Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-02-21 23:08:22 -06:00
commit 3eba715778
12 changed files with 60 additions and 20 deletions

6
.gitignore vendored
View File

@ -15,5 +15,7 @@ factor
.gdb_history .gdb_history
*.*.marks *.*.marks
.*.swp .*.swp
reverse-complement-in.txt temp
reverse-complement-out.txt logs
work
misc/wordsize

View File

@ -45,7 +45,10 @@ DLL_OBJS = $(PLAF_DLL_OBJS) \
EXE_OBJS = $(PLAF_EXE_OBJS) EXE_OBJS = $(PLAF_EXE_OBJS)
default: default: misc/wordsize
make `./misc/target`
help:
@echo "Run 'make' with one of the following parameters:" @echo "Run 'make' with one of the following parameters:"
@echo "" @echo ""
@echo "freebsd-x86-32" @echo "freebsd-x86-32"
@ -158,6 +161,9 @@ factor: $(DLL_OBJS) $(EXE_OBJS)
$(CC) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \ $(CC) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \
$(CFLAGS) -o $@$(EXE_SUFFIX)$(EXE_EXTENSION) $(EXE_OBJS) $(CFLAGS) -o $@$(EXE_SUFFIX)$(EXE_EXTENSION) $(EXE_OBJS)
misc/wordsize: misc/wordsize.c
gcc misc/wordsize.c -o misc/wordsize
clean: clean:
rm -f vm/*.o rm -f vm/*.o
rm -f factor*.dll libfactor*.* rm -f factor*.dll libfactor*.*

View File

@ -154,3 +154,11 @@ M: pathname <=> [ pathname-string ] compare ;
: with-file-appender ( path quot -- ) : with-file-appender ( path quot -- )
>r <file-appender> r> with-stream ; inline >r <file-appender> r> with-stream ; inline
: temp-dir ( -- path )
"temp" resource-path
dup exists? not
[ dup make-directory ]
when ;
: temp-file ( name -- path ) temp-dir swap path+ ;

View File

@ -2,9 +2,9 @@ USING: tools.test io.files io io.streams.c ;
IN: temporary IN: temporary
[ "hello world" ] [ [ "hello world" ] [
"test.txt" resource-path [ "test.txt" temp-file [
"hello world" write "hello world" write
] with-file-writer ] with-file-writer
"test.txt" resource-path "rb" fopen <c-reader> contents "test.txt" temp-file "rb" fopen <c-reader> contents
] unit-test ] unit-test

5
cp_dir
View File

@ -1,5 +0,0 @@
#!/bin/sh
echo $1
mkdir -p "`dirname \"$2\"`"
cp "$1" "$2"

View File

@ -65,7 +65,7 @@ SYMBOL: cols
] with-scope ; ] with-scope ;
: mandel-main ( -- ) : mandel-main ( -- )
"mandel.ppm" resource-path "mandel.ppm" temp-file
[ mandel write ] with-file-writer ; [ mandel write ] with-file-writer ;
MAIN: mandel-main MAIN: mandel-main

View File

@ -170,7 +170,7 @@ DEFER: create ( level c r -- scene )
] "" make ; ] "" make ;
: raytracer-main : raytracer-main
"raytracer.pnm" resource-path "raytracer.pnm" temp-file
[ run write ] with-file-writer ; [ run write ] with-file-writer ;
MAIN: raytracer-main MAIN: raytracer-main

View File

@ -41,12 +41,10 @@ HINTS: do-line vector string ;
] with-disposal ; ] with-disposal ;
: reverse-complement-in : reverse-complement-in
"extra/benchmark/reverse-complement/reverse-complement-in.txt" "reverse-complement-in.txt" temp-file ;
resource-path ;
: reverse-complement-out : reverse-complement-out
"extra/benchmark/reverse-complement/reverse-complement-out.txt" "reverse-complement-out.txt" temp-file ;
resource-path ;
: reverse-complement-main ( -- ) : reverse-complement-main ( -- )
reverse-complement-in reverse-complement-in

View File

@ -98,4 +98,10 @@ USING: bootstrap.image bootstrap.image.download io.streams.null ;
: cat-n ( file n -- ) : cat-n ( file n -- )
[ file-lines ] [ ] bi* [ file-lines ] [ ] bi*
maybe-tail* maybe-tail*
[ print ] each ; [ print ] each ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
USE: prettyprint
: to-file ( object file -- ) [ . ] with-file-writer ;

View File

@ -38,8 +38,8 @@ yield
"unix-domain-datagram-test" resource-path delete-file "unix-domain-datagram-test" resource-path delete-file
] ignore-errors ] ignore-errors
: server-addr "unix-domain-datagram-test" resource-path <local> ; : server-addr "unix-domain-datagram-test" temp-file <local> ;
: client-addr "unix-domain-datagram-test-2" resource-path <local> ; : client-addr "unix-domain-datagram-test-2" temp-file <local> ;
[ [
[ [
@ -112,7 +112,7 @@ client-addr <datagram>
"unix-domain-datagram-test-3" resource-path delete-file "unix-domain-datagram-test-3" resource-path delete-file
] ignore-errors ] ignore-errors
"unix-domain-datagram-test-2" resource-path delete-file "unix-domain-datagram-test-2" temp-file delete-file
[ ] [ client-addr <datagram> "d" set ] unit-test [ ] [ client-addr <datagram> "d" set ] unit-test

17
misc/target Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
if [ \( `uname -s` = Darwin \) -a \( `uname -p` = powerpc \) ]
then
echo macosx-ppc
elif [ `uname -s` = Darwin ]
then
echo macosx-x86-`./misc/wordsize`
elif [ \( `uname -s` = Linux \) -a \( `uname -m` = i686 \) ]
then
echo linux-x86-`./misc/wordsize`
elif [ \( `uname -o` = Cygwin \) -a \( `uname -m` = i686 \) ]
then
echo winnt-x86-`./misc/wordsize`
else
echo help
fi

8
misc/wordsize.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
int main ()
{
printf("%d", 8*sizeof(void*));
return 0;
}