From a274f9943760cd6c72a38ffa59c0ca605f3bc09a Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 12 Aug 2018 21:12:58 -0500 Subject: [PATCH 01/13] io.files.temp: When using temp-file, it's possible that it fails since the temporary-directory does not exist yet. Always check if the directory exists and create it if not. --- basis/io/files/temp/temp.factor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/basis/io/files/temp/temp.factor b/basis/io/files/temp/temp.factor index b1c18725c1..477c1f078d 100644 --- a/basis/io/files/temp/temp.factor +++ b/basis/io/files/temp/temp.factor @@ -12,7 +12,8 @@ SYMBOL: current-temp-directory current-temp-directory get ; : temp-file ( name -- path ) - temp-directory prepend-path ; + temp-directory + [ make-directories ] [ prepend-path ] bi ; : with-temp-directory ( quot -- ) [ temp-directory ] dip with-directory ; inline From 1b95fba17870eb7defe77f5dc83ed6419b367134 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 21 Aug 2018 10:44:10 -0700 Subject: [PATCH 02/13] Revert "io.files.temp: When using temp-file, it's possible that it fails since" This reverts commit a274f9943760cd6c72a38ffa59c0ca605f3bc09a. --- basis/io/files/temp/temp.factor | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/basis/io/files/temp/temp.factor b/basis/io/files/temp/temp.factor index 477c1f078d..b1c18725c1 100644 --- a/basis/io/files/temp/temp.factor +++ b/basis/io/files/temp/temp.factor @@ -12,8 +12,7 @@ SYMBOL: current-temp-directory current-temp-directory get ; : temp-file ( name -- path ) - temp-directory - [ make-directories ] [ prepend-path ] bi ; + temp-directory prepend-path ; : with-temp-directory ( quot -- ) [ temp-directory ] dip with-directory ; inline From f56ed221d70503a765340f97f60e926ffcd903c7 Mon Sep 17 00:00:00 2001 From: Alexander Iljin Date: Mon, 30 Jul 2018 09:13:59 +0200 Subject: [PATCH 03/13] rosetta-code.ternary-logic: remove useless type casts before drops --- extra/rosetta-code/ternary-logic/ternary-logic.factor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/rosetta-code/ternary-logic/ternary-logic.factor b/extra/rosetta-code/ternary-logic/ternary-logic.factor index c1508bb563..23709db46d 100644 --- a/extra/rosetta-code/ternary-logic/ternary-logic.factor +++ b/extra/rosetta-code/ternary-logic/ternary-logic.factor @@ -43,12 +43,12 @@ M: trit >trit ; >trit { { t [ >trit ] } { m [ >trit { { t [ m ] } { m [ m ] } { f [ f ] } } case ] } - { f [ >trit drop f ] } + { f [ drop f ] } } case ; : tor ( trit1 trit2 -- trit ) >trit { - { t [ >trit drop t ] } + { t [ drop t ] } { m [ >trit { { t [ t ] } { m [ m ] } { f [ m ] } } case ] } { f [ >trit ] } } case ; @@ -56,13 +56,13 @@ M: trit >trit ; : txor ( trit1 trit2 -- trit ) >trit { { t [ tnot ] } - { m [ >trit drop m ] } + { m [ drop m ] } { f [ >trit ] } } case ; : t= ( trit1 trit2 -- trit ) { { t [ >trit ] } - { m [ >trit drop m ] } + { m [ drop m ] } { f [ tnot ] } } case ; From 6b23c7c6d6381b3adbe2bbb2ef3dd35984fda71c Mon Sep 17 00:00:00 2001 From: Alexander Iljin Date: Mon, 30 Jul 2018 09:14:32 +0200 Subject: [PATCH 04/13] rosetta-code.ternary-logic: add a missing type cast to t= --- extra/rosetta-code/ternary-logic/ternary-logic.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/rosetta-code/ternary-logic/ternary-logic.factor b/extra/rosetta-code/ternary-logic/ternary-logic.factor index 23709db46d..64fc3cbb5f 100644 --- a/extra/rosetta-code/ternary-logic/ternary-logic.factor +++ b/extra/rosetta-code/ternary-logic/ternary-logic.factor @@ -61,7 +61,7 @@ M: trit >trit ; } case ; : t= ( trit1 trit2 -- trit ) - { + >trit { { t [ >trit ] } { m [ drop m ] } { f [ tnot ] } From 0637557cca90dc295ca5478d14cb0eb3c1866a02 Mon Sep 17 00:00:00 2001 From: Alexander Iljin Date: Wed, 18 Jul 2018 20:54:21 +0700 Subject: [PATCH 05/13] *-docs: remove extra space character at the end of paragraghs --- basis/bitstreams/bitstreams-docs.factor | 2 +- basis/compiler/cfg/builder/builder-docs.factor | 2 +- basis/compiler/cfg/cfg-docs.factor | 2 +- basis/compiler/cfg/intrinsics/alien/alien-docs.factor | 2 +- basis/compiler/tree/tree-docs.factor | 2 +- basis/compression/lzw/lzw-docs.factor | 2 +- basis/cpu/x86/x86-docs.factor | 2 +- basis/db/tuples/tuples-docs.factor | 2 +- basis/furnace/auth/providers/providers-docs.factor | 2 +- basis/generalizations/generalizations-docs.factor | 4 ++-- basis/match/match-docs.factor | 2 +- basis/peg/ebnf/ebnf-docs.factor | 8 ++++---- basis/prettyprint/sections/sections-docs.factor | 2 +- basis/ui/gadgets/editors/editors-docs.factor | 2 +- basis/ui/ui-docs.factor | 2 +- core/alien/alien-docs.factor | 2 +- core/definitions/definitions-docs.factor | 2 +- core/slots/slots-docs.factor | 2 +- extra/24-game/24-game-docs.factor | 2 +- extra/game/models/collada/collada-docs.factor | 2 +- extra/game/models/obj/obj-docs.factor | 2 +- extra/irc/client/client-docs.factor | 2 +- extra/pop3/pop3-docs.factor | 2 +- extra/successor/successor-docs.factor | 4 ++-- 24 files changed, 29 insertions(+), 29 deletions(-) diff --git a/basis/bitstreams/bitstreams-docs.factor b/basis/bitstreams/bitstreams-docs.factor index 7be5514275..cc69a7a501 100644 --- a/basis/bitstreams/bitstreams-docs.factor +++ b/basis/bitstreams/bitstreams-docs.factor @@ -25,7 +25,7 @@ HELP: seek HELP: align { $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? { $values { "n" integer } { "bs" bit-reader } { "?" boolean } } diff --git a/basis/compiler/cfg/builder/builder-docs.factor b/basis/compiler/cfg/builder/builder-docs.factor index 308c3e4ff0..543a87f3cc 100644 --- a/basis/compiler/cfg/builder/builder-docs.factor +++ b/basis/compiler/cfg/builder/builder-docs.factor @@ -78,7 +78,7 @@ HELP: emit-loop-call HELP: emit-node { $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 "The following classes emit-node methods does not change the current block:" { $list diff --git a/basis/compiler/cfg/cfg-docs.factor b/basis/compiler/cfg/cfg-docs.factor index 205faec446..eeb2916277 100644 --- a/basis/compiler/cfg/cfg-docs.factor +++ b/basis/compiler/cfg/cfg-docs.factor @@ -10,7 +10,7 @@ HELP: basic-block { $table { { $slot "number" } - { "The blocks sequence number. Generated by calling " { $link number-blocks } ". " } + { "The blocks sequence number. Generated by calling " { $link number-blocks } "." } } { { $slot "successors" } diff --git a/basis/compiler/cfg/intrinsics/alien/alien-docs.factor b/basis/compiler/cfg/intrinsics/alien/alien-docs.factor index 72dd90da53..ed65434996 100644 --- a/basis/compiler/cfg/intrinsics/alien/alien-docs.factor +++ b/basis/compiler/cfg/intrinsics/alien/alien-docs.factor @@ -9,4 +9,4 @@ HELP: inline-accessor { "test" quotation } { "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." } ; diff --git a/basis/compiler/tree/tree-docs.factor b/basis/compiler/tree/tree-docs.factor index fcaf8b9352..eaf309010e 100644 --- a/basis/compiler/tree/tree-docs.factor +++ b/basis/compiler/tree/tree-docs.factor @@ -14,7 +14,7 @@ HELP: #alien-invoke { $see-also alien-invoke } ; 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 { $class-description "SSA tree node that calls a word. It has the following slots:" diff --git a/basis/compression/lzw/lzw-docs.factor b/basis/compression/lzw/lzw-docs.factor index 55c54bc9f7..4456365938 100644 --- a/basis/compression/lzw/lzw-docs.factor +++ b/basis/compression/lzw/lzw-docs.factor @@ -48,7 +48,7 @@ HELP: reset-lzw-uncompress { $values { "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" { $vocab-link "compression.lzw" } diff --git a/basis/cpu/x86/x86-docs.factor b/basis/cpu/x86/x86-docs.factor index 205e2a9124..3cfa366c79 100644 --- a/basis/cpu/x86/x86-docs.factor +++ b/basis/cpu/x86/x86-docs.factor @@ -14,7 +14,7 @@ HELP: %boolean HELP: %prepare-var-args { $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 { $values { "dst" "destination offset (relative to the instruction pointer register)" } } diff --git a/basis/db/tuples/tuples-docs.factor b/basis/db/tuples/tuples-docs.factor index 254e7fc282..fecfdff3ee 100644 --- a/basis/db/tuples/tuples-docs.factor +++ b/basis/db/tuples/tuples-docs.factor @@ -232,7 +232,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 "We're going to store books in this tutorial." { $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 } "." { $code "USING: db.tuples db.types ; diff --git a/basis/furnace/auth/providers/providers-docs.factor b/basis/furnace/auth/providers/providers-docs.factor index f541885e4d..44cc9c44b4 100644 --- a/basis/furnace/auth/providers/providers-docs.factor +++ b/basis/furnace/auth/providers/providers-docs.factor @@ -30,7 +30,7 @@ HELP: new-user HELP: update-user { $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" "The " { $vocab-link "furnace.auth.providers" } " vocabulary implements a protocol for persistence and authentication of users." diff --git a/basis/generalizations/generalizations-docs.factor b/basis/generalizations/generalizations-docs.factor index f4a15411f9..f750f5f494 100644 --- a/basis/generalizations/generalizations-docs.factor +++ b/basis/generalizations/generalizations-docs.factor @@ -91,7 +91,7 @@ HELP: ndrop HELP: nrot { $values { "n" integer } } { $description "A generalization of " { $link rot } " that works for any " -"number of items on the stack. " +"number of items on the stack." } { $examples { $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 { $values { "n" integer } } { $description "A generalization of " { $link -rot } " that works for any " -"number of items on the stack. " +"number of items on the stack." } { $examples { $example "USING: arrays generalizations kernel prettyprint ;" "1 2 3 4 4 -nrot 4array ." "{ 4 1 2 3 }" } diff --git a/basis/match/match-docs.factor b/basis/match/match-docs.factor index 6110c037b8..11d89a9811 100644 --- a/basis/match/match-docs.factor +++ b/basis/match/match-docs.factor @@ -7,7 +7,7 @@ IN: match HELP: match { $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 { $unchecked-example "USE: match" "MATCH-VARS: ?a ?b ;\n{ ?a { 2 ?b } 5 } { 1 { 2 3 } _ } match ." "H{ { ?a 1 } { ?b 3 } }" } } diff --git a/basis/peg/ebnf/ebnf-docs.factor b/basis/peg/ebnf/ebnf-docs.factor index 6d2e3b52fc..1ec977ce51 100644 --- a/basis/peg/ebnf/ebnf-docs.factor +++ b/basis/peg/ebnf/ebnf-docs.factor @@ -346,7 +346,7 @@ ARTICLE: "peg.ebnf.foreign-rules" "EBNF Foreign Rules" ARTICLE: "peg.ebnf.tokenizers" "EBNF Tokenizers" "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. " -"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 { $code "USING: multiline ;" @@ -392,7 +392,7 @@ ARTICLE: "peg.ebnf.tokenizers" "EBNF Tokenizers" "instead of the string \"++--\". With the new tokenizer \"....\" sequences " "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 " -"to match an AST from a tokenizer. " +"to match an AST from a tokenizer." $nl "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 " @@ -463,7 +463,7 @@ $nl "This tokenizer strips out whitespace and newlines. Some rules in the grammar " "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 " -"be optional in places. " +"be optional in places." { $examples { $code "\"do\" Stmt:s \"while\" \"(\" Expr:c \")\" Sc => [[ s c ast-do-while boa ]]" @@ -477,7 +477,7 @@ $nl ARTICLE: "peg.ebnf" "EBNF" "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 " -"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 POSTPONE: EBNF: POSTPONE: EBNF[[ diff --git a/basis/prettyprint/sections/sections-docs.factor b/basis/prettyprint/sections/sections-docs.factor index 54384d9dda..f6b51216e0 100644 --- a/basis/prettyprint/sections/sections-docs.factor +++ b/basis/prettyprint/sections/sections-docs.factor @@ -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." } ; HELP: HELP: { $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 diff --git a/basis/ui/ui-docs.factor b/basis/ui/ui-docs.factor index 148e1e0a32..477d490c28 100644 --- a/basis/ui/ui-docs.factor +++ b/basis/ui/ui-docs.factor @@ -259,7 +259,7 @@ $nl clear-gadget } "The children of a gadget are available via the " -{ $snippet "children" } " slot. " +{ $snippet "children" } " slot." $nl "Working with gadget children:" { $subsections diff --git a/core/alien/alien-docs.factor b/core/alien/alien-docs.factor index 16a38fac40..545fe0b9f1 100644 --- a/core/alien/alien-docs.factor +++ b/core/alien/alien-docs.factor @@ -72,7 +72,7 @@ $nl HELP: free-callback { $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." } ; HELP: with-callback diff --git a/core/definitions/definitions-docs.factor b/core/definitions/definitions-docs.factor index df02b8e485..43177fb617 100644 --- a/core/definitions/definitions-docs.factor +++ b/core/definitions/definitions-docs.factor @@ -78,7 +78,7 @@ HELP: changed-definition { $description "Adds the definition to the unit's " { $link 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 } ; HELP: changed-effects diff --git a/core/slots/slots-docs.factor b/core/slots/slots-docs.factor index 1eb0d61b8a..19bb68a545 100644 --- a/core/slots/slots-docs.factor +++ b/core/slots/slots-docs.factor @@ -117,7 +117,7 @@ $nl ABOUT: "slots" HELP: bad-initial-value -{ $error-description "Thrown by " { $link POSTPONE: TUPLE: } " if a slot has an impossible initial value. " +{ $error-description "Thrown by " { $link POSTPONE: TUPLE: } " if a slot has an impossible initial value." { $examples { $unchecked-example "TUPLE: a { b integer initial: \"invalid\" } ;" diff --git a/extra/24-game/24-game-docs.factor b/extra/24-game/24-game-docs.factor index 280d74dff9..c338a5ca0f 100644 --- a/extra/24-game/24-game-docs.factor +++ b/extra/24-game/24-game-docs.factor @@ -56,7 +56,7 @@ HELP: makes-24? ARTICLE: "24-game" "The Game of 24" "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 24-game make-24 diff --git a/extra/game/models/collada/collada-docs.factor b/extra/game/models/collada/collada-docs.factor index 0936d864ab..e2dc4db8aa 100644 --- a/extra/game/models/collada/collada-docs.factor +++ b/extra/game/models/collada/collada-docs.factor @@ -46,7 +46,7 @@ HELP: mesh>sources HELP: mesh>vertices { $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 { $values { "sources" hashtable } { "vertices" pair } { "inputs" tag sequence } { "seq" sequence } } diff --git a/extra/game/models/obj/obj-docs.factor b/extra/game/models/obj/obj-docs.factor index 033b163941..c2b419d22a 100644 --- a/extra/game/models/obj/obj-docs.factor +++ b/extra/game/models/obj/obj-docs.factor @@ -18,7 +18,7 @@ HELP: cm HELP: md { $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 { $values { "strings" sequence } { "numbers" sequence } } diff --git a/extra/irc/client/client-docs.factor b/extra/irc/client/client-docs.factor index 3103ed4323..6a05cb38bf 100644 --- a/extra/irc/client/client-docs.factor +++ b/extra/irc/client/client-docs.factor @@ -70,7 +70,7 @@ ARTICLE: "irc.client" "IRC Client" { $heading "Special messages" } "Some special messages that are created by the library and not by the irc server." { $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-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." } } diff --git a/extra/pop3/pop3-docs.factor b/extra/pop3/pop3-docs.factor index 61ee4c76be..4faac9a3c2 100644 --- a/extra/pop3/pop3-docs.factor +++ b/extra/pop3/pop3-docs.factor @@ -299,7 +299,7 @@ $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 } { $examples { $code diff --git a/extra/successor/successor-docs.factor b/extra/successor/successor-docs.factor index 025ff47f38..b3b032d8b2 100644 --- a/extra/successor/successor-docs.factor +++ b/extra/successor/successor-docs.factor @@ -8,9 +8,9 @@ IN: succesor HELP: successor { $values { "str" string } { "str'" string } } { $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 - "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." } ; From f11e5da90fdf58b04ca4ed6b9f0a68b6ec4db41c Mon Sep 17 00:00:00 2001 From: Alexander Iljin Date: Sun, 5 Aug 2018 20:24:13 +0200 Subject: [PATCH 06/13] splitting-docs: mention two existing words in documentation --- core/splitting/splitting-docs.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/splitting/splitting-docs.factor b/core/splitting/splitting-docs.factor index 599bdbb5f7..d69338c5ee 100644 --- a/core/splitting/splitting-docs.factor +++ b/core/splitting/splitting-docs.factor @@ -15,6 +15,8 @@ ARTICLE: "sequences-split" "Splitting sequences" split1-last split1-last-slice split + split-indices + split-slice split-when split-when-slice } From d8e7e8606ffe9dfb58643b214f185e58ca623f48 Mon Sep 17 00:00:00 2001 From: Cat Stevens Date: Thu, 16 Aug 2018 20:26:16 -0400 Subject: [PATCH 07/13] build.sh: correctness / safety and fixups --- build.sh | 71 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/build.sh b/build.sh index bfe47359da..166a6d8d53 100755 --- a/build.sh +++ b/build.sh @@ -15,9 +15,11 @@ GIT_PROTOCOL=${GIT_PROTOCOL:="git"} GIT_URL=${GIT_URL:=$GIT_PROTOCOL"://factorcode.org/git/factor.git"} SCRIPT_ARGS="$*" +REQUIRE_CLANG_VERSION=3.1 + # return 1 on found test_program_installed() { - if ! [[ -n `type -p $1` ]] ; then + if ! [[ -n $(type -p $1) ]] ; then return 0; fi return 1; @@ -27,7 +29,7 @@ test_program_installed() { test_programs_installed() { installed=0; $ECHO -n "Checking for all($*)..." - for i in $* ; + for i in "$@" ; do test_program_installed $i if [[ $? -eq 1 ]]; then @@ -54,7 +56,7 @@ exit_script() { ensure_program_installed() { installed=0; $ECHO -n "Checking for any($*)..." - for i in $* ; + for i in "$@" ; do test_program_installed $i if [[ $? -eq 1 ]]; then @@ -133,16 +135,16 @@ semver_into() { } 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 if [[ $CLANG_VERSION =~ $CLANG_VERSION_RE ]] ; then 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 if [[ $CLANG_MAJOR -lt 3 || ( $CLANG_MAJOR -eq 3 && $CLANG_MINOR -le 1 ) ]] ; then - echo "clang version required >= 3.1, got $CLANG_VERSION" + echo "clang version required >= $REQUIRE_CLANG_VERSION, got $CLANG_VERSION" return 1 fi else @@ -241,7 +243,7 @@ check_factor_exists() { find_os() { if [[ -n $OS ]] ; then return; fi $ECHO "Finding OS..." - uname_s=`uname -s` + uname_s=$(uname -s) check_ret uname case $uname_s in CYGWIN_NT-5.2-WOW64) OS=windows;; @@ -258,7 +260,7 @@ find_os() { find_architecture() { if [[ -n $ARCH ]] ; then return; fi $ECHO "Finding ARCH..." - uname_m=`uname -m` + uname_m=$(uname -m) check_ret uname case $uname_m in i386) ARCH=x86;; @@ -275,7 +277,7 @@ find_architecture() { find_num_cores() { $ECHO "Finding num cores..." NUM_CORES=7ZZ - uname_s=`uname -s` + uname_s=$(uname -s) check_ret uname case $uname_s in CYGWIN_NT-5.2-WOW64 | *CYGWIN_NT* | *CYGWIN* | MINGW32*) NUM_CORES=$NUMBER_OF_PROCESSORS;; @@ -283,20 +285,19 @@ find_num_cores() { esac } -write_test_program() { +echo_test_program() { #! Must be 'echo' - echo "#include " > $C_WORD.c - echo "int main(){printf(\"%ld\", (long)(8*sizeof(void*))); return 0; }" >> $C_WORD.c + echo -e "int main(){ return (long)(8*sizeof(void*)); }" } c_find_word_size() { $ECHO "Finding WORD..." - C_WORD=factor-word-size - write_test_program - $CC -o $C_WORD $C_WORD.c - WORD=$(./$C_WORD) - check_ret $C_WORD - $DELETE -f $C_WORD* + C_WORD="factor-word-size" + echo_test_program | $CC -o $C_WORD -xc - + check_ret $CC + ./$C_WORD + WORD=$? + $DELETE -f $C_WORD } intel_macosx_word_size() { @@ -403,9 +404,9 @@ set_build_info() { 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` + 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 @@ -433,7 +434,7 @@ find_build_info() { } invoke_git() { - git $* + git "$@" check_ret git } @@ -443,12 +444,12 @@ git_clone() { } update_script_name() { - $ECHO `dirname $0`/_update.sh + $ECHO "$(dirname $0)/_update.sh" } update_script() { - update_script=`update_script_name` - bash_path=`which bash` + local -r update_script=$(update_script_name) + local -r bash_path=$(which bash) $ECHO "#!$bash_path" >"$update_script" $ECHO "git pull \"$GIT_URL\" master" >>"$update_script" $ECHO "if [[ \$? -eq 0 ]]; then exec \"$0\" $SCRIPT_ARGS; else echo \"git pull failed\"; exit 2; fi" \ @@ -460,13 +461,13 @@ update_script() { } 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() { $ECHO "Fetching the git repository from factorcode.org..." - rm -f `update_script_name` + rm -f "$(update_script_name)" invoke_git fetch "$GIT_URL" master if update_script_changed; then @@ -479,7 +480,7 @@ git_fetch_factorcode() { } cd_factor() { - cd factor + cd "factor" check_ret cd } @@ -519,7 +520,7 @@ check_makefile_exists() { invoke_make() { check_makefile_exists - $MAKE $MAKE_OPTS $* + $MAKE $MAKE_OPTS "$@" check_ret $MAKE } @@ -543,13 +544,13 @@ current_git_branch() { check_url() { 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 else return 1 fi elif [[ $DOWNLOADER_NAME == 'curl' ]]; then - code=`curl -sL -w "%{http_code}\\n" "$1" -o /dev/null` + code=$(curl -sL -w "%{http_code}\\n" "$1" -o /dev/null) if [[ $code -eq 200 ]]; then return 0; else return 1; fi else $ECHO "error: wget or curl required in check_url" @@ -589,9 +590,9 @@ update_boot_image() { $DELETE temp/staging.*.image > /dev/null 2>&1 if [[ -f $BOOT_IMAGE ]] ; then get_url $CHECKSUM_URL - factorcode_md5=`cat checksums.txt|grep $BOOT_IMAGE|cut -f2 -d' '` + factorcode_md5=$(cat checksums.txt | grep $BOOT_IMAGE | cut -f2 -d' ') set_md5sum - disk_md5=`$MD5SUM $BOOT_IMAGE|cut -f1 -d' '` + disk_md5=$($MD5SUM $BOOT_IMAGE | cut -f1 -d' ') $ECHO "Factorcode md5: $factorcode_md5"; $ECHO "Disk md5: $disk_md5"; if [[ "$factorcode_md5" == "$disk_md5" ]] ; then @@ -665,12 +666,12 @@ net_bootstrap_no_pull() { } 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 } 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 } From 3559e47957f6a743863e90fd70c70245dbf5767f Mon Sep 17 00:00:00 2001 From: Cat Stevens Date: Fri, 17 Aug 2018 19:56:31 -0400 Subject: [PATCH 08/13] build.sh: more variables are local --- build.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 166a6d8d53..b48cec41d0 100755 --- a/build.sh +++ b/build.sh @@ -27,7 +27,7 @@ test_program_installed() { # return 1 on found test_programs_installed() { - installed=0; + local installed=0; $ECHO -n "Checking for all($*)..." for i in "$@" ; do @@ -54,7 +54,7 @@ exit_script() { } ensure_program_installed() { - installed=0; + local installed=0; $ECHO -n "Checking for any($*)..." for i in "$@" ; do @@ -243,7 +243,7 @@ check_factor_exists() { find_os() { if [[ -n $OS ]] ; then return; fi $ECHO "Finding OS..." - uname_s=$(uname -s) + local uname_s=$(uname -s) check_ret uname case $uname_s in CYGWIN_NT-5.2-WOW64) OS=windows;; @@ -550,7 +550,7 @@ check_url() { return 1 fi 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 else $ECHO "error: wget or curl required in check_url" @@ -562,10 +562,10 @@ check_url() { # Otherwise, just use `master` set_boot_image_vars() { 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 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}" else CHECKSUM_URL="http://downloads.factorcode.org/images/master/checksums.txt" From 60785ef0fcc7328f88a45d7f2e3eb982033a135b Mon Sep 17 00:00:00 2001 From: Cat Stevens Date: Sat, 18 Aug 2018 11:24:14 -0400 Subject: [PATCH 09/13] build.sh: pacman: never use -S without -yu syncing https://wiki.archlinux.org/index.php/Pacman#Usage --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index b48cec41d0..4b47ca940f 100755 --- a/build.sh +++ b/build.sh @@ -681,7 +681,7 @@ install_deps_apt() { } 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 } From 3214332510f833b7d1f7a58fd3db7e4ab628b9f5 Mon Sep 17 00:00:00 2001 From: Cat Stevens Date: Sun, 19 Aug 2018 07:30:03 -0400 Subject: [PATCH 10/13] build.sh: final two local vars --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 4b47ca940f..b4854cc2c9 100755 --- a/build.sh +++ b/build.sh @@ -590,9 +590,9 @@ update_boot_image() { $DELETE temp/staging.*.image > /dev/null 2>&1 if [[ -f $BOOT_IMAGE ]] ; then 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 - disk_md5=$($MD5SUM $BOOT_IMAGE | cut -f1 -d' ') + local disk_md5=$($MD5SUM $BOOT_IMAGE | cut -f1 -d' ') $ECHO "Factorcode md5: $factorcode_md5"; $ECHO "Disk md5: $disk_md5"; if [[ "$factorcode_md5" == "$disk_md5" ]] ; then From 91e55dc02ac25e2b7f05ec7ed5c709947c1254e8 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 21 Aug 2018 13:12:28 -0700 Subject: [PATCH 11/13] Revert "alien.data: Make with-scoped-allocation an $unchecked-example because it's breaking travisci" This reverts commit 739fb5d94f827fbc2377faf08173ba5f43aa3d00. --- basis/alien/data/data-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/alien/data/data-docs.factor b/basis/alien/data/data-docs.factor index 736636baf8..8d947d127d 100644 --- a/basis/alien/data/data-docs.factor +++ b/basis/alien/data/data-docs.factor @@ -74,7 +74,7 @@ $nl "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." } { $examples - { $unchecked-example + { $example "USING: accessors alien.c-types alien.data classes.struct kernel math math.functions prettyprint ; From a27f560475301a0287e97d4ba2cbabb248cf2be7 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 23 Aug 2018 20:32:01 -0700 Subject: [PATCH 12/13] timers: fix issue with restart-timer after timer went off. --- basis/timers/timers-tests.factor | 9 +++++++++ basis/timers/timers.factor | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/basis/timers/timers-tests.factor b/basis/timers/timers-tests.factor index 35f8483dcf..5abb0023e0 100644 --- a/basis/timers/timers-tests.factor +++ b/basis/timers/timers-tests.factor @@ -64,3 +64,12 @@ threads tools.test tools.time ; 700 milliseconds sleep dup restart-timer 700 milliseconds sleep stop-timer 500 milliseconds sleep ] unit-test + +{ { 2 } } [ + { 0 } + dup '[ 0 _ [ 1 + ] change-nth ] 300 milliseconds f + dup restart-timer + 700 milliseconds sleep + dup restart-timer drop + 700 milliseconds sleep +] unit-test diff --git a/basis/timers/timers.factor b/basis/timers/timers.factor index cbe9870573..925fc246a7 100644 --- a/basis/timers/timers.factor +++ b/basis/timers/timers.factor @@ -94,11 +94,10 @@ PRIVATE> ] if ; : restart-timer ( timer -- ) - t >>restart? dup quotation-running?>> [ - drop + t >>restart? drop ] [ - dup thread>> [ nip interrupt ] [ start-timer ] if* + dup thread>> [ interrupt ] when* start-timer ] if ; Date: Thu, 23 Aug 2018 20:37:20 -0700 Subject: [PATCH 13/13] timers: simplify stop-timer. --- basis/timers/timers.factor | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/basis/timers/timers.factor b/basis/timers/timers.factor index 925fc246a7..029f640616 100644 --- a/basis/timers/timers.factor +++ b/basis/timers/timers.factor @@ -88,10 +88,8 @@ PRIVATE> : stop-timer ( timer -- ) dup quotation-running?>> [ - f >>thread drop - ] [ - [ [ interrupt ] when* f ] change-thread drop - ] if ; + dup thread>> [ interrupt ] when* + ] unless f >>thread drop ; : restart-timer ( timer -- ) dup quotation-running?>> [