From 06ee9705a86fe99cfa9a66e8cbd2e5846aec4a2e Mon Sep 17 00:00:00 2001 From: crc Date: Fri, 4 Jun 2021 13:54:21 +0000 Subject: [PATCH] image: rename some words s:contains-char? to s:contains/char? s:contains-string? to s:contains/string? a:contains-string? to a:contains/string? old names are now deprecated and will be removed after 2021.7. FossilOrigin-Name: 5a19d7aac514c5ba87963c5f0645f3daa8a8e3dc04546c0627fa046479ecd8dd --- RELEASE-NOTES | 6 ++++ doc/Glossary-Concise.txt | 11 +++++++- doc/Glossary-Names-and-Stack.txt | 3 ++ doc/Glossary.html | 23 +++++++++++++++- doc/Glossary.txt | 35 +++++++++++++++++++++++- doc/words.tsv | 9 ++++-- example/7080.retro | 4 +-- example/Casket-HTTP.retro | 2 +- example/advent-of-code-2020-day-4.retro | 18 ++++++------ example/atua-gophermap.retro | 2 +- example/display-names.retro | 2 +- example/enum.retro | 2 +- example/file.retro | 3 +- example/irc-bot.retro | 2 +- example/muri-with-hex.retro | 2 +- example/namespaces.retro | 4 +-- example/retro-edit.retro | 4 +-- example/retro-stats.retro | 4 +-- image/retro.forth | 16 +++++------ ngaImage | Bin 38784 -> 38784 bytes package/dict-words-listing.forth | 12 ++++---- package/extensions/deprecated.retro | 3 ++ tools/glossary.retro | 2 +- vm/nga-c/image.c | 18 +++++++----- 24 files changed, 134 insertions(+), 53 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e7da875..e05866b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -25,11 +25,17 @@ - `s:split/string` replaces `s:split-on-string` - `s:split/char` replaces `s:split` +- `s:contains/char?` replaces `s:contains-char?` +- `s:contains/string?` replaces `s:contains-string?` +- `a:contains/string?` replaces `a:contains-string?` ## Deprecated - `s:split-on-string` - `s:split` +- `s:contains-char?` +- `s:contains-string?` +- `a:contains-string?` ## Hooks diff --git a/doc/Glossary-Concise.txt b/doc/Glossary-Concise.txt index 652409b..79ebdfc 100644 --- a/doc/Glossary-Concise.txt +++ b/doc/Glossary-Concise.txt @@ -233,6 +233,9 @@ a:chop D: a-a A: - F: - Return a new array containing all but the last value in the source array. a:contains-string? D: sa-f A: - F: - +Deprecated. Use `a:contains/string?` instead. Return `TRUE` if the string value is in the array or `FALSE` otherwise. + +a:contains/string? D: sa-f A: - F: - Return `TRUE` if the string value is in the array or `FALSE` otherwise. a:contains? D: na-f A: - F: - @@ -1157,9 +1160,15 @@ s:const D: ss- A: - F: - Create a constant named s2, returning a pointer to s1. This will use `s:keep` to preserve the original string. s:contains-char? D: sc-f A: - F: - -Return `TRUE` if the character is present in the string or `FALSE` otherwise. +Deprecated. Use `s:contains/char?` instead. Return `TRUE` if the character is present in the string or `FALSE` otherwise. s:contains-string? D: ss-f A: - F: - +Deprecated. Use `s:contains/string?` instead. Return `TRUE` if the second string is present in the first string or `FALSE` otherwise. + +s:contains/char? D: sc-f A: - F: - +Return `TRUE` if the character is present in the string or `FALSE` otherwise. + +s:contains/string? D: ss-f A: - F: - Return `TRUE` if the second string is present in the first string or `FALSE` otherwise. s:copy D: sa- A: - F: - diff --git a/doc/Glossary-Names-and-Stack.txt b/doc/Glossary-Names-and-Stack.txt index 45456a4..72cbc2c 100644 --- a/doc/Glossary-Names-and-Stack.txt +++ b/doc/Glossary-Names-and-Stack.txt @@ -77,6 +77,7 @@ a:append D: aa-a A: - F: - a:begins-with? D: aa-f A: - F: - a:chop D: a-a A: - F: - a:contains-string? D: sa-f A: - F: - +a:contains/string? D: sa-f A: - F: - a:contains? D: na-f A: - F: - a:copy D: aa- A: - F: - a:counted-results D: q-a A: - F: - @@ -386,6 +387,8 @@ s:chop D: s-s A: - F: - s:const D: ss- A: - F: - s:contains-char? D: sc-f A: - F: - s:contains-string? D: ss-f A: - F: - +s:contains/char? D: sc-f A: - F: - +s:contains/string? D: ss-f A: - F: - s:copy D: sa- A: - F: - s:empty D: -s A: - F: - s:ends-with? D: ss-f A: - F: - diff --git a/doc/Glossary.html b/doc/Glossary.html index a487796..f8f98ca 100644 --- a/doc/Glossary.html +++ b/doc/Glossary.html @@ -576,6 +576,13 @@ Addr: -
Float: -

