mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 09:17:35 +02:00
Converted Cyc-installation-dir
This commit is contained in:
parent
09515b2141
commit
53aad98d71
3 changed files with 11 additions and 13 deletions
|
@ -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);
|
||||
|
|
15
runtime.c
15
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); }
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue