A HIGH-LEVEL GRAPHICS LANGUAGE BASED ON ...

0 downloads 0 Views 4MB Size Report
[Dene75] E. Denert, G. Ernst, and H. Wetzel, "GRAPHEX68: Graphical Language Features in ALGOL 68," Computer and. Graphics, Vol. 1, 1975, pp. 195-202.
A HIGH-LEVEL GRAPHICS LANGUAGE

BASED ON THE GRAPHICAL

KERNEL SYSTEM by HANQIU SUN B . A . S c , Huazhong U n i v e r s i t y ,

1981

A THESIS SUBMITTED IN PARTIAL FULFILMENT OF THE

REQUIREMENTS FOR THE DEGREE OF MASTER OF APPLIED SCIENCE in

THE

FACULTY OF GRADUATE STUDIES

Department

We a c c e p t to

THE

of E l e c t r i c a l

this

t h e s i s as

the required

Engineering

conforming

standard

UNIVERSITY OF BRITISH COLUMBIA February

©

1986

H a n q i u Sun, 1986

In p r e s e n t i n g

this thesis

r e q u i r e m e n t s f o r an of

British

it

freely available

agree that for

Library

s h a l l make

for reference

and

study.

I

f o r extensive copying of

h i s or

be

her

g r a n t e d by

shall

not

be

Fkcf^''ccv£

The U n i v e r s i t y o f B r i t i s h 1956 Main Mall V a n c o u v e r , Canada V6T 1Y3

Date

>E-6

(3/81)

Ma»JL

S>o ,

fIBf

of

further this

(p^r' *-' KA

f

r/ (1.5,1)') t2 = t u r n p i c ( T , ' a b o u t = p o i n t ( T , " T C " ) ; deg=l80;') Figure Originating

from

successfully with

most of

graphics

for

i t s features being

( G r a p h i c a l Language

to

operations

i n the

Language

approach, the of

field the

ESP

ESP

nature

of

3

has

3

of p a t t e r n

organize

design

a

been

recognition high-level

The

application

means

of

programs

spatial in

in

features a

It and

high-level of

an

d a t a b a s e , GLIDE p r o v i d e s

an

i n GLIDE i s shown i n F i g u r e

modelling

definition 7.

and

manipulations

for

CAD.

MUMBLE[Guib82], b u i l t appropriate

database

hierarchical

object

Design)[East77],

characteristics.

of p h y s i c a l s y s t e m s

a three-dimensional

effective

design

commonly-needed

environment. object

for Interactive

e x h i b i t s some new

f o r the

computing

Based on

linguistic

implemented

i n 1977,

attempts

graphical

a

Expressions

language.

GLIDE proposed

6 - Basic

i n 1982,

i s another

f o r d e s c r i b i n g b i t m a p s and

digital

graphics

language

computations

for

10

Euler Operators

""TOPOLOGY s

Vertex Coordinates

SHAPE PROCEDURE Parameters

* POLYHEDRON Attribute Initializations Shape

FORM

Operators

^

COPY

Figure raster

7 - Hierarchical

displays.

performed basis.

D e f i n i t i o n o f t h e Language GLIDE

Boolean

operations

f o r each p i x e l of the An

example

of

L o c a t i o n and Copy Attributes

image

like

AND, OR a n d XOR a r e

plane

the computations

on

a

bit-by-bit

i n MUMBLE

i s shown i n

F i g u r e 8. A A L L 2 )

E x p r e s s i o n s i n t h e Language MUMBLE geometric

language

increasingly

operations

MUMBLE.

important, will

+ (B S H I F T f 0 , - 1 ] )

become

As

the

are

raster

precisely

devices

interesting

and

are

useful

a p p a r e n t due t o i t s s p e c i f i c

design. From t h e above b r i e f unlike

other

overview,

u n i f o r m programming

i t becomes

obvious

languages, graphics

that,

languages

11

have been c r e a t e d o f h i g h l y i n d i v i d u a l styles

stemming

practical for basic

from

different

requirements.

every

design?

In

and c r u c i a l

practice,

mentioned

r e s e a r c h approaches e x i s t i n g subroutine entirely extended Subroutine

totally entirely extended

new

new g r a p h i c s

kept

before,

criteria

What a r e t h e in

the

languages three

main

language d e s i g n a r e :

languages,

languages.

new

syntax

compiler

p o r t a b l e and e x t e n d a b l e

languages

involved.

considerations.

non-graphic

computation

a language

implementation

have

and s e m a n t i c s

languages has a t t r a c t e d

economics

common

and

packages,

entirely

new g r a p h i c s