+

Deprecated. Use `a:contains/string?` instead. Return `TRUE` if the string value is in the array or `FALSE` otherwise.

+
Class: class:word
Namespace: a
Interface Layer: all

+

a:contains/string?

+

Data: sa-f
+Addr: -
+Float: -

+

Return `TRUE` if the string value is in the array or `FALSE` otherwise.

Class: class:word
Namespace: a
Interface Layer: all

a:contains?

@@ -2912,13 +2919,27 @@ Addr: -
Float: -

-

Return `TRUE` if the character is present in the string or `FALSE` otherwise.

+

Deprecated. Use `s:contains/char?` instead. Return `TRUE` if the character is present in the string or `FALSE` otherwise.

Class: class:word
Namespace: s
Interface Layer: all

s:contains-string?

Data: ss-f
Addr: -
Float: -

+

Deprecated. Use `s:contains/string?` instead. Return `TRUE` if the second string is present in the first string or `FALSE` otherwise.

+
Class: class:word
Namespace: s
Interface Layer: all

+

s:contains/char?

+

Data: sc-f
+Addr: -
+Float: -

+
+

Return `TRUE` if the character is present in the string or `FALSE` otherwise.

+
Class: class:word
Namespace: s
Interface Layer: all

+

s:contains/string?

+

Data: ss-f
+Addr: -
+Float: -

+

Return `TRUE` if the second string is present in the first string or `FALSE` otherwise.

Class: class:word
Namespace: s
Interface Layer: all

s:copy

