Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ OverviewFortran Graphics System for the SC4020 (SCFOR)CAMP and CAMPER softwareComputer-animated movies (Anderson, 1970)Automating animation software (SPROGS)ANTICS animation software (1972)ANTICS (1973)ANTICS (1975)ANTICS manualCommand system for interactive graphics (PIGS)
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACLApplicationsGraphics :: Graphics at ACL
ACLApplicationsGraphics :: Graphics at ACL
ACL ACD C&A INF CCD CISD Archives
Further reading

Overview
Fortran Graphics System for the SC4020 (SCFOR)
CAMP and CAMPER software
Computer-animated movies (Anderson, 1970)
Automating animation software (SPROGS)
ANTICS animation software (1972)
ANTICS (1973)
ANTICS (1975)
ANTICS manual
Command system for interactive graphics (PIGS)

PIGS: a command system for interactive graphics

J R Gallop and W D Shaw

September 1975

Interactive Systems Conference

Abstract

PIGS is intended to help people write interactive graphics programs without requiring them to become systems programmers. PIGS organises the command flow from an operator to an interactive graphics application program and helps a programmer structure that application.

When the application is being used, the PIGS Run Time Environment (PRTE) presents a standard display layout to the operator with a list of his current choice of commands (the current menu), reads commands from one of several input devices, enters an application procedure associated with that command and presents to the operator a new menu on the display if required. When the application is being designed, the programmer provides a text description of each command and the organisation of commands into menus. This description (the MDL file or menu definition) is assembled to produce a binary discfile (Menu Binary or MNB file) containing all information about each command and menu.

The command structure can be easily reorganised; new commands and menus can be added at run-time.

PIGS

1. INTERACTIVE GRAPHICS; THE DIFFICULTY

An interactive graphics program allows an operator to specify a series of actions that he requires the computer to perform on his data. As a result of some actions an altered image appears on the display device. Each new image, since it tells (or should tell) the operator something he didn't know before, will certainly affect and hopefully guide the subsequent commands he makes to the program. In addition a well-written interactive graphics program shows the user his choices at each stage. This is in contrast to a batch program where the user summons a well-defined algorithm and receives the solution only when the algorithm halts. Thus interactive graphics programs are extremely valuable in problem situations where no explicit solution algorithm is known, but a set of helpful procedures is available. These procedures are selected and linked together by the actions of an operator/user.

In writing an interactive graphics program there are 3 problems which PIGS attempts to solve:

  1. There is a multitude of techniques of employing the interactive devices in order to specify an operator's intention. This tends to be more confusing than enlightening. An application programmer would profit by using a few well-structured tools in preference to a host of unorganised ones. In PIGS, the basic operator action is the command.
  2. The time taken to process a command on a modern satellite computer tends to be short. Thus the speed at which the operator can work depends mainly on ergonomic organisation of command choices. This tendency is accentuated by the fact that the ill-structured problems dealt with by computer graphics (for example "design a bridge") presuppose a good deal of false starts and backing up. The programmer may need to experiment with his command groupings before being satisfied with the application program. In PIGS, command groupings are expressed in one text file and are easy to alter.
  3. Even a simple interactive graphics program contains a large number of procedures. A program FONTS, for designing character fonts and using them to construct slides and title frames for films, was written at Atlas before PIGS was designed; it includes about 70 commands grouped into 10 menus. Such a program grows and changes. If there isn't an explicit command structure, the program will become increasingly difficult to modify.

2. STRUCTURE OF PIGS

PIGS is an attempt to address these three problems. Figure 1 illustrates its relationship to the component parts of the system. PIGS itself is represented by the 2 boxes in the figure, which correspond to the 2 phases: design (MENDEL) and operation (PRTE) of an application program.

It aids logical explanation to separate PIGS into these 2 phases even though:

  1. the application designer and the operator could reasonably be the same person,
  2. it is possible to amalgamate the 2 phases to a limited extent (section 7) and
  3. the 2 phases are identical with respect to keyboard syntax.

INPUT DEVICES COMMANDS PIGS RUN TIME ENVIRONMENT DISPLAY JUMP ADDRESS TABLE APPLICATION SUBROUTINES (FORTRAN) MENDEL ASSEMBLER APPLICATION PROGRAMMER'S DESCRIPTION OF MENUS (MDL FILE) DISC FILE (MNB FILE) MENUS