be

in graphics

packages a r e e a s i l y

structureless;

to

versatile

facilities

language t o f o l l o w ?

factors

as

and

motivations,

However, what a r e t h e

h i g h - l e v e l graphics

principles

character

The

t h e freedom of a

but a t t h e c o s t of

Therefore,

most

and c o n t r o l

an

the approach of

r e s e a r c h a t t e n t i o n due

host

but

to

language can p r o v i d e a l l

facilities,

i s restricted

thus

the c o s t of

t o i t s extended

graphics

part. Using language graphical

the

design, types,

hierarchical structures

same

principles a

graphics

variables,

structuring

of

a

language

and o p e r a t o r s

towards a h i g h e r

are generally considered

languages: data s t r u c t u r e s , picture structures,

high-level should

programming contain i t s

v i a name r e f e r e n c e a n d level.

i n the design

Three of

kinds of graphical

1 2

language Data

structures

graphical the

structures.

objects

deal

with

i n the data base; p i c t u r e

interrelationships

between

s p a c e ; and l a n g u a g e

structures

of

system

and e x t e r n a l

In

some s e n s e ,

by

the

functions

and

are mainly

language In

the p i c t u r e

i n t e r n a l data

structures

are

language

structures,

2.1 CADEP

both

structures

will

on

in a picture

i n t e r n a l procedures

procedures of statement

structures.

section,

investigated syntax,

features

and p i c t u r e

somehow be

Data s t r u c t u r e s the s t r u c t u r e s

types.

reflected

and l a n g u a g e of

database

some t y p i c a l

e x a m p l e s of e x t e n d e d

i n some d e p t h , c o n c e n t r a t i n g s e m a n t i c s , and t h e c r e a t i o n

such

as

graphical

data

on t h e of

hightypes,

operations.

(1971)

(Computer A s s i s t e d CADEP[Brac71] extended

consider

objects

focus

of

layout.

a s p e c t s of g r a p h i c s level

structures

graphical

concerned with

the f o l l o w i n g

languages

the i n t e r n a l representation

i n FORTRAN

dimensional

space.

Description

is

a

Patterns)

problem-oriented

for positioning The g r a p h i c a l

geometric

graphics

language

patterns

i n a two-

types defined

i n CADEP a r e :

geometric, graphic, unilevel

graphic,

multilevel A geometric

type

graphic.

i s employed

viewed as a u x i l i a r y p a t t e r n s .

t o b u i l d up g e o m e t r i c

I t c a n be a s s i g n e d

by

entities geometric

13

primitives

and

processed

by

the

following

operators

and

funct ions. /

intersection,

+ union,

.

-

difference,

*

concatenation,

copy(g,s), trans(g,xl,y1,s), rot(g,x1,y1,alfa,s).

The

unilevel

dimensional

graphic

and f u n c t i o n

unilevel

type as w e l l .

several

belonging

unilevel to

integrated levels).

the

used

circuit

f o r geometric

patterns

same

The o p e r a t i o n s

addition,

the

operator

i n CADEP.

possessing

multilevel

objects

language a p p l i c a b l e

a well-defined

syntax

language

types

type

is

composed

d i f f e r e n t p l a n e s -and ( f o r instance,

gate

in

l y i n g on d i f f e r e n t

link

a l l of

to acquire

them

as w e l l

t h e s t a t e and

as d i s p l a y

involved,

commands

CADEP p r o v e s t o be

to two-dimensional pattern

and n a t u r a l

structure

provides

and t h e n

functions

interactive activities

a simple

An

*.

predicate

are

a passive

object

separately

between g r a p h i c

Without

plane.

t y p e s c a n be u s e d a s a

on

same

two-

on m u l t i l e v e l t y p e s c a n be p e r f o r m e d on

relationship supplied

lying

physical

masks,

the concatenation In

physical

The m u l t i l e v e l g r a p h i c

each of the u n i l e v e l types by

represents

e n t i t i e s l y i n g on a p a r t i c u l a r g r a p h i c a l

operation

of

type

a

semantics, which

i n CADEP.

clear

layout lead to

The i n t r o d u c t i o n o f

concept

for

each

level

1 4

modelling can

and t h r e e - d i m e n s i o n a l

overlap

different

language,

CADEP

assignment

statements

2.2 GPL/I

levels.

Being

keeps a c o n s i s t e n t form with

those

of host

Extension

GPL/I[Smit71] handle

f o r Computer

graphical

situations

hardcopying,

display,

attributes,

and p i c t u r e

animation.

g r a p h i c a l types

image, attr, text, graphic. operations

on v e c t o r s a r e

+ addition, -

on

extended

FORTRAN

i n i t s d e c l a r a t i o n and language

deletion,

*.*

dot product,

***

cross

product;

images a r e +>

graphics such

inclusion, connection, position, scaling,

as

picture

i n GPL/I a r e :

vector,

The

an

FORTRAN.

Graphics)

