From ffc4c077eeeeb12f6c0e301a1a142c3f0e31792e Mon Sep 17 00:00:00 2001 From: crc Date: Fri, 10 Nov 2017 20:54:46 +0000 Subject: [PATCH] successfully edit a description FossilOrigin-Name: 366a427e0123cc5fbc9a5b4cce368c0f985b3e657e6f082c1733527db0a9cd8a --- wip/glossary.forth | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/wip/glossary.forth b/wip/glossary.forth index f1a8a4e..66034ac 100755 --- a/wip/glossary.forth +++ b/wip/glossary.forth @@ -142,12 +142,37 @@ QUERY 'export s:eq? 'tsv TARGET s:eq? and 'EDITOR here [ unix:getenv ] sip s:temp 'EDITOR s:const 'FID var +:edit:description + '/tmp/glossary.descr file:W file:open !FID + field:descr [ @FID file:write ] s:for-each @FID file:close + '/tmp/glossary.descr EDITOR '%s_%s s:with-format unix:system ; + +'FOUT var +:fputs (s-) [ dup ASCII:CR eq? over ASCII:LF eq? or [ drop ] [ @FOUT file:write ] choose ] s:for-each ASCII:HT @FOUT file:write ; + +:display-fields + field:name fputs + field:dstack fputs + field:astack fputs + field:fstack fputs + here '/tmp/glossary.descr file:slurp here fputs + field:itime fputs + field:ctime fputs + field:class fputs + field:ex1 fputs + field:ex2 fputs + field:namespace fputs + field:interface fputs + ; + + QUERY 'edit:descr s:eq? [ 'words.tsv - [ s:keep !SourceLine field:name TARGET s:eq? - [ '/tmp/glossary.descr file:W file:open !FID - field:descr [ @FID file:write ] s:for-each @FID file:close - '/tmp/glossary.descr EDITOR '%s_%s s:with-format unix:system ] if ] file:for-each-line + [ s:keep !SourceLine field:name TARGET s:eq? [ edit:description ] if ] file:for-each-line + 'words.new file:W file:open !FOUT + 'words.tsv + [ s:keep !SourceLine field:name TARGET s:eq? [ display-fields ] [ @SourceLine [ @FOUT file:write ] s:for-each ASCII:LF @FOUT file:write ] choose ] file:for-each-line + @FOUT file:close ] if ~~~