|
DESCRIPTIONPloticus is controlled by scripts that a user creates in a text editor. The scripts can also be created by other programs. EXAMPLEHere is an example of a ploticus script:
As you can see, this is not low-level 3GL-style code. It is a sort of hybrid; plotting actions (#procs) are specified in procedural order, but within each #proc the language is goal-driven (4GL). Thus, traditional procedural programming skills are not required. The above Ploticus script invokes a number of procedures (procs). First, proc areadef to set up a plotting area, then proc xaxis and yaxis to render the axes. Then proc getdata is invoked to define some data, and then finally proc bars is invoked to produce a bar graph. For each proc, the user may specify a various attributes or options. Attributes that are not specified use a default when possible. In the above example, the user has invoked proc areadef and specified values for these attributes: rectangle, xrange, and yrange. All of the procs, as well as the names, types, and acceptable values for all attributes, are described in the Ploticus Handbook (click here) SYNTAXComments: any line beginning with a double slash (//) is taken as a comment. Also, HTML tags and just about anything can be included as long as it is above the first #proc. Procedures are always invoked using this construct: #proc procname. The word #proc indicates the start of a procedure specification block; the other word is the name of a procedure (case insensitive). Attributes within a procedure may be specified in any order. A colon (:) may be used after an attribute name or a procedure name (however it is not required). All proc names and attribute names are case-insensitive. Attributes that are multiline text type are terminated by a blank (zero-length) line. Variables may be used within scripts. Variables may be named anything. Our convention is to use all capital letters, but this is not required. A number of variables are set automatically by ploticus for use in your scripts if desired. Otherwise, all variables must be #declared (see below) before use. The #set operator (see below) assigns values to variables. Variables may also be declared and set by supplying them on the ploticus command line as a var=value pair . When a variable is dereferenced, its name must begin with an at-sign (@). The at-sign is not used with #declare, #musthave, or #set. Functions may occasionally appear in scripts. They are usually used with the #set operator to produce a value, or in conditional expressions . Function calls always begin with a dollar sign ($). The construct is $name(arg1,..argn). Embedded spaces are not allowed anywhere in the function construct when used in conditional expressions, but they are allowed with #set. See also functions for a list of available built-in functions. Script Operators all begin with a pound sign (#). The most commonly used operators are #proc, #clone, and #saveas; many scripts use no script operators other than #proc. #clone objname
#declare varname [,varname2, varname3, etc.]
#exit
#hideund
#if conditional-expression
#include scriptname
#includesh command
#intrailer
#loop
#declare I #set I = 0 #loop #set I = $arith(@I+1) #if @I > 10 #break #endif #endloop #musthave varname [,varname2, varname3, etc.]
#proc procname
#procdef procname
#saveas objname
#set varname = value or function
#showund
|
![]() data display engine Copyright Steve Grubb ![]() |