pike.git / src / post_modules / VCDiff / vcdiff.cmod

version» Context lines:

pike.git/src/post_modules/VCDiff/vcdiff.cmod:1: + /* -*- c -*- + || 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. + */ +    #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "stralloc.h"   #include "array.h"   #include "pike_macros.h"   #include "program.h" - #include "stralloc.h" +    #include "object.h"   #include "pike_types.h"   #include "threads.h" - #include "dynamic_buffer.h" +    #include "module_support.h"   #include "builtin_functions.h"      #ifdef HAVE_VCDIFF      #include "vcdiff_wrapper.h"      DECLARATIONS    -  + /* NB: Usually pulled in from crtbeginS.o, but we compile with -nostartfiles... +  * +  * cf http://wiki.osdev.org/C%2B%2B#GCC +  * and http://www.linuxquestions.org/questions/programming-9/fyi-shared-libs-and-iostream-c-331113/#post1681605 +  * +  * It is needed due to vcdiff_wrapper.cc pulling in iostream. +  */ + void *__dso_handle = NULL; +    /*! @module VCDiff    *!    *! Pike glue for the open-vcdiff differential compression library.    *! http://code.google.com/p/open-vcdiff/    *!    *! Encoding and decoding relies on a common string that the differences are    *! computed against - this string is called the dictionary.    *!    *! Basic usage:    *! @code
pike.git/src/post_modules/VCDiff/vcdiff.cmod:63:    THREADS_DISALLOW();       if (_dict != NULL) {    _vcencoder = vcdiff_init_encoder (_dict);    THIS->dict = _dict;    THIS->vcencoder = _vcencoder;    THIS->encoder_state = 1;    } else {    Pike_error ("Initializing dictionary failed.\n");    } -  pop_n_elems (args); +     }       PIKEFUN string encode (string data)    {    push_int (1);    apply (Pike_fp->current_object, "encode_chunk", 2);    }       PIKEFUN string encode_chunk (void|string data, void|int(0..1) flush)    {
pike.git/src/post_modules/VCDiff/vcdiff.cmod:162:    if (THIS->vcdecoder != NULL)    vcdiff_free_decoder (THIS->vcdecoder);       THIS->dict_len = dictionary->len;    THIS->dict_str = (char *)malloc (dictionary->len);    memcpy (THIS->dict_str, dictionary->str, dictionary->len);       THIS->vcdecoder = vcdiff_init_decoder (THIS->dict_str, THIS->dict_len);       THIS->decoder_state = 2; -  pop_n_elems (args); +     }       PIKEFUN string decode (string data)    {    push_int (1);    apply (Pike_fp->current_object, "decode_chunk", 2);    }    -  PIKEFUN string decode_chunk (string data, void|int(0..1) flush) +  PIKEFUN string decode_chunk (void|string data, void|int(0..1) flush)    {    char *in_buf = NULL;    int in_buf_len = 0;       char *out_buf = NULL;    int out_buf_len = 0;       char *trailer = NULL;    int trailer_len = 0;   
pike.git/src/post_modules/VCDiff/vcdiff.cmod:259:    INIT   #endif   }      PIKE_MODULE_EXIT   {   #ifdef HAVE_VCDIFF    EXIT   #endif   } -  +