/usr/share/slsh/zlib.sl is in slsh 2.3.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | % -*- mode: slang; mode: fold -*-
% Copyright (C) 2012-2014 John E. Davis
%
% This file is part of the S-Lang Library and may be distributed under the
% terms of the GNU General Public License. See the file COPYING for
% more information.
%---------------------------------------------------------------------------
import ("zlib");
%{{{ Deflate Object and methods
private define deflate_method ()
{
if (_NARGS != 2)
{
_pop_n (_NARGS);
usage (".deflate(str [;flush=val])");
}
variable z, b;
(z, b) = ();
return _zlib_deflate (z.zobj, b, qualifier("flush", ZLIB_NO_FLUSH));
}
private define def_reset_method (z)
{
_zlib_deflate_reset (z.zobj);
}
private define def_flush_method ()
{
variable z, flush = ZLIB_FINISH;
switch (_NARGS)
{
case 2:
(z, flush) = ();
}
{
case 1:
z = ();
}
{
_pop_n (_NARGS);
usage (".flush ([val]); Default is ZLIB_FINISH");
}
return _zlib_deflate_flush (z.zobj, flush);
}
private variable Deflate_Object = struct
{
zobj,
deflate = &deflate_method,
reset = &def_reset_method,
flush = &def_flush_method,
};
define zlib_deflate_new ()
{
variable z = @Deflate_Object;
z.zobj = _zlib_deflate_new (qualifier ("level", ZLIB_DEFAULT_COMPRESSION),
qualifier ("method", ZLIB_DEFLATED),
qualifier ("wbits", 15),
qualifier ("memlevel", 8),
qualifier ("strategy", ZLIB_DEFAULT_STRATEGY));
return z;
}
%}}}
%{{{ Inflate Object and methods
private define inflate_method ()
{
if (_NARGS != 2)
{
_pop_n (_NARGS);
usage (".inflate(str [;flush=val])");
}
variable z, b;
(z, b) = ();
return _zlib_inflate (z.zobj, b, qualifier("flush", ZLIB_NO_FLUSH));
}
private define inf_reset_method (z)
{
_zlib_inflate_reset (z.zobj);
}
private define inf_flush_method ()
{
variable z, flush = ZLIB_FINISH;
switch (_NARGS)
{
case 2:
(z, flush) = ();
}
{
case 1:
z = ();
}
{
_pop_n (_NARGS);
usage (".flush ([val]); Default is ZLIB_FINISH");
}
return _zlib_inflate_flush (z.zobj, flush);
}
private variable Inflate_Object = struct
{
zobj,
inflate = &inflate_method,
reset = &inf_reset_method,
flush = &inf_flush_method,
};
define zlib_inflate_new ()
{
variable z = @Inflate_Object;
z.zobj = _zlib_inflate_new (qualifier ("wbits", 15));
return z;
}
%}}}
define zlib_deflate ()
{
if (_NARGS != 1)
{
usage ("zstr = zlib_deflate (str [;qualifiers])\n"
+ " qualifiers:\n"
+ " level=val, method=val, wbits=val, memlevel=val, strategy=val");
}
variable bstr = ();
variable z = zlib_deflate_new (;; __qualifiers);
return _zlib_deflate (z.zobj, bstr, ZLIB_FINISH);
}
define zlib_inflate ()
{
if (_NARGS != 1)
{
usage ("str = zlib_inflate (zstr [;wbits=val])");
}
variable zstr = ();
variable z = zlib_inflate_new (;; __qualifiers);
return _zlib_inflate (z.zobj, zstr, ZLIB_FINISH);
}
|