XCircuit Original Command-Line Reference

The XCircuit Command Line ("%")

XCircuit has a command-line feature intended to duplicate the menu and keyboard functions in xcircuit. A command line can be executed in three different ways:
  1. Read as part of the .xcircuitrc file on program startup
  2. Read as part of an executable script run from the menu selection File->Execute script
  3. Entered directly into the message window as a result of typing the "%" key macro (Python and non-interpreter versions only) or
  4. Entered into the console window (Tcl version only). The console window is popped down on startup (beginning with version 3.1.6) but can be deiconified by selecting menu option "File->Tcl Console".
The command line functions are written in Tcl if xcircuit has been selected as a Tcl extension at compile time, or in Python, if Python has been compiled into xcircuit. Whether this is true is indicated by the command-line prompt when the '%' macro is chosen, which is a question mark ('?') if the interpreter is the old-style xcircuit interpreter, and the usual Python prompt ('>>>') if the interpreter is Python. If Tcl is the interpreter, there is no "%" macro, and the interpreter prompt is available in the Tcl/Tk console window, which can be accessed from the menu command File->Tcl Console. The old xcircuit command line syntax is as follows: The Tcl command line syntax accepts any valid Tcl/Tk code. XCircuit functions imported into Tcl are summarized in Tcl-Based XCircuit page. Note especially the changes in syntax for overrides and library loads. Some of this has been (somewhat awkwardly) made backwardly-compatible, but the preferred syntax is "library override" for the override command, and "library number load filename" for libraries. Note that TCL has a habit of dropping all input when an error is encountered, so an error at the top of the .xcircuitrc file will prevent the remainder of the file from being parsed.

The Python command line syntax accepts any valid Python code. Special functions in the embedded interpreter, imported as a module, link the Python interpreter to internal xcircuit variables. These special commands are summarized in The Python Interpreter page.

Note on Key Bindings: The new key bindings scheme includes a difference from the original behavior. Originally, the BackSpace and Delete keys were both interpreted as "Delete". In the new key bindings scheme, only Delete deletes the previous character, while BackSpace acts like the left arrow cursor (moves one space to the left). If you prefer the original behavior, it can be emulated with the following commands (Python version) (to be put, for instance, in your home .xcircuitrc file):

unbind("BackSpace", "Text Left")
bind("BackSpace", "Text Delete")

Xcircuit configuration file (.xcircuitrc)

If a configuration file named ".xcircuitrc" exists in the current working directory (first place searched) or the user's home directory (second place searched) or the xcircuit library directory (last place searched), it will be loaded on startup. The syntax of the .xcircuitrc file is the same as an executable xcircuit script or command-line entry, and is described in the section "The XCircuit Command Line".

System startup file:

The difference between ".xcircuitrc" and "startup.script" in the library is that ".xcircuitrc" will be overridden if a file of the same name exists in a user's current working directory or home directory. "startup.script" always runs, although default libraries and fonts listed therein can be forcibly ignored by the user with the "override" command. Thus, it is recommended that "startup.script" restrict itself to loading fonts and libraries, and that ".xcircuitrc" be used for all other commands, unless the administrator has totalitarian tendencies and wishes to force a consistent interface among users, such as for an instructional course.

Back to the xcircuit home page. . .


Last updated: August 5, 2016 at 6:54pm