version 1.1, 2025/01/19 02:04:04
|
version 1.10, 2025/03/27 03:27:35
|
Line 1
|
Line 1
|
/* |
/* |
* * |
* $Id$ |
* * * |
|
* * * |
|
* *************** |
|
* * * * * |
|
* * MUMPS * |
|
* * * * * |
|
* *************** |
|
* * * |
|
* * * |
|
* * |
|
* |
|
* xecline.c |
|
* freem interpreter proper |
* freem interpreter proper |
* |
* |
* |
* |
* Author: Serena Willis <jpw@coherent-logic.com> |
* Author: Serena Willis <snw@coherent-logic.com> |
* Copyright (C) 1998 MUG Deutschland |
* Copyright (C) 1998 MUG Deutschland |
* Copyright (C) 2020 Coherent Logic Development LLC |
* Copyright (C) 2020, 2025 Coherent Logic Development LLC |
* |
* |
* |
* |
* This file is part of FreeM. |
* This file is part of FreeM. |
Line 35
|
Line 23
|
* You should have received a copy of the GNU Affero Public License |
* You should have received a copy of the GNU Affero Public License |
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* |
* |
|
* $Log$ |
|
* Revision 1.10 2025/03/27 03:27:35 snw |
|
* Install init scripts to share/freem/examples/init and fix regression in method dispatch |
|
* |
|
* Revision 1.9 2025/03/24 04:13:12 snw |
|
* Replace action macro dat with fra_dat to avoid symbol conflict on OS/2 |
|
* |
|
* Revision 1.8 2025/03/24 04:05:36 snw |
|
* Replace crlf with frm_crlf to avoid symbol conflict with readline on OS/2 |
|
* |
|
* Revision 1.7 2025/03/22 22:52:24 snw |
|
* Add STRLEN_GBL macro to manage global string length |
|
* |
|
* Revision 1.6 2025/03/22 21:44:32 snw |
|
* Make the startup messages fewer and add environment name to direct-mode prompt |
|
* |
|
* Revision 1.5 2025/03/09 19:50:47 snw |
|
* Second phase of REUSE compliance and header reformat |
|
* |
|
* |
|
* SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC |
|
* SPDX-License-Identifier: AGPL-3.0-or-later |
**/ |
**/ |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
Line 1076 set:
|
Line 1086 set:
|
goto err; |
goto err; |
} |
} |
|
|
expr (STRING); |
expr (STRING); |
|
|
if (merr () > OK) goto err; |
if (merr () > OK) goto err; |
|
|
stcpy (tmp2, argptr); |
stcpy (tmp2, argptr); |
Line 2021 set10:
|
Line 2031 set10:
|
goto err; |
goto err; |
} |
} |
|
|
sec += day * 86400 + timezone; |
sec += day * 86400 + FreeM_timezone; |
day = timezone; |
day = FreeM_timezone; |
|
|
sh_ts.tv_sec = sec; |
sh_ts.tv_sec = sec; |
|
|
Line 2042 set10:
|
Line 2052 set10:
|
clock = time (0L); |
clock = time (0L); |
ctdata = localtime (&clock); |
ctdata = localtime (&clock); |
|
|
if (day -= (timezone = ctdata->tm_tzadj)) { |
if (day -= (FreeM_timezone = ctdata->tm_tzadj)) { |
sec -= day; |
sec -= day; |
tzoffset += day; |
tzoffset += day; |
stime (&sec); |
stime (&sec); |
Line 3753 off3:
|
Line 3763 off3:
|
break; |
break; |
|
|
case KILL: |
case KILL: |
|
|
/* argumentless: KILL all local variables */ |
/* argumentless: KILL all local variables */ |
if (((ch = *codptr) == SP) || ch == EOL) { |
if (((ch = *codptr) == SP) || ch == EOL) { |
symtab (kill_all, "", ""); |
symtab (kill_all, "", ""); |
Line 3787 off3:
|
Line 3797 off3:
|
if (destructor_ct) { |
if (destructor_ct) { |
|
|
for (cd = 0; cd < destructor_ct; cd++) { |
for (cd = 0; cd < destructor_ct; cd++) { |
strcat (destc, destructors[cd]); |
if (strlen (destructors[cd]) > 0) { |
strcat (destc, ","); |
strcat (destc, destructors[cd]); |
|
strcat (destc, ","); |
|
} |
} |
} |
|
|
destructor_ct = 0; |
destructor_ct = 0; |
Line 3936 off3:
|
Line 3948 off3:
|
|
|
stcpy (objvar, vn); |
stcpy (objvar, vn); |
|
|
symtab (dat, objvar, datres); |
symtab (fra_dat, objvar, datres); |
dat_res = atoi (datres); |
dat_res = atoi (datres); |
|
|
if (dat_res > 0) { |
if (dat_res > 0) { |
Line 4320 use0: /* entry point for proces
|
Line 4332 use0: /* entry point for proces
|
break; |
break; |
|
|
case 2: |
case 2: |
crlf[io] = tvexpr (argptr); |
frm_crlf[io] = tvexpr (argptr); |
break; |
break; |
|
|
case 3: |
case 3: |
Line 4422 use_socket:
|
Line 4434 use_socket:
|
|
|
/* need to evaluate the following 6 lines carefully - smw 2023-10-15 */ |
/* need to evaluate the following 6 lines carefully - smw 2023-10-15 */ |
if (k != HOME) { |
if (k != HOME) { |
crlf[k] = FALSE; |
frm_crlf[k] = FALSE; |
fm_nodelay[k] = FALSE; |
fm_nodelay[k] = FALSE; |
xpos[k] = 0; |
xpos[k] = 0; |
ypos[k] = 0; |
ypos[k] = 0; |
Line 5538 zgo:
|
Line 5550 zgo:
|
|
|
for (; beg < end; beg += UNSIGN (*beg) + 2) { |
for (; beg < end; beg += UNSIGN (*beg) + 2) { |
|
|
if (crlf[io]) { |
if (frm_crlf[io]) { |
write_m ("\012\201"); |
write_m ("\012\201"); |
} |
} |
else { |
else { |
Line 5554 zgo:
|
Line 5566 zgo:
|
rouins = beg; |
rouins = beg; |
} |
} |
|
|
if (crlf[io]) { |
if (frm_crlf[io]) { |
write_m ("\012\201"); |
write_m ("\012\201"); |
} |
} |
else { |
else { |
Line 5823 zwritep:
|
Line 5835 zwritep:
|
} |
} |
|
|
if (varnam[0] != '^') { |
if (varnam[0] != '^') { |
symtab (dat, varnam, tmp2); |
symtab (fra_dat, varnam, tmp2); |
zwmode = 'L'; |
zwmode = 'L'; |
} |
} |
else { |
else { |
if (varnam[1] == '$') { |
if (varnam[1] == '$') { |
ssvn (dat, varnam, tmp2); |
ssvn (fra_dat, varnam, tmp2); |
zwmode = '$'; |
zwmode = '$'; |
} |
} |
else { |
else { |
global (dat, varnam, tmp2); |
global (fra_dat, varnam, tmp2); |
zwmode = '^'; |
zwmode = '^'; |
} |
} |
} |
} |
Line 5943 zwritep:
|
Line 5955 zwritep:
|
switch (zwmode) { |
switch (zwmode) { |
|
|
case 'L': |
case 'L': |
symtab (dat, tmp, tmp3); |
symtab (fra_dat, tmp, tmp3); |
symtab (get_sym, tmp, &w_tmp[1]); |
symtab (get_sym, tmp, &w_tmp[1]); |
|
|
break; |
break; |
|
|
|
|
case '$': |
case '$': |
ssvn (dat, tmp, tmp3); |
ssvn (fra_dat, tmp, tmp3); |
ssvn (get_sym, tmp, &w_tmp[1]); |
ssvn (get_sym, tmp, &w_tmp[1]); |
|
|
break; |
break; |
|
|
|
|
case '^': |
case '^': |
global (dat, tmp, tmp3); |
global (fra_dat, tmp, tmp3); |
global (get_sym, tmp, &w_tmp[1]); |
global (get_sym, tmp, &w_tmp[1]); |
|
|
break; |
break; |
Line 7210 direct_mode:
|
Line 7222 direct_mode:
|
|
|
if (quiet_mode == FALSE) { |
if (quiet_mode == FALSE) { |
if (tp_level == 0) { |
if (tp_level == 0) { |
snprintf (fmrl_prompt, 255, "\r\n%s> ", nsname); |
snprintf (fmrl_prompt, 255, "\r\n%s.%s> ", shm_env, nsname); |
} |
} |
else { |
else { |
snprintf (fmrl_prompt, 255, "\r\nTL%d:%s> ", tp_level, nsname); |
snprintf (fmrl_prompt, 255, "\r\nTL%d:%s.%s> ", tp_level, shm_env, nsname); |
} |
} |
} |
} |
set_io (UNIX); |
set_io (UNIX); |
Line 7484 void rbuf_dump(void)
|
Line 7496 void rbuf_dump(void)
|
|
|
|
|
printf ("ROUTINE BUFFER CONFIGURATION\r\n"); |
printf ("ROUTINE BUFFER CONFIGURATION\r\n"); |
printf (" ROUTINE BUFFER COUNT: %d\r\n", NO_OF_RBUF); |
printf (" ROUTINE BUFFER COUNT: %ld\r\n", NO_OF_RBUF); |
printf (" MAX. ROUTINE BUFFER COUNT: %d\r\n", MAXNO_OF_RBUF); |
printf (" MAX. ROUTINE BUFFER COUNT: %d\r\n", MAXNO_OF_RBUF); |
printf (" DEFAULT ROUTINE BUFFER SIZE (EACH): %d BYTES\r\n", DEFPSIZE0 - 1); |
printf (" DEFAULT ROUTINE BUFFER SIZE (EACH): %d BYTES\r\n", DEFPSIZE0 - 1); |
printf (" CURRENT ROUTINE BUFFER SIZE (EACH): %d BYTES\r\n\r\n", PSIZE0 - 1); |
printf (" CURRENT ROUTINE BUFFER SIZE (EACH): %ld BYTES\r\n\r\n", PSIZE0 - 1); |
printf ("BUFFERS IN USE:\r\n\r\n"); |
printf ("BUFFERS IN USE:\r\n\r\n"); |
|
|
|
|