Figure 1

3. MACHINE ENVIRONMENT

PIGS was designed to run. on the PDP15/40 using DOS (Disc Operating System) and takes advantage of the fact that the hardware and software are more substantial than that of a basic minicomputer. Nonetheless, satellite computers are becoming more powerful and the number of computers for which the ideas of PIGS are suitable, is increasing. The hardware and software environment includes:

  1. a refreshed vector display with hardware characters (VTI5/VT04)
  2. interactive input devices: lightpen, sparkpen/writing tablet, read-only keyboard, teletype: all these are available as PIGS input devices: it is intended that a D-MAC digitizing table will also be available with PIGS,
  3. a 50Hz clock which is used to schedule commands,
  4. 32K words of core store (This has been recently increased to 64K, but this increased store will chiefly be used for a 2-user operating system RSX) and
  5. 1M words of fixed head disc: the disc is used to store the menu information and program overlays as well as the DOS system and the user's data.
  6. a FORTRAN IV compiler (the application procedures are written as FORTRAN subroutines. PIGS itself, although machine-dependent, is largely written in FORTRAN),
  7. random and serial-access filing system on disc (PIGS requires a random-access file to store menus, otherwise menu changes would be slow),
  8. FORTRAN-callable basic graphics routines,
  9. a facility to construct overlaid programs from relocatable binary files (the PIGS library is fairly large and would overflow core if overlays were not available), and
  10. a source text editor.

4. LAYOUT

Figure 2 shows the standard layout on the refreshed display used by a PIGS Graphics Application Program (GAP). This display is generated by the PIGS Run Time Environment (PRTE). The largest area, the Main Display-Area, is-not used by PIGS and is therefore free for the GAP to use. Moving clockwise, the 2 message areas can be used by both PIGS and the GAP via subroutines. Messages output to the error area blinks and cause the teletype bell to ring. Application programmers are encouraged to insert messages in the prompting area to guide the operator. The top right corner shows the menu name and exit command for the current menu. Below is a list of commands (or lightbuttons) which constitute the current menu. These choices are local in that they will disappear when a new menu is activated. Each command consists of a text string followed by an optional data display area. The GAP can alter the data areas using subroutines. Below the display area are 6 pushbuttons. These can be pressed to activate up to 6 local commands, whose names appear as prompts and also as lightbuttons. Above the pushbutton prompt, operator typing is echoed (the VT04 console keyboard is read-only). Any command typed on the keyboard is echoed here. The subroutine which reads keyboards and echoes typing is available to the GAP. Above the keyboard display area are 6 global lightbuttons; these survive menu changes and may be selected regardless of the current menu. The complete set of global commands includes the global lightbuttons and other globals which are not displayed and which therefore can only be keyed in or scheduled.

TO QUIT, PUSH BUTTON 1 AGAIN Prompting Messages ERROR 203 Error Messages (Blinking) DRAW 10,3_ Keyboard Input Display and Cursor PENAC YES ACCEP ***** Pushbuttons Lightbuttons (6) USEST VWA USEKE LTA SHOW2 QUIT !!!!! GLOBAL LIGHTBUTTONS (6) Lightpen Tracking Cross Main Display Area 1 2 3 4 5 6 MENU PATH INIT EXIT Control Lightbuttons (2) DRAW 3 PLAYB 1, 2 REDRA 2 DATACL USEGR YES BACKG Local Lightbuttons (16) COMMAND DATA AREAS OFFSET DISPLAY AREA STYLUS TRACKING DOT

Figure 1

5. RECOGNITION AND EXECUTION OF COMMANDS

5.1 Main control loop of PIGS

To discuss commands it is useful to trace the flow of control through PIGS as it processes a command. This is illustrated in Figure 3. The word required in this figure refers to a choice which the application programmer makes when he constructs the menu-definition (Section 6). The dotted arrows refer to the deferred argument capability (Section 5.3) which is not currently available in PIGS.

