Next: , Previous: Tools, Up: Tools

7.1 ans-report.fs: Report the words used, sorted by wordset

If you want to label a Forth program as ANS Forth Program, you must document which wordsets the program uses; for extension wordsets, it is helpful to list the words the program requires from these wordsets (because Forth systems are allowed to provide only some words of them).

The ans-report.fs tool makes it easy for you to determine which words from which wordset and which non-ANS words your application uses. You simply have to include ans-report.fs before loading the program you want to check. After loading your program, you can get the report with print-ans-report. A typical use is to run this as batch job like this:

     gforth ans-report.fs myprog.fs -e "print-ans-report bye"

The output looks like this (for compat/control.fs):

     The program uses the following words
     from CORE :
     : POSTPONE THEN ; immediate ?dup IF 0=
     from BLOCK-EXT :
     from FILE :

7.1.1 Caveats

Note that ans-report.fs just checks which words are used, not whether they are used in an ANS Forth conforming way!

Some words are defined in several wordsets in the standard. ans-report.fs reports them for only one of the wordsets, and not necessarily the one you expect. It depends on usage which wordset is the right one to specify. E.g., if you only use the compilation semantics of S", it is a Core word; if you also use its interpretation semantics, it is a File word.