[Python-checkins] CVS: python/dist/src/Modules regexmodule.c,1.36,1.37 regexpr.c,1.30,1.31 rotormodule.c,2.24,2.25

Peter Schneider-Kamp python-dev@python.org
Mon, 10 Jul 2000 06:05:31 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv27262

Modified Files:
	regexmodule.c regexpr.c rotormodule.c 
Log Message:


ANSI-fication


Index: regexmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/regexmodule.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** regexmodule.c	2000/06/30 23:58:05	1.36
--- regexmodule.c	2000/07/10 13:05:28	1.37
***************
*** 41,46 ****
  
  static void
! reg_dealloc(re)
! 	regexobject *re;
  {
  	if (re->re_patbuf.buffer)
--- 41,45 ----
  
  static void
! reg_dealloc(regexobject *re)
  {
  	if (re->re_patbuf.buffer)
***************
*** 55,60 ****
  
  static PyObject *
! makeresult(regs)
! 	struct re_registers *regs;
  {
  	PyObject *v;
--- 54,58 ----
  
  static PyObject *
! makeresult(struct re_registers *regs)
  {
  	PyObject *v;
***************
*** 90,96 ****
  
  static PyObject *
! regobj_match(re, args)
! 	regexobject *re;
! 	PyObject *args;
  {
  	PyObject *argstring;
--- 88,92 ----
  
  static PyObject *
! regobj_match(regexobject *re, PyObject *args)
  {
  	PyObject *argstring;
***************
*** 128,134 ****
  
  static PyObject *
! regobj_search(re, args)
! 	regexobject *re;
! 	PyObject *args;
  {
  	PyObject *argstring;
--- 124,128 ----
  
  static PyObject *
! regobj_search(regexobject *re, PyObject *args)
  {
  	PyObject *argstring;
***************
*** 175,181 ****
   */
  static PyObject*
! group_from_index(re, index)
! 	regexobject *re;
! 	PyObject *index;
  {
  	int i, a, b;
--- 169,173 ----
   */
  static PyObject*
! group_from_index(regexobject *re, PyObject *index)
  {
  	int i, a, b;
***************
*** 219,225 ****
  
  static PyObject *
! regobj_group(re, args)
! 	regexobject *re;
! 	PyObject *args;
  {
  	int n = PyTuple_Size(args);
--- 211,215 ----
  
  static PyObject *
! regobj_group(regexobject *re, PyObject *args)
  {
  	int n = PyTuple_Size(args);
***************
*** 282,288 ****
  
  static PyObject *
! regobj_getattr(re, name)
! 	regexobject *re;
! 	char *name;
  {
  	if (strcmp(name, "regs") == 0) {
--- 272,276 ----
  
  static PyObject *
! regobj_getattr(regexobject *re, char *name)
  {
  	if (strcmp(name, "regs") == 0) {
***************
*** 381,389 ****
  */
  static PyObject *
! newregexobject(pattern, translate, givenpat, groupindex)
! 	PyObject *pattern;
! 	PyObject *translate;
! 	PyObject *givenpat;
! 	PyObject *groupindex;
  {
  	regexobject *re;
--- 369,373 ----
  */
  static PyObject *
! newregexobject(PyObject *pattern, PyObject *translate, PyObject *givenpat, PyObject *groupindex)
  {
  	regexobject *re;
***************
*** 433,439 ****
  
  static PyObject *
! regex_compile(self, args)
! 	PyObject *self;
! 	PyObject *args;
  {
  	PyObject *pat = NULL;
--- 417,421 ----
  
  static PyObject *
! regex_compile(PyObject *self, PyObject *args)
  {
  	PyObject *pat = NULL;
***************
*** 446,452 ****
  
  static PyObject *
! symcomp(pattern, gdict)
! 	PyObject *pattern;
! 	PyObject *gdict;
  {
  	char *opat, *oend, *o, *n, *g, *v;
--- 428,432 ----
  
  static PyObject *
! symcomp(PyObject *pattern, PyObject *gdict)
  {
  	char *opat, *oend, *o, *n, *g, *v;
***************
*** 555,561 ****
  
  static PyObject *
! regex_symcomp(self, args)
! 	PyObject *self;
! 	PyObject *args;
  {
  	PyObject *pattern;
--- 535,539 ----
  
  static PyObject *
! regex_symcomp(PyObject *self, PyObject *args)
  {
  	PyObject *pattern;
***************
*** 584,589 ****
  
  static int
! update_cache(pat)
! 	PyObject *pat;
  {
  	PyObject *tuple = Py_BuildValue("(O)", pat);
--- 562,566 ----
  
  static int
! update_cache(PyObject *pat)
  {
  	PyObject *tuple = Py_BuildValue("(O)", pat);
***************
*** 611,617 ****
  
  static PyObject *
! regex_match(self, args)
! 	PyObject *self;
! 	PyObject *args;
  {
  	PyObject *pat, *string;
--- 588,592 ----
  
  static PyObject *
! regex_match(PyObject *self, PyObject *args)
  {
  	PyObject *pat, *string;
***************
*** 631,637 ****
  
  static PyObject *
! regex_search(self, args)
! 	PyObject *self;
! 	PyObject *args;
  {
  	PyObject *pat, *string;
--- 606,610 ----
  
  static PyObject *
! regex_search(PyObject *self, PyObject *args)
  {
  	PyObject *pat, *string;
***************
*** 651,657 ****
  
  static PyObject *
! regex_set_syntax(self, args)
! 	PyObject *self;
! 	PyObject *args;
  {
  	int syntax;
--- 624,628 ----
  
  static PyObject *
! regex_set_syntax(PyObject *self, PyObject *args)
  {
  	int syntax;
***************
*** 668,674 ****
  
  static PyObject *
! regex_get_syntax(self, args)
! 	PyObject *self;
! 	PyObject *args;
  {
  	if (!PyArg_Parse(args, ""))
--- 639,643 ----
  
  static PyObject *
! regex_get_syntax(PyObject *self, PyObject *args)
  {
  	if (!PyArg_Parse(args, ""))

Index: regexpr.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/regexpr.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** regexpr.c	1999/04/10 15:46:56	1.30
--- regexpr.c	2000/07/10 13:05:28	1.31
***************
*** 547,552 ****
  }
  
! int re_set_syntax(syntax)
! 	int syntax;
  {
  	int ret;
--- 547,551 ----
  }
  
! int re_set_syntax(int syntax)
  {
  	int ret;
***************
*** 559,564 ****
  }
  
! static int hex_char_to_decimal(ch)
! 	int ch;
  {
  	if (ch >= '0' && ch <= '9')
--- 558,562 ----
  }
  
! static int hex_char_to_decimal(int ch)
  {
  	if (ch >= '0' && ch <= '9')
***************
*** 571,584 ****
  }
  
! 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;
  {
  	int a;
--- 569,576 ----
  }
  
! static void re_compile_fastmap_aux(unsigned char *code, int pos,
!                                    unsigned char *visited,
!                                    unsigned char *can_be_null,
!                                    unsigned char *fastmap)
  {
  	int a;
***************
*** 707,720 ****
  }
  
! 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;
  {
  	unsigned char small_visited[512], *visited;
--- 699,705 ----
  }
  
! 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;
***************
*** 737,742 ****
  }
  
! void re_compile_fastmap(bufp)
! 	regexp_t bufp;
  {
  	if (!bufp->fastmap || bufp->fastmap_accurate)
--- 722,726 ----
  }
  
! void re_compile_fastmap(regexp_t bufp)
  {
  	if (!bufp->fastmap || bufp->fastmap_accurate)
***************
*** 783,789 ****
   */
  
! static int re_optimize_star_jump(bufp, code)
! 	regexp_t bufp;
! 	unsigned char *code;
  {
  	unsigned char map[256];
--- 767,771 ----
   */
  
! static int re_optimize_star_jump(regexp_t bufp, unsigned char *code)
  {
  	unsigned char map[256];
***************
*** 946,951 ****
  }
  
! static int re_optimize(bufp)
! 	regexp_t bufp;
  {
  	unsigned char *code;
--- 928,932 ----
  }
  
! static int re_optimize(regexp_t bufp)
  {
  	unsigned char *code;
***************
*** 1148,1155 ****
  }
  
! char *re_compile_pattern(regex, size, bufp)
! 	unsigned char *regex;
! 	int size;
! 	regexp_t bufp;
  {
  	int a;
--- 1129,1133 ----
  }
  
! char *re_compile_pattern(unsigned char *regex, int size, regexp_t bufp)
  {
  	int a;
***************
*** 1418,1423 ****
  			int offset;
  			int range;
! 			int firstchar;
! 	    
  			SET_LEVEL_START;
  			ALLOC(1+256/8);
--- 1396,1401 ----
  			int offset;
  			int range;
!                         int firstchar;
!                         
  			SET_LEVEL_START;
  			ALLOC(1+256/8);
***************
*** 1587,1600 ****
  	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;
  {
  	unsigned char *code;
--- 1565,1570 ----
  	var = translate[var]
  
! int re_match(regexp_t bufp, unsigned char *string, int size, int pos,
!              regexp_registers_t old_regs)
  {
  	unsigned char *code;
***************
*** 2022,2037 ****
  #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;
  {
  	unsigned char *fastmap;
--- 1992,1997 ----
  #undef NEXTCHAR
  
! int re_search(regexp_t bufp, unsigned char *string, int size, int pos,
!               int range, regexp_registers_t regs)
  {
  	unsigned char *fastmap;

Index: rotormodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/rotormodule.c,v
retrieving revision 2.24
retrieving revision 2.25
diff -C2 -r2.24 -r2.25
*** rotormodule.c	2000/06/28 21:31:10	2.24
--- rotormodule.c	2000/07/10 13:05:29	2.25
***************
*** 88,93 ****
  
  static void
! set_seed(r) 
! 	Rotorobj *r;
  {
  	r->seed[0] = r->key[0];
--- 88,92 ----
  
  static void
! set_seed(Rotorobj *r)
  {
  	r->seed[0] = r->key[0];
***************
*** 99,104 ****
  /* Return the next random number in the range [0.0 .. 1.0) */
  static double
! r_random(r)
! 	Rotorobj *r;
  {
  	int x, y, z;
--- 98,102 ----
  /* Return the next random number in the range [0.0 .. 1.0) */
  static double
! r_random(Rotorobj *r)
  {
  	int x, y, z;
***************
*** 135,141 ****
  
  static short
! r_rand(r, s)
! 	Rotorobj *r;
! 	short s;
  {
  	return (short)((short)(r_random(r) * (double)s) % s);
--- 133,137 ----
  
  static short
! r_rand(Rotorobj *r, short s)
  {
  	return (short)((short)(r_random(r) * (double)s) % s);
***************
*** 143,149 ****
  
  static void
! set_key(r, key)
! 	Rotorobj *r;
! 	char *key;
  {
  	unsigned long k1=995, k2=576, k3=767, k4=671, k5=463;
--- 139,143 ----
  
  static void
! set_key(Rotorobj *r, char *key)
  {
  	unsigned long k1=995, k2=576, k3=767, k4=671, k5=463;
***************
*** 173,179 ****
  /* These define the interface to a rotor object */
  static Rotorobj *
! rotorobj_new(num_rotors, key)
! 	int num_rotors;
! 	char *key;
  {
  	Rotorobj *xp;
--- 167,171 ----
  /* These define the interface to a rotor object */
  static Rotorobj *
! rotorobj_new(int num_rotors, char *key)
  {
  	Rotorobj *xp;
***************
*** 252,258 ****
  /* Set ROTOR to the identity permutation */
  static void
! RTR_make_id_rotor(r, rtr)
! 	Rotorobj *r;
! 	unsigned char *rtr;
  {
  	register int j;
--- 244,248 ----
  /* Set ROTOR to the identity permutation */
  static void
! RTR_make_id_rotor(Rotorobj *r, unsigned char *rtr)
  {
  	register int j;
***************
*** 266,271 ****
  /* The current set of encryption rotors */
  static void
! RTR_e_rotors(r)
! 	Rotorobj *r;
  {
  	int i;
--- 256,260 ----
  /* The current set of encryption rotors */
  static void
! RTR_e_rotors(Rotorobj *r)
  {
  	int i;
***************
*** 277,282 ****
  /* The current set of decryption rotors */
  static void
! RTR_d_rotors(r)
! 	Rotorobj *r;
  {
  	register int i, j;
--- 266,270 ----
  /* The current set of decryption rotors */
  static void
! RTR_d_rotors(Rotorobj *r)
  {
  	register int i, j;
***************
*** 290,295 ****
  /* The positions of the rotors at this time */
  static void
! RTR_positions(r)
! 	Rotorobj *r;
  {
  	int i;
--- 278,282 ----
  /* The positions of the rotors at this time */
  static void
! RTR_positions(Rotorobj *r)
  {
  	int i;
***************
*** 301,306 ****
  /* The number of positions to advance the rotors at a time */
  static void
! RTR_advances(r) 
! 	Rotorobj *r;
  {
  	int i;
--- 288,292 ----
  /* The number of positions to advance the rotors at a time */
  static void
! RTR_advances(Rotorobj *r)
  {
  	int i;
***************
*** 314,321 ****
   */
  static void
! RTR_permute_rotor(r, e, d)
! 	Rotorobj *r;
! 	unsigned char *e;
! 	unsigned char *d;
  {
  	short i = r->size;
--- 300,304 ----
   */
  static void
! RTR_permute_rotor(Rotorobj *r, unsigned char *e, unsigned char *d)
  {
  	short i = r->size;
***************
*** 339,344 ****
   */
  static void
! RTR_init(r)
! 	Rotorobj *r;
  {
  	int i;
--- 322,326 ----
   */
  static void
! RTR_init(Rotorobj *r)
  {
  	int i;
***************
*** 360,365 ****
  /* Change the RTR-positions vector, using the RTR-advances vector */
  static void
! RTR_advance(r)
! 	Rotorobj *r;
  {
  	register int i=0, temp=0;
--- 342,346 ----
  /* Change the RTR-positions vector, using the RTR-advances vector */
  static void
! RTR_advance(Rotorobj *r)
  {
  	register int i=0, temp=0;
***************
*** 387,393 ****
  /* Encrypt the character P with the current rotor machine */
  static unsigned char
! RTR_e_char(r, p)
! 	Rotorobj *r;
! 	unsigned char p;
  {
  	register int i=0;
--- 368,372 ----
  /* Encrypt the character P with the current rotor machine */
  static unsigned char
! RTR_e_char(Rotorobj *r, unsigned char p)
  {
  	register int i=0;
***************
*** 414,420 ****
  /* Decrypt the character C with the current rotor machine */
  static unsigned char
! RTR_d_char(r, c)
! 	Rotorobj *r;
! 	unsigned char c;
  {
  	register int i = r->rotors - 1;
--- 393,397 ----
  /* Decrypt the character C with the current rotor machine */
  static unsigned char
! RTR_d_char(Rotorobj *r, unsigned char c)
  {
  	register int i = r->rotors - 1;
***************
*** 441,449 ****
  /* 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;
  {
  	register int i;
--- 418,422 ----
  /* Perform a rotor encryption of the region from BEG to END by KEY */
  static void
! RTR_e_region(Rotorobj *r, unsigned char *beg, int len, int doinit)
  {
  	register int i;
***************
*** 457,465 ****
  /* 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;
  {
  	register int i;
--- 430,434 ----
  /* Perform a rotor decryption of the region from BEG to END by KEY */
  static void
! RTR_d_region(Rotorobj *r, unsigned char *beg, int len, int doinit)
  {
  	register int i;
***************
*** 475,480 ****
  /* Rotor methods */
  static void
! rotor_dealloc(xp)
! 	Rotorobj *xp;
  {
  	if (xp->e_rotor)
--- 444,448 ----
  /* Rotor methods */
  static void
! rotor_dealloc(Rotorobj *xp)
  {
  	if (xp->e_rotor)
***************
*** 490,496 ****
  
  static PyObject * 
! rotorobj_encrypt(self, args)
! 	Rotorobj *self;
! 	PyObject * args;
  {
  	char *string = NULL;
--- 458,462 ----
  
  static PyObject * 
! rotorobj_encrypt(Rotorobj *self, PyObject *args)
  {
  	char *string = NULL;
***************
*** 514,520 ****
  
  static PyObject * 
! rotorobj_encrypt_more(self, args)
! 	Rotorobj *self;
! 	PyObject * args;
  {
  	char *string = NULL;
--- 480,484 ----
  
  static PyObject * 
! rotorobj_encrypt_more(Rotorobj *self, PyObject *args)
  {
  	char *string = NULL;
***************
*** 538,544 ****
  
  static PyObject * 
! rotorobj_decrypt(self, args)
! 	Rotorobj *self;
! 	PyObject * args;
  {
  	char *string = NULL;
--- 502,506 ----
  
  static PyObject * 
! rotorobj_decrypt(Rotorobj *self, PyObject *args)
  {
  	char *string = NULL;
***************
*** 562,568 ****
  
  static PyObject * 
! rotorobj_decrypt_more(self, args)
! 	Rotorobj *self;
! 	PyObject * args;
  {
  	char *string = NULL;
--- 524,528 ----
  
  static PyObject * 
! rotorobj_decrypt_more(Rotorobj *self, PyObject *args)
  {
  	char *string = NULL;
***************
*** 586,592 ****
  
  static PyObject * 
! rotorobj_setkey(self, args)
! 	Rotorobj *self;
! 	PyObject * args;
  {
  	char *key;
--- 546,550 ----
  
  static PyObject * 
! rotorobj_setkey(Rotorobj *self, PyObject *args)
  {
  	char *key;
***************
*** 613,619 ****
  /* Return a rotor object's named attribute. */
  static PyObject * 
! rotorobj_getattr(s, name)
! 	Rotorobj *s;
! 	char *name;
  {
  	return Py_FindMethod(rotorobj_methods, (PyObject*)s, name);
--- 571,575 ----
  /* Return a rotor object's named attribute. */
  static PyObject * 
! rotorobj_getattr(Rotorobj *s, char *name)
  {
  	return Py_FindMethod(rotorobj_methods, (PyObject*)s, name);
***************
*** 639,645 ****
  
  static PyObject * 
! rotor_rotor(self, args)
! 	PyObject * self;
! 	PyObject * args;
  {
  	Rotorobj *r;
--- 595,599 ----
  
  static PyObject * 
! rotor_rotor(PyObject *self, PyObject *args)
  {
  	Rotorobj *r;