Merge jcg@repo.or.cz:/srv/git/factor

db4
Joe Groff 2008-09-14 09:34:41 -07:00
commit 166f5777b5
7 changed files with 92 additions and 28 deletions

View File

@ -8,7 +8,7 @@ calendar.format accessors sets hashtables ;
IN: smtp
SYMBOL: smtp-domain
SYMBOL: smtp-server "localhost" "smtp" <inet> smtp-server set-global
SYMBOL: smtp-server "localhost" 25 <inet> smtp-server set-global
SYMBOL: smtp-read-timeout 1 minutes smtp-read-timeout set-global
SYMBOL: esmtp? t esmtp? set-global

View File

@ -102,7 +102,7 @@ set_make() {
*) MAKE='make';;
esac
if ! [[ $MAKE -eq 'gmake' ]] ; then
ensure_program_installed gmake
ensure_program_installed gmake
fi
}
@ -159,6 +159,7 @@ check_factor_exists() {
}
find_os() {
if [[ -n $OS ]] ; then return; fi
$ECHO "Finding OS..."
uname_s=`uname -s`
check_ret uname
@ -178,6 +179,7 @@ find_os() {
}
find_architecture() {
if [[ -n $ARCH ]] ; then return; fi
$ECHO "Finding ARCH..."
uname_m=`uname -m`
check_ret uname
@ -197,7 +199,7 @@ write_test_program() {
echo "int main(){printf(\"%d\", 8*sizeof(void*)); return 0; }" >> $C_WORD.c
}
find_word_size() {
c_find_word_size() {
$ECHO "Finding WORD..."
C_WORD=factor-word-size
write_test_program
@ -207,6 +209,29 @@ find_word_size() {
rm -f $C_WORD*
}
intel_macosx_word_size() {
ensure_program_installed sysctl
$ECHO -n "Testing if your Intel Mac supports 64bit binaries..."
sysctl machdep.cpu.extfeatures | grep EM64T >/dev/null
if [[ $? -eq 0 ]] ; then
WORD=32
$ECHO "yes!"
$ECHO "Defaulting to 32bit for now though..."
else
WORD=32
$ECHO "no."
fi
}
find_word_size() {
if [[ -n $WORD ]] ; then return; fi
if [[ $OS == macosx && $ARCH == x86 ]] ; then
intel_macosx_word_size
else
c_find_word_size
fi
}
set_factor_binary() {
case $OS in
# winnt) FACTOR_BINARY=factor-nt;;
@ -230,15 +255,18 @@ echo_build_info() {
$ECHO MAKE=$MAKE
}
set_build_info() {
check_os_arch_word() {
if ! [[ -n $OS && -n $ARCH && -n $WORD ]] ; then
$ECHO "OS: $OS"
$ECHO "ARCH: $ARCH"
$ECHO "WORD: $WORD"
$ECHO "OS, ARCH, or WORD is empty. Please report this"
$ECHO "OS, ARCH, or WORD is empty. Please report this."
exit 5
fi
}
set_build_info() {
check_os_arch_word
MAKE_TARGET=$OS-$ARCH-$WORD
MAKE_IMAGE_TARGET=$ARCH.$WORD
BOOT_IMAGE=boot.$ARCH.$WORD.image
@ -254,15 +282,32 @@ set_build_info() {
fi
}
parse_build_info() {
ensure_program_installed cut
$ECHO "Parsing make target from command line: $1"
OS=`echo $1 | cut -d '-' -f 1`
ARCH=`echo $1 | cut -d '-' -f 2`
WORD=`echo $1 | cut -d '-' -f 3`
if [[ $OS == linux && $ARCH == ppc ]] ; then WORD=32; fi
if [[ $OS == linux && $ARCH == arm ]] ; then WORD=32; fi
if [[ $OS == macosx && $ARCH == ppc ]] ; then WORD=32; fi
if [[ $OS == wince && $ARCH == arm ]] ; then WORD=32; fi
$ECHO "OS=$OS"
$ECHO "ARCH=$ARCH"
$ECHO "WORD=$WORD"
}
find_build_info() {
find_os
find_architecture
find_word_size
set_factor_binary
set_build_info
set_downloader
set_gcc
set_make
set_downloader
set_gcc
set_make
echo_build_info
}
@ -415,30 +460,37 @@ make_boot_image() {
}
install_build_system_apt() {
ensure_program_installed yes
yes | sudo apt-get install sudo libc6-dev libfreetype6-dev libx11-dev xorg-dev glutg3-dev wget git-core git-doc rlwrap gcc make
sudo apt-get --yes install sudo libc6-dev libfreetype6-dev libx11-dev xorg-dev glutg3-dev wget git-core git-doc rlwrap gcc make
check_ret sudo
}
install_build_system_port() {
test_program_installed git
if [[ $? -ne 1 ]] ; then
ensure_program_installed yes
echo "git not found."
echo "This script requires either git-core or port."
echo "If it fails, install git-core or port and try again."
ensure_program_installed port
echo "Installing git-core with port...this will take awhile."
yes | sudo port install git-core
ensure_program_installed yes
echo "git not found."
echo "This script requires either git-core or port."
echo "If it fails, install git-core or port and try again."
ensure_program_installed port
echo "Installing git-core with port...this will take awhile."
yes | sudo port install git-core
fi
}
usage() {
echo "usage: $0 install|install-x11|install-macosx|self-update|quick-update|update|bootstrap|dlls|net-bootstrap|make-target"
echo "usage: $0 install|install-x11|install-macosx|self-update|quick-update|update|bootstrap|dlls|net-bootstrap|make-target|report [optional-target]"
echo "If you are behind a firewall, invoke as:"
echo "env GIT_PROTOCOL=http $0 <command>"
echo ""
echo "Example for overriding the default target:"
echo " $0 update macosx-x86-32"
}
# -n is nonzero length, -z is zero length
if [[ -n "$2" ]] ; then
parse_build_info $2
fi
case "$1" in
install) install ;;
install-x11) install_build_system_apt; install ;;
@ -447,8 +499,9 @@ case "$1" in
quick-update) update; refresh_image ;;
update) update; update_bootstrap ;;
bootstrap) get_config_info; bootstrap ;;
report) find_build_info ;;
dlls) get_config_info; maybe_download_dlls;;
net-bootstrap) get_config_info; update_boot_images; bootstrap ;;
make-target) ECHO=false; find_build_info; echo $MAKE_TARGET ;;
make-target) ECHO=false; find_build_info; echo $MAKE_TARGET ;;
*) usage ;;
esac

