Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3c540307
Commit
3c540307
authored
Jun 03, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doc strings (AMK).
parent
2b1566be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
11 deletions
+88
-11
Modules/zlibmodule.c
Modules/zlibmodule.c
+88
-11
No files found.
Modules/zlibmodule.c
View file @
3c540307
...
@@ -27,6 +27,16 @@ typedef struct
...
@@ -27,6 +27,16 @@ typedef struct
z_stream
zst
;
z_stream
zst
;
}
compobject
;
}
compobject
;
static
char
compressobj__doc__
[]
=
"compressobj() -- Return a compressor object.
\n
"
"compressobj(level) -- Return a compressor object, using the given compression level.
\n
"
;
static
char
decompressobj__doc__
[]
=
"decompressobj() -- Return a decompressor object.
\n
"
"decompressobj(wbits) -- Return a decompressor object, setting the window buffer size to wbits.
\n
"
;
static
compobject
*
static
compobject
*
newcompobject
(
type
)
newcompobject
(
type
)
PyTypeObject
*
type
;
PyTypeObject
*
type
;
...
@@ -38,6 +48,13 @@ newcompobject(type)
...
@@ -38,6 +48,13 @@ newcompobject(type)
return
self
;
return
self
;
}
}
static
char
compress__doc__
[]
=
"compress(string) -- Compress string using the default compression level, "
"returning a string containing compressed data.
\n
"
"compress(string, level) -- Compress string, using the chosen compression "
"level (from 1 to 9). Return a string containing the compressed data.
\n
"
;
static
PyObject
*
static
PyObject
*
PyZlib_compress
(
self
,
args
)
PyZlib_compress
(
self
,
args
)
PyObject
*
self
;
PyObject
*
self
;
...
@@ -125,6 +142,11 @@ PyZlib_compress(self, args)
...
@@ -125,6 +142,11 @@ PyZlib_compress(self, args)
return
ReturnVal
;
return
ReturnVal
;
}
}
static
char
decompress__doc__
[]
=
"decompress(string) -- Decompress the data in string, returning "
"a string containing the decompressed data."
;
static
PyObject
*
static
PyObject
*
PyZlib_decompress
(
self
,
args
)
PyZlib_decompress
(
self
,
args
)
PyObject
*
self
;
PyObject
*
self
;
...
@@ -341,6 +363,14 @@ Decomp_dealloc(self)
...
@@ -341,6 +363,14 @@ Decomp_dealloc(self)
err
=
inflateEnd
(
&
self
->
zst
);
/* Deallocate zstream structure */
err
=
inflateEnd
(
&
self
->
zst
);
/* Deallocate zstream structure */
}
}
static
char
comp_compress__doc__
[]
=
"compress(data) -- Return a string containing a compressed version of the data.
\n\n
"
"After calling this function, some of the input data may still
\n
"
"be stored in internal buffers for later processing.
\n
"
"Call the flush() method to clear these buffers."
;
static
PyObject
*
static
PyObject
*
PyZlib_objcompress
(
self
,
args
)
PyZlib_objcompress
(
self
,
args
)
compobject
*
self
;
compobject
*
self
;
...
@@ -383,6 +413,13 @@ PyZlib_objcompress(self, args)
...
@@ -383,6 +413,13 @@ PyZlib_objcompress(self, args)
return
RetVal
;
return
RetVal
;
}
}
static
char
decomp_decompress__doc__
[]
=
"decompress(data) -- Return a string containing the decompressed version of the data.
\n\n
"
"After calling this function, some of the input data may still
\n
"
"be stored in internal buffers for later processing.
\n
"
"Call the flush() method to clear these buffers."
;
static
PyObject
*
static
PyObject
*
PyZlib_objdecompress
(
self
,
args
)
PyZlib_objdecompress
(
self
,
args
)
compobject
*
self
;
compobject
*
self
;
...
@@ -424,6 +461,11 @@ PyZlib_objdecompress(self, args)
...
@@ -424,6 +461,11 @@ PyZlib_objdecompress(self, args)
return
RetVal
;
return
RetVal
;
}
}
static
char
comp_flush__doc__
[]
=
"flush() -- Return a string containing any remaining compressed data. "
"The compressor object can no longer be used after this call."
;
static
PyObject
*
static
PyObject
*
PyZlib_flush
(
self
,
args
)
PyZlib_flush
(
self
,
args
)
compobject
*
self
;
compobject
*
self
;
...
@@ -474,6 +516,11 @@ PyZlib_flush(self, args)
...
@@ -474,6 +516,11 @@ PyZlib_flush(self, args)
return
RetVal
;
return
RetVal
;
}
}
static
char
decomp_flush__doc__
[]
=
"flush() -- Return a string containing any remaining decompressed data. "
"The decompressor object can no longer be used after this call."
;
static
PyObject
*
static
PyObject
*
PyZlib_unflush
(
self
,
args
)
PyZlib_unflush
(
self
,
args
)
compobject
*
self
;
compobject
*
self
;
...
@@ -525,15 +572,15 @@ PyZlib_unflush(self, args)
...
@@ -525,15 +572,15 @@ PyZlib_unflush(self, args)
static
PyMethodDef
comp_methods
[]
=
static
PyMethodDef
comp_methods
[]
=
{
{
{
"compress"
,
PyZlib_objcompress
,
1
},
{
"compress"
,
PyZlib_objcompress
,
1
,
comp_compress__doc__
},
{
"flush"
,
PyZlib_flush
,
0
},
{
"flush"
,
PyZlib_flush
,
0
,
comp_flush__doc__
},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
static
PyMethodDef
Decomp_methods
[]
=
static
PyMethodDef
Decomp_methods
[]
=
{
{
{
"decompress"
,
PyZlib_objdecompress
,
1
},
{
"decompress"
,
PyZlib_objdecompress
,
1
,
decomp_decompress__doc__
},
{
"flush"
,
PyZlib_unflush
,
0
},
{
"flush"
,
PyZlib_unflush
,
0
,
decomp_flush__doc__
},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
...
@@ -553,6 +600,13 @@ Decomp_getattr(self, name)
...
@@ -553,6 +600,13 @@ Decomp_getattr(self, name)
return
Py_FindMethod
(
Decomp_methods
,
(
PyObject
*
)
self
,
name
);
return
Py_FindMethod
(
Decomp_methods
,
(
PyObject
*
)
self
,
name
);
}
}
static
char
adler32__doc__
[]
=
"adler32(string) -- Compute an Adler-32 checksum of string, using "
"a default starting value, and returning an integer value.
\n
"
"adler32(string, value) -- Compute an Adler-32 checksum of string, using "
"the starting value provided, and returning an integer value
\n
"
;
static
PyObject
*
static
PyObject
*
PyZlib_adler32
(
self
,
args
)
PyZlib_adler32
(
self
,
args
)
PyObject
*
self
,
*
args
;
PyObject
*
self
,
*
args
;
...
@@ -569,6 +623,12 @@ PyZlib_adler32(self, args)
...
@@ -569,6 +623,12 @@ PyZlib_adler32(self, args)
return
Py_BuildValue
(
"l"
,
adler32val
);
return
Py_BuildValue
(
"l"
,
adler32val
);
}
}
static
char
crc32__doc__
[]
=
"crc32(string) -- Compute a CRC-32 checksum of string, using "
"a default starting value, and returning an integer value.
\n
"
"crc32(string, value) -- Compute a CRC-32 checksum of string, using "
"the starting value provided, and returning an integer value.
\n
"
;
static
PyObject
*
static
PyObject
*
PyZlib_crc32
(
self
,
args
)
PyZlib_crc32
(
self
,
args
)
...
@@ -588,12 +648,12 @@ PyZlib_crc32(self, args)
...
@@ -588,12 +648,12 @@ PyZlib_crc32(self, args)
static
PyMethodDef
zlib_methods
[]
=
static
PyMethodDef
zlib_methods
[]
=
{
{
{
"adler32"
,
PyZlib_adler32
,
1
},
{
"adler32"
,
(
PyCFunction
)
PyZlib_adler32
,
1
,
adler32__doc__
},
{
"compress"
,
PyZlib_compress
,
1
},
{
"compress"
,
(
PyCFunction
)
PyZlib_compress
,
1
,
compress__doc__
},
{
"compressobj"
,
PyZlib_compressobj
,
1
},
{
"compressobj"
,
(
PyCFunction
)
PyZlib_compressobj
,
1
,
compressobj__doc__
},
{
"crc32"
,
PyZlib_crc32
,
1
},
{
"crc32"
,
(
PyCFunction
)
PyZlib_crc32
,
1
,
crc32__doc__
},
{
"decompress"
,
PyZlib_decompress
,
1
},
{
"decompress"
,
(
PyCFunction
)
PyZlib_decompress
,
1
,
decompress__doc__
},
{
"decompressobj"
,
PyZlib_decompressobj
,
1
},
{
"decompressobj"
,
(
PyCFunction
)
PyZlib_decompressobj
,
1
,
decompressobj__doc__
},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
...
@@ -653,11 +713,28 @@ insint(d, name, value)
...
@@ -653,11 +713,28 @@ insint(d, name, value)
}
}
}
}
static
char
zlib_module_documentation
[]
=
"The functions in this module allow compression and decompression "
"using the zlib library, which is based on GNU zip.
\n\n
"
"adler32(string) -- Compute an Adler-32 checksum.
\n
"
"adler32(string, start) -- Compute an Adler-32 checksum using a given starting value.
\n
"
"compress(string) -- Compress a string.
\n
"
"compress(string, level) -- Compress a string with the given level of compression (1--9).
\n
"
"compressobj([level]) -- Return a compressor object.
\n
"
"crc32(string) -- Compute a CRC-32 checksum.
\n
"
"crc32(string, start) -- Compute a CRC-32 checksum using a given starting value.
\n
"
"decompressobj([wbits]) -- Return a decompressor object (wbits=window buffer size).
\n\n
"
"Compressor objects support compress() and flush() methods; decompressor
\n
"
"objects support decompress() and flush()."
;
void
void
PyInit_zlib
()
PyInit_zlib
()
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
m
=
Py_InitModule
(
"zlib"
,
zlib_methods
);
m
=
Py_InitModule4
(
"zlib"
,
zlib_methods
,
zlib_module_documentation
,
(
PyObject
*
)
NULL
,
PYTHON_API_VERSION
);
d
=
PyModule_GetDict
(
m
);
d
=
PyModule_GetDict
(
m
);
ZlibError
=
Py_BuildValue
(
"s"
,
"zlib.error"
);
ZlibError
=
Py_BuildValue
(
"s"
,
"zlib.error"
);
PyDict_SetItemString
(
d
,
"error"
,
ZlibError
);
PyDict_SetItemString
(
d
,
"error"
,
ZlibError
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment