pike.git / lib / modules / Debug.pmod / Subject.pike

version» Context lines:

pike.git/lib/modules/Debug.pmod/Subject.pike:9:   //! object.   //!   //! @example   //! > object s = Debug.Subject();   //! create()   //! > random(s);   //! _random()   //! (1) Result: 0   //! > abs(s);   //! `<(0) - //! _sprintf(79, ([ "indent":2 ])) + //! _sprintf(79, ([ ]))   //! (2) Result: Debug.Subject   //! > abs(class { inherit Debug.Subject; int `<(mixed ... args) { return 1; } }());   //! create()   //! `-() - //! destroy() + //! _destruct()   //! (3) Result: 0   //! > pow(s,2);   //! `[]("pow")   //! Attempt to call the NULL-value   //! Unknown program: 0(2)      #define ENTER(X) \    string t = sprintf("%{%O, %}", args); \    werror("%s%s(%s)\n", id, #X, \    has_suffix(t, ", ") ? t[..<2] : t)
pike.git/lib/modules/Debug.pmod/Subject.pike:37:      protected string id = "";      void create(mixed ... args)   {    ENTER(create);    if(sizeof(args)==1 && stringp(args[0]))    id = "(" + args[0] + ") ";   }    - void PROXY(destroy, 0); + void PROXY(_destruct, 0);      mixed PROXY(`->, 0);   mixed PROXY(`->=, 0);   mixed PROXY(`[], 0);   mixed PROXY(`[]=, 0);      mixed PROXY(`+, 0);   mixed PROXY(`-, 0);   mixed PROXY(`&, 0);   mixed PROXY(`|, 0);
pike.git/lib/modules/Debug.pmod/Subject.pike:100:    ENTER(_get_iterator);    string iid = id==""?"":id[1..<2];    return this_program("("+iid+" iterator) ");   }      string _sprintf(int|void t, mapping|void opt, mixed ... x)   {    string args = "";    if(t)    args += sprintf("'%c'", t); -  if(opt == ([])) -  args += ", ([])"; -  else if(opt) +  if(opt)    {    string tmp = sprintf("%O", opt); -  sscanf(tmp, "([ /*%*s*/\n %s\n])", tmp); -  args += sprintf(", ([ %s ])", replace(tmp, "\n ", "")); +  string a,b; int c; +  if( sscanf(tmp, "%s /* 1 element */%s", a, b)==2 || +  sscanf(tmp, "%s /* %d elements */%s", a, c, b)==3 ) +  tmp = a+b; +  args += sprintf(", %s", String.normalize_space(tmp));    }    string tmp = sprintf("%{%O, %}", x);    if(has_suffix(tmp, ", "))    tmp = tmp[..<2];    if(sizeof(tmp))    args += ", " + tmp;    werror("%s_sprintf(%s)\n", id, args);    return "Debug.Subject" + id[..<1];   }      mixed PROXY(_random, 0);