diff --git a/src/conio/Common.gmake b/src/conio/Common.gmake new file mode 100644 index 0000000000000000000000000000000000000000..502e6152fdbddf78e2fa0fdb8b5c850be2d738c6 --- /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 f5485af196a42367ba6ba3279507d2287a5c5798..5c819e576896f5e2dd763769ebb6e579af4856d9 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 0c891ec30a62c2fdb11e7f1145b8e0be8d7fa826..413ae67a6efca4d264af0717ebed7c0473d117ef 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 d488e4bfa1c5c955ff3535cecd8ac6356d124459..2d2e0214f2d8f70b3ac94e5b2e62680e1b592246 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 a41a1bd0c495577d7d4c8a62413b992d03dbb538..db67755f8c5f2992027fc1464e28060204b3076a 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 886a25ccf682bf96a391895928eb6827a7928a58..cb0af3fed5b87f7e413264969dac61cebb06a6be 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 fa8ee4f5e12cd06ea55ef2870667293ed3dca52c..2a1fd209c4e50f8aea1417d5b621fe9b8284186c 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 9ffd000dc64c1d1d3472df9446ba4011b9172098..ab6f60f0e6248c532508290869237c52665f03d3 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 0b709ab53a20954db4262b1826fff9d28c8e7020..4e54061033b94a3c01dbdbf737a86e406a8c6309 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 1d49bb136a199c53059f294fff09e130aa78b676..d273f827d49fee9adcfe6cffb4d045ddc910f71f 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 9ad721ba013a581a2ffbff781f0289593a9922c9..1051d815a9578c6870dae0e348d6105e30536136 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 7c36511cf838f851acdb2c517e4a08ba4b5b8e48..953bc89f1e64c6ae58343a0cb9f0e59851c090ca 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 7eecc32f8b48d409513055db356ea0e57fc4ff34..7d1946abacb2ce5e1e177117f414773c8785aa64 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 1dac3106be9abd86234c43a332ca85c5ccc95ba1..ef84d86b77410844e7b600b45302eac8edb9b36f 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 011791de3e4bde6e8b01eb600d92136e56011beb..49d92a70aacb3ff362a13f37dd0f0a75130dcc6f 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 3d062326820c32ae220990a756c3afc282cfa5be..b4ac1bd19d7f9bfbb464b84da1b926d4a4c8761a 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 9bb52e39c7d5039fd5eaa4c01af53ed6c40f4eb2..5865ba1e34a1dcdbcde0dc247cb22fdbd60eb24c 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 f1026a875ee0b8216e9de311e0311d8bcdce6891..c02f03551e38c23a251c63b50515aa4afb8b05b7 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 0857bab22c9586e32bdb25b5747556a13b42e389..4b2051a0dbe1f38f5eef05ce2634c94cce2f5798 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 e2703f535a97b1f47732722382f35acce8445d02..d8e408b10d65f953eb38576cfd348853469b4682 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;