e576bb | 2002-10-11 | Martin Nilsson | | |
1cbb89 | 2011-04-25 | Martin Stjernholm | | || $Id$
|
e576bb | 2002-10-11 | Martin Nilsson | | */
|
aedfb1 | 2002-10-09 | Martin Nilsson | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | #include "global.h"
|
1cbb89 | 2011-04-25 | Martin Stjernholm | | RCSID("$Id$");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
#include "zlib_machine.h"
|
51ef5c | 2002-10-21 | Marcus Comstedt | | #include "module.h"
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
#if !defined(HAVE_LIBZ) && !defined(HAVE_LIBGZ)
#undef HAVE_ZLIB_H
#endif
#ifdef HAVE_ZLIB_H
#include "interpret.h"
#include "svalue.h"
#include "stralloc.h"
#include "array.h"
|
bb55f8 | 1997-03-16 | Fredrik Hübinette (Hubbe) | | #include "pike_macros.h"
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | #include "program.h"
#include "stralloc.h"
#include "object.h"
#include "pike_types.h"
#include "threads.h"
#include "dynamic_buffer.h"
#include <zlib.h>
|
250587 | 2002-09-25 | Marcus Comstedt | |
|
65bd33 | 2002-05-11 | Martin Stjernholm | | #define sp Pike_sp
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | struct zipper
{
|
98a7e1 | 2002-04-07 | Leif Stensson | | int level;
int state;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | struct z_stream_s gz;
|
1549c8 | 2002-08-25 | Marcus Agehall | | gzFile gzfile;
|
e0c81f | 1997-03-22 | Henrik Grubbström (Grubba) | | #ifdef _REENTRANT
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | DEFINE_MUTEX(lock);
|
e0c81f | 1997-03-22 | Henrik Grubbström (Grubba) | | #endif /* _REENTRANT */
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | };
|
1d90b9 | 1997-11-11 | Henrik Grubbström (Grubba) | | #define BUF 32768
|
d7288e | 1997-11-11 | Henrik Grubbström (Grubba) | | #define MAX_BUF (64*BUF)
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
356826 | 1998-05-07 | Fredrik Hübinette (Hubbe) | | #undef THIS
|
39221e | 2000-07-07 | Henrik Grubbström (Grubba) | | #define THIS ((struct zipper *)(Pike_fp->current_storage))
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | |
|
050d9c | 2001-11-18 | Martin Nilsson | | *!
*! Gz_deflate is a builtin program written in C. It interfaces the
*! packing routines in the libz library.
*!
*! @note
*! This program is only available if libz was available and found when
*! Pike was compiled.
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | | *!
*! @seealso
*! @[Gz.inflate()]
*/
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | static void gz_deflate_create(INT32 args)
{
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | | int tmp;
THIS->level=Z_DEFAULT_COMPRESSION;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
if(THIS->gz.state)
{
|
726095 | 1997-09-01 | Per Hedbor | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | deflateEnd(&THIS->gz);
|
726095 | 1997-09-01 | Per Hedbor | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
if(args)
{
if(sp[-args].type != T_INT)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Bad argument 1 to gz->create()\n");
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | | THIS->level=sp[-args].u.integer;
if(THIS->level < Z_NO_COMPRESSION ||
THIS->level > Z_BEST_COMPRESSION)
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | {
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Compression level out of range for gz_deflate->create()\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
}
THIS->gz.zalloc=Z_NULL;
THIS->gz.zfree=Z_NULL;
|
316475 | 1998-04-30 | Henrik Grubbström (Grubba) | | THIS->gz.opaque=(void *)THIS;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
pop_n_elems(args);
|
726095 | 1997-09-01 | Per Hedbor | |
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | | tmp=deflateInit(&THIS->gz, THIS->level);
|
726095 | 1997-09-01 | Per Hedbor | |
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | | switch(tmp)
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | {
case Z_OK:
return;
case Z_VERSION_ERROR:
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("libz not compatible with zlib.h!!!\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | break;
default:
if(THIS->gz.msg)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Failed to initialize gz_deflate: %s\n",THIS->gz.msg);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | else
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Failed to initialize gz_deflate\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
}
|
ab1d38 | 2009-08-28 | Martin Stjernholm | | static void do_mt_unlock (PIKE_MUTEX_T *lock)
{
mt_unlock (lock);
}
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | static int do_deflate(dynamic_buffer *buf,
struct zipper *this,
int flush)
{
|
b28077 | 1999-06-08 | Mirar (Pontus Hagland) | | int ret=0;
|
ab1d38 | 2009-08-28 | Martin Stjernholm | | ONERROR uwp;
|
b28077 | 1999-06-08 | Mirar (Pontus Hagland) | |
THREADS_ALLOW();
mt_lock(& this->lock);
THREADS_DISALLOW();
|
ab1d38 | 2009-08-28 | Martin Stjernholm | | SET_ONERROR (uwp, do_mt_unlock, &this->lock);
|
b28077 | 1999-06-08 | Mirar (Pontus Hagland) | | if(!this->gz.state)
ret=Z_STREAM_ERROR;
else
do
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | {
|
b28077 | 1999-06-08 | Mirar (Pontus Hagland) | | this->gz.next_out=low_make_buf_space(
(this->gz.avail_out =
|
9189f3 | 2000-12-13 | Fredrik Hübinette (Hubbe) | | this->gz.avail_in ?
this->gz.avail_in+this->gz.avail_in/1000+42 :
4096),
|
b28077 | 1999-06-08 | Mirar (Pontus Hagland) | | buf);
THREADS_ALLOW();
ret=deflate(& this->gz, flush);
THREADS_DISALLOW();
|
ffc099 | 1999-07-15 | Fredrik Hübinette (Hubbe) | |
|
391971 | 2000-08-17 | Henrik Grubbström (Grubba) | | low_make_buf_space(-((ptrdiff_t)this->gz.avail_out), buf);
|
ffc099 | 1999-07-15 | Fredrik Hübinette (Hubbe) | |
|
3b1376 | 2001-02-15 | Fredrik Hübinette (Hubbe) | | if(ret == Z_BUF_ERROR) ret=Z_OK;
|
726095 | 1997-09-01 | Per Hedbor | | }
|
9189f3 | 2000-12-13 | Fredrik Hübinette (Hubbe) | | while (ret==Z_OK && (this->gz.avail_in || !this->gz.avail_out));
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
ab1d38 | 2009-08-28 | Martin Stjernholm | | CALL_AND_UNSET_ONERROR (uwp);
|
b28077 | 1999-06-08 | Mirar (Pontus Hagland) | | return ret;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | static void gz_deflate(INT32 args)
{
struct pike_string *data;
int flush, fail;
struct zipper *this=THIS;
dynamic_buffer buf;
|
a598cd | 2001-01-23 | Fredrik Hübinette (Hubbe) | | ONERROR err;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | | if(THIS->state == 1)
{
deflateEnd(& THIS->gz);
deflateInit(& THIS->gz, THIS->level);
THIS->state=0;
}
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | if(!THIS->gz.state)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("gz_deflate not initialized or destructed\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
if(args<1)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Too few arguments to gz_deflate->deflate()\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
if(sp[-args].type != T_STRING)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Bad argument 1 to gz_deflate->deflate()\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
data=sp[-args].u.string;
if(args>1)
{
if(sp[1-args].type != T_INT)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Bad argument 2 to gz_deflate->deflate()\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
flush=sp[1-args].u.integer;
switch(flush)
{
case Z_PARTIAL_FLUSH:
case Z_FINISH:
case Z_SYNC_FLUSH:
case Z_NO_FLUSH:
break;
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | | default:
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Argument 2 to gz_deflate->deflate() out of range.\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
}else{
flush=Z_FINISH;
}
this->gz.next_in=(Bytef *)data->str;
|
340c56 | 2001-06-13 | Henrik Grubbström (Grubba) | | this->gz.avail_in = DO_NOT_WARN((unsigned INT32)(data->len));
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
2bb222 | 1999-08-20 | Henrik Grubbström (Grubba) | | initialize_buf(&buf);
|
a598cd | 2001-01-23 | Fredrik Hübinette (Hubbe) | | SET_ONERROR(err,toss_buffer,&buf);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | fail=do_deflate(&buf,this,flush);
|
a598cd | 2001-01-23 | Fredrik Hübinette (Hubbe) | | UNSET_ONERROR(err);
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | if(fail != Z_OK && fail != Z_STREAM_END)
{
|
a5b2c7 | 2001-01-24 | Henrik Grubbström (Grubba) | | toss_buffer(&buf);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | if(THIS->gz.msg)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Error in gz_deflate->deflate(): %s\n",THIS->gz.msg);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | else
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Error in gz_deflate->deflate(): %d\n",fail);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | |
if(fail == Z_STREAM_END)
THIS->state=1;
|
a5b2c7 | 2001-01-24 | Henrik Grubbström (Grubba) | | pop_n_elems(args);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
push_string(low_free_buf(&buf));
}
static void init_gz_deflate(struct object *o)
{
|
238302 | 1997-02-27 | Fredrik Hübinette (Hubbe) | | mt_init(& THIS->lock);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | MEMSET(& THIS->gz, 0, sizeof(THIS->gz));
THIS->gz.zalloc=Z_NULL;
THIS->gz.zfree=Z_NULL;
|
316475 | 1998-04-30 | Henrik Grubbström (Grubba) | | THIS->gz.opaque=(void *)THIS;
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | | THIS->state=0;
deflateInit(& THIS->gz, THIS->level = Z_DEFAULT_COMPRESSION);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
static void exit_gz_deflate(struct object *o)
{
|
726095 | 1997-09-01 | Per Hedbor | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | deflateEnd(&THIS->gz);
|
726095 | 1997-09-01 | Per Hedbor | |
|
4e77fb | 1999-06-10 | Fredrik Hübinette (Hubbe) | | mt_destroy( & THIS->lock );
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | | |
050d9c | 2001-11-18 | Martin Nilsson | | *!
*! Gz_deflate is a builtin program written in C. It interfaces the
*! unpacking routines in the libz library.
*!
*! @note
*! This program is only available if libz was available and found when
*! Pike was compiled.
*!
*! @seealso
*! @[deflate]
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | | */
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | static void gz_inflate_create(INT32 args)
{
int tmp;
if(THIS->gz.state)
{
|
726095 | 1997-09-01 | Per Hedbor | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | inflateEnd(&THIS->gz);
|
726095 | 1997-09-01 | Per Hedbor | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
THIS->gz.zalloc=Z_NULL;
THIS->gz.zfree=Z_NULL;
|
316475 | 1998-04-30 | Henrik Grubbström (Grubba) | | THIS->gz.opaque=(void *)THIS;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
pop_n_elems(args);
|
726095 | 1997-09-01 | Per Hedbor | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | tmp=inflateInit(& THIS->gz);
|
726095 | 1997-09-01 | Per Hedbor | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | switch(tmp)
{
case Z_OK:
return;
case Z_VERSION_ERROR:
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("libz not compatible with zlib.h!!!\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | break;
default:
if(THIS->gz.msg)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Failed to initialize gz_inflate: %s\n",THIS->gz.msg);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | else
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Failed to initialize gz_inflate\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
}
static int do_inflate(dynamic_buffer *buf,
struct zipper *this,
int flush)
{
int fail=0;
|
ab1d38 | 2009-08-28 | Martin Stjernholm | | ONERROR uwp;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | THREADS_ALLOW();
|
726095 | 1997-09-01 | Per Hedbor | | mt_lock(& this->lock);
|
cadacf | 1997-10-21 | Henrik Grubbström (Grubba) | | THREADS_DISALLOW();
|
ab1d38 | 2009-08-28 | Martin Stjernholm | | SET_ONERROR (uwp, do_mt_unlock, &this->lock);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | if(!this->gz.state)
{
fail=Z_STREAM_ERROR;
}else{
|
4951fc | 2001-02-08 | Fredrik Hübinette (Hubbe) | | #if 0
static int fnord=0;
fnord++;
#endif
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | do
{
char *loc;
int ret;
loc=low_make_buf_space(BUF,buf);
|
cadacf | 1997-10-21 | Henrik Grubbström (Grubba) | | THREADS_ALLOW();
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | this->gz.next_out=(Bytef *)loc;
this->gz.avail_out=BUF;
|
4951fc | 2001-02-08 | Fredrik Hübinette (Hubbe) | | #if 0
fprintf(stderr,"INFLATE[%d]: avail_out=%7d avail_in=%7d flush=%d\n",
fnord,
this->gz.avail_out,
this->gz.avail_in,
flush);
fprintf(stderr,"INFLATE[%d]: mode=%d\n",fnord,
this->gz.state ? *(int *)(this->gz.state) : -1);
#endif
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | ret=inflate(& this->gz, flush);
|
4951fc | 2001-02-08 | Fredrik Hübinette (Hubbe) | | #if 0
fprintf(stderr,"Result [%d]: avail_out=%7d avail_in=%7d ret=%d\n",
fnord,
this->gz.avail_out,
this->gz.avail_in,
ret);
#endif
|
cadacf | 1997-10-21 | Henrik Grubbström (Grubba) | | THREADS_DISALLOW();
|
391971 | 2000-08-17 | Henrik Grubbström (Grubba) | | low_make_buf_space(-((ptrdiff_t)this->gz.avail_out), buf);
|
4951fc | 2001-02-08 | Fredrik Hübinette (Hubbe) | |
if(ret == Z_BUF_ERROR) ret=Z_OK;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | if(ret != Z_OK)
|
726095 | 1997-09-01 | Per Hedbor | | {
fail=ret;
break;
}
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | } while(!this->gz.avail_out || flush==Z_FINISH || this->gz.avail_in);
}
|
ab1d38 | 2009-08-28 | Martin Stjernholm | |
CALL_AND_UNSET_ONERROR (uwp);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | return fail;
}
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | | |
050d9c | 2001-11-18 | Martin Nilsson | | *! @example
*! // whole file
*! write(Gz_inflate()->inflate(stdin->read(0x7fffffff));
*!
*! // streaming (blocks)
*! function inflate=Gz_inflate()->inflate;
*! while(string s=stdin->read(8192))
*! write(inflate(s));
*!
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | | *! @seealso
*! @[Gz.deflate->deflate()]
*/
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | static void gz_inflate(INT32 args)
{
struct pike_string *data;
int fail;
struct zipper *this=THIS;
dynamic_buffer buf;
|
a598cd | 2001-01-23 | Fredrik Hübinette (Hubbe) | | ONERROR err;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
if(!THIS->gz.state)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("gz_inflate not initialized or destructed\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
if(args<1)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Too few arguments to gz_inflate->inflate()\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
if(sp[-args].type != T_STRING)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Bad argument 1 to gz_inflate->inflate()\n");
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
data=sp[-args].u.string;
this->gz.next_in=(Bytef *)data->str;
|
340c56 | 2001-06-13 | Henrik Grubbström (Grubba) | | this->gz.avail_in = DO_NOT_WARN((unsigned INT32)(data->len));
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
2bb222 | 1999-08-20 | Henrik Grubbström (Grubba) | | initialize_buf(&buf);
|
a5b2c7 | 2001-01-24 | Henrik Grubbström (Grubba) | |
|
a598cd | 2001-01-23 | Fredrik Hübinette (Hubbe) | | SET_ONERROR(err,toss_buffer,&buf);
|
3b1376 | 2001-02-15 | Fredrik Hübinette (Hubbe) | | fail=do_inflate(&buf,this,Z_SYNC_FLUSH);
|
a598cd | 2001-01-23 | Fredrik Hübinette (Hubbe) | | UNSET_ONERROR(err);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
if(fail != Z_OK && fail != Z_STREAM_END)
{
|
a5b2c7 | 2001-01-24 | Henrik Grubbström (Grubba) | | toss_buffer(&buf);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | if(THIS->gz.msg)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Error in gz_inflate->inflate(): %s\n",THIS->gz.msg);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | else
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Error in gz_inflate->inflate(): %d\n",fail);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | |
|
a5b2c7 | 2001-01-24 | Henrik Grubbström (Grubba) | | pop_n_elems(args);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | push_string(low_free_buf(&buf));
if(fail != Z_STREAM_END && fail!=Z_OK && !sp[-1].u.string->len)
{
pop_stack();
push_int(0);
}
}
static void init_gz_inflate(struct object *o)
{
|
77fe17 | 1997-02-27 | Fredrik Hübinette (Hubbe) | | mt_init(& THIS->lock);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | MEMSET(& THIS->gz, 0, sizeof(THIS->gz));
THIS->gz.zalloc=Z_NULL;
THIS->gz.zfree=Z_NULL;
|
e85aa9 | 2001-07-04 | Fredrik Hübinette (Hubbe) | | THIS->gz.opaque=(void *)THIS;
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | inflateInit(&THIS->gz);
inflateEnd(&THIS->gz);
}
static void exit_gz_inflate(struct object *o)
{
|
726095 | 1997-09-01 | Per Hedbor | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | inflateEnd(& THIS->gz);
|
726095 | 1997-09-01 | Per Hedbor | |
|
4e77fb | 1999-06-10 | Fredrik Hübinette (Hubbe) | | mt_destroy( & THIS->lock );
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | }
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | |
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | |
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | | |
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | *! This function calculates the standard ISO3309 Cyclic Redundancy Check.
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | | */
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | | static void gz_crc32(INT32 args)
{
unsigned INT32 crc;
if (!args ||
sp[-args].type!=T_STRING)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Gz.crc32: illegal or missing argument 1 (expected string)\n");
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | |
|
b804b2 | 1998-03-24 | Henrik Grubbström (Grubba) | | if (args>1) {
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | | if (sp[1-args].type!=T_INT)
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | Pike_error("Gz.crc32: illegal argument 2 (expected integer)\n");
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | | else
crc=(unsigned INT32)sp[1-args].u.integer;
|
b804b2 | 1998-03-24 | Henrik Grubbström (Grubba) | | } else
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | | crc=0;
crc=crc32(crc,
(unsigned char*)sp[-args].u.string->str,
|
340c56 | 2001-06-13 | Henrik Grubbström (Grubba) | | DO_NOT_WARN((unsigned INT32)(sp[-args].u.string->len)));
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | |
pop_n_elems(args);
push_int((INT32)crc);
}
|
3e6895 | 2002-10-15 | Johan Sundström | | |
1549c8 | 2002-08-25 | Marcus Agehall | | */
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | *! Opens a file for I/O.
|
1549c8 | 2002-08-25 | Marcus Agehall | | *! @param file
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | *! The filename or an open filedescriptor for the GZip file to use.
|
1549c8 | 2002-08-25 | Marcus Agehall | | *! @param mode
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | *! Mode for the fileoperations. Defaults to read only.
|
1549c8 | 2002-08-25 | Marcus Agehall | | *!
*! @note
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | *! If the object already has been opened, it will first be closed.
|
1549c8 | 2002-08-25 | Marcus Agehall | | */
void gz_file_open(INT32 args)
{
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | char *mode = "rb";
|
1549c8 | 2002-08-25 | Marcus Agehall | |
if (THIS->gzfile!=NULL) {
gzclose(THIS->gzfile);
THIS->gzfile = NULL;
}
if (args<1 || args>2) {
Pike_error("Bad number of arguments to file->open()\n"
"Got %d, expected 1 or 2.\n", args);
}
if (sp[-args].type != PIKE_T_STRING &&
sp[-args].type != PIKE_T_INT) {
Pike_error("Bad parameter 1 to file->open()\n");
}
if (args == 2 && sp[1-args].type != PIKE_T_STRING) {
Pike_error("Bad parameter 2 to file->open()\n");
} else if (args == 2) {
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | mode = STR0(sp[1-args].u.string);
|
1549c8 | 2002-08-25 | Marcus Agehall | | }
if (sp[-args].type == PIKE_T_INT) {
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | |
THIS->gzfile = gzdopen(sp[-args].u.integer, mode);
|
1549c8 | 2002-08-25 | Marcus Agehall | | } else {
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | THIS->gzfile = gzopen(STR0(sp[-args].u.string), mode);
|
1549c8 | 2002-08-25 | Marcus Agehall | | }
pop_n_elems(args);
push_int(THIS->gzfile != NULL);
}
|
e889da | 2002-08-26 | Marek Habersack | | |
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | *! Opens a gzip file for reading.
|
1549c8 | 2002-08-25 | Marcus Agehall | | */
void gz_file_create(INT32 args)
{
THIS->gzfile = NULL;
if (args) {
gz_file_open(args);
if (sp[-1].u.integer == 0) {
Pike_error("Failed to open file.\n");
}
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | pop_stack();
|
1549c8 | 2002-08-25 | Marcus Agehall | | }
}
|
e889da | 2002-08-26 | Marek Habersack | | *! @returns
*! 1 if successful
|
1549c8 | 2002-08-25 | Marcus Agehall | | */
void gz_file_close(INT32 args)
{
if (args!=0) {
Pike_error("Bad number of arguments to file->close()\n"
"Got %d, expected 0.\n", args);
}
if (THIS->gzfile!=NULL) {
gzclose(THIS->gzfile);
THIS->gzfile = NULL;
}
push_int(1);
}
void gz_file_read(INT32 args)
{
|
2ef321 | 2002-11-24 | Marcus Agehall | | struct pike_string *buf;
|
1549c8 | 2002-08-25 | Marcus Agehall | | int len;
int res;
if (args!=1) {
Pike_error("Bad number of arguments to gz_file->read()\n"
"Got %d, expected 1.\n", args);
}
if (sp[-args].type != PIKE_T_INT) {
Pike_error("Bad argument 1 to gz_file->read()\n");
}
if (THIS->gzfile == NULL) {
Pike_error("File not open!\n");
}
len = sp[-args].u.integer;
|
2ef321 | 2002-11-24 | Marcus Agehall | | buf = begin_shared_string(len);
|
1549c8 | 2002-08-25 | Marcus Agehall | |
pop_n_elems(args);
|
2ef321 | 2002-11-24 | Marcus Agehall | | res = gzread(THIS->gzfile, STR0(buf), len);
|
1549c8 | 2002-08-25 | Marcus Agehall | |
|
2ef321 | 2002-11-24 | Marcus Agehall | |
|
1549c8 | 2002-08-25 | Marcus Agehall | | if (res<0) {
push_int(0);
|
2ef321 | 2002-11-24 | Marcus Agehall | | free_string(end_shared_string(buf));
|
1549c8 | 2002-08-25 | Marcus Agehall | | return;
}
|
90fc48 | 2002-11-25 | Henrik Grubbström (Grubba) | | |
2ef321 | 2002-11-24 | Marcus Agehall | | * the data read.
*/
push_string(end_and_resize_shared_string(buf, res));
|
1549c8 | 2002-08-25 | Marcus Agehall | | }
|
e889da | 2002-08-26 | Marek Habersack | | *! @returns
*! the number of bytes written to the file.
|
1549c8 | 2002-08-25 | Marcus Agehall | | */
void gz_file_write(INT32 args)
{
int res = 0;
if (args!=1) {
Pike_error("Bad number of arguments to gz_file->write()\n"
"Got %d, expected 1.\n", args);
}
if (sp[-args].type != PIKE_T_STRING) {
Pike_error("Bad argument 1 to gz_file->write()\n");
}
if (THIS->gzfile == NULL) {
Pike_error("File not open!\n");
}
res = gzwrite(THIS->gzfile,
sp[-args].u.string->str,
(unsigned INT32)sp[-args].u.string->len);
pop_n_elems(args);
push_int(res);
}
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #ifdef HAVE_GZSEEK
|
1549c8 | 2002-08-25 | Marcus Agehall | | |
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | *! Seeks within the file.
|
1549c8 | 2002-08-25 | Marcus Agehall | | *! @param pos
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | *! Position relative to the searchtype.
|
1549c8 | 2002-08-25 | Marcus Agehall | | *! @param type
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | *! SEEK_SET = set current position in file to pos
*! SEEK_CUR = new position is current+pos
*! SEEK_END is not supported.
|
e889da | 2002-08-26 | Marek Habersack | | *! @returns
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | *! New position or negative number if seek failed.
*!
*! @note
*! Not supported on all operating systems.
|
1549c8 | 2002-08-25 | Marcus Agehall | | */
void gz_file_seek(INT32 args)
{
int res, newpos;
int type = SEEK_SET;
if (args>2) {
Pike_error("Bad number of arguments to file->seek()\n"
"Got %d, expected 1 or 2.\n", args);
}
if (sp[-args].type != PIKE_T_INT) {
Pike_error("Bad argument 1 to file->seek()\n");
}
if (args == 2 && sp[1-args].type != PIKE_T_INT) {
Pike_error("Bad argument 2 to file->seek()\n");
}
else if (args == 2) {
type = sp[1-args].u.integer;
}
if (THIS->gzfile == NULL) {
Pike_error("File not open!\n");
}
newpos = sp[-args].u.integer;
pop_n_elems(args);
res = gzseek(THIS->gzfile, newpos, type);
push_int(res);
}
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #endif /* HAVE_GZSEEK */
|
1549c8 | 2002-08-25 | Marcus Agehall | |
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #ifdef HAVE_GZTELL
|
e889da | 2002-08-26 | Marek Habersack | | *! @returns
*! the current position within the file.
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | *!
*! @note
*! Not supported on all operating systems.
|
1549c8 | 2002-08-25 | Marcus Agehall | | */
void gz_file_tell(INT32 args)
{
if (args!=0) {
Pike_error("Bad number of arguments to file->tell()\n"
"Got %d, expected 0.\n", args);
}
if (THIS->gzfile == NULL) {
Pike_error("File not open!\n");
}
push_int(gztell(THIS->gzfile));
}
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #endif /* HAVE_GZTELL */
|
1549c8 | 2002-08-25 | Marcus Agehall | |
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #ifdef HAVE_GZEOF
|
1549c8 | 2002-08-25 | Marcus Agehall | | |
e889da | 2002-08-26 | Marek Habersack | | *! @returns
*! 1 if EOF has been reached.
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | *!
*! @note
*! Not supported on all operating systems.
|
1549c8 | 2002-08-25 | Marcus Agehall | | */
void gz_file_eof(INT32 args)
{
if (args!=0) {
Pike_error("Bad number of arguments to file->eof()\n"
"Got %d, expected 0.\n", args);
}
push_int(gzeof(THIS->gzfile));
}
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #endif /* HAVE_GZEOF */
|
1549c8 | 2002-08-25 | Marcus Agehall | |
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #ifdef HAVE_GZSETPARAMS
|
1549c8 | 2002-08-25 | Marcus Agehall | | |
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | *! Sets the encoding level and strategy
|
1549c8 | 2002-08-25 | Marcus Agehall | | *! @param level
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | *! Level of the compression.
*! 0 is the least compression, 9 is max. 8 is default.
|
1549c8 | 2002-08-25 | Marcus Agehall | | *! @param strategy
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | *! Set strategy for encoding to one of the following:
*! Z_DEFAULT_STRATEGY
*! Z_FILTERED
*! Z_HUFFMAN_ONLY
*!
*! @note
*! Not supported on all operating systems.
|
1549c8 | 2002-08-25 | Marcus Agehall | | */
void gz_file_setparams(INT32 args)
{
int res;
if (args!=2) {
Pike_error("Bad number of arguments to file->setparams()\n"
"Got %d, expected 2.\n", args);
}
if (sp[-args].type != PIKE_T_INT ||
sp[1-args].type != PIKE_T_INT) {
Pike_error("Bad type in argument\n");
}
res = gzsetparams(THIS->gzfile,
sp[-args].u.integer,
sp[1-args].u.integer);
pop_n_elems(args);
push_int(res == Z_OK);
}
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #endif /* HAVE_GZSETPARAMS */
|
1549c8 | 2002-08-25 | Marcus Agehall | |
static void init_gz_file(struct object *o)
{
mt_init(& THIS->lock);
THIS->gzfile = NULL;
}
static void exit_gz_file(struct object *o)
{
if (THIS->gzfile != NULL)
gzclose(THIS->gzfile);
mt_destroy( & THIS->lock );
}
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | |
|
6461ef | 2001-01-05 | Henrik Grubbström (Grubba) | |
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | #endif
|
51ef5c | 2002-10-21 | Marcus Comstedt | | PIKE_MODULE_EXIT {}
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
51ef5c | 2002-10-21 | Marcus Comstedt | | PIKE_MODULE_INIT
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | {
#ifdef HAVE_ZLIB_H
start_new_program();
|
90e978 | 1999-01-31 | Fredrik Hübinette (Hubbe) | | ADD_STORAGE(struct zipper);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
45ee5d | 1999-02-10 | Fredrik Hübinette (Hubbe) | |
ADD_FUNCTION("create",gz_deflate_create,tFunc(tOr(tInt,tVoid),tVoid),0);
ADD_FUNCTION("deflate",gz_deflate,tFunc(tStr tOr(tInt,tVoid),tStr),0);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
add_integer_constant("NO_FLUSH",Z_NO_FLUSH,0);
add_integer_constant("PARTIAL_FLUSH",Z_PARTIAL_FLUSH,0);
add_integer_constant("SYNC_FLUSH",Z_SYNC_FLUSH,0);
add_integer_constant("FINISH",Z_FINISH,0);
set_init_callback(init_gz_deflate);
set_exit_callback(exit_gz_deflate);
end_class("deflate",0);
start_new_program();
|
90e978 | 1999-01-31 | Fredrik Hübinette (Hubbe) | | ADD_STORAGE(struct zipper);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
|
e908b0 | 2003-06-18 | Marcus Comstedt | |
ADD_FUNCTION("create",gz_inflate_create,tFunc(tNone,tVoid),0);
|
45ee5d | 1999-02-10 | Fredrik Hübinette (Hubbe) | |
ADD_FUNCTION("inflate",gz_inflate,tFunc(tStr,tStr),0);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | |
add_integer_constant("NO_FLUSH",Z_NO_FLUSH,0);
add_integer_constant("PARTIAL_FLUSH",Z_PARTIAL_FLUSH,0);
add_integer_constant("SYNC_FLUSH",Z_SYNC_FLUSH,0);
add_integer_constant("FINISH",Z_FINISH,0);
set_init_callback(init_gz_inflate);
set_exit_callback(exit_gz_inflate);
end_class("inflate",0);
|
2e8784 | 1997-04-06 | Fredrik Hübinette (Hubbe) | |
|
1549c8 | 2002-08-25 | Marcus Agehall | | start_new_program();
ADD_STORAGE(struct zipper);
ADD_FUNCTION("create", gz_file_create, tFunc(tOr(tVoid, tString) tOr(tVoid, tString), tVoid), 0);
ADD_FUNCTION("open", gz_file_open, tFunc(tString tOr(tVoid, tString), tInt), 0);
ADD_FUNCTION("close", gz_file_close, tFunc(tVoid, tInt), 0);
ADD_FUNCTION("read", gz_file_read, tFunc(tInt,tOr(tString,tInt)), 0);
ADD_FUNCTION("write", gz_file_write, tFunc(tString,tInt), 0);
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #ifdef HAVE_GZSEEK
|
1549c8 | 2002-08-25 | Marcus Agehall | | ADD_FUNCTION("seek", gz_file_seek, tFunc(tInt tOr(tVoid,tInt), tInt), 0);
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #endif /* HAVE_GZSEEK */
#ifdef HAVE_GZTELL
|
1549c8 | 2002-08-25 | Marcus Agehall | | ADD_FUNCTION("tell", gz_file_tell, tFunc(tVoid, tInt), 0);
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #endif /* HAVE_GZTELL */
#ifdef HAVE_GZEOF
|
1549c8 | 2002-08-25 | Marcus Agehall | | ADD_FUNCTION("eof", gz_file_eof, tFunc(tVoid, tInt), 0);
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #endif /* HAVE_GZEOF */
#ifdef HAVE_GZSETPARAMS
|
1549c8 | 2002-08-25 | Marcus Agehall | | ADD_FUNCTION("setparams", gz_file_setparams, tFunc(tInt tInt, tInt), 0);
|
dd8fa7 | 2002-09-10 | Henrik Grubbström (Grubba) | | #endif /* HAVE_GZSETPARAMS */
|
1549c8 | 2002-08-25 | Marcus Agehall | |
add_integer_constant("SEEK_SET", SEEK_SET, 0);
add_integer_constant("SEEK_CUR", SEEK_CUR, 0);
add_integer_constant("Z_DEFAULT_STRATEGY", Z_DEFAULT_STRATEGY,0);
add_integer_constant("Z_FILTERED", Z_FILTERED,0);
add_integer_constant("Z_HUFFMAN_ONLY", Z_HUFFMAN_ONLY,0);
set_init_callback(init_gz_file);
set_exit_callback(exit_gz_file);
end_class("_file", 0);
|
2e8784 | 1997-04-06 | Fredrik Hübinette (Hubbe) | | add_integer_constant("NO_FLUSH",Z_NO_FLUSH,0);
add_integer_constant("PARTIAL_FLUSH",Z_PARTIAL_FLUSH,0);
add_integer_constant("SYNC_FLUSH",Z_SYNC_FLUSH,0);
add_integer_constant("FINISH",Z_FINISH,0);
|
45ee5d | 1999-02-10 | Fredrik Hübinette (Hubbe) | |
ADD_FUNCTION("crc32",gz_crc32,tFunc(tStr tOr(tVoid,tInt),tInt),
|
8d36d5 | 1998-02-27 | Mirar (Pontus Hagland) | | OPT_TRY_OPTIMIZE);
|
ab6aec | 1997-02-11 | Fredrik Hübinette (Hubbe) | | #endif
}
|
9eed30 | 1997-10-26 | Henrik Grubbström (Grubba) | | #if defined(HAVE___VTBL__9TYPE_INFO) || defined(HAVE___T_9__NOTHROW)
|
35d10a | 1997-10-12 | Henrik Grubbström (Grubba) | |
|
9eed30 | 1997-10-26 | Henrik Grubbström (Grubba) | | #ifdef HAVE___VTBL__9TYPE_INFO
|
297fff | 1997-10-14 | Henrik Grubbström (Grubba) | | extern void __vtbl__9type_info(void);
|
9eed30 | 1997-10-26 | Henrik Grubbström (Grubba) | | #endif /* HAVE___VTBL__9TYPE_INFO */
#ifdef HAVE___T_9__NOTHROW
extern void __T_9__nothrow(void);
#endif /* HAVE___T_9__NOTHROW */
|
297fff | 1997-10-14 | Henrik Grubbström (Grubba) | | void zlibmod_strap_kluge(void)
|
35d10a | 1997-10-12 | Henrik Grubbström (Grubba) | | {
|
9eed30 | 1997-10-26 | Henrik Grubbström (Grubba) | | #ifdef HAVE___VTBL__9TYPE_INFO
|
35d10a | 1997-10-12 | Henrik Grubbström (Grubba) | | __vtbl__9type_info();
#endif /* HAVE___VTBL__9TYPE_INFO */
|
9eed30 | 1997-10-26 | Henrik Grubbström (Grubba) | | #ifdef HAVE___T_9__NOTHROW
__T_9__nothrow();
#endif /* HAVE___T_9__NOTHROW */
}
#endif /* HAVE___VTBL__9TYPE_INFO || HAVE___T_9__NOTHROW */
|