Merge branch 'master' of git://factorcode.org/git/factor
commit
0fa5e73ffc
|
@ -89,6 +89,11 @@ set_md5sum() {
|
|||
set_gcc() {
|
||||
case $OS in
|
||||
openbsd) ensure_program_installed egcc; CC=egcc;;
|
||||
netbsd) if [[ $WORD -eq 64 ]] ; then
|
||||
CC=/usr/pkg/gcc34/bin/gcc
|
||||
else
|
||||
CC=gcc
|
||||
fi ;;
|
||||
*) CC=gcc;;
|
||||
esac
|
||||
}
|
||||
|
@ -185,6 +190,7 @@ find_architecture() {
|
|||
i386) ARCH=x86;;
|
||||
i686) ARCH=x86;;
|
||||
amd64) ARCH=x86;;
|
||||
ppc64) ARCH=ppc;;
|
||||
*86) ARCH=x86;;
|
||||
*86_64) ARCH=x86;;
|
||||
"Power Macintosh") ARCH=ppc;;
|
||||
|
|
|
@ -12,3 +12,10 @@ os unix? [
|
|||
[ ] [ "envs" get set-os-envs ] unit-test
|
||||
[ t ] [ os-envs "envs" get = ] unit-test
|
||||
] when
|
||||
|
||||
[ ] [ "factor-test-key-1" unset-os-env ] unit-test
|
||||
[ ] [ "ps3" "factor-test-key-1" set-os-env ] unit-test
|
||||
[ "ps3" ] [ "factor-test-key-1" os-env ] unit-test
|
||||
[ ] [ "factor-test-key-1" unset-os-env ] unit-test
|
||||
[ f ] [ "factor-test-key-1" os-env ] unit-test
|
||||
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
#include <ucontext.h>
|
||||
|
||||
#define FRAME_RETURN_ADDRESS(frame) *((XT *)(frame_successor(frame) + 1) + 1)
|
||||
|
||||
INLINE void *ucontext_stack_pointer(void *uap)
|
||||
{
|
||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||
return (void *)ucontext->uc_mcontext.uc_regs->gregs[PT_R1];
|
||||
}
|
||||
|
||||
#define UAP_PROGRAM_COUNTER(ucontext) \
|
||||
(((ucontext_t *)(ucontext))->uc_mcontext.uc_regs->gregs[PT_NIP])
|
||||
|
|
|
@ -15,4 +15,10 @@ DLLEXPORT void c_to_factor_toplevel(CELL quot);
|
|||
#ifndef environ
|
||||
extern char ***_NSGetEnviron(void);
|
||||
#define environ (*_NSGetEnviron())
|
||||
#endif
|
||||
#endif
|
||||
|
||||
INLINE void *ucontext_stack_pointer(void *uap)
|
||||
{
|
||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||
return ucontext->uc_stack.ss_sp;
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#include <ucontext.h>
|
||||
|
||||
INLINE void *ucontext_stack_pointer(void *uap)
|
||||
{
|
||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||
return ucontext->uc_stack.ss_sp;
|
||||
}
|
10
vm/os-unix.c
10
vm/os-unix.c
|
@ -85,6 +85,16 @@ DEFINE_PRIMITIVE(read_dir)
|
|||
dpush(result);
|
||||
}
|
||||
|
||||
DEFINE_PRIMITIVE(os_env)
|
||||
{
|
||||
char *name = unbox_char_string();
|
||||
char *value = getenv(name);
|
||||
if(value == NULL)
|
||||
dpush(F);
|
||||
else
|
||||
box_char_string(value);
|
||||
}
|
||||
|
||||
DEFINE_PRIMITIVE(os_envs)
|
||||
{
|
||||
GROWABLE_ARRAY(result);
|
||||
|
|
|
@ -215,19 +215,34 @@ void sleep_millis(DWORD msec)
|
|||
Sleep(msec);
|
||||
}
|
||||
|
||||
DEFINE_PRIMITIVE(os_env)
|
||||
{
|
||||
F_CHAR *key = unbox_u16_string();
|
||||
F_CHAR *value = safe_malloc(MAX_UNICODE_PATH);
|
||||
int ret;
|
||||
ret = GetEnvironmentVariable(key, value, MAX_UNICODE_PATH);
|
||||
if(ret == 0)
|
||||
dpush(F);
|
||||
else
|
||||
dpush(tag_object(from_u16_string(value)));
|
||||
free(value);
|
||||
}
|
||||
|
||||
DEFINE_PRIMITIVE(set_os_env)
|
||||
{
|
||||
F_CHAR *key = unbox_u16_string();
|
||||
REGISTER_C_STRING(key);
|
||||
F_CHAR *value = unbox_u16_string();
|
||||
UNREGISTER_C_STRING(key);
|
||||
SetEnvironmentVariable(key, value);
|
||||
if(!SetEnvironmentVariable(key, value))
|
||||
general_error(ERROR_IO, tag_object(get_error_message()), F, NULL);
|
||||
}
|
||||
|
||||
DEFINE_PRIMITIVE(unset_os_env)
|
||||
{
|
||||
F_CHAR *key = unbox_u16_string();
|
||||
SetEnvironmentVariable(key, NULL);
|
||||
if(!SetEnvironmentVariable(unbox_u16_string(), NULL)
|
||||
&& GetLastError() != ERROR_ENVVAR_NOT_FOUND)
|
||||
general_error(ERROR_IO, tag_object(get_error_message()), F, NULL);
|
||||
}
|
||||
|
||||
DEFINE_PRIMITIVE(set_os_envs)
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "os-unix.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "os-unix-ucontext.h"
|
||||
#include "os-macosx.h"
|
||||
#include "mach_signal.h"
|
||||
|
||||
|
@ -84,7 +83,6 @@
|
|||
#if defined(FACTOR_X86)
|
||||
#include "os-linux-x86.32.h"
|
||||
#elif defined(FACTOR_PPC)
|
||||
#include "os-unix-ucontext.h"
|
||||
#include "os-linux-ppc.h"
|
||||
#elif defined(FACTOR_ARM)
|
||||
#include "os-linux-arm.h"
|
||||
|
|
Loading…
Reference in New Issue