[Python-checkins] python/nondist/sandbox/csv _csv.c,1.24,1.25

andrewmcnamara@users.sourceforge.net andrewmcnamara@users.sourceforge.net
Mon, 10 Feb 2003 00:40:09 -0800


Update of /cvsroot/python/python/nondist/sandbox/csv
In directory sc8-pr-cvs1:/tmp/cvs-serv29422

Modified Files:
	_csv.c 
Log Message:
Turned Dialect struct into a fully fledged Python type and moved
dialect/keyword parsing onto it's init function. ReaderObj and WriterObj
now contain pointers to objects of this type, and have a "dialect" 
attribute - this made several things cleaner. Switched Reader_Type 
and Writer_Type to use 2.2 style attribute access - this allows better
introspection.


Index: _csv.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/csv/_csv.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** _csv.c	10 Feb 2003 03:42:16 -0000	1.24
--- _csv.c	10 Feb 2003 08:40:04 -0000	1.25
***************
*** 52,55 ****
--- 52,57 ----
  
  typedef struct {
+         PyObject_HEAD
+         
  	int doublequote;	/* is " represented by ""? */
  	char delimiter;		/* field separator */
***************
*** 61,65 ****
  
[...1259 lines suppressed...]
! 	/* Add quote styles into disctionary */
  	for (style = quote_styles; style->name; style++) {
  		v = PyInt_FromLong(style->style);
--- 1417,1421 ----
                  return;
  
! 	/* Add quote styles into dictionary */
  	for (style = quote_styles; style->name; style++) {
  		v = PyInt_FromLong(style->style);
***************
*** 1297,1300 ****
--- 1426,1433 ----
  			return;
  	}
+ 
+         /* Add the Dialect type */
+         if (PyModule_AddObject(module, "Dialect", (PyObject *)&Dialect_Type))
+                 return;
  
  	/* Add the CSV exception object to the module. */