|
|
| version 1.65.2.2, 2001/04/27 17:17:58 | version 1.65.2.4, 2001/04/28 08:30:23 |
|---|---|
| Line 39 public: | Line 39 public: |
| // methods | // methods |
| void _set(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _set(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| // data is last parameter | // data is last parameter |
| Value& vdata=params->get_junction(params->size()-1, "body must be code"); | Value& vdata=params->get_junction(params->size()-1, "body must be code"); |
| Line 81 void _set(Methoded& m, Request& r, const | Line 81 void _set(Methoded& m, Request& r, const |
| static_cast<VTable *>(r.self)->set_table(table); | static_cast<VTable *>(r.self)->set_table(table); |
| } | } |
| void _load(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _load(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| // filename is last parameter | // filename is last parameter |
| Value& vfilename=params->get_no_junction(params->size()-1, | Value& vfilename=params->get_no_junction(params->size()-1, |
| Line 130 void _load(Methoded& m, Request& r, cons | Line 130 void _load(Methoded& m, Request& r, cons |
| static_cast<VTable *>(r.self)->set_table(table); | static_cast<VTable *>(r.self)->set_table(table); |
| } | } |
| void _save(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _save(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Value& vtable_name=params->get_no_junction(params->size()-1, | Value& vtable_name=params->get_no_junction(params->size()-1, |
| "file name must not be code"); | "file name must not be code"); |
| Line 177 void _save(Methoded& m, Request& r, cons | Line 177 void _save(Methoded& m, Request& r, cons |
| sdata.cstr(), sdata.size(), true); | sdata.cstr(), sdata.size(), true); |
| } | } |
| void _count(Methoded& m, Request& r, const String&, MethodParams *) { | static void _count(Request& r, const String&, MethodParams *) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Value& value=*new(pool) VInt(pool, static_cast<VTable *>(r.self)->table().size()); | Value& value=*new(pool) VInt(pool, static_cast<VTable *>(r.self)->table().size()); |
| r.write_no_lang(value); | r.write_no_lang(value); |
| } | } |
| void _line(Methoded& m, Request& r, const String& method_name, MethodParams *) { | static void _line(Request& r, const String& method_name, MethodParams *) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Value& value=*new(pool) VInt(pool, 1+static_cast<VTable *>(r.self)->table().current()); | Value& value=*new(pool) VInt(pool, 1+static_cast<VTable *>(r.self)->table().current()); |
| r.write_no_lang(value); | r.write_no_lang(value); |
| } | } |
| void _offset(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _offset(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Table& table=static_cast<VTable *>(r.self)->table(); | Table& table=static_cast<VTable *>(r.self)->table(); |
| if(params->size()) | if(params->size()) |
| Line 200 void _offset(Methoded& m, Request& r, co | Line 200 void _offset(Methoded& m, Request& r, co |
| } | } |
| } | } |
| void _menu(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _menu(Request& r, const String& method_name, MethodParams *params) { |
| Value& body_code=params->get_junction(0, "body must be code"); | Value& body_code=params->get_junction(0, "body must be code"); |
| Value *delim_code=params->size()==2?¶ms->get(1):0; | Value *delim_code=params->size()==2?¶ms->get(1):0; |
| Line 224 void _menu(Methoded& m, Request& r, cons | Line 224 void _menu(Methoded& m, Request& r, cons |
| table.set_current(saved_current); vtable.unlock(); | table.set_current(saved_current); vtable.unlock(); |
| } | } |
| void _empty(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _empty(Request& r, const String& method_name, MethodParams *params) { |
| Table& table=static_cast<VTable *>(r.self)->table(); | Table& table=static_cast<VTable *>(r.self)->table(); |
| if(table.size()==0) | if(table.size()==0) |
| r.write_pass_lang(r.process(params->get(0))); | r.write_pass_lang(r.process(params->get(0))); |
| Line 249 static void store_column_item_to_hash(Ar | Line 249 static void store_column_item_to_hash(Ar |
| value=new(*ri.pool) VUnknown(*ri.pool); | value=new(*ri.pool) VUnknown(*ri.pool); |
| ri.hash->put(column_name, value); | ri.hash->put(column_name, value); |
| } | } |
| void _record(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _record(Request& r, const String& method_name, MethodParams *params) { |
| Table& table=static_cast<VTable *>(r.self)->table(); | Table& table=static_cast<VTable *>(r.self)->table(); |
| if(const Array *columns=table.columns()) { | if(const Array *columns=table.columns()) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Line 284 static int sort_cmp_double(const void *a | Line 284 static int sort_cmp_double(const void *a |
| else | else |
| return 0; | return 0; |
| } | } |
| void _sort(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _sort(Request& r, const String& method_name, MethodParams *params) { |
| Value& key_maker=params->get_junction(0, "key-maker must be code"); | Value& key_maker=params->get_junction(0, "key-maker must be code"); |
| bool reverse=params->size()==2/*..[asc|desc]*/? | bool reverse=params->size()==2/*..[asc|desc]*/? |
| Line 327 void _sort(Methoded& m, Request& r, cons | Line 327 void _sort(Methoded& m, Request& r, cons |
| table.set_current(0); | table.set_current(0); |
| } | } |
| void _locate(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _locate(Request& r, const String& method_name, MethodParams *params) { |
| VTable& vtable=*static_cast<VTable *>(r.self); | VTable& vtable=*static_cast<VTable *>(r.self); |
| Table& table=vtable.table(); | Table& table=vtable.table(); |
| vtable.last_locate_was_successful=table.locate( | vtable.last_locate_was_successful=table.locate( |
| Line 335 void _locate(Methoded& m, Request& r, co | Line 335 void _locate(Methoded& m, Request& r, co |
| params->get(1).as_string()); | params->get(1).as_string()); |
| } | } |
| void _found(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _found(Request& r, const String& method_name, MethodParams *params) { |
| if(static_cast<VTable *>(r.self)->last_locate_was_successful) | if(static_cast<VTable *>(r.self)->last_locate_was_successful) |
| r.write_pass_lang(r.process(params->get_junction(0, "found-parameter must be code"))); | r.write_pass_lang(r.process(params->get_junction(0, "found-parameter must be code"))); |
| else if(params->size()==2) | else if(params->size()==2) |
| r.write_pass_lang(r.process(params->get_junction(0, "else-parameter must be code"))); | r.write_pass_lang(r.process(params->get_junction(0, "else-parameter must be code"))); |
| } | } |
| void _flip(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _flip(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| VTable& vtable=*static_cast<VTable *>(r.self); | VTable& vtable=*static_cast<VTable *>(r.self); |
| Line 362 void _flip(Methoded& m, Request& r, cons | Line 362 void _flip(Methoded& m, Request& r, cons |
| vtable.set_table(new_table); | vtable.set_table(new_table); |
| } | } |
| void _append(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _append(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| // data is last parameter | // data is last parameter |
| const String& string= | const String& string= |
| Line 372 void _append(Methoded& m, Request& r, co | Line 372 void _append(Methoded& m, Request& r, co |
| Array& row=*new(pool) Array(pool); | Array& row=*new(pool) Array(pool); |
| string.split(row, 0, "\t", 1, String::UL_CLEAN); | string.split(row, 0, "\t", 1, String::UL_CLEAN); |
| static_cast<VTable *>(r.self)->table()+=&row; | VTable& vtable=*static_cast<VTable *>(r.self); |
| // disable ^a.menu{^a.append[]} | |
| vtable.lock(); | |
| vtable.table()+=&row; | |
| vtable.unlock(); | |
| } | } |
| void _join(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _join(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Table *maybe_src=params->get_no_junction(0, "table ref must not be code").get_table(); | Table *maybe_src=params->get_no_junction(0, "table ref must not be code").get_table(); |
| Line 408 void _join(Methoded& m, Request& r, cons | Line 412 void _join(Methoded& m, Request& r, cons |
| } | } |
| /// ^table:sql{query}[(count[;offset])] | /// ^table:sql{query}[(count[;offset])] |
| void _sql(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _sql(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| if(!r.connection) | if(!r.connection) |
| Line 485 void _sql(Methoded& m, Request& r, const | Line 489 void _sql(Methoded& m, Request& r, const |
| /// ^table:dir[path] | /// ^table:dir[path] |
| /// ^table:dir[path][regexp] | /// ^table:dir[path][regexp] |
| void _dir(Methoded& m, Request& r, const String& method_name, MethodParams *params) { | static void _dir(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Value& relative_path=params->get_no_junction(0, "path must not be code"); | Value& relative_path=params->get_no_junction(0, "path must not be code"); |
| Line 562 void _dir(Methoded& m, Request& r, const | Line 566 void _dir(Methoded& m, Request& r, const |
| // constructor | // constructor |
| MTable::MTable(Pool& pool) : Methoded(pool) { | MTable::MTable(Pool& apool) : Methoded(apool) { |
| set_name(NEW String(pool, TABLE_CLASS_NAME)); | set_name(*NEW String(pool(), TABLE_CLASS_NAME)); |
| // ^table:set{data} | // ^table:set{data} |
| // ^table:set[nameless]{data} | // ^table:set[nameless]{data} |