i s an i n t e r a c t i v e

modelling,

The

where t h e same o b j e c t

(1971)

(PL/I

to

modelling

language

intended

three-dimensional storage,

colour

1 5

*> Some

rotation.

operations

projection,

intensity,

functions.

Graphical

with

sets

they

design

and

thickness,

hardcopy

files,

softcopy

files,

GPL/I

function images.

the

With

viewing

files

image.

ANIMATE

a l l the

language sets

does n o t c o n v e y

attributes

of v a r i a b l e s a larger

extending

can

instead

the

standard of

B o t h t h e IMINTR process

procedures,

picture

performed. of

readily their

runtime

reference.

dynamically

display

i s well

a r e s e t by

for global

function.

statement predefined

directly to

An i n t e r e s t i n g f e a t u r e

i t s animation

use o f c h a r a c t e r

requires

by

statements.

operators

system

an

by

as

i s achieved

is

i n t h e GPL/I

The

as

a t t r i b u t e s c a n be a s s i g n e d

management

system

and

into graphical

displayed

t o an ATTR v a r i a b l e

programming

the

implemented

files.

image o r i n d i r e c t l y

interrupt

perspective

files,

GPL/I, g r a p h i c a l

PL/I

are

as

files,

storage

Interactive

such

types are processed

are c l a s s i f i e d

display

an

attributes,

o f a t t r i b u t e s w h i c h c a n be

Functionally,

In

and

names

meaning.

function

library

for Also,

calls,

than other

graphical a s most

the

GPL/I

systems.

1 6

2.3 GRAPHEX68

(1975)

(Graphical

Language F e a t u r e s

Departing

from o t h e r

facilities operators. during

i n ALGOL 68)

l a n g u a g e s , GRAPHEX68[Dene75] u s e s t h e

o f ALGOL 68 f o r d e f i n i n g new g r a p h i c a l d a t a Much f l e x i b i l i t y

the experimental

i s gained

definition

thereby

which

and e v a l u a t i o n

t y p e s and

i s valuable

phase

of

the

system. The

two g r a p h i c a l t y p e s

i n GRAPHEX68 a r e

point, pict. Correspondingly,

the operators are

- connection

(of p o i n t s ) ,

< AT: a t v , SCALE: s c l v >

POLYLINE t r e e d : 1 5) FILLAREA t a b l e ( 1 : 1 0 ) Figure POLYLINE The GKS.

type

P l a c e m e n t s i n HL/GKS

tree(3:12)

segment

o f HL/GKS d i r e c t l y

As f r o m GKS, two w o r k i n g

provided

by

environment, primitives

modelled

the segment

space. and

can

OPEN be

operations

and

CLOSE.

segments o f

segments

are

In

open

by

segments w i t h i n

the

predefined i t s specified

e n v i r o n m e n t , a segment

by p r e v i o u s l y

under

for

superimposed

created

and d e l e t i o n

reflects

environments

In the c l o s e d

processed

superposition

segment

keywords

and p r e v i o u s l y

coordinate

the

25 - V e c t o r

created

functions.

can

segments

A simple

through

example

both environments i s given

be

of

in Figure

26. OPEN house house =

POLYLINE square(1:5) + POLYMARKER handle + d o o r + window(1)

CLOSE f l a g = s t a r + s t a r s + frame house = house - w i n d o w ( l ) + Figure

The

26 - Segment

data

type

Operations

trans

of

window(2)

i n HL/GKS E n v i r o n m e n t s

HL/GKS

implements

the

40

transformations specified called

o f t h e GKS c o o r d i n a t e

by r e c t a n g l e s .

the

window

of

mapped t o i s c a l l e d

the

keywords

TO

window

FROM and

and

respectively,

The r e c t a n g l e a

to

viewport

of

a

mapped

from

transformation.

of

is

t h e r e c t a n g l e t o be

a transformation

assignment

The mappings a r e

be

transformation;

in

viewport

spaces.

pattern

the

The

s i g n a l the

transformation,

such a s :

TRANS n t nt

= < FROM: ( 3 . 8 , 2 . 9 ) ; TO:

A

window

or

viewport

transformation GKS,

pattern

(0.5,1.0) >

assignment will

transformations

distinguished

assigned

