├── SRC ├── SCUP │ ├── ED.BAT │ ├── DOT.C │ ├── PMENU.C │ ├── PRT.C │ ├── PRTT.C │ ├── GLOBAL.C │ ├── MAKEBACK.BAT │ ├── PREPROC.C │ ├── PRTUTIL.C │ ├── CUPSETUP.C │ ├── PRINTING.C │ ├── FUNCMAC.H │ ├── TURBOC.CFG │ ├── ERROR.C │ ├── INC.H │ ├── CUPTYPE.H │ ├── SCUP.TLR │ ├── TABLE.H │ ├── CPTHAI.H │ ├── LDFONT.C │ ├── KBD.C │ ├── TUTIL1.C │ ├── CPTHAI.C │ ├── PRINTVAR.EXT │ ├── SMENU.C │ ├── MAKEFILE │ ├── CONST.H │ ├── PRNCNTRL.C │ ├── GLOBAL.EXT │ ├── PROTO.H │ ├── PCONFIG.C │ ├── PRTBUF24.C │ ├── 24PINS.H │ ├── PRTG.C │ ├── CPI.C │ └── ATTR.C ├── SCUW │ ├── ED.BAT │ ├── CW.C │ ├── BLOCK.C │ ├── FILE.C │ ├── GRPH.C │ ├── INS.C │ ├── KARAN.C │ ├── KBD.C │ ├── MAKEBACK.BAT │ ├── MENU.C │ ├── MOVE.C │ ├── SARAA.C │ ├── SARAO.C │ ├── SARAR.C │ ├── SARAU.C │ ├── THAI.H │ ├── VAR.H │ ├── CWSETUP.C │ ├── GETSTR.C │ ├── GLOBAL.C │ ├── HUNAKAD.C │ ├── MAIMUAN.C │ ├── NOPCUT.C │ ├── ONSCRN.C │ ├── RORERU.C │ ├── SARAAH.C │ ├── SARAAIR.C │ ├── SARAIE.C │ ├── SARAUE.C │ ├── SARAUEE.C │ ├── SEARCH.C │ ├── STATUS.C │ ├── TCTYPE.H │ ├── MAIMALAI.C │ ├── WOREWAAN.C │ ├── SARAUM.C │ ├── TURBOC.CFG │ ├── TMODE.C │ ├── CUFONT.C │ ├── ROREREO.C │ ├── SCRN.C │ ├── CONST.H │ ├── GLOBAL.H │ ├── SCUW.TLR │ ├── LEADCON.C │ ├── INC.H │ ├── NEWROUTI.H │ ├── THAIENG.C │ ├── FINDCHAR.C │ ├── NSTRCMP.C │ ├── CONVERT.H │ ├── ROUTINE.H │ ├── HOREHEEB.C │ ├── MAINSYLS.C │ ├── TUTIL1.C │ ├── MAKEFILE │ ├── MOVEMENT.C │ ├── PROTO.H │ └── WRAP.C ├── SCUF │ ├── WRITE.H │ ├── DIR.C │ ├── FED.C │ ├── FONTMSG.C │ ├── GETSTR.C │ ├── HERCF.OBJ │ ├── CUFSETUP.C │ ├── EGAVGAF.OBJ │ ├── TCCONFIG.TC │ ├── TCPICK.TCP │ ├── GETCH.H │ ├── FONTMSG.H │ ├── TURBOC.CFG │ ├── POPUP.H │ ├── SCUF.TLR │ ├── CONST.H │ ├── FED.PRJ │ ├── INC.H │ ├── FILE.C │ ├── KEY.H │ ├── PROTO.H │ ├── FED.H │ ├── TUTIL1.C │ ├── GETCH.C │ ├── MAKEFILE │ ├── KBD.C │ ├── WRITE.C │ ├── INT.C │ ├── VAR.H │ ├── POPUP.C │ └── CONST.C ├── COMMON │ ├── DIR.C │ ├── CSCRN.C │ ├── FILEUTIL.H │ ├── TURBOC.CFG │ ├── STAMPDAT.C │ ├── CONST.H │ ├── TCONV.C │ ├── CWFNTM.ASM │ ├── CWFNTAM.ASM │ ├── CWFNTHM.ASM │ ├── TUTIL1.C │ ├── CWTYPE.H │ ├── GRDETECT.H │ ├── CWAGRPH.C │ ├── MAKEFILE │ ├── FILEUTIL.C │ ├── SOUND.C │ ├── CWEGRPH.C │ ├── EKBD.C │ ├── CUSONG.C │ ├── PROTO.H │ ├── CWGRPHC.C │ ├── CWGRPHC.H │ ├── KBDCODE.H │ └── GRDETECT.C └── MAKE.BAT ├── MANUAL1 ├── MANUAL10 ├── MANUAL11 ├── MANUAL2 ├── MANUAL3 ├── MANUAL4 ├── MANUAL5 ├── MANUAL6 ├── MANUAL7 ├── MANUAL8 ├── MANUAL9 ├── TEST.DOC ├── CUFONT.DOC ├── CW141.DOC ├── ITALIC.FON ├── ITALIC.P24 ├── ITALIC.PRN ├── ITALICS.P24 ├── ITALICS.PRN ├── MANUAL1.DOC ├── MANUAL2.DOC ├── MANUAL3.DOC ├── MANUAL4.DOC ├── MANUAL5.DOC ├── MANUAL6.DOC ├── MANUAL7.DOC ├── MANUAL8.DOC ├── MANUAL9.DOC ├── NORMAL.FON ├── NORMAL.P24 ├── NORMAL.PRN ├── NORMALS.P24 ├── NORMALS.PRN ├── TAIRUT.DOC ├── TEST2.DOC ├── TEST3.DOC ├── MANUAL10.DOC ├── MANUAL11.DOC └── README.md /SRC/SCUP/ED.BAT: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | \CU\CW %1 3 | -------------------------------------------------------------------------------- /SRC/SCUW/ED.BAT: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | \CU\CW %1 3 | -------------------------------------------------------------------------------- /MANUAL1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL1 -------------------------------------------------------------------------------- /MANUAL10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL10 -------------------------------------------------------------------------------- /MANUAL11: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL11 -------------------------------------------------------------------------------- /MANUAL2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL2 -------------------------------------------------------------------------------- /MANUAL3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL3 -------------------------------------------------------------------------------- /MANUAL4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL4 -------------------------------------------------------------------------------- /MANUAL5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL5 -------------------------------------------------------------------------------- /MANUAL6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL6 -------------------------------------------------------------------------------- /MANUAL7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL7 -------------------------------------------------------------------------------- /MANUAL8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL8 -------------------------------------------------------------------------------- /MANUAL9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL9 -------------------------------------------------------------------------------- /TEST.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/TEST.DOC -------------------------------------------------------------------------------- /CUFONT.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/CUFONT.DOC -------------------------------------------------------------------------------- /CW141.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/CW141.DOC -------------------------------------------------------------------------------- /ITALIC.FON: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/ITALIC.FON -------------------------------------------------------------------------------- /ITALIC.P24: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/ITALIC.P24 -------------------------------------------------------------------------------- /ITALIC.PRN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/ITALIC.PRN -------------------------------------------------------------------------------- /ITALICS.P24: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/ITALICS.P24 -------------------------------------------------------------------------------- /ITALICS.PRN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/ITALICS.PRN -------------------------------------------------------------------------------- /MANUAL1.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL1.DOC -------------------------------------------------------------------------------- /MANUAL2.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL2.DOC -------------------------------------------------------------------------------- /MANUAL3.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL3.DOC -------------------------------------------------------------------------------- /MANUAL4.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL4.DOC -------------------------------------------------------------------------------- /MANUAL5.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL5.DOC -------------------------------------------------------------------------------- /MANUAL6.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL6.DOC -------------------------------------------------------------------------------- /MANUAL7.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL7.DOC -------------------------------------------------------------------------------- /MANUAL8.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL8.DOC -------------------------------------------------------------------------------- /MANUAL9.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL9.DOC -------------------------------------------------------------------------------- /NORMAL.FON: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/NORMAL.FON -------------------------------------------------------------------------------- /NORMAL.P24: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/NORMAL.P24 -------------------------------------------------------------------------------- /NORMAL.PRN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/NORMAL.PRN -------------------------------------------------------------------------------- /NORMALS.P24: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/NORMALS.P24 -------------------------------------------------------------------------------- /NORMALS.PRN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/NORMALS.PRN -------------------------------------------------------------------------------- /SRC/SCUF/WRITE.H: -------------------------------------------------------------------------------- 1 | ewritech(int,int,char); 2 | hgcwritech(int,int,char); -------------------------------------------------------------------------------- /TAIRUT.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/TAIRUT.DOC -------------------------------------------------------------------------------- /TEST2.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/TEST2.DOC -------------------------------------------------------------------------------- /TEST3.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/TEST3.DOC -------------------------------------------------------------------------------- /MANUAL10.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL10.DOC -------------------------------------------------------------------------------- /MANUAL11.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/MANUAL11.DOC -------------------------------------------------------------------------------- /SRC/SCUW/CW.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/CW.C -------------------------------------------------------------------------------- /SRC/COMMON/DIR.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/COMMON/DIR.C -------------------------------------------------------------------------------- /SRC/SCUF/DIR.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUF/DIR.C -------------------------------------------------------------------------------- /SRC/SCUF/FED.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUF/FED.C -------------------------------------------------------------------------------- /SRC/SCUP/DOT.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUP/DOT.C -------------------------------------------------------------------------------- /SRC/SCUP/PMENU.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUP/PMENU.C -------------------------------------------------------------------------------- /SRC/SCUP/PRT.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUP/PRT.C -------------------------------------------------------------------------------- /SRC/SCUP/PRTT.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUP/PRTT.C -------------------------------------------------------------------------------- /SRC/SCUW/BLOCK.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/BLOCK.C -------------------------------------------------------------------------------- /SRC/SCUW/FILE.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/FILE.C -------------------------------------------------------------------------------- /SRC/SCUW/GRPH.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/GRPH.C -------------------------------------------------------------------------------- /SRC/SCUW/INS.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/INS.C -------------------------------------------------------------------------------- /SRC/SCUW/KARAN.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/KARAN.C -------------------------------------------------------------------------------- /SRC/SCUW/KBD.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/KBD.C -------------------------------------------------------------------------------- /SRC/SCUW/MAKEBACK.BAT: -------------------------------------------------------------------------------- 1 | pkarc -a %1 *.c *.h *.bat makefile turboc.cfg scuw.tlr 2 | -------------------------------------------------------------------------------- /SRC/SCUW/MENU.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/MENU.C -------------------------------------------------------------------------------- /SRC/SCUW/MOVE.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/MOVE.C -------------------------------------------------------------------------------- /SRC/SCUW/SARAA.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SARAA.C -------------------------------------------------------------------------------- /SRC/SCUW/SARAO.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SARAO.C -------------------------------------------------------------------------------- /SRC/SCUW/SARAR.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SARAR.C -------------------------------------------------------------------------------- /SRC/SCUW/SARAU.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SARAU.C -------------------------------------------------------------------------------- /SRC/SCUW/THAI.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/THAI.H -------------------------------------------------------------------------------- /SRC/SCUW/VAR.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/VAR.H -------------------------------------------------------------------------------- /SRC/COMMON/CSCRN.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/COMMON/CSCRN.C -------------------------------------------------------------------------------- /SRC/SCUF/FONTMSG.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUF/FONTMSG.C -------------------------------------------------------------------------------- /SRC/SCUF/GETSTR.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUF/GETSTR.C -------------------------------------------------------------------------------- /SRC/SCUF/HERCF.OBJ: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUF/HERCF.OBJ -------------------------------------------------------------------------------- /SRC/SCUP/GLOBAL.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUP/GLOBAL.C -------------------------------------------------------------------------------- /SRC/SCUP/MAKEBACK.BAT: -------------------------------------------------------------------------------- 1 | pkarc -a %1 *.bat *.h *.c *.ext makefile scup.tlr turboc.cfg 2 | -------------------------------------------------------------------------------- /SRC/SCUP/PREPROC.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUP/PREPROC.C -------------------------------------------------------------------------------- /SRC/SCUP/PRTUTIL.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUP/PRTUTIL.C -------------------------------------------------------------------------------- /SRC/SCUW/CWSETUP.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/CWSETUP.C -------------------------------------------------------------------------------- /SRC/SCUW/GETSTR.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/GETSTR.C -------------------------------------------------------------------------------- /SRC/SCUW/GLOBAL.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/GLOBAL.C -------------------------------------------------------------------------------- /SRC/SCUW/HUNAKAD.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/HUNAKAD.C -------------------------------------------------------------------------------- /SRC/SCUW/MAIMUAN.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/MAIMUAN.C -------------------------------------------------------------------------------- /SRC/SCUW/NOPCUT.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/NOPCUT.C -------------------------------------------------------------------------------- /SRC/SCUW/ONSCRN.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/ONSCRN.C -------------------------------------------------------------------------------- /SRC/SCUW/RORERU.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/RORERU.C -------------------------------------------------------------------------------- /SRC/SCUW/SARAAH.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SARAAH.C -------------------------------------------------------------------------------- /SRC/SCUW/SARAAIR.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SARAAIR.C -------------------------------------------------------------------------------- /SRC/SCUW/SARAIE.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SARAIE.C -------------------------------------------------------------------------------- /SRC/SCUW/SARAUE.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SARAUE.C -------------------------------------------------------------------------------- /SRC/SCUW/SARAUEE.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SARAUEE.C -------------------------------------------------------------------------------- /SRC/SCUW/SEARCH.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/SEARCH.C -------------------------------------------------------------------------------- /SRC/SCUW/STATUS.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/STATUS.C -------------------------------------------------------------------------------- /SRC/SCUW/TCTYPE.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/TCTYPE.H -------------------------------------------------------------------------------- /SRC/SCUF/CUFSETUP.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUF/CUFSETUP.C -------------------------------------------------------------------------------- /SRC/SCUF/EGAVGAF.OBJ: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUF/EGAVGAF.OBJ -------------------------------------------------------------------------------- /SRC/SCUF/TCCONFIG.TC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUF/TCCONFIG.TC -------------------------------------------------------------------------------- /SRC/SCUF/TCPICK.TCP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUF/TCPICK.TCP -------------------------------------------------------------------------------- /SRC/SCUP/CUPSETUP.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUP/CUPSETUP.C -------------------------------------------------------------------------------- /SRC/SCUP/PRINTING.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUP/PRINTING.C -------------------------------------------------------------------------------- /SRC/SCUW/MAIMALAI.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/MAIMALAI.C -------------------------------------------------------------------------------- /SRC/SCUW/WOREWAAN.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kytulendu/CW141/HEAD/SRC/SCUW/WOREWAAN.C -------------------------------------------------------------------------------- /SRC/COMMON/FILEUTIL.H: -------------------------------------------------------------------------------- 1 | boolean file_exist(char *filename); 2 | int havewild(char *filname); 3 | -------------------------------------------------------------------------------- /SRC/MAKE.BAT: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO This will make CU-Writer 1.41 3 | ECHO. 4 | PAUSE 5 | CD COMMON 6 | MAKE 7 | CD.. 8 | -------------------------------------------------------------------------------- /SRC/SCUF/GETCH.H: -------------------------------------------------------------------------------- 1 | cursorkey(char *key); 2 | get_pos(unsigned *,unsigned *,unsigned,unsigned,unsigned,unsigned); 3 |  -------------------------------------------------------------------------------- /SRC/SCUP/FUNCMAC.H: -------------------------------------------------------------------------------- 1 | #define PrinterLineFeed216inch(n) line_feed(n) 2 | #define PrinterLineFeed180inch(n) line_feed(n) 3 | 4 | -------------------------------------------------------------------------------- /SRC/SCUW/SARAUM.C: -------------------------------------------------------------------------------- 1 | unsigned char *SaraUmRtn(TempIndx) 2 | register unsigned char *TempIndx; 3 | { 4 | return(TempIndx); 5 | } 6 |  -------------------------------------------------------------------------------- /SRC/COMMON/TURBOC.CFG: -------------------------------------------------------------------------------- 1 | -ml 2 | -w 3 | -f- 4 | -K 5 | -C 6 | -O 7 | -Z 8 | -k- 9 | -d 10 | -IC:\TC\INCLUDE 11 | -LC:\TC\LIB 12 |  -------------------------------------------------------------------------------- /SRC/SCUF/FONTMSG.H: -------------------------------------------------------------------------------- 1 | fontnamebox(char*,int); 2 | error_message(char*); 3 | immediate(int,int,char*,char*); 4 | put_box(int,int,int,int); -------------------------------------------------------------------------------- /SRC/SCUF/TURBOC.CFG: -------------------------------------------------------------------------------- 1 | -ml 2 | -w 3 | -f- 4 | -K 5 | -C 6 | -O 7 | -Z 8 | -k- 9 | -d 10 | -IC:\TC\INCLUDE 11 | -LC:\TC\LIB 12 |  -------------------------------------------------------------------------------- /SRC/SCUW/TURBOC.CFG: -------------------------------------------------------------------------------- 1 | -ml 2 | -w 3 | -f- 4 | -K 5 | -C 6 | -O 7 | -Z 8 | -k- 9 | -d 10 | -IC:\TC\INCLUDE 11 | -LC:\TC\LIB 12 |  -------------------------------------------------------------------------------- /SRC/SCUP/TURBOC.CFG: -------------------------------------------------------------------------------- 1 | -ml 2 | -w 3 | -f- 4 | -K 5 | -C 6 | -O 7 | -Z 8 | -k- 9 | -d 10 | -v 11 | -IC:\TC\INCLUDE 12 | -LC:\TC\LIB 13 |  -------------------------------------------------------------------------------- /SRC/SCUF/POPUP.H: -------------------------------------------------------------------------------- 1 | #define CENTER 1 2 | 3 | #define OLD 1 4 | #define DIRECT 2 5 | #define HIGH_LIGHT 3 6 | 7 | popup_message(char**); 8 | popup_menu(char **,char**); 9 | restore_menu(char**); -------------------------------------------------------------------------------- /SRC/SCUW/TMODE.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include "..\common\grdetect.h" 3 | 4 | void main () 5 | { 6 | int mode; 7 | 8 | graph_detecthardware (&mode); 9 | printf ("Mode = %d\n",mode); 10 | } 11 | -------------------------------------------------------------------------------- /SRC/SCUP/ERROR.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include "inc.h" 3 | 4 | void disperror(char *s) 5 | { 6 | clear_message(); /* from printing.obj */ 7 | dispstrhgc(s,40-strlen(s)/2,13,2); 8 | /* errorsound(); */ 9 | while (!keypressed()); 10 | clear_message(); /* from printing.obj */ 11 | } 12 | 13 | -------------------------------------------------------------------------------- /SRC/SCUW/CUFONT.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | main (argc,argv) 5 | int argc; 6 | char *argv[]; 7 | { 8 | register int temp; 9 | temp = 0; 10 | while (argc -- > 0) 11 | { 12 | printf ("argv %d = %s\n",temp,argv[temp]); 13 | temp++; 14 | } 15 | getch (); 16 | } -------------------------------------------------------------------------------- /SRC/SCUP/INC.H: -------------------------------------------------------------------------------- 1 | /* inc.h use in ..\scup only 2 | Written Suttipong Kanakakorn 3 | Mon 08-07-1989 00:26:41 4 | */ 5 | #include "..\common\cwtype.h" 6 | #include "..\common\const.h" 7 | #include "..\common\proto.h" 8 | #include "const.h" 9 | #include "cuptype.h" 10 | #include "proto.h" 11 | #include "funcmac.h" 12 | -------------------------------------------------------------------------------- /SRC/COMMON/STAMPDAT.C: -------------------------------------------------------------------------------- 1 | /* Written: Suttipong Kanakakorn 2 | Thu 08-03-1989 10:15:28 3 | collect date, and time of final program 4 | we can't define in cw.c 'cause it will reflex the time 5 | that we compile cw.c not the time when the program is linked 6 | */ 7 | char prog_date[] = __DATE__; 8 | char prog_time[] = __TIME__; 9 | -------------------------------------------------------------------------------- /SRC/SCUW/ROREREO.C: -------------------------------------------------------------------------------- 1 | #include "Thai.h" 2 | #include "TCtype.h" 3 | #include "Global.h" 4 | 5 | unsigned char *RoreReoRtn(TempIndx) 6 | register unsigned char *TempIndx; 7 | { 8 | if (*(TempIndx - 1) != RoreReo) 9 | return(FAIL); 10 | if (istrvwl(*(TempIndx - 2))) 11 | return(TempIndx - 1); 12 | return(FAIL); 13 | } -------------------------------------------------------------------------------- /SRC/COMMON/CONST.H: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* Common MACRO for cw.exe and cuprint.exe 3 | Updated: Suttipong Kanakakorn 4 | Sun 08-06-1989 10:04:26 */ 5 | /****************************************************************************/ 6 | #define BLANK ' ' 7 | -------------------------------------------------------------------------------- /SRC/COMMON/TCONV.C: -------------------------------------------------------------------------------- 1 | main() 2 | { 3 | int i; 4 | for (i=0; i<256; i++) { 5 | if (kutostd(stdtoku(i)) != i) { 6 | printf("In std->ku code wrong = %X\n", i); 7 | } 8 | } 9 | for (i=0; i<256; i++) { 10 | if (stdtoku(kutostd(i)) != i) { 11 | printf("In ku->std code wrong = %X\n", i); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SRC/SCUF/SCUF.TLR: -------------------------------------------------------------------------------- 1 | /x/n/d/c \tc\lib\c0l + 2 | ..\common\edisp ..\common\hdisp ..\common\adisp ..\common\grdetect + 3 | ..\common\cwgrphc ..\common\cwegrph ..\common\cwagrph ..\common\ekbd + 4 | ..\common\cscrn ..\common\fileutil ..\common\dir + ..\common\sound + 5 | getstr tutil1 cufsetup kbd file + 6 | fed write int getch popup fontmsg + 7 | convert stampdat + 8 | hercf egavgaf \tc\lib\graphics.lib + 9 | ,\cw\cufont,\cw\cufont,\tc\lib\cl.lib 10 |  -------------------------------------------------------------------------------- /SRC/SCUF/CONST.H: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* MACRO for cufont.exe only 15 JAN 89 */ 3 | /* Updated: Suttipong Kanakakorn 4 | Sun 08-06-1989 10:04:26 */ 5 | /****************************************************************************/ 6 | #define MAXCOL 256 7 | #define HUNAKADMITO 0xdb /* treat as upper level */ 8 | -------------------------------------------------------------------------------- /SRC/SCUP/CUPTYPE.H: -------------------------------------------------------------------------------- 1 | typedef enum Set_linespace_mode { 2 | INTERACTIVE, 3 | BATCH 4 | } set_linespace_mode; 5 | 6 | typedef enum Ctrl_char { 7 | LF = 10, /* line feed */ 8 | VT = 11, /* vertical tab */ 9 | FF = 12, /* form feed */ 10 | CR = 13, /* carriage return */ 11 | ESC = 27 /* escape code */ 12 | } ctrl_char; 13 | -------------------------------------------------------------------------------- /SRC/SCUP/SCUP.TLR: -------------------------------------------------------------------------------- 1 | /x/n/d/c \tc\lib\c0l + 2 | ..\common\edisp ..\common\hdisp ..\common\adisp ..\common\grdetect + 3 | ..\common\cwgrphc ..\common\cwegrph ..\common\cwagrph ..\common\ekbd + 4 | ..\common\cscrn ..\common\fileutil ..\common\dir + ..\common\sound + 5 | kbd getstr tutil1 cupsetup pmenu smenu prtutil + 6 | printing prt prtt prtg + 7 | pic dot cpi global prncntrl + 8 | error preproc 24pins attr cpthai + 9 | prtbuf24 stampdat + 10 | ,\cw\cuprint,\cw\cuprint,\tc\lib\cl.lib 11 |  -------------------------------------------------------------------------------- /SRC/SCUF/FED.PRJ: -------------------------------------------------------------------------------- 1 | getstr.c 2 | tutil1.c 3 | cufsetup.c 4 | KBD.c 5 | file.c 6 | fed.c 7 | write.c 8 | int.c 9 | getch.c 10 | popup.c 11 | fontmsg.c 12 | ..\scuw\grph.c 13 | convert.c 14 | hercf.obj 15 | egavgaf.obj 16 | ..\common\hdisp.obj 17 | ..\common\edisp.obj 18 | ..\common\cwgrphc.obj 19 | ..\common\cwegrph.obj 20 | ..\common\grdetect.obj 21 | ..\common\cscrn.obj 22 | ..\common\dir.obj 23 | ..\common\ekbd.obj 24 | ..\common\fileutil.obj 25 | ..\common\sound.obj 26 | ..\common\cwgrphc.obj 27 | ..\common\ekbd.obj 28 |  -------------------------------------------------------------------------------- /SRC/COMMON/CWFNTM.ASM: -------------------------------------------------------------------------------- 1 | ; Font macro definition module for TURBO C 2 | ; EGA/VGA Adaptor 3 | ; 4 | ; Kraisorn Liansee 5 | ; Date : 12/01/88 6 | ; Updated : 12/01/88 7 | 8 | 9 | shift_down macro reg 10 | add ®&,80 11 | endm 12 | 13 | shift_up macro reg 14 | sub ®&,80 15 | endm 16 | 17 |  -------------------------------------------------------------------------------- /SRC/SCUF/INC.H: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* INC.H 15 JAN 89 */ 3 | /****************************************************************************/ 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "..\common\kbdcode.h" 10 | #include "..\common\const.h" 11 | #include "..\common\cwtype.h" 12 | #include "..\common\proto.h" 13 | #include "const.h" 14 | #include "proto.h" 15 | -------------------------------------------------------------------------------- /SRC/SCUP/TABLE.H: -------------------------------------------------------------------------------- 1 | #define CP_MIDMIDDLE 0x8F 2 | #define CP_BOTTOMMIDDLE 0x90 3 | #define CP_TOPMIDDLE 0x91 4 | #define CP_MIDRIGHT 0x92 5 | #define CP_MIDLEFT 0x93 6 | #define CP_LEFTUP 0x94 7 | #define CP_HORIZONTAL 0x95 8 | #define CP_VERTICAL 0x96 9 | #define CP_RIGHTUP 0x97 10 | #define CP_TOPLEFT 0x98 11 | #define CP_TOPRIGHT 0x99 12 | #define CP_BOTTOMLEFT 0x9A 13 | #define CP_BOTTOMRIGHT 0x9B 14 | #define CP_LEFTBOTTOM 0x9C 15 | #define CP_RIGHTBOTTOM 0x9D 16 | 17 | #define cp_istablechar(ch) (((ch) >= CP_MIDMIDDLE)&&((ch) <= CP_RIGHTBOTTOM)) 18 |  -------------------------------------------------------------------------------- /SRC/SCUF/FILE.C: -------------------------------------------------------------------------------- 1 | /* Written: Suttipong Kanakakorn */ 2 | /* Updated: Sun 08-27-1989 23:04:09 */ 3 | 4 | #include 5 | #include 6 | 7 | #include "..\common\cwtype.h" 8 | 9 | search_file_mode find_file(char *filename, char *search_path) 10 | { 11 | struct ffblk ffblk; 12 | char p[MAXPATH]; 13 | 14 | if (findfirst(filename, &ffblk, 0) == 0) 15 | return CUR_DIR; 16 | sprintf(p, "%s\\%s", search_path, filename); 17 | if (findfirst(p, &ffblk, 0) == 0) 18 | return CW_DIR; 19 | return NOT_FOUND; 20 | } 21 | -------------------------------------------------------------------------------- /SRC/SCUW/SCRN.C: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* SCRN.C 15 JAN 89 */ 3 | /* Updated: Suttipong Kanakakorn */ 4 | /* Sun 08-06-1989 09:31:59 */ 5 | /****************************************************************************/ 6 | #include "inc.h" 7 | #include "..\common\cwgrphc.h" 8 | 9 | void cls() 10 | { 11 | clsgraph(wind.col,wind.row,wind.col+wind.length-1,wind.row+wind.width-1); 12 | } 13 | -------------------------------------------------------------------------------- /SRC/SCUF/KEY.H: -------------------------------------------------------------------------------- 1 | #define NORMAL 0 2 | #define EXTEND 0xff 3 | #define ENTER 13 4 | #define BELL 7 5 | #define ESC 27 6 | #define RET 13 7 | #define LF 10 8 | #define HOME 0x47 9 | #define UP 0x48 10 | #define PGUP 0x49 11 | #define LEFT 0x4b 12 | #define RIGHT 0x4d 13 | #define END 0x4f 14 | #define DOWN 0x50 15 | #define PGDN 0x51 16 | #define INS 0x52 17 | #define DEL 0x53 18 | #define BACKSPACE 8 19 | #define F1 0x3b 20 | #define F2 0x3c 21 | #define F3 0x3d 22 | #define F4 0x3e 23 | #define F5 0x3f 24 | #define F6 0x40 25 | #define F7 0x41 26 | #define F8 0x42 27 | #define F9 0x43 28 | #define F10 0x44 29 |  -------------------------------------------------------------------------------- /SRC/SCUP/CPTHAI.H: -------------------------------------------------------------------------------- 1 | /* ------ Define constant ---- */ 2 | #define CP_UPPER 0 3 | #define CP_MIDDLE 1 4 | #define CP_LOWER 2 5 | #define CP_UPPEST 3 6 | #define CP_INVALID 4 7 | 8 | /* ------ Define thai table ----- */ 9 | extern char cp_smo_table[]; 10 | extern char cp_ku_table[]; 11 | extern char cp_thaitable[]; 12 | 13 | /* ------ Define Macro ------- */ 14 | #define cp_ismidlev(ch) ( (cp_thaitable[ch] == CP_MIDDLE) ) 15 | #define cp_isuplev(ch) ( (cp_thaitable[ch] == CP_UPPER ) ) 16 | #define cp_islowlev(ch) ( (cp_thaitable[ch] == CP_LOWER ) ) 17 | #define cp_isuppest(ch) ( (cp_thaitable[ch] == CP_UPPEST) ) 18 | -------------------------------------------------------------------------------- /SRC/SCUW/CONST.H: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* MACRO for cw.exe only 15 JAN 89 */ 3 | /* Updated: Suttipong Kanakakorn 4 | Sun 08-06-1989 10:04:26 */ 5 | /****************************************************************************/ 6 | #define MAXCOL 266 7 | #define MAXRMAR 256 8 | #define ERROR 1 9 | 10 | #define WRAPCODE 0x8d 11 | #define WRAPBLANK 0xa0 12 | 13 | #define HUNAKADMITO 0xdb /* treat as upper level */ 14 | 15 | #define ISBLANK(X) ((X)==' ' || (X)==WRAPBLANK) 16 |  -------------------------------------------------------------------------------- /SRC/SCUW/GLOBAL.H: -------------------------------------------------------------------------------- 1 | /*------------------Global Reference------------------*/ 2 | 3 | extern unsigned char *(*FuncPtr[])(char *); 4 | extern unsigned char *ThaiEngCutRtn(char *); 5 | extern unsigned char *Indx, *RightMargin, *EndOfText, *LeftLimit; 6 | 7 | /* Sat 07-29-1989 03:46:20 By Suttipong K. 8 | for remove warning about prototypes 9 | */ 10 | short int findchar(unsigned char ch, unsigned char *strbuf); 11 | int nstrcmp(register char *source, register char *destination); 12 | 13 | /*---------------------End Global---------------------*/ 14 | 15 | /*---------------Symbol that used often---------------*/ 16 | #define NULL 0 17 | #define FAIL 0 18 | -------------------------------------------------------------------------------- /SRC/SCUW/SCUW.TLR: -------------------------------------------------------------------------------- 1 | /x/n/d/c \tc\lib\c0l + 2 | ..\common\edisp ..\common\hdisp ..\common\adisp ..\common\grdetect + 3 | ..\common\cwgrphc ..\common\cwegrph ..\common\cwagrph ..\common\ekbd + 4 | ..\common\cscrn ..\common\fileutil ..\common\dir + ..\common\sound + 5 | ..\common\cusong + 6 | scrn getstr tutil1 edit ins del + 7 | menu status kbd move movement wrap onscrn file search block cw + 8 | cwsetup stampdat + 9 | mainsyls thaieng worewaan FINDCHAR HOREHEEB HUNAKAD JULCUT KARAN LEADCON + 10 | MAIMALAI MAIMUAN NOPCUT NSTRCMP ROREREO RORERU SARAA SARAAH SARAAIR SARAIE + 11 | SARAO SARAR SARAU SARAUE SARAUEE SARAUM GLOBAL + 12 | ,\cw\cw,\cw\cw,\tc\lib\cl.lib 13 |  -------------------------------------------------------------------------------- /SRC/SCUW/LEADCON.C: -------------------------------------------------------------------------------- 1 | #include "TCtype.h" 2 | #include "Thai.h" 3 | #include "Global.h" 4 | #include "Routine.h" 5 | 6 | /* ------------ LeadCon Rtn ------------ */ 7 | /* Programmer : Subun Yenjaichon 8 | Date Written : Friday, 13 May, 1988 10:47:33 AM 9 | Last Updated : Friday, 13 May, 1988 10:47:51 AM 10 | */ 11 | 12 | unsigned char *LeadConRtn(TempIndx) 13 | register unsigned char *TempIndx; 14 | { 15 | unsigned char *TempIndxm1 = TempIndx -1; 16 | 17 | if (istlvwl(*(TempIndxm1))) 18 | return(TempIndx-2); /* cut before leading vowel */ 19 | else 20 | return(TempIndxm1); /* cut before leading Consonant */ 21 | }/* end of LeadConRtn() */ -------------------------------------------------------------------------------- /SRC/SCUW/INC.H: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* INC.H 15 JAN 89 */ 3 | /****************************************************************************/ 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "..\common\kbdcode.h" 18 | #include "..\common\const.h" 19 | #include "..\common\cwtype.h" 20 | #include "..\common\proto.h" 21 | #include "const.h" 22 | #include "var.h" 23 | #include "proto.h" 24 | -------------------------------------------------------------------------------- /SRC/SCUW/NEWROUTI.H: -------------------------------------------------------------------------------- 1 | unsigned char *LeadConRtn(); 2 | unsigned char *RoreReoRtn(); 3 | unsigned char *RoreRuRtn(); 4 | unsigned char *WoreWaanRtn(); 5 | unsigned char *HorHeebRtn(); 6 | unsigned char *OrAngRtn(); 7 | unsigned char *SaraAhRtn(); 8 | unsigned char *HunAkadRtn(); 9 | unsigned char *SaraRRtn(); 10 | unsigned char *SaraUmRtn(); 11 | unsigned char *SaraIeRtn(); 12 | unsigned char *SaraERtn(); 13 | unsigned char *SaraUeRtn(); 14 | unsigned char *SaraUeeRtn(); 15 | unsigned char *SaraURtn(); 16 | unsigned char *SaraUURtn(); 17 | unsigned char *SaraARtn(); 18 | unsigned char *SaraAirRtn(); 19 | unsigned char *SaraORtn(); 20 | unsigned char *MaiMuanRtn(); 21 | unsigned char *MaiMalaiRtn(); 22 | unsigned char *MaiTaiKuuRtn(); 23 | unsigned char *KaranRtn(); 24 |  -------------------------------------------------------------------------------- /SRC/SCUW/THAIENG.C: -------------------------------------------------------------------------------- 1 | #include "Thai.h" 2 | #include "TCtype.h" 3 | #include "Ctype.h" 4 | #include "Global.h" 5 | 6 | /* ------------------------------------------- 7 | Routine : Thai English Cut Rtn 8 | Programmer : Subun Yenjaichon 9 | Date Written : Saturday, 7 May, 1988 9:53:12 AM 10 | Last Updated : Saturday, 7 May, 1988 9:53:28 AM 11 | ------------------------------------------- */ 12 | 13 | unsigned char *ThaiEngCutRtn(TempIndx) 14 | unsigned char *TempIndx; 15 | { 16 | unsigned char *TempIndxm1 = TempIndx -1; 17 | 18 | if ((isthai(*TempIndx) && isalpha(*TempIndxm1)) || 19 | (isthai(*TempIndxm1) && isalpha(*TempIndx))) 20 | return(TempIndxm1); /* cut before thai and after English */ 21 | return (FAIL); 22 | } -------------------------------------------------------------------------------- /SRC/COMMON/CWFNTAM.ASM: -------------------------------------------------------------------------------- 1 | ; Font macro definition module for TURBO C 2 | ; AT&T Adaptor 3 | ; 4 | ; Kraisorn Liansee 5 | ; Date : 12/01/88 6 | ; Updated : 12/01/88 7 | 8 | 9 | 10 | shift_down macro reg 11 | local br1 12 | add ®&,2000h 13 | jns br1 14 | add ®&,8050h 15 | br1: 16 | endm 17 | 18 | shift_up macro reg 19 | local br1 20 | sub ®&,2000h 21 | jns br1 22 | add ®&,8000h - 050h 23 | br1: 24 | endm 25 |  -------------------------------------------------------------------------------- /SRC/COMMON/CWFNTHM.ASM: -------------------------------------------------------------------------------- 1 | ; Font macro definition module for TURBO C 2 | ; Hercules Adaptor 3 | ; 4 | ; Kraisorn Liansee 5 | ; Date : 12/01/88 6 | ; Updated : 12/01/88 7 | 8 | 9 | 10 | shift_down macro reg 11 | local br1 12 | add ®&,2000h 13 | jns br1 14 | add ®&,805ah 15 | br1: 16 | endm 17 | 18 | shift_up macro reg 19 | local br1 20 | sub ®&,2000h 21 | jns br1 22 | add ®&,8000h - 05ah 23 | br1: 24 | endm 25 |  -------------------------------------------------------------------------------- /SRC/SCUP/LDFONT.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "global.ext" 7 | 8 | char dfont [5121]; 9 | char ditalicfont [5121]; 10 | int protect1; 11 | 12 | void loadfont(void) 13 | { 14 | int handle; 15 | char s1[55]; 16 | strcpy(s1,cuprintpath); 17 | strcat(s1,"normal.fon"); 18 | if ((handle = open(s1,O_RDONLY || O_BINARY)) != -1) { 19 | read(handle,dfont,5120); 20 | close(handle); 21 | } else { 22 | puts("FONT FILE (NORMAL.FON) NOT FOUND !"); 23 | exit(1); 24 | } 25 | if ((handle = open("italic.fon",O_RDONLY || O_BINARY)) != -1) { 26 | read(handle,ditalicfont,5120); 27 | close(handle); 28 | } else { 29 | puts("FONT FILE (italic.FON) NOT FOUND !"); 30 | exit(1); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SRC/SCUW/FINDCHAR.C: -------------------------------------------------------------------------------- 1 | /* This function is written for find the position of character in string 2 | that is ascending-sorted, if not found then return NULL. 3 | And when character is greater than an element in string, return NULL. 4 | 5 | Sample calling statement : findchar ('x', "abcdefg"); 6 | return value : NULL(or 0) ,if not found 7 | Else return string's position + 1 8 | (real position must minus 1) 9 | Copyright by Subun & Tanat Advanced Computer Inc. 1988 10 | Date Written : Tuesday, 10 May, 1988 11:25:20 AM 11 | 12 | Last Updated : Tuesday, 10 May, 1988 11:22:59 AM 13 | 14 | */ 15 | 16 | #include 17 | 18 | short int findchar(unsigned char ch, unsigned char *strbuf) 19 | { 20 | while (*strbuf != NULL && ch >= *strbuf) 21 | if (ch == *(strbuf++)) 22 | return(1); 23 | return(NULL); 24 | } 25 |  -------------------------------------------------------------------------------- /SRC/SCUP/KBD.C: -------------------------------------------------------------------------------- 1 | /* keyboard function that different between cuprint.exe and cw.exe 2 | Suttipong Kanakakorn Mon 08-07-1989 00:18:41 3 | */ 4 | 5 | #include "inc.h" 6 | #include "..\common\cwgrphc.h" 7 | #include "global.ext" 8 | 9 | void waitkbd(unsigned x, unsigned y) 10 | { 11 | register unsigned i; 12 | 13 | setcurpos(x,y,thaimode); 14 | while (!keypressed()) { 15 | for (i=0; !keypressed() && i < 1200 ; i++) 16 | ; 17 | setcurpos(x,y,thaimode); 18 | for (i=0; !keypressed() && i < 1200 ; i++) 19 | ; 20 | setcurpos(x,y,thaimode); 21 | } 22 | setcurpos(x,y,thaimode); 23 | } 24 | 25 | int readkbd(void) 26 | { 27 | register unsigned c; 28 | 29 | c = ebioskey(0); 30 | if (thaimode) 31 | return(thaikey(c)); 32 | else 33 | return(c); 34 | } 35 | -------------------------------------------------------------------------------- /SRC/COMMON/TUTIL1.C: -------------------------------------------------------------------------------- 1 | 2 | /*****************************************************************************/ 3 | /* find length of thai string */ 4 | /* input */ 5 | /* thaist : thai string */ 6 | /* return : length of thai string */ 7 | /* Updated: Suttipong Kanakakorn, use pointer instead of array 8 | Sun 08-06-1989 16:32:15 */ 9 | /*****************************************************************************/ 10 | int thaistrlen(char *thaist) 11 | { 12 | register int count = 0; 13 | 14 | while (*thaist) { 15 | if (whatlevel(*thaist) == MIDDLE) 16 | count++; 17 | thaist++; 18 | } 19 | return(count); 20 | } 21 | -------------------------------------------------------------------------------- /SRC/SCUF/PROTO.H: -------------------------------------------------------------------------------- 1 | /* 2 | proto.h for cufont.exe 3 | By Suttipong Kanakakorn Fri 08-25-1989 22:34:30 4 | */ 5 | 6 | /***GETSTR.C*****************************************************************/ 7 | int getstring(char textst[],unsigned x,unsigned y, 8 | unsigned maxlen,char attr,strtype mode); 9 | int getname(char textst[],unsigned x,unsigned y,unsigned maxlen,char attr); 10 | 11 | /* TUTIL1.c */ 12 | unsigned thaistrlen(register unsigned char *thaist); 13 | 14 | /* cufsetup.c */ 15 | void cufsetup(int argc, char *argv[]); 16 | void readfont(void *font_buffer, char *fontname); 17 | 18 | /***KBD.C********************************************************************/ 19 | void waitkbd(unsigned x,unsigned y); 20 | int readkbd(void); 21 | 22 | /***FILE.C*******************************************************************/ 23 | search_file_mode find_file(char *filename, char *search_path); 24 | -------------------------------------------------------------------------------- /SRC/SCUW/NSTRCMP.C: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------- 2 | name : nstrcmp (new string compare) 3 | function : compare two strings until the end of source string 4 | return value : 0 -> when same. 5 | : positive value -> when not same 6 | and source greater than dest. 7 | : negative value _> when not same 8 | and source less that dest. 9 | date written : Friday 13, May 1988 10 | last updated : Saturday, 14 May, 1988 10:03:04 AM 11 | ------------------------------------------------------- */ 12 | 13 | int nstrcmp(register char *source, register char *destination) 14 | { 15 | if (source != destination) 16 | while(*source) 17 | { 18 | if (*source++ != *destination++) 19 | return(*--source - *--destination); 20 | /* return negative if source less than dest. 21 | else positive will be returned */ 22 | } 23 | return(0); /* when same return zero */ 24 | } 25 |  -------------------------------------------------------------------------------- /SRC/SCUP/TUTIL1.C: -------------------------------------------------------------------------------- 1 | #include "inc.h" 2 | 3 | /*****************************************************************************/ 4 | /* find length of thai string */ 5 | /* input */ 6 | /* thaist : thai string */ 7 | /* return : length of thai string */ 8 | /* Updated: Use fast pointer instead of clumsy array */ 9 | /* By Suttipong Kanakakorn Mon 08-07-1989 00:40:51 */ 10 | /*****************************************************************************/ 11 | int thaistrlen(char *thaist) 12 | { 13 | register int count = 0; 14 | 15 | while (*thaist) { 16 | if (whatlevel(*thaist) == MIDDLE) 17 | count++; 18 | thaist++; 19 | } 20 | return(count); 21 | } 22 | -------------------------------------------------------------------------------- /SRC/SCUF/FED.H: -------------------------------------------------------------------------------- 1 | #define BYTE_X(X) (_ceil((X),8)) 2 | #define STOP 0 3 | #define EDIT_FONT 1 4 | #define SELECT_FONT 2 5 | 6 | #define MAX_X 64 /* maximum of font size */ 7 | #define MAX_Y 64 8 | 9 | #define SCR_FONT 1 10 | #define ITALIC_SCR_FONT 2 11 | #define PRN_FONT 3 12 | #define ITALIC_PRN_FONT 4 13 | #define LQ_FONT 5 14 | #define ITALIC_LQ_FONT 6 15 | #define SUP_SUB_LQ_FONT 7 16 | #define ITALIC_SUP_SUB_LQ_FONT 8 17 | #define FED_FONT 9 18 | 19 | extern int first_file; 20 | extern unsigned pos_x,pos_y,BYTE,sel_x,sel_y; 21 | extern char WIDTH_X,WIDTH_Y,X,Y; 22 | extern char *all_font; 23 | extern char *char_block_image; 24 | extern int align; 25 | extern int loaded; 26 | extern int new_load; 27 | extern char fname[]; 28 | extern unsigned int is_herc; 29 | extern char cufontpath[]; 30 | extern char cuwordpath[]; 31 | extern char cuprintpath[]; 32 | 33 | #define SIGN "FONT EDITOR Version 1.0" 34 | #define SIGN_LENGTH strlen(SIGN) 35 | -------------------------------------------------------------------------------- /SRC/SCUW/CONVERT.H: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------*/ 2 | /* Conversion Header file */ 3 | /* */ 4 | /* Kraisorn Liansee */ 5 | /* Date : 4/19/89 */ 6 | /* Updated : 4/20/89 */ 7 | /*--------------------------------------------------------------------*/ 8 | 9 | /*--------------------------------------------*/ 10 | /* Module purpose :- */ 11 | /* */ 12 | /* This module defines some data */ 13 | /* required for converting 90 cols */ 14 | /* CU-Writer (V1.10 on Hercules) into */ 15 | /* 80 cols (V1.2 Hercules/EGA/VGA) */ 16 | /*--------------------------------------------*/ 17 | 18 | #define SHRINK_FACTOR 10 /* Columns decreased */ 19 | #define CENTER_FACTOR 5 /* Shifting left factor */ 20 |  -------------------------------------------------------------------------------- /SRC/SCUF/TUTIL1.C: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* tutil1.C 15 Fri 08-25-1989 21:41:55 */ 3 | /****************************************************************************/ 4 | #include "inc.h" 5 | /*****************************************************************************/ 6 | /* find length of thai string */ 7 | /* input */ 8 | /* thaist : thai string */ 9 | /* return : length of thai string */ 10 | /*****************************************************************************/ 11 | unsigned thaistrlen(char thaist[]) 12 | { 13 | register unsigned index = 0,count = 0; 14 | char curfont = 0; 15 | while (thaist[index] != '\0') { 16 | if (whatlevel(thaist[index]) == MIDDLE) { 17 | count++; 18 | if ((curfont & ENLARGEATTR) == ENLARGEATTR) { 19 | count++; 20 | } 21 | } 22 | index++; 23 | } 24 | return(count); 25 | } 26 | -------------------------------------------------------------------------------- /SRC/COMMON/CWTYPE.H: -------------------------------------------------------------------------------- 1 | typedef enum Boolean { 2 | NO=0, YES=1, FALSE=0, TRUE=1 3 | } boolean; 4 | 5 | /* for getstring */ 6 | typedef enum Strtype { 7 | THAIENG, ENGLISH, ENGUPCASE, NUMBER, ONEORTWO 8 | } strtype; 9 | 10 | typedef enum Search_file_mode { 11 | AUTO_FIND, CUR_DIR, CW_DIR, NOT_FOUND = -1 12 | } search_file_mode; 13 | 14 | typedef enum Thai_level { 15 | TOPEST=3, UPPER=2, MIDDLE=0, BELOW=1 16 | } thai_level; 17 | 18 | typedef enum Font_attr { 19 | REVERSEATTR=0x02, 20 | ONELINEATTR=0x01, 21 | BOLDATTR=0x04, 22 | ENLARGEATTR=0x40, 23 | TWOLINEATTR=0x80, 24 | ITALICATTR=0x20, 25 | SUPERATTR=0x08, 26 | SUBATTR=0x10, 27 | NORMALATTR=0x00 28 | } font_attr; 29 | 30 | typedef enum Font_code { 31 | ONELINECODE=19, /* ^S */ 32 | BOLDCODE=2, /* ^B */ 33 | ENLARGECODE=5, /* ^E */ 34 | TWOLINECODE=18, /* ^R */ 35 | ITALICCODE=23, /* ^W */ 36 | SUPERCODE=20, /* ^T */ 37 | SUBCODE=22, /* ^V */ 38 | ITALIC=23, 39 | UNDERLINE=19, 40 | SUBSCRIPT=22, 41 | SUPER=20, 42 | ENLARGE=5, 43 | BOLD=2, 44 | DOUBLEUNDERLINE=18 45 | } font_code; 46 | -------------------------------------------------------------------------------- /SRC/COMMON/GRDETECT.H: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------*/ 2 | /* Graphics hardware detector header for TURBO C 2.00 */ 3 | /* */ 4 | /* Kraisorn Liansee */ 5 | /* Date : 4/27/89 */ 6 | /* Updated : 4/27/89 */ 7 | /* Suttipong Kanakakorn */ 8 | /* Updated : Sun 08-27-1989 20:25:09 */ 9 | /*-------------------------------------------------------------------------*/ 10 | 11 | typedef enum Graphics_hardware 12 | { 13 | DETECT, /* request autodetection */ 14 | CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514, /* 1 - 6 */ 15 | HERCMONO, ATT400, VGA, PC3270, /* 7 - 10 */ 16 | MDA = 128, 17 | UNKNOWN_HW = -1 18 | } graphics_hardware; 19 | 20 | void graph_detecthardware (graphics_hardware *mode_ptr); 21 | void egavga_class (graphics_hardware *mode_ptr); 22 | 23 | int is_egavga (void); 24 | int is_mcga (void); 25 | int check_vretrace (void); 26 | -------------------------------------------------------------------------------- /SRC/SCUF/GETCH.C: -------------------------------------------------------------------------------- 1 | #include "key.h" 2 | 3 | int cursorkey(char *key) 4 | { 5 | *key=getch(); 6 | if (*key==ESC) return(EXTEND); 7 | if (*key!=0) return(NORMAL); 8 | *key=getch(); 9 | return(EXTEND); 10 | } 11 | 12 | 13 | int get_pos(x,y,block_x,block_y,width_x,width_y) 14 | int *x,*y,width_x,width_y,block_x,block_y; 15 | { 16 | char key; 17 | if(cursorkey(&key)==EXTEND) 18 | switch(key) { 19 | case UP : *y-=width_y; 20 | break; 21 | case DOWN: *y+=width_y; 22 | break; 23 | case RIGHT: *x+=width_x; 24 | break; 25 | case LEFT: *x-=width_x; 26 | break; 27 | case HOME: *x-=width_x;*y-=width_y; 28 | break; 29 | case END: *x-=width_x;*y+=width_y; 30 | break; 31 | case PGUP: *x+=width_x;*y-=width_y; 32 | break; 33 | case PGDN: *x+=width_x;*y+=width_y; 34 | break; 35 | case ESC: return(3); 36 | case INS: return(1); 37 | case DEL: return(2); 38 | default : return(key); 39 | } 40 | else 41 | return(key); 42 | if (*x>width_x*block_x) *x-=width_x; 43 | if (*x<0) *x+=width_x; 44 | if (*y>width_y*block_y) *y-=width_y; 45 | if (*y<0) *y+=width_y; 46 | 47 | return(0); 48 | } 49 |  -------------------------------------------------------------------------------- /SRC/COMMON/CWAGRPH.C: -------------------------------------------------------------------------------- 1 | /* AT&T graphics module for CW 1.20 */ 2 | /* */ 3 | /* Kraisorn Liansee */ 4 | /* Date: 04/21/1988 */ 5 | /* Updated: 04/21/1988 */ 6 | 7 | #include 8 | 9 | 10 | /* AT&T dependent function */ 11 | /* This is a AT&T dependent function */ 12 | 13 | 14 | extern unsigned int graph_seg; 15 | extern int is_ega, is_vga; 16 | 17 | void asetgraph (void) 18 | { 19 | union REGS inregs,outregs; 20 | 21 | graph_seg = 0xB800; 22 | 23 | inregs.x.ax = 0x40 ; 24 | int86 (0x10,&inregs,&outregs); 25 | 26 | /* 27 | outportb (0x03C4,0x02); 28 | outportb (0x03C5,0x0F); 29 | */ 30 | } 31 | 32 | 33 | 34 | 35 | void asettext (void) 36 | { 37 | union REGS inregs,outregs; 38 | 39 | inregs.x.ax = 3; 40 | int86 (0x10,&inregs,&outregs); /* text mode */ 41 | inregs.x.ax = 3; 42 | int86 (0x10,&inregs,&outregs); /* text mode */ 43 | 44 | } 45 | 46 | 47 | unsigned int acompute_off (register unsigned x, register unsigned y) 48 | { 49 | return (0x2000*(y%4) + 80*(y/4) + x/8); 50 | } 51 | -------------------------------------------------------------------------------- /SRC/SCUW/ROUTINE.H: -------------------------------------------------------------------------------- 1 | /* 2 | Routine.h 3 | */ 4 | 5 | unsigned char *dummy(); 6 | unsigned char *SaraUmRtn(); 7 | unsigned char *SaraAhRtn(); 8 | unsigned char *SaraUeeRtn(); 9 | unsigned char *SaraArWithoutTnl(); 10 | unsigned char *MaiMalaiRtn(); 11 | unsigned char *MaiMalaiFC(); 12 | unsigned char *SaraAirRtn(); 13 | unsigned char *SaraORtn(); 14 | unsigned char *SaraRRtn(); 15 | unsigned char *LeadConRtn(); 16 | unsigned char *RoreReoRtn(); 17 | unsigned char *RoreRuRtn(); 18 | unsigned char *SaraARtn(); 19 | unsigned char *SaraAhRtn(); 20 | unsigned char *SaraUmRtn(); 21 | unsigned char *MaiTaiKuuRtn(); 22 | unsigned char *SaraUURtn(); 23 | unsigned char *SaraERtn(); 24 | unsigned char *OrAngRtn(); 25 | unsigned char *HunAkadRtn(); 26 | unsigned char *KaranRtn(); 27 | unsigned char *MaiMuanRtn(); 28 | unsigned char *SaraIeRtn(); 29 | unsigned char *SaraUeRtn(); 30 | unsigned char *SaraURtn(); 31 | unsigned char *WoreWaanRtn(); 32 | unsigned char *HorHeebRtn(); 33 | unsigned char *CntlChar(); 34 | unsigned char *PuncChar(); 35 | unsigned char *TermChar(); 36 | unsigned char *FCPuncChar(); 37 | unsigned char *PaiYarnnoyRtn(); 38 | unsigned char *MaiYamokRtn(); 39 | 40 | unsigned char *SaraRWithoutTnl(); 41 | unsigned char *SaraRWithMaiTri(); 42 | unsigned char *SaraRWithTonal(); 43 | unsigned char *SaraORtn(); 44 | unsigned char *SaraAirRtn(); 45 | unsigned char *MaiMalaiRtn(); 46 | unsigned char *MaiMalaiFC(); 47 | unsigned char *LeadConRtn(); 48 | -------------------------------------------------------------------------------- /SRC/COMMON/MAKEFILE: -------------------------------------------------------------------------------- 1 | # 2 | # makefile for common object file of cuprint.exe and cw.exe 3 | # By Suttipong Kanakakorn 4 | # Sun 08-06-1989 16:24:57 5 | # 6 | # TCC_OPTION -w = enable all warning 7 | # 8 | # 9 | TCC_OPTION=-w -DCW 10 | 11 | project: edisp.obj hdisp.obj adisp.obj \ 12 | grdetect.obj cwgrphc.obj cwegrph.obj cwagrph.obj \ 13 | ekbd.obj cscrn.obj fileutil.obj dir.obj sound.obj cusong.obj 14 | cd ..\scuw 15 | make 16 | cd ..\scup 17 | make 18 | cd ..\scuf 19 | make 20 | 21 | edisp.obj: edisp.asm cwfntm.asm 22 | tasm /mx edisp 23 | 24 | hdisp.obj: hdisp.asm cwfnthm.asm 25 | tasm /mx hdisp 26 | 27 | adisp.obj: adisp.asm cwfntam.asm 28 | tasm /mx adisp 29 | 30 | grdetect.obj: grdetect.c grdetect.h 31 | tcc -c $(TCC_OPTION) grdetect.c 32 | 33 | cwgrphc.obj: cwgrphc.c cwgrphc.h grdetect.h 34 | tcc -c $(TCC_OPTION) cwgrphc.c 35 | 36 | cwegrph.obj: cwegrph.c cwgrphc.h 37 | tcc -c $(TCC_OPTION) cwegrph.c 38 | 39 | cwagrph.obj: cwagrph.c cwgrphc.h 40 | tcc -c $(TCC_OPTION) cwagrph.c 41 | 42 | ekbd.obj: ekbd.c 43 | tcc -c $(TCC_OPTION) ekbd.c 44 | 45 | cscrn.obj: cscrn.c 46 | tcc -c $(TCC_OPTION) cscrn.c 47 | 48 | fileutil.obj: fileutil.c 49 | tcc -c $(TCC_OPTION) fileutil.c 50 | 51 | dir.obj: dir.c 52 | tcc -c $(TCC_OPTION) dir.c 53 | 54 | sound.obj: sound.c 55 | tcc -c -v $(TCC_OPTION) sound.c 56 | 57 | cusong.obj: cusong.c 58 | tcc -c -v $(TCC_OPTION) cusong.c 59 |  -------------------------------------------------------------------------------- /SRC/SCUW/HOREHEEB.C: -------------------------------------------------------------------------------- 1 | #include "Thai.h" 2 | #include "TCtype.h" 3 | #include "Global.h" 4 | 5 | /* ----------------------------------- 6 | Module Name : HorHeebRtn 7 | Programmer : Subun yenjaichon 8 | Date Written : Friday, 20 May, 1988 2:04:06 PM 9 | Last Updated : date 10 | parameter : TempIndx (pointer to unsigned char) 11 | return value : pointer that pointer to cut pointer. 12 | ------------------------------------ */ 13 | 14 | unsigned char *HorHeebRtn(TempIndx) 15 | unsigned char *TempIndx; 16 | { 17 | unsigned char *TempIndxm1 = TempIndx -1; 18 | unsigned char *TempIndxp1 = TempIndx +1; 19 | 20 | if (istcon(*TempIndxm1)) 21 | switch (*TempIndxm1) 22 | { 23 | case KoreKwai: 24 | case MoreMar: 25 | case SoreSeo: 26 | return(FAIL); 27 | case ToreTaharn: 28 | if (*TempIndxp1 != SaraR) 29 | return(TempIndxm1); /* cut before HorHeeb */ 30 | break; 31 | case RoreReo: 32 | case OrAng: 33 | if (*TempIndxp1 != HunAkad) 34 | return(TempIndxm1); /* cut before HorHeeb */ 35 | break; 36 | case PoreParn: 37 | if (*TempIndxp1 != SaraU && *TempIndxp1 != SaraUU) 38 | return(TempIndxm1); /* cut before HorHeeb */ 39 | break; 40 | default: 41 | return(TempIndxm1); 42 | } /* end switch */ 43 | return(FAIL); 44 | } /* end HorHeebRtn() */ -------------------------------------------------------------------------------- /SRC/SCUF/MAKEFILE: -------------------------------------------------------------------------------- 1 | # 2 | # makefile for cufont.exe 3 | # Written by: Suttipong Kanakakorn 4 | # Fri 08-25-1989 21:38:46 5 | # 6 | # TCC_OPTION -w = enable all warning 7 | # 8 | TCC_OPTION=-DALIGN 9 | TCC_OPTION2= -w -DALIGN 10 | 11 | \cw\cufont.exe: \ 12 | ..\common\edisp.obj ..\common\hdisp.obj ..\common\adisp.obj \ 13 | ..\common\grdetect.obj \ 14 | ..\common\cwgrphc.obj ..\common\cwegrph.obj ..\common\cwagrph.obj \ 15 | ..\common\ekbd.obj \ 16 | ..\common\cscrn.obj ..\common\fileutil.obj ..\common\dir.obj \ 17 | ..\common\sound.obj \ 18 | getstr.obj tutil1.obj cufsetup.obj kbd.obj file.obj \ 19 | fed.obj write.obj int.obj getch.obj popup.obj \ 20 | fontmsg.obj convert.obj 21 | tcc -c ..\common\stampdate.c 22 | tlink @scuf.tlr 23 | 24 | getstr.obj: getstr.c var.h 25 | tcc -c $(TCC_OPTION2) getstr.c 26 | 27 | tutil1.obj: tutil1.c 28 | tcc -c $(TCC_OPTION2) tutil1.c 29 | 30 | cufsetup.obj: cufsetup.c var.h 31 | tcc -c $(TCC_OPTION2) cufsetup.c 32 | 33 | kbd.obj: kbd.c var.h 34 | tcc -c $(TCC_OPTION2) kbd.c 35 | 36 | file.obj: file.c 37 | tcc -c $(TCC_OPTION2) file.c 38 | 39 | fed.obj: fed.c 40 | tcc -c -v $(TCC_OPTION2) fed.c 41 | 42 | write.obj: write.c 43 | tcc -c -v $(TCC_OPTION) write.c 44 | 45 | int.obj: int.c 46 | tcc -c $(TCC_OPTION) int.c 47 | 48 | getch.obj: getch.c 49 | tcc -c $(TCC_OPTION) getch.c 50 | 51 | popup.obj: popup.c 52 | tcc -c -v $(TCC_OPTION) popup.c 53 | 54 | fontmsg.obj: fontmsg.c 55 | tcc -c $(TCC_OPTION) fontmsg.c 56 | 57 | convert.obj: convert.c 58 | tcc -c $(TCC_OPTION) convert.c 59 |  -------------------------------------------------------------------------------- /SRC/SCUF/KBD.C: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "inc.h" 4 | #include "var.h" 5 | #include "..\common\cwgrphc.h" 6 | 7 | void waitkbd(unsigned x, unsigned y) 8 | { 9 | register unsigned i; 10 | 11 | setcurpos(x,y,thaimode); 12 | while (!keypressed()) { 13 | for (i=0; !keypressed() && i < 1200 ; i++) 14 | ; 15 | setcurpos(x,y,thaimode); 16 | for (i=0; !keypressed() && i < 1200 ; i++) 17 | ; 18 | setcurpos(x,y,thaimode); 19 | } 20 | setcurpos(x,y,thaimode); 21 | } 22 | 23 | int readkbd(void) 24 | { 25 | unsigned c; 26 | c = bioskey(0); 27 | switch(c) { 28 | case ALTA : c = 0x80; 29 | break; 30 | case ALTB : c = 0x81; 31 | break; 32 | case ALTC : c = 0x88; 33 | break; 34 | case ALTD : c = 0x87; 35 | break; 36 | case ALTE : c = 0x85; 37 | break; 38 | case ALTI : c = 0x84; 39 | break; 40 | case ALTO : c = 0x83; 41 | break; 42 | case ALTQ : c = 0x8c; 43 | break; 44 | case ALTR : c = 0x86; 45 | break; 46 | case ALTS : c = 0x8b; 47 | break; 48 | case ALTT : c = 0x89; 49 | break; 50 | case ALTU : c = 0x8e; 51 | break; 52 | case ALTY : c = 0x82; 53 | break; 54 | default : if (thaimode) { 55 | if ((bioskey(2) & 0x20) == 0) { 56 | return(thaikey(c)); 57 | } else { 58 | if ((c & 0xff00) < 0x4700) 59 | return(thaikey(c)); 60 | } 61 | } 62 | break; 63 | } 64 | return(c); 65 | } 66 | -------------------------------------------------------------------------------- /SRC/SCUP/CPTHAI.C: -------------------------------------------------------------------------------- 1 | /* ---------- Thai Character code for Printer ----------- */ 2 | /* Suttipong Kanakakorn Sat 10-28-1989 10:41:46 , receive BALI at 0xDA,ed,ee */ 3 | #include "cpthai.h" 4 | 5 | /* ----- SMO Character ----- */ 6 | char cp_thaitable[] = { 7 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 8 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 9 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 10 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 11 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 12 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 13 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 14 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 15 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 16 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 17 | CP_MIDDLE ,CP_UPPER ,CP_MIDDLE ,CP_MIDDLE ,CP_UPPER ,CP_UPPER ,CP_UPPER ,CP_UPPER , 18 | CP_LOWER ,CP_LOWER ,CP_LOWER ,CP_MIDDLE ,CP_UPPER ,CP_UPPER ,CP_UPPER ,CP_MIDDLE , 19 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_UPPER , 20 | CP_UPPEST ,CP_UPPEST ,CP_UPPEST ,CP_UPPEST ,CP_UPPEST ,CP_UPPER ,CP_UPPER ,CP_MIDDLE , 21 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE , 22 | CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE ,CP_MIDDLE 23 | }; 24 | -------------------------------------------------------------------------------- /SRC/SCUF/WRITE.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "fed.h" 5 | 6 | void variable_blink(unsigned x,unsigned y); 7 | void reverse(unsigned x,unsigned y); 8 | void hgcwritech(int x,int y,char ch); 9 | void ewritech(int x,int y,char ch); 10 | 11 | void variable_blink(unsigned x,unsigned y) 12 | { 13 | int i; 14 | reverse(x,y); 15 | for (i=0;i<4000;i++); 16 | reverse(x,y); 17 | } 18 | 19 | void reverse(unsigned x,unsigned y) 20 | { 21 | #ifdef NOALIGN 22 | putimage(16+x*8*BYTE+40,(y*Y)+40,char_block_image,XOR_PUT); 23 | #else 24 | putimage(16+x*8*BYTE+align,(y*Y)+40,char_block_image,XOR_PUT); 25 | #endif 26 | } 27 | 28 | 29 | void hgcwritech(int x,int y,char ch) 30 | { 31 | int i,j; 32 | extern int herc_align; 33 | 34 | char far *pos=(char far *)((0xb0000000L)+x+y*90+herc_align); 35 | char *chr=all_font+ch*BYTE*Y; 36 | for(i=0;i 5 | #include 6 | #include 7 | #include 8 | 9 | #include "cwtype.h" 10 | 11 | boolean file_exist(char *filename) 12 | { 13 | int fd; 14 | 15 | fd = open(filename, O_RDONLY || O_BINARY); 16 | if (fd == -1) 17 | return NO; 18 | else { 19 | close(fd); 20 | return YES; 21 | } 22 | } 23 | /* 24 | search_file_mode find_file(char *filename, char *search_path) 25 | { 26 | struct ffblk ffblk; 27 | char p[MAXPATH]; 28 | 29 | if (findfirst(filename, &ffblk, 0) == 0) 30 | return CUR_DIR; 31 | sprintf(p, "%s\\%s", search_path, filename); 32 | if (findfirst(p, &ffblk, 0) == 0) 33 | return CW_DIR; 34 | return NOT_FOUND; 35 | } 36 | */ 37 | int havewild(char *filname) 38 | { 39 | while (*filname) { 40 | if ((*filname == '*') || (*filname == '?')) 41 | return(YES); 42 | filname++; 43 | } 44 | return(NO); 45 | } 46 | 47 | /* read screen font from current dir first, 48 | if not found try reading from search_path 49 | */ 50 | /* Tue 08-01-1989 13:52:17 */ 51 | void readscrfont(void *font_buffer, char *fontname, char *search_path) 52 | { 53 | register int handle; 54 | /* long filelen; */ 55 | char fn[MAXPATH]; 56 | 57 | if ((handle = open(fontname,O_RDONLY || O_BINARY)) == -1) { 58 | sprintf(fn, "%s\\%s", search_path, fontname); 59 | handle = open(fn, O_RDONLY || O_BINARY); 60 | } 61 | if (handle != -1) { 62 | /* filelen = filelength(handle); */ 63 | read(handle, font_buffer, 20*256); 64 | close(handle); 65 | } else { 66 | fprintf(stderr,"FONT FILE (%s) NOT FOUND !\n", fontname); 67 | exit(1); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SRC/SCUF/INT.C: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "fed.h" 4 | #include "inc.h" 5 | #include "..\common\cwgrphc.h" 6 | 7 | static int clock_busy=STOP; 8 | 9 | static void interrupt far (*oldvect28)(void); 10 | static void interrupt far (*oldvect23)(void); 11 | 12 | extern int draw_mode; 13 | 14 | int cur_char; 15 | 16 | union { 17 | char far *ptr; 18 | struct { 19 | unsigned Ofs; 20 | unsigned Seg; 21 | } x; 22 | } ActivePtr; 23 | 24 | void start_clock(int func) 25 | { 26 | clock_busy=func; 27 | } 28 | 29 | get_active_clock() 30 | { 31 | return clock_busy; 32 | } 33 | 34 | void stop_clock() 35 | { 36 | clock_busy=STOP; 37 | } 38 | 39 | void interrupt far newint28(void) 40 | { 41 | static char buff[40]; 42 | enable(); 43 | (*oldvect28)(); 44 | if(clock_busy) 45 | switch(clock_busy) { 46 | case EDIT_FONT:blink(pos_x,pos_y); 47 | switch(draw_mode) { 48 | case 0:dispstrhgc("Move mode",50,16,REVERSEATTR); 49 | return; 50 | case 1:dispstrhgc("Draw mode",50,16,REVERSEATTR); 51 | return; 52 | case 2:dispstrhgc("Erasemode",50,16,REVERSEATTR); 53 | return; 54 | } 55 | break; 56 | case SELECT_FONT: 57 | variable_blink(sel_x,sel_y); 58 | sprintf(buff,"Character # %3d : 0x%02x",cur_char,cur_char); 59 | dispstrhgc(buff,55,0,0); 60 | return; 61 | } 62 | } 63 | 64 | void interrupt far newint23(void){} 65 | 66 | void init_clock() 67 | { 68 | union REGS reg; 69 | struct SREGS sreg; 70 | oldvect23=getvect(0x23); 71 | oldvect28=getvect(0x28); 72 | reg.x.ax=0x3400; 73 | intdosx(®,®,&sreg); 74 | ActivePtr.x.Seg=sreg.es; 75 | ActivePtr.x.Ofs=reg.x.bx; 76 | setvect(0x28,newint28); 77 | setvect(0x23,newint23); 78 | } 79 | 80 | void flush_clock(void) 81 | { 82 | clock_busy=STOP; 83 | setvect(0x28,oldvect28); 84 | setvect(0x23,oldvect23); 85 | } 86 | 87 | -------------------------------------------------------------------------------- /SRC/SCUP/PRINTVAR.EXT: -------------------------------------------------------------------------------- 1 | /* ******************************* */ 2 | /* 3-level buffer declaration */ 3 | /* ******************************* */ 4 | char font[2][11264] ; 5 | char *fonts; 6 | char *bupper1; 7 | char *bupper2; 8 | char *bmiddle1; 9 | char *bmiddle2; 10 | char *bbelow1; 11 | char *bbelow2; 12 | int table[96] = { 13 | /* converse code from so-mo-oo to Kaset */ 14 | /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ 15 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdb,0xdc,0xdd, 16 | 0xde,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0xfc, 17 | 0x00,0x00,0x00,0x00,0xfd,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00, 18 | 0x00,0x00,0x00,0xd2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 19 | 0x00,0x00,0x7f,0x7f,0x7f,0xfd,0xfd,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 20 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 21 | } ; 22 | char tablev[48] = { 23 | 2,1,2,1,1,1,1,1, 3,3,3,3,3,3,3,2, 24 | 2,2,1,1,1,2,2,1, 1,1,1,1,1,1,2,2, 25 | 2,2,2,2,2,2,2,2, 2,2,2,2,1,3,1,2 26 | } ; 27 | int gtable[16] = { 28 | 0x03,0x02,0x01,0x03,0x03, 29 | 0x01,0x00,0x03,0x01,0x01, 30 | 0x01,0x02,0x02,0x02,0x02, 31 | 0x00 32 | } ; 33 | 34 | char mask241[8][3] ={ 35 | 0xc0,0x00,0x00, 36 | 0x18,0x00,0x00, 37 | 0x03,0x00,0x00, 38 | 0x00,0x60,0x00, 39 | 0x00,0x0c,0x00, 40 | 0x00,0x01,0x80, 41 | 0x00,0x00,0x30, 42 | 0x00,0x00,0x06 43 | } ; 44 | 45 | char mask242[8][3] ={ 46 | 0x60,0x00,0x00, 47 | 0x0c,0x00,0x00, 48 | 0x01,0x80,0x00, 49 | 0x00,0x30,0x00, 50 | 0x00,0x06,0x00, 51 | 0x00,0x00,0xc0, 52 | 0x00,0x00,0x18, 53 | 0x00,0x00,0x03 54 | } ; 55 |  -------------------------------------------------------------------------------- /SRC/COMMON/SOUND.C: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* SOUND.C 15 JAN 89 */ 3 | /* Updated : Suttipong Kanakakorn 4 | Sun 08-06-1989 18:30:55 5 | Mon 10-23-1989 23:18:49 */ 6 | /****************************************************************************/ 7 | #include 8 | #include 9 | 10 | #define CC 262*2 11 | #define DD 294*2 12 | #define EE 330*2 13 | #define FF 349*2 14 | #define GG 392*2 15 | #define AA 440*2 16 | #define BB 494*2 17 | #define C 262 18 | #define D 294 19 | #define E 330 20 | #define F 349 21 | #define G 392 22 | #define A 440 23 | #define B 494 24 | #define Cc 262/2 25 | #define Dd 294/2 26 | #define Ee 330/2 27 | #define Ff 349/2 28 | #define Gg 392/2 29 | #define Aa 440/2 30 | #define Bb 494/2 31 | 32 | #ifdef NOSOUND 33 | 34 | void soundnoise(unsigned freq,unsigned time) {} 35 | void errorsound(void) {} 36 | 37 | #else 38 | 39 | void biosdelay(long millisecs); 40 | 41 | void soundnoise(unsigned freq,unsigned time) 42 | { 43 | sound(freq); 44 | biosdelay((long)time); 45 | nosound(); 46 | } 47 | 48 | void errorsound(void) 49 | { 50 | /* soundnoise(C*2,300); */ 51 | soundnoise(C,40); 52 | soundnoise(D,40); 53 | soundnoise(E,40); 54 | soundnoise(F,40); 55 | soundnoise(G,40); 56 | soundnoise(A,40); 57 | soundnoise(B,40); 58 | soundnoise(C*2,40); 59 | } 60 | 61 | /* we can not use delay() because it call dos, so it is not reentrant */ 62 | 63 | void biosdelay(long millisecs) 64 | { 65 | long i; 66 | 67 | i = biostime(0, 0); 68 | millisecs = i + 182L * millisecs / 10000L; 69 | if (millisecs == i) millisecs++; 70 | do { 71 | i = biostime(0, 0); 72 | } while (i < millisecs); 73 | } 74 | 75 | #endif 76 |  -------------------------------------------------------------------------------- /SRC/SCUF/VAR.H: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* VAR.C 15 JAN 89 */ 3 | /* var.c combine with var.h By Noom Suttipong Sun 07-30-1989 15:37:35 */ 4 | /* Updated: Suttipong Kanakakorn */ 5 | /* : Mon 07-31-1989 20:13:05 */ 6 | /****************************************************************************/ 7 | 8 | #ifndef __VAR_H_ 9 | #define __VAR_H_ 10 | 11 | #ifdef DEFINE_VAR 12 | #define EXTERN 13 | #else 14 | #define EXTERN extern 15 | #endif 16 | 17 | /* =================================================================== */ 18 | /* First part can define and declare with the same attribute */ 19 | 20 | 21 | EXTERN char dfont[20 * 256]; 22 | EXTERN char ditalicfont[1]; 23 | 24 | EXTERN char *progname; /* point to argv[0] */ 25 | EXTERN char cuf_dir[MAXDRIVE+MAXDIR]; /* which directory is cw.exe in */ 26 | 27 | /* End first part */ 28 | /* ==================================================================== */ 29 | /* Second part */ 30 | /* We can't init extern variables , just declare it with extern */ 31 | /* We'll define it in one place only */ 32 | 33 | #ifndef DEFINE_VAR 34 | 35 | /* Just declare these variables only */ 36 | 37 | EXTERN char protect1; 38 | EXTERN char protect2; 39 | EXTERN boolean thaimode; /* current mode is thai or eng */ 40 | 41 | #else 42 | /* EXTERN will be declared as null already */ 43 | 44 | EXTERN char protect1 = 0x00; 45 | EXTERN char protect2 = 0x00; 46 | EXTERN boolean thaimode = YES; /* current mode is thai or eng */ 47 | 48 | #endif 49 | 50 | #undef EXTERN /* restore it */ 51 | 52 | #endif /* __VAR_H */ 53 | -------------------------------------------------------------------------------- /SRC/COMMON/CWEGRPH.C: -------------------------------------------------------------------------------- 1 | /* EGA/VGA graphics module for CW 1.20 */ 2 | /* */ 3 | /* Kraisorn Liansee */ 4 | /* Date: 04/21/1988 */ 5 | /* Updated: 04/21/1988 */ 6 | 7 | /* Updated: Suttipong Kanakakorn */ 8 | /* Mon 07-31-1989 19:03:13 */ 9 | /* Tue 08-22-1989 01:53:19 */ 10 | 11 | #include 12 | 13 | /* EGA/VGA dependent function */ 14 | /* This is a EGA/VGA dependent function */ 15 | 16 | #include "cwgrphc.h" 17 | #include "grdetect.h" 18 | 19 | void esetgraph(void) 20 | { 21 | union REGS inregs,outregs; 22 | 23 | graph_seg = 0xA000; 24 | 25 | /* code by Suttipong Kanakakorn */ 26 | if (scrmode == VGA) 27 | inregs.x.ax = 0x11; /* 640 x 480 graphic on vga display */ 28 | else if (scrmode == EGA64 || scrmode == EGA) 29 | inregs.x.ax = 0x10; /* 640 x 350 graphic on ega display */ 30 | else 31 | inregs.x.ax = 0x0F; /* 640 x 350 mono-graphic on mono display */ 32 | 33 | int86 (0x10,&inregs,&outregs); 34 | 35 | outportb (0x03C4,0x02); 36 | if (scrmode != EGAMONO) 37 | outportb (0x03C5,0x0F); 38 | else 39 | /* code by Suttipong Kanakakorn, use 2 plain only on mode 0F */ 40 | outportb (0x03C5,0x03); 41 | } 42 | 43 | 44 | 45 | 46 | void esettext(void) 47 | { 48 | union REGS inregs,outregs; 49 | 50 | inregs.x.ax = 3; 51 | int86 (0x10,&inregs,&outregs); /* text mode */ 52 | } 53 | 54 | 55 | unsigned compute_off (register unsigned x, register unsigned y) 56 | { 57 | return (80*y+x/8); 58 | } 59 |  -------------------------------------------------------------------------------- /SRC/COMMON/EKBD.C: -------------------------------------------------------------------------------- 1 | /* ekbd.c : extended keyboard routine 2 | Written by Suttipong Kanakakorn 3 | Thu 08-03-1989 16:59:05 4 | ebioskey = encapsulate bioskey for future expanded like macro keyboard 5 | placekey(k) place scancode k to ebioskey keyboard buffer 6 | keypressed() check whether key is pressed or not 7 | */ 8 | 9 | #include 10 | #include "cwtype.h" 11 | #include "proto.h" 12 | 13 | extern boolean thaimode; 14 | 15 | #define KBUFSIZE 128 16 | static int ebioskey_buf[KBUFSIZE]; 17 | static int keyb_head = 0; 18 | static int keyb_tail = 0; 19 | 20 | int ebioskey(register int cmd) 21 | { 22 | register int keycode; 23 | if (cmd == 0) { 24 | if (keyb_head == keyb_tail) 25 | return (bioskey(0)); 26 | keycode = ebioskey_buf[keyb_head++]; 27 | if (keyb_head == KBUFSIZE) 28 | keyb_head = 0; 29 | return(keycode); 30 | } 31 | return (bioskey(cmd)); 32 | } 33 | 34 | void placekey(register int k) 35 | { 36 | ebioskey_buf[keyb_tail++] = k; 37 | if (keyb_tail == KBUFSIZE) 38 | keyb_tail = 0; 39 | } 40 | 41 | boolean keypressed(void) 42 | { 43 | if (keyb_head == keyb_tail) 44 | return(asm_keypressed()); 45 | return(YES); 46 | } 47 | 48 | /* Pointer version 49 | #define KBUFSIZE 128 50 | int ebioskey_buf[KBUFSIZE]; 51 | int *keyb_head = ebioskey_buf; 52 | int *keyb_tail = ebioskey_buf; 53 | 54 | int ebioskey(register int cmd) 55 | { 56 | register int keycode; 57 | if (cmd == 0) { 58 | if (keyb_head == keyb_tail) 59 | return (bioskey(0)); 60 | keycode = *keyb_head++; 61 | if (keyb_head == ebioskey_buf + KBUFSIZE) 62 | keyb_head = ebioskey_buf; 63 | return(keycode); 64 | } 65 | return (bioskey(cmd)); 66 | } 67 | 68 | void placekey(register int k) 69 | { 70 | *keyb_tail++ = k; 71 | if (keyb_tail == ebioskey_buf + KBUFSIZE) 72 | keyb_tail = ebioskey_buf; 73 | } 74 | */ 75 | -------------------------------------------------------------------------------- /SRC/COMMON/CUSONG.C: -------------------------------------------------------------------------------- 1 | #include "cwtype.h" 2 | #include "proto.h" 3 | 4 | #define CC 262*2 5 | #define DD 294*2 6 | #define EE 330*2 7 | #define FF 349*2 8 | #define GG 392*2 9 | #define AA 440*2 10 | #define BB 494*2 11 | #define C 262 12 | #define D 294 13 | #define E 330 14 | #define F 349 15 | #define G 392 16 | #define A 440 17 | #define B 494 18 | #define Cc 262/2 19 | #define Dd 294/2 20 | #define Ee 330/2 21 | #define Ff 349/2 22 | #define Gg 392/2 23 | #define Aa 440/2 24 | #define Bb 494/2 25 | 26 | static int cusong_data[] = { 27 | CC,300, A,300, CC,300, E,300, A,300, G,300, G,1800, 28 | CC,300, A,300, E,300, A,300, G,300, D,300, D,1800, 29 | E,300, D,300, E,300, Aa,600, C,600, D,1800, 30 | C,600, D,900, E,300, G,1800, 31 | 32 | CC,300, A,300, CC,300, E,300, A,300, G,300, G,1800, 33 | CC,300, A,300, E,300, A,300, G,300, D,300, D,1800, 34 | G,300, E,300, G,300, D,600, E,600, G,1500, 35 | Gg,600, Aa,900, D,300, C,1800, 36 | 37 | A,600, G,900, A,300, E,1800, 38 | A,600, G,900, E,300, D,1800, 39 | E,300, D,300, E,300, Aa,600, C,600, D,1800, 40 | E,300, D,300, E,300, Gg,600, Aa,600, C,1800, 41 | 42 | CC,300, A,300, CC,300, E,300, A,300, G,300, G,1800, 43 | CC,300, A,300, E,300, A,300, G,300, D,300, D,1800, 44 | G,300, E,300, G,300, D,600, E,600, G,1500, 45 | Gg,600, Aa,900, D,300, C,1800, 46 | 47 | A,600, G,900, A,300, E,1800, 48 | A,600, G,900, E,300, D,1800, 49 | E,300, D,300, E,300, Aa,600, C,600, D,1800, 50 | E,300, D,300, E,300, Gg,600, Aa,600, C,1800, 51 | 52 | CC,300, A,300, CC,300, E,300, A,300, G,300, G,1800, 53 | CC,300, A,300, E,300, A,300, G,300, D,300, D,1800, 54 | G,300, E,300, G,300, D,600, E,600, G,1500, 55 | G,600, A,900, CC,300, CC,1800, 56 | }; 57 | 58 | void cusong(void) 59 | { 60 | 61 | register int i; 62 | for (i = 0; !keypressed() && i < sizeof(cusong_data)/sizeof(int); i += 2) { 63 | soundnoise(cusong_data[i], cusong_data[i+1]); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /SRC/SCUW/MAINSYLS.C: -------------------------------------------------------------------------------- 1 | #include "Thai.h" 2 | #include "TCtype.h" 3 | #include "Global.h" 4 | #include "CType.h" 5 | 6 | /*------------------------------------------------------------------------ 7 | Module name : SYL_SEP (Syllable Separation) 8 | Parameters : lm (Left Limit to search for cut point) 9 | eot (End Of Text) 10 | rm (Right Margin) 11 | Function : Find the location of the given text to be separated 12 | Return : Pointer to that location (Real Right Margin) 13 | 14 | Author : Tanat Chirakarn 15 | Subun Yenjaichon 16 | 17 | Date Written : Friday, 6 May, 1988 8:38:18 AM 18 | Last Update : Thueday, 19 May, 1988 10:07:31 AM 19 | ------------------------------------------------------------------------*/ 20 | 21 | /* The Main Function Thai Syllable Separate that will return 22 | the Real Right Margin */ 23 | 24 | /* Function name must be capital letter for asm call */ 25 | 26 | unsigned char *FINDCUT(lm, eot, rm) 27 | unsigned char *lm, *eot, *rm; /* receive value from assembly call */ 28 | { 29 | register unsigned char *CutPt; 30 | 31 | LeftLimit = lm; /* give value to C's global variable */ 32 | EndOfText = eot; /* give value to C's global variable */ 33 | RightMargin = rm; /* give value to C's global variable */ 34 | 35 | /* Back searching to find cut point until left limit */ 36 | 37 | if (isbpunc(*(RightMargin + 1)) || istspmk(*(RightMargin + 1))) 38 | --RightMargin; 39 | for (Indx = RightMargin; Indx >= LeftLimit; --Indx) 40 | { 41 | if ((CutPt = ThaiEngCutRtn(Indx)) != NULL) 42 | return((CutPt >= LeftLimit)? CutPt : NULL); 43 | else 44 | if ((CutPt = (*FuncPtr[*Indx])(Indx)) != NULL) 45 | if (CutPt >= LeftLimit && CutPt <= RightMargin 46 | && !isfpunc(*CutPt) && !isbpunc(*(CutPt+1)) 47 | && !istspmk(*(CutPt+1))) 48 | return (CutPt); 49 | } 50 | return(RightMargin); /* Reach LeftLimit, return RightMargin */ 51 | } -------------------------------------------------------------------------------- /SRC/SCUP/SMENU.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include "inc.h" 3 | #include "..\common\kbdcode.h" 4 | #include "..\common\cwgrphc.h" 5 | 6 | /* 7 | smenu -> select menu 8 | - popup menu for user to select, programmer must save and restore 9 | the screen by himslef 10 | 11 | - input x, y, number of messege, messege, curmenu 12 | - output curmenu 13 | - return ESCKEY or RETKEY 14 | 15 | Written: Suttipong Kanakakorn 16 | Date: Fri 08-18-1989 09:16:37 17 | */ 18 | 19 | int smenu(register int x, register int y, int number, 20 | char *message[], int *curmenu) 21 | { 22 | int i; 23 | int c, length; 24 | char fmt[7]; 25 | 26 | length = find_menu_len(number, message); 27 | sprintf(fmt, "%%-%ds", length); 28 | /* 29 | scrndx = savescrn(x-1, y-1, x+1+length, y+number+1); 30 | */ 31 | for (i = 0; i < number; i++) { 32 | dispprintf(x, y+i, NORMALATTR, fmt, message[i]); 33 | } 34 | i = *curmenu - 1; 35 | dispprintf(x, y+i, REVERSEATTR, fmt, message[i]); 36 | box(x*8 - 2, y*20 + 2, (x+length-1)*8 + 9, (y+number)*20 + 5); 37 | while (1) { 38 | c = ebioskey(0); 39 | switch(c) { 40 | case UPKEY : 41 | dispprintf(x, y+i, NORMALATTR, fmt, message[i]); 42 | i = (i) ? i-1 : number - 1; 43 | dispprintf(x, y+i, REVERSEATTR, fmt, message[i]); 44 | break; 45 | case DNKEY : 46 | dispprintf(x, y+i, NORMALATTR, fmt, message[i]); 47 | i = (i != number - 1) ? i+1 : 0; 48 | dispprintf(x, y+i, REVERSEATTR, fmt, message[i]); 49 | break; 50 | case ESCKEY : 51 | case RETKEY : 52 | /* 53 | resscrn(scrndx, x-1, y-1, x+1+length, y+number+1); 54 | */ 55 | *curmenu = i + 1; 56 | return(c); 57 | } 58 | } 59 | } 60 | 61 | unsigned find_menu_len(register int number, char *message[]) 62 | { 63 | register unsigned length; 64 | int i; 65 | char **m; 66 | 67 | length = thaistrlen(message[0]); 68 | for (m = message+1; m < message + number; m++) { 69 | if ((i = thaistrlen(*m)) > length) 70 | length = i; 71 | } 72 | return length; 73 | } 74 | -------------------------------------------------------------------------------- /SRC/SCUP/MAKEFILE: -------------------------------------------------------------------------------- 1 | # makefile for cuprint.exe 2 | # by Suttipong Kanakakorn 3 | # Sun 08-06-1989 16:24:05 4 | # 5 | # TCC_OPTION -w = enable all warning 6 | # 7 | TCC_OPTION=-w 8 | 9 | \cw\cuprint.exe: \ 10 | ..\common\edisp.obj ..\common\hdisp.obj ..\common\adisp.obj \ 11 | ..\common\grdetect.obj \ 12 | ..\common\cwgrphc.obj ..\common\cwegrph.obj ..\common\cwagrph.obj \ 13 | ..\common\ekbd.obj \ 14 | ..\common\cscrn.obj ..\common\fileutil.obj ..\common\dir.obj \ 15 | ..\common\sound.obj \ 16 | kbd.obj getstr.obj tutil1.obj cupsetup.obj \ 17 | pmenu.obj smenu.obj prtutil.obj \ 18 | printing.obj prt.obj prtt.obj prtg.obj \ 19 | pic.obj dot.obj cpi.obj global.obj prncntrl.obj \ 20 | error.obj preproc.obj 24pins.obj attr.obj cpthai.obj \ 21 | prtbuf24.obj 22 | tcc -c $(TCC_OPTION) ..\common\stampdate.c 23 | tlink @scup.tlr 24 | 25 | kbd.obj: kbd.c 26 | tcc -c $(TCC_OPTION) kbd.c 27 | 28 | getstr.obj: getstr.c 29 | tcc -c $(TCC_OPTION) getstr.c 30 | 31 | tutil1.obj: tutil1.c 32 | tcc -c $(TCC_OPTION) tutil1.c 33 | 34 | cupsetup.obj: cupsetup.c 35 | tcc -c $(TCC_OPTION) cupsetup.c 36 | 37 | pmenu.obj: pmenu.c 38 | tcc -c $(TCC_OPTION) pmenu.c 39 | 40 | smenu.obj: smenu.c 41 | tcc -c $(TCC_OPTION) smenu.c 42 | 43 | #pconfig.obj: pconfig.c 44 | # tcc -c $(TCC_OPTION) pconfig.c 45 | 46 | prtutil.obj: prtutil.c 47 | tcc -c $(TCC_OPTION) prtutil.c 48 | 49 | printing.obj: printing.c 50 | tcc -c $(TCC_OPTION) printing.c 51 | 52 | prt.obj: prt.c 53 | tcc -c $(TCC_OPTION) prt.c 54 | 55 | prtt.obj: prtt.c 56 | tcc -c $(TCC_OPTION) prtt.c 57 | 58 | prtg.obj: prtg.c 59 | tcc -c $(TCC_OPTION) prtg.c 60 | 61 | pic.obj: pic.c 62 | tcc -c $(TCC_OPTION) pic.c 63 | 64 | dot.obj: dot.c 65 | tcc -c $(TCC_OPTION) dot.c 66 | 67 | cpi.obj: cpi.c 68 | tcc -c $(TCC_OPTION) cpi.c 69 | 70 | global.obj: global.c 71 | tcc -c $(TCC_OPTION) global.c 72 | 73 | prncntrl.obj: prncntrl.c 74 | tcc -c $(TCC_OPTION) prncntrl.c 75 | 76 | error.obj: error.c 77 | tcc -c $(TCC_OPTION) error.c 78 | 79 | preproc.obj: preproc.c 80 | tcc -c $(TCC_OPTION) preproc.c 81 | 82 | 24pins.obj: 24pins.c 83 | tcc -c $(TCC_OPTION) 24pins.c 84 | 85 | attr.obj: attr.c 86 | tcc -c $(TCC_OPTION) attr.c 87 | 88 | cpthai.obj: cpthai.c 89 | tcc -c $(TCC_OPTION) cpthai.c 90 | 91 | prtbuf24.obj: prtbuf24.c 92 | tcc -c $(TCC_OPTION) prtbuf24.c 93 | 94 |  -------------------------------------------------------------------------------- /SRC/SCUP/CONST.H: -------------------------------------------------------------------------------- 1 | /* macro for control code of printer */ 2 | #define SET_1_8_LINE_SPACE 0x30 /* set 1/8 inch line spacing */ 3 | #define SET_1_6_LINE_SPACE 0x32 /* set 1/6 inch line spacing */ 4 | #define SET_N_180_LINE_SPACE 0x33 /* set n/180 inch line spacing */ 5 | #define SET_N_60_LINE_SPACE 0x41 /* set n/60 inch line spacing */ 6 | #define N_180_LINE_FEED 0x4a /* perform n/180 inch line feed */ 7 | #define SET_PAGE_IN_LINE 0x43 /* set page length in lines */ 8 | #define SINGLE_DENSITY 0x4b /* set single density bit image */ 9 | #define DOUBLE_DENSITY 0x4c /* set double density bit image */ 10 | #define H_SP_DOUBLE_DENSITY 0x59 /* select high speed double density bit image*/ 11 | #define QUADRUPLE_DENSITY 0x5a /* select quadruple_density bit image printing */ 12 | #define BIT_IMAGE_COMMAND 0x2a /* general 8 pin bit image command */ 13 | 14 | /* macro for buffer */ 15 | #define MAX_BUFFER 1920 16 | #define DOT_BIT_IMAGE_MODE_1 480 17 | #define DOT_BIT_IMAGE_MODE_2 960 18 | #define DOT_BIT_IMAGE_MODE_3 1440 19 | #define DOT_BIT_IMAGE_MODE_4 1920 20 | 21 | #define MINIMUM_LINE_SPACING 4 /* minimum line spacing not update base position */ 22 | #define MASK_BYTE 128 23 | 24 | /* macro for font area */ 25 | #define MAX_FONT 10 26 | #define FONT_AREA_SIZE 11264 27 | 28 | /* macro for error message */ 29 | #define MEM_NOT_ENOUGH 0 30 | #define NOT_OPEN_FILE 1 31 | 32 | /* define printer type */ 33 | #define EPSON9PIN80COLTYPE1 0 34 | #define EPSON9PIN136COLTYPE1 1 35 | #define EPSON9PIN80COLTYPE2 2 36 | #define EPSON24PIN80COL 3 37 | #define EPSON24PIN136COL 4 38 | #define NEC24PIN80COL 5 39 | #define NEC24PIN136COL 6 40 | #define FX 0 41 | #define LX 1 42 | #define LQ 2 43 | #define N5 3 44 | #define N7 4 45 | 46 | /* Add by Suttipong Kanakakorn Tue 08-29-1989 12:32:36 */ 47 | /* for calculating linespace */ 48 | /* IPL = inch per line / 180 for 24 pins printer */ 49 | /* IPL = inch per line / 216 for 9 pins printer */ 50 | 51 | #define IPL_TEXT_24 60 52 | #define IPL_TEXT_9 67 53 | #define IPL_GRPH_24 46 54 | #define IPL_GRPH_9 48 55 | 56 | /* ML = maxline per page */ 57 | #define ML_TEXT_24 (((pagelength)-1) * 180 / IPL_TEXT_24) 58 | #define ML_TEXT_9 (((pagelength)-1) * 216 / IPL_TEXT_9) 59 | #define ML_GRPH_24 (((pagelength)-1) * 180 / IPL_GRPH_24) 60 | #define ML_GRPH_9 (((pagelength)-1) * 216 / IPL_GRPH_9) 61 |  -------------------------------------------------------------------------------- /SRC/COMMON/PROTO.H: -------------------------------------------------------------------------------- 1 | /* cproto.h: common prototype.h, function prototype of file 2 | from common directory 3 | from assembly module 4 | hdisp.asm, edisp.asm 5 | from C module 6 | ekbd.c, cscrn.c cwgraphc.c 7 | */ 8 | /* Updated: Suttipong Kanakakorn 9 | Sun 07-30-1989 17:56:53 10 | */ 11 | 12 | /* From cwgraphc.c edisp.asm hdisp.asm */ 13 | void prchar(unsigned c,unsigned attr,unsigned x,unsigned y); 14 | void prblank(unsigned x,unsigned y); 15 | void setcurpos(unsigned x,unsigned y,int thaimode); 16 | void plot(unsigned x,unsigned y); 17 | void setgraph(void); 18 | void settext(void); 19 | char stdtoku (char c); 20 | char kutostd (char c); 21 | int thaikey(unsigned c); 22 | int asm_keypressed(void); 23 | void savepic(void); 24 | void retpic(void); 25 | void clsall(void); 26 | void clsgraph(unsigned x1,unsigned y1,unsigned x2,unsigned y2); 27 | void clrline(unsigned x1,unsigned y1,unsigned x2); 28 | void prakeaw(void); 29 | int whatlevel(char c); 30 | void rdchardot (unsigned int x, unsigned int y); 31 | void wrchardot (unsigned int x, unsigned int y); 32 | 33 | /***EKBD.C****************************************************************/ 34 | int ebioskey(int cmd); 35 | void placekey(int k); 36 | boolean keypressed(void); 37 | 38 | /***CSCRN.C***************************************************************/ 39 | int sign(int x); 40 | void _line(int x1,int y1,int x2,int y2); 41 | void box(int x1,int y1,int x2,int y2); 42 | void dispstrhgc(char *st, unsigned x, unsigned y, font_attr attr); 43 | void dispprintf(unsigned x, unsigned y, font_attr attr, char *format,...); 44 | void dispblank(unsigned x, unsigned y, unsigned count, font_attr attr); 45 | void togglefont(font_attr *curfont, font_code code); 46 | void framebox(unsigned x1, unsigned y1, 47 | unsigned x2, unsigned y2, 48 | unsigned attr); 49 | void blockmsg(int y); 50 | void showerrno(void); 51 | void resscrn(char *scrnindex,int x1,int y1,int x2,int y2); 52 | char *savescrn(int x1,int y1,int x2,int y2); 53 | 54 | /**** FILEUTIL.C ****/ 55 | boolean file_exist(char *filename); 56 | int havewild(char *filname); 57 | void readscrfont(void *font_buffer, char *fontname, char *search_path); 58 | search_file_mode find_file(char *filename, char *search_path); 59 | 60 | /***DIR.C********************************************************************/ 61 | int selectfile(char mask[]); 62 | 63 | /***SOUND.C******************************************************************/ 64 | void soundnoise(unsigned freq,unsigned time); 65 | void errorsound(void); 66 | 67 | /* cusong.c */ 68 | void cusong(void); 69 | -------------------------------------------------------------------------------- /SRC/SCUP/PRNCNTRL.C: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------- */ 2 | /* Program : PRNCNTRL.C */ 3 | /* Create Date : 9 May 1989 */ 4 | /* Programmer : Mr. Prasart Topitumatukhun */ 5 | /* Updated : Suttipong Kanakakorn */ 6 | /* increse speed and add function prototype */ 7 | /* Function : control printer */ 8 | /* ----------------------------------------------- */ 9 | 10 | /* header file */ 11 | #include 12 | #include 13 | #include "const.h" 14 | #include "cuptype.h" 15 | 16 | void putp(unsigned c) 17 | { 18 | /* 19 | union REGS regs; 20 | regs.h.ah = 0; 21 | regs.h.al = c; 22 | regs.h.dh = 0; 23 | regs.h.dl = 0; 24 | intr(0x17,®s,®s); 25 | */ 26 | biosprint(0, c, 0); 27 | } 28 | 29 | int PrinterReadstatus(void) 30 | { 31 | /* 32 | union REGS regs; 33 | regs.h.ah = 0x02; 34 | regs.h.al = 0; 35 | regs.h.dh = 0; 36 | regs.h.dl = 0; 37 | return(int86(0x17,®s,®s)); 38 | */ 39 | return(biosprint(2, 0, 0)); 40 | } 41 | 42 | void PrinterInitialize(void) 43 | { 44 | putp(ESC); 45 | putp('@'); 46 | } 47 | 48 | /* 49 | void PrinterSetFormLenghtLine(register unsigned n) 50 | { 51 | putp(ESC); 52 | putp('C'); 53 | putp(n); 54 | } 55 | */ 56 | 57 | void PrinterSetFormLenghtInch(register unsigned n) 58 | { 59 | putp(ESC); 60 | putp('C'); 61 | putp(0); 62 | putp(n); 63 | } 64 | 65 | void PrinterSkipLine(register int n) 66 | { 67 | for (;n>0; n--) { 68 | putp(CR); 69 | putp(LF); 70 | } 71 | } 72 | 73 | void PrinterFormFeed(void) 74 | { 75 | putp(FF); 76 | } 77 | 78 | /* modify by Suttipong Kanakakorn Tue 08-29-1989 12:56:39 */ 79 | void PrinterLineFeed(register unsigned n) 80 | { 81 | putp(CR); 82 | if (n == 0) 83 | return; 84 | putp(ESC); 85 | putp('J'); 86 | putp(n); /* will feed n/180 inches on 24 pins printer and */ 87 | /* n/216 inches on 9 pins printer */ 88 | } 89 | 90 | void PrinterMasterSelectMode(register unsigned n) 91 | { 92 | putp(ESC); 93 | putp('!'); 94 | putp(n); 95 | } 96 | 97 | void PrinterSetGraphicMode9pinQuadrupleDensity(register unsigned n) 98 | { 99 | putp(ESC); 100 | putp('Z'); 101 | putp(n%256); 102 | putp(n/256); 103 | } 104 | 105 | void PrinterSetGraphicMode24pinTripleDensity(register unsigned n) 106 | { 107 | putp(ESC); 108 | putp('*'); 109 | putp(39); 110 | putp(n%256); 111 | putp(n/256); 112 | } 113 | 114 | void PrinterSet10cpi(void) 115 | { 116 | putp(ESC); 117 | putp('P'); 118 | } 119 | -------------------------------------------------------------------------------- /SRC/SCUW/TUTIL1.C: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* tutil1.C -> Thai utility 1 , cut from str.c */ 3 | /* updated: Suttipong Kanakakorn */ 4 | /* Wed 08-02-1989 09:52:44 */ 5 | /* Sun 08-06-1989 11:24:52 */ 6 | /****************************************************************************/ 7 | #include "inc.h" 8 | 9 | /*****************************************************************************/ 10 | /* find length of thai string */ 11 | /* input */ 12 | /* thaist : thai string */ 13 | /* return : length of thai string */ 14 | /* Modify : Suttipong Kanakakakorn */ 15 | /* Mon 07-31-1989 08:32:36 use only pointer no index */ 16 | /*****************************************************************************/ 17 | unsigned thaistrlen(register unsigned char *thaist) 18 | { 19 | register int count = 0; 20 | font_attr curfont = 0; 21 | 22 | while (*thaist) { 23 | if (whatlevel(*thaist) == MIDDLE) { 24 | if (*thaist < 32) { 25 | togglefont(&curfont,*thaist); 26 | } else { 27 | count++; 28 | if ((curfont & ENLARGEATTR) == ENLARGEATTR) { 29 | count++; 30 | } 31 | } 32 | } 33 | thaist++; 34 | } 35 | return(count); 36 | } 37 | 38 | /****************************************************************************/ 39 | /* Find column of string from column given in Thai,ignore level of Thai */ 40 | /* character & attribute code of font. Column is origin 0. Find current */ 41 | /* attribute of font of string via *font too. */ 42 | /****************************************************************************/ 43 | unsigned linearcolumn(char *textstream, unsigned thaicol, font_attr *font) 44 | { 45 | register unsigned logiccol = 0; /* origin 0 */ 46 | *font = 0; 47 | while ((thaicol > 0) && (*textstream != '\0')) { 48 | if (whatlevel(*textstream) == MIDDLE) { 49 | if (*textstream < 32) { 50 | togglefont(font,*textstream); 51 | } else { 52 | if ((*font & ENLARGEATTR) == ENLARGEATTR) thaicol--; 53 | if (thaicol > 0) thaicol--; 54 | } 55 | } 56 | textstream++; 57 | logiccol++; 58 | } 59 | if (*textstream != MIDDLE) { 60 | while (whatlevel(*(textstream++)) != MIDDLE) 61 | logiccol++; 62 | } 63 | return(logiccol); 64 | } 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CU Writer 1.41 Source Code 2 | ========================== 3 | 4 | Descriptions 5 | ------------ 6 | [CU Writer](http://th.wikipedia.org/wiki/%E0%B8%8B%E0%B8%B5%E0%B8%A2%E0%B8%B9%E0%B9%84%E0%B8%A3%E0%B9%80%E0%B8%95%E0%B8%AD%E0%B8%A3%E0%B9%8C) is a Thai [WordStar](https://en.wikipedia.org/wiki/WordStar) clone that run on [DOS](https://en.wikipedia.org/wiki/DOS). 7 | Develop by Computer Service Centre and Faculty of Engineering, Chulalongkorn University. 8 | First public release in april 1989 in [public domain](http://unlicense.org/), 9 | through BBTV Channel 7. 10 | 11 | More information about CU Writer, please read [Wikipedia](http://th.wikipedia.org/wiki/%E0%B8%8B%E0%B8%B5%E0%B8%A2%E0%B8%B9%E0%B9%84%E0%B8%A3%E0%B9%80%E0%B8%95%E0%B8%AD%E0%B8%A3%E0%B9%8C) or [CW141 wiki](https://github.com/kytulendu/CW141/wiki) (both are in Thai). 12 | 13 | This is the same original source code that found on a ftp server. 14 | ftp://ftp.cs.washington.edu/pub/thaisys/software/dos/cu-writer/ 15 | 16 | cusrc-1.zip 41 KB 12/5/2536 0:00:00 17 | cusrc-2.zip 37 KB 12/5/2536 0:00:00 18 | cusrc-3.zip 62 KB 12/5/2536 0:00:00 19 | cusrc-4.zip 91 KB 12/5/2536 0:00:00 20 | 21 | no modification in the source code, except change a function name 22 | in \COMMON\CSCR.C from line to _line to make it not conflict with 23 | Borland Graphics Interface (BGI) when linking CUFONT, 24 | some edit in MAKEFILE and TURBOC.CFG. 25 | 26 | I also add the original document that included in CU Writer 1.41 release, 27 | TIS-620 converted document, binary font files and [Command Quick Reference](QREF.md) to the repo. 28 | 29 | The source code use Thai Industrial Standard 620-2533 (TIS-620) 30 | for character encoding. 31 | 32 | System Requirement 33 | ------------------ 34 | 35 | * IBM PC or Compatible, 8086 or 8088 CPU, 256 KB RAM or better 36 | * DOS 3.3 or better 37 | * Hercules, EGA, VGA, MCGA or AT&T 400 (Graphic card in AT&T PC 6300/Olivetti M24) 38 | * Two 5.25" 360Kb floppy disk drive 39 | * 9 pin or 24 pin Dot-Matrix printer 40 | 41 | Compiling the source code 42 | ------------------------- 43 | 44 | 1. To build this source code you need 45 | 46 | - Borland Turbo C 2.01 47 | - Borland Turbo Assembler 2.0 or newer 48 | 49 | 2. Put this reposity content into C:\CW 50 | 3. Set PATH to Turbo C and Turbo Assembler 51 | 4. Change directory to C:\CW\SRC 52 | 5. Run MAKE.BAT 53 | 6. Binary will go to C:\CW\ 54 | 55 | CU-Writer developers 56 | -------------------- 57 | From CU-Writer 1.2 manual and CU-Writer 1.41 source code. 58 | 59 | * สถาบันบริการคอมพิวเตอร์ จุฬาลงกรณ์มหาวิทยาลัย และ ภาควิชาวิศวกรรมคอมพิวเตอร์ คณะวิศวกรรมศาสตร์ จุฬาลงกรณ์มหาวิทยาลัย 60 | (Computer Service Centre and Faculty of Engineering, Chulalongkorn University) 61 | * สำนวน หิรัญวงษ์ 62 | (Sumnuan Hirunwong) 63 | * ไกรศร เลียนษี 64 | (Kraisorn Liansee) 65 | * ดำเกิง ธรรมเถกิงกิจ 66 | * ทศพล อภิกุลวณิช 67 | (Thotsapol Aphikulvanich) 68 | * ธณัฎฐ์ จิระกาล 69 | (Tanat Chirakarn) 70 | * ประสาท โตปิตุมาตุคุณ 71 | (Prasart Topitumatukhun) 72 | * ลักษณ์ชัย ลือชัยชนะกุล 73 | * วิชัย ปฏิภาภรณ์ 74 | (Wichai Patipaporn) 75 | * วิทยา วงศ์อนวัช 76 | (Wittaya Wonganawat) 77 | * สุทธิพงษ์ คนาคกร 78 | (Suttipong Kanakakorn) 79 | * สุบรรณ เย็นใจชน 80 | (Subun Yenjaichon) 81 | * สุวพจน์ จันทโรจนวงศ์ 82 | 83 | If you know any one who is in CU-Writer project that isn't in this list, 84 | please in inform me. :) 85 | -------------------------------------------------------------------------------- /SRC/SCUP/GLOBAL.EXT: -------------------------------------------------------------------------------- 1 | /* Modified Suttipong Kanakakorn Mon 08-14-1989 10:57:02 */ 2 | /* By CUCC 22 June 90 */ 3 | 4 | #include 5 | 6 | /* ******************************* */ 7 | /* 3-level buffer declaration */ 8 | /* ******************************* */ 9 | extern char *font[2]; /* Suttipong Kanakakorn Tue 08-15-1989 01:23:37 */ 10 | extern char *fonts; /* Suttipong Kanakakorn Tue 08-15-1989 01:23:51 */ 11 | extern char *bupper1; 12 | extern char *bupper2; 13 | extern char *bupper3; 14 | extern char *bmiddle1; 15 | extern char *bmiddle2; 16 | extern char *bmiddle3; 17 | extern char *bbelow1; 18 | extern char *bbelow2; 19 | extern char *bbelow3; 20 | extern char *extbar1; 21 | extern char *extbar2; 22 | extern char *extbar3; 23 | extern int table[]; 24 | extern char tablev[]; 25 | extern int tgtable[]; 26 | extern char mask241[8][3]; 27 | extern char mask242[8][3]; 28 | extern FILE *fp; 29 | extern int fileready; 30 | extern char blankline[]; 31 | extern char oldfilename[]; 32 | extern char filename[]; 33 | extern char cup_dir[]; 34 | /************************** 35 | Menu data area . 36 | ***************************/ 37 | extern char mcol[]; 38 | extern char smcol[]; 39 | extern char mlenght; 40 | /************************** 41 | Dotcommand global area . 42 | **************************/ 43 | extern FILE *mfp; /* define mailmerge file ptr */ 44 | extern char *fieldname[]; /* define array of fieldnames */ 45 | extern char *fieldcontent[]; /* define array of strings */ 46 | extern int fieldcount; /* define number of fields */ 47 | extern int mailmergeflag; /* each field content ready */ 48 | extern int mergefileexist; /* .df successful */ 49 | extern int fieldnameexist; /* .rv successful */ 50 | /*** Printer Data Area ****/ 51 | extern int graphicprint; 52 | extern int prtcodestd; /* YES standard,NO ku */ 53 | extern int cpi; /* number of characters per inch */ 54 | extern int lineperpage; 55 | extern int userlineperpage; 56 | extern int pagelength; 57 | extern int leftmargin; 58 | extern int rightmargin; 59 | extern char pagetitle[]; 60 | extern char pageformat[]; 61 | extern char heading[]; 62 | extern char footing[]; 63 | /* -------------------------------------- 64 | Location of pagetitle,heading,footing 65 | 0 -> no print 1 -> left justify 66 | 2 -> center justify 3 -> right justify 67 | 4 -> right<-> odd pgno left <-> even 68 | 5 -> right<-> even left <-> odd 69 | -------------------------------------- */ 70 | extern int locpagetitle; 71 | extern int locheading; 72 | extern int locfooting; 73 | extern int printer; 74 | extern int printer24pin; 75 | extern int printer24pininit; 76 | extern int printer9pininit; 77 | extern int maxcol; 78 | extern int maxdot; 79 | extern int maxbuffer; 80 | extern int linespace; 81 | extern int nlqmode; 82 | extern int pagebreak; 83 | extern int pagebegin; 84 | extern int pageend; 85 | extern int pagenumberoffset; 86 | extern int copytoprint; 87 | extern int stdcode; 88 | extern int curline; 89 | extern int curpage; 90 | extern int newpage; 91 | /*********************************/ 92 | extern int thaimode; 93 | extern int quitprog; 94 | extern int rowmax[]; 95 | extern int prtrowmax; 96 | extern int titlerowmax; 97 | extern int moderowmax; 98 | extern int smallpaper; 99 | 100 | extern char *progname; 101 | extern char prog_date[]; 102 | extern char prog_time[]; 103 | 104 | extern int extbarprinting; 105 |  -------------------------------------------------------------------------------- /SRC/SCUP/PROTO.H: -------------------------------------------------------------------------------- 1 | /* function prototype for cuprint, (use in prjcuw\scup only) 2 | Written Suttipong Kanakakorn Mon 08-07-1989 00:29:50 3 | */ 4 | 5 | /* kbd.c */ 6 | void waitkbd(unsigned x, unsigned y); 7 | int readkbd(void); 8 | 9 | /* getstr.c */ 10 | int getstring(char textst[], int x, int y, int maxlen, font_attr attr); 11 | int getname(char textst[], int x, int y, int maxlen, font_attr attr); 12 | int getnumber(char textst[], int x, int y, int maxlen, font_attr attr); 13 | 14 | /* tutil1.c */ 15 | int thaistrlen(char *thaist); 16 | 17 | /* error.c */ 18 | void disperror(char *s); 19 | 20 | /* pconfig.c */ 21 | int savepconfig(void); 22 | int readpconfig(void); 23 | 24 | /* ldfont.c */ 25 | void loadfont(void); 26 | 27 | /* pmenu.c */ 28 | void writemenu(int row, int col, font_attr attr); 29 | void writeallmenu(void); 30 | void menuselect(void); 31 | void prtwriteallmenu(void); 32 | void prtwritemenu(int row, font_attr attr); 33 | void prtmenuselect(void); 34 | void setprinter(int smallpaper, int printer24pin); 35 | void prtdocommand(int row); 36 | void modewriteallmenu(void); 37 | void modewritemenu(int row, int attr); 38 | void modemenuselect(void); 39 | void modedocommand(int row); 40 | void titlewriteallmenu(void); 41 | void titlewritemenu(int row, int attr); 42 | void titlemenuselect(void); 43 | void titledocommand(int row); 44 | 45 | /* printing.c */ 46 | void printing(void); 47 | char *setpageformat(char form[], int max); 48 | void initializebufferandfont(void); 49 | void contostd(char *t); 50 | void clear_message(void); 51 | 52 | /* prt.c */ 53 | void AllocateBuffer9pin(void); 54 | int PrinterLoadFont9pin(void); 55 | int islevel(int *pline); 56 | void PrinterLoadLine(char pline[]); 57 | void PrinterLoadLine9pin(char line[]); 58 | 59 | /* prtutil.c */ 60 | int find_line_perpage(void); 61 | int find_max_line_perpage(void); 62 | int find_max_userline_perpage(void); 63 | int find_line_space(void); 64 | void set_all_lineperpage(set_linespace_mode mode); 65 | void line_feed(unsigned n); 66 | void skip_line(unsigned n); 67 | 68 | /* prtt.c */ 69 | void PrinterLoadLineText(unsigned char line[]); 70 | 71 | /* prncntrl.c */ 72 | void putp(unsigned c); 73 | int PrinterReadstatus(void); 74 | void PrinterInitialize(void); 75 | void PrinterSetFormLenghtInch(unsigned n); 76 | void PrinterSetFormLenghtLine(unsigned n); 77 | void PrinterSkipLine(int n); 78 | void PrinterFormFeed(void); 79 | void PrinterLineFeed(unsigned n); 80 | void PrinterMasterSelectMode(unsigned n); 81 | void PrinterSetGraphicMode9pinQuadrupleDensity(unsigned n); 82 | void PrinterSetGraphicMode24pinTripleDensity(unsigned n); 83 | void PrinterSet10cpi(void); 84 | 85 | /* dot.c */ 86 | void dotcommand(char string[]); 87 | void mailmerge(char stringin[], char stringout[]); 88 | int blankskip(char *s); 89 | 90 | /* prtbuf24.c */ 91 | void PrintThree24pin(int uindex, int mindex, int lindex); 92 | void PrintBuffer24pin(char buf1[], char buf2[], char buf3[], int maxscan); 93 | 94 | /* prtg.c */ 95 | void PrintThree9pin(void); 96 | 97 | /* pic.c */ 98 | void read_picture_file(void); 99 | 100 | /* cpi.c */ 101 | void charwidth(char buf1[]); 102 | 103 | /* pic.c */ 104 | void get_argument(char arg[][40],char st[],int *no_arg); 105 | void analyze_picture_file(char *st); 106 | void initialize_read(char *st); 107 | 108 | /* cwsetup.c */ 109 | void cupsetup(int argc, char *argv[]); 110 | void usage(void); 111 | void set_directory(void); 112 | void readoption(search_file_mode mode); 113 | void saveoption(search_file_mode mode); 114 | void readfont(void *font_buffer, char *fontname); 115 | int handler(int errval,int ax,int bp,int si); 116 | void *cp_loadfont (char *fname, unsigned font_size); 117 | 118 | /* 24pins.c (24pins.h) */ 119 | void execerror ( char *s, char *t); 120 | 121 | /* smenu.c */ 122 | int smenu(register int x, register int y, int number, 123 | char *messege[], int *curmenu); 124 | unsigned find_menu_len(register int number, char *messege[]); 125 | -------------------------------------------------------------------------------- /SRC/SCUW/MAKEFILE: -------------------------------------------------------------------------------- 1 | # 2 | # makefile for cw.exe 3 | # Updated: Suttipong Kanakakorn 4 | # Sun 08-06-1989 16:25:44 5 | # 6 | # TCC_OPTION -w = enable all warning 7 | # 8 | TCC_OPTION=-w -DCW 9 | 10 | \cw\cw.exe: \ 11 | ..\common\edisp.obj ..\common\hdisp.obj ..\common\adisp.obj \ 12 | ..\common\grdetect.obj \ 13 | ..\common\cwgrphc.obj ..\common\cwegrph.obj ..\common\cwagrph.obj \ 14 | ..\common\ekbd.obj \ 15 | ..\common\cscrn.obj ..\common\fileutil.obj ..\common\dir.obj \ 16 | ..\common\sound.obj ..\common\cusong.obj \ 17 | scrn.obj getstr.obj tutil1.obj edit.obj ins.obj del.obj \ 18 | menu.obj \ 19 | kbd.obj status.obj move.obj movement.obj wrap.obj \ 20 | onscrn.obj file.obj search.obj block.obj cw.obj cwsetup.obj \ 21 | mainsyls.obj thaieng.obj worewaan.obj FINDCHAR.obj HOREHEEB.obj \ 22 | HUNAKAD.obj JULCUT.obj KARAN.obj LEADCON.obj \ 23 | MAIMALAI.obj MAIMUAN.obj NOPCUT.obj NSTRCMP.obj ROREREO.obj \ 24 | RORERU.obj SARAA.obj SARAAH.obj SARAAIR.obj SARAIE.obj \ 25 | SARAO.obj SARAR.obj SARAU.obj SARAUE.obj SARAUEE.obj \ 26 | SARAUM.obj GLOBAL.obj 27 | tcc -c ..\common\stampdate.c 28 | tlink @scuw.tlr 29 | 30 | scrn.obj: scrn.c var.h 31 | tcc -c $(TCC_OPTION) scrn.c 32 | 33 | getstr.obj: getstr.c var.h 34 | tcc -c $(TCC_OPTION) getstr.c 35 | 36 | tutil1.obj: tutil1.c var.h 37 | tcc -c $(TCC_OPTION) tutil1.c 38 | 39 | edit.obj: edit.c var.h 40 | tcc -c -v $(TCC_OPTION) edit.c 41 | 42 | ins.obj: ins.c var.h 43 | tcc -c -v $(TCC_OPTION) ins.c 44 | 45 | del.obj: del.c var.h 46 | tcc -c $(TCC_OPTION) del.c 47 | 48 | menu.obj: menu.c var.h ..\common\cwgrphc.h 49 | tcc -c $(TCC_OPTION) menu.c 50 | 51 | kbd.obj: kbd.c var.h 52 | tcc -c $(TCC_OPTION) kbd.c 53 | 54 | status.obj: status.c var.h 55 | tcc -c $(TCC_OPTION) status.c 56 | 57 | move.obj: move.c var.h 58 | tcc -c $(TCC_OPTION) move.c 59 | 60 | movement.obj: movement.c var.h 61 | tcc -c $(TCC_OPTION) movement.c 62 | 63 | wrap.obj: wrap.c var.h 64 | tcc -c $(TCC_OPTION) wrap.c 65 | 66 | onscrn.obj: onscrn.c var.h 67 | tcc -c $(TCC_OPTION) onscrn.c 68 | 69 | file.obj: file.c var.h 70 | tcc -c $(TCC_OPTION) file.c 71 | 72 | search.obj: search.c var.h 73 | tcc -c $(TCC_OPTION) search.c 74 | 75 | block.obj: block.c var.h 76 | tcc -c -v $(TCC_OPTION) block.c 77 | 78 | cw.obj: cw.c var.h ..\common\cwgrphc.h 79 | tcc -c $(TCC_OPTION) cw.c 80 | 81 | cwsetup.obj: cwsetup.c var.h 82 | tcc -c $(TCC_OPTION) cwsetup.c 83 | 84 | # 85 | # TUD KUM 86 | # 87 | 88 | MAINSYLS.OBJ: mainsyls.c 89 | tcc -c $(TCC_OPTION) mainsyls.c 90 | THAIENG.OBJ: thaieng.c 91 | tcc -c THAIENG.c 92 | WOREWAAN.OBJ: worewaan.c 93 | tcc -c worewaan.c 94 | FINDCHAR.OBJ: findchar.c 95 | tcc -c findchar.c 96 | HOREHEEB.OBJ: horeheeb.c 97 | tcc -c horeheeb.c 98 | HUNAKAD.OBJ: hunakad.c 99 | tcc -c hunakad.c 100 | JULCUT.OBJ: julcut.c 101 | tcc -c julcut.c 102 | KARAN.OBJ: karan.c 103 | tcc -c karan.c 104 | LEADCON.OBJ: leadcon.c 105 | tcc -c leadcon.c 106 | MAIMALAI.OBJ: maimalai.c 107 | tcc -c maimalai.c 108 | MAIMUAN.OBJ: maimuan.c 109 | tcc -c maimuan.c 110 | NOPCUT.OBJ: nopcut.c 111 | tcc -c nopcut.c 112 | NSTRCMP.OBJ: nstrcmp.c 113 | tcc -c nstrcmp.c 114 | ROREREO.OBJ: rorereo.c 115 | tcc -c rorereo.c 116 | RORERU.OBJ: roreru.c 117 | tcc -c roreru.c 118 | SARAA.OBJ: saraa.c 119 | tcc -c saraa.c 120 | SARAAH.OBJ: saraah.c 121 | tcc -c saraah.c 122 | SARAAIR.OBJ: saraair.c 123 | tcc -c saraair.c 124 | SARAIE.OBJ: saraie.c 125 | tcc -c saraie.c 126 | SARAO.OBJ: sarao.c 127 | tcc -c sarao.c 128 | SARAR.OBJ: sarar.c 129 | tcc -c sarar.c 130 | SARAU.OBJ: sarau.c 131 | tcc -c sarau.c 132 | SARAUE.OBJ: saraue.c 133 | tcc -c saraue.c 134 | SARAUEE.OBJ: sarauee.c 135 | tcc -c sarauee.c 136 | SARAUM.OBJ: saraum.c 137 | tcc -c saraum.c 138 | GLOBAL.OBJ: global.c 139 | tcc -c global.c 140 |  -------------------------------------------------------------------------------- /SRC/SCUF/POPUP.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "inc.h" 4 | #include "fontmsg.h" 5 | #include "getch.h" 6 | #include "popup.h" 7 | #include "key.h" 8 | #include "fed.h" 9 | 10 | extern int herc_align; 11 | extern int center_x,center_y; 12 | int menu_top,menu_left,menu_right,menu_bottom; 13 | char **menu_list; 14 | 15 | menu_width() 16 | { 17 | int i=0,width=0; 18 | while (menu_list[i]) { 19 | if (width=amount) { 144 | i=1; 145 | oldi=amount-1; 146 | } 147 | dispstrhgc(item[oldi],40-width/2,8-height/2+oldi,0); 148 | dispstrhgc(item[i],40-width/2,8-height/2+i,REVERSEATTR); 149 | } 150 | exit: 151 | return i-1; 152 | } 153 | 154 | -------------------------------------------------------------------------------- /SRC/SCUP/PCONFIG.C: -------------------------------------------------------------------------------- 1 | /* --------------------------------- */ 2 | /* Program PCONFIG.C */ 3 | /* Written DEC-88 */ 4 | /* Update 25-12-88 */ 5 | /* Update 16-5-89 */ 6 | /* Function : read & write prt config*/ 7 | /* Update Mon 08-07-1989 01:42:26 */ 8 | /* --------------------------------- */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "inc.h" 16 | #include "global.ext" 17 | 18 | FILE *cfp; 19 | 20 | int savepconfig(void) 21 | { 22 | char s1[MAXPATH]; /* modified by Suttipong Kanakakorn */ 23 | strcpy(s1,cuprintpath); 24 | if ((cfp = fopen(strcat(s1,"cuprint.cfg"),"w")) == NULL){fclose(cfp);return(-1);} 25 | if (fprintf ( cfp,"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d ", 26 | graphicprint ,prtcodestd ,cpi ,lineperpage ,leftmargin , 27 | rightmargin ,locpagetitle ,locheading ,locfooting ,printer , 28 | printer24pin ,maxcol ,maxdot ,maxbuffer ,linespace , 29 | nlqmode ,pagebreak ,pagebegin ,pageend ,pagenumberoffset, 30 | copytoprint ,stdcode ,smallpaper) 31 | == EOF) {fclose(cfp);return(-2);} 32 | 33 | if (fprintf(cfp,"%s\n%s\n%s\n%s\n",pagetitle,pageformat,heading,footing) 34 | == EOF) {fclose(cfp);return(-2);} 35 | 36 | else {fclose(cfp);return(0);} 37 | 38 | } 39 | 40 | int readpconfig(void) 41 | { 42 | int i0=0,i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0,i9=0; 43 | int j0=0,j1=0,j2=0,j3=0,j4=0,j5=0,j6=0,j7=0,j8=0,j9=0; 44 | int k0=0,k1=0,k2=0; 45 | char w1[200],w2[200],w3[200],w4[200]; 46 | char s1[55]; 47 | strcpy(s1,cuprintpath); 48 | if ((cfp = fopen(strcat(s1,"cuprint.cfg"),"r")) == NULL) {fclose(cfp);return(-1);} 49 | else 50 | if (fscanf ( cfp,"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d ", 51 | &i0,&i1,&i2,&i3,&i4,&i5,&i6,&i7,&i8,&i9, 52 | &j0,&j1,&j2,&j3,&j4,&j5,&j6,&j7,&j8,&j9, 53 | &k0,&k1,&k2) == EOF) {fclose(cfp);return(2);} 54 | else 55 | if (fgets(w1,200,cfp) == NULL) {fclose(cfp);return('3');} 56 | if (fgets(w2,200,cfp) == NULL) {fclose(cfp);return('4');} 57 | if (fgets(w3,200,cfp) == NULL) {fclose(cfp);return('5');} 58 | if (fgets(w4,200,cfp) == NULL) {fclose(cfp);return('6');} 59 | /* 60 | printf("linespace=%d\nlineperpage=%d\npage read in=%s\n",j4,i3,w1); 61 | printf("heading=%s\nfooting=%s\n",w3,w4); 62 | getch(); 63 | */ 64 | fclose(cfp); 65 | /* ******************* */ 66 | /* verify valid values */ 67 | /* ******************* */ 68 | graphicprint= (i0==0 || i0==1) ? i0 : graphicprint; 69 | prtcodestd= (i1==0 || i1==1) ? i1 : prtcodestd; 70 | cpi= (i2>0 && i2<21) ? i2 : 10; 71 | lineperpage = (i3>0 ) ? i3 : lineperpage; 72 | 73 | leftmargin = (i4<136&& i4>1 ) ? i4 : leftmargin; 74 | rightmargin = (i5>i4 && i5>1 ) ? i5 : rightmargin; 75 | 76 | locpagetitle = (i6<6 && i6>=0) ? i6 : locpagetitle; 77 | locheading = (i7<6 && i7>=0) ? i7 : locheading; 78 | locfooting = (i8<6 && i8>=0) ? i8 : locfooting; 79 | printer = (i9<7 && i9>=0) ? i9 : FX; 80 | printer24pin = (j0==0 || j0==1) ? j0 : printer24pin; 81 | maxcol = (j1>0 && j1<137) ? j1 : 80; 82 | maxdot = (j2>0) ? j2 : 1920; 83 | maxbuffer = (j3>0) ? j3 : 1920; 84 | linespace = (j4==4 || j4==15) ? j4 : 15; 85 | nlqmode = (j5==0 || j5==1) ? j5 : nlqmode; 86 | pagebreak = (j6>0) ? j6 : pagebreak; 87 | pagebegin = (j7>0) ? j7 : 1; 88 | pageend = (j8>=j7) ? j8 : 9999; 89 | pagenumberoffset =(j9>0) ? j9 : pagenumberoffset; 90 | copytoprint = (k0>0) ? k0 : copytoprint; 91 | stdcode = (k1==0 || k1==1) ? k1 : stdcode; 92 | smallpaper = (k2==0 || k2==1) ? k2 : YES; 93 | if (strlen(w1)>0 && strlen(w1)<200){ 94 | strcpy(pagetitle,w1); 95 | pagetitle[strlen(pagetitle)-1]='\0'; 96 | } 97 | if (strlen(w2)>0 && strlen(w2)<200){ 98 | strcpy(pageformat,w2); 99 | pageformat[strlen(pageformat)-1]='\0'; 100 | } 101 | if (strlen(w3)>0 && strlen(w3)<200){ 102 | strcpy(heading,w3); 103 | heading[strlen(heading)-1]='\0'; 104 | } 105 | if (strlen(w4)>0 && strlen(w4)<200){ 106 | strcpy(footing,w4); 107 | footing[strlen(footing)-1]='\0'; 108 | } 109 | setprinter(smallpaper,printer24pin); 110 | return(0); 111 | } 112 | -------------------------------------------------------------------------------- /SRC/COMMON/CWGRPHC.C: -------------------------------------------------------------------------------- 1 | /*-----------------------------------------------------------------------*/ 2 | /* Graphics module for CW 1.20 */ 3 | /* */ 4 | /* Kraisorn Liansee */ 5 | /* Date : 04/21/89 */ 6 | /* Updated : 04/21/89 */ 7 | /* Suttipong Kanakakorn */ 8 | /* Updated : Sun 07-30-1989 17:46:05 */ 9 | /* : Tue 08-15-1989 02:09:46 */ 10 | /* Use macro instead of function call */ 11 | /* : Tue 08-22-1989 02:01:28 */ 12 | /* Add egamono mode */ 13 | /*-----------------------------------------------------------------------*/ 14 | 15 | #include 16 | #include 17 | 18 | #include "grdetect.h" 19 | 20 | #define DEFINE_VAR 21 | #include "cwgrphc.h" 22 | 23 | /* 24 | void prchar(unsigned c, unsigned attr, unsigned x, unsigned y) 25 | { 26 | (*prchar_ptr)(c,attr,x,y); 27 | } 28 | 29 | void prblank(unsigned x, unsigned y) 30 | { 31 | (*prblank_ptr)(x,y); 32 | } 33 | 34 | void setcurpos(unsigned x, unsigned y, int thaimode) 35 | { 36 | (*setcurpos_ptr)(x,y,thaimode); 37 | } 38 | 39 | void plot(unsigned x, unsigned y) 40 | { 41 | (*plot_ptr)(x,y); 42 | } 43 | 44 | void settext() 45 | { 46 | (*settext_ptr)(); 47 | } 48 | 49 | void savepic() 50 | { 51 | (*savepic_ptr)(); 52 | } 53 | 54 | void retpic() 55 | { 56 | (*retpic_ptr)(); 57 | } 58 | 59 | void clsall() 60 | { 61 | (*clsall_ptr)(); 62 | } 63 | 64 | void clsgraph(unsigned x1,unsigned y1,unsigned x2,unsigned y2) 65 | { 66 | (*clsgraph_ptr)(x1,y1,x2,y2); 67 | } 68 | 69 | void clrline(unsigned x1,unsigned y1,unsigned x2) 70 | { 71 | (*clrline_ptr)(x1,y1,x2); 72 | } 73 | 74 | void prakeaw() 75 | { 76 | (*prakeaw_ptr)(); 77 | } 78 | 79 | void rdchardot (unsigned int x, unsigned int y) 80 | { 81 | (*rdchardot_ptr)(x,y); 82 | } 83 | 84 | void wrchardot (unsigned int x, unsigned int y) 85 | { 86 | (*wrchardot_ptr)(x,y); 87 | } 88 | */ 89 | 90 | void setgraph() 91 | { 92 | static int first = 1; 93 | 94 | if (!first) { 95 | (*setgraph_ptr)(); 96 | return; 97 | } 98 | 99 | first = 0; 100 | #ifdef EDA_VERSION 101 | scrmode = DETECT; 102 | #endif 103 | 104 | if ((screen_buffptr = malloc ((unsigned int)32768L))==NULL) { 105 | fputs ("Not enough memory\n",stderr); 106 | exit (1); 107 | } 108 | if (scrmode == DETECT) 109 | graph_detecthardware ((graphics_hardware *) &scrmode); 110 | 111 | #ifdef EDA_VERSION 112 | if (scrmode == EGAMONO) 113 | scrmode = HERCMONO; 114 | #endif 115 | 116 | if (scrmode == CGA) 117 | scrmode = ATT400; 118 | else if (scrmode == MCGA) 119 | scrmode = VGA; 120 | 121 | if ((scrmode == EGAMONO) || (scrmode == EGA64) || 122 | (scrmode == VGA) || (scrmode == EGA)) { 123 | prchar_ptr = eprchar; 124 | prblank_ptr = eprblank; 125 | setcurpos_ptr = esetcurpos; 126 | plot_ptr = eplot; 127 | setgraph_ptr = esetgraph; 128 | settext_ptr = esettext; 129 | savepic_ptr = esavepic; 130 | retpic_ptr = eretpic; 131 | clsall_ptr = eclsall; 132 | clsgraph_ptr = eclsgraph; 133 | clrline_ptr = eclrline; 134 | prakeaw_ptr = eprakeaw; 135 | rdchardot_ptr = erdchardot; 136 | wrchardot_ptr = ewrchardot; 137 | putwind_ptr = eputwind; 138 | getwind_ptr = egetwind; 139 | } else if (scrmode == HERCMONO) { 140 | prchar_ptr = hprchar; 141 | prblank_ptr = hprblank; 142 | setcurpos_ptr = hsetcurpos; 143 | plot_ptr = hplot; 144 | setgraph_ptr = hsetgraph; 145 | settext_ptr = hsettext; 146 | savepic_ptr = hsavepic; 147 | retpic_ptr = hretpic; 148 | clsall_ptr = hclsall; 149 | clsgraph_ptr = hclsgraph; 150 | clrline_ptr = hclrline; 151 | prakeaw_ptr = hprakeaw; 152 | rdchardot_ptr = hrdchardot; 153 | wrchardot_ptr = hwrchardot; 154 | putwind_ptr = hputwind; 155 | getwind_ptr = hgetwind; 156 | } else if (scrmode == ATT400) { 157 | prchar_ptr = aprchar; 158 | prblank_ptr = aprblank; 159 | setcurpos_ptr = asetcurpos; 160 | plot_ptr = aplot; 161 | setgraph_ptr = asetgraph; 162 | settext_ptr = asettext; 163 | savepic_ptr = asavepic; 164 | retpic_ptr = aretpic; 165 | clsall_ptr = aclsall; 166 | clsgraph_ptr = aclsgraph; 167 | clrline_ptr = aclrline; 168 | prakeaw_ptr = aprakeaw; 169 | rdchardot_ptr = ardchardot; 170 | wrchardot_ptr = awrchardot; 171 | putwind_ptr = aputwind; 172 | getwind_ptr = agetwind; 173 | } else { 174 | fputs ("CU-Writer V1.4 runs on Hercules/EGA/VGA/MCGA/AT&T only", 175 | stderr); 176 | exit (1); 177 | } 178 | (*setgraph_ptr)(); 179 | } 180 |  -------------------------------------------------------------------------------- /SRC/COMMON/CWGRPHC.H: -------------------------------------------------------------------------------- 1 | /*-----------------------------------------------------------------------*/ 2 | /* Graphics module header file for CW 1.20 */ 3 | /* */ 4 | /* Suttipong Kanakakorn */ 5 | /* Date : Sun 07-30-1989 16:01:13 */ 6 | /* Updated : */ 7 | /*-----------------------------------------------------------------------*/ 8 | 9 | #ifndef __CWGRPHC_H_ 10 | #define __CWGRPHC_H_ 11 | 12 | #ifdef DEFINE_VAR 13 | #define EXTERN 14 | #else 15 | #define EXTERN extern 16 | #endif 17 | 18 | #ifndef DEFINE_VAR 19 | EXTERN int scrmode; 20 | #else 21 | EXTERN int scrmode=DETECT; /* not initialize (text) mode */ 22 | #endif 23 | 24 | EXTERN unsigned int graph_seg; 25 | EXTERN unsigned char *screen_buffptr; 26 | 27 | /* ===================================================================== */ 28 | 29 | typedef void(Prchar_func)(unsigned c, unsigned attr, unsigned x, unsigned y); 30 | typedef Prchar_func *Prchar_ptr; 31 | 32 | EXTERN Prchar_ptr prchar_ptr; 33 | EXTERN Prchar_func hprchar, eprchar, aprchar; 34 | /* same as 35 | void(hprchar)(unsigned c, unsigned attr, unsigned x, unsigned y); 36 | void(hprchar)(unsigned c, unsigned attr, unsigned x, unsigned y); 37 | but more easier to manage and can get rid of compiler warning 38 | */ 39 | 40 | /* --------------------------------------------------------------------- */ 41 | 42 | typedef void (Prblank_func)(unsigned x, unsigned y); 43 | typedef Prblank_func *Prblank_ptr; 44 | 45 | EXTERN Prblank_func hprblank, eprblank, aprblank; 46 | EXTERN Prblank_ptr prblank_ptr; 47 | 48 | /* --------------------------------------------------------------------- */ 49 | 50 | typedef void (Setcurpos_func)(unsigned x, unsigned y, int thaimode); 51 | typedef Setcurpos_func *Setcurpos_ptr; 52 | 53 | EXTERN Setcurpos_func hsetcurpos, esetcurpos, asetcurpos; 54 | EXTERN Setcurpos_ptr setcurpos_ptr; 55 | 56 | /* --------------------------------------------------------------------- */ 57 | 58 | typedef void (Plot_func)(unsigned x, unsigned y); 59 | typedef Plot_func *Plot_ptr; 60 | 61 | EXTERN Plot_func hplot, eplot, aplot; 62 | EXTERN Plot_ptr plot_ptr; 63 | 64 | /* --------------------------------------------------------------------- */ 65 | 66 | typedef void (Voidvoid_func)(void); 67 | typedef Voidvoid_func *Voidvoid_ptr; 68 | 69 | EXTERN Voidvoid_func hsetgraph, esetgraph, asetgraph, 70 | hsettext, esettext, asettext; 71 | EXTERN Voidvoid_func hsavepic, esavepic, asavepic, 72 | hretpic, eretpic, aretpic; 73 | EXTERN Voidvoid_func hclsall, eclsall, aclsall, 74 | hprakeaw, eprakeaw, aprakeaw; 75 | 76 | EXTERN Voidvoid_ptr setgraph_ptr, settext_ptr, savepic_ptr, retpic_ptr; 77 | EXTERN Voidvoid_ptr clsall_ptr, prakeaw_ptr; 78 | 79 | /* --------------------------------------------------------------------- */ 80 | 81 | typedef void (Clsgraph_func)(unsigned x1, unsigned x2, 82 | unsigned y1, unsigned y2); 83 | typedef Clsgraph_func *Clsgraph_ptr; 84 | 85 | EXTERN Clsgraph_func hclsgraph, eclsgraph, aclsgraph; 86 | EXTERN Clsgraph_ptr clsgraph_ptr; 87 | 88 | /* --------------------------------------------------------------------- */ 89 | 90 | typedef void (Clrline_func)(unsigned x1, unsigned y1, unsigned x2); 91 | typedef Clrline_func *Clrline_ptr; 92 | 93 | EXTERN Clrline_func hclrline, eclrline, aclrline; 94 | EXTERN Clrline_ptr clrline_ptr; 95 | 96 | /* --------------------------------------------------------------------- */ 97 | 98 | typedef void (RWchardot_func)(unsigned int x, unsigned int y); 99 | typedef RWchardot_func *RWchardot_ptr; 100 | 101 | EXTERN RWchardot_func hrdchardot, erdchardot, ardchardot, 102 | hwrchardot, ewrchardot, awrchardot; 103 | EXTERN RWchardot_ptr rdchardot_ptr, wrchardot_ptr; 104 | 105 | /* --------------------------------------------------------------------- */ 106 | 107 | typedef void (PGwind_func)(unsigned x1, unsigned x2, 108 | unsigned linecount, unsigned bytecount, 109 | char *buffer); 110 | typedef PGwind_func *PGwind_ptr; 111 | 112 | EXTERN PGwind_func hputwind, eputwind, aputwind, hgetwind, egetwind, agetwind; 113 | EXTERN PGwind_ptr putwind_ptr, getwind_ptr; 114 | 115 | /* ===================================================================== */ 116 | 117 | #define prchar(c, attr, x, y) (*prchar_ptr)(c, attr, x, y) 118 | 119 | #define prblank(x, y) (*prblank_ptr)(x, y) 120 | 121 | #define setcurpos(x, y, thaimode) (*setcurpos_ptr)(x, y, thaimode) 122 | 123 | #define plot(x, y) (*plot_ptr)(x, y) 124 | 125 | #define settext() (*settext_ptr)() 126 | 127 | #define savepic() (*savepic_ptr)() 128 | 129 | #define retpic() (*retpic_ptr)() 130 | 131 | #define clsall() (*clsall_ptr)() 132 | 133 | #define clsgraph(x1, y1, x2, y2) (*clsgraph_ptr)(x1, y1, x2, y2); 134 | 135 | #define clrline(x1, y1, x2) (*clrline_ptr)(x1, y1, x2) 136 | 137 | #define prakeaw() (*prakeaw_ptr)() 138 | 139 | #define rdchardot (x, y) (*rdchardot_ptr)(x,y) 140 | 141 | #define wrchardot (x, y) (*wrchardot_ptr)(x,y) 142 | 143 | #endif /* __CWGRPHC_H_ */ 144 | -------------------------------------------------------------------------------- /SRC/SCUF/CONST.C: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* CONST.C 15 JAN 89 */ 3 | /****************************************************************************/ 4 | /**********************************/ 5 | /* key code constant 6/11/87 */ 6 | /**********************************/ 7 | 8 | #define ESCKEY 0x0011B 9 | #define RETKEY 0x01C0D 10 | #define BSKEY 0x00E08 11 | #define TABKEY 0x00F09 12 | #define CNTRLRET 0x01C0A 13 | #define CNTRLBS 0x00E7F 14 | #define SHFTTAB 0x00F00 15 | 16 | /**********************************/ 17 | /* control key constant */ 18 | /**********************************/ 19 | #define CNTRL_A 0x01E01 20 | #define CNTRL_B 0x03002 21 | #define CNTRL_C 0x02E03 22 | #define CNTRL_D 0x02004 23 | #define CNTRL_E 0x01205 24 | #define CNTRL_F 0x02106 25 | #define CNTRL_G 0x02207 26 | #define CNTRL_H 0x02308 27 | #define CNTRL_I 0x01709 28 | #define CNTRL_J 0x0240A 29 | #define CNTRL_K 0x0250B 30 | #define CNTRL_L 0x0260C 31 | #define CNTRL_M 0x0320D 32 | #define CNTRL_N 0x0310E 33 | #define CNTRL_O 0x0180F 34 | #define CNTRL_P 0x01910 35 | #define CNTRL_Q 0x01011 36 | #define CNTRL_R 0x01312 37 | #define CNTRL_S 0x01F13 38 | #define CNTRL_T 0x01414 39 | #define CNTRL_U 0x01615 40 | #define CNTRL_V 0x02F16 41 | #define CNTRL_W 0x01117 42 | #define CNTRL_X 0x02D18 43 | #define CNTRL_Y 0x01519 44 | #define CNTRL_Z 0x02C1A 45 | #define CNTRLESC 0x01A1B 46 | #define CNTRLFS 0x02B1C 47 | #define CNTRLGS 0x01B1D 48 | #define CNTRLRS 0x0071E 49 | #define CNTRLUS 0x00C1F 50 | 51 | /**********************************/ 52 | /* alternate code constant */ 53 | /**********************************/ 54 | #define ALT1 0x07800 55 | #define ALT2 0x07900 56 | #define ALT3 0x07A00 57 | #define ALT4 0x07B00 58 | #define ALT5 0x07C00 59 | #define ALT6 0x07D00 60 | #define ALT7 0x07E00 61 | #define ALT8 0x07F00 62 | #define ALT9 0x08000 63 | #define ALT0 0x08100 64 | #define ALTA 0x01E00 65 | #define ALTB 0x03000 66 | #define ALTC 0x02E00 67 | #define ALTD 0x02000 68 | #define ALTE 0x01200 69 | #define ALTF 0x02100 70 | #define ALTG 0x02200 71 | #define ALTH 0x02300 72 | #define ALTI 0x01700 73 | #define ALTJ 0x02400 74 | #define ALTK 0x02500 75 | #define ALTL 0x02600 76 | #define ALTM 0x03200 77 | #define ALTN 0x03100 78 | #define ALTO 0x01800 79 | #define ALTP 0x01900 80 | #define ALTQ 0x01000 81 | #define ALTR 0x01300 82 | #define ALTS 0x01F00 83 | #define ALTT 0x01400 84 | #define ALTU 0x01600 85 | #define ALTV 0x02F00 86 | #define ALTW 0x01100 87 | #define ALTX 0x02D00 88 | #define ALTY 0x01500 89 | #define ALTZ 0x02C00 90 | 91 | /**********************************/ 92 | /* function key constant */ 93 | /**********************************/ 94 | #define HOMEKEY 0x04700 95 | #define CHOMEKEY 0x07700 96 | #define UPKEY 0x04800 97 | #define PGUPKEY 0x04900 98 | #define CPGUPKEY 0x08400 99 | #define LEKEY 0x04B00 100 | #define CLEKEY 0x07300 101 | #define RIKEY 0x04D00 102 | #define CRIKEY 0x07400 103 | #define ENDKEY 0x04F00 104 | #define CENDKEY 0x07500 105 | #define DNKEY 0x05000 106 | #define PGDNKEY 0x05100 107 | #define CPGDNKEY 0x07600 108 | #define INSKEY 0x05200 109 | #define DELKEY 0x05300 110 | 111 | #define F1KEY 0x03B00 112 | #define F2KEY 0x03C00 113 | #define F3KEY 0x03D00 114 | #define F4KEY 0x03E00 115 | #define F5KEY 0x03F00 116 | #define F6KEY 0x04000 117 | #define F7KEY 0x04100 118 | #define F8KEY 0x04200 119 | #define F9KEY 0x04300 120 | #define F10KEY 0x04400 121 | #define UF1KEY 0x05400 122 | #define UF2KEY 0x05500 123 | #define UF3KEY 0x05600 124 | #define UF4KEY 0x05700 125 | #define UF5KEY 0x05800 126 | #define UF6KEY 0x05900 127 | #define UF7KEY 0x05A00 128 | #define UF8KEY 0x05B00 129 | #define UF9KEY 0x05C00 130 | #define UF10KEY 0x05D00 131 | 132 | #define CF1KEY 0x05E00 133 | #define CF2KEY 0x05F00 134 | #define CF3KEY 0x06000 135 | #define CF4KEY 0x06100 136 | #define CF5KEY 0x06200 137 | #define CF6KEY 0x06300 138 | #define CF7KEY 0x06400 139 | #define CF8KEY 0x06500 140 | #define CF9KEY 0x06600 141 | #define CF10KEY 0x06700 142 | #define AF1KEY 0x06800 143 | #define AF2KEY 0x06900 144 | #define AF3KEY 0x06A00 145 | #define AF4KEY 0x06B00 146 | #define AF5KEY 0x06C00 147 | #define AF6KEY 0x06D00 148 | #define AF7KEY 0x06E00 149 | #define AF8KEY 0x06F00 150 | #define AF9KEY 0x07000 151 | #define AF10KEY 0x07100 -------------------------------------------------------------------------------- /SRC/SCUP/PRTBUF24.C: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------ 2 | Module : PRTBUF24.C 3 | Description : print data in cp_lqbuf. 4 | Written by : Mr. Prasart Topitumatukhun ID. 2716943 5 | Date written : 10 May 1989 6 | ------------------------------------------------------------------------ */ 7 | #include 8 | #include 9 | #include "inc.h" 10 | #include "24pins.h" 11 | #include "global.ext" 12 | 13 | void ClearTempBuffer(int memclear) 14 | { 15 | memclear = (memclear>maxdot*2) ? maxdot*2:memclear; 16 | memset(bupper1,0,memclear); 17 | memset(bupper2,0,memclear); 18 | memset(bupper3,0,memclear); 19 | memset(bmiddle1,0,memclear); 20 | memset(bmiddle2,0,memclear); 21 | memset(bmiddle3,0,memclear); 22 | memset(bbelow1,0,memclear); 23 | memset(bbelow2,0,memclear); 24 | memset(bbelow3,0,memclear); 25 | if(extbarprinting) { 26 | memset(extbar1,0,memclear); 27 | memset(extbar2,0,memclear); 28 | memset(extbar3,0,memclear); 29 | } 30 | } 31 | 32 | /* ------------------------------------------------------------------------ 33 | Function : TransformBuffer() 34 | Description : Use to transfrom data structure cp_lqbuf to nine 35 | one dimension array. 36 | Input parameter: cindex = number of character to transform. 37 | Return value : none. 38 | ------------------------------------------------------------------------ */ 39 | /* ---------------------------------------------- 40 | void TransformBuffer(int cindex) 41 | { 42 | int i,j,k,memclear; 43 | ClearTempBuffer(cindex*18); 44 | for (i=0,k=0;ifont[j][0]; 47 | bupper2[k]=(cp_lqbuf.upper+i)->font[j][1]; 48 | bupper3[k]=(cp_lqbuf.upper+i)->font[j][2]; 49 | bmiddle1[k]=(cp_lqbuf.middle+i)->font[j][0]; 50 | bmiddle2[k]=(cp_lqbuf.middle+i)->font[j][1]; 51 | bmiddle3[k]=(cp_lqbuf.middle+i)->font[j][2]; 52 | bbelow1[k]=(cp_lqbuf.lower+i)->font[j][0]; 53 | bbelow2[k]=(cp_lqbuf.lower+i)->font[j][1]; 54 | bbelow3[k]=(cp_lqbuf.lower+i)->font[j][2]; 55 | } 56 | } 57 | ----------------------------- */ 58 | void TransformBuffer(int cindex) 59 | { 60 | register int i,j,k; 61 | int memclear; 62 | FONT *p10,*p20,*p30,*p40; 63 | char *p11,*p21,*p31,*p41; 64 | for (i=0,k=0;ifont[j][0]); 72 | p21=&(p20->font[j][0]); 73 | p31=&(p30->font[j][0]); 74 | bupper1[k]=*(p11); 75 | bupper2[k]=*(p11+1); 76 | bupper3[k]=*(p11+2); 77 | bmiddle1[k]=*(p21); 78 | bmiddle2[k]=*(p21+1); 79 | bmiddle3[k]=*(p21+2); 80 | bbelow1[k]=*(p31); 81 | bbelow2[k]=*(p31+1); 82 | bbelow3[k]=*(p31+2); 83 | if(extbarprinting) { 84 | p41=&(p40->font[j][0]); 85 | extbar1[k]=*(p41); 86 | extbar2[k]=*(p41+1); 87 | extbar3[k]=*(p41+2); 88 | } 89 | } 90 | } 91 | } 92 | 93 | int Ltrim24(char buf1[], char buf2[], char buf3[], int left, int right) 94 | { 95 | register int i ; 96 | i = left ; 97 | while ( (buf1[i] == 0) && (buf2[i]==0) && (buf3[i]==0) ) { 98 | i++ ; 99 | if (i > right) 100 | return(right); 101 | } 102 | return((int)(i / 18)); 103 | } 104 | 105 | 106 | int Rtrim24(char buf1[], char buf2[], char buf3[], int left, int right) 107 | { 108 | register int i ; 109 | i = right-1; 110 | while ( (buf1[i] == 0) && (buf2[i]==0) && (buf3[i]==0) ) { 111 | i-- ; 112 | if(i < left) 113 | return(left) ; 114 | } 115 | return(i+1); 116 | } 117 | 118 | void PrintBuffer24pin(char buf1[], char buf2[], char buf3[], int maxscan) 119 | { 120 | int left,right,length; 121 | register int i,j; 122 | left = Ltrim24(buf1,buf2,buf3,0,maxscan); 123 | if (left != maxscan) { 124 | right = Rtrim24(buf1,buf2,buf3,0,maxscan); 125 | for (i=0;i0) { 129 | PrinterSetGraphicMode24pinTripleDensity(length); 130 | for (i=0,j=left*18;i=10) ? ((long)(mindex)*18*1000)/(cpi*100):maxdot; 145 | maxprint = (maxprint>maxdot) ? maxdot:maxprint; 146 | ClearTempBuffer(mindex*18); 147 | TransformBuffer(mindex); 148 | 149 | charwidth(bupper1); 150 | charwidth(bupper2); 151 | charwidth(bupper3); 152 | PrintBuffer24pin(bupper1,bupper2,bupper3,(int)(maxprint)); 153 | 154 | PrinterLineFeed180inch(23); 155 | charwidth(bmiddle1); 156 | charwidth(bmiddle2); 157 | charwidth(bmiddle3); 158 | PrintBuffer24pin(bmiddle1,bmiddle2,bmiddle3,(int)(maxprint)); 159 | 160 | PrinterLineFeed180inch(23); 161 | charwidth(bbelow1); 162 | charwidth(bbelow2); 163 | charwidth(bbelow3); 164 | PrintBuffer24pin(bbelow1,bbelow2,bbelow3,(int)(maxprint)); 165 | 166 | if(linespace>23) { 167 | spleft=linespace; 168 | charwidth(extbar1); 169 | charwidth(extbar2); 170 | charwidth(extbar3); 171 | while(spleft>23) { 172 | PrinterLineFeed180inch(23); 173 | PrintBuffer24pin(extbar1,extbar2,extbar3,(int)(maxprint)); 174 | spleft-=23; 175 | } 176 | PrinterLineFeed180inch(spleft); 177 | } else 178 | PrinterLineFeed180inch(linespace); 179 | } 180 |  -------------------------------------------------------------------------------- /SRC/SCUP/24PINS.H: -------------------------------------------------------------------------------- 1 | /* --------------------------------------------------------------------- */ 2 | /* Module : 24PINS.H */ 3 | /* Description : define characteristic used in 24pins.C */ 4 | /* Written by : Mr. Thotsapol Aphikulvanich ID.2818966 */ 5 | /* Date written : 23 April 1989 */ 6 | /* Last modified : 3 June 1989 */ 7 | /* Modified By CUCC */ 8 | /* : 22 June 1990 Extend Bar Table */ 9 | /* --------------------------------------------------------------------- */ 10 | 11 | /* ----- define error and success value ------- */ 12 | #define CP_ERROR -1 13 | #define CP_SUCCESS 0 14 | #define CP_WRAPCODE 0xA0 15 | #define CP_BLANK 0x20 16 | #define CP_ENGLISH 0x80 17 | 18 | /* ----- define sara and wannayok ---------- */ 19 | #define CP_SARAAR 0xD2 20 | #define CP_SARAUM 0xD3 21 | #define CP_HUNARKAD 0xD1 22 | #define CP_SARAI 0xD4 23 | #define CP_SARAE 0xD5 24 | #define CP_SARAUD 0xD6 25 | #define CP_SARAEE 0xD7 26 | 27 | #define CP_MIAKE 0xE8 28 | #define CP_MITO 0xE9 29 | #define CP_MITEE 0xEA 30 | #define CP_MIJUDTAWA 0xEB 31 | #define CP_KARUN 0xEC 32 | 33 | /* ---- define printing mode of output ------- */ 34 | #define CP_TEXT 0 35 | #define CP_DOWNLOAD 1 36 | #define CP_GRAPHICS 2 37 | 38 | /* ---- define quality of output printing ---- */ 39 | #define CP_DRAFT 0 40 | #define CP_LQ 1 41 | 42 | /* ---- define print size ----- */ 43 | #define CP_10CPI 0 44 | #define CP_12CPI 1 45 | #define CP_15CPI 3 46 | 47 | /* ---- define head type ------ */ 48 | #define CP_24PINS 0 49 | #define CP_9PINS 1 50 | #define CP_HPLASER 2 51 | #define CP_OLYMPIA 3 52 | 53 | /* ---- define size of 24 pins printer font ---- */ 54 | #define CP_LQ_FONTSIZE 54 55 | #define CP_LQSCR_FONTSIZE 36 56 | #define CP_LQ_TABSIZE 12096 /* SPACE -> 0xFF */ 57 | #define CP_LQSCR_TABSIZE 8064 /* SPACE -> 0xFF */ 58 | #define CP_LQCOMB_TABSIZE 1620 /* Combine code table */ 59 | #define CP_LQSCRCOMB_TABSIZE 1080 60 | 61 | /* ---- define printing buffer size ----------- */ 62 | #define CP_MAX_TEXTBUF 272 63 | #define CP_LQ_MAXPRBUF 272 * CP_LQ_FONTSIZE 64 | 65 | /* ---- define printing control code ---------- */ 66 | #define CP_NORMALATTR 0x00 67 | #define CP_ITALICATTR 0x01 68 | #define CP_SUBATTR 0x02 69 | #define CP_SUPERATTR 0x04 70 | 71 | #define CP_UNDERLINEATTR 0x08 72 | #define CP_DOUBLELINEATTR 0x10 73 | 74 | #define CP_ENLARGEATTR 0x20 75 | #define CP_BOLDATTR 0x40 76 | 77 | #define CP_ITALIC 23 /* ^W */ 78 | #define CP_SUBSCRIPT 22 /* ^V */ 79 | #define CP_SUPERSCRIPT 20 /* ^T */ 80 | #define CP_ENLARGE 05 /* ^E */ 81 | #define CP_BOLD 02 /* ^B */ 82 | #define CP_UNDERLINE 19 /* ^S */ 83 | #define CP_DOUBLELINE 18 /* ^R */ 84 | 85 | #define CP_UNDERLINE_MSK 0x18 86 | #define CP_DOUBLELINE_MSK 0x33 87 | 88 | #define MSK_CHARTYPE(ch) ( ch & 0x07 ) 89 | #define MSK_LINE(ch) ( ch & 0x18 ) 90 | #define MSK_CHARATTR(ch) ( ch & 0xE0 ) 91 | 92 | /* ---- used as buffer before printing to print buffer ---- */ 93 | struct cp_textbuf { 94 | unsigned char *uppest; /* buffer for wannayok */ 95 | unsigned char *upper; /* buffer for upper line */ 96 | unsigned char *middle; /* buffer for middle line */ 97 | unsigned char *lower; /* buffer for lower line */ 98 | }; 99 | 100 | /* ---- graphics printing buffer ------ */ 101 | #define CP_LQCOL 18 102 | #define CP_LQROW 3 103 | #define CP_LQSCRROW 2 104 | 105 | typedef struct { 106 | unsigned char font[CP_LQCOL][CP_LQROW]; 107 | } FONT; 108 | typedef struct { 109 | unsigned char font[CP_LQCOL][CP_LQSCRROW]; 110 | } FONTSCR; 111 | struct cp_grlqbuf { 112 | FONT *upper; 113 | FONT *middle; 114 | FONT *lower; 115 | FONT *extbar; 116 | }; 117 | /* ---- define buffer used in 24pins.c module ----- */ 118 | extern struct cp_textbuf cp_buf; 119 | extern struct cp_grlqbuf cp_lqbuf; 120 | 121 | /* ----- define character font table -------- */ 122 | extern FONT *cp_lqnorm; 123 | extern FONT *cp_lqitalic; 124 | extern FONT *cp_lqnorm_comb; 125 | extern FONT *cp_lqitalic_comb; 126 | extern FONTSCR *cp_lqscr; 127 | extern FONTSCR *cp_lqscr_italic; 128 | extern FONTSCR *cp_lqscr_comb; 129 | extern FONTSCR *cp_lqscr_italic_comb; 130 | 131 | /* ------ define control byte for character attribute ----- */ 132 | extern unsigned char cp_control; 133 | 134 | /* ----- define prototype of function in 24pins.c module ----- */ 135 | void execerror ( char *s, char *t); 136 | void cp_clearbuf (void); 137 | void cp_split4level (unsigned char *linemsg); 138 | void cp_init_textbuf ( void); 139 | void cp_init_grpbuf ( void); 140 | 141 | /* ----- NORMAL and ITALIC CODE ----- */ 142 | void cp_combine_fontlq ( FONT *combcode, FONT *sara, FONT *wannayok); 143 | FONT *cp_create_lqcombine ( FONT *fntable); 144 | FONT *cp_lq_font ( FONT *fntable, unsigned char ch); 145 | FONT *cp_lq_combinecode ( FONT *fntable, FONT *combtable, 146 | unsigned char sara, unsigned char wannayok); 147 | 148 | /* --- SUBCRIPT and SUPERSCRIPT --- */ 149 | void cp_combine_fontlqscr(FONTSCR *combcode,FONTSCR *sara,FONTSCR *wannayok); 150 | FONTSCR *cp_create_lqscrcombine ( FONTSCR *fntable); 151 | FONTSCR *cp_lqscr_font ( FONTSCR *fntable, unsigned char ch); 152 | FONTSCR *cp_lqscr_combinecode ( FONTSCR *fntable, FONTSCR *combtable, 153 | unsigned char sara, unsigned char wannayok); 154 | 155 | /* -- print data to buffer and manage all attribute -- */ 156 | FONT *cp_lqscr_blank( FONT *buf); 157 | 158 | FONT *cp_sub_middle_lower ( FONT *buf, FONTSCR *middle, FONTSCR * lower); 159 | FONT *cp_sub_upper_middle( FONT *buf, FONTSCR *upper, FONTSCR *middle); 160 | 161 | FONT *cp_super_upper_middle ( FONT *buf , FONTSCR *upper, FONTSCR *middle); 162 | FONT *cp_super_middle_lower ( FONT * buf, FONTSCR *middle, FONTSCR *lower); 163 | 164 | FONT *cp_underline ( FONT *newchar, FONT *oldchar); 165 | FONT *cp_doubleline ( FONT *newchar, FONT *oldchar); 166 | 167 | int cp_enlarge( struct cp_grlqbuf buf, int index); 168 | 169 | void cp_bold ( struct cp_grlqbuf buf, int index); 170 | 171 | int cp_pr_lqbuf ( struct cp_grlqbuf lqbuf, struct cp_grlqbuf grpchar, 172 | int gindex); 173 | int cp_printlq(void); 174 | void cp_printing (int cpi, int nchar); 175 | 176 | /* --- set control flag --- */ 177 | int cp_set_reset ( unsigned char ch, unsigned char *cntptr); 178 |  -------------------------------------------------------------------------------- /SRC/SCUP/PRTG.C: -------------------------------------------------------------------------------- 1 | /* Updated: Suttipong Kanakakorn Tue 08-08-1989 23:50:08 */ 2 | /* Group constants in a file, add function prototype */ 3 | 4 | #include 5 | #include "inc.h" 6 | #include "global.ext" 7 | 8 | /* function prototype */ 9 | void print_picture(char *point); 10 | void PrintBuffer9pin(unsigned char c[]); 11 | void PrintThree9pin(void); 12 | int ltrim(unsigned char line[], int left, int right); 13 | int rtrim(unsigned char line[], int left, int right); 14 | 15 | /* constant area */ 16 | #define WIDTH 24 17 | #define ADJUST(x) (x>=0) ? x : 256+x 18 | #define ASCII_NO 256 19 | 20 | /* 21 | void print_picture(char *point) 22 | { 23 | extern int grp_ready; 24 | extern char *print_buffer_pointer; 25 | grp_ready=NO; 26 | print_buffer_pointer=point; 27 | read_picture_file(); 28 | } 29 | */ 30 | 31 | /* --------------------------------------------- 32 | function PrintBuffer9pin().print data in buffer. 33 | include left-right trim functions to fasten 34 | graphic print. In text mode the printer print 35 | nothing when it reaches blank (' '). 36 | -------------------------------------------- */ 37 | void PrintBuffer9pin(unsigned char c[]) 38 | { 39 | extern int maxdot ; 40 | register int i; 41 | int left,right,length; 42 | charwidth(c) ; /* alternate character width in cpi.obj */ 43 | left = ltrim(c,0,maxdot); 44 | right = rtrim(c,0,maxdot); 45 | for(i=0; i 24) { 93 | PrinterLineFeed216inch(23); 94 | PrintBuffer9pin(extbar1); /* More table line */ 95 | PrinterLineFeed216inch(1); 96 | PrintBuffer9pin(extbar2); 97 | spleft-=24; 98 | } 99 | PrinterLineFeed216inch(spleft); 100 | } else 101 | PrinterLineFeed216inch(linespace); 102 | } else 103 | PrinterLineFeed216inch(23); 104 | } 105 | } /* picprint == yes */ /* 106 | else { 107 | switch (dot_per_line) { 108 | case 1: 109 | if (i%2==0) { 110 | PrintBuffer9pin(print_pointer[i]); 111 | PrinterLineFeed216inch(1); 112 | } 113 | else { 114 | /* print_picture(print_pointer[i]); */ 115 | PrintBuffer9pin(print_pointer[i]); 116 | PrinterLineFeed216inch(23); 117 | } 118 | break; 119 | case 2: 120 | print_picture(print_pointer[i]); 121 | PrintBuffer9pin(print_pointer[i]); 122 | if ((i%2)==0) 123 | PrinterLineFeed216inch(1); 124 | else 125 | PrinterLineFeed216inch(23); 126 | break; 127 | case 3: 128 | print_picture(print_pointer[i]); 129 | PrintBuffer9pin(print_pointer[i]); 130 | switch (i%2) { 131 | case 0: 132 | PrinterLineFeed216inch(1); 133 | break; 134 | case 1: 135 | PrinterLineFeed216inch(1); 136 | temp_buffer=(char *)calloc(6600,sizeof(char)); 137 | print_picture(temp_buffer); 138 | PrintBuffer9pin(temp_buffer); 139 | PrinterLineFeed216inch(22); 140 | free(temp_buffer); 141 | break; 142 | } 143 | break; 144 | } 145 | } */ 146 | } 147 | } 148 | else { 149 | for (i=1;i<6;i+=2) { 150 | for (j=0;j= right-1) 170 | return(left); 171 | } 172 | return((int)(i / 24)); 173 | } 174 | 175 | int rtrim(unsigned char line[], int left, int right) 176 | { 177 | register int i ; 178 | i = right-1; 179 | while( line[i] == 0){ 180 | i-- ; 181 | if(i <= left) 182 | return(left) ; 183 | } 184 | return(i+1); 185 | } 186 |  -------------------------------------------------------------------------------- /SRC/COMMON/KBDCODE.H: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* KBDCODE.H 15 JAN 89 */ 3 | /* Updated: Suttipong Kanakakorn */ 4 | /* Sun 08-06-1989 13:24:38 */ 5 | /****************************************************************************/ 6 | /**********************************/ 7 | /* key code constant 6/11/87 */ 8 | /**********************************/ 9 | 10 | #define ESCKEY 0x0011B 11 | #define RETKEY 0x01C0D 12 | #define BSKEY 0x00E08 13 | #define TABKEY 0x00F09 14 | #define CNTRLRET 0x01C0A 15 | #define CNTRLBS 0x00E7F 16 | #define SHFTTAB 0x00F00 17 | 18 | /**********************************/ 19 | /* control key constant */ 20 | /**********************************/ 21 | #define CNTRL_A 0x01E01 22 | #define CNTRL_B 0x03002 23 | #define CNTRL_C 0x02E03 24 | #define CNTRL_D 0x02004 25 | #define CNTRL_E 0x01205 26 | #define CNTRL_F 0x02106 27 | #define CNTRL_G 0x02207 28 | #define CNTRL_H 0x02308 29 | #define CNTRL_I 0x01709 30 | #define CNTRL_J 0x0240A 31 | #define CNTRL_K 0x0250B 32 | #define CNTRL_L 0x0260C 33 | #define CNTRL_M 0x0320D 34 | #define CNTRL_N 0x0310E 35 | #define CNTRL_O 0x0180F 36 | #define CNTRL_P 0x01910 37 | #define CNTRL_Q 0x01011 38 | #define CNTRL_R 0x01312 39 | #define CNTRL_S 0x01F13 40 | #define CNTRL_T 0x01414 41 | #define CNTRL_U 0x01615 42 | #define CNTRL_V 0x02F16 43 | #define CNTRL_W 0x01117 44 | #define CNTRL_X 0x02D18 45 | #define CNTRL_Y 0x01519 46 | #define CNTRL_Z 0x02C1A 47 | #define CNTRLESC 0x01A1B 48 | #define CNTRLFS 0x02B1C 49 | #define CNTRLGS 0x01B1D 50 | #define CNTRLRS 0x0071E 51 | #define CNTRLUS 0x00C1F 52 | 53 | /**********************************/ 54 | /* alternate code constant */ 55 | /**********************************/ 56 | #define ALT1 0x07800 57 | #define ALT2 0x07900 58 | #define ALT3 0x07A00 59 | #define ALT4 0x07B00 60 | #define ALT5 0x07C00 61 | #define ALT6 0x07D00 62 | #define ALT7 0x07E00 63 | #define ALT8 0x07F00 64 | #define ALT9 0x08000 65 | #define ALT0 0x08100 66 | #define ALTA 0x01E00 67 | #define ALTB 0x03000 68 | #define ALTC 0x02E00 69 | #define ALTD 0x02000 70 | #define ALTE 0x01200 71 | #define ALTF 0x02100 72 | #define ALTG 0x02200 73 | #define ALTH 0x02300 74 | #define ALTI 0x01700 75 | #define ALTJ 0x02400 76 | #define ALTK 0x02500 77 | #define ALTL 0x02600 78 | #define ALTM 0x03200 79 | #define ALTN 0x03100 80 | #define ALTO 0x01800 81 | #define ALTP 0x01900 82 | #define ALTQ 0x01000 83 | #define ALTR 0x01300 84 | #define ALTS 0x01F00 85 | #define ALTT 0x01400 86 | #define ALTU 0x01600 87 | #define ALTV 0x02F00 88 | #define ALTW 0x01100 89 | #define ALTX 0x02D00 90 | #define ALTY 0x01500 91 | #define ALTZ 0x02C00 92 | 93 | /**********************************/ 94 | /* Direction key constant */ 95 | /**********************************/ 96 | #define HOMEKEY 0x04700 97 | #define CHOMEKEY 0x07700 98 | #define UPKEY 0x04800 99 | #define PGUPKEY 0x04900 100 | #define CPGUPKEY 0x08400 101 | #define LEKEY 0x04B00 102 | #define CLEKEY 0x07300 103 | #define RIKEY 0x04D00 104 | #define CRIKEY 0x07400 105 | #define ENDKEY 0x04F00 106 | #define CENDKEY 0x07500 107 | #define DNKEY 0x05000 108 | #define PGDNKEY 0x05100 109 | #define CPGDNKEY 0x07600 110 | #define INSKEY 0x05200 111 | #define DELKEY 0x05300 112 | 113 | /**********************************/ 114 | /* Numeric key constant */ 115 | /* By Suttipong Kanakakorn */ 116 | /* Sun 08-06-1989 13:26:33 */ 117 | /* NP = numeric keypad */ 118 | /**********************************/ 119 | #define SHIFT_GRAY_SLASH 0x352F 120 | #define SHIFT_GRAY_PLUS 0x4E2B 121 | #define SHIFT_GRAY_MINUS 0x4A2D 122 | #define GRAY_SLASH 0x352F 123 | #define GRAY_STAR 0x372A 124 | #define GRAY_MINUS 0x4A2D 125 | #define GRAY_PLUS 0x4E2B 126 | #define SHIFT_1_NP 0x4F31 127 | #define SHIFT_2_NP 0x5032 128 | #define SHIFT_3_NP 0x5133 129 | #define SHIFT_4_NP 0x4B34 130 | #define SHIFT_5_NP 0x4C35 131 | #define SHIFT_6_NP 0x4D36 132 | #define SHIFT_7_NP 0x4737 133 | #define SHIFT_8_NP 0x4838 134 | #define SHIFT_9_NP 0x4939 135 | #define SHIFT_0_NP 0x5230 136 | #define SHIFT_DOT_NP 0x532E 137 | 138 | 139 | /**********************************/ 140 | /* function key constant */ 141 | /**********************************/ 142 | #define F1KEY 0x03B00 143 | #define F2KEY 0x03C00 144 | #define F3KEY 0x03D00 145 | #define F4KEY 0x03E00 146 | #define F5KEY 0x03F00 147 | #define F6KEY 0x04000 148 | #define F7KEY 0x04100 149 | #define F8KEY 0x04200 150 | #define F9KEY 0x04300 151 | #define F10KEY 0x04400 152 | #define UF1KEY 0x05400 153 | #define UF2KEY 0x05500 154 | #define UF3KEY 0x05600 155 | #define UF4KEY 0x05700 156 | #define UF5KEY 0x05800 157 | #define UF6KEY 0x05900 158 | #define UF7KEY 0x05A00 159 | #define UF8KEY 0x05B00 160 | #define UF9KEY 0x05C00 161 | #define UF10KEY 0x05D00 162 | 163 | #define CF1KEY 0x05E00 164 | #define CF2KEY 0x05F00 165 | #define CF3KEY 0x06000 166 | #define CF4KEY 0x06100 167 | #define CF5KEY 0x06200 168 | #define CF6KEY 0x06300 169 | #define CF7KEY 0x06400 170 | #define CF8KEY 0x06500 171 | #define CF9KEY 0x06600 172 | #define CF10KEY 0x06700 173 | #define AF1KEY 0x06800 174 | #define AF2KEY 0x06900 175 | #define AF3KEY 0x06A00 176 | #define AF4KEY 0x06B00 177 | #define AF5KEY 0x06C00 178 | #define AF6KEY 0x06D00 179 | #define AF7KEY 0x06E00 180 | #define AF8KEY 0x06F00 181 | #define AF9KEY 0x07000 182 | #define AF10KEY 0x07100 183 | -------------------------------------------------------------------------------- /SRC/COMMON/GRDETECT.C: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------*/ 2 | /* Graphics hardware detector module for TURBO C 2.00 */ 3 | /* */ 4 | /* Kraisorn Liansee */ 5 | /* Date : 4/27/89 */ 6 | /* Updated : 4/27/89 */ 7 | /* Updated : Suttipong Kanakakorn Sun 08-20-1989 11:28:45 */ 8 | /*-------------------------------------------------------------------------*/ 9 | 10 | #include 11 | 12 | #include "grdetect.h" 13 | 14 | /*-----------------------------------------------------------------*/ 15 | /* Graph_detecthardware function */ 16 | /* */ 17 | /* check current video configuration */ 18 | /*-----------------------------------------------------------------*/ 19 | 20 | void graph_detecthardware (graphics_hardware *mode_ptr) 21 | { 22 | union REGS reg_pack; 23 | unsigned char far *mem_ptr, byte_keep; 24 | 25 | *mode_ptr = UNKNOWN_HW; 26 | 27 | reg_pack.h.ah = 0x0F; /* read current video state */ 28 | int86 (0x10, ®_pack, ®_pack); 29 | 30 | if (reg_pack.h.al == 0x07) { /* Monochrome mode */ 31 | /*----------------------------------------*/ 32 | /* May be CGA/EGA/VGA/MDA/Hercules */ 33 | /*----------------------------------------*/ 34 | 35 | if (is_egavga ()) 36 | { 37 | /*-----------------*/ 38 | /* EGA/VGA test */ 39 | /*-----------------*/ 40 | egavga_class (mode_ptr); /* Classify EGA/VGA */ 41 | return; 42 | } 43 | /*--------------------------*/ 44 | /* CGA/MDA/Hercules test */ 45 | /*--------------------------*/ 46 | 47 | if (check_vretrace() == 0) /* No Vertical retrace change */ 48 | { 49 | mem_ptr = (unsigned char far *) 0xB8000L; /* point to screen */ 50 | byte_keep = *mem_ptr; 51 | (*mem_ptr) ^= 0xFF; 52 | byte_keep ^= 0xFF; 53 | if (byte_keep != (*mem_ptr)) /* No memory in this area */ 54 | *mode_ptr = MDA; /* IBM Monochrome monitor */ 55 | else 56 | *mode_ptr = CGA; 57 | return; /* CGA adaptor */ 58 | } 59 | else 60 | { 61 | *mode_ptr = HERCMONO; 62 | return; 63 | } 64 | } else { /* Assuming ALL except Mono */ 65 | if (is_egavga()) { 66 | /*-----------------*/ 67 | /* EGA/VGA test */ 68 | /*-----------------*/ 69 | egavga_class (mode_ptr); /* Classify EGA/VGA */ 70 | return; 71 | } 72 | if (is_mcga ()) 73 | *mode_ptr = MCGA; 74 | else 75 | *mode_ptr = CGA; 76 | return; 77 | } 78 | } 79 | 80 | /*----------------------------------------------------------------*/ 81 | /* Is_egavga function */ 82 | /* */ 83 | /* check if the equipped adaptor is EGA or VGA */ 84 | /*----------------------------------------------------------------*/ 85 | 86 | int is_egavga () 87 | { 88 | union REGS reg_pack; 89 | 90 | reg_pack.x.ax = 0x1200; /* Read EGA/VGA configuration */ 91 | reg_pack.h.bl = 0x10; 92 | reg_pack.h.bh = 0xFF; /* video controller mode */ 93 | reg_pack.h.cl = 0x0F; /* video config mode */ 94 | int86 (0x10, ®_pack, ®_pack); 95 | 96 | if ((reg_pack.h.cl > 0x0C)|| /* invalid configuration */ 97 | (reg_pack.h.bh > 0x01) || /* invalid controller mode */ 98 | (reg_pack.h.bl > 0x03)) /* invalid memory size */ 99 | return (0); 100 | else 101 | return (1); 102 | } 103 | 104 | /*----------------------------------------------------------------*/ 105 | /* EgaVga_class function */ 106 | /* */ 107 | /* determines EGA/VGA adaptor configuration */ 108 | /*----------------------------------------------------------------*/ 109 | void egavga_class (graphics_hardware *mode_ptr) 110 | { 111 | union REGS reg_pack; 112 | unsigned char far *mem_ptr; 113 | 114 | reg_pack.x.ax = 0x1200; /* Read EGA/VGA configuration */ 115 | reg_pack.h.bl = 0x10; 116 | reg_pack.h.bh = 0xFF; /* video controller mode */ 117 | reg_pack.h.cl = 0x0F; /* video config mode */ 118 | int86 (0x10, ®_pack, ®_pack); 119 | 120 | *mode_ptr = EGA64; /* Assumes EGA with 64K first */ 121 | if (reg_pack.h.bh == 1) /* Config in Monochrome mode */ 122 | { 123 | *mode_ptr = EGAMONO; 124 | return; 125 | } 126 | if ((reg_pack.h.bl == 0) || (reg_pack.h.cl == 0) || (reg_pack.h.cl == 1) 127 | || (reg_pack.h.cl == 6) || (reg_pack.h.cl == 7)) 128 | return; /* EGA 64K */ 129 | *mode_ptr = EGA; 130 | mem_ptr = (unsigned char far *) 0xC0039L;/* Checking ROM */ 131 | if (is_mcga ()) 132 | *mode_ptr = VGA; 133 | else 134 | if ((*mem_ptr==0x5A) && (*(mem_ptr+1)==0x34) && (*(mem_ptr+2)==0x34) 135 | && (*(mem_ptr+3)==0x39)) 136 | *mode_ptr = VGA; 137 | return; 138 | } 139 | 140 | /*----------------------------------------------------------------*/ 141 | /* Is_mcga function */ 142 | /* */ 143 | /* check if the equipped adaptor is MCGA */ 144 | /*----------------------------------------------------------------*/ 145 | int is_mcga () 146 | { 147 | union REGS reg_pack; 148 | 149 | reg_pack.x.ax = 0x1A00; /* Read video information */ 150 | int86 (0x10, ®_pack, ®_pack); 151 | 152 | if (reg_pack.h.al != 0x1A) /* Call is invalid */ 153 | return (0); 154 | if ((reg_pack.h.bl == 7)||(reg_pack.h.bl == 8)|| 155 | (reg_pack.h.bl == 0x0B)||(reg_pack.h.bl == 0x0C)) 156 | return (1); 157 | else 158 | return (0); 159 | } 160 | 161 | 162 | /*-----------------------------------------------------------------*/ 163 | /* Check_vretrace function */ 164 | /* */ 165 | /* check if there is any transition on 0x3BF port */ 166 | /*-----------------------------------------------------------------*/ 167 | 168 | int check_vretrace () 169 | { 170 | register unsigned int change; 171 | register unsigned int old_value; 172 | unsigned int count; 173 | 174 | old_value = inportb (0x3BA) & 0x80; 175 | change = 0; 176 | for (count = 0; count <= 0x7FFF; count++) 177 | { 178 | if ((inportb (0x3BA) & 0x80) != old_value) 179 | if (++change > 10) break; /* Vertical Retrace changes */ 180 | } 181 | if (change <= 10) return (0); /* Not hercules */ 182 | 183 | for (count = 0; count <= 0x7FFF; count++) 184 | { 185 | if ((inportb (0x3BA) & 0x30) != 0x10) 186 | return (1); 187 | } 188 | 189 | return (2); 190 | } 191 | -------------------------------------------------------------------------------- /SRC/SCUW/MOVEMENT.C: -------------------------------------------------------------------------------- 1 | /* Update: Suttipong Kanakakorn 2 | Fri 08-04-1989 20:13:52 3 | Add top_of_page() and bottom_of_page() 4 | CUCC: 5 | Debug 255 Right Margin to work correctly 6 | */ 7 | 8 | #include "inc.h" 9 | /****************************************************************************/ 10 | /* Up line one line. */ 11 | /****************************************************************************/ 12 | void cursor_up(void) 13 | { 14 | if (curline->previous != sentinel) { /* top of file ? */ 15 | storeline(curline); 16 | lineno--; 17 | if (curpage == curline) { /* Is top of page ? */ 18 | curpage = curpage->previous; /* scroll page up */ 19 | curline = curline->previous; /* up one line */ 20 | pagecomplete = NO; /* refresh screen */ 21 | } else { 22 | curline = curline->previous; /* up one line */ 23 | } 24 | loadtoline(curline->text); 25 | } 26 | } 27 | /****************************************************************************/ 28 | /* Down line one line. */ 29 | /****************************************************************************/ 30 | void cursor_down(unsigned y) 31 | { 32 | if (curline->next != sentinel) { /* end of file ? */ 33 | storeline(curline); 34 | lineno++; /* increment lineno */ 35 | curline = curline->next; /* down one line */ 36 | if (y == (wind.width - 1)) { /* bottom of screen ? */ 37 | if (pagebreak && (((lineno - 1) % lineperpage) == 0)) { 38 | curpage = curpage->next; /* skip over page break */ 39 | } 40 | curpage = curpage->next; /* scroll page down */ 41 | pagecomplete = NO; /* refresh screen */ 42 | } else { 43 | if (pagebreak && /* page break is displayed at bottom of screen ? */ 44 | ((((lineno - 1) % lineperpage) == 0) && 45 | (y == (wind.width - 2)))) { 46 | curpage = curpage->next; /* skip over page break */ 47 | pagecomplete = NO; /* refresh screen */ 48 | } 49 | } 50 | loadtoline(curline->text); 51 | } 52 | } 53 | /****************************************************************************/ 54 | /* Left cursor. */ 55 | /****************************************************************************/ 56 | void cursor_left(unsigned *x) 57 | { 58 | unsigned i = *x + firstcol; 59 | if (i != 0) { /* Home of line ? */ 60 | gocol(i-1,x); 61 | } else { 62 | if (curline->previous != sentinel) { 63 | cursor_up(); /* go to end of */ 64 | endline(x); /* previous line */ 65 | } 66 | } 67 | } 68 | /****************************************************************************/ 69 | /* Right cursor. */ 70 | /****************************************************************************/ 71 | void cursor_right(unsigned *x,unsigned y) 72 | { 73 | if ((*x + firstcol + 1) == strlen(workline.middle)) { 74 | if (curline->next != sentinel) { 75 | cursor_down(y); 76 | home(x); 77 | } 78 | } else { 79 | if ((*x + firstcol + 1) < MAXCOL) { /* 5 to TUDCUM in 255 RMAR */ 80 | if (*x >= (wind.length - 2)) 81 | shiftscrn(20,x); 82 | if ((workline.attr[*x + firstcol + 1] & ENLARGEATTR) == ENLARGEATTR) { 83 | (*x)++; 84 | } 85 | (*x)++; 86 | } else { 87 | linetoolong(); 88 | } 89 | } 90 | } 91 | /****************************************************************************/ 92 | /* Up page. */ 93 | /****************************************************************************/ 94 | void page_up(void) 95 | { 96 | int count; 97 | storeline(curline); 98 | if (curpage->previous != sentinel) { /* top of file ? */ 99 | count = wind.width - 1; 100 | while ((count > 0) && (curpage->previous != sentinel)) { 101 | curpage = curpage->previous; 102 | curline = curline->previous; 103 | lineno--; 104 | count--; 105 | } 106 | pagecomplete = NO; 107 | } else { 108 | curline = curpage; 109 | lineno = 1; 110 | } 111 | loadtoline(curline->text); 112 | } 113 | /****************************************************************************/ 114 | /* Down page. */ 115 | /****************************************************************************/ 116 | void page_down(void) 117 | { 118 | int count; 119 | if (curpage->next != sentinel) { /* bottom of file ? */ 120 | storeline(curline); 121 | count = wind.width - 1; 122 | while ((count != 0) && (curline->next != sentinel)) { 123 | curline = curline->next; 124 | curpage = curpage->next; 125 | count--; 126 | lineno++; 127 | } 128 | if (count != 0) /* end of file ? */ 129 | curpage = curline; 130 | pagecomplete = NO; 131 | loadtoline(curline->text); 132 | } 133 | } 134 | /****************************************************************************/ 135 | /* Scroll page up. */ 136 | /* WARNING : Curline is not updated in this routine,it must be updated */ 137 | /* by calling function (main) after call if current cursor */ 138 | /* position is at bottom of screen. */ 139 | /****************************************************************************/ 140 | void scroll_up(void) 141 | { 142 | if (curpage->previous != sentinel) { /* top of file ? */ 143 | storeline(curline); 144 | curpage = curpage->previous; 145 | pagecomplete = NO; 146 | loadtoline(curline->text); 147 | } 148 | } 149 | 150 | /****************************************************************************/ 151 | /* Scroll page down. */ 152 | /****************************************************************************/ 153 | void scroll_down(void) 154 | { 155 | if (curpage->next != sentinel) { /* end of file ? */ 156 | storeline(curline); 157 | if (curpage != curline) { 158 | curpage = curpage->next; 159 | } else { 160 | curpage = curpage->next; 161 | curline = curpage; 162 | lineno++; 163 | } 164 | pagecomplete = NO; 165 | loadtoline(curline->text); 166 | } 167 | } 168 | 169 | /**************************************************************************/ 170 | /* Goto top of page (CTRL-QE in wordstar) */ 171 | /**************************************************************************/ 172 | void top_of_page(void) 173 | { 174 | storeline(curline); 175 | while (curline != curpage) { 176 | curline = curline->previous; 177 | lineno--; 178 | } 179 | loadtoline(curline->text); 180 | } 181 | 182 | /**************************************************************************/ 183 | /* Goto bottom of page (CTRL-QX in wordstar) */ 184 | /**************************************************************************/ 185 | void bottom_of_page(void) 186 | { 187 | int count; 188 | 189 | top_of_page(); 190 | count = wind.width-1; 191 | storeline(curline); 192 | while ((curline != sentinel) && count--) { 193 | curline = curline->next; 194 | lineno++; 195 | } 196 | if(curline==sentinel) { 197 | curline = sentinel->previous; 198 | lineno--; 199 | } 200 | loadtoline(curline->text); 201 | } 202 |  -------------------------------------------------------------------------------- /SRC/SCUP/CPI.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "inc.h" 5 | 6 | /* ------------------------------------------------------------- 7 | Routine to set actual character width (character per inch). 8 | characters per inch (cpi) is stored in global int 'cpi'. 9 | the parameter is the buffer store dot data size[1920,3264]. 10 | ------------------------------------------------------------- 11 | ch/inch dot/char increasingdot process(after/before) 12 | 1 240 216 10/1 13 | 2 120 96 5/1 14 | 3 80 56 10/3 15 | 4 60 36 5/2 16 | 5 48 24 2/1 17 | 6 40 16 5/3 18 | 7 34 10 17/12 19 | 8 30 6 5/4 20 | 9 27 3 9/8 21 | --------------------------------------------------- 22 | 10 24 0 NONE 23 | --------------------------------------------------- 24 | 11 22 - 2 11/12 25 | 12 20 - 4 5/6 26 | 13 18 - 6 3/4 27 | 14 17 - 7 17/24 28 | 15 16 - 8 2/3 29 | 16 15 - 9 15/24 30 | 17 14 -10 7/12 31 | 18 13 -11 13/24 32 | 19 12 -12 1/2 33 | 20 12 -12 1/2 34 | ------------------------------------------------------------ */ 35 | /* 36 | void waittest(void) 37 | { 38 | while (ebioskey(1)==0); 39 | } 40 | */ 41 | 42 | void charwidth(char buf1[]) 43 | { 44 | extern int maxdot; /* already defined in prt.c and pmenu.c */ 45 | extern int maxbuffer; /* already defined in pmenu.c */ 46 | extern int cpi ; /* already defined in prt.c and pmenu.c */ 47 | 48 | char *buf2; 49 | char cf[21]; 50 | register int i,j,k,m; 51 | buf2 =(char *) calloc(maxdot+100,sizeof(char)); 52 | i=0; 53 | j=0; 54 | switch (cpi){ 55 | 56 | case 0 : break; 57 | 58 | case 1 : /* term '10/cpi' generate number */ 59 | case 2 : /* of times the same dot appears */ 60 | case 5 : while((i 2 | #include "24pins.h" 3 | 4 | /* -------------------------------------------------------------------- */ 5 | /* Function : cp_lqscr_blank */ 6 | /* Description : clear buffer */ 7 | /* Parameters : buf - font buffer */ 8 | /* Return value : pointer to the font buffer */ 9 | /* Remark : This function used buf as buffer */ 10 | /* -------------------------------------------------------------------- */ 11 | FONT *cp_lqscr_blank( FONT *buf) 12 | { 13 | memset ( buf, 0, CP_LQ_FONTSIZE); 14 | return ( buf); 15 | } 16 | /* -------------------------------------------------------------------- */ 17 | /* Function : cp_sub_middle_lower */ 18 | /* Description : write subscript character middle and */ 19 | /* lower to font character buffer */ 20 | /* Parameters : buf - font buffer */ 21 | /* middle - middle subscript buffer */ 22 | /* lower - lower subscript buffer */ 23 | /* Return value : pointer to the font buffer */ 24 | /* Remark : This function used buf as buffer */ 25 | /* -------------------------------------------------------------------- */ 26 | FONT *cp_sub_middle_lower ( FONT *buf, FONTSCR *middle, FONTSCR * lower) 27 | { 28 | int i; 29 | 30 | memset (buf , 0, CP_LQ_FONTSIZE); 31 | for ( i = 0; i < CP_LQCOL; i++) { 32 | buf -> font[i][0] = middle-> font[i][1]; 33 | buf -> font[i][1] = ( (lower -> font[i][0]) << 4) | 34 | ( (lower -> font[i][1]) >> 4); 35 | buf -> font[i][2] = ( (lower -> font[i][1]) << 4); 36 | }; 37 | return ( buf); 38 | } 39 | /* -------------------------------------------------------------------- */ 40 | /* Function : cp_sub_upper_middle */ 41 | /* Description : write subscript character upper and */ 42 | /* middle to font character buffer */ 43 | /* Parameters : buf - font buffer */ 44 | /* middle - middle subscript buffer */ 45 | /* upper - upper subscript buffer */ 46 | /* Return value : pointer to the font buffer */ 47 | /* Remark : This function used buf as buffer */ 48 | /* -------------------------------------------------------------------- */ 49 | FONT *cp_sub_upper_middle( FONT *buf, FONTSCR *upper, FONTSCR *middle) 50 | { 51 | int i; 52 | 53 | memset ( buf, 0, CP_LQ_FONTSIZE); 54 | for ( i = 0; i < CP_LQCOL; i++) { 55 | buf -> font[i][1] = ( (upper -> font[i][0]) << 4 ) | 56 | ( (upper -> font[i][1]) >> 4 ); 57 | buf -> font[i][2] = ( (upper -> font[i][1]) << 4 ) | 58 | middle-> font[i][0]; 59 | }; 60 | return ( buf); 61 | } 62 | 63 | /* -------------------------------------------------------------------- */ 64 | /* Function : cp_super_upper_middle */ 65 | /* Description : write superscript character upper and */ 66 | /* middle to font character buffer */ 67 | /* Parameters : buf - font buffer */ 68 | /* middle - middle subscript pointer */ 69 | /* upper - upper subscript pointer */ 70 | /* Return value : pointer to the font buffer */ 71 | /* Remark : This function used buf as buffer */ 72 | /* -------------------------------------------------------------------- */ 73 | FONT *cp_super_upper_middle ( FONT *buf , FONTSCR *upper, FONTSCR *middle) 74 | { 75 | int i; 76 | 77 | memset ( buf , 0, CP_LQ_FONTSIZE); 78 | for ( i = 0; i < CP_LQCOL; i++) { 79 | buf -> font[i][0] = ( (upper -> font[i][0]) << 4) | 80 | ( (upper -> font[i][1]) >> 4); 81 | buf -> font[i][1] = ( (upper -> font[i][1]) << 4); 82 | buf -> font[i][2] = ( (middle -> font[i][0]) << 4) | 83 | ( (middle -> font[i][1]) >> 4); 84 | }; 85 | return ( buf); 86 | } 87 | /* -------------------------------------------------------------------- */ 88 | /* Function : cp_super_middle_lower */ 89 | /* Description : write superscript character middle and */ 90 | /* lower to font character buffer */ 91 | /* Parameters : buf - font buffer */ 92 | /* lower - lower superscript pointer */ 93 | /* Return value : pointer to the font buffer */ 94 | /* Remark : This function used buf as buffer */ 95 | /* -------------------------------------------------------------------- */ 96 | FONT *cp_super_middle_lower ( FONT *buf , FONTSCR *middle, FONTSCR *lower) 97 | { 98 | int i; 99 | 100 | memset ( buf , 0, CP_LQ_FONTSIZE); 101 | for ( i = 0; i < CP_LQCOL; i++) { 102 | buf -> font[i][0] = ( (middle -> font[i][1]) << 4); 103 | buf -> font[i][1] = ( (lower -> font[i][0]) << 4) | 104 | ( (lower -> font[i][1]) >> 4); 105 | buf -> font[i][2] = ( (lower -> font[i][1]) << 4); 106 | }; 107 | return ( buf); 108 | } 109 | /* -------------------------------------------------------------------- */ 110 | /* Function : cp_underline */ 111 | /* Description : underline character in buffer */ 112 | /* Parameters : newchar - new character buffer */ 113 | /* oldchar - old character pointer */ 114 | /* Return value : pointer to newchar buffer */ 115 | /* Remark : This function used newchar as buffer */ 116 | /* -------------------------------------------------------------------- */ 117 | FONT *cp_underline ( FONT *newchar, FONT *oldchar) 118 | { 119 | int i; 120 | 121 | memcpy ( newchar, oldchar, CP_LQ_FONTSIZE); 122 | for (i = 0; i < CP_LQCOL; i++) 123 | newchar->font[i][0] |= CP_UNDERLINE_MSK; 124 | return ( newchar ); 125 | } 126 | /* -------------------------------------------------------------------- */ 127 | /* Function : cp_doubleline */ 128 | /* Description : doubleline character in buffer */ 129 | /* Parameters : newchar - new character buffer */ 130 | /* oldchar - old character pointer */ 131 | /* Return value : pointer to newchar buffer */ 132 | /* Remark : This function used newchar as buffer */ 133 | /* -------------------------------------------------------------------- */ 134 | FONT *cp_doubleline ( FONT *newchar, FONT *oldchar) 135 | { 136 | int i; 137 | 138 | memcpy ( newchar, oldchar, CP_LQ_FONTSIZE); 139 | for (i = 0; i < CP_LQCOL; i++) 140 | newchar->font[i][0] |= CP_DOUBLELINE_MSK; 141 | return ( newchar ); 142 | } 143 | /* -------------------------------------------------------------------- */ 144 | /* Function : cp_enlarge */ 145 | /* Description : enlarge character in graphic buffer */ 146 | /* Parameters : buf - graphic buffer */ 147 | /* index - index to text position in */ 148 | /* graphic buffer */ 149 | /* Return value : index to next position in graph buffer */ 150 | /* -------------------------------------------------------------------- */ 151 | int cp_enlarge( struct cp_grlqbuf buf, int index) 152 | { 153 | int i, j; 154 | FONT upper[2], middle[2], lower[2]; 155 | 156 | index--; /* Pointer to that character */ 157 | for ( i = 0; i < 17; i ++) 158 | for (j = 0; j < CP_LQROW; j++) { 159 | upper[0].font[2*i][j] = upper[0].font[2*i+1][j] 160 | = (buf.upper + index)->font[i][j]; 161 | middle[0].font[2*i][j] = middle[0].font[2*i+1][j] 162 | = (buf.middle + index)->font[i][j]; 163 | lower[0].font[2*i][j] = lower[0].font[2*i+1][j] 164 | = (buf.lower + index)->font[i][j]; 165 | }; 166 | 167 | for ( j = 0; j < CP_LQROW; j++) { 168 | upper[0].font[2*i][j] = upper[0].font[2*i+1][j] 169 | = (buf.upper + index)->font[i][j]; 170 | middle[0].font[2*i][j] = middle[0].font[2*i+1][j] 171 | = (buf.middle + index)->font[i][j]; 172 | lower[0].font[2*i][j] = lower[0].font[2*i+1][j] 173 | = (buf.lower + index)->font[i][j]; 174 | }; 175 | 176 | memcpy (buf.upper + index, upper, 2 * CP_LQ_FONTSIZE ); 177 | memcpy (buf.middle + index, middle, 2 * CP_LQ_FONTSIZE ); 178 | memcpy (buf.lower + index, lower, 2 * CP_LQ_FONTSIZE ); 179 | return (index + 2); 180 | } 181 | 182 | /* -------------------------------------------------------------------- */ 183 | /* Function : cp_bold */ 184 | /* Description : change any character to boldface */ 185 | /* Parameters : buf - graphic buffer */ 186 | /* index - index to text position in */ 187 | /* graphic buffer */ 188 | /* Return value : NONE */ 189 | /* -------------------------------------------------------------------- */ 190 | void cp_bold ( struct cp_grlqbuf buf, int index) 191 | { 192 | int i, j; 193 | FONT upper, middle, lower; 194 | 195 | index--; /* Pointer to that character */ 196 | for ( i = 0; i < 17; i ++) 197 | for (j = 0; j < CP_LQROW; j++) { 198 | upper.font[i][j] = (buf.upper + index)->font[i][j]; 199 | upper.font[i][j] |= (buf.upper + index)->font[i+1][j]; 200 | 201 | middle.font[i][j] = (buf.middle + index)->font[i][j]; 202 | middle.font[i][j] |= (buf.middle + index)->font[i+1][j]; 203 | 204 | lower.font[i][j] = (buf.lower + index)->font[i][j]; 205 | lower.font[i][j] |= (buf.lower + index)->font[i+1][j]; 206 | }; 207 | 208 | for ( j = 0; j < CP_LQROW; j++) { 209 | upper.font[i][j] = (buf.upper + index)->font[i][j]; 210 | middle.font[i][j] = (buf.middle + index)->font[i][j]; 211 | lower.font[i][j] = (buf.lower + index)->font[i][j]; 212 | }; 213 | 214 | memcpy (buf.upper + index, &upper, CP_LQ_FONTSIZE ); 215 | memcpy (buf.middle + index, &middle, CP_LQ_FONTSIZE ); 216 | memcpy (buf.lower + index, &lower, CP_LQ_FONTSIZE ); 217 | } 218 |  -------------------------------------------------------------------------------- /SRC/SCUW/WRAP.C: -------------------------------------------------------------------------------- 1 | /* Updated: Suttipong Kanakakorn 2 | Thu 08-03-1989 01:05:26 3 | */ 4 | 5 | #include "inc.h" 6 | 7 | /****************************************************************************/ 8 | /* Insert blank code (bit 8 = 1) to justify text to right margin. Text */ 9 | /* must be in workline,not linked list. */ 10 | /****************************************************************************/ 11 | void justify_right(void) 12 | { 13 | register int count,i,j,k,already = NO; 14 | for(i=strlen(workline.middle) - 1; 15 | ((workline.middle[i] == ' ') || (workline.middle[i] == WRAPBLANK)) && 16 | (i > 0); 17 | i--); 18 | if ((i < rightmar) && (i > 0)) { 19 | for(j=1; 20 | (workline.middle[j] == ' ') || (workline.middle[j] == WRAPBLANK); 21 | j++); 22 | k = j; 23 | count = rightmar - i; 24 | while (count > 0) { 25 | while ((workline.middle[k] != ' ') && 26 | (workline.middle[k] != WRAPBLANK) && 27 | (k < i)) { 28 | k++; 29 | } 30 | if (k < i) { 31 | insertblank(k,WRAPBLANK); 32 | count--; 33 | i++; 34 | already = YES; 35 | } 36 | while (((workline.middle[k] == ' ') || (workline.middle[k] == WRAPBLANK)) 37 | && (k < i)) { 38 | k++; 39 | } 40 | if (k >= i) { 41 | if (already == NO) return; 42 | k = j; 43 | } 44 | } 45 | } 46 | } 47 | 48 | /****************************************************************************/ 49 | /* Reform paragraph from line specified to end of paragraph. */ 50 | /****************************************************************************/ 51 | void reform(void) 52 | { 53 | struct line_node *templine,*firstline,*freeline; 54 | unsigned char *temp1,*temp2,*temp3,*cuthere; 55 | unsigned i,j; 56 | font_attr font = 0; 57 | char fontcode[9]; 58 | 59 | storeline(curline); 60 | firstline = curline; 61 | templine = firstline; /* start to concatenate all lines to one line only */ 62 | temp1 = (char *) malloc(1); 63 | *temp1 = '\0'; 64 | while (1) { 65 | temp2 = (char *) malloc(strlen(templine->text) + 1); 66 | i = 0; 67 | j = 0; 68 | while (templine->text[i] != '\0') { 69 | if (templine->text[i] != WRAPBLANK) { 70 | temp2[j] = templine->text[i]; 71 | j++; 72 | } 73 | i++; 74 | } 75 | temp2[j] = '\0'; 76 | temp3 = (char *) malloc(strlen(temp1) + strlen(temp2) + 1); 77 | strcpy(temp3,temp1); 78 | strcat(temp3,temp2); 79 | free(temp1); 80 | free(temp2); 81 | if (templine->wrap == NO) break; 82 | temp1 = temp3; 83 | templine = templine->next; 84 | } 85 | /* now paragraph is in the one line only pointed by temp3 */ 86 | /* so we will compress two or more blanks to one blank only */ 87 | compress_blank(temp3); 88 | 89 | templine->previous = firstline->previous; 90 | (templine->previous)->next = templine; 91 | free(templine->text); 92 | templine->text = temp3; 93 | if (curline == curpage) { 94 | curpage = templine; 95 | } 96 | curline = templine; 97 | while (firstline != templine) { 98 | freeline = firstline; 99 | firstline = firstline->next; 100 | free(freeline->text); 101 | if (freeline->graph != NULL) 102 | free(freeline->graph); 103 | free(freeline); 104 | } 105 | while (thaistrlen(curline->text) > (rightmar - leftmar + 1)) { 106 | i = rightmar - leftmar; /* + 1; */ 107 | temp1 = curline->text; 108 | while ((i != 0) && (*temp1 != '\0')) { 109 | for (temp1++;whatlevel(*temp1) != MIDDLE;temp1++); 110 | i--; 111 | } 112 | temp3 = temp1; 113 | for (i = 10;(i != 0) && (*temp3 != '\0');i--) 114 | temp3++; 115 | cuthere = FINDCUT(curline->text,temp3,temp1); 116 | cuthere++; 117 | font = 0; 118 | for (temp1 = curline->text;temp1 != cuthere;temp1++) { 119 | if (*temp1 < 32) togglefont(&font,*temp1); 120 | } 121 | findstrcode(fontcode,font); 122 | templine = (struct line_node *) malloc(sizeof(struct line_node)); 123 | templine->text = (char *) malloc(strlen(fontcode) + strlen(cuthere) + 1); 124 | templine->wrap = NO; 125 | templine->graph = NULL; 126 | strcpy(templine->text,fontcode); 127 | strcat(templine->text,cuthere); 128 | *cuthere = '\0'; 129 | temp3 = (char *) malloc(leftmar + strlen(curline->text) + strlen(fontcode)); 130 | i = 0; 131 | while (i != (leftmar - 1)) { 132 | temp3[i] = WRAPBLANK; 133 | i++; 134 | } 135 | temp3[i] = '\0'; 136 | strcat(temp3,curline->text); 137 | strcat(temp3,fontcode); 138 | free(curline->text); 139 | curline->text = temp3; 140 | templine->next = curline->next; 141 | (curline->next)->previous = templine; 142 | templine->previous = curline; 143 | curline->next = templine; 144 | curline->wrap = YES; 145 | loadtoline(curline->text); 146 | justify_right(); 147 | storeline(curline); 148 | curline = curline->next; 149 | } 150 | temp3 = (char *) malloc(strlen(curline->text) + leftmar); 151 | i = 0; 152 | while (i != (leftmar - 1)) { 153 | temp3[i] = WRAPBLANK; 154 | i++; 155 | } 156 | temp3[i] = '\0'; 157 | strcat(temp3,curline->text); 158 | free(curline->text); 159 | curline->text = temp3; 160 | if (curline->next != sentinel) 161 | curline = curline->next; 162 | lineno = findlineno(curline); 163 | loadtoline(curline->text); 164 | while (findrow() > (wind.width - 1)) { 165 | curpage = curpage->next; 166 | } 167 | changeflag = YES; 168 | pagecomplete = NO; 169 | blkbegin.lineno = 1; 170 | blkend.lineno = 1; 171 | blkbegin.column = 0; 172 | blkend.column = 0; 173 | } 174 | 175 | void manualwrap(unsigned *x,unsigned *y) 176 | { 177 | int i; 178 | insert_ret(x); 179 | curline->wrap = YES; 180 | *x = (leftmar - 1) + (*x - thaistrlen(curline->text)); 181 | justify_right(); 182 | *y = findrow(); 183 | cursor_down(*y); 184 | for (i=1;i != leftmar;i++) 185 | workline.middle[i] = WRAPBLANK; 186 | } 187 | 188 | void autowrap(unsigned *x,unsigned *y) 189 | { 190 | unsigned i,j,already = NO,diff; 191 | char *temp1,*temp3,*cuthere,fontcode[9]; 192 | font_attr font = 0; 193 | struct line_node *templine; 194 | 195 | storeline(curline); 196 | diff = strlen(workline.middle) - (*x + firstcol + 1); 197 | i = 0; 198 | j = 0; 199 | while (curline->text[i] != '\0') { 200 | if (curline->text[i] != WRAPBLANK) { 201 | curline->text[j] = curline->text[i]; 202 | j++; 203 | already = YES; 204 | } else { 205 | if (already == NO) { 206 | curline->text[j] = curline->text[i]; 207 | j++; 208 | } 209 | } 210 | i++; 211 | } 212 | curline->text[j] = '\0'; 213 | temp1 = curline->text; 214 | for (i = rightmar - 2;(i > 0) && (*temp1 != '\0');i--) { 215 | temp1++; 216 | while (whatlevel(*temp1) != MIDDLE) 217 | temp1++; 218 | } 219 | temp3 = temp1; 220 | for (i = 10;(i != 0) && (*temp3 != '\0');i--) 221 | temp3++; 222 | cuthere = FINDCUT(curline->text,temp3,temp1); 223 | cuthere++; 224 | for (temp1 = curline->text;temp1 != cuthere;temp1++) { 225 | if (*temp1 < 32) togglefont(&font,*temp1); 226 | } 227 | findstrcode(fontcode,font); 228 | templine = (struct line_node *) malloc(sizeof(struct line_node)); 229 | templine->text = (char *) malloc(leftmar + strlen(fontcode) + strlen(cuthere)); 230 | for (i=0;i != (leftmar - 1);i++) 231 | templine->text[i] = WRAPBLANK; 232 | templine->text[i] = '\0'; 233 | strcat(templine->text,fontcode); 234 | strcat(templine->text,cuthere); 235 | templine->graph = NULL; 236 | templine->wrap = (curline->next)->wrap; 237 | *cuthere = '\0'; 238 | temp3 = (char *) malloc(strlen(curline->text) + strlen(fontcode) + 1); 239 | strcpy(temp3,curline->text); 240 | strcat(temp3,fontcode); 241 | free(curline->text); 242 | curline->text = temp3; 243 | templine->next = curline->next; 244 | (curline->next)->previous = templine; 245 | templine->previous = curline; 246 | curline->next = templine; 247 | curline->wrap = YES; 248 | loadtoline(curline->text); 249 | justify_right(); 250 | *y = findrow(); 251 | cursor_down(*y); 252 | firstcol = 0; 253 | gocol(strlen(workline.middle) - 1 - diff,x); 254 | pagecomplete = NO; 255 | } 256 | 257 | /* Thu 08-03-1989 01:05:37 */ 258 | /* leave the leading blank alone, just compress the rest 259 | and trim the trailing blank 260 | */ 261 | void compress_blank(register unsigned char *s) 262 | { 263 | register unsigned char *r; 264 | 265 | for (; *s == ' '; s++) 266 | ; 267 | r = s; 268 | while (*s++ = *r) { 269 | if (*r == ' ') { 270 | for (; *r == ' '; r++) 271 | ; 272 | } else 273 | r++; 274 | } 275 | s -= 2; 276 | if (*s == ' ') 277 | *s = '\0'; 278 | } 279 |  --------------------------------------------------------------------------------