\ defs.txt Leo Wong 4 April 02003 fyj + \ Sort names after : CREATE CONSTANT DEFER VALUE VARIABLE \ All names are made lower case \ Usage example at the end of this file include from.txt from string.txt from files.txt from source.txt from linked.txt linked Definitions-List FALSE VALUE colon \ Exit if within a colon definition (foolable but useful) : ;? ( ca1 u1 -- ca1|ca2 u1|u2 f|t ) S" ;" SEARCH ; : -colon ( ca1 u1 -- ca2 u2 ) FALSE TO colon 2 /STRING ; macro ?Exit " colon IF ;? IF -colon ELSE 2DROP EXIT THEN THEN " \ Add definition names to Definitions-List : Link-Names ( ca1 u1 ca2 u2 -- ) 2>R BEGIN 2R@ SEARCH WHILE R@ /STRING word> Definitions-List ssadd 2R@ S" : " COMPARE 0= IF TRUE TO colon THEN REPEAT 2DROP 2R> 2DROP ; : Add-Names ( ca u -- ) -strings ?Exit 2DUP slower 2DUP S" : " Link-Names ?Exit 2DUP S" constant " Link-Names 2DUP S" defer " Link-Names 2DUP S" create " Link-Names 2DUP S" variable " Link-Names S" value " Link-Names ; : Get-and-Sort-Names 0 PARSE open-in FALSE TO colon BEGIN readl WHILE Add-Names REPEAT 2DROP close-in ; : .Def ( node -- ) >data COUNT TYPE SPACE ; ' .def IS xNode : Defs ( -- ) \ defs HERE Definitions-List 0 Definitions-List 2! Get-and-Sort-Names Definitions-List CR xList HERE - ALLOT ; \ Usage example Defs Defs.txt