File: bz2lib.c

package info (click to toggle)
tcltrf 2.1.4-dfsg3-8
  • links: PTS
  • area: main
  • in suites: sid, trixie
  • size: 9,656 kB
  • sloc: ansic: 73,139; sh: 3,155; tcl: 1,343; makefile: 182; exp: 22
file content (73 lines) | stat: -rw-r--r-- 1,369 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * bz2lib.c --
 *
 *	Loader for 'bz2' compression library.
 *
 * Copyright (c) 1996 Jan Nijtmans (Jan.Nijtmans.wxs.nl)
 * All rights reserved.
 *
 * CVS: $Id: bz2lib.c,v 1.5 2008/12/11 19:04:25 andreas_kupries Exp $
 */

#include "transformInt.h"

#ifndef BZ2_LIB_NAME
#    ifdef __WIN32__
#    define BZ2_LIB_NAME "libbz2.dll"
#    endif /* __WIN32__ */
#    ifdef __APPLE__
#    define BZ2_LIB_NAME "libbz2.dylib"
#    endif /* __APPLE__ */
#    ifndef BZ2_LIB_NAME
#    define BZ2_LIB_NAME "libbz2.so"
#    endif /* BZ2_LIB_NAME */
#endif /* BZ2_LIB_NAME */


static char* symbols [] = {
  "BZ2_bzCompress",
  "BZ2_bzCompressEnd",
  "BZ2_bzCompressInit",
  "BZ2_bzDecompress",
  "BZ2_bzDecompressEnd",
  "BZ2_bzDecompressInit",
  (char *) NULL
};


/*
 * Global variable containing the vectors into the 'bz2'-library.
 */

#ifdef BZLIB_STATIC_BUILD
bzFunctions bz = {
  0,
  BZ2_bzCompress,
  BZ2_bzCompressEnd,
  BZ2_bzCompressInit,
  BZ2_bzDecompress,
  BZ2_bzDecompressEnd,
  BZ2_bzDecompressInit,
};
#else
bzFunctions bz = {0}; /* THREADING: serialize initialization */
#endif


int
TrfLoadBZ2lib (interp)
    Tcl_Interp* interp;
{
#ifndef BZLIB_STATIC_BUILD
  int res;

  TrfLock; /* THREADING: serialize initialization */

  res = Trf_LoadLibrary (interp, BZ2_LIB_NAME, (VOID**) &bz, symbols, 6);
  TrfUnlock;

  return res;
#else
  return TCL_OK;
#endif
}