Previous: , Up: Schematic capture   [Contents][Index]


5.16 Interactive work with Scheme code

You can extend the functionality of lepton-schematic, automate some work on schematic or symbol creation, and learn how things are internally made up playing with Scheme without even exiting the program. There are several ways to get things done and they are described below.

Note: You can also work with Scheme using interactive mode of several non-GUI Lepton utilities, namely, lepton-netlist, lepton-cli, and lepton-symcheck. Please read their manual pages on how to run them interactively.

Sometimes it is very convenient to invoke a one-line script to try some idea. Use File → Invoke macro... (:, colon, or E Shift-:) to open a macro widget which will allow you to execute some small excerpts of Scheme code interactively. In the macro widget entry you may enter one line consisting of one or more commands in Scheme (don’t forget parentheses). Hit Enter to make them evaluate and watch the result of your expression in the Log window. If the script includes some interactive functions, you’ll immediately see the result in GUI.

Another, more powerful possibility is executing a Scheme script stored in some file in your file system. It allows you evaluate the code of any length, so it is much more convenient if you work on some complex code. Use File → Execute Script... (F T) and select a Scheme script to execute. You can filter the files like in the File Open dialog (see Creating new and opening existing schematic files), though you can choose solely amongst showing only Scheme or any files. Switch between lepton-schematic and your text editor, edit your code and try again.

The most powerful and convenient way of working with Scheme is using REPL. There are two ways to start it:

In the REPL, you’ll immediately see the results of your expressions or errors, be able to list, edit and use expressions evaluated before, utilize their results again, load files, and more. So this option embraces all the advantages of the former two and adds more. However, be careful:

Caution: Trying some code pieces may be dangerous and crash your running lepton-schematic process while working in the REPL! The reason is the lack of proper multi-threading support in GTK while Scheme supports it pretty well. If in doubt, save your designs before trying something out.


Previous: Component libraries, Up: Schematic capture   [Contents][Index]