Tcl_ZlibStreamInit

int Tcl_ZlibStreamInit(Tcl_Interp *interp, int mode, int format, int level, Tcl_Obj *dictObj,
                       Tcl_ZlibStream *zshandlePtr)

Create a compressing or decompressing zlib stream (returned in the variable pointed to by the zshandlePtr argument). If an interp is given, bind the stream to a command in that interpreter. (If interp is NULL, leave it unbound.) This is the interface behind the zlib stream command. It is also used by Tk's png format handler.

Once you have a Tcl_ZlibStream handle, you can use it with these other functions:

  • Tcl_ZlibStreamChecksum — returns the checksum (according to the stream format) of the uncompressed data that has gone through the stream engine.
  • Tcl_ZlibStreamClose — deletes the stream.
  • Tcl_ZlibStreamEof — tests whether the stream has reached the end of the data (depends on there being a marker in the stream to indicate this).
  • Tcl_ZlibStreamGet — appends processed (i.e. compressed or decompressed) data to a Tcl_Obj.
  • Tcl_ZlibStreamGetCommandName — gets the name of the stream command, or NULL if there isn't one.
  • Tcl_ZlibStreamPut — adds a byte-array Tcl_Obj to the stream, ready to be compressed or decompressed.