ANSI-fication

This commit is contained in:
Peter Schneider-Kamp 2000-07-10 09:57:19 +00:00
parent fe74263cec
commit a788a7f0fb
4 changed files with 43 additions and 124 deletions

View File

@ -187,9 +187,7 @@ static unsigned short crctab_hqx[256] = {
static char doc_a2b_uu[] = "(ascii) -> bin. Decode a line of uuencoded data"; static char doc_a2b_uu[] = "(ascii) -> bin. Decode a line of uuencoded data";
static PyObject * static PyObject *
binascii_a2b_uu(self, args) binascii_a2b_uu(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -264,9 +262,7 @@ binascii_a2b_uu(self, args)
static char doc_b2a_uu[] = "(bin) -> ascii. Uuencode line of data"; static char doc_b2a_uu[] = "(bin) -> ascii. Uuencode line of data";
static PyObject * static PyObject *
binascii_b2a_uu(self, args) binascii_b2a_uu(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -315,10 +311,7 @@ binascii_b2a_uu(self, args)
static int static int
binascii_find_valid(s, slen, num) binascii_find_valid(unsigned char *s, int slen, int num)
char *s;
int slen;
int num;
{ {
/* Finds & returns the (num+1)th /* Finds & returns the (num+1)th
** valid character for base64, or -1 if none. ** valid character for base64, or -1 if none.
@ -345,9 +338,7 @@ binascii_find_valid(s, slen, num)
static char doc_a2b_base64[] = "(ascii) -> bin. Decode a line of base64 data"; static char doc_a2b_base64[] = "(ascii) -> bin. Decode a line of base64 data";
static PyObject * static PyObject *
binascii_a2b_base64(self, args) binascii_a2b_base64(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -430,9 +421,7 @@ binascii_a2b_base64(self, args)
static char doc_b2a_base64[] = "(bin) -> ascii. Base64-code line of data"; static char doc_b2a_base64[] = "(bin) -> ascii. Base64-code line of data";
static PyObject * static PyObject *
binascii_b2a_base64(self, args) binascii_b2a_base64(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -483,9 +472,7 @@ binascii_b2a_base64(self, args)
static char doc_a2b_hqx[] = "ascii -> bin, done. Decode .hqx coding"; static char doc_a2b_hqx[] = "ascii -> bin, done. Decode .hqx coding";
static PyObject * static PyObject *
binascii_a2b_hqx(self, args) binascii_a2b_hqx(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -549,9 +536,7 @@ binascii_a2b_hqx(self, args)
static char doc_rlecode_hqx[] = "Binhex RLE-code binary data"; static char doc_rlecode_hqx[] = "Binhex RLE-code binary data";
static PyObject * static PyObject *
binascii_rlecode_hqx(self, args) binascii_rlecode_hqx(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
unsigned char *in_data, *out_data; unsigned char *in_data, *out_data;
PyObject *rv; PyObject *rv;
@ -598,9 +583,7 @@ PyObject *args;
static char doc_b2a_hqx[] = "Encode .hqx data"; static char doc_b2a_hqx[] = "Encode .hqx data";
static PyObject * static PyObject *
binascii_b2a_hqx(self, args) binascii_b2a_hqx(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -640,9 +623,7 @@ binascii_b2a_hqx(self, args)
static char doc_rledecode_hqx[] = "Decode hexbin RLE-coded string"; static char doc_rledecode_hqx[] = "Decode hexbin RLE-coded string";
static PyObject * static PyObject *
binascii_rledecode_hqx(self, args) binascii_rledecode_hqx(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
unsigned char *in_data, *out_data; unsigned char *in_data, *out_data;
unsigned char in_byte, in_repeat; unsigned char in_byte, in_repeat;
@ -739,9 +720,7 @@ static char doc_crc_hqx[] =
"(data, oldcrc) -> newcrc. Compute hqx CRC incrementally"; "(data, oldcrc) -> newcrc. Compute hqx CRC incrementally";
static PyObject * static PyObject *
binascii_crc_hqx(self, args) binascii_crc_hqx(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
unsigned char *bin_data; unsigned char *bin_data;
unsigned int crc; unsigned int crc;
@ -879,9 +858,7 @@ static unsigned long crc_32_tab[256] = {
}; };
static PyObject * static PyObject *
binascii_crc32(self, args) binascii_crc32(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ /* By Jim Ahlstrom; All rights transferred to CNRI */ { /* By Jim Ahlstrom; All rights transferred to CNRI */
unsigned char *bin_data; unsigned char *bin_data;
unsigned long crc = 0UL; /* initial value of CRC */ unsigned long crc = 0UL; /* initial value of CRC */

View File

@ -9,8 +9,7 @@
/* Module crypt */ /* Module crypt */
static PyObject *crypt_crypt(self, args) static PyObject *crypt_crypt(PyObject *self, PyObject *args)
PyObject *self, *args;
{ {
char *word, *salt; char *word, *salt;
extern char * crypt(); extern char * crypt();

View File

@ -45,9 +45,7 @@ extern char *(*PyOS_ReadlineFunctionPointer)(char *);
/* Exported function to send one line to readline's init file parser */ /* Exported function to send one line to readline's init file parser */
static PyObject * static PyObject *
parse_and_bind(self, args) parse_and_bind(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *s, *copy; char *s, *copy;
if (!PyArg_ParseTuple(args, "s:parse_and_bind", &s)) if (!PyArg_ParseTuple(args, "s:parse_and_bind", &s))
@ -73,9 +71,7 @@ Parse and execute single line of a readline init file.\
/* Exported function to parse a readline init file */ /* Exported function to parse a readline init file */
static PyObject * static PyObject *
read_init_file(self, args) read_init_file(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *s = NULL; char *s = NULL;
if (!PyArg_ParseTuple(args, "|z:read_init_file", &s)) if (!PyArg_ParseTuple(args, "|z:read_init_file", &s))
@ -97,9 +93,7 @@ The default filename is the last filename used.\
/* Exported function to load a readline history file */ /* Exported function to load a readline history file */
static PyObject * static PyObject *
read_history_file(self, args) read_history_file(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *s = NULL; char *s = NULL;
if (!PyArg_ParseTuple(args, "|z:read_history_file", &s)) if (!PyArg_ParseTuple(args, "|z:read_history_file", &s))
@ -121,9 +115,7 @@ The default filename is ~/.history.\
/* Exported function to save a readline history file */ /* Exported function to save a readline history file */
static PyObject * static PyObject *
write_history_file(self, args) write_history_file(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *s = NULL; char *s = NULL;
if (!PyArg_ParseTuple(args, "|z:write_history_file", &s)) if (!PyArg_ParseTuple(args, "|z:write_history_file", &s))
@ -152,9 +144,7 @@ static PyObject *endidx = NULL;
/* get the beginning index for the scope of the tab-completion */ /* get the beginning index for the scope of the tab-completion */
static PyObject * static PyObject *
get_begidx(self, args) get_begidx(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
if(!PyArg_NoArgs(args)) { if(!PyArg_NoArgs(args)) {
return NULL; return NULL;
@ -169,9 +159,7 @@ get the beginning index of the readline tab-completion scope";
/* get the ending index for the scope of the tab-completion */ /* get the ending index for the scope of the tab-completion */
static PyObject * static PyObject *
get_endidx(self, args) get_endidx(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
if(!PyArg_NoArgs(args)) { if(!PyArg_NoArgs(args)) {
return NULL; return NULL;
@ -188,9 +176,7 @@ get the ending index of the readline tab-completion scope";
/* set the tab-completion word-delimiters that readline uses */ /* set the tab-completion word-delimiters that readline uses */
static PyObject * static PyObject *
set_completer_delims(self, args) set_completer_delims(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *break_chars; char *break_chars;
@ -211,9 +197,7 @@ set the readline word delimiters for tab-completion";
/* get the tab-completion word-delimiters that readline uses */ /* get the tab-completion word-delimiters that readline uses */
static PyObject * static PyObject *
get_completer_delims(self, args) get_completer_delims(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
if(!PyArg_NoArgs(args)) { if(!PyArg_NoArgs(args)) {
return NULL; return NULL;
@ -226,9 +210,7 @@ get_completer_delims() -> string\n\
get the readline word delimiters for tab-completion"; get the readline word delimiters for tab-completion";
static PyObject * static PyObject *
set_completer(self, args) set_completer(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *function = Py_None; PyObject *function = Py_None;
if (!PyArg_ParseTuple(args, "|O:set_completer", &function)) if (!PyArg_ParseTuple(args, "|O:set_completer", &function))
@ -265,9 +247,7 @@ It should return the next possible completion starting with 'text'.\
/* Exported function to read the current line buffer */ /* Exported function to read the current line buffer */
static PyObject * static PyObject *
get_line_buffer(self, args) get_line_buffer(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
if (!PyArg_NoArgs(args)) if (!PyArg_NoArgs(args))
return NULL; return NULL;
@ -282,9 +262,7 @@ return the current contents of the line buffer.\
/* Exported function to insert text into the line buffer */ /* Exported function to insert text into the line buffer */
static PyObject * static PyObject *
insert_text(self, args) insert_text(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *s; char *s;
if (!PyArg_ParseTuple(args, "s:insert_text", &s)) if (!PyArg_ParseTuple(args, "s:insert_text", &s))
@ -325,9 +303,7 @@ static struct PyMethodDef readline_methods[] =
/* C function to call the Python completer. */ /* C function to call the Python completer. */
static char * static char *
on_completion(text, state) on_completion(char *text, int state)
char *text;
int state;
{ {
char *result = NULL; char *result = NULL;
if (completer != NULL) { if (completer != NULL) {
@ -366,10 +342,7 @@ on_completion(text, state)
* before calling the normal completer */ * before calling the normal completer */
char ** char **
flex_complete(text, start, end) flex_complete(char *text, int start, int end)
char *text;
int start;
int end;
{ {
Py_XDECREF(begidx); Py_XDECREF(begidx);
Py_XDECREF(endidx); Py_XDECREF(endidx);
@ -413,8 +386,7 @@ static jmp_buf jbuf;
/* ARGSUSED */ /* ARGSUSED */
static RETSIGTYPE static RETSIGTYPE
onintr(sig) onintr(int sig)
int sig;
{ {
longjmp(jbuf, 1); longjmp(jbuf, 1);
} }
@ -423,8 +395,7 @@ onintr(sig)
/* Wrapper around GNU readline that handles signals differently. */ /* Wrapper around GNU readline that handles signals differently. */
static char * static char *
call_readline(prompt) call_readline(char *prompt)
char *prompt;
{ {
size_t n; size_t n;
char *p, *q; char *p, *q;

View File

@ -42,8 +42,7 @@ static char decompressobj__doc__[] =
; ;
static compobject * static compobject *
newcompobject(type) newcompobject(PyTypeObject *type)
PyTypeObject *type;
{ {
compobject *self; compobject *self;
self = PyObject_New(compobject, type); self = PyObject_New(compobject, type);
@ -62,9 +61,7 @@ static char compress__doc__[] =
; ;
static PyObject * static PyObject *
PyZlib_compress(self, args) PyZlib_compress(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *ReturnVal; PyObject *ReturnVal;
Byte *input, *output; Byte *input, *output;
@ -160,9 +157,7 @@ static char decompress__doc__[] =
; ;
static PyObject * static PyObject *
PyZlib_decompress(self, args) PyZlib_decompress(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *result_str; PyObject *result_str;
Byte *input; Byte *input;
@ -267,9 +262,7 @@ PyZlib_decompress(self, args)
} }
static PyObject * static PyObject *
PyZlib_compressobj(selfptr, args) PyZlib_compressobj(PyObject *selfptr, PyObject *args)
PyObject *selfptr;
PyObject *args;
{ {
compobject *self; compobject *self;
int level=Z_DEFAULT_COMPRESSION, method=DEFLATED; int level=Z_DEFAULT_COMPRESSION, method=DEFLATED;
@ -316,9 +309,7 @@ PyZlib_compressobj(selfptr, args)
} }
static PyObject * static PyObject *
PyZlib_decompressobj(selfptr, args) PyZlib_decompressobj(PyObject *selfptr, PyObject *args)
PyObject *selfptr;
PyObject *args;
{ {
int wbits=DEF_WBITS, err; int wbits=DEF_WBITS, err;
compobject *self; compobject *self;
@ -363,8 +354,7 @@ PyZlib_decompressobj(selfptr, args)
} }
static void static void
Comp_dealloc(self) Comp_dealloc(compobject *self)
compobject *self;
{ {
if (self->is_initialised) if (self->is_initialised)
deflateEnd(&self->zst); deflateEnd(&self->zst);
@ -373,8 +363,7 @@ Comp_dealloc(self)
} }
static void static void
Decomp_dealloc(self) Decomp_dealloc(compobject *self)
compobject *self;
{ {
inflateEnd(&self->zst); inflateEnd(&self->zst);
Py_XDECREF(self->unused_data); Py_XDECREF(self->unused_data);
@ -390,9 +379,7 @@ static char comp_compress__doc__[] =
static PyObject * static PyObject *
PyZlib_objcompress(self, args) PyZlib_objcompress(compobject *self, PyObject *args)
compobject *self;
PyObject *args;
{ {
int err = Z_OK, inplen; int err = Z_OK, inplen;
int length = DEFAULTALLOC; int length = DEFAULTALLOC;
@ -449,9 +436,7 @@ static char decomp_decompress__doc__[] =
; ;
static PyObject * static PyObject *
PyZlib_objdecompress(self, args) PyZlib_objdecompress(compobject *self, PyObject *args)
compobject *self;
PyObject *args;
{ {
int length, err, inplen; int length, err, inplen;
PyObject *RetVal; PyObject *RetVal;
@ -523,9 +508,7 @@ static char comp_flush__doc__[] =
; ;
static PyObject * static PyObject *
PyZlib_flush(self, args) PyZlib_flush(compobject *self, PyObject *args)
compobject *self;
PyObject *args;
{ {
int length=DEFAULTALLOC, err = Z_OK; int length=DEFAULTALLOC, err = Z_OK;
PyObject *RetVal; PyObject *RetVal;
@ -622,9 +605,7 @@ static char decomp_flush__doc__[] =
; ;
static PyObject * static PyObject *
PyZlib_unflush(self, args) PyZlib_unflush(compobject *self, PyObject *args)
compobject *self;
PyObject *args;
{ {
int length=0, err; int length=0, err;
PyObject *RetVal; PyObject *RetVal;
@ -707,17 +688,13 @@ static PyMethodDef Decomp_methods[] =
}; };
static PyObject * static PyObject *
Comp_getattr(self, name) Comp_getattr(compobject *self, char *name)
compobject *self;
char *name;
{ {
return Py_FindMethod(comp_methods, (PyObject *)self, name); return Py_FindMethod(comp_methods, (PyObject *)self, name);
} }
static PyObject * static PyObject *
Decomp_getattr(self, name) Decomp_getattr(compobject *self, char *name)
compobject *self;
char *name;
{ {
if (strcmp(name, "unused_data") == 0) if (strcmp(name, "unused_data") == 0)
{ {
@ -735,8 +712,7 @@ static char adler32__doc__[] =
; ;
static PyObject * static PyObject *
PyZlib_adler32(self, args) PyZlib_adler32(PyObject *self, PyObject *args)
PyObject *self, *args;
{ {
uLong adler32val=adler32(0L, Z_NULL, 0); uLong adler32val=adler32(0L, Z_NULL, 0);
Byte *buf; Byte *buf;
@ -758,8 +734,7 @@ static char crc32__doc__[] =
; ;
static PyObject * static PyObject *
PyZlib_crc32(self, args) PyZlib_crc32(PyObject *self, PyObject *args)
PyObject *self, *args;
{ {
uLong crc32val=crc32(0L, Z_NULL, 0); uLong crc32val=crc32(0L, Z_NULL, 0);
Byte *buf; Byte *buf;
@ -824,10 +799,7 @@ statichere PyTypeObject Decomptype = {
/* Convenience routine to export an integer value. /* Convenience routine to export an integer value.
For simplicity, errors (which are unlikely anyway) are ignored. */ For simplicity, errors (which are unlikely anyway) are ignored. */
static void static void
insint(d, name, value) insint(PyObject *d, char *name, int value)
PyObject *d;
char *name;
int value;
{ {
PyObject *v = PyInt_FromLong((long) value); PyObject *v = PyInt_FromLong((long) value);
if (v == NULL) { if (v == NULL) {