pike.git / lib / modules / ADT.pmod / Table.pmod

version» Context lines:

pike.git/lib/modules/ADT.pmod/Table.pmod:110:    return col(column);    }       //! This method compares two tables. They are equal if the contents    //! of the tables and the column names are equal. The column name    //! comparison is case insensitive.    int `==(object table)    {    return (equal(Array.map(fields, lower_case),    Array.map(indices(table), lower_case)) && -  equal(this_program::table, values(table))); +  equal(this::table, values(table)));    }       //! This method appends two tables. The table given as an argument will be    //! added at the bottom of the current table. Note, the column names must    //! be equal. The column name comparison is case insensitive.    object append_bottom(object table)    {    if(!equal(Array.map(indices(table), lower_case),    Array.map(fields, lower_case)))    TABLE_ERR("Table fields are not equal."); -  return copy(this_program::table+values(table), fields, types); +  return copy(this::table+values(table), fields, types);    }       //! This method appends two tables. The table given as an argument will be    //! added on the right side of the current table. Note that the number of    //! rows in both tables must be equal.    object append_right(object table)    { -  if(sizeof(table) != sizeof(this_program::table)) +  if(sizeof(table) != sizeof(this::table))    TABLE_ERR("Table sizes are not equal.");    array v = values(table); -  for(int r = 0; r < sizeof(this_program::table); r++) -  v[r] = this_program::table[r] + v[r]; +  for(int r = 0; r < sizeof(this::table); r++) +  v[r] = this::table[r] + v[r];    return copy(v, fields+indices(table), types+table->all_types());    }       protected private mixed op_col(function f, int|string c, mixed ... args)    {    c = remap(c);    mixed x = table[0][c];    for(int r = 1; r < sizeof(table); r++)    f(x, table[r][c], @args);    return x;
pike.git/lib/modules/ADT.pmod/Table.pmod:394:    if(!arrayp(table))    TABLE_ERR("Table not array");    if(!arrayp(column_names))    TABLE_ERR("Fields not array");    if(sizeof(table) && sizeof(table[0]) != sizeof(column_names))    TABLE_ERR("Table and field sizes differ");    foreach(column_names, string s)    if(!stringp(s))    TABLE_ERR("Field name not string");    -  this_program::table = copy_value(table); +  this::table = copy_value(table);    fields = copy_value(column_names);    types = allocate(sizeof(column_names));       if(column_types)    for(int i = 0; i < sizeof(fields); i++)    if(!column_types[i] || mappingp(column_types[i]))    types[i] = copy_value(column_types[i]);    else    TABLE_ERR("Field type not mapping");