Command-line interface to SWOG.


The script is a command-line interface to SWOG.

Script may be started like this

$ perl bin/SWOG.pl --help
Command line interface to use SWOG
        --help prints this help message and exits
        --bufGif starts fast mode and creates a GIF image
        --bufGifanim=tempDir starts fast mode and writes a 
                GIF animation frames to the tempDir, use --toGifanim to 
        --bufPng starts fast mode and creates PNG image
        --bufSVGToFile=filename starts fast mode and stores SVG to the 
        --input=filename SWOG picture description file (when given it 
                is passed to SWOG before executing any other commands)
        --mode=state sets script operation mode, when input
                redirection is used then default value is 'input', 
                without redirected input default value is 'none' 
             Modes are: 
                  none - program uses only command line options and 
                        waits no user interaction
                  input - program reads SWOG commands from std. input, 
                        after Ctrl+D or line starting with #endInput 
                        executes outputting commands given 
                        as command line arguments and exits
                  command - program reads user commands from std. input.
                        commands are:
                           help - help on commands
	--outputHtml prints to std output picture's html clickmap
        --outputRawGif ouputs to std output picture as gif file
        --outputRawGifAnim outputs to std output picture as gif 
        --outputRawPng outputs to std output picture as png file
        --outputRawSVG outputs to std output picture as SVG file
        --toGif=s outputs to given file as gif image
        --toGifAnim=s outputs to given file as gif animation
        --toPng=s outputs to given file as png image
        --toSVG=s outputs to given gile as SVG image
        --version prints out SWOG version
Switch --mode defines script execution mode, modes are:
none (default): script waits no input from user, all is defined by command-line switches
input: User has to enter SWOG picture to script input, Ctrl+D or #endInput finishes input mode and script continues to execute command-line parameters
command: mode, where user may enter commands
$perl bin/SWOG.pl --mode=command
commands are:
        debug  prints SWOG objects hashtable to std. output
        detect_click X Y  prints objects containing the given point
        help  prints this help message
        imageDimensions  prints out image width and height
        input  starts reading SWOG picture description, Ctrl+D changes
                back to command mode
        objectInfo obj-name  prints out object properties
        outputHtml  prints out HTML clickmap
        outputRawGif  prints gif to std. output
        outputRawGifAnim [temp-dir]  prints gif animation to std. 
        outputRawPng  prints png image to std. output
        outputRawSVG  prints SVG to std. output
        readObjects  filename reads SWOG picture file
        toGif filename  outputs to gif file
        toGifAnim [temp-dir] filename  outputs animation to gif file
        toPng filename  outputs to png file
        toSVG filename  outputs to SVG file
        version  prints out SWOG version
        quit  exits command mode and processes commands issued by 
                command line arguments

A simple example

To save SWOG code examples/simple.swog as PNG image simple.png:
perl bin/SWOG.pl --input=examples/simple.swog --toPng=simple

An example session

Start script in commands enter mode and read in SWOG file examples/simple.swog:
perl bin/SWOG.pl --input=examples/simple.swog --mode=command
Output the current picture to file names simple.png:
toPng simple
Move to input mode and add a string to the picture:
string 10,10 {smile!}
Finish input mode (back to command mode)
And enter the image to simple.png
toPng simple
And finish: