Annotation of freem/src/mpsdef.h, revision 1.3
1.1 snw 1: /*
2: * *
3: * * *
4: * * *
5: * ***************
6: * * * * *
7: * * MUMPS *
8: * * * * *
9: * ***************
10: * * *
11: * * *
12: * *
13: *
14: * mpsdef.h
15: * common external definitions for all mumps modules
16: *
17: *
1.3 ! snw 18: * Author: Serena Willis <snw@coherent-logic.com>
1.1 snw 19: * Copyright (C) 1998 MUG Deutschland
20: * Copyright (C) 2020, 2023 Coherent Logic Development LLC
21: *
22: *
23: * This file is part of FreeM.
24: *
25: * FreeM is free software: you can redistribute it and/or modify
26: * it under the terms of the GNU Affero Public License as published by
27: * the Free Software Foundation, either version 3 of the License, or
28: * (at your option) any later version.
29: *
30: * FreeM is distributed in the hope that it will be useful,
31: * but WITHOUT ANY WARRANTY; without even the implied warranty of
32: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33: * GNU Affero Public License for more details.
34: *
35: * You should have received a copy of the GNU Affero Public License
36: * along with FreeM. If not, see <https://www.gnu.org/licenses/>.
37: *
38: **/
39:
40: #include <stdio.h>
41: #include <setjmp.h>
42: #include <signal.h>
43: #include <float.h>
44:
45: #if !defined(DBL_DIG)
46: # define DBL_DIG 15
47: #endif
48:
49: /* constants definition module */
50: #include "mpsdef0.h"
51:
52: #if defined(HAVE_MWAPI_MOTIF)
53: # include <Xm/Xm.h>
54: extern XtAppContext mwapi_context;
55: #endif
56:
57: /* c-global variables as external definitions */
58:
59: /* NOTE: this is a constant if SYSFIVE is undefined (in mumps.c) */
60: /* needs to be resolved: djw 3/15/99 */
61: #ifdef SYSFIVE
62: extern long FreeM_timezone; /* time zone */
63: #endif
64:
65: extern short run_daemon;
66: extern short nofork;
67: extern char *pid_file_path;
68: extern int pid_fd;
69:
70: /* USING and WITH */
71: extern char i_using[STRLEN];
72: extern char i_with[STRLEN];
73:
74: extern int errno; /* external error code for systemcalls */
75:
76: extern int m_argc; /* arguments count */
77: extern char **m_argv; /* arguments string */
78: extern char **m_envp; /* environment pointer */
79:
80: extern short frm_throw_all_errors; /* allow non-U errors to be raised by setting $ECODE */
81:
82: extern union four_fl {
83: long unsigned all;
84: char one[4];
85: } glvnflag; /* [0] unique name chars 0=no limit */
86:
87: /* [1] case sensitivity flag 0=sensitive */
88: /* [2] max. name+subscripts 0=no limit */
89: /* [3] max. length of a subscript 0=no limit */
90: extern int libflag; /* are we running as library? */
91: extern int lonelyflag; /* single user flag */
92: extern int lowerflag; /* lowercase everywhere flag */
93: extern int killerflag; /* SIGTERM handling flag */
94: extern int huperflag; /* SIGHUP handling flag */
95: extern int s_fun_flag; /* VIEW 70: ZSORT/ZSYNTAX flag */
96: extern int n_fun_flag; /* VIEW 71: ZNEXT/ZNAME flag */
97: extern int p_fun_flag; /* VIEW 72: ZPREVIOUS/ZPIECE flag */
98: extern int d_fun_flag; /* VIEW 73: ZDATE/ZDATA flag */
99: extern int zjobflag; /* VIEW 79: old ZJOB vs. new ZJOB flag */
100: extern int eightbit; /* VIEW 80: 7 vs. 8 bit flag */
101: extern int PF1flag; /* VIEW 81: PF1 flag */
102: extern int ordercounter; /* VIEW 82: order counter */
103: extern int etxtflag; /* VIEW 83: text in $ZE flag */
104: extern char lvndefault[256]; /* VIEW 89: UNDEF lvn default */
105: extern char gvndefault[256]; /* VIEW 90: UNDEF gvn default */
106: extern char exfdefault[256]; /* VIEW 91: missig QUIT expr default */
107: extern int typemmflag; /* VIEW 92: DEM2EUR: type mismatch error */
108: extern int namespace; /* VIEW 200: namespace index */
109: extern int config; /* VIEW 201: configuration index */
110: extern char WHR[12][4]; /* names of currencies */
111: extern char EUR2WHR[12][9]; /* conversion factors EUR to ... */
112:
113: extern char glo_prefix[MONTH_LEN]; /* VIEW 96: global prefix */
114: extern char glo_ext[MONTH_LEN]; /* VIEW 97: global postfix */
115: extern char rou_ext[MONTH_LEN]; /* VIEW 98: routine extention */
116: extern long tzoffset; /* VIEW 99: timer offset */
117: extern int v100; /* VIEW 100: return value of kill */
118: extern char l_o_val[256]; /* VIEW 110: local $o/$q data value */
119: extern char g_o_val[256]; /* VIEW 111: global $o/$q data value */
120: extern int zsavestrategy; /* VIEW 133: remember ZLOAD directory on ZSAVE */
121: extern long v93; /* VIEW 93: zkey prod. default */
122: extern char v93a[NO_V93][256]; /* VIEW 93: production rules */
123:
124: extern struct vtstyp *screen; /* active screen */
125: extern short jour_flag; /* journal flag 0/1/-1 */
126:
127: /* trace variables for global.c */
128: extern unsigned long traceblk[TRLIM]; /* trace stack - block numbers */
129: extern short traceadr[TRLIM]; /* - status */
130: extern short trx; /* - stack pointer */
131: extern char compactkey[256]; /* internal form of key in global.c */
132:
133: extern short mcmnd; /* mumps command letter */
134: extern short arg; /* stack pointer (expr.c) */
135: extern char *argstck[PARDEPTH + 1]; /* stack of pointers to */
136:
137: /* intermediate results */
138:
139: extern long ordercnt; /* repeater for $order/$query */
140: extern short setpiece; /* =1 set$piece executing */
141: extern short setop; /* SET op flag */
142: extern char rou_name[]; /* $T(+0)/$ZN routine name */
143: extern char *namstck; /* routine name stack */
144: extern char *namptr; /* routine name stack pointer */
145: extern char *framstck; /* DO_frame stack */
146: extern char *dofrmptr; /* DO_frame stack pointer */
147: extern char zb[40]; /* $ZB last ESC_sequence */
148: extern char zerror[]; /* $ZERROR last error */
149: extern char ztrap[NESTLEVLS + 2][ZTLEN]; /* $ZTRAP to be xecuted on error */
150: extern short DSM2err; /* enable normal error processing */
151: extern short nesterr; /* nesterr and callerr contain info */
152: extern char callerr[NESTLEVLS + 1][40]; /* about call situation at error */
153: extern short zerr; /* $ZE numeric error code */
154:
155: extern char stack0[];
156:
157: extern char zmc[]; /* $ZMC loadable match 'controls' */
158: extern char zmn[]; /* $ZMN loadable match 'numeric' */
159: extern char zmp[]; /* $ZMP loadable match 'punctuation' */
160: extern char zml[]; /* $ZML loadable match 'lowercase' */
161: extern char zmu[]; /* $ZMU loadable match 'uppercase' */
162:
163:
164: extern char zloc[256]; /* $ZL last local reference */
165: extern char zref[256]; /* $ZR last global reference */
166: extern short nakoffs; /* offset to naked reference */
167: extern char zfunkey[44][FUNLEN]; /* $ZF function key */
168: extern short xpos[MAXDEV + 1]; /* $X-vector */
169: extern short ypos[MAXDEV + 1]; /* $Y-vector */
170: extern short crlf[MAXDEV + 1]; /* CR/LF flag vector */
171: extern short fm_nodelay[MAXDEV + 1]; /* nodelay flag vector */
172: extern int SIflag[MAXDEV + 1]; /* SI/SO flag */
173: extern int ESCflag[MAXDEV + 1]; /* ESC flag */
174: extern short RightMargin; /* Output Margin. Default no */
175:
176: /* automatic CR/LF */
177: extern short InFieldLen; /* Input Field length Def: 255 char */
178: extern long DSW; /* Device Status word (Terminal) */
179: extern char LineTerm[]; /* Input Line Terminator chars */
180: extern char BrkKey; /* <INTERRUPT> key Def: CTRL/C */
181: extern char ug_buf[MAXDEV + 1][256]; /* ungetc-buffers */
182: extern char devopen[MAXDEV + 1]; /* 0 not open */
183:
184: /* 'r' input */
185: /* 'w' or 'a' output */
186:
187:
188: extern short fp_mode; /* 0 = fixed, 1 = IEEE 754 */
189: extern short en_revstrf; /* if 1, reverse $E, $P, $N enabled */
190:
191: typedef struct frm_devstat {
192: short mdc_err;
193: short frm_err;
194: char err_txt[80];
195: } frm_devstat;
196:
197: extern frm_devstat devstat[MAXDEV + 1]; /* device error statuses */
198:
199: extern char dev[MAXDEV + 1][40]; /* names of IO devices */
200:
201: extern char G0I[MAXDEV + 1][257]; /* G0 input translation table */
202: extern char G0O[MAXDEV + 1][257]; /* G0 output translation table */
203: extern char G1I[MAXDEV + 1][257]; /* G1 input translation table */
204: extern char G1O[MAXDEV + 1][257]; /* G1 output translation table */
205:
206: extern FILE *opnfile[];
207: extern char sq_modes[MAXDEV + 1];
208: extern char act_oucpath[MAXDEV + 1][40]; /* actual path of currently used device */
209:
210: extern short olddes[NO_GLOBLS]; /* filedescr of open global files */
211: extern char oldfil[NO_GLOBLS][1024]; /* names of open global files */
212: extern short usage[NO_GLOBLS]; /* usage count of global files */
213: extern long g_ages[NO_GLOBLS]; /* last access of global files */
214: extern short inuse; /* file in use */
215:
216: extern int lio_mode;
217: extern short io; /* $IO */
218: extern short test; /* $TEST */
219: extern short pattrnflag; /* incomplete match flag */
220: extern char pattrnchar; /* incomplete match flag supplement */
221: extern int zsystem; /* $ZSYSTEM return status of UNIX call */
222: extern short zcc; /* $ZC (ControlC-Flag) */
223: extern char *rouptr; /* pointer to begin of routine */
224: extern char *roucur; /* cursor into routine */
225: extern char *rouend; /* pointer to end of pgm */
226: extern char *rouins; /* pointer for direct mode insert */
227:
228: extern short breakon; /* BREAK enable/disable-flag */
229: extern short zbreakon; /* ZBREAK enable/disable-flag */
230: extern short zbflag; /* 'ZBREAK from terminal'-flag */
231: extern short zprecise; /* $ZPRECICION of arithmetic */
232: extern char fp_conversion[10]; /* sprintf conversion constant for ieee754 support */
233: extern long nrandom; /* random number */
234: extern long ran_a; /* random number parameter a */
235: extern long ran_b; /* random number parameter b */
236: extern long ran_c; /* random number parameter c */
237: extern short usermode; /* 0=user mode 1=programmer mode */
238: extern int restricted_mode; /* TRUE=restricted mode FALSE=unrestricted mode */
239: extern short demomode; /* 0=no demo 1=demo mode */
240: extern int d0char; /* demomode ouput character */
241: extern int d1char; /* demomode '!' character */
242: extern short cset; /* 0=mumps set 1='C' set flag */
243: extern int hardcopy; /* hardcopy flag */
244: extern int frm_filter; /* filter flag */
245: extern int noclear;
246: extern int standard; /* 1=standard only, */
247: extern int quiet_mode; /* quiet mode */
248: extern char config_file[4096]; /* path to configuration file */
249: extern char shm_env[255]; /* shared memory environment */
250: /* 0=non standard features enabled */
251: extern short ierr;
252: extern short deferred_ierr;
253: extern char err_suppl[255];
254: extern char errmes[MAXERR][ERRLEN]; /* error messages */
255:
256: extern long PSIZE; /* size of 'partition' */
257: extern char *mbpartition;
258: extern char *partition;
259: extern short writing_mb;
260: extern unsigned long alphptr[]; /* pointers into symbol table */
261: extern long symlen; /* 'lower' bound of symbol table */
262: extern char *apartition; /* alternate partition */
263: extern long asymlen; /* 'lower' bound of symbol table */
264: extern unsigned long aalphptr[]; /* pointers into symbol table */
265:
266: extern short autopsize; /* automatic increase of PSIZE */
267: extern long svnlen; /* 'lower' bound of udf_svn_tab */
268: extern long UDFSVSIZ; /* size of userdef special var tab. */
269: extern short autousize; /* automatic increase of UDFSVSIZ */
270: extern char *svntable; /* udf special variable table */
271: extern unsigned long svnaptr[]; /* pointers into udf_svn_tab */
272: extern long NO_OF_RBUF; /* number of routine buffers */
273: extern long PSIZE0; /* size of routine buffers */
274: extern short autorsize; /* automatic increase of PSIZE0 */
275: extern short aliases; /* aliases pointer */
276: extern char ali[]; /* aliases table */
277: extern long v22ptr; /* view 22 aliases pointer */
278: extern char *v22ali; /* view 22 aliases field */
279: extern long v22size; /* current size of aliases field */
280:
281: extern char *buff; /* alternate buffers */
282: extern char code[]; /* currently interpreted code */
283: extern long NSIZE; /* size of newstack */
284: extern char *newstack; /* stack for NEWed variables */
285: extern char *newptr; /* pointer to NEW stack */
286: extern char *newlimit; /* pointer to NEW stack end */
287: extern int errfunlvl; /* avoid wrong error message in $$FUN */
288: extern short nstx; /* nest stack: */
289: extern short nestc[]; /* - command (DO...) */
290: extern char *nestp[]; /* - cmdptr */
291: extern char *nestn[]; /* - namptr */
292: extern long nestr[]; /* - roucur */
293: extern char *nestnew[]; /* - newptr */
294: extern char neste[]; /* - was this frame entered as the result of an error? */
295: extern short repQUIT; /* QUIT repeater */
296:
297: extern char *argptr; /* pointer to beg of tmp storage */
298: extern char *s; /* pointer to symlen_offset */
299: extern char *codptr; /* pointer within code[] */
300: extern char dosave[20]; /* in a FOR range save DO label */
301: extern char *xdosave;
302:
303: extern char varnam[]; /* variable/array/function name */
304: extern char varerr[256]; /* reference in error message */
305: extern char pgms[MAXNO_OF_RBUF + 1][40]; /* names of alt.pgms */
306: extern long ages[]; /* last call to this pgm */
307: extern char *ends[]; /* saved rouend-pointer */
308: extern char path[MAXNO_OF_RBUF][256]; /* directory where routine was loaded */
309: extern rtn_flags rbuf_flags[MAXNO_OF_RBUF]; /* per-routine flags */
310: extern char glopath[PATHLEN]; /* path to access globals */
311: extern char rou0path[PATHLEN]; /* routine access with DO,GOTO,JOB */
312: extern char rou1path[PATHLEN]; /* routine access with ZL,ZS */
313:
314: extern char gloplib[PATHLEN]; /* path to access %globals */
315: extern char rou0plib[PATHLEN]; /* %routine path (DO..) */
316: extern char rou1plib[PATHLEN]; /* %routine path (ZL..) */
317:
318: extern char gbl_u_engine[255]; /* user global engine */
319: extern char gbl_s_engine[255]; /* system global engine */
320: extern char loc_engine[255]; /* local engine */
321:
322: extern unsigned long int bdb_flush_threshold;
323:
324: extern char oucpath[PATHLEN]; /* OPEN/USE/CLOSE path */
325: extern char rgafile[PATHLEN]; /* routine/global access protocol file */
326: extern char zargdefname[PATHLEN]; /* default varname for Zcommands */
327: extern FILE *rgaccess; /* dto. filedes */
328: extern char locktab[PATHLEN]; /* file with LOCKs */
329: extern char zallotab[PATHLEN]; /* file with ZALLOCATE */
330: extern char hcpyfile[PATHLEN]; /* hardcopy file */
331: extern char jourfile[PATHLEN]; /* journal file */
332: extern FILE *jouraccess; /* dto. filedes */
333:
334: extern char curdir[PATHLEN]; /* current directory */
335: extern char startuprou[PATHLEN];
336: extern char zcommds[256]; /* intrinsic z-commands */
337: extern char zfunctions[256]; /* intrinsic z-functions */
338: extern char zsvn[256]; /* intrinsic z-special variables */
339: extern char brkaction[256]; /* action in case of BREAK */
340: extern pid_t father; /* JOB-ID of father process */
341:
342: /* date types parameters */
343: extern char month[NO_DATETYPE][12][MONTH_LEN]; /* month names or numbers */
344: extern char dat1char[NO_DATETYPE][MONTH_LEN]; /* date 1st delimiter */
345: extern char dat2char[NO_DATETYPE][MONTH_LEN]; /* date 2nd delimmiter */
346: extern char dat3char[NO_DATETYPE]; /* date day justify char */
347: extern char dat4flag[NO_DATETYPE]; /* 0=DMY, 1=MDY, 2=YMD */
348: extern char dat5flag[NO_DATETYPE]; /* suppress century digits */
349: extern long int datGRbeg[NO_DATETYPE]; /* first day of gregorian calendar 15-OCT-1582 */
350: extern int datetype; /* type for $zd special variable */
351:
352: extern char tim1char[NO_TIMETYPE]; /* time 1st delimiter */
353: extern char tim2char[NO_TIMETYPE]; /* time 2nd delimiter */
354: extern char tim3char[NO_TIMETYPE]; /* time hour justify char */
355: extern char tim4flag[NO_TIMETYPE]; /* 0=12 Hrs 1=24 Hrs */
356: extern char tim5flag[NO_TIMETYPE]; /* suppress seconds */
357: extern int timetype; /* type for $zt special variable */
358:
359: extern jmp_buf sjbuf; /* on timeout */
360: extern char *roucu0;
361: extern char *dofram0;
362:
363: extern short forx; /* FOR stack pointer */
364: extern char forvar[NESTLEVLS + 1][40], /* FOR variable */
365: forinc[NESTLEVLS + 1][40], /* FOR increment */
366: forpost[NESTLEVLS + 1][128],/* FOR postconditional */
367: forlim[NESTLEVLS + 1][40]; /* FOR limit value */
368: extern short fortyp[NESTLEVLS + 1]; /* 0 = forever 1 = single, */
369:
370: /* 2 = unlim.iter,3 = limit iter. */
371: /* 4 = "" +inc=1 5 = "" + inc=1 */
372: extern short fori[NESTLEVLS + 1]; /* if fortyp=5 length of forlimit */
373:
374: extern char *fvar; /* current forvar */
375: extern char *finc; /* current forinc */
376: extern char *fpost; /* current forpost */
377: extern char *flim; /* current forlim */
378: extern short ftyp; /* current fortyp */
379: extern short fi; /* current fori */
380: extern short forsw; /* FOR switch */
381: extern short argless_forsw_quit; /* QUIT from argumentless FOR */
382: extern short sigint_in_for; /* SIGINT occurred in FOR loop */
383: extern short direct_mode;
384: extern short loadsw; /* flag to avoid redundant loads */
385: extern short extr_types[NESTLEVLS + 1]; /* return types of extrinsic functions */
386:
387: extern char destructors[10][50];
388: extern int destructor_ct;
389: extern char private_keys[MAX_PRIVATE_KEYS][255];
390:
391: /* after XECUTEs */
392: extern short promflag; /* prompt execute flag */
393: extern short privflag; /* extrinsic z-command flag */
394:
395: extern short brkstk[NESTLEVLS + 1]; /* stack for BREAK information */
396:
397: extern char *cmdstack;
398: extern char *cmdptr;
399:
400: extern short offset;
401: extern long frm_timeout;
402: extern short timeoutms;
403: extern char tmp4[80];
404: extern short param; /* parameter count */
405: extern short paramx; /* current parameter */
406: //extern char *calloc ();
407: extern short level; /* level count */
408: extern short nestlt[NESTLEVLS + 1]; /* stack $T / stack levelcount */
409: extern pid_t pid; /* $J = process ID */
410:
411: extern char jour_hostid[256];
412:
413: extern char nsroot[4096]; /* root path of namespace */
414: extern char nsname[256]; /* namespace name */
415: extern char *freem_path; /* path to the running instance of FreeM */
416: extern char history_file[256];
417: extern int n_lines; /* rows in screen */
418: extern int n_columns; /* columns in screen */
419: extern short ipc_pending; /* 1 if an incoming IPC is pending, 0 otherwise */
420:
421: extern int strict_mode;
422: extern short first_process;
423: extern size_t shm_init_size;
424: extern short inrpt_after_async;
425:
426: //#ifndef OLDUNIX
427: // extern struct sigaction act; /* signals stuff */
428: //#endif /* OLDUNIX */
429:
430: /* Macros */
431: /* Create a new variable of type (datatype) with space for qty instances */
432: #define NEW(datatype,qty) ((datatype *)calloc(qty,sizeof(datatype)))
433:
1.2 snw 434: /* End of $Source: /home/cvsroot/freem/src/mpsdef.h,v $ */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>