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