Syntax Databases¶
The tool uses a file defining what commands are available and how they are used. This file is typically called syntaxdb.tcl, and is just a Tcl file defining variables.
Any file called syntaxdb*.tcl in your current directory or in the directory where Nagelfar is located is detected and possibly used as default database unless you specify one on the command line. The search order for default database is:
syntaxdb.tcl in current directory
syntaxdb*.tcl in current directory (if more than one it is unspecified which)
syntaxdb.tcl where Nagelfar is located
syntaxdb*.tcl where Nagelfar is located
You can select database(s) with the command line switch “-s”.
In the GUI, all databases found are listed, and those found where Nagelfar is located are marked “(app)”.
Syntax databases may contain inline comments, so a file generated with the -header option may be used with -s.
Creating Syntax Databases¶
A syntax database is created by syntaxbuild.tcl which makes it possible to create customized databases for the interpreter where your script will run.
For example, if you want to create a database for Tcl8.2:
$ tclsh82 syntaxbuild.tcl syntaxdb82.tcl
or
$ tclsh82
% source syntaxbuild.tcl
% buildFile syntaxdb82.tcl
% exit
Then use it:
$ nagelfar.tcl -s syntaxdb82.tcl <tcl-file>
On Windows it is usually just to double click on syntaxbuild.tcl and a new syntaxdb.tcl is generated using your installed Tcl version.
Limitations to extraction¶
As a base, only command names are collected and marked known. Thus avoiding “unknown command” errors.
More to be written…
Package databases¶
Whan a ‘package require’ is encountered, Nagelfar will look for a matching database to load for that package. In the distribution, they are under the packagedb/ directory which is searched for next to the nagelfar.tcl script.