glossary tool: add "missing" option to show words not in glossary

FossilOrigin-Name: 9b48678f8b0b9f59382ef1e1f8bb2c237a9e98eb0eaac0f9b14a9fd445568c6c
This commit is contained in:
crc 2019-01-23 13:09:36 +00:00
parent f76cfe7f1a
commit 24eff02944
2 changed files with 21 additions and 2 deletions

View file

@ -16,6 +16,10 @@ not, just exit.
sys:argc n:zero? [ #0 unix:exit ] if
~~~
~~~
:GLOSSARY-TOOL ;
~~~
If execution reaches this point there's at least one
argument. I use a loop to store arguments into an array
named `Args`.
@ -174,6 +178,19 @@ There are five primary roles:
'words.tsv [ s:keep !SourceLine matched? [ display-result ] if ] file:for-each-line ;
~~~
## Missing Words
~~~
'GlossaryNames d:create #4097 allot
:populate-names
#1 'words.tsv [ !SourceLine field:name s:keep over &GlossaryNames + store n:inc ] file:for-each-line
n:dec &GlossaryNames store ;
:display-missing
'GLOSSARY-TOOL d:lookup fetch !Dictionary
populate-names [ d:name dup &GlossaryNames set:contains-string? [ drop ] [ s:put nl ] choose ] d:for-each ;
~~~
## Add a Word
This just adds a stub to the end of the words.tsv file.
@ -406,6 +423,7 @@ to use.
'add_<wordname> s:put nl
'edit_<field>_<wordname> s:put nl
'export_<format> s:put nl
'missing s:put nl
#32 [ $- c:put ] times nl
'Editor_Fields: s:put nl
'__name\n__dstack\n__astack\n__fstack\n s:format s:put
@ -540,7 +558,8 @@ handle each case.
'edit [ handle-edit ] s:case
'add [ add-word ] s:case
'delete [ delete-entry ] s:case
'serve [ gopher:serve ] s:case
'serve [ gopher:serve ] s:case
'missing [ display-missing ] s:case
drop show-help ;
~~~

View file

@ -1337,7 +1337,7 @@ a flag.
[ over eq? @F or !F ] set:for-each
drop @F ;
:set:contains-string? (na-f)
:set:contains-string? (sa-f)
&F v:off
[ over s:eq? @F or !F ] set:for-each
drop @F ;