[Python-checkins] python/dist/src/Modules xxmodule.c,2.31,2.32

montanaro@users.sourceforge.net montanaro@users.sourceforge.net
Tue, 13 Aug 2002 18:44:36 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv4607

Modified Files:
	xxmodule.c 
Log Message:
add PyDoc_STR and PyDoc_STRVAR calls as examples for module authors


Index: xxmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/xxmodule.c,v
retrieving revision 2.31
retrieving revision 2.32
diff -C2 -d -r2.31 -r2.32
*** xxmodule.c	2 Aug 2002 02:27:13 -0000	2.31
--- xxmodule.c	14 Aug 2002 01:44:33 -0000	2.32
***************
*** 58,62 ****
  
  static PyMethodDef Xxo_methods[] = {
! 	{"demo",	(PyCFunction)Xxo_demo,	METH_VARARGS},
  	{NULL,		NULL}		/* sentinel */
  };
--- 58,63 ----
  
  static PyMethodDef Xxo_methods[] = {
! 	{"demo",	(PyCFunction)Xxo_demo,	METH_VARARGS,
! 		PyDoc_STR("demo() -> None")},
  	{NULL,		NULL}		/* sentinel */
  };
***************
*** 144,147 ****
--- 145,153 ----
  /* Function of two integers returning integer */
  
+ PyDoc_STRVAR(xx_foo_doc,
+ "foo(i,j)\n\
+ \n\
+ Return the sum of i and j.");
+ 
  static PyObject *
  xx_foo(PyObject *self, PyObject *args)
***************
*** 209,219 ****
  
  static PyMethodDef xx_methods[] = {
! 	{"roj",		xx_roj,		METH_VARARGS},
! 	{"foo",		xx_foo,		METH_VARARGS},
! 	{"new",		xx_new,		METH_VARARGS},
! 	{"bug",		xx_bug,		METH_VARARGS},
  	{NULL,		NULL}		/* sentinel */
  };
  
  
  /* Initialization function for the module (*must* be called initxx) */
--- 215,231 ----
  
  static PyMethodDef xx_methods[] = {
! 	{"roj",		xx_roj,		METH_VARARGS,
! 		PyDoc_STR("roj(a,b) -> None")},
! 	{"foo",		xx_foo,		METH_VARARGS,
! 	 	xx_foo_doc},
! 	{"new",		xx_new,		METH_VARARGS,
! 		PyDoc_STR("new() -> new Xx object")},
! 	{"bug",		xx_bug,		METH_VARARGS,
! 		PyDoc_STR("bug(o) -> None")},
  	{NULL,		NULL}		/* sentinel */
  };
  
+ PyDoc_STRVAR(module_doc,
+ "This is a template module just for instruction.");
  
  /* Initialization function for the module (*must* be called initxx) */
***************
*** 229,233 ****
  
  	/* Create the module and add the functions */
! 	m = Py_InitModule("xx", xx_methods);
  
  	/* Add some symbolic constants to the module */
--- 241,245 ----
  
  	/* Create the module and add the functions */
! 	m = Py_InitModule3("xx", xx_methods, module_doc);
  
  	/* Add some symbolic constants to the module */