Open Collections

UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Mathematical aspects of a graphical programming language and its implementation 1976

You don't seem to have a PDF reader installed, try download the pdf

Item Metadata

Download

Media
UBC_1976_A7 C49.pdf
UBC_1976_A7 C49.pdf [ 3.65MB ]
Metadata
JSON: 1.0065568.json
JSON-LD: 1.0065568+ld.json
RDF/XML (Pretty): 1.0065568.xml
RDF/JSON: 1.0065568+rdf.json
Turtle: 1.0065568+rdf-turtle.txt
N-Triples: 1.0065568+rdf-ntriples.txt
Citation
1.0065568.ris

Full Text

MATHEMATICAL ASPECTS OF A GRAPHICAL PROGRAMMING LANGUAGE AND ITS IMPLEMENTATION by Bon-boon Chan B . S c , U n i v e r s i t y o f C a l i f o r n i a , B e r k e l e y , 1973 A THESIS SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENT FOR THE DEGREE OF MASTER OF APPLIED SCIENCE i n t h e Department of E l e c t r i c a l E n g i n e e r i n g We a c c e p t t h i s t h e s i s as co n f o r m i n g t o the r e q u i r e d s t a n d a r d THE UNIVERSITY OF J u l y , 0 BON-BOON BRITISH COLUMBIA 1976 CHAN, 1976 In presenting th i s thesis in pa r t i a l fu l f i lment of the requirements for an advanced degree at the Un ivers i ty of B r i t i s h Columbia, I agree that the L ibrary sha l l make it f ree l y ava i l ab le for reference and study. I fur ther agree that permission for extensive copying of th i s thesis for scho lar ly purposes may be granted by the Head of my Department or by his representat ives. It is understood that copying or pub l i ca t ion of th is thes is fo r f i nanc ia l gain sha l l not be allowed without my writ ten permission. Depa rtment The Univers i ty of B r i t i s h Columbia 2075 Wesbrook P l a c e Vancouver, Canada 1 V6T 1W5 ABSTRACT This t h e s i s describes the improvements i n the mathematical aspects of the h i g h - l e v e l programming language f o r i n t e r a c t i v e graphics (LIG). Improvement p o s s i b i l i t i e s were i n v e s t i g a t e d i n three areas: dependence on the order of tran s f o r m a t i o n s , a r i t h m e t i c exp- r e s s i o n s appearing i n LIG statements, and the implementation to a l l o w the programming of g r a p h i c a l f u n c t i o n s . The method of implementation of the proposed improvements i s a l s o discussed. i TABLE OF CONTENTS PAGE ABSTRACT i TABLE OF CONTENTS i i LIST OF FI GERES. . . i i i ACKNOWLEDGEMENT iv I. INTRODUCTION 1 1.1 Host Language Concept 1 1.2 Purpose of Research. 3 II. ORDER OF GRAPHICAL TRANSFORMATIONS 5 2.1 The Requirement for Transformations 5 2.2 The Formulation of Transformations 5 2.3 The Transformation Equations and Matrices 8 2.4 Transformations in LIG 10 2.5 Non-commutativity property 12 2.6 To Derive the A and B Matrices 18 III. SYNTACTIC IMPROVEMENT FOR LIG STATEMENTS 22 3.1 Description of Syntax 22 3.2 The Backus Normal Form 22 3.3 Graphical Variable and Modification Attributes 27 3.4 Attribute Assignment and Numerical Assignment 29 3.5 LIG Preprocessor and Improvement Result 30 IV. PICTURE GENERATION BY GRAPHICAL FUNCTIONS 35 4.1 Picture Generation in LIG 35 4.2 The LIG Data Base 38 4.3 Graphical Function 40 4.4 Implementation Scheme 42 4.5 Generation of Special Plane Curves by a Graphical Function : Examples 43 4 . 6 Graphical Assignment Statement with a Graphical Function 46 V. CONCLUSION 50 REFERENCES , • 54 APPENDIX A 57 APPENDIX B 62 APPENDIX C 76 i i LIST OF FIGURES PAGE F i g . 1.1 Object Code Generation 2 F i g . 2 .1 S i g n i f i c a n c e i n the Sequence of Transformations. . . . 7 F i g . 2.2 Transformation Order 21 F i g . 3 .1 S y n t a c t i c Chart 2 4 F i g . 4 . 1 Primitives;,..-. 35 F i g . 4 . 2 2 Input-And-Gate . 37 F i g . 4 . 3 A Track 37 F i g . 4 . 4 LIG Data Base S t r u c t u r e 39 F i g . 4-5 Hypocycloid w i t h Four Cusps 48 F i g . 4 . 6 Tree leaved rose 48 F i g . 4 .7 Four leaved rose 49 F i g . 4 . 8 Function Generation 49 i i i ACKNOWLEDGEMENT The author wishes to thank h i s s u p e r v i s o r . Dr. G.F.Schrack f o r h i s i n t e r e s t , a d v i c e and encouragement throughout the p e r i o d of t h i s r e s e a r c h . F i n a n c i a l support f o r t h i s r e s e a r c h was provided fay the N a t i o n a l fiesearch C o u n c i l of Canada under grant number A- 0148. i v 1 I . INTRODUCTION Host Language Concept Graphics languages have been developed f o r the p r o d u c t i o n of diagrams and p i c t u r e s - Examples are B-LINE £ 6 ] and GROAN [25]- However, a g r a p h i c s language which i s i n t e n d e d to a s s i s t computer-aided a c t i v i t i e s cannot be a pure g r a p h i c s language, as computer-aided design r e q u i r e s the u s u a l numerical, Boolean, and c h a r a c t e r s t r i n g h a n d l i n g c a p a b i l i t i e s of a problem-oriented h i g h - l e v e l language (e.g. FORTRAN, ALGOL, APL e t c . ) . For t h i s reason, LIG was designed to accept an e x i s t i n g p r o c e d u r a l language as a host language, i n a d d i t i o n to the g r a p h i c s statements proper- Examples of language e x t e n s i o n s are LIG [ 1 7 ] , GPL/1 [ 2 2 ] , TUIA [ 2 ] , and XPLG 123). F o r t r a n i s the host language f o r the h i g h - l e v e l g r a p h i c s language LIG. Thus, an a p p l i c a t i o n program c o n t a i n s both F o r t r a n and LIG statements. F i g . 1.1 shows the procedure i n v o l v e d i n the gene r a t i o n of the o b j e c t code- The LIG p r e p r o c e s s o r t r a n s l a t e s a l l LIG statements i n t o F o r t r a n c a l l statements, but passes the pure F o r t r a n statements d i r e c t l y to the output f i l e . The c o n s t r u c t i o n of the LIG preprocessor i s d i s c u s s e d i n S e c t i o n 3.5 £12] [ 8 j . 2 Object Code Fig.1.1 Object Code Generation 3 l s . 2 Purpose of .Research The mathematical a s p e c t s of the LIG g r a p h i c s language and g r a p h i c s system are i n v e s t i g a t e d - The areas of study are l i s t e d as f o l l o w s : (a) the dependence on the order of t r a n s f o r m a t i o n (b) LIG statement syntax improvement (c) implementation of g r a p h i c a l f u n c t i o n s I n the p r e v i o u s LIG system, the order of t r a n s f o r m a t i o n was always e v a l u a t e d i n a f i x e d o r d e r . The t r a n s f o r m a t i o n s i n g u e s t i o n are t r a n s l a t i o n , s c a l i n g and r o t a t i o n . The t h r e e o p e r a t o r s a s s o c i a t e d with these t r a n s f o r m a t i o n s can be arranged i n t o d i f f e r e n t seguences. D i f f e r e n t t r a n s f o r m a t i o n seguences were i n v e s t i g a t e d to determine i f i d e n t i c a l p i c t u r e s were generated from the same g r a p h i c a l o b j e c t . In the p r e v i o u s v e r s i o n of LIG, statements c o u l d not c o n t a i n imbedded a r i t h m e t i c e x p r e s s i o n s . For example, a s u b s c r i p t of a v a r i a b l e has to be a s i n g l e number or an i d e n t i f i e r - The grammatical r u l e s as w e l l as the LIG preprocessor were changed. A g r a p h i c a l o b j e c t i s b u i l t up from a f i x e d s e t of g r a p h i c a l p r i m i t i v e s . These g r a p h i c a l p r i m i t i v e s are; BLANK, LINE, TRIANGLE, SQUARE , CIJ8CLE and SCIRCLE- From t h i s s e t , i t i s d i f f i c u l t t o generate curves d e s c r i b e d by an a l g e b r a i c 4 equation- Thus, the v a r i e t y of g r a p h i c a l o b j e c t s generated i s somewhat l i m i t e d . In order t o permit a l g e b r a i c curves, the n o t i o n of a g r a p h i c a l f u n c t i o n was i n t r o d u c e d , k g r a p h i c a l f u n c t i o n i s a f u n c t i o n which r e t u r n s a value of type g r a p h i c a l , i . e . a g r a p h i c a l o b j e c t - I I . 2. 1 ORDER OF GRAPHICAL TRANSFOBMATIOHS A graphics system should allow the app l i c a t i o n programmer to define pictures, to display these predefined pictures on the screen, and to manipulate these pictures. The basic type of manipulation should include the c a p a b i l i t y to position a picture at any desired location of the screen, to change the dimension of a picture in X- or ^ - d i r e c t i o n , and to rotate a picture by a s p e c i f i e d angle in the clockwise or anti-clockwise d i r e c t i o n . In graphics terminology, these types of picture manipulation are ca l l e d t ranslation, scaling and r o t a t i o n . They are c o l l e c t i v e l y known as graphical transformations. 2-2 The Formulation of Transformations E s s e n t i a l l y , there are two aspects i n the formulation of graphical transformations £ 1 5 ] : (a) A transformation which i s a single mathematical en t i t y , and which can be denoted by a single name or a symbol; (b) Two or more transformations which can be combined, or concatenated, to yi e l d a single transformation which has the same effect as the 6 s e q u e n t i a l a p p l i c a t i o n of the o r i g i n a l t r a n s f o r m a t i o n s . In the h i g h - l e v e l i n t e r a c t i v e g r a p h i c s language (LIG), t r a n s l a t i o n i s denoted by the keyword AT, s c a l i n g by SCALE, and r o t a t i o n by ANGLE- T h i s conforms with the f i r s t a s pect o f f o r m u l a t i o n . Moreover, when these t r a n s f o r m a t i o n s are concatenated, the r e s u l t i s eva l u a t e d i n a f i x e d order- ( 16 ][ 17 ][20 ] Independent of the order of appearance of the t r a n s f o r m a t i o n e n t i t y i n a LIG statement, t h e order of e v a l u a t i o n i s s c a l i n g , r o t a t i o n and t r a n s l a t i o n . Thus the r e s u l t i n g t r a n s f o r m a t i o n s are i d e n t i c a l f o r a l l of the . f o l l o w i n g LIG statements: AT X,Y SCALE SX,SY ANGLE A AT X,Y ANGLE A SCALE SX,SY SCALE SX,SY AT X,Y ANGLE A SCALE SX,SY ANGLE A AT X,Y ANGLE A SCALE SX,SY AT X,Y ANGLE A AT X,Y SCALE SX,SY As the r e s u l t i n g t r a n s f o r m a t i o n s are not order dependent, the f o r m u l a t i o n of the t r a n s f o r m a t i o n i n the pr e v i o u s LIG g r a p h i c s system does not conform with the second aspect of the f o r m u l a t i o n of t r a n s f o r m a t i o n s . Using a simple example, one w i l l n o t i c e t h a t the order i n the c o n c a t e n a t i o n of g r a p h i c a l t r a n s f o r m a t i o n s i s important. The s i g n i f i c a n c e of the seguence of t r a n s f o r m a t i o n s a p p l i e d to a g r a p h i c a l 7 o b j e c t i s shown i n Fig» 2-1. Seguence _1 i s c a l i n g + rotation)_ o r i g i n a l p i c t u r e a f t e r s c a l i n g a f t e r r o t a t i o n Sequence 2 i r o t a t i o n + s c a l i n g j _ r o t a t i o n the sequence 8 Hence, the p r e v i o u s LIG g r a p h i c s s y s t e a can be improved by implementing i n t o the system the second aspect i n the f o r m u l a t i o n of t r a n s f o r m a t i o n s - 2^3 The Transformation Equations and M a t r i c e s - F i r s t , c o n s i d e r the t r a n s f o r m a t i o n s a p p l i e d to a s i n g l e p o i n t with r e s p e c t to the o r i g i n of the c o - o r d i n a t e system- The equations can then be a p p l i e d to the c o - o r d i n a t e s of the s e t of p o i n t s which d e f i n e s a g r a p h i c a l o b j e c t - A l g e b r a i c a l l y , the equations are [ 5 ] ; a. T r a n s l a t i o n of a p o i n t (X1,Y1) to (X2,Y2) by (Xt,Yt) X2 = X1 + Xt Y2 = Y1 + Yt b. R o t a t i o n of a p o i n t (X1 #Y1) with r e s p e c t to the o r i g i n through an angle B i n the a n t i - c l o c k w i s e d i r e c t i o n X2 = X1 cos© - Y1 s i n e Y2 = X1 s i n e + Y1 cose c. S c a l i n g the axes with value f a c t o r s Sx,Sy about the o r i g i n X2 •= X1 Sx Y2 = Y1 Sy When us i n g the above a l g e b r a i c eguations f o r the 9 concatenation of transformations, the re s u l t i n g set of algebraic equations w i l l be d i f f i c u l t to manipulate. Morever, these transformations can be represented in a uniform way by a 3x3 matrix [1 ]. This i s c a l l e d the homogeneous coordinate representation. The homogeneous coordinate representation of the transformations of a point about the or i g i n are given as follows: a. Translation r i I 1 0 OJ I 1 [X2 12 1] = [X1 Y1 1]|0 1 0j I I j Xt Yt 1 J L J b. Rotation r i | cose sine 0| I i [X2 Y2 1 ] = [X1 Y1 1]j-sine cose Oj I I |0 0 11 c. Scaling r 1 |Sx 0 01 [X2 Y2 1] = [X1 11 1]|0 Sy Oj i i jO 0 1J L J Then, for any seguence of t r a n s l a t i o n , r o t a t i o n and sca l i n g , the re s u l t i n g transformation can be represented as follows: 10 r T |a d 0| [X2 ¥ 2 1] = £X1 Y1 13 j fa e 01 lc f 11 Due to i t s uniform c h a r a c t e r i s t i c s , the homogeneous c o o r d i n a t e r e p r e s e n t a t i o n of the t r a n s f o r m a t i o n i s more convenient. 2.2.4 Transformations i n LIG In the LIG g r a p h i c s system, g r a p h i c a l p r i m i t i v e s are the b a s i c g r a p h i c a l o b j e c t s [ 2 0 ] . The v a r i e t y of g r a p h i c a l p r i m i t i v e s a v a i l a b l e i s d i s c u s s e d i n S e c t i o n 4.1. a l l other g r a p h i c a l o b j e c t s are to be b u i l t from t h i s o a s i c s e t of g r a p h i c a l p r i m i t i v e s . The LIG g r a p h i c a l p r i m i t i v e s are d e f i n e d w i t h i n a u n i t square, which i s 750 x 750 p o i n t s . Each g r a p h i c a l p r i m i t i v e i s as l a r g e as the dimension of the u n i t square. The g r a p h i c a l o b j e c t i s c o n s i d e r e d t o be l o c a t e d at a r e f e r e n c e p o i n t which i s the center of the u n i t square. The o r i g i n of the c o - o r d i n a t e system i s def i n e d to be i n the lower l e f t - h a n d c o rner of the scr e e n . Thus f o r a g r a p h i c a l p r i m i t i v e , the r e f e r e n c e p o i n t i s at (0.5,0.5), Hence, i f a g r a p h i c a l p r i m i t i v e i s transformed by r o t a t i o n through an angle 9, the f o l l o w i n g three steps need t o be performed: 11 (a) Translate from reference point (0.5,0.5) to the o r i g i n (0,0) (b) Rotate about the o r i g i n (c) Translate from the o r i g i n back to the reference point (0.5,0.5). Osing matrix notation, the homogeneous co-ordinate representation i s as follows: (a) Translate to the o r i g i n r - i |1 0 Oj ! I [X2 ¥2 1] = £ XI ¥1 1J|0 1 0| 1 J 1-0.5 -0.5 1j L J (b) fiotate about the o r i g i n by angle & i n anti-clockwise d i r e c t i o n r T |cose sine 0| 1 1 [X3 Y 3 1 ] = £X2 ¥2 IJJ-sine- cos8 0J I J JO 0 1J (c) T r a n s l a t e back to the r e f e r e n c e p o i n t 12 r T | 1 0 0| I I [Xl* Y4 1 ] = [X3 Y3 1 ]|0 1 0| I I |Q-5 0.5 1| L J Hence, we have [X4 Y4 1] = £X1 Y1 1][M] where r i r i r T r -j j r u 0| |1 0 0J|cose s i n e Oj|1 0 0| 1 1 1 II J i I [M]=|s v OJ = |0 1 0||-sine cose OJ 10 1 0| i l l i i II 1 | t w 1| 1-0.5 -0.5 1||0 0 1||0.5 0.5 1| L J L J L J L J The r e s u l t i n g t r a n s f o r m a t i o n matrix [Mj can be a p p l i e d to every c o - o r d i n a t e p a i r of the g r a p h i c a l p r i m i t i v e which i s t o be r o t a t e d . 2-J5 Non-commutativity property In the process of implementing the second aspect i n the f o r m u l a t i o n of t r a n s f o r m a t i o n s , the non-commutative property of r o t a t i o n and s c a l i n g has to be taken i n t o account, so as to u n i f y the method of implementation. A l l cases i n the c o n c a t e n a t i o n of t r a n s f o r m a t i o n s must be examined- • s i n g the procedure d i s c u s s e d i n S e c t i o n 2-4, the 13 d i f f e r e n t cases are formulated i n matrix form, using the f o l l o w i n g n o t a t i o n : (X1,Y1) i s the c o - o r d i n a t e p a i r before t r a n s f o r m a t i o n (X2,Y2) i s the c o - o r d i n a t e p a i r a f t e r t r a n s f o r m a t i o n (Xr,Yr) i s the c o o r d i n a t e p a i r of the r e f e r e n c e point before t r a n s f o r m a t i o n (Xt,Yt) i s the c o o r d i n a t e p a i r of the r e f e r e n c e p o i n t a f t e r t r a n s f o r m a t i o n (Sx,Sy) i s the s c a l e value 8 i s the angle of r o t a t i o n - I t has a p o s i t i v e value f o r r o t a t i o n i n the a n t i - c l o c k w i s e d i r e c t i o n , or i t has a negative value f o r r o t a t i o n i n the c l o c k w i s e d i r e c t i o n . r i n o oi i i [T0J=|0 1 0} , t r a n s l a t i o n from the o r i g i n a l I I r e f e r e n c e p o i n t l - X r -Yr 1| 14 r |0 1 0| I I £T1J= 10 1 oj I i iXr Yr 11 J r T |0 i 1 01 1 [ 1 2 ] = 1 10 1 1 1 01 1 1 I x t Yt 1 11 , translation back to the o r i g i n a l reference point |cose sine 0 | I 1 [R]=|-sine cose 0 ) , rotation matrix 1 1 1 0 0 1 1 L J r i |Sx 0 0| 1 I £S}=10 Sy 01 , scaling matrix 1 1 10 0 11 i. J A l i s t of a l l possible concatenations of transformations i s given as follows: a- Translation £ X 2 Y 2 1 ] = £ X 1 Y 1 1 ] £ T 0 ] £ T 2 ] b. Translation + rotation £ X 2 Y 2 1 ] = £ X 1 Y 1 1 ][ TO ]£ E ][ T 2 ] 15 c. T r a n s l a t i o n + s c a l i n g £X2 12 1] = £X1 Y1 1 3£T0 3£S ]£T2] d. T r a n s l a t i o n •+ r o t a t i o n + s c a l i n g £X2 12 1] = £X1 Y1 1]£T0]£B]£SJ£T2 j e. T r a n s l a t i o n + s c a l i n g + r o t a t i o n £X2 Y2 1] = £X1 Y1 1 ]£ TO ]£ S ]£ E ]£ T2 ] f . R o t a t i o n £X2 Y2 1] = £X1 Y1 1 ]£ TO ]£ fi J£ T1] g- R o t a t i o n + t r a n s l a t i o n £X2 Y2 1] = £X1 Y1 1 ]£ TO ][ R ]£ T2 ] h- R o t a t i o n + s c a l i n g £X2 Y2 1] = £X1 Y1 1 ]£ TO ]£ R ]£ S ]£ T1 ] i . R o t a t i o n + t r a n s l a t i o n + s c a l i n g £X2 Y2 1J - £X1 Y2 1 ]£ TO ]£ B ]£ S ]£ T2 J j . R o t a t i o n + s c a l i n g + t r a n s l a t i o n £X2 ¥2 1J '= £X1 ¥1 13£T0]£B3£S]£T2] k. S c a l i n g £X2 12 1j = £X1 Y1 1 ]£T0 j£S 3£T1 j 1» S c a l i n g + r o t a t i o n £X2 Y2 13 = £X1 Y1 1]£T0]£S]£R3£T13 m. S c a l i n g + t r a n s l a t i o n £X2 Y2 13 = £X1 Y1 1 3£ TO 3£ S J£T2 3 n» S c a l i n g + r o t a t i o n + t r a n s l a t i o n [X2 Y2 1] = [X1 ¥1 13£TO ] £S3£R3£T2 3 o- S c a l i n g + t r a n s l a t i o n + r o t a t i o n [X2 Y2 1] = [X1 Y1 1 ] [T0]£S JJ;R j [ T 2 J These f i f t e e n cases can be g e n e r a l i z e d by two cases. These two cases are l i s t e d as f o l l o w s ; Case 1 £ X 2 Y2 1 ] = [X1 Y1 1]£T] [ fi ][ S ][ T ] Case 2 £ X2 Y2 1 ] = [ X1 Y1 1 ][ T ][ S ][ R l'J !' Case 1 r e p r e s e n t s cases f o r d. T r a n s l a t i o n + r o t a t i o n + s c a l i n g h. R o t a t i o n + s c a l i n g i . R o t a t i o n + t r a n s l a t i o n + s c a l i n g j . R o t a t i o n + s c a l i n g + t r a n s l a t i o n Case 2 r e p r e s e n t s cases f o r e. T r a n s l a t i o n + s c a l i n g + r o t a t i o n 1. S c a l i n g + r o t a t i o n h. S c a l i n g + r o t a t i o n + t r a n s l a t i o n o. S c a l i n g + t r a n s l a t i o n + r o t a t i o n As f o r the remaining cases, they can be r e p r e s e n t e d by e i t h e r Case 1 or Case 2. For example, r o t a t i o n can be represented e i t h e r by Case 1 or Case 2 as S i = Sy = 1. The matrix £SJ w i l l be 17 |1 0 0| ) I [S]=|0 1 01 ( i . e . the u n i t matrix) i I |0 0 1J t. J T h e r e f o r e the only two cases to be f u r t h e r d i s c u s s e d are a. R o t a t i o n + s c a l i n g + t r a n s l a t i o n b. S c a l i n g + r o t a t i o n + t r a n s l a t i o n S e t t i n g Xr = Yr = 0-5,. and p u t t i n g Case 1 and Case 2 i n t o the form of a l g e b r a i c e q u a t i o n s , from Case 1, Set 1 X2 = Sx cose (X1 - 0.5) - Sx s i n e (11 - 0-5) + Xt Y2 = Sy s i n e (X1 - 0.5) + Sy cose (Y1 - 0.5) + Yt from Case 2, Set 2 X2 = Sx cose (X1 - 0.5) - Sy s i n e {11 - 0.5) + Xt Y2 = Sx s i n e (X1 - 0.5) + Sy cos8 (Y1 - 0-5) + Yt The implemention of the second aspect of the f o r m u l a t i o n of t r a n s f o r m a t i o n s i s based on the above two s e t s of eguations- 18 2-6 To Derive the A and B M a t r i c e s In the pr e v i o u s v e r s i o n of IIG, the s e t of e q u a t i o n s which was used i s Set 2- Represented i n matrix form, P2 = A»P1 + B r T |X2J where P2=J | |Y2| L. J r i i x i i PI=I i m i r i |Sx cose -Sy s i n e | A= i j |Sx s i n e Sy cose | r i i x t + 0.5 (Sy s i n e - sx cose) j |Yt - 0.5 (Sx s i n e + Sy cose) J L J The values A and B are s t o r e d i n s t e a d of Xt, Yt, Sx, Sy, and e. One m o d i f i c a t i o n (A2,B2) can be a p p l i e d t o another m o d i f i c a t i o n (A1,B1) as f o l l o w s P3 = A2 • P2 + B2 = A2 • ( A1 • P1 + Bl ) + B2 = A2 • A1 * P1 + A2 * B1 + B2 = C • P1 + D where 19 C = A2 * A1 D = A2 * B1 + B2' r T I X31 P3 = | ) , the point after transforming P1 twice | Y3| In order to keep t h i s feature and to implement. Set 1 and Set 2 into the LIG graphics system, the common aspects and differences between Set 1 and Set 2 was investigated. For s c a l i n g , rotation and t r a n s l a t i o n , the matrices are, from Set 2 . _ r i lSx cose -Sy sinei A1=| | JSx sine Sy cose | L J r -j \Tx - 0.5 (-Sy sine + Sx cos9) j B1=1 I |Ty - 0.5 (Sx sine + Sy cose) | L J For rotation, s c a l i n g and t r a n s l a t i o n , the matrices are, from Set 1 iSx cose -Sx sine | A 2= | | |Sy sine Sy cose | L J T 1 |.Xt - 0-5 (-Sx sine + Sx cose) j B2=| 1 |Yt - 0.5 (Sy sine + Sy cose-) 1 L J 20 An examination of the p a i r s (A1,A2) and (B1,B2) shows t h a t they are the same except i n two pl a c e s where Sx and Sy are interchanged- In the LIG g r a p h i c s system, the subroutine which s e t s up the matrices A and B i s named TRAMA. To s a t i s f y both t r a n s f o r m a t i o n o r d e r s , a m o d i f i c a t i o n i s made so t h a t the reguested matrices are generated according to the s p e c i f i e d o r d e r of t r a n s f o r m a t i o n - The modified TRAMA i s l i s t e d i n Appendix C- A parameter of the sub-program TRAMA ( v i z - IlfiANS ) must supply the order o f the t r a n s f o r m a t i o n s of s c a l i n g and r o t a t i o n - T h i s order of AT, SCALE, ANGLE i n a LIG statement can only be detected by the LIG preprocessor- The LIG preprocessor i s t h e r e f o r e modified a c c o r d i n g l y . F i g . 2.2 shows the r e s u l t s of the f o l l o w i n g LIG statements, •DISPLAY TRIANGLE AT 0-5,0.5 SCALE 0-3,0.5 ANGLE 1.57079 RAD; • DISPLAY TfilANGLE AT 0-5,0.5 ANGLE 1.57079 RAD SCALE 0.3,0.5; demonstrating the e f f e c t s of an interchange o f s c a l i n g and r o t a t i o n - For comparison purposes, the o r i g i n a l t r i a n g l e i s a l s o shown i n T i g - 2-2- Fig.2.2 Transformation order 22 I I I . SYNTACTIC IMPROVEMENT FOR LIG STATEMENTS 3.J D e s c r i p t i o n of Syntax Before a language i s generated, the s y n t a c t i c and semantic s t r u c t u r e of the language must be s p e c i f i e d . There are s e v e r a l ways t o d e s c r i b e the s y n t a c t i c s t r u c t u r e of a language. For example, there are: (a) The Backus Normal Form [ 8 ] (h) S y n t a c t i c Chart £ 9 ] (c) Compiler D i r e c t i n g Statement and Sentence [19] The Compiler D i r e c t i n g Statement and Sentence i s the method used to d e s c r i b e the language COBOL (Common Business O r i e n t e d Language). For comparison purpose, only the Backus Normal Form and the S y n t a c t i c Chart are presented, as both of them have been used to d e s c r i b e the language ALGOL [ 9 ] £ 1 8 ] . 3-2 The Backus Normal Form The Backus Normal Form i s a metalanguage f o r the d e f i n i t i o n of the syntax of programming languages- Four metasymbols are employed- T h e i r d e f i n i t i o n s are the f o l l o w i n g : Symbol D e f i n i t i o n < > Angular brackets e n c l o s i n g a c o n s t r u c t . A c o n s t r u c t i s developed from the d e f i n i t i o n s of 2 3 the language- I f a c o n s t r u c t appears on the l e f t - hand s i d e of a d e f i n e s i g n ( i - e - :; = ) , i t i s d e f i n e d with the d e f i n i t i o n s on the r i g h t - h a n d s i d e o f the d e f i n e s i g n - I f a c o n s t r u c t appears on the righ t - h a n d s i d e , i t i s used to d e f i n e the c o n s t r u c t on the l e f t - h a n d s i d e - ::- Define s i g n means t h a t t h e c o n s t r u c t on the l e f t of the d e f i n e s i g n i s being d e f i n e d by the c o n s t r u c t or c o n s t r u c t s on the r i g h t - 1 I n c l u s i v e or means that the c o n s t r u c t on the l e f t of the v e r t i c a l l i n e i s i n t e r c h a n g e a b l e with the c o n s t r u c t on the r i g h t - As an example, the d e f i n i t i o n of an i n t e g e r i n ALGOL and i t s s y n t a c t i c d e s c r i p t i o n i n Backus Normal Form i s l i s t e d as f o l l o w s ; <integer> :; = <unsigned integer> | + <unsigned inte g e r > J - <unsigned i n t e g e r > <unsigned inte g e r > ::= <digit> j <unsigned integer> <digit> <digit> ;:= 0|1]2 J314 I 5|6|7|8|9 XD7 Fig.3.1 S y n t a c t i c Chart 2 5 The same d e f i n i t i o n o f an i n t e g e r presented i n f l o w c h a r t form by a S y n t a c t i c Chart i s shown i n F i g . 3-1. The compiler generator XPL £12] which i s used In the ge n e r a t i o n of the language LIG, r e q u i r e s a d e s c r i p t i o n of the s y n t a c t i c s t r u c t u r e of the language LIG i n Backus Normal Form. S p e c i f i c a l l y , u s i n g the Backus Normal Form n o t a t i o n , the g r a p h i c a l assignment of LIG was d e f i n e d as f o l l o w s - (Note: each BNF statement i s c a l l e d a production rule.) < g r a p h i c a l assignment> <graphical v a r i a b l e > <replace> <expression> <replace> ::= := <expression> ::= <primary> I <expression> + <primary> I <expression> - <primary> <primary> ::= <display v a r i a b l e > | <display v a r i a b l e > <modification> <display v a r i a b l e > ::= <g r a p h i c a l v a r i a b l e > J < g r a p h i c a l p r i r a i t i v e > | < l i t e r a l > <graphical v a r i a b l e > ::= < i d e n t i f i e r > I < i d e n t i f i e r > ( <variable> ) <variable> ::= < i d e n t i f i e r > | <number> <modification> <modifier> j <modification> <modifier> <modifiar> = AT <arguments> | SCALE <arguments> | ANGLE <variable> | ANGLE <variable> HAD J ANGLE <variable> DEG | FROM <arguments> | TO <arguments> j VSYM <varia.ble> | HSYM <variable> <arguments> ::= <variable> j <arguments> , <variable> <graphical p r i m i t i v e > BLANK| LINE] SQUARE |TRIANGLEj CIRCLE|SCIHCLE < i d e n t i f i e r > , <number> and < l i t e r a l > are i n t e r n a l l y d e f i n e d i n the XPL compiler [ 1 2 ] . Hence, t o make the g r a p h i c a l assignment of a g r a p h i c a l v a r i a b l e TAT t o the d i s p l a y v a r i a b l e TRIANGLE at the c o - o r d i n a t e p o i n t (0.6,1.0), the LIG statement i s coded as f o l l o w s : * TAT := TRIANGLE AT 0.6,1.0 ; The symbols * and ; are d e f i n e d i n the o r i g i n a l LIG language. The symbol * i s used to n o t i f y the LIG preprocessor t h a t t h i s i s not a F o r t r a n statement- The LIG preprocessor 27 w i l l t r a n s l a t e the source statement beginning with the symbol *, and i t passes a l l F o r t r a n statement d i r e c t l y t o the output f i l e . The symbol ; i s used to denote the end of a LIG statement. 3.3 Gra£hical V a r i a b l e and M o d i f i c a t i o n A t t r i b u t e s A two-dimensional p i c t u r e i s composed of l i n e s . There w i l l be v i s i b l e and i n v i s i b l e l i n e s . Considered as a s i n g l e u n i t , a p i c t u r e i s c a l l e d a g r a p h i c a l o b j e c t . The value of a g r a p h i c a l v a r i a b l e i s a g r a p h i c a l o b j e c t [ 2 1 ] . A g r a p h i c a l v a r i a b l e can be denoted by an i d e n t i f i e r (e.g. LINE1, FLOSEE, HOUSE e t c ) . I t can a l s o be denoted by a s u b s c r i p t e d v a r i a b l e . In Backus Normal Form n o t a t i o n , < graphical v a r i a b l e > ::= < i d e n t i f i e r > I < i d e n t i f i e r > { <variable> ) <variable> :;= < i d e n t i f i e r > | <number> Hence P(1) and BOBT are l e g a l g r a p h i c a l v a r i a b l e naxes. However, P(SQST(2.3+N)) and Q(1,4) are i l l e g a l g r a p h i c a l v a r i a b l e names. The s u b s c r i p t of the f i r s t g r a p h i c a l v a r i a b l e i s a f u n c t i o n and the second g r a p h i c a l v a r i a b l e i s not a s i n g l e s u b s c r i p t e d v a r i a b l e . Compared to many h i g h - l e v e l programming languages, the s u b s c r i p t of a v a r i a b l e can be a number, an i d e n t i f i e r , a f u n c t i o n or even an a r i t h m e t i c e x p r e s s i o n . In order t o r e t a i n 28 t h i s compact f e a t u r e , the s y n t a c t i c s t r u c t u r e and i t s implementation i n LIG was improved- As mentioned i n S e c t i o n 2 - 1 , a g r a p h i c s system should a l l o w the a p p l i c a t i o n programmer t o modify and manipulate a g r a p h i c a l o b j e c t - In LIG statements, the m o d i f i c a t i o n o p e r a t o r s are AT, SCALE, ANGLE, FROM, TO, VSYM AND HSYM- The value f a c t o r a s s o c i a t e d with these m o d i f i c a t i o n o p e r a t o r s i s c a l l e d a m o d i f i c a t i o n a t t r i b u t e . With r e f e r e n c e t o the Backus Normal Form n o t a t i o n i n S e c t i o n 3-2, the f o l l o w i n g examples are l e g a l LIG m o d i f i c a t i o n s i n a g r a p h i c a l assignment statements, AT X, Y SCALE 0-5,0.1 ANGLE 90 DEG However, the f o l l o w i n g are i l l e g a l LIG m o d i f i c a t i o n , i n g r a p h i c a l assignment statements, AT (3 + 4) , (I/N*J) SCALE SQBT(N) ,B00T(6+T) ANGLE H (1) DEG In the prev i o u s LIG syntax, i d e n t i f i e r s and numbers were the o n l y two l e g a l m o d i f i c a t i o n a t t r i b u t e s - T h e r e f o r e , the LIG syntax was improved, so that the m o d i f i c a t i o n a t t r i b u t e s can a l s o be a s u b s c r i p t e d v a r i a b l e , a F o r t r a n f u n c t i o n or an 29 a r i t h m e t i c e x p r e s s i o n . These improvements are r e f l e c t e d i n the syntax as given i n Appendix A- A t t r i b u t e Assignment and Numerical Assignment The m o d i f i c a t i o n a t t r i b u t e s a s s o c i a t e d with a g r a p h i c a l v a r i a b l e are s t o r e d i n the data base. There are two LIG statements which can be u t i l i z e d t o modify and examine the values of any simple a t t r i b u t e bonded t o a g r a p h i c a l v a r i a b l e - They are the a t t r i b u t e assignment statement and the numerical assignment statement. In Backus Normal Form n o t a t i o n , the grammatical r u l e s are: < a t t r i b u t e assignment> ::= < a t t r i b u t e f u n c t i o n > = <variable> <numerical a s s i g n m e n t ::= <variable> = < a t t r i b u t e functioa> < a t t r i b u t e f u n c t i o n > ::= <functionhead> <display v a r i a b i e > ) <functionhead> ::= <functicnname> ( <f unctionname> ::= XLOC|YLGCJ XSCALE|YSCALEJ ANGLEJ SUBSCRIPT The a t t r i b u t e assignment statement changes the previous a t t r i b u t e of a g r a p h i c a l v a r i a b l e t o a new one s p e c i f i e d by the F o r t r a n v a r i a b l e on i t s r i g n t hand s i d e - The numerical assignment statement e x t r a c t s the value of the a t t r i b u t e 30 bonded to a g r a p h i c a l v a r i a b l e and a s s i g n s the value t o a s p e c i f i e d FORTRAN v a r i a b l e - There are cases where an a p p l i c a t i o n programmer would l i k e t o change the a t t r i b u t e value by a s s i g n i n g the value of a v a r i a b l e , a f u n c t i o n or an a r i t h m e t i c e x p r e s s i o n . In the case of a numerical assignment statement, he might wish t o a s s i g n the e x t r a c t e d a t t r i b u t e value to a s u b s c r i p t e d F o r t r a n v a r i a b l e - A l l these have been implemented to improve the s y n t a c t i c s t r u c t u r e of the LIG statements- These improvements are a l s o r e f l e c t e d i n the syntax as given i n Appendix A. 3.5 LIG Preprocessor and Im£rovement fiesult To change the LIG P r e p r o c e s s o r , the f i r s t step i s t o formulate the c o r r e c t Backus Normal Form f o r the LIG s y n t a c t i c s t r u c t u r e - The XPL a n a l y z e r takes the LIG syntax i n BNF form and determines i f i t i s a c c e p t a b l e f o r the p a r s e r of the preprocessor- I f there i s no e r r o r , a t a b l e of XPL statements i s generated £ 1 2 ] - L I G SYNTAX ANALYZER (BNF) (XPL) 31 The second step i s to modify the XPL SKELETON- Then the t a b l e generated by the XPL a n a l y z e r , the syntax-semantics and the modified XPL SKELETON are combined and input to the XPL compiler as source codes. The r e s u l t i n g object code i s the LIG Preprocessor which accepts the r e v i s e d s y n t a c t i c s t r u c t u r e of LIG statements. TABLE L I G P R E P R O - C E S S O R S K E L E T O N A l i s t i n g of the t e s t r e s u l t i s shown i n the l a s t two pages of t h i s s e c t i o n . For the g r a p h i c a l assignment statement * 0BJ1(SUB1) := OBJ2(S0B2) AT X,¥ SCALE SX,S¥ ANGLE A ; , the LIG preprocessor w i l l generate the f o l l o w i n g F o r t r a n statements: CALL ASSIG(»0BJ1 ',S0B1) CALL PRIMA(1,* OBJ2 •,SUB2,X,Y,SX,SY,A,1) The l a s t parameter of PRIMA w i l l be 2 i f s c a l i n g i s a p p l i e d before r o t a t i o n - The preprocessor t r a n s l a t e s a. numerical assignment statement i n t o a F o r t r a n assignment statement with the f u n c t i o n C0RF1 on the r i g h t hand s i d e . An a t t r i b u t e assignment statement w i l l be t r a n s l a t e d as a F o r t r a n c a l l statement ( i . e . the subprogram CHCHOR i s invoked). The f i r s t parameter i n CHCHOR s p e c i f i e s whether X, 1, SX, SI, ANGLE or SUBSCRIPT i s to be examined or mod i f i e d . L I G - PREPROCESSOR (MAY 27,1976 VERSION) TODAY IS: 06-28-76. TIME = 15:46:55.80. 1 • *NOVA VERSION 2 *STATE 1: 3 C TO TEST THE LIG SYNTACTIC STRUCTURE H C 1 S T f j HE GRAPHICAL ASSIGNMENT STATEMENTS 5 *OBJ(M(N(0(P(Q(R(S{((D+D)/(M + D ) ) * G ) ) ) ) ) ) ) ) :=CIRCLE AI (S + D (I) +M (D*G+F/K) 6 */M (1+1) }, (SQRT ( (J + K)/M) ) ANGLE FMT SCALE HAHA; 7 *OBJ (SQRT(I + 2*K/D) ) :=CIRCLE AT (X3+X4* (SQfiT (D) ) ) ,Y3 SCALE (F (I*H) ) , (M-D) 8 *ANGLE ( (ROOT (F)+SQRT (G) ) *D) ; 9 C 2ND, THE NUMERICAL ASSIGNMENT STATEflENTS 10 *NEM1 = XLOC(0BJ2); 11 *NOMBEH(I) = YLOC (Q (1+1) ) ; 12 *INT ( (SQRT (M**2)+C-D/Q) *D(I)-D) =XSCALE (F (ROOT (F*G) )) ; 13 *INT(1) =YSCALE (OBJ (1) ) ; 14 *INT (I) = ANGLE (M (6) ) ; 15 *INT(I*J/K) = SUBSCRIPT(OBJJJJJ) ; 16 C 3RD, ATTRIBUTE ASSIGNMENT STATEMENTS 17 *XLOC(OBJ1) =ARITHEXP; 18 * YLOC (OBJ (2) ) = A + C /D; 19 *XSCALE (OBJ (I) ) =M**SQRT (D/C + D) ; 20 *YSCALE (OBJ (ROOT (M) *D-C (I) ) ) =SQRT (M**N**1) - ROOT (Q); 21 *ANGLE (QUEET) = 6 ; 22 *SUBSCRIPT (INTEG (6 + 6) } = 6+1-4**2; 23 STOP 24 *END STATE 1: 1 *EOF EOF EOF * MAIN PROGRAM GENERATED COMPILATION TIME 0:0:0.14. END OF COMPILATION NO ERRORS WERE DETECTED. LIG PREPROCESSOR OUTPUT C NOVA VERSION (MAY 27, 1976) OVERLAY OVS01 SUBROUTINE S01 C . STATS 1 LOGICAL HITON COMMON IDUMMY(5147) C TO TEST THE LIG SYNTACTIC STRUCTURE C 1ST , THE GRAPHICAL ASSIGNMENT STATEMENTS CALL ASSIG(»OBJ CALL PRIMA (1 ,'CIRCLE *) ) ,HAHA,HAHA,FMT,2) CALL ASSIG ('OBJ CALL PRIMA(1,'CIRCLE *OT (F) + SQRT (G) ) *D) ,1) C 2ND, THE NUMERICAL ASSIGNMENT STATEMENTS NEM 1 = CORF1 (1 , 'OBJ2 ',0) NUMBER (I) = CORF1(2,'Q ',(1 + 1)) INT ( (SQRT (M**2) + C-D/Q) *D(I)-D) = CORF1 (3,»F INT (1) = CORF 1 (4, 'OBJ • , (1) ) INT(I) = CORF 1 (5, ' M • , (6) ) INT(I*J/H) = CORF1 (6,'OBJJJJJ »,0) C 3RD, ATTRIBUTE ASSIGNMENT STATEMENTS (M(N(0(P{Q(R(S(((D+D)/(M+D))*3) )))>))) ) ',0, (S + D(I)+M(D*G + F/K)/M(I+1)) , (SQRT((J+K)/M (SQRT(I + 2*K/D) ) ) ',0, (X3 + X4*(SQRT(D) ) ) ,Y3, (F (I+M) ) , (M-D) , ((RO (ROOT (F*G))) CALL CHCHOR(1,'OBJ1 CALL CALL CALL CALL CALL STOP END CHCHOR (2, • O B J C H C H O R(3, • O B J CHCHOR(4 , ' O B J CHCHOR(5,'QUEET CHCHOR(6,•INTEG ,0,ARITHEXP) , (2) fA + C/D) , (I) ,M**SQRT (D/C+D) ) , (ROOT(M) *D-C(I)) ,SQRT(M**N**1)-BOOT(Q)) ,0,6) , (6+6) ,FLOAT(6 + 1-4**2) ) 35 •IV. PICTOEE GENERATION BY GRAPHICAL FUNCTIONS 4.1 P i c t u r e Generation i n LIG In the h i g h - l e v e l g r a p h i c s language LIG, the g r a p h i c a l assignment statement i s used t o b u i l d up a p i c t u r e , which i s c a l l e d the g r a p h i c a l o b j e c t [ 7 ] . The g r a p n i c a i d i s p l a y statement w i l l p l a c e a g r a p h i c a l o b j e c t on the s c r e e n . G r a p h i c a l o b j e c t s can be decomposed i n t o b a s i c g r a p h i c a l o b j e c t s , which a r e c a l l e d g r a p h i c a l p r i m i t i v e s . These g r a p h i c a l p r i m i t i v e s cannot be f u r t h e r decomposed i n t o o t h e r g r a p h i c a l elements. The s e t of g r a p h i c a l p r i m i t i v e s c o n s i s t s o f BLANK, LINE, TRIANGLE, SQUARE, CIRCLE and SCIaCLE ( r e f e r t o F i g . 4. 1) . LINE TRIANGLE SQUARE CIRCLE SCIRCLE BLANK A OC FIG. 4.1 PRIMITIVES A l l LIG g r a p h i c a l p r i m i t i v e s are de f i n e d w i t h i n a u n i t square with the r e f e r e n c e p o i n t at the c e n t r e ox the u n i t square. Using these s i x g r a p h i c a l p r i m i t i v e s , other g r a p h i c a l o b j e c t s are b u i l t . The f o l l o w i n g two examples show the forma t i o n of a 2-input AND gate and the p i c t u r e of a t r u c k . (a) 2-input AND gate ( r e f e r to F i g . 4.2) * GATE := LINE FROM 0.1, 0.5 TO 0.3, 0.5 * + SCIBCLE SCALE 0.6, 0.4 AT 0-6, 0-5 * + LINE FROM 0.6, 0-7 TO 0-6, 0-3 * + LINE FROM 0-6, 0.6 TO 0.9, 0-6 * + LINE FROM 0-6, 0-4 TO 0-9, 0-4; * DISPLAY GATE; (b) A tr u c k ( r e f e r t o F i g - 4.3) * TRUCK := SQUARE SCALE 0.3 AT 0.35, 0-65 * + SQUARE SCALE 0.8, 0.3 AT 0-5, 0-35 * + CIRCLE SCALE 0-2 AT 0-3, 0-2 * + CIRCLE SCALE 0-2 AT 0.7, 0.2; * DISPLAY TRUCK;  38 4.2 The LIG Data Base The LIG data base s t r u c t u r e i s shown i n F i g - 4.4- I t i s a l i n k e d l i s t s t r u c t u r e £3] £4] £7] [ 2 4 ] , Luring system i n i t i a l i z a t i o n , the name of the g r a p h i c a l p r i m i t i v e s are i n s e r t e d i n t o the NAHLST. A hash algorithm i s employed f o r name i n s e r t i o n £11] £13]. This algorithm was p r e v i o u s l y used i n the previous LIG graphics system. The a s s o c i a t e d LOCLST contains the po i n t e r t o a LIG data block- There are 200 LIG data blocks. Each data block c o n s i s t s of the m o d i f i c a t i o n a t t r i b u t e values i n compact form, the s u p e r p o s i t i o n p o i n t e r (SOPP), the d e f i n i t i o n pointer (DEFP), the index, the index pointer and the use p o i n t e r . For a g r a p h i c a l p r i m i t i v e , the d e f i n i t i o n p o i n t e r i s biased by a value of 10000. I t s true value i s used as a p o i n t e r , p o i n t i n g to the f i r s t entry i n the XYP l i s t - The XYP l i s t contains the co-ordinate p a i r s and the Pen-value, a value i n d i c a t i n g whether the pen i s i n w r i t i n g or non-writing p o s i t i o n - To d i s p l a y a p i c t u r e on the screen, the alg o r i t h m discussed i n Section 2.6 i s used. In order to keep t r a c k of a l l the m o d i f i c a t i o n a t t r i b u t e values, a push down stack i s implemented. 39 ^ NAMLST ^ LOCLST Y PEN 1 < • * TRUCK := SQUARE a + SQUARE b + CIRCLE c + CIRCLE d ; where a,b,c and d are m o d i f i c a t i o n a t t r i b u t e s . Fig.4.4 LIG- Data Base S t r u c t u r e 40 Besides the s u p e r p o s i t i o n o p e r a t o r •+*, there i s a l s o a d e l e t i o n operator The d e l e t i o n operator w i l l d e l e t e the a p p r o p r i a t e data block from the LIG data base, The d e l e t e d data block i n the previous LIG v e r s i o n could not be re-used a g a i n . For the improved.LIG g r a p h i c system, a simple garbage c o l l e c t i o n a l g o r i t h m i s implemented- The r e l e a s e d data block i s l i n k e d back to the data b l o c k pool, wnich i s then a v a i l a b l e f o r f u r t h e r use. 4^3 G r a p h i c a l Function As there are only s i x b a s i c LIG g r a p h i c a l p r i m i t i v e s , the g e n e r a t i o n of a g r a p h i c a l o b j e c t i s somewhat l i m i t e d . T h i s i s p a r t i c u l a r l y t r u e when an a p p l i c a t i o n programmer wants to generate a g r a p h i c a l o b j e c t composed of i r r e g u l a r l y curved l i n e s . An a p p r o p r i a t e example i s the g e n e r a t i o n of an a r c . Hence, a g r a p h i c a l f u n c t i o n f e a t u r e was implemented i n the graphic language LIG [10] [ 1 4 ] . By d e f i n i t i o n , a f u n c t i o n i s almost a u n i v e r s a l o p e r a t o r , which y i e l d s a r e s u l t , c a l l e d the value of the f u n c t i o n . In the f o l l o w i n g F o r t r a n statement, A = SUM (C,D) SUM i s a f u n c t i o n , whose value i s the sua of C and D. The r e s u l t i n g value of C + D i s a s s o c i a t e d with the name SUM- S i m i l a r l y , a g r a p h i c a l f u n c t i o n i s a f u n c t i o n which d e l i v e r s 41 a value of type g r a p h i c a l . The sequence of o p e r a t i o n s d e f i n i n g the f u n c t i o n may be dependent on a set of i n p u t parameters which u s u a l l y appear i n an argument l i s t . For the above F o r t r a n statement, with d i f f e r e n t C and D, the r e s u l t i n g A i s d i f f e r e n t . A g r a p h i c a l f u n c t i o n generates d i f f e r e n t g r a p h i c a l o b j e c t s depending on the parameters. A g r a p h i c a l f u n c t i o n i s invoked by i t s appearance i n a g r a p h i c a l e x p r e s s i o n . Thus, AfiC(X1, Y1, X2, ¥2, X3, Y3) i s a g r a p h i c a l f u n c t i o n which w i l l generate an arc passing through the p o i n t s (21,11), (X2,Y2) and (X3, ¥3) - For the LIG statement, * DISPLAY ABC (0.1, 0.2, 0.4, 0.6, 0.1, 0.3); , the g r a p h i c a l f u n c t i o n ABC i s r e f e r r e d to, and so the reguested arc i s generated and d i s p l a y e d on the s c r e e n . In t h i s case, the parameters w i l l not be s t o r e d i n the data base. For the LIG statements * P := ABC(X1, Y1, X2, Y2, X3, ¥3) AT X4, Y4 SCALE M ; * DISPLAY P ; the value of the parameters and the m o d i f i c a t i o n a t t r i b u t e s have t o be s t o r e d i n t o the data base. These data values w i l l be r e t r i e v e d when the g r a p h i c a l o b j e c t P i s to be d i s p l a y e d on the s c r e e n . 42 iii£ il£l®lSSi§ii2a Scheme In the former LIG g r a p h i c s system, when a g r a p h i c a l v a r i a b l e was r e f e r r e d to f o r d i s p l a y on the s c r e e n , i t s name was checked by the s ubroutine NMSRCH (name s e a r c h i n g sub- program)- I f i t i s not a g r a p h i c a l p r i m i t i v e or a p r e d e f i n e d g r a p h i c a l o b j e c t , an e r r o r message i s generated. For the implementation of the g r a p h i c a l f u n c t i o n f e a t u r e , i n s t e a d of g e n e r a t i n g an e r r o r message, a name not i d e n t i f i e d as a g r a p h i c a l v a r i a b l e or p r i m i t i v e i s handled as a f u n c t i o n c a l l . The program w i l l c a l l the s ubroutine FSSCH ( g r a p h i c a l f u n c t i o n switch subprogram) which w i l l f u r t h e r check f o r the e x i s t e n c e of t h i s g r a p h i c a l f u n c t i o n . E r r o r messages w i l l be generated i f there i s no such g r a p h i c a l f u n c t i o n - I f there i s a match, the system or user g r a p h i c a l f u n c t i o n i s c a l l e d . That i s , the a p p r o p r i a t e X Y P - l i s t w i l l be generated and passed back to the s ubroutine DISPL ( g r a p n i c a l o b j e c t d i s p l a y i n g subprogram). DISPL w i l l apply the necessary m o d i f i c a t i o n to t h i s X Y P - l i s t and d i s p l a y the generated p i c t u r e on the screen- In the case when a g r a p h i c a l assignment i s i n v o l v e d , as i n * P : = A(M,N) AT X, Y SCALE SX, SY ANGLE A DEG; , the v a l u e s of the m o d i f i c a t i o n a t t r i b u t e s i n compact form are s t o r e d i n t o a data b l o c k . The name of the g r a p h i c a l f u n c t i o n 43 A, and the parameters (M,N) have to he kept- This i n f o r m a t i o n i s r e g i s t e r e d i n another data block- The d e f i n i t i o n p o i n t e r of t h i s data b l o c k , which c o n t a i n s the m o d i f i c a t i o n a t t r i b u t e v a l u e s , i s b i a s e d by a value of 20,000, I t s true value i s a p o i n t e r , p o i n t i n g to the data block which s t o r e s the g r a p h i c a l f u n c t i o n name and the a s s o c i a t e d parameters. T h e r e f o r e , when P i s to be d i s p l a y e d on the s c r e e n , the bias e d p o i n t e r w i l l be used i n d i r e c t i n g the necessary a c t i o n to be performed. 4.5 Generation of S p e c i a l Plane Curves by a G r a p h i c a l F u n c t i o n ^ Examples Using the g r a p h i c a l f u n c t i o n f e a t u r e , an a p p l i c a t i o n programmer can generate a g r a p h i c a l o b j e c t which i s im p o s s i b l e i n the pre v i o u s LIG g r a p h i c system- Some of the examples are l i s t e d as f o l l o w s : a) Ml£2£Y.Si2id with f o u r cusps ( r e f e r t o F i g - 4.5) T h i s i s a curve d e s c r i b e d by a po i n t P on a c i r c l e of r a d i u s a/4 as i t r o l l s on the i n s i d e of a c i r c l e of r a d i u s a. The curve can be d e s c r i b e d by the eguations i n parametric form: x = a c o s 3 A y = a s i n 3 A Using LIG statements, the f u n c t i o n was coded as f o l l o w s * FUNCTION CUSPS: C TO GENERATE A HYPOCYCLOID WITH FOUR CUSPS 44 * START (1-0,0.5) ; DO 10 K=1,5 9 I=T*Q.1047199 T1=C0S (T) T2=SIN (T) T3=0.5+Q.5*T1*T1*T1 T4=0-5-Q.5*T2*T2*T2 * FORBAED(T3,T4) ; 10 CONTINUE * STOP (1-0,0-5) ; RETURN E N D (fa) Three-leaved Rose (refer to Fig- 4.6) The curve i s described by the eguation r=a cos 3A . Using LIG statements, the function was coded as follows; * FUNCTION R0SE3: C TO GENERATE A ROSE OF 3 LEAVES ANGLE^O.01282 * START (1.0,0.5) ; DO 10 K=1,4 90 T=K*ANGLE TT=A*COS (3*T) T1 = 0.5*TT*COS{T) T2=0.5-TT*SIN (T) * FORWARD (T1, T2) ; 10 CONTINUE * STOP (1.0/0.5) ; RETURN END ( c) l2ii£~i§.ived Rose ( r e f e r to F i g . 4.7) The curve i s d e s c r i b e d by the eguation r=a cos2A. Using LIG statements, the f u n c t i o n was coded as f o l l o w s : * FUNCTION ROSE4: C TO GENERATE A ROSE OF 4 LEAVES ANGLE=0.00641 * START (1.0,0-5) ; DO 10 K=1,4 90 T=K*AHGLE TT=A*COS (4*T) T1 = 0. 5+TT*COS (T) T2=0.5-TT*SIN{T) * FORWARD(11,T2); 10 CONTINUE * STOP (1.0,0.5) ; RETURN END In g e n e r a l , f o r the case (b) and (c) the eguation i s r = a cos nA or r = a s i n nA The generated g r a p h i c a l o b j e c t has n l e a v e s i f n i s odd, or 2n l e a v e s i f n i s even and i t degenerates i n t o a c i r c l e f o r n = 0. Using LIG statements, the f u n c t i o n was coded as f o l l o w s : * FUNCTION EOSE(N): ANGLE=0-01282 L=N/2 L-=L*2 IF (N.NE-L)ANGLE=0.00641 * START (1.0,0-5) ; DO 10 K=1,490 T=K*ANGLE TT=A*COS (N*I) T1=Q-5+IT*COS (T) T2=0.5-TT*SIN(T) * FORWARD (T1,T2) ; 10 CONTINUE * STOP (1-0,0-5) ; RETURN END 4.6 G r a g h i c a l Assignment Statement with a G r a p h i c a l F u n c t i o n Shen a g r a p h i c a l f u n c t i o n i s invoked i n a g r a p h i c a l assignment statement, the name of the g r a p h i c a l f u n c t i o n and i t s a s s o c i a t e d parameters have to be s t o r e d i n t o the LIG data base- In the d i s p l a y process, t h i s i n f o r m a t i o n i s r e t r i e v e d from the data base- Computations are then performed and the reguested g r a p h i c a l o b j e c t , which i s generated by the g r a p h i c a l f u n c t i o n , i s b u i l t - A f t e r a p p l y i n g the necessary m o d i f i c a t i o n s to t h i s generated g r a p h i c a l o b j e c t , i t w i l l be d i s p l a y e d on the s c r e e n . For example, the LIG statements * P:= ROSE(O) + ROSE (2) + ROSE (4) ; * DISPLAY P ; w i l l generate a p i c t u r e as shown i n FIG- 4 .8 - Fig.4.6 Three leaved rose  50 V. CONCLUSION a f t e r i n v e s t i g a t i n g the e f f e c t of a p p l y i n g a d i f f e r e n t seguence of t r a n s f o r m a t i o n s to the same g r a p h i c a l o b j e c t , i t was shown that the p i c t u r e s generated were not i d e n t i c a l . Thus, the dependence on the order of t r a n s f o r m a t i o n i s s i g n i f i c a n t . The previous LIG g r a p h i c s system i g n o r e s the order of appearance of the t r a n s f o r m a t i o n e n t i t y i n a LIG statement. Then f o r whatever seguence of t r a n s f o r m a t i o n s were a p p l i e d to a g r a p h i c a l o b j e c t , the same p i c t u r e was generated. i s the order of appearance of the t r a n s f o r m a t i o n e n t i t y i n a LIG statement can only be detected by the LIG p r e p r o c e s s o r , the XPL Skeleton was modified to i n c o r p o r a t e the d e t e c t i o n of the t r a n s f o r m a t i o n seguence. Then a modified LIG preprocessor was generated by means of the XPL c o m p i l e r . The LIG s u p p o r t i n g system was modified as w e l l , such t h a t i t w i l l generate the a p p r o p r i a t e p i c t u r e - The grammar of the previous LIG g r a p h i c s language does not accept a r i t h m e t i c e x p r e s s i o n s i n any LIG statements. The m o d i f i c a t i o n a t t r i b u t e and the s u b s c r i p t c o u l d o n l y be a number or an i d e n t i f i e r . In order to accept any imbedded a r i t h m e t i c e x p r e s s i o n , the grammar of the LIG g r a p h i c s language was changed. a i t h 51 the r e v i s e d grammar, a new XPL t a b l e was generated, and was used to b u i l d the r e v i s e d LIG preprocessor- The LIG statements which were a f f e c t e d by the changed grammatical r u l e s are the g r a p h i c a l assignment statement, the numerical assignment statement and the a t t r i b u t e assignment statement. A g r a p h i c a l f u n c t i o n f e a t u r e was proposed and i n c o r p o r a t e d i n t o the LIG gr a p h i c s system- I t was shown t h a t a v a r i e t y of g r a p h i c a l o b j e c t s can be generated by the use of t h i s f e a t u r e - The g r a p h i c a l o b j e c t generated a l s o depends on the a s s o c i a t e d parameters- The grammar of the pre v i o u s LIG gr a p h i c s language was modified t o accept the g r a p h i c a l f u n c t i o n f e a t u r e . The LIG s u p p o r t i n g system was a l s o modified- The r e v i s e d LIG g r a p h i c s system w i l l d i s t i n g u i s h a g r a p h i c a l f u n c t i o n from a g r a p h i c a l v a r i a b l e . At the same time, a simple garbage c o l l e c t i o n a l g o r i t h m was implemented. Thus, a r e l e a s e d data block can be made a v a i l a b l e f o r f u t u r e use. In the previous LIG g r a p h i c s system, r e l e a s e d data b l o c k s were not made a v a i l a b l e f o r re-use. The f o l l o w i n g l i s t summarizes the improvemeats, which have been implemented i n t o the LIG gra p h i c s language and system: (a) For concatenated t r a n s f o r m a t i o n s , the r e s u l t i n g t r a n s f o r m a t i o n has the same e f f e c t as s e q u e n t i a l a p p l i c a t i o n s of the o r i g i n a l t r a n s f o r m a t i o n s . (b) LIG statements can have imbedded a r i t h m e t i c e x p r e s s i o n s . (c) More v a r i e t y of g r a p h i c a l o b j e c t s can be generated by means of g r a p h i c a l f u n c t i o n s . Using a g r a p h i c a l f u n c t i o n , the g r a p h i c a l o b j e c t can be changed dynamically by a l t e r i n g the a s s o c i a t e d paramenter l i s t . (d) , The garbage c o l l e c t o r scheme enables the r e - use of r e l e a s e d data b l o c k s . (e) The LIG system s u p p o r t i n g subprograms were recoded and combined to reduce the number of unnecessary su b r o u t i n e c a l l s . T h i s reduces the p o s s i b i l i t y of stack overflow during program e x e c u t i o n . F u r t h e r improvements which can be made to the LIG g r a p h i c s language and system are; (a) I n v e s t i g a t e the p o s s i b i l i t y of using the c e n t e r of the screen as the o r i g i n of the co- o r d i n a t e system. (b) D e l e t e the symbol * and ; from the LIG statement. (c) Modify the HITOB c o n s t r u c t , so that 53 i d e n t i f i c a t i o n w i l l not be made to an non- d i s p l a y e d g r a p h i c a l v a r i a b l e . (d) Implement a g r a p h i c a l i n p u t statement, using •a w r i t i n g t a b l e t as an i n p u t device, or u s i n g the i n k i n g technigue. (e) Include g r a p h i c a l type parameters i n a g r a p h i c a l f u n c t i o n . 54 [1 ] F.Ayres, Theory, and Problems of M a t r i c e s ^ McGraw-Hill, 1967 [2 ] T.S-Berk, TUNA j . A H i a h-Leyel G r a p h i c a l Programming Lang.ua£e x T e c h n i c a l Report, Mathematical Sciences Department, F l o r i d a I n t e r n a t i o n a l U n i v e r s i t y , February 1973 [3] A . T - B e r z t i s s , Data S t r u c t u r e , Theory and P r a c t i c e ^ Academic Press, 1971 [4 ] J . Ear l e y , Toward an Understanding of Data Structures.* Communication of ACM, V o l . 14, No. 10, October 1971, p-617- 627 [5] 1-Fox, An I n t r o d u c t i o n to Numerical Linear-- A l g e b r a , Oxford U n i v e r s i t y P r e s s , London 1964 [6 ] A-J.Frank, B - l i n e A B e l l L i n e Drawing Language^ AFIPS 1968 FJCC, p-179-191 [7] J-C.Gray, Compound Data S t r u c t u r e of Com£uter Aided Des i sa i A S u r v e y x Proceedings ACM N a t i o n a l Meeting, 1967, p.355-365 [8] D-Gries, Comgiler C o n s t r u c t i o n f o r D i g i t a l Com£uterj, John Wiley and Sons, 1972 [9 ] H.Kanner, P- K o s i n s k i and C.L. Robinson, The S t r u c t u r e of Yet Another ALGOL Cqmpilerj Programming Systems and Languages, McGraw-Hill, 1967, p.228-252 £10] N.Marovac, A S i n g l e Data-dis£lay_ S t r u c t u r e A New View 2S lSi§£§Stil§ Computer Graphics i n CAD A The Computer 55 J o u r n a l , V o l . 16, No. 2, June 1971, p.152-156 [1 1 ] W.D.Maurer, T.G.lewis. Hash Table Methods*. Computing Surveys, V o l . 7, No- 1, March 1975, p.5-19 [12 ] W.M.McKeeman, J.J.Horning and D.B.Hortman, A Compiler G e n e r a t o r t P r e n t i c e - H a l l , 1970 [13] E .Morris, S c a t t e r Storage Technigues t i Communications of ACM, V o l . 11, No. 1, January 1968, p.38-44 [14] W.Newman, Display. Procedures t Communications of ACM, Oct. 1971, V o l . 14, No. 10, p.651-660 [15] W.M.Newman, E . F . S p r o u l l , P r i n c i p l e s ox I n t e r a c t i v e Computer Graphics*, McGraw-Hill, 1973 [16] B. Pieke, Design and Implementation o f a Hxgh-Level 1§£9.U.§..S® Ifit§£S£iive Computer Graphics, Department of E l e c t r i c a l E n g i n e e r i n g , The U n i v e r s i t y o f B r i t i s h Columbia, J u l y 1973 [17] B.Pieke, G.F.Schrack, Implementation - of an I n t e r a c t i v e • GJElElliSs Language*. Proc. T h i r d Man-Computer Communications Seminar of the N a t i o n a l Eesearch C o u n c i l , Ottawa, 1973, p. 7. 1-9 [18] S.fiosen, The ALGOL Programming Language*. Programming Systems and Languages, McGraw-Hill 1976, p.48-78 [19 ] J . E.Sammet, Ba s i c Elements of COBOL 61*. Programming Systems and Languages, McGraw-Hill, 1967, p.119-159 [20 ] G.F.Schrack, L I G X Language f o r I n t e r a c t i v e Graphic§i Ogg£s« Manual*. Department of E l e c t r i c a l E n g i n e e r i n g , The University of B r i t i s h Columbia, 1975 [21] G.F.Schrack, Design*. Implementation and 'Experiences with a High-level Graphics Language for Interactive Computer- Aided Design gugBQsesj, computer Graphics, Vol. 10, Spring 1976, p.10-17 [22] D.M.Smith, GPL^I - A PL/I Extension for Computer Graphics,*. AFIPS 1971 SJCC, p.511-528 [23] C . N . T u r r i i l , 8.R.Mallgren, XPLG - Experiences i n Implementing an Experimental Interactive Graphics Pro System* Comput. and Graphics, Vol. 1, 19 75, p-55-63 [24] R .Williams, A Survey of Data Structures for Computer Graphics Systems*. Computing Surveys, Vol. 3, No. 1, March 1971, p.1-21 [25] B.L.M.wyvill, GROAN*. University of Bradford, June 1974 APPENDIX A LIG GRAMMAR IN BNE NOTATION 58 A u t s M a a s co * A «0 W H •4 H W V A SC rt ta O O M 0. V A CO EH «« H 10 V A A 10 co w EH H rt M) En EH l O (A V V A </> (a H «s EH to V rt OS (9 O CS CU ca S3 CO 55 o M H O la CM V A EH M M (-1 55 CO A « IS CO Ss E-i M rt a H ss to ca v. ca o f H M rt n M '1 to V o CM A V H to >• M . J A n o SB rt w ca JQ ca W f - t 3d T - C M ro «s «< A A f - l (K ca e-i to u ca 55 V o ca CO ca »: C-< D ca CQ 55 EH A D V rt O to EH rt W to ca v. H V X o rt M H W El to II H U «: II in cu • • V V A EH to H — A M o •4 «: f -* to 55 S3 M A C O - co CO SH EH H «c rt «: EH f - i E-l to CO to V V V VO A r-t 55 ra « W M rt n to V A H to W •4 EH A M • J CO rt M ca «: >• V ca f H rt fH to Q 55 co A A EH EH 55 5= w to 55 55 O U M M to 10 to to «« «: •J ca rt EH U O M CO X W o. m rt EH CB EH O rt V V A EH • • O n A ca E H E H 55 tO CO A 55 S E H O 55 55 tJ u ro M K 55 to ra o tO E H M rt •< H E n rt •J CO O rt M U >H CW M rt M CC E H CO OH 55 K W M 3 M Q 55 Q M V V V A EH 55 U W E H — rt •* E - A CO E H A 55 EH E W 2 to r : to CM ra K t/l J H C J 55 rt E H rt f-' rt ra to E H E H tO i « co o w E H to to *Z Crl *Z E H O 05 tO (J CO V V V A EH to M •4 ca CO EH CO n « : ca rt 0. 55 O M EH U 53 D ( u V A 19 Bs M O rt CO » A CO H Cv. M EH A A A E H E H E H 55 55 55 CO Ul CO sz XZ CO ro CO E H E - E H rt rt rt E H fH E H to to to W a rt 1̂ rt M to a Du. ca V V V II A O 55 M A a EH 55 55 to CO CO CO H H rt rt EH EH to to V V o EH U V A Q rt CO ca o o (K CM ca E> to 55 O M EH O 55 t3 Cn V f M CM CO o w V 55 o M EH O 55 O Cvi A O rt CO » 55 O M EH U 55 CM V A EH SS CO 9C CO A f H cn rt CO EH M to CM M SS H o ss M CO f H o u n 55 V O CM V A A EH A EH to ca to M to M M A ^1 « CM EH EH CO M 55 55 EH EH CO CO CO 55 33 JC CO CO co rt o EH * H ca A M rt rt rt <N V EH EHcv. ca to to CO 55 55 M OS 55 55 O CM a o o M M EH H M EH EH CO EH EH U 55 05 O 55 CO 55 55 D a O D CM M II CM CM V V V V at II — II *• A 13 a i 55 M A £3. A EH 55 EH to W to ^ ) 3C »-4 ca rt EH CO ca 55 EH is CO CO o JC ca CO rt a, EH 05 CO rt rt tz> EH OH to to 55 55 55 O O O M M M EH EH EH O U U 55 55 55 r> Z3 ZZt CM Cu CM V V V a in VO r - co f M I N CN CN f H • » A EH 55 A CO to A CO ro 10 A EH CO to rt tzt rt to EH •0 >-to rt >H •J >• X rt CO X V t- 55 X X H V a X ca V V E-i rt ca 31 a . rt cs o II EH o EH »• to CM to • t II _ , A EH 55 CO 3C A CO EH EH 55 rt CO EH E to CO EH 55 rt O EH M to EH o CO 55 55 zz> M CM tO V V <n o CM ro ro ro A 55 O W CO to CO ca 04 X A CO 55 V O M A to CO tn o CO rt ta tA Cu CU K CO CO « V FH 55 A CO CO .a •J o co r-» rt ca M rt ca V rt >• - 1 A rt 55 U O 1-H W ™ to CU to rt CO C M ca O cu V X CO H EH 55 CO A EH ca 55 rt CO H V 5= 15 II l - l to u in fll rt • « A >J to rt A CO "U CO E> u ^4 a : rt rt C^ •o t- rt a. X ca CO X o ca V V V ro in n m ro 36 . <ATTRIBUTE ASSIGNMENT : : » <ATTRIBOTB FONCIION> « ARITHMETIC EXPBESSION> 37 38 39 t»0 <NUMERICAL ASSIGNMENT ::= <IDENTIFIER> = <ATTRIBUTE FUNCTION> | <SUBSCRIPTED VARIABLE> = ATTRIBUTE FUNCTION> <DISPL£Y STATEMENT> :» DISPLAY <DISPLAY> 1 DISPLAY <DISPLAY> 3NT0 <ARGUMENTS> 42 43 44 as 46 47 48 49 50 51 52 53. 5i» 55 56 57 58 59 60 61 62 63 64 65 66 <DISPLAY> :!= <DISPLAY VARIABLE> | <DJCSPLAY VARIABLE> <MODIFICATION> 1 <DISPLAY VARIABLE> WITHIN <ARGUHSNTS> <IDENTIFICATION CONSTRUCT> ::= <IDENTIFICATION HEAD> : <STATEMENTLIST> <ENDING> <IDENTIFICATION HEAD> ::= FOR HIT ON <IDENTIFIER> <ENDING> ::= END <STATE-TRANSFER STATEMENT I GOTO STATE <VAHIABLE> GO TO STATE <VARIABLE> <CURSOR STATEMENT <ERASE STATEMENT> <DRAW STATEMENT : <FILE STATEMENT> : <READ STATEMENT> ! I = CURSOR ON ERASE SCREEN DRAW <MODIFICATION> STORE <ARGOMENTS> RESTORE <ARGUKENTS> READ CURSOR <IDENTIFIER4> <,3> <IDENTIFIES> READ KEY <IDENTIFIER> READ SUBSCRIPT <IDENTiFIER> <EXPRESSION> <PRIKARY> <EXPRESSION> + <PRIMARY> <EXPRESSION> - <PRIMARY> <PHIMAHY> <DISPLAY VARIABLE> 1 <DISPLAY VARIABLE> < D I S P L A Y V A R I A B L E > < M O D I F I C A r i O N > <GRAPHICAL VARIABLE> <GRAPHICAL PR IB IT IVE> <LITERAL> <GRAPHICAL VARIABLE> <IDENTIFIER> <SUBSCRIPTED VARIABLE> KO 67 <SUBSCRIPTED VARIABLE> 6 8 < I N D E X O B P A R A B E T E R S > : : = < A E I T H B E T I C E X P R E S S I O N S <r2> < I N D E X O R P A E A H E T E R S > 6 9 ! A R I T H M E T I C E X P R E S S I O N ^ 7 0 < L I T S R A L > : : = < S T R I N G > 7 1 1 < C O N V E E S I O N F U N C T I O N H E A D > < A R G U M E N T S > ) 7 2 C O N V E R S I O N F U N C T I O N H E A D > : : = < C O N V E R S I O N F U N C T I O N N A H E > ( 7 3 C O N V E R S I O N F U N C T I O N N A M E > : : = I V A L U E 7 « | RVALUE 7 5 | TVALUE 7 6 < V A R I A B L E > : : = < I D E N T I F I E R > 7 7 | <NUMBER> 7 8 A T T R I B U T E F U N C T I O N > : : = < F O N C T I O N H E A D > O I S P L A Y V A R X A B L E > ) 7 9 < F U N C T I O N H E A D > : : = < F U N C T I O N N A M E > ( 8 0 - < F U N C T I O N N A M E > : : = ? X L O C 8 1 I YLOC 8 2 | XSCALE 8 3 I YSCALE 8 U I ANGLE 8 5 I S U 3 S C R I P T 8 6 < H O D I F I C A T I O » > : : = < M O D I F I E R > 8 7 | < M O D I F I C A T I O N > < M O D I F I E l l > 8 8 < H O D I F I E R > : : « A T <ARGUttENTS> 8 9 t SCALE <ARGUKEUTS> 9 0 | ANGLE <ARGUMENTS> ' • 9 1 | ANGLE <ARGUMENTS> R A D 9 2 j ANGLE <ARGUMENTS> D E G 9 3 I FROM <ARGUMENTS> 9 U | T O <ARGUMENTS> 9 5 I VSYH <ARGUHENTS> 9 6 | HSYM <A3GUM£NTS> 9 7 < A R G U H E N T 5 > <ARGU«ENT EXPRESSION> 9 8 | < A R G U H E N T S > < . 1 > A R G U M E N T E X P R E S S I O N > 9 9 < G R A P H I C A L P R I M I T I V E > : : = BLANK 100 I L INE 1 0 1 1 SQUARE 1 0 2 I TRIANGLE <̂ 1 0 3 I C IRCLE O 1 0 H 1 SC IRCLE 1 0 5 1 0 6 1 0 7 1 0 8 ' 1 0 9 1 1 0 1 1 1 1 1 2 1 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1 8 1 1 9 1 2 0 1 2 1 1 2 2 1 2 3 1 2 4 1 2 5 1 2 6 1 2 7 1 2 8 1 2 9 1 3 0 131 1 3 2 1 3 3 1 3 4 1 3 5 1 3 6 1 3 7 A R G U M E N T E X P R E S S I O N > : A R I T H M E T I C E X P R E S S I O N > « <(2> A R I T H M E T I C Z X P R E S S I O N > ) | < V A R I A B L E > A R I T H M E T I C E X P R E S S I O N > < • ! > < I E R 8 > i A R I T H M E T I C E X P R E S S I 0 N > < - 1 > < T E R S > I < + 2 > < T E R M > | < - 2 > < T E R M > • I < T E R M > < T E R M > : : = < T E R M > * < A R I T H M E T I C P R I M A R X > I < T E R M > / < A R I T H M E T I C P R I M A R Y > | < T E R M > < * 1 > <*2> A R I T H M E T I C P R I M A R X > | < A R I T H M E T I C P R I M A R Y < A R I T H M E T I C P R I M A R ¥ > < S U B S C R I P T H E A D > < ( 1 > : : • ( < ( 2 > : : = ( < ( 3 > ( < I D E N T I F I E R 1 > < I D E N T I F I E R 2 > ' < I D E N T I P I E R 3 > < I D E N T I F I E R 4 > = < ( 3 > < A R I T H M E T I C E X P R E S S I O N > ) | < S U B S C R I P T H E A D > A R I T H M E T I C E X P R E S S I O N > ) | < V A R I A B L E > - < I D E N T I F I E R 1 > ( „ „ „ , . „ „ v | < S U B S C R I P T H E A D > < A R I T H M E T I C E X P R E S S I O N > , < I D E N T I F I E R > < I D E N T I F I E R > < I D E N T I F I E R > < I D E N T I F I E R > < + 1 > < * 2 > : : = + < - 1 > - < - 2 > : : = - < * 1 > : : = * < * 2 > : : = * < , 1 > : : = , < / 2 > , < , 3 > : : = , < A R I T H M E T I C E X P R E S S I O N S H 1 A R I T H M E T I C E X P R E S S I O N > APPENDIX B SYNATX SEMANTICS AND SKELETON S Y N T A X S E M A N T I C S F O R T H E L I G L A N G U A G E * / F O H T O U T : / * O U T P U T A F O R T R A N S T A T E M E N T V P R O C E D U R E ( L I N E P ) ; D E C L A R E ( L I N E P , L I N E 1 ) C H A R A C T E R ; I F L E N G T H ( L I N E P ) < 6 7 T H E N D O ; O U T P U T ( 2 ) = • ' I I L I N E P ; R E T U R N ; E N D ; E L S E D O ; L I N E 1 = S U B S T R ( L I N E P , 0 , 6 6 ) ; L I N E P = S U B S T R ( L I N E P , 6 6 ) ; O U T P U T ( 2 ) = • ' ] | L I N E 1 ; E N D ; D O F O R E V E R ; • I F L E N G T H ( L I N E P ) < 6 7 T H E N D O ; O U T P U T ( 2 ) = » * « M L I N E P ; R E T U R N ; E N D ; E L S E D O ; L I N E 1 = S U B S T R ( L I N E P , 0 , 6 6 ) ; L I N E P « S U B S T R ( L I N E P , 6 6 ) ; O U T P U T ( 2 ) = « * » | I L I N E 1 ; E N D ; E N D ; E N D F O R T O U T ; R E M O V E D E C I M A L : / * R E M O V E D E C I M A L P O I N T F R O M E N D O F N U M B E R P R O C E D U H E ( S I ) C H A R A C T E R ; D E C L A R E S 1 C H A R A C T E R ; K = L E N G T H ( S 1 ) - 1 ; I F B Y T E ( S 1 , K ) = B Y T E ( « . » ) T H E N S 1 = S U B S T R ( S 1 # 0 , K ) ; R E T U R N S 1 ; E N D R E M O V E _ D E C I M A L ; A R G _ C H E C K : / * C H E C K F O R C O R R E C T N U M B E R O F A R G U M E N T S * / P R O C E D U R E ( N U M ) ; D E C L A R E N U M F I X E D ; I F N U M - . = A R G C O U N T T H E N C A L L E R R O R ( • N U M B E R O F A R G U M E N T S I N C O R R E C T ' , 0 ) ; A R G _ C O U N T = 0 ; E N D A R G _ C H E C K ; */ Ch V>0 B E S E T : / * B E S E T M O D I F I E R S T O D E F A U L T V A L U E S * / P R O C E D U R E ; i . • - • • • < i I L O C = ' . 5 , . 5 ' ; • , S C A L E « * 1 . , 1 . * ; > i - A N G L E - ' 0 . • ; • j• : S U B S C R I P T = « o * : ! • P R C O D E = 0 ; T R A N S F O R M A T I O N _ O B D E R • M » : F I R S T E N C O U N T E R = 1 ; P A R A M E T E R . ( I ) = '0 ' : P A R A M E T E R ( 2 ) = * 0 ' ; P A R A M E T E R ^ ) = ' 0 ' ; P A R A M E T E R ( U ) = ' 0 ' ; P A R A M E T E R ( 5 ) = ' 0 « ; P A R A M E T E R ( 6 ) = ' 0 ' : P A R A M E T E R C O U N T = 0 ; E N D R E S E T ; P A D_8: P R O C E D U R E (SI) C H A R A C T E R ; D E C L A R E S 1 C H A R A C T E R ; S 1 = S U B S T R ( S l i p '#0,8) ; R E T U R N S 1 ; E N D P A D _ 8 ; E X O U T : / * T O O U T P U T C A L L S I N V O L V I N G E X P R E S S I O N S » / P R O C E D U R E ( E X C O D E , V A R T Y P E , P R C O D E ) ; D E C L A R E ( E X C O D E , V A R T Y P E , P R C O D E ) F I X E D ; K = EXCODE; I F P R C O D E = 1 T H E N D O ; O U T P U T ( 2 ) " » C A L L U N A R Y ( • | | U N A B Y _ O P | | • ) • ; K = - K ; E N D ; I = L E N G T H ( V A R ( M P ) ) - 2 ; / * T H E M A X I M U M L E N G T H O F AN I N D I V I D U A L ' * / I F I > 5 0 T H E N / * S T R I N G I S 5 0 C H A R A C T E R S * / D O ; V A R ( M P ) = S U B S T R ( V A R ( M P ) , 0 , U 9 ) ; I = 5 0 ; E N D ; • P A R A M E T E R L I N E = P A R A M S T E R ( 1 ) I ! ' , « | | P A R A M E T E R ( 2 ) | | I | P A R A M E T E R ( 3 ) || ' . • I ! P A R A M E T E R ( U ) | | * , ' I I P A R A M E T E R ( 5 ) I | I | P A R A M E T E R (6); D O C A S E V A R T Y P E ; I . - / * C A S E 0: D U M M Y 1 * / L I N E = ' C A L L P R I M A C I I X N ' , I 1 S U B S C R I P T | | ' , ' | | L O C | I • ' , • 1 | T R A N S F O R M A T I O N O R D E R ) L I N E = ' C A L L P R I M S ( ' 7 I K | I ' » L I N E = . ' - C A L L I V A L U E (* | I K I I ' L I N E = ' C A L L R V A L U E ( • | | K | |• L I N E = ' C A L L T V A L U E ('I I K I I ' E X D ; C A L L F O R T O U T ( L I N E ) . E N D E X O U T ; I I V A R N A K E I | ' | I S C A L E | | « , ' | I A N 3 L E I | » , • | | P A R A M E T E R L I N E | | ' ) » ; I I L O C 1 | ' , ' | | V A R ( M P ) | | » M i l l ' ) ' I I L O C | | ' I ! V A R ( M P ) | J ' ) ' 5 • | | L O C | | | | V A R ( M P ) I I ' ) ' ; ' | ! L O C | J ' , ' I I V A R ( M P ) 11 •) •; C A L L R E S E T ; S Y N T H E S I Z E : P R O C E D U R E ( P R O D U C T I O N N U M B E R ) ; D E C L A R E P R 0 D U C T I 0 N _ N U M 3 S R F I X E D ; D E C L A R E L A B E L S T A C K ( 1 0 0 ) C H A R A C T E R , P R E V L O C C H A R A C T E R , L P F I X E D I N I T I A L ( 0 ) ; D E C L A R E C A R D I J O _ S T A C K ( 1 0 0 ) F I X E D ; D E C L A R E S T M T N O ~ F I X E D I N I T I A L ( 1 0 0 0 ) ; D E C L A R E ( I M _ V A L U E , N U M _ V A L U E , V A R T Y P E , F T Y P E ) F I X E D ; D O C A S E P R O D U C T I C N _ N U M B E R ; / * C A S E 0 I S ~ A D U M M Y */ /* 1 : < P R O G R A M > : : = < S T A T E S > * / I F M P - . = 2 T H E N D O ; C A L L E R R O R ( ' E O F A T I N V A L I D P O I N T ' , 1 ) : C A L L S T A C K _ D U M P ; E N D ; ' E L S E D O ; C O M P I L I N G = F A L S E ; D O ; O U T P U T ( 2 ) = ' C — M A I N P R O G R A M ('!I V E R S I O N t I ' ) ' I F C O N T R O L ( B Y T E { ' D ' ) ) T H E N D O ; / * 3 7 0 - V E R S I O N O U T P U T ( 2 ) = • I N T E G E R * 2 M S G , I D U M M Y ' ; O U T P U T ( 2 ) = ' C O M M O N M S G , I D U M M Y ( 5 1 4 7 ) E N D ; E L S E D O ; / * N O V A - V E R S I O N S = « O V S Y S » ; D O I = 0 T O N O O F S T A T E S : S = S | | « , O V S ' l I S T A T E S ( I ) ; E N D ; O U T P U T ( 2 ) = • E X T E R N A L ' I I S ; O U T P U T ( 2 ) = ' C O M M O N M S G , I D U M K Y ( 5 1 4 7 ) « ; O U T P U T ( 2 ) = « C A L L O V O P N { 5 , " M A I N . O L " , I E R R ) ' ; E N D ; V OUTPUT (2) *> • C A L L S Y S I N ' ; s * " : DO I = 0 TO NO 0 ? S T A T E S ; T = S U B S T R { ' '» 0 , 5 - L E N G T H ( S T A T E S ( I ) ) ) 1 1 S T A T E S ( I ) ; S a S| | S T A T E S ( I ) I j ' t * ; I F C O N T R O L ( B Y T E ( ' D « ) ) * T H E N / * 3 7 0 - V E R S I O N * / 0 U T P U T ( 2 ) = T||' C A L L S - \ ] S T A T E S ( I ) ; E L S E DO; / * N O V A - V E R S I O N * / 0 U T P U T ( 2 ) = T|| • C A L L O V L O D ( 5 , O V S • | [ S T A T E S ( I ) | | ' , 0 , I E R R ) ' ; 0 D T P U T ( 2 ) = • C A L L S' | | S T A T E S ( I ) ; E N D ; O U T P U T ( 2 ) = ' GOTO 1 0 0 ' ; E N D ; / * OF L O O P I * / O U T P U T ( 2 ) = ' 1 0 0 GOTO (• | | S | | • 1 0 1) . MSG • ; O U T P U T ( 2 ) = • 1 0 1 S T O P 9 8 ' ; O U T P U T ( 2 ) = • E N D ' ; O U T P U T = •* • M A I N P R O G R A M G E N E R A T E D END; END; /<• 2 : < S T A T E S > ::=• < S T A T E > V / * 3 : < S T A T E S > = < S T A T E S > < S T A T E > * / /«• 4 : <STATE> ::= < S T A T E HEAD> : < S T A T E H E N T L I S T > < S T A T E ENDING> ; V / * 5 : < S T A T E > ::= < F U N C T I O N S U B P R O G R A M HEAD>.: < F U N C T I O N S T A T E M E N T L I S T > F U N C T I O N S U B P R O G R A M EBDING> / * 6: < S T A T E H E A D > ::= S T A T E <NUMBER> * / DO; I F L E N G T H ( V A R ( S P ) ) = 1 T H E N S = ' 0 • | | V A R ( S P ) ; E L S E S = VAR ( S P ) ; I P - C O N T R O L ( B Y T E ( • D « ) ) T H E N O U T P U T ( 2 ) = ' O V E R L A Y O V S ' J I S ; O U T P U T ( 2 ) = ' S U B R O U T I N E S ' | | S ; O U T P U T ( 2 ) = 'C S T A T E ' | | V AR (SP) 1J * '; I F CONT R O L ( B Y T E ( ' D ' ) ) T H E N O U T P U T ( 2 ) = ' I N T E G E R * 2 I D U H M Y ' ; 0 U T P U T ( 2 ) = ' L O G I C A L H I T O N ' ; I F C O N T R 0 L ( B Y T E ( ! D ' ) ) T H E N 0 U T P U T ( 2 ) = ' COMMON ID U M M Y ( 5 1 4 7 ) ' ; / * 3 7 0 - V E R S I O N * / E L S E O U T P U T ( 2 ) = » COMMON I D U M M Y ( 5 1 4 7 ) »; / * N O V A - V E R S I O N * / S T A T E _ N " J M B E R = V A R ( S P ) ; NO O F _ S T A T E S = N O _ O F _ S T A T E S + 1 ; D O ~ I =• 0 TO N O _ O F I S T A T E S - 1; I F S T A T E NUMBER = S T A T E S ( I ) T H E N . C A L L E R R O R ( • D U P L I C A T E S T A T E D E C L A R A T I O N ' , 1 ) ; E N D ; / * OF L O O P I * / S T A T E S ( N 0 _ 0 F S T A T E S ) = S; END; / * 7: < S T A T E M E N T L I S T > ::= < S T A T E M E N T > V / * 8: < S T A T E M E N T L I S T > ::= < S T A T E M E N T L I S T > < S T A T E M E N T > V / * 9 : < S T A T E E K D I N O : : = E N D S T A T E < V A R I A B L E > * / D O ; V A R ( S P ) = R E M O V E D E C I M A L ( V A R ( S P ) ) i O U T P U T ( 2 ) = « E N D • ; I F L P - . = 0 T H E N D O I = 1 T O L P ; C A L L E F . R O R ( ' U N M A T C H E D F O R - S T A T E M E N T , L I N E : * I I C A R D N 3 _ S T A C K ( L P ) , 1 ) ; E N D ; I F S T A T E N U M B E R V A R ( S P ) T H E N C A L L E R R O R ( ' S T A T E N U M B E R «|l S T A T E ~ N U M B E H | | ' A N D E N D - S T A T E N U M B E R • | | V A S ( S P ) | I ' D O N O T M A T C H ' , 0 ) ; L P = 0 ; D O U B L E _ S P A C E ; C A R D C O U N T = 0 ; E N D ; / * 1 0 : < S T A T E M E N T > / * 2 3 < S T A T E M E N T > < S T A T E M E U T > < S T A T E M E N T > < S T A T E M E N T > < S T A T E M E N T > < S T A T E M E N T > < S T A T E M E N T > < S T A T E M E N T > < S T A T E M E N T > < S T A T E M E N T > < S T A T E M E N T > * 1 1 / » 1 2 * 1 3 * 1 4 * 1 5 * 1 6 / * 1 7 / * 1 8 * 1 9 * 2 0 / * 2 1 / * 2 2 O U T P U T ( 2 ) = V A R ( M P ) I I' (' I I V A R ( M P P 1 * 1 ) I I 1 ) ' : : = < G R A P H I C A L A S S I G N B E N T > ; * / = < A T T R I B U T E A S S I G N M E N T > ; * / = < N U M E R I C A L A S S I G N M E N T > ; * / = < D I S P L A Y S T A T E M E N T > ; * / » I D E N T I F I C A T I O N C O N S T R U C T ; V = < S T A T E - T R A N S F E R S T A T E H E N T > J * / < C U R S 0 R S T A T E M E N T > ; * / < E R A S E S T A T E M E N T > ; * / < D R A W S T A T E M E N T > ;. * / < F I L E S T A T E M E N T > ; * / < R E A D S T A T E M E N T > ; * / : */ < F U N C T I 0 N S U B P R O G R A M H E A D > : : = < F U N C T I 0 N H E A D I N O ( < F 0 N C T I 0 N P A R A M E T E R L I S T > ) < F D N C T I O N H E A D I N G > : : = F U N C T I O N < I D E N T I F I E R > */ V A R ( M ? ) = ' S U B R O U T I N E ' | | V A R ( S P ) ; / * 2 4 : < F U N C T I O N P A R A M E T E R L I S T : : » < F D " N C T I O N P A E A H E T E R L I S T > , < X D E N T I F X E R > * / V A R ( B P ) = V A R (MP) 1 | ' , ' J | V A R ( S P ) ; / * 2 5 : < F U N C T I O N P A R A H E T E R L I S T < I D E N T I F I E R 2 > * / / * 2 6 : < F U N C T I O N S U B P R O G R A M E N D I N G > : : = R E T U R N < I O E N T I F I E R > * / D O ; O U T P U T (2) = » R E T U R N ' ; . : O U T P U T (2) = * E N D ' ; E N D ; . / * 2 7 : < F U N C T I O N S T A T E M E N T L I S T : : = < F U N C T I O N S T A I E M E N T > V / * 2 8 : < F U N C T I O N S T A T E M E N T L I S T > : : = < F U N C T I O N S T A T E M E N T L I S T < P U N C T I O N S T A T E M E N T / * 2 9 : < P U N C T I O N S T A T E M E N T > : := < L I N E S T A T E M E N T ; V / * 3 0 : < L I N E S T A T E M E N T > : : = S T A R T < X Y V A L U E S > * / O U T P U T ( 2 ) = ' C A L L P O I N T ( ' | | V A R ( S P ) 1 I ' » 0 ) • ; / * 3 1 : < L I N E S T A T E M E N T > : : = . F O R W O R D < X Y V A L U E S > V O U T P U T ( 2 ) = ' C A L L P O I N T ( ' I | V A R (SP) | | ' , 1) • ; / * 3 2 : < L I N E S T A T E M E N T : : = S T O P < X Y V A L U E S > * / O U T P U T ( 2 ) = ' • C A L L P O I N T ( ' | | V A R ( S P ) | | ' , 1 1 ) • ; / * 3 3 : < X Y V A L U E S > : : = A R G U M E N T E X P R E S S I O N > , < A R G U M E N T E X P R E S S I 0 N > * / V A R ( M P ) = V A R ( M P ) | | ' , ' | I V A S ( S P ) ; / * 3 4 : < G R A P H I C A L A S S I G N M E N T > : : = < G R A P H I C A L V A R I A B L E > < 3 B P L A C E > < E X P R E S S I O N > * / / * 3 5 : < R E P L A C E > : : = : = * / O U T P U T ( 2 ) = ' C A L L A S S I G ( ' | | V A R N A M E | ] ' , ' | I S U B S C R I P T I | ' ) ' ; / * 3 6 : < A T T R I B U T E A S S I G N M E N T : := A T T R I B U T E F U N C T I O N > = A R I T H M E T I C E X P R E S S I O N > * / D O ; I F F T Y P E = 6 T H E N D O ; V A R ( M P ) = * 6 , •) | V A R (MP) ; V A R ( S P ) = ' F L O A T C | | V A R (SP) | | ' ) ' ; E N D ; L I N E = • C A L L C H C H O R ( ' | | L I N E ) | ' , ' I | V A R ( S P ) | | ' ) ' ; C A L L F O R T O U T ( L I N E) ; E N D ; / * 3 7 : < N U M E R I C A L A S S I G N M E N T : : = < I D E N T I F I E R > = A T T R I B U T E F U N C T I O N > * / O U T P U T ( 2 ) = • • | | V A R ( M P ) | | ' = C O R F 1 C M L I N E J I ' ) ' ; / * 3 8 : < N U M E R I C A L A S S I G N M E N T : : = S U B S C R I P T E D V A R I A B L E > ^ A T T R I B U T E F U N C T I O N > V O U T P U T ( 2 ) = ' • | | V A R ( M P ) | | ' = C O R F 1 (• | | L I N E I I ' ) • ; / * 3 9 : < D I S P L A Y S T A T S M E N T > : := D I S P L A Y < D I S P L A Y > * / D O ; P A R A M E T S R L I N E = P A R A M E T E R { 1 ) !|',•|I P A R A M E T E R ( 2 ) | | • , ' | | P A R A M E T E R ( 3 ) I | | | P A R A M E T E R (4) | | | | P A R A M E T E R (5) | | ' , ' I ( P A R A M E T E R ( 6 ) ; DO C A S E I M V A L U E ; L I N E = " C A L L D I S P L (•I I V A R N A M E I I • , ' I I S U B S C R I P T I I ' , ' I | L O C | I ' , • | | S C A L E l |• , • | | A N G L E | | • , « | | T R A N S F O R M A r l O N _ O R D E R | | • , ' | | P A R A M E T E R L I N E | | • ) * ; DO; I P L E N G T H(VAR (SP))>50 T H E N VAR (SP)» S U B S T R(VAR(SP),0,50) J I " L I N E = ' C A L L D I S P S ( ' | | V A R (SP) 1 I * , * I I L O C | | ' , ' | | L E N G T H ( V A R ( S P ) ) - 2 | I • ) • ; E N D ; E N D ; C A L L F O R T O U T ( L I N E ) ; C A L L R E S E T ; E N D ; /«• «0: < D I S P L A Y S T A T E M £ N T > : : = D I S P L A Y < D I S P L A Y > O N T O < A R G U M E N T S > I F I M _ V A L U E = 0 T H E N D O ; . . . . O U T P U T (2) « • C A L L O N T O ('IIVAR ( S P ) 11*) '; L I N E «= ' C A L L D I S P L (* | | V A R N A M E J | ' , ' J I S U B S C R I P T ) I ' » * I I L O C I I ' , ' |I S C A L E | | ' » ' | ) A N G L E | | ' ) ' ; C A L L F O K T O U T ( L I N E ) ; C A L L R E S E T ; E N D ; / * «1 : < D I S P L A Y > : : = < D I S P L A Y V A R I A B L E > * / • / * HI: < D I S P L A Y > : : = < D I S P L A Y V A R I A B L E > <MODIFICAriON> */ / • l » 3 : < D I S P L A Y > : : = < D I S P L A Y V A R I A B L E > " W I T H I N < A E 3 U M E N T S > ' * / D O ; • L I N E = ' C A L L W I T H I N ( ' | I V A R ( S P ) | | ' ) • ; C A L L F O R T O U T ( L I N E ) ; E N D ; , . ' . • , • /* lit: I D E N T I F I C A T I O N C O N S T S U C T > = < I D E N T T F I C A T I O N H E A D > : < S T A T E M E N T L I S T > < E N D I N G > * / D O ; . , . O U T P U T(2) = * 0 1 ] | L A B E L _ S T A C K ( L P ) | | ' C O N T I N U E ' ; L P = L P - 1 ; E N D ; / * U 5 : < I D E N T I F I C A T I O N H E A D > : : = F O R H I T ON < I D S N I I F I E B > * / D O ; L P = L P+1; S T M T N O = S T H T N O t 1 ; L A B E L _ S T A C K ( L P ) = S T M T N O ; C A R D N O _ S T A C K ( L P ) = C A R D _ C O U N T ; V A R ( S P ) = P A D 8 ( V A R ( S P ) ) " ; O U T P U T(2) = • I F ( . N O T . H I T O N ( ' " 11 VAR ( S P ) II • " ) ) G O T O O ' K L A B E L _ S T A C K ( L P ) ! E N D ; / * i » 6 : < E ! 1 D I N G > : : = E N D * / /* HI: < S T A T E - T R A N S F E R S T A T E H E N T > G O T O S T A T E < V A R I A B L E > * / D O ; T = R E M O V E D E C I M A L ( V A R ( S P ) ) ; O U T P U T(2) = 1 C A L L C H S T A T ('|JTiI') '; O U T P U T(2) = ' R E T U R N ' ; E N D : / * 4 8 : < S T A T E - T R A N S F E R S T A T E H E N T > G O T O S T A T E < V A B I A B L E > V D O ; T = R E M O V E D E C I M A L ( V A R ( S P ) ) ; O U T P U T ( 2 ) = ' C A L L C H S T A T ( ' 1 I T | | •) ' J O U T P U T (2) = ' R E T U R N ' ; E N D ; / * 4 9 : < C U R S O R S T A T E M E N T > : : = C U R S O R ON * / • O U T P U T (2) = • C A L L C R S R O N ' ; / * 5 0 : < E R A S E S T A T E M E N T > : : = E R A S E S C R E E N * / O U T P U T ( 2 ) = ' C A L L E R A S E ' ; / * 5 1 : <DRAW S T A T E M E N T > : : = DRAW < M O D I F I C A T I O N > * / D O ; O U T P U T ( 2 ) = ' C A L L DRAW ( ' | J L O C | | ' , • | I S C A L E 1 J ' ) * ; C A L L R E S E T ; E N D ; / * 5 2 : < F I L E S T A T E M E N T > : : = S T O R E < A R G U M E N T S > * / D O ; C A L L A R G C H E C K ( 2 ) ; O U T P U T (2) - • C A L L S T O R E C | | V A R ( S P ) | | ' ) • ; E N D ; / * 5 3 : < F I L E S T A T E M E N T > : : = R E S T O R E < A R G U M E N T S > V D O ; C A L L A R G _ C H E C K ( 2 ) ; O U T P U T { 2 ) = ' C A L L R E S T O R C | | V A R ( S P ) 1 1 ' ) • ; E N D ; / * 5 4 : < R 2 A D S T A T E M E N T > : : = R E A D C U R S O R < I D E N T I F I E R 4 > < , 3 > < I D E N T I F I E R > O U T P U T ( 2 ) = ' C A L L . R D C R S R ( 1 , * | | V A S ( M P + 2 ) | | ' , ' ) | V A R ( S P ) | | ' , K D U M ) • ; / * 5 5 i < R E A D S T A T E M E N T > : : - R E A D K E ? < I D E N T I F I E R > * / O U T P U T ( 2 ) = ' C A L L R D C R S R ( 2 , X D U M , Y D U f l . • H V A R ( S P ) f | ' ) ' ; / * 5 6 : < R E A D S T A T EM E N T > : : = R E A D S U B S C R I P T < I D E N T I F I E R > * / O U T P U T { 2 ) = • C A L L RDCP.SH (3 , X D U M , YDUM , M I V AR ( S P ) | | •) » ; / * 5 7 : < E X P R E S S I O N > : : = < P R I M A R Y > V . D O ; C A L L E X O U T ( 1 , V A R T Y P E , P R C O D E ) ; E N D ; / * 5 8 : < E X P R E S S I O N > : : = < E X P R E S S I O N > • < P R I M A B Y > * / D O ; V A R (MP) = V A R ( S P ) ; C A L L E X O U T ( 2 , V A R T Y P E , P R C O D E ) ; E N D ; / * 5 9 : < E X P R E S S I O N > : : = < E X P R E S S I O N > - < P R I M A R Y > * / D O ; V A R (MP) = V A R ( S P ) ; C A L L E X O U T ( 3 , V A R T Y P E , P R C O D E ) ; E N D ; / * 6 0 : < P R I M A R Y > : : = < D I S P L A Y Y A R I A B L E > * / / * 6 1 : < P R I M A R Y > : : = < D I S P L A Y V A R I A D L E > <MODI7ICAriOX> */ / * 6 2 : < D I S P L A Y V A S I A B L E > : : = < G R A P U I C A L V A R I A B L E > * / I M _ V A L U E = 0 ; / *~63: O ISPLAY VARIABLE> : : = <GRAPHICAL PRZMITIVB> V DO; V A R T Y P E « 1 ; VAR(MP) = PAD_8 ( V A R (BP)) ; V A R N A H 2 » ' • * • J | V A R ( R P ) | | ; • I M _ V A L U E * 0 ; P A R A M E T E R ( 1 ) = ' 0 • ; S U B S C R I P T = ' 0 ' ; E N D ; / * 6 U : < D I S P L A Y V A R I A B L E > : : = < L I T E R A L > * / I B V A L U E =i 1 ; / * 6 5 : < G R A P H I C A L V A R I A B L E > : : = < I D E N T I F I E R > * / D O ; V A R T Y P E = 1 ; V A R (MP) = P A D _ 8 ( V A R (MP) ) ; V A R N A M E • ' * • • | | V A R ( H P ) ||* " •J S U B S C R I P T = ' 0 ' ; P A R A M E T E R ( 1 ) = ' 0 ' ; E N D ; / » 6 6 : < G R A P H I C A L V A R I A B L E > : : = < S U B S C R I P T E D V A R I A B L E > * / V A R T Y P E = 1 ; / * 6 7 : < S 0 3 S C R I P T E D V A R I A B L E > : : = < I D E N T I F I E R 3 > < ( 1 > < I N D E X O R P A R A M E T E R S > ) * / D O ; T E M P C H = P A D _ 8 ( V A R ( M P ) ) ; V A R N A M E = • I j T E M P C H I | • « " ; V A R ( M P ) = V A R (MP) 1|• ( ' | | V A R ( M P P 1 * 1 ) |I•) • ; S U B S C R I P T S ' ( ' I I V A R ( M P P 1 * 1 ) ||') ' t E N D ; /<• 6 8 : < I N D E X OR P A R A M E T E R S > : : * A R I T H M E T I C EXPRESSIONS < , 2 > <INDEX OR PARAHETERS> D O ; P A R A M E T E R C O U N T = P A R A M E T E R C O U N T + 1 ; P A R A M E T E R ( P A R A M E T E R C O D N T ) = V A R ( M P ) ; E N D ; / * 6 9 : < I N D E X O S P A R A M E T E R S > : : = < A R I T H M E T I C E X P R E S S I O N > V D O ; P A R A M E T E R C O U N T = P A R A B E T E R C O . U N T + 1 j • P A R A M E T E R ( P A R A M E T E R C O U N T ) = V A R ( M P ) ; E N D ; / * 7 0 : C L I T E B A L > : : = < S T R I N G > V D O ; V A R T Y P E " 2 ; V A R ( M P ) = " " l | V A R ( M P ) | | " " ; E N D ; / * 7 1 : < L I T E E A L > : : = CONVERSION FUNCTIONHEAO <ARGUMENTS> ) * / D O ; DO CASE VARTYPE; C A L L A R G _ C H E C K ( 1 ) ? C A L L A K G _ C H E C K ( 2 ) ; C A L L A R G _ C H E C K ( 2 ) ; E N D ; V A R (MP) =• V A R ( M P P 1 ) ; E N D : / * 7 2 : C O N V E R S I O N F U N C T I O N H E A D > : : » C O N V E R S I O N F U N C T I O N N A H E > ( : ' / * 7 3 : C O N V E R S I O N F U N C T I O N N A M E > : : » I V A L U E * / V A R T Y P E = 3 ; / * 7 « : C O N V E R S I O N F U N C T I O N N A N E > : : = R V A L U E * / . V A R T Y P E . = 4 ; / * 7 5 : C O N V E R S I O N F U N C T I O N N A « E > : : = T V A L U E + / V A R T Y P E = 5 ; / * 7 6 : < V A R I A B L E > : : = < I D E N T I F I E R > * / / * 7 7 : < V A R I A B L E > : : = < N U M B E R > * / •/* C O N C A T E N A T E A D E C I M A L P O I N T T O N U M B E R * / DO; K = 0 ; D O I = 0 T O L E N G T H ( V A R ( S P ) ) - 1 ; ' I F B Y T E ( V A R ( S P ) , I ) = B Y T E ( ' . * ) T H E N K • 1j E N D ; I F K = 0 T H E N V A R ( S P ) = V A R ( S P ) | |' . * ; E N D ; / * 7 8 : A T T R I B U T E F U N C T I O N > : : = < F U N C T I O N H E A D > < D I S P L A Y V A R I A B L E > ) L I N E = F T Y P E | | ' | | V A R N A M E | | | ] S U B S C R I P T ; / * 7 9 : < F U N C T I O N H E A D > : : = < F U N C T I O N N A M E > ( V / « 8 . 0 : < F U N C T I O N N A M E > : : = X L O C * / F T Y P E = 1 ; / * 8 1 : < F U N C T I O N N A M E > : : = Y L O C * / F T Y P E = 2 ; / * 8 2 : < F U N C T I O N N A M E > : : = X S C A L E V F T Y P E = 3 ; / • 8 3 : < F U N C T I O N N A H E > : : = Y S C A L E * / F T Y P E = U ; / * 8 4 : - < F U N C T I O N N A M E > : : = A N G L E * / F T Y P E = 5 ; / * 3 5 : < F U N C T I O N N A M E > : : = S U B S C R I P T * / F T Y P E = 6 ; / * 8 6 : < M O D I F I C A T I O N > : : = < M O D I F I E R > V / * 8 7 : < M O D I F I C A T I O N > : : = < M O D I F I C A T I O N > < M O D I F I E R > * / / * 8 8 : < M O D I F I E R > : : = A T < A R G U M E N T S > V D O ; C A L L A R G _ C H E C K ( 2 ) ; L O C = V A R ( S P ) ; E N D ; / * 8 9 : < M O D I F I E R > : : = S C A L E < A R G U M E N T S > * / DO; I F ARG COUNT » 1 THEN SCALE » VAR(SP)11'#'1fYAR(SP) ; E L S E D O ; C A L L A R G _ C H E C K ( 2 ) ; S C A L E « Y A R ( S P ) ; E N D ; A R G _ C O U N T = 0 ; I F F I R S T _ E N C O U N T E R THEN T R A N S F O R M A T I O N_OSDER » * 1 • ; F I R S T _ E N C O U N T E R = 0; E N D ; / * 9 0 : < M O D I F I E R > : : = A N G L E < A R G U M E N T S > V D O ; I F F I R S T E N C O U N T E R T H E N T R A N S F O R M A T I O N _ O R D E R » * 2 ' ; F I R S T _ E N C O U N T E R = 0; A N G L E = V A R (SP) ; E N D ; • / * 9 1 : < M O D I F I E R > : : = A N G L E < A R G U M E N T S > RAD V D O ; I F F I R S T _ E N C O U N T E R T H E N T R A N S F O R M A T I O N . O R D E B « ' 2 ' ; F I H S T _ E N C O U N T E R = 0; A N G L E = V A R ( M P P 1 ) ; . E N D ; / * 9 2 : < M O D I F I E R > : : * A N G L E < A R G U M E N T S > D E G ; THE 1 . 7 U 5 3 2 9 E - 2 I S T H E C O N V E R S I O N F A C T O R F R O M D E G R E E S TO D O ; I F F I R S T _ E N C O U N T E R T H E N T R A N S F O R M A T I O N _ O R D E R * ' 2 ' ; F I R S T _ E N C O U N T E R = 0 ; A N G L E = VAR (MPP.1) ) | * * 1 . 7 4 5 3 2 9 E - 2 1 ; E N D ; / * 9 3 : < M O D I F I E R > : : = F R O M < A R G U M E N T S > * / D O ; C A L L A R G C H E C K (2) ; • P R E V L O C = V A R ( S P ) ; E N D ; / * 9 4 : < M O D I F I E R > : :=* T O < A R G U M E N T S > V D O ; C A L L A R G C H E C K ( 2 ) ; L O C = P R E V L O C ; S C A L E = V A R ( S P ) ; P R E V L O C = S C A L E ; A N G L E = ' - 9 9 9 . ' ; E N D ; / * 9 5 : < M O D I F I E R > : : = V S Y M < A R G U M E N T S > * / D O ; U N A R Y OP = ' 1 , ' | | V A R ( S P ) ; P R C O D E = 1 ; E N D ; / * 9 6 : < M O D I F I E R > : : = H S Y M < A R G U M E N T S > * / D O ; U N A R Y O P = ' 2 , • | | 7 A R ( S P ) ; P R C O D E = 1 ; E N D ; / * 9 7 : < A R G U M E N T S > : : = < A R G U M E N T E X P R E S S I O N > <•/ A R G _ C O U N T = 1 ; IBER L D I A N S V —0 / * 9 8 : < A 3 G U H E N T S S : : = < A R G U M E N T S S < , 1 S < & B 6 0 H E S I E X P R E S S I O N S * / D O ; A R G _ C O U N T = A R G _ C O U N T * 1 ; Y A R (UP) = V A R ( H P ) | | « , • | | V A R ( S P ) ; E N D ; / * 9 9 : < G R A P H I C A L P R I M I T I V E S : : = B L A N K * / / * 1 0 0 J < G R A P H I C A L P R I M I T I V E S : : ' = L I N E * / / * . 1 0 1 : < G R A P H I C A L P R I M I T I V E S : : = S Q U A R E * / / * 1 0 2 r < G R A P H I C A L P R I « I T I V S > : : = T R I A N G L E * / / * 1 0 3 : < G R A P H I C A L P R I M I T I V E S : : = C I R C L E * / / * 1 0 t » : < G R A P H I C A L P R I H I T I V E > : : = S C I R C L E * / / * 1 0 5 : < A R G U M E N T E X P R E S S I O N S : : = < ( 2 > < A R I T H M E T I C E X P R E S S I O N > ) *> V A R ( K P ) = ' ( ' I | V A R ( M P P 1 ) | I ') ' ; / * 1 0 6 : < A E G D M E N T E X P R E S S I O N S : : = ' < V A R I A B L E S * / / * 1 0 7 : A R I T H M E T I C E X P R E S S I O N > : : = A R I T H M E T I C E X P R E S S I O N > <+1S < T E R B > * / V A R (MP) = V A R (MP) | | » + ' | | VAR ( S P ) ; / • 1 0 8 : < A R I T H M E T I C E X P R E S S I O N > : : = < A H I T H M E T I C E X P R E S S I O N S < - 1 > < T E R H > V V A R ( K P ) = V A R ( M P ) | | ' - ' I I V A R ( S P ) ; / * 1 0 9 : < A R I T H M E T I C E X P R E S S I O N S : : = ' <+2S < T E R M S * / V A R ( K P ) = • • • | I V A H ( S P ) ; / * 1 1 0 : < A R I T H M E T I C E X P R E S S I O N S : : = < - 2 > < T E R U > * / V A R ( M P ) = ' - ' | | VAR ( S P ) ; / * 1 1 1 : < A R I T H M E T I C E X P R E S S I O N S : : = <TEHM> * / / * 1 1 2 : < T E R M > : : = < T E R M S * < A R I T H M E T I C P R I B A R Y S * / V A R ( M P ) = V A R ( M P ) | I ' * 1 I t V A R ( S P ) ; / * 1 1 3 : < T E R M > : : = < T E R M > / < A R I T H M E T I C P R I M A R Y S * / V A R (MP) = V A R (MP) | | ' / ' I | V A R ( S P ) ; / * 1 1 4 : < T E R B S : : = < T E R M > < * 1 S < * 2 S < A R I T H M E T I C P R I M A R Y S * / V A R ( M P ) = V A R ( M P ) | | 1 * * ' | I V A R ( S P ) ; / * 1 1 5 : < T E R M > : : = < A R I T H M E T I C P R I M A R Y S . * / / * 1 1 6 : < A R I T H M E T I C P R I M A R Y S : : * < ( 3 S < A R I T H B E T I C E X P R E S S I O N S ) * / V A R ( M P ) = ' ( ' | I V A R ( M P P 1 ) | | • ) ' ; / + 1 1 7 : < A R I T H M E T I C P R I M A R Y S : : = < S U B S C R I P T H E A D > < A R I T H B E T I C E X P R E S S I O N S . ) * / V A R ( H P ) = V A R (KP) | | V A R (MPP1) | | ' ) ' ; / * 1 1 8 : A R I T H M E T I C P R I M A R Y > : : = < V A R I A B L E S V V A R ( M P ) = R E M O V E _ D E C I M A L (VAR ( M P ) ) ; / * 1 1 9 : S U B S C R I P T H E A D S : : = < I D E N T I P I E R 1 S ( * / V A R (MP) =VAR (MP) | | ' (* ; / * 1 2 0 : < S U B S C R I P T H E A D > : : = < S U B S C R I P T H E A D S A R I T H M E T I C E X P R E S S I O N S , * / Y A H (MP) = VAR ( K P ) | | V A R (MPP1) | | ' , » ; / * 1 2 1 : < (1> : : = ( * / '/" 1 2 2 : < ( 2 > ::= ( V /* 1 2 3 : < ( 3 > { /» 1 2 4 : < I D ' E N T I P I E R 1 > :: = < I D E N T I F I E R > */ /* 1 2 5 : < I D E N T I F I E R 2 > :: = < I D E N T I F I E R > */ /* 1 2 6 : < I D E N T I F I E R 3 > : : = < I D E N T I F I E R > */ /* 1 2 7 : < I D E N T I F I E R 4 > : : = < I D E N T I F I E R > V /* 1 2 8 : <*1> : : = •f */ /* 1 2 9 : <*2> : : = */ 1 3 0 : < - 1 > ::= */ /* 1 3 1 : < - 2 > : := - */ /* 1 3 2 : <*1> J J B * */ /* 1 3 3 : <*2> • ; 2 * V /* 1 3 4 : < , 1> : : = *» */ /* 1 3 5 : < , 2 > • • B » • */ /* 1 3 6 : < , 3 > J J B V /* 1 3 7 : < A R I T H H E T X C E X P R E S S I O N S : :« <ARITHHEriC E N D ; E N D S Y N T H E S I Z E ; APPENDIX C LISTING OF TRAMA 77 S U B R O U T I N E T R A M A [ T V A L , 1 T R A N S ) C TO B U I L D T H E RHANS FORMATION M A T R I C E S C I T R A N S = 1 , TO PERFORM S C A L I N G , ROTATIONAND C AND T R A N S L A T I O N C I T R A N S = 2 , TO PEBFORM R O T A T I O N , S C A L I N G C AND T R A N S L A T I O N R E A L T V A I (6) ,SX (2) ,SY (2) C I N I T I A L I Z A L L Y , TVAL(1)=XLOC C VAL ( 2 ) = Y L O C C TVAI (3)=XSCALE C T V A L (4) = Y S C A L E C T V A L (5)= ANGLE IN 5ADINAS C TO T E S T I F X S C A L E OR YSCALE IS TOO SMALL I F ( T V A 1 { 3 ) . L T 0 . 0 0 1 , O R . T V A L ( 4 ) . L T . O . 0 0 1 ) S T O P 15 S I N A = S I N (TVAL (5) ) COSA=COS (TVAL (5) ) XLOC-TVA.L (1) Y L O C = T V A L (2) SX (1)=TVAL (3) SX (2) =TVA.L (4) SY ( 1 ) = T V A L ( 4 ) SY (2) =TVAL (3) T V AL (1) =COS A*SX (1) TVA 'L (2) =S.'INA*SX (ITBANS) TVAL ( 3 ) = - S I N A * S Y ( I T B A N S ) T V A L (4) =COSA*SY (1) TV AL (5) = X L O C - 0 . 5* (TVAL (1) +T VAL (3) ) T V A L {6} = Y L O C - 0 . 5* ( T V A L (2) + T V A L ( 4 ) ) RETURN END

Cite

Citation Scheme:

    

Usage Statistics

Country Views Downloads
China 9 17
United States 2 0
France 1 0
Japan 1 0
City Views Downloads
Beijing 9 0
Tokyo 1 0
Latham 1 0
Unknown 1 5
Ashburn 1 0

{[{ mDataHeader[type] }]} {[{ month[type] }]} {[{ tData[type] }]}

Share

Share to:

Comment

Related Items