X I B HAHY OF THL UNIVER.SITY OY ILLINOIS 510.84 lZ6r no. 237-242 cop.2 The person charging this material is re- sponsible for its return on or before the Latest Date stamped below. Theft, mutilation, and underlining of books are reasons for disciplinary action and moy result in dismissal from the University. University of Illinois Library MARJ8 1971 OEC $m L161 — O-1096 Digitized by the Intemet Archive in 2013 http://archive.org/details/graphicsdisplayl240hend Report No. 2^+0 M A rvV coo-1^69-0068 1968 A GRAPHICS DISPLAY LANGUAĠE Dugald Austin Henderson, Jr. August 21, 1967 Report No. 2^0 A GRAPHICS DISPLAY LANGUAGE* Dugald Austin Henderson, Jr. August 21, 1967 Department of Computer Science University of Illinois Urbana, Illinois 6l801 This work was supported in part "by Contract No. US AEC AT(ll-l)lU69 and was submitted in partial fulfillment of the requirements for the degree of Master of Science in Computer Science, August , 196?. 111 ACKNOWLEDGMENT The author wishes to acknowledge the invaluable guidance and encouragement given to him by Dr. C. W. Gear during all phases of this study. Also thanks are extended to James Roman for his extensive work in programming many of the geometrical routines , Michelle Boucher who typed the rough draft, and Marguerite Dunlap who typed the final draft TABLE OF CONTENTS Page LIST OF ABBREVIATIONS v I. MOTIVATION AND INTRODUCTION 1 II. THE CHOICE BETWEEN INTERPRETATION AND COMPILATION k III. THE LANGUAGE 6 a) Definition 6 b) Basic Construction Units 17 c) An Example 26 IV. GDL-1 31 a) Introduction 31 h) Basic Structures 31 c) Handler Commands and Effects 35 d) Plotting, Displaying, and Representation in Fortran. . .kl e) Block Diagrams 53 f) Program Listing 58 V. GDL-2 86 a) Introduction 86 b) Basic Structures 87 c) Handler Commands and Effects 88 d) Plotting, Displaying, and Representation in Fortran. . .92 e) Block Diagrams 97 f) Program Listing 101 VI. SUGGESTIONS FOR FURTHER RESEARCH 129 VII. SUMMARY AND CONCLUSIONS 133 REFERENCE 136 LIST OF ABBREVIATIONS BCU - basic construction unit BCUC - basic construction unit command BCUL - "basic construction unit line FL - figure line NPI - no pointer indicator NSI - next sequential instruction PAM - parameter and manipulation block SF - subfigure SFC - subfigure command SFL - subfigure line I. MOTIVATION AND INTRODUCTION It has become clear that one of the most powerful roles the computer will play in the future is as a partner to a human being in an on-line exchange type of creative process. The computer will act as the powerful computational half of the man-machine pair, leaving the human to provide creative insight, and direction. To make such facilities for computer-aided thinking avail- able to those unfamiliar with these devices, it is essential to pro- vide software packages that allow the communication between man and machine to be in a form familiar to the human participant. In the design of systems allowing the creation of two-dimen- sional pictures the use of a Cathode Ray Tube (CRT) display screen, light^-pen, and special function keys have been the usual medium of communication. "Sketchpad" was the first of the devices to use this method. [l] The CRT display screen has become a very common device for many applications. However, special light-pen and function-keys are not so common; this follows from there being a large number of appli- cations requiring displayed output but typed input. Many business applications are of this sort. The relatively ready availability of installations with display screens - console typewriter peripheral units leads to the desirability of a language through which the operations of the graphi- cal displays of the above-mentioned systems could be created by key- ing in information. It is desirable to provide the language of basic Euclidean geometry as there is widespread understanding and acceptance of this description of displays. Many installations lacking CRT displays have off-line plotters; readily available. These devices would prove useful drafting tools provided that one could easily describe figures to be drawn by them. A language of the type proposed above would be such a description. The fast interactive abilities of the on-line CRT display would not carry over to the system having only plotter output; however, most programs are written in the slow interactive environment of batch processing, a very tried and proven milieu. In short , a computer with a Fortran com- piler and a plotter should provide, through use of the language pro- posed here, a very powerful drafting tool. The software package described in this paper is a preliminary attempt to provide such a language, This Graphics Display Language (G.D.L.) provides the facility to describe in a fairly rigid format, and have displayed, figures composed of straight line segments and arcs of circles. The choice of such an apparently restricted language was made to limit the scope of the work, so as to direct study toward data structure and implementation. As a result the restrictions can be easily relaxed. The data structures used here can, without modifica- tion, be employed to encompass the drawing of conic sections and more complex curves . A more sophisticated string processing segment can be added to allow a freer format. The aim of this work was not to provide a finished software system but rather to provide a basic package which can be used to study the worth of this approach to computer graphics; it should then provide a base for further development. Hence , thought has been put into the facilities which may be desired and the data structures designed to be amenable to as much flexibility as possible. Little is known of what functional commands it is desirable to give a designer using such a system. Initial assumptions as to what will be most useful have had to be made. It is anticipated that usage of the package will accent the weakness in these assumptions , and the G.D.L. amended to correct them. II. THE CHOICE BETWEEN INTERPRETATION AMD COMPILATION As any drawing can be described as a list of line segments , arcs , and points (one may or may not want to draw this last), an ini- tial reaction is to do all calculations of a new component from data for existing components at the time it is entered, and store the name and the values of the co-ordinates only. Lists of components would thus be formed; description of any component would be in terms of actual co-ordinates or components already defined. To draw the figure, one has a subroutine to display each basic type of component, which one then does for each member of each list. However, the advantage of on-line operation is the ability to change figures one has drawn. Suppose calculation of a point C as the intersection of lines A and B has taken place and its co-ordinates stored in the list of points. Now the definition of line B is changed. It must be possible to recalculate C. This involves knowing which things depend on what other things , and also the nature of these depen- dences. If all of this information must be stored, one might as well store all the input statements and provide an interpretive system which would analyze and draw any file of statements in the language. However, the input statements are in a language particularly well suited to the human using the system and hence not well suited to easy or economical storage within the computer. Other advantages and disadvantages of these two extremes of compilation and interpretation are : a) Compilation provides faster display time , all the work having been done at list-creation time. 5 b) Storage space for the interpretive system will in general be larger. c) Less computer time will be taken in the interpretive system, as the programs to accept each line are the standard file generation routines of the time-sharing system. In the compilation system, the compiler must be called for each line. d) The interpretive system has flexibility allowing chang- ing, adding and deleting, while the compiler has no ability this way, Between these extremes , there are many levels of partial interpretation. These involve partially analyzing the input state- ments , and storing the information contained therein in a partially digested fashion in a format designed to be economical on storage. The level of digestion determines the degree of flexibility obtained. The more digested, the harder it is to change things . Specifically , if interrelational information is used at input-time , the retention of it is redundant; yet this retention is the only possible way to insure flexibility. The scheme selected initially (GDL-l) was one in which re- lational information was retained in the form of pointers , and names were compiled. The second scheme (GDL-2) is much more interpretive , call- by-name being used throughout. III. THE LANGUAGE a) Definition The GDL is divided into two sections. The first of these in- eludes the statements which define the figures to be drawn. These statements are given in the context of the commands of the second section called the HANDLER, These commands are instructions to the GDL compiler providing information necessary to properly compile the definition statements. The Handler commands are different for GDL-1 and GDL-2 and hence will he dealt with in the description of each of these compilers, its data structures, capabilities , and uses. In this section a discussion will be given of the definition statements. Once these are understood, the use of the language will become apparent , and the discussion of the Handlers will follow naturally. Figures described by GDL are composed of segments of straight lines and circles , and subfigures previously described. The description is given in a series of 'lines' of character-string input. Each line may physically spill over onto more than one card or extend onto a second line of typed input on a console. At the current stage of GDL the format of these lines has been rigidly fixed to allow a minimum of effort to be spent on parsing of the input string. It is expected that when more experience has been acquired in using GDL, the desirable con- densing of statements will become clear. At that time free format and tliese condensations should be added. The format is given in Figure 1 • First a line with key word FIGURE (this will be called a FIGURE- line ) is given. The name of the figure is given in the name word. All other words are blank. o ^ 3S 36 m o m O sO I — < o O o tn J£ JC 3 o> >t ^-t co m * 1 p-i •—1 * # 1 --) •»4 o m m ! ( m CNJ I O o Q Q l m UJ fH ac -H l 1 1 I 1 UJ < >o as 1 1 < 0Ċ — 1 O 13 o a •H P o •H 8 All names are character strings of six alphabetic and numeric characters (no special characters ) with the first character an alpha- betic character,. Blanks are allowed at the right-hand end of a name. (The name ABC u u u will be shown ABC here.) Following the FIGURE-line , the description of the basic construction units (BCU's) are given. These may be points , line segments , circles , arcs , distances , or angles . Following the common practice in Euclidean geometry, the figure to be described is augmented with ' construction lines ' to make it easier to describe or draw. These are used to construct the figure but are not drawn when the figure is drawn , (physically the construction lines are erased once the figure is drawn). If a BCU is to be drawn as part of the figure the draw sord is DRAW. If this is blank the BCU is taken to be a construction line only. (Note that anything not drawn is con- sidered a construction line in our case. Thus , most points , and all distances and angles are ' construction lines ' ) . Each BCU, drawn or not , is given a name. In GDL-1 these names must be unique for all figures. In GDL-2 names must be unique within each figure. The integer N gives the kind of BCU of the type indicated by the KEY word that is being described. For example, a point can be des- cribed by its co-ordinates (kind l), or by the intersection of two line segments (kind 2), or the intersection of a line and an arc (kins 6), etc. Each kind of BCU of a given type is numbered arbitrarily. A complete list of those implemented in GDL-1 and GDL-2 is given at the end of this section. As will be noted in this list, many of the BCU's have quite arbitrary definitions. It is obvious that many useful BCU's are not yet implemented, and probable that some BCU's in the current list are quite useless. Again, the current work is to provide some study chiefly of the data structures for GDL. It is anticipated that given this, useful BCU's can be easily added to the list. The struc- tures provided by both GDL-1 and GDL-2 are open-ended in this respect for exactly this reason. Currently, the BCU's implemented are of the following types : POINT u , LINE ,j u , CIRCLE, ARC u u u , DIST u u , ANGLE u . The word 1 through word 25 positions are used to give the BCU's and values in terms of which the BCU in the current line is being described. For example if the point A (U, 3) is to be defined by its co-ordinates, word 1 is given value h and word 2 the value 3. If two points A and B are defined, then the line segment AB is of kind 1 with word 1 given the name A u u u u u and word 2 the name B u u u u u . Values are six numeric characters and blanks . Blanks are interpreted as zeros. The decimal point is assumed to be between the third and fourth digit. Digit 1 set - gives a negative value. An an example consider the figure described by the GDL - lines of Figure 2. This is a square with 8 units to each side. A point of kind 1 requires two co-ordinates to define it. A line of kind one is defined as connecting the two points given. An iscoceles triangle is described by the lines of Figure 3. Once a complete figure is defined, it may be called as part of a larger figure. The KEY - word is SUBFIG on such a subfigure call. Word 1 is the name of the figure being called as a subfigure. Name is the 1— 4 6 11 13—18 21 23 — 28 30—35 37—41 44 — 49 51 — 56 . . SCUARE FIGURE SGUA PCINT SOUB PCINT SQUC POINT SQUD PCINT DRAW SQUAB LINE DRAW SQU8C LINE DR/>W SQUCD LINE DR£W SQUAD LINE 1 C 1 8 1 8 8 1 8 1 SCUA SQUB 1 SCUB SCUC 1 scuc SQUD i SCUA SCUC b(o,8: A(0,0) c(8,8) D(8,0) Figure 2. A Fixed Square 11 x __ 4 t JL a 3 — la 21 23 — 28 30- 5 37 — 41 44—49 51—56 TRIANG FIGURE TRIA PCINT 1 TRIB POINT 1 4 6 TRIC POINT 1 8 CRAW TRIA8 LINE 1 TRIA TRIB DRAk TRIBC LINE 1 TRIB TRIC DRAW TRICA LINE 1 TRIC TRIA A(0,0) B(U,6) c(8,o) Figure 3. A Fixed Triangle 12 subfigure as part of the current figure. (Name serves no real purpose in the existing GDL's, but an important extension of the language should allow indications of the type ABODEF«G where G is a BCU of some figure which is given the name DEF as a subfigure of some figure which is given the name ABC as a subfigure of the current figure.) N is not used. Figure k presents a figure defined as a composite of our previously defined figures SQUARE and TRIANGLE. (it should be noted that this is purely an illustrative example and hence is missing many necessary words of definition.) Also note that all subfigures are assumed not to be construction lines . Hence, the DRAW keys are un- necessary . This example indicates a definite further need. In calling a subfigure, one may well wish to have its origin translated with res- pect to the origin of the current figure. Also one may wish to rotate and/or expand the subfigure about its origin for use in the current figure. Words 2 through 5 are used for these values. Word 2 = x n , word 3 = y n , word k = 0, word 5 = E, where (x , y ) is the translation, is the angle of rotation in degrees , and E is the expansion factor. The composite of Figure 5 is given by the same GDL - lines as Figure k with the necessary manipulations . Note that the square has not been manipulated at all (translation by (0, 0), 0° rotation, expansion factor of l). In describing a figure, one may wish to describe many sim- ilar figures by providing parameters. When a figure is called as a subfigure, if parameters have been used in its description, these must 13 1 — 4 6 11 13—18 21 23—28 30 — 35 37 — 41 44 — 49 51 — 56 CCMPl FIGURE DRAK ClFIGl SUBFIG SQUARE DRAW C1FIG2 SUBFIG TRIANG Figure h. A Figure Composed of Unmanipulated Subfigures lk 1—4 6—11 13—18 21 23—28 30—35 37—41 44 — 49 51—56 C0MP2 FIGURE C2FIG1 SUBFIG SCUARE 1 C2FIG2 SUBFIG TRIANG 6 6 180 05 (0,0) Figure 5. A Figure Composed of Manipulated Subfigures 15 be provided. Up to 20 parameters (numbered 01 through 20) may be used in the description of a figure. Suppose a point C is described in ternu; of its co-ordinates (x, 3). If parameter h is the one to be used to deliver the value x to this figure, word 1 of the GDL - line describing C would "be PAR ^ O^. (Note that as internal blanks are not allowed in names this will not be mistaken for a name.) Words 6 through 25 of the SUBFIG - line are used to provide the parameters to the figure being called as a subfigure. Each parameter in the call may be a value, a name of the BCU of the correct type , or a parameter itself. Hence, a parameter can be passed down through nested subfigures ( as in Fortran). A SUBFIG - line need not have all 25 words present. Only the necessary ones (maybe only words 1 through 5) need be provided. An example of a more general figure is given in Figure 6. Part a) shows a rectangle with sides given by parameters 1 and 2. Part b) gives the GDL - line calling for an unmanipulated rectangle with sides 3 units and the distance given in the BCU described by GDL - line XDIST. (Note that while a point of kind 1 is expecting two values, it will search out and calculate a distance in place of that value. The opposite is also useful, and has been implemented. If in looking for a distance the program encounters a value in its search it will be satisfied. ) The current GDL's require that names used in lines be already defined (as BCU's or as figures as the case may be). This 'pre- definition' was not considered a serious restriction on the user, and as it simplifies the implementation it was employed. f\J o J I o m >o l 1 00 m vO m 1 JL tn o> I l o. n. o£ QS oc oc co »»4 fftl 1 O o < 00 o Q I o o oc Of o o o O m < y a circle and two distances format: NAME ARC 6 CIRCLE DISTl DIST2 description: DISTl is the chord length to the first end point from (r,0) where r is the radius of the circle. The second end point is determined similarly by DIST2. The arc is drawn counter- clockwise from the first to the second end point, 6l00 : the distance between two points format: NAME DIST 1 P0INT1 P0INT2 21 6200: horizontal distance between two points format: NAME DIST 2_ P0INT1 P0INT2 description : distance between "base of perpendicular to the horizontal asix from P0INT1 and P0INT2. This is always positive 6300 : vertical distance between two points format: NAME DIST 3_ P0INT1 P0INT2 description: distance between base of perpendicular to the vertical axis from P0INT1 and P0INT2. This is always positive 6U00 : perpendicular distance from a point to a line format: NAME DIST h P0INT1 LINEl 65OO : radius of a circle format: NAME DIST 5 CIRCLE 6600 : distance given by a real number format: NAME DIST 6_ value 1 6700: binary operations on distances format: NAME DIST 7_ DISTl value 1 DIST2 description: binary operations on DISTl and DIST2 are per- formed on the basis of the value of value 1 22 value 1=1 2 3 h 5 6 7 DISTl + DIST2 DISTl - DIST2 DISTl x DIST2 DISTl / DIST2 .DIST2 DISTl DISTl -/|dIST2 DISTl IDIST2 (exponentiation) 7100: angle determined by two lines format: NAME ANGLE 1 LINEl LINE2 description: positive angle through which LINEl must be rotated to get LINE2 7200: angle determined by three points format: NAME ANGLE 2_ P0INT1 P0INT2 P0INT3 description: positive angle through which the line defined hy PCilNTl and P0INT2 must be rotated counter- clockwise to get the line defined by P$INT2 and P0INT3 7300 : an angle given by a real number format: NAME ANGLE 3 value 1 The program is designed to provide the user with a standard set of linkages to the Handler and Drawing programs for both GDL-1 and GDL-2. These can be used in creating new routines , if the following conventions are followed: 23 U O •P cd o o 0) -C -p fl o •H ■s o •H O O _|l • ■> III III 1 1 o o LT\ o o H o < X S (M 8 o O o O -3- o o o H H o < X X S C\J >> H 3 o o o O on o o O o H o O o H H < X S CM X X t3 X -ti o o O o o o O o CM o o O o O H H H H O < X X X X S H >> H >> H >> H >. o o O o o o O o o O H o o o o o o O H H H H o o o H X H X H X H H X H X X X X X xi 3 O > — * •H CVJ -P >> O n U (D c CM , — .. (D •H O X H * — * H P fl O T_i •H v^. ^ >. H 3 -P >> (D 1=3 Pi o ff O s . ^ — % * — s N^_^ & C H M V w H H 3 — taO »H o > >> U Jh co H § C\J o Q d X X M « H H ^^ O II ^^ O II i-q II II fe O E^ II II fc O < E-< s W M o* H S w M H ^_^ ^^ K IX < < Ph eu a s H i rv o M O O ,-"j EH O H O Q H o* O J- o O + fl o vo + * \£> a 0\ M 0\ 1 H CD On 1 0\ fC a; S * K ' — ' ffl <5 03 ■ l/\ < Ph H Eh Q* fe H « H" — * S + ca *~-s 1 + C < K M K H > < II En Q < II EH H M P-i H i-3 M ^ H H Q O II Q V_^ O II J o H O < P>H £ Eh < P>H <; Eh O M Q o M s Q d ■r^i TJ 0) CD B C iH •H O 0) -P ^M c 2 u •H o (V -P M Cu, 3 o T3 o •H ct3 cd P o H H cd H H cti fc O H O CVJ 25 o cn o TS- o II !3 CM TS. O H cu _=r LTN t- II II II II II a G G G -p H (l) c c o O -p ^H CJ •H a ?H o w WJ o tJ O •H •H h •H Cl) cd o H ft H O b3 H nd 0) ctj .. ,d o I i •4- i l r» ro m rn I o r<*> cx> <\l I I m 0C < o o cc < Ql (V »4 fO t\t m "sT «■«' o f-4 I fp» M *H O O O O UJ UJ UJ LU i ac oc oc ac r-l oH r-l — 1 o o p*» r^ r™ r* r* P 1 " ac oc »-< o o o o o o < O CsJ o ODĊHO < a »■* r— t p^ c\j m rv) Ou O 0» a au O O O O O O O H> l-» K — * ►— O ►- H» UJ UJ UJ UJ UJ UJ _J -J -J 1 _J -J _> f\J 00 -4 I I m >r ! I DZZt-Z ZUJUJOIIU tijHH^HMZzzz fc*00>~«00 , ~''~*»~»*— ' U. a OU a £ -I -J .J .J »»• f\i ro •$• ~4 ^(MQfn-tp-ifsjfO^t oooooooooo UJUJUJUJUJUJUJUJUJUJ acaCQCaeQCocaeocaJoc UJ UJ UJ QC |— .J |M h- «J 3zu wz uj za Owt.oz w Zwo;o ^O'-'QC'—O^O'-'OC u.u.u I l o o o •*• I I r» m m m I I o m oo <\J I I m CNJ QC < a o f—i C_ < Q. *^d t——l ^J ^^ r~ o o a m o o < UJ UJ I l a ~i _i •_ O O O O Q -J 0C H O < UJ a _i •-4 —t O f\l o o o *■ 4 P* ^ 1 '— ' ^** 1"* (*■**■ i— *i >- _« f\J h» >— f~ t— k- LU UJ UJ IU UJ UJ UJ UJ UJ UJ UJ UJ UJ — » — 1 » 1 _J _J -J -J _J _J 1 -J -J — 1 — 1 — J O l~ r- <\J C0 f-l I I ro I I I _ I l _( _i _< ,_ „4 f_ _J (\j _( (\j _| _ ,-| oj UJ UJ UJ Cfc H* —J !*•*' h"** H* - — J i^ QZO ZZhZUJUJUJO ZUJ O i -»QiO'- < '-'<-o , -'~'z^a;o'-*2r _,c_o z z _* o *—* *— • *— • U. f_ O ~J -J _l _4 p_ f\| a a _i -j o -j _j _j _j UU UJ UJ UJ UJ 3K :_ < < c_ c_ Q O UJ O O O Q£ t-H _» f— I Q U. U. — ■ O CO CD CQ -♦_»_» D u. (/) to t/) O Q -J rwrJ ^_J *—*' — — * Q O Q Q o o o o <\J 29 o 0 ! O ac 00 < irv a «0 u*\ m 1 f\l i \T o 1 1 o >r •4" mà «* 1 1 o r- m trt m I o o tf\ oo cg 1 1 -J CO Q fvi o p4 f\J 00 UJ o M Of »-4 1 3 U. 1 O 03 m M 3 r-< u. M -J •-4 0. 1 z: < fH 1 X X >o Ul LU >*• 1 1 oooooooo acacatatatatatac <<<<<<<< aaaaaaaa oo ir> in m ir> N Ift r- O (M lf| ^ H (f> w oooooooo oooooooo m o (•w ^"" pM pM p^ F""* pw pw* OtfOOOOOOOO t/)i/)i/> f\if\s*if\'>Or>-cocr« XXXXXXXX IJJ UJ UJ UJ LU UJ UJ UJ o O -4 a X < x UJ < a. i/> >— « Q 30 \ \ o ■^ O __j i Figure 7. An Example of the Use of GDL 31 IV. GDL - 1 a) Introduction As was mentioned in Section 2, an initial attempt was made using a quasi-interpretive system in which all names had been removed from the structures set up for each line in the language. The struc- ture for each line is assigned a fixed location in memory as it is assembled, and then references to the name of that line are simply integer pointers to the location at which that line is situated. b) Basic Structures A/. Construction Blocks: There are six types of construc- tion blocks of which all figures must be composed: points , line segments, circles, arcs , distances , angles. Each of these can be des- cribed in a number of ways. For example , a point can be given by two co-ordinates; this is referred to by the language as a point of kind 1, A point of kind 2 is described by the intersection of two lines . A number of consecutive words in storage is called a block. A block describing a point of kind 1 is four words long, the first three of which are used. The first indicates by the integer 1100 that a con- struction block of type 1 (point) kind 1 is being represented. The second word is the x co-ordinate, the third is the y co-ordinate,, It is shown in this paper as in Figure 8. A construction block for a point of kind two is given in Figure 9. Here the second word is a pointer to a block repre- senting a line segment indicated here by L . This may be any kind of line segment block. A complete list of BCU's has been given in Section III. 32 110C Figure 8. GDL-1 Block Structure for a Line of Kind 1 1200 ^2 Figure 9. GDL-1 Block Structure for a Line of Kind 2 Figure 10. GDL-1 Block Structure for a Figure 33 B/. Figure Blocks: Those construction blocks which, when drawn, compose a figure are pointed to in a figure block. The figure block may have many pointers in it, each indicating a construction block to be drawn. The last word in a figure block is an end-of-figure indication. The paper will indicate a figure block as in Figure 10, It should be noted that there may be many construction blocks which are not drawn ; these may be considered as playing the role of construction lines. In particular, points are usually not drawn , as they would not appear significantly on a display; all distances and angles also fall into this class. C/. Parameter and Manipulation (PAM) Blocks: A figure may have as its elements , not only construction blocks but also other figures. Each figure is initially described in terms of some origin ( at the discretion of the user) . When it is called as a subfigure of another figure GDL allows it to be translated by vector (x , y ) rotated through degrees , and expanded to E times the size. Hence , the pointer in a figure calling a subfigure indicates a block giving the details of the manipulations to be done to the figure to which it in turn points . It is shown in the GDL-1 block structure as in Figure 11. The first word in a PAM block is a pointer to the figure it is providing parameters for and manipulating. Words 2 through 5 are reserved for values of x , y , 0, and E. Following the fifth word in the PAM block are from one to twenty parameters , a word being provided for each used parameter. 3U paramete: Figure 11. GDL-1 Block Structure for a PAM-Block Linkage Figure 12. Nesting of Figures in GDL-1 35 It is often desirable to create a segment of a figure which will appear differently depending on what parameters it is fed, much like a FORTRAN subroutine. Hence, any of the construction blocks in Figure F p may have pointers to parameters in any words except their type-kind indicator word. A parameter in a PAM block may be a pointer to a construc- tion block, or it may be a value , or it may itself be a pointer to a parameter. This allows many levels of parametrization, a parameter being handed down from subfigure to subfigure through PAM blocks . A figure may be a subfigure of a given figure many times each through a different PAM block, and it may be called as a sub- figure of two different figures. Hence , patterns of GDL-1 blocks such as that shown in Figure 12 will occur. Note that F will appear three times as a subfigure of F , twice as a part of F p , which occurs twice in F . c) Handler Commands and Effects G.D.L. is designed to allow the user to enter the descrip- tion of a drawing through an on-line CRT = display - console = type- writer - terminal, display his current description as a picture on the CRT = display, add, delete and change items in his description, redisplay, iterating until satisfied, and then obtain hard copy output from a plotter. The language includes the following modes of operation: A/. DEFINE: With this mode command is given the name of a new figure to be defined. A check is made to insure that the 36 given name has not already been used; and then it is entered in the Name Table. This table is a cross listing of names and addresses of names the user employes, No duplications are allowed. In this mode, Basic Construction Unit Commands (BCUC) can be given. An ARC command results in a check of the items in the com- mand for validity, and then the creation of a construction block, with cross listing in the name table, If the arc is to be drawn as part of the figure being defined, a pointer to it is added to a list of pointers for the figure, Also a SubFigure Command (SFC) can be given in the define mode. This initiates a check for validity, then places an entry in the name table , creates a PAM - block and places a pointer to that PAM - block in the list of pointers for the figure being defined. An END command terminates the initial definition of a figure, causes allocations of storage for the figure block, creates the figure block by copying the list of pointers into the defined space, creates the address section of the entry for the figure in the name table, and returns the program to the point of waiting for a redefinition of mode. Validity checks resulting in the determination of errors cause the program to ignore the command, print out the cause of error, and await the next command at the same point at which the defective command was given, The error messages are given symbolically wherever possible through use of the name table, An example is given in Figure 13. B/» ADD: The name of the figure to which additions are to be made is given with this command. A validity check is made , and the a ©» E are stored as values x 1000. The parameters in a PAM - block are either pointers to blocks representing BCU's (positive in- tegers < 30,000), pointers to parameters (negative integers from -1 to -20), or values (positive integers between 30,000 and 90,000). This last is interpreted to mean (value x 1000) + 60,000. Values in PAM - blocks are therefore limited to ±30,000 and the L(l) array limited to 29,999 locations. The assembler program follows the outlines as suggested in Section h. c) The Handler . A block diagram appears in Section h, e), program listings in Section h t f). The drawing sub-program, employs two stacks allowing ar- bitrary levels of nesting of figures, or construction blocks within figures. On entering this program a pointer to the first (artificial) PAM - block is created. This is used as a base register for parameter searching and points to E. The number of the parameter desired is added to this base address to obtain the parameter. In addition from x n » y n » ©» E are created six values representing this manipulation. The manipulation is represented by: \TJ + [C Dj[y where [ is the vector representing the co-ordinates of a point returned by the BCU being drawn, and / , 1 is the vector of co-ordin- ates to be used by the displaying or plotting subroutines . Hence, from simple geometry, s = x o A = E cos B = -E sin C = E sin D = E cos 0. The "next-sequential-instruction" (NSI) is set to the first pointer in the figure to be drawn (obtained from the name table). The first pointer is followed; assume a BCU is encountered. This BCU is to be drawn, but as yet the values of the BCU's upon which it depends have not been determined. Hence, a stage indicator is set to 1 and decremented as the stages are traced down. Eventually points will be reached and values obtained. Then as these values are returned up a stage, the stage indicator is augmented. When values are obtained and the stage indicator is less than 1, the values are returned up a stage through an "accumulator" . When values are obtained and the stage indicator equals 1 then the results are plotted or displayed. An example may make this clearer. Suppose it is wished to draw the line ST of Figure 18 as part of a figure named FIGl. Points A, B, C, D, V, W are defined by co-ordinates (type- kind = 1100); lines AD, CB, VD, WB are defined as between two end- U5 Figure 18. Diagram of Figure FIGl FIGl Figure 19. GDL-1 Block Structure for Figure FIGl points (type-kind = 2100); points S and T are defined as intersections of two lines (type-kind = 1200); line ST is defined as between two end-points (type-kind = 2100). The structure resulting would be as in Figure 19. The program setting with NSI = 260 would: a) stack 26l as NSI on return to FIG 1 b) set the stage indicator (ID) equal to 2 c) go down one stage: i) NSI = L (NSI + LT) : pointer is followed ii) ID = ID - 1 : stage indicator is decre- mented iii) LT = 1 : program section is set for first pointer of new BCU here; NSI = 2U8, ID = 1, LT = 1 d) NSI is examined, and program section 2100 is called, e) LT = 1 indicates first pointer is to be followed. LT = 2, and NSI = 2^8 are stacked for return to this stage. Go down a stage, NSI = 2^0, ID = 0, LT = 1. f) And so on until NSI = 200, ID = -2 , OT = 1 and the stack looks like Figure 20, g) Here, however, the program can return the values of (A , A ) without searching to any deeper stages. The x y accumulator is loaded with these ( as ID ^ l). h) go up one stage: i) LT = IP0P (l); pop LT from the stack ii) NSI = IP0P (l); pop NSI from the stack iii) ID = ID + 1 ; stage indicator is augmented hl Figure 20. Stack 1 When Analyzing A of FIGl. (cf\ Figure 19' Figure 21. Stack 1 While Analyzing D of FIGl, (cf. Figure 19) kS i) as NSI = 22U, the segment for 2100 is again called. As LT = 2 as "computed - G0 - T0" transfers control to that section of this segment which analyzes the second pointer. j) again LT = 3, NSI = 22U are stacked, as are the values for point A (This last actually being done first so NSI x LT will pop first for return to the correct seg- ment of program) . The stack looks like Figure 21 and the program goes down a stage (LT = 2) : NSI = 212, LT = 1, ID = -2. k) Again values can be immediately returned; D , D are x y loaded into the accumulator; the program goes up a stage: NSI = 22U, LT = 3, ID = -1. l) Now program segment 3 of program section 2100 can cal- culate the values for line AD. As ID = -1 it loads the accumulator, and returns up a stage. m) The second pointer of BCU S is now followed, the values of the first being stacked as in j ) . A prefix scan is being carried out on the tree represented, n) The procedure continues until NSI = 2U8, LT = 3, and the calculation of the values for line ST have been ob- tained. Now ID = 1, and so these values are passed to the plotter or display subprogram. o) The plotter or display subprogram returns control to the drawing subprogram where it can pop NSI = 26l out of the stack and continue. If any of the pointers in the tree described had been a parameter, instead of simply calculating NSI from L(NSI + LT), a U9 reference to the PAM - "block calling the subfigure is made , the pointer, parameter, or value obtained from there. If it was a para- meter, this procedure would have been repeated at a level higher, re- ferring to the PAM - block calling the figure which pointed to the PAM - block in which the program found the parameter. To clarify this and explain when subfigures are encountered while executing a figure block, the example of Figure 22 is given. FIG 1 is to be drawn. The Dummy PAM - block is created as shown. When pointer A is encountered while drawing FIG 1, the program detects that a subfigure is to be drawn. The position of E in the DUMMY PAM - block is stacked in stack 2, as indicated. The current parameter pointer is set to indicate E in PAM - block 1. Any point ( generated by FIG 2 to be drawn as a section of FIG 1 will now be mani- pulated first by the x ' , y ' , 0* , E' , of PAM 1, and then by the x , y , 0, E of the Dummy PAM - block. But all manipulations must return to those of just the Duramy PAM - block when FIG 2 is completed. Hence the program stacks in stack 1 the current values of A, B, C, D, S, T. Then it calculates a new set of six variables to accomplish the combined manipulation. This calculation is (where the subscript "new" indicates those being calculated) . S = S + Ax ' + By ' new T = T + Cx ' + Dy ' new J A = AE' cos 0' + BE' sin 0' new B = -AE' sin 0' + BE' cos 0' new C = CE' cos 0' + DE' sin 0' new D = -CE" sin 0' + DE' cos 0' new 50 DUMMY PAM STACK 2 PAM 2 FIG 3 Figure 22. Nested Figures and Parameter Chasing Using Stack 2 51 The program then determines from the first word of PAM 1 the address of the figure to be drawn, NSI = (Location of pointer A + l) is stacked in stack 1 and NSI is set equal to the location of the first word of FIG 2. A similar series of actions takes place when pointer B is encountered while drawing FIG 2. When FIG 3 is being drawn, stack 2 will contain pointers to both E in PAM 1 and E in the Dummy-PAM - block; the current parameter indicator will point to the E in PAM 2. If a BCU of the substructure of FIG 3 has a pointer to a parameter, then when it is encountered its number (say 3) is added to the current parameter indicator. If the result is a parameter (i.e. parameter 3 in PAM 2 is itself a pointer to a parameter), its number is the parameter indicator for PAM 1. This is turn may be a pointer to a parameter, in which case its value is added to the second value in stack 2, the parameter indicator for the Dummy-PAM - block. Note that a restriction is placed on parameters in the Dummy-PAM - block; they must be values . Hence no further chasing results, (Stack 2 is not strictly speaking a Push-Down Stack, the ability to read all en- tries in it being also provided. ) On encountering the end-of-figure indicator (a work with in it) of FIG 3, the current parameter indicator is set equal to the popped top entry in stack 2. NSI is set equal to the popped entry from stack 1, A, B, C, D, S, T are replaced by the six old values popped from stack 1, and processing continues. When the value of the entry popped from stack 2 is the known value of the location of E in the Dummy-PAM - block (this is fixed at 52 0) the drawing sub-program returns control to the G.D.L. assembler at the undefined mode stage. Storage Allocation has been left in a most crude state. All blocks are assigned sequentially , and there is no recourse of action if core is exceeded. As arrays are in FORTRAN , and hence lack dynamic allocation facilities, maximum stack sizes must be guessed at, and space wasted while it is not fully in use. If it is exceeded, again there is no way out. This seems to be the most serious price one pays for working in FORTRAN. Minimum block size is four words . All BCU's have four words. If a one-entry addition is made to a figure block, an additional block of four words is provided for chaining. This prevents many small blocks going to waste. 53 e) Block Diagrams 3. h. read next \ '*" 7 identify key word DEFINE ^? ADD v mode? yS JNO add pointer to figure if BCU to be drawn 1 <* c 57 37. 38. 39. set plot switch off for DISPLAY on for PL0T check and set up dummy PAM hlock get and check locati\jn of figure to/ he drawn U3. kk. get & check\ location of \ figure to wh/ch adding / I set mode to ADD $ UO Ul. k2. set initial A,B,C,D,S,T /go down \ a level to drawing subprogram (see descrip- tion of that jprogram for \ flow) / 1+5. k6. kl. get and check locatiJ of all BCU's to be deletard get and che< location of figure from which to de/ete delete BCU's from figure 58 f ) Program Listing C PROGRAM GDL-1 C C DIMENSION L(3O0),LIN(27,2),LSTl( 100 ) , LST2 (40 ) DIMENSION NTL(1C0,2),LBLK{8C) COMMON LALLPT,NTLPT,NTL,L8LK,LST1,LPT1,LPT2,L,LST2 COMMON A,B,C,D,S,T,LIN C C INITIALIZE C LPT1=0 LPT2=G LALLPT=25 LADD=0 LCHANG=0 NTLPT=C DO 3601 1=1,80 3601 LBLK(I)=3 LBLK(11)=2 LBLK(12)=2 LBLK(14)=1 LBLK(21)=2 LBLK(61)=2 LBLK(63)=2 LBLK(64)=2 LBLK(65)=1 LBLK(66)=1 LBLK(7i)=2 LBLK(73)=1 C C G.D.L.-l HANDLER C 3000 CALL RDLNd ) IF(I) 3003,3003,9002 3003 IF( LIN(2,1)-6FCEFINE) 3150,3010,3150 59 3150 3151 3152 3001 3002 3252 3009 9002 IF( IF( IF( IF( IF( IF( PRINT GO TO PRINT GO TO UM2,1)- LIN(2,D- LIK(2,D- LIN(2,D- LIN(2,D- LIN(2,D- 10001 3000 10002 3000 6MDD ) 6HCELETE) 6HCHANGE) 6HCISPLA) 6HPL0T ) 6HFINISH) 3151, 3152, 3001, 3002, 3252, 3009, 3300,3151 3400,3152 3500,3001 3100,3002 3250,3252 3200,3009 C C c c c c FINISH ORDER 3200 STOP 02 DEFINE COMMAND 3010 CALL RCLN(I) IF(D 3004,30 3004 LADD=0 3012 IF( LIN(2,D- 3013 PRINT 10004 GO TO 3010 9003 PRINT 10002 GO TG 3010 04,9003 6HFIGURE) 3013,3014,3013 C C c FIGURE COMNANO 3014 9005 3026 3015 9006 3005 3025 3016 3024 3017 3018 3019 3020 3021 3022 3023 LT=LIN(1,2) IF(LSRCHN(LT) PRINT 10005 GO TC 3010 NTLPT=NTLPT+1 NTL(NTLPT,D = IX=0 CALL RCLNd ) IF(I) 3005, 3C PRINT 10002 GO TO 3015 IF(LCHANG) 30 IF( LIN(2,D- IF( LIN(2,D- IF( LIN(2,D- IF( LIN(2,D- IF( LIN(2,D- IF( LIN(2,D- IF( LIN(2,D- IF( LIN(2,D- IF( LIN(2,D- PRINT 10006 GO TO 3015 ) 9005, 3026, 9CC LT 05,9006 25,3025, 6HSU6FIG 6HCUMMY 6HP0INT 6HLINE 6HCIRCLE 6HARC 6HCIST 6HANGLE 6HEND 3504 ) 3016, 3024, 3017, 3018, 3019, 3020, 3021, 3022, 3023, 3030, 3600, 3060, 3080, 3082, 3084, 3090, 3086, 3050, 3016 3024 3017 3018 3019 3020 3021 3022 3023 9 13 SUBFIG ORDER 6o c 3C3C IF(LCHANG) 3520,3520,9008 14 9CC8 PRINT 10008 G0 TO 3015 3520 IF(LIN(3, 2D 3031,9009,9009 9009 PRINT 10009 GO TO 3015 3031 LSTKD=-LSRCHN(LIN(3,D) 15 IF(LSTKD) 901C, 9010, 3032 9010 PRINT 10010 GO TO 3015 3032 IF(LIN(4,2D 9011,3033,9011 16 3033 IF(LIN(5,2)) 9011,3034,9011 3034 IF(LIN(6,2)) 9011,3035,9011 3C35 TEMP=LIN(6,1) T£MP=TEMP/57„29578 LIN(6,1)=TEMP IF1LIN(7,2)) 9011,3036,9011 9011 PRINT 10011 GO TO 3015 3036 K=LlN(2,2)+2 IF1K-7) 3039,3039,3040 3040 DO 3037 1=8, K 17 IF1LIN(I,2)) 3038,3780,3781 3038 LSTKI)= LSRCHN(LIN( 1,1) I IF(LSTKD) 9012,9012,3037 9012 PRINT 10012 GO TO 3015 3780 LSTKI)=LIN(I,1 J+60000 GO TC 3037 3781 LSTKD=-LIN(I,D 3037 CONTINUE 3039 IF(LSRCHN(LIN(1,2)D 9013,3046,9013 18 9013 PRINT 10013 GO TO 3015 3046 N=LALLCC(K~2) 19 NTLPT=NTLPT+1 NTL(NTLPT,D = LIN<1,2) NTL(NTLPT,2)=N L(N)=-LSTKD L(N+D = LIN(4,D L(N+2) = LIN(5,D L(N+3) = LIN(6,D L(N+4)=LIN(7,D IF(K-7) 3047, 3C47, 3041 3041 DG 3042 1=8, K li=N+I-3 3042 L1ID=LST1(I) 20 3047 IX=IX+1 LST2( IX)=N GO TO 3015 C C ENL ORDER 6i C 3050 IF(IX) 9014,9014,3051 9014 PRINT 10014 GO TO 3015 3051 IF(LADC) 3053,3053,3056 21 3053 K=IX+1 22 N=LALLCC(K) 00 3052 1=1, IX K=N*I-1 3052 L(K)=LST2(I) K=N+IX L(K)=0 DO 3054 K=i,NTLPT 23 IF(NTL(K,1)-LT) 3054,3055,3054 3054 CQNTINUE 3055 NTL(K,2)=-N GO TO 3000 3056 1=1 24 3310 M=LT 3313 IF(L(LT)) 3057,3059,3058 3057 LT=-L(LT) GO TO 3310 3058 IF(L(LT)-40000) 3311,3312,3311 3311 LT=LT+1 GO TO 3313 3312 LCLT)=LST2(I) 1 = 1*1 IF(IX-I) 3314,3311,3311 3314 LADO=0 GO TO 3000 3059 K=3-LT*M IF(K) 3316,3316,3317 3317 L(LT+1)=0 GO TO 3312 3316 K=IX=I*2 N=LALLGC(K) L(LT)=-N 00 3315 J=I,IX K=N*J-I 3315 L(K)=LST2(J) K=N+IX-I+1 L(K)=0 GO TO 3314 C C PCINT OROER C 3060 M=LIN(2,2)+1C 25 3063 K=LIN(7,1) IF(LBLK(M)-K) 9C15 S 3064,9015 9015 PRINT 10015 GO TO 3015 3064 00 3069 1=1, K 26 IF(LIN(I+2,2) ) 3065,3066,3067 3065 N=LSRCHN(LIN( 1+2,11) IF(N) 9016,9016,3068 9016 PRINT 10016 G0 TO 3015 306 LST1(I)=N GO TO 3069 3066 LSTUI) = LIN(I+2,l)+60000 GO TO 3069 3067 LST1(I)=-LINCI+2,1) 3069 CONTINUE IF(LSRCHN(LIN(1„2)) ) 9017,30 70,9017 27 9017 PRINT 10017 GO TO 3015 3070 IF(LCHANG) 3508,3508,3507 28 3508 N=LALLCC(4) 29 NTLPT=NTLPT+1 NTL(NTLPT,1) = LIM1,2) NTL(NTLPT,2)=N 3509 L(N)=M*100 31 K=LINC7,1) DO 3768 1=1, K M=N + I 3768 LCM) = LST1U) IF(LCHANG) 3510,3510,3015 32 3510 IFC LINCl, D-6H0RAW ) 3015,3769,3015 33 3769 IX=IX+1 LST2C IX)=N GO TO 3015 C C LINE ORDER C 3080 M=LIN(2,2)+2C 25 GO TO 3063 C C CIRCLE CROER C 3082 M=LIN(2,2)+4C 25 GO TO 3063 C C ARC ORDER C 3084 M=LIN(2,2)+50 25 GO TO 3063 C C DISTANCE CRCER C 3090 M=LlN(2,2)+60 25 GO TO 3063 C C ANGLE ORCER L 3C86 M=LIN(2,2)+7C 25 GO TO 3063 63 C C CUMKY ROUTINE C 3600 IF(LCHANG) 9016,9018,3503 34 9018 PRINT 10018 GO TO 3015 3530 N=LSRCHN(LIN(1,2) ) 35 IF(N) 9020,9020,3769 9020 PRINT 10020 GO TO 3015 36 C C OISPLAY ORCER C 3100 LPLTSfc=0 37 3251 IF(LIN(3,2)) 3101,3009,3009 3101 NSI=-LSRCHN(LIN(3,1U 38 IF(NSI) 3009,3009,3102 3102 K=LIN(2,2) 39 IFCK-5) 3009,3105,3106 3106 00 3104 1=6, K IF(LIN( 1*2,2) ) 3009,3103,3009 3103 L(I-5)=LIN( 1*2,1) 3104 CONTINUE 3105 00 3108 1=1,4 IFCLINf I+3«2) ) 3009,3108,3009 3108 L(I+20)=LIN(I+3,1) N=20 40 CALL STACK2(0) S=0 T=0 A=l 8=0 C=0 0=1 GO TO 0031 41 C C PLOT OROER C 3250 LPLTSW=1 37 GO TO 3251 C C ACC ORDER C 3300 LT=-LSRCHN(LIN(1,2) ) 43 IF(LT)9023,9C23,3302 9023 PRINT 10023 9023 GO TO 3000 3302 IX=0 44 LADD=L GO TO 3015 C C OELETE ORDER C 6k 3400 LT=LIN(2,2) D0 3401 I=i,LT IF(LIN( 1+2,2) ) 3402,9024,9024 9024 PRINT 10024 GO TG 3000 3402 LST2(n = LSRCHN«LIN(l+2»l)) IF(LST2(I)) 3401,9025,3401 9025 PRINT 10025 GO TO 3000 3401 CONTINUE K=LSRCHN(LIN(1,2>) IF(K) 3408,9026,9026 9026 PRINT 10026 GO TO 3000 3408 00 34G3 1=1, LT M=LST2(I) N=-K 3406 IFCL(N)) 3404,3403,3405 3404 N=-L(N) GO TO 3406 3405 IF«L(N>-M) 3409 N=N+1 GO TO 3406 3407 L(N)=40000 3403 CONTINUE GO TO 3000 45 46 47 3409 c 3407,3409 C C c CHANGE ORDER ) 3260,3503,3260 42 10 11 12 3500 LCHANG =1 GO TO 3015 3504 IFCLIN«2,1)-6HEND 3503 LCHANG=0 GO TO 3000 3260 N=LSRCHN(LIN(1,2>) IF(N> 9021,9021,3505 9021 PRINT 10021 GO TO 3015 3505 IF(LCN)) 9022,3506,3506 9022 PRINT 10022 GC TO 3015 3506 LCH=N LIN(1,2)=0 GO TO 3024 3507 N=LCH GO TO 3509 HANDLER ERROR MESSAGES 0001 F0RMAT«1H ,40HILLEGAL KEY WCRD„ DOES NOT DEFINE MODE ) 0002 FORMATtlH ,20HINVALID INPUT LINE ) 0004 FORMATdH ,40HFIGURE COMMAND DOES NOT FOLLOW OEFINE ) 0005 FORMATdH P 40HNAME IN FIGURE COMMAND NOT A NAME ) 30 65 10006 lOCCd 10009 10C10 10011 I 10012 1CC13 10014 10015 10016 10017 10018 10020 10021 10022 10023 10024 10025 10026 C C C C C C C c i 1 FGRM*T( 1H FGRMATUH FORMATdH FORMATUH FGRMATUH FORMATUH FGRMA7UH F0RMA7UH F0RMA7UH FGRMATUH F0RMA7UH FGRMAK 1H F0RMA7UH F0RMA7UH F0RMA7UH F0RMA7UH F0RMA7UH F0RMA7UH FGRMA7C 1H ,4CHILLEGAL KEY WC ,40HSUBFIG CCMMANO ,4CHSUBFIGURE NAME ,40HSUBFIGUR£ NAME ,4GH^CN-NUMERIC MA ,20HFIG COMMAND ,4CHNAME IN PARAME ,40HNAME OF SUBFIG ,40HNC LINES DEFIN ,40HINVALID KIND I ,40HPCIN7ER NAME N ,40HB.C.U. NAME AL ,40HDUMMY COMMAND ,40HNAME IN DUMMY ,40HNAME IN B.C.U. , 1HE) ,40HNAME DOES N07 .40HFIGURE NAME NC ,4CHBCU NAME 70 BE ,40HBCU NAME 70 BE ,40HN*ME 7C DELE7E RD« CGES NCT DEFINE A LINE) ILLEGAL IN CHANGE KCDE ) WORD N07 A NAME ) N07 IN NAME 7A8LE ) NIPULA7I0N CCNSTAN7 1H SUB ) 7ER LIS7 INDEFINED URE ALREACY DEFINED £D IN 7HIS FIGURE NDICA70R WORD C7 IN NAME 7ABLE RAEDY DEFINED ILLEGAL IN CHANGE MODE COMMAND N07 DEFINED N07 DEFINED IN CHANGE KCD PGIN7 70 A B.CUo ) 7 DEFINED WHILE AODING ) DELE7ED N07 A NAME ) DELE7ED N07 DEFINED ) FROM N07 DEFINED OR A BCU) DRAWING SUBPRCGRAM SEGMEN7S EXECU7E FIGURE BLCCK C c c 0011 NSI = IP0PU) 0012 IFiL(NSD) 0013,0020,0014 0013 NSI=-L(NSI) GO 7G C012 0014 IF(L(NSI)-4000C) 0015 P 0016,C 0016 NSI=NSIU GO 70 0012 0015 N=L(NSI) IF(L(N)) 0030, CC17, 0017 0C17 CALL S7ACKKNSI + 1) 10=1 L7=l NSI=N GO 70 1 END OF FIGURE ELOCK 0020 L7=IPCP(2) IF(L7)C021, 3000,0021 0021 NSI=IPCP(1) 7=IPGPU) 7=7/10C0. S=IPOP(l) S=S/1C00. C15 66 A=IP0P(1) A=A/10C0. 8=IP0P(1) B=B/iC00. C=IP0P(1) C=C/10C0. D=IPOP(i) D=D/10C0. GOTO 0C12 C C GO DOfoN FIG LEVEL C 0030 LT=D*1C00. CALL STACKKLT) LT=C*1000. CALL STACKKLT) LT=8*1000. CALL STACKKLT) LT=A*1C00. CALL STACKKLT) LT=S*1C00. CALL STACKKLT) LT=T*1000. CALL STACKKLT) CALL STACKKNSI + 1) CALL STACK2CN+4) NSI=-L(N) 0031 TH=L(N+3) TH=TH/1000. Xi=COS(TH) X2=SIN(TH) X3=L(N+4) X3=X3/1000. Y1=L(N+1) Yi=Yl/1000. Y2=L(N+2) Y2=Y2/10C0c S=S+A*Y1+B*Y2 T=T+C*Y1+D*Y2 Y3=X3*(A*X1+B*X2) 8=X3*(-A*X2+B*X1) A=Y3 Y3=X3*(C*X1+D*X2) D=X3*(-C*X2+C*X1) C = Y3 GOTG 0012 C C ENTERING A LOWER LEVEL ROUTINE C 0002 CALL ICHASE(NSI+LT,N,NPAR) IF(NPAR) 0099, CC99, 0004 0C05 NPAR=-NPAR 0C04 CALL STACKKLT) 67 C C c CALL STACKKNSI) ID - ID-1 LT = 1 NSI = NPAR GOTO OCOl ENTERING HIGHER LEVEL ROUTINE 0003 ID = ID+1 NSI=IPOP( 1) LT=IP0P(1) LT=LT+i GG TO 1 C C C C C C 0099 13001 96 C c c CALCULATING RCUTINES CALCULATING ROUTINE ERROR RCUTINE PRINT 13001 FORMATQH , 17HERRCR IN ROUTINES) CALL LSRCHP(NSI,NPAR) PRINT 96,LT,NPAR FGRMATdH ,14HVALUE IN WORD ,12, 4H OF ,A6) GO TO 3000 CHOOSE ROUTINE FOR SPECIFIC FIGURE C C c c c c c 0001 KSN = L(NSI ) NUM = KSN/1000 KSN = (KSN~NUM*1000)/100 GO TO (1000,2000, 9000, 4000, 5000,6000 ,7000) 8 NUM 9000 LT=0 GQ TO 99 CHOOSE RCUTINE FOR SPECIFIC POINT 1000 GOTO (1100, 1200, 1300, 1400)*KSN ROUTINE FOR PCINT DEFINED BV TWO COORDINATES 1100 GO TO (1110, 1120,1130), LT 1110 CALL IVAL(NSI+1,NPAR) IF(NPAR) 0005, CC99, 1111 1111 LT=2 MACC1=NPAR=6C0CC 1120 CALL STACKKMACCl) CALL IVAL(NSI+2,NPAR) IF(NPAR) 0005,0099,1121 1121 MACC1=NPAR=6C0CC 1130 MACC2=MACC1 LT=LT+l 68 MACCi=IPOP(l) GG TO 1050 C C C ROUTINE FOR POINT DEFINEO BY INTERSECTION OF TWO LINES C 1200 GG TO (1210, 122C, 1230), LT 1210 N=l GO TO 2 1220 CALL STACKH*ACC2) CALL STACKHKACCl) N=l GG TO 2 1230 X2=MACC1 Y2=MACC2 X1=IP0P(1) Y1=IP0P(1) DX1=X2-X1 DX2=X4-X3 IFCDXl) 1238,1234,1238 1238 IFCDX2) 1231,1236,1231 1231 XM1=(Y2-Y1)/CX1 XM2=(Y4-Y3)/CX2 DM=XM1=XM2 IFIABSF(DMJ-lo) 1232,99,1232 1232 MACC2=(Y3~XM2*X3+XM1*X1-Y1)/CM +0.5 MACC1=(MACC2=Y3+XM2*X3)/XM2 + 0*5 1237 IFIABSF(MACC2)-30000) 1233,99,99 1233 IF(A8SF(MACC1)-30000) 1050,99,99 1234 IFCDX2) 1235,99,1235 1235 MACC1=X1 +0.5 MACC2=Y3+(Y4-Y3 )/DX2*(Xl-X3) +0.5 GG TO 1237 1236 MACC1=X3 MACC2=Y1+(Y2-Y11 /0X1*1 X3-X1) +0.5 GO TO 1237 C C C ROUTINE FOR POINT DEFINED BY TRANSLATICN FROM A POINT C 13 00 G0T0(1310, 1320» 1330, 1340 ),LT 1310 N = l GO TO 0002 1320 CALL STACKHMACC2) CALL STACKHMACCi) CALL IVAL(NSI+LT,NPAR) IF(NPAR) 5,99,1321 1321 MACCl=-NPAR-60CC0 LT=LT+1 1330 CALL STACKl(^ACCl) CALL IVAUNSI+LT.NPAR) IF(NPAR) 5 P 99,1331 1331 MACC1=-NPAR- 6CCC0 69 LT=LT*1 1340 N=IPGP(l)+IP0P(i) MACC2=MACC1+IP0P(1) MACC1=N GO TO 1050 C C C ROUTINE FOR PT CEFINEO BY CIRCLE C 1400 GO TO (1410, 1420), LT 1410 N=4 GO TO 2 1420 GO TO 1050 C C C ROUTINE TO CRAW fi POINT C 1050 IF(ID-l) 3,1051, 3 1051 IF(LPLTSW) 1052,1052,1053 1052 CONTINUE C ROUTINE TO DISPLAY A POINT GO TO 11 1053 CONTINUE C ROUTINE TO PLOT A POINT GO TO 11 C C C CHOOSE ROUTINE FOR SPECIFIC LINE C 2000 GOTO (2100,2200) ,KSN C C C ROUTINE FOR LINE SEGMENT DEFINED BY TWO POINTS C 2100 GO TO (2110, 2120,2130), LT 2110 N=i GO TO 2 2120 CALL STACKKMACC2) CALL STACKKMACCl) N=l GO TO 2 2130 MACC3=MACC1 MACC4=MACC2 MACC1=IP0P(1) MACC2=IP0P(1) GO TO 2050 C C C LINE SEGMENT DEFINED BY POINT AND TRANSLATICN C 2200 GO TO (2210, 2220, 2230, 2240), LT 2210 N=l GO TO 2 70 2220 2221 2230 2231 2240 CALL CALL CALL IF(NP MACCl LT=LT CALL CALL IF(NP MACCl LT=LT N=IP0 MACC2 MACCl G0 TO ST ST IV AR = N + 1 ST IV AR = N + 1 P( = M = N 2 ACKKMACC2) ACKKMACCl) AL(NSKLT,NPAR) ) 5,99,2221 PAR-600CC ACKKMACCl) AL(NSI+LT,NPAR) ) 5,99,2231 PAR-600CC iKIPCPt 1) ACCKIPCP(l) ACC2 050 C c c c DRAW A LINE SEGMENT 2050 IF(ID-l) 3,2051, 3 2051 IF(LPLTSW) 2052,2052,2053 2052 CONTINUE ROUTINE TO DISPLAY A LINE SEGMENT GO TO 11 2053 CONTINUE ; ROUTINE TO PLOT A LINE SEGMENT GG TO 11 C c c c 4 c c c c c c c c CHOOSE ROUTINE FOR SPECIFIC CIRCLE CO GOTO (4100,420C,4300),KSN ROUTINE FOR CIRCLE DEFINED BY PT ANO DIST 4100 GO TO (4110, 4120, 4130), LT 4110 N=l GO TO 2 4120 CALL STACKKMACC2) CALL STACKKMACCl) CALL ICIST(NSKLT,NPAR) IF(NPAR) 4121,99,4 4121 MACC1=-NPAR=60CC0 LT=LT^1 4130 MACC3=MACC1 MACCi=IPOP( 1) MACC2=IP0P( 1) GO TO 4050 ROUTINE FOR CIRCLE DEFINED BY CENTER ANO PT ON CIRCUM 71 42C0 GO TO (4210, 422C, 4230), LT 4210 N = l GO TO 2 4220 CALL STACKl (MACC2) CALL STACKKKACCi) N=l GO TO 2 4230 X1=IP0P(1) Y1=IP0P(1) X2=MACC1 Y2=MACC2 MACC3=SQRT((X2~X1)*CX2-X1)+«Y2-Y1)*(Y2-Y1)) IF(MACC3-20) 99,99,4231 4231 MACC1=X1 MACC2=Y1 GO TO 4050 C C C ROUTINE FOR CIRCLE OEFINED BY 3 POINTS ON CIRCUM C 4300 GO TO (4310, 432C, 4330, 4340), LT 4310 N=l GO TO 2 4320 CALL STACKl (MACC2) CALL STACKKMACCl) N=l GO TO 2 4330 CALL STACKKMACC2) CALL STACKKMACCl) N=l GO TO 2 4340 X3=MACC1 Y3=MACC2 X2=IP0P(1) Y2=IPCP(1) X1=IP0P(1) Y1=IP0P(1) C1=-(X1*X1+YI*Y1) C2=-(X2*X2+Y2*Y2) C3=-(X3*X3+Y3*Y3) DET=X1*(Y2-Y3)-Y1*(X2-X3)+X2*Y3-X3*Y2 IF(ABSF(DET)-5 o )0G99, 4351, 4351 4351 D=(C1*(Y2-Y3)-Y1*(C2-C3)+C2*Y3-C3*Y2)/DET E=(X1*(C2-C3)-C1*(X2-X3)*X2*C3-X3*C2)/DET F=X1*(Y2*C3-C2*Y3)-Y1*(X2*C3-C2*X3)+C1*(X2*Y3-X3*Y2) F=F/D£T MACCl=(-D/2o) MACC2=(-E/2.) MACC3=*5*SGRTF(C*D+E*E-4.*F) GO TO 4050 C C C DRAW CIRCLE 72 C 4050 IF(ID-l)3,405i,3 4051 IF(LPLTSW)4052, 4052, 4053 4052 CONTINUE C ROUTINE TC DISPLAY A CIRCLE GO TO 11 4053 CONTINUE C ROUTINE TO PLOT A CIRCLE GO TO 11 C C C CHOOSE RCUTINE FOR SPECIFIC ARC C 5000 GOTO( 5100, 5200,5 300, 5400, 55CC, 5600 ) , KSN C C C ROUTINE FOR ARC OEFINEO BY CIRCLE AND TWO ANGLES C 5100 GO TO (5110,5120, 5130, 5140),LT 5110 N=4 GO TO 2 5120 CALL STACKKMACC3) CALL STACKKMACC2) CALL STACKKMACCl) N=7 GO TQ 2 5130 CALL STACKKMACCl) N=7 GO TO 2 5140 IF(ABSF(MACC1)=3142) 5141*5141,5142 5142 MACCl=KACCl-SIGNFtMACCl,3142) 5141 MACC5=MACC1 MACC1=IP0P(1) IF(A8SF(KACC1)-3142) 5143,5143,5144 5144 MACC1=MACC1-SIGNF(MACC 1,3142) 5143 MACC4=MACC1 MACC1=IP0P(1I MACC2=IP0P(1) MACC3=IP0P«1) GO TO 5050 C C C ROUTINE FOR ARC DEFINED BY A CIRCLE AND TWO POINTS C 5200 GO TO (5210, 522C P 5230, 5240), LT 5210 N=4 GO TO 2 5220 CALL STACKl ( KACC3) CALL STACKKMACC2) CALL STACKKHACCl) N = l GO TO 2 5230 CALL STACKKNACC2) 73 CALL STACKHMACCl) N=l GO TO 2 5240 X3=MACC2 Y3=MACC1 X2=IP0PU> Y2=IPOP( l) Xi=IPCP(l) Yl=IPOP(l) PI=3141o59 DY=Y2-Y1 DX=X2-X1 IF(OX) 5242,5241,5242 5241 IF(DY) 5243,99,5244 5243 ALP=PI/2. GO TO 5245 5244 ALP=-PI/2o GO TO 5245 5242 ALP=ATANF(DY/DX)*1000. IFCDX) 5245,5245,5246 5246 ALP=ALP-SIGNFCPI,ALP) 5245 MACC4=ALP DY=Y1-Y3 DX=X1-X3 IFCDX) 5262,5261,5262 5261 IF(DY) 5263,99,5264 5263 ALP=PI/2. GQ TO 5265 5264 ALP=-PI/2. GO TO 5265 5262 ALP=ATANF(DY/DXJ*1000. IF(DX) 5265,5265,5266 5266 ALP=ALP-SIGNF«PI,ALP) 5265 MACC5=ALP GO TO 5050 C C C ROUTINE FOR ARC DETER BY CIRCLE, PT , ANGLE C 5300 GO TO (5310, 5320, 533C5340) „LT 5310 N=4 GO TO 2 5320 CALL STACKl (MACC3) CALL STACKKKACC2) CALL STACKl(MACCl) N=l GO TQ 2 5330 CALL STACKl (MACC2) CALL STACKHMACCl) N=7 GO TO 2 5340 A2=MACC1 X1=IPCP(1) TU Y1=IP0P( 1) X2=IP0P(1) Y2=IP0P(1) R=IP0P(1) 5350 PI=3141.59 0Y=Y2-Y1 0X=X2-X1 IF(DX) 5342,5341,5342 5341 IF(OY) 5343,99,5344 5343 ALP=PI/2. GO TO 5345 5344 ALP=-PI/2. GO TO 5345 5342 ALP=ATANF(DY/DX)*1000„ IF(DX) 5345,5345,5346 5346 ALP=ALP-SIGNF 5542,5542,99 5542 T=0/«2.*R) A2=200C.*ATANF« T/SQRTF f l.-T*T) ) GO TO 5351 C C C ROUTINE FOR ARC DETER BY CIRCLE AND TWO DIST C 5600 GO TO «5610*5620, 5630, 5640), LT 5610 N=4 GO TO 2 5620 CALL STACKl ( KACC3) CALL STACKKMACC2) CALL STACKKMACCl) CALL IDIST«NSI+LT*NPAR) IF«NPAR) 5621,99,4 5621 MACC1=-NPAR-60CC0 LT=LT+1 5630 CALL STACKl l KACCl ) CALL ICIST«NSI+LT,NPAR) IF(NPAB) 5631,99,4 5631 HACC1=-NPAR=60CC0 LT=LT+1 5640 D2=MACC1 76 D1 = IP0PU) X1=IP0P( 1) Y1=IP0P(1) ft =IP0P(1) 5641 IF(D1-2.*R) 5642,5642,99 5642 T=D1/(2.*R) A1=200C.*ATANF(T/SQRTF«1.-T*T)) IF(D2-2.*R) 5643,5643,99 5643 T=D2/(2.*R) A2=2000.*ATANF(T/SQRTF(i.-T*T)) MACC4=A1 MACC5=A2 MACC1=X1 MACC2=X2 MACC3=R GO TO 5050 C C C DRAW AN ARC C 5050 IF(ID-l) 3,5051,3 5051 IF(LPLTSW)5052, 5052, 5053 5052 CONTINUE C ROUTINE TO OISPLAY ARC GO TO 11 5C53 CONTINUE C ROUTINE TO PLCT ARC GO TO 11 C C C CHOOSE RCUTINE FOR SPECIFIC DISTANCE C 6C00 GOTO (6100, 6200,6300, 6400, 6500,6600, 6700), KSN C C C RGUTINE FOR DISTANCE DEFINEC BY TWO PTS C 6100 GOTO (6110, 6120, 6130), LT 6110 N=l GO TO 0002 6120 CALL STACKl(PACCl) CALL STACK1(*ACC2) N=l GO TO 0002 6130 X2=MACC1 Y2=MACC2 Y1=IP0P(1) X1=IP0P(1) MACC1=SQRTF((X2-X1)*(X2-X1)*(Y2-Y1)*(Y2-Y1>) GO TO 6050 C C C ROUTINE FOR HORZ OIST BETWEEN TWO PTS 77 C 62C0 GOTO {6210„622C,6230),LT 6210 N=l GO TO 2 6220 CALL STACMMACCl) N=l GO TO 2 6230 MACC1=ABSFCMACC1-IP0P{1)) GO TO 6050 C C C ROUTINE FOR VERT DIST 8ETWEEN TWO PTS C 6300 GOTO {6310,632C 6330),LT 6310 N=l GO TO 2 6320 CALL STACKCMACC2) N=l GO TO 2 6330 MACC1= ABSFCKACC2-IP0PC 1)) GO TG 6050 C C C ROUTINE FOR CIST DEFINED 8Y PT AND LINE C 64C0 GOTO {6410 P 642C6430) 8 LT 6410 N=l GO TO 2 6420 CALL STACKCMACCl) CALL STACKCMACC2) N=2 GO TO 2 6430 X1=MACC1 Y1=MACC2 X2=MACC3 Y2=MACC4 Y3=IP0PC1) X3=IP0P«1) A=Y1-Y2 8=X2-X1 C=CY2-Y1)*X1+CX1"X2)*Y1 IF{ABSFCB)=5o)6433 »6433,6434 6433 MACC1=ABSFCX1-X3) GO TO 6050 6434 IFCBI6431, 6432, 6432 6432 MACC1=ABSFC { A*X3+B*Y3*C)/SGRT ( A*A+B*B ) ) GG TO 6050 6431 TX=X1 TY=Y1 X1=X2 Y1=Y2 X2 = TX Y2=TY 78 GOTO 6432 C C C ROUTINE FOR DISTANCE DEFINEC BY CIRCLE C 6500 GO TO (6510*6520, LT 6510 N=4 GO TQ 2 6520 MACCl=MACC3 GO TO 6050 C C C ROUTINE FOR DIST — REAL NUKBER C 66C0 GO T0( 6610i662C) t LT 6610 CALL IVAL(NSI+LT,NPAR) IF(NPAR) 5,99,6611 6611 MACC1=NPAR-600CC LT=LT+l 6620 GO TO 6050 C C C ROUTINE FOR BINARY OPERATION ON TWO DISTANCES C 6700 GO TO (6710, 6720, 6730, 6740), LT 6710 CALL IDIST«NSI+LT,NPAR) IF(NPAR) 6711,99,4 6711 MACC1=-NPAR~60CC0 LT=LT+1 6720 CALL STACKi ( MACCl ) CALL IVAL(NSI*LT,NPAR) IF(NPAR) 5,99,6721 6721 MACC1=NPAR~6000C LT=LT+1 673C CALL STACKl ( MACCl ) CALL IDIST(NSI+LT,NPAR) IF(NPAR) 6731,99,4 6731 MACC1=-NPAR-60CC0 LT=LT+1 6740 N=IP0P(1)/10C0 A=IP0P(1) B=MACC1 G0TQ( 6741, 6742, 6 743, 6744, 6745, 6746, 6747 ),N 6741 MACC1=A+B GO TO 6050 6742 MACC1=A-B GO TO 6050 6743 MACC1=A*B GO TO 6050 6744 MACC1=A/B GO TQ 6050 6745 MACC1=A**B GO TO 6050 79 6746 MACC1=A*SQRT(ABSF(B) ) GO TO 6050 6747 MACC1=A*ABSF(B) GO TO 6050 C C C ORAW A OISTANCE C 6050 GO TO 3 C C C CHOOSE ROUTINE FOR DEGREES C 7000 GOTO(7100, 7200,7300), KSN C C C ROUTINE FOR DEGREES DETER BY TWO LINES C 7100 GO TO (7110, 712C, 7130), LT 7110 N=2 GO TO 2 7120 CALL STACKKMACC4) CALL STACKKMACC3) CALL STACKKMACC2) CALL STACKKMACCl) N=2 GO TO 2 7130 X3=MACC1 Y3=MACC2 X4=MACC3 Y4=MACC4 X1=IP0P(1) Y1=IP0P( 1) X2=IPGP(1) Y2=IP0P(1) 7141 IF(ABSF(X1-X2)=20o) 7143,7143,7144 7143 Al=3ol4159/2» GO TO 7142 7144 A1=ATANF((Y1=Y2)/(X1-X2) ) 7142 IF{ABSF(X3-X4)~20o) 7146,7146,7147 7146 A2=3,14159/2o GO TO 7148 7147 A2=ATANF( (Y3-Y4 }/(X3-X4)) 7148 MACC1=ABSF(A1-A2) GO TG 7050 C C C ROUTINE FOR DEGREES DETER BV 3 PTS C 72C0 GO TO (7210, 722C723C, 7240), LT 7210 N=l GO TG 2 7220 CALL STACKKMACC2) 80 CALL STACKKMACCl) N=l GO TO 2 7230 CALL STACKl (MACC2 ) CALL STACKKMACCi) N = l GO T0.2 7240 X3=MACC1 Y3=MACC2 X2=IP0P(1) Y2=IP0P( 1) Xi=IPOP(l) Y1=IP0P(1) 7241 X4=X3 Y4=Y3 X3=X2 Y3=Y2 GO TO 7141 C c C ANGLE CETERMINED 8Y A REAL NUM8ER C 7300 GO TO (7310,7320, LT 7310 CALL IVAL(NSI*LT,NPAR) IF(NPAR) 5*99,7311 7311 MACC1 = NPAR-=6C0GC LT=LT*1 7320 GO TO 7050 C C C ORAW AN ANGLE C 7050 GO TO 3 C END SU8R0UTINE ICHASE (M,K,NPAR) DIMENSION L(30C),LIN(27,2),LSTK100),LST2<40I DIMENSION NTL(1C0,2),L8LK(8C) COMMON LALLPT,NTLPT,NTL,LBLK,LSTl,LPTl,LPT2»LtLST2 COMMON A,B,C,O s S,T,LIN LL=K*1CC0 LU=LL-HCOO I=LPT2 J=L(M) 13 IF(J) 2,1,1 1 IF(J-3C000) 15,16,16 15 N=L( J) IF(K-8) 18,19,18 19 IF(N/lC00-6) 4,20,4 81 2 NPAR=-J RETURN 18 IF{ N -LL) 4,3,3 3 IF(LU- N ) 4,4,5 4 IFC N ) 6,7,7 6 NPAR==3 RETURN 7 IFCN-1000) 8,9,9 8 NPAR =-9 RETURN 9 IFCN-3000) 12,8,10 10 IFIN-4000) 8,11,11 11 IFCN-8C00) 12,8,8 12 NPAR =-N/10C0 RETURN 5 NPAR=J RETURN 2 IF(I) 8,8,14 14 J=LST2(I )-J J=L(J) 1 = 1-1 GO TO 13 16 IF(K-8) 21,5,17 21 IFIK-6) 17,20,17 17 NPAR=-8 RETURN ENO FUNCTICN IDENTY(J) IDENTIFIES TYPE OF WORD END SUBROUTINE ICIST ( M,NPAR ) CALL ICHASE C M,6,NPAR) IF(NPAR) 1,1,2 1 IF(NPAR+10) 2,3,3 3 NPAR=C 2 RETURN END FUNCTICN INTGER(J,N) CONVERTS WORD TC INTEGER VALUE END FUNCTICN IPOP(N) DIMENSIGN L(3CC),LIN(27,2),LST1(100),LST2(40) DIMENSION NTL(1C0,2),LBLK(8C) COMMON LALLPT,NTLPT,NTL,L8LK,LST1,LPT1 P LPT2,L,LST2 COMMQN A,B,C,D,S,T,LIN 82 IF(N-l) 20,20,21 20 IP0P=LST1(LPT1) LPT1=LPT1-1 RETURN 21 IP0P=LST2(LPT2) LPT2=LPT2-1 RETURN END SUBROUTINE IVAL(M,NPAR) CALL ICHASE(M,8,NPAR) IF(NPAR)1,1,2 1 IF(NPAR+10) 2,2,3 3 NPAR=0 2 RETURN END FUNCTICN LALLCC(N) DIMENSION L(300),LIN(27,2),LST1(100),LST2(40I DIMENSION NTL(1C0,2),L8LK(8C) COMMON LALLPT,NTLPT,NTL,LBLK,LST1,LPT1,LPT2,L,LST2 COMMON A,B,C,D,S,T,LIN IFCN-4) 1,1,2 1 N=4 2 IFJLALLPT+N-300) 3,3,4 3 LALLCC=LALLPT LALLPT=LALLPT+N RETURN 4 PRINT 5 5 F0RMAT(1H ,40HMAIN MEMORY ARRAY SIZE EXCEEDEO STOP 01 END FUNCTICN LSRCHN(N) DIMENSION L(3CC),LIN(27,2),LST1( 100 ) , LST2 (40 ) DIMENSION NTL(1C0,2),LBLK(8C) COMMCN LALLPT,NTLPT,NTL,LBLK,LST1,LPT1,LPT2,L,LST2 CCMMCN A,BsC,D,S,T,LIN IF(NTLPT) 1,1,2 LSRCHN=0 RETURN 00 3 I=1,NTLPT IF(N-NTL(I, 1)) 3,4,3 CONTINLE GO TO l LSRCHN=NTL(I,2) RETURN END 83 FUNCTICN LSRCHPCN) DIMENSION LC30C),LINC27,2),LST1C100),LST2C40) DIMENSICN NTLC1C0,2),LBLKC8C) COMMON LALLPT,NTLPT,NTL S L8LK,LST1 9 LPT1,LPT2 8 L,LST2 COMMON A,B C C,D,S,T,LIN IFCNTLPT) 1,1,2 LSRCHP=0 RETURN DO 3 I=1,NTLPT IFCN-NTLCI,2)) 3,4,3 CONTINUE GO TO 1 LSRCHP=NTL(I,1) RETURN END SUBROUTINE MAN C X,Y, XI, Yl) OIMENSICN LC300),LINC27,2),LST1C100) C LST2C40) OiMENSION NTLC1C0,2),L8LKC8C) COMMON LALLPT,NTLPT,NTL,L8LK,LST1,LPT1,LPT2,L,LST2 COMMON A,B,C,D,S,T,LIN Xi=S+A*X+B*Y Yi=T*C*X+D*Y RETURN END SUBROUTINE RCLNCK) DIMENSICN LC30C),LINC27,2),LST1C100),LST2C40) DIMENSION NTLC1C0,2) ,LBLKC8C) COMMON LALLPT,NTLPT,NTL,LBLK,LSTULPT1 C LPT2,L,LST2 COMMON A,B,C,D,S,T,LIN READ 90, LINClvl), LINC1,2), LINC2,i), LINC2,2), 1 CLINCI,1),I=3,9),LC 90 F0RMATCA4,1X,A6,1X»A6,2X,I1,7C1X,A6 ),iX,Il) IFCLC) 22,22,1 22 LINC10,1)=6H GO TO 2 1 READ 91, { LINCI,1),I=10,16),LC 91 F0RMATC22X,7CA6,1X),U) IFCLC) 23,23,3 23 LINC17,1)=6H GO TO 2 3 READ 91, C LINC I , l ), 1=17,23) ,LC IFCLC)24,24,4 24 LINC24,1)=6H GO TQ 2 4 READ 91, C LINC I , 1 ), 1=24,27) ,LC, LC, LC,LC IFCLC) 2,2,6 6 K = l RETURN 2 N=IDENTYILINC1,2)) 8U IF(N) 5,6,6 5 00 7 1=3,27 N=IDENTY(LINl 1,1) ) IF(N+1) 25,15,8 8 IF(N) 13,14,13 13 IF(N-l) 15,14,6 14 LC=INT€ER(LIN(I,1),N) LIN(I,l)=LC 15 LINU,2)=N 7 CGNTINUE 1=27 G0 TO 9 25 1=1-1 9 IF(LIN(2,2) ) 10,10,11 10 LIN(2,2) = 1-2 GO TO 12 11 LIN(7,i)=I-2 12 K=0 RETURN END SUBRGUTINE STACKKK) DIMENSION L(30C),LIN(27,2),LST1( 100 ) ,LST2<40 ) OIMENSION NTL(1C0,2),L8LK(8C) CGMMON LALLPT,NTLPT,NTL,LBLK,LSTi,LPTi,LPT2,L,LST2 COMMCN A,B,C,D,S,T,LIN LPT1=LPTI+1 IF(LPTl-lOO) 2,2,1 1 PRINT 10010 STGP 04 2 LST1(LPT1)=K RETURN 10010 FGRMATQH ,4CHSTACK 1 SIZE EXCEEDED END SUBRGUTINE STACK2IK) DIMENSION L(30C),LIN(27,2),LST1(100),LST2(40) DIMENSIGN NTL(1C0,2),LBLKI8C) COMMGN LALLPT,KTLPT,NTL,LBLK,LST1,LPT1,LPT2,L,LST2 COMMON A,B,C,D S S,T,LIN LPT2=LPT2+1 IF(LPT2-40) 2,2,1 1 PRINT 10011 STOP 05 2 LST2(LPT2)=K RETURN 10011 FORMATdH ,40HSTACK 2 SIZE EXCEEDED END 85 Notes : The numhers in the right hand margin refer to blocks on the block diagrams. The suhroutine IDENTY identifies a word in A6 format as : blank: -2; a name : -1; a number: 0; a parameter: 1. The suhroutine INTGER converts numbers and integers from A6 to I format. All communications with the user are given in the form of PRINT statements. Display and plot routines are necessary for each of the types of BCU's. 86 V. G.D.L. - 2 a) Introduction As progress on the first version of the language progressed it became very clear that the decision to partially assemble the language statements into the block form outlined was leading to a good deal of artificiality in the language implementation , and Handler commands , Particularly changing, adding and deleting were not ter- ribly easy (c.f. the Dummy statement), and hampering restrictions were placed on the user ( for example, names within a figure were globally, not locally, defined). The problem of garbage collection became important, as the deletion method employed left all structures in memory. Garbage col- lection was very difficult indeed in the GDL-1 system as the movement of anything required the changing of all pointers to the thing moved; as no record of references was intrinsic to the data structure scheme, it proved nearly impossible to locate these pointers. The trouble stemmed from the loss of information available once names were replaced by pointers. A pointer is location dependent , while a name is not. Hence, once the partial compilation had been com- pleted the structure became totally location dependent. To meet these drawbacks , a second form of the language was designed and implemented. It is more interpretive in nature and a call-by-name scheme is used throughout. 87 b) Basic Structures The "basic structure of GDL-2 is the line. Each line is generated by a single typed input line. Lines are stored as a file. There are three types of lines; figure (FL), subfigure (SL), and basic construction unit (BCUL) t A figure is defined as those SL and BCUL lines between a FL line indicating the figure and the FL line begin- ning the next figure. The format of each line is essentially that of the typed input line: A) Figure lines (FL): These have three words . The first is a name, the second a 0, the third a length indicator set = 3. These are used to indicate the beginning of new figures. The figure whose name is in word 1 of the FL is that set of SL and BCUL lines following that FL and preceding the next FL. A figure name table is kept giving pointers to each FL currently in the file. B) Subfigure lines (SL): These have n + 9 words where n is the number of parameters in a subfigure call within a figure. Such a line corresponds exactly to the PAM - block and the pointer in a fig- ure block to it in GDL-1. The words are: 1. name 2, -1 3. a length indicator = n + 9 U. the name of the subfigure to be drawn 5 = x o 6. y o 7. 88 9. through n + 8. n parameters , each a name, or value , or a parameter. n + 9. a length indicator = n + 9. C) Basic construction unit lines (BCUL): These correspond exactly to BCU "blocks in GDL-1. They have n + k words , where n is the number of other pieces of information required to define this basic (i.e., the number of pointers in the BCU in GDL-l). They are : 1 . name 2. k x 10000 + xyOO where k is 1 if the BL is to be drawn , and otherwise; x is the type digit, and y is the kind digit. 3. length indicator set = n + k. k. through n + 3. the n pieces of information defining the BCUL. n + k, length indicator set = n + k. c) Handler Commands and Effects GDL-2 has only two basic modes of operation. One is the FILE CREATION mode and the other is the PLOT mode . Initially, or after a plot has been made , control is im- mediately returned to the file creation mode ; this program is referred to as the "Handler". The file is created as a list of lines. Initially the file consists of only an End— Of-File (EOF) line. An arrow is set pointing above the top of the file, namely to the EOF - line initially. This arrow points between lines in the file at all times . 89 The following commands can be given to the handler; examples are given in Figure 23: 1. Figure: this sets up a figure line. The name given is entered in the name table and the line inserted below the arrow. The arrow is reset pointing below this line. 2. Subfig, Point, ...... Angle: these set up their corres- ponding type of line, as in the figure command„ 3. Locate: this command sets the arrow above: a) a figure line : the figure name given is looked up in the table, and the arrow set accordingly „ b) the first line in the file: the word FIRST calls this option. c) the EOF line: the word NEW calls the option. U. Skip: this skips the arrow over a number of lines, The options are: a) n > 0. This skips the arrow over n lines in a downward direction. The skip will only reach the end of the figure. If n lines have not been skipped when this happens, a message is given and the arrow set above the figure - line following or the EOF line» b) n < 0. This skips the arrow over n lines in an upward direction. The skip will only reach the figure line for the figure in which the arrow is before the command If n lines have not been skipped when the figure line is encountered a message is given and the arrow set above the figure line in question, c) n = 0, or blank. Default condition: n = 1, 5. Delete : This deletes a number of lines . The options are : Y< 1—4 6 11 13—18 21 23—28 30—35 37—41 44—49 51—56 LOCATE SQUARE SKIP 5 DELETE 2 SKIP - 1 Skips to line SQUAB Deletes lines SQUAB, and SQUBC Sets pointer above line SQUD LOCATE CELETE SQUARE Deletes all of SQUARE LOCATE SQUARE PRINT FIGURE PRINT 3 Prints all of SQUARE Prints lines SQUARE, SQUA and SQUB CISPLA SQUARE PLOT SQUARE 1 FINISH Figure 23. Some Examples of GDL-2 Handler Commands (cf. Figure 2 for Lines Defining Figure SQUARE) 91 a) n > 0. Deletes the n lines following the arrow. How- ever, if a figure line is encountered first, a message is given and no deleting is done. b) n = 0. Deletes a whole figure, The arrow must "be set above a figure line. If this is not the situation, a message is given and no deletion takes place. If it is on a figure line, the whole figure it begins is deleted. c) n is blank. Default condition : n = 1. Any delete command causing a figure line to be deleted also causes that figure name to be deleted from the name table. 6. Print: This causes portions of the file to be printed for inspection. The options are : a) ALL: Prints the complete file. b) FIGURE: Prints out a complete figure. The arrow must be set above a figure line. Otherwise, an error message is given and no printing is done. If the arrow is set correctly, the figure line and all the lines composing the figure are 'printed. c) n > 0. Prints out the n lines immediately following the arrow regardless of type^ However, if the EOF line is encountered before n lines have been printed, a message is given and printing is terminated. d) n = 0, or blank. Default condition: n = 1 All print commands leave the position of the arrow un- changed. 92 7» Display: This causes the mode to change to display mode* The figure given is displayed. 8, Plot: This causes the mode to change to plot mode. The figure given is plotted on the CalComp Plotter, 9. Finish: This calls the system monitor. The various Handler commands can be given in any order whatsoever* Errors in the usage of them cause error messages, some of which have been indicated in the discussion of the commands. d) Plotting, Displaying, and Representation in Fortran The techniques of plotting and displaying used in GDL-2 are almost identical to those used in GDL-1. The PLOT and DISPLAY commands, cause control to be transferred to the drawing program; the program is then considered to be in the PLOT or DISPLAY mode. The actions taken by the drawing program are the same for both the PLOT and DISPLAY commands ; the only difference is that when the des- cription of a line or circle segment has been determined and is to be drawn, a PLOT command calls x-y plotter subroutines , while a DISPLAY command calls CRT display subroutines. Initially, the drawing program sets up the x , y , 0, and E parameters in their vector format I 1 and I ) , forms a partial line of parameters for the figure to be drawn , stacking its location in LST2 - the parameter stack, and locates the FIGURE - line of that f i gure . Control is transferred to a routine which steps through each line in the figure to be drawn, checking the type-kind indicator 93 for over 10000. This routine, controls the calling of the correct routines to calculate the descriptions of each of the BCUL's which is to be drawn. The selection of the correct calculating routine is done on the basis of the type and kind of line encountered. This information is stored in each line as has been discussed. Control is then passed to the code for that type and kind of line. This code in turn will often have to call still further blocks of code to calculate the BCU's upon which it depends for its description. As in GDL-1, a push-down stack is used to allow arbitrarily deep nesting of BCU's. Suppose, for instance, that a BCUL defining a line segment by its end points is to be drawn r The type-kind in- dicator will then be 12100 = 10,000 ( as it is to be drawn) + 2100 (a line segment - 2 - of kind l). Control is transferred through a 'computed - GO - TO' statement to the block of code starting with statement number 2100. This code calls a subroutine, called ICHASE, to locate the BCUL represented by the name in word 1. If there is any trouble in locating this, or if the BCUL represented by word 1 does not represent a point an error return is given by ICHASEc This error return causes an error message to be given, the drawing program to be terminated, and the program to be returned to the FILE CREATION mode. ICHASE locates the desired BCUL by searching upward through the file until it is encountered, or until the FIGURE - line for the figure being drawn is encountered. This latter is an error condition. It should be noted that this procedure demands predefinition of all 9* BCU names used within a figure. If ICHASE is successful, the location of the current BCUL is stored in the stack, along with an indicator (called LT in FORTRAN) of which word in the current BCUL is being analyzed, in this case word 1, The locationof the new BCUL represented by word 1 as deter- mined by ICHASE becomes the current BCUL and LT becomes 1. This pro- cedure is called ' going down a stage'. The same procedure may be repeated in this new BCUL. At some point the program will be able to calculate the co-ordinates of a point. These will be stored in an accumulator (MACC n, where 1 <_ n '_ 5) and the program returns up a stage, Suppose that the point represented by word 1 in our example was represented by its co-ordinate, The code for this type and kind of BCUL would simply load the accumulator with these values, Control is then returned to the routine to ' go up a stage'. This routine obtains the old LT and location of the old BCUL. An- alyzing the type-kind indication in the BCUL the program again goes to the code for a 2100 - line . Now LT is updated, and the second word is examined. Before going down a stage for the second word, the values of the first are stacked from the accumulator. Then ICHASE is called on the second word and the processing continues , searching down as many stages as is necessary, stacking what needs to be saved. This can be thought of as doing a prefix scan on the tree in which each BCUL represents a node and each word used with a name a branch. Throughout this procedure an indicator (ID) is decremented by 1 each time the program goes down a stage, and augmented by 1 each 95 time it goes up a stage, It is initially set at 1 by the routine which steps through the figure to be drawn, When it again becomes 1, the program knows that it should draw the BCU represented by the cur- rent BCUL„ Instead of returning values to the accumulator, lt calls the plotter or CRT routines , usmg the values calculated, as manipu- lated according to the current values of A, B, C, D, S, and T. After drawing, control is returned to the routine which steps through the figure, This searches for the next BCUL to be calculated and drawn, If this routine encounters a line which is a SUBFIG - line, it recognizes the necessity to ' go down a level'. It calls a routine to do this. This routine stores the current values of A, B, C, D, S, and T, calculates new values for A, B, C, D, S, T based on the old values and the values of x , y , 0, E in this BCUL, stacks in the parameter stack the location of the parameter list of this BCUL (word 6), locates the subfigure to be drawn, stacks the location of this BCUL for later return, and returns control of the routme which steps through this new figure, The parameter stack allows ICHASE to search back up through various levels of figure to locate any parameter encountered while calculating BCU'So When the routine which steps through a figure encounters the FIGURE - line of the following figure, it recognizes the need to 1 return up a level' . The old values of A, B, C, D, S, T are removed from the stack, as is the location of the BCUL which caused the pro- gram to go down the level; control is returned to the stepping pro- gram at the BCUL following this one, A check is made on whether the 96 figure just finished is the main figure "being drawn. If this is the case, control is returned to the Handler and the program reverts to FILE CREATION mode. e) Block Diagrams !• / initialize 91 A h. read next input line identify key word DISPLAY, PL0T PRINT FIGURE SUBFIG P0INT, LINE CIRCLE, ARC Dia'l', ANGLE L0CATE SKIP DELETE FINISH \? ■*1 c <€> 7~w 9B set plot switch to 1 for PL0T for DISPLA /enter dra ing subpro with arrow where it is for details and flow see text \ set arrow at top of file 5> 11, 12, 13, same positiofi of arrow I determine &\ check mode \ of printing ) ALL, FIGUREA reform line below arrow into input format display this line to] user move arrow down one line Ik. restore arrow position ^ 99 15. 16. 17. 18, 19. check name , not in name\ table / add name to name ta"ble 1 set up figure line below arrow move arrow below figure line W set type-kind- draw indicatojr equal -1 V 20. w 21. 22 23. 2U. set and check type- kind-draw ii dicator app/opriately set up BCU or SUBFIG line below arrow move arrow below this line W determine mode of locate set arrow accordingly A 25. 26 30. 27. skip arrow down one line mode 'of delete 31. 32. 1° /more\ T S deleting? J>- ^YES skip arrow down one line N0 28, 29. skip arrow up one line 33, 3* if no errors delete, and set arrow as "before A skip arrow down one line 101 f ) Program Listing Refer to the notes at the end of Section IV-f, C PROGRAM 6DL-2 C C C HANDLER C C DIMENSIGN L C 100C ) ,L IN C 29 ), LST 1 C 200 I ,LST2C 103, NTL 150,2) COMMON L,L1N S LST1«LST2,NTL*LPT1,LPT2,LAL0PT,NTLPT CCMMGN AfBvCpDsSfT C C INITIALIZATIGN. C NTLPT=0 1 LALOPT=22 PR INT 1 1 FORMATCIHI) LC22)=0 LA=22 C C READ THE NEXT LINE C 9200 READ 9201 , C LINC I ) , 1=1, 11 ) ,LC 2 9201 F0RMATCA4 S 2C1X,A6),2X,I1,7C1X,A6),1X,I1) IFCLC) 9202,9202,9203 9202 LINC12)=6H GO TO 9210 9203 READ 9204, | L INt I ) , 1=12, 18 ) ,LC 9204 F0RHATC22X,7CA6,1X),I1) IFCLC) 9205, 92G5, 9206 9205 LINC19)=6H GO TO 9210 9206 REAO 9204, C L INC I ), 1 = 19,25 ) ,LC IFCLC) 9207,9207,9208 9207 LINC26)=6H GO TO 9210 102 9208 READ 9209,« L IN( I ) , 1=26, 2<5 ) , LC 9209 F0RMAT«22X S 4«A6 9 1X),21X,I1) IF(LC) 9210,9210,9226 9226 PRINT 10015 GO TO 9200 C C TESTS C c 9210 IFCLINC3J-6HFINISH) 9211.9250,9211 3 9211 IF(LIN(3)-6HCISPLA) 9212,9260,9212 9212 IFCLIN«3)-6HPLCT ) 9213,9270.9213 9213 IF(LIN(!3)-6HPRINT ) 9214, 9260,9214 9214 IF(LIN«3)-6HFIGURE) 9215,9330,9215 9215 IFCLINC3)-6HPGINT ) 9216,9350,9216 9216 IFCLINC3)-6HLINE ) 9217,9360,9217 9217 IF(LIN(3)-6HCIRCLE) 9218,9370,9218 9218 IFCLINC3)-6HARC ) 9219,9380.9219 9219 IFCLINC3J-6HDIST ) 9220,9390,9220 9220 IFCLINC3)-6HANGLE ) 9221 ,9400,9221 9221 IFCLIN(3)-6HSU8FIG) 9222.9410,9222 9222 IFJLINC3)-6HL0CATE) 9223.9420,9223 9223 IF(LIN!3)-6HSKIP 5 9224,9430,9224 9224 IFCLIN«3)-6HDELETE) 9225,9450,9225 9225 PRINT 10016 GO TO 9200 C C FINISH CRDER C 9250 STOP 10 4 C C DISPLAY CCMMAND C 9260 LPLTSK=0 5 GO TG 9000 6 C Io£. GO TC PLOTTING SUEPROGRAM 9999 LA=22 7 GO TO 9200 C C PLCT COMMAND C 9270 LPLTSW=1 5 GO TO 9000 6 C C PRINT COMMAND C 9280 NSI=LA 8 IF«LINJ5)~6HALL ) 9281,9269,9281 9 9281 IFILIN(5)-6HFIGURE) 9282,9266,9282 9282 K=IDENTY(LIN«5) ) IF(K) 9300,9284,9283 9300 IFIK+2) 9283,9299,9283 9283 PRINT 10017 103 G0 TO 9219 9284 N=XNTGER(LlN(5KK)/100Q IF(N) 9283*9299,9285 9299 N=l 9285 LS=3 GO TO 9290 9286 IFCLILA)) 9287,9288,9287 9287 PRINT 10018 GG TO 9319 9288 LS=2 GO TO 9290 9289 LA=22 LS=1 9290 IFCLA-LALOPT) 9291,9316,9316 10 9291 IFCL(LA)) 9292,9293,9295 9292 LIN(3)=6HSUBFIG 11 9294 LIN(1)=6H KPSW=0 GO TO 9307 9293 LIN(3)=6HFIGLRE GO TO 9294 9295 K=L(LA)/1000G KPSW=1 IF(K) 9296,9296,9297 9297 LIN(1)=6HDRAW GO TO 9298 9296 LIN(1)=6H 9298 H=L(LA)-K*1Q00C K=M/lGGO M=(H-K*1000)/1CC LIN(4)=M GO TO (9301*9302, 9319, 9303*9304, 9305, 9306), K 9301 LIN(3)=6HP0INT GO TO 9307 9302 LIN(3)=6HLINE GO TO 9307 9303 LINC3)=6HCIRCLE GO TO 9307 9304 LIN(3)=6HARC 50 TO 9307 9305 LIN(3)=6H0IST GO TO 9307 9306 LIN(3)=6HANGLE 9307 LIN(2)=L(LA-1) K=L(LA+l)-4 00 9308 1=1,25 IF(I-K) 9310,9310,9309 9309 LINC I+4)=6H GO TO 9311 9310 LB=LA+I+1 9308 LIN(I*4)=L(L8) 1=25 9311 IF(KPSW) 932C, 9320,9321 10U 9320 PRINT 9322, ( L IN ( J ) , J = l, 3) , ( L IN( J + 4 ) , J=l , I) 12 9322 FORMATUH , A4, 1 X,2 ( A6, IX ) ,3X , 7( A6, IX ) / ( 23X, 7( A6, IX) ) ) GO TO 9 313 9321 PRINT 9312, ( L IN ( J ) , J= 1, 3) ,L IN( 4 ) , ( LIN( J+4) , J=l, I ) 9312 FORMATdH , A4 , IX ,2 ( A6, IX ) , 12 , IX, 7( A6, IX ) / 1 (23X,7(A6 v lXni 9313 LA=LA+L(LA+1) 13 GO TO (9290,9314, 9315), LS 9314 IF(L(LA)) 9290,9319,9290 9315 N=N-1 IF(N) 9290,9319,9290 10 9316 GO T0(9319,9317,9318),LS 9317 PRINT 10019 GO TO 9319 9318 PRINT 10020 14 9319 LA=NSI GO TO 9200 C C FIGURE CGMMAND C 9330 N=IDENTY(LIN(2)) 15 IFIN+1) 9331,9332,9331 9331 PRINT 10021 GO TO 9200 9332 N=LSRCHN(LIN(2) ) IF(N) 9334,9334,9333 9333 PRINT 10022 GQ TO 9200 9334 N=LALCCT(LA,3) 17 IF(N> 9335,9335,9336 9335 PRINT 10023 GO TO 9200 9336 CALL NAMADD (L IN (2 ) ,LA) 16 L(LA-l)=LIN(2) 17 L(LA)=0 L(LA+1)=3 LA=LA+3 18 GO TO 9200 C C COMMON SET UP RCUTINE FOR B.CU. LINES C 9340 IF(LIN(4)-LC) 9348,9348,9349 20 9348 IF(LIN(4)) 9349,9349,9339 9349 PRINT 10024 GO TO 9200 9339 N=K*1CC0+LIN(4»*100 IF(LIN(1)-6H0RAW ) 9341,9342,9341 9342 N=N+10C00 9341 DO 9343 1=5,29 21 M = IDENTY(LINU ) ) IF(M+2) 9343,9345,9343 9343 CONTINUE 1 = 30 105 9345 K1=I-1 M=LAL0CT(LA,K1) IF(M) 9351,9351,9352 9351 PRINT 10023 G0 TO 9200 9352 L(LA-l)=LIN(2) L(LA)=N L(LA+l)=Ki LB=LA+Kl-2 L(LB)=K1 00 9347 1=5, Kl LB=LA+I-3 9347 L(LB)=LIN(I ) LA=LA+K1 22 GO TO 9200 C C POINT CQMMAND C 9350 K=l 20 LC=4 GO TO 9340 C C LINE CGMMAND C 9360 K=2 20 LC=2 GO TO 9340 C C CIRCLE COMMAND C 9370 K=4 20 LC=3 GO TO 9340 C C ARC COMMANC C 9380 K=5 20 LC=6 GO TO 9 340 C C DISTANCE CCMMAND C 9390 K=6 20 LC=7 GO TO 9340 C C DEGREE COMMAND C 9400 K=7 20 LC=3 GO TO 9340 C C SUBFIGURE COMMANC ] 06 c 9410 N=-l 19 G0 TO 9341 C C LOCATE COWAND C 9420 IF(LIN(5)-6HFIRST ) 9421,9422,9421 23 9421 1F(LIN(5)-6HNEW ) 9423,9424,9423 9423 N=IDENTY(LIN(5) ) IF(N+1) 9425,9426,9425 9425 PRINT 10025 GO TO 9200 9426 N=LSRCFN(LIN(5) ) 24 IFCN) 9427,9427,9428 9427 PRINT 10026 GO TO 9200 9428 LA=N GO TO 92C0 9422 LA=22 GC TC 9200 9424 LA=LALCPT GO TO 9200 C C SKIP CGtfMANO C 9430 N=I0ENTY(LIN(5) ) IF(N) 9442,9443,9444 9442 IF(N+2) 9444,9432,9444 9444 PRINT 10036 GO TO 9200 9443 N=INTGER(LIN(5),N)/1C00 IF(N) 9431,9432,9433 25 9432 N=l 9433 IF(LA-LALCPT) 9434,9435,9435 26 9435 PRINT 10027 GO TO 9200 9434 LA=L(LA+1)+LA 27 N = N-1 IF(N) 9436,9200,9436 26 9436 IF(LCLA)) 9433,9437,9433 9437 PRINT 10028 GO TG 9200 9431 IF(LA-22) 9438,9438,9439 28 9438 PRINT 10029 GO TG 9200 9439 IF(L(LA)) 9440,9441,9440 9441 PRINT 10030 GO TO 9200 9440 LA=LA-L(LA-2) 29 N=N+1 28 IF(N) 9431,9200,9431 C C DELETE CCFNAND 107 9450 9462 9463 9456 9457 9451 9452 9454 9455 9459 9458 9453 9461 9464 9460 C c c c 10GG1 LS=LA N=I0ENTY(LIN(5) ) IF(N) 9462,9457,9456 IF(N+2) 9456,9463,9456 N=l GC TO 9453 PRINT 10033 GO TO 9200 N=INTGER(LIN(5),N)/1000 LC=0 IFtMl 9451,9452,9453 PRINT 10031 GG TG 9200 IFCL(LA)) 9454,9455,9454 PRINT 10032 GO TG 9200 IF(LA-LALGPT) 9458,9459,9456 PRINT 10034 GO TG 9200 LS=LS+L(LS+1) LC=LC+L(LS-2) IF(LCLS)) 9460,9458,9460 LS=LS+L(LS+1) LC=LC+L(LS=2> N=N-1 IF(N) 9461,9460,9461 IF(L(LS)) 9453,9464,9453 PRINT 10035 GG TO 9200 N=LALOCT(LS,LC) GO TO 9200 30 31 32 31 34 35 33 HflNDLER ERRCR MESSAGES i FCRMATUH 1CCC2 FORKATUH 1 10003 FORMATUH 1 1CCC4 FGRMAT( 1H 1 10005 FGRMATUH 1 10006 FORMATUH 1 10015 10016 10017 10C18 FGRMATUH FGRMATUH FGRMATUH FORMAT( 1H ,40HFIGURE NAHE IN ,2CHGT A NAME ,4CHFIGURE NAME IN ,20HCI IN NAME TAE ,40HNCN-NUM£RIC MA ,20HT OR DISPLAY C ,2CHSETUP ERROR IN ,11H CF FIGURE ,A6 ,40HN0N-NUMERIC MA ,2CHFIG LINE ,40HNCN-NUMERIC PA ,20H COMMAND ,40HMCRE THAN FOUR ,4CHILLEGAL KEY WO ,40HILLEGAL SYNTAX ,40HARROW NOT ON F ,20H CC^MAND DISPLAY CR PLOT CCMMANC N ) DISPLAY CR PLOT CGMMAND H LE ) NIPULATION CGNSTANT IN PLO CMMAND) WCRD ,14,10H OF LINE , A6 ) NIPULATION CONSTANT IN SUB I RAMETER IN DISPLAY OR PLOT ) CARDS IN INPUT LINE ) RD IN INPUT LINE ) IN PRINT CCMMAND ) IGURE LINE IN PRINT FIGURE ) 108 1CC19 FORMATUH ON EOF LINE IN PRINT FIGURE CC**AN 10020 1CC21 10C22 10023 10024 10C25 1CC26 10027 10028 i FORMATUH FCRMATUH FORMATUH FGRMATUH FGRMATUH FORMATf 1H FORMATUH FQRMATUH FGRMATUH 4CH£RK0W i IHOJ ,4CHREACHED EOF LINE B „4CHN4ME WORD IN FIGUR v4CHN/SME IN FIGURE LIN 8 40HMMN MEMCRY ARRAY C 40HINVALID KIND NUMBE ,4CHNAME WORD IN LOCAT C 40HN£ME IN LOCATE COM „20HFIGURE NAME »40HECF ENCOUNTERED BE ,4CHFXGURE LINE EKCOUN , 6HKIPPED) EFORE N LINES PRINTED E LINE NOT A NAKE E ALREACY USED SIZE EXCEEDED R IN BoC.Uo LINE E COMMAND NOT A NAME MAND NCT DEFINED AS A ) FORE N LINES SKIPPED ) TERED BEFGRE N LINES S 10C29 FORMATUH 1 10C30 FORMATCIH 1 10031 10032 i 10033 10034 10035 j 10036 C C c c c r FQRMATUH FORMATUH FQRMATC 1H FGRMATUH FGRMATUH FORMATUH PLOTTER P 40HFIRST LINE t 6HKIPPED) „40HFIGURE LINE - 7HSKIPPED) ,40HCGUNT WORD NEGATIV p40HARR0W NOT ON FIGUR , 4HMAND) »40HCCUNT WORQ INVALIO 9 40HARR0W CN EOF LINE S 4CHFIGURE LINE OCCURS 9 2CHIN DELETING ,40HCCUNT WORD INVALID ENCOUNTERED BEFORE -N LINES S ENCOUNTERED BEFORE -N LINES E IN DELETE COMMAND ) E LINE IN DELETE CCM IN DELETE COMMAND ) IN DELETE COMMAND ) IN LESS THAN N LINES ) IN SKIP COMMAND ) C C PLCTTER PRGGRAM IN X TX AL IZATION* 9000 K = G LPT1=C LPT2=0 DO 9015 1=1,20 IFCK& 9016*9017 C 9C16 9C16 LU)=6H GG TG 9015 9017 N=IGENTYCLINU+9) ) IFCN) 9018,9012^9014 9018 IFCN4-2)9014, 9013, 9014 9012 LU) = LINC 1*9) GG TO 9015 9013 9014 9015 K-l GO TO PRINT GO TO 9016 10006 9999 CONTINLE CALL STACK2C0) DO 9005 1=6,9 N=IDENTYCLINU 109 IF(N) 9006, 9C07, 9006 9007 LIN(I)=INTGER(LIN(I),N) 9005 CONTINUE GO TO 9008 9006 PRINT 10003 GO TO 9999 9008 A=1.0 8=0.0 C=0.0 0=1.0 S=Q.O T=0.0 C C CALCULATE NEW A,B,C,D,S,Te FIND NEW NSI. C 9010 X=LIN(8) X=X/(1C00*57. 29578) X1=C0S(X) X2=SIN(X) X3=LIN(9) X3=X3/10C0. Y1=LIN(6) Yi=Yl/1000. Y2=LIN(7) Y2=Y2/1000. S=S+A*Y1+B*Y2 T=T+C*Y1+D*Y2 Y3=X3*(A*X1+B*X2) B=X3*(-A*X2+B*X1) A=Y3 Y3=X3*(C*X1+D*X2) D=X3*(-C*X2+D*X1) C=Y3 N=IDENTY(LIN(5)) IF(N+1) 9002,9001,9002 9002 PRINT 10001 GO TO 9999 9001 N=LSRCHN(LIN(5)) IF(N) 9003,9003 9004 9003 PRINT 10002 GO TO 9999 9004 NSI=N GO TO 9020 C C PLCT A FIGURE C 9020 NSI=L(NSI+I)+NSI IF(L(NSI)) 9050,9060,9021 9021 IF(L(NSI )-10000) 9020,9020,9022 9022 10=1 LT=1 C computod cro to selection of program 9023 N=L(NSI )/100C0 110 N=L(NSI)-N*1C0CC NUM=N/10C0 KSN=(N-NUM*1C0C)/100 GQ T0 (1000, 200C, 3000,4000, 5000, 6000, 7000), NUM 3000 PRINT 130Ġ0 13CC0 FGRMAKIH ,2CHROUTINE NUMBER ERROR ) GO TO 9200 C C GO DOWN A STAGE C 9C3G K=IGETCNSI,LT,N) IF(K) 9990,9990, 9C31 9C31 CALL STACKKLT) CALL STACKKNSI) 10=10-1 LT=1 NSI=K GG TO 9023 C C GO UP A STAGEo C 9C4G 10=10*1 NS^=IPCP(1) LT=IPOPQ)+l GO TO 9023 C C GO GGWN A LEVELo C 9C50 K=A*1CC0. CALL STACKKK) K=B*1CC0. CALL STACKKK) K=C*1C00. CALL STACKKK) K=D*10C0 o CALL STACKKK) K=S*10C0o CALL STACKKK) K=T*10CC. CALL STACKKK) CALL STACKKNSI) CALL STACK2JNSI*5) DO 9051 1 = 1,4 K=NSI*I*2 N=IDENTY(L«K) ) IF(N) 9052,9C51 C 9052 9052 PRINT 10005 GG TG 9999 9C51 LINU*5)=INTGER«L(K),N) LIN(5)=L(NSK2) GC TC 9010 C C GC UP A LEVEL. 111 c 9060 N=IP0P(2) IF(N) 9062,9061,9062 9061 GG TO 9999 C RECGPY ANO EXIT FROM PLGTTER 9062 NSI=IP0P(1) T=IPQP(1) T=T/10C0* S=IP0P(1) S=S/1000. D=IP0P(1) 0=0/1000» C=IP0P(1) C=C/10C0. B=IP0P(1) B=B/1GCG. A=IP0P(1) A=A/1000. GO TO 9020 C C STAGE ERRGR C 9990 LX=LCNSI-1) 9993 IFCL(NSI)) 9991,9992,9991 9991 NSI=NSI-L(NSI-2) GO TO 9993 9992 LY=LCNSI-1) PRINT 10004, LT,LX,LY GO TO 9999 99 GO TO 9990 C C C C B.C.Uo ANALYZINC- ROUTINES C C C CHOOSE ROUTINE FOR SPECIFIC POINT C 1000 GOTO (1100,1200, 1300, 1400), KSN C C C ROUTINE FOR POINT DEFINEO BY THO COORDINATES C 1100 GO TO C 1110,1120, 1130), LT 1110 N=8 K=IGET(NSI 8 LT»N) IFCK) 1111,9990,9031 1111 MACC1=N LT=LT*1 N=8 1120 CALL STACKKMACCl) N=8 K=IGET(NSI,LT,N) 112 IF(K) 1121,9990,9031 1121 MACCi=N LT=LT+1 1130 MACC2=fACCl MACC1=IP0P(1) G0 TO 1050 C C C RQUTINE FOR POINT DEFINEC 8Y INTERSECTIGN OF TWG LINES C 1200 GG TG (1210,1220, 1230), LT 1210 N = l GO TO 9030 1220 CALL STACKKMACC2) CALL STACKKPACCl) N = l GO TO 9030 1230 X2=MACC1 Y2=MACC2 X1=IPGP(1) Y1=IPGP(1) DX1=X2-XI 0X2=X4-X3 IF(OXl) 1238,1224,1238 1238 IF(DX2) 1231*1236,1231 1231 XM1=(Y2-Y1)/DX1 XM2=(Y4-Y3)/DX2 DM=XM1-XM2 IF(ABSF(0M)-K) 1232,99,1232 1232 MACC2=SY3-XM2*X3+XM1*X1-Y1)/CM + 0.5 MACC1=(MACC2-Y3+XM2*X3)/XM2 +0.5 1237 IF(A8SF(MACC2)~30000) 1233,99,99 1233 IF(ABSF(MACC1)~ 30000) 1050,99,99 1234 IF(DX2) 1235,99,1235 1235 MACC1=X1 +0.5 MACC2=Y3+(Y4-Y3)/DX2*(X1-X3) +0.5 SO TG 1237 1236 MACC1=X3 MACC2=Y1+(Y2-Y1 ) /DXl* (X3-X1 ) +0.5 GO TG 1237 C C C ROUTINE FGR PGINT DEFINED BY TRANSLATION FRGM A POINT C 1300 GOTO( 1310,1320,1330,1340) *LT 1310 N=l GO TO 9030 1320 CALL STACKKMACC2) CALL STACKKMACCl) N=8 K=IGET(NSI,LT,N) IF(K) 1321,9990,9031 1321 MACCl=N 113 LT=LT+1 1330 CALL STACKICKACCI) N=8 K=IGET«NSI,LT,N) IF(K) 1331,999C,9031 1331 MACC1=N LT=LT+1 1340 N=IPGPC1)+IPCP< 1) MACC2=*ACCH-IPCPC1) MACC1=N GO TC 1050 C C C ROUTINE FOR PT CEFINED 8Y CIRCLECARC) C 1400 GO TO <1410,142C),LT 1410 N=4 GO TG 9030 1420 GO TO 1050 C c C ROUTINE TO CRAfc A POINT C 1C5C IFCID-1) 904C,1C51,9040 1051 IF(LPLTSW) 1052,1052,1053 1052 CONTINUE C ROUTINE TO DISPLAY A POINT IG53 CONTINUE C ROUTINE TO PLOT A PCINT GO TO 9020 C C C CHGGSE ROUTINE FGR SPECIFIC LINE C 2000 GCTG C2100,220C),KSN C C C ROUTINE FGR LINE SEGMENT OEFINED BY TWO POINTS C 2100 GO TO (2110,2120, 2130), LT 2110 N=l GO TG 9030 2120 CALL STACK1CHACC2) CALL STACKICNACCI) N=l GQ TC 9030 2130 HACC3=MACC1 MACC4=MACC2 MACC1=IPCPC 1) «ACC2=IPGPC1) GO TG 2050 C C lll* C KCUTINE FCR LINE CEFINED E!Y POINT AND TRANSLATICN C 2200 G0 TC (2210, 2220,2230,2240), LT 2210 N*l GO TC 9030 2220 CALL ST ACKl { MACC2 ) CALL STACKKMACCi) N=8 K=IGET(NSI,LT,N) IF(K) 2221,9990,9031 2221 MACC1=N LT=LT+1 2230 CALL ST ACKl ( NACC 1 ) N=8 K=IGET(NSI,LT,N) IF(K) 2231,999C,9C31 2231 MACC1=N LT=LT+1 2240 N=IPOP( l)-UPCP(l) MACC2=? MACC1=MACC2 GO TO 2050 C C C DRAW A LINE SEGMENT C 2050 IF(IO-l) 9040,2051,9040 2051 IF(LPLTSW) 2052 ,2C52, 2053 2052 CONTINUE C ROUTINE TG DISPLAY A LINE SEGMENT GQ TO 9020 2C53 CCNTINLE C ROUTINE TC PLCT A LINE SEGMENT GC TC 9C2 C c C ChCGSE ROUTINE FOR SPECIFIC CIRCLE C 4000 GCTC (4100, 4200, 4300), KSN C C C ROUTINE FOR CIRCLE DEFINED EY PT ANC CIST C 4100 GC TO (4110, 412C, 4130), LT 4110 N=l GO TC 9030 4120 CALL STACKKPACC2) CALL STACKKKACCl) = 6 K=IGET(NSI,LT,N) IF(K) 4121,999C,9C31 412L MACCl=N LT=LT+i 115 4130 MACC3=*ACC1 MACC1=IPGP(1) MACC2=IPGP( 1) GC TC 4050 C C C RGUTINE FOR CIRCLE DEFINED 6Y CENTER ANC PT CN CIRCUM C 4200 GO TC (4210,422C,4230>,LT 4210 N=l GO TO 9030 4220 CALL STACKl (MACC2) CALL STACKHMACCl) N=l GO TO 9030 4230 X1=IP0P(1) Y1=IP0P(1) X2=MACC1 Y2=MACC2 MACC3=SCRT( (X2-X 1 ) * ( X2-X1 )♦ ( Y2-Y1 )*( Y2-Y1 ) ) IF(MACC3-20) 99,99,4231 4231 MACC1=X1 MACC2=Y1 GO TO 4050 C C C RGUTINE FOR CIRCLE DEFINEC EY 3 POINTS CN CIRCUM C 4300 GO TG (4310, 432C 5 4330„ 4340), LT 4310 N = l GO TO 9030 4320 CALL STACKl (MACC2 ) CALL STACKl(PACCl) N=l GG TC 9C3C 4330 CALL STACKl (MACC2 ) CALL STACKl(KACCi) N=l GO TO 9030 4340 X3=MACC1 Y3=MACC2 X2=IP0P(1) Y2=IP0P(1) X1=IP0P(1) Y1=IPCP(1) C1=-(X1*X1+Y1*Y1> C2=-(X2*X2+Y2*Y2) C3=-(X3*X3+Y3*Y3) DET=X1*(Y2-Y3)-Y1*(X2~X3)+X2*Y3-X3*Y2 IF(ABSF(DET)-5o ) 0099,4351,43 51 43 51 D=(C1*( Y2-Y3)~Y1*(C2-C3)«-C2*Y3-C3*Y2)/CET £=(X1*(C2-C3)-C1*(X2-X3)*-X2*C3-X3*C2)/0ET F=Xl*(Y2*C3-C2*Y3)-Yl*(X2*C3-C2*X3)+Ci*(X2*Y3-X3*Y2) 116 F-F/DET MACCi=(-D/2„) MACC2=(-E/2.) MACC3=«5*SQRTF(C*D+E*E-4.*F) GO TO 4050 C C C DRAW CIRCLE C 4050 IFUD-i) 9040,4051,9040 4051 IF(LPLTSW)4052, 4052, 4053 4052 CONTINUE C ROUTINE TC DISPLAY A CIRCLE GO TO 9020 4053 CONTINUE C ROUTINE TC PLOT A CIRCLE GO TO 9020 C C C CHOOSE ROUTINE FOR SPECIFIC ARC C 5000 GOTO(510Q, 5200, 5300,5400,5500,5600) ,KSN C C C ROUTINE FOR ARC DEFINED BY CIRCLE AND TWQ ANGLES C 5100 GO TO (5110, 5120, 5130, 5140),LT 5110 N = 4 GC TO 9030 5120 CALL STACKKNACC3) CALL STACKKMACC2) CALL STACKKMACCi) N = 7 GO TO 9030 5130 CALL STACKKMACCl) N=7 GO TO 9030 5140 IF(ABSF(MACC1)-3142) 5141,5141,5142 5142 MACCi=NACCl-SIGNF(MACCl»3142) 5141 MACC5=MACC1 MACC1=IP0P(1) IF(ABSF(MACCi)-3142) 5143,5143,5144 5144 MACC1=NACC1-SIGNF(MACC 1,3142) 5143 MACC4=NACC1 MACC1=IP0P(1) MACC2=IP0P( 1) MACC3=IPGP( 1) GO TO 5050 C C C ROUTINE FOR ARC DEFINEO BY A CIRCLE AND TWO POINTS C 5200 GO TC (5210, 5220, 5230, 5240), LT 117 5210 N=4 G0 TC 9030 5220 CALL STACKKKACC3) CALL STACKKKACC2) CALL STACKKPACCl) N=l GO TC 9C30 5230 CALL STACKl ( *ACC2 ) CALL STACKK^ACCl) N=l GC TQ 9030 5240 X3=MACC2 Y3=MACC1 X2=IPCP(1) Y2=IPCP(1) X1=IPGP(1) Y1=IPCP( 1) ?I=3141.59 0Y=Y2-Y1 0X=X2-X1 IF(DX) 5242,5241,5242 5241 IF(OY) 5243,99,5244 5243 ALP=PI/2« GO TO 5245 5244 ALP=-PI/2. GO TC 5245 5242 ALP=ATANF(DY/DX )*100G. IF(OX) 5245,5245,5246 5246 ALP=ALP-SIGNF(PI,ALP) 5245 tfACC4=ALP 0Y=Y1-Y3 DX=X1-X3 IFCOXi 5262,5261,5262 5261 IF(DY) 5263,99,5264 5263 ALP=PI/2. GO TG 5265 5264 ALP=-PI/2. GO TO 5265 5262 ALP=ATANF(DY/0X)*1000. IF(DX) 5265,5265,5266 5266 ALP=ALP-SIGNFIPI,ALP) 5265 HACC5=ALP GG TO 5050 C C C ROUTINE FCR ARC DETER 8Y C IRCLE, PT v ANGLE C 5300 GO TC (5310, 532C»533C, 5340), LT 5310 N=4 GC TC 9030 5320 CALL STACKl (KACC3) CALL STACKKPACC2) CALL STACKKKACCl) 118 N = l GO TO 9030 5330 CALL STACKl (KACC2 ) CALL STACKKKACCl) N = 7 GO TO 9030 5340 A2=MACC1 Xl=IPOP(l) Y1=1PCP(L) X2=IP0P(1) Y2=IP0P( 1) R=IPCP( 1) 5350 PI=3141o59 DY=Y2-Y1 0X=X2-X1 IF(DX) 5342,5341,5342 5341 IF(DY) 5343,99,5344 5343 ALP=PI/2. GO TO 5345 5344 ALP=-PI/2c GO TO 5345 5342 ALP=ATANF(DY/DX)*1000. IFIDX) 5345,5345,5346 5346 ALP=ALP-SIGNF(PI,ALP) 5345 IF(A2) 5349,99,5347 5349 A1=ALP+A2 IF(ABSFIAI)-PI) 5351,5352,5352 5352 A1=AI-SIGNF(2„*PI,A1) 5351 A2=ALP GO TO 5348 5347 A2=ALP+A2 IF(ABSF(A1)-PI) 5353,5354,5354 5354 A2=A2-SIGNF(2»*PI,A2) 5353 A1=ALP 5348 MACC1=X2 MACC2=Y2 MACC3=R MACC4=A1 MACC5=A2 GO TG 5050 C C C ROUTINE FOR ARC OETER BY CIRCLE,PT,DI ST C 5400 GO TO (5410, 542C, 5430, 5440), LT 5410 N=4 GO TO 9030 5420 CALL STACKl ( KACC3) CALL STACKKNACC2) CALL STACKKMACCl) N = l GO TO 9030 5430 CALL STACKKNACC2) 119 CALL STACKKMACCl) N=6 K=IGET(NSI,LT,N) IF(K) 5431,9990,9031 5431 MACC1=N LT=LT+1 5440 D=MACC1 X1=IP0P(1) Y1=IP0P(1) X2=IPOP(l) Y2=IPOP(l) R =IPGPC1) 5441 IFCD-2.*R) 5442,5442,99 5442 T=D/C2„*R) A2=20CC.*ATANF( T/SQRTF C l.-T*T ) ) G0 TO 5350 C C C ROUTINE FOR ARC DETER BY CIRCLE.ANGLE DIST C 5500 GO TO (5510,5520, 5530, 5540),LT 5510 N=4 GO TO 9030 5520 CALL STACKl (MACC3 ) CALL STACKHMACC2) CALL STACKKMACCl) N=l GO TO 9030 5530 CALL STACKKMACCl) N=6 K=IGET(NSI,LT,N) IF(K) 5531,9990,9031 5531 MACC1=N LT=LT+1 5540 D=MACC1 A1=IP0PU) X2=IP0P(1) Y2=IP0P(1) R =IP0P(1) 5541 IF(D-2o*R) 5542,5542,99 5542 T=D/C2 *R) A2=2000.*ATANFC T/SORTF C lo=T*T ) ) GO TO 5351 C C C ROUTINE FCR ARC DETER BY CIRCLE AND TWG DIST C 5600 GQ TQ C 5610, 562C, 5630,5640) , LT 5610 N=4 GO TO 9030 5620 CALL STACKl CMACC3 ) CALL STACKKMACC2) CALL STACKKMACCl) 120 N=6 K=IGET(NSI,LT,N) IF(K) 5621, 9990,9031 5621 MACCi=N LT=LT*1 5630 CALL STACKl ( MACC 1 ) N=6 K=IGET(NSI,LT,N) IF(K) 5631,9990,9031 5631 MACCi=N LT=LT*1 5640 D2=MACCi 01=IPCP( 1) X1=IP0P(1) Y1=IP0P(1) R =IPOP( 1) 5641 IF(Dl-2c*R) 5642,5642,99 5642 T=D1/(2.*R» Al=2000.*ATANF(T/SQRTF(l.-T*T)) IF(D2-2.*R) 5643,5643,99 5643 T=02/(2o*R) A2=200C. *ATANF C T/SQRTF ( 1 .-T*T ) ) MACC4=Ai MACC5=A2 MACC1=X1 MACC2=X2 MACC3=R GO TO 5050 C c C DRAW AN ARC C 5050 IFCID-1) 9040,5051,9040 5051 IF(LPLTSW)5052„5052,5053 5052 CONTINLE C ROUTINE TO DISPLAY ARC GO TO 9020 5053 CONTINUE C ROUTINE TC PLCT ARC GO TO 9020 C C C CHOOSE RCUTINE FOR SPECIFIC DISTANCE C 6000 GOTO (6100, 6200, 6300, 6400, 6500*6600, 6700), KSN C C C ROUTINE FOR DISTANCE DEFINEC 8Y TWO PTS C 6100 GCTO (6110 P 612C„6130),LT 6110 N=l GO TO 9030 6120 CALL STACKHNACCl) 121 CALL STACKUMACC2) N=l GO TO 9030 6130 X2=MACC1 Y2=MACC2 Yl=IPOP(l) X1=IP0P(1) MACC1=SQRTF((X2-X1)*(X2-X1)*(Y2-Y1)*(Y2-Y1)) GG TO 6050 C C C ROUTINE FOR HORZ OIST 8ETWEEN TWO PTS C 6200 GGTO (6210,6220, 6230), LT 6210 N=i GG TO 9030 6220 CALL STACKl (NACCl ) N=l GO TG 9030 6230 MACC1=A8SF(MACC1-IP0P(1)) GG TG 6050 C C C ROUTINE FCR VERT OIST BETWEEN TWO PTS C 6300 GOTO (6310,6320, 6330), LT 6310 N = l GO TO 9030 6320 CALL STACKl (MACC2) N=l GO TO 9030 6330 MACC1= ABSF(MACC2-IP0P(D) GO TO 6050 C C C ROUTINE FGR CIST DEFINED BY PT AND LINE C 6400 GOTG (6410, 6420, 6430), LT 6410 N=l GO TG 9030 6420 CALL STACKKHACCl) CALL STACKKMACC2) N = 2 GG TO 9030 6430 X1=MACC1 Y1=NACC2 X2=MACC3 Y2=MACC4 Y3=IP0P(1) X3=IPCP(1) A=Y1-Y2 8=X2-X1 C=(Y2-Y1)*X1+(X1-X2)*Y1 122 IF(ABSF(B)-5«, )6 4 33,6433,6434 6433 MACC1=ABSF(X1-X3) GO TO 6050 6434 IF(B)6431, 6432, 6432 6432 MACC1=ABSF( ( A*X3+B*Y3+C )/SCRT ( A*A*B*B ) ) GO TO 6050 6431 TX=X1 TY=Y1 X1=X2 Yi=Y2 X2 = TX Y2 = TY GOTO 6432 C C C ROUTINE FOR DISTANCE OEFINEC BY CIRCLE C 6500 GO TO (6510, 6520), LT 6510 N=4 GO TO 9030 6520 MACC1=MACC3 GO TO 6050 C c C ROUTINE FOR DIST — REAL NUNBER C 6600 GO TCt 6610,662C),LT 6610 N-8 K=IGET«NSI,LT,N) IF(K) 6611,9990,9031 6611 MACC1=N LT=LT+1 6620 GO TG 6050 C C C ROUTINE FOR 8INARY OPERATION ON TWO OISTANCES C 6700 GO TO «6710,672C S 6730,6740),LT 6710 N=6 K=IGET(NSI,LT,N) IF(K) 671i,999C,9G31 6711 MACC1=N LT=LT+1 6720 CALL STACKl ( MACCl ) N=8 K=IGET(NSI,LT,N) IF(K) 6721,999C,9C31 6721 MACC1=N LT=LT+1 6730 CALL ST ACKl ( MACC 1 ) N=6 K=IGET(NSI,LT,N) IF(K) 6731, 999C, 9031 123 6 731 MACC1=N LT=LT+1 6740 N=IPGP( D/1000 A=IP0P( 1) 8=MACC1 G0T0C 6741, 6742*6 743, 6744,674 5 »6746, 6747 j,N 6741 MACCl=A+8 GG TC 6050 6742 MACC1=A-B GG TO 6C50 6743 MACC1=A*B GC TC 6050 6744 MACC1=A/B GC TC 6050 6745 MACC1=A**8 GG TC 6C50 6746 MACC1=A*SQRT(AESF(B) ) GO TG 6C5C 6747 MACC1=A*ABSF(B) GG TC 6C50 C C C CRAto A CISTANCE C 6050 GG TC 9040 C C C CHGGSE RGUTINE FGR DEGREES C 7CC0 GGTG(7100,72CC,73C0),KSN C C C ROUTINE FGR DEGREES CETER 8Y TWG LINES C 7100 GC TG 1711C,712C,713C),LT 7110 N=2 GG TG 9030 7120 CALL STACKKMACC4) CALL STACKHMACC3) CALL STACKICHACC2) CALL STACKHMACCl) N=2 GG TG 9C30 7130 X3=MACC1 Y3=MACC2 X4=MACC3 Y4=MACC4 X1=IP0P(U Y1=IPGP(1) X2=IPGP( l) Y2=IP0P( 1) 7141 IF(ABSF(Xl-X2)-20o) 7143,7143,7144 7143 Al=3. 14159/2«, 12U -i, TC 7142 7144 A1 = ATANFUY1-Y2 )/(Xl-X2) ) 714<> IF(ABSF(X3-X4)-20.1 7146,714.6,7147 7146 A2=3 14159/2o GC TO 7148 7147 A2=ATANF((Y3-Y4)/(X3-X4)1 7148 MACC1=ABSF( A1-A2) GO TC 7C50 C C C RGUTINE FOR DEGREES DETER BY 3 PTS C 7200 GO TO (7210, 7220, 7230, 72401, LT 7210 N=l GO TO 9030 7220 CALL STACKl (MACC2 ) CALL STACKKMACCl) N-I GO TO 9030 7230 CALL STACKl (MACC2) CALL STACKKMACCl! N = l GO TO 9030 7240 X3=MACCl Y3=MACC2 X2=IP0P(l) Y2=IP0P(i) Xl=iP0P(l) Y1=IP0P( 1) 7241 X4=X3 Y4=Y3 X3=X2 Y3=Y2 GO TC 7141 C C C ANGLE DETERMINED BY A REAL NUMBER C 7300 GG TG ( 7310,7320 ) ,LT 7310 N=8 K = IGET«NSULT,N) IF(K) 73ll»999C»9031 73 11 MACC1=N LT=LT+1 7320 GO TC 7050 C c C DRAk AN ANGLE C 7050 GO TO 9040 END 125 FUNCTICN IOENTY(J) iNDENTIFIES TYPE CF WORO END FUNCTIGN IGET(I,J,N) DIMENSION LC10CC),LINC29),LST1(200),LST2C10> ,NTLC50,2) COMMGN L,LIN,LST1,LST2,NTL,LPTI,LPT2,LALGPT,NTLPT NSI = I LT=J LP=LPT2 3 K=NSI*LT+i M=IDENTY(L(K) ) IF(M-l) 2,1,2 C C PARAMETER C 1 M=INTGER(L(K),M) NSI=LST2(LP)-6 LT=M+5 LP=LP-1 GG TG 3 C 2 IFCM) 5,4,5 C C VALUE C 4 IFCN-8) 6,7,6 6 IF(N-6) 15,7,15 15 IGET=0 RETURN 7 N=INTGER(L(K),K) IGET=-1 RETURN C 5 IFIM+1) 8,9,8 8 IGET=0 RETURN C C NAME C 9 NSI=NSI-L(NSI-2) IF(L(NSI-1)-L(K)) 10,11,10 10 IFCLCNSD) 9,12,9 12 IGET=C RETURN 11 K=LCNSI J/IOOCO K=CLCNSI)-K*10CC0)/10G0 IF(K-N) 13,14,13 13 IGET=C RETURN 126 14 IGET=NSI RETURN END FUNCTICN INTGER(J,N) CONVERTS WCRD TC INTEGER VALUE END FUNCTICN IPOPIM) DIMENSICN L UOCC ),L IN ( 29 ),LST 1(200) ,LST2 ( 1C ) , NTL < 50,2 ) COMMON L,LIN,LST1,LST2,NTL*LPT1,LPT2,LALCPT,NTLPT IF(M-i) 1,1,2 IP0P=LST1(LPT1) LPT1=LPT1-1 RETURN IP0P=LST2(LPT2) LPT2=LPT2-1 RETURN END FUNCTICN LALCCT(N,M) CIMENSION L(10CC),LIN(29) f LSTl(200),LST2(10)»NTL(50,2) COMMON L,LIN,LST1,LST2,NTL,LPT1,LPT2,LALCPT,NTLPT IF(M) 1,2,3 2 RETURN 1 IF(N+M-21) 4,4,5 4 LALOCT=0 RETURN 5 Nl-N-1 LS=N LC = 18 LS=LS-L(LS~2) LC=LC+L(LS+1) IFCLCLS)) 15,16,15 15 IFCM+LC) 18,17,17 16 CALL NAMDELCL(LS-l)) GO TO 15 17 DO 6 I=N1,LAL0PT 6 N2=I+M L(N2 )=L(I) LALOPT=LALOPT+M GO TO 9 3 IF(LALCPT+M=10CC) 7,7,4 7 Nl=LALCPT-N+2 DO 8 1=1, Nl N2=LALCPT-I+1 LD=N2+N 8 LILD )=L(N2) LALOPT=LALOPT+N 9 IF(NTLPT) 10,10,11 127 10 LALGCT=1 RETURN 11 00 12 I=1,NTLPT IF(NTL(I,2)-N+1) 12,13,13 13 NTL(I,2)=NTL(I,2)+M 12 CQNTINUE GO TO 10 ENO FUNCTICN LSRCHN(N) OIMENSION L(10CC),LIN(29),LSTK200),LST2(i0),NTL(50,2) COMMCN L,LIN,LST1,LST2,NTL,LPT1,LPT2,LAL0PT»NTLPT IF(NTLPT) 1,1,2 LSRCHN=0 RETURN DO 3 I=1,NTLPT IF(N-NTL(I,1>) 3,4,3 CONTINUE GO TO 1 LSRCHN=NTL( 1,2) RETURN END SUBROUTINE MAN ( X,Y, XI, Yl) DIMENSION L(10CC),LIN(29),LST1(2 00),LST2(10),NTL(50,2) COMMON L,LIN,LST1,LST2,NTL,LPT1,LPT2,LAL0PT,NTLPT COMMON A,B,C,D,S,T X1=S+A*X+B*Y Y1=T+C*X+D*Y RETURN END SUBRCUTINE NAMACD(N,M) DIMENSIGN LCIOCC) ,L IN (29 ) ,LST1 ( 200 ) ,LST2 ( 10) ,NTL (50,2 ) COMMON L,LIN,LST1,LST2,NTL S LPT1,LPT2,LALCPT,NTLPT IF(NTLPT-50) 1,2,2 1 NTLPT=NTLPT+1 NTL(NTLPT,1)=N NTL(NTLPT,2)=M RETURN 2 PRINT 10014 STOP 05 10014 FORMATdH ,4CHFIGURE NAME TABLE SIZE EXCEEDED ) END SUBRGUTINE NAMCEL(N) DIMENSION U( 10001 ,L IN( 29) ,LST1 (200 ) ,LST2 ( 10) ,NTLI50, 2 ) COMMON L,LIN,LST1,LST2,NTL,LPT1,LPT2,LAL0PT,NTLPT DO 1 I=1,NTLPT 128 IF(NTL(I,i)-N) 1,2,1 1 CONTINUE RETURN 2 IF(I-NTLPT) 3,4.4 3 NTLU,1)=NTL( 1+1,1) NTLII ,2)=NTL(I+1,1) 1-1*1 GO TO 2 4 NTLPT=NTLPT-1 RETURN END SUBROUIINE STACKl(K) DIMENSION L ( 10CC ), L IN ( 29 ),LST 1(200) , LST2 ( 10) ,NTL (50,2 ) COMMGN L,LIN,LST1,LST2,NTL,LPT1,LPT2,LAL0PT,NTLPT LPT1=LPT1+1 IFILPTl-200) 2,2,1 1 PRINT 10010 STOP 01 2 LST1(LPT1)=K RETURN 10010 FORMATHH ,4CHSTACK 1 SIZE EXCEEDED END SUBROUTINE STACK2(K) DIMENSION L(100C),LIN(29),LST1(200),LST2I10),NTLI50,2) COMMON L,LIN,LST1,LST2,NTL,LPT1,LPT2,LAL0PT,NTLPT LPT2=LPT2+1 IF(LPT2-10) 2,2,1 1 PRINT 10011 STOP 02 2 LST2(LPT2)=K RETURM 10011 FORMATdH ,40HSTACK 2 SIZE EXCEEDED ) END 129 VI. SUGGESTIONS FOR FURTHER RESEARCH During the creation of GDL-1 and GDL-2 certain decisions have been made to facilitate the initial implementation of the lan- guage. Some of these have been mentioned previously, In particular, the motivations for the creation of GDL-2 constituted a wħole area of further research which was felt sufficiently important to he im- plemented in the original study. The following areas are some of those which need further study. 1/. Dynamic storage allocation for stacks, tables , and block structure. Unsophisticated error routines currently simply state that space allotted has been exceeded, and terminate the pro- gram. 2/. In GDL-1, garbage collection routines for block structures. A record could be kept of the usage of each BCU block. When delete commands involve the removal of all usages of a BCU block, it should by physically removed, and its space re-allocated. 3/o x n , y , 0, E could be allowed to be pointers , or para- meters as well as values as is currently the case. h/ „ Usage of secondary storage for subfigures , allowing the creation of a library of primary figures to be created, from which larger figures could be composed- Input - output routines for these would have to be created, and linkage systems defined and im- plemented. 5/. Default conditions should be specified for certain parameters (x , y , 0, E, for exampleK If in addition free format 130 for the input lines is implemented, the punctuation of this could allow omitted parameters, 6/. Abbreviated format for input lines, allowing more geometrical descriptions of figures. For example: A: L.S., THRU B, C. might indicate that A is a line segment drawn through point B parallel to line C. 7/. Specification of whether or not particular parameters are to be manipulated or not. Currently parameters are handed down in absolute form and the figures resulting from their use then mani- pulated. It might prove useful also to allow the parameter to be inversely manipulated in the process of handing it down , so that when the figure was manipulated the parameter would appear in un- manipulated form. This could be done ifA, B, C, D, S, T were stored in stack 2, so as to be available while chasing down parameters . 8/. A check could be made to prevent drawing BCU's which are too small to appear properly. Some record of the size of sub- figure could be kept, and when calls are made to it, the size of it checked. 9/. A limiting subroutine could be incorporated to prevent the attempted drawing of BCU's which appear off the display screen or plotter. This would allow the detailed creation of a large dia- gram. If it were displayed in total the suggestion in 8 would pre- vent unnecessary detail. To study the detail, smaller sections could be displayed in blow-ups . The suggestion here would prevent trouble with those sections of the diagram appearing outside the 'frame' of the drawing. 131 10/. When using a CRT for interactive display, it might prove useful to have an automatic call to the display suhroutine while creating the figure so as to allow immediate display of BCU's which are being created. 11/. The addition of more BCU's, including conic sections, and curve fitting routines. 12/. On an error condition, provision to continue with the drawing of those parts of the figure which are unaffected by the error. This should reduce the number of attempts necessary to correct the figure. The following apply only to GDL-2: 13/. Extend LOCATE to X°Y, where X is a figure name, Y is a name of a line within a figure. ik/. While drawing, where a BCUL is based on no parameters , store its values to prevent having to recalculate it. 15/. It may prove useful to check at file creation time that names are not duplicated within a figure. l6/. Set up a dynamic name table, so that names used within a figure are not visible outside that figure, 17/. In the current GDL-2 it is not possible to base lines on lines from different figures, except through the use of parameters. This could be made possible with the proper stacking and use of A, B, C, D, S, T and free format forms like ABC°DEF°G where ABC is the name of a sub-figure line in the current figure, DEF is the name of a subfigure line in the figure called in ABC, G is a basic line in the figure called in DEF. 132 Generally it is felt that the data structures of GDL-2 are sufficiently superior, principally on account of their flexibility, to those of GDL-1 that further study of GDL-1 is not warranted. 133 VII. SUMMARY AND CONCLUSIONS As has been discussed, the task of providing languages through which a computer can be used by those with little knowledge of the machines themselves is an important one. In consideration of the facts that a system equipped with an x-y plotter and a console typewriter can be used as quite an accurate drafting tool, and that no language exists currently to utilize this fact , this work has studied some aspects of the data structures necessary to provide such a language. A tentative lan- guage giving the ability to describe and produce planar figures composed of straight line segments and circle arcs has been defined. Two versions of this Graphics Display Language have been designed and implemented, These vary in the degree to which they are compiled into a condensed format at the time of entry into the GDL system. The first is based on a structure with blocks of storage assigned for each basic construction unit, figure, and set of para- meter and manipulation data. All relational information between these blocks is embodied intrinsically in pointers from one to another. The second version of GDL is based on a file structure of lines of input information. Relational information between these lines is embodied in both their ordering within the file, and through names given to each line which are used for reference purposes in other lines. The programs which handle the creation of the block and pointer structure for GDL-1 and the file structure for GDL-2 are referred to as the HANDLER in each case, These differ greatly 13U between the two versions of GDL, and the commands which can be given them reflect these differences, The extents of these differences is increased by the desire to make the GDL system an interactive one in which it is possible to 'talk' between the computer and the user on-line while creating the block or file structure. Although this interactive nature is not intrinsic in the objective of this study as stated at the beginning of this summary it is an important aspect for the many time-sharing systems being designed. These systems are becoming more and more appreciated due to the powerful capabilities provided by the man- machine symbiosis they make possible, Therefore the system and structures have been designed to provide as much of this interactive capability as possible. The displaying subprogram is essentially the same in these two versions. Two push-down stacks allow arbitrarily deep nesting of figures within figures, and arbitrarily deep dependence of basic construction units on others. The structures designed and the restrictions placed upon the user through the definition of the Handler commands leave little doubt that the second version of the GDL system is a better struc- ture c Conceptually , as a file is an easily comprehended idea, the user has little more to learn than the language itself, whereas the block structure of GDL-1 requires more understanding of the im- plementation used. The flexibility of the GDL-2 structure lends itself much more easily to the interactive environment of time-shared systemso Also it appears to provide the basis for expansion of the facilities 135 of GDL in many more directions and to a greater extent than GDL-1. A further indication of the superiority of the structure of GDL-2 is the easier programming ( in Fortran) that results from its implementation. The file system appears to be a more 'natural' structure for this language. The value of the language itself will have to be deter- mined through usage. It is anticipated that usage will also high- light those constructions most commonly used, thus providing a guide to useful shorthand notations and/or library subfigures. It is expected that this study will lead to more sophisti- cated versions of GDL which will prove valuable additions to the library of problem-oriented languages. REFERENCE lo Sutherland, I. E. , "Sketchpad: A Man-Machine Graphical Communi- cation System," Defense Documentation Center, Technical Report Noc 296, January, 1963. <% ?0