Mail Archives: djgpp/1993/01/19/15:57:48
Following are the diffs applied to the PDCURSES package as distributed
on comp.sources.misc a few weeks back (I'm reasonably sure it was the
current volume, v34). It also adds DV awareness to the original
distribution when compiled for dos (which doesn't work with go32, but
it was worth doing anyway :-)).
Enjoy.
diff +context +recursive curses.old/curses.h curses/curses.h
*** curses.old/curses.h Sat Dec 05 18:16:06 1992
--- curses/curses.h Sun Jan 17 03:20:36 1993
***************
*** 235,240 ****
--- 235,262 ----
#endif
/*----------------------------------------
+ * GNU compilers djgpp
+ *
+ * djgpp definitions:
+ * GO32
+ * DOS
+ */
+ #ifdef __GO32__ /* You may have to define in makefile */
+ # define GO32 1
+ # define ANSI 1 /* GNU supports ANSI C prototypes */
+ # define DOS 6
+ # include <dos.h>
+ # ifdef __FLEXOS__ /* define this on the command line */
+ # define FLEXOS 2 /* or latest major release value. */
+ # endif
+ # define CURSES__32BIT__
+ # ifdef _cplusplus
+ # define CPLUSPLUS 1
+ # endif
+ # define NO_VSSCANF 1 /* define if no vsscanf() function in library */
+ #endif
+
+ /*----------------------------------------
* Watcom C/386 9.0X compiler
*
* WATCOM definitions:
diff +context +recursive curses.old/curspriv.h curses/curspriv.h
*** curses.old/curspriv.h Sat Dec 05 18:16:10 1992
--- curses/curspriv.h Sun Jan 17 03:00:56 1993
***************
*** 55,60 ****
--- 55,73 ----
# define FAST_VIDEO 1 /* We can write directly to the screen. */
typedef union REGS Regs;
extern Regs regs;
+ #ifdef __GO32__
+ #define _FAR_POINTER(s,o) (0xe0000000 + s*16 + o)
+ #define _FP_SEGMENT(p) (unsigned short)((((long)fp) >> 4) & 0xffff)
+ #define _FP_OFFSET(p) ((unsigned short)fp & 0x000f)
+ #else
+ #ifdef __TURBOC__
+ #define _FAR_POINTER(s,o) ((unsigned long)s * 16 + (unsigned long)o)
+ #else
+ #define _FAR_POINTER(s,o) ((long(s) << 16) | long(o))
+ #endif
+ #define _FP_SEGMENT(p) (unsigned short)(((long)fp) >> 4)
+ #define _FP_OFFSET(p) ((unsigned short)fp & 0x000f)
+ #endif
#endif
/*----------------------------------------*/
diff +context +recursive curses.old/makefile curses/makefile
*** curses.old/makefile Sat Dec 05 18:16:12 1992
--- curses/makefile Sun Jan 17 03:50:32 1993
***************
*** 12,17 ****
--- 12,18 ----
# DOS TC OS=DOS COMP=TC Borland Turbo C
# DOS MSC OS=DOS COMP=MSC Microsoft C
# DOS QC OS=DOS COMP=QC Microsoft Quick C
+ # DOS GO32 OS=DOS COMP=GO32 DJGPP gnu C
# OS2 MSC OS=OS2 COMP=MSC Microsoft C
# OS2 CSET2 OS=OS2 COMP=CSET2 IBM C Set/2
# OS2 EMX OS=OS2 COMP=EMX emx/gcc
***************
*** 29,35 ****
# change values below or override with -e switch on command line
#-----------------------------------------------------------------------
OS=DOS
! COMP=BCC
OPT=Y
#-----------------------------------------------------------------------
.IF $(TOS) == $(NULL)
--- 30,36 ----
# change values below or override with -e switch on command line
#-----------------------------------------------------------------------
OS=DOS
! COMP=GO32
OPT=Y
#-----------------------------------------------------------------------
.IF $(TOS) == $(NULL)
***************
*** 257,267 ****
DLFLAGS = $(LDEBUG) $*.obj,,,$(PDCLIB);
UTLFLAGS = $(LDEBUG) $*.obj;
MANFLAGS = $(LDEBUG) $*.obj+$(SETARGV);
.END
.END
#-----------------------------------------------------------------------
! ROOTDIR = c:\curses
! CC_INC = c:/curses
PORT_DIR = $(ROOTDIR)\portable
NONP_DIR = $(ROOTDIR)\nonport
PRIV_DIR = $(ROOTDIR)\private
--- 258,298 ----
DLFLAGS = $(LDEBUG) $*.obj,,,$(PDCLIB);
UTLFLAGS = $(LDEBUG) $*.obj;
MANFLAGS = $(LDEBUG) $*.obj+$(SETARGV);
+ #========================================================================
+ #========================= DOS - DJGPP ==================================
+ #========================================================================
+ .ELIF $(COMP) == GO32
+ LINK = $(CC)
+ CC = gcc
+ LIB_EXE = ar
+ LIB_DIR = lib
+ LIBFLAGS = rcv
+ RUNBIND = aout2exe $*
+ DEFINES =
+ .IF $(OPT) == N
+ CDEBUG = -g
+ LDEBUG = -g
+ DBG = d
+ .ELSE
+ CDEBUG = -O -DNDEBUG
+ LDEBUG =
+ DBG =
+ .END
+ OBJ = o
+ OBJ_DIR = o$(DBG)
+ PDCLIB = curses$(DBG).a
+ LIBRSP =
+ CFLAGS = $(CDEBUG) $(DEFINES) -o$(@:db).$(OBJ) -c -I$(CC_INC)
+ MAKE_LIB = $(LIB_EXE) $(LIBFLAGS) $(PDCLIB) $(OBJ_DIR)/*.$(OBJ)
+ DLFLAGS = $(LDEBUG) -L$(LIB_DIR) $*.$(OBJ) $(PDCLIB) -o $*
+ UTLFLAGS = $(LDEBUG) -L$(LIB_DIR) $*.$(OBJ) -o $*
+ MANFLAGS = $(LDEBUG) -Le:/djgpp/lib -lc $*.$(OBJ) -o $*
+ EMX_OMF_LIB=ranlib $(PDCLIB)
.END
.END
#-----------------------------------------------------------------------
! ROOTDIR = .
! CC_INC = .
PORT_DIR = $(ROOTDIR)\portable
NONP_DIR = $(ROOTDIR)\nonport
PRIV_DIR = $(ROOTDIR)\private
***************
*** 287,318 ****
#######################################################################
demos: $(PDCLIB) xmas.exe newdemo.exe testcurs.exe firework.exe
! newdemo.exe: $(PDCLIB) newdemo.obj
$(LINK) $(DLFLAGS)
! xmas.exe: $(PDCLIC) xmas.obj
$(LINK) $(DLFLAGS)
! testcurs.exe: $(PDCLIB) testcurs.obj
$(LINK) $(DLFLAGS)
! firework.exe: $(PDCLIB) firework.obj
$(LINK) $(DLFLAGS)
! newdemo.obj: $(HEADERS) $(DEMO_DIR)\newdemo.c
$(CC) $(CFLAGS) $(DEMO_DIR)\newdemo.c
$(EMX_OMF_OBJ)
! xmas.obj: $(HEADERS) $(DEMO_DIR)\xmas.c
$(CC) $(CFLAGS) $(DEMO_DIR)\xmas.c
$(EMX_OMF_OBJ)
! testcurs.obj: $(HEADERS) $(DEMO_DIR)\testcurs.c
$(CC) $(CFLAGS) $(DEMO_DIR)\testcurs.c
$(EMX_OMF_OBJ)
! firework.obj: $(HEADERS) $(DEMO_DIR)\firework.c
$(CC) $(CFLAGS) $(DEMO_DIR)\firework.c
$(EMX_OMF_OBJ)
--- 318,353 ----
#######################################################################
demos: $(PDCLIB) xmas.exe newdemo.exe testcurs.exe firework.exe
! newdemo.exe: $(PDCLIB) newdemo.$(OBJ)
$(LINK) $(DLFLAGS)
+ $(RUNBIND)
! xmas.exe: $(PDCLIC) xmas.$(OBJ)
$(LINK) $(DLFLAGS)
+ $(RUNBIND)
! testcurs.exe: $(PDCLIB) testcurs.$(OBJ)
$(LINK) $(DLFLAGS)
+ $(RUNBIND)
! firework.exe: $(PDCLIB) firework.$(OBJ)
$(LINK) $(DLFLAGS)
+ $(RUNBIND)
! newdemo.$(OBJ): $(HEADERS) $(DEMO_DIR)\newdemo.c
$(CC) $(CFLAGS) $(DEMO_DIR)\newdemo.c
$(EMX_OMF_OBJ)
! xmas.$(OBJ): $(HEADERS) $(DEMO_DIR)\xmas.c
$(CC) $(CFLAGS) $(DEMO_DIR)\xmas.c
$(EMX_OMF_OBJ)
! testcurs.$(OBJ): $(HEADERS) $(DEMO_DIR)\testcurs.c
$(CC) $(CFLAGS) $(DEMO_DIR)\testcurs.c
$(EMX_OMF_OBJ)
! firework.$(OBJ): $(HEADERS) $(DEMO_DIR)\firework.c
$(CC) $(CFLAGS) $(DEMO_DIR)\firework.c
$(EMX_OMF_OBJ)
***************
*** 320,338 ****
######################### Utility Program Targets ####################
#######################################################################
! buildlrf.exe: buildlrf.obj
$(LINK) $(UTLFLAGS)
$(RUNBIND)
! buildlrf.obj: $(TOOLS_DIR)\buildlrf.c
$(CC) $(CFLAGS) $(TOOLS_DIR)\buildlrf.c
$(EMX_OMF_OBJ)
! manext.exe: manext.obj
$(LINK) $(MANFLAGS)
$(RUNBIND)
! manext.obj: $(TOOLS_DIR)\manext.c
$(CC) $(CFLAGS) $(TOOLS_DIR)\manext.c
$(EMX_OMF_OBJ)
--- 355,373 ----
######################### Utility Program Targets ####################
#######################################################################
! buildlrf.exe: buildlrf.$(OBJ)
$(LINK) $(UTLFLAGS)
$(RUNBIND)
! buildlrf.$(OBJ): $(TOOLS_DIR)\buildlrf.c
$(CC) $(CFLAGS) $(TOOLS_DIR)\buildlrf.c
$(EMX_OMF_OBJ)
! manext.exe: manext.$(OBJ)
$(LINK) $(MANFLAGS)
$(RUNBIND)
! manext.$(OBJ): $(TOOLS_DIR)\manext.c
$(CC) $(CFLAGS) $(TOOLS_DIR)\manext.c
$(EMX_OMF_OBJ)
***************
*** 437,443 ****
lib: $(PDCLIB)
+if exist $(PDCLIB) del $(PDCLIB)
+if exist $(LRF) del $(LRF)
! +for %%f in ($(OBJ_DIR)\*.obj) do buildlrf +%%f $(LRF)
+echo $(LIBRSP) >> $(LRF)
$(MAKE_LIB)
$(EMX_OMF_LIB)
--- 472,478 ----
lib: $(PDCLIB)
+if exist $(PDCLIB) del $(PDCLIB)
+if exist $(LRF) del $(LRF)
! +for %%f in ($(OBJ_DIR)\*.$(OBJ)) do buildlrf +%%f $(LRF)
+echo $(LIBRSP) >> $(LRF)
$(MAKE_LIB)
$(EMX_OMF_LIB)
***************
*** 513,519 ****
#######################################################################
clean:
+del PDCurses.ar? > NUL:
! +del $(OBJ_DIR)\*.obj
zoo:
zoo a pdcurs20 $(ROOTDIR)\readme $(ROOTDIR)\makefile $(HEADERS)
--- 548,554 ----
#######################################################################
clean:
+del PDCurses.ar? > NUL:
! +del $(OBJ_DIR)\*.$(OBJ)
zoo:
zoo a pdcurs20 $(ROOTDIR)\readme $(ROOTDIR)\makefile $(HEADERS)
diff +context +recursive curses.old/portable/flushinp.c curses/portable/flushinp.c
*** curses.old/portable/flushinp.c Sat Dec 05 18:16:16 1992
--- curses/portable/flushinp.c Sun Jan 17 03:00:56 1993
***************
*** 47,54 ****
#if defined(DOS) && defined(FAST_VIDEO)
! short *KB_HEAD = (short *) 0x041aL; /* 40:1A BIOS KB head */
! short *KB_TAIL = (short *) 0x041cL; /* 40:1A BIOS KB tail */
*KB_HEAD = *KB_TAIL; /* Force the BIOS kbd buf */
/* head/tail pointers to be the */
--- 47,54 ----
#if defined(DOS) && defined(FAST_VIDEO)
! short *KB_HEAD = (short *) _FAR_POINTER(0,0x41a); /* 40:1A BIOS KB head */
! short *KB_TAIL = (short *) _FAR_POINTER(0,0x41c); /* 40:1A BIOS KB tail */
*KB_HEAD = *KB_TAIL; /* Force the BIOS kbd buf */
/* head/tail pointers to be the */
diff +context +recursive curses.old/private/_clrupda.c curses/private/_clrupda.c
*** curses.old/private/_clrupda.c Sat Dec 05 18:16:20 1992
--- curses/private/_clrupda.c Sun Jan 17 03:00:56 1993
***************
*** 126,132 ****
_cursvar.video_ofs + (i*COLS*sizeof(chtype)),
(COLS * sizeof(chtype)));
# else
! memcpy(MK_FP(_cursvar.video_seg,
_cursvar.video_ofs + (i * COLS * sizeof(chtype))),
ch, (COLS * sizeof(chtype)));
# endif
--- 126,132 ----
_cursvar.video_ofs + (i*COLS*sizeof(chtype)),
(COLS * sizeof(chtype)));
# else
! memcpy((void *)_FAR_POINTER(_cursvar.video_seg,
_cursvar.video_ofs + (i * COLS * sizeof(chtype))),
ch, (COLS * sizeof(chtype)));
# endif
diff +context +recursive curses.old/private/_fixcurs.c curses/private/_fixcurs.c
*** curses.old/private/_fixcurs.c Sat Dec 05 18:16:34 1992
--- curses/private/_fixcurs.c Sun Jan 17 03:01:00 1993
***************
*** 42,48 ****
return( OK );
#endif
#ifdef DOS
! char far* INFO = (char far *) 0x0487L;
if (_cursvar.bogus_adapter)
return( OK );
--- 42,52 ----
return( OK );
#endif
#ifdef DOS
! # if SMALL || MEDIUM || MSC
! char far* INFO = (char far *)_FAR_POINTER(0,0x0487);
! # else
! char * INFO = (char *)_FAR_POINTER(0,0x0487);
! # endif
if (_cursvar.bogus_adapter)
return( OK );
diff +context +recursive curses.old/private/_gbiosky.c curses/private/_gbiosky.c
*** curses.old/private/_gbiosky.c Sat Dec 05 18:16:24 1992
--- curses/private/_gbiosky.c Sun Jan 17 03:01:00 1993
***************
*** 42,52 ****
int ascii,scan;
#ifdef DOS
static unsigned char keyboard_function=0xFF;
unsigned char far *enhanced_keyboard;
if (keyboard_function == 0xFF)
{
! enhanced_keyboard = (unsigned char far *) 0x0496L;
regs.h.ah = 0x02; /* get shift status for all keyboards */
int86(0x16, ®s, ®s);
scan = regs.h.al;
--- 42,61 ----
int ascii,scan;
#ifdef DOS
static unsigned char keyboard_function=0xFF;
+ # if SMALL || MEDIUM || MSC
unsigned char far *enhanced_keyboard;
+ # else
+ unsigned char *enhanced_keyboard;
+ # endif
if (keyboard_function == 0xFF)
{
!
! # if SMALL || MEDIUM || MSC
! enhanced_keyboard = (unsigned char far *) _FAR_POINTER(0,0x496);
! # else
! enhanced_keyboard = (unsigned char *) _FAR_POINTER(0,0x496);
! # endif
regs.h.ah = 0x02; /* get shift status for all keyboards */
int86(0x16, ®s, ®s);
scan = regs.h.al;
diff +context +recursive curses.old/private/_getcrsr.c curses/private/_getcrsr.c
*** curses.old/private/_getcrsr.c Sat Dec 05 18:16:38 1992
--- curses/private/_getcrsr.c Sun Jan 17 03:01:00 1993
***************
*** 43,52 ****
return (FALSE);
#endif
#ifdef DOS
- short far* CURSOR_MODE;
short cmode;
- CURSOR_MODE = (short far *) 0x0460L;
cmode = *CURSOR_MODE;
return (cmode);
#endif
--- 43,55 ----
return (FALSE);
#endif
#ifdef DOS
short cmode;
+ # if SMALL || MEDIUM
+ short far* CURSOR_MODE = (short far *) _FAR_POINTER(0,0x0460);
+ # else
+ short * CURSOR_MODE = (short *) _FAR_POINTER(0,0x0460);
+ # endif
cmode = *CURSOR_MODE;
return (cmode);
#endif
diff +context +recursive curses.old/private/_getfont.c curses/private/_getfont.c
*** curses.old/private/_getfont.c Sat Dec 05 18:16:38 1992
--- curses/private/_getfont.c Sun Jan 17 03:01:00 1993
***************
*** 33,41 ****
{
#if defined (DOS) && defined (FAST_VIDEO)
int retval;
! short far *POINTS;
- POINTS = (short far *) 0x0485L;
retval = *POINTS;
if ((retval == 0) && (_cursvar.adapter == _MDS_GENIUS))
{
--- 33,44 ----
{
#if defined (DOS) && defined (FAST_VIDEO)
int retval;
! # if SMALL || MEDIUM
! short far *POINTS = (short far *) _FAR_POINTER (0,0x485);
! # else
! short *POINTS = (short *) _FAR_POINTER (0,0x485);
! # endif
retval = *POINTS;
if ((retval == 0) && (_cursvar.adapter == _MDS_GENIUS))
{
diff +context +recursive curses.old/private/_getrows.c curses/private/_getrows.c
*** curses.old/private/_getrows.c Sat Dec 05 18:16:24 1992
--- curses/private/_getrows.c Sun Jan 17 03:01:00 1993
***************
*** 35,46 ****
return (vir.vc_size.rs_nrows);
#endif
#ifdef DOS
! char far* ROWS;
int rows;
char *env_rows;
/* use the value from LINES environment variable, if set. MH 10-Jun-92 */
/* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */
- ROWS = (char far *) 0x0484L;
rows = *ROWS + 1;
env_rows = (char *)getenv("LINES");
if (env_rows != (char *)NULL)
--- 35,49 ----
return (vir.vc_size.rs_nrows);
#endif
#ifdef DOS
! # if SMALL || MEDIUM
! char far* ROWS = (char far *) _FAR_POINTER(0,0x484);
! # else
! char * ROWS = (char *) _FAR_POINTER(0,0x484);
! # endif
int rows;
char *env_rows;
/* use the value from LINES environment variable, if set. MH 10-Jun-92 */
/* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */
rows = *ROWS + 1;
env_rows = (char *)getenv("LINES");
if (env_rows != (char *)NULL)
diff +context +recursive curses.old/private/_queryad.c curses/private/_queryad.c
*** curses.old/private/_queryad.c Sat Dec 05 18:16:18 1992
--- curses/private/_queryad.c Sun Jan 17 03:04:26 1993
***************
*** 44,50 ****
#ifdef DOS
int retval = _NONE;
int equip;
! short far *VIDEO_BASE;
/*
* Attempt to call VGA Identify Adapter Function...
--- 44,55 ----
#ifdef DOS
int retval = _NONE;
int equip;
! struct SREGS segs;
! # if SMALL || MEDIUM
! short far *VIDEO_BASE = (void far *) _FAR_POINTER(0,0x0463);
! # else
! short *VIDEO_BASE = (void *) _FAR_POINTER(0,0x0463);
! # endif
/*
* Attempt to call VGA Identify Adapter Function...
***************
*** 143,149 ****
}
}
}
! VIDEO_BASE = (void far *) 0x0463L;
if (*VIDEO_BASE == 0x3d4)
{
_cursvar.video_seg = 0xb800;
--- 148,154 ----
}
}
}
!
if (*VIDEO_BASE == 0x3d4)
{
_cursvar.video_seg = 0xb800;
***************
*** 183,189 ****
_cursvar.mono = TRUE;
else
_cursvar.mono = FALSE;
! if (!_cursvar.adapter)
_cursvar.adapter = retval;
return (PDC_sanity_check(retval));
#endif
--- 188,203 ----
_cursvar.mono = TRUE;
else
_cursvar.mono = FALSE;
!
! regs.h.ah = 0xfe; /* Check for DESQview shadow buffer */
! regs.h.al = 0;
! regs.x.di = _cursvar.video_ofs;
! segs.es = _cursvar.video_seg;
! int86x(0x10, ®s, ®s, &segs);
! _cursvar.video_ofs = regs.x.di;
! _cursvar.video_seg = segs.es;
!
! if (!_cursvar.adapter)
_cursvar.adapter = retval;
return (PDC_sanity_check(retval));
#endif
diff +context +recursive curses.old/private/_scropen.c curses/private/_scropen.c
*** curses.old/private/_scropen.c Sat Dec 05 18:16:26 1992
--- curses/private/_scropen.c Sun Jan 17 03:01:02 1993
***************
*** 60,66 ****
#endif
#ifdef DOS
! char far *INFO = (char far *) 0x0487L;
internal->orig_attr = 0;
internal->orig_emulation = *INFO;
--- 60,70 ----
#endif
#ifdef DOS
! # if SMALL || MEDIUM
! char far *INFO = (char far *) _FAR_POINTER(0,0x487);
! # else
! char *INFO = (char *) _FAR_POINTER(0,0x487);
! # endif
internal->orig_attr = 0;
internal->orig_emulation = *INFO;
diff +context +recursive curses.old/private/_xfrmlin.c curses/private/_xfrmlin.c
*** curses.old/private/_xfrmlin.c Sat Dec 05 18:16:18 1992
--- curses/private/_xfrmlin.c Sun Jan 17 03:01:04 1993
***************
*** 130,136 ****
_cursvar.video_ofs+(((lineno*curscr->_maxx)+x)*sizeof(chtype)),
len * sizeof(chtype));
# else
! memcpy(MK_FP(_cursvar.video_seg,
_cursvar.video_ofs + (((lineno * curscr->_maxx) + x) * sizeof(chtype))),
ch, len * sizeof(chtype));
# endif
--- 130,136 ----
_cursvar.video_ofs+(((lineno*curscr->_maxx)+x)*sizeof(chtype)),
len * sizeof(chtype));
# else
! memcpy((void *)_FAR_POINTER(_cursvar.video_seg,
_cursvar.video_ofs + (((lineno * curscr->_maxx) + x) * sizeof(chtype))),
ch, len * sizeof(chtype));
# endif
--
davidn AT csource DOT oz DOT au 3:632/348 AT fidonet 58:4100/1 AT intlnet 199:4242/5 AT rainbownet
Unique Computing P/L / Communications+LAN Specialists / Public Access USENET
- Raw text -