5.4.6 CSS Commands

The following are the commands available in CSS. Commands are a little bit "special" in that they are typically executed immediately, they can be called with arguments without using the parentheses required in normal C functions (though they can be used if desired), and they do not need to be terminated with a semicolon (note that this also means that commands cannot extend across more than one line). Also, they do not generate return values. In general, commands provide debugging and program management (loading, listing, etc) kinds of facilities.

alias <cmd> <new_nm>
Gives a new name to an existing command. This is useful for defining shortcuts (e.g., alias list ls), but does not allow more complex functionality. For that, either define a new function, or use a pre-processor #define macro.
chsh <script_path>
Switches the CSS interface to access the CSS script object pointed to by the given path. This is for hard-coded objects that have CSS script objects in them (of type cssProgSpace).
clearall
Clears out everything from the current program space. This is like restarting the CSS shell, compared to reset which does not remove any variables defined at the top-level.
commands
Shows a list of the currently available commands (including any aliases that have been defined, which will appear at the end of the list).
constants
Shows a list of the pre-defined constants that have been defined in CSS. These are just like globally-defined Int and Real values, and thus they can be assigned to different values (though this is obviously not recommended).
cont
Continues the execution of a program that was stopped either by a breakpoint or by single-stepping. To continue at a particular line in the code, use the goto command.
debug <level>
Sets the debug level. Level 1 provides a trace of the source lines executed. Level 2 provides a more detailed, machine-level trace, and causes list to show the program at the machine level instead of at the usual source level. Levels greater than 2 provide increasing amounts of detail about the inner workings of CSS, which should not be relevant to most users.
define
Toggles the mode where statements that are typed in become part of the current program to be executed later (define mode), as opposed the default (run mode) where statements are executed immediately after entering them.
defines
Shows a list of all of the current #define pre-processor macros.
edit <object> [<wait>]
If the GUI (graphical user interface) is active (i.e., by using -gui to start up CSS), edit will bring up a graphical edit dialog for the given object, which must be either a script-defined or hard-coded class object. The optional second argument, if true, will cause the system to wait for the user to close the edit dialog before continuing execution of the script.
enums
Shows a list of all the current enum types. Note that most enum types are defined within a class scope, and can be found there by using the type command on the class type.
exit
Exits from the program (CSS), or from another program space if chsh (or its GUI equivalent) was called.
frame [<back>]
Shows the variables and their values associated with the current block or frame of processing. The optional argument gives the number of frames back from the current one to display. This is most relevant for debugging at a breakpoint, since otherwise there will only be a single, top-level frame to display.
functions
Shows a list of all of the currently defined functions.
globals
Shows a list of all of the currently defined global variables, including those in the script and hard-coded ones.
goto <src_ln>
Continues execution at the given source line.
help
Shows a short help message, including lists of commands and functions available.
inherit <object_type>
Shows the inheritance path for the given object type.
list [<start_ln> [<n_lns>]] [<function>]
Lists the program source (or machine code, if debug is 2 or greater), optionally starting at the given source line number, and continuing for either 20 lines (the initial default) or the number given by the second argument (which then becomes the new default). Alternatively, a function name can be given, which will start the listing at the beginning of that function (even if the function is external and does not appear in a line-number based list). list with no arguments will resume where the last one left off.
load <program_file>
Loads and compiles a new program from the given file.
mallinfo
Generates a listing of the current malloc memory allocation statistics, including changes from the last time the command was called.
print <expr>
Prints the results of the given expression (which can be any valid CSS expression), giving some type information and following with a new line (\n). This is useful for debugging, but not for printing values as part of an executing program.
printr <object>
Prints an object and any of its sub-objects in a indented style output. This can be very long for objects near the top of the object hierarchy (i.e., the root object), so be careful!
reload
Reloads the current program from the last file that was loaded. This is useful because you do not have to specify the program file when making a series of changes to a program.
remove <var_name>
Removes given variable from whatever space it was defined in. This can be useful if a variable was defined accidentally or given the wrong name during interactive use.
reset
Reset is like clearall, except that it does not remove any top-level variables that might have been defined. Neither of these commands will remove anything declared extern.
restart
Resets the script to start at the beginning. This is useful if you want to stop execution of the program after a break point.
run
Runs the script from the start (as opposed to cont which continues execution from the current location).
setbp <src_ln>
Sets a breakpoint at the given source-code line. Execution of the program will break when it gets to that line, and you will be able to examine variables, etc.
setout <ostream>
Sets the default output of CSS commands to the given stream. This can be used to redirect listings or program tracing output to a file.
settings
Shows the current values of various system-level settings or parameters. These settings are all static members of the class ta_Misc, and can be set by using the scoped member name, for example: ta_Misc::display_width = 90;
shell <"shell_cmd">
Executes the given Unix shell command (i.e., shell "ls -lt").
showbp
Shows a list of all currently defined breakpoints, and the source code line they point to.
source <cmd_file>
Loads a file which contains a series of commands or statements, which are executed exactly as if they were entered from the keyboard. Note that this is different than loading a program, which merely compiles the program but does not execute it immediately thereafter. source uses run mode, while load uses define mode.
stack
Displays the current contents of the stack. This can be useful for debugging.
status
Displays a brief listing of various status parameters, such as current source line, depth, etc.
step <step_n>
Sets the single-step mode for program execution. The parameter is the number of lines to step through before pausing. A value of 0 turns off single stepping.
tokens <obj_type>
Lists the instances of the given object type which are known to have been created. Many object types do not register tokens, which will be indicated in the results of this command if applicable. It is possible to refer to the objects by their position in this list with the Token function, which can be a useful shortcut to using the object's path.
trace [<level>]
Displays a trace of the functions called up to the current one (i.e., as called from within a breakpoint). A trace level of 0 (the default) just gives function names, line numbers, and the source code for the function call, while level 1 adds stack information, level 2 adds stack and auto variable state information, and level 3 gives a complete dump of all available information.
type <type_name>
Gives type information about the given type. This includes full information about classes (both hard-coded and script-defined), including members, functions, scoped types (enums), etc.
undo
This undoes the previous statement, when in define mode.
unsetbp <src_ln>
Removes a breakpoint associated with the given source-code line number.