Merge remote-tracking branch 'origin/master' into modern-harvey3

modern-harvey3-triple
Doug Coleman 2018-08-24 16:49:34 -05:00
commit fdb5383f19
30 changed files with 94 additions and 85 deletions

View File

@ -74,7 +74,7 @@ $nl
"If no initial value is specified, the contents of the allocated memory are undefined." } "If no initial value is specified, the contents of the allocated memory are undefined." }
{ $warning "Reading or writing a scoped allocation buffer outside of the given quotation will cause memory corruption." } { $warning "Reading or writing a scoped allocation buffer outside of the given quotation will cause memory corruption." }
{ $examples { $examples
{ $unchecked-example { $example
"USING: accessors alien.c-types alien.data "USING: accessors alien.c-types alien.data
classes.struct kernel math math.functions classes.struct kernel math math.functions
prettyprint ; prettyprint ;

View File

@ -25,7 +25,7 @@ HELP: seek
HELP: align HELP: align
{ $values { "n" integer } { "bitstream" bit-reader } } { $values { "n" integer } { "bitstream" bit-reader } }
{ $description "Moves the read cursor of the bit-reader forward until its position in bits from the start of the stream is an even multiple of n. If it is already such a multiple, the cursor is not moved at all. " } ; { $description "Moves the read cursor of the bit-reader forward until its position in bits from the start of the stream is an even multiple of n. If it is already such a multiple, the cursor is not moved at all." } ;
HELP: enough-bits? HELP: enough-bits?
{ $values { "n" integer } { "bs" bit-reader } { "?" boolean } } { $values { "n" integer } { "bs" bit-reader } { "?" boolean } }

View File

@ -78,7 +78,7 @@ HELP: emit-loop-call
HELP: emit-node HELP: emit-node
{ $values { "block" basic-block } { "node" node } { "block'" basic-block } } { $values { "block" basic-block } { "node" node } { "block'" basic-block } }
{ $description "Emits CFG instructions for the given SSA node. The word can add one or more basic blocks to the " { $link cfg } ". The next block to operate on is pushed onto the stack. " { $description "Emits CFG instructions for the given SSA node. The word can add one or more basic blocks to the " { $link cfg } ". The next block to operate on is pushed onto the stack."
$nl $nl
"The following classes emit-node methods does not change the current block:" "The following classes emit-node methods does not change the current block:"
{ $list { $list

View File

@ -10,7 +10,7 @@ HELP: basic-block
{ $table { $table
{ {
{ $slot "number" } { $slot "number" }
{ "The blocks sequence number. Generated by calling " { $link number-blocks } ". " } { "The blocks sequence number. Generated by calling " { $link number-blocks } "." }
} }
{ {
{ $slot "successors" } { $slot "successors" }

View File

@ -9,4 +9,4 @@ HELP: inline-accessor
{ "test" quotation } { "test" quotation }
{ "block'" basic-block } { "block'" basic-block }
} }
{ $description "Combinator used to simplify writing intrinsic emitting code. If the 'test' quotation yields " { $link t } " when called on the 'call#' nodes inputs, then the 'quot' quotation is used to emit intrinsic instructions. Otherwise a primitive call is emitted. " } ; { $description "Combinator used to simplify writing intrinsic emitting code. If the 'test' quotation yields " { $link t } " when called on the 'call#' nodes inputs, then the 'quot' quotation is used to emit intrinsic instructions. Otherwise a primitive call is emitted." } ;

View File

@ -14,7 +14,7 @@ HELP: alien-invoke#
{ $see-also alien-invoke } ; { $see-also alien-invoke } ;
HELP: alien-callback# HELP: alien-callback#
{ $class-description "SSA tree node that constructs an alien callback. It is not a subclass of " { $link alien-node# } ". " } ; { $class-description "SSA tree node that constructs an alien callback. It is not a subclass of " { $link alien-node# } "." } ;
HELP: call# HELP: call#
{ $class-description "SSA tree node that calls a word. It has the following slots:" { $class-description "SSA tree node that calls a word. It has the following slots:"

View File

@ -48,7 +48,7 @@ HELP: reset-lzw-uncompress
{ $values { $values
{ "lzw" lzw } { "lzw" lzw }
} }
{ $description "Reset the LZW uncompressor state (either at initialization time or immediately after receiving a Clear Code). " } ; { $description "Reset the LZW uncompressor state (either at initialization time or immediately after receiving a Clear Code)." } ;
ARTICLE: "compression.lzw.differences" "LZW differences between TIFF and GIF" ARTICLE: "compression.lzw.differences" "LZW differences between TIFF and GIF"
{ $vocab-link "compression.lzw" } { $vocab-link "compression.lzw" }

View File

@ -14,7 +14,7 @@ HELP: %boolean
HELP: %prepare-var-args HELP: %prepare-var-args
{ $values { "reg-inputs" sequence } } { $values { "reg-inputs" sequence } }
{ $description "Emits code needed for calling variadic functions. On " { $link unix } " " { $link x86.64 } ", the " { $link AL } " register must contain the number of float registers used. " } ; { $description "Emits code needed for calling variadic functions. On " { $link unix } " " { $link x86.64 } ", the " { $link AL } " register must contain the number of float registers used." } ;
HELP: JLE HELP: JLE
{ $values { "dst" "destination offset (relative to the instruction pointer register)" } } { $values { "dst" "destination offset (relative to the instruction pointer register)" } }

View File

@ -231,7 +231,7 @@ ARTICLE: "db-tuples-tutorial" "Tuple database tutorial"
"Let's make a tuple and store it in a database. To follow along, click on each code example and run it in the listener. If you forget to run an example, just start at the top and run them all again in order." $nl "Let's make a tuple and store it in a database. To follow along, click on each code example and run it in the listener. If you forget to run an example, just start at the top and run them all again in order." $nl
"We're going to store books in this tutorial." "We're going to store books in this tutorial."
{ $code "TUPLE: book id title author date-published edition cover-price condition ;" } { $code "TUPLE: book id title author date-published edition cover-price condition ;" }
"The title, author, and publisher should be strings; the date-published a timestamp; the edition an integer; the cover-price a float. These are the Factor types for which we will need to look up the corresponding " { $link "db.types" } ". " $nl "The title, author, and publisher should be strings; the date-published a timestamp; the edition an integer; the cover-price a float. These are the Factor types for which we will need to look up the corresponding " { $link "db.types" } "." $nl
"To actually bind the tuple slots to the database types, we'll use " { $link define-persistent } "." "To actually bind the tuple slots to the database types, we'll use " { $link define-persistent } "."
{ $code { $code
"USING: db.tuples db.types ; "USING: db.tuples db.types ;

View File

@ -30,7 +30,7 @@ HELP: new-user
HELP: update-user HELP: update-user
{ $values { "user" user } { "provider" "an authentication provider" } } { $values { "user" user } { "provider" "an authentication provider" } }
{ $contract "Stores a user back to an authentication provider after being changed. This is a no-op with in-memory providers; providers which use an external store will save the user in this word. " } ; { $contract "Stores a user back to an authentication provider after being changed. This is a no-op with in-memory providers; providers which use an external store will save the user in this word." } ;
ARTICLE: "furnace.auth.providers.protocol" "Authentication provider protocol" ARTICLE: "furnace.auth.providers.protocol" "Authentication provider protocol"
"The " { $vocab-link "furnace.auth.providers" } " vocabulary implements a protocol for persistence and authentication of users." "The " { $vocab-link "furnace.auth.providers" } " vocabulary implements a protocol for persistence and authentication of users."

View File

@ -7,7 +7,7 @@ IN: match
HELP: match HELP: match
{ $values { "value1" object } { "value2" object } { "bindings" assoc } { $values { "value1" object } { "value2" object } { "bindings" assoc }
} }
{ $description "Pattern match " { $snippet "value1" } " against " { $snippet "value2" } ". These values can be any Factor value, including sequences and tuples. The values can contain pattern variables, which are symbols that begin with '?'. The result is a hashtable of the bindings, mapping the pattern variables from one sequence to the equivalent value in the other sequence. The " { $link _ } " symbol can be used to ignore the value at that point in the pattern for the match. " } { $description "Pattern match " { $snippet "value1" } " against " { $snippet "value2" } ". These values can be any Factor value, including sequences and tuples. The values can contain pattern variables, which are symbols that begin with '?'. The result is a hashtable of the bindings, mapping the pattern variables from one sequence to the equivalent value in the other sequence. The " { $link _ } " symbol can be used to ignore the value at that point in the pattern for the match." }
{ $examples { $examples
{ $unchecked-example "USE: match" "MATCH-VARS: ?a ?b ;\n{ ?a { 2 ?b } 5 } { 1 { 2 3 } _ } match ." "H{ { ?a 1 } { ?b 3 } }" } { $unchecked-example "USE: match" "MATCH-VARS: ?a ?b ;\n{ ?a { 2 ?b } 5 } { 1 { 2 3 } _ } match ." "H{ { ?a 1 } { ?b 3 } }" }
} }

View File

@ -332,7 +332,7 @@ ARTICLE: "peg.ebnf.foreign-rules" "EBNF Foreign Rules"
ARTICLE: "peg.ebnf.tokenizers" "EBNF Tokenizers" ARTICLE: "peg.ebnf.tokenizers" "EBNF Tokenizers"
"It is possible to override the tokenizer in an EBNF defined parser. " "It is possible to override the tokenizer in an EBNF defined parser. "
"Usually the input sequence to be parsed is an array of characters or a string. " "Usually the input sequence to be parsed is an array of characters or a string. "
"Terminals in a rule match successive characters in the array or string. " "Terminals in a rule match successive characters in the array or string."
{ $examples { $examples
{ $code { $code
"USING: multiline ;" "USING: multiline ;"
@ -378,7 +378,7 @@ ARTICLE: "peg.ebnf.tokenizers" "EBNF Tokenizers"
"instead of the string \"++--\". With the new tokenizer \"....\" sequences " "instead of the string \"++--\". With the new tokenizer \"....\" sequences "
"in the grammar are matched for equality against the token, rather than a " "in the grammar are matched for equality against the token, rather than a "
"string comparison against successive items in the sequence. This can be used " "string comparison against successive items in the sequence. This can be used "
"to match an AST from a tokenizer. " "to match an AST from a tokenizer."
$nl $nl
"In this example I split the tokenizer into a separate parser and use " "In this example I split the tokenizer into a separate parser and use "
"'foreign' to call it from the main one. This allows testing of the " "'foreign' to call it from the main one. This allows testing of the "
@ -449,7 +449,7 @@ $nl
"This tokenizer strips out whitespace and newlines. Some rules in the grammar " "This tokenizer strips out whitespace and newlines. Some rules in the grammar "
"require checking for a newline. In particular the automatic semicolon insertion " "require checking for a newline. In particular the automatic semicolon insertion "
"rule (managed by the 'Sc' rule here). If there is a newline, the semicolon can " "rule (managed by the 'Sc' rule here). If there is a newline, the semicolon can "
"be optional in places. " "be optional in places."
{ $examples { $examples
{ $code { $code
"\"do\" Stmt:s \"while\" \"(\" Expr:c \")\" Sc => [[ s c ast-do-while boa ]]" "\"do\" Stmt:s \"while\" \"(\" Expr:c \")\" Sc => [[ s c ast-do-while boa ]]"
@ -463,7 +463,7 @@ $nl
ARTICLE: "peg.ebnf" "EBNF" ARTICLE: "peg.ebnf" "EBNF"
"The " { $vocab-link "peg.ebnf" } " vocabulary provides a DSL that allows writing PEG parsers that look like " "The " { $vocab-link "peg.ebnf" } " vocabulary provides a DSL that allows writing PEG parsers that look like "
"EBNF syntax. It provides three parsing words described below. These words all " "EBNF syntax. It provides three parsing words described below. These words all "
"accept the same EBNF syntax. The difference is in how they are used. " "accept the same EBNF syntax. The difference is in how they are used."
{ $subsections { $subsections
postpone: \EBNF: postpone: \EBNF:
postpone: \EBNF[[ postpone: \EBNF[[

View File

@ -193,7 +193,7 @@ HELP: flow
{ $class-description "A " { $link block } " section printed on its own line if it can fit entirely on one line." } ; { $class-description "A " { $link block } " section printed on its own line if it can fit entirely on one line." } ;
HELP: <flow HELP: <flow
{ $description "Begins a " { $link flow } " section. " } ; { $description "Begins a " { $link flow } " section." } ;
HELP: colon HELP: colon
{ $class-description "A " { $link block } " section. When printed as a " { $link long-section } ", indents every line except the first." } { $class-description "A " { $link block } " section. When printed as a " { $link long-section } ", indents every line except the first." }

View File

@ -64,3 +64,12 @@ threads tools.test tools.time ;
700 milliseconds sleep dup restart-timer 700 milliseconds sleep dup restart-timer
700 milliseconds sleep stop-timer 500 milliseconds sleep 700 milliseconds sleep stop-timer 500 milliseconds sleep
] unit-test ] unit-test
{ { 2 } } [
{ 0 }
dup '[ 0 _ [ 1 + ] change-nth ] 300 milliseconds f <timer>
dup restart-timer
700 milliseconds sleep
dup restart-timer drop
700 milliseconds sleep
] unit-test

View File

@ -88,17 +88,14 @@ PRIVATE>
: stop-timer ( timer -- ) : stop-timer ( timer -- )
dup quotation-running?>> [ dup quotation-running?>> [
f >>thread drop dup thread>> [ interrupt ] when*
] [ ] unless f >>thread drop ;
[ [ interrupt ] when* f ] change-thread drop
] if ;
: restart-timer ( timer -- ) : restart-timer ( timer -- )
t >>restart?
dup quotation-running?>> [ dup quotation-running?>> [
drop t >>restart? drop
] [ ] [
dup thread>> [ nip interrupt ] [ start-timer ] if* dup thread>> [ interrupt ] when* start-timer
] if ; ] if ;
<PRIVATE <PRIVATE

View File

@ -65,7 +65,7 @@ HELP: <model-field>
HELP: <action-field> HELP: <action-field>
{ $values { "quot" { $quotation ( string -- ) } } { "gadget" editor } } { $values { "quot" { $quotation ( string -- ) } } { "gadget" editor } }
{ $description "Creates an editor gadget with a blank model. Whenever a value is entered into the editor and Return pressed, the value is pushed on the stack as a string and the specified quotation is called. Note that the quotation cannot update the value in the field. " } ; { $description "Creates an editor gadget with a blank model. Whenever a value is entered into the editor and Return pressed, the value is pushed on the stack as a string and the specified quotation is called. Note that the quotation cannot update the value in the field." } ;
HELP: editor-string HELP: editor-string

View File

@ -259,7 +259,7 @@ $nl
clear-gadget clear-gadget
} }
"The children of a gadget are available via the " "The children of a gadget are available via the "
{ $snippet "children" } " slot. " { $snippet "children" } " slot."
$nl $nl
"Working with gadget children:" "Working with gadget children:"
{ $subsections { $subsections

View File

@ -15,9 +15,11 @@ GIT_PROTOCOL=${GIT_PROTOCOL:="git"}
GIT_URL=${GIT_URL:=$GIT_PROTOCOL"://factorcode.org/git/factor.git"} GIT_URL=${GIT_URL:=$GIT_PROTOCOL"://factorcode.org/git/factor.git"}
SCRIPT_ARGS="$*" SCRIPT_ARGS="$*"
REQUIRE_CLANG_VERSION=3.1
# return 1 on found # return 1 on found
test_program_installed() { test_program_installed() {
if ! [[ -n `type -p $1` ]] ; then if ! [[ -n $(type -p $1) ]] ; then
return 0; return 0;
fi fi
return 1; return 1;
@ -25,9 +27,9 @@ test_program_installed() {
# return 1 on found # return 1 on found
test_programs_installed() { test_programs_installed() {
installed=0; local installed=0;
$ECHO -n "Checking for all($*)..." $ECHO -n "Checking for all($*)..."
for i in $* ; for i in "$@" ;
do do
test_program_installed $i test_program_installed $i
if [[ $? -eq 1 ]]; then if [[ $? -eq 1 ]]; then
@ -52,9 +54,9 @@ exit_script() {
} }
ensure_program_installed() { ensure_program_installed() {
installed=0; local installed=0;
$ECHO -n "Checking for any($*)..." $ECHO -n "Checking for any($*)..."
for i in $* ; for i in "$@" ;
do do
test_program_installed $i test_program_installed $i
if [[ $? -eq 1 ]]; then if [[ $? -eq 1 ]]; then
@ -133,16 +135,16 @@ semver_into() {
} }
clang_version_ok() { clang_version_ok() {
CLANG_VERSION=`clang --version | head -n1` CLANG_VERSION=$(clang --version | head -n1)
CLANG_VERSION_RE='^[a-zA-Z0-9 ]* version (.*)$' # 3.3-5 CLANG_VERSION_RE='^[a-zA-Z0-9 ]* version (.*)$' # 3.3-5
if [[ $CLANG_VERSION =~ $CLANG_VERSION_RE ]] ; then if [[ $CLANG_VERSION =~ $CLANG_VERSION_RE ]] ; then
export "CLANG_VERSION=${BASH_REMATCH[1]}" export "CLANG_VERSION=${BASH_REMATCH[1]}"
local CLANG_MAJOR local CLANG_MINOR local CLANG_PATCH local CLANG_SPECIAL local CLANG_MAJOR CLANG_MINOR CLANG_PATCH CLANG_SPECIAL
semver_into "$CLANG_VERSION" CLANG_MAJOR CLANG_MINOR CLANG_PATCH CLANG_SPECIAL semver_into "$CLANG_VERSION" CLANG_MAJOR CLANG_MINOR CLANG_PATCH CLANG_SPECIAL
if [[ $CLANG_MAJOR -lt 3 if [[ $CLANG_MAJOR -lt 3
|| ( $CLANG_MAJOR -eq 3 && $CLANG_MINOR -le 1 ) || ( $CLANG_MAJOR -eq 3 && $CLANG_MINOR -le 1 )
]] ; then ]] ; then
echo "clang version required >= 3.1, got $CLANG_VERSION" echo "clang version required >= $REQUIRE_CLANG_VERSION, got $CLANG_VERSION"
return 1 return 1
fi fi
else else
@ -241,7 +243,7 @@ check_factor_exists() {
find_os() { find_os() {
if [[ -n $OS ]] ; then return; fi if [[ -n $OS ]] ; then return; fi
$ECHO "Finding OS..." $ECHO "Finding OS..."
uname_s=`uname -s` local uname_s=$(uname -s)
check_ret uname check_ret uname
case $uname_s in case $uname_s in
CYGWIN_NT-5.2-WOW64) OS=windows;; CYGWIN_NT-5.2-WOW64) OS=windows;;
@ -258,7 +260,7 @@ find_os() {
find_architecture() { find_architecture() {
if [[ -n $ARCH ]] ; then return; fi 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
case $uname_m in case $uname_m in
i386) ARCH=x86;; i386) ARCH=x86;;
@ -275,7 +277,7 @@ find_architecture() {
find_num_cores() { find_num_cores() {
$ECHO "Finding num cores..." $ECHO "Finding num cores..."
NUM_CORES=7ZZ NUM_CORES=7ZZ
uname_s=`uname -s` uname_s=$(uname -s)
check_ret uname check_ret uname
case $uname_s in case $uname_s in
CYGWIN_NT-5.2-WOW64 | *CYGWIN_NT* | *CYGWIN* | MINGW32*) NUM_CORES=$NUMBER_OF_PROCESSORS;; CYGWIN_NT-5.2-WOW64 | *CYGWIN_NT* | *CYGWIN* | MINGW32*) NUM_CORES=$NUMBER_OF_PROCESSORS;;
@ -283,20 +285,19 @@ find_num_cores() {
esac esac
} }
write_test_program() { echo_test_program() {
#! Must be 'echo' #! Must be 'echo'
echo "#include <stdio.h>" > $C_WORD.c echo -e "int main(){ return (long)(8*sizeof(void*)); }"
echo "int main(){printf(\"%ld\", (long)(8*sizeof(void*))); return 0; }" >> $C_WORD.c
} }
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 echo_test_program | $CC -o $C_WORD -xc -
$CC -o $C_WORD $C_WORD.c check_ret $CC
WORD=$(./$C_WORD) ./$C_WORD
check_ret $C_WORD WORD=$?
$DELETE -f $C_WORD* $DELETE -f $C_WORD
} }
intel_macosx_word_size() { intel_macosx_word_size() {
@ -403,9 +404,9 @@ set_build_info() {
parse_build_info() { parse_build_info() {
ensure_program_installed cut ensure_program_installed cut
$ECHO "Parsing make target from command line: $1" $ECHO "Parsing make target from command line: $1"
OS=`echo $1 | cut -d '-' -f 1` OS=$(echo $1 | cut -d '-' -f 1)
ARCH=`echo $1 | cut -d '-' -f 2` ARCH=$(echo $1 | cut -d '-' -f 2)
WORD=`echo $1 | cut -d '-' -f 3` WORD=$(echo $1 | cut -d '-' -f 3)
if [[ $OS == linux && $ARCH == ppc ]] ; then WORD=32; fi if [[ $OS == linux && $ARCH == ppc ]] ; then WORD=32; fi
if [[ $OS == linux && $ARCH == arm ]] ; then WORD=32; fi if [[ $OS == linux && $ARCH == arm ]] ; then WORD=32; fi
@ -433,7 +434,7 @@ find_build_info() {
} }
invoke_git() { invoke_git() {
git $* git "$@"
check_ret git check_ret git
} }
@ -443,13 +444,13 @@ git_clone() {
} }
update_script_name() { update_script_name() {
$ECHO `dirname $0`/_update.sh $ECHO "$(dirname $0)/_update.sh"
} }
update_script() { update_script() {
update_script=`update_script_name` local -r update_script=$(update_script_name)
bash_path=`which bash` local -r bash_path=$(which bash)
branch=$(current_git_branch) local -r branch=$(current_git_branch)
$ECHO "#!$bash_path" >"$update_script" $ECHO "#!$bash_path" >"$update_script"
$ECHO "git pull \"$GIT_URL\" ${branch}" >>"$update_script" $ECHO "git pull \"$GIT_URL\" ${branch}" >>"$update_script"
$ECHO "if [[ \$? -eq 0 ]]; then exec \"$0\" $SCRIPT_ARGS; else echo \"git pull failed\"; exit 2; fi" \ $ECHO "if [[ \$? -eq 0 ]]; then exec \"$0\" $SCRIPT_ARGS; else echo \"git pull failed\"; exit 2; fi" \
@ -461,16 +462,16 @@ update_script() {
} }
update_script_changed() { update_script_changed() {
invoke_git diff --stat `invoke_git merge-base HEAD FETCH_HEAD` FETCH_HEAD | grep 'build\.sh' >/dev/null invoke_git diff --stat "$(invoke_git merge-base HEAD FETCH_HEAD)" FETCH_HEAD | grep 'build\.sh' >/dev/null
} }
git_fetch_factorcode() { git_fetch_factorcode() {
$ECHO "Fetching the git repository from factorcode.org..." $ECHO "Fetching the git repository from factorcode.org..."
branch=$(current_git_branch) branch=$(current_git_branch)
rm -f `update_script_name` rm -f "$(update_script_name)"
invoke_git fetch --all invoke_git fetch "$GIT_URL" --all
invoke_git fetch --tags invoke_git fetch "$GIT_URL" --tags
if update_script_changed; then if update_script_changed; then
$ECHO "Updating and restarting the build.sh script..." $ECHO "Updating and restarting the build.sh script..."
@ -482,7 +483,7 @@ git_fetch_factorcode() {
} }
cd_factor() { cd_factor() {
cd factor cd "factor"
check_ret cd check_ret cd
} }
@ -522,7 +523,7 @@ check_makefile_exists() {
invoke_make() { invoke_make() {
check_makefile_exists check_makefile_exists
$MAKE $MAKE_OPTS $* $MAKE $MAKE_OPTS "$@"
check_ret $MAKE check_ret $MAKE
} }
@ -546,13 +547,13 @@ current_git_branch() {
check_url() { check_url() {
if [[ $DOWNLOADER_NAME == 'wget' ]]; then if [[ $DOWNLOADER_NAME == 'wget' ]]; then
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then if [[ $(wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK') ]]; then
return 0 return 0
else else
return 1 return 1
fi fi
elif [[ $DOWNLOADER_NAME == 'curl' ]]; then elif [[ $DOWNLOADER_NAME == 'curl' ]]; then
code=`curl -sL -w "%{http_code}\\n" "$1" -o /dev/null` local code=$(curl -sL -w "%{http_code}\\n" "$1" -o /dev/null)
if [[ $code -eq 200 ]]; then return 0; else return 1; fi if [[ $code -eq 200 ]]; then return 0; else return 1; fi
else else
$ECHO "error: wget or curl required in check_url" $ECHO "error: wget or curl required in check_url"
@ -564,10 +565,10 @@ check_url() {
# Otherwise, just use `master` # Otherwise, just use `master`
set_boot_image_vars() { set_boot_image_vars() {
set_current_branch set_current_branch
url="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/checksums.txt" local url="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/checksums.txt"
check_url $url check_url $url
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
CHECKSUM_URL="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/checksums.txt" CHECKSUM_URL="$url"
BOOT_IMAGE_URL="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/${BOOT_IMAGE}" BOOT_IMAGE_URL="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/${BOOT_IMAGE}"
else else
CHECKSUM_URL="http://downloads.factorcode.org/images/master/checksums.txt" CHECKSUM_URL="http://downloads.factorcode.org/images/master/checksums.txt"
@ -592,9 +593,9 @@ update_boot_image() {
$DELETE temp/staging.*.image > /dev/null 2>&1 $DELETE temp/staging.*.image > /dev/null 2>&1
if [[ -f $BOOT_IMAGE ]] ; then if [[ -f $BOOT_IMAGE ]] ; then
get_url $CHECKSUM_URL get_url $CHECKSUM_URL
factorcode_md5=`cat checksums.txt|grep $BOOT_IMAGE|cut -f2 -d' '` local factorcode_md5=$(cat checksums.txt | grep $BOOT_IMAGE | cut -f2 -d' ')
set_md5sum set_md5sum
disk_md5=`$MD5SUM $BOOT_IMAGE|cut -f1 -d' '` local disk_md5=$($MD5SUM $BOOT_IMAGE | cut -f1 -d' ')
$ECHO "Factorcode md5: $factorcode_md5"; $ECHO "Factorcode md5: $factorcode_md5";
$ECHO "Disk md5: $disk_md5"; $ECHO "Disk md5: $disk_md5";
if [[ "$factorcode_md5" == "$disk_md5" ]] ; then if [[ "$factorcode_md5" == "$disk_md5" ]] ; then
@ -668,12 +669,12 @@ net_bootstrap_no_pull() {
} }
refresh_image() { refresh_image() {
./$FACTOR_BINARY -script -e="USING: vocabs.loader vocabs.refresh system memory ; refresh-all save 0 exit" ./$FACTOR_BINARY -e="USING: vocabs.loader vocabs.refresh system memory ; refresh-all save 0 exit"
check_ret factor check_ret factor
} }
make_boot_image() { make_boot_image() {
./$FACTOR_BINARY -script -e="\"$MAKE_IMAGE_TARGET\" USING: system bootstrap.image memory ; make-image save 0 exit" ./$FACTOR_BINARY -e="\"$MAKE_IMAGE_TARGET\" USING: system bootstrap.image memory ; make-image save 0 exit"
check_ret factor check_ret factor
} }
@ -683,7 +684,7 @@ install_deps_apt() {
} }
install_deps_pacman() { install_deps_pacman() {
sudo pacman --noconfirm -S gcc clang make rlwrap git wget pango glibc gtk2 gtk3 gtkglext gtk-engines gdk-pixbuf2 libx11 screen tmux sudo pacman --noconfirm -Syu gcc clang make rlwrap git wget pango glibc gtk2 gtk3 gtkglext gtk-engines gdk-pixbuf2 libx11 screen tmux
check_ret sudo check_ret sudo
} }

View File

@ -72,7 +72,7 @@ $nl
HELP: free-callback HELP: free-callback
{ $values { "alien" alien } } { $values { "alien" alien } }
{ $description "Releases the callback heap memory allocated for an alien callback. " } { $description "Releases the callback heap memory allocated for an alien callback." }
{ $warning "If the callback is invoked (either from C or Factor) after it has been freed, then Factor may crash." } ; { $warning "If the callback is invoked (either from C or Factor) after it has been freed, then Factor may crash." } ;
HELP: with-callback HELP: with-callback

View File

@ -78,7 +78,7 @@ HELP: changed-definition
{ $description "Adds the definition to the unit's " { $link changed-definitions } "." } ; { $description "Adds the definition to the unit's " { $link changed-definitions } "." } ;
HELP: changed-definitions HELP: changed-definitions
{ $var-description "A set that contains all words and vocabs whose definitions have changed or are new. " } { $var-description "A set that contains all words and vocabs whose definitions have changed or are new." }
{ $see-also changed-definition } ; { $see-also changed-definition } ;
HELP: changed-effects HELP: changed-effects

View File

@ -91,7 +91,7 @@ HELP: ndrop
HELP: nrot HELP: nrot
{ $values { "n" integer } } { $values { "n" integer } }
{ $description "A generalization of " { $link rot } " that works for any " { $description "A generalization of " { $link rot } " that works for any "
"number of items on the stack. " "number of items on the stack."
} }
{ $examples { $examples
{ $example "USING: arrays generalizations kernel prettyprint ;" "1 2 3 4 4 nrot 4array ." "{ 2 3 4 1 }" } { $example "USING: arrays generalizations kernel prettyprint ;" "1 2 3 4 4 nrot 4array ." "{ 2 3 4 1 }" }
@ -105,7 +105,7 @@ HELP: nrot
HELP: -nrot HELP: -nrot
{ $values { "n" integer } } { $values { "n" integer } }
{ $description "A generalization of " { $link -rot } " that works for any " { $description "A generalization of " { $link -rot } " that works for any "
"number of items on the stack. " "number of items on the stack."
} }
{ $examples { $examples
{ $example "USING: arrays generalizations kernel prettyprint ;" "1 2 3 4 4 -nrot 4array ." "{ 4 1 2 3 }" } { $example "USING: arrays generalizations kernel prettyprint ;" "1 2 3 4 4 -nrot 4array ." "{ 4 1 2 3 }" }

View File

@ -117,7 +117,7 @@ $nl
ABOUT: "slots" ABOUT: "slots"
HELP: bad-initial-value HELP: bad-initial-value
{ $error-description "Thrown by " { $link \ \TUPLE: } " if a slot has an impossible initial value. " { $error-description "Thrown by " { $link \ \TUPLE: } " if a slot has an impossible initial value."
{ $examples { $examples
{ $unchecked-example { $unchecked-example
"TUPLE: a { b integer initial: \"invalid\" } ;" "TUPLE: a { b integer initial: \"invalid\" } ;"

View File

@ -15,6 +15,8 @@ ARTICLE: "sequences-split" "Splitting sequences"
split1-last split1-last
split1-last-slice split1-last-slice
split split
split-indices
split-slice
split-when split-when
split-when-slice split-when-slice
} }

View File

@ -56,7 +56,7 @@ HELP: makes-24?
ARTICLE: "24-game" "The Game of 24" ARTICLE: "24-game" "The Game of 24"
"A classic math game, where one attempts to create 24, by applying " "A classic math game, where one attempts to create 24, by applying "
"arithmetical operations and some shuffle words to a stack of 4 numbers. " "arithmetical operations and some shuffle words to a stack of 4 numbers."
{ $subsections { $subsections
24-game 24-game
make-24 make-24

View File

@ -46,7 +46,7 @@ HELP: mesh>sources
HELP: mesh>vertices HELP: mesh>vertices
{ $values { "mesh-tag" tag } { "pair" pair } } { $values { "mesh-tag" tag } { "pair" pair } }
{ $description "Convert the mesh tag's vertices element to a pair for further lookup in " { $link collect-sources } ". " } ; { $description "Convert the mesh tag's vertices element to a pair for further lookup in " { $link collect-sources } "." } ;
HELP: collect-sources HELP: collect-sources
{ $values { "sources" hashtable } { "vertices" pair } { "inputs" tag sequence } { "seq" sequence } } { $values { "sources" hashtable } { "vertices" pair } { "inputs" tag sequence } { "seq" sequence } }

View File

@ -18,7 +18,7 @@ HELP: cm
HELP: md HELP: md
{ $values { "material-dictionary" assoc } } { $values { "material-dictionary" assoc } }
{ $description "Convenience word for accessing the material dictionary while parsing primitives. " } ; { $description "Convenience word for accessing the material dictionary while parsing primitives." } ;
HELP: strings>numbers HELP: strings>numbers
{ $values { "strings" sequence } { "numbers" sequence } } { $values { "strings" sequence } { "numbers" sequence } }

View File

@ -70,7 +70,7 @@ ARTICLE: "irc.client" "IRC Client"
{ $heading "Special messages" } { $heading "Special messages" }
"Some special messages that are created by the library and not by the irc server." "Some special messages that are created by the library and not by the irc server."
{ $table { $table
{ { $link irc-chat-end } "sent to a chat when it has been detached from the client, the chat should stop after it receives this message. " } { { $link irc-chat-end } "sent to a chat when it has been detached from the client, the chat should stop after it receives this message." }
{ { $link irc-end } " sent when the client isn't running anymore, the chat should stop after it receives this message." } { { $link irc-end } " sent when the client isn't running anymore, the chat should stop after it receives this message." }
{ { $link irc-disconnected } " sent to notify chats that connection was lost." } { { $link irc-disconnected } " sent to notify chats that connection was lost." }
{ { $link irc-connected } " sent to notify chats that a connection with the irc server was established." } } { { $link irc-connected } " sent to notify chats that a connection with the irc server was established." } }

View File

@ -299,7 +299,7 @@ $nl
} }
} }
$nl $nl
"The messages marked for deletion are actually deleted only when " { $link close } " is called. This should be the last command you issue. " "The messages marked for deletion are actually deleted only when " { $link close } " is called. This should be the last command you issue."
{ $subsections close } { $subsections close }
{ $examples { $examples
{ $code { $code

View File

@ -43,12 +43,12 @@ M: trit >trit ;
>trit { >trit {
{ t [ >trit ] } { t [ >trit ] }
{ m [ >trit { { t [ m ] } { m [ m ] } { f [ f ] } } case ] } { m [ >trit { { t [ m ] } { m [ m ] } { f [ f ] } } case ] }
{ f [ >trit drop f ] } { f [ drop f ] }
} case ; } case ;
: tor ( trit1 trit2 -- trit ) : tor ( trit1 trit2 -- trit )
>trit { >trit {
{ t [ >trit drop t ] } { t [ drop t ] }
{ m [ >trit { { t [ t ] } { m [ m ] } { f [ m ] } } case ] } { m [ >trit { { t [ t ] } { m [ m ] } { f [ m ] } } case ] }
{ f [ >trit ] } { f [ >trit ] }
} case ; } case ;
@ -56,13 +56,13 @@ M: trit >trit ;
: txor ( trit1 trit2 -- trit ) : txor ( trit1 trit2 -- trit )
>trit { >trit {
{ t [ tnot ] } { t [ tnot ] }
{ m [ >trit drop m ] } { m [ drop m ] }
{ f [ >trit ] } { f [ >trit ] }
} case ; } case ;
: t= ( trit1 trit2 -- trit ) : t= ( trit1 trit2 -- trit )
{ >trit {
{ t [ >trit ] } { t [ >trit ] }
{ m [ >trit drop m ] } { m [ drop m ] }
{ f [ tnot ] } { f [ tnot ] }
} case ; } case ;

View File

@ -8,7 +8,7 @@ IN: succesor
HELP: successor HELP: successor
{ $values { "str" string } { "str'" string } } { $values { "str" string } { "str'" string } }
{ $description { $description
"Returns the successor to " { $snippet "str" } ". The successor is calculated by incrementing characters starting from the rightmost alphanumeric (or the rightmost character if there are no alphanumerics) in the string. Incrementing a digit always results in another digit, and incrementing a letter results in another letter of the same case. " "Returns the successor to " { $snippet "str" } ". The successor is calculated by incrementing characters starting from the rightmost alphanumeric (or the rightmost character if there are no alphanumerics) in the string. Incrementing a digit always results in another digit, and incrementing a letter results in another letter of the same case."
$nl $nl
"If the increment generates a carry, the character to the left of it is incremented. This process repeats until there is no carry, adding an additional character if necessary. " "If the increment generates a carry, the character to the left of it is incremented. This process repeats until there is no carry, adding an additional character if necessary."
} ; } ;