1 /*****************************************************************************
2 	ZPort.h
3 
4 	This file contains portability identifiers.  It is the only file
5 that should need modification when porting the code.  It is assumed that the
6 compiler supports the #elif and "defined()" preprocessor directives,  but
7 it need not be fully ANSI C compatible in all ways.
8 *****************************************************************************/
9 
10 /****************************************************************************
11 	These identifiers enhance code readability as well as providing the
12 capability to avoid machine-dependent data type problems.  The following
13 types work for the VAX/VMS and SAGE/CPM-68K compilers.  If a compiler does
14 not have 8-bit chars, 16 or 32-bit shorts and 32-bit longs,  then problems
15 will arise.
16 	There are many places in TECOC where one pointer is subtracted from
17 another.  If the result is stored in a variable or sent to a function,  I
18 have tried to define the type of the destination as ptrdiff_t.
19 	The mode control flags (like ES, ED) are 16-bit entities defined as
20 WORD.  The DoEvEs function will not function correctly if WORD does not
21 produce signed 16-bit variables.
22 	The MakDBf function will not work properly if LONG does not
23 produce 32-bit variables.
24 *****************************************************************************/
25 
26 typedef	int		BOOLEAN;	/* holds FALSE or TRUE */
27 typedef int		DEFAULT;	/* signed, at least 16 bits */
28 typedef	short		WORD;		/* 16 bits signed */
29 typedef long		LONG;		/* 32 bits signed */
30 typedef unsigned long	ULONG;		/* 32 bits unsigned */
31 
32 #define FOREVER		for(;;)		/* Infinite loop declaration */
33 
34 /*
35  * Define TRUE and FALSE if they haven't been defined already.
36  */
37 
38 #ifndef FALSE
39 #define FALSE 0
40 #endif
41 #ifndef TRUE
42 #define TRUE 1
43 #endif
44 
45 /*****************************************************************************
46 	The following identifiers determine which compiler is being used.
47 Only ONE of the following identifiers should be defined.
48 	The UNKNOWN identifier should only be used when porting TECO-C to a
49 new environment.  When set,  it will cause stubs to be compiled for all the
50 system-dependent functions.
51 *****************************************************************************/
52 
53 /*#define __GNUC__	automatically defined by FSF GNU C		*/
54 /*#define __POWERC	automatically defined by Mix Power C		*/
55 /*#define unix		automatically defined by unix C			*/
56 /*#define __TURBOC__	automatically defined by Borland Turbo C	*/
57 /*#define UNKNOWN	unknown compiler				*/
58 /*#define VAX11C	automatically defined by DEC VAX-11 C		*/
59 /*#define AMIGA		automatically defined by SAS Institute C	*/
60 /*#define EMX       defined for OS/2, GCC/EMX compiler */
61 /*#define WIN32     defined for Borland, 32 bit windows version */
62 
63 /*****************************************************************************
64 	There are three things which can be enabled during debugging:
65 
66 	CHECKSUM_CODE (under Turbo C only) will verify at run-time that
67 code isn't being corrupted by stray pointers.
68 
69 	CONSISTENCY_CHECKING will check various pointers after each command
70 is executed and verify that they are "consistent"; for example, that edit
71 buffer pointers point into the edit buffer and not elsewhere.
72 
73 	DEBUGGING enables code included at the entry and exit of every
74 function so a "function trace" can be displayed.  The unused TECO command
75 ^P sets the level of detail which is displayed by the debugging routines
76 in TECOC.C.
77 *****************************************************************************/
78 
79 #ifndef CHECKSUM_CODE			/* if not defined on command line */
80 #define CHECKSUM_CODE (FALSE && defined(__TURBOC__))
81 #endif
82 #ifndef CONSISTENCY_CHECKING		/* if not defined on command line */
83 #define CONSISTENCY_CHECKING FALSE	/* check pointer consistency */
84 #endif
85 #ifndef DEBUGGING			/* if not defined on command line */
86 #define DEBUGGING FALSE			/* compile debugging code */
87 #endif
88 
89 /*****************************************************************************
90 	Determine what memory model we're running under Turbo C and set
91 whether we have small (near, 64K) or large (far, 1MB) code and data
92 references.
93 *****************************************************************************/
94 
95 #if defined(__TURBOC__)&&!defined(WIN32)
96 
97 #define TC_SMALL_DATA (defined(__SMALL__) || defined(__MEDIUM__))
98 #define TC_SMALL_CODE (defined(__SMALL__) || defined(__COMPACT__))
99 
100 #if DEBUGGING && TC_SMALL_CODE
101 /* GNU C objects to this #error directive even though it should skip it? */
102 /* redefining main() should stop the compiler */
103 /* #error DEBUGGING=TRUE needs large code model */
main()104 main() {}
105 #endif
106 
107 #else
108 
109 #define TC_SMALL_DATA FALSE
110 #define TC_SMALL_CODE FALSE
111 
112 #endif
113 
114 /*****************************************************************************
115 	The debugging code uses the standard library so we need to get
116 prototypes for the standard functions.  When not debugging, the only TECO-C
117 functions which need the standard library are in the Z*.C system-specific
118 code files which explicitly #include these header files.
119 *****************************************************************************/
120 
121 #if (CHECKSUM_CODE || CONSISTENCY_CHECKING || DEBUGGING)
122 #if defined(unix)
123 extern int printf();
124 /*extern int sprintf();*/
125 extern int puts();
126 #else
127 #include <stdio.h>
128 #include <stdlib.h>
129 #include <string.h>
130 #endif
131 #endif
132 
133 /*****************************************************************************
134 	Define VIDEO,  which compiles in some kind of video code,  even if
135 it's just stubs.  Define CURSES to get video support.  Note that the CURSES
136 is checked in some files before this file is included,  so it HAS to be
137 defined on the command line.
138 *****************************************************************************/
139 
140 #ifdef CURSES			/* if CURSES is defined on command line */
141 #define VIDEO TRUE
142 #else
143 #define CURSES FALSE
144 #ifndef VIDEO			/* if VIDEO is not defined on command line */
145 #define VIDEO FALSE
146 #endif
147 #endif
148 
149 /****************************************************************************
150 	The brain-damaged memory addressing of the IBM PC requires that all
151 character pointers used in TECO-C be "huge" pointers.  "Huge" pointers are
152 like "far" pointers in that they are 32-bits (a 16-bit SEGMENT and a 16-bit
153 OFFSET); however, when you do far pointer arithmetic, only the OFFSET is
154 affected so adding to a far pointer eventually causes the OFFSET to wrap
155 around to zero.  When you do huge pointer arithmetic, both the OFFSET and
156 the SEGMENT are properly updated.  Huge pointers are also normalized so
157 pointer comparisons work correctly.  For these reasons, all pointers
158 are declared using the following typedefs,  which are special on PCs.
159 ****************************************************************************/
160 
161 #if (defined(__TURBOC__) && !TC_SMALL_DATA && !defined(WIN32)) || defined(__POWERC)
162 #define _Huge huge
163 #else
164 #define _Huge /**/
165 #endif
166 
167 typedef unsigned char _Huge *	charptr;
168 #if defined(unix)
169 typedef unsigned char *		voidptr;
170 #else
171 typedef void _Huge *		voidptr;
172 #endif
173 typedef struct EStck _Huge *	ESptr;
174 typedef struct MStck _Huge *	MSptr;
175 typedef struct QReg  _Huge *	QRptr;
176 
177 #undef _Huge
178 
179 /****************************************************************************
180 	Some compilers allow function prototypes to be defined for functions
181 even when the function declarations aren't written in prototype form.  This
182 allows checking of function calls for correctness,  but doesn't guarantee
183 that prototypes and declarations match.  I choose to leave the actual
184 function declarations in non-prototype form,  so they work with older
185 compilers.  Defining USE_PROTOTYPES to TRUE causes prototypes to be defined
186 in TECOC.H for all functions.  Defining it FALSE causes old-style definitions
187 in TECOC.H.
188 	GNU C is one of the compilers that forces consistency:  if you use
189 prototypes,  then declarations have to match the prototypes.  The only way
190 I can do this in TECOC code is to surround each function declarations with
191 "#if USE_PROTOTYPES...#else...#endif" directives.  This looks hideous, so I
192 just don't use prototypes in GNU C.
193 ****************************************************************************/
194 
195 #if defined(VAX11C) || defined(__TURBOC__) || defined(__POWERC) || defined(ULTRIX)
196 #define USE_PROTOTYPES TRUE
197 #else
198 #define USE_PROTOTYPES FALSE
199 #endif
200 
201 /****************************************************************************
202 	ANSI C compilers are supposed to concatenate adjacent string literals
203 in source code.  If they do,  a superior form of the command-line parsing
204 macro (in CLPARS.H, used by ZPrsCL), is used.  If not,  a klunkier form needs
205 to be used.
206 	Note:  The clpars[] string is over 3 Kbytes long, so in addition to
207 supporting string concatenation, the compiler must support long strings.  The
208 Power C v1.3.0 compiler, for example, supports ANSI string concatenation, but
209 does not like the 3 Kbyte clpars[] string.
210 ****************************************************************************/
211 
212 #if defined(__TURBOC__) || defined(__GNUC__)
213 #define USE_ANSI_CLPARS TRUE
214 #else
215 #define USE_ANSI_CLPARS FALSE
216 #endif
217 
218 /*****************************************************************************
219 	Define ptrdiff_t (the type of things that can hold the result when
220 one pointer is subtracted from another), size_t (the size of memory objects
221 and repeat counts), and NULL.
222 *****************************************************************************/
223 
224 #if defined(unix) || defined(UNKNOWN) || defined(AMIGA) && !defined(ULTRIX)
225 
226 #if sun
227 #ifdef SUNOS4_0
228 typedef int	ptrdiff_t;	/* not in /sys/types.h yet */
229 #endif
230 #include <sys/types.h>		/* size_t (and maybe ptrdiff_t) */
231 #else /* sun */
232 #ifdef LINUX
233 #include <stddef.h>
234 #else
235 typedef int	ptrdiff_t;
236 typedef ULONG	size_t;
237 #endif
238 #endif /* sun */
239 
240 #ifdef AMIGA
241 #define NULL 0L
242 #else
243 #ifdef LINUX
244 #ifndef NULL
245 #define NULL (void *)0
246 #endif
247 #else
248 #define NULL 0
249 #endif
250 #endif
251 
252 #else
253 #include <stddef.h>		/* define ptrdiff_t, size_t and NULL */
254 #endif
255 
256 /*****************************************************************************
257 	Define SIZE_T,  which on most machines will be the same as size_t.
258 There are problems (as usual) on the IBM PC.  In various places,  TECO-C
259 subtracts two pointers and puts the resulting value in a variable of type
260 SIZE_T.  Under Turbo C,  size_t is 16 bits,  which won't work,  so we
261 use unsigned long for SIZE_T for TURBO C.
262 *****************************************************************************/
263 
264 #if (defined(__TURBOC__) && !TC_SMALL_DATA && !defined(WIN32)) || defined(__POWERC)
265 typedef ULONG SIZE_T;		/* PCs suck */
266 #elif defined(unix)
267 typedef unsigned int SIZE_T;	/* override their size_t, which is "int" */
268 #else
269 typedef size_t SIZE_T;		/* use size_t as defined above */
270 #endif
271 
272 /*****************************************************************************
273 	The values of the following identifiers are system-dependent.
274 
275 EXTERN	usually "extern",  this identifier lets the more useful keyword
276 	"globalref" be used to define an external variable in VAX C.
277 GLOBAL	used for the single definition of a variable.  This identifier
278 	allows the use of the keyword "globaldef" in VAX C.
279 EXTERNV used only for GotCtC, this means "extern volatile" for compilers that
280 	support the "volatile" keyword.
281 GLOBALV used only for GotCtC, this means "volatile" for compilers that
282 	support the "volatile" keyword.
283 VVOID	if the compiler supports the keyword "void",  then this should be
284 	defined as such,  else it should be meaningless.  It would be nice
285 	to use "VOID" instead of "VVOID",  but the damn curses.h file defines
286 	"VOID".
287 
288 EBFEXP	amount by which the edit buffer is expanded each time the user tries
289 	to insert too much text.
290 EBFINIT	initial size of the edit buffer.  This value is added to IBFINIT
291 	to create a value used to initially allocate both buffers.
292 ERBFSIZ Size of error message buffer.  A missing tag message for a bad Otag$
293 	command might be long...
294 GAPMIN	minimum size of the edit buffer gap.  This value should be set such
295 	that there's enough room to hold the text of the largest expected
296 	insertion command.
297 IBFEXP	amount by which the input buffer is expanded each time it becomes
298 	too small for a reasonable-length line (IBFMIN) to be read.
299 IBFINIT	initial size of the input buffer.  This value is added to EBFINIT
300 	to create a value used to initially allocate both buffers.
301 IBFMIN	minimum size of the input buffer.  This value is checked before each
302 	read operation.
303 NIFDBS	number of input file data blocks.  This should be 3 plus the
304 	number of levels that EI files may be nested.  8 is a good number.
305 SBFINIT	size of search string buffer
306 TBFINIT	size of tag buffer for O command, max size of label to search for
307 ZBFEXP	amount by which the EI file buffer is expanded when there are less
308 	than ZBFMIN bytes left in the buffer.
309 ZBFINIT	initial size of the file buffer used to read in a macro executed by
310 	an "EIfilespec$$" command.
311 ZBFMIN	minimum size of the EI file buffer before it is expanded.
312 *****************************************************************************/
313 
314 #if defined(VAX11C)
315 
316 #define EXTERN	globalref	/* to reference an external symbol */
317 #define GLOBAL	globaldef	/* to define an external symbol */
318 #define EXTERNV	extern volatile	/* to reference an external volatile symbol */
319 #define GLOBALV	volatile	/* to define an external volatile symbol */
320 #define VVOID	void		/* Void function return */
321 
322 #define CBFINIT		20000	/* command buffer initial size */
323 #define EBFEXP		64000	/* edit buffer expansion value */
324 #define EBFINIT		64000	/* edit buffer initial size */
325 #define ERBFSIZ		1024	/* error message buffer */
326 #define GAPMIN		64000	/* edit buffer gap minimum size */
327 #define IBFEXP		64000	/* input buffer expansion size */
328 #define IBFINIT		64000	/* input buffer initial size */
329 #define IBFMIN		10000	/* input buffer minimum size */
330 #define NIFDBS		8	/* number of input file data blocks */
331 #define SBFINIT		1000	/* size of search string buffer */
332 #define TBFINIT		1000	/* size of tag buffer for O command */
333 #define WBFINIT		1000	/* batch input and output buffer size */
334 #define ZBFEXP		64000	/* EI file buffer expansion value */
335 #define ZBFINIT		64000	/* EI file buffer initial size */
336 #define ZBFMIN		1000	/* EI file buffer minimum size */
337 
338 #define EXS_SIZE	64	/* size of expression stack */
339 #define LPS_SIZE	32	/* size of loop stack */
340 #define MCS_SIZE	32	/* size of macro stack */
341 #define QRS_SIZE	32	/* size of q-register stack */
342 
343 #elif defined(__TURBOC__) || defined(__POWERC) || defined(unix) || defined(AMIGA)
344 
345 #define EXTERN	extern		/* to reference an external symbol */
346 #define GLOBAL	/**/		/* to define an external symbol */
347 #if defined(AMIGA) || defined(unix) && !defined(__GNUC__)
348 #define EXTERNV	extern		/* to reference an external volatile symbol */
349 #define GLOBALV	/**/		/* to define an external volatile symbol */
350 #else
351 #define EXTERNV	extern volatile	/* to reference an external volatile symbol */
352 #define GLOBALV	volatile	/* to define an external volatile symbol */
353 #endif
354 
355 #if defined(__TURBOC__) || defined(__POWERC) || defined(__GNUC__) || defined(AMIGA)
356 #define VVOID		void	/* Void function return */
357 #else
358 #define VVOID		/**/	/* Void function return */
359 #endif
360 
361 #if TC_SMALL_DATA
362 
363 /*
364  * with the DEBUGGING #define off, Turbo C can compile teco-c for the small
365  * data model which is sometimes easier to debug.  use "make -DMODEL=s or m".
366  *
367  * define smaller buffer sizes
368  */
369 
370 #define CBFINIT		100	/* command buffer initial size */
371 #define EBFEXP		1000	/* edit buffer expansion value */
372 #define EBFINIT		8000	/* edit buffer initial size */
373 #define ERBFSIZ		100	/* error message buffer */
374 #define GAPMIN		1000	/* edit buffer gap minimum size */
375 #define IBFEXP		1000	/* input buffer expansion size */
376 #define IBFINIT		8000	/* input buffer initial size */
377 #define IBFMIN		1000	/* input buffer minimum size */
378 #define NIFDBS		6	/* number of input file data blocks */
379 #define SBFINIT		100	/* size of search string buffer */
380 #define TBFINIT		100	/* size of tag buffer for O command */
381 #define ZBFEXP		1000	/* EI file buffer expansion value */
382 #define ZBFINIT		8000	/* EI file buffer initial size */
383 #define ZBFMIN		1000	/* EI file buffer minimum size */
384 
385 /*
386  * define far heap management calls used in ZMSDOS.C in terms of
387  * near heap functions.
388  */
389 
390 #define farfree(p) free(p)
391 #define farmalloc(ul) malloc((unsigned int)ul)
392 #define farrealloc(p,ul) realloc((p),((unsigned int)ul))
393 
394 #else
395 
396 #define CBFINIT		20000	/* command buffer initial size */
397 #define EBFEXP		64000L	/* edit buffer expansion value */
398 #define EBFINIT		64000L	/* edit buffer initial size */
399 #define ERBFSIZ		128	/* error message buffer */
400 #define GAPMIN		64000L	/* edit buffer gap minimum size */
401 #define IBFEXP		64000L	/* input buffer expansion size */
402 #define IBFINIT		64000L	/* input buffer initial size */
403 #define IBFMIN		1000	/* input buffer minimum size */
404 #define NIFDBS		8	/* number of input file data blocks */
405 #define SBFINIT		1000	/* size of search string buffer */
406 #define TBFINIT		1000	/* size of tag buffer for O command */
407 #define ZBFEXP		8000	/* EI file buffer expansion value */
408 #define ZBFINIT		16000	/* EI file buffer initial size */
409 #define ZBFMIN		1000	/* EI file buffer minimum size */
410 
411 #ifdef WIN32
412 /*
413  * define far heap management calls used in ZMSDOS.C in terms of
414  * near heap functions.
415  */
416 
417 #undef farfree
418 #undef farmalloc
419 #undef farrealloc
420 
421 #define farfree(p) free(p)
422 #define farmalloc(ul) malloc((unsigned int)ul)
423 #define farrealloc(p,ul) realloc((p),((unsigned int)ul))
424 #endif
425 
426 #endif
427 
428 #define EXS_SIZE	64	/* size of expression stack */
429 #define LPS_SIZE	32	/* size of loop stack */
430 #define MCS_SIZE	32	/* size of macro stack */
431 #define QRS_SIZE	32	/* size of q-register stack */
432 
433 #elif defined(EMX)
434 
435 #define EXTERN	extern		/* to reference an external symbol */
436 #define GLOBAL	/**/		/* to define an external symbol */
437 #define EXTERNV	extern volatile	/* to reference an external volatile symbol */
438 #define GLOBALV	volatile	/* to define an external volatile symbol */
439 #define VVOID	void		/* Void function return */
440 
441 #define CBFINIT		20000	/* command buffer initial size */
442 #define EBFEXP		64000	/* edit buffer expansion value */
443 #define EBFINIT		64000	/* edit buffer initial size */
444 #define ERBFSIZ		128		/* error message buffer */
445 #define GAPMIN		64000	/* edit buffer gap minimum size */
446 #define IBFEXP		64000	/* input buffer expansion size */
447 #define IBFINIT		64000	/* input buffer initial size */
448 #define IBFMIN		1000	/* input buffer minimum size */
449 #define NIFDBS		8		/* number of input file data blocks */
450 #define SBFINIT		1000	/* size of search string buffer */
451 #define TBFINIT		1000	/* size of tag buffer for O command */
452 #define ZBFEXP		8000	/* EI file buffer expansion value */
453 #define ZBFINIT		16000	/* EI file buffer initial size */
454 #define ZBFMIN		1000	/* EI file buffer minimum size */
455 
456 #define EXS_SIZE	64	/* size of expression stack */
457 #define LPS_SIZE	32	/* size of loop stack */
458 #define MCS_SIZE	32	/* size of macro stack */
459 #define QRS_SIZE	32	/* size of q-register stack */
460 
461 #elif defined(UNKNOWN)
462 
463 #define EXTERN	extern		/* to reference an external symbol */
464 #define GLOBAL	/**/		/* to define an external symbol */
465 #define EXTERNV	extern volatile	/* to reference an external volatile symbol */
466 #define GLOBALV	volatile	/* to define an external volatile symbol */
467 #define VVOID	void		/* Void function return */
468 
469 #define CBFINIT		100	/* command buffer initial size */
470 #define EBFEXP		100	/* edit buffer expansion value */
471 #define EBFINIT		100	/* edit buffer initial size */
472 #define ERBFSIZ		100	/* error message buffer */
473 #define GAPMIN		100	/* edit buffer gap minimum size */
474 #define IBFEXP		100	/* input buffer expansion size */
475 #define IBFINIT		100	/* input buffer initial size */
476 #define IBFMIN		100	/* input buffer minimum size */
477 #define NIFDBS		4	/* number of input file data blocks */
478 #define SBFINIT		100	/* size of search string buffer */
479 #define TBFINIT		100	/* size of tag buffer for O command */
480 #define ZBFEXP		100	/* EI file buffer expansion value */
481 #define ZBFINIT		100	/* EI file buffer initial size */
482 #define ZBFMIN		100	/* EI file buffer minimum size */
483 
484 #define EXS_SIZE	5	/* size of expression stack */
485 #define LPS_SIZE	5	/* size of loop stack */
486 #define MCS_SIZE	5	/* size of macro stack */
487 #define QRS_SIZE	5	/* size of q-register stack */
488 
489 #endif
490 
491 /*****************************************************************************
492 	Define ZCHKKB, a macro that does a keyboard check under MS-DOS to keep
493 the Control-Break (Control-C) handler happy.  Under MS-DOS a Control-C isn't
494 checked for until you make a DOS call to the keyboard, screen, or printer.
495 To make loops Control-C'able in ExeCSt we make a call to ZCHKKB before
496 checking GotCtC so that if a Control-C was pressed in a TECO-C loop which
497 doesn't make an explicit DOS call, ZCHKKB makes a no-op DOS call, which
498 allows GotCtC to be set correctly.
499 
500 	Should we use Turbo C's setcbrk to make sure BREAK is on ???
501 
502 	Under other operating systems, ZCHKKB() expands to nothing.
503 *****************************************************************************/
504 
505 #if defined(__TURBOC__)
506 #include <conio.h>			/* kbhit() prototype */
507 #define ZCHKKB() ((void)kbhit())	/* check keyboard */
508 #else
509 #define ZCHKKB() /**/			/* expand to nothing */
510 #endif
511 
512 /*****************************************************************************
513 	Define ZMKOFN, a macro called only by ExeEB.  It's needed because the
514 semicolon and file version number have to be stripped off of the end of the
515 fully expanded file name that's in FBf before we can call ZOpOut.
516 *****************************************************************************/
517 
518 #if defined(VAX11C)
519 #define ZMKOFN() do { FBfPtr--;} while (*FBfPtr != ';');
520 #else
521 #define ZMKOFN() /**/		/* expand to nothing */
522 #endif
523 
524 /*****************************************************************************
525 	Define MEMMOVE,  a macro that copies "len" bytes from "source" to
526 "dest" correctly,  even if "source" and "dest" overlap.  In most cases,  this
527 maps to the ANSI C function "memmove".  If it doesn't,  there's C code that
528 does the job in function ZCpyBl,  which is in the Z*.C system-specific code
529 files.
530 *****************************************************************************/
531 
532 #if defined(sun)
533 
534 EXTERN VVOID bcopy();
535 #define MEMMOVE(dest,source,len) bcopy((source),(dest),(len))
536 
537 #elif defined(unix) || defined(AMIGA) || (defined(UNKNOWN) && !defined(__STDC__))
538 
539 EXTERN VVOID ZCpyBl();
540 #define MEMMOVE(dest,source,len) ZCpyBl((dest),(source),(len))
541 
542 #elif defined(__TURBOC__) || defined(__POWERC)
543 
544 EXTERN VVOID ZCpyBl(charptr dest, charptr source, SIZE_T len);
545 #define MEMMOVE(dest,source,len) ZCpyBl((dest),(source),(len))
546 
547 #else
548 
549 #define MEMMOVE(dest,source,len) memmove((dest),(source),(len))
550 
551 #endif
552 
553 /*****************************************************************************
554 	Define EXIT_SUCCESS and EXIT_FAILURE
555 *****************************************************************************/
556 
557 #ifndef EXIT_SUCCESS
558 #define EXIT_SUCCESS 0
559 #endif
560 
561 #ifndef EXIT_FAILURE
562 #define EXIT_FAILURE 1
563 #endif
564 
565 /*****************************************************************************
566 	Define FILENAME_MAX, which is used in Init() and in the Z*.C files.
567 This is the maximum size of a filename.  It's supposed to be defined in
568 stdio.h by ANSI C compilers,  but some compilers don't.
569 
570 	In VAX C v3.0, STDIO.H defines FILENAME_MAX as 39,  which is the
571 length of only the name part of a full file specification.  I'm not sure what
572 use this is to anybody,  because most VAX file names include a file type,  if
573 not a version number, directory specification or node specification.  So if
574 we're on a VAX,  we override stdio's definition with the right one here.
575 *****************************************************************************/
576 
577 #if defined(unix)
578 
579 #ifndef FILENAME_MAX
580 #define FILENAME_MAX 64
581 #endif
582 
583 #elif defined(VAX11C)
584 
585 #undef FILENAME_MAX			/* undefine stdio.h's definition */
586 #include nam
587 #define FILENAME_MAX NAM$C_MAXRSS	/* and define the correct one */
588 
589 #elif defined(__TURBOC__) || defined(__POWERC)
590 
591 #ifndef FILENAME_MAX
592 #define FILENAME_MAX 80			/* MAXPATH */
593 #endif
594 
595 #elif defined(AMIGA)
596 /*
597  * This is filesystem dependent on the Amiga, and there is no real good
598  * way to get at it. This value is true for FileSystem and FastFileSystem,
599  * but probably isn't for other things (like mounted MS-DOS partitions...)
600  */
601 #define FILENAME_MAX 255
602 
603 #elif defined(UNKNOWN)
604 
605 #define FILENAME_MAX 20
606 
607 #endif
608 
609 /*****************************************************************************
610 	When compiling with Turbo C set to use smaller and faster Pascal
611 function calling sequences (tcc -p), main() in TECOC.C and CntrlC() in
612 ZMSDOS.C have to be specifically declared as C functions.  The _Cdecl
613 #define in STDDEF.H takes care of this for Turbo.  Define it as nothing
614 for everyone else.
615 *****************************************************************************/
616 
617 #if !defined(_Cdecl)
618 #define _Cdecl /**/
619 #endif
620 
621 
622 /*****************************************************************************
623 	Bit masks for EZ mode control flag.  These are system-dependent.
624 *****************************************************************************/
625 
626 #if defined(unix)
627 #define EZ_NO_VER	  1	/* do not do VMS style versions */
628 #define EZ_ARROW	  8	/* */
629 #define EZ_AUDIO_BEEP	  16	/* (CURSES only) on = beep , off = flash */
630 #define EZ_WIN_LINE	  32	/* (CURSES only) line between windows */
631 #define EZ_FF		  128	/* do not stop read on FF */
632 #define EZ_UNIXNL	  256	/* use Unix-style newline terminators */
633 #define EZ_VT100GRAPHICS  512
634 #define EZ_BTEE		  2048	/* use BTEE instead of DIAMOND */
635 #define EZ_INVCR	  8192	/* don't show CR in scope - closer to */
636 				/* TECO-11, but really not as good in */
637 				/* my opinion (Mark Henderson) */
638 #if defined(LINUX)
639 #define EZ_NO_STRIP    16384 /* Don't strip the extension */
640 #endif
641 #elif defined(AMIGA)
642 #define EZ_FF		128	/* do not stop read on FF */
643 #define EZ_UNIXNL	256	/* use Unix-style newline terminators */
644 #endif
645