Diff for /parser3/src/classes/table.C between versions 1.131 and 1.133

version 1.131, 2001/11/20 17:58:47 version 1.133, 2001/11/22 15:47:12
Line 208  static void _offset(Request& r, const St Line 208  static void _offset(Request& r, const St
         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()) {
                 Value& offset_expr=params->as_junction(0, "offset must be expression");                  bool absolute=false;
                 table.shift(r.process(offset_expr).as_int());                  if(params->size()>1) {
                       const String& whence=params->as_string(0, "whence must be string");
                       if(whence=="cur")
                           absolute=false;
                       else if(whence=="set")
                           absolute=true;
                       else
                           throw Exception(0, 0,
                               &whence,
                               "is invalid whence, valid are 'cur' or 'set'");
                   }
                       
                   
                   Value& offset_expr=params->as_junction(params->size()-1, "offset must be expression");
                   table.offset(absolute, r.process(offset_expr).as_int());
         } else {          } else {
                 Value& value=*new(pool) VInt(pool, table.current());                  Value& value=*new(pool) VInt(pool, table.current());
                 value.set_name(method_name);                  value.set_name(method_name);
Line 467  public: Line 481  public:
                 statement_string(astatement_string),                  statement_string(astatement_string),
                 statement_cstr(astatement_cstr),                  statement_cstr(astatement_cstr),
                 columns(*new(pool) Array(pool)),                  columns(*new(pool) Array(pool)),
                 row(0),                   row(0), row_index(0),
                 table(0)                  table(0)
         {          {
         }          }
Line 490  public: Line 504  public:
                 if(size)                  if(size)
                         cell->APPEND_TAINTED(                          cell->APPEND_TAINTED(
                                 (const char *)ptr, size,                                   (const char *)ptr, size, 
                                 statement_cstr, table->size()-1);                                  statement_cstr, row_index++);
                 (*row)+=cell;                  (*row)+=cell;
         }          }
   
Line 500  private: Line 514  private:
         const String& statement_string; const char *statement_cstr;          const String& statement_string; const char *statement_cstr;
         Array& columns;          Array& columns;
         Array *row;          Array *row;
           uint row_index;
 public:  public:
         Table *table;          Table *table;
 };  };
Line 601  MTable::MTable(Pool& apool) : Methoded(a Line 616  MTable::MTable(Pool& apool) : Methoded(a
         add_native_method("line", Method::CT_DYNAMIC, _line, 0, 0);          add_native_method("line", Method::CT_DYNAMIC, _line, 0, 0);
   
         // ^table.offset[]            // ^table.offset[]  
         // ^table.offset[offset]          // ^table.offset(offset)
         add_native_method("offset", Method::CT_DYNAMIC, _offset, 0, 1);          // ^table.offset[cur|set](offset)
           add_native_method("offset", Method::CT_DYNAMIC, _offset, 0, 2);
   
         // ^table.menu{code}            // ^table.menu{code}  
         // ^table.menu{code}[delim]          // ^table.menu{code}[delim]

Removed from v.1.131  
changed lines
  Added in v.1.133


E-mail: