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.353 2004/07/04 14:30:09 mast Exp $ + // $Id: master.pike.in,v 1.354 2004/07/04 14:51:19 mast Exp $      #pike __REAL_VERSION__   //#pragma strict_types      // Some programs destroys character pairs beginning with the currency   // symbol when running in chinese locale.   #if "ยค/" != "\244/"   #error "master.pike.in is corrupted."   #endif   
pike.git/lib/master.pike.in:4219:    void decode_object(object o, mixed data)    {    DEC_MSG ("decode_object (object(%O), %O)\n", object_program (o), data);    if(!o->_decode)    error ("Cannot decode object(%O) without _decode function.\n",    object_program (o));    ([function(mixed:void)]o->_decode)(data);    }   }    - mapping(string:Decoder) codecs = set_weak_flag(([]),1); + // Note: This mapping is not for caching but for coping with recursion + // problems by returning the same codec for the same file. As a cache + // it's really pointless. + static mapping(string:Decoder) codecs = set_weak_flag (([]), 1); +    Decoder get_codec(string|void fname, int|void mkobj, void|object handler)   {    if (handler) -  // Maybe cache these too? Not done right now since explicit -  // handlers are fairly rare. Note that caching easily could -  // introduce a cyclic ref through Decoder.handler. +  // Decoders are currently not reused in this case since it's +  // tricky to set up a weak multilevel mapping for lookup. This is +  // seldom a problem since explicit handlers are fairly rare. If it +  // is then the handler can always override this function.    return Decoder (fname, mkobj, handler);    string key = fname + "\0" + mkobj;    if (codecs[key]) return codecs[key];    return codecs[key] = Decoder(fname, mkobj);   }      class Codec   //! @appears Pike.Codec   //!   //! @[Encoder] and @[Decoder] rolled into one. This is for mainly