next up previous contents index
Next: .lib Line Up: Title, Comments, Job Separation, Previous: .newjob Line   Contents   Index


.include or .inc Line

General Form:
.include [h] filename
.inc [h] filename
Example:
.include models.def
.inc /projects/data.inc
.inc h /models/hspice_models.inc

The keywords ``.include'' and ``.inc'' are equivalent. The .include line specifies that the named file is to be read and added to the input at the location of the .include line. Included files may be nested arbitrarily.

If the h option (case insensitive) is given, the dollarcmt variable is effectively set while the file, and any recursive sub-files, are being read. Thus, the HSPICE `$' comment syntax will be recognized in the included files. The dollarcmt variable is reset to its prior value after the read.

This avoids having to explicitly set the dollarcmt variable when reading files intended for HSPICE. It allows the normal WRspice shell substitution to work with the file containing the include line, which would not be the case if the dollarcmt variable was set explicitly.

While the included file is being read, the current directory is pushed to the directory containing the file. Thus, .include (and .lib) lines in the file will have paths resolveed relative to that directory, and not the original current directory.

In WRspice, the keyword .spinclude is accepted as a synonym for .include. This is for compatibility with Xic, which will replace .include lines with the file contents, but will pass .spinclude lines to SPICE, after converting ``.spinclude'' to ``.include''.

These lines are shell expanded when encountered, before the indicated file is accessed. This allows the paths to include shell variables, which can be set interactively. Normal shell expansion, which applies to all other lines, occurs after all includes are read, parameter expansion, etc., much later in the sourcing process. Note that shell variables can't be used in files included with the `h' option, or when the dollarcmt variable is set, as the `$' will be taken as the start of a comment.


next up previous contents index
Next: .lib Line Up: Title, Comments, Job Separation, Previous: .newjob Line   Contents   Index
Stephen R. Whiteley 2017-11-08