-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
eisl.h
1538 lines (1443 loc) · 43.5 KB
/
eisl.h
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
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Easy-ISLisp (ISLisp) written by kenichi sasagawa 2016/4 ~ 2023/9
*/
#ifndef EISL_H
#define EISL_H
#include <setjmp.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <pthread.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include "compat/cdefs.h"
#include "ffi.h"
#include "term.h"
#include "except.h"
#include "compat/eiffel_stubs.h"
#define DYNSIZE 1000
#define STACKSIZE 400000
#define REMKSIZE 3000000
#define BUFSIZE 256
#define STRSIZE 10000
#define SHORT_STRSIZE 32
#define HASHTBSIZE 137
#define PARASIZE 20
#define PROCSIZE 10
#define CTRLSTK 200
#define BACKSIZE 30
#define EISL_PATH_MAX 256
#if defined(__TINYC__) && defined(__riscv)
/* TCC in RISC-V cannot handle a larger number */
#define COL_SIZE 51
#else
#define COL_SIZE 255
#endif
#define NUM_HISTORY 10
#define BIGSIZE 20000000
#define NTTBASE 1000
#define PROFSIZE 1024
#define CPPQUOTE(x) #x
#define STRQUOTE(x) CPPQUOTE(x)
/* following are for unicode<=>UTF-8 transform */
#define UNI2ADD1 192 //#b11000000
#define UNI3ADD1 224 //#b11100000
#define UNI4ADD1 240 //#b11110000
#define UNIOADDO 128 //#b10000000
#define UNI2MSK1 1984 //#b0000011111000000
#define UNI2MSK2 63 //#b0000000000111111
#define UNI3MSK1 61440 //#b1111000000000000
#define UNI3MSK2 4032 //#b0000111111000000
#define UNI3MSK3 63 //#b0000000000111111
#define UNI4MSK1 1835008 //#b00000000000111000000000000000000
#define UNI4MSK2 258048 //#b00000000000000111111000000000000
#define UNI4MSK3 4032 //#b00000000000000000000111111000000
#define UNI4MSK4 63 //#b00000000000000000000000000111111
#define UTF2MSK1 63 //#b00111111
#define UTF3MSK1 31 //#b00011111
#define UTF4MSK1 15 //#b00001111
#define UTFOMSKO 127 //#b01111111
#define isUni1(c) ((unsigned char)(c) <= 0x7f)
#define isUni2(c) (((unsigned char)(c) >= 0xc2) && \
((unsigned char)(c) <= 0xdf))
#define isUni3(c) (((unsigned char)(c) >= 0xe0) && \
((unsigned char)(c) <= 0xef))
#define isUni4(c) (((unsigned char)(c) >= 0xf0) && \
((unsigned char)(c) <= 0xf7))
#define isUni5(c) (((unsigned char)(c) >= 0xf8) && \
((unsigned char)(c) <= 0xfb))
#define isUni6(c) (((unsigned char)(c) >= 0xfc) && \
((unsigned char)(c) <= 0xfd))
#define isUniRest(c) (((unsigned char)(c) >= 0x80) && \
((unsigned char)(c) <= 0xbf))
static const float VERSION = 5.37;
static const int FREESIZE = 1000000;
static const int SYMSIZE = 256;
static const int CHARSIZE = 7; // unicode char. add \0 to tail
static const int MATSIZE = 256;
static const int UNDEF = 4;
static const int FEND = 6;
static const int BIGNUM_BASE = 1000000000;
static const int FAILSE = -1000000000;
static const int BIGNUM_WORK = BIGSIZE * 5 / 10; // from 50% to 90% of bigcell area is working area.
// TCC does not have support for "static conts" as compile time constant
#ifdef __TINYC__
#define BIGNUM_PARMA (BIGSIZE * 9 / 10)
#else
static const int BIGNUM_PARMA = BIGSIZE * 9 / 10; //from 90% to 100% of bigcell area is parmanent area
#endif
typedef enum __packed { EMP, INTN, FLTN, LONGN, BIGN, VEC, ARR, CHR, STR,
SYM,
LIS, DUMMY,
SUBR, FSUBR, FUNC, MACRO, CLASS, INSTANCE, GENERIC, METHOD,
STREAM
} tag_t;
typedef enum __packed { FRE, USE } flag;
typedef int (*subr_t)(int args, int th);
typedef struct __packed {
union __packed {
double fltnum;
long long int lngnum;
struct __packed {
union {
int intnum;
subr_t subr;
FILE *port;
int *dyna_vec;
int sockfd;
} car;
union {
int intnum;
} cdr;
};
} val;
int aux;
int prop;
char *name;
tag_t tag;
flag flag;
signed char option;
char trace;
int prof;
} cell;
typedef enum { LPAREN, RPAREN, QUOTE, DOT, BACKQUOTE, COMMA, ATMARK,
STRING, SYMBOL,
FUNCTION, INTEGER, FLOAT_N, BIGNUM, VECTOR, ARRAY, CHARACTER,
BINARY, OCTAL, DECNUM, HEXNUM, EXPTNUM, EXPTOVERF, EXPTUNDERF, FILEEND,
OTHER
} toktype;
typedef enum { GO, BACK } backtrack;
typedef struct {
char ch;
backtrack flag;
toktype type;
int bufsize;
char *buf;
} token;
typedef struct {
char sepch;
char before[BUFSIZE];
char after[BUFSIZE];
} septoken;
/* ------pointer---- */
extern int ep[PARASIZE]; // environment pointer
extern int dp[PARASIZE]; // dynamic pointer
extern int hp[PARASIZE]; // heap pointer
extern int sp[PARASIZE]; // stack pointer
extern int fc[PARASIZE]; // free counter
extern int ap[PARASIZE]; // arglist pointer
extern int lp[PARASIZE]; // shelter pointer
extern int ac; // allocate counter
extern int cp; // catch tag pointer
/* ------class----- */
extern int cobject;
extern int cbasic_array;
extern int cbasic_array_star;
extern int cgeneral_array_star;
extern int cbasic_vector;
extern int cgeneral_vector;
extern int cstring;
extern int cbuilt_in_class;
extern int ccharacter;
extern int cfunction;
extern int cgeneric_function;
extern int cstandard_generic_function;
extern int clist;
extern int ccons;
extern int cnull;
extern int csymbol;
extern int cnumber;
extern int cfloat;
extern int cinteger;
extern int cserious_condition;
extern int cerror;
extern int carithmetic_error;
extern int cdivision_by_zero;
extern int cfloating_point_overflow;
extern int cfloating_point_underflow;
extern int ccontrol_error;
extern int cparse_error;
extern int cprogram_error;
extern int cdomain_error;
extern int cclass_error;
extern int cundefined_entity;
extern int cunbound_variable;
extern int cundefined_function;
extern int csimple_error;
extern int cstream_error;
extern int cend_of_stream;
extern int cstorage_exhausted;
extern int cstandard_class;
extern int cstandard_object;
extern int cstream;
extern int cinvalid;
extern int cfixnum;
extern int clongnum;
extern int cbignum;
static const int CLASS_NULL = 28;
static const int CLASS_SYMBOL = 29;
/* stream */
extern int standard_input;
extern int standard_output;
extern int standard_error;
extern int input_stream;
extern int output_stream;
extern int error_stream;
extern char stream_str[STRSIZE];
extern int charcnt;
/* read scanner */
extern token stok;
extern int line;
extern int column;
extern char buffer[COL_SIZE + 1][NUM_HISTORY];
extern char buffer1[COL_SIZE + 1];
extern char buffer2[COL_SIZE + 1];
extern char buffer3[STRSIZE];
/* heap and stack */
extern cell heap[CELLSIZE];
extern int stack[STACKSIZE][PARASIZE];
extern int argstk[STACKSIZE][PARASIZE];
extern int cell_hash_table[HASHTBSIZE];
extern int shelter[STACKSIZE][PARASIZE];
extern int dynamic[DYNSIZE][2][PARASIZE];
extern int bigcell[BIGSIZE];
/* bignum pointer, NTT(FFT) input_vector */
extern int big_pt0;
extern int big_pt1;
/* debugger */
extern int examin_sym;
extern int stepper_flag;
/* profiler */
extern int prof_sw;
extern int prof_sym[PROFSIZE];
extern int prof_pt;
extern double prof_dt0[PROFSIZE];
extern int prof_dt1[PROFSIZE];
#define DEF_GETTER(RETURN_TYPE, NAME, MEMBER, DEFAULT) \
static inline RETURN_TYPE GET_ ## NAME (int addr) \
{ \
if (CELLRANGE(addr)) { \
return heap[addr].MEMBER; \
} else { \
return DEFAULT; \
} \
}
DEF_GETTER(int, CAR, val.car.intnum, NIL)
DEF_GETTER(int, CDR, val.cdr.intnum, NIL)
DEF_GETTER(int, AUX, aux, cfixnum)
DEF_GETTER(int, PROP, prop, NIL)
DEF_GETTER(subr_t, SUBR, val.car.subr, NULL)
DEF_GETTER(tag_t, TAG, tag, INTN)
DEF_GETTER(int, PROF, prof, NIL)
DEF_GETTER(int, SOCKET, val.car.sockfd, NIL)
static inline FILE *GET_PORT(int addr)
{
REQUIRE(CELLRANGE(addr) && GET_TAG(addr) == STREAM);
FILE *res = heap[addr].val.car.port;
ENSURE(res != NULL);
return res;
}
static inline int GET_INT(int addr)
{
return ((addr > 0) ? (INT_MASK & addr) : addr);
}
DEF_GETTER(double, FLT, val.fltnum, NIL)
DEF_GETTER(long long int, LONG, val.lngnum, NIL)
static inline void SET_NAME(int addr, const char *x)
{
REQUIRE(CELLRANGE(addr));
heap[addr].name = (char *) x;
}
static inline char *GET_NAME(int addr)
{
REQUIRE(CELLRANGE(addr));
char *res = heap[addr].name;
ENSURE(res != NULL);
return res;
}
static inline char GET_CHAR(int addr)
{
REQUIRE(CELLRANGE(addr) &&
GET_TAG(addr) == CHR && heap[addr].name != NULL);
return heap[addr].name[0];
}
DEF_GETTER(signed char, OPT, option, 0)
static inline void SET_TAG(int addr, tag_t x)
{
REQUIRE(CELLRANGE(addr));
heap[addr].tag = x;
}
static inline void SET_CAR(int addr, int x)
{
REQUIRE(CELLRANGE(addr));
heap[addr].val.car.intnum = x;
}
static inline void SET_CDR(int addr, int x)
{
REQUIRE(CELLRANGE(addr));
heap[addr].val.cdr.intnum = x;
}
static inline void SET_AUX(int addr, int x)
{
REQUIRE(CELLRANGE(addr));
heap[addr].aux = x;
}
static inline int SET_PROP(int addr, int x)
{
if (CELLRANGE(addr)) {
return (heap[addr].prop = x);
} else {
return NIL;
}
}
static inline int SET_PROF(int addr, int x)
{
if (CELLRANGE(addr)) {
return (heap[addr].prof = x);
} else {
return NIL;
}
}
static inline void SET_FLT(int addr, double x)
{
REQUIRE(CELLRANGE(addr) && GET_TAG(addr) == FLTN);
heap[addr].val.fltnum = x;
}
static inline void SET_LONG(int addr, long long int x)
{
REQUIRE(CELLRANGE(addr) && GET_TAG(addr) == LONGN);
heap[addr].val.lngnum = x;
}
static inline void SET_PORT(int addr, FILE * x)
{
REQUIRE(CELLRANGE(addr) && GET_TAG(addr) == STREAM);
heap[addr].val.car.port = x;
}
static inline void SET_SOCKET(int addr, int x)
{
REQUIRE(CELLRANGE(addr) && GET_TAG(addr) == STREAM);
heap[addr].val.car.sockfd = x;
}
static inline void SET_OPT(int addr, signed char x)
{
REQUIRE(CELLRANGE(addr));
heap[addr].option = x;
}
static inline void SET_TR(int addr, char x)
{
REQUIRE(CELLRANGE(addr));
heap[addr].trace = x;
}
static inline void SET(int addr, int x)
{
REQUIRE(CELLRANGE(addr) && CELLRANGE(x));
heap[addr] = heap[x];
}
#define DEF_PREDICATE(NAME, TAG) \
static inline bool IS_ ## NAME (int addr) \
{ \
if (CELLRANGE(addr)) { \
return (heap[addr].tag == TAG); \
} else { \
return NIL; \
} \
}
static inline bool IS_INTEGER(int addr)
{
return !CELLRANGE(addr);
}
DEF_PREDICATE(BIGNNUM, BIGN)
DEF_PREDICATE(LONGNUM, LONGN)
DEF_PREDICATE(FLOAT, FLTN)
DEF_PREDICATE(LIST, LIS)
DEF_PREDICATE(STRING, STR)
static inline bool IS_NIL(int addr)
{
return (addr == NIL);
}
static inline bool IS_T(int addr)
{
return (addr == T);
}
DEF_PREDICATE(VECTOR, VEC)
DEF_PREDICATE(ARRAY, ARR)
DEF_PREDICATE(SUBR, SUBR)
DEF_PREDICATE(FSUBR, FSUBR)
DEF_PREDICATE(FUNC, FUNC)
DEF_PREDICATE(MACRO, MACRO)
DEF_PREDICATE(CLASS, CLASS)
DEF_PREDICATE(GENERIC, GENERIC)
static inline bool HAS_NAME(int addr, const char *x)
{
REQUIRE(CELLRANGE(addr) && heap[addr].name != NULL);
return (strcmp(heap[addr].name, x) == 0);
}
static inline bool SAME_NAME(int addr1, int addr2)
{
REQUIRE(CELLRANGE(addr1) && CELLRANGE(addr2) &&
heap[addr1].name != NULL && heap[addr2].name != NULL);
return (strcmp(heap[addr1].name, heap[addr2].name) == 0);
}
static inline char STRING_REF(int addr, int k)
{
REQUIRE(CELLRANGE(addr) &&
(GET_TAG(addr) == STR || GET_TAG(addr) == SYM ||
(GET_TAG(addr) == CHR && k == 0)) && heap[addr].name != NULL);
return heap[addr].name[k];
}
static inline void STRING_SET(int addr, int k, char c)
{
REQUIRE(CELLRANGE(addr) &&
GET_TAG(addr) == STR && heap[addr].name != NULL);
heap[addr].name[k] = c;
}
static inline int GET_VEC_ELT(int addr, int i)
{
REQUIRE(CELLRANGE(addr) &&
(GET_TAG(addr) == VEC || GET_TAG(addr) == ARR) &&
heap[addr].val.car.dyna_vec != NULL);
return heap[addr].val.car.dyna_vec[i];
}
static inline void SET_VEC_ELT(int addr, int i, int x)
{
REQUIRE(CELLRANGE(addr) &&
(GET_TAG(addr) == VEC || GET_TAG(addr) == ARR) &&
heap[addr].val.car.dyna_vec != NULL);
heap[addr].val.car.dyna_vec[i] = x;
}
static inline void SET_VEC(int addr, int *x)
{
REQUIRE(CELLRANGE(addr) &&
(GET_TAG(addr) == VEC || GET_TAG(addr) == ARR));
heap[addr].val.car.dyna_vec = x;
}
static inline int IDX2C(int i, int j, int ld)
{
return (j * ld + i);
}
static inline int IDX2R(int i, int j, int ld)
{
return (i * ld + j);
}
static inline void append_str(int output_stream, const char *from)
{
char *to = GET_NAME(output_stream);
strncat(to, from, STRSIZE - strlen(to) - 1);
to[STRSIZE - 1] = '\0';
SET_PROP(output_stream, GET_PROP(output_stream) + strlen(from));
}
static inline void output_str(int output_stream, const char *from)
{
if (GET_OPT(output_stream) != EISL_OUTSTR) {
fputs(from, GET_PORT(output_stream));
} else {
append_str(output_stream, from);
}
}
static inline void output_char(int output_stream, char c)
{
if (GET_OPT(output_stream) != EISL_OUTSTR) {
fputc(c, GET_PORT(output_stream));
} else {
stream_str[0] = c;
stream_str[1] = '\0';
append_str(output_stream, stream_str);
}
}
// object oriented
extern int generic_func;
extern int generic_vars;
extern int next_method;
extern int generic_list;
extern int setf_list;
// flag
extern int gArgC;
extern char **gArgV;
extern bool gbc_flag;
extern int genint;
extern bool simp_flag;
extern bool ignore_flag;
extern bool open_flag;
extern bool top_flag;
extern bool redef_flag;
extern bool start_flag;
extern bool back_flag;
extern bool ignore_topchk;
#ifdef WITHOUT_CURSES
#define repl_flag false
#else
extern bool repl_flag;
extern bool org_repl_flag;
#endif
extern bool option_flag;
extern volatile sig_atomic_t exit_flag;
extern bool greeting_flag;
extern bool script_flag;
extern bool handling_resource_err;
extern bool looking_for_shebang;
extern bool multiple_call_next_method;
extern bool error_flag;
extern bool parallel_flag;
extern bool parallel_exit_flag;
extern bool process_flag;
extern bool thread_flag;
extern bool network_flag;
extern bool connect_flag;
extern bool receiver_exit_flag;
extern bool child_busy_flag;
// try function
extern bool try_flag;
extern double try_timer;
extern int try_res;
/* longjmp control and etc */
extern Except_T Restart_Repl, Exit_Interp;
extern jmp_buf block_buf[CTRLSTK];
extern jmp_buf catch_buf[CTRLSTK];
extern jmp_buf cont_buf;
extern Except_T Ignored_Error;
extern Except_T Exit_Thread;
extern Except_T Exit_Process;
extern Except_T Exit_Network;
extern int block_tag_check[CTRLSTK];
extern int block_data[CTRLSTK][3];
extern int catch_data[CTRLSTK][4];
extern int unwind_buf[CTRLSTK];
extern int block_pt; // pointer for block
extern int catch_pt; // catch counter
extern int unwind_pt; // lambda address for unwind-protect
extern int block_arg; // argument that block will recieve
extern int catch_arg; // argument that catch will recieve
extern int cont_arg; // argument that signal_condition will recieve
extern int tagbody_tag; // tag symbol address in tagbody
extern int error_handler;
extern int error_handler1;
extern int trace_list;
extern int backtrace[BACKSIZE];
extern int unwind_nest;
extern int signal_condition_x;
extern int signal_condition_y;
/* editor */
extern int ed_lparen_col;
extern int ed_rparen_col;
extern const char *ed_candidate[COMPLETION_CANDIDATES_MAX];
extern int ed_candidate_pt;
extern const short ed_syntax_color;
extern const short ed_builtin_color;
extern const short ed_extended_color;
extern const short ed_string_color;
extern const short ed_comment_color;
extern int ed_incomment;
/* multi thread */
extern pthread_mutex_t mutex;
extern pthread_mutex_t mutex1;
extern int mt_queue[PARASIZE];
extern int mt_queue_pt;
extern int mt_queue_num;
extern int thread_num;
extern int para_input[PARASIZE];
extern int para_output[PARASIZE];
extern pthread_t mt_para_thread[PARASIZE];
extern pthread_cond_t mt_cond_para[PARASIZE];
extern pthread_cond_t mt_cond_main;
extern pthread_cond_t mt_cond_queue;
extern pthread_attr_t mt_para_attr[PARASIZE];
extern size_t mt_para_size[PARASIZE];
/*multi proccess*/
extern int pipe_p2c[PROCSIZE][2];
extern int pipe_c2p[PROCSIZE][2];
extern pid_t pid[PROCSIZE];
extern int process_pt;
extern int process_num;
extern struct sigaction child_action;
extern int child_signal[PROCSIZE];
extern int child_signal1[PROCSIZE];
/* distributed parallel */
#define PORT 5000
extern int sockfd[PARASIZE];
extern socklen_t parent_len;
extern struct sockaddr_in parent_addr, child_addr[PARASIZE];
extern int child_num;
extern pthread_t receiver_thread;
extern int child_result[PARASIZE];
/* -----TCPIP for server----------------*/
extern socklen_t server_len;
extern struct sockaddr_in server_addr,client_addr;
// -------error code---
enum {
UNDEF_VAR = 101,
UNDEF_FUN,
NOT_COMPUTABLE,
OUT_OF_RANGE,
MALLOC_OVERF,
UNDEF_CLASS,
WRONG_ARGS,
NOT_NUM,
NOT_STR,
NOT_LIST,
NOT_SYM,
ILLEGAL_INPUT,
NOT_FUNC,
UNDEF_TAG,
CANT_OPEN,
ILLEGAL_ARGS,
NOT_VEC,
NOT_ARR,
NOT_CLASS,
NOT_METHOD,
NOT_CONS,
CANT_MODIFY,
NOT_INT,
NOT_STREAM,
NOT_STREAM_ERROR,
NOT_OUT_STREAM,
NOT_IN_STREAM,
NOT_CHAR,
NOT_FLT,
NOT_INSTANCE,
CTRL_OVERF,
ILLEGAL_RPAREN,
END_STREAM,
ILLEGAL_FORM,
IMPROPER_FORM,
DIV_ZERO,
NOT_VECARR,
CANT_CREATE,
CANT_PARSE,
CANT_ASSURE,
NOT_EXIST_METHOD,
HAS_COMMON_CLASS,
ILLEGAL_CLASS,
NOT_TOP_LEVEL,
NOT_POSITIVE,
FLT_OVERF,
FLT_UNDERF,
CANT_REDEFINE,
STACK_OVERF,
SHELTER_OVERF,
STACK_UNDERF,
SHELTER_UNDERF,
SYSTEM_ERR,
RESOURCE_ERR,
NOT_EXIST_ARG,
IMPROPER_ARGS,
OUT_OF_DOMAIN,
FLT_OUT_OF_DOMAIN,
OUT_OF_REAL,
NOT_BASIC_ARRAY,
SERIOUS_ERR,
ARITHMETIC_ERR,
DOMAIN_ERR,
UNDEF_DYN,
UNDEF_ENTITY,
SIMPLE_ERR,
EXHAUSTED_ERR,
VARIABLE_OVERF,
};
double getETime(void);
int readc(void);
int absolute(int x);
int add_sym(const char *name, int index);
int adaptp(int varlist, int arglist);
int angle(int y, int x);
int append(int x, int y);
int apply(int func, int arg, int th);
int arg_push(int addr, int th);
int arg_pop(int th);
int array(int n, int ls);
int array_dim(int n, int ls);
int array_length(int obj);
int array_ref(int obj, int ls);
int array_set(int obj, int ls, int val);
int arrayp(int addr);
int assoc(int sym, int lis);
int assoc_list_p(int ls);
int assq(int x, int y);
int atomp(int addr);
int bignump(int x);
int bignum_token(char buf[]);
int big_abs(int x);
int big_big_to_flt(int x);
int big_eqp(int x, int y);
int big_first_half(int x);
int big_flt_to_big(int x);
int big_int_to_big(int x);
int big_karatsuba_mult(int x, int y);
int big_karatsuba_mult1(int x, int y);
int big_length(int x);
int big_long_to_big(int x);
int big_minus(int arg1, int arg2);
int big_minus1(int arg1, int arg2);
int big_mult(int arg1, int arg2);
int big_mult_i(int x, int y);
int big_mult1(int arg1, int arg2);
int big_ntt_mult(int x, int y);
int big_negativep(int x);
int big_plus(int arg1, int arg2);
int big_plus1(int arg1, int arg2);
int big_positivep(int x);
int big_div(int arg1, int arg2);
int big_div_i(int x, int y);
int big_div1(int arg1, int arg2);
int big_remainder(int x, int y);
int big_remainder_i(int x, int y);
int big_second_half(int x);
int big_shift_left(int x, int n);
int big_shift_right(int x, int n);
int big_simplify(int x);
int big_smallerp(int arg1, int arg2);
int big_take_from_left(int x, int n);
int big_to_parmanent(int x);
int big_zero_supress(int x, int n);
int bind_args(int x);
int bin_token(char buf[]);
int binary_input_stream_p(int x);
int binary_output_stream_p(int x);
int caar(int addr);
int cadar(int addr);
int caddar(int addr);
int caddr(int addr);
int cadr(int addr);
int car(int addr);
int cdar(int addr);
int cdddr(int addr);
int cddr(int addr);
int cdr(int addr);
int charp(int x);
int check_dimension(int ls);
int check_gbc(int th);
int classp(int x);
int class_symbol_p(int x);
int clear_child_signal(void);
int cons(int car, int cdr);
int copy(int x);
int count_args(int ls);
int create_array(int x);
int create_list(int x, int y);
int dec_token(char buf[]);
int divide(int arg1, int arg2);
int duplicate_list_p(int ls);
int each_car(int x);
int each_cdr(int x);
int eqgreaterp(int x, int y);
int eqlp(int addr1, int addr2);
int eqp(int addr1, int addr2);
int eqsmallerp(int x, int y);
int equalp(int addr1, int addr2);
int eval(int addr, int th);
int evlis(int addr, int th);
int exact_to_inexact(int x);
int eval_para(int arg);
int eval_args(int x);
int expt(int x, int y);
int expt_token(char buf[]);
int f_abs(int arglist, int th);
int f_address(int arglist, int th);
int f_and(int arglist, int th);
int f_append(int arglist, int th);
int f_apply(int arglist, int th);
int f_aref(int arglist,int th);
int f_arithmetic_error_operands(int arglist, int th);
int f_arithmetic_error_operation(int arglist, int th);
int f_array_dimensions(int arglist, int th);
int f_assoc(int arglist, int th);
int f_assure(int arglist, int th);
int f_atan(int arglist,int th);
int f_atan2(int arglist, int th);
int f_atanh(int arglist, int th);
int f_atomp(int arglist, int th);
int f_basic_array_p(int arglist, int th);
int f_basic_array_star_p(int arglist, int th);
int f_basic_vector_p(int arglist, int th);
int f_debug(int arglist,int th);
int f_block(int arglist,int th);
int f_break(int arglist, int th);
int f_call_next_method(int arglist, int th);
int f_car(int arglist, int th);
int f_case(int arglist, int th);
int f_case_using(int arglist, int th);
int f_catch(int arglist, int th);
int f_cdr(int arglist, int th);
int f_ceiling(int arglist, int th);
int f_cerror(int arglist, int th);
int f_char_eqgreaterp(int arglist, int th);
int f_char_eqp(int arglist, int th);
int f_char_eqsmallerp(int arglist, int th);
int f_char_greaterp(int arglist, int th);
int f_char_index(int arglist, int th);
int f_char_noteqp(int arglist, int th);
int f_char_smallerp(int arglist, int th);
int f_characterp(int arglist, int th);
int f_class(int arglist,int th);
int f_class_of(int arglist, int th);
int f_close(int arglist, int th);
int f_cond(int arglist, int th);
int f_condition_continuable(int arglist, int th);
int f_cons(int arglist, int th);
int f_consp(int arglist, int th);
int f_continue_condition(int arglist, int th);
int f_convert(int arglist, int th);
int f_cos(int arglist, int th);
int f_cosh(int arglist, int th);
int f_create_array(int arglist, int th);
int f_create_list(int arglist, int th);
int f_create_star(int arglist, int th);
int f_create_string(int arglist, int th);
int f_create_string_input_stream(int arglist, int th);
int f_create_string_output_stream(int arglist, int th);
int f_create_vector(int arglist, int th);
int f_defclass(int arglist, int th);
int f_defconstant(int arglist, int th);
int f_defdynamic(int arglist, int th);
int f_defgeneric(int arglist, int th);
int f_defgeneric_star(int arglist, int th);
int f_defglobal(int arglist, int th);
int f_defmacro(int arglist, int th);
int f_defmethod(int arglist, int th);
int f_defmodule(int arglist,int th);
int f_defun(int arglist, int th);
int f_div(int arglist, int th);
int f_domain_error_expected_class(int arglist, int th);
int f_domain_error_object(int arglist, int th);
int f_dp_create(int arglist, int th);
int f_dp_close(int arglist, int th);
int f_dp_let(int arglist, int th);
int f_dp_eval(int arglist, int th);
int f_dp_transfer(int arglist, int th);
int f_dp_receive(int arglist, int th);
int f_dp_load(int arglist, int th);
int f_dp_compile(int arglist, int th);
int f_dp_call(int arglist, int th);
int f_dp_exec(int arglist, int th);
int f_dp_part(int arglist, int th);
int f_dp_report(int arglist, int th);
int f_dummyp(int arglist, int th);
int f_dynamic(int arglist, int th);
int f_dynamic_let(int arglist, int th);
int f_eisl_test(int arglist, int th);
int f_elt(int arglist, int th);
int f_eq(int arglist, int th);
int f_eqgreater(int arglist, int th);
int f_eql(int arglist, int th);
int f_eqsmaller(int arglist, int th);
int f_equal(int arglist, int th);
int f_error(int arglist, int th);
int f_error_output(int arglist, int th);
int f_eval(int arglist, int th);
int f_exp(int arglist, int th);
int f_expt(int arglist, int th);
int f_file_length(int arglist, int th);
int f_file_position(int arglist, int th);
int f_finish_output(int arglist, int th);
int f_flet(int arglist, int th);
int f_float(int arglist, int th);
int f_floatp(int arglist, int th);
int f_floor(int arglist, int th);
int f_for(int arglist, int th);
int f_format(int arglist, int th);
int f_format_char(int arglist, int th);
int f_format_float(int arglist, int th);
int f_format_fresh_line(int arglist, int th);
int f_format_integer(int arglist, int th);
int f_format_object(int arglist, int th);
int f_format_tab(int arglist, int th);
int f_funcall(int arglist, int th);
int f_function(int arglist, int th);
int f_function_star(int arglist, int th);
int f_functionp(int arglist, int th);
int f_funcp(int arglist, int th);
int f_garef(int arglist, int th);
int f_gbc(int arglist, int th);
int f_gcd(int arglist, int th);
int f_general_array_star_p(int arglist, int th);
int f_general_vector_p(int arglist, int th);
int f_generic_function_p(int arglist, int th);
int f_gensym(int arglist, int th);
int f_get_internal_real_time(int arglist, int th);
int f_get_internal_run_time(int arglist, int th);
int f_get_myself(int arglist, int th);
int f_get_output_stream_string(int arglist, int th);
int f_get_universal_time(int arglist, int th);
int f_go(int arglist, int th);
int f_getenv(int arglist, int th);
int f_greater(int arglist, int th);
int f_heapdump(int arglist, int th);
int f_identity(int arglist, int th);
int f_if(int arglist, int th);
int f_ignore_errors(int arglist, int th);
int f_import(int arglist, int th);
int f_initialize_object_star(int arglist, int th);
int f_input_stream_p(int arglist, int th);
int f_instance(int arglist, int th);
int f_instancep(int arglist, int th);
int f_integerp(int arglist, int th);
int f_internal_time_units_per_second(int arglist, int th);
int f_isqrt(int arglist, int th);
int f_labels(int arglist, int th);
int f_lambda(int arglist, int th);
int f_lcm(int arglist, int th);
int f_length(int arglist, int th);
int f_let(int arglist, int th);
int f_letstar(int arglist, int th);
int f_list(int arglist, int th);
int f_listp(int arglist, int th);
int f_load(int arglist, int th);
int f_log(int arglist, int th);
int f_macroexpand_1(int arglist, int th);
int f_macroexpand_all(int arglist, int th);
int f_map_into(int arglist, int th);
int f_mapc(int arglist, int th);
int f_mapcan(int arglist, int th);
int f_mapcar(int arglist, int th);
int f_mapcon(int arglist, int th);