diff --git a/include/cyclone/runtime.h b/include/cyclone/runtime.h index b2e52ec9..9141b406 100644 --- a/include/cyclone/runtime.h +++ b/include/cyclone/runtime.h @@ -92,8 +92,6 @@ object apply(object cont, object func, object args); void Cyc_apply(int argc, closure cont, object prim, ...); integer_type Cyc_string_cmp(object str1, object str2); 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, object, va_list); list mcons(object,object); cvar_type *mcvar(object *var); object Cyc_display(object, FILE *port); @@ -134,7 +132,7 @@ integer_type Cyc_string_length(object str); object Cyc_substring(object cont, object str, object start, object end); object Cyc_string_ref(object str, object k); object Cyc_string_set(object str, object k, object chr); -string_type Cyc_installation_dir(); +object Cyc_installation_dir(object cont, object type); object Cyc_command_line_arguments(object cont); integer_type Cyc_system(object cmd); integer_type Cyc_char2integer(object chr); diff --git a/runtime.c b/runtime.c index 5b5ddb0d..fb4cb665 100644 --- a/runtime.c +++ b/runtime.c @@ -1054,7 +1054,7 @@ object Cyc_substring(object cont, object str, object start, object end) { { make_string_with_len(sub, raw + s, e - s); - return_closcall1(cont, sub); + return_closcall1(cont, &sub); } } @@ -1062,28 +1062,28 @@ object Cyc_substring(object cont, object str, object start, object end) { * Return directory where cyclone is installed. * This is configured via the makefile during a build. */ -string_type Cyc_installation_dir(object type) { +object Cyc_installation_dir(object cont, object type) { if (Cyc_is_symbol(type) == boolean_t && strncmp(((symbol)type)->pname, "sld", 5) == 0) { char buf[1024]; snprintf(buf, sizeof(buf), "%s", CYC_INSTALL_SLD); make_string(str, buf); - return str; + return_closcall1(cont, &str); } else if (Cyc_is_symbol(type) == boolean_t && strncmp(((symbol)type)->pname, "lib", 5) == 0) { char buf[1024]; snprintf(buf, sizeof(buf), "%s", CYC_INSTALL_LIB); make_string(str, buf); - return str; + return_closcall1(cont, &str); } else if (Cyc_is_symbol(type) == boolean_t && strncmp(((symbol)type)->pname, "inc", 5) == 0) { char buf[1024]; snprintf(buf, sizeof(buf), "%s", CYC_INSTALL_INC); make_string(str, buf); - return str; + return_closcall1(cont, &str); } else { make_string(str, CYC_INSTALL_DIR); - return str; + return_closcall1(cont, &str); } } @@ -1727,8 +1727,7 @@ void _cyc_string_91ref(object cont, object args) { return_closcall1(cont, c); }} void _Cyc_91installation_91dir(object cont, object args) { Cyc_check_num_args("Cyc-installation-dir", 1, args); - { string_type dir = Cyc_installation_dir(car(args)); - return_closcall1(cont, &dir);}} + Cyc_installation_dir(cont, car(args));} void _command_91line_91arguments(object cont, object args) { object cmdline = Cyc_command_line_arguments(cont); return_closcall1(cont, cmdline); } diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index f0f1d899..7d5075d7 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -590,6 +590,7 @@ ((eq? p 'make-vector) "object") ((eq? p 'list->string) "object") ((eq? p 'list->vector) "object") + ((eq? p 'Cyc-installation-dir) "object") (else #f))) ;; Determine if primitive creates a C variable @@ -619,14 +620,14 @@ (and (prim? exp) (member exp '(Cyc-read-line apply command-line-arguments number->string symbol->string list->string substring - make-vector list->vector)))) + make-vector list->vector Cyc-installation-dir)))) ;; TODO: this is a hack, right answer is to include information about ;; how many args each primitive is supposed to take (define (prim:cont-has-args? exp) (and (prim? exp) (member exp '(Cyc-read-line apply number->string symbol->string list->string substring - make-vector list->vector)))) + make-vector list->vector Cyc-installation-dir)))) ;; Pass an integer arg count as the function's first parameter? (define (prim:arg-count? exp)