Content-type: text/html
ADD R1 (5.3/(4-2)),10 (3*5.3/4),20;
When entering points with the mouse, the clicks ALWAYS snap to the
grid, giving a powerful way to enter precise coordinates.
All the Piglet built-in commands are case-insensitive and can be abbreviated to just three letters with one exception. DISPLAY must be entered as "DISP" or "disp" to distinguish it from "DIStance".
Piglet's interactive command environment is also a simple shell. If you type the name of any executable that can be found in the $PATH variable, Piglet will run the program, displaying any output in the Piglet text window.
Any Piglet command can be placed in the $PIG_RC file. Macro definitions and SET commands will be read and added to the environment. This allows the $PIG_RC file to have the last say in setting the $PIG_PATH and $PIG_GEOMETRY variables. However, at this phase of startup, any EDIt commands are ignored.
After reading the $PIG_RC file, all the necessary support files are read using the $PIG_PATH. These include the menu and font definition files and process definition files. After all support files are read, the X11 graphical window is created using the $PIG_GEOMETRY specification.
Finally, the $PIG_RC file is read a second time. The contents are now executed just as if the user typed them. Now that the X11 system is initialized, EDIt commands will be honored.
The following example pigrc file sets the SHOW default to "#E", defines a three macros, sets the starting window geometry and begins an EDI of the cell named "PLAN". Piglet uses the double dollar sign "$$" as a comment character. Anything after a comment up to an end-of-line is discarded by the parser and treated as a single end-of-line character.
$$
$$ example piglet initialization file
$$
SET PIG_SHOW_DEFAULT "#E" $$ make cells editable by default
DEF wi "WIN :X.5;" $$ window in macro
DEF wo "WIN :X2;" $$ window out macro
DEF wf "WIN :F;" $$ window fit macro
SET PIG_GEOMETRY "700x440+10+30";
EDI PLAN;
Piglet can nest edit commands. If you are editing <device1> and you decide that you need to create a new module, you can type "EDI <newdevice>;" without leaving your current edit session. After you SAVE and EXIT the nested edit, you will be returned to your original edit in progress. You can nest edit commands without limit subject to the constraint that you cannot simultaneously edit any device more than once.
The WINDOW command can be used to adjust the current view. "WIN :F;" will fit the device in the window. "WIN 0,0 10,10;" will set the viewport so that a rectangle with a lower left coordinate of 0,0 and upper right of 10,10 fits as tightly as possible. Using the WINDOW command with mouse picks is a good way to zoom into a specific detail of the current device. After zooming in to check some detail, "WIN :Z;" is handy to return to the previous window setting.
MAIN> edi testcell;
An autosave file was found that is newer than the device file.
device file: ./cells/testcell.d, 2803 bytes, Tue May 4 00:00:47 2010
autosave file: ./cells/#testcellt.d, 2827 bytes, Tue May 4 00:31:58 2010
read autosave file instead of .d file?: (y/n)?
It is possible to examine the cells directory at any time and to compare the contents of any autosave files with the associated .d files, and to either delete the autosave file or copy it onto the .d file as appropriate.
set editing-mode vi
set keymap vi
to the file "~/.inputrc". See the GNU readline(1) man page for more details about commandline editing.
When a drawing is SAVed, Piglet creates a human readable cell definition file which consist of the same commands which were used to create the device originally. Piglet can also create postscript drawings with the PLOT command. Screendumps can be created in numerous formats with the DUMP command. By default, the compact png format is used for dumps.
Piglet requires several configuration files to start up. These include the TEXT and NOTE font definition files, the MENU definition file and the PROCESS layer definition file.
Unless overridden with Environment Variables (see below) Piglet sequentially searches the following directories to find the needed startup files.
1) current working directory
2) directory ".pigrc" under the current working directory
3) directory ".pigrc" in the users HOME directory
4) /usr/local/lib/piglet
5) /usr/lib/piglet
The TEXT and FONT files by default are named "TEXTDATA.F" and "NOTEDATA.F" respectively. These names can be overridden with Environment Variables. The format for both files is plain ASCII. The files start with two integers separated by a comma. The first gives the height of each character definition and the second, the width. Each character is then listed in printed form and the glyph is defined by a set of vector coordinates. It is assumed that each successive x,y coordinate pair is connected by a stroke unless the path is broken by the special coordinate "-64,0". Each definition is terminated by the special coordinate "-64,-64". Here is an example of the first three definitions in "NOTEDATA.F" for the characters <exclam>, <double-quote>, and <pound>:
16,12 ! 6,2 6,3 -64,0 6,5 6,14 -64,-64 " 4,14 4,10 -64,0 8,14 8,10 -64,-64 # 2,6 10,6 -64,0 2,10 10,10 -64,0 4,2 4,14 -64,0 8,2 8,14 -64,-64
Piglet's menu is also defined by a customizable file "MENUDATA_V". The default menu is defined as:
ayyyyy |ADD |R|P|L|N|T| ayyyyb |SHO |C|E|I|A|O| ayyggg |GRI |#|^|1|2|3| aggggg |WIN |+|-|4|5|6| yyyggg |:F|:V|:Z|7|8|9| yyyggg |:D|:S|:L|,|0|.| yyyyy |:W|:C|:N|:O|:R| yyaaaa |:X|:Y|:M|X|Y|@| ggg |LAY |LEV |LOC | ggg |FSI |TSL | | gyyy |SHO #E; |;|!| | wrgbapy|0|1|2|3|4|5|6 | ww | | | aap |MOV |COP |CHA | ypy |IDE |POI |LIS | ygg |DISP |DIST | | ggg |DUM |PLO |ARC | gby |RET |SPL |INP | ggb |ARE |WRA |GRO | ggr |STR |SMA |PUR | rrr |DEL |EXI |BYE | ygg |SAV | | | ygg |EDI |UND |RED |
The file consists of fields separated by "|" characters. The first field consists of some combination of the characters "wrgbapy" which denote the colors white, red, green, blue, aqua, purple and yellow. There should be as many color designators as remaining fields. The subsequent fields on each line will be displayed exactly as shown, rendered in the corresponding color. The vertical bars are replaced with white bounding boxes.
When using the editor, any mouse pick on the menu boxes injects the menu text directly into the parse stream. The menu designer should take care to leave extra spaces after command names so that any combination of mouse picks results in intelligible commands.
The layer definition process file is named "PROCDATA.P". Its format is also plain ASCII. It consists of one EQUate command line per layer. The following PROCDATA.P file defines the characteristics of 9 layers.
EQU :C1 :P1 :M0 :B :F0 boundary 0 EQU :C2 :P2 :M1 :D :F2 layer1 1 EQU :C3 :P3 :M2 :D :F2 layer2 2 EQU :C4 :P4 :M3 :D :F2 layer3 3 EQU :C5 :P5 :M4 :S :F0 layer4 4 EQU :C6 :P6 :M5 :S :F0 layer5 5 EQU :C7 :P7 :M6 :I :F0 layer6 6 EQU :C1 :P1 :M0 :I :F0 layer7 7 EQU :C2 :P2 :M1 :I :F0 layer8 8
The first line, for example, says that layer 0 is named "boundary", drawn with color 1 (white), plotted with pen 1, and uses line type 0 (solid). The detail layers (2,3,4) are filled with fill pattern 2 and the other layers are unfilled. See the EQUate man page for full details.
Piglet inheirits any environment variables exported by the parent shell. In addition, new variables can be created as private variables by using the SET command.
Some example geometries:
PIG_GEOMETRY=500x500+0+0 pig ; a small window in upper left corner
PIG_GEOMETRY=900x700-0+0 pig ; a wide window in upper right corner
PIG_GEOMETRY=500x700-0-0 pig ; a tall window in lower right corner
PIG_GEOMETRY=600x600+0-0 pig ; a medium window in lower left corner
Since Piglet is under active development, it is distributed to run under the gdb() debugger. The script "pig" runs pig.bin under gdb(). When running under gdb() most run-time errors will print out a backtrace of the stack. If you would like help fixing a bug, please send a copy of the dump file (named "pigtrace.<process_id>") to Rick Walker <walker AT omnisterra DOT com> along with some description of what caused the bug.
When running pig.bin without the debugger, Piglet traps and ignores most signals, printing a notification to the terminal: "caught 2: Interrupt. Use QUIT command to end program". However, the special signal SIGQUIT elicits the message: "caught 3: Quit. do it again and I'll die!". Two SIGQUITs in a row will terminate the program.
The PD Piglet homepage is at http://www.omnisterra.com/walker/linux/piglet/intro.htm.