i s not s p e c i f i e d

o r t h e one a s s i g n e d and

workstation

by t h e a s s i g n m e n t

context.

transformation;

workstation

as

transformation.

A

previously.

transformation

either

a

trans

variable

Examples of t r a n s f o r m a t i o n

assigned

viewing

A transformation

of

transformations

transformation

the workstation

workstation by

a

ina

assignment

t o an opened segment a s t h e segment open a t t r i b u t e

normalization viewing

which

be s e t t o t h e d e f a u l t

v i z . (0.,0.) t o ( 1 . , 1 . ) ,

Normalization are

(0.0,0.0);

(6.8,12.0)

can

to

attribute be

a

i sa

specified

o r by a t r a n s f o r m a t i o n

assignments a r e presented

i sa

pattern. in

Figure

27. The select

input the

coordinate

priority

of

transformation space,

are

normalization

order

indicated

BELOW f o r e a c h t r a n s f o r m a t i o n

in

the

transformation, to normalized

device

by t h e keywords o f ABOVE a n d

pair.

OPEN house WITH n t ( l ) BELOW n t ( 2 )

41

The

data

type

workstation

is

designed

to

minimize

state

TRANS n t ( 1 ) TRANS wt wt = n t d ) = OPEN house WITH n t ( 1 ) .DISPLAY h o u s e ON s c r e e n

WITH wt

OPEN house WITH < FROM: ( 3 . 5 , 2 . 0 ) ; DISPLAY house ON p l o t t e r Figure

of

"workstation

active",

a

used

etc.

statement.

for

updating

such

a

as

Workstations

type

Transformations "workstation are

opened

a n d a c t i v a t e d when r e f e r r e d

Some l o n g - t e r m

systematically defined

changed

WITH < TO: ( 0 . 0 , 0 . 0 ) ; ( 3 . 6 , 5.8)>

workstations

as a w o r k s t a t i o n

display

are

(4.8,7.0) >

27 - The A l t e r n a t e S e t t i n g s o f Two

assignments

declared

9

running

i n the precompiler, configuration.

workstation which a r e

The w o r k s t a t i o n

open", when toin types easily types

i n HL/GKS a r e : screen, printer, plotter,

The

.

t4027,

.

t4025,

.

t4105,

.

t4112,

.

t4113,

.

t4115.

display

workstation" the

functions

of

a n d "copy segment

keywords SEND and DISPLAY

GKS

"associate

to workstation"

segment

with

a r e expressed

i n a d i s p l a y statement

by

o f HL/GKS.

42

SEND house TO DISPLAY Using

natural

controlled numeric

names,

screen

workstations

processed

references

With level

house ON

and

workstation

plotter

o f GKS.

more

HL/GKS i n c o n t r a s t

This

the

i s especially

i n t r o d u c t i o n of g r a p h i c a l d a t a

programming f e a t u r e s a n d details

can

checking,

and type

parsing

graphical

types

system.

simply

much

true

distinctly

t o the use of in a

multi-

system.

function

GKS

in

are

be

and a v o i d Using

freedom

provided.

passing

incorrect

supplying

highsystem

declarations,

parameters

to

Display

statements

i n F i g u r e 28.

GOPWK(1,8,100) {open w o r k s l } GOPWK(2,9, 1 00000) {open works2.} GACWK(2) { a c t i v a t e works2} GSVP(1,0.,0.5,0.,1.0) { s e t v i e w p o r t l } GSELNT(1) { s e l e c t norm t r a n s l } GCSGWK(2,3) {copy seg3 t o works2} GDAWK(2) { d e a c t i v a t e works2} GCLWK(2) { c l o s e works2} GCLWK(1) { c l o s e w o r k s l }

28 - A D i s p l a y

the

i n both

WORKSTATION p l o t t e r , s c r e e n TRANS n1,n2 n1 = DISPLAY house ON p l o t t e r WITH n1 Figure

type

t h e f u n c t i o n s o f t h e GKS s y s t e m a r e

p e r f o r m e d a s u n i t s by HL/GKS.

CALL CALL CALL CALL CALL CALL CALL CALL CALL

Type

more

o f HL/GKS a i d i n d e t e c t i n g m i s m a t c h e d

types,

GKS a n d HL/GKS a r e shown

from

types,

Fragment i n GKS and HL/GKS Language

43

4.3 HL/GKS

Implementation

HL/GKS i s i m p l e m e n t e d a s a h i g h - l e v e l the is

basis

The

o f t h e GKS s y s t e m by a p r e c o m p i l e r .

specified

generated

by

with

files

two

separate

but

