--- parser3/src/classes/op.C 2001/09/05 09:02:52 1.40 +++ parser3/src/classes/op.C 2001/09/28 15:58:26 1.46 @@ -2,10 +2,10 @@ Parser: parser @b operators. Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + + $Id: op.C,v 1.46 2001/09/28 15:58:26 parser Exp $ */ -static const char *RCSId="$Id: op.C,v 1.40 2001/09/05 09:02:52 parser Exp $"; #include "classes.h" #include "pa_config_includes.h" @@ -186,7 +186,7 @@ static void _for(Request& r, const Strin &method_name, "endless loop detected"); vint->set_int(i); - r.root->put_element(var_name, vint); + r.self/*root*/->put_element(var_name, vint); Value& processed_body=r.process(body_code); if(delim_code) { // delimiter set? @@ -218,7 +218,7 @@ static void _eval(Request& r, const Stri } -static void _connect(Request& r, const String&, MethodParams *params) { +static void _connect(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); Value& url=params->as_no_junction(0, "url must not be code"); @@ -229,7 +229,7 @@ static void _connect(Request& r, const S // connect SQL_Connection& connection=SQL_driver_manager->get_connection( - url.as_string(), protocol2driver_and_client); + url.as_string(), method_name, protocol2driver_and_client); Exception rethrow_me; // remember/set current connection @@ -267,12 +267,13 @@ static void _connect(Request& r, const S rethrow_me.comment()); } +#ifndef DOXYGEN struct Switch_data { Value *searching; Value *found; Value *_default; }; - +#endif static void _switch(Request& r, const String&, MethodParams *params) { void *backup=r.classes_conf.get(*switch_data_name); Switch_data data={&r.process(params->get(0))}; @@ -374,6 +375,68 @@ Methoded *MOP_create(Pool& pool) { return new(pool) MOP(pool); } +/* +static void element2ctypes(unsigned char *tables, + Value& ctype, const String& name, + unsigned char bit, + int group_offset=-1, + bool skip_ws=true) { + Value *value=ctype.get_element(name); + if(!value) + return; + + unsigned char *ctypes_table=tables+ctypes_offset; + const unsigned char *cstr= + (const unsigned char *)value->as_string().cstr(String::UL_AS_IS); + for(; *cstr; cstr++) { + unsigned char c=*cstr; + if(skip_ws && (c=='\n' || c=='\t' || c==' ')) + continue; + ctypes_table[c]|=bit; + + if(group_offset>=0) + tables[cbits_offset+group_offset+c/8] |= 1 << (c%8); + } +} +static void cstr2ctypes(unsigned char *tables, const unsigned char *cstr, + unsigned char bit) { + unsigned char *ctypes_table=tables+ctypes_offset; + ctypes_table[0]=bit; + for(; *cstr; cstr++) { + unsigned char c=*cstr; + ctypes_table[c]|=bit; + } +} +static void prepare_case_tables(unsigned char *tables) { + unsigned char *lcc_table=tables+lcc_offset; + unsigned char *fcc_table=tables+fcc_offset; + for(int i=0; i<0x100; i++) + lcc_table[i]=fcc_table[i]=i; +} +static void element2case(unsigned char *tables, Value& ctype, const String& name) { + Value *value=ctype.get_element(name); + if(!value) + return; + + unsigned char *lcc_table=tables+lcc_offset; + unsigned char *fcc_table=tables+fcc_offset; + const unsigned char *cstr= + (const unsigned char *)value->as_string().cstr(String::UL_AS_IS); + unsigned char from=0; + for(; *cstr; cstr++) { + unsigned char c=*cstr; + if(c=='\n' || c=='\t' || c==' ') + continue; + if(from) { + lcc_table[from]=c; + fcc_table[from]=c; fcc_table[c]=from; + from=0; + } else + from=c; + } +} + +*/ void MOP::configure_user(Request& r) { Pool& pool=r.pool(); @@ -383,4 +446,7 @@ void MOP::configure_user(Request& r) { if(Value *element=sql->get_element(main_sql_drivers_name)) if(Table *protocol2library=element->get_table()) r.classes_conf.put(name(), protocol2library); + + + }