IS THERE A COMMAND? N Y IDENTIFY COMMAND AND PARSE ARGUMENTS FROM KEYBOARD BLINK LIGHTBUTTON AND DELAY IF REQUIRED ANY DEFERRED ARGUMENTS? Y N SAVE CURRENT MENU LOAD ARGUMENT GETTING MENU GET ALL DEFERRED ARGUMENTS RESTORE CURRENT MENU EXECUTE COMMAND VIA JUMP ADDRESS TABLE NEW MENU REQUIRED ? N Y AUTOMATIC EXIT COMMAND OF CURRENT MENU IF REQUIRED WRITE OUT CURRENT MENU IF REQUIRED FETCH NEW LOCAL COMMAND TABLE & MENU FROM DISC AUTOMATIC ENTRY COMMAND OF NEW MENU IF REQUIRED LOADER

Figure 3
5.2 Activation of a command

Assume a menu is displayed as in Figure 2, and that PIGS is waiting for a command. Four command sources are polled for a command from the user. These are the keyboard, lightbuttons, pushbuttons and the clock.

Two keyboards are available to PIGS, one produces hardcopy and the other doesn't. Only one keyboard is active at a time. The syntax of a keyboard command is described in section 5.3. An operator selects a lightbutton by picking one of the displayed command text-strings with a stylus device (the sparkpen/writing tablet or the lightpen). A tracking dot on the display follows the sparkpen; a lightbutton is picked if the operator depresses the pen when the dot is coincident with the lightbutton. Pushbutton commands (PENAC or ACCEP in figure 2) are entered by pressing one of the 6 buttons. Clock-initiated commands (any global or current local) can be scheduled at regular intervals for a fixed number of occurrences. For instance the application programmer can ensure that the database is regularly dumped. A scheduled command will only be initiated during polling.

When a command is entered, the lightbutton may blink for a set delay as a visual confirmation to the operator and to prevent inadvertent multiple hits. The application designer can instead indicate that the command be executed immediately, if suitable for the command; such a command might be rotate selected object by a preset amount.

Any PIGS device may be used for input by the application procedures using subroutines provided.

5.3 Syntax of a command and its arguments

The most general form of command which PIGS accepts is the keyboard command. Keyboard input is free format and consists of a command name followed by arguments separated by commas. An argument can be a string, a number, an array (not implemented currently), omitted or deferred (not implemented currently).

