diffs for cursesmodule.c 1.0 -> 1.1

lance@fox.com
Wed, 31 Aug 94 8:58:56 PDT

Guido found a crash and a few problems with the 1.0 version of
my cursesmodule. I have fixed them and here are the diffs for those
interested. I am working on getting an email file server up and running
and this will allow people to query the latest version, gets diffs,
and get the whole module (as well as my other modules).

Please let me know if you find any other problems with this module!

*** cursesmodule.c.1.0 Tue Aug 30 16:40:19 1994
--- cursesmodule.c Wed Aug 31 08:47:18 1994
***************
*** 23,29 ****
******************************************************************/

/******************************************************************
! This is a curses implimentation. I have tried to be as complete
as possible. If there are functions you need that are not included,
please let me know and/or send me some diffs.

--- 23,29 ----
******************************************************************/

/******************************************************************
! This is a curses implementation. I have tried to be as complete
as possible. If there are functions you need that are not included,
please let me know and/or send me some diffs.

***************
*** 178,189 ****

Change Log:

Version 1.0: 94/08/30:
This is the first release of this software.
Released to the Internet via python-list@cwi.nl

******************************************************************/
! char *PyCursesVersion = "1.0 first release"

/* ------------- SCREEN routines --------------- */
#ifdef NOT_YET
--- 178,196 ----

Change Log:

+ Version 1.1: 94/08/31:
+ Minor fixes given by Guido.
+ Changed 'ncurses' to 'curses'
+ Changed '__version__' to 'version'
+ Added PyErr_Clear() where needed
+ Moved ACS_* attribute initialization to PyCurses_InitScr() to fix
+ crash on SGI
Version 1.0: 94/08/30:
This is the first release of this software.
Released to the Internet via python-list@cwi.nl

******************************************************************/
! char *PyCursesVersion = "1.1";

/* ------------- SCREEN routines --------------- */
#ifdef NOT_YET
***************
*** 405,410 ****
--- 412,418 ----
int use_xy = TRUE;
if (!PyArg_Parse(arg,"(ii);y,x", &y, &x))
use_xy = FALSE;
+ PyErr_Clear();
if (use_xy == TRUE)
rtn = mvwdelch(self->win,y,x);
else
***************
*** 750,755 ****
--- 758,764 ----
int rtn;
if (!PyArg_Parse(arg,"(ii);y,x",&y,&x))
use_xy = FALSE;
+ PyErr_Clear();
if (use_xy == TRUE)
rtn = mvwgetch(self->win,y,x);
else
***************
*** 768,773 ****
--- 777,783 ----
int rtn2;
if (!PyArg_Parse(arg,"(ii);y,x",&y,&x))
use_xy = FALSE;
+ PyErr_Clear();
if (use_xy == TRUE)
rtn2 = mvwgetstr(self->win,y,x,rtn);
else
***************
*** 787,792 ****
--- 797,803 ----
int rtn;
if (!PyArg_Parse(arg,"(ii);y,x",&y,&x))
use_xy = FALSE;
+ PyErr_Clear();
if (use_xy == TRUE)
rtn = mvwinch(self->win,y,x);
else
***************
*** 1028,1033 ****
--- 1039,1045 ----
PyObject * args;
{
static int already_inited = FALSE;
+ WINDOW *win;
if (!PyArg_NoArgs(args))
return (PyObject *)NULL;
if (already_inited == TRUE) {
***************
*** 1035,1041 ****
return (PyObject *)PyCursesWindow_New(stdscr);
}
already_inited = TRUE;
! return (PyObject *)PyCursesWindow_New(initscr());
}

static PyObject *
--- 1047,1087 ----
return (PyObject *)PyCursesWindow_New(stdscr);
}
already_inited = TRUE;
!
! win = initscr();
!
! /* This was moved from initcurses() because core dumped on SGI */
! #define SetDictChar(string,ch) \
! PyDict_SetItemString(d,string,PyInt_FromLong(ch));
!
! /* Here are some graphic symbols you can use */
! SetDictChar("ACS_ULCORNER",(ACS_ULCORNER));
! SetDictChar("ACS_ULCORNER",(ACS_ULCORNER));
! SetDictChar("ACS_LLCORNER",(ACS_LLCORNER));
! SetDictChar("ACS_URCORNER",(ACS_URCORNER));
! SetDictChar("ACS_LRCORNER",(ACS_LRCORNER));
! SetDictChar("ACS_RTEE", (ACS_RTEE));
! SetDictChar("ACS_LTEE", (ACS_LTEE));
! SetDictChar("ACS_BTEE", (ACS_BTEE));
! SetDictChar("ACS_TTEE", (ACS_TTEE));
! SetDictChar("ACS_HLINE", (ACS_HLINE));
! SetDictChar("ACS_VLINE", (ACS_VLINE));
! SetDictChar("ACS_PLUS", (ACS_PLUS));
! SetDictChar("ACS_S1", (ACS_S1));
! SetDictChar("ACS_S9", (ACS_S9));
! SetDictChar("ACS_DIAMOND", (ACS_DIAMOND));
! SetDictChar("ACS_CKBOARD", (ACS_CKBOARD));
! SetDictChar("ACS_DEGREE", (ACS_DEGREE));
! SetDictChar("ACS_PLMINUS", (ACS_PLMINUS));
! SetDictChar("ACS_BULLET", (ACS_BULLET));
! SetDictChar("ACS_LARROW", (ACS_RARROW));
! SetDictChar("ACS_DARROW", (ACS_DARROW));
! SetDictChar("ACS_UARROW", (ACS_UARROW));
! SetDictChar("ACS_BOARD", (ACS_BOARD));
! SetDictChar("ACS_LANTERN", (ACS_LANTERN));
! SetDictChar("ACS_BLOCK", (ACS_BLOCK));
!
! return (PyObject *)PyCursesWindow_New(win);
}

static PyObject *
***************
*** 1328,1339 ****
/* Initialization function for the module */

void
! initncurses()
{
PyObject *m, *d, *x;

/* Create the module and add the functions */
! m = Py_InitModule("ncurses", PyCurses_methods);

PyCurses_OK = Py_True;
PyCurses_ERR = Py_False;
--- 1374,1385 ----
/* Initialization function for the module */

void
! initcurses()
{
PyObject *m, *d, *x;

/* Create the module and add the functions */
! m = Py_InitModule("curses", PyCurses_methods);

PyCurses_OK = Py_True;
PyCurses_ERR = Py_False;
***************
*** 1343,1384 ****
d = PyModule_GetDict(m);

/* Make the version available */
! PyDict_SetItemString(d,"__version__",
PyString_FromString(PyCursesVersion));

/* Here are some defines */
PyDict_SetItemString(d,"OK", PyCurses_OK);
PyDict_SetItemString(d,"ERR",PyCurses_ERR);
-
- #define SetDictChar(string,ch) \
- PyDict_SetItemString(d,string,PyInt_FromLong(ch));
-
- /* Here are some graphic symbols you can use */
- SetDictChar("ACS_ULCORNER",(ACS_ULCORNER));
- SetDictChar("ACS_ULCORNER",(ACS_ULCORNER));
- SetDictChar("ACS_LLCORNER",(ACS_LLCORNER));
- SetDictChar("ACS_URCORNER",(ACS_URCORNER));
- SetDictChar("ACS_LRCORNER",(ACS_LRCORNER));
- SetDictChar("ACS_RTEE", (ACS_RTEE));
- SetDictChar("ACS_LTEE", (ACS_LTEE));
- SetDictChar("ACS_BTEE", (ACS_BTEE));
- SetDictChar("ACS_TTEE", (ACS_TTEE));
- SetDictChar("ACS_HLINE", (ACS_HLINE));
- SetDictChar("ACS_VLINE", (ACS_VLINE));
- SetDictChar("ACS_PLUS", (ACS_PLUS));
- SetDictChar("ACS_S1", (ACS_S1));
- SetDictChar("ACS_S9", (ACS_S9));
- SetDictChar("ACS_DIAMOND", (ACS_DIAMOND));
- SetDictChar("ACS_CKBOARD", (ACS_CKBOARD));
- SetDictChar("ACS_DEGREE", (ACS_DEGREE));
- SetDictChar("ACS_PLMINUS", (ACS_PLMINUS));
- SetDictChar("ACS_BULLET", (ACS_BULLET));
- SetDictChar("ACS_LARROW", (ACS_RARROW));
- SetDictChar("ACS_DARROW", (ACS_DARROW));
- SetDictChar("ACS_UARROW", (ACS_UARROW));
- SetDictChar("ACS_BOARD", (ACS_BOARD));
- SetDictChar("ACS_LANTERN", (ACS_LANTERN));
- SetDictChar("ACS_BLOCK", (ACS_BLOCK));

/* Here are some attributes you can add to chars to print */
PyDict_SetItemString(d, "A_NORMAL", PyInt_FromLong(A_NORMAL));
--- 1389,1400 ----
d = PyModule_GetDict(m);

/* Make the version available */
! PyDict_SetItemString(d,"version",
PyString_FromString(PyCursesVersion));

/* Here are some defines */
PyDict_SetItemString(d,"OK", PyCurses_OK);
PyDict_SetItemString(d,"ERR",PyCurses_ERR);

/* Here are some attributes you can add to chars to print */
PyDict_SetItemString(d, "A_NORMAL", PyInt_FromLong(A_NORMAL));

--
Lance Ellinghouse                lance@fox.com