Annotation of freem/src/mpsdef0.h, revision 1.1
1.1 ! snw 1: /*
! 2: * *
! 3: * * *
! 4: * * *
! 5: * ***************
! 6: * * * * *
! 7: * * MUMPS *
! 8: * * * * *
! 9: * ***************
! 10: * * *
! 11: * * *
! 12: * *
! 13: *
! 14: * mpsdef0.h
! 15: * common constants definitions for all mumps modules
! 16: *
! 17: *
! 18: * Author: Serena Willis <jpw@coherent-logic.com>
! 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:
! 41: #ifdef HAVE_CONFIG_H
! 42: # include <config.h>
! 43: #endif
! 44:
! 45: #ifdef HAVE_WIRINGPI_H
! 46: #define register
! 47: #endif
! 48:
! 49: #include <signal.h>
! 50: #include <stddef.h>
! 51:
! 52: #ifndef MDC_VENDOR_ID
! 53: #define MDC_VENDOR_ID 49
! 54: #endif/*MDC_VENDOR_ID*/
! 55:
! 56: #define byte char
! 57: #define toggle(A) (A^=01)
! 58:
! 59: /* if you do not want to run under SCO-UNIX, put the following in comment */
! 60:
! 61: #define SCO
! 62:
! 63: /* if you want mumps to run under XENIX, put the following in comment */
! 64: #define SYSFIVE
! 65:
! 66: /* if you want mumps to run under LINUX, un-comment the following */
! 67: #define LINUX
! 68:
! 69: /* rlf 01/15/99 If you want to compile under libc-6 (GLIBC), as on */
! 70: /* RedHat Linux >= 5.0, define LINUX_GLIBC. */
! 71: #define LINUX_GLIBC
! 72:
! 73: /* spz 4/19/99 If you want to compile under FreeBSD 2.2.8+, define the */
! 74: /* following line... */
! 75: /*#define FREEBSD */
! 76:
! 77: /* spz 5/24/99 use the new variable stack */
! 78: /* #define NEWSTACK */
! 79: /* #define DEBUG_NEWSTACK */
! 80:
! 81: /* rlf 01/16/99 If you want German error messages, define EM_GERMAN */
! 82: /* If you want English error messages, define EM_ENGLISH */
! 83: #define EM_ENGLISH
! 84:
! 85: /* lmv 1999-05-09 define this if you want to use gmtoff timezone data in */
! 86: /* struct tm instead of tzadj */
! 87: #define USE_GMTOFF
! 88:
! 89: /* lmv 1999-05-09 define this if you want to include sys/time.h */
! 90: #define USE_SYS_TIME_H
! 91:
! 92: /* lmv 1999-05-09 define this if you want to use the gettimeofday function */
! 93: /* instead of the ftime function */
! 94: #define USE_GETTIMEOFDAY
! 95:
! 96:
! 97: /* if you do not want MUMPS to support color terminals, put this in comment */
! 98: #ifdef SCO
! 99: #define COLOR
! 100: #endif /* SCO */
! 101:
! 102: /* if you do not want MUMPS to support automatic DEM <--> EUR conversion, */
! 103: /* put this in comment */
! 104: #define EUR2DEM "1.95583\201"
! 105:
! 106: /* end of line symbol 0201/-127 */
! 107: #define EOL ((char)'\201')
! 108:
! 109: /* end of line symbol 0202/-126/130 */
! 110: #define DELIM ((char)'\202')
! 111:
! 112: /* default size of a 'partition' i.e. intermediate result stack+local vars */
! 113: #define DEFPSIZE 8388608L
! 114:
! 115: /* default size of 'userdefined special variable table' */
! 116: #define DEFUDFSVSIZ 1000
! 117:
! 118: /* default size of the NEW stack */
! 119: #define DEFNSIZE 4096
! 120:
! 121: /* default number & size of alternate routine buffers */
! 122: /* maximum number of routine buffers */
! 123: #define MAXNO_OF_RBUF 128
! 124: #define DEFNO_OF_RBUF 128
! 125: #define DEFPSIZE0 10001
! 126:
! 127: /* number of global files concurrently open */
! 128: #define NO_GLOBLS 6
! 129:
! 130: /* length of global blocks */
! 131: #define BLOCKLEN 1024
! 132:
! 133: /* number of global buffers */
! 134: #define NO_OF_GBUF 6
! 135:
! 136: /* number of DO_FOR_XECUTE levels; i.e. depth of gosub-stack */
! 137: #define NESTLEVLS 80
! 138:
! 139: /* depth of parser stack; each pending operation/argument requires one entry */
! 140: #define PARDEPTH 128
! 141:
! 142: /* pattern match stack; maximum number of pattern atoms */
! 143: #define PATDEPTH 14
! 144:
! 145: /* trace limit in globals module, i.e. trees wo'nt grow to the sky */
! 146: #define TRLIM 32
! 147:
! 148: /* arguments in an ESC_sequence */
! 149: #define ARGS_IN_ESC 5
! 150:
! 151: /* maximum length of a string, 0 <= $L() <= 255 */
! 152: #define STRLEN 65535
! 153:
! 154: /* length of $ZTRAP variable */
! 155: #define ZTLEN 20
! 156:
! 157: /* length of $ZF (function key) variable */
! 158: #define FUNLEN 128
! 159:
! 160: /* length of $V(3)...$V(8) i.e. path names */
! 161: #define PATHLEN 4096
! 162:
! 163: /* length of error message */
! 164: #define ERRLEN 180
! 165:
! 166: /* number of DATE types */
! 167: #define NO_DATETYPE 8
! 168: #define NO_TIMETYPE 2
! 169: #define MONTH_LEN 10
! 170:
! 171: /* object stuff */
! 172: #define MAX_PRIVATE_KEYS 100
! 173: #define MAX_DESTRUCTORS 10
! 174: #define SC_UNCHANGED 0
! 175: #define SC_PUBLIC 1
! 176: #define SC_PRIVATE 2
! 177:
! 178:
! 179: /* number of zkey() production rules */
! 180: #define NO_V93 8
! 181:
! 182: /* depth of CS/CRST (cursor save/restore) stack */
! 183: #define CSLEN 1
! 184:
! 185: /* HOME device: number of lines and columns */
! 186: #define N_LINES 2000
! 187: #define N_COLUMNS 2000
! 188:
! 189: #if !defined(FALSE)
! 190: # define FALSE 0
! 191: #endif
! 192:
! 193: #if !defined(TRUE)
! 194: # define TRUE 1
! 195: #endif
! 196:
! 197: #define DISABLE 0
! 198: #define ENABLE 1
! 199:
! 200: /* parameters for set_io() */
! 201: #define UNIX 0
! 202: #define MUMPS 1
! 203:
! 204: #include "merr.h"
! 205:
! 206: /* HOME = default device */
! 207: #define HOME 0
! 208: /* number of devices/units */
! 209: #define MAXDEV 256
! 210: #define MAXSEQ 99 /* last sequential I/O channel */
! 211: #define FIRSTSCK 100 /* first socket I/O channel */
! 212: #define SCKCNT 155
! 213: #define MAXSCK SCKCNT-1
! 214:
! 215: /* if tab_clear TBC (CSI 3g) and tab_set HTS (ESC H) are not processed */
! 216: /* by the 'HOME' device, define the symbol PROC_TAB to emulate them */
! 217: /* #define PROC_TAB #otherwise make it comment !!! */
! 218: #define PROC_TAB
! 219:
! 220: /* ASCII control character mnemonics */
! 221: #define NUL 0
! 222: #define SOH 1
! 223: #define STX 2
! 224: #define ETX 3
! 225: #define EOT 4
! 226: #define ENQ 5
! 227: #define ACK 6
! 228: #define BEL 7
! 229: #define BS 8
! 230: #if defined(TAB)
! 231: # undef TAB
! 232: #endif
! 233: #define TAB 9
! 234: #define LF 10
! 235: #define VT 11
! 236: #define FF 12
! 237: #define CR 13
! 238: #define SO 14
! 239: #define SI 15
! 240: #define DLE 16
! 241: #define DC1 17
! 242: #define DC2 18
! 243: #define DC3 19
! 244: #define DC4 20
! 245: #define NAK 21
! 246: #define SYN 22
! 247: #define ETB 23
! 248: #define CAN 24
! 249: #define EM 25
! 250: #define SUB 26
! 251: #if defined(ESC)
! 252: # undef ESC
! 253: #endif
! 254: #define ESC 27
! 255: #define FS 28
! 256: #define GS 29
! 257: #define RS 30
! 258: #define US 31
! 259: #define SP 32
! 260: #define DEL 127
! 261:
! 262: /* function select in expr evaluator */
! 263: #define STRING 0
! 264: #define NAME 1
! 265: #define LABEL 2
! 266: #define OFFSET 3
! 267: #define ARGIND 4
! 268:
! 269: /* function select in global/local/ssv variables management */
! 270: /* even numbers require 'read/write' access, odd numbers 'read' access */
! 271: #define set_sym 0
! 272: #define kill_sym 2
! 273: #define kill_all 4
! 274: #define killexcl 6
! 275: #define new_sym 8
! 276: #define new_all 10
! 277: #define newexcl 12
! 278: #define killone 14
! 279: #define merge_sym 16
! 280: #define lock_inc 24
! 281: #define lock_dec 26
! 282: #define lock_old 28
! 283:
! 284: #define get_sym 1
! 285: #define dat 3
! 286: #define fra_order 5
! 287: #define fra_query 7
! 288: #define bigquery 9
! 289: #define getinc 11
! 290: #define getnext 13
! 291: #define m_alias 15
! 292: #define zdata 17
! 293:
! 294: /* sets 8th bit in A */
! 295: #define SETBIT(A) ((A)|0200)
! 296: /* needed if byte data are to be interpreted as unsigned integer */
! 297:
! 298: #define UNSIGN(A) ((A)&0377)
! 299:
! 300: /* Fail if pointer null */
! 301: extern void m_fatal(char *s);
! 302: #define NULLPTRCHK(p,s) if (p == NULL) m_fatal(s)
! 303:
! 304: /* device control for terminal I/O */
! 305:
! 306: #define ECHOON (~DSW&BIT0)
! 307: #define DELMODE (DSW&BIT2)
! 308: #define ESCSEQPROC (DSW&BIT6)
! 309: #define CONVUPPER (DSW&BIT14)
! 310: #define DELEMPTY (DSW&BIT19)
! 311: #define NOCTRLS (DSW&BIT20)
! 312: #define CTRLOPROC (DSW&BIT21)
! 313: #define NOTYPEAHEAD (DSW&BIT25)
! 314:
! 315: #define BIT0 1
! 316: #define BIT1 2
! 317: #define BIT2 4
! 318: #define BIT3 8
! 319: #define BIT4 16
! 320: #define BIT5 32
! 321: #define BIT6 64
! 322: #define BIT7 128
! 323: #define BIT8 256
! 324: #define BIT9 512
! 325: #define BIT10 1024
! 326: #define BIT11 2048
! 327: #define BIT12 4096
! 328: #define BIT13 8192
! 329: #define BIT14 16384
! 330: #define BIT15 32768
! 331: #define BIT16 65536
! 332: #define BIT17 131072
! 333: #define BIT18 262144
! 334: #define BIT19 524288
! 335: #define BIT20 1048576
! 336: #define BIT21 2097152
! 337: #define BIT22 4194304
! 338: #define BIT23 8388608
! 339: #define BIT24 16777216
! 340: #define BIT25 33554432
! 341: #define BIT26 67108864
! 342: #define BIT27 134217728
! 343: #define BIT28 268435456
! 344: #define BIT29 536870912
! 345: #define BIT30 1073741824
! 346: #define BIT31 2147483648
! 347:
! 348: /* functions from mumps.c */
! 349: void unnew (void);
! 350:
! 351: #include "sighnd.h"
! 352:
! 353: /* functions from expr.c */
! 354: void expr (short extyp);
! 355: void zsyntax ();
! 356: void zdate ();
! 357: void ztime ();
! 358: void zkey ();
! 359: short is_horolog(char *s);
! 360:
! 361: /* functions from ssvn.c */
! 362: void ssvn (short action, char *key, char *data);
! 363:
! 364: /* functions from ssvn_character.c */
! 365: void ssvn_character(short action, char *key, char *data);
! 366:
! 367: /* functions from ssvn_device.c */
! 368: void ssvn_device(short action, char *key, char *data);
! 369:
! 370: /* functions from ssvn_display.c */
! 371: void ssvn_display_update(void);
! 372: void ssvn_display(short action, char *key, char *data);
! 373:
! 374: /* functions from ssvn_event.c */
! 375: void ssvn_event(short action, char *key, char *data);
! 376:
! 377: /* functions from ssvn_global.c */
! 378: void ssvn_global(short action, char *key, char *data);
! 379:
! 380: /* functions from ssvn_job.c */
! 381: void ssvn_job_add_device(int channel, char *device);
! 382: void ssvn_job_remove_device(int channel);
! 383: void ssvn_job_update(void);
! 384: void ssvn_job(short action, char *key, char *data);
! 385: void frm_process_alias (char *key);
! 386:
! 387: /* functions from ssvn_library.c */
! 388: void ssvn_library(short action, char *key, char *data);
! 389: void ssvn_library_update(void);
! 390:
! 391: /* functions from ssvn_object.c */
! 392: void ssvn_object(short action, char *key, char *data);
! 393:
! 394: /* functions from ssvn_lock.c */
! 395: void ssvn_lock_add(char *key, pid_t owner_job, int count);
! 396: void ssvn_lock_remove(char *key);
! 397: void ssvn_lock(short action, char *key, char *data);
! 398:
! 399: /* functions from ssvn_routine.c */
! 400: void ssvn_routine(short action, char *key, char *data);
! 401: void ssvn_routine_update(void);
! 402:
! 403: /* functions from ssvn_system.c */
! 404: void ssvn_system(short action, char *key, char *data);
! 405: void ssvn_system_update(void);
! 406: /* functions from ssvn_window.c */
! 407: void ssvn_window(short action, char *key, char *data);
! 408:
! 409: /* functions from ssvn_z.c */
! 410: void ssvn_z(short action, char *key, char *data);
! 411:
! 412: /* functions from ssvn_zos.c */
! 413: void ssvn_zos(short action, char *key, char *data);
! 414:
! 415: /* functions from ssvn_zfreem.c */
! 416: void ssvn_zfreem(short action, char *key, char *data);
! 417:
! 418: /* functions from ssvn_zprocess.c */
! 419: void ssvn_zprocess(short action, char *key, char *data);
! 420:
! 421: /* functions from ssvn_routine.c */
! 422: void ssvn_routine_date(void);
! 423:
! 424: #include "ssvn_zrpi.h"
! 425:
! 426: /* functions from symtab_dispatch.c */
! 427: void symtab (short action, char *key, char *data);
! 428: short int collate ();
! 429: short int numeric ();
! 430: short int comp ();
! 431: void intstr ();
! 432: void lintstr ();
! 433: void udfsvn ();
! 434: long getpmore ();
! 435: long getumore ();
! 436: long getrmore ();
! 437: short int getnewmore ();
! 438:
! 439: /* functions from init.c */
! 440: void reset_terminal(void);
! 441:
! 442: /* functions from symtab_bltin.c */
! 443: void symtab_init ();
! 444: short symtab_get_sem(void);
! 445: void symtab_release_sem(void);
! 446: void symtab_shm (short action, char *key, char *data);
! 447: void symtab_bltin (short action, char *key, char *data);
! 448:
! 449: /* functions from global_dispatch.c */
! 450: void global_set_engine(char ns, char *engine);
! 451: void global (short action, char *key, char *data);
! 452: void close_all_globals ();
! 453:
! 454: /* functions from global_bltin.c */
! 455: void global_bltin (short action, char *key, char *data);
! 456: void gbl_dump_stat (void);
! 457:
! 458: /* functions from global_bdb.c */
! 459: void global_bdb (short action, char *key, char *data);
! 460: void frm_bdb_gbl_session_dump(void);
! 461: void frm_bdb_flush_all(void);
! 462: void frm_bdb_close_all(void);
! 463:
! 464: /* functions from operator.c */
! 465: short int pattern ();
! 466: void pminmax ();
! 467: void add ();
! 468: void mul ();
! 469: void mdiv ();
! 470: void power ();
! 471: void g_sqrt ();
! 472: int numlit ();
! 473: long intexpr ();
! 474: short int tvexpr ();
! 475: void m_op ();
! 476:
! 477: /* functions from service.c */
! 478: long int find ();
! 479: short int kill_ok ();
! 480: void lineref ();
! 481: void zi ();
! 482: void write_f ();
! 483: void writeHOME ();
! 484: void m_output ();
! 485: void write_m ();
! 486: void write_t (short int col);
! 487: void ontimo ();
! 488: void read_m (char *stuff, long read_timeout, short read_timeoutms, short length);
! 489: void hardcpf ();
! 490: int rdchk0 ();
! 491: int locking ();
! 492: void set_io (short action);
! 493: void set_break (short break_char);
! 494: void set_zbreak (short quit_char);
! 495: void lock (char *lockarg, long time_out, char type);
! 496:
! 497: /* functions from routine.c */
! 498: #include "routine.h"
! 499:
! 500: /* functions from strings.c */
! 501: long int stlen (const char *source);
! 502: long int stnlen (const char *source, size_t siz);
! 503: long int stcpy (char *dest, const char *source);
! 504: long int stncpy (char *dest, const char *source, size_t siz);
! 505: void stcpy0 (char *dest, const char *source, long length);
! 506: void stcpy1 (char *dest, const char *source, long length);
! 507: short int stcat (char *dest, const char *source);
! 508: long int stncat (char *dest, const char *source, size_t siz);
! 509: short int stcmp (char *str1, char *str2);
! 510: char *trim (char *s);
! 511: void stcnv_m2c (char *mstr);
! 512: void stncnv_m2c(char *mstr, size_t siz);
! 513: void stcnv_c2m (char *cstr);
! 514: void stncnv_c2m(char *cstr, size_t siz);
! 515: size_t key_to_name (char *buf, const char *key, size_t count);
! 516: size_t name_to_key (char *buf, const char *name, size_t count);
! 517: void create_var_key (char *buf, int subct, char *nam, ...);
! 518: void trim_decimal (char *s);
! 519: void uuid_v4 (char *buf);
! 520:
! 521: short is_standard(void);
! 522: int rtn_dialect(void);
! 523:
! 524: /* CRT screen */
! 525: struct vtstyp {
! 526: unsigned char screenx[N_LINES + 1][N_COLUMNS]; /* characters */
! 527: unsigned char screena[N_LINES + 1][N_COLUMNS]; /* attributes */
! 528: #ifdef COLOR
! 529: unsigned char screenc[N_LINES + 1][N_COLUMNS]; /* colors */
! 530: #endif /* COLOR */
! 531: char sclines[N_LINES + 1]; /* lines translation table */
! 532: char rollflag; /* Roll or Page mode */
! 533: char lin24; /* 24 lines or 25 lines mode */
! 534: char savarg;
! 535: char tabs[N_COLUMNS];
! 536: unsigned char Xpos;
! 537: unsigned char Ypos;
! 538: unsigned char sc_up;
! 539: unsigned int sc_lo; /* jpw */
! 540: unsigned char csx[CSLEN];
! 541: unsigned char csy[CSLEN];
! 542: short cssgr[CSLEN]; /* save SGR flag */
! 543: short cscol[CSLEN]; /* save SGR flag */
! 544: short cs;
! 545: unsigned char att;
! 546: #ifdef COLOR
! 547: unsigned char col; /* color byte */
! 548: #endif /* COLOR */
! 549: #ifdef SCO
! 550: unsigned char bw; /* black_on_white flag */
! 551: #endif /* SCO */
! 552: };
! 553:
! 554: /* functions from views.c */
! 555: void view_com ();
! 556: void view_fun ();
! 557: short int newpsize ();
! 558: short int newusize ();
! 559: short int newrsize ();
! 560: void zreplace ();
! 561: short int tstglvn ();
! 562: void zname ();
! 563: short int znamenumeric ();
! 564: void procv22 ();
! 565: void v25 ();
! 566: void m_tolower ();
! 567: void part_ref (struct vtstyp *scr, short from, short to);
! 568:
! 569: #define D_FREEM 0
! 570: #define D_M77 1
! 571: #define D_M84 2
! 572: #define D_M90 3
! 573: #define D_M95 4
! 574: #define D_MDS 5
! 575: #define D_M5 6
! 576:
! 577: /* per-routine flags */
! 578: typedef struct rtn_flags {
! 579: short standard;
! 580: short dialect;
! 581: } rtn_flags;
! 582:
! 583:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>