pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c:1:   /*   || 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: encode.c,v 1.224 2004/11/12 13:05:27 grubba Exp $ + || $Id: encode.c,v 1.225 2004/12/18 15:45:04 grubba Exp $   */      #include "global.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "mapping.h"
pike.git/src/encode.c:1612:   #endif   }      static void free_encode_data(struct encode_data *data)   {    toss_buffer(& data->buf);    free_mapping(data->encoded);    free_array(data->delayed);   }    - /*! @decl string encode_value(mixed value, object|void codec) + /*! @decl string encode_value(mixed value, Codec|void codec)    *!    *! Code a value into a string.    *!    *! This function takes a value, and converts it to a string. This string    *! can then be saved, sent to another Pike process, packed or used in    *! any way you like. When you want your value back you simply send this    *! string to @[decode_value()] and it will return the value you encoded.    *!    *! Almost any value can be coded, mappings, floats, arrays, circular    *! structures etc.    *!    *! To encode objects, programs and functions, a codec object must be    *! provided.    *! -  +  *! If @expr{codec->nameof(o)@} returns @tt{UNDEFINED@} for an object, +  *! @expr{val = o->encode_object(o)@} will be called. The returned value +  *! will be passed to @expr{o->decode_object(o, val)@} when the object is +  *! decoded. +  *!    *! @note    *!    *! When only simple types like int, floats, strings, mappings,    *! multisets and arrays are encoded, the produced string is very    *! portable between pike versions. It can at least be read by any    *! later version.    *!    *! The portability when objects, programs and functions are involved    *! depends mostly on the codec. If the byte code is encoded, i.e.    *! when Pike programs are actually dumped in full, then the string