t h e Top-Down C o m p i l e r

global source

file

file

BNF d e s c r i p t i o n i n standard

c o n t a i n s the syntax

language;

the g l o b a l

actions.

The i n t e r f a c e

TD s y s t e m

i s shown

file

and

[Schr82].

file,

PASCAL. and semantics

i s designated

Global

>

Semanti

^

precompiler

library.

HL/GKS p r o g r a m

the

semantics

o f HL/GKS t o t h e CWS-

CWS-TD > Precompiler

System

translates

i n t o GKS s u b r o u t i n e s the

of

for additional

29 - The I n t e r f a c e o f t h e P r e c o m p i l e r t h e CWS-TD System

by

rules

i n F i g u r e 29.

^

HL/GKS p r o g r a m

runtime

files

W r i t i n g System

( optional')

compiled

The p r e c o m p i l e r

interrelated

of the precompiler

Source

Figure

The

on

of the precompiler a r e : integrated

The

g r a p h i c s language

FORTRAN

graphical

i s illustrated

of

statements

i n v o c a t i o n s which

77 c o m p i l e r

The s e q u e n c e

o f HL/GKS t o

and e x e c u t e d

transformation

i n F i g u r e 30.

of

are

with steps

an then

t h e GKS of

a

44

OJ Tj

O O

•e ro

5

Ni cn CO o t_ CU

i l a t i o n> .P r e c o m p_

cn o CL

, OJ 'PIE CHARTS' AT (-0.6,1.7); 'FIRST' AT (-0.25,1.3) CLOSE PIE= PIE+PART DISPLAY P I E ON PLOTTER DISPLAY TITLE+PATHS ON PLOTTER DISPLAY PICTURE ON PLOTTER STOP END { GET SOME PART OF A CIRCLE } { } SUBROUTINE GETP(A1,A2,POINT) VECTOR P 0 I N T O 8 ) , DIST REAL RADIUS BEGIN I F (A1.LT.0.0) THEN A1= 360.+A1 END I F I F (A2.LT.0.0) THEN A2= 360.+A2 END I F ANGLE= A1 R1=((A2-A1)/2.+A1)*3.14159/180. DIST= (0.1*COS(R1), 0.1*SIN(R1)> POINT(1)= (DIST.XCOORD,DIST.YCOORD) POINT(18)= POINT(1)

ADDING=

(A2-A1)/14.

DO

10 1=1,15 RADIUS= ANGLE*3.14159/180. P0INT(I+1)= (COS(RADIUS)+DIST.XCOORD, SIN(RADIUS)+DIST.YCOORD) ANGLE= ANGLE+ ADDING CONTINUE RADIUS= A2*3.14159/180. POINT(17)= (COS(RADIUS)+DIST.XCOORD, SIN(RADIUS)+DIST.YCOORD) RETURN END { GET A LABELLING BLOCK } { } SUBROUTINE BLOCK(A,VS,PS,VT) VECTOR V S ( 5 ) , VT VECTOR P S ( 5 ) BEGIN A= A*3.14159/180. VT= ( 0 . 7 * C O S ( A ) , 0 . 7 * S I N ( A ) ) DO

10 1=1,5 P S ( I ) = (VS.XCOORD(I)+VT.XCOORD, VS.YCOORD(I)+VT.YCOORD) CONTINUE RETURN END

PJtf

CHARTS

flPIT

{ , < I d e n t i f i e r > } | DATA < I d e n t i f i e r > / { ; } /

0

0

VECTOR SEGMENT TRANS WORKSTATION

::=

::= ::=



0 |

::=

+| -|

::=

< D i g i t >

::=

V

H V

9 J

X

J X

) |

::= < F i r s t

: : =

{

}

0





1 4

Int>

< F i r s t Int>::== 1 b P B P

}

. {}!

,

< C l e a r Works>

},

: : = OPEN < I d e n t i f i e r > { { ABOVE

k y K Y

m| n M| N

96

|BELOW } < I d e n t i f i e r > | } }^ CLOSE ::=

WITH { < I d e n t i f i e r > | } |

::= < { FROM TO ::=







< I d e n t i f i e r > | ( , )

::= CALL | WHILE ( < B o o l e a n Exp> ) DO ENDWHILE | REPEAT UNTIL ( < B o o l e a n Exp> ) CLIPPING ON CLIPPING OFF < I d n e t i f i e r > ( } ::=



|

< E x p r e s s i o n > : : =

{ { +| - }

::= < F a c t o r > { { *| /| . } < F a c t o r > ::=

< I d e n t i f i e r > ( )

::=

: : =

} }

0

0



< { AT: SHIFT: ROT: { { D| | } SCALE: )i >



}

)

