Merge branch 'master' of sheeple@office.stack-effects.com:factor

db4
Doug Coleman 2008-04-09 00:08:23 -05:00
commit 1da97fe13e
7 changed files with 26 additions and 4 deletions

View File

@ -732,6 +732,8 @@ define-builtin
{ "set-innermost-frame-quot" "kernel.private" } { "set-innermost-frame-quot" "kernel.private" }
{ "call-clear" "kernel" } { "call-clear" "kernel" }
{ "(os-envs)" "system.private" } { "(os-envs)" "system.private" }
{ "set-os-env" "system" }
{ "unset-os-env" "system" }
{ "(set-os-envs)" "system.private" } { "(set-os-envs)" "system.private" }
{ "resize-byte-array" "byte-arrays" } { "resize-byte-array" "byte-arrays" }
{ "resize-bit-array" "bit-arrays" } { "resize-bit-array" "bit-arrays" }

View File

@ -587,6 +587,10 @@ set-primitive-effect
\ (os-envs) { } { array } <effect> set-primitive-effect \ (os-envs) { } { array } <effect> set-primitive-effect
\ set-os-env { string string } { } <effect> set-primitive-effect
\ unset-os-env { string } { } <effect> set-primitive-effect
\ (set-os-envs) { array } { } <effect> set-primitive-effect \ (set-os-envs) { array } { } <effect> set-primitive-effect
\ do-primitive [ \ do-primitive no-effect ] "infer" set-word-prop \ do-primitive [ \ do-primitive no-effect ] "infer" set-word-prop

View File

@ -6,8 +6,7 @@ IN: db.postgresql.ffi
<< "postgresql" { << "postgresql" {
{ [ os winnt? ] [ "libpq.dll" ] } { [ os winnt? ] [ "libpq.dll" ] }
{ [ os macosx? ] [ "/opt/local/lib/postgresql83/libpq.dylib" ] } { [ os macosx? ] [ "libpq.dylib" ] }
! { [ os macosx? ] [ "libpq.dylib" ] }
{ [ os unix? ] [ "libpq.so" ] } { [ os unix? ] [ "libpq.so" ] }
} cond "cdecl" add-library >> } cond "cdecl" add-library >>

View File

@ -29,6 +29,4 @@ DEFER: fake
[ ] [ \ testing define-generic ] unit-test [ ] [ \ testing define-generic ] unit-test
[ t ] [ \ testing generic? ] unit-test [ t ] [ \ testing generic? ] unit-test
[ t ] [ \ testing "default-multi-method" word-prop method-body? ] unit-test
] with-compilation-unit ] with-compilation-unit

View File

@ -103,6 +103,21 @@ DEFINE_PRIMITIVE(os_envs)
dpush(result); dpush(result);
} }
DEFINE_PRIMITIVE(set_os_env)
{
char *key = unbox_char_string();
REGISTER_C_STRING(key);
char *value = unbox_char_string();
UNREGISTER_C_STRING(key);
setenv(key, value, 1);
}
DEFINE_PRIMITIVE(unset_os_env)
{
char *key = unbox_char_string();
unsetenv(key);
}
DEFINE_PRIMITIVE(set_os_envs) DEFINE_PRIMITIVE(set_os_envs)
{ {
F_ARRAY *array = untag_array(dpop()); F_ARRAY *array = untag_array(dpop());

View File

@ -182,6 +182,8 @@ void *primitives[] = {
primitive_set_innermost_stack_frame_quot, primitive_set_innermost_stack_frame_quot,
primitive_call_clear, primitive_call_clear,
primitive_os_envs, primitive_os_envs,
primitive_set_os_env,
primitive_unset_os_env,
primitive_set_os_envs, primitive_set_os_envs,
primitive_resize_byte_array, primitive_resize_byte_array,
primitive_resize_bit_array, primitive_resize_bit_array,

View File

@ -249,6 +249,8 @@ DECLARE_PRIMITIVE(setenv);
DECLARE_PRIMITIVE(exit); DECLARE_PRIMITIVE(exit);
DECLARE_PRIMITIVE(os_env); DECLARE_PRIMITIVE(os_env);
DECLARE_PRIMITIVE(os_envs); DECLARE_PRIMITIVE(os_envs);
DECLARE_PRIMITIVE(set_os_env);
DECLARE_PRIMITIVE(unset_os_env);
DECLARE_PRIMITIVE(set_os_envs); DECLARE_PRIMITIVE(set_os_envs);
DECLARE_PRIMITIVE(eq); DECLARE_PRIMITIVE(eq);
DECLARE_PRIMITIVE(millis); DECLARE_PRIMITIVE(millis);