[Coco] curses status

Willard Goosey goosey at virgo.sdc.org
Wed Aug 19 20:41:19 EDT 2009


It works, for suitably small values of works. ;-)

After various hacks and some interesting crashes, what there is,
works.  But it's fragile. :-(

The big problem, is that this is a "subset" of real CURSES.  Under
real curses, a function like addc(a) is actually a macro, calling
waddc(stdscr,a).  stdscr is a WINDOW *, pointing at the "standard
screen" a window that's the size of the terminal's screen.

But in this "subset", stdscr is #define 0, and addc() is a seperate
function from waddc().  The problem with this, besides near-duplicate
code (the starting window needs to keep most of the data of a proper
WINDOW struct, rather it's stored in one or not), is that it wasn't
carried all the way through.  A lot of the functions take a WINDOW *
argument, and not all of them check to make sure the pointer isn't
NULL.

So, if your program calls a function with stdscr as an argument, it
might work, or it might crash horribly, depending on which function
got called!

I suppose the quick and dirty solution is to continue the style used
in the code now (if(win){use win->foo} else {use globals}) but it would
be cleaner and smaller to re-write the library do to things
correctly. 

So, that's where curses is right now.

Willard
-- 
Willard Goosey  goosey at sdc.org
Socorro, New Mexico, USA
I search my heart and find Cimmeria, land of Darkness and the Night.
  -- R.E. Howard



More information about the Coco mailing list