aboutsummaryrefslogtreecommitdiff
path: root/src/interp/sys-constants.boot
blob: fc1543e855b81520b90341dd9c7b73f0ec6ed507 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
-- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd.
-- All rights reserved.
-- Copyright (C) 2007-2008, Gabriel Dos Reis.
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are
-- met:
--
--     - Redistributions of source code must retain the above copyright
--       notice, this list of conditions and the following disclaimer.
--
--     - Redistributions in binary form must reproduce the above copyright
--       notice, this list of conditions and the following disclaimer in
--       the documentation and/or other materials provided with the
--       distribution.
--
--     - Neither the name of The Numerical Algorithms Group Ltd. nor the
--       names of its contributors may be used to endorse or promote products
--       derived from this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--

--
-- This file collects and documents some of the constants used by either
-- the interpreter or the compiler or both.
--

import types
namespace BOOT

--%
--% Numeric limits
--%

++ Minimum for %Short values.
$ShortMinimum ==
  MOST_-NEGATIVE_-FIXNUM

++ Maximum for %Short values.
$ShortMaximum ==
  MOST_-POSITIVE_-FIXNUM

++ Minimum for %SingleFloat values.
$SingleFloatMinimum ==
)if %hasFeature KEYWORD::GCL
  MOST_-NEGATIVE_-SHORT_-FLOAT
)else
  MOST_-NEGATIVE_-SINGLE_-FLOAT
)endif

++ Maximum for %SingleFloat values.
$SingleFloatMaximum ==
)if %hasFeature KEYWORD::GCL
  MOST_-POSITIVE_-SHORT_-FLOAT
)else
  MOST_-POSITIVE_-SINGLE_-FLOAT
)endif

++ Machine precision for %SingleFloat
$SingleFloatEpsilon ==
)if %hasFeature KEYWORD::GCL
  SHORT_-FLOAT_-EPSILON
)else
  SINGLE_-FLOAT_-EPSILON
)endif

++ Maximum for %DoubleFloat values
$DoubleFloatMinimum ==
  MOST_-NEGATIVE_-DOUBLE_-FLOAT

++ Maximum for %DoubleFloat values
$DoubleFloatMaximum ==
  MOST_-POSITIVE_-DOUBLE_-FLOAT

++ Machine precision for %DoubleFloat
$DoubleFloatEpsilon ==
  DOUBLE_-FLOAT_-EPSILON

--% 

++ Clock time unit per second.
$timerTicksPerSecond == 
  INTERNAL_-TIME_-UNITS_-PER_-SECOND


++ Internal magic coockie.
_/MAJOR_-VERSION ==
  2

--
-- Text formatting
--

++ Glyph for a box
$boxString ==
  CONCATENATE('STRING, [CODE_-CHAR 29, CODE_-CHAR 226])

++ Glyph for an APL quad
$quadSymbol ==
  $boxString

--% ANSI Escape Sequences.  Note that these days, people
--% will be talking of ISO/IEC 6429.  The practical end result
--% is the same.  
--% The next few definitions provide symbolic names for ANSI
--% espace sequences.

++ The escape character, in string form
$escapeString ==
  STRING CODE_-CHAR 27

++ Marker to swicth to bold font
$boldString ==
  CONCATENATE('STRING, $escapeString, '"[1m")

++ Marker to switch to normal font
$normalString ==
  CONCATENATE('STRING, $escapeString, '"[0;10m")

++ Marker to switch to reverve video display
$reverseVideoString ==
  CONCATENATE('STRING, $escapeString, '"[7m")

++ Marker to underline text
$underlineString ==
  CONCATENATE('STRING, $escapeString, '"[4m")

++
$highlightFontOn ==
  CONCATENATE("STRING", '" ", $boldString)

++
$highlightFontOff ==
  CONCATENATE("STRING", $normalString, '" ")

-- 
-- User Interface
--

++
++ FIXME: Eventually move this to i-syscmd.boot
$noParseCommands ==
  '(boot      _
    copyright _
    credits   _
    fin       _
    lisp      _
    pquit     _
    quit      _
    suspend   _
    synonym   _
    system)

++
$tokenCommands ==
  '(abbreviations     _
    cd                _
    clear             _
    close             _
    compiler          _
    depends           _
    display           _
    edit              _
    frame             _
    frame             _
    help              _
    history           _
    input             _
    library           _
    load              _
    ltrace            _
    read              _
    savesystem        _
    set               _
    spool             _
    undo              _
    what              _
    with              _
    workfiles         _
    zsystemdevelopment)

++
++ List of pair (command . user level)
$systemCommands ==
  '((abbreviations . compiler)      _
   (boot . development)             _
   (cd . interpreter)               _
   (clear . interpreter)            _
   (close . interpreter)            _
   (compiler . compiler)            _
   (copyright . interpreter)        _
   (credits . interpreter)          _
   (display . interpreter)          _
   (edit . interpreter)             _
   (fin . development)              _
   (frame . interpreter)            _
   (help . interpreter)             _
   (history . interpreter)          _
   (lisp . development)             _
   (library . interpreter)          _
   (load . interpreter)             _
   (ltrace . interpreter)           _
   (pquit . interpreter)            _
   (quit . interpreter)             _
   (read . interpreter)             _
   (savesystem . interpreter)       _
   (set . interpreter)              _
   (show . interpreter)             _
   (spool . interpreter)            _
   (summary . interpreter)          _
   (synonym . interpreter)          _
   (system . interpreter)           _
   (trace . interpreter)            _
   (undo . interpreter)             _
   (what . interpreter)             _
   (with . interpreter)             _
   (workfiles . development)        _
   (zsystemdevelopment . interpreter))

