/* error messages from EP */ #include /*#include */ #include /*#include */ #define er val['E'-'@']['R'-'@'] /*#define BSTKSIZE 60*/ #define PTCH(C) bios(5,C) #define PTESCCH(C) bios(5,ESC); bios(5,C) #include union ptr { unsigned u; unsigned *w; char *b; }; main(argc,argv) char **argv; { int i; printf("\n\n** Error #%d **\n", errcode); /* printf("[%s] [%s]", argv[1], argv[2]);*/ switch (errcode) { case 0: printf("There was no error"); break; case 8: printf("File nesting exceeded 7 levels with %s",fnbuf);break; case 110: printf("Imbed file %s not found", fnbuf); break; case 111: printf("Insufficent memory for font"); break; case 112: printf("Can't read some font"); break; case 113: printf("Couldn't find file EP.INI on default drive"); break; case 114: printf("Defective file EP.INI"); break; case 115: case 116: case 117: printf("Couldn't save EP.INn"); break; case 120: case 121: case 122: case 123: case 124: case 125: case 126: if (ftname[errcode-120][0] & 0x80) printf("Picture %s.BTP not found", ftname[errcode-120]); else printf("Font %s.FN2 not found", ftname[errcode-120]); break; case 130: case 131: case 132: case 133: case 134: case 135: case 136: if (ftname[errcode-130][0] & 0x80) printf("Picture %s.BTP not found", ftname[errcode-120]); else printf("Defective font %s.FN2",ftname[errcode-130]); break; case 146: printf("Can't understand expression"); break; case 148: printf("Unattached font number"); break; case 149: printf("Font number too large"); break; case 150: printf("String nesting exceeded %d", MAXSNEST); break; case 151: printf("String reference occurred in macro argument"); break; case 300: printf("Exit due to \\error command with n = %d\n%s", er, inbuf+inpoint); break; default: printf("The error is of an unknown type"); break; } if (errcode != 300) { printf(".\n\n"); printf("Current input line was\n%s", inbuf); for (i=0; i=' ' && *loc.b<0x80)? *loc.b: '.'); gets(s); cmmnd = toupper(s[0]); if (!cmmnd && lcmmnd == 'D') cmmnd = 'D'; if (!cmmnd) { loc.u++; if (wdrf) loc.u++; } else switch(cmmnd) { case '@': sscanf(s+1, "%x", &loc.u); break; case 'W': wdrf = TRUE; break; case 'B': wdrf = FALSE; break; case 0x27: case '/': loc.u = lookup(s+1, &wdrf); break; case '\\': case 'C': loc.u = &val[cctr(s[1])-'@'][cctr(s[2])-'@']; wdrf = TRUE; break; case 'T': loc.u = &valtp[cctr(s[1])-'@'][cctr(s[2])-'@']; wdrf = FALSE; break; case 'D': dump(loc.u, wdrf); loc.u += wdrf? 32 : 26; break; case '?': info(); break; case 'Y': sinfo(); break; case 'E': if (s[1]) execl(editname,s+1,0); else execl(editname,mtext,0); printf("\nCan't find %s.com\n",editname); break; case 'L': loadi(); printf("Loaded.\n"); break; case 'S': savei(); printf("Saved.\n"); break; case '=': if (wdrf) *loc.w = patval(s+1); else *loc.b = patval(s+1); break; case '$': strcpy(editname, s+1); break; default: printf(" ??\n"); info(); break; } lcmmnd = cmmnd; } } patval(ns) char *ns; { unsigned pnum; char ntype; ntype = toupper(ns[strlen(ns)]); if (!isdigit(ns[0])) return(ns[0]); switch (ntype) { case 'H': sscanf(ns,"%x", &pnum); break; case 'O': sscanf(ns,"%o", &pnum); break; default: sscanf(ns,"%d", &pnum); break; } return (pnum); } cctr(c) char c; { return ( (c == '$')? '@' : toupper(c)); } lookup(sym, wd) char *sym, *wd; { char *adr; adr = 0; if (!strcmp(sym, "outbuf")) {adr = outbuf; *wd = FALSE;} else if (!strcmp(sym, "inbuf")) {adr = inbuf; *wd = FALSE;} else if (!strcmp(sym, "attrbuf")) {adr = attrbuf; *wd = TRUE;} else if (!strcmp(sym, "widbuf")) {adr = widbuf; *wd = TRUE;} else if (!strcmp(sym, "ftp")) {adr = ftp; *wd = TRUE;} else if (!strcmp(sym, "fix")) {adr = fix; *wd = TRUE;} else if (!strcmp(sym, "ftlen")) {adr = ftlen; *wd = FALSE;} else if (!strcmp(sym, "ftname")) {adr = ftname; *wd = FALSE;} else if (!strcmp(sym, "brcstk")) {adr = brcstk; *wd = TRUE;} else if (!strcmp(sym, "brcpt")) {adr = brcpt; *wd = TRUE;} else if (!strcmp(sym, "lindent")) {adr = lindent; *wd = TRUE;} else if (!strcmp(sym,"vposition")) {adr =&vposition;*wd = TRUE;} else if (!strcmp(sym, "skdots")) {adr = &skdots; *wd = TRUE;} return(adr); } dump(loc, wdrf) union ptr loc; char wdrf; { int i; if (wdrf) { for (i = 0; i < 16; i++,loc.w++) printf(" %04x", *loc.w); } else { for (i = 0; i < 26; i++) printf(" %02x", *(loc.b+i)); printf("\n"); for (i = 0; i < 26; i++, loc.b++) printf(" %c", (*loc.b>=' ' && *loc.b<0x80)? *loc.b: '.'); } printf("\n"); } sinfo() { printf("\n List of symbols I know:\n\n"); printf( " outbuf: output line\n"); printf( " inbuf: input line\n"); printf( "attrbuf: print modes for output line characters\n"); printf( " widbuf: widths for output line characters\n"); printf( " ftp: addresses of fonts' character data\n"); printf( " fix: font character directories\n"); printf( " ftlen: font character widths\n"); printf( " ftname: names of fonts\n"); printf( " brcstk: stack for print modes\n"); printf( " brcpt: stack pointers for above\n"); printf( "lindent: left indents for each column\n"); printf( "vposition: vertical position on page\n"); printf( " skdots: accumulated vertical change\n\n"); } info() { printf("\n Examining external values:\n\n"); printf(" ^C to exit\n"); printf(" CR - memory at next address, or dump more\n"); printf(" @ - memory at this address\n"); printf(" b - bytes\n"); printf(" w - words\n"); printf(" d - dump\n"); printf(" ' - memory for this variable ( or /)\n"); printf(" y - sYmbol list\n"); printf(" \\ - value of command variable (or c)\n"); printf(" t - type of command variable\n"); printf(" e - call %s.com to edit it (opt. file)\n", editname); printf(" = - patch in new value\n"); printf(" $ - patch in new name for editor; no ext\n"); printf(" l - load EP.INI\n"); printf(" s - save EP.INI\n"); printf("\n"); } /************************************************/ /* Load initialization data */ /************************************************/ loadi() { int fd; if ((fd = open("ep.ini",0)) == ERROR) {printf("Can't find EP.INI\n"); return;} if (read(fd, val, 21) != 21) {printf("Something wrong with file EP.INI\n"); return;} fabort(fd); } /************************************************/ /* Save current values as new initialization data*/ /* (not used now) */ /************************************************/ savei() { int fd; if ((fd = creat("ep.ini",1)) == ERROR) {printf("Couldn't create a new EP.INI\n"); return; } if (write(fd, val, 21) != 21) {printf("Couldn't finish making the new EP.INI\n"); return; } if (close(fd) == ERROR) {printf("Couldn't put EP.INI in disk directory\n"); return; } }