From 75e75225d9dfbb987ff42ac36e132b94c4731a30 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Mon, 5 Jul 2004 21:27:41 +0000 Subject: [PATCH] Move conio emulation stuff out of uifc dir and into new conio dir. This will (eventually) allow a separate stand-alone lib to be built. --- src/conio/Common.gmake | 56 ++++++++++++++++++++++++++ src/{uifc/ciowrap.c => conio/conio.c} | 3 +- src/{uifc/ciowrap.h => conio/conio.h} | 8 +--- src/{uifc => conio}/console.c | 0 src/{uifc => conio}/console.h | 0 src/{uifc => conio}/cp437-8x14.pcf.gz | Bin src/{uifc => conio}/cp437-8x16.pcf.gz | Bin src/{uifc => conio}/cp437-8x8.pcf.gz | Bin src/{uifc => conio}/curs_cio.c | 5 +-- src/{uifc => conio}/curs_cio.h | 5 ++- src/{uifc => conio}/curs_fix.h | 2 +- src/{uifc => conio}/font8x14.h | 0 src/{uifc => conio}/font8x16.h | 0 src/{uifc => conio}/font8x8.h | 0 src/{uifc => conio}/vparams.h | 0 src/{uifc => conio}/x_cio.c | 2 +- src/{uifc => conio}/x_cio.h | 2 +- src/doors/ny2008/src/Makefile | 22 ++++++---- src/doors/ny2008/src/ny2008.cpp | 1 - src/doors/ny2008/src/ny2008.h | 2 +- src/doors/ny2008/src/nyedit.cpp | 1 - src/doors/ny2008/src/nyedit.h | 2 +- src/syncterm/menu.c | 2 +- src/syncterm/syncterm.c | 3 +- src/syncterm/term.c | 2 +- src/syncterm/uifcinit.c | 3 +- src/syncterm/window.c | 2 +- src/uifc/Common.gmake | 38 +---------------- src/uifc/uifc32.c | 3 +- 29 files changed, 92 insertions(+), 72 deletions(-) create mode 100644 src/conio/Common.gmake rename src/{uifc/ciowrap.c => conio/conio.c} (99%) rename src/{uifc/ciowrap.h => conio/conio.h} (96%) rename src/{uifc => conio}/console.c (100%) rename src/{uifc => conio}/console.h (100%) rename src/{uifc => conio}/cp437-8x14.pcf.gz (100%) rename src/{uifc => conio}/cp437-8x16.pcf.gz (100%) rename src/{uifc => conio}/cp437-8x8.pcf.gz (100%) rename src/{uifc => conio}/curs_cio.c (99%) rename src/{uifc => conio}/curs_cio.h (87%) rename src/{uifc => conio}/curs_fix.h (95%) rename src/{uifc => conio}/font8x14.h (100%) rename src/{uifc => conio}/font8x16.h (100%) rename src/{uifc => conio}/font8x8.h (100%) rename src/{uifc => conio}/vparams.h (100%) rename src/{uifc => conio}/x_cio.c (99%) rename src/{uifc => conio}/x_cio.h (96%) diff --git a/src/conio/Common.gmake b/src/conio/Common.gmake new file mode 100644 index 0000000000..502e6152fd --- /dev/null +++ b/src/conio/Common.gmake @@ -0,0 +1,56 @@ +# Available Options: +# NEED_CURSES = Set flags suitable for building with the curses lib +# XCURSES = Use XCurses +# NEED_CIOWRAP = Set flage suitable for using with ciowrap lib +# NO_X = Don't use X version of ciowrap + +# You really should set this first. +CONIO_SRC ?= $(XPDEV)../conio/ +UIFC_SRC ?= $(XPDEV)../uifc/ + +CIOWRAP_CFLAGS += -I$(CONIO_SRC) +# ciowrap stuff +ifndef NO_X + X_DIR ?= /usr/X11R6/ + CIOWRAP_CFLAGS += -I${X_DIR}include + CIOWRAP_LDFLAGS += -L${X_DIR}lib -lX11 + CIOWRAP_OBJS += $(LIBODIR)/console.o $(LIBODIR)/x_cio.o +endif +CIOWRAP_OBJS += $(LIBODIR)/curs_cio.o $(LIBODIR)/conio.o +CIOWRAP_CFLAGS += -I$(UIFC_SRC) + +# Curses Stuff +ifdef XCURSES + CURSES_LDFLAGS += -lXCurses -L/usr/local/lib -lXaw -lXmu -lXt -lX11 -lSM -lICE -lXext -L/usr/X11R6/lib + CURSES_CFLAGS += -DXCURSES -I/usr/local/include +else + ifeq ($(os),qnx) + CURSES_LDFLAGS += -lncurses + CURSES_CFLAGS += -DN_CURSES_LIB + else + CURSES_LDFLAGS += -lcurses + CURSES_CFLAGS += -DCURSES_LIB + endif +endif + +CIOWRAP_CFLAGS += $(CURSES_CFLAGS) +CIOWRAP_LDFLAGS += $(CURSES_LDFLAGS) + +ifdef NEED_CIOWRAP + CFLAGS += $(CIOWRAP_CFLAGS) + LDFLAGS += $(CIOWRAP_LDFLAGS) + OBJS += $(CIOWRAP_OBJS) +endif +ifdef UIFC_NEED_CIOWRAP + UIFC_CFLAGS += $(CIOWRAP_CFLAGS) + UIFC_LDFLAGS += $(CIOWRAP_LDFLAGS) + UIFC_OBJS += $(CIOWRAP_OBJS) +endif + +ifdef NEED_CURSES + CFLAGS += $(CURSES_CFLAGS) + LDFLAGS += $(CURSES_LDFLAGS) +endif + +vpath %.c $(CONIO_SRC) +vpath %.cpp $(CONIO_SRC) diff --git a/src/uifc/ciowrap.c b/src/conio/conio.c similarity index 99% rename from src/uifc/ciowrap.c rename to src/conio/conio.c index f5485af196..5c819e5768 100644 --- a/src/uifc/ciowrap.c +++ b/src/conio/conio.c @@ -1,11 +1,12 @@ #include <stdarg.h> #include <stdio.h> -#include "ciowrap.h" +#include "conio.h" #ifndef NO_X #include "x_cio.h" #endif #include "curs_cio.h" +#undef getch cioapi_t cio_api; diff --git a/src/uifc/ciowrap.h b/src/conio/conio.h similarity index 96% rename from src/uifc/ciowrap.h rename to src/conio/conio.h index 0c891ec30a..413ae67a6e 100644 --- a/src/uifc/ciowrap.h +++ b/src/conio/conio.h @@ -4,13 +4,9 @@ #define _CIOWRAP_H_ #ifndef __unix__ -#include "conio.h" +#include <conio.h> #define initciowrap(x) #else -#include "curs_fix.h" -#ifndef NEED_CURSES_GETCH - #undef getch -#endif #ifndef BOOL #define BOOL int @@ -111,7 +107,7 @@ int movetext(int sx, int sy, int ex, int ey, int dx, int dy); char *cgets(char *str); int cscanf (char *format , ...); int kbhit(void); -#ifndef NEED_CURSES_GETCH +#ifndef NEEC_CURSES_GETCH int getch(void); #endif int getche(void); diff --git a/src/uifc/console.c b/src/conio/console.c similarity index 100% rename from src/uifc/console.c rename to src/conio/console.c diff --git a/src/uifc/console.h b/src/conio/console.h similarity index 100% rename from src/uifc/console.h rename to src/conio/console.h diff --git a/src/uifc/cp437-8x14.pcf.gz b/src/conio/cp437-8x14.pcf.gz similarity index 100% rename from src/uifc/cp437-8x14.pcf.gz rename to src/conio/cp437-8x14.pcf.gz diff --git a/src/uifc/cp437-8x16.pcf.gz b/src/conio/cp437-8x16.pcf.gz similarity index 100% rename from src/uifc/cp437-8x16.pcf.gz rename to src/conio/cp437-8x16.pcf.gz diff --git a/src/uifc/cp437-8x8.pcf.gz b/src/conio/cp437-8x8.pcf.gz similarity index 100% rename from src/uifc/cp437-8x8.pcf.gz rename to src/conio/cp437-8x8.pcf.gz diff --git a/src/uifc/curs_cio.c b/src/conio/curs_cio.c similarity index 99% rename from src/uifc/curs_cio.c rename to src/conio/curs_cio.c index d488e4bfa1..2d2e0214f2 100644 --- a/src/uifc/curs_cio.c +++ b/src/conio/curs_cio.c @@ -1,13 +1,10 @@ /* $Id$ */ -#define NEED_CURSES_GETCH - #include <sys/time.h> #include <stdarg.h> #include <unistd.h> -#include "ciowrap.h" +#include "conio.h" #include "curs_cio.h" -#include "uifc.h" /* UIFC_IBM */ static unsigned char curs_nextgetch=0; const int curs_tabs[10]={9,17,25,33,41,49,57,65,73,80}; diff --git a/src/uifc/curs_cio.h b/src/conio/curs_cio.h similarity index 87% rename from src/uifc/curs_cio.h rename to src/conio/curs_cio.h index a41a1bd0c4..db67755f8c 100644 --- a/src/uifc/curs_cio.h +++ b/src/conio/curs_cio.h @@ -1,7 +1,8 @@ /* $Id$ */ #ifdef __unix__ -#include "ciowrap.h" +#include "conio.h" +#include "curs_fix.h" #ifdef __cplusplus extern "C" { @@ -27,4 +28,6 @@ void curs_textmode(int mode); } #endif +#define UIFC_IBM (1<<4) /* Force use of IBM charset */ + #endif diff --git a/src/uifc/curs_fix.h b/src/conio/curs_fix.h similarity index 95% rename from src/uifc/curs_fix.h rename to src/conio/curs_fix.h index 886a25ccf6..cb0af3fed5 100644 --- a/src/uifc/curs_fix.h +++ b/src/conio/curs_fix.h @@ -8,7 +8,7 @@ #include <ncurses.h> #endif -#ifdef CURSES_LIB +#if defined(CURSES_LIB) || (!defined(XCURSES)&&!defined(N_CURSES_LIB)) #include <curses.h> #endif diff --git a/src/uifc/font8x14.h b/src/conio/font8x14.h similarity index 100% rename from src/uifc/font8x14.h rename to src/conio/font8x14.h diff --git a/src/uifc/font8x16.h b/src/conio/font8x16.h similarity index 100% rename from src/uifc/font8x16.h rename to src/conio/font8x16.h diff --git a/src/uifc/font8x8.h b/src/conio/font8x8.h similarity index 100% rename from src/uifc/font8x8.h rename to src/conio/font8x8.h diff --git a/src/uifc/vparams.h b/src/conio/vparams.h similarity index 100% rename from src/uifc/vparams.h rename to src/conio/vparams.h diff --git a/src/uifc/x_cio.c b/src/conio/x_cio.c similarity index 99% rename from src/uifc/x_cio.c rename to src/conio/x_cio.c index fa8ee4f5e1..2a1fd209c4 100644 --- a/src/uifc/x_cio.c +++ b/src/conio/x_cio.c @@ -1,6 +1,6 @@ #include <stdarg.h> -#include "ciowrap.h" +#include "conio.h" #include "x_cio.h" #include "console.h" WORD x_curr_attr=0x0700; diff --git a/src/uifc/x_cio.h b/src/conio/x_cio.h similarity index 96% rename from src/uifc/x_cio.h rename to src/conio/x_cio.h index 9ffd000dc6..ab6f60f0e6 100644 --- a/src/uifc/x_cio.h +++ b/src/conio/x_cio.h @@ -1,7 +1,7 @@ /* $Id$ */ #ifdef __unix__ -#include "ciowrap.h" +#include "conio.h" #ifdef __cplusplus extern "C" { diff --git a/src/doors/ny2008/src/Makefile b/src/doors/ny2008/src/Makefile index 0b709ab53a..4e54061033 100644 --- a/src/doors/ny2008/src/Makefile +++ b/src/doors/ny2008/src/Makefile @@ -1,11 +1,11 @@ CC = gcc CXX = g++ -UIFC_SRC = ../../../uifc +CONIO_SRC = ../../../conio XPDEV_SRC = ../../../xpdev ODOOR_SRC = ../../../odoors CFLAGS += -O2 CFLAGS += -g -CFLAGS += -I${ODOOR_SRC} -I${XPDEV_SRC} -I${UIFC_SRC} +CFLAGS += -I${ODOOR_SRC} -I${XPDEV_SRC} -I${CONIO_SRC} # Needed for struct alignment! CFLAGS += -fshort-enums LDFLAGS += -L${ODOOR_SRC} @@ -21,8 +21,14 @@ dirwrap.o: genwrap.o: $(CC) $(CFLAGS) -c ${XPDEV_SRC}/genwrap.c -ciowrap.o: - $(CC) $(CFLAGS) -c ${UIFC_SRC}/ciowrap.c +conio.o: curs_cio.o x_cio.o + $(CC) $(CFLAGS) -c ${CONIO_SRC}/conio.c + +curs_cio.o: + $(CC) $(CFLAGS) -c ${CONIO_SRC}/curs_cio.c + +x_cio.o: + $(CC) $(CFLAGS) -c ${CONIO_SRC}/x_cio.c fights.o : fights.cpp fights.h ny2008.h $(CXX) $(CFLAGS) -c fights.cpp @@ -42,8 +48,8 @@ chatadd.o : chatadd.cpp ny2008.h ny2008.o : ny2008.cpp $(CXX) $(CFLAGS) -c ny2008.cpp -ny2008 : ny2008.o ibbsny.o second.o igmsup.o ibbsny.o fights.o dirwrap.o filewrap.o genwrap.o ciowrap.o chatadd.o - $(CXX) $(CFLAGS) ${LDFLAGS} ciowrap.o ny2008.o chatadd.o dirwrap.o filewrap.o genwrap.o fights.o ibbsny.o igmsup.o second.o -lcurses -lODoors -lm -o ../ny2008 +ny2008 : ny2008.o ibbsny.o second.o igmsup.o ibbsny.o fights.o dirwrap.o filewrap.o genwrap.o conio.o chatadd.o + $(CXX) $(CFLAGS) ${LDFLAGS} conio.o curs_cio.o x_cio.o ny2008.o chatadd.o dirwrap.o filewrap.o genwrap.o fights.o ibbsny.o igmsup.o second.o -lcurses -lODoors -lm -o ../ny2008 aedit : aedit.cpp $(CXX) $(CFLAGS) ${LDFLAGS} aedit.cpp -o ../aedit @@ -54,8 +60,8 @@ medit : medit.cpp nyibbs : nyibbs.cpp ibbsny.o filewrap.o genwrap.o dirwrap.o $(CXX) $(CFLAGS) ${LDFLAGS} nyibbs.cpp ibbsny.o filewrap.o genwrap.o dirwrap.o -o ../nyibbs -nyedit : nyedit.cpp nyedit.h filewrap.o genwrap.o dirwrap.o ciowrap.o - $(CXX) $(CFLAGS) ${LDFLAGS} nyedit.cpp filewrap.o genwrap.o dirwrap.o ciowrap.o -lcurses -lODoors -lm -o ../nyedit +nyedit : nyedit.cpp nyedit.h filewrap.o genwrap.o dirwrap.o conio.o curs_cio.o x_cio.o + $(CXX) $(CFLAGS) ${LDFLAGS} nyedit.cpp filewrap.o genwrap.o dirwrap.o conio.o curs_cio.o x_cio.o -lcurses -lODoors -lm -o ../nyedit clean : rm -f *.o diff --git a/src/doors/ny2008/src/ny2008.cpp b/src/doors/ny2008/src/ny2008.cpp index 1d49bb136a..d273f827d4 100644 --- a/src/doors/ny2008/src/ny2008.cpp +++ b/src/doors/ny2008/src/ny2008.cpp @@ -353,7 +353,6 @@ main(int argc,char *argv[]) { rip=166; } else if (strnicmp(argv[cnt],"-L",2)==0) { od_control.od_force_local=TRUE; - initciowrap(COLOR_MODE); clrscr(); textbackground(LIGHTCYAN); textcolor(BLUE); diff --git a/src/doors/ny2008/src/ny2008.h b/src/doors/ny2008/src/ny2008.h index 9ad721ba01..1051d815a9 100644 --- a/src/doors/ny2008/src/ny2008.h +++ b/src/doors/ny2008/src/ny2008.h @@ -51,7 +51,7 @@ #include <dirwrap.h> #include <genwrap.h> #include <filewrap.h> -#include <ciowrap.h> +#include <conio.h> #endif #include <fcntl.h> #include <sys/stat.h> diff --git a/src/doors/ny2008/src/nyedit.cpp b/src/doors/ny2008/src/nyedit.cpp index 7c36511cf8..953bc89f1e 100644 --- a/src/doors/ny2008/src/nyedit.cpp +++ b/src/doors/ny2008/src/nyedit.cpp @@ -86,7 +86,6 @@ int main(int argc,char *argv[]) { do { if (strnicmp(argv[cnt],"-L",2)==0) { od_control.od_force_local=TRUE; - initciowrap(COLOR_MODE); clrscr(); textbackground(LIGHTCYAN); textcolor(BLUE); diff --git a/src/doors/ny2008/src/nyedit.h b/src/doors/ny2008/src/nyedit.h index 7eecc32f8b..7d1946abac 100644 --- a/src/doors/ny2008/src/nyedit.h +++ b/src/doors/ny2008/src/nyedit.h @@ -26,7 +26,7 @@ #include <OpenDoor.h> // Must be included in all doors #include <dirwrap.h> -#include <ciowrap.h> +#include <conio.h> #include <filewrap.h> #include <genwrap.h> diff --git a/src/syncterm/menu.c b/src/syncterm/menu.c index 1dac3106be..ef84d86b77 100644 --- a/src/syncterm/menu.c +++ b/src/syncterm/menu.c @@ -1,5 +1,5 @@ #include <uifc.h> -#include <ciowrap.h> +#include <conio.h> #include "term.h" #include "uifcinit.h" diff --git a/src/syncterm/syncterm.c b/src/syncterm/syncterm.c index 011791de3e..49d92a70aa 100644 --- a/src/syncterm/syncterm.c +++ b/src/syncterm/syncterm.c @@ -1,5 +1,5 @@ #include <stdlib.h> -#include <ciowrap.h> +#include <conio.h> #include "bbslist.h" #include "rlogin.h" @@ -40,7 +40,6 @@ int main(int argc, char **argv) if(!winsock_startup()) return(1); - initciowrap(UIFC_IBM|COLOR_MODE); gettextinfo(&txtinfo); if((txtinfo.screenwidth<40) || txtinfo.screenheight<24) { fputs("Window too small, must be at lest 80x24\n",stderr); diff --git a/src/syncterm/term.c b/src/syncterm/term.c index 3d06232682..b4ac1bd19d 100644 --- a/src/syncterm/term.c +++ b/src/syncterm/term.c @@ -1,5 +1,5 @@ #include <genwrap.h> -#include <ciowrap.h> +#include <conio.h> #include "term.h" #include "uifcinit.h" diff --git a/src/syncterm/uifcinit.c b/src/syncterm/uifcinit.c index 9bb52e39c7..5865ba1e34 100644 --- a/src/syncterm/uifcinit.c +++ b/src/syncterm/uifcinit.c @@ -1,6 +1,6 @@ #include <stdio.h> -#include <ciowrap.h> +#include <conio.h> #include <uifc.h> #include "uifcinit.h" @@ -34,7 +34,6 @@ void uifcbail(void) { if(uifc_initialized) { uifc.bail(); - initciowrap(UIFC_IBM|COLOR_MODE); } uifc_initialized=0; } diff --git a/src/syncterm/window.c b/src/syncterm/window.c index f1026a875e..c02f03551e 100644 --- a/src/syncterm/window.c +++ b/src/syncterm/window.c @@ -1,4 +1,4 @@ -#include <ciowrap.h> +#include <conio.h> #include "uifcinit.h" #include "term.h" diff --git a/src/uifc/Common.gmake b/src/uifc/Common.gmake index 0857bab22c..4b2051a0db 100644 --- a/src/uifc/Common.gmake +++ b/src/uifc/Common.gmake @@ -7,16 +7,9 @@ # You really should set this first. UIFC_SRC ?= $(XPDEV)../uifc/ +CONIO_SRC ?= $(XPDEV)../conio/ -# ciowrap stuff -ifndef NO_X - X_DIR ?= /usr/X11R6/ - CIOWRAP_CFLAGS += -I${X_DIR}include - CIOWRAP_LDFLAGS += -L${X_DIR}lib -lX11 - CIOWRAP_OBJS += $(LIBODIR)/console.o $(LIBODIR)/x_cio.o -endif -CIOWRAP_OBJS += $(LIBODIR)/curs_cio.o $(LIBODIR)/ciowrap.o -CIOWRAP_CFLAGS += -I$(UIFC_SRC) +include $(CONIO_SRC)Common.gmake # UIFC Related stuff UIFC_CFLAGS += -I$(UIFC_SRC) @@ -46,39 +39,12 @@ ifdef USE_CIOWRAP UIFC_NEED_CIOWRAP := 1 endif -# Curses Stuff -ifdef XCURSES - CURSES_LDFLAGS += -lXCurses -L/usr/local/lib -lXaw -lXmu -lXt -lX11 -lSM -lICE -lXext -L/usr/X11R6/lib - CURSES_CFLAGS += -DXCURSES -I/usr/local/include -else - ifeq ($(os),qnx) - CURSES_LDFLAGS += -lncurses - CURSES_CFLAGS += -DN_CURSES_LIB - else - CURSES_LDFLAGS += -lcurses - CURSES_CFLAGS += -DCURSES_LIB - endif -endif - -CIOWRAP_CFLAGS += $(CURSES_CFLAGS) -CIOWRAP_LDFLAGS += $(CURSES_LDFLAGS) - -ifdef NEED_CIOWRAP - CFLAGS += $(CIOWRAP_CFLAGS) - LDFLAGS += $(CIOWRAP_LDFLAGS) - OBJS += $(CIOWRAP_OBJS) -endif ifdef UIFC_NEED_CIOWRAP UIFC_CFLAGS += $(CIOWRAP_CFLAGS) UIFC_LDFLAGS += $(CIOWRAP_LDFLAGS) UIFC_OBJS += $(CIOWRAP_OBJS) endif -ifdef NEED_CURSES - CFLAGS += $(CURSES_CFLAGS) - LDFLAGS += $(CURSES_LDFLAGS) -endif - ifdef NEED_UIFC CFLAGS += $(UIFC_CFLAGS) LDFLAGS += $(UIFC_LDFLAGS) diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c index e2703f535a..d8e408b10d 100644 --- a/src/uifc/uifc32.c +++ b/src/uifc/uifc32.c @@ -48,7 +48,7 @@ #define mswait(x) Sleep(x) #endif -#include "ciowrap.h" +#include "conio.h" #include "keys.h" #include "uifc.h" #define MAX_GETSTR 5120 @@ -289,7 +289,6 @@ int uifcini32(uifcapi_t* uifcapi) */ #endif #ifdef __unix__ - initciowrap(api->mode); #ifdef NCURSES_VERSION_MAJOR if(cio_api.mode==CURSES_MODE) { ESCDELAY=api->esc_delay; -- GitLab