pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1:   // -*- Pike -*-   //   // Master Control Program for Pike.   //   // This file is part of Pike. For copyright information see COPYRIGHT.   // Pike is distributed under GPL, LGPL and MPL. See the file COPYING   // for more information.   // - // $Id: master.pike.in,v 1.283 2003/05/31 11:03:16 mast Exp $ + // $Id: master.pike.in,v 1.284 2003/05/31 11:05:35 mast Exp $      #pike __REAL_VERSION__      // Some programs destroys character pairs beginning with the currency   // symbol when running in chinese locale.   #if "ยค/" != "\244/"   #error "master.pike.in is corrupted."   #endif      // --- Some configurable parameters
pike.git/lib/master.pike.in:3151:   //!   //! All lowercase letters and the symbols ':', '/' and '.' are   //! reserved for internal use in both cases where characters are used   //! above.   {    mixed encoded;       static mapping(mixed:string) rev_constants = ([]);    static mapping(mixed:string) rev_static_modules = ([]);    -  static array(string) find_index (object|program parent, mixed child) +  static array find_index (object|program parent, mixed child)    {    array id;       find_id: {    array vals = values (parent);    int i = search (vals, child);    if (i >= 0)    id = ({indices (parent)[i]});    else {    // Try again with the programs of the objects in parent, since
pike.git/lib/master.pike.in:3179:    error ("Cannot find %O in %O.\n", child, parent);    }    }       if (!stringp (id[0]))    error ("Got nonstring index %O for %O in %O.\n", id[0], child, parent);       return id;    }    -  string|array(string) nameof (mixed what) +  string|array nameof (mixed what)    {    ENC_MSG ("nameof (%t %O)\n", what, what);       if (what == encoded) {    ENC_MSG (" got the thing to encode - encoding recursively\n");    return UNDEFINED;    }       if (string id = rev_constants[what]) ENC_RETURN (id);    if (string id = rev_static_modules[what]) ENC_RETURN (id);
pike.git/lib/master.pike.in:3218:   #endif    }       if (what->_encode) {    ENC_MSG (" object got _encode function - encoding recursively\n");    return UNDEFINED;    }       if (function|program prog = object_program (what))    if (object|program parent = function_object (prog) || function_program (prog)) { -  string|array(string) parent_name = nameof (parent); +  string|array parent_name = nameof (parent);    if (!parent_name) {    ENC_MSG (" inside the thing to encode - encoding recursively\n");    return UNDEFINED;    }    else {    // If we did an object_program step in the recursive nameof to get    // the parent then we'll always be able to do a better job if we    // base the indexing on the corresponding object instead.      #define CONVERT_PARENT_TO_OBJ(parent_name, parent) \    if (arrayp (parent_name) && parent_name[-1] == 'p') { \    object|program grandparent = \    objectp (parent) ? object_program (parent) : parent; \    grandparent = \    function_object (grandparent) || function_program (grandparent); \    parent = grandparent[parent_name[-2]]; \    parent_name = parent_name[..sizeof (parent_name) - 2]; \    }       CONVERT_PARENT_TO_OBJ (parent_name, parent); -  array(string) id = find_index (parent, what); +  array id = find_index (parent, what);    ENC_RETURN ((arrayp (parent_name) ? parent_name : ({parent_name})) + id);    }    }       error ("Failed to find name of unencodable object %O.\n", what);    }       if (programp (what) || functionp (what)) {    if (string path = programs_reverse_lookup (what)) {   #ifdef PIKE_MODULE_RELOC    ENC_RETURN ("p" + unrelocate_module (path));   #else    ENC_RETURN ("p" + path);   #endif    }       if (object|program parent = function_object (what) || function_program (what)) { -  string|array(string) parent_name = nameof (parent); +  string|array parent_name = nameof (parent);    if (!parent_name) {    ENC_MSG (" inside the thing to encode - encoding recursively\n");    return UNDEFINED;    }    else { -  string|array(string) id = function_name (what); +  string|array id = function_name (what);    if (stringp (id)) id = ({id});    else {    CONVERT_PARENT_TO_OBJ (parent_name, parent);    id = find_index (parent, what);    }    ENC_RETURN ((arrayp (parent_name) ? parent_name : ({parent_name})) + id);    }    }       error ("Failed to find name of %t %O.\n", what, what);
pike.git/lib/master.pike.in:3342:    if(unregistered && fname)    {    unregistered = 0;    programs[fname]=p;    if (mkobj)    DEC_RETURN (objectp (objects[p]) ? objects[p] : (objects[p]=__null_program()));    }    DEC_RETURN (0);    }    -  static mixed thingof (string|array(string) what) +  static mixed thingof (string|array what)    {    mixed res; -  array(string) sublist; +  array sublist;    if (arrayp (what)) sublist = what, what = sublist[0];       switch (what[0]) {    case 'c':    if (zero_type (res = all_constants()[what[1..]]))    error ("Cannot find global constant %O.\n", what[1..]);    break;    case 's':    if (zero_type (res = _static_modules[what[1..]]))    error ("Cannot find %O in _static_modules.\n", what[1..]);
pike.git/lib/master.pike.in:3394:    subres = object_program (subres);    else    error ("Unknown sublist operation %O in %O\n", op, what);    }    res = subres;    }       return res;    }    -  object objectof (string|array(string) what) +  object objectof (string|array what)    {    DEC_MSG ("objectof (%O)\n", what);    mixed res = thingof (what);    if (!objectp (res)) error ("Expected object for %O, got %O.\n", what, res);    DEC_RETURN ([object] res);    }    -  function functionof (string|array(string) what) +  function functionof (string|array what)    {    DEC_MSG ("functionof (%O)\n", what);    mixed res = thingof (what);    if (!functionp (res)) error ("Expected function for %O, got %O.\n", what, res);    DEC_RETURN ([function] res);    }    -  program programof (string|array(string) what) +  program programof (string|array what)    {    DEC_MSG ("programof (%O)\n", what);    mixed res = thingof (what);    if (!programp (res)) error ("Expected program for %O, got %O.\n", what, res);    DEC_RETURN ([program] res);    }       void decode_object(object o, mixed data)    {    DEC_MSG ("decode_object (object(%O), %O)\n", object_program (o), data);