A string is entered simply as a sequence of characters unquoted or, if ambiguity is possible, enclosed in quotes. A command name is syntactically the same as a string. A number can be integer (decimal or octal) or floating point. For instance the following command line has one omitted argument, two numerical (# indicates octal) and one string argument:

POSITION,, 123.45^+3,#62,"# 62" <cr>

If PIGS receives the typed command,

SETPT,*,512 <cr>

it recognises that * is a deferred argument. It saves the current menu and displays a special menu of commands which retrieves arguments. This argument-getting menu might include commands to select an x-coordinate with a stylus, to read a typed string or to implement some of the standard lightpen techniques for inputting numbers (for instance thermometers or dials).

5.4 Execution of a command

Whatever the command source, PIGS reconciles the command and arguments to a standard form. For instance if the PLAYB command (which, say, is preset to expect 2 arguments) had been entered by hitting a lightbutton, PIGS would proceed as if

PLAYB,*,*<cr>

had been entered on the teletype.

After determining that all arguments have been specified, PIGS looks up the command name in a command table produced by the menu-definition. This table gives the location of an application procedure to be executed whenever that command is received. The procedure is part of the application and must be a FORTRAN or assembly language subroutine without formal arguments. Application procedures retrieve arguments from PIGS using a set of standard subroutines. The procedure does not need to know which device was the command source, but it can find out if this is useful.

The procedure could also be defined in other ways, for instance as a saved list of other commands. This would be suitable for an operator who wants to define as a macro a sequence of commands that are frequently used.

5.5 Swapping of menus

On return from the procedure, PIGS again examines the command table to see if a new menu is to be placed on the screen. If so, a command table for the specified new menu is read from disc, where the menu-definition assembler (MENDEL) placed it, and PIGS waits for a new command with a new set of local lightbuttons on the display.

The new command table overwrites the old when read into core. The application programmer can specify that the old command table be written to disc first in order to save changeable information like display data areas.

An exit procedure for the old menu and an entry procedure for the new are executed if required. In general, these simplify protection and book-keeping for each program state.

Note that the method of swapping menus does not necessarily imply a hierarchic ordering of menus. Unlike subroutines once a menu has been entered, PIGS itself has no memory of which menu was previously active. Thus there is no implied return to a calling menu. A return must be effected by an explicit call. An application programmer must ensure that entry and exit procedures for a menu are meaningful for all possible previous and next menus, respectively.

6. PROGRAMMING AN INTERACTIVE GRAPHICS SYSTEM USING PIGS

In designing a new interactive graphics program using PIGS, the application programmer needs to decide what commands are to be provided for the operator, write a procedure for each and write a file containing a menu-definition to organise the commands. The menu-definition must then, using the MENDEL program, be assembled to produce a series of command tables in a random access binary disc file (the MDB file) and a jump-address-table which relates each command in the application to the starting address of a procedure; the loader generates the correct absolute starting address. The application programmer then creates an executable overlay file which includes PIGS run-time subroutines, the application procedures and the jump-address-table.

Part of a sample menu-definition is shown in figure 4; this is part of a file input to MENDEL. Each line (apart from comments) starts with a keyword followed by commas and arguments, using the same syntax as described for PRTE in section 5.3. Procedure names are indicated here as SUB1, SUB2, etc, but could be any legal assembly language or FORTRAN symbol.

PART OF A SAMPLE MENU-DEFINITION
/
/MENDEL FILE FOR FONTS PROGRAM 
/COMMENTS PRECEDED BY 'I' 
CREAT, FONTS, 15, 60, 0      /ALLOW FOR 15 MENU'S, 60 SUBROUTINES 
KEYB, LTA                    /SPECIFY KEYBOARD 
STYLS, VWA                   /SPECIFY WRITING TABLET AS COMMAND STYLUS 
DELAY, 200                   /LIGHTBUTTON BLINKS BEFORE EXECUTING 
/MUST DECLARE MENU NAMES AND FORTRAN SUBROUTINES 
MNDEC, CONTROL, DEFINFRAM, BOROERFRA, CONSTRFRA, .....
SBDEC, SUB1, SUB2, .....
/
/GLOBALS IF REQUIRED
        .
        .
        .
/NOW DEFINE MENUS 
/'COM' DECLARES COMMAND NAME AND NUMBER OF ARGUMENTS 
/    DO, SUBROUTINE NAME SPECIFIES THE SUBROUTINE TO BE OBEYED 
/                        AFTER THE LIGHTBUTTON BLINKS 
/    GO, MENU-NAME       SPECIFIES A NEW MENU TO BE PRESENTED 
/                        TO THE END-USER 
/MENU 'CONTROL' IS DISPLAYED FIRST ON ENTRY 
/AND PRESENTS THE END-USER WITH A CHOICE OF SUBPROGRAMS 
MENU, CONTROL
        .
        .
        .
COM, DEFINFRAM, 0,,, GO, DEFINFRAM 
COM, PLOTFRAME,0,,, GO, PLOTFRAME 
COM, OUTFONT, 0,,, GO, OUTFONT 
/NOW DEFINE MENU TO SET UP FRAME INITIALLY 
MENU, DEFINFRAM 
COM, BORDERTYP, 0,,, G0, BORDERFRA 
COM, FONTNUMB, 1, DO, SUB1.., 'NONE' 
COM, CONTINUE, 0, DO, SUB2, GO, CONTSTRFRA 
/NOW DEFINE MENU TO DO BORDER 
MENU, BORDERFRA 
COM, MM16,, DO, SUB3, GO, DEFINFRAM 
COM, MM35SINGL,, DO, SUB4, GO, DEFINFRAM 
COM, MM35DOUBL,, DO, SUBS, GO, DEFINFRAM 
COM, NONE,,,, GO, DEFINFRAM
Figure 4

The application programmer may specify in the MENDEL program such PRTE options as whether the display is to have large or small characters, how long the lightbuttons are to blink for (section 5.2) and which stylus and keyboard are to be active initially. He must describe each menu to be included in detail.

Concerning each menu, the programmer must decide whether it should have entry and exit procedures (section 5.5) and whether pushbuttons should activate any of the local commands. He must also describe each command to be included in the local command display area.

Each command is declared in the menu-definition with a keyword COM. For each command, the programmer must specify:

  1. the command name (up to 9 characters),
  2. the maximum number of arguments,
  3. the name of the application procedure (if any) associated with the command, and whether the lightbutton is to blink before executing the procedure,
  4. whether the command is initially inactive (the application programmer can, by this means, allow or prevent certain command sequences),
  5. the name of a new menu (if any) to replace the current one (section 5.5); in the event of a menu change he must indicate whether the exit and entry procedures are to be executed, and
  6. the initial setting of the data-display-area (up to 9 characters).

Assembly of the menu definition file by MENDEL is a simple two-pass operation. It is extremely easy to alter most of the decisions initially made about the command structure - to regroup commands, for instance. All that need be done is to use the DOS text editor to alter the menu-definition, reassemble it and load the overlay file again with the new MNB file on disc. It is not necessary to reconstruct the overlay file (a more lengthy process) unless application procedures are to be added or edited.

7. DISTINCTION BETWEEN APPLICATION DESIGN AND APPLICATION USE

In section 2, a fairly rigid distinction was made between the 2 phases in which PIGS operates (MENDEL and PRTE). In fact it is possible for an operator to modify the GAP design at run-time if the application programmer allows certain internal PIGS routines to be summoned explicitly by command. In this way the operator can alter the MNB disc file at run-time to add new commands (provided no new application procedures are necessary), or alter the arrangement of commands in a menu.

8. MODULARITY OF PIGS

To avoid limiting the experienced package designer, the routines composing PIGS have been coded and documented for library usage and it is hoped that a designer can arrange to take control from PIGS and return it easily. There is a subroutine NMNU, for instance, which immediately changes to the specified menu and returns control to PIGS. Similarly, the polling routine can be run by a package procedure. Thus, a clever designer should be able to grab control from PIGS for elaborate interaction and return control when through.

9. CONCLUSION

PIGS does not cover all aspects of interactive control. A principal consideration in designing it has been to offer a useful interaction structure for novice package designers without needlessly limiting more experienced programming.

A first version of PIGS has now been implemented. With the small amount of experience gained so far, a few comments can be made.

  1. A useful debugging tool on the PDP15 is DDT which allows the programmer to stop the program at specified breakpoints and inspect variables. DDT is not available however with an overlaid program. A skimmed down version of PIGS (PIGLET) uses the teletype but does not use the display or any of the graphic input devices. PIGLET sends typed commands to application procedures in a manner compatible with PIGS and can be loaded with application procedures without overlays.
  2. The pushbuttons are useful in controlling the course of an application procedure while it is executing. To do this successfully with prompting captions for each pushbutton, seems to require more than superficial understanding of PIGS pushbutton routines.
  3. Lightpen selection and sketching of objects is still left to the application designer. The ability provided in some graphics systems to select an object instead of a text string to activate a command is not provided in PIGS itself; this could well be useful in something like a circuit design program. However, the application designer can employ PIGS subroutines to generate menus and detect hits on menus. The basic graphics package allows labelling of objects for the lightpen.
  4. The discrimination between command control features built into PIGS and those left to the application procedures appears to be successful in simplifying application programming. One consequence of using PIGS is that decisions about command control such as those outlined in section 6 are made explicit, where otherwise the inexperienced graphics programmer might have designed his application program in an ad hoc manner and produced a confusing and unmaintainable system.

Appendix 1 TERMINOLOGY

This appendix lists some terms that are used in PIGS and refers to a section where they are explained.

application procedure
5.4
command
5
command-source
5.2
data-display-area
4
deferred argument
5.3
DOS
3
GAP
4
global command
4
global lightbutton
4
jump-address-table
6
lightbutton
4
local command
4
MENDEL
2
menu
4
menu-definition
6
MNB file
6
PRTE
2

Appendix 2 REFERENCES

The work referred to in 1,2 and 3, below, addresses similar problems in interactive graphics. PIGS was influenced to some extent by the system of Butlin (Ref.2) but differs in design philosophy and because of different hardware and software configurations.

1 Boehm "POGO - Programmer-oriented Graphics Operation" (1969. AFIPS Vol.34 pp 321-330)

2. Butlin, G.A. "A FORTRAN package for interactive graphics" (1970. Advanced Computer Graphics3 (ed) Parslow and Green. pp 947-965)

3. Cotton, I.W. "Languages for attention handling" (1970. Advanced Computer Graphics3 (ed) Parslow and Green. pp 1049-1091)

4. Shaw, W.D. PIGS Manual (1974. SRC Atlas Computer Laboratory)

5. Shaw, W.D. PIGS - PDPI5 Interactive Graphics (1973. DECUS EUROPE Ninth Seminar Proceedings. pp 299-301)

⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site