diff --git a/doc/Glossary.txt b/doc/Glossary.txt index 452bb30..ec9cf23 100644 --- a/doc/Glossary.txt +++ b/doc/Glossary.txt @@ -895,6 +895,17 @@ a:contains-string? Addr: - Float: - +Deprecated. Use `a:contains/string?` instead. Return `TRUE` if the string value is in the array or `FALSE` otherwise. + +Class: class:word | Namespace: a | Interface Layer: all +------------------------------------------------------------------------ + +a:contains/string? + + Data: sa-f + Addr: - + Float: - + Return `TRUE` if the string value is in the array or `FALSE` otherwise. Class: class:word | Namespace: a | Interface Layer: all @@ -4498,7 +4509,7 @@ s:contains-char? Addr: - Float: - -Return `TRUE` if the character is present in the string or `FALSE` otherwise. +Deprecated. Use `s:contains/char?` instead. Return `TRUE` if the character is present in the string or `FALSE` otherwise. Class: class:word | Namespace: s | Interface Layer: all ------------------------------------------------------------------------ @@ -4509,6 +4520,28 @@ s:contains-string? Addr: - Float: - +Deprecated. Use `s:contains/string?` instead. Return `TRUE` if the second string is present in the first string or `FALSE` otherwise. + +Class: class:word | Namespace: s | Interface Layer: all +------------------------------------------------------------------------ + +s:contains/char? + + Data: sc-f + Addr: - + Float: - + +Return `TRUE` if the character is present in the string or `FALSE` otherwise. + +Class: class:word | Namespace: s | Interface Layer: all +------------------------------------------------------------------------ + +s:contains/string? + + Data: ss-f + Addr: - + Float: - + Return `TRUE` if the second string is present in the first string or `FALSE` otherwise. Class: class:word | Namespace: s | Interface Layer: all diff --git a/doc/words.tsv b/doc/words.tsv index 5c484a0..516cbae 100644 --- a/doc/words.tsv +++ b/doc/words.tsv @@ -76,7 +76,8 @@ a:-eq? aa-f - - Compare all values in the array. Return `FALSE` if all values ar a:append aa-a - - Return a new array consisting of the values in a1 followed by the values in a2. class:word {n/a} {n/a} a all a:begins-with? aa-f - - Return `TRUE` if a1 begins with a2 or `FALSE` otherwise. class:word {n/a} {n/a} a all a:chop a-a - - Return a new array containing all but the last value in the source array. class:word {n/a} {n/a} a all -a:contains-string? sa-f - - Return `TRUE` if the string value is in the array or `FALSE` otherwise. class:word {n/a} {n/a} a all +a:contains-string? sa-f - - Deprecated. Use `a:contains/string?` instead. Return `TRUE` if the string value is in the array or `FALSE` otherwise. class:word {n/a} {n/a} a all +a:contains/string? sa-f - - Return `TRUE` if the string value is in the array or `FALSE` otherwise. class:word {n/a} {n/a} a all a:contains? na-f - - Return `TRUE` if the value is in the array or `FALSE` otherwise. class:word {n/a} {n/a} a all a:copy aa- - - Copy an array (a1) to a destination (a2). class:word {n/a} {n/a} a all a:counted-results q-a - - Run a quote and construct a new array from the returned values. The quote should return the values and the number of values to put into the array. class:word {n/a} {n/a} a all @@ -384,8 +385,10 @@ s:begins-with? ss-f - - Return `TRUE` if s1 begins with s2 or `FALSE` otherwise. s:case sSq- || sSq-s - - If the `s` matches `S`, discard `s` and run the quote before exiting the caller. If they do not match, discard the quote and leave `s` on the stack. class:word {n/a} {n/a} s all s:chop s-s - - Remove the last character from a string. Returns a new string. class:word {n/a} {n/a} s all s:const ss- - - Create a constant named s2, returning a pointer to s1. This will use `s:keep` to preserve the original string. class:word {n/a} {n/a} s all -s:contains-char? sc-f - - Return `TRUE` if the character is present in the string or `FALSE` otherwise. class:word {n/a} {n/a} s all -s:contains-string? ss-f - - Return `TRUE` if the second string is present in the first string or `FALSE` otherwise. class:word {n/a} {n/a} s all +s:contains-char? sc-f - - Deprecated. Use `s:contains/char?` instead. Return `TRUE` if the character is present in the string or `FALSE` otherwise. class:word {n/a} {n/a} s all +s:contains-string? ss-f - - Deprecated. Use `s:contains/string?` instead. Return `TRUE` if the second string is present in the first string or `FALSE` otherwise. class:word {n/a} {n/a} s all +s:contains/char? sc-f - - Return `TRUE` if the character is present in the string or `FALSE` otherwise. class:word {n/a} {n/a} s all +s:contains/string? ss-f - - Return `TRUE` if the second string is present in the first string or `FALSE` otherwise. class:word {n/a} {n/a} s all s:copy sa- - - Copy a string (s) to a destination (a). This will include the terminator character when copying. class:word {n/a} {n/a} s all s:empty -s - - Return an empty string. class:word {n/a} {n/a} s all s:ends-with? ss-f - - Return `TRUE` if s1 ends with s2 or `FALSE` otherwise. class:word {n/a} {n/a} s all diff --git a/example/7080.retro b/example/7080.retro index 95299b2..16d502f 100755 --- a/example/7080.retro +++ b/example/7080.retro @@ -148,7 +148,7 @@ that provide a hint to the user about the content being linked. @Line [ ' s:put s:put ' s:put ] a:for-each nl ; :line - dup ASCII:HT s:contains-char? + dup ASCII:HT s:contains/char? [ fields a:length #3 gteq? [ [ menu-entry ] [ plain-text ] choose ] if; [ s:putm ] tt ; @@ -164,7 +164,7 @@ that provide a hint to the user about the content being linked. [ s:trim line ] a:for-each ; :process - &Buffer ASCII:HT s:contains-char? [ process:line ] if; + &Buffer ASCII:HT s:contains/char? [ process:line ] if; ' s:put &Buffer s:put ' s:put ; :eol ASCII:CR c:put ASCII:LF c:put ; diff --git a/example/Casket-HTTP.retro b/example/Casket-HTTP.retro index 078a1bd..a4318bd 100755 --- a/example/Casket-HTTP.retro +++ b/example/Casket-HTTP.retro @@ -82,7 +82,7 @@ the requested file from any query string that may be present. [ '/ &Requested s:append s:keep &Requested s:copy ] if ; :check-for-params (-) - &Requested $? s:contains-char? + &Requested $? s:contains/char? [ &Requested $? s:split/char drop dup n:inc !GET-Query #0 swap store ] if ; :filename (-s) diff --git a/example/advent-of-code-2020-day-4.retro b/example/advent-of-code-2020-day-4.retro index 739f50f..97d88ff 100644 --- a/example/advent-of-code-2020-day-4.retro +++ b/example/advent-of-code-2020-day-4.retro @@ -106,15 +106,15 @@ each one that proves valid. ~~~ :valid? - [ [ 'byr: s:contains-string? ] - [ 'iyr: s:contains-string? ] - [ 'eyr: s:contains-string? ] tri and and ] + [ [ 'byr: s:contains/string? ] + [ 'iyr: s:contains/string? ] + [ 'eyr: s:contains/string? ] tri and and ] - [ [ 'hgt: s:contains-string? ] - [ 'hcl: s:contains-string? ] - [ 'ecl: s:contains-string? ] tri and and ] + [ [ 'hgt: s:contains/string? ] + [ 'hcl: s:contains/string? ] + [ 'ecl: s:contains/string? ] tri and and ] - [ 'pid: s:contains-string? ] tri and and ; + [ 'pid: s:contains/string? ] tri and and ; #0 &Passports [ valid? [ n:inc ] if ] a:for-each ~~~ @@ -209,9 +209,9 @@ Then I implement the checks for each field. [ height-metric? ] [ height-imperial? ] choose record-result ; :process-hcl [ fetch $# eq? ] [ s:length #7 eq? ] - [ [ 'abcdef0123456789 swap s:contains-char? ] s:filter s:length #6 eq? ] tri + [ [ 'abcdef0123456789 swap s:contains/char? ] s:filter s:length #6 eq? ] tri and and record-result ; -:process-ecl EYE-COLORS a:contains-string? record-result ; +:process-ecl EYE-COLORS a:contains/string? record-result ; :process-pid [ s:length #9 eq? ] [ [ c:digit? ] s:filter s:length #9 eq? ] bi and record-result ; ~~~ diff --git a/example/atua-gophermap.retro b/example/atua-gophermap.retro index 5032275..c60cb35 100755 --- a/example/atua-gophermap.retro +++ b/example/atua-gophermap.retro @@ -144,7 +144,7 @@ Then I look to see if it has a file extension. ~~~ :has-extension? (s-sf) - dup $. s:contains-char? ; + dup $. s:contains/char? ; ~~~ If there is an extension, it can be mapped to a type code. diff --git a/example/display-names.retro b/example/display-names.retro index cdbb6c4..9ae5568 100644 --- a/example/display-names.retro +++ b/example/display-names.retro @@ -62,7 +62,7 @@ any used space is recovered. {{ :identify-classes (-a) here #0 , - [ dup d:name 'class: s:contains-string? + [ dup d:name 'class: s:contains/string? &, &drop choose ] d:for-each here over - n:dec over store ; ---reveal--- diff --git a/example/enum.retro b/example/enum.retro index abf49d4..f5b164b 100644 --- a/example/enum.retro +++ b/example/enum.retro @@ -32,7 +32,7 @@ increments the counter. ~~~ :a:enum (a-) #0 swap - [ dup $= s:contains-char? + [ dup $= s:contains/char? [ nip $= s:split/char [ n:inc s:to-number ] dip ] if over &const dip n:inc ] a:for-each drop ; diff --git a/example/file.retro b/example/file.retro index 7041feb..2864604 100644 --- a/example/file.retro +++ b/example/file.retro @@ -38,7 +38,7 @@ Works imperfectly, but useful. [ drop SOURCE/RETRO ] [ d:name ] choose !FileName ; :count-lines (-) #1 !Line (open @FileName file:open-for-reading !FileID !Size ) - [ @FileID file:read-line word-name s:contains-string? + [ @FileID file:read-line word-name s:contains/string? dup [ &Line v:inc ] -if not (-eof? @FileID file:tell @Size lt? ) and ] while (close @FileID file:close ) ; :pre (a-f) word file ; @@ -61,4 +61,3 @@ will not be found correctly.. Also, words defined in Rx such as `push`, `pop`, `drop`, `swap`, and `dup` are not found. - diff --git a/example/irc-bot.retro b/example/irc-bot.retro index b767ae5..ba0594f 100644 --- a/example/irc-bot.retro +++ b/example/irc-bot.retro @@ -143,7 +143,7 @@ I pass it to `s:evaluate`, capturing and relaying the output. #128 allot :message? - here 'PRIVMSG s:contains-string? ; + here 'PRIVMSG s:contains/string? ; :channel here 'PRIVMSG s:split-on-string drop #8 + $: s:split nip s:chop &Channel s:copy ; diff --git a/example/muri-with-hex.retro b/example/muri-with-hex.retro index ee994d5..bfbb68f 100644 --- a/example/muri-with-hex.retro +++ b/example/muri-with-hex.retro @@ -117,7 +117,7 @@ hex conversion above. ~~~ :decode (s-n) - dup &Instructions a:contains-string? + dup &Instructions a:contains/string? [ &Instructions swap a:index-of-string ] [ s:to-hex-number ] choose ; ~~~ diff --git a/example/namespaces.retro b/example/namespaces.retro index 7017b26..e2a36bb 100644 --- a/example/namespaces.retro +++ b/example/namespaces.retro @@ -11,9 +11,9 @@ Three words will be exposed. 'Namespaces d:create #513 allot {{ - :has-namespace? dup $: s:contains-char? ; + :has-namespace? dup $: s:contains/char? ; :get-namespace $: s:split nip ; - :known? dup &Namespaces a:contains-string? ; + :known? dup &Namespaces a:contains/string? ; :add s:keep buffer:add &Namespaces v:inc ; :process get-namespace known? &drop &add choose ; ---reveal--- diff --git a/example/retro-edit.retro b/example/retro-edit.retro index 59846ed..67c27b3 100755 --- a/example/retro-edit.retro +++ b/example/retro-edit.retro @@ -198,7 +198,7 @@ display a range of lines, use `p`, followed by a `first,last` line number pair. ~~~ -:pair? @Input $, s:contains-char? ; +:pair? @Input $, s:contains/char? ; :get-limits @Input $, s:tokenize [ s:to-number ed:constrain ] a:for-each ; :display-range over - n:inc [ dup ed:display-line n:inc ] times drop ; @@ -211,7 +211,7 @@ The final display related command is `/`, which displays lines that contain the text following the `/`. ~~~ -:match? I ed:to-line @Input s:contains-string? ; +:match? I ed:to-line @Input s:contains/string? ; :cmd:/ @Lines [ match? [ I ed:display-line ] if ] indexed-times ; ~~~ diff --git a/example/retro-stats.retro b/example/retro-stats.retro index cb74896..3c187c7 100644 --- a/example/retro-stats.retro +++ b/example/retro-stats.retro @@ -85,7 +85,7 @@ nl 'Classes: s:put nl nl :identify-classes (-a) here #0 , - [ d:name dup 'class: s:contains-string? + [ d:name dup 'class: s:contains/string? &, &drop choose ] d:for-each here over - n:dec over store ; @@ -109,7 +109,7 @@ nl 'Sigils: s:put nl nl :identify-sigils (-a) here #0 , - [ d:name dup 'sigil: s:contains-string? + [ d:name dup 'sigil: s:contains/string? &, &drop choose ] d:for-each here over - n:dec over store ; diff --git a/image/retro.forth b/image/retro.forth index 57f87ba..f044a4f 100644 --- a/image/retro.forth +++ b/image/retro.forth @@ -907,11 +907,11 @@ In higher level code: [ drop #-1 ] if ; ~~~ -`s:contains-char?` returns a flag indicating whether or not a +`s:contains/char?` returns a flag indicating whether or not a given character is in a string. ~~~ -:s:contains-char? (sc-f) s:index-of #-1 -eq? ; +:s:contains/char? (sc-f) s:index-of #-1 -eq? ; ~~~ Hash (using DJB2) @@ -925,7 +925,7 @@ on an implementation at http://www.cse.yorku.ca/~oz/hash.html :s:hash (s-n) #5381 swap [ \swlimuad `33 ] s:for-each ; ~~~ -`s:contains-string?` returns a flag indicating whether or not +`s:contains/string?` returns a flag indicating whether or not a given substring is in a string. ~~~ @@ -949,7 +949,7 @@ a given substring is in a string. :next (-) &I v:inc ; ---reveal--- - :s:contains-string? (ss-f) + :s:contains/string? (ss-f) !Tar !Src s:empty !Pad #0 !I #0 !F @Src s:length [ extract terminate compare next ] times @@ -1099,9 +1099,9 @@ First are a bunch of words to help identify character values. :c:letter? (c-f) &c:lowercase? &c:uppercase? bi or ; :c:digit? (c-f) $0 $9 n:between? ; :c:visible? (c-f) #32 #126 n:between? ; -:c:vowel? (c-f) 'aeiouAEIOU swap s:contains-char? ; +:c:vowel? (c-f) 'aeiouAEIOU swap s:contains/char? ; :c:consonant? (c-f) dup c:letter? [ c:vowel? not ] [ drop FALSE ] choose ; -:c:whitespace? (c-f) s:WHITESPACE swap s:contains-char? ; +:c:whitespace? (c-f) s:WHITESPACE swap s:contains/char? ; ~~~ And the inverse forms. (These are included for readability and @@ -1476,7 +1476,7 @@ a `TRUE` flag for. here over - n:dec over store ; ~~~ -Next are `a:contains?` and `a:contains-string?` which +Next are `a:contains?` and `a:contains/string?` which compare a given value to each item in the array and returns a flag. @@ -1484,7 +1484,7 @@ a flag. :a:contains? (na-f) #0 swap [ swap push over eq? pop or ] a:for-each nip ; -:a:contains-string? (na-f) +:a:contains/string? (na-f) #0 swap [ swap push over s:eq? pop or ] a:for-each nip ; ~~~ diff --git a/ngaImage b/ngaImage index e129f31a5cae957857a85ea8880d3c8a1430197f..6aa64657fc21c5f0bbc10814b8dbe7eddab2dd4c 100644 GIT binary patch delta 45 zcmZoz&(yG