--
-- Old Parser data
--

++ The double quote character in string form
++ FIXME: This constant is used in only one place.  Move it there.
$DoubleQuote ==
  '"_""

++ Internal type tag for big float values.  
++ This must be consistent with the tag checked for in postBigFloat
++ and also set in property.lisp.
++ FIXME: Have all those places use this symbolic constants.
$BFtag ==
  ":BF:"

--
-- Compiler flags
--

++ True if the system should support compilation
++ This constant does not seem very terrible useful.
++ FIXME: Check if it can be removed.
$COMPILE ==
  true

--
-- Common system data
--

++ A list of precomputed formal function formal parameter names.
++ 50 parameters should be enough for everybody, right?
$FormalMapVariableList ==
  '(_#1 _#2 _#3 _#4 _#5 _#6 _#7 _#8 _#9 _#10 _
    _#11 _#12 _#13 _#14 _#15 _#16 _#17 _#18 _#19 _#20 _
    _#21 _#22 _#23 _#24 _#25 _#26 _#27 _#28 _#29 _#30 _
    _#31 _#32 _#33 _#34 _#35 _#36 _#37 _#38 _#39 _#40 _
    _#41 _#42 _#43 _#44 _#45 _#46 _#47 _#48 _#49 _#50)


++ List of precomputed pattern variable names.
$PatternVariableList ==
  '(_*1 _*2 _*3 _*4 _*5 _*6 _*7 _*8 _*9 _*10 _*11 _
    _*12 _*13 _*14 _*15 _*16 _*17 _*18 _*19 _*20 _
    _*21 _*22 _*23 _*24 _*25 _*26 _*27 _*28 _*29 _*30 _
    _*31 _*32 _*33 _*34 _*35 _*36 _*37 _*38 _*39 _*40 _
    _*41 _*42 _*43 _*44 _*45 _*46 _*47 _*48 _*49 _*50)

$ModeVariableList ==
  '(dv_$1 dv_$2 dv_$3 dv_$4 dv_$5 dv_$6 dv_$7 dv_$8 _
    dv_$9 dv_$10 dv_$11 dv_$12 dv_$13 dv_$14 dv_$15 _
    dv_$16 dv_$17 dv_$18 dv_$19 dv_$20)

$DomainVariableList ==
  '(_$1 _$2 _$3 _$4 _$5 _$6 _$7 _$8 _$9 _$10 _$11 _
    _$12 _$13 _$14 _$15 _$16 _$17 _$18 _$19 _$20)

$TriangleVariableList ==
  '(t_#1 t_#2 t_#3 t_#4 t_#5 t_#6 t_#7 t_#8 t_#9 t_#10
    t_#11 t_#12 t_#13 t_#14 t_#15 t_#16 t_#17 t_#18 t_#19 t_#20
    t_#21 t_#22 t_#23 t_#24 t_#25 t_#26 t_#27 t_#28 t_#29 t_#30
    t_#31 t_#32 t_#33 t_#34 t_#35 t_#36 t_#37 t_#38 t_#39 t_#40
    t_#41 t_#42 t_#43 t_#44 t_#45 t_#46 t_#47 t_#48 t_#49 t_#50)

++ List of basic predicates the system has a built-in optimization
++ support for.
$BasicPredicates ==
  '(INTEGERP STRINGP FLOATP SYMBOLP)



