/* Regex object methods */
static void
-reg_dealloc(re)
- regexobject *re;
+reg_dealloc(regexobject *re)
{
if (re->re_patbuf.buffer)
PyMem_DEL(re->re_patbuf.buffer);
}
static PyObject *
-makeresult(regs)
- struct re_registers *regs;
+makeresult(struct re_registers *regs)
{
PyObject *v;
int i;
}
static PyObject *
-regobj_match(re, args)
- regexobject *re;
- PyObject *args;
+regobj_match(regexobject *re, PyObject *args)
{
PyObject *argstring;
char *buffer;
}
static PyObject *
-regobj_search(re, args)
- regexobject *re;
- PyObject *args;
+regobj_search(regexobject *re, PyObject *args)
{
PyObject *argstring;
char *buffer;
an integer index [0 .. 99]
*/
static PyObject*
-group_from_index(re, index)
- regexobject *re;
- PyObject *index;
+group_from_index(regexobject *re, PyObject *index)
{
int i, a, b;
char *v;
static PyObject *
-regobj_group(re, args)
- regexobject *re;
- PyObject *args;
+regobj_group(regexobject *re, PyObject *args)
{
int n = PyTuple_Size(args);
int i;
static PyObject *
-regobj_getattr(re, name)
- regexobject *re;
- char *name;
+regobj_getattr(regexobject *re, char *name)
{
if (strcmp(name, "regs") == 0) {
if (re->re_lastok == NULL) {
groupindex: transferred
*/
static PyObject *
-newregexobject(pattern, translate, givenpat, groupindex)
- PyObject *pattern;
- PyObject *translate;
- PyObject *givenpat;
- PyObject *groupindex;
+newregexobject(PyObject *pattern, PyObject *translate, PyObject *givenpat, PyObject *groupindex)
{
regexobject *re;
char *pat;
}
static PyObject *
-regex_compile(self, args)
- PyObject *self;
- PyObject *args;
+regex_compile(PyObject *self, PyObject *args)
{
PyObject *pat = NULL;
PyObject *tran = NULL;
}
static PyObject *
-symcomp(pattern, gdict)
- PyObject *pattern;
- PyObject *gdict;
+symcomp(PyObject *pattern, PyObject *gdict)
{
char *opat, *oend, *o, *n, *g, *v;
int group_count = 0;
}
static PyObject *
-regex_symcomp(self, args)
- PyObject *self;
- PyObject *args;
+regex_symcomp(PyObject *self, PyObject *args)
{
PyObject *pattern;
PyObject *tran = NULL;
static PyObject *cache_prog;
static int
-update_cache(pat)
- PyObject *pat;
+update_cache(PyObject *pat)
{
PyObject *tuple = Py_BuildValue("(O)", pat);
int status = 0;
}
static PyObject *
-regex_match(self, args)
- PyObject *self;
- PyObject *args;
+regex_match(PyObject *self, PyObject *args)
{
PyObject *pat, *string;
PyObject *tuple, *v;
}
static PyObject *
-regex_search(self, args)
- PyObject *self;
- PyObject *args;
+regex_search(PyObject *self, PyObject *args)
{
PyObject *pat, *string;
PyObject *tuple, *v;
}
static PyObject *
-regex_set_syntax(self, args)
- PyObject *self;
- PyObject *args;
+regex_set_syntax(PyObject *self, PyObject *args)
{
int syntax;
if (!PyArg_Parse(args, "i", &syntax))
}
static PyObject *
-regex_get_syntax(self, args)
- PyObject *self;
- PyObject *args;
+regex_get_syntax(PyObject *self, PyObject *args)
{
if (!PyArg_Parse(args, ""))
return NULL;
regexp_ansi_sequences = (regexp_syntax & RE_ANSI_HEX) != 0;
}
-int re_set_syntax(syntax)
- int syntax;
+int re_set_syntax(int syntax)
{
int ret;
return ret;
}
-static int hex_char_to_decimal(ch)
- int ch;
+static int hex_char_to_decimal(int ch)
{
if (ch >= '0' && ch <= '9')
return ch - '0';
return 16;
}
-static void re_compile_fastmap_aux(code,
- pos,
- visited,
- can_be_null,
- fastmap)
- unsigned char *code;
- int pos;
- unsigned char *visited;
- unsigned char *can_be_null;
- unsigned char *fastmap;
+static void re_compile_fastmap_aux(unsigned char *code, int pos,
+ unsigned char *visited,
+ unsigned char *can_be_null,
+ unsigned char *fastmap)
{
int a;
int b;
}
}
-static int re_do_compile_fastmap(buffer,
- used,
- pos,
- can_be_null,
- fastmap)
- unsigned char *buffer;
- int used;
- int pos;
- unsigned char *can_be_null;
- unsigned char *fastmap;
+static int re_do_compile_fastmap(unsigned char *buffer, int used, int pos,
+ unsigned char *can_be_null,
+ unsigned char *fastmap)
{
unsigned char small_visited[512], *visited;
return 1;
}
-void re_compile_fastmap(bufp)
- regexp_t bufp;
+void re_compile_fastmap(regexp_t bufp)
{
if (!bufp->fastmap || bufp->fastmap_accurate)
return;
*
*/
-static int re_optimize_star_jump(bufp, code)
- regexp_t bufp;
- unsigned char *code;
+static int re_optimize_star_jump(regexp_t bufp, unsigned char *code)
{
unsigned char map[256];
unsigned char can_be_null;
return 1;
}
-static int re_optimize(bufp)
- regexp_t bufp;
+static int re_optimize(regexp_t bufp)
{
unsigned char *code;
} \
}
-char *re_compile_pattern(regex, size, bufp)
- unsigned char *regex;
- int size;
- regexp_t bufp;
+char *re_compile_pattern(unsigned char *regex, int size, regexp_t bufp)
{
int a;
int pos;
int prev;
int offset;
int range;
- int firstchar;
-
+ int firstchar;
+
SET_LEVEL_START;
ALLOC(1+256/8);
STORE(Cset);
if (translate) \
var = translate[var]
-int re_match(bufp,
- string,
- size,
- pos,
- old_regs)
- regexp_t bufp;
- unsigned char *string;
- int size;
- int pos;
- regexp_registers_t old_regs;
+int re_match(regexp_t bufp, unsigned char *string, int size, int pos,
+ regexp_registers_t old_regs)
{
unsigned char *code;
unsigned char *translate;
#undef PREFETCH
#undef NEXTCHAR
-int re_search(bufp,
- string,
- size,
- pos,
- range,
- regs)
- regexp_t bufp;
- unsigned char *string;
- int size;
- int pos;
- int range;
- regexp_registers_t regs;
+int re_search(regexp_t bufp, unsigned char *string, int size, int pos,
+ int range, regexp_registers_t regs)
{
unsigned char *fastmap;
unsigned char *translate;
/* This defines the necessary routines to manage rotor objects */
static void
-set_seed(r)
- Rotorobj *r;
+set_seed(Rotorobj *r)
{
r->seed[0] = r->key[0];
r->seed[1] = r->key[1];
/* Return the next random number in the range [0.0 .. 1.0) */
static double
-r_random(r)
- Rotorobj *r;
+r_random(Rotorobj *r)
{
int x, y, z;
double val, term;
}
static short
-r_rand(r, s)
- Rotorobj *r;
- short s;
+r_rand(Rotorobj *r, short s)
{
return (short)((short)(r_random(r) * (double)s) % s);
}
static void
-set_key(r, key)
- Rotorobj *r;
- char *key;
+set_key(Rotorobj *r, char *key)
{
unsigned long k1=995, k2=576, k3=767, k4=671, k5=463;
size_t i;
\f
/* These define the interface to a rotor object */
static Rotorobj *
-rotorobj_new(num_rotors, key)
- int num_rotors;
- char *key;
+rotorobj_new(int num_rotors, char *key)
{
Rotorobj *xp;
/* Set ROTOR to the identity permutation */
static void
-RTR_make_id_rotor(r, rtr)
- Rotorobj *r;
- unsigned char *rtr;
+RTR_make_id_rotor(Rotorobj *r, unsigned char *rtr)
{
register int j;
register int size = r->size;
/* The current set of encryption rotors */
static void
-RTR_e_rotors(r)
- Rotorobj *r;
+RTR_e_rotors(Rotorobj *r)
{
int i;
for (i = 0; i < r->rotors; i++) {
/* The current set of decryption rotors */
static void
-RTR_d_rotors(r)
- Rotorobj *r;
+RTR_d_rotors(Rotorobj *r)
{
register int i, j;
for (i = 0; i < r->rotors; i++) {
/* The positions of the rotors at this time */
static void
-RTR_positions(r)
- Rotorobj *r;
+RTR_positions(Rotorobj *r)
{
int i;
for (i = 0; i < r->rotors; i++) {
/* The number of positions to advance the rotors at a time */
static void
-RTR_advances(r)
- Rotorobj *r;
+RTR_advances(Rotorobj *r)
{
int i;
for (i = 0; i < r->rotors; i++) {
* see Knuth for explanation of algorithm.
*/
static void
-RTR_permute_rotor(r, e, d)
- Rotorobj *r;
- unsigned char *e;
- unsigned char *d;
+RTR_permute_rotor(Rotorobj *r, unsigned char *e, unsigned char *d)
{
short i = r->size;
short q;
* Set the advancement, position, and permutation of the rotors
*/
static void
-RTR_init(r)
- Rotorobj *r;
+RTR_init(Rotorobj *r)
{
int i;
set_seed(r);
/* Change the RTR-positions vector, using the RTR-advances vector */
static void
-RTR_advance(r)
- Rotorobj *r;
+RTR_advance(Rotorobj *r)
{
register int i=0, temp=0;
if (r->size_mask) {
/* Encrypt the character P with the current rotor machine */
static unsigned char
-RTR_e_char(r, p)
- Rotorobj *r;
- unsigned char p;
+RTR_e_char(Rotorobj *r, unsigned char p)
{
register int i=0;
register unsigned char tp=p;
/* Decrypt the character C with the current rotor machine */
static unsigned char
-RTR_d_char(r, c)
- Rotorobj *r;
- unsigned char c;
+RTR_d_char(Rotorobj *r, unsigned char c)
{
register int i = r->rotors - 1;
register unsigned char tc = c;
/* Perform a rotor encryption of the region from BEG to END by KEY */
static void
-RTR_e_region(r, beg, len, doinit)
- Rotorobj *r;
- unsigned char *beg;
- int len;
- int doinit;
+RTR_e_region(Rotorobj *r, unsigned char *beg, int len, int doinit)
{
register int i;
if (doinit || r->isinited == FALSE)
/* Perform a rotor decryption of the region from BEG to END by KEY */
static void
-RTR_d_region(r, beg, len, doinit)
- Rotorobj *r;
- unsigned char *beg;
- int len;
- int doinit;
+RTR_d_region(Rotorobj *r, unsigned char *beg, int len, int doinit)
{
register int i;
if (doinit || r->isinited == FALSE)
\f
/* Rotor methods */
static void
-rotor_dealloc(xp)
- Rotorobj *xp;
+rotor_dealloc(Rotorobj *xp)
{
if (xp->e_rotor)
PyMem_DEL(xp->e_rotor);
}
static PyObject *
-rotorobj_encrypt(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_encrypt(Rotorobj *self, PyObject *args)
{
char *string = NULL;
int len = 0;
}
static PyObject *
-rotorobj_encrypt_more(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_encrypt_more(Rotorobj *self, PyObject *args)
{
char *string = NULL;
int len = 0;
}
static PyObject *
-rotorobj_decrypt(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_decrypt(Rotorobj *self, PyObject *args)
{
char *string = NULL;
int len = 0;
}
static PyObject *
-rotorobj_decrypt_more(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_decrypt_more(Rotorobj *self, PyObject *args)
{
char *string = NULL;
int len = 0;
}
static PyObject *
-rotorobj_setkey(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_setkey(Rotorobj *self, PyObject *args)
{
char *key;
/* Return a rotor object's named attribute. */
static PyObject *
-rotorobj_getattr(s, name)
- Rotorobj *s;
- char *name;
+rotorobj_getattr(Rotorobj *s, char *name)
{
return Py_FindMethod(rotorobj_methods, (PyObject*)s, name);
}
static PyObject *
-rotor_rotor(self, args)
- PyObject * self;
- PyObject * args;
+rotor_rotor(PyObject *self, PyObject *args)
{
Rotorobj *r;
char *string;