"Applied Science, Faculty of"@en . "Electrical and Computer Engineering, Department of"@en . "DSpace"@en . "UBCV"@en . "Pieke\u00CC\u0081, Albertus Jacobus"@en . "2011-03-17T23:32:23Z"@en . "1973"@en . "Master of Applied Science - MASc"@en . "University of British Columbia"@en . "The design and implementation of the interactive graphics language IGL is described. This language not only allows the definition and display of line drawings but also has full facilities for manipulating, naming, identifying and interacting with such drawings. The language has been implemented as an extension to Fortran IV using the XPL compiler generator system. The experience gained so far in the use of the language has already proven a number of advantages over present-day graphics systems. The language is readily learned by users with previous high-level language experience. As no extensive testing and documentation is necessary due to the readability of the program, the time required for the completion of a project is greatly reduced."@en . "https://circle.library.ubc.ca/rest/handle/2429/32582?expand=metadata"@en . "DESIGN AND IMPLEMENTATION OF A HIGH-LEVEL LANGUAGE FOR INTERACTIVE COMPUTER GRAPHICS by Albertus Jacobus (Bert) Pieke* Diplom in E.E., ETH-Ziirich 1969 A THESIS SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF APPLIED SCIENCE in the Department of E l e c t r i c a l Engineering We accept this thesis as conforming to the required standard THE UNIVERSITY OF BRITISH COLUMBIA July 1973 In p r e s e n t i n g t h i s t h e s i s i n p a r t i a l f u l f i l m e n t o f the requirements f o r an advanced degree a t the U n i v e r s i t y o f B r i t i s h Columbia, I agree t h a t the L i b r a r y s h a l l make i t f r e e l y a v a i l a b l e f o r r e f e r e n c e and study. I f u r t h e r agree t h a t p e r m i s s i o n f o r e x t e n s i v e c o p y i n g o f t h i s t h e s i s by h i s r e p r e s e n t a t i v e s . I t i s understood t h a t c o p y i n g or p u b l i c a t i o n of t h i s t h e s i s f o r f i n a n c i a l g a i n s h a l l not be allowed without my w r i t t e n p e r m i s s i o n . Department o f ^L\u00E2\u0082\u00ACy>. C A L /\u00E2\u0082\u00ACAJ: END; allows a scan of a l l items with the name , which are l i n k e d by a d d i t i o n a l \"buddy\"-pointers, to determine whether any of those items were wit h i n a tolerance region ( s p e c i f i e d by the x and y-scale of the item) around the cursor l o c a t i o n . 4.4 System Configuration Two implementations are used at t h i s u n i v e r s i t y . One runs under the MTS timesharing system on an IBM 360/67 with an Adage/10 graphics terminal, Calcomp and l i n e - p r i n t e r p l o t t e r s . This system i s used mainly for debugging new programs. The other system runs under 18 .DOS on a Data General 20k Supernova with a Tektronix 4010 graphics terminal. Graphics programs can be run on e i t h e r system without mo f i c a t i o n . 19 5. IGLCOM, AN IGL COMPILER IGLCOM, the IGL compiler used i n t h i s implementation was w r i t t e n using the XPL compiler w r i t i n g system [12]. This i s a w e l l documented and easy to use program package w r i t -ten i n the XPL d i a l e c t of PL/I. To b u i l d a compiler using the XPL system, the language syntax i n Backus Naur notation (BNF) and the corresponding semantics i n XPL must be supplied. These two user components are pro-cessed as follows. The syntax i s read i n , p r i n t e d , analyzed and a parser i s punched out by the XPL program ANALYZER. ANALYZER w i l l check that the grammar i s unambiguous and w i l l attempt to modify the grammar i f that i s not the case. The produced parser i s i n a format that allows i t to be d i r e c t l y i n s e r t e d i n t o a compiler framework c a l l e d SKELETON. SKELETON i t s e l f i s w r i t t e n i n XPL and has two open s l o t s , one f o r accepting the parser from ANALYZER and one f o r acepting the se-mantics. When these two components have been added, SKELETON can be compiled by the XPL compiler producing f o r the input grammar a compiler i n object code. The semantics are written as an XPL procedure named SYNTHESIZE. This procedure i s c a l l e d i n SKELETON each time a grammar ru l e i s applied by the parser for reducing the input s t r i n g . The number of the p a r t i -cular rule applied i s passed along as an argument. In SYNTHESIZE the output language i s generated. I f the output i s i n a high l e v e l language, the output statements w i l l usually consist of c a l l s to semantic routines. I f the output i s i n assembly language, the actions can be generated d i r e c t l y . For passing names from, the input to the output language, SYNTHESIZE has access to the contents of the parsing stacks. Pointers 20 are kept by SKELETON to show the current state of these stacks. This automation of the compiler-writing process allows changes to the language to be c a r r i e d out e a s i l y when needed. The syntax and the corresponding semantics can be updated independently of one another. Compilers generated by the XPL system provide good e r r o r checking f a c i l i -t i e s and have proven to be quite e f f i c i e n t . Complete l i s t i n g s of the IGL syntax d e s c r i p t i o n i n BNF and of the SYNTHESIZE routines can be found i n Appendix C of t h i s t h e s i s . 21 6. IGLRUNLIB, AN IGL RUNTIME LIBRARY The routines i n IGLRUNLIB maintain a datastructure, represen-t i n g the p i c t o r i a l information created by the executing IGL program, and handle the communication with the graphics terminal. 6.1 Datastructure The o v e r a l l datastructure has been introduced i n Chapter 4. I t consists of a l i n k e d l i s t of datablocks, addressable through a hash-coded d i r e c t o r y . The d i r e c t o r y contains the name, the l o c a t i o n of the f i r s t d e f i n i t i o n datablock and the l o c a t i o n of the f i r s t datablock that references that d e f i n i t i o n f or every named item. The p r i m i t i v e s , de-f i n e d i n the language, are flagged i n the d i r e c t o r y to prevent t h e i r a l t e r a t i o n by the program. Datablocks The datablocks contain the l o c a t i o n (xloc, yloc), s c a l i n g (xscale, y s c a l e ) , r o t a t i o n (angle), and subscript (tag) of a p i c t u r e item, aid three pointers as l i n k s to other items. 22 xloc, y l o c xscale,yscale angle, tag BROTHER BUDDY SON A datablock The son-pointer l i n k s the datablock to i t s d e f i n i t i o n block(s) i n the stru c t u r e . It i s a one-way pointer; no pointers l i n k \"sons\" back to \"fathers\". The datablocks for the p r i m i t i v e s have son-pointers that point to t h e i r graphical d e s c r i p t i o n i n an array of (x,y,ipen) t r i p l e s . To d i s t i n g u i s h t h i s pointer from normal son-pointers, a value of 10,000 i s added to i t s correct value. Example: * A:= SQUARE SCALE .1; B:= A ANGLE 45; A X SQUARE / B 0 X Y i SQUARE i s here a son of A, who i s i n turn a son of B. 23 The brother pointer l i n k s together datablocks that are l o g i -c a l l y connected by the (+) operator. The end of the l i n k i s i n d i c a t e d by a zero entry. Brother pointers e x i s t on two l e v e l s : \"stronger\" l i n k s within the d e f i n i t i o n of subscripted v a r i a b l e s and \"weaker\" l i n k s within the d e f i n i t i o n of unsubscripted v a r i a b l e s . This allows a two l e v e l hierarchy within a l i n e a r l i s t . Example: * E(2):= A + B; C:= E(2) + A; C The statement: * C:= C-E(2); would now cause the de l e t i o n of both of the f i r s t two blocks i n C, as they are l i n k e d by the stronger l i n k s . The t h i r d block, however, w i l l be retained as i t i s l i n k e d by a weaker l i n k , meaning that although i t i s part of C, i t i s not a part of E ( 2 ) . The buddy pointer l i n k s together datablocks that have the same name. They are e s s e n t i a l f o r access to any item given by name and 24 su b s c r i p t . This access i s accomplished as follows: The name i s looked up i n the di r e c t o r y , where the l o c a t i o n of the f i r s t d e f i n i t i o n and refer-encing block i s found. A sequential search of a l l blocks with that name i s made by following the buddy pointers. A comparison between the stored \"tag\" i n the datablock and the subscript given allows the item to be i d e n t i f i e d . As the buddy pointers are l i n k e d i n a closed r i n g , the end of an unsuccessful search i s determined when returning to the f i r s t block. Example: * C:= E ( l ) + E(2) ; D:= E(3); C E(2) 1 brother \ son son \ D ' buddy / son 6.2 Display Algorithm For d i s p l a y i n g a p i c t u r e , the information i n the data struc-ture has to be transformed into a l i n e a r sequence of beam or pen move-ments on the display device. * In the following the terms father, son and brother are de-fin e d as shown: 25 B A x ^ A i s the f a t h e r of B and C \u00E2\u0080\u00A2 B i s the f i r s t son of A / i \ 1 1 C i s B's brother The a l g o r i t h m i s the f o l l o w i n g : S t a r t i n g a t the image to be d i s p l a y e d , the f i r s t son (subimage) i s taken and the v a l u a t i o n of the f a t h e r ap-p l i e d . The v a l u a t i o n i s the set of a t t r i b u t e s : (XLOC, YLOC, XSCALE, YSCALE, ANGLE). This i s c a r r i e d out r e p e t i t i v e l y u n t i l a p r i m i t i v e i s encountered, the intermediate steps being saved i n a push-down stack. Then the p r i m i t i v e i s d i s p l a y e d using the accumulated t r a n s f o r m a t i o n s . A f t e r t h i s , the top item i n the push-down stack i s popped up and i t i s t r e a t e d as a new s t a r t i n g image. This process i s stopped when the s t a c k i s empty and a l l brothers of the o r i g i n a l f a t h e r have been considered. The process i s i l l u s t r a t e d by the f l o w c h a r t i n F i g . 2. In order to be able to apply a f a t h e r ' s v a l u a t i o n to h i s son we must consider the f o l l o w i n g : The v a l u a t i o n i n v o l v e s a SCALING, ROTATION and TRANSLATION of some p o i n t P (X,Y) i n a coordinate system. The equations f o r t h i s t r a n s f o r m a t i o n are: X = (X - 0.5) XSCALE ' COSa - (Y - 0.5) YSCALE \u00E2\u0080\u00A2 ' SINct + XLOC Y = (X - 0.5) XSCALE \u00E2\u0080\u00A2 SINa + (Y - 0.5) YSCALE * COSa + YLOC or: P = [A] ' P + [B] where: XSCALE \u00E2\u0080\u00A2 COSa [A] = XSCALE ' SINa -YSCALE \u00E2\u0080\u00A2 SINa YSCALE * COSa DISPLAY 'NAME' Get pointer to 'NAME*' Push down into stack Get f i r s t son Figure 2: DISPLAY algorithm 27 [B] = Storing the valuation as ([A], [B]) rather than as (XLOC, YLOC, XSCALE, YSCALE, a) allows us to apply one v a l u a t i o n (A^, B^) to another (A g, B g ) . P = A, P + B. = A\u00E2\u0080\u009E (A P + B ) + B.. f f f v s s f = A. A P + A. B + B = A P + B f s f s f ->- A = A \u00C2\u00A3 \u00E2\u0080\u00A2 A f s B = A\u00C2\u00A3 B + B \u00C2\u00A3 f s f For t h i s reason the i n t e r n a l representation of the v a l u a t i o n components i s a sextuplet (A^^, A^^, A^> -^22' B l ' B2^ r a t n e r t n a n the quintuplet used i n the IGL-syntax. 6.3 Terminal Interface The communication with the graphics terminal takes place on a l o g i c a l l e v e l , using a coordinate system of 1.0 by 1.0 as defined i n the language. Keeping this i n t e r f a c e on a l o g i c a l l e v e l , rather than on a p h y s i c a l l e v e l , makes i t r e l a t i v e l y easy to i n t e r f a c e to d i f f e r e n t terminals. The l o g i c a l terminal i s assumed to be capable of four things: - erase the screen - move the beam or draw a vector from the current beam p o s i t i o n to l o c a t i o n X,Y - display a t e x t s t r i n g of n characters, s t a r t i n g at l o c a t i o n X,Y - display a cursor on the screen, wait for the user to p o s i t i o n the cursor, return the X,Y coordinates of the cursor, and the vrnr J. YSCALE \u00E2\u0080\u00A2 SINa - XSCALE \u00E2\u0080\u00A2 COSa XSCALE \u00E2\u0080\u00A2 SINa + YSCALE \u00E2\u0080\u00A2 COSa 28 charactercode of the button pushed by the user to in d i c a t e his i n t e r r u p t . The c a l l i n g sequences are: CALL ERASE IPEN = 0: move beam CALL VECTOR (X,Y,IPEN) IPEN = 1: draw vector CALL DISPS (ITEXT, X.Y.N) CALL WAITIN COMMON/CURSOR/IDUMMY, X,Y, KEYHIT Any other input/output can be programmed using conventional Fortran WRITE and READ statements. 29 7. IMPLEMENTATION OF IGL ON A DATA GENERAL SUPERNOVA MINICOMPUTER Although, during the implementation phase, every effort was made to keep the programs hardware independent, i t was unavoidable that the particular computer system used had some influence on the decisions that were made. The most far-reaching decision was made in choosing Fortran as programming language for the runtime library. Although the language Fortran IV was standardized by ASA i n 1964 [7], a combination of practical considerations and the ambiguities in the published description of the language have led to the present situation, where the Fortran compilers supplied by computer manufacturers include most ( i f not a l l ) features of ASA Fortran and, to make up for any deficiencies, usually offer added on special features not found i n ASA Fortran. The average user of such a compiler w i l l tend to regard his particular expanded subset of ASA Fortran as the \"only Fortran\" and distrust any other implementa-tions of the language. This i s particularly the case i f the implementa-tion used is the IBM Fortran IV G-level compiler, regarded by many as the ultimate definition of the Fortran language. The runtime library was written in a subset of Fortran common to the IBM and Data General compilers. These routines can thus be executed on either computer without modification. This fact does not insure, however, that these routines w i l l execute on any computer due to the above reasons. Only the routines that communicate with the graphics terminal differ in the two implementations. The routines for the Tektronix 4010 terminal are written in assembler. They were supplied with the terminal 30 and are documented by Tektronix. The routines for the Adage/10 terminal are written i n Fortran using the UBC AGT:BASIC support package and can be found i n Appendix D of this t h e s i s . The same r e s t r i c t i o n s that apply to the runtime l i b r a r y apply to any user program written i n IGL. A program that w i l l execute c o r r e c t l y on the IBM 360 may not do so on the Supernova. The Users' Guide l i s t s some of the points to be watched when w r i t i n g a program, most of which need not concern us here. There are a few points, though, that are of more general i n t e r e s t and may apply to a number of computers. Wordlength - Many t h i r d generation computers have followed the example of the IBM 360 system, using a wordlength of 32 b i t s (4 bytes), divided i n t o 2 halfwords of 16 b i t s (2 bytes). Fortran compilers on these machines t y p i c a l l y allow integer wordlengths of one word (INTEGER*4) or of one halfword (INTEGERS) . For numerical algorithms t h i s f a c t i s of no great s i g n i f i c a n c e as long as i t i s kept i n mind that the l a r g e s t allowable INTEGER*2 value i s 32767, which may be quite low f o r many problems. More noticeable i s the e f f e c t on the character handling c a p a b i l i t i e s , which i n Fortran are l i n k e d to the integer wordlength. Many minicomputers are organized around a wordlength of 16 b i t s , which leaves them with the r e s t r i c t i o n of allowing only INTEGER*2 values. The Supernova i s an example. To be compatible between the two machines, only 16 b i t integers should be used f o r character manipulation. These facts n a t u r a l l y l i m i t the p o r t a b i l i t y of any Fortran program from one computer i n s t a l l a t i o n to another, but i n t e r a c t i v e programs e s p e c i a l l y are dependent on character handling for evaluating responses and values typed i n by the user. 31 Storage - 16 b i t machines are designed to use two computer words for s t o r i n g a f l o a t i n g point value. One word would not permit s u f f i c i e n t accuracy. This means that the storage of REAL values uses twice the amount of space needed for s t o r i n g the same number of INTEGER values. For t h i s reason, a l l arrays representing the IGL datastructure are stored as integer values. This i s at a cost i n accuracy (4-5 versus 7 decimal p l a c e s ) , a cost i n conversion f o r arithmetic operations, and at the r i s k of integer overflow i f unexpected large values should occur. Another problem i n storage on a minicomputer i s the very f i n i t e s i z e of the main memory. Designers of operating systems and programmers of large programs have resorted to various techniques of using a v a i l a b l e external storage space ( f i x e d or moving head disk) to augment the power of the main (core or semiconductor) memory. The simplest technique i s to keep part of the data used on external storage and read i t i n every time i t i s to be used. Another p o s s i b i l i t y i s to keep part of the program to be executed on external storage and read i t i n t o the main memory when needed; t h i s scheme i s generally r e f e r r e d to as overlaying. The Data General disk operating system allows up to 6 l e v e l s of overlays and i n addition allows chaining of segments. To understand the difference between these two methods, we consider the following example. 32 1) Routine A - T - A 2) Routine A CALL B CALL C A CALL B B END END Routine B __ C B CALL C END C We assume that any of the routines A-D w i l l f i t i n t o the main memory separately, but no two routines w i l l f i t i n together. Each routine i s now considered a separate program segment. In case 1), the execution of segment A must be suspended f o r segment B to be brought i n t o core. When B has f i n i s h e d , A can continue. As A, however, would be over-w r i t t e n by B, i t must f i r s t be saved. An overlay thus i n v o l v e s : - saving the current segment A - loading the needed segment B - s t a r t i n g the execution of B. A return from overlay involves: - reloading the previous segment A - r e s t a r t i n g the execution of A at the l o c a t i o n where the In case 2), the execution of segment A i s f i n i s h e d when segment B i s needed. There i s thus no need to save A, and B can be loaded d i r e c t l y . This process i s c a l l e d chaining. A chaining involves: - loading the needed segment B execution was suspended. 33 - s t a r t i n g the execution of B. A r e t u r n from ch a i n i n g does not e x i s t . The communication between segments i s only p o s s i b l e through the BLANK COMMON area, the only p a r t of core that i s n e i t h e r saved nor r e s t o r e d when executing an overlay. (Communication by saving r e l e v a n t data on e x t e r n a l storage i s of course always p o s s i b l e ) . The present v e r s i o n of DOS (r e l e a s e 5) w i l l , however (contr a r y to i t s d e s c r i p t i o n ) , s t o r e and l o a d a l l of core, i n c l u d i n g blank common. This can be pre-vented by c a l l i n g the i n i t i a l i z a t i o n r o u t i n e INCOM, des c r i b e d i n Ap-pendix D. T h e . d i v i s i o n of an IGL program i n t o s t a t e s makes an automatic o v e r l a y i n g scheme f e a s i b l e . Each s t a t e corresponds to a separate ov e r l a y segment. As no r e t u r n to a previous s t a t e i s provided f o r i n the IGL syntax, segments can be chained. Apart from savin g time ( c h a i n i n g : 3 s e c , o v e r l a y : 7 sec. i n our system), the c h a i n i n g allows the execution to proceed at the same l e v e l i n DOS, thus s e t t i n g no l i m i t to the number of s t a t e s to be executed. The IGL compiler t r a n s -l a t e s the goto statement: GOTO STATE n i n t o : CALL CHAIN ('STAT n.SV'), where n i s the number of the s t a t e to be executed. (n = n f o r n > 9, ii = 0 n f o r n $ 9) . Because of the l i m i t e d storage s i z e of 20k words main memory, i t was i n i t i a l l y found t h a t the runtime l i b r a r y was t a k i n g up too much space, l e a v i n g only a m i n i s c u l e amount f o r the user program. The s o l u -t i o n has been t o move the d i s p l a y and e r r o r r o u t i n e s to separate o v e r l a y segments. This i s r e g r e t t a b l e , as the d i s p l a y r o u t i n e s are c a l l e d o f t e n , and executing an overlay f o r each d i s p l a y command causes a very n o t i c e a b l e pause i n the i n t e r a c t i o n . 34 For an analysis of th i s situation., i t i s useful to examine the storage a l l o c a t i o n within the main memory and see which parameters can be varied. With an IGL program executing, the main memory of the computer i s roughly divided up as follows: Page zero and Fortran addresses .5 k IGL user program 1.5 k * IGLRUNLIB 4.5k(*) Fortran runtime l i b r a r y 4 k DOS stacks 1 k BLANK COMMON 2.5 k * DOS SYSTEM 6 k 20 k Of these sections, only the s t a r r e d values are v a r i a b l e , a l l others -are f i x e d , regardless of program s i z e . What would now be the e f f e c t of increasing the memory s i z e by 4k to 24 k words? The following changes could be made to the current implementation: - The display routines are added to the main segment (1.5 k) - The BLANK COMMON area and user program are allowed an a d d i t i o n a l 2.5 k. This would mean instant response to a display command, more data storage and la r g e r (and hopefully more i n t e r e s t i n g ) a p p l i c a t i o n s . The present implementation i s s u c c e s s f u l , i n as f a r as i t proves that an IGL system can be implemented and used on a moderately small machine. For the system to be t r u l y convenient and s u f f i c i e n t l y powerful f o r r e a l world a p p l i c a t i o n s , however, a minimum storage s i z e of 24 k words i s absolutely necessary. 35 8. EXPERIENCE WITH USING THE IMPLEMENTED IGL SYSTEM The f l e x i b i l i t y and ease of use make the language IGL i d e a l f o r experimenting with new graphics techniques and ideas. To gain ex-perience with the system, se v e r a l applications were programmed by d i f -ferent users. (See Appendix B). F i r s t p rojects were a program for drawing e l e c t r o n i c c i r c u i t s and a load flow program f o r the analysis of power systems [3]. In two 12 week systems lab p r o j e c t s , groups of fourth year students i n this department implemented complete i n t e r -a c t i v e systems; one for i n t e r a c t i v e p r o j e c t scheduling using CPM methods and one f o r i n t e r a c t i v e nonlinear c i r c u i t a n a l y s i s , [17]. Both systems run on a minicomputer i n t h i s department and i n t e r f a c e to analysis programs on the IBM 360 i n s t a l l a t i o n i n the Computer Centre. A voice grade data l i n k i s used for transmitting data from one computer to another. The experience gained so f a r i n the use of the language has already proven a number of advantages over present-day graphics systems. Due to the d e f i n i t i o n of the syntax and the semantics, changes of these are e a s i l y incorporated as experience i s gained i n the use of the language. The system has been found f a r easier to use than the graphical subroutine packages found on most computer i n s t a l l a t i o n s . The language i s r e a d i l y learned by users with previous h i g h - l e v e l language experience. As no extensive t e s t i n g and.documentation i s necessary due to the r e a d a b i l i t y of the program, the time required for the completion of a project i s greatly reduced. Furthermore, the a v a i l a b i l i t y of a new powerful t o o l stimulates the imagination of the user to tackle pro-blems previously considered out of reach. 36 9. BIBLIOGRAPHY U n t i l recently, l i t t l e i n t e r a c t i o n has taken place between the d i f f e r e n t workers i n the f i e l d of Computer Graphics. No textbooks e x i s -ted on graphics and a r t i c l e s were scattered throughout various p u b l i c a -tions such as Communications of the ACM, Computing Surveys, AFIPS con-ference proceedings etc. However, i n 1970 a f i r s t conference was held on Computer Graphics at Brunei University. In 19 72, the jou r n a l \"Computer Graphics and Image Processing\" appeared and a working conference on Graphic Languages was held by IFIPS at the Un i v e r s i t y of B.C. F i n a l l y , an excel l e n t textbook has appeared i n 1973, \" P r i n c i p l e s of I n t e r a c t i v e Computer Graphics\", by W.H. Newman, that contains the essence of a way of thinking about computer graphics that was developed over the l a s t 10 years. 37 REFERENCES 1. P. B o u l l i e r et a l . , \"METAVISU, A general purpose graphic system\", i n F. Nake,. A. Rosenfeld, Eds., Graphic Languages, Amsterdam: North-Holland Publ. Co., 1972. 2. I.W. Cotton, R.S. Greatorex, \"Data structures and techniques f o r re-mote computer graphics\", AFIPS Proc. FJCC, 1968. 3. B.A. Dixon, \"Interactive Graphical Load Flow\", submitted to: I n t e r -n a t i o n a l E l e c t r i c a l , E l e c t r o n i c s Conference and Exposition, Toronto, Oct. 1973. 4. J.D. Duf f i n , \"A language f o r l i n e drawing\", Tech. Rep. #20, Comp. Sc. Dept., U. of Toronto, May 1970. 5. A.J. Frank, \" B - l i n e , B e l l l i n e draining language\", AFIPS Proc. FJCC, 1968. 6. \"Grapple - Graphical Programming Language Reference Manual\", B e l l -Northern Research, Feb. 19 72. 7. \"History and Summary of FORTRAN standardization development f o r the ASA\". Comm. ACM, Oct. 1964. 8. IFIP Working Conference on Graphic Languages, i n F. Nake, A. Rosen-f e l d Eds., Graphic Languages, Amsterdam: North-Holland Publ. Co., 1972. 9. D.E. Knuth, The Art of Computer Programming, V o l . 1, Addison-Wesley, 1969. 10. H.E. Kulsrud, \"A general purpose Graphic Language\", Comm. ACM, A p r i l 1968. 11. W.D. Maurer, \"An improved Hash Code f or s c a t t e r storage\", Comm. ACM, January 1968. 12. W.M. McKeeman et a l . , A Compiler Generator, P r e n t i c e - H a l l , 1970. 13. W.F. M i l l e r , A.C. Shaw, \" L i n g u i s t i c methods i n p i c t u r e processing -A survey\", AFIPS Proc. FJCC, 1968. *\u00E2\u0080\u00A2 14. F. Nake, \"A proposed language f o r the d e f i n i t i o n of a r b i t r a r y two-dimensional signs\" i n 0.1. Grusser, R. Klinke, Eds., Zeichenerkennung i n biologischen und technischen Systemen. B e r l i n : Springer, 19 71. 15. W.M. Newman, \"A system for i n t e r a c t i v e graphical programming\", AFIPS Proc. SJCC, 1968. 16. W.M. Newman, R.F. S p r o u l l , P r i n c i p l e s of Int e r a c t i v e Computer Graphics, McGraw-Hill, 19 73. 38 17. B. Pieke, G.F. Schrack, \"I n t e r a c t i v e c i r c u i t analysis using a high-l e v e l graphics language\", 16th Midwest Symposium on C i r c u i t Theory, Waterloo, 1973. 18. M.D. Prince, I n t e r a c t i v e Graphics for_Computer-Aided Design, Addison-Wesley, 1971. 19. S. Semrau, \"PDP-9 c i r c u i t input program\", E.E. Dept., U. of B r i t i s h Columbia, 19 71. 20. I.E. Sutherland, \"SKETCHPAD - A man-machine graphical communication system\", AFIPS Proc. SJCC, 1963. 21. R. Williams, \"Asurvey of data structures f o r computer graphics systems\", Computing Surveys, March 1971. APPENDICES 40 APPENDIX A: IGL USERS' GUIDE 1. Introduction IGL i s an acronym f or In t e r a c t i v e Graphics Language, a com-puter language for w r i t i n g programs for handling l i n e drawings. This language not only allows the d e f i n i t i o n and display of l i n e drawings, but also has f u l l f a c i l i t i e s f o r manipulating, naming, i d e n t i f y i n g and i n t e r a c t i n g with such drawings. The IGL system consists of IGLCOM, the IGL compiler, and IGLRUNLIB, the IGL runtime l i b r a r y . 2. The IGL Language The d e f i n i t i o n of the IGL language has been formally given i n BNF notation, but t h i s d e f i n i t i o n should not be required reading f o r the average user. Instead, this users' guide w i l l attempt to introduce the language i n a less formal manner, using examples to explain the use of IGL statements. IGL has been implemented as an extension to Fortran IV, allow-ing the user to mix Fortran IV and IGL statements i n the same program. IGL statements are recognized by the IGL compiler by examining the f i r s t column of each l i n e . The characters . {_, 0, 1...9, C, A, X} i n d i -cate a Fortran statement, any other character an IGL statement. In a l l examples i n t h i s manual, the character * w i l l be used to i n d i c a t e IGL statements. The rules f o r the coding of IGL statements do not follow the Fortran convention. IGL statements can be w r i t t e n i n free format, with no regard f o r card boundaries. One rule should be followed, however. Keywords i n e i t h e r Fortran or IGL are considered to be reserved words. 41 They cannot be used as var i a b l e names and must be written without im-bedded blanks. Keywords should be separated by at l e a s t one blank. Example: RE~AD, which i s l e g a l i n IBM Fortran IV i s not l e g a l i n an IGL program. 3. Writing an IGL Program An IGL program i s divided up into s t a t e s , each state corres-ponds to a l o g i c a l state i n the i n t e r a c t i o n . Consider the following example: A 'rubber-band' l i n e can be created by means of a joy-s t i c k and a push-button i n a sequence of f i v e operations. 1) press button to turn on cursor; . 2) move cursor, using j o y s t i c k , to s t a r t i n g point of l i n e ; 3) press button to f i x s t a r t i n g point; 4) move cursor to end point of l i n e ; 5) press button to f i x end point. A state diagram might look as seen on the next page. Here a feature i s added to allow d e l e t i o n of l i n e s and to continue drawing l i n e s from the l a s t endpoint. Each of the 5 states shown represents a d i f f e r e n t stage i n the i n t e r a c t i o n . This can be seen by the meaning of the push-button i n each s t a t e . i n state 2 i t means: F i x the s t a r t i n g point of a new l i n e , and the end point of the l i n e i n s t ate 4 : Execute a command from the menu i n state 5 : Delete the l i n e that i s pointed to An IGL program that corresponds to t h i s state diagram would look as follows: 42 STATE DIAGRAM (creating a 'rubber-band' drawing) f INITIALISATIONS I press button f o r d e l e t i o n 43 * STATE H C C \u00E2\u0080\u0094 IN IT IALISATIONS ' C COMMON X i , X ? , Y l , Y 2 , I * NEWLINE J = 'Nf;w L INE>; DELETE J = I DELETE I ; * DRAWING\u00C2\u00BB=NEWLINE SCALE , 1 , , 1 AT 1 , 1 5 , , 8 + DELETE SCALE , 1 # , 1 AT 1 , 1 5 , , 6 ; 1 = 0 X1 = 0 , Y1 = 0, PAUSE 'PRESS BUTTON I * ERASE SCREEN? DISPLAY DRAWING; GOTO STATE 2 ; END STATE 1; * STATE 2J C C \u00E2\u0080\u0094\u00C2\u00AB\u00C2\u00BB STORING STARTING AND ENDING POINT OF A LINE C COMMON X 1 , X 2 , Y 1 , Y 2 , I * CURSOR ON; WAIT FOR INTERRUPT; X1=XHIT Y1=YHIT * DISPLAY DOT AT X I , Y l ; * CURSOR ON; WAIT FOR INTERRUPT; X2=XHIT Y2=YHIT * GOTO STATE 3; END STATE 2; * STATE 3j C . . . . . . . . . . . C - ~ * ADDING LINE TO DRAWING C COMMON X l , X 2 , Y i , Y 2 , I 1 = 1 + 1 * L C I ) : = L I N b FROM X I , Y l TO X 2 , Y 2 ; DISPLAY L U ) ; * DRAWING:=DRAWING + L C I ) ; * GOTO STATE 4; ENU STATE 3; * STATE 4 : C C \u00E2\u0080\u0094 CHOOSING FROM MENU C COMMON X 1 , X 2 , Y 1 , Y 2 , I * CURSOR ON; WAIT FOR INTERRUPT; * FOR HIT ON NEWLINE: GOTO STATE 2; END; * FOR HIT ON D E L E T E : GOTO STATE 5; END; X1=X2 Y1=Y2 X2=XHIT Y2=YHIT * GOTO STATE 3; END STATE 4; * STATE 5 : C C \u00E2\u0080\u0094 - DELETING A LINE C COMMON XI , X 2 , Y 1 , Y 2 , I * DISPLAY 'CHOOSE LINES TO BE DELETED' AT , 2 , , 9 ; 1 CONTINUE * CURSOR ON; WAIT FOR INTERRUPT; * FOR HIT ON L l DRAWING f= DRAW1NG-L(I HIT) ; GOTO 1 * END; * ERASE SCREEN; DISPLAY DRAWING; GOTO STATE 2> * END STATE 5; * EOF EOF EOF 44 This example shows how the i n t e r a c t i o n can be programmed i n IGL and already uses most of the statement types to be described below. A number of points should be noted here, however. - The program i s divided i n t o states of which the f i r s t to be executed must be STATE 1. - Fortran variables can be passed between states using BLANK COMMON only. The length of BLANK COMMON areas must be declared equal i n a l l s t a t e s . - Fortran statement numbers are l o c a l to st a t e s . - A l l statements i n IGL are terminated using a semicolon (;). Cons tants There are.two types of image constants i n IGL: p i c t u r e con-stants and l i t e r a l constants. Picture constants form the set {BLANK, LINE, DOT, SQUARE, TRIANGLE, CIRCLE, HCIRCLE} and are defined as shown below. BLANK LINE DOT SQUARE TRIANGLE CIRCLE HCIRCLE L i t e r a l constants are t e x t s t r i n g s , delimited by quotemarks. They can have a maximum length of 10 characters. Functions are provided to convert Fortran values to corres-ponding IGL image values. 45 VALUE converts an integer value TEXT converts an integer v a r i a b l e containing a t e x t s t r i n g . (The s t r i n g i s assumed to be 10 characters long). Example: 'DELETE', 'HI, THERE', VALUE (3) or TEXT (ITEXT) are l i t e r a l constants. Variables Image va r i a b l e s stand f o r p i c t u r e s and/or l i t e r a l s and can be assigned image values. They are named according to the Fortran rules f o r v a r i a b l e names, but can have up to 8 characters. Example: DELETE or RESISTOR are l e g a l v a r i a b l e names. Assignments ] Image variables are assigned values using an assignment s t a t e -ment. The image assignment operator i s the (:=). A l l values on the ri g h t hand side of the assignment must have been previously defined. Example: * DELETE:= 'DELETE'; A:= SQUARE; B:= VALUE (13); Modifiers Constants and variables can be modified, using v a l u a t i o n modifiers. A l l a f f i n e transformations can be applied. The modifiers are: - t r a n s l a t i o n : AT x,y - s c a l i n g : SCALE xs , ys or SCALE s - r o t a t i o n : ANGLE alpha - mirroring: VSYM axis or HSYM axis (the lower case names stand f o r Fortran REAL values) 46 Any combination of these can be s p e c i f i e d and w i l l be applied i n the following order: Scaling, r o t a t i o n , t r a n s l a t i o n , mirroring As a l l p i c t u r e v a r i a b les are defined within a unit square, i t helps to v i s u a l i s e what happens to t h i s square when the modifiers are applied. Example: * A:= TRIANGLE SCALE dx, dy ANGLE alpha AT x,y; * B:= A VSYM ax; I ax TRIANGLE Pi* B For l i n e segments, the modifiers as given are akward to use. The f o l l o w -i n g can be used: -FROM x l , x l TO y2, y2 This corresponds to: SCALE xs , ys ANGLE alpha AT x,y where: XS = SQRT ((X2-X1) 2 + (Y2 - Y l ) 2 ) YS = .1 * XS ALPHA = ARCTAN ((Y2 - Y1)/(X2-X1)) * 180/ir X = (XI + X2)/2 Y = (Y l + Y2)/2 Example: * HORIZON:= LINE FROM 0,.3 TO 1,.3; LINE HORIZON Note: A t r a i l i n g decimal point need not be w r i t t e n . No value l a r g e r than 3.0 should be used. (Larger values may produce integer overflow at runtime). I f the s c a l i n g factors f o r X and Y are i d e n t i c a l , only one value need be given. Example: * SUN: = CIRCLE SCALE .1; CIRCLE SUN Default values are assigned f o r any modifiers that are not s p e c i f i e d . The default values are: SCALE 1,1 ANGLE 0 AT .5,.5 Expressions The right hand side of an assignment can be an image expression. The operators are (+) for superposition and (\u00E2\u0080\u0094) for d e l e t i o n . Example: \u00E2\u0080\u00A2* SUNSET:= HORIZON + SUN AT .6,.6; * M00N:= HCIRCLE SCALE .1 + HCIRCLE SCALE .05,.1; * NIGHT:= SUNSET - SUN + MOON AT .A,.8; 48 0 SUNSET MOON NIGHT Subscripted variables It may be useful to assign the same v a r i a b l e name to p i c t u r e s that are not a f f i n e transformations of one another. Assume that R and C are defined as follows: R C Both may be r e f e r r e d to as ELEMENTS (E): * E ( l ) : = R; E(2):= C; * DIAGRAM: = E ( l ) SCALE dx, dy AT xl.'yl + E(2) SCALE dx,dy AT x2, y2; or a l t e r n a t i v e l y : * E ( l ) : = R SCALE dx, dy AT x l , y l ; * E(2):= C SCALE dx, dy AT x2, y l ; ' \u00E2\u0080\u00A2 * DIAGRAM:= E ( l ) + E(2); I d e n t i f i c a t i o n and Hitarea An important feature of each p i c t u r e item i s the s i z e of the area surrounding i t which i s i d e n t i f i e d on the screen as being part of the item. This area i s c a l l e d the h i t a r e a of the item. The s i z e of 4 9 the h i t a r e a i s defined by the XSCALE and YSCALE a t t r i b u t e s of the item. This means that the h i t a r e a corresponds to the o r i g i n a l u n i t square i n which the item was defined. A d i s t i n c t i o n must be made between item d e f i n i t i o n s and uses of items: A d e f i n i t i o n : P:= TRIANGLE SCALE .5; defines the item P. Every time the item p i s referenced i n def i n i n g other items, a use of the item P i s created. Its h i t a r e a i s the s i z e of the unit square of P, modified according.to the a t t r i b u t e s of this use of P. Example: * PICTURE:= P SCALE .2,.6 AT .7,.6; TRIANGLE P PICTURE The dotted square of s i z e .2 by .6 i s the h i t a r e a of P. Because P was defined as a t r i a n g l e , scaled by a f a c t o r - j , the h i t a r e a of a l l uses of P w i l l be rectangles double the siz e of the t r i a n g l e displayed. Note: For h i t a r e a s i z e , the modifiers applied to subscripted v a r i a b l e s are cumulative. 5 \u00E2\u0080\u00A2 Example: *Q(3):= SQUARE SCALE .5; PICTURE:= Q(3) SCALE .2,.6; The h i t a r e a f o r Q ( 3 ) i s .5'(.2 by .6) = . 1 by .3. The reason for t h i s i s that there i s only one item Q(3). I f i t i s modified, i t s at t r i b u t e s are changed. In constrast, there may appear, many uses of P, 50 each with i t s own h i t a r e a . Interaction I d e n t i f i c a t i o n on the screen i s accomplished as follows: The statements: CURSOR ON; WAIT FOR INTERRUPT; cause the cursor (crosshairs) to be displayed on the screen and cause the program to wait for a key to-be pressed on the keyboard. When a key i s pressed, the X and Y coordinates of the cursor are stored i n the global Fortran v a r i a b l e s XHIT and YHIT and the l i t e r a l code of the key i n KEYHIT. (On the Nova: ASCII code of key i n l e f t byte, r i g h t byte = n u l l j o n the 360: EBCDIC code of key i s l e f t byte, r i g h t bytes = blanks). The statement: FOR HIT ON : END; allows the user to determine whether the cursor was within the h i t a r e a of any item named . Is th i s the case, the statements i n are executed and the subscript of the item h i t i s stored i n the Fortran v a r i a b l e IHIT. I f there was no h i t , the program w i l l branch to the statement following the END. For-statements can be nested but the nesting has to close within each s t a t e . I f an unsubscripted v a r i a b l e i s i d e n t i f i e d on the screen, the v a r i a b l e IHIT contains the value 0. Example: \u00E2\u0080\u00A2* * FOR HIT ON MENUAREA: * FOR HIT ON DELETE: GOTO STATE 5; END: * FOR HIT ON ROTATE: GOTO STATE 4; END; \u00C2\u00AB * END; 51 *-'-FOR HIT ON E: * CIRCUIT:= CIRCUIT - E(IHIT); * END * CURSOR ON; WAIT FOR INTERRUPT; * CIRCUIT:= CIRCUIT + NODE SCALE .03 AT XHIT, YHIT; A t t r i b u t e functions The functions XLOC, YLOC, XSCALE, YSCALE, ANGLE and TAG allow access to the a t t r i b u t e s given to any pi c t u r e item. Note the use of the equal sign (=). Example: * XI = XLOC (ELEMENT (IHIT)); * ANGLE (E(IHIT)) = ALPHA2; * TAG (Q(3)) = 4; The l a s t statement w i l l cause the item p r e v i o u s l y c a l l e d Q(3) to be renamed Q(4). Q(3) now no longer e x i s t s . Jumps The GOTO STATE n statement i s used to tr a n s f e r c o n t r o l to the beginning of another s t a t e . Within a sta t e , Fortran.GOTO's and labels (statement numbers) should be used. Example: * GOTO STATE 2; or GOTO STATE 2; 52 Display Statements A number of commands allow the user c o n t r o l over the graphics terminal. A display statement causes an item to be displayed on the screen. Example: * DISPLAY CIRCUIT; DISPLAY R AT XI, Y l ; * DISPLAY 'GOOD MORNING' AT .7,-8; The erase statement: ERASE SCREEN w i l l cause the screen to be erased. P a r t i a l erasure of the screen i s not p o s s i b l e . The Tektronix 4010 screen The unit square i s mapped onto the rectangular screen as f o l -lows : 1.3,1 1.3,0 The screen i s p h y s i c a l l y addressable by 781 x 1024 points, corresponding to a 1 x 1.3 r a t i o . The character s i z e on the screen i s f i x e d (approx. 14 x 22 p o i n t s ) . Textstrings are neit h e r scaled nor rotated. Such values, i f given, are ignored for display purposes. Writing to and reading from the terminal can furth e r be pro-grammed i n Fortran. The terminal i s addressed as. a teletype (output: WRITE (10), input: READ (11)). Vectors can be drawn on the screen using the IGL statement: DRAW FROM x l , y l to x2, y2. Such vectors are not stored i n the data s t r u c t u r e . T I I I 53 Example: C DRAW A GRID, RASTER SIZE = .05 .. DO 1 I = 1, 21 V = 0.5 * (1-1) * DRAW FROM 0, V to 1, V; DRAW FROM V,0 TO V , l ; 1 CONTINUE Windowing The display command allows a window to be set to show only part of a pic t u r e on the screen. Example: * DISPLAY CIRCUIT WITHIN XI, Y l DXl, DY1 ONTO X2, Y2 DX2, DY2; Y l ( v i r t u a l picture) DXl (screen) Y2 Saving and re s t o r i n g on secondary storage The statement: * STORE nm,n; w i l l cause the complete IGL data structure and i n a d d i t i o n a following blank common area of n words to be stored on a disk f i l e with the name as s p e c i f i e d i n the v a r i a b l e nm. This f i l e w i l l be created i f i t does not already e x i s t . The corresponding statement: * RESTORE nm,n; w i l l cause the f i l e as s p e c i f i e d i n nm to be read n and used as the current data s t r u c t u r e . 54 Differences between the IBM 360 version and the Data General Supernova version of IGL The differences between the two implementations are twofold: 1) The procedure for compiling and running IGL i s d i f f e r e n t , 2) The two Fortran implementations are d i f f e r e n t . Procedures f o r compiling and executing IGL programs IBM 360 Datagen Supernova F i r s t card i n program: * 360 VERSION * NOVA VERSION Compiling program: $R ELEC:XPL 0 = ELEC:.IGLCOM 2 = -OUT SCARDS = igl - s o u r c e SPRINT = i g l - l i s t i n g ' Compiling intermediate Fortran program $R * FORTRAN SCARDS = -OUT SPUNCH = i g l - o b j e c t or $R*'WATFIV PAR=SIZE=40 SCARDS= -OUT+ELEC:IGLRUNLIB.S Execute Program $R igl-object+ELEC:IGLRUNLIB 9 = p l o t f i l e (plots go to p l o t f i l e ) or $R igl-object+ELEC:IGLAGTLIB ( i n t e r a c t i o n through Adage terminal) Transfer -OUT to Supernova, s p l i t up X into i n d i v i d u a l programs, one f o r each state, named STAT01...STATn FORT STAT01; FORT STAT02 ... RLDR STAT01 IGLRUNLIB; ... IGLGO^ ( i n t e r a c t i o n through Tek-t r o n i x 4010 terminal). 55 Differences i n the Fortran implementation on the IBM 360 and the Data- gen Supernova Below, a l i s t i s given of the major v a r i a t i o n s of Datagen;.For-tran from the IBM Fortran IV d e f i n i t i o n . - A l l variables not stored i n COMMON are placed on a run-time stack. Any program that does not a l t e r COMMON storage i s therefore a reentrant program. (Variables i n subroutines (or states) are not saved from one c a l l to the next!) - Program units must be ordered as follows: FUNCTION, SUBROUTINE statement. - Declaration statements. These begin with the keywords COMMON, COMPLEX, DIMENSION, DOUBLE, EQUIVALENCE, EXTERNAL, INTEGER, LOGICAL or REAL. .- Statement functions and i n t e r n a l subprograms (FORMAT statements .and DATA i n i t i a l i z a t i o n statements may be given i n t h i s area). - Executable statements. (FORMAT statements and DATA i n i t i a l i -zations may be given i n this area). - Imbedded blanks are s i g n i f i c a n t except when they appear i n the name of a program v a r i a b l e or i n the statement i d e n t i f i e r GOTO (GO TO) . - Statement i d e n t i f i e r s , operator names, and names of l i b r a r y functions are reserved and cannot be used as program v a r i a b l e s . The reserved names are: 56 . A N D . ASSIGN D A T A N D R E A L L O G I C A L . E O T . A T A N D A T A N 2 DSIGN M A X 0 . E Q . A T A N 2 D A T N 2 DSIN M A X 1 . F A L S E . B A C K S P A C E D B L E D S Q R T MIN0 . G E . BINARY D C ABS - D T A N MINI . G T . B L O C K D A T A D C C O S D T A N H M O D . L E . DABS D C E X P E N D F I L E P A R A M E T E R . L T . C A L L D C L O G E N T R Y P A U S E . N E . C C O S D C M P L X E Q U I V A L E N C E R E A D . N O T . C E X P D C O S E X P R E A L . OR. C L O G DCSIN E X T E R N A L R E T U R N . T R U E . C M P L X D C S Q R T F L O A T R E W I N D ABS C O M M O N D E X P F O R M A T SIGN A C C E P T C O M P I L E R D E X O A T F U N C T I O N SIN A I M A G C O M P L E X D I M G O T O SINH A INT \u00E2\u0080\u00A2 C O N j G IABS S N G L A L O G C O N T I N U E D L O G IDIM S Q R T A L O G 1 0 COS . D L O G 10 IDINT STOP A M A X 0 CSIN D M A X 1 IF S U B R O U T I N E A M A X 1 C S Q R T D M INI IFIX T A N AMINO DABS D M O D INT T A N I-1 AMIN1 D A I M A G D O I N T E G E R T Y P E A M O D D A T A D O U B L E PRECISION ISIGN W R I T E - Names i d e n t i c a l to DGC extended assembler mnemonics are not av a i l a b l e f o r use as subprogram names. - DATA i n i t i a l i z a t i o n i s provided f o r lab e l e d COMMON only. - Only COMMON variables can be EQUIVALENCed. - DATA i n i t i a l i z a t i o n of labe l e d COMMON i s pos s i b l e i n any Fortran program or subprogram. - Subprogram names must be unique within the f i r s t f i v e chara-cters (ANSI standard i s s i x ) . - The characters > and < cannot be used i n H o l l e r i t h . . s t r i n g s . 57 - A l l integers are of length 2 bytes - A l l r e a l s are length 4 bytes - Data i n i t i a l i z a t i o n statements use the n u l l character as f i l l character. S Format uses the n u l l character as f i l l character (A Format uses the blank character, as on the IBM 360) - Read and write statements use unit numbers 11 and 10. Example: DATA IA/'A'/ AO DATA IA/'A '/ A^ FORMAT (Al) A_ FORMAT(SI) AO For complete information on IBM Fortran, consult: IBM System/360 FORTRAN IV Language, document //C28-6515-7 For Data General Fortran: DGC FORTRAN IV USER'S MANUAL, #093-000053. APPENDIX B ILLUSTRATIONS FROM IGL PROGRAMS: NETWORK ANALYSIS, CPM, LOAD FLOW PICK TWO NODES AND AN ELEMENT, LAST NODE I S SftUEO Rl<> C l r R O T A T E D E L E T E L A B E L U A L U E S SAME REDRAW A N A L Y Z E P L O T R E S T A R T \u00C2\u00A9 INSERT DELETE A C T I V I T Y RELATION REDRAW MOVE 20 3 12C 52\" D E L E T E R O T A T E KEY MORO h-1 62 APPENDIX C LISTINGS: IGL-SYNTAX, IGLCOM (Only routines that d i f f e r from the published XPL d e s c r i p t i o n [12] are shown). 6 3 P R O D U C T I O N S 1 :1= E S T A T E S * 2 !!= 3 I ! : = : 5 :!= STATE 6 8 . S:= END S.TATE ::= j 10 I f 11 I <0ISPLAY STATEMENT* J 12 I tt = t = 23 25 EVALUATION* 27 < IM A G E * : := WITHIN ::= GOTO STATE 31 I GO TO STATE 35 11 = WAIT FOR INTERRUPT 36 I I- CURSOR ON 37 I READ CURSOR 38 I READ KEY F O R T R A N VARIABLF.> 39 :;= PLOT 11 It- STORE 12 .1 RESTORE :;= 11 I 15 : j= + 16 I -17 ::= 18 I 19 \u00E2\u0080\u00A2 50 I HSYM 51 :!= 52 I 53 55 I VALUE ( ) 56 I TEXT ( ) 57 ::= 58 I 59 ti~ ( t : = 61 I 63 C O O R D I N A T E FUNCTION> \u00C2\u00BB : = .) 61 ::= ( 65 ::= XLOC 66 I YLOC 67 I XSCALE 68 t YSCALE 69 I ANGLE 70 I TAG 71 ::= COMPONENTS* 72 I 73 : ; s 65 71 I 75 ::= AT 76 I SCALE 77 I SCALE 78 I ANGLE 79 I TAG 80 ll~ FROM TO 81 t:= , 66 1 2 /ft CARD IMAGE HANDLING PROCEDURE $L *, 3 4 5 GET_CARD V 6 PROCEDURE? 7 /* DOES ALL CARD READING AND L I S T I N G */ 8 DECLARE I F I X E D , (TEMP, TEMPO, REST) CHARACTER, READING B I T ( l ) ; 9 DECLARE F I R S T - C A R D BIT C I ) I N I T I A L ( T R U E ) ) 10 READ! BUFFER = INPUT; 11 I F L E N G T H ( B U F F E R ) = 0 THEN 12 DO; /* SIGNAL FOR EOF */ 13 C A L L ERROR C 1 EOF M I S S I N G OR COMMENT STARTING IN COLUMN 1,1,1) 14 BUFFER = PAD ('* /*\u00E2\u0080\u00A2'/* */ EOF;END;EOF ', 8 0 ) ; 15 END; 16 17 E L S E CARD_COUNT = CARD_COIJNT + 1) /* USED TO PRINT ON L I S T I N G */ 18 /* OUTPUT F I R S T L I N E BEFORE F I R S T CARD */ 19 I F FIRST_CARD=TRUE THEN DO; 20 F I.RST_C AR D = F AL5E ; END; 21 /* E L I M I N A T E FORTRAN CARDS */ 22 DO J=0 TO 1 3 ; 23 I F BYTE ( B U F F E R , 0 ) = B Y T E ( 1 C 0 1 2 3 4 5 6 7 8 9 X A I , J ) THEN 24 DO; 25 I F C O N T R O L ( B Y T E ( ' M l ) ) THEN OUTPUT=BUFFER; 26 E L S E IF C O N T R O L ( B Y T E ( * L ' ) ) THEN 27 OUTPUT = I _F 0 R M A T (CARD\u00E2\u0080\u0094COUNT,4)1 I f I I |BUFFER; 28 \u00E2\u0080\u00A2 O U T P U T ( 2 ) = B U F F E R ; 29 GOTO READ; 30 END; 31 END; ' 32 I F MARGIN\u00E2\u0080\u009ECHOP > 0 THEN 33 DO; /* THE MARGIN CONTROL FROM DOLLAR | */ 34 I = L E N G T H ( B U F F E R ) * MARGIN_CHOP; 35 REST = S U B S T R ( B U F F E R , I ) ; 36 BUFFER = S U B S T R ( B U F F E R , 0, I ) ; 37 END; 38 E L S E REST = \" ; 39 S = S U B S T R ( B U F F E R , 0 , 1 ) ; 40 B U F F E R = S U B S T R ( B U F F E R , 1 ) ; 41 TEXT = BUFFER; 42 T E X T _ L I M 1 T = L E N G T H ( T E X T ) - 1 ; . 43 I F C O N 1 R O L C B Y T E C \u00C2\u00BB M 1 ) ) THEN OUTPUT = SI I B U F F E R ) 44 E L S E I F C O N T R O L ( B Y T E ( ' L 1 ) ) THEN 45 OUTPUT = I\u00E2\u0080\u0094F ORMAT (CARD\u00E2\u0080\u009ECOUNT, 4) l l \u00C2\u00BB ' l | S I I BUFFER II REST; 46 CP = 0; 47 END GET.CARD; 67 1 ADD_FORTRAN_VAR s 2 PROCEDURE; /* KEEP A LIST OF FORTRAN VARIABLES USEO */ 3 1 END ADD_FORTRAN_VAR; 5 RESET: 6 PROCEDURE? /* RESET VALUATION TO DEFAULT VALUES */ 7 L 0 C = ' , 5 , , 5 i ; 8 SCALES' 1 , , 1 , l \u00C2\u00BB 9 ANGLE='0 o!j 10 T AG= ' 0 ' ? 11 RETURN; 12 END RESET; 13 PAD_8S 11 PROCEDURE; /* PAD VARIABLENAME WITH BLANKS */ 15 I = LENGTH(VAR(MP) ) ; 16 IF I>8 THEN VAR(MP)=SUBSTR(VARCMP ) , 0,8) ; 17 IF I<8 THEN 18 DO; 1 9 S = SU8STRP \u00C2\u00BB,I)> 20 VAR(MP)=VAR(MP) I I S ; 21 END; ' 22 RETURN; 23 END PAD-.8; 21 EXOUTt 25 PROCEDURE(VARTYPE , PRCODE,EXCODE ) ; 26 DECLARE (VARTYPE,PRCODE,EXCODE) FIXED; 27 DECLARE FILEOUT LITERALLY ' OUTPUT(2) CALL ' M l ' j 28 - DECLARE CONTINUATION LITERALLY 'OUTPUT(2) = \" * M | | \u00C2\u00BB ; 29 IF EXC0DE=3 THEN FILEOUT 'ASS I G ( M I VAR(MP-2)I I ' ) I ; 30 DO CASE VARTYPE; 31 ; 32 FILEOUT < PRIMA ( ' I IPRCODE I I ' , M IEXCODEI I ', ' I IVAR (MP) | I ' , ' I I LOC ! I 33 ' / M l SCALE I I ' , \u00E2\u0080\u00A2 I I ANGLE I I ' , M | TAG I I ' ) ' ; 31 FILEOUT 'PRIMS( ' I I PRCODE I M , ' I IEXCODEI I ' /M I LOCI I I,' '\u00C2\u00BBI IVAR(MP) I I I ' < ) I ; 35 FILEOUT 'PR IMC( 1 I IPRCODEI I ',' I I EXCODE I I ' , ' I ILOC I I ' , < IIVAR(MP ) | | \u00E2\u0080\u00A2 ) ' ; 36 FILEOUT ' PR I MS ( ' I I PRC ODE I I ' , ' I I EXCODEI I ', \u00E2\u0080\u00A2 I ILOC I I 1 , ' I I VAR(MP ) | | ' ) I ; 37 END; 38 CALL RESET; 39 RETURN; 10 END EXOUT; 11 SYNTHESIZE: 12 PROCEDURE(PRODUCT ION_NUMBER); 13 DECLARE PRODUCTION_NUMBER FIXED; 11 DECLARE LABEL\u00E2\u0080\u0094ST ACK (100) CHARACTER , LP FIXED INITIAL ( 0 ) ; 15 DECLARE CARDNO.STACK (1 00 ) FIXED; 16 DECLARE STMTNO FIXED INITIAL ( 1 0 0 0 ) ; 17 DECLARE UNARY_OP CHARACTER; 18 DECLARE (NUM\u00E2\u0080\u009EVALUE,VARTYPE,FTYPE) FIXED) 19 DECLARE IK_VALUE FIXED; 50 DECLARE (EXCODE, PRCODE ) FIXED; 51 DECLARE (FNAME,VARNAME,VART AG) CHARACTER; 52 DO CA5E PRODUCTION_NUMBER; 53 ; /* CASE 0 I S A DUMMY */ 51 /* ::= */ 55 IF MP-\u00C2\u00BB = 2 THEN 68 56 DO; 57 CALL ERROR ( 1 EOF AT I N V A L I D P O I N T ' , 1 ) ; 58 CALL STACK\u00E2\u0080\u009E DUMP; 59 END; 60 E L S E DO; 61 I F LP - i = 0 THEN DO 1 = 1 TO L P ; 62 CALL ERROR( 'UNMATCHED FOR\"STATEMENT, L I N E : ' 1 1CARDNO - S T A C K ( L P ) 63 END; 64 C O M P I L I N G = F A L S E ; 6 5 END; 66 /* :s= */ 67 ? 68 /* I!= */ 69 ; 70 /* t < S T A T E M E N T t-I S T >,' : : = STATE */ 74 DO; 75 I F L E N G T H ( V A R ( S P ) ) = 1 THEN S= \u00E2\u0080\u00A2 0' 1 1 V A R ( S P ) ) 76 E L S E S = V A R ( S P ) ; 77 I F C O N T R O L ( B Y T E ( ' D ' ) ) THEN 78 O U T P U T ( 2 ) = ' SUBROUTINE STAT M I S ; 79 0 U T P U T ( 2 ) = ' C ----- STATE 1 1 I V A R ( M P P l ) 1 1 \u00E2\u0080\u0094 I ; 80 OUTPUT(2)=\u00C2\u00BB LOGICAL H I T 0 N ' ; 81 O U T P U T ( 2 ) = ' COMMON 1 DUMMY(3376)\u00C2\u00AB; 82 V A R ( M P ) = V A R ( M P P 1 ) ; 83 END; 84 /* ::= ::= */ 87 \u00E2\u0080\u00A2 i 88 /* */ 89 DO; 90 V A R ( M P ) = V A R ( S P ) ; 91 0 U T P U T ( 2 ) = ' C END STATE >1 1VAR(SP) I I ' - \u00E2\u0080\u0094 f = < P I C T O R I A L ASSIGNMENT* ; */ 101 ; 102 /* :; = ::= 1!= : != 118 /ft t\u00C2\u00BB= : J = : = * / 132 ; 133 / * 50 THEN VA R C S P ) = S U B S T R (VA R ( S P ) , 0 , 5 0 ) ; 139 FILEOUT \u00C2\u00BB D I S P S ( \u00C2\u00AB \u00E2\u0080\u00A2 1 I I VAR(SP ) I | I M , I ; 140 CONTINUATION LOCI I l , 1 I ILENGTHCVAR (SP) ) I M ) ' ; 141 END; 142 END; 143 CALL R E S E T ; 144 END; 145 / * \u00C2\u00BB ;= 160 IM_VALUfc'=0; 161 END; 162 / * ::= 216 END J 217 /* EXPRESSION* ::= EX P R E S S I O N * */ 218 DO; 219 VAR(MP)=VAR(3P) ; 220 CALL EXOUT(VARTYPE,PRCODE,EXCODE); 221 END; 222 /* ::= * / 238 ; 2 3 9 / * < V A L U A T E 0 V A R I A B L E * = * / 24 0 ; 241 / * < I T E M * : ? = ^ V A R I A B L E * * / 2 4 2 V A R T Y P E = 1 ; 2 4 3 / * S 5 = * / 2 4 4 D O ; 2 4 5 I ~ L E N G T H ( V A R ( M P ) ) ; 2 4 6 I F I >16 THEN V A R ( M P ) = S U B S T R ( V A R ( M P ) , 0 , 16 ) | 2 4 7 I F K 1 6 THEN D O ; 2 4 6 S = S U B 9 T R ( ( 2 4 9 V A R ( M P ) u V A R ( M P ) I I S ; 2 5 0 END J 251 V A R T Y P E = 2 ; 2 5 2 E N D ; 2 5 3 / * : : = V A L U E ( ; : = < I D E N T I F I E R > * / 2 6 4 D O ; 2 6 5 C A L L P A D - . 8 J 2 6 6 VARNAME--VAR ( M P ) ; 2 6 7 V A R T A G - ' O ' ; 2 6 8 \u00E2\u0080\u00A2 V A R ( M P ) = \u00C2\u00BB 1 1 \u00E2\u0080\u00A2 I I V A R N A M E I M ' ',' MV A R T A G ; 2 6 9 E N D ; 2 7 0 / * < V A R I A B L E * \u00C2\u00AB : = ( ( * / 301 ; 302 / * < F U N C TI 0 N N A M E * ::= XLOC * / 303 FTYPE =1; 304 / * ::= ANGLE * / 311 FTYPE = 5; 312 / * * / 325 SCALE--VAR(SP) ; 326 / * COMPONENT* SCALE 337 / * CQMPONENTPAIR* tl- FROM TO . T I T L .NREL .ENT .EXTD .EXTN CHAIN CHAIN . C P Y L . , . F R E T ERROR TEXT=-167 C H A I N S F S . JSR LDA MOVZL SUBZR .SYSTM .EXEC JMP JSR @.CPYL ;GET POINTER TO NAME 0 , T E X T , 3 ; F O R M BYTE POINTER IN AC0 0 , 0 1,1 ; S E T AC 1 BIT 0 \u00C2\u00A9.EROR \u00C2\u00A9.FRET &RETURN TO CALLING PROGRAM .EROR: \u00C2\u00BB ERROR .END 76 1 C I N T E R A C T I V E ADAGE PACKAGE FOR P I E K E ' S IGL SYSTEM---2 C - - - O B J E C I DECK CONTAINS SCONTINUE WITH A G T j B A S I C THEREBY 3 CONCATENATION OF THAT F I L E IS NOT REQUIRED, 4 SUBROUTINE WA1TIN 5 C PROVIDES THE I N T E R A C T I O N - READS KEYBOARD AND CROSSHAIR LOCATION 6 LOGICAL FLAG /.TRUE,/ 7 INTEGER P L O T / i PLOT ' / , Y E S / ' Y '/ 6 COMMON/CURSOR/I H I T , X H I T , Y H I T , K E Y H I T 9 REAL 0(b) 10 IF ( F L A G ) W R I T E ( 6 , 3 0 ) 11 30 F O R M A T C A KEYBOARD ENTRY OF PLOT WILL A U T O M A T I C A L L Y ' / 12 *' COPY THE D I S P L A Y AS A P L O T F I L E ON L O G I C A L UNIT 9 , ' / / 13 *' U N S P E C I F I E D L O G I C A L UNIT PUTS P L O T F I L E IN -PLOT*,') 14 F L A G = , F A L S E , 15 1 CALL A G T M U V ( 5 9 2 5 , 1 , 3 7 ) 16 CALL D I S P L A Y S READY MESSAGE ON SCREEN 17 R E A D ( 5 , 1 0 ) K E Y H I T 18 10 FORMAT (Aa) 19 CALL A G T M O V ( 5 8 8 8 , 1 , 3 7 ) 20 CALL D I S P L A Y S WAITI MESSAGE ON SCREEN 21 C---A KEYBOARD ENTRY OF PLOT WILL AUTOMATICALLY 22 COPY THE D I S P L A Y AS A P L O T F I L E ON LOGICAL UNIT 9,---23 I F ( K E Y H I T , E Q , P L 0 T ) GO TO 100 24 CALL D I A L S ( D ) 25 X H I T = ( D C 4 ) + l , ) * 5 1 2 , / 7 8 0 , 26 Y H J T = ( D ( l ) + i , ) * 5 1 2 , / 7 8 Q , 27 RETURN 28 100 NFL AG = 0 29 W R I T E ( 6 , 2 0 ) 30 20 FORMAT( ' ' , ' I S THIS TO BE THE LAST P L O T ? ' ) 31 R E A D ( 5 , 2 1 ) 1 REPLY 32 21 FORMAT(A 1) 33 IF ( I R E P L Y . E O . Y E S ) N F L A G s l 34 CALL S A V E ( N F L A G ) 35 GO TO 1 36 END 37 C - - - - - - - -38 SUBROUTINE ERASE 39 C ERASES SCREEN A NO I N I T I A L I Z E S THE TERMINAL 40 INTEGER D I S P ( 1 1 2 ) 41 LOGICAL F L A G / . F A L S E , / 42 COMMON/POINTR/NV 43 I F ( F L A G ) GO TO 200 44 F LAG= .TRUE. 45 CALL A G T C V T ( D I S P ( 1 ) , 0 , , 0 , , 0 , 1 ) 46 CALL GENERATES AN EOF CONDITION TO KEEP STORED MESSAGES FROM BEING D I S P L A Y E D 47 CREATE MESSAGES 48 CALL A G T E X T ( - 5 , , 7 , , 1 , , 'WAITI I ,0 , , 5 , D I S P ( 2 ) , N V 0 ) 49 DO 100 J = 3 3 , 3 8 50 100 D I S P ( J ) = 0 51 CALL A G T E X T ( - 5 , , 7 , , 1 , , \u00E2\u0080\u00A2 R E A D Y ' , 0 , , 5 , D I S P ( 3 9 ) , NVD) 52 CREATE BLANK MESSAGE 53 DO 300 J = 7 6 , 1 1 2 5\u00C2\u00AB 300 D I S P ( J ) = 0 55 200 CALL A G T D S P ( D I S P ( 1 ) , 1 1 2 , 5 8 8 7 , , T R U E , , 0 ) 77 56 CALL AGTMOVC5B88, 1 , 37 ) 57 CALLS WAIT! MESSAGE 58 NV-37 59 RETURN 60 END 61 62 SUBROUTINE VECTOR ( X i,Y1 ,IDRAw) 63 C DRAWS A VECTOR FROM PREVIOUS P O S I T I O N TO NEW X t , Y l WITH PEN 64 C UP OH DO\u00C2\u00BB.\ (IDRAW = 0 OR i ) 65 LOGICAL F L A G / , T R U E , / 66 INTEGER D I S P 67 COMMON/POINTR/NV 68 IF ( F L A G ) CALL CHECK 69 F L A G s , F A L S E , 70 X = X l 71 v=ri 72 CALL T S C A L E ( X , Y ) 73 NV=NV+1 74 CREATE VECTOR AND SEND TO AGT 75 CALL AGTCVT ( D I S P , X , Y , I D R A W , 0) 76 CALL A G T D S P ( P I S P , 1 , N V , , F A L S E , , 0 ) 77 RETURN 78 END 79 80 SUBROUTINE D I S P S ( I S , X I , Y l , N C ) 81 C THIS ROUTINE DYNAMICALLY ALLOCATES S U F F I C I E N T STORAGE FOR DSTEXT 82 C A L L S DSTEXT, THEN DROPS STORAGE I M M E D I A T E L Y , 83 EXTERNAL DSTEXT 84 LOGICAL FLAG/,TRUE,/ 85 INTEGER*2 I S U ) 86 IF ( F L A G ) CALL CHECK 87 F L A G = , F A L S E , 88 N=NC*10 89 CALL G S P A C E ( P 0 I S P , N * 4 ) 90 CALL C A L L E R ( D S T E X T , P D I S P , I P T R ( N ) , I P T R ( I S ) , I P T R ( X I ) , I P T R ( Y l ) # 91 H P T R ( N C ) ) 92 CALL F S P A C E ( P D I S P ) 93 RETURN 94 END 95 96 SUBROUTINE D S T E X T ( D I S P , N , I S , X I , Y l ,NC) 97 C D I S P L A Y S A CHARACTER STRING OF NC CHARACTERS AT X I , Y l 98 INTEGER D I S P ( N ) , I S * 2 ( 1 ) 99 COMMON/POINTR/NV 100 NVcNV+1 101 X = X1 102 Y = Y1 103 CALL T S C A L E ( X , Y ) 104 CALL A G T F . X T ( X , Y , 7 8 . / ? 5 6 , , I S , 0 , , N C , D 1 3 P ( 1 ),NVG) 105 I F (NVG.EU.O) GO TO 100 106 CALL A G T D S P ( D I S P ( 1 ) , N V G , N V , , F A L S E , , 0 ) 107 100 NV = NV + NVG-?1 108 RETURN 109 END 110 1 1 1 SUBROUTINE TSCALfc*(X,Y) 112 C L I M I T S X AND Y VALUES AND SCALES FROM I GL TO AGT 113 I F ( X , L T , 0 , ) X=0, 114 I F ( X , G T , 1 0 2 4 , / 7 8 0 , ) X = l 0 2 4 , / 7 8 0 , 115 I F ( Y , L T , 0 . ) Y=0, 7 8 116 I F ( Y , G T , 1 . ) Y= l , 117 x = x * 7 n o , / 5 i , 2 - 1 0 , 116 Y = Y * 7 8 0 , / 5 1 , 2 - 1 0 t 119 RETURN 120 END 121 C - - - - - - - - - - - - - - - - - - -122 SUBROUTINE SAVE ( M F L A G ) 123 C READS THE BUFFER AT THE AGT AND SENDS D I S P L A Y E D IMAGE TO L O G I C A L UNIT 9, 124 COMMON/PuINTR/^V 125 CALL A G T M 0 V C 5 9 6 2 , 1 / 3 7 ) 126 C A L L S BLANK MESSAGE 127 CALL A J P L O T ( 1 0 , , N V ) 128 CALL AGTMOVC5888,1,37) 129 C A L L S WAIT I MESSAGE 130 I F ( N F L A G . E Q , 1 ) CALL PLOTND 131 RETURN 132 END 133 c\u00C2\u00AB--------- \u00E2\u0080\u009E--.--,.-.,..--,.--134 SUBROUTINE CHECK 135 C ENSURES THAT ERASE HAS BEEN CALLED BEFORE VFCTOR AND D I S P S TO 136 C I N I T I A L I Z E S C R E E N , 137 L O G I C A L F LAG/,TRUE,/ 138 I F ( F L A G ) CALL ERASE 139 F L A G = , F A L S E , 140 RETURN 141 END "@en . "Thesis/Dissertation"@en . "10.14288/1.0101250"@en . "eng"@en . "Electrical and Computer Engineering"@en . "Vancouver : University of British Columbia Library"@en . "University of British Columbia"@en . "For non-commercial purposes only, such as research, private study and education. Additional conditions apply, see Terms of Use https://open.library.ubc.ca/terms_of_use."@en . "Graduate"@en . "Design and implementation of a high-level language for interactive computer graphics"@en . "Text"@en . "http://hdl.handle.net/2429/32582"@en .