… | |
… | |
34 | |
34 | |
35 | #include <sys/types.h> |
35 | #include <sys/types.h> |
36 | #include <sys/stat.h> |
36 | #include <sys/stat.h> |
37 | #include <fcntl.h> |
37 | #include <fcntl.h> |
38 | |
38 | |
|
|
39 | #if !USE_ERROR_CHECKING |
|
|
40 | # define NDEBUG |
|
|
41 | #endif |
|
|
42 | |
|
|
43 | #include <assert.h> |
|
|
44 | #include <stdlib.h> |
39 | #include <string.h> |
45 | #include <string.h> |
40 | #include <stdlib.h> |
|
|
41 | |
46 | |
42 | #include <limits.h> |
47 | #include <limits.h> |
43 | #include <inttypes.h> |
48 | #include <inttypes.h> |
44 | #include <float.h> |
49 | #include <float.h> |
45 | //#include <ctype.h> |
50 | //#include <ctype.h> |
|
|
51 | |
|
|
52 | #if '1' != '0' + 1 \ |
|
|
53 | || '2' != '0' + 2 || '3' != '0' + 3 || '4' != '0' + 4 || '5' != '0' + 5 \ |
|
|
54 | || '6' != '0' + 6 || '7' != '0' + 7 || '8' != '0' + 8 || '9' != '0' + 9 \ |
|
|
55 | || 'b' != 'a' + 1 || 'c' != 'a' + 2 || 'd' != 'a' + 3 || 'e' != 'a' + 4 \ |
|
|
56 | || 'f' != 'a' + 5 |
|
|
57 | # error "execution character set digits not consecutive" |
|
|
58 | #endif |
46 | |
59 | |
47 | enum { |
60 | enum { |
48 | TOK_EOF, |
61 | TOK_EOF, |
49 | TOK_LPAREN, |
62 | TOK_LPAREN, |
50 | TOK_RPAREN, |
63 | TOK_RPAREN, |
51 | TOK_DOT, |
64 | TOK_DOT, |
52 | TOK_ATOM, |
65 | TOK_ATOM, |
|
|
66 | TOK_DOTATOM, /* atom name starting with '.' */ |
|
|
67 | TOK_STRATOM, /* atom name enclosed in | */ |
53 | TOK_QUOTE, |
68 | TOK_QUOTE, |
54 | TOK_DQUOTE, |
69 | TOK_DQUOTE, |
55 | TOK_BQUOTE, |
70 | TOK_BQUOTE, |
56 | TOK_COMMA, |
71 | TOK_COMMA, |
57 | TOK_ATMARK, |
72 | TOK_ATMARK, |
… | |
… | |
59 | TOK_SHARP_CONST, |
74 | TOK_SHARP_CONST, |
60 | TOK_VEC |
75 | TOK_VEC |
61 | }; |
76 | }; |
62 | |
77 | |
63 | #define BACKQUOTE '`' |
78 | #define BACKQUOTE '`' |
64 | #define DELIMITERS "()\";\f\t\v\n\r " |
79 | #define WHITESPACE " \t\r\n\v\f" |
|
|
80 | #define DELIMITERS "()\";" WHITESPACE |
65 | |
81 | |
66 | #define NIL (&SCHEME_V->xNIL) //TODO: make this 0? |
82 | #define NIL (&SCHEME_V->xNIL) //TODO: make this 0? |
67 | #define S_T (&SCHEME_V->xT) //TODO: magic ptr value? |
83 | #define S_T (&SCHEME_V->xT) //TODO: magic ptr value? |
68 | #define S_F (&SCHEME_V->xF) //TODO: magic ptr value? |
84 | #define S_F (&SCHEME_V->xF) //TODO: magic ptr value? |
69 | #define S_SINK (&SCHEME_V->xsink) |
85 | #define S_SINK (&SCHEME_V->xsink) |
… | |
… | |
391 | } |
407 | } |
392 | |
408 | |
393 | INTERFACE char * |
409 | INTERFACE char * |
394 | symname (pointer p) |
410 | symname (pointer p) |
395 | { |
411 | { |
396 | return strvalue (car (p)); |
412 | return strvalue (p); |
397 | } |
413 | } |
398 | |
414 | |
399 | #if USE_PLIST |
415 | #if USE_PLIST |
400 | SCHEME_EXPORT int |
416 | SCHEME_EXPORT int |
401 | hasprop (pointer p) |
417 | hasprop (pointer p) |
… | |
… | |
425 | } |
441 | } |
426 | |
442 | |
427 | INTERFACE char * |
443 | INTERFACE char * |
428 | syntaxname (pointer p) |
444 | syntaxname (pointer p) |
429 | { |
445 | { |
430 | return strvalue (car (p)); |
446 | return strvalue (p); |
431 | } |
447 | } |
432 | |
448 | |
433 | #define procnum(p) ivalue_unchecked (p) |
449 | #define procnum(p) ivalue_unchecked (p) |
434 | static const char *procname (pointer x); |
450 | static const char *procname (pointer x); |
435 | |
451 | |
… | |
… | |
651 | #endif |
667 | #endif |
652 | |
668 | |
653 | static int file_push (SCHEME_P_ const char *fname); |
669 | static int file_push (SCHEME_P_ const char *fname); |
654 | static void file_pop (SCHEME_P); |
670 | static void file_pop (SCHEME_P); |
655 | static int file_interactive (SCHEME_P); |
671 | static int file_interactive (SCHEME_P); |
656 | ecb_inline int is_one_of (char *s, int c); |
672 | ecb_inline int is_one_of (const char *s, int c); |
657 | static int alloc_cellseg (SCHEME_P_ int n); |
673 | static int alloc_cellseg (SCHEME_P_ int n); |
658 | ecb_inline pointer get_cell (SCHEME_P_ pointer a, pointer b); |
674 | ecb_inline pointer get_cell (SCHEME_P_ pointer a, pointer b); |
659 | static void finalize_cell (SCHEME_P_ pointer a); |
675 | static void finalize_cell (SCHEME_P_ pointer a); |
660 | static int count_consecutive_cells (pointer x, int needed); |
676 | static int count_consecutive_cells (pointer x, int needed); |
661 | static pointer find_slot_in_env (SCHEME_P_ pointer env, pointer sym, int all); |
677 | static pointer find_slot_in_env (SCHEME_P_ pointer env, pointer sym, int all); |
… | |
… | |
678 | static void mark (pointer a); |
694 | static void mark (pointer a); |
679 | static void gc (SCHEME_P_ pointer a, pointer b); |
695 | static void gc (SCHEME_P_ pointer a, pointer b); |
680 | static int basic_inchar (port *pt); |
696 | static int basic_inchar (port *pt); |
681 | static int inchar (SCHEME_P); |
697 | static int inchar (SCHEME_P); |
682 | static void backchar (SCHEME_P_ int c); |
698 | static void backchar (SCHEME_P_ int c); |
683 | static char *readstr_upto (SCHEME_P_ char *delim); |
699 | static char *readstr_upto (SCHEME_P_ int skip, const char *delim); |
684 | static pointer readstrexp (SCHEME_P); |
700 | static pointer readstrexp (SCHEME_P_ char delim); |
685 | ecb_inline int skipspace (SCHEME_P); |
701 | ecb_inline int skipspace (SCHEME_P); |
686 | static int token (SCHEME_P); |
702 | static int token (SCHEME_P); |
687 | static void printslashstring (SCHEME_P_ char *s, int len); |
703 | static void printslashstring (SCHEME_P_ char *s, int len); |
688 | static void atom2str (SCHEME_P_ pointer l, int f, char **pp, int *plen); |
704 | static void atom2str (SCHEME_P_ pointer l, int f, char **pp, int *plen); |
689 | static void printatom (SCHEME_P_ pointer l, int f); |
705 | static void printatom (SCHEME_P_ pointer l, int f); |
… | |
… | |
1079 | return x; |
1095 | return x; |
1080 | } |
1096 | } |
1081 | |
1097 | |
1082 | /* ========== oblist implementation ========== */ |
1098 | /* ========== oblist implementation ========== */ |
1083 | |
1099 | |
|
|
1100 | static pointer |
|
|
1101 | generate_symbol (SCHEME_P_ const char *name) |
|
|
1102 | { |
|
|
1103 | pointer x = mk_string (SCHEME_A_ name); |
|
|
1104 | setimmutable (x); |
|
|
1105 | set_typeflag (x, T_SYMBOL | T_ATOM); |
|
|
1106 | return x; |
|
|
1107 | } |
|
|
1108 | |
1084 | #ifndef USE_OBJECT_LIST |
1109 | #ifndef USE_OBJECT_LIST |
1085 | |
1110 | |
|
|
1111 | static int |
1086 | static int hash_fn (const char *key, int table_size); |
1112 | hash_fn (const char *key, int table_size) |
|
|
1113 | { |
|
|
1114 | const unsigned char *p = key; |
|
|
1115 | uint32_t hash = 2166136261; |
|
|
1116 | |
|
|
1117 | while (*p) |
|
|
1118 | hash = (hash ^ *p++) * 16777619; |
|
|
1119 | |
|
|
1120 | return hash % table_size; |
|
|
1121 | } |
1087 | |
1122 | |
1088 | static pointer |
1123 | static pointer |
1089 | oblist_initial_value (SCHEME_P) |
1124 | oblist_initial_value (SCHEME_P) |
1090 | { |
1125 | { |
1091 | return mk_vector (SCHEME_A_ 461); /* probably should be bigger */ |
1126 | return mk_vector (SCHEME_A_ 461); /* probably should be bigger */ |
… | |
… | |
1093 | |
1128 | |
1094 | /* returns the new symbol */ |
1129 | /* returns the new symbol */ |
1095 | static pointer |
1130 | static pointer |
1096 | oblist_add_by_name (SCHEME_P_ const char *name) |
1131 | oblist_add_by_name (SCHEME_P_ const char *name) |
1097 | { |
1132 | { |
1098 | int location; |
1133 | pointer x = generate_symbol (SCHEME_A_ name); |
1099 | |
|
|
1100 | pointer x = immutable_cons (mk_string (SCHEME_A_ name), NIL); |
|
|
1101 | set_typeflag (x, T_SYMBOL); |
|
|
1102 | setimmutable (car (x)); |
|
|
1103 | |
|
|
1104 | location = hash_fn (name, veclength (SCHEME_V->oblist)); |
1134 | int location = hash_fn (name, veclength (SCHEME_V->oblist)); |
1105 | vector_set (SCHEME_V->oblist, location, immutable_cons (x, vector_get (SCHEME_V->oblist, location))); |
1135 | vector_set (SCHEME_V->oblist, location, immutable_cons (x, vector_get (SCHEME_V->oblist, location))); |
1106 | return x; |
1136 | return x; |
1107 | } |
1137 | } |
1108 | |
1138 | |
1109 | ecb_inline pointer |
1139 | ecb_inline pointer |
… | |
… | |
1169 | |
1199 | |
1170 | /* returns the new symbol */ |
1200 | /* returns the new symbol */ |
1171 | static pointer |
1201 | static pointer |
1172 | oblist_add_by_name (SCHEME_P_ const char *name) |
1202 | oblist_add_by_name (SCHEME_P_ const char *name) |
1173 | { |
1203 | { |
1174 | pointer x; |
1204 | pointer x = mk_string (SCHEME_A_ name); |
1175 | |
|
|
1176 | x = immutable_cons (mk_string (SCHEME_A_ name), NIL); |
|
|
1177 | set_typeflag (x, T_SYMBOL); |
1205 | set_typeflag (x, T_SYMBOL); |
1178 | setimmutable (car (x)); |
1206 | setimmutable (x); |
1179 | SCHEME_V->oblist = immutable_cons (x, SCHEME_V->oblist); |
1207 | SCHEME_V->oblist = immutable_cons (x, SCHEME_V->oblist); |
1180 | return x; |
1208 | return x; |
1181 | } |
1209 | } |
1182 | |
1210 | |
1183 | static pointer |
1211 | static pointer |
… | |
… | |
1273 | SCHEME_V->no_memory = 1; |
1301 | SCHEME_V->no_memory = 1; |
1274 | return SCHEME_V->strbuff; |
1302 | return SCHEME_V->strbuff; |
1275 | } |
1303 | } |
1276 | |
1304 | |
1277 | if (str) |
1305 | if (str) |
1278 | { |
1306 | memcpy (q, str , len_str); /* caller must ensure that *str has length len_str */ |
1279 | int l = strlen (str); |
|
|
1280 | |
|
|
1281 | if (l > len_str) |
|
|
1282 | l = len_str; |
|
|
1283 | |
|
|
1284 | memcpy (q, str, l); |
|
|
1285 | q[l] = 0; |
|
|
1286 | } |
|
|
1287 | else |
1307 | else |
1288 | { |
|
|
1289 | memset (q, fill, len_str); |
1308 | memset (q, fill, len_str); |
|
|
1309 | |
1290 | q[len_str] = 0; |
1310 | q[len_str] = 0; |
1291 | } |
|
|
1292 | |
1311 | |
1293 | return q; |
1312 | return q; |
1294 | } |
1313 | } |
1295 | |
1314 | |
1296 | INTERFACE pointer |
1315 | INTERFACE pointer |
… | |
… | |
1310 | pointer x = get_cell (SCHEME_A_ NIL, NIL); |
1329 | pointer x = get_cell (SCHEME_A_ NIL, NIL); |
1311 | |
1330 | |
1312 | set_typeflag (x, T_STRING | T_ATOM); |
1331 | set_typeflag (x, T_STRING | T_ATOM); |
1313 | strvalue (x) = store_string (SCHEME_A_ len, str, 0); |
1332 | strvalue (x) = store_string (SCHEME_A_ len, str, 0); |
1314 | strlength (x) = len; |
1333 | strlength (x) = len; |
|
|
1334 | |
1315 | return x; |
1335 | return x; |
1316 | } |
1336 | } |
1317 | |
1337 | |
1318 | INTERFACE pointer |
1338 | INTERFACE pointer |
1319 | mk_string (SCHEME_P_ const char *str) |
1339 | mk_string (SCHEME_P_ const char *str) |
… | |
… | |
1332 | { |
1352 | { |
1333 | int i; |
1353 | int i; |
1334 | |
1354 | |
1335 | for (i = start; i < veclength (vec); i++) |
1355 | for (i = start; i < veclength (vec); i++) |
1336 | vecvalue (vec)[i] = obj; |
1356 | vecvalue (vec)[i] = obj; |
|
|
1357 | } |
|
|
1358 | |
|
|
1359 | INTERFACE void |
|
|
1360 | vector_resize (pointer vec, uint32_t newsize, pointer fill) |
|
|
1361 | { |
|
|
1362 | uint32_t oldsize = veclength (vec); |
|
|
1363 | vecvalue (vec) = realloc (vecvalue (vec), newsize * sizeof (pointer)); |
|
|
1364 | veclength (vec) = newsize; |
|
|
1365 | fill_vector (vec, oldsize, fill); |
1337 | } |
1366 | } |
1338 | |
1367 | |
1339 | INTERFACE pointer |
1368 | INTERFACE pointer |
1340 | vector_get (pointer vec, uint32_t ielem) |
1369 | vector_get (pointer vec, uint32_t ielem) |
1341 | { |
1370 | { |
… | |
… | |
1363 | |
1392 | |
1364 | INTERFACE pointer |
1393 | INTERFACE pointer |
1365 | gensym (SCHEME_P) |
1394 | gensym (SCHEME_P) |
1366 | { |
1395 | { |
1367 | pointer x; |
1396 | pointer x; |
1368 | |
|
|
1369 | for (; SCHEME_V->gensym_cnt < LONG_MAX; SCHEME_V->gensym_cnt++) |
|
|
1370 | { |
|
|
1371 | char name[40] = "gensym-"; |
1397 | char name[40] = "gensym-"; |
1372 | xnum (name + 7, SCHEME_V->gensym_cnt); |
1398 | xnum (name + 7, ++SCHEME_V->gensym_cnt); |
1373 | |
1399 | |
1374 | /* first check oblist */ |
1400 | return generate_symbol (SCHEME_A_ name); |
1375 | x = oblist_find_by_name (SCHEME_A_ name); |
|
|
1376 | |
|
|
1377 | if (x == NIL) |
|
|
1378 | { |
|
|
1379 | x = oblist_add_by_name (SCHEME_A_ name); |
|
|
1380 | return x; |
|
|
1381 | } |
|
|
1382 | } |
|
|
1383 | |
|
|
1384 | return NIL; |
|
|
1385 | } |
1401 | } |
1386 | |
1402 | |
1387 | /* make symbol or number atom from string */ |
1403 | /* make symbol or number atom from string */ |
1388 | static pointer |
1404 | static pointer |
1389 | mk_atom (SCHEME_P_ char *q) |
1405 | mk_atom (SCHEME_P_ char *q) |
… | |
… | |
1673 | |
1689 | |
1674 | static void |
1690 | static void |
1675 | finalize_cell (SCHEME_P_ pointer a) |
1691 | finalize_cell (SCHEME_P_ pointer a) |
1676 | { |
1692 | { |
1677 | /* TODO, fast bitmap check? */ |
1693 | /* TODO, fast bitmap check? */ |
1678 | if (is_string (a)) |
1694 | if (is_string (a) || is_symbol (a)) |
1679 | free (strvalue (a)); |
1695 | free (strvalue (a)); |
1680 | else if (is_vector (a)) |
1696 | else if (is_vector (a)) |
1681 | free (vecvalue (a)); |
1697 | free (vecvalue (a)); |
1682 | #if USE_PORTS |
1698 | #if USE_PORTS |
1683 | else if (is_port (a)) |
1699 | else if (is_port (a)) |
… | |
… | |
2105 | #endif |
2121 | #endif |
2106 | } |
2122 | } |
2107 | |
2123 | |
2108 | /* read characters up to delimiter, but cater to character constants */ |
2124 | /* read characters up to delimiter, but cater to character constants */ |
2109 | static char * |
2125 | static char * |
2110 | readstr_upto (SCHEME_P_ char *delim) |
2126 | readstr_upto (SCHEME_P_ int skip, const char *delim) |
2111 | { |
2127 | { |
2112 | char *p = SCHEME_V->strbuff; |
2128 | char *p = SCHEME_V->strbuff + skip; |
2113 | |
2129 | |
2114 | while ((p - SCHEME_V->strbuff < sizeof (SCHEME_V->strbuff)) && !is_one_of (delim, (*p++ = inchar (SCHEME_A)))); |
2130 | while ((p - SCHEME_V->strbuff < sizeof (SCHEME_V->strbuff)) && !is_one_of (delim, (*p++ = inchar (SCHEME_A)))); |
2115 | |
2131 | |
2116 | if (p == SCHEME_V->strbuff + 2 && p[-2] == '\\') |
2132 | if (p == SCHEME_V->strbuff + 2 && p[-2] == '\\') |
2117 | *p = 0; |
2133 | *p = 0; |
… | |
… | |
2124 | return SCHEME_V->strbuff; |
2140 | return SCHEME_V->strbuff; |
2125 | } |
2141 | } |
2126 | |
2142 | |
2127 | /* read string expression "xxx...xxx" */ |
2143 | /* read string expression "xxx...xxx" */ |
2128 | static pointer |
2144 | static pointer |
2129 | readstrexp (SCHEME_P) |
2145 | readstrexp (SCHEME_P_ char delim) |
2130 | { |
2146 | { |
2131 | char *p = SCHEME_V->strbuff; |
2147 | char *p = SCHEME_V->strbuff; |
2132 | int c; |
2148 | int c; |
2133 | int c1 = 0; |
2149 | int c1 = 0; |
2134 | enum |
|
|
2135 | { st_ok, st_bsl, st_x1, st_x2, st_oct1, st_oct2 } state = st_ok; |
2150 | enum { st_ok, st_bsl, st_x1, st_x2, st_oct1, st_oct2 } state = st_ok; |
2136 | |
2151 | |
2137 | for (;;) |
2152 | for (;;) |
2138 | { |
2153 | { |
2139 | c = inchar (SCHEME_A); |
2154 | c = inchar (SCHEME_A); |
2140 | |
2155 | |
… | |
… | |
2142 | return S_F; |
2157 | return S_F; |
2143 | |
2158 | |
2144 | switch (state) |
2159 | switch (state) |
2145 | { |
2160 | { |
2146 | case st_ok: |
2161 | case st_ok: |
2147 | switch (c) |
2162 | if (ecb_expect_false (c == delim)) |
2148 | { |
|
|
2149 | case '\\': |
|
|
2150 | state = st_bsl; |
|
|
2151 | break; |
|
|
2152 | |
|
|
2153 | case '"': |
|
|
2154 | *p = 0; |
|
|
2155 | return mk_counted_string (SCHEME_A_ SCHEME_V->strbuff, p - SCHEME_V->strbuff); |
2163 | return mk_counted_string (SCHEME_A_ SCHEME_V->strbuff, p - SCHEME_V->strbuff); |
2156 | |
2164 | |
2157 | default: |
2165 | if (ecb_expect_false (c == '\\')) |
|
|
2166 | state = st_bsl; |
|
|
2167 | else |
2158 | *p++ = c; |
2168 | *p++ = c; |
2159 | break; |
|
|
2160 | } |
|
|
2161 | |
2169 | |
2162 | break; |
2170 | break; |
2163 | |
2171 | |
2164 | case st_bsl: |
2172 | case st_bsl: |
2165 | switch (c) |
2173 | switch (c) |
… | |
… | |
2195 | case 'r': |
2203 | case 'r': |
2196 | *p++ = '\r'; |
2204 | *p++ = '\r'; |
2197 | state = st_ok; |
2205 | state = st_ok; |
2198 | break; |
2206 | break; |
2199 | |
2207 | |
2200 | case '"': |
|
|
2201 | *p++ = '"'; |
|
|
2202 | state = st_ok; |
|
|
2203 | break; |
|
|
2204 | |
|
|
2205 | default: |
2208 | default: |
2206 | *p++ = c; |
2209 | *p++ = c; |
2207 | state = st_ok; |
2210 | state = st_ok; |
2208 | break; |
2211 | break; |
2209 | } |
2212 | } |
2210 | |
2213 | |
2211 | break; |
2214 | break; |
2212 | |
2215 | |
2213 | case st_x1: |
2216 | case st_x1: |
2214 | case st_x2: |
2217 | case st_x2: |
2215 | c = toupper (c); |
2218 | c = tolower (c); |
2216 | |
2219 | |
2217 | if (c >= '0' && c <= 'F') |
2220 | if (c >= '0' && c <= '9') |
2218 | { |
|
|
2219 | if (c <= '9') |
|
|
2220 | c1 = (c1 << 4) + c - '0'; |
2221 | c1 = (c1 << 4) + c - '0'; |
2221 | else |
2222 | else if (c >= 'a' && c <= 'f') |
2222 | c1 = (c1 << 4) + c - 'A' + 10; |
2223 | c1 = (c1 << 4) + c - 'a' + 10; |
2223 | |
|
|
2224 | if (state == st_x1) |
|
|
2225 | state = st_x2; |
|
|
2226 | else |
|
|
2227 | { |
|
|
2228 | *p++ = c1; |
|
|
2229 | state = st_ok; |
|
|
2230 | } |
|
|
2231 | } |
|
|
2232 | else |
2224 | else |
2233 | return S_F; |
2225 | return S_F; |
|
|
2226 | |
|
|
2227 | if (state == st_x1) |
|
|
2228 | state = st_x2; |
|
|
2229 | else |
|
|
2230 | { |
|
|
2231 | *p++ = c1; |
|
|
2232 | state = st_ok; |
|
|
2233 | } |
2234 | |
2234 | |
2235 | break; |
2235 | break; |
2236 | |
2236 | |
2237 | case st_oct1: |
2237 | case st_oct1: |
2238 | case st_oct2: |
2238 | case st_oct2: |
… | |
… | |
2242 | backchar (SCHEME_A_ c); |
2242 | backchar (SCHEME_A_ c); |
2243 | state = st_ok; |
2243 | state = st_ok; |
2244 | } |
2244 | } |
2245 | else |
2245 | else |
2246 | { |
2246 | { |
2247 | if (state == st_oct2 && c1 >= 32) |
2247 | if (state == st_oct2 && c1 >= ' ') |
2248 | return S_F; |
2248 | return S_F; |
2249 | |
2249 | |
2250 | c1 = (c1 << 3) + (c - '0'); |
2250 | c1 = (c1 << 3) + (c - '0'); |
2251 | |
2251 | |
2252 | if (state == st_oct1) |
2252 | if (state == st_oct1) |
… | |
… | |
2257 | state = st_ok; |
2257 | state = st_ok; |
2258 | } |
2258 | } |
2259 | } |
2259 | } |
2260 | |
2260 | |
2261 | break; |
2261 | break; |
2262 | |
|
|
2263 | } |
2262 | } |
2264 | } |
2263 | } |
2265 | } |
2264 | } |
2266 | |
2265 | |
2267 | /* check c is in chars */ |
2266 | /* check c is in chars */ |
2268 | ecb_inline int |
2267 | ecb_inline int |
2269 | is_one_of (char *s, int c) |
2268 | is_one_of (const char *s, int c) |
2270 | { |
2269 | { |
2271 | if (c == EOF) |
|
|
2272 | return 1; |
|
|
2273 | |
|
|
2274 | return !!strchr (s, c); |
2270 | return c == EOF || !!strchr (s, c); |
2275 | } |
2271 | } |
2276 | |
2272 | |
2277 | /* skip white characters */ |
2273 | /* skip white characters */ |
2278 | ecb_inline int |
2274 | ecb_inline int |
2279 | skipspace (SCHEME_P) |
2275 | skipspace (SCHEME_P) |
… | |
… | |
2281 | int c, curr_line = 0; |
2277 | int c, curr_line = 0; |
2282 | |
2278 | |
2283 | do |
2279 | do |
2284 | { |
2280 | { |
2285 | c = inchar (SCHEME_A); |
2281 | c = inchar (SCHEME_A); |
|
|
2282 | |
2286 | #if SHOW_ERROR_LINE |
2283 | #if SHOW_ERROR_LINE |
2287 | if (c == '\n') |
2284 | if (ecb_expect_false (c == '\n')) |
2288 | curr_line++; |
2285 | curr_line++; |
2289 | #endif |
2286 | #endif |
|
|
2287 | |
|
|
2288 | if (ecb_expect_false (c == EOF)) |
|
|
2289 | return c; |
2290 | } |
2290 | } |
2291 | while (c == ' ' || c == '\n' || c == '\r' || c == '\t'); |
2291 | while (is_one_of (WHITESPACE, c)); |
2292 | |
2292 | |
2293 | /* record it */ |
2293 | /* record it */ |
2294 | #if SHOW_ERROR_LINE |
2294 | #if SHOW_ERROR_LINE |
2295 | if (SCHEME_V->load_stack[SCHEME_V->file_i].kind & port_file) |
2295 | if (SCHEME_V->load_stack[SCHEME_V->file_i].kind & port_file) |
2296 | SCHEME_V->load_stack[SCHEME_V->file_i].rep.stdio.curr_line += curr_line; |
2296 | SCHEME_V->load_stack[SCHEME_V->file_i].rep.stdio.curr_line += curr_line; |
2297 | #endif |
2297 | #endif |
2298 | |
2298 | |
2299 | if (c != EOF) |
|
|
2300 | { |
|
|
2301 | backchar (SCHEME_A_ c); |
2299 | backchar (SCHEME_A_ c); |
2302 | return 1; |
2300 | return 1; |
2303 | } |
|
|
2304 | else |
|
|
2305 | return EOF; |
|
|
2306 | } |
2301 | } |
2307 | |
2302 | |
2308 | /* get token */ |
2303 | /* get token */ |
2309 | static int |
2304 | static int |
2310 | token (SCHEME_P) |
2305 | token (SCHEME_P) |
… | |
… | |
2326 | return TOK_RPAREN; |
2321 | return TOK_RPAREN; |
2327 | |
2322 | |
2328 | case '.': |
2323 | case '.': |
2329 | c = inchar (SCHEME_A); |
2324 | c = inchar (SCHEME_A); |
2330 | |
2325 | |
2331 | if (is_one_of (" \n\t", c)) |
2326 | if (is_one_of (WHITESPACE, c)) |
2332 | return TOK_DOT; |
2327 | return TOK_DOT; |
2333 | else |
2328 | else |
2334 | { |
2329 | { |
2335 | //TODO: ungetc twice in a row is not supported in C |
|
|
2336 | backchar (SCHEME_A_ c); |
2330 | backchar (SCHEME_A_ c); |
2337 | backchar (SCHEME_A_ '.'); |
|
|
2338 | return TOK_ATOM; |
2331 | return TOK_DOTATOM; |
2339 | } |
2332 | } |
|
|
2333 | |
|
|
2334 | case '|': |
|
|
2335 | return TOK_STRATOM; |
2340 | |
2336 | |
2341 | case '\'': |
2337 | case '\'': |
2342 | return TOK_QUOTE; |
2338 | return TOK_QUOTE; |
2343 | |
2339 | |
2344 | case ';': |
2340 | case ';': |
… | |
… | |
2476 | } |
2472 | } |
2477 | |
2473 | |
2478 | putcharacter (SCHEME_A_ '"'); |
2474 | putcharacter (SCHEME_A_ '"'); |
2479 | } |
2475 | } |
2480 | |
2476 | |
2481 | |
|
|
2482 | /* print atoms */ |
2477 | /* print atoms */ |
2483 | static void |
2478 | static void |
2484 | printatom (SCHEME_P_ pointer l, int f) |
2479 | printatom (SCHEME_P_ pointer l, int f) |
2485 | { |
2480 | { |
2486 | char *p; |
2481 | char *p; |
2487 | int len; |
2482 | int len; |
2488 | |
2483 | |
2489 | atom2str (SCHEME_A_ l, f, &p, &len); |
2484 | atom2str (SCHEME_A_ l, f, &p, &len); |
2490 | putchars (SCHEME_A_ p, len); |
2485 | putchars (SCHEME_A_ p, len); |
2491 | } |
2486 | } |
2492 | |
|
|
2493 | |
2487 | |
2494 | /* Uses internal buffer unless string pointer is already available */ |
2488 | /* Uses internal buffer unless string pointer is already available */ |
2495 | static void |
2489 | static void |
2496 | atom2str (SCHEME_P_ pointer l, int f, char **pp, int *plen) |
2490 | atom2str (SCHEME_P_ pointer l, int f, char **pp, int *plen) |
2497 | { |
2491 | { |
… | |
… | |
2658 | #endif |
2652 | #endif |
2659 | } |
2653 | } |
2660 | else if (is_continuation (l)) |
2654 | else if (is_continuation (l)) |
2661 | p = "#<CONTINUATION>"; |
2655 | p = "#<CONTINUATION>"; |
2662 | else |
2656 | else |
|
|
2657 | { |
|
|
2658 | #if USE_PRINTF |
|
|
2659 | p = SCHEME_V->strbuff; |
|
|
2660 | snprintf (p, STRBUFFSIZE, "#<ERROR %x>", (int)typeflag (l)); |
|
|
2661 | #else |
2663 | p = "#<ERROR>"; |
2662 | p = "#<ERROR>"; |
|
|
2663 | #endif |
|
|
2664 | } |
2664 | |
2665 | |
2665 | *pp = p; |
2666 | *pp = p; |
2666 | *plen = strlen (p); |
2667 | *plen = strlen (p); |
2667 | } |
2668 | } |
2668 | |
2669 | |
… | |
… | |
2812 | /* () is #t in R5RS */ |
2813 | /* () is #t in R5RS */ |
2813 | #define is_true(p) ((p) != S_F) |
2814 | #define is_true(p) ((p) != S_F) |
2814 | #define is_false(p) ((p) == S_F) |
2815 | #define is_false(p) ((p) == S_F) |
2815 | |
2816 | |
2816 | /* ========== Environment implementation ========== */ |
2817 | /* ========== Environment implementation ========== */ |
2817 | |
|
|
2818 | #if !defined(USE_ALIST_ENV) || !defined(USE_OBJECT_LIST) |
|
|
2819 | |
|
|
2820 | static int |
|
|
2821 | hash_fn (const char *key, int table_size) |
|
|
2822 | { |
|
|
2823 | const unsigned char *p = key; |
|
|
2824 | uint32_t hash = 2166136261; |
|
|
2825 | |
|
|
2826 | while (*p) |
|
|
2827 | hash = (hash ^ *p++) * 16777619; |
|
|
2828 | |
|
|
2829 | return hash % table_size; |
|
|
2830 | } |
|
|
2831 | #endif |
|
|
2832 | |
2818 | |
2833 | #ifndef USE_ALIST_ENV |
2819 | #ifndef USE_ALIST_ENV |
2834 | |
2820 | |
2835 | /* |
2821 | /* |
2836 | * In this implementation, each frame of the environment may be |
2822 | * In this implementation, each frame of the environment may be |
… | |
… | |
2853 | |
2839 | |
2854 | SCHEME_V->envir = immutable_cons (new_frame, old_env); |
2840 | SCHEME_V->envir = immutable_cons (new_frame, old_env); |
2855 | setenvironment (SCHEME_V->envir); |
2841 | setenvironment (SCHEME_V->envir); |
2856 | } |
2842 | } |
2857 | |
2843 | |
|
|
2844 | static uint32_t |
|
|
2845 | sym_hash (pointer sym, uint32_t size) |
|
|
2846 | { |
|
|
2847 | uintptr_t ptr = (uintptr_t)sym; |
|
|
2848 | |
|
|
2849 | #if 0 |
|
|
2850 | /* table size is prime, so why mix */ |
|
|
2851 | ptr += ptr >> 32; |
|
|
2852 | ptr += ptr >> 16; |
|
|
2853 | ptr += ptr >> 8; |
|
|
2854 | #endif |
|
|
2855 | |
|
|
2856 | return ptr % size; |
|
|
2857 | } |
|
|
2858 | |
2858 | ecb_inline void |
2859 | ecb_inline void |
2859 | new_slot_spec_in_env (SCHEME_P_ pointer env, pointer variable, pointer value) |
2860 | new_slot_spec_in_env (SCHEME_P_ pointer env, pointer variable, pointer value) |
2860 | { |
2861 | { |
2861 | pointer slot = immutable_cons (variable, value); |
2862 | pointer slot = immutable_cons (variable, value); |
2862 | |
2863 | |
2863 | if (is_vector (car (env))) |
2864 | if (is_vector (car (env))) |
2864 | { |
2865 | { |
2865 | int location = hash_fn (symname (variable), veclength (car (env))); |
2866 | int location = sym_hash (variable, veclength (car (env))); |
2866 | |
|
|
2867 | vector_set (car (env), location, immutable_cons (slot, vector_get (car (env), location))); |
2867 | vector_set (car (env), location, immutable_cons (slot, vector_get (car (env), location))); |
2868 | } |
2868 | } |
2869 | else |
2869 | else |
2870 | set_car (env, immutable_cons (slot, car (env))); |
2870 | set_car (env, immutable_cons (slot, car (env))); |
2871 | } |
2871 | } |
2872 | |
2872 | |
2873 | static pointer |
2873 | static pointer |
2874 | find_slot_in_env (SCHEME_P_ pointer env, pointer hdl, int all) |
2874 | find_slot_in_env (SCHEME_P_ pointer env, pointer hdl, int all) |
2875 | { |
2875 | { |
2876 | pointer x, y; |
2876 | pointer x, y; |
2877 | int location; |
|
|
2878 | |
2877 | |
2879 | for (x = env; x != NIL; x = cdr (x)) |
2878 | for (x = env; x != NIL; x = cdr (x)) |
2880 | { |
2879 | { |
2881 | if (is_vector (car (x))) |
2880 | if (is_vector (car (x))) |
2882 | { |
2881 | { |
2883 | location = hash_fn (symname (hdl), veclength (car (x))); |
2882 | int location = sym_hash (hdl, veclength (car (x))); |
2884 | y = vector_get (car (x), location); |
2883 | y = vector_get (car (x), location); |
2885 | } |
2884 | } |
2886 | else |
2885 | else |
2887 | y = car (x); |
2886 | y = car (x); |
2888 | |
2887 | |
… | |
… | |
2925 | for (y = car (x); y != NIL; y = cdr (y)) |
2924 | for (y = car (x); y != NIL; y = cdr (y)) |
2926 | if (caar (y) == hdl) |
2925 | if (caar (y) == hdl) |
2927 | break; |
2926 | break; |
2928 | |
2927 | |
2929 | if (y != NIL) |
2928 | if (y != NIL) |
|
|
2929 | return car (y); |
2930 | break; |
2930 | break; |
2931 | |
2931 | |
2932 | if (!all) |
2932 | if (!all) |
2933 | return NIL; |
2933 | break; |
2934 | } |
2934 | } |
2935 | |
|
|
2936 | if (x != NIL) |
|
|
2937 | return car (y); |
|
|
2938 | |
2935 | |
2939 | return NIL; |
2936 | return NIL; |
2940 | } |
2937 | } |
2941 | |
2938 | |
2942 | #endif /* USE_ALIST_ENV else */ |
2939 | #endif /* USE_ALIST_ENV else */ |
2943 | |
2940 | |
2944 | ecb_inline void |
2941 | ecb_inline void |
2945 | new_slot_in_env (SCHEME_P_ pointer variable, pointer value) |
2942 | new_slot_in_env (SCHEME_P_ pointer variable, pointer value) |
2946 | { |
2943 | { |
|
|
2944 | assert (is_symbol (variable));//TODO: bug in current-ws/OP_LET2 |
2947 | new_slot_spec_in_env (SCHEME_A_ SCHEME_V->envir, variable, value); |
2945 | new_slot_spec_in_env (SCHEME_A_ SCHEME_V->envir, variable, value); |
2948 | } |
2946 | } |
2949 | |
2947 | |
2950 | ecb_inline void |
2948 | ecb_inline void |
2951 | set_slot_in_env (SCHEME_P_ pointer slot, pointer value) |
2949 | set_slot_in_env (SCHEME_P_ pointer slot, pointer value) |
… | |
… | |
3243 | |
3241 | |
3244 | #endif |
3242 | #endif |
3245 | |
3243 | |
3246 | #define s_retbool(tf) s_return ((tf) ? S_T : S_F) |
3244 | #define s_retbool(tf) s_return ((tf) ? S_T : S_F) |
3247 | |
3245 | |
|
|
3246 | #if 1 |
|
|
3247 | static int |
|
|
3248 | debug (SCHEME_P_ int indent, pointer x) |
|
|
3249 | { |
|
|
3250 | int c; |
|
|
3251 | |
|
|
3252 | if (is_syntax (x)) |
|
|
3253 | { |
|
|
3254 | printf ("%*ssyntax<%s,%d>\n", indent, "", syntaxname(x),syntaxnum(x)); |
|
|
3255 | return 8 + 8; |
|
|
3256 | } |
|
|
3257 | |
|
|
3258 | if (x == NIL) |
|
|
3259 | { |
|
|
3260 | printf ("%*sNIL\n", indent, ""); |
|
|
3261 | return 3; |
|
|
3262 | } |
|
|
3263 | |
|
|
3264 | switch (type (x)) |
|
|
3265 | { |
|
|
3266 | case T_INTEGER: |
|
|
3267 | printf ("%*sI<%d>%p\n", indent, "", (int)ivalue_unchecked (x), x); |
|
|
3268 | return 32+8; |
|
|
3269 | |
|
|
3270 | case T_SYMBOL: |
|
|
3271 | printf ("%*sS<%s>\n", indent, "", symname (x)); |
|
|
3272 | return 24+8; |
|
|
3273 | |
|
|
3274 | case T_CLOSURE: |
|
|
3275 | printf ("%*sS<%s>\n", indent, "", "closure"); |
|
|
3276 | debug (SCHEME_A_ indent + 3, cdr(x)); |
|
|
3277 | return 32 + debug (SCHEME_A_ indent + 3, car (x)); |
|
|
3278 | |
|
|
3279 | case T_PAIR: |
|
|
3280 | printf ("%*spair %p %p\n", indent, "", car(x),cdr(x)); |
|
|
3281 | c = debug (SCHEME_A_ indent + 3, car (x)); |
|
|
3282 | c += debug (SCHEME_A_ indent + 3, cdr (x)); |
|
|
3283 | return c + 1; |
|
|
3284 | |
|
|
3285 | case T_PORT: |
|
|
3286 | printf ("%*sS<%s>\n", indent, "", "port"); |
|
|
3287 | return 24+8; |
|
|
3288 | |
|
|
3289 | case T_VECTOR: |
|
|
3290 | printf ("%*sS<%s>\n", indent, "", "vector"); |
|
|
3291 | return 24+8; |
|
|
3292 | |
|
|
3293 | case T_ENVIRONMENT: |
|
|
3294 | printf ("%*sS<%s>\n", indent, "", "environment"); |
|
|
3295 | return 0 + debug (SCHEME_A_ indent + 3, car (x)); |
|
|
3296 | |
|
|
3297 | default: |
|
|
3298 | printf ("unhandled type %d\n", type (x)); |
|
|
3299 | break; |
|
|
3300 | } |
|
|
3301 | } |
|
|
3302 | #endif |
|
|
3303 | |
3248 | static int |
3304 | static int |
3249 | opexe_0 (SCHEME_P_ enum scheme_opcodes op) |
3305 | opexe_0 (SCHEME_P_ enum scheme_opcodes op) |
3250 | { |
3306 | { |
3251 | pointer args = SCHEME_V->args; |
3307 | pointer args = SCHEME_V->args; |
3252 | pointer x, y; |
3308 | pointer x, y; |
3253 | |
3309 | |
3254 | switch (op) |
3310 | switch (op) |
3255 | { |
3311 | { |
|
|
3312 | #if 1 //D |
|
|
3313 | case OP_DEBUG: |
|
|
3314 | printf ("len = %d\n", debug (SCHEME_A_ 0, args) / 8); |
|
|
3315 | printf ("\n"); |
|
|
3316 | s_return (S_T); |
|
|
3317 | #endif |
3256 | case OP_LOAD: /* load */ |
3318 | case OP_LOAD: /* load */ |
3257 | if (file_interactive (SCHEME_A)) |
3319 | if (file_interactive (SCHEME_A)) |
3258 | { |
3320 | { |
3259 | xwrstr ("Loading "); xwrstr (strvalue (car (args))); xwrstr ("\n"); |
3321 | xwrstr ("Loading "); xwrstr (strvalue (car (args))); xwrstr ("\n"); |
3260 | //D fprintf (SCHEME_V->outport->object.port->rep.stdio.file, "Loading %s\n", strvalue (car (args))); |
3322 | //D fprintf (SCHEME_V->outport->object.port->rep.stdio.file, "Loading %s\n", strvalue (car (args))); |
… | |
… | |
3383 | } |
3445 | } |
3384 | else |
3446 | else |
3385 | s_return (SCHEME_V->code); |
3447 | s_return (SCHEME_V->code); |
3386 | |
3448 | |
3387 | case OP_E0ARGS: /* eval arguments */ |
3449 | case OP_E0ARGS: /* eval arguments */ |
3388 | if (is_macro (SCHEME_V->value)) /* macro expansion */ |
3450 | if (ecb_expect_false (is_macro (SCHEME_V->value))) /* macro expansion */ |
3389 | { |
3451 | { |
3390 | s_save (SCHEME_A_ OP_DOMACRO, NIL, NIL); |
3452 | s_save (SCHEME_A_ OP_DOMACRO, NIL, NIL); |
3391 | SCHEME_V->args = cons (SCHEME_V->code, NIL); |
3453 | SCHEME_V->args = cons (SCHEME_V->code, NIL); |
3392 | SCHEME_V->code = SCHEME_V->value; |
3454 | SCHEME_V->code = SCHEME_V->value; |
3393 | s_goto (OP_APPLY); |
3455 | s_goto (OP_APPLY); |
… | |
… | |
4391 | } |
4453 | } |
4392 | |
4454 | |
4393 | case OP_VECLEN: /* vector-length */ |
4455 | case OP_VECLEN: /* vector-length */ |
4394 | s_return (mk_integer (SCHEME_A_ veclength (x))); |
4456 | s_return (mk_integer (SCHEME_A_ veclength (x))); |
4395 | |
4457 | |
|
|
4458 | case OP_VECRESIZE: |
|
|
4459 | vector_resize (x, ivalue_unchecked (cadr (args)), caddr (args)); |
|
|
4460 | s_return (x); |
|
|
4461 | |
4396 | case OP_VECREF: /* vector-ref */ |
4462 | case OP_VECREF: /* vector-ref */ |
4397 | { |
4463 | { |
4398 | int index = ivalue_unchecked (cadr (args)); |
4464 | int index = ivalue_unchecked (cadr (args)); |
4399 | |
4465 | |
4400 | if (index >= veclength (car (args)) && USE_ERROR_CHECKING) |
4466 | if (index >= veclength (car (args)) && USE_ERROR_CHECKING) |
… | |
… | |
4955 | s_save (SCHEME_A_ OP_RDUQTSP, NIL, NIL); |
5021 | s_save (SCHEME_A_ OP_RDUQTSP, NIL, NIL); |
4956 | SCHEME_V->tok = token (SCHEME_A); |
5022 | SCHEME_V->tok = token (SCHEME_A); |
4957 | s_goto (OP_RDSEXPR); |
5023 | s_goto (OP_RDSEXPR); |
4958 | |
5024 | |
4959 | case TOK_ATOM: |
5025 | case TOK_ATOM: |
4960 | s_return (mk_atom (SCHEME_A_ readstr_upto (SCHEME_A_ DELIMITERS))); |
5026 | s_return (mk_atom (SCHEME_A_ readstr_upto (SCHEME_A_ 0, DELIMITERS))); |
|
|
5027 | |
|
|
5028 | case TOK_DOTATOM: |
|
|
5029 | SCHEME_V->strbuff[0] = '.'; |
|
|
5030 | s_return (mk_atom (SCHEME_A_ readstr_upto (SCHEME_A_ 1, DELIMITERS))); |
|
|
5031 | |
|
|
5032 | case TOK_STRATOM: |
|
|
5033 | x = readstrexp (SCHEME_A_ '|'); |
|
|
5034 | //TODO: haven't checked whether the garbage collector could interfere |
|
|
5035 | s_return (mk_atom (SCHEME_A_ strvalue (x))); |
4961 | |
5036 | |
4962 | case TOK_DQUOTE: |
5037 | case TOK_DQUOTE: |
4963 | x = readstrexp (SCHEME_A); |
5038 | x = readstrexp (SCHEME_A_ '"'); |
4964 | |
5039 | |
4965 | if (x == S_F) |
5040 | if (x == S_F) |
4966 | Error_0 ("Error reading string"); |
5041 | Error_0 ("Error reading string"); |
4967 | |
5042 | |
4968 | setimmutable (x); |
5043 | setimmutable (x); |
… | |
… | |
4980 | s_goto (OP_EVAL); |
5055 | s_goto (OP_EVAL); |
4981 | } |
5056 | } |
4982 | } |
5057 | } |
4983 | |
5058 | |
4984 | case TOK_SHARP_CONST: |
5059 | case TOK_SHARP_CONST: |
4985 | if ((x = mk_sharp_const (SCHEME_A_ readstr_upto (SCHEME_A_ DELIMITERS))) == NIL) |
5060 | if ((x = mk_sharp_const (SCHEME_A_ readstr_upto (SCHEME_A_ 0, DELIMITERS))) == NIL) |
4986 | Error_0 ("undefined sharp expression"); |
5061 | Error_0 ("undefined sharp expression"); |
4987 | else |
5062 | else |
4988 | s_return (x); |
5063 | s_return (x); |
4989 | |
5064 | |
4990 | default: |
5065 | default: |
… | |
… | |
5212 | |
5287 | |
5213 | case OP_CLOSUREP: /* closure? */ |
5288 | case OP_CLOSUREP: /* closure? */ |
5214 | /* |
5289 | /* |
5215 | * Note, macro object is also a closure. |
5290 | * Note, macro object is also a closure. |
5216 | * Therefore, (closure? <#MACRO>) ==> #t |
5291 | * Therefore, (closure? <#MACRO>) ==> #t |
|
|
5292 | * (schmorp) well, obviously not, fix? TODO |
5217 | */ |
5293 | */ |
5218 | s_retbool (is_closure (a)); |
5294 | s_retbool (is_closure (a)); |
5219 | |
5295 | |
5220 | case OP_MACROP: /* macro? */ |
5296 | case OP_MACROP: /* macro? */ |
5221 | s_retbool (is_macro (a)); |
5297 | s_retbool (is_macro (a)); |
… | |
… | |
5462 | |
5538 | |
5463 | /* Hard-coded for the given keywords. Remember to rewrite if more are added! */ |
5539 | /* Hard-coded for the given keywords. Remember to rewrite if more are added! */ |
5464 | static int |
5540 | static int |
5465 | syntaxnum (pointer p) |
5541 | syntaxnum (pointer p) |
5466 | { |
5542 | { |
5467 | const char *s = strvalue (car (p)); |
5543 | const char *s = strvalue (p); |
5468 | |
5544 | |
5469 | switch (strlength (car (p))) |
5545 | switch (strlength (p)) |
5470 | { |
5546 | { |
5471 | case 2: |
5547 | case 2: |
5472 | if (s[0] == 'i') |
5548 | if (s[0] == 'i') |
5473 | return OP_IF0; /* if */ |
5549 | return OP_IF0; /* if */ |
5474 | else |
5550 | else |
… | |
… | |
5910 | # endif |
5986 | # endif |
5911 | int fin; |
5987 | int fin; |
5912 | char *file_name = InitFile; |
5988 | char *file_name = InitFile; |
5913 | int retcode; |
5989 | int retcode; |
5914 | int isfile = 1; |
5990 | int isfile = 1; |
|
|
5991 | system ("ps v $PPID");//D |
5915 | |
5992 | |
5916 | if (argc == 2 && strcmp (argv[1], "-?") == 0) |
5993 | if (argc == 2 && strcmp (argv[1], "-?") == 0) |
5917 | { |
5994 | { |
5918 | xwrstr ("Usage: tinyscheme -?\n"); |
5995 | xwrstr ("Usage: tinyscheme -?\n"); |
5919 | xwrstr ("or: tinyscheme [<file1> <file2> ...]\n"); |
5996 | xwrstr ("or: tinyscheme [<file1> <file2> ...]\n"); |