mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
WIP - (system)
This commit is contained in:
parent
a1dd27a42d
commit
7537d41e26
6 changed files with 18 additions and 1 deletions
1
TODO
1
TODO
|
@ -15,6 +15,7 @@ Working TODO list:
|
|||
- quasiquote - will need to enhance the parser to support a second type of quote, at minimum
|
||||
- string<? - and related functions, too
|
||||
- (system) - not standard, but need to run gcc. See cyclone.scm for use
|
||||
Almost done, need to add primitive to runtime
|
||||
- vectors - limited use in cgen module - make-vector, vector-set!, and vector-ref
|
||||
|
||||
- Reduction in size of generated code
|
||||
|
|
4
cgen.scm
4
cgen.scm
|
@ -438,6 +438,7 @@
|
|||
((eq? p 'string->symbol) "Cyc_string2symbol")
|
||||
((eq? p 'symbol->string) "Cyc_symbol2string")
|
||||
((eq? p 'number->string) "Cyc_number2string")
|
||||
((eq? p 'system) "Cyc_system")
|
||||
((eq? p 'assq) "assq")
|
||||
((eq? p 'assv) "assq")
|
||||
((eq? p 'assoc) "assoc")
|
||||
|
@ -477,6 +478,7 @@
|
|||
((eq? p 'open-input-file) "port_type")
|
||||
((eq? p 'length) "integer_type")
|
||||
((eq? p 'char->integer) "integer_type")
|
||||
((eq? p 'system) "integer_type")
|
||||
((eq? p '+) "common_type")
|
||||
((eq? p '-) "common_type")
|
||||
((eq? p '*) "common_type")
|
||||
|
@ -495,7 +497,7 @@
|
|||
(and (prim? exp)
|
||||
(member exp '(
|
||||
current-input-port open-input-file
|
||||
char->integer string->number string-append list->string string->list
|
||||
char->integer system string->number string-append list->string string->list
|
||||
symbol->string number->string
|
||||
+ - * / apply cons length cell))))
|
||||
|
||||
|
|
1
eval.scm
1
eval.scm
|
@ -203,6 +203,7 @@
|
|||
(list 'apply apply)
|
||||
(list '%halt %halt)
|
||||
(list 'exit exit)
|
||||
(list 'system system)
|
||||
(list 'error error)
|
||||
(list 'cons cons)
|
||||
(list 'cell-get cell-get)
|
||||
|
|
10
runtime.c
10
runtime.c
|
@ -692,6 +692,16 @@ string_type Cyc_string_append_va_list(int argc, object str1, va_list ap) {
|
|||
return result;
|
||||
}
|
||||
|
||||
integer_type Cyc_system(object cmd) {
|
||||
if (nullp(cmd) || is_value_type(cmd) || type_of(cmd) != string_tag) {
|
||||
make_int(n, -1);
|
||||
return n;
|
||||
} else {
|
||||
make_int(n, system(((string_type *)cmd)->str));
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
integer_type Cyc_char2integer(object chr){
|
||||
make_int(n, obj_obj2char(chr));
|
||||
return n;
|
||||
|
|
|
@ -90,6 +90,7 @@ common_type Cyc_string2number(object str);
|
|||
void dispatch_string_91append(int argc, object clo, object cont, object str1, ...);
|
||||
string_type Cyc_string_append(int argc, object str1, ...);
|
||||
string_type Cyc_string_append_va_list(int argc, object str1, va_list ap);
|
||||
integer_type Cyc_system(object cmd);
|
||||
integer_type Cyc_char2integer(object chr);
|
||||
object Cyc_integer2char(object n);
|
||||
void my_exit(closure) never_returns;
|
||||
|
|
|
@ -480,6 +480,7 @@
|
|||
apply
|
||||
%halt
|
||||
exit
|
||||
system
|
||||
Cyc-default-exception-handler
|
||||
Cyc-current-exception-handler
|
||||
cons
|
||||
|
@ -548,6 +549,7 @@
|
|||
apply
|
||||
%halt
|
||||
exit
|
||||
system
|
||||
Cyc-default-exception-handler
|
||||
Cyc-current-exception-handler
|
||||
cell-get
|
||||
|
|
Loading…
Add table
Reference in a new issue