++ List of functions known to be free of side effects
++ FIXME: Check that the names on this list are not renamed.
$SideEffectFreeFunctionList ==
  '(_null    _
    _not     _
    _and     _
    _or      _
    _xor     _
    _case    _
    Zero     _
    One      _
    _:       _
    _:_:     _
    _has     _
    Mapping  _
    _elt     _
    _=       _
    _>       _
    _>_=     _
    _<       _
    _<_=     _
    MEMBER   _
    _is      _
    _isnt    _
    ATOM     _
    $_=      _
    $_>      _
    $_>_=    _
    $_<      _
    $_<_=    _
    $_^_=    _
    $MEMBER)

--% Types

++ The Field category form
$Field ==
  '(Field)

++ The Void domain constructor form
$Void ==
  '(Void)

++ The Any domain constructor form
$Any ==
  '(Any)

++ The None domain constructor form.
$None ==
  '(None)

++ The Syntax domain constructor form
$Syntax ==
  '(Syntax)

++ Boolean domain constructor form
$Boolean ==
  '(Boolean)

++ The SmallInteger domain constructor form
$SmallInteger ==
  '(SingleInteger)

$SingleInteger ==
  '(SingleInteger)

++ The Integer domain constructor form.
$Integer ==
  '(Integer)


++ The NegativeInteger domain constructor form
$NegativeInteger ==
  '(NegativeInteger)

++ The NonNegativeInteger domain constructor form
$NonNegativeInteger ==
  '(NonNegativeInteger)

++ The NonPositiveInteger domain constructor form
$NonPositiveInteger ==
  '(NonPositiveInteger)

++ The PositiveInteger domain constructor form
$PositiveInteger ==
  '(PositiveInteger)

++ The fraction field constructor
$QuotientField ==
  'Fraction

++ The RationalNumber domain constructor form
$RationalNumber ==
  '(Fraction (Integer))

++ The domain constructor for Gaussian integers
$ComplexInteger ==
  ["Complex", $Integer]


++ SingleFloat domain constructor form
$SingleFloat ==
  '(SingleFloat)

++ Float domain constructor form
$Float ==
  '(Float)

++ DoubleFloat domain constructor form
$DoubleFloat ==
  '(DoubleFloat)

++ BigFloat domain constructor form
++ FIXME: This does not appear to be used anywhere in the 
++  source codes.  
$BigFloat ==
  '(Float)


++ The String constructor domain form
$String ==
  '(String)

++ The Symbol constructor domain form
$Symbol ==
  '(Symbol)


++ The 'wildcar' for a type -- "?" in Spad syntax.  This stands for 
++ an unspecified type.
$EmptyMode ==
  "$EmptyMode"

++ The OutputForm domain constructor form
$OutputForm ==
  '(OutputForm)

++ The InputForm domain form
$InputForm ==
  '(InputForm)

++ The domain constructor for functional expression
$FunctionalExpression ==
  'Expression

++ Expression domain constructor form
$Expression ==
  '(OutputForm)

++ The constructor form for unnamed functions.
$AnonymousFunction ==
  '(AnonymousFunction)

++ Exit domain constructor form
$Exit ==
  '(Exit)

++ The ThrowAwayMode constructor form
$ThrowAwayMode ==
  "$ThrowAwayMode"

++ This mode is used to indicate that the value of expression
++ can be thrown away.
$NoValueMode ==
  "$NoValueMode"

++
$ExitMode ==
  "$ExitMode"


+++ List of domains that are (currently) built-in into the system.
$Primitives == 
  '(Union Record Mapping Enumeration)

--%
  
++ Category constructor form
$Category ==
  '(Category)

++ The Type category constructor form.
$Type ==
  '(Type)

++ Domain constructor form
++ FIXME: Find where this is used in the system.
$Domain ==
  '(Domain)

++ Mode constructor form
++ FIXME: Where is this used?
$Mode ==
  '(Mode)

$CategoryConstructor ==
  '(CategoryConstructor)

$DomainConstructor ==
  '(DomainConstructor)


++ StringCategory Constructor form
$StringCategory ==
  '(StringCategory)


++ List of category constructors that do not have entries in the 
++ constructor database. So, they are mostly recognized by their names.
$CategoryNames ==
  '(Category _
    CATEGORY _
    RecordCategory _
    Join _
    EnumerationCategory _
    SubsetCategory _
    UnionCategory)

++ List of domain constructors that do not have entries in the constructor
++ database. So, they are mostly recognized by their names.
++ See also $CategoryNames.
$DomainNames ==
  '(Mapping _
    SubDomain _
    Union _
    Record _
    Enumeration)

