--- parser3/src/targets/parser/Attic/parser.C 2001/01/30 13:43:43 1.3 +++ parser3/src/targets/parser/Attic/parser.C 2001/02/13 10:50:24 1.6 @@ -1,5 +1,5 @@ /* - $Id: parser.C,v 1.3 2001/01/30 13:43:43 paf Exp $ + $Id: parser.C,v 1.6 2001/02/13 10:50:24 paf Exp $ */ #include @@ -9,7 +9,7 @@ #include "pa_array.h" #include "pa_table.h" #include "pa_common.h" -#include "pool.h" +#include "pa_pool.h" char *itoa(int n, char *buf){ snprintf(buf,MAX_STRING,"%d",n); @@ -19,10 +19,10 @@ char *itoa(int n, char *buf){ int main(int argc, char *argv[]) { Exception fatal_exception; if(EXCEPTION_TRY(fatal_exception)) { - parser_Pool pool(fatal_exception); + Pool pool(fatal_exception); char *file="file1"; - String& string=pool.make_string(); + String& string=*new(pool) String(pool); string.APPEND("Hello, ", file, 1); string.APPEND("w", file, 2); string.APPEND("o", file, 3); @@ -33,12 +33,12 @@ int main(int argc, char *argv[]) { printf(string.cstr()); char *key1_file="key1_file"; - Hash& hash=pool.make_hash(); + Hash& hash=*new(pool) Hash(pool, false); String key1=string; key1.APPEND("1", key1_file, 1); - String& value1=pool.make_string(); + String& value1=*new(pool) String(pool); value1.APPEND("i'm value1\n", file, 1); - String& value2=pool.make_string(); + String& value2=*new(pool) String(pool); value2.APPEND("i'm value2\n", file, 1); hash.put(key1, &value1); char *key2_file="key2_file"; @@ -48,12 +48,12 @@ int main(int argc, char *argv[]) { String *found_value=(String*)hash.get(key2); printf(found_value?found_value->cstr():"not found\n"); - String& a=pool.make_string(); a.APPEND("fi", file, 1); a.APPEND("rst", file, 2); - String& b=pool.make_string(); b.APPEND("fir", file, 1); b.APPEND("st", file, 2); + String& a=*new(pool) String(pool); a.APPEND("fi", file, 1); a.APPEND("rst", file, 2); + String& b=*new(pool) String(pool); b.APPEND("fir", file, 1); b.APPEND("st", file, 2); printf(a==b?"eq\n":"ne\n"); - Array& array=pool.make_array(2); + Array& array=*new(pool) Array(pool, 2); array+="first"; array+="second"; array+="third"; @@ -62,18 +62,18 @@ int main(int argc, char *argv[]) { array.get_cstr(1), array.get_cstr(2)); - Array& a1=pool.make_array(); + Array& a1=*new(pool) Array(pool); a1+="first"; - Array& a2=pool.make_array(); + Array& a2=*new(pool) Array(pool); a2+="second"; - Array& asum=pool.make_array(); + Array& asum=*new(pool) Array(pool); asum.append_array(a1); asum.append_array(a2); printf("%s-%s\n", asum.get_cstr(0), asum.get_cstr(1)); - parser_Pool request_pool(fatal_exception); + Pool request_pool(fatal_exception); Request request(request_pool); Exception operator_exception; @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) { */ Table table(request, "_file.cfg", 1, 0); for(int n=1; n<=5; n++) { - Array& row=request.pool().make_array(3/*table.columns()->size()*/); + Array& row=*new(request.pool()) Array(request.pool(), 3/*table.columns()->size()*/); char *buf=static_cast(request.pool().malloc(MAX_STRING)); row+=itoa(n, buf); row+="paf"; @@ -120,6 +120,30 @@ int main(int argc, char *argv[]) { } printf("%s\n", line.cstr()); } + + + String it(request.pool()); + it.APPEND("ab.cd[zzz]", 0,0); + String_iterator si(it); + /*si++; + si++; + si++; + si++; + si++; + si++; + */ + /*bool found=si.skip_to('.'); + si++; + */ + si++; + Char_types types; + types.set(' ', 1); + types.set('[', 2); + types.set(']', 3); + int type=si.skip_to(types); + si++; + + } else { Exception& e=request.exception(); printf("operator_error occured: %s\n", e.comment());