97

::=

POLYLINE < I d e n t i f i e r > ( ) { ; < I d e n t i f i e r > ( ) } | POLYMARKER < I d e n t i f i e r > { ( ) | } { ; < I d e n t i f i e r > { ( ) | } } | TEXT < S t r i n g > AT { ; < S t r i n g > AT } | FILLAREA < F i l l a A t t r i > < I d e n t i f i e r > ( ) { ; < I d e n t i f i e r > ( ) } | CELLARRAY < C e l l a A t t r i > < I d e n t i f i e r > ( , ) { ; < I d e n t i f i e r > ( , ) } 0

0

0

0

0

::= TYPE

: { I

::= COLOUR ::=

: : =


|} , H >

< { FONT : { < S t r i n g > | } PREC : { < S t r i n g > | } EXP : { | } SPACE : { | } HEIGHT : { | } UPVEC : ( < E x p r e s s i o n > , ) PATH : { < S t r i n g > | } ALIGN : { < S t r i n g > I }

98

TABLE : { |}

I , }, >

| ::=

< { INSIDE

: { | } { = { PSIZE: ( | PREF: ( < E x p r e s s i o n >

}i )o : { | } TABLE : { |}

| STYLE

I ,

::=

::=

1


},

: : = {

>

),

;

1

( { < I d e n t i f i e r > } { , { < I d e n t i f i e r > } } ) | } 0

::=

::=

RENAME < I d e n t i f i e r > AS < I d e n t i f i e r > | DELETE < I d e n t i f i e r > { , < I d e n t i f i e r > { FROM < I d e n t i f i e r > { , < I d e n t i f i e r > | } REDRAW < I d e n t i f i e r > { , < I d e n t i f i e r >

::= MESSAGE < S t r i n g > ON < I d e n t i f i e r > { , < I d e n t i f i e r > : : =


| } ) < I d e n t i f i e r > { ( { | } ) | } { , < I d e n t i f i e r > { ( { | } ) | } } 0

::= SEND { , } TO < I d e n t i f i e r > { , } DISPLAY { < I d e n t i f i e r > } + } { < I d e n t i f i e r > | } } ON < I d e n t i f i e r > } 0

0

0

0

< C l e a r Works>::= ERASE < I d e n t i f i e r > { , ::=



}

0

{ SUBROUTINE | FUNCTION } { ( { ,

{ : OPEN | } { : OPEN |} } 0

). | { } BEGIN RETURN END 0

::= CHARACTER

{ * |

COMPLEX DOUBLE PRECISION INTEGER LOGICAL REAL

}

}

1 00

APPENDIX B - RESERVED WORDS AND SYMBOLS F o r HL/GKS, a s an e x t e n d e d l a n g u a g e , t h e r e a r e g r a p h i c a l symbols a n d r e s e r v e d keywords w h i c h a r e p a r t o f t h e s y n t a x definition. The c o m p l e t e s e t a r e shown i n t h e two t a b l e s b e l o w . Graphical ( )

Symbols

: *

/

>

Reserved BEGIN SEGMENT CLOSE DELETE TO CLIPPING WHILE UNTIL ABOVE REDRAW ROT POLYLINE FILLAREA INVISIBLE COLOUR FONT SPACE PATH PSIZE RANGE

Keywords

OPEN TRANS RENAME FROM DISPLAY OFF REPEAT WITH BELOW AT D TEXT CELLARRAY NORMAL TYPE PREC HEIGHT ALIGN PREF MAXROW

VECTOR WORKSTATION AS SEND ON DO ENDWHILE MESSAGE ERASE SHIFT SCALE POLYMARKER VISIBLE HIGHLIGHT TABLE EXP UPVEC INSIDE STYLE

101

APPENDIX C - EXECUTION

INSTRUCTIONS

