Merge jcg@repo.or.cz:/srv/git/factor
commit
166f5777b5
|
@ -8,7 +8,7 @@ calendar.format accessors sets hashtables ;
|
||||||
IN: smtp
|
IN: smtp
|
||||||
|
|
||||||
SYMBOL: smtp-domain
|
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: smtp-read-timeout 1 minutes smtp-read-timeout set-global
|
||||||
SYMBOL: esmtp? t esmtp? set-global
|
SYMBOL: esmtp? t esmtp? set-global
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ set_make() {
|
||||||
*) MAKE='make';;
|
*) MAKE='make';;
|
||||||
esac
|
esac
|
||||||
if ! [[ $MAKE -eq 'gmake' ]] ; then
|
if ! [[ $MAKE -eq 'gmake' ]] ; then
|
||||||
ensure_program_installed gmake
|
ensure_program_installed gmake
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,6 +159,7 @@ check_factor_exists() {
|
||||||
}
|
}
|
||||||
|
|
||||||
find_os() {
|
find_os() {
|
||||||
|
if [[ -n $OS ]] ; then return; fi
|
||||||
$ECHO "Finding OS..."
|
$ECHO "Finding OS..."
|
||||||
uname_s=`uname -s`
|
uname_s=`uname -s`
|
||||||
check_ret uname
|
check_ret uname
|
||||||
|
@ -178,6 +179,7 @@ find_os() {
|
||||||
}
|
}
|
||||||
|
|
||||||
find_architecture() {
|
find_architecture() {
|
||||||
|
if [[ -n $ARCH ]] ; then return; fi
|
||||||
$ECHO "Finding ARCH..."
|
$ECHO "Finding ARCH..."
|
||||||
uname_m=`uname -m`
|
uname_m=`uname -m`
|
||||||
check_ret uname
|
check_ret uname
|
||||||
|
@ -197,7 +199,7 @@ write_test_program() {
|
||||||
echo "int main(){printf(\"%d\", 8*sizeof(void*)); return 0; }" >> $C_WORD.c
|
echo "int main(){printf(\"%d\", 8*sizeof(void*)); return 0; }" >> $C_WORD.c
|
||||||
}
|
}
|
||||||
|
|
||||||
find_word_size() {
|
c_find_word_size() {
|
||||||
$ECHO "Finding WORD..."
|
$ECHO "Finding WORD..."
|
||||||
C_WORD=factor-word-size
|
C_WORD=factor-word-size
|
||||||
write_test_program
|
write_test_program
|
||||||
|
@ -207,6 +209,29 @@ find_word_size() {
|
||||||
rm -f $C_WORD*
|
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() {
|
set_factor_binary() {
|
||||||
case $OS in
|
case $OS in
|
||||||
# winnt) FACTOR_BINARY=factor-nt;;
|
# winnt) FACTOR_BINARY=factor-nt;;
|
||||||
|
@ -230,15 +255,18 @@ echo_build_info() {
|
||||||
$ECHO MAKE=$MAKE
|
$ECHO MAKE=$MAKE
|
||||||
}
|
}
|
||||||
|
|
||||||
set_build_info() {
|
check_os_arch_word() {
|
||||||
if ! [[ -n $OS && -n $ARCH && -n $WORD ]] ; then
|
if ! [[ -n $OS && -n $ARCH && -n $WORD ]] ; then
|
||||||
$ECHO "OS: $OS"
|
$ECHO "OS: $OS"
|
||||||
$ECHO "ARCH: $ARCH"
|
$ECHO "ARCH: $ARCH"
|
||||||
$ECHO "WORD: $WORD"
|
$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
|
exit 5
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_build_info() {
|
||||||
|
check_os_arch_word
|
||||||
MAKE_TARGET=$OS-$ARCH-$WORD
|
MAKE_TARGET=$OS-$ARCH-$WORD
|
||||||
MAKE_IMAGE_TARGET=$ARCH.$WORD
|
MAKE_IMAGE_TARGET=$ARCH.$WORD
|
||||||
BOOT_IMAGE=boot.$ARCH.$WORD.image
|
BOOT_IMAGE=boot.$ARCH.$WORD.image
|
||||||
|
@ -254,15 +282,32 @@ set_build_info() {
|
||||||
fi
|
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_build_info() {
|
||||||
find_os
|
find_os
|
||||||
find_architecture
|
find_architecture
|
||||||
find_word_size
|
find_word_size
|
||||||
set_factor_binary
|
set_factor_binary
|
||||||
set_build_info
|
set_build_info
|
||||||
set_downloader
|
set_downloader
|
||||||
set_gcc
|
set_gcc
|
||||||
set_make
|
set_make
|
||||||
echo_build_info
|
echo_build_info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,30 +460,37 @@ make_boot_image() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_build_system_apt() {
|
install_build_system_apt() {
|
||||||
ensure_program_installed yes
|
sudo apt-get --yes install sudo libc6-dev libfreetype6-dev libx11-dev xorg-dev glutg3-dev wget git-core git-doc rlwrap gcc make
|
||||||
yes | sudo apt-get install sudo libc6-dev libfreetype6-dev libx11-dev xorg-dev glutg3-dev wget git-core git-doc rlwrap gcc make
|
|
||||||
check_ret sudo
|
check_ret sudo
|
||||||
}
|
}
|
||||||
|
|
||||||
install_build_system_port() {
|
install_build_system_port() {
|
||||||
test_program_installed git
|
test_program_installed git
|
||||||
if [[ $? -ne 1 ]] ; then
|
if [[ $? -ne 1 ]] ; then
|
||||||
ensure_program_installed yes
|
ensure_program_installed yes
|
||||||
echo "git not found."
|
echo "git not found."
|
||||||
echo "This script requires either git-core or port."
|
echo "This script requires either git-core or port."
|
||||||
echo "If it fails, install git-core or port and try again."
|
echo "If it fails, install git-core or port and try again."
|
||||||
ensure_program_installed port
|
ensure_program_installed port
|
||||||
echo "Installing git-core with port...this will take awhile."
|
echo "Installing git-core with port...this will take awhile."
|
||||||
yes | sudo port install git-core
|
yes | sudo port install git-core
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
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 "If you are behind a firewall, invoke as:"
|
||||||
echo "env GIT_PROTOCOL=http $0 <command>"
|
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
|
case "$1" in
|
||||||
install) install ;;
|
install) install ;;
|
||||||
install-x11) install_build_system_apt; install ;;
|
install-x11) install_build_system_apt; install ;;
|
||||||
|
@ -447,8 +499,9 @@ case "$1" in
|
||||||
quick-update) update; refresh_image ;;
|
quick-update) update; refresh_image ;;
|
||||||
update) update; update_bootstrap ;;
|
update) update; update_bootstrap ;;
|
||||||
bootstrap) get_config_info; bootstrap ;;
|
bootstrap) get_config_info; bootstrap ;;
|
||||||
|
report) find_build_info ;;
|
||||||
dlls) get_config_info; maybe_download_dlls;;
|
dlls) get_config_info; maybe_download_dlls;;
|
||||||
net-bootstrap) get_config_info; update_boot_images; bootstrap ;;
|
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 ;;
|
*) usage ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -334,7 +334,7 @@ HELP: if-empty
|
||||||
{ $values { "seq" sequence } { "quot1" quotation } { "quot2" quotation } }
|
{ $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." }
|
{ $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
|
{ $example
|
||||||
"USING: kernel prettyprint sequences sequences.lib ;"
|
"USING: kernel prettyprint sequences ;"
|
||||||
"{ 1 2 3 } [ \"empty sequence\" ] [ sum ] if-empty ."
|
"{ 1 2 3 } [ \"empty sequence\" ] [ sum ] if-empty ."
|
||||||
"6"
|
"6"
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -54,19 +54,19 @@ SYMBOL: load-help?
|
||||||
: load-source ( vocab -- vocab )
|
: load-source ( vocab -- vocab )
|
||||||
f over set-vocab-source-loaded?
|
f over set-vocab-source-loaded?
|
||||||
[ vocab-source-path [ parse-file ] [ [ ] ] if* ] keep
|
[ vocab-source-path [ parse-file ] [ [ ] ] if* ] keep
|
||||||
t over set-vocab-source-loaded?
|
t swap set-vocab-source-loaded?
|
||||||
[ [ % ] [ call ] if-bootstrapping ] dip ;
|
[ % ] [ call ] if-bootstrapping ;
|
||||||
|
|
||||||
: load-docs ( vocab -- vocab )
|
: load-docs ( vocab -- vocab )
|
||||||
load-help? get [
|
load-help? get [
|
||||||
f over set-vocab-docs-loaded?
|
f over set-vocab-docs-loaded?
|
||||||
[ vocab-docs-path [ ?run-file ] when* ] keep
|
[ vocab-docs-path [ ?run-file ] when* ] keep
|
||||||
t over set-vocab-docs-loaded?
|
t swap set-vocab-docs-loaded?
|
||||||
] when ;
|
] [ drop ] if ;
|
||||||
|
|
||||||
: reload ( name -- )
|
: 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 ;
|
] with-compiler-errors ;
|
||||||
|
|
||||||
: require ( vocab -- )
|
: require ( vocab -- )
|
||||||
|
@ -90,8 +90,8 @@ GENERIC: (load-vocab) ( name -- )
|
||||||
|
|
||||||
M: vocab (load-vocab)
|
M: vocab (load-vocab)
|
||||||
[
|
[
|
||||||
dup vocab-source-loaded? [ load-source ] unless
|
dup vocab-source-loaded? [ dup load-source ] unless
|
||||||
dup vocab-docs-loaded? [ load-docs ] unless
|
dup vocab-docs-loaded? [ dup load-docs ] unless
|
||||||
drop
|
drop
|
||||||
] [ [ swap add-to-blacklist ] keep rethrow ] recover ;
|
] [ [ swap add-to-blacklist ] keep rethrow ] recover ;
|
||||||
|
|
||||||
|
|
|
@ -31,3 +31,7 @@ IN: regexp2.parser
|
||||||
[ ] [ "[a-c]" test-regexp ] unit-test
|
[ ] [ "[a-c]" test-regexp ] unit-test
|
||||||
[ ] [ "[^a-c]" test-regexp ] unit-test
|
[ ] [ "[^a-c]" test-regexp ] unit-test
|
||||||
[ "[^]" test-regexp ] must-fail
|
[ "[^]" test-regexp ] must-fail
|
||||||
|
|
||||||
|
[ ] [ "|b" test-regexp ] unit-test
|
||||||
|
[ ] [ "b|" test-regexp ] unit-test
|
||||||
|
[ ] [ "||" test-regexp ] unit-test
|
||||||
|
|
|
@ -67,7 +67,7 @@ left-parenthesis pipe caret dash ;
|
||||||
: <negation> ( obj -- negation ) negation boa ;
|
: <negation> ( obj -- negation ) negation boa ;
|
||||||
: <concatenation> ( seq -- concatenation )
|
: <concatenation> ( seq -- concatenation )
|
||||||
>vector get-reversed-regexp [ reverse ] when
|
>vector get-reversed-regexp [ reverse ] when
|
||||||
concatenation boa ;
|
[ epsilon ] [ concatenation boa ] if-empty ;
|
||||||
: <alternation> ( seq -- alternation ) >vector alternation boa ;
|
: <alternation> ( seq -- alternation ) >vector alternation boa ;
|
||||||
: <capture-group> ( obj -- capture-group ) capture-group boa ;
|
: <capture-group> ( obj -- capture-group ) capture-group boa ;
|
||||||
: <kleene-star> ( obj -- kleene-star ) kleene-star boa ;
|
: <kleene-star> ( obj -- kleene-star ) kleene-star boa ;
|
||||||
|
|
|
@ -14,6 +14,13 @@ IN: regexp2-tests
|
||||||
[ t ] [ "c" "a|b|c" <regexp> matches? ] unit-test
|
[ t ] [ "c" "a|b|c" <regexp> matches? ] unit-test
|
||||||
[ f ] [ "c" "d|e|f" <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 ] [ "aa" "a|b|c" <regexp> matches? ] unit-test
|
||||||
[ f ] [ "bb" "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
|
[ f ] [ "cc" "a|b|c" <regexp> matches? ] unit-test
|
||||||
|
|
Loading…
Reference in New Issue