Diff for /parser3/src/classes/table.C between versions 1.67 and 1.72

version 1.67, 2001/04/28 13:49:14 version 1.72, 2001/05/08 06:00:34
Line 12 Line 12
   
 #include "pcre.h"  #include "pcre.h"
   
 #include "pa_methoded.h"  #include "classes.h"
 #include "pa_common.h"  #include "pa_common.h"
 #include "pa_request.h"  #include "pa_request.h"
 #include "pa_vtable.h"  #include "pa_vtable.h"
 #include "pa_vint.h"  #include "pa_vint.h"
 #include "pa_sql_connection.h"  #include "pa_sql_connection.h"
 #include "pa_dir.h"  #include "pa_dir.h"
   #include "pa_vbool.h"
   
 // defines  // defines
   
Line 28 Line 29
   
 class MTable : public Methoded {  class MTable : public Methoded {
 public: // VStateless_class  public: // VStateless_class
           
         Value *create_new_value(Pool& pool) { return new(pool) VTable(pool); }          Value *create_new_value(Pool& pool) { return new(pool) VTable(pool); }
   
 public:  public:
         MTable(Pool& pool);          MTable(Pool& pool);
         bool used_directly() { return true; }  
   
   public: // Methoded
           bool used_directly() { return true; }
 };  };
   
 // methods  // methods
Line 328  static void _sort(Request& r, const Stri Line 329  static void _sort(Request& r, const Stri
 }  }
   
 static void _locate(Request& r, const String& method_name, MethodParams *params) {  static void _locate(Request& r, const String& method_name, MethodParams *params) {
           Pool& pool=r.pool();
   
         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(          Value& result=*new(pool) VBool(pool, table.locate(
                 params->get(0).as_string(),                  params->get(0).as_string(),
                 params->get(1).as_string());                  params->get(1).as_string()));
 }          result.set_name(method_name);
           r.write_no_lang(result);
 static void _found(Request& r, const String& method_name, MethodParams *params) {  
         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")));  
         else if(params->size()==2)  
                 r.write_pass_lang(r.process(params->get_junction(0, "else-parameter must be code")));  
 }  }
   
 static void _flip(Request& r, const String& method_name, MethodParams *params) {  static void _flip(Request& r, const String& method_name, MethodParams *params) {
Line 411  static void _join(Request& r, const Stri Line 409  static void _join(Request& r, const Stri
         }          }
 }  }
   
 /// ^table:sql{query}[(count[;offset])]  
 static void _sql(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();
   
Line 487  static void _sql(Request& r, const Strin Line 484  static void _sql(Request& r, const Strin
         static_cast<VTable *>(r.self)->set_table(table);          static_cast<VTable *>(r.self)->set_table(table);
 }  }
   
 /// ^table:dir[path]  
 /// ^table:dir[path][regexp]  
 static void _dir(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();
   
Line 548  static void _dir(Request& r, const Strin Line 543  static void _dir(Request& r, const Strin
                         char *file_name_cstr=(char *)r.malloc(file_name_size);                          char *file_name_cstr=(char *)r.malloc(file_name_size);
                         memcpy(file_name_cstr, ffblk.ff_name, file_name_size);                          memcpy(file_name_cstr, ffblk.ff_name, file_name_size);
                         String &file_name=*new(pool) String(pool);                          String &file_name=*new(pool) String(pool);
                         file_name.APPEND_TAINTED(file_name_cstr, file_name_size,                           file_name.APPEND(file_name_cstr, file_name_size, String::UL_FILE_NAME,
                                 method_name.origin().file, method_name.origin().line);                                  method_name.origin().file, method_name.origin().line);
                                   
                         Array& row=*new(pool) Array(pool);                          Array& row=*new(pool) Array(pool);
Line 608  MTable::MTable(Pool& apool) : Methoded(a Line 603  MTable::MTable(Pool& apool) : Methoded(a
   
         // ^table.locate[field;value]          // ^table.locate[field;value]
         add_native_method("locate", Method::CT_DYNAMIC, _locate, 2, 2);          add_native_method("locate", Method::CT_DYNAMIC, _locate, 2, 2);
         // ^table.found{when-found}  
         // ^table.found{when-found}{when-not-found}  
         add_native_method("found", Method::CT_DYNAMIC, _found, 1, 2);  
   
         // ^table.flip[]          // ^table.flip[]
         add_native_method("flip", Method::CT_DYNAMIC, _flip, 0, 0);          add_native_method("flip", Method::CT_DYNAMIC, _flip, 0, 0);

Removed from v.1.67  
changed lines
  Added in v.1.72


E-mail: