Branch: Tag:

1999-12-21

1999-12-21 12:06:47 by Fredrik Noring <noring@nocrew.org>

Changed declaration from string to int.

Rev: lib/modules/ADT.pmod/Table.pmod:1.11

1:   // Table.pmod by Fredrik Noring, 1998 - // $Id: Table.pmod,v 1.10 1999/11/25 00:55:54 hubbe Exp $ + // $Id: Table.pmod,v 1.11 1999/12/21 12:06:47 noring Exp $      #define TABLE_ERR(msg) throw(({ "(Table) "+msg+"\n", backtrace() }))   
42:    switch(type) {    case "array":    return copy_value(table); - #if 0 // This works only in Pike 0.6. +     case "string":    return ASCII->encode(this_object()); - #endif +     }    }   
328:   object ASCII = class {    object decode(string s, void|mapping options)    { -  // Yet to be done +  // Yet to be done.    return 0;    }   
340:    string indent = String.strmult(" ", options->indent);       t = t->copy(({ fields }) + values(t)); -  foreach(indices(fields), string field) -  t = (t->map(lambda(mixed m, string field, mapping sizes) -  { m = (string)m; +  for(int field = 0; field < sizeof(fields); field++) +  t = (t->map(lambda(mixed m, int field, mapping sizes) +  { +  m = (string)m;    sizes[field] = max(sizeof(m), sizes[field]); -  return m; }, field, field, sizes)-> +  return m; +  }, +  field, field, sizes)->    map(lambda(string s, string size, int num) -  { return sprintf("%"+(num?"":"-")+size+"s", s); }, +  { +  return sprintf("%"+(num?"":"-")+size+"s", s); +  },    field, (string)sizes[field],    (t->type(field)||([]))->type == "num"));