As f o r t h e i n s t a l l a t i o n of GKS FORTRAN b i n d i n g i n UBC, a l l workstation outputs are assigned to i n d i v i d u a l output m e t a f i l e s , w h i c h a r e t h e n t r a n s l a t e d i n t o t h e g r a p h i c a l f i l e of e a c h t e r m i n a l by p o s t - p r o c e s s o r s . The name of e a c h o u t p u t m e t a f i l e i s t h e f i r s t s i x c h a r a c t e r s of t h e t r a n s l a t e d w o r k s t a t i o n name, b e g i n n i n g w i t h t h e minus s i g n as a t e m p o r a r y o u t p u t file. F o r i n s t a n c e , t h e m e t a f i l e name of t h e w o r k s t a t i o n s c r e e n w i l l be t h e name -SCREEN. There are t h r e e m e t a f i l e p o s t - p r o c e s s o r s ( f o r the T e k t r o n i x 4027, P r i n t r o n i x p r i n t e r , and p l o t f i l e ) a v a i l a b l e t o view t h e m e t a f i l e o u t p u t from GKS. A d e t a i l e d d e s c r i p t i o n of m e t a f i l e p o s t - p r o c e s s o r s i s p r o v i d e d i n t h e w r i t e - u p UBC G K S [ M a i r 8 4 ] , HL/GKS p r o g r a m s can be i n t e r a c t i v e l y e x e c u t e d by b u i l t - i n macros. An example of HL/GKS i n t e r a c t i v e e x e c u t i o n i s shown below where t h e l o w e r - c a s e l i n e s r e p r e s e n t t h e p r o m p t s of a t e r m i n a l w h i l e t h e u p p e r - c a s e ones a r e t h e i n p u t s t r i n g s of a user. $HLGKS go1 $r HL:GKS go2 $r FORTRANVS go3 $r -fort+GKS:GKS " g i v e t h e s t e p name. G01 " g i v e t h e name of y o u r f i l e . TEST n e x t s t e p i s go2. "do you want t o c o n t i n u e ? Yes n e x t s t e p i s go3. "do you want t o c o n t i n u e ? YES $ A r b i t a r y e n t r a n c e t o t h e e x e c u t i o n s t e p s can be s e l e c t e d by t h e i n p u t of G01, Go2, or Go3 r e s p e c t i v e l y . Freedom of c o n t i n u o u s p r o c e s s i n g i s p r o v i d e d w i t h t h e i n q u i r y prompt (do you want t o c o n t i n u e ? ) w h i c h can be r e p l i e d t o w i t h Y, YES, OK, N, or NO. Any e r r o r i n t y p i n g c a u s e s a r e t u r n w i t h some w a r n i n g information provided. An example o f s i n g l e e x e c u t i o n of s t e p G02 i s g i v e n b e l o w . $HLGKS go1 $r HL:GKS go2 $r FORTRANVS go3 $r -fort+GKS:GKS " g i v e t h e s t e p name. G02 n e x t s t e p i s go3. "do you want t o c o n t i n u e ? $ The

running

instructions

of

the

NO post-processors

are:

1 02

$run $run $run

( t r a n s l a t i o n to Tektronix) GKS:Metint427 s c a r d s = m e t a f i l e , ( t r a n s l a t i o n to p r i n t r o n i x printer) GKStMetintptx scards=meatfile, ( t r a n s l a t i o n to p l o t f i l e ) GKS:Metintplt scards=metafile.

For d e t a i l e d running GKS[Mair84].

steps, refer

to the write-up

of

UBC

103

APPENDIX

C C C

D - A SAMPLE OF GKS OBJECT CODE

T h i s i s a sample of preprocessor

GKS c o d e s p r o d u c e d

REAL GV1X( 5),GV1Y( 5) REAL GV2X( 5),GV2Y( 5) REAL GV3X( 5),GV3Y( 5) REAL GV4X( 7),GV4Y( 7) REAL GVX, GVY CHARACTER*4 GWF1 CHARACTER*4 GWF2 REAL GTRAN1(2,3), GTRAN2(2,3) INTEGER G P 0 L Y L O 3 ) ,GP0LYM(13) INTEGER G T E X T ( 1 3 ) , G F I L L ( 1 3 ) , G G ( 1 3 ) CHARACTER*4 GF REAL GAX(100),GAY(100) INTEGER GT,GN,GSTAT 0, 50, 0. 70, 0, 20, DATA GV1X/ 0, 50, 0, 50, 0 DATA GV1 Y/ DATA 1/2/ DATA GV2X/ 20, 0.70, 0, 50, 0 DATA GV2Y/ 0, 50, 0, 50, , 0 DATA GV4X/ , 5.00, 5, 00, 2, 50, / , 0 3.20, 4.00, DATA GV4Y/ , 0 /

by t h e HL/GKS

0 0

/ /

0.20/

/

3.20, 0

