| 1 |
#ifdef RCSID |
| 2 |
static char RCSid[] = |
| 3 |
"$Header: d:/cvsroot/tads/TADS2/ERRMSG.C,v 1.3 1999/07/11 00:46:29 MJRoberts Exp $"; |
| 4 |
#endif |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#include "os.h" |
| 26 |
#include "err.h" |
| 27 |
#include "mch.h" |
| 28 |
|
| 29 |
#ifdef ERR_LINK_MESSAGES |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
#ifndef TCD_HEAPSIZ_MSG |
| 40 |
#define TCD_HEAPSIZ_MSG " -mh size heap size (default 1024 bytes)" |
| 41 |
#endif |
| 42 |
#ifndef TCD_POOLSIZ_MSG |
| 43 |
#define TCD_POOLSIZ_MSG \ |
| 44 |
" -mp size parse node pool size (default 6144 bytes)" |
| 45 |
#endif |
| 46 |
#ifndef TCD_LCLSIZ_MSG |
| 47 |
#define TCD_LCLSIZ_MSG \ |
| 48 |
" -ml size local symbol table size (default 4096 bytes)" |
| 49 |
#endif |
| 50 |
#ifndef TCD_STKSIZ_MSG |
| 51 |
#define TCD_STKSIZ_MSG " -ms size stack size (default 50 elements)" |
| 52 |
#endif |
| 53 |
#ifndef TCD_LABSIZ_MSG |
| 54 |
#define TCD_LABSIZ_MSG \ |
| 55 |
" -mg size goto label table size (default 1024 bytes)" |
| 56 |
#endif |
| 57 |
|
| 58 |
#ifndef TRD_HEAPSIZ_MSG |
| 59 |
#define TRD_HEAPSIZ_MSG " -mh size heap size (default 2048 bytes)" |
| 60 |
#endif |
| 61 |
#ifndef TRD_STKSIZ_MSG |
| 62 |
#define TRD_STKSIZ_MSG " -ms size stack size (default 200 elements)" |
| 63 |
#endif |
| 64 |
#ifndef TRD_UNDOSIZ_MSG |
| 65 |
#define TRD_UNDOSIZ_MSG \ |
| 66 |
" -u size set undo to size (0 to disable; default 16384)" |
| 67 |
#endif |
| 68 |
|
| 69 |
#ifndef TDD_HEAPSIZ_MSG |
| 70 |
#define TDD_HEAPSIZ_MSG " -mh size heap size (default 2048 bytes)" |
| 71 |
#endif |
| 72 |
#ifndef TDD_STKSIZ_MSG |
| 73 |
#define TDD_STKSIZ_MSG " -ms size stack size (default 200 elements)" |
| 74 |
#endif |
| 75 |
#ifndef TDD_UNDOSIZ_MSG |
| 76 |
#define TDD_UNDOSIZ_MSG \ |
| 77 |
" -u size set undo to size (0 to disable; default 16384)" |
| 78 |
#endif |
| 79 |
#ifndef TDD_POOLSIZ_MSG |
| 80 |
#define TDD_POOLSIZ_MSG " -mp size parse pool size (default 2048 bytes)" |
| 81 |
#endif |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
static errmdef errlist[] = |
| 88 |
{ |
| 89 |
{ ERR_NOMEM, "fatal: out of memory" }, |
| 90 |
{ ERR_FSEEK, "fatal: error seeking in file" }, |
| 91 |
{ ERR_FREAD, "fatal: error reading from file" }, |
| 92 |
{ ERR_NOPAGE, "fatal: no more page slots" }, |
| 93 |
{ ERR_REALCK, "attempting to reallocate a locked object" }, |
| 94 |
{ ERR_SWAPBIG, "fatal: swapfile limit reached - out of virtual memory" }, |
| 95 |
{ ERR_FWRITE, "fatal: error writing file" }, |
| 96 |
{ ERR_SWAPPG, "fatal: exceeded swap page table limit" }, |
| 97 |
{ ERR_CLIUSE, "requested client object number already in use" }, |
| 98 |
{ ERR_CLIFULL, "fatal: client mapping table is full" }, |
| 99 |
{ ERR_NOMEM1, "fatal: no memory, even after swapping/garbage collection" }, |
| 100 |
{ ERR_NOMEM2, "fatal: no memory to resize (expand) an object" }, |
| 101 |
{ ERR_OPSWAP, "unable to open swap file" }, |
| 102 |
{ ERR_NOHDR, "can't get a new object header" }, |
| 103 |
{ ERR_NOLOAD, "mcm cannot find object to load (internal error)" }, |
| 104 |
{ ERR_LCKFRE, "attempting to free a locked object (internal error)" }, |
| 105 |
{ ERR_INVOBJ, "invalid object (object has been deleted)" }, |
| 106 |
{ ERR_BIGOBJ, "object too big - exceeds maximum object allocation size" }, |
| 107 |
{ ERR_INVTOK, "invalid token" }, |
| 108 |
{ ERR_STREOF, "end of file while scanning string" }, |
| 109 |
{ ERR_TRUNC, "warning: symbol too long - truncated to \"%s\"" }, |
| 110 |
{ ERR_NOLCLSY, "fatal: no space in local symbol table" }, |
| 111 |
{ ERR_PRPDIR, "invalid preprocessor (#) directive" }, |
| 112 |
{ ERR_INCNOFN, "no filename in #include directive" }, |
| 113 |
{ ERR_INCSYN, "invalid #include syntax" }, |
| 114 |
{ ERR_INCSEAR, "can't find included file \"%s\"" }, |
| 115 |
{ ERR_INCMTCH, "no matching delimiter in #include filename" }, |
| 116 |
{ ERR_MANYSYM, "fatal: out of space for symbol table expansion" }, |
| 117 |
{ ERR_LONGLIN, "input line is too long" }, |
| 118 |
{ ERR_INCRPT, "warning: file \"%s\" already included; #include ignored" }, |
| 119 |
{ ERR_PRAGMA, "unknown pragma (ignored)" }, |
| 120 |
{ ERR_BADPELSE, "unexpected #else" }, |
| 121 |
{ ERR_BADENDIF, "unexpected #endif" }, |
| 122 |
{ ERR_BADELIF, "unexpected #elif" }, |
| 123 |
{ ERR_MANYPIF, "#if nesting too deep" }, |
| 124 |
{ ERR_DEFREDEF, "#define symbol already defined -- redefinition ignored" }, |
| 125 |
{ ERR_PUNDEF, "warning: symbol not defined in #undef" }, |
| 126 |
{ ERR_NOENDIF, "missing #endif" }, |
| 127 |
{ ERR_MACNEST, "macros nested too deeply" }, |
| 128 |
{ ERR_BADISDEF, "invalid argument for defined() preprocessor operator" }, |
| 129 |
{ ERR_PIF_NA, "#if is not implemented" }, |
| 130 |
{ ERR_PELIF_NA, "#elif is not implemented" }, |
| 131 |
{ ERR_P_ERROR, "Error directive: %s" }, |
| 132 |
{ ERR_LONG_FILE_MACRO, |
| 133 |
"internal error: __FILE__ expansion too long" }, |
| 134 |
{ ERR_LONG_LINE_MACRO, |
| 135 |
"internal error: __LINE__ expansion too long" }, |
| 136 |
|
| 137 |
{ ERR_UNDOVF, "operation is too big for undo log" }, |
| 138 |
{ ERR_NOUNDO, "no more undo information" }, |
| 139 |
{ ERR_ICUNDO, "incomplete undo (no previous savepoint)" }, |
| 140 |
{ ERR_REQTOK, "expected %s" }, |
| 141 |
{ ERR_REQSYM, "expected a symbol" }, |
| 142 |
{ ERR_REQPRP, "expected a property name" }, |
| 143 |
{ ERR_REQOPN, "expected an operand" }, |
| 144 |
{ ERR_REQARG, "expected a comma or closing paren (in arg list)" }, |
| 145 |
{ ERR_NONODE, |
| 146 |
"fatal: no space for new parse node (use -mp option to increase the limit)" }, |
| 147 |
{ ERR_REQOBJ, "expected object name" }, |
| 148 |
{ ERR_REQEXT, "redefining symbol as external function" }, |
| 149 |
{ ERR_REQFCN, "redefining symbol as function" }, |
| 150 |
{ ERR_NOCLASS, "can't use \"class\" with function/external function" }, |
| 151 |
{ ERR_REQUNO, "unary operator required" }, |
| 152 |
{ ERR_REQBIN, "binary operator required" }, |
| 153 |
{ ERR_INVBIN, "invalid binary operator" }, |
| 154 |
{ ERR_INVASI, "invalid assignment" }, |
| 155 |
{ ERR_REQVAR, "variable name required" }, |
| 156 |
{ ERR_LCLSYN, "comma or semicolon required in local list" }, |
| 157 |
{ ERR_REQRBR, "right brace required (eof before end of group)" }, |
| 158 |
{ ERR_BADBRK, "'break' without 'while'" }, |
| 159 |
{ ERR_BADCNT, "'continue' without 'while'" }, |
| 160 |
{ ERR_BADELS, "'else' without 'if'" }, |
| 161 |
{ ERR_WEQASI, "warning: possible use of '=' where ':=' intended" }, |
| 162 |
{ ERR_EOF, "unexpected end of file" }, |
| 163 |
{ ERR_SYNTAX, "general syntax error" }, |
| 164 |
{ ERR_INVOP, "invalid operand type" }, |
| 165 |
{ ERR_NOMEMLC, "fatal: can't expand local symbol table" }, |
| 166 |
{ ERR_NOMEMAR, "fatal: can't expand argument symbol table" }, |
| 167 |
{ ERR_FREDEF, "redefining a function which is already defined" }, |
| 168 |
{ ERR_NOSW, "'case' or 'default' not in switch block" }, |
| 169 |
{ ERR_SWRQCN, "constant required in switch case value" }, |
| 170 |
{ ERR_REQLBL, "label required for 'goto'" }, |
| 171 |
{ ERR_NOGOTO, "'goto' label never defined" }, |
| 172 |
{ ERR_MANYSC, "too many superclasses for object" }, |
| 173 |
{ ERR_OREDEF, "redefining symbol as object" }, |
| 174 |
{ ERR_PREDEF, "property being redefined in object" }, |
| 175 |
{ ERR_BADPVL, "invalid property value" }, |
| 176 |
{ ERR_BADVOC, "invalid vocabulary property value" }, |
| 177 |
{ ERR_BADTPL, "invalid template property value (need string)" }, |
| 178 |
{ ERR_LONGTPL, "template base property name too long" }, |
| 179 |
{ ERR_MANYTPL, "too many templates (internal compiler limit)" }, |
| 180 |
{ ERR_BADCMPD, "invalid value for compound word (string required)" }, |
| 181 |
{ ERR_BADFMT, "invalid value for format string (string required)" }, |
| 182 |
{ ERR_BADSYN, "invalid value for synonym (string required)"}, |
| 183 |
{ ERR_UNDFSYM, "undefined symbol" }, |
| 184 |
{ ERR_BADSPEC, "invalid value for specialWords list (string required)" }, |
| 185 |
{ ERR_NOSELF, "\"self\" is not valid in this context" }, |
| 186 |
{ ERR_STREND, "warning: possible unterminated string" }, |
| 187 |
{ ERR_MODRPLX, "'replace'/'modify' not allowed with external function" }, |
| 188 |
{ ERR_MODFCN, "'modify' not allowed with function; ignored" }, |
| 189 |
{ ERR_MODFWD, "'modify'/'replace' ignored with forward declaration" }, |
| 190 |
{ ERR_MODOBJ, "'modify' can only be used with a defined object" }, |
| 191 |
{ ERR_RPLSPEC, "warning: replacing specialWords (please use 'replace')" }, |
| 192 |
{ ERR_SPECNIL, "nil allowed only with modify specialWords" }, |
| 193 |
{ ERR_BADLCL, "'local' is only allowed at the beginning of a block" }, |
| 194 |
{ ERR_IMPPROP,"implied verifier '%s' is not a property" }, |
| 195 |
{ ERR_BADTPLF,"invalid command template flag" }, |
| 196 |
{ ERR_NOTPLFLG,"flags are not allowed with old file formats" }, |
| 197 |
{ ERR_AMBIGBIN,"warning: operator '%s' interpreted as unary in list" }, |
| 198 |
{ ERR_PIA,"warning: possibly incorrect assignment" }, |
| 199 |
{ ERR_BADSPECEXPR, "speculative evaluation failed" }, |
| 200 |
|
| 201 |
{ ERR_OBJOVF, "object cannot grow any bigger - code too big" }, |
| 202 |
{ ERR_NOLBL, "no more temporary labels/fixups (internal compiler limit)"}, |
| 203 |
{ ERR_LBNOSET, "(internal error) label never set" }, |
| 204 |
{ ERR_INVLSTE, "invalid datatype for list element" }, |
| 205 |
{ ERR_MANYDBG, |
| 206 |
"fatal: too many debugger source line records (internal limit)" }, |
| 207 |
{ ERR_VOCINUS, "vocabulary being redefined for object" }, |
| 208 |
{ ERR_VOCMNPG, |
| 209 |
"fatal: too many vocabulary word relations (internal limit)" }, |
| 210 |
{ ERR_VOCREVB, "warning: same verb '%s' defined for two objects" }, |
| 211 |
{ ERR_VOCREVB2, "warning: same verb '%s %s' defined for two objects" }, |
| 212 |
{ ERR_LOCNOBJ, "warning: location of object \"%s\" is not an object" }, |
| 213 |
{ ERR_CNTNLST, "warning: contents of object \"%s\" is not list" }, |
| 214 |
{ ERR_SUPOVF, "overflow trying to build contents list" }, |
| 215 |
{ ERR_RQOBJNF, "required object \"%s\" not found" }, |
| 216 |
{ ERR_WRNONF, "warning: object \"%s\" not found" }, |
| 217 |
{ ERR_MANYBIF, "too many built-in functions (internal error)" }, |
| 218 |
{ ERR_OPWGAM, "unable to open game for writing" }, |
| 219 |
{ ERR_WRTGAM, "error writing to game file" }, |
| 220 |
{ ERR_FIOMSC, "too many sc's for writing in fiowrt" }, |
| 221 |
{ ERR_UNDEFF, "undefined function \"%s\"" }, |
| 222 |
{ ERR_UNDEFO, "undefined object \"%s\"" }, |
| 223 |
{ ERR_UNDEF, "undefined symbols found" }, |
| 224 |
{ ERR_OPRGAM, "unable to open game for reading" }, |
| 225 |
{ ERR_RDGAM, "error reading game file" }, |
| 226 |
{ ERR_BADHDR, "file has invalid header - not a TADS game file" }, |
| 227 |
{ ERR_UNKRSC, "unknown resource type in .gam file" }, |
| 228 |
{ ERR_UNKOTYP, "unknown object type in OBJ resource" }, |
| 229 |
{ ERR_BADVSN, "file saved by different (incompatible) version" }, |
| 230 |
{ ERR_LDGAM, "error loading object on demand" }, |
| 231 |
{ ERR_LDBIG, "object too big for load region (internal error)" }, |
| 232 |
{ ERR_UNXEXT, "did not expect external function" }, |
| 233 |
{ ERR_WRTVSN, "compiler cannot write this file version" }, |
| 234 |
{ ERR_VNOCTAB, "this file version cannot be used with a -ctab setting" }, |
| 235 |
{ ERR_BADHDRRSC, "resource file \"%s\" has an invalid header" }, |
| 236 |
{ ERR_RDRSC, "error reading resource file \"%s\"" }, |
| 237 |
{ ERR_CHRNOFILE, |
| 238 |
"character table file \"%s\" not found for internal character set \"%s\""}, |
| 239 |
{ ERR_USRINT, "user requested cancel of current operation" }, |
| 240 |
{ ERR_STKOVF, "stack overflow" }, |
| 241 |
{ ERR_HPOVF, "heap overflow" }, |
| 242 |
{ ERR_REQNUM, "numeric value required" }, |
| 243 |
{ ERR_STKUND, "stack underflow" }, |
| 244 |
{ ERR_REQLOG, "logical value required" }, |
| 245 |
{ ERR_INVCMP, "invalid datatypes for magnitude comparison" }, |
| 246 |
{ ERR_REQSTR, "string value required" }, |
| 247 |
{ ERR_INVADD, "invalid datatypes for binary '+' operator" }, |
| 248 |
{ ERR_INVSUB, "invalid datatypes for binary '-' operator" }, |
| 249 |
{ ERR_REQVOB, "object value required" }, |
| 250 |
{ ERR_REQVFN, "function pointer required" }, |
| 251 |
{ ERR_REQVPR, "property pointer value required" }, |
| 252 |
{ ERR_RUNEXIT, "'exit' statement executed" }, |
| 253 |
{ ERR_RUNABRT, "'abort' statement executed" }, |
| 254 |
{ ERR_RUNASKD, "'askdo' statement executed" }, |
| 255 |
{ ERR_RUNASKI, "'askio' executed; preposition is object #%d" }, |
| 256 |
{ ERR_RUNQUIT, "'quit' executed" }, |
| 257 |
{ ERR_RUNRESTART, "'reset' executed" }, |
| 258 |
{ ERR_RUNEXITOBJ, "'exitobj' executed" }, |
| 259 |
{ ERR_REQVLS, "list value required" }, |
| 260 |
{ ERR_LOWINX, "index value too low (must be at least 1)" }, |
| 261 |
{ ERR_HIGHINX,"index value too high (must be at most length(list))" }, |
| 262 |
{ ERR_INVTBIF,"invalid type for built-in function" }, |
| 263 |
{ ERR_INVVBIF,"invalid value for built-in function \"%s\"" }, |
| 264 |
{ ERR_BIFARGC,"wrong number of arguments to built-in" }, |
| 265 |
{ ERR_ARGC, "wrong number of arguments to user function \"%s\"" }, |
| 266 |
{ ERR_FUSEVAL,"string/list not allowed for fuse/daemon arg" }, |
| 267 |
{ ERR_BADSETF,"internal error in setfuse/setdaemon/notify" }, |
| 268 |
{ ERR_MANYFUS,"too many fuses" }, |
| 269 |
{ ERR_MANYDMN,"too many daemons" }, |
| 270 |
{ ERR_MANYNFY,"too many notifiers" }, |
| 271 |
{ ERR_NOFUSE, "fuse not found in remfuse" }, |
| 272 |
{ ERR_NODMN, "daemon not found in remdaemon" }, |
| 273 |
{ ERR_NONFY, "notifier not found in unnotify" }, |
| 274 |
{ ERR_BADREMF,"internal error in remfuse/remdaemon/unnotify" }, |
| 275 |
{ ERR_DMDLOOP,"load-on-demand loop: property not being set (internal)" }, |
| 276 |
{ ERR_UNDFOBJ,"undefined object \"%s\" in class list"}, |
| 277 |
{ ERR_BIFCSTR,"c-string conversion overflows buffer (internal limit)" }, |
| 278 |
{ ERR_INVOPC, "invalid opcode (internal error)" }, |
| 279 |
{ ERR_RUNNOBJ,"property evaluated for non-existent object" }, |
| 280 |
{ ERR_EXTLOAD,"unable to load external function \"%s\"" }, |
| 281 |
{ ERR_EXTRUN, |
| 282 |
"external functions are obsolete (attempted to invoke \"%s\")" }, |
| 283 |
{ ERR_CIRCSYN,"circular synonym" }, |
| 284 |
{ ERR_DIVZERO,"divide by zero" }, |
| 285 |
{ ERR_BADDEL, "only objects allocated with 'new' can be deleted" }, |
| 286 |
{ ERR_BADNEWSC,"invalid superclass for 'new'" }, |
| 287 |
{ ERR_VOCSTK, "fatal: out of space in parser stack" }, |
| 288 |
{ ERR_BADFILE, "invalid file handle" }, |
| 289 |
|
| 290 |
{ ERR_PRS_SENT_UNK, "unrecognized sentence structure" }, |
| 291 |
{ ERR_PRS_VERDO_FAIL, "direct object validation failed" }, |
| 292 |
{ ERR_PRS_VERIO_FAIL, "indirect object validation failed" }, |
| 293 |
{ ERR_PRS_NO_VERDO, "no direct object validation method defined" }, |
| 294 |
{ ERR_PRS_NO_VERIO, "no indirect object validation method defined" }, |
| 295 |
{ ERR_PRS_VAL_DO_FAIL, "direct object validation failed" }, |
| 296 |
{ ERR_PRS_VAL_IO_FAIL, "indirect object validation failed" }, |
| 297 |
|
| 298 |
{ ERR_USAGE, "invalid command-line usage" }, |
| 299 |
{ ERR_OPNINP, "error opening input file" }, |
| 300 |
{ ERR_NODBG, |
| 301 |
"game not compiled for debugging - recompile with -ds or -ds2 \ |
| 302 |
option (check your debugger instructions to determine which option to \ |
| 303 |
use with your version of the debugger)" }, |
| 304 |
{ ERR_ERRFIL, "unable to create error logging file" }, |
| 305 |
{ ERR_PRSCXSIZ, |
| 306 |
"parse pool + local sizes too large - total cannot exceed %u" }, |
| 307 |
{ ERR_STKSIZE, "stack size too large - cannot exceed %u" }, |
| 308 |
{ ERR_OPNSTRFIL, "error creating string capture file" }, |
| 309 |
{ ERR_INVCMAP, "character map file not found or invalid" }, |
| 310 |
|
| 311 |
{ ERR_BPSYM, "error setting breakpoint: unknown symbol" }, |
| 312 |
{ ERR_BPPROP, "error setting breakpoint: symbol is not a property" }, |
| 313 |
{ ERR_BPFUNC, "error setting breakpoint: symbol is not a function" }, |
| 314 |
{ ERR_BPNOPRP, "error setting breakpoint: property not defined in object" }, |
| 315 |
{ ERR_BPPRPNC, "error setting breakpoint: property is not code" }, |
| 316 |
{ ERR_BPSET, "error: breakpoint is already set at this location" }, |
| 317 |
{ ERR_BPNOTLN, "error setting breakpoint: breakpoint not at line" }, |
| 318 |
{ ERR_MANYBP, "too many breakpoints" }, |
| 319 |
{ ERR_BPNSET, "breakpoint was not set" }, |
| 320 |
{ ERR_DBGMNSY, "too many symbols in eval expression (internal limit)" }, |
| 321 |
{ ERR_NOSOURC, "unable to find source file \"%s\"" }, |
| 322 |
{ ERR_WTCHLCL, "assignment to local is illegal in watch expression" }, |
| 323 |
{ ERR_INACTFR, "inactive frame (expression value not available)" }, |
| 324 |
{ ERR_MANYWX, "too many watch expressions" }, |
| 325 |
{ ERR_WXNSET, "watch expression not set" }, |
| 326 |
{ ERR_EXTRTXT, "extraneous text after end of command" }, |
| 327 |
{ ERR_BPOBJ, "error setting breakpoint: symbol is not an object" }, |
| 328 |
{ ERR_DBGINACT, "debugger is inactive (program running)" }, |
| 329 |
{ ERR_BPINUSE, "breakpoint is already used" }, |
| 330 |
{ ERR_RTBADSPECEXPR, "speculative evaluation failed (runtime)" }, |
| 331 |
{ ERR_NEEDLIN2, |
| 332 |
"New-style debugging records required. Recompile game with -ds2 option." }, |
| 333 |
|
| 334 |
|
| 335 |
{ ERR_TCUS1, OS_TC_USAGE }, |
| 336 |
{ ERR_TCUS1 + 1, "options:" }, |
| 337 |
{ ERR_TCUS1 + 2, " -C (-)[toggle] use C-style =, == operators"}, |
| 338 |
{ ERR_TCUS1 + 3, |
| 339 |
" -case (+)[toggle] turn case sensitivity on(+) or off(-)" }, |
| 340 |
{ ERR_TCUS1 + 4, " -ctab file use character mapping table file" }, |
| 341 |
{ ERR_TCUS1 + 5, " -D sym=val define preprocessor symbol" }, |
| 342 |
{ ERR_TCUS1 + 6, |
| 343 |
" -ds (-)[toggle] generate source debugging information" }, |
| 344 |
{ ERR_TCUS1 + 7, |
| 345 |
" -ds2 (-)[toggle] generate new-style debug information" }, |
| 346 |
{ ERR_TCUS1 + 8, " -e file capture errors/warnings in file" }, |
| 347 |
{ ERR_TCUS1 + 9, " -Fs file capture strings in file" }, |
| 348 |
{ ERR_TCUS1 + 10, " -fv a|b|c|* .GAM file version to generate" }, |
| 349 |
{ ERR_TCUS1 + 11," -i path add path to include file search list" }, |
| 350 |
{ ERR_TCUS1 + 12," -l file load precompiled header file" }, |
| 351 |
{ ERR_TCUS1 + 13," -m memory suboptions (use -m? to list)" }, |
| 352 |
{ ERR_TCUS1 + 14, |
| 353 |
" -o file write game to file (-o- for no output)" }, |
| 354 |
{ ERR_TCUS1 + 15, |
| 355 |
" -p (-)[toggle] pause for key after compilation" }, |
| 356 |
{ ERR_TCUS1 + 16, |
| 357 |
" -s (-)[toggle] show statistics after compilation" }, |
| 358 |
{ ERR_TCUS1 + 17, |
| 359 |
" -tf file use file for swapping (default: TADSSWAP.DAT)" }, |
| 360 |
{ ERR_TCUS1 + 18, |
| 361 |
" -ts size maximum swapfile size (default: unlimited)" }, |
| 362 |
{ ERR_TCUS1 + 19, |
| 363 |
#if OS_DEFAULT_SWAP_ENABLED |
| 364 |
" -t (+)[toggle] swapping" }, |
| 365 |
#else |
| 366 |
" -t (-)[toggle] swapping" }, |
| 367 |
#endif |
| 368 |
{ ERR_TCUS1 + 20, " -U sym undefine preprocessor symbol" }, |
| 369 |
{ ERR_TCUS1 + 21, " -v arg set warning level (-v? for details)" }, |
| 370 |
{ ERR_TCUS1 + 22, " -w file precompile headers to file" }, |
| 371 |
{ ERR_TCUS1 + 23, |
| 372 |
" -Z code generation options (use -Z? to list)" }, |
| 373 |
{ ERR_TCUSL, |
| 374 |
" -1 v1 compatibility options (use -1? to list)" }, |
| 375 |
|
| 376 |
{ ERR_TCTGUS1, "" }, |
| 377 |
{ ERR_TCTGUS1 + 1, |
| 378 |
"toggle options: add + to enable, - to disable, nothing to toggle" }, |
| 379 |
{ ERR_TCTGUSL, "(default is shown in parentheses before [toggle] above)"}, |
| 380 |
|
| 381 |
{ ERR_TCZUS1, "-Z (code generation) suboptions:" }, |
| 382 |
{ ERR_TCZUSL, |
| 383 |
" -Za (+)[toggle] run-time user function argument checking" }, |
| 384 |
|
| 385 |
{ ERR_TC1US1, "-1 (TADS version 1 compatibility) suboptions:" }, |
| 386 |
{ ERR_TC1US1 + 1, |
| 387 |
" -1a (+)[toggle] run-time user function argument checking" }, |
| 388 |
{ ERR_TC1US1 + 2, " (same as -Za)" }, |
| 389 |
{ ERR_TC1US1 + 3, " -1k (-)[toggle] disable new keywords" }, |
| 390 |
{ ERR_TC1US1 + 4, |
| 391 |
" -1e (-)[toggle] ignore ';' after 'if {...}'" }, |
| 392 |
{ ERR_TC1US1 + 5, " -1d new replace 'do' keyword with 'new'" }, |
| 393 |
{ ERR_TC1USL - 2, "" }, |
| 394 |
{ ERR_TC1USL - 1, |
| 395 |
"With no suboption, -1 acts like a toggle option for all" }, |
| 396 |
{ ERR_TC1USL, "toggle-type v1 compatibility options" }, |
| 397 |
|
| 398 |
{ ERR_TCMUS1, "-m (memory) suboptions:" }, |
| 399 |
{ ERR_TCMUS1 + 1, |
| 400 |
" -m size limit in-memory cache to size (in bytes)" }, |
| 401 |
{ ERR_TCMUS1 + 2, TCD_LABSIZ_MSG }, |
| 402 |
{ ERR_TCMUS1 + 3, TCD_HEAPSIZ_MSG }, |
| 403 |
{ ERR_TCMUS1 + 4, TCD_LCLSIZ_MSG }, |
| 404 |
{ ERR_TCMUS1 + 5, TCD_POOLSIZ_MSG }, |
| 405 |
{ ERR_TCMUSL, TCD_STKSIZ_MSG }, |
| 406 |
{ ERR_TCVUS1, "-v (warning verbosity level) suboptions:" }, |
| 407 |
{ ERR_TCVUS1 + 1, |
| 408 |
" -v level set warning verbosity to level (default is 0)" }, |
| 409 |
{ ERR_TCVUSL, |
| 410 |
" -v-abin disable ambiguous binary operator warnings (+abin enables)" }, |
| 411 |
|
| 412 |
|
| 413 |
{ ERR_TRUSPARM, "usage: %s [options] file" }, |
| 414 |
{ ERR_TRUS1, OS_TR_USAGE }, |
| 415 |
{ ERR_TRUS1 + 1, "options:" }, |
| 416 |
{ ERR_TRUS1 + 2, " -ctab file use character mapping table file" }, |
| 417 |
{ ERR_TRUS1 + 3, " -ctab- do not use any character mapping file" }, |
| 418 |
{ ERR_TRUS1 + 4, " -i file read commands from file" }, |
| 419 |
{ ERR_TRUS1 + 5, " -o file write commands to file" }, |
| 420 |
{ ERR_TRUS1 + 6, " -l file log all output to file" }, |
| 421 |
{ ERR_TRUS1 + 7, " -m size maximum cache size (in bytes)" }, |
| 422 |
{ ERR_TRUS1 + 8, TRD_HEAPSIZ_MSG }, |
| 423 |
{ ERR_TRUS1 + 9, TRD_STKSIZ_MSG }, |
| 424 |
{ ERR_TRUS1 + 10, " -p [toggle] pause after play" }, |
| 425 |
{ ERR_TRUS1 + 11, |
| 426 |
" -r savefile restore saved game position from savefile" }, |
| 427 |
{ ERR_TRUS1 + 12, " -s level set I/O safety level (-s? for help)" }, |
| 428 |
{ ERR_TRUS1 + 13, |
| 429 |
" -tf file use file for swapping (default: TADSSWAP.DAT)" }, |
| 430 |
{ ERR_TRUS1 + 14, |
| 431 |
" -ts size maximum swapfile size (default: unlimited)" }, |
| 432 |
{ ERR_TRUS1 + 15, " -tp (-)[toggle] preload all objects" }, |
| 433 |
{ ERR_TRUS1 + 16, |
| 434 |
#if OS_DEFAULT_SWAP_ENABLED |
| 435 |
" -t- disable swapping (enabled by default)" }, |
| 436 |
#else |
| 437 |
" -t+ enable swapping (disabled by default)" }, |
| 438 |
#endif |
| 439 |
{ ERR_TRUS1 + 17, TRD_UNDOSIZ_MSG }, |
| 440 |
{ ERR_TRUSFT1, "" }, |
| 441 |
{ ERR_TRUSFT1 + 1, |
| 442 |
"toggle options: add + to enable, - to disable, nothing to toggle" }, |
| 443 |
|
| 444 |
|
| 445 |
{ ERR_TRSUS1, "-s (file I/O safety level) suboptions:" }, |
| 446 |
{ ERR_TRSUS1 + 1, |
| 447 |
" -s0 minimum safety - read and write in any directory" }, |
| 448 |
{ ERR_TRSUS1 + 2, |
| 449 |
" -s1 read in any directory, write in current directory only" |
| 450 |
}, |
| 451 |
{ ERR_TRSUS1 + 3, |
| 452 |
" -s2 (default) read and write in current directory only" }, |
| 453 |
{ ERR_TRSUS1 + 4, " -s3 read-only access in current directory only" }, |
| 454 |
{ ERR_TRSUS1 + 5, " -s4 maximum safety - no file I/O allowed" }, |
| 455 |
{ ERR_TRSUS1 + 6, |
| 456 |
"(These options apply only to explicit file operations by the game,"}, |
| 457 |
{ ERR_TRSUSL, "not to saving and restoring games.)" }, |
| 458 |
|
| 459 |
|
| 460 |
{ ERR_TDBUSPARM, "usage: %s [options] file" }, |
| 461 |
{ ERR_TDBUS1, OS_TDB_USAGE }, |
| 462 |
{ ERR_TDBUS1 + 1, "options:"}, |
| 463 |
{ ERR_TDBUS1 + 2, " -ctab file use character mapping table file" }, |
| 464 |
{ ERR_TDBUS1 + 3, " -ctab- do not use any character table file" }, |
| 465 |
{ ERR_TDBUS1 + 4, " -i path add path to source file search list" }, |
| 466 |
{ ERR_TDBUS1 + 5, " -m size maximum cache size (in bytes)" }, |
| 467 |
{ ERR_TDBUS1 + 6, TDD_HEAPSIZ_MSG }, |
| 468 |
{ ERR_TDBUS1 + 7, TDD_POOLSIZ_MSG }, |
| 469 |
{ ERR_TDBUS1 + 8, TDD_STKSIZ_MSG }, |
| 470 |
{ ERR_TDBUS1 + 9, |
| 471 |
" -r savefile restore saved game position from savefile" }, |
| 472 |
{ ERR_TDBUS1 + 10," -s level set I/O safety level (-s? for help)" }, |
| 473 |
{ ERR_TDBUS1 + 11, |
| 474 |
" -tf file use file for swapping (default: TADSSWAP.DAT)" }, |
| 475 |
{ ERR_TDBUS1 + 12, |
| 476 |
" -ts size maximum swapfile size (default: unlimited)" }, |
| 477 |
{ ERR_TDBUS1 + 13, |
| 478 |
#if OS_DEFAULT_SWAP_ENABLED |
| 479 |
" -t- disable swapping (enabled by default)" }, |
| 480 |
#else |
| 481 |
" -t+ enable swapping (disabled by default)" }, |
| 482 |
#endif |
| 483 |
{ ERR_TDBUSL, TDD_UNDOSIZ_MSG }, |
| 484 |
|
| 485 |
|
| 486 |
{ ERR_TRUS_DOS_1, |
| 487 |
" -plain use plain text console output (no BIOS calls)" }, |
| 488 |
|
| 489 |
|
| 490 |
{ ERR_TRUS_DOS32_1, |
| 491 |
" -plain use plain text console output (no BIOS calls)" }, |
| 492 |
{ ERR_TRUS_DOS32_1 + 1, |
| 493 |
" -kbfix95 use special Windows 95 keyboard handling (use only if" }, |
| 494 |
{ ERR_TRUS_DOS32_1 + 2, |
| 495 |
" you have problems with keyboard layout switching)" }, |
| 496 |
|
| 497 |
|
| 498 |
{ ERR_GNOFIL, "warning: graphics resource file \"%s\" not found" }, |
| 499 |
{ ERR_GNORM, "can't find room \"%s\" (it's used in the resource file)" }, |
| 500 |
{ ERR_GNOOBJ, |
| 501 |
"can't find object \"%s\" (it's used in a hot spot resource)" }, |
| 502 |
{ ERR_GNOICN, "can't find object \"%s\" (it's used in an icon resource)"} |
| 503 |
}; |
| 504 |
|
| 505 |
void errmsg(errcxdef *ctx, char *outbuf, uint outbufl, uint err) |
| 506 |
{ |
| 507 |
uint last; |
| 508 |
uint first; |
| 509 |
uint cur; |
| 510 |
|
| 511 |
VARUSED(outbufl); |
| 512 |
|
| 513 |
|
| 514 |
first = 0; |
| 515 |
last = (sizeof(errlist) / sizeof(errlist[0])) - 1; |
| 516 |
for (;;) |
| 517 |
{ |
| 518 |
if (first > last) |
| 519 |
{ |
| 520 |
strcpy(outbuf, "unknown error"); |
| 521 |
return; |
| 522 |
} |
| 523 |
|
| 524 |
cur = first + (last - first)/2; |
| 525 |
if (errlist[cur].errmerr == err) |
| 526 |
{ |
| 527 |
strcpy(outbuf, errlist[cur].errmtxt); |
| 528 |
return; |
| 529 |
} |
| 530 |
else if (errlist[cur].errmerr < err) |
| 531 |
first = (cur == first ? first + 1 : cur); |
| 532 |
else |
| 533 |
last = (cur == last ? last - 1 : cur); |
| 534 |
} |
| 535 |
} |
| 536 |
|
| 537 |
void errini(errcxdef *ctx, osfildef *fp) |
| 538 |
{ |
| 539 |
VARUSED(ctx); |
| 540 |
VARUSED(fp); |
| 541 |
} |
| 542 |
|
| 543 |
#else |
| 544 |
|
| 545 |
void errmsg(errcxdef *ctx, char *outbuf, uint outbufl, uint err) |
| 546 |
{ |
| 547 |
uint last; |
| 548 |
uint first; |
| 549 |
uint cur; |
| 550 |
errmfdef *errlist = ctx->errcxseek; |
| 551 |
int l; |
| 552 |
|
| 553 |
if (!errlist) |
| 554 |
{ |
| 555 |
strcpy(outbuf, "unknown: no error message file"); |
| 556 |
return; |
| 557 |
} |
| 558 |
|
| 559 |
|
| 560 |
first = 0; |
| 561 |
last = ctx->errcxsksz - 1; |
| 562 |
for (;;) |
| 563 |
{ |
| 564 |
if (first > last) |
| 565 |
{ |
| 566 |
strcpy(outbuf, "error not found"); |
| 567 |
return; |
| 568 |
} |
| 569 |
|
| 570 |
cur = first + (last - first)/2; |
| 571 |
if (errlist[cur].errmfnum == err) |
| 572 |
{ |
| 573 |
osfseek(ctx->errcxfp, errlist[cur].errmfseek + ctx->errcxbase, |
| 574 |
OSFSK_SET); |
| 575 |
osfgets(outbuf, outbufl, ctx->errcxfp); |
| 576 |
l = strlen(outbuf); |
| 577 |
while (l && (outbuf[l-1] == '\n' || outbuf[l-1] == '\r')) --l; |
| 578 |
outbuf[l] = '\0'; |
| 579 |
return; |
| 580 |
} |
| 581 |
else if (errlist[cur].errmfnum < err) |
| 582 |
first = (cur == first ? first + 1 : cur); |
| 583 |
else |
| 584 |
last = (cur == last ? last - 1 : cur); |
| 585 |
} |
| 586 |
} |
| 587 |
|
| 588 |
void errini(errcxdef *ctx, osfildef *fp) |
| 589 |
{ |
| 590 |
uint siz; |
| 591 |
uint i; |
| 592 |
uchar buf[6]; |
| 593 |
|
| 594 |
ctx->errcxseek = (errmfdef *)0; |
| 595 |
ctx->errcxsksz = 0; |
| 596 |
ctx->errcxbase = 0; |
| 597 |
if (!fp || ctx->errcxfp) return; |
| 598 |
|
| 599 |
|
| 600 |
(void)osfrb(fp, buf, 2); |
| 601 |
ctx->errcxsksz = osrp2(buf); |
| 602 |
siz = ctx->errcxsksz * sizeof(errmdef); |
| 603 |
ctx->errcxseek = (errmfdef *)mchalo(ctx, siz, "error messages"); |
| 604 |
for (i = 0; i < ctx->errcxsksz; ++i) |
| 605 |
{ |
| 606 |
(void)osfrb(fp, buf, 6); |
| 607 |
ctx->errcxseek[i].errmfnum = osrp2(buf); |
| 608 |
ctx->errcxseek[i].errmfseek = osrp4(buf+2); |
| 609 |
} |
| 610 |
|
| 611 |
ctx->errcxfp = fp; |
| 612 |
} |
| 613 |
|
| 614 |
#endif |
| 615 |
|
| 616 |
#ifdef ERR_BUILD_FILE |
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
int main(int argc, char *argv[]) |
| 621 |
{ |
| 622 |
osfildef *fp; |
| 623 |
uint i; |
| 624 |
uint siz; |
| 625 |
ulong pos; |
| 626 |
char *nameout; |
| 627 |
uchar buf[6]; |
| 628 |
|
| 629 |
if (argc > 2) |
| 630 |
{ |
| 631 |
printf("usage: tadserr [msg-file]\n"); |
| 632 |
os_term(1); |
| 633 |
} |
| 634 |
nameout = (argc == 2) ? argv[1] : "tadserr.msg"; |
| 635 |
|
| 636 |
fp = osfopwb(nameout, OSFTERRS); |
| 637 |
if (!fp) |
| 638 |
{ |
| 639 |
printf("error: can't open %s\n", nameout); |
| 640 |
os_term(OSEXFAIL); |
| 641 |
} |
| 642 |
|
| 643 |
|
| 644 |
siz = sizeof(errlist) / sizeof(errlist[0]); |
| 645 |
oswp2(buf, siz); |
| 646 |
(void)osfwb(fp, buf, 2); |
| 647 |
|
| 648 |
|
| 649 |
for (i = 0, pos = 2 + siz * 6 ; i < siz ; ++i) |
| 650 |
{ |
| 651 |
oswp2(buf, errlist[i].errmerr); |
| 652 |
oswp4(buf+2, pos); |
| 653 |
(void)osfwb(fp, buf, 6); |
| 654 |
|
| 655 |
pos += strlen(errlist[i].errmtxt) + 1; |
| 656 |
} |
| 657 |
|
| 658 |
|
| 659 |
for (i = 0 ; i < siz ; ++i) |
| 660 |
{ |
| 661 |
uint msglen; |
| 662 |
|
| 663 |
|
| 664 |
msglen = strlen(errlist[i].errmtxt); |
| 665 |
if (msglen) (void)osfwb(fp, errlist[i].errmtxt, msglen); |
| 666 |
(void)osfwb(fp, "\n", 1); |
| 667 |
} |
| 668 |
|
| 669 |
osfcls(fp); |
| 670 |
return 0; |
| 671 |
} |
| 672 |
|
| 673 |
#endif |
| 674 |
|
| 675 |
#ifdef ERR_BUILD_DOC |
| 676 |
|
| 677 |
#include <ctype.h> |
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
int main(int argc, char *argv[]) |
| 682 |
{ |
| 683 |
osfildef *fp; |
| 684 |
uint i; |
| 685 |
uint siz; |
| 686 |
osfildef *fpin; |
| 687 |
char *namein; |
| 688 |
char buf[128]; |
| 689 |
char buf2[80]; |
| 690 |
unsigned inmsg; |
| 691 |
char *src; |
| 692 |
char *dst; |
| 693 |
int found_end = 0; |
| 694 |
long prvpos; |
| 695 |
int inquote; |
| 696 |
|
| 697 |
if (argc != 2) |
| 698 |
{ |
| 699 |
printf("usage: tadsmdoc tex-file\n"); |
| 700 |
os_term(OSEXFAIL); |
| 701 |
} |
| 702 |
|
| 703 |
namein = argv[1]; |
| 704 |
rename(namein, "$DOC$.TMP"); |
| 705 |
if (!(fpin = osfoprt("$DOC$.TMP", OSFTTEXT))) |
| 706 |
printf("warning: old doc file not found - creating %s\n", namein); |
| 707 |
|
| 708 |
fp = osfopwt(namein, OSFTTEXT); |
| 709 |
if (!fp) |
| 710 |
{ |
| 711 |
printf("error: can't create %s\n", namein); |
| 712 |
rename("$DOC$.TMP", namein); |
| 713 |
os_term(OSEXFAIL); |
| 714 |
} |
| 715 |
|
| 716 |
|
| 717 |
if (fpin != 0) |
| 718 |
{ |
| 719 |
for (;;) |
| 720 |
{ |
| 721 |
if (!fgets(buf, sizeof(buf), fpin)) |
| 722 |
{ |
| 723 |
fpin = 0; |
| 724 |
break; |
| 725 |
} |
| 726 |
|
| 727 |
if (!memcmp(buf, "% message #", 11)) |
| 728 |
{ |
| 729 |
inmsg = atoi(buf + 11); |
| 730 |
break; |
| 731 |
} |
| 732 |
else if (!memcmp(buf, "% end messages", 14)) |
| 733 |
{ |
| 734 |
found_end = 1; |
| 735 |
break; |
| 736 |
} |
| 737 |
else |
| 738 |
fputs(buf, fp); |
| 739 |
} |
| 740 |
} |
| 741 |
|
| 742 |
|
| 743 |
siz = sizeof(errlist) / sizeof(errlist[0]); |
| 744 |
for (i = 0 ; i < siz ; ++i) |
| 745 |
{ |
| 746 |
if (errlist[i].errmerr == ERR_TCUS1) break; |
| 747 |
|
| 748 |
|
| 749 |
while (fpin != 0 && !found_end && inmsg < errlist[i].errmerr) |
| 750 |
{ |
| 751 |
prvpos = ftell(fpin); |
| 752 |
if (!fgets(buf, sizeof(buf), fpin)) |
| 753 |
fpin = 0; |
| 754 |
else if (!memcmp(buf, "% message #", 11)) |
| 755 |
{ |
| 756 |
inmsg = atoi(buf + 11); |
| 757 |
if (inmsg < errlist[i].errmerr) |
| 758 |
fputs(buf, fp); |
| 759 |
} |
| 760 |
else if (!memcmp(buf, "% end messages", 14)) |
| 761 |
found_end = 1; |
| 762 |
else |
| 763 |
fputs(buf, fp); |
| 764 |
} |
| 765 |
|
| 766 |
|
| 767 |
if (fpin != 0 && inmsg == errlist[i].errmerr) |
| 768 |
fgets(buf, sizeof(buf), fpin); |
| 769 |
|
| 770 |
|
| 771 |
sprintf(buf2, "%% message #%d\n", errlist[i].errmerr); |
| 772 |
fputs(buf2, fp); |
| 773 |
|
| 774 |
sprintf(buf2, "\\tadsmessage{%d}{", errlist[i].errmerr); |
| 775 |
dst = buf2 + strlen(buf2); |
| 776 |
inquote = 0; |
| 777 |
for (src = errlist[i].errmtxt ; *src ; ++src) |
| 778 |
{ |
| 779 |
if (*src == '%') |
| 780 |
{ |
| 781 |
switch(*++src) |
| 782 |
{ |
| 783 |
case 'd': |
| 784 |
memcpy(dst, "{\\it n}", 8); |
| 785 |
dst += 7; |
| 786 |
break; |
| 787 |
case 's': |
| 788 |
memcpy(dst, "{\\it xxx}", 10); |
| 789 |
dst += 9; |
| 790 |
break; |
| 791 |
case 't': |
| 792 |
memcpy(dst, "{\\it token}", 12); |
| 793 |
dst += 11; |
| 794 |
break; |
| 795 |
} |
| 796 |
} |
| 797 |
else if (*src == '"') |
| 798 |
{ |
| 799 |
if (inquote) |
| 800 |
{ |
| 801 |
*dst++ = '\''; |
| 802 |
*dst++ = '\''; |
| 803 |
} |
| 804 |
else |
| 805 |
{ |
| 806 |
*dst++ = '`'; |
| 807 |
*dst++ = '`'; |
| 808 |
} |
| 809 |
inquote = !inquote; |
| 810 |
} |
| 811 |
else if (*src == '\'') |
| 812 |
{ |
| 813 |
if (inquote |
| 814 |
|| (src > errlist[i].errmtxt && isalpha(*(src-1)) |
| 815 |
&& isalpha(*(src+1)))) |
| 816 |
{ |
| 817 |
*dst++ = *src; |
| 818 |
inquote = 0; |
| 819 |
} |
| 820 |
else |
| 821 |
{ |
| 822 |
*dst++ = '`'; |
| 823 |
inquote = 1; |
| 824 |
} |
| 825 |
} |
| 826 |
else if (*src == '#') |
| 827 |
{ |
| 828 |
*dst++ = '\\'; |
| 829 |
*dst++ = *src; |
| 830 |
} |
| 831 |
else |
| 832 |
*dst++ = *src; |
| 833 |
} |
| 834 |
*dst++ = '}'; |
| 835 |
*dst++ = '\n'; |
| 836 |
*dst++ = '\0'; |
| 837 |
fputs(buf2, fp); |
| 838 |
|
| 839 |
|
| 840 |
if (fpin != 0 && errlist[i].errmerr != inmsg) |
| 841 |
fseek(fpin, prvpos, 0); |
| 842 |
} |
| 843 |
|
| 844 |
|
| 845 |
while (fpin != 0 && !found_end) |
| 846 |
{ |
| 847 |
if (!fgets(buf, sizeof(buf), fpin)) |
| 848 |
fpin = 0; |
| 849 |
else if (!memcmp(buf, "% end messages", 14)) |
| 850 |
found_end = 1; |
| 851 |
else |
| 852 |
fputs(buf, fp); |
| 853 |
} |
| 854 |
|
| 855 |
|
| 856 |
fputs("% end messages\n", fp); |
| 857 |
while (fpin != 0) |
| 858 |
{ |
| 859 |
if (!fgets(buf, sizeof(buf), fpin)) |
| 860 |
fpin = 0; |
| 861 |
else |
| 862 |
fputs(buf, fp); |
| 863 |
} |
| 864 |
|
| 865 |
osfcls(fp); |
| 866 |
if (fpin != 0) |
| 867 |
fclose(fpin); |
| 868 |
remove("$DOC$.TMP"); |
| 869 |
|
| 870 |
return 0; |
| 871 |
} |
| 872 |
|
| 873 |
#endif |
| 874 |
|