Port of MicroEMACS to OS/2 Jon Saxton November 89 This is a summary of the patches needed to upgrade the 3.9e version of MicroEMACS for OS/2 to be compatible with the 3.10 sources currently being distributed. ESTRUCT.H ========= 42> #define MSDOS 1 /* MS-DOS */ 62> #define MSC 1 /* MicroSoft C compile version 3 & 4 & 5.1 */ 96> #define IBMPC 1 /* IBM-PC CGA/MONO/EGA/VGA drvr */ In the file OS2DEF.H which is normally included as a matter of course into an OS/2 program Microsoft #defines COLOR. This causes a problem when com- piling MicroEMACS because ESTRUCT.H also #defines COLOR to be something quite different. The person who created the OS2.C and OS2NPM.C files distributed with MicroEMACS suggested that Microsoft's #define of COLOR be edited out of OS2DEF.H on the basis that no Microsoft stuff used COLOR. Whereas that may be true for OS/2 1.0 there is no guarantee that later versions of OS/2 will not use COLOR so editing a standard header file is potentially dangerous. Accordingly I have devised a simple scheme to resolve the #define conflict without requiring modification to any header file supplied by Micro- soft. What I do is to #define a synonym for COLOR using the English spelling, COLOUR. Later on, after OS2DEF.H has been included, I #undef COLOR and then #define COLOR to be the same as COLOUR. 134> /* 135> In the following #define the English spelling of COLOUR has been 136> used to avoid a conflict in os2def.h but it will eventually 137> resolve to a #define of the American spelled COLOR. In other 138> words, if you set COLOUR then it will eventually set COLOR. 139> */ 140> #define COLOUR 1 /* color commands and windows */ Now OS2.H (and subordinate header files such as OS2DEF.H) get dragged in at a point where we can resolve all the #define conflicts. 196> #if OS2 & MSC 197> #define INCL_BASE 198> #include 199> #undef COLOR 200> #undef PCOLOR 201> #undef HIBYTE 202> #undef NEAR 203> #undef PASCAL 204> #endif 218> #define COLOR COLOUR EPATH.H ======= Just need to provide something sensible. 2> MicroEMACS files on a system dependent basis. 3> 4> The first entry in the table is the name of the startup 5> file. The second is the name of the help file. Each 6> subsequent entry is a path which MicroEMACS will search 7> for its auxiliary files (such as the startup file, the 8> help file, command files and so on. 60> #if OS2 61> { 62> "emacs.rc", 63> "emacs.hlp", 64> "c:\\ue\\", 65> } 66> #endif BIND.C ====== A couple of unused and undefined parameters were causing the compiler to generate warning messages. 14> PASCAL NEAR help(/* f, n */) /* give me some help!!!! FILE.C ====== A line which said #if MSDOS | MSDOS was changed to:- 355> #if MSDOS | OS2 OS2.C ===== deleted line 17> #define INCL_BASE and line 18> #include "os2.h" because these are now handled within ESTRUCT.H Changed the declaration of "results" to avoid a pointer-to-nowhere condition. 315> RESULTCODES results; 316> char envBlk[2]; 317> 318> envBlk[0] = envBlk[1] = '\0'; All usages of "results" have to be changed to reflect the new declaration. 354> return (0 == DosExecPgm( failName, 1, EXEC_SYNC, 355> args, envBlk, &results, prog)); Included the directory search routines similar to those found in MSDOS.H 473> #if COMPLET 474> /* FILE Directory routines */ . . . . . . (not reproduced here) . . . . . . 567> #endif OS2NPM.C ======== Deleted the #include of os2.h as this is now done within ESTRUCT.H 27> /* #define INCL_BASE */ 28> /* #include */ Fixed up the keyboard handling 212> static int prefix = -1; /* -1 when not holding a prefix */ 213> 214> if (nextc != -1) 215> { 216> if (!prefix) 217> { 218> prefix = -1; 219> return nextc >> 8; 220> } 212> 229> if (keyInfo.chChar == 0 || keyInfo.chChar == 0xE0) 230> { 231> nextc=extcode(keyInfo.chScan); /* hold on to scan code */ 232> return prefix=0; Note: I believe I can do much better things with the AT extended keyboard!