mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 00:37:35 +02:00
Added Cyc_compilation_environment()
This commit is contained in:
parent
e13f46b39e
commit
b96a9fcedd
4 changed files with 38 additions and 6 deletions
9
Makefile
9
Makefile
|
@ -62,9 +62,9 @@ libcyclone.so.1: runtime.c include/cyclone/runtime.h
|
|||
gcc -shared -Wl,-soname,libcyclone.so.1 -o libcyclone.so.1.0.1 runtime.o
|
||||
|
||||
libcyclone.a: runtime.c include/cyclone/runtime.h include/cyclone/types.h gc.c dispatch.c
|
||||
echo $(CC_PROG)
|
||||
echo $(CC_EXEC)
|
||||
echo $(CC_LIB)
|
||||
# echo $(CC_PROG)
|
||||
# echo $(CC_EXEC)
|
||||
# echo $(CC_LIB)
|
||||
$(CC) $(CFLAGS) -c -Iinclude dispatch.c -o dispatch.o
|
||||
$(CC) $(CFLAGS) -std=gnu99 -c -Iinclude gc.c -o gc.o
|
||||
$(CC) $(CFLAGS) -c -Iinclude \
|
||||
|
@ -72,6 +72,9 @@ libcyclone.a: runtime.c include/cyclone/runtime.h include/cyclone/types.h gc.c d
|
|||
-DCYC_INSTALL_LIB=\"$(LIBDIR)\" \
|
||||
-DCYC_INSTALL_INC=\"$(INCDIR)\" \
|
||||
-DCYC_INSTALL_SLD=\"$(DATADIR)\" \
|
||||
-DCYC_CC_PROG=\"$(CC_PROG)\" \
|
||||
-DCYC_CC_EXEC=\"$(CC_EXEC)\" \
|
||||
-DCYC_CC_LIB=\"$(CC_LIB)\" \
|
||||
runtime.c -o runtime.o
|
||||
$(AR) rcs libcyclone.a runtime.o gc.o dispatch.o
|
||||
# Instructions from: http://www.adp-gmbh.ch/cpp/gcc/create_lib.html
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
CFLAGS ?= -g -Wall
|
||||
CC ?= cc
|
||||
CC_PROG ?= "$(CC) %src-file% $(CFLAGS) -c -o %exec-file%.o"
|
||||
CC_EXEC ?= "$(CC) %exec-file%.o %objs% -pthread -lcyclone -lck -lm $(CFLAGS) -o %exec-file%"
|
||||
CC_LIB ?= "$(CC) %src-file% $(CFLAGS) -c -o %exec-file%.o"
|
||||
CC_PROG ?= "$(CC) ~src-file~ $(CFLAGS) -c -o ~exec-file~.o"
|
||||
CC_EXEC ?= "$(CC) ~exec-file~.o ~obj-files~ -pthread -lcyclone -lck -lm $(CFLAGS) -o ~exec-file~"
|
||||
CC_LIB ?= "$(CC) ~src-file~ $(CFLAGS) -c -o ~exec-file~.o"
|
||||
|
||||
AR ?= ar
|
||||
#CD ?= cd
|
||||
|
|
|
@ -201,6 +201,7 @@ object Cyc_substring(void *data, object cont, object str, object start,
|
|||
object Cyc_string_ref(void *data, object str, object k);
|
||||
object Cyc_string_set(void *data, object str, object k, object chr);
|
||||
object Cyc_installation_dir(void *data, object cont, object type);
|
||||
void Cyc_compilation_environment(void *data, object cont, object var);
|
||||
object Cyc_command_line_arguments(void *data, object cont);
|
||||
object Cyc_system(object cmd);
|
||||
object Cyc_char2integer(object chr);
|
||||
|
|
28
runtime.c
28
runtime.c
|
@ -1730,6 +1730,34 @@ object Cyc_installation_dir(void *data, object cont, object type)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a value set during Cyclone compilation
|
||||
*/
|
||||
void Cyc_compilation_environment(void *data, object cont, object var)
|
||||
{
|
||||
if (Cyc_is_symbol(var) == boolean_t){
|
||||
if (strncmp(((symbol) var)->pname, "cc-prog", 8) == 0) {
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "%s", CYC_CC_PROG);
|
||||
make_string(str, buf);
|
||||
return_closcall1(data, cont, &str);
|
||||
} else if (strncmp(((symbol) var)->pname, "cc-exec", 8) == 0) {
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "%s", CYC_CC_EXEC);
|
||||
make_string(str, buf);
|
||||
return_closcall1(data, cont, &str);
|
||||
} else if (strncmp(((symbol) var)->pname, "cc-lib", 7) == 0) {
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "%s", CYC_CC_LIB);
|
||||
make_string(str, buf);
|
||||
return_closcall1(data, cont, &str);
|
||||
}
|
||||
}
|
||||
Cyc_rt_raise2(data,
|
||||
"Cyc-compilation-environment - unrecognized symbol",
|
||||
var);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform same role as the CHICKEN function:
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue