Merge branch 'master' of git://factorcode.org/git/factor
commit
80ad31db06
6
Makefile
6
Makefile
|
@ -62,6 +62,7 @@ default:
|
||||||
@echo "solaris-x86-64"
|
@echo "solaris-x86-64"
|
||||||
@echo "windows-ce-arm"
|
@echo "windows-ce-arm"
|
||||||
@echo "windows-nt-x86-32"
|
@echo "windows-nt-x86-32"
|
||||||
|
@echo "windows-nt-x86-64"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Additional modifiers:"
|
@echo "Additional modifiers:"
|
||||||
@echo ""
|
@echo ""
|
||||||
|
@ -113,6 +114,9 @@ solaris-x86-64:
|
||||||
windows-nt-x86-32:
|
windows-nt-x86-32:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
|
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
|
||||||
|
|
||||||
|
windows-nt-x86-64:
|
||||||
|
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.64
|
||||||
|
|
||||||
windows-ce-arm:
|
windows-ce-arm:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.arm
|
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.arm
|
||||||
|
|
||||||
|
@ -138,7 +142,7 @@ clean:
|
||||||
rm -f vm/*.o
|
rm -f vm/*.o
|
||||||
|
|
||||||
vm/resources.o:
|
vm/resources.o:
|
||||||
windres vm/factor.rs vm/resources.o
|
$(WINDRES) vm/factor.rs vm/resources.o
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CFLAGS) -o $@ $<
|
$(CC) -c $(CFLAGS) -o $@ $<
|
||||||
|
|
|
@ -383,7 +383,7 @@ M: windows-ui-backend (close-window)
|
||||||
>r class-name-ptr get-global f r>
|
>r class-name-ptr get-global f r>
|
||||||
>r >r >r ex-style r> r>
|
>r >r >r ex-style r> r>
|
||||||
WS_CLIPSIBLINGS WS_CLIPCHILDREN bitor style bitor
|
WS_CLIPSIBLINGS WS_CLIPCHILDREN bitor style bitor
|
||||||
0 0 r>
|
CW_USEDEFAULT dup r>
|
||||||
get-RECT-dimensions
|
get-RECT-dimensions
|
||||||
f f f GetModuleHandle f CreateWindowEx dup win32-error=0/f ;
|
f f f GetModuleHandle f CreateWindowEx dup win32-error=0/f ;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,215 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# Programs returning != 0 will not cause script to exit
|
||||||
|
set +e
|
||||||
|
|
||||||
|
# Case insensitive string comparison
|
||||||
|
shopt -s nocaseglob
|
||||||
|
#shopt -s nocasematch
|
||||||
|
|
||||||
|
OS=
|
||||||
|
ARCH=
|
||||||
|
WORD=
|
||||||
|
|
||||||
|
ensure_program_installed() {
|
||||||
|
echo -n "Checking for $1..."
|
||||||
|
result=`type -p $1`
|
||||||
|
if ! [[ -n $result ]] ; then
|
||||||
|
echo "not found!"
|
||||||
|
echo "Install $1 and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "found!"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_ret() {
|
||||||
|
RET=$?
|
||||||
|
if [[ $RET -ne 0 ]] ; then
|
||||||
|
echo $1 failed
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_gcc_version() {
|
||||||
|
GCC_VERSION=`gcc --version`
|
||||||
|
if [[ $GCC_VERSION == *3.3.* ]] ; then
|
||||||
|
echo "You have a known buggy version of gcc (3.3)"
|
||||||
|
echo "Install gcc 3.4 or higher and try again."
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_installed_programs() {
|
||||||
|
ensure_program_installed chmod
|
||||||
|
ensure_program_installed uname
|
||||||
|
ensure_program_installed git
|
||||||
|
ensure_program_installed wget
|
||||||
|
ensure_program_installed gcc
|
||||||
|
ensure_program_installed make
|
||||||
|
check_gcc_version
|
||||||
|
}
|
||||||
|
|
||||||
|
check_factor_exists() {
|
||||||
|
if [[ -d "factor" ]] ; then
|
||||||
|
echo "A directory called 'factor' already exists."
|
||||||
|
echo "Rename or delete it and try again."
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
find_os() {
|
||||||
|
uname_s=`uname -s`
|
||||||
|
case $uname_s in
|
||||||
|
CYGWIN_NT-5.2-WOW64) OS=windows-nt;;
|
||||||
|
*CYGWIN_NT*) OS=windows-nt;;
|
||||||
|
*CYGWIN*) OS=windows-nt;;
|
||||||
|
*darwin*) OS=macosx;;
|
||||||
|
*Darwin*) OS=macosx;;
|
||||||
|
*linux*) OS=linux;;
|
||||||
|
*Linux*) OS=linux;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
find_architecture() {
|
||||||
|
uname_m=`uname -m`
|
||||||
|
case $uname_m in
|
||||||
|
i386) ARCH=x86;;
|
||||||
|
i686) ARCH=x86;;
|
||||||
|
*86) ARCH=x86;;
|
||||||
|
"Power Macintosh") ARCH=ppc;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
write_test_program() {
|
||||||
|
echo "#include <stdio.h>" > $C_WORD.c
|
||||||
|
echo "int main(){printf(\"%d\", 8*sizeof(void*)); return 0; }" >> $C_WORD.c
|
||||||
|
}
|
||||||
|
|
||||||
|
find_word_size() {
|
||||||
|
C_WORD=factor-word-size
|
||||||
|
write_test_program
|
||||||
|
gcc -o $C_WORD $C_WORD.c
|
||||||
|
WORD=$(./$C_WORD)
|
||||||
|
check_ret $C_WORD
|
||||||
|
rm -f $C_WORD*
|
||||||
|
}
|
||||||
|
|
||||||
|
set_factor_binary() {
|
||||||
|
case $OS in
|
||||||
|
windows-nt) FACTOR_BINARY=factor-nt;;
|
||||||
|
macosx) FACTOR_BINARY=./Factor.app/Contents/MacOS/factor;;
|
||||||
|
*) FACTOR_BINARY=factor;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_build_info() {
|
||||||
|
echo OS=$OS
|
||||||
|
echo ARCH=$ARCH
|
||||||
|
echo WORD=$WORD
|
||||||
|
echo FACTOR_BINARY=$FACTOR_BINARY
|
||||||
|
echo MAKE_TARGET=$MAKE_TARGET
|
||||||
|
echo BOOT_IMAGE=$BOOT_IMAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
set_build_info() {
|
||||||
|
if ! [[ -n $OS && -n $ARCH && -n $WORD ]] ; then
|
||||||
|
echo "OS, ARCH, or WORD is empty. Please report this"
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
|
MAKE_TARGET=$OS-$ARCH-$WORD
|
||||||
|
BOOT_IMAGE=boot.$ARCH.$WORD.image
|
||||||
|
}
|
||||||
|
|
||||||
|
find_build_info() {
|
||||||
|
find_os
|
||||||
|
find_architecture
|
||||||
|
find_word_size
|
||||||
|
set_factor_binary
|
||||||
|
set_build_info
|
||||||
|
echo_build_info
|
||||||
|
}
|
||||||
|
|
||||||
|
git_clone() {
|
||||||
|
echo "Downloading the git repository from factorcode.org..."
|
||||||
|
git clone git://factorcode.org/git/factor.git
|
||||||
|
check_ret git
|
||||||
|
}
|
||||||
|
|
||||||
|
git_pull_factorcode() {
|
||||||
|
git pull git://factorcode.org/git/factor.git
|
||||||
|
check_ret git
|
||||||
|
}
|
||||||
|
|
||||||
|
cd_factor() {
|
||||||
|
cd factor
|
||||||
|
check_ret cd
|
||||||
|
}
|
||||||
|
|
||||||
|
make_clean() {
|
||||||
|
make clean
|
||||||
|
check_ret make
|
||||||
|
}
|
||||||
|
|
||||||
|
make_factor() {
|
||||||
|
make $MAKE_TARGET -j5
|
||||||
|
check_ret make
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_boot_images() {
|
||||||
|
echo "Deleting old images..."
|
||||||
|
rm $BOOT_IMAGE > /dev/null 2>&1
|
||||||
|
rm $BOOT_IMAGE.* > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
get_boot_image() {
|
||||||
|
wget http://factorcode.org/images/latest/$BOOT_IMAGE
|
||||||
|
check_ret wget
|
||||||
|
}
|
||||||
|
|
||||||
|
maybe_download_dlls() {
|
||||||
|
if [[ $OS == windows-nt ]] ; then
|
||||||
|
wget http://factorcode.org/dlls/freetype6.dll
|
||||||
|
check_ret
|
||||||
|
wget http://factorcode.org/dlls/zlib1.dll
|
||||||
|
check_ret
|
||||||
|
chmod 777 *.dll
|
||||||
|
check_ret
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
bootstrap() {
|
||||||
|
./$FACTOR_BINARY -i=$BOOT_IMAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "usage: $0 install|update"
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
install)
|
||||||
|
check_factor_exists
|
||||||
|
check_installed_programs
|
||||||
|
find_build_info
|
||||||
|
git_clone
|
||||||
|
cd_factor
|
||||||
|
make_factor
|
||||||
|
get_boot_image
|
||||||
|
maybe_download_dlls
|
||||||
|
bootstrap
|
||||||
|
;;
|
||||||
|
|
||||||
|
update)
|
||||||
|
check_installed_programs
|
||||||
|
find_build_info
|
||||||
|
git_pull_factorcode
|
||||||
|
make_clean
|
||||||
|
make_factor
|
||||||
|
delete_boot_images
|
||||||
|
get_boot_image
|
||||||
|
bootstrap
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
120
misc/install.sh
120
misc/install.sh
|
@ -1,120 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
# Programs returning != 0 will not cause script to exit
|
|
||||||
set +e
|
|
||||||
|
|
||||||
# Case insensitive string comparison
|
|
||||||
shopt -s nocaseglob
|
|
||||||
#shopt -s nocasematch
|
|
||||||
|
|
||||||
ensure_program_installed() {
|
|
||||||
echo -n "Checking for $1..."
|
|
||||||
result=`type -p $1`
|
|
||||||
if ! [[ -n $result ]] ; then
|
|
||||||
echo "not found!"
|
|
||||||
echo "Install $1 and try again."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "found!"
|
|
||||||
}
|
|
||||||
|
|
||||||
check_ret() {
|
|
||||||
RET=$?
|
|
||||||
if [[ $RET -ne 0 ]] ; then
|
|
||||||
echo $1 failed
|
|
||||||
exit 5
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
ensure_program_installed uname
|
|
||||||
ensure_program_installed git
|
|
||||||
ensure_program_installed wget
|
|
||||||
ensure_program_installed gcc
|
|
||||||
ensure_program_installed make
|
|
||||||
|
|
||||||
GCC_VERSION=`gcc --version`
|
|
||||||
if [[ $GCC_VERSION == *3.3.* ]] ; then
|
|
||||||
echo "You have a known buggy version of gcc (3.3)"
|
|
||||||
echo "Install gcc 3.4 or higher and try again."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# OS
|
|
||||||
OS=
|
|
||||||
uname_s=`uname -s`
|
|
||||||
case $uname_s in
|
|
||||||
CYGWIN_NT-5.2-WOW64) OS=windows-nt;;
|
|
||||||
*CYGWIN_NT*) OS=windows-nt;;
|
|
||||||
*CYGWIN*) OS=windows-nt;;
|
|
||||||
*darwin*) OS=macosx;;
|
|
||||||
*Darwin*) OS=macosx;;
|
|
||||||
*linux*) OS=linux;;
|
|
||||||
*Linux*) OS=linux;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Architecture
|
|
||||||
ARCH=
|
|
||||||
uname_m=`uname -m`
|
|
||||||
case $uname_m in
|
|
||||||
i386) ARCH=x86;;
|
|
||||||
i686) ARCH=x86;;
|
|
||||||
*86) ARCH=x86;;
|
|
||||||
"Power Macintosh") ARCH=ppc;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
WORD=
|
|
||||||
C_WORD=factor-word-size
|
|
||||||
# Word size
|
|
||||||
echo "#include <stdio.h>" > $C_WORD.c
|
|
||||||
echo "int main() { printf(\"%d\", 8*sizeof(long)); return 0; }" >> $C_WORD.c
|
|
||||||
gcc -o $C_WORD $C_WORD.c
|
|
||||||
WORD=$(./$C_WORD)
|
|
||||||
check_ret $C_WORD
|
|
||||||
rm -f $C_WORD*
|
|
||||||
|
|
||||||
case $OS in
|
|
||||||
windows-nt) FACTOR_BINARY=factor-nt;;
|
|
||||||
macosx) FACTOR_BINARY=./Factor.app/Contents/MacOS/factor;;
|
|
||||||
*) FACTOR_BINARY=factor;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
MAKE_TARGET=$OS-$ARCH-$WORD
|
|
||||||
BOOT_IMAGE=boot.$ARCH.$WORD.image
|
|
||||||
|
|
||||||
echo OS=$OS
|
|
||||||
echo ARCH=$ARCH
|
|
||||||
echo WORD=$WORD
|
|
||||||
echo FACTOR_BINARY=$FACTOR_BINARY
|
|
||||||
echo MAKE_TARGET=$MAKE_TARGET
|
|
||||||
echo BOOT_IMAGE=$BOOT_IMAGE
|
|
||||||
|
|
||||||
if ! [[ -n $OS && -n $ARCH && -n $WORD ]] ; then
|
|
||||||
echo "OS, ARCH, or WORD is empty. Please report this"
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Downloading the git repository from factorcode.org..."
|
|
||||||
git clone git://factorcode.org/git/factor.git
|
|
||||||
check_ret git
|
|
||||||
|
|
||||||
cd factor
|
|
||||||
check_ret cd
|
|
||||||
|
|
||||||
make $MAKE_TARGET
|
|
||||||
check_ret make
|
|
||||||
|
|
||||||
echo "Deleting old images..."
|
|
||||||
rm $BOOT_IMAGE > /dev/null 2>&1
|
|
||||||
rm $BOOT_IMAGE.* > /dev/null 2>&1
|
|
||||||
wget http://factorcode.org/images/latest/$BOOT_IMAGE
|
|
||||||
check_ret wget
|
|
||||||
|
|
||||||
if [[ $OS == windows-nt ]] ; then
|
|
||||||
wget http://factorcode.org/dlls/freetype6.dll
|
|
||||||
check_ret
|
|
||||||
wget http://factorcode.org/dlls/zlib1.dll
|
|
||||||
check_ret
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
./$FACTOR_BINARY -i=$BOOT_IMAGE
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
LIBS = -lm
|
||||||
|
EXE_SUFFIX=-nt
|
||||||
|
DLL_SUFFIX=-nt
|
||||||
|
PLAF_DLL_OBJS += vm/os-windows-nt.o
|
||||||
|
PLAF_EXE_OBJS += vm/resources.o
|
||||||
|
PLAF_EXE_OBJS += vm/main-windows-nt.o
|
||||||
|
#CFLAGS += -mwindows
|
||||||
|
include vm/Config.windows
|
|
@ -1,7 +1,3 @@
|
||||||
LIBS = -lm
|
WINDRES=windres
|
||||||
EXE_SUFFIX=-nt
|
include vm/Config.windows.nt
|
||||||
DLL_SUFFIX=-nt
|
include vm/Config.x86.32
|
||||||
PLAF_DLL_OBJS += vm/os-windows-nt.o
|
|
||||||
PLAF_EXE_OBJS += vm/resources.o
|
|
||||||
PLAF_EXE_OBJS += vm/main-windows-nt.o
|
|
||||||
include vm/Config.x86.32 vm/Config.windows
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
CC=/k/target/bin/x86_64-pc-mingw32-gcc
|
||||||
|
include vm/Config.windows.nt
|
||||||
|
include vm/Config.x86.64
|
||||||
|
WINDRES = /k/target/bin/windres
|
|
@ -213,6 +213,7 @@ void dump_objects(F_FIXNUM type)
|
||||||
void factorbug(void)
|
void factorbug(void)
|
||||||
{
|
{
|
||||||
reset_stdio();
|
reset_stdio();
|
||||||
|
open_console();
|
||||||
|
|
||||||
printf("Starting low level debugger...\n");
|
printf("Starting low level debugger...\n");
|
||||||
printf(" Basic commands:\n");
|
printf(" Basic commands:\n");
|
||||||
|
|
|
@ -26,6 +26,7 @@ void default_parameters(F_PARAMETERS *p)
|
||||||
|
|
||||||
p->secure_gc = false;
|
p->secure_gc = false;
|
||||||
p->fep = false;
|
p->fep = false;
|
||||||
|
p->console = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get things started */
|
/* Get things started */
|
||||||
|
@ -110,6 +111,8 @@ void init_factor_from_args(F_CHAR *image, int argc, F_CHAR **argv, bool embedded
|
||||||
p.fep = true;
|
p.fep = true;
|
||||||
else if(STRNCMP(argv[i],STR_FORMAT("-i="),3) == 0)
|
else if(STRNCMP(argv[i],STR_FORMAT("-i="),3) == 0)
|
||||||
p.image = argv[i] + 3;
|
p.image = argv[i] + 3;
|
||||||
|
else if(STRCMP(argv[i],STR_FORMAT("-console")) == 0)
|
||||||
|
p.console = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_factor(&p);
|
init_factor(&p);
|
||||||
|
@ -135,6 +138,9 @@ void init_factor_from_args(F_CHAR *image, int argc, F_CHAR **argv, bool embedded
|
||||||
|
|
||||||
nest_stacks();
|
nest_stacks();
|
||||||
|
|
||||||
|
if(p.console)
|
||||||
|
open_console();
|
||||||
|
|
||||||
if(p.fep)
|
if(p.fep)
|
||||||
factorbug();
|
factorbug();
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ typedef struct {
|
||||||
CELL code_size;
|
CELL code_size;
|
||||||
bool secure_gc;
|
bool secure_gc;
|
||||||
bool fep;
|
bool fep;
|
||||||
|
bool console;
|
||||||
} F_PARAMETERS;
|
} F_PARAMETERS;
|
||||||
|
|
||||||
void load_image(F_PARAMETERS *p);
|
void load_image(F_PARAMETERS *p);
|
||||||
|
|
|
@ -256,3 +256,5 @@ void reset_stdio(void)
|
||||||
fcntl(0,F_SETFL,0);
|
fcntl(0,F_SETFL,0);
|
||||||
fcntl(1,F_SETFL,0);
|
fcntl(1,F_SETFL,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void open_console(void) { }
|
||||||
|
|
|
@ -39,3 +39,4 @@ s64 current_millis(void);
|
||||||
void sleep_millis(CELL msec);
|
void sleep_millis(CELL msec);
|
||||||
|
|
||||||
void reset_stdio(void);
|
void reset_stdio(void);
|
||||||
|
void open_console(void);
|
||||||
|
|
|
@ -46,3 +46,5 @@ void c_to_factor_toplevel(CELL quot)
|
||||||
{
|
{
|
||||||
c_to_factor(quot);
|
c_to_factor(quot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void open_console(void) { }
|
||||||
|
|
|
@ -24,3 +24,4 @@ char *getenv(char *name);
|
||||||
|
|
||||||
s64 current_millis(void);
|
s64 current_millis(void);
|
||||||
void c_to_factor_toplevel(CELL quot);
|
void c_to_factor_toplevel(CELL quot);
|
||||||
|
void open_console(void);
|
||||||
|
|
|
@ -88,3 +88,17 @@ void c_to_factor_toplevel(CELL quot)
|
||||||
c_to_factor(quot);
|
c_to_factor(quot);
|
||||||
RemoveVectoredExceptionHandler((void*)exception_handler);
|
RemoveVectoredExceptionHandler((void*)exception_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void open_console(void)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
// Do this: http://www.cygwin.com/ml/cygwin/2007-11/msg00432.html
|
||||||
|
if(console_open)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())
|
||||||
|
{
|
||||||
|
console_open = true;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
|
@ -18,3 +18,5 @@ typedef char F_SYMBOL;
|
||||||
|
|
||||||
void c_to_factor_toplevel(CELL quot);
|
void c_to_factor_toplevel(CELL quot);
|
||||||
long exception_handler(PEXCEPTION_POINTERS pe);
|
long exception_handler(PEXCEPTION_POINTERS pe);
|
||||||
|
bool console_open;
|
||||||
|
void open_console(void);
|
||||||
|
|
Loading…
Reference in New Issue