Subject: Fixing curses problems -- Was: How to get XaoS 3.0 to compile on NetBSD i386 1.3.1
To: 'Jan Hubicka' <hubicka@atrey.karlin.mff.cuni.cz>
From: John A. Maier - MIS dept. <johnam@mail.kemper.org>
List: netbsd-bugs
Date: 06/04/1998 11:16:21
I found that NetBSD's curses doesn't support several macros that other 
seemingly do.

To get Xaos ui_curses.c to compile I have to do this:

(change to ui_curses.c)
#ifdef USE_NCURSES
#include <ncurses.h>
#else
#include <curses.h>
#inlcude "./curses.hack.h>
#endif

(Create a include file to work around the netbsd curses.h)
/****************************************************************
*** Filename: curses.hack.h                                   ***
*** Author:   John A. Maier                                   ***
*** Date:     06/04/1998 10:54am CST                          ***
*****************************************************************
*** Some curses do not have these definitions in the curses.c ***
*** In particular I ran into this under NetBSD 1.3.x and this ***
*** fixes it.                                                 ***
****************************************************************/

#ifndef   A_BOLD
#define   A_BOLD          000400000000L
#endif
#ifndef   A_NORMAL
#define   A_NORMAL        000000000000L
#endif
#ifndef   A_REVERSE
#define   A_REVERSE       000040000000L
#endif
#ifndef   A_DIM
#define   A_DIM           000200000000L
#endif
#ifndef   KEY_UP
#define   KEY_UP          0403   /* Sent by terminal up arrow key */
#endif
#ifndef   KEY_DOWN
#define   KEY_DOWN        0402   /* Sent by terminal down arrow key */
#endif
#ifndef   KEY_LEFT
#define   KEY_LEFT        0404   /* Sent by terminal left arrow key */
#endif
#ifndef   KEY_RIGHT
#define   KEY_RIGHT       0405   /* Sent by terminal right arrow key */
#endif

I found the problem with _maxx and _maxy errors they are not (by default) 
part of the __window structure in NetBSD's curses.h, so I had to add it!

typedef struct __window {		/* Window structure. */
	struct __window	*nextp, *orig;	/* Subwindows list and parent. */
	size_t begy, begx;		/* Window home. */
	size_t cury, curx;		/* Current x, y coordinates. */
	size_t maxy, maxx;		/* Maximum values for curx, cury. */
	size_t _maxy, _maxx;		/* max coordinates */ /* added to fix Xaos compile 
error*/
	short ch_off;			/* x offset for firstch/lastch. */
	__LINE **lines;			/* Array of pointers to the lines */
	__LINE  *lspace;		/* line space (for cleanup) */
	__LDATA *wspace;		/* window space (for cleanup) */

I know that mucking around in system include files it not recomended, but I 
don't know (remember) how to do this cleanly.

So these will have to be my work arounds!

jam


----------
From: 	Jan Hubicka[SMTP:hubicka@atrey.karlin.mff.cuni.cz]
Sent: 	Thursday, June 04, 1998 2:37 AM
To: 	johnam@kemper.org
Subject: 	Re: XaoS 3.0 on NetBSD i386 1.3.1 Assembler messages (errors?)

>
> Okay I got it to compile
OK :)
>
> I had to put:
>
> /* Asembler disable for NetBSD i386 */
> #ifdef __NetBSD__
> #undef __i386__
> #endif

Hmm, so it was problems of my hacks... BTW there is some macro for 
enablig/disabling
assembly (I think it is ASSEMBLY). I will try to fix them...
>
> at the VERY begining of the files:
> /src/engine/i386.c
> /src/engin/formula.c
> src/ui/ui_helper.c
>
> Now I'm fighting with src/ui/ui-drv/curses/ui_curses.c but that will have 
to
> wait until Monday, I'm taking a few days off.

OK, let me know, whats wrong... curses.c is removed in the new version,
but I would like to know whats wrong, to avoid it in the other programs..

Honza
>
> Thanks for he help, I hope my personal HACKs work.
>
> **********************************************************************
> *       John A. Maier          * Director of MIS                     *
> * E-mail: johnam@kemper.org    * Kemper Military School and College  *
> *                              * (660) 882-3760                      *
> **********************************************************************

--
                      OK. Lets make some signature file.
+-------------------------------------------------------------------------+
|        Jan Hubicka (Jan Hubi\v{c}ka in TeX) hubicka@freesoft.cz         |
|         Czech free software foundation: http://www.freesoft.cz          |
| AA project - the new way for comupter graphics - http://www.ta.jcu.cz/aa|
|  homepage: http://www.paru.cas.cz/~hubicka/, games koules, Xonix, fast  |
|  fractal zoomer XaoS, index of Czech GNU/Linux/UN*X documentation etc.  | 
+-------------------------------------------------------------------------+