++ The union of the above two lists.
$BuiltinConstructorNames ==
  [:$CategoryNames,:$DomainNames]

++ List of language support type forms.
$LangSupportTypes ==
  '((Mode) (Domain) (Type) (Category))

++
$NonMentionableDomainNames ==
  '($ Rep Record Union Mapping Enumeration)


++ List of primitive domains
$PrimitiveDomainNames ==
  '(List _
    Integer _
    NonNegativeInteger _
    PositiveInteger _
    SingleInteger _
    String _
    Boolean)

++ These symbols are not constructor names, but they define domains.
$SpecialDomainNames ==
  '(add _
    CAPSULE _
    SubDomain)


$optimizableConstructorNames ==
  '(List               _
    Integer            _ 
    PositiveInteger    _
    NonNegativeInteger _
    SingleInteger      _
    String             _
    Boolean            _
    Symbol             _
    DoubleFloat        _
    PrimitiveArray     _
    Vector)

++ FIXME
$DomainsInScope == 
  '(NIL)

++ List of domains in scope in fresh settings.
$InitialDomainsInScope ==
  '($EmptyMode _
    $NoValueMode)


++ FIXME
$underDomainAlist ==
  nil


++ A list of functors that do not really have modemaps
$DummyFunctorNames ==
  '(Mapping _[_|_|_])

--% 

++ The empty environment
$EmptyEnvironment ==
  '((NIL))

++
$LocalFrame ==
  '((NIL))

++ The empty string constant.
$EmptyString ==
  '""
++ The empty vector constant
$EmptyVector ==
  ["VECTOR"]

++ A symbol denoting failure
$failure ==
  GENSYM()

++ The initial modemap frame
$InitialModemapFrame ==
  '((NIL))


++ The constant 0.
$Zero ==
  '(Zero)

++ The constant 1.
$One ==
  '(One)


++
$true ==
  ''T

$false ==
  false

++ Indicate absence of value
$NoValue ==
  "$NoValue"


++
$exitMode == 
  $EmptyMode

++
$leaveMode == 
  $EmptyMode

++
$noEnv == nil

++
IDENTITY == 
  function IDENTITY

+++
$IndexFilename ==
  '"index.KAF"

++
$FILETYPE_-TABLE ==
  [["LISPLIB", :"LILIB"],
   ["SPADLIB", :"slib"],
   ["HISTORY", :"hist"],
   ["HELPSPAD", :"help"],
   ["INPUT", :"input"],
   ["SPAD", :"spad"],
   ["BOOT", :"boot"],
   ["LISP", :"lsp"],
   ["META", :"meta"],
   ["OUTPUT", :"splog"],
   ["ERRORLIB", :"erlib"],
   ["DATABASE", :"DAASE"],
   ["SPADDATA", :"sdata"],
   ["SPADFORT", :"sfort"],
   ["SPADFORM", :"sform"],
   ["SPADTEX", :"stex"],
   ["SPADOUT", :"spout"]]

+++
$BuiltinAttributes ==
 '(nil infinite arbitraryExponent approximate complex
   shallowMutable canonical noetherian central
   partiallyOrderedSet arbitraryPrecision canonicalsClosed
   noZeroDivisors rightUnitary leftUnitary
   additiveValuation unitsKnown canonicalUnitNormal
   multiplicativeValuation finiteAggregate shallowlyMutable
   commutative)

+++
BLANK == '" "

++
UNDERBAR == '"__"

++ Lisp catch tag used by some Lisp systems to exit the debugger loop.
$quitTag ==
)if %hasFeature KEYWORD::GCL
  SYSTEM::_*QUIT_-TAG_*
)elseif %hasFeature KEYWORD::SBCL
  QUOTE SB_-INT::TOPLEVEL_-CATCHER
)else
  GENSYM()
)endif

--% Constants for OpenAxiom IPC
--??? These constants should ideally be coming from a single
--??? source used by both the C and the Lisp world.
$SessionManager == 1
$ViewportServer == 2
$MenuServer == 3
$SessionIO == 4
$MessageServer == 5
$InterpWindow == 6
$KillSpad == 7
$DebugWindow == 8
$Forker == 9

$CreateFrame == 1
$SwitchFrames == 2
$EndOfOutput == 3
$CallInterp == 4
$EndSession == 5
$LispCommand == 6
$SpadCommand == 7
$SendXEventToHyperTeX == 8
$QuietSpadCommand == 9
$CloseClient == 10
$QueryClients == 11
$QuerySpad == 12
$NonSmanSession == 13
$KillLispSystem == 14


$SpadReaderTag ==
  "SPAD__READER"