Annotation of freem/mlib/%SYSINIT.m, revision 1.7
1.5 snw 1: %SYSINIT ;VCL/SNW-FREEM STARTUP ROUTINE; 5/1/2025 11:00 AM
1.2 snw 2: ;0.0;FreeM;****FREEM**;Serena Willis @2020
1.1 snw 3: ;
1.7 ! snw 4: ; $Id: %SYSINIT.m,v 1.6 2025/05/02 12:44:48 snw Exp $
1.1 snw 5: ; FreeM Startup Routine
6: ;
7: ;
1.3 snw 8: ; Author: Serena Willis <snw@coherent-logic.com>
1.1 snw 9: ; Copyright (C) 1998 MUG Deutschland
10: ; Copyright (C) 2020, 2022 Coherent Logic Development LLC
11: ;
12: ;
13: ; This file is part of FreeM.
14: ;
15: ; FreeM is free software: you can redistribute it and/or modify
16: ; it under the terms of the GNU Affero Public License as published by
17: ; the Free Software Foundation, either version 3 of the License, or
18: ; (at your option) any later version.
19: ;
20: ; FreeM is distributed in the hope that it will be useful,
21: ; but WITHOUT ANY WARRANTY; without even the implied warranty of
22: ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23: ; GNU Affero Public License for more details.
24: ;
25: ; You should have received a copy of the GNU Affero Public License
26: ; along with FreeM. If not, see <https://www.gnu.org/licenses/>.
1.3 snw 27: ;
1.4 snw 28: ; $Log: %SYSINIT.m,v $
1.7 ! snw 29: ; Revision 1.6 2025/05/02 12:44:48 snw
! 30: ; Documentation updates
! 31: ;
1.6 snw 32: ; Revision 1.5 2025/05/01 17:02:30 snw
33: ; Further debugging improvements
34: ;
1.5 snw 35: ; Revision 1.4 2025/04/10 14:37:20 snw
36: ; Updates to manual
37: ;
1.4 snw 38: ; Revision 1.3 2025/03/10 00:38:15 snw
39: ; Phase 3 of REUSE compliance and header reformatting
40: ;
1.3 snw 41: ;
42: ; SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
43: ; SPDX-License-Identifier: AGPL-3.0-or-later
1.1 snw 44: S %DIA=$DIALECT
45: S $DIALECT="FREEM"
1.7 ! snw 46: CONST %MATH("PI")=3.141592653589793238462
1.6 snw 47: CONST %MATH("E")=2.71828182845904523536
48: CONST %MATH("GAMMA")=0.57721566490153286060
49: CONST %MATH("DEGPERRAD")=57.29577951308232087680
50: CONST %MATH("PHI")=1.61803398874989484820
51: CONST %IO("CRLF")=$C(13,10)
52: CONST %SYS("SIGNAL","HUP")=1
53: CONST %SYS("SIGNAL","INIT")=2
54: CONST %SYS("SIGNAL","KILL")=9
55: CONST %SYS("SIGNAL","TERM")=15
1.1 snw 56: ASTART "TRIGGER"
57: S $ZTRAP="NOLS^%SYSINIT"
58: D ^LCLINIT
59: NOLS ;
60: S $ZTRAP=""
61: S $DIALECT=%DIA
62: K %DIA
63: I $D(%TMPINITROUTINE) D @%TMPINITROUTINE G RTNDONE
64: I $D(%TMPINITMCODE) @%TMPINITMCODE
65: RTNDONE ;
66: Q
67: copyright ;
68: COPYRIGHT ;
69: S %DIA=$DIALECT
70: S $DIALECT="FREEM"
71: W "Coherent Logic Development ",$ZVERSION,!
1.6 snw 72: W "Copyright (C) 2014, 2025 Coherent Logic Development LLC",!,!
1.1 snw 73: W "License AGPLv3+: GNU AGPL version 3 or later <https://gnu.org/license/agpl-3.0.html>",!
74: W "This is free software: you are free to change and redistribute it.",!
75: W "There is NO WARRANTY, to the extent permitted by law.",!,!
76: S $DIALECT=%DIA
77: K %DIA
78: Q
79: limits ;
80: LIMITS ;
81: S %DIA=$DIALECT
82: S $DIALECT="FREEM"
83: N MWAPI S MWAPI="<<DISABLED>>"
84: S:^$SYSTEM("MWAPI") MWAPI=^$DISPLAY($PDISPLAY,"PLATFORM")
85: W !,$ZVERSION," - System Limits",!!
86: W " MAX NAME LENGTH: ",^$SYSTEM("NAME_LENGTH"),!
87: W " MAX NODE LENGTH: ",^$SYSTEM("STRING_MAX"),!
88: W " MWAPI SUPPORT: ",MWAPI,!
89: I MWAPI'="<<DISABLED>>" THEN D
90: . W " DISPLAY: ",$PDISPLAY,!
91: . W " RESOLUTION: ",^$DISPLAY($PDISPLAY,"SIZE"),!
92: . W " COLOR SPECTRUM: ",^$DISPLAY($PDISPLAY,"SPECTRUM"),!
93: . W " COLOR TYPE: ",^$DISPLAY($PDISPLAY,"COLORTYPE"),!
94: . W " SCREEN UNITS: ",^$DISPLAY($PDISPLAY,"UNITS"),!
95: S $DIALECT=%DIA
96: K %DIA
97: Q
98: info ;
99: INFO ;
100: S %DIA=$DIALECT
101: S $DIALECT="FREEM"
102: N NS S NS=^$JOB($JOB,"NAMESPACE")
103: W $ZVERSION," (Namespace ",^$JOB($JOB,"NAMESPACE"),")",!,!
104: W "USER-DEFINED LANGUAGE ELEMENTS:",!
105: W " Intrinsic Z-Commands: ",!
106: W " Intrinsic Z-Functions: ",!
107: W " Intrinsic Special Variables: ",!!
108: W "EVENT MANAGEMENT:",!
109: W " BREAK Service Code: '",!!
110: W "GLOBAL DATABASE:",!
111: W " Global Handler: ","[",NS,"] ",?65,^$JOB($JOB,"ENGINES","GLOBAL",NS),!
112: S NS="SYSTEM"
113: W " -> ","[",NS,"] ",?65,^$JOB($JOB,"ENGINES","GLOBAL",NS),!
114: W " Last Referenced Global: ",$REFERENCE,!
115: W " Characters in Unique Name: ",^$JOB($JOB,"GVN_UNIQUE_CHARS"),!
116: W " Case Sensitivity: ",^$JOB($JOB,"GVN_CASE_SENSITIVE"),!
117: W " Max Length (Global Name + Subscripts): ",^$JOB($JOB,"GVN_NAME_SUB_LENGTH"),!
118: W " Max Length (Each Subscript): ",^$JOB($JOB,"GVN_SUB_LENGTH"),!
119: S $DIALECT=%DIA
120: K %DIA
121: Q
122: jobs ;
123: JOBS ;
124: S %DIA=$DIALECT
125: S $DIALECT="FREEM"
126: W " -== ",$ZVERSION," Job Manager ==-",!,!
127: jmmnu ;%DIALECT FREEM
128: W "PID",?7,"NAMESPACE",?20,"ROUTINE",?41,"$PRINCIPAL",?63,"UID:GID",!
129: W "---",?7,"---------",?20,"-------",?41,"----------",?63,"-------",!
130: S PID=""
131: F S PID=$O(^$JOB(PID)) Q:PID="" D
132: . W PID,?7,^$JOB(PID,"NAMESPACE"),?20,^$JOB(PID,"ROUTINE"),?41,^$JOB(PID,"$PRINCIPAL")
133: . W ?63,^$JOB(PID,"USER"),":",^$JOB(PID,"GROUP")
134: . I PID=$JOB W "*",!
135: . I PID'=$JOB W !
136: W !
137: W "'*' represents the current process.",!
138: W "Type 'quit' at the prompt to quit the Job Manager.",!,!
139: gpid ;
140: W "PID> " R PID W !
141: I PID="quit" S $DIALECT=%DIA K %DIA QUIT
142: I '$D(^$JOB(PID)) W "Invalid PID",! G gpid
143: W "Job PID "_PID_":",!
144: W " Current Namespace: ",^$JOB(PID,"NAMESPACE"),!
145: W " Current Routine: ",^$JOB(PID,"ROUTINE"),!
146: W " Value of $PRINCIPAL: ",^$JOB(PID,"$PRINCIPAL"),!
147: W " Value of $IO: ",^$JOB(PID,"$IO"),!
148: W " Process Owner: ",^$JOB(PID,"USER"),!
149: W " Process Group: ",^$JOB(PID,"GROUP"),!
150: W " Process $TLEVEL: ",^$JOB(PID,"$TLEVEL"),!,!
151: jsel ;
152: W "h)alt PID "_PID_" or c)hoose another? " R ACT#1
153: I (ACT="h")!(ACT="H") K ^$JOB(PID) W !,"Sent SIGTERM to process "_PID_".",! G jmmnu
154: W !,! G jmmnu
155: S $DIALECT=%DIA
156: K %DIA
157: Q
158: TRMSTAT ;
159: trmstat ;
160: S %DIA=$DIALECT
161: S $DIALECT="FREEM"
162: W !,"FreeM Terminal Status",!
163: W "---------------------",!,!
164: W "ECHOON = "_^$DEVICE($P,"ECHOON")_" DELMODE = "_^$DEVICE($P,"DELMODE")_" ESCSEQPROC = "_^$DEVICE($P,"ESCSEQPROC"),!
165: W "CONVUPPER = "_^$DEVICE($P,"CONVUPPER")_" DELEMPTY = "_^$DEVICE($P,"DELEMPTY")_" NOCTRLS = "_^$DEVICE($P,"NOCTRLS"),!
166: W "CTRLOPROC = "_^$DEVICE($P,"CTRLOPROC")_" NOTYPEAHEAD = "_^$DEVICE($P,"NOTYPEAHEAD")_" TERMID = "_^$DEVICE($P,"TERMID"),!,!
167: W "Device Status Word is "_^$DEVICE($P,"DSW"),!,!
168: S $DIALECT=%DIA K %DIA
169: Q
170: GLOBAL ;
171: global ;
172: S %DIA=$DIALECT
173: S $DIALECT="FREEM"
174: N GBLNAM,G
175: W !,"Which global (including ^)? "
176: R GBLNAM W !!
177: I '$D(GBLNAM) W "Invalid global?",! G GLOBAL
178: S G=$E(GBLNAM,2,$L(GBLNAM))
179: W "GLOBAL: ",GBLNAM,!
180: W "NAMESPACE: ",^$GLOBAL(G,"NAMESPACE")
181: I $D(^$SYSTEM("MAPPINGS","GLOBAL",GBLNAM)) W " [mapped]",!
182: E W !
183: W "DATA FILE: ",^$GLOBAL(G,"FILE"),!
184: S $DIALECT=%DIA K %DIA
185: Q
186: rw ;
187: S %DIA=$DIALECT
188: S $DIALECT="FREEM"
189: W !,"---=== PROFESSOR RICHARD WALTERS ===---",!!
190: W "UC Davis professor Richard Walters, the former director of the",!
191: W "FreeM project, died on January 18, 2021 at the age of 90.",!,!
192: W "The FreeM project--and the M community--owes him a great debt",!
193: W "of gratitude.",!,!
194: W "Rest in power, Professor Walters.",!,!
195: W "Sincerely,",!
196: W " - The FreeM Project",!,!
197: S $DIALECT=%DIA K %DIA
198: Q
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>