C C GKS-system i n i t i a l i z a t i o n 1 DATA GPOLYL/0,0,0,1, 1,1.1.1.1 1/ 1,0,0 0 DATA GPOLYM/1 1/ , 1 , 1,1, DATA GTEXT /1 1.1.1 1 ,0,0,0,0,1,1,1/ DATA G F I L L /1 1 , 1, 1 , 1 1,1,1,1,1,0,0,0/ DATA GG /1 1 , 1 , 1 , 1 1,1,1,1,1,1,1,1/ GF='-ERR' OPEN(UNIT= 2 0,FILE=GF,STATUS='UNKNOWN' ) CALL GOPKS(20) CALL GOPWK(1,8,100) CALL GACWK(1) GWF1='-PLOTTE' STATUS='UNKNOWN') OPEN(UNIT=14,IOSTAT=IOS,FILE=GWF1 CALL GOPWK( 2,14,100000) GWF2='-SCREEN' OPEN(UNIT=15,1OSTAT=IOS,FILE=GWF 2,STATUS='UNKNOWN' ) CALL GOPWK( 3,15,100000) CALL GMSG( 3,'WELCOME TO GKS' ) CALL GSWN( 1,0.0,5.0,0.0,7.0) CALL GSVP( 1,0.0,0.45,0.2,1.0) CALL GSWN( 2,1.5,3.5,0.0,7.0) CALL GSVP( 2,0.75,0.85,0.2,1.0) CALL GSELNT( 1) CALL GCRSG( 3)

CALL GSLN( 3) CALL GPL( 5,GV1X, GV1Y) CALL GCLSG CALL GCRSG( 5) GV3X(1)=0.0 GV3Y(1)=0.0 GV3X(2)=1.0 GV3Y(2)=0.0 GV3X(3)=1.0 GV3Y(3)=1.5 GV3X(4)=0.0 GV3Y(4)=1.5 GV3X(5)=0.0 GV3Y(5)=0.0 GVX=0.8 GVY=0.7 CALL GSLN( 1) CALL GPL( 5,GV3X, GV3Y) CALL GSMK( 4) CALL GPM(1,GVX, GVY) CALL GCLSG CALL GCRSG( 1) CALL GPL( 6,GV4X, GV4Y) CALL GCLSG CALL GCRSG( 7) CALL GEVTM(0.,0.,0.,0.,0. CALL GINSG( 1,GTRAN1) CALL GEVTM(0.,0.,2.0,0.0, CALL GINSG( 5+1 -1,GTRAN1) CALL GEVTM(0.,0.,0.6,2.0, CALL GINSG( 3+1 -1 ,GTRAN1) CALL GEVTM(0.,0.,3.7,2.0, CALL GINSG( 3+1 -1 ,GTRAN1) CALL GCLSG CALL GDSG( 1) CALL GRENSG( 7, 1) CALL GSELNT( 2) CALL GCRSG( 4) CALL GSLN( 3) CALL GPL( 5,GV2X, GV2Y) CALL GCLSG CALL GCRSG( 6) CALL GSLN( 1) CALL GPL( 5,GV3X, GV3Y) CALL GSMK( 4) CALL GPM(1,GVX, GVY) CALL GCLSG CALL GCRSG( 2) GV4X(4)=3.0 GV4Y(4)=3.7 GV4X(5)=2.0 GV4Y(5)=3.7 GV4X(6)=0.0 GV4Y(6)=3.2

1.,1.,0,GTRAN1) 0

,1.0,1.0,0,GTRAN1)

0

,1.0,1.0,0,GTRAN1)

0

,1.0,1.0,0,GTRAN1)

105

CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL

GPL( 7,GV4X, GV4Y) GSCHSP( 1.5) GSCHH( 0.10) GTX(1.0,5.0,'WELCOME GCLSG GCRSG( 7) GEVTM(0.,0.,0.,0.,0. GINSG( 2,GTRAN1) GEVTM(0.,0.,2.0,0.0, GINSG( 5+2-1,GTRAN1) GEVTM(0.,0.,0.8,2.0, GINSG( 3+2-1,GTRAN1) GEVTM(0.,0.,3.7,2.0, GINSG( 3+2-1,GTRAN1) GCLSG GDSG( 2) GRENSG( 7, 2) GACWK( 2) GSHLIT( 1+1-1,1) GCSGWK( 2, 1 +1 -1) GDAWK( 2) GACWK( 2) GSHLIT( 1+2-1,0) GCSGWK( 2, 1+2-1) GDAWK( 2) GMSG( 3,'GOODBYE')

C C GKS-SYSTEM CLOSE CALL GDAWK(1) CALL GCLWK(1) CALL GCLWK( 2) CALL GCLWK( 3) CALL GCLKS STOP END

TO GKS') 1.,1.,0,GTRAN1) 0

,1.0,1.0,0,GTRAN1)

0

,1.0,1.0,0,GTRAN1)

0

,1.0,1.0,0,GTRAN1)

Suggest Documents