View File

@ -334,7 +334,7 @@ HELP: if-empty
{ $values { "seq" sequence } { "quot1" quotation } { "quot2" quotation } }
{ $description "Makes an implicit check if the sequence is empty. An empty sequence is dropped and " { $snippet "quot1" } " is called. Otherwise, if the sequence has any elements, " { $snippet "quot2" } " is called on it." }
{ $example
"USING: kernel prettyprint sequences sequences.lib ;"
"USING: kernel prettyprint sequences ;"
"{ 1 2 3 } [ \"empty sequence\" ] [ sum ] if-empty ."
"6"
} ;

View File

@ -54,19 +54,19 @@ SYMBOL: load-help?
: load-source ( vocab -- vocab )
f over set-vocab-source-loaded?
[ vocab-source-path [ parse-file ] [ [ ] ] if* ] keep
t over set-vocab-source-loaded?
[ [ % ] [ call ] if-bootstrapping ] dip ;
t swap set-vocab-source-loaded?
[ % ] [ call ] if-bootstrapping ;
: load-docs ( vocab -- vocab )
load-help? get [
f over set-vocab-docs-loaded?
[ vocab-docs-path [ ?run-file ] when* ] keep
t over set-vocab-docs-loaded?
] when ;
t swap set-vocab-docs-loaded?
] [ drop ] if ;
: reload ( name -- )
[
dup vocab [ load-source load-docs drop ] [ no-vocab ] ?if
dup vocab [ [ load-source ] [ load-docs ] bi ] [ no-vocab ] ?if
] with-compiler-errors ;
: require ( vocab -- )
@ -90,8 +90,8 @@ GENERIC: (load-vocab) ( name -- )
M: vocab (load-vocab)
[
dup vocab-source-loaded? [ load-source ] unless
dup vocab-docs-loaded? [ load-docs ] unless
dup vocab-source-loaded? [ dup load-source ] unless
dup vocab-docs-loaded? [ dup load-docs ] unless
drop
] [ [ swap add-to-blacklist ] keep rethrow ] recover ;

View File

@ -31,3 +31,7 @@ IN: regexp2.parser
[ ] [ "[a-c]" test-regexp ] unit-test
[ ] [ "[^a-c]" test-regexp ] unit-test
[ "[^]" test-regexp ] must-fail
[ ] [ "|b" test-regexp ] unit-test
[ ] [ "b|" test-regexp ] unit-test
[ ] [ "||" test-regexp ] unit-test

View File

@ -67,7 +67,7 @@ left-parenthesis pipe caret dash ;
: <negation> ( obj -- negation ) negation boa ;
: <concatenation> ( seq -- concatenation )
>vector get-reversed-regexp [ reverse ] when
concatenation boa ;
[ epsilon ] [ concatenation boa ] if-empty ;
: <alternation> ( seq -- alternation ) >vector alternation boa ;
: <capture-group> ( obj -- capture-group ) capture-group boa ;
: <kleene-star> ( obj -- kleene-star ) kleene-star boa ;

View File

@ -14,6 +14,13 @@ IN: regexp2-tests
[ t ] [ "c" "a|b|c" <regexp> matches? ] unit-test
[ f ] [ "c" "d|e|f" <regexp> matches? ] unit-test
[ t ] [ "b" "|b" <regexp> matches? ] unit-test
[ t ] [ "b" "b|" <regexp> matches? ] unit-test
[ t ] [ "" "b|" <regexp> matches? ] unit-test
[ t ] [ "" "b|" <regexp> matches? ] unit-test
[ f ] [ "" "|" <regexp> matches? ] unit-test
[ f ] [ "" "|||||||" <regexp> matches? ] unit-test
[ f ] [ "aa" "a|b|c" <regexp> matches? ] unit-test
[ f ] [ "bb" "a|b|c" <regexp> matches? ] unit-test
[ f ] [ "cc" "a|b|c" <regexp> matches? ] unit-test