next up previous contents index
Next: edit Up: Input and Output Commands Previous: Input and Output Commands   Contents   Index


codeblock

The codeblock command manipulates codeblocks.

codeblock [-options] [filename]
A codeblock is a stored executable structure derived from a script file. Being internal representations, codeblocks execute more efficiently than script files. A codeblock generally has the same name as the script file from which it was derived.

Option characters, which may be lumped or given separate tokens, are listed below.

p print the text of a block (synonym t)
f remove the block (synonym d)
a add a block
b bind the block to the ``controls'' of the current circuit
be bind the block to the ``execs'' of the current circuit

If no filename is given, all the blocks in the internal list are listed by name, commands are printed if p is given, and the blocks are deleted if f is given (a and b are ignored), and the current circuit codeblock pointer is undefined.

Otherwise, the named file/block is acted on. Added blocks overwrite existing blocks of the same name.

When a command is entered in response to a prompt or in a script (or another codeblock), the blocks are checked first, then the WRspice internal commands, then scripts, then vectors (for the implicit let in vector = something) and finally operating system commands if unixcom is set.

A codeblock can be ``bound'' to the current circuit with the b and be options. If be, the block is bound as an ``exec'' codeblock, and if b is given, the block is bound as a ``control'' codeblock. Each circuit has one of each type, which are by default derived from the .exec and .control statements from the circuit file. Binding an external codeblock overrides the blocks obtained from the file. If no filename was given, the existing binding is deleted from the current circuit, according to whether the b or be was given. Separate calls are required to unbind both blocks.

Operating range and Monte Carlo analysis can make use of ``bound'' codeblocks. In both types of analysis, the ``controls'' codeblock execution sets a variable indicating whether the circuit simulated properly according to user specified criteria. When a margin analysis file is input, the lines between .control and .endc become the default controls codeblock. Similarly, the lines between .exec and .endc become the default exec codeblock. A bound codeblock will always supersede the default codeblock.

Once a codeblock has been added, it can be executed by simply entering its name, as if it were a shell command. If a name conflicts with an internal command or script, the codeblock has precedence.


next up previous contents index
Next: edit Up: Input and Output Commands Previous: Input and Output Commands   Contents   Index
Stephen R. Whiteley 2006-10-23