Lecture T2: The Design of Scout

Work of Simon Yung

insight into issues for the design of a definitive notation.

Design of SCOUT

primitives reflect nature of the screen and application

e.g. combinations of rectangular boxes for text layout

assumes special-purpose notations for any graphics

 

Role of SCOUT

• screen layout, scaling and operations at pixel level

• coordinates the use of different definitive notations

• gives basic text display facilities

 

[For serious text-processing require another definitive notation

e.g. can't control font size or get sophisticated layout]

 

SCOUT data types

 

Essential data types in SCOUT:

display, window, point, integer

 

Overall concept

 

definitive script in SCOUT defines state of the screen

screen is a special variable of type display

the display is made up out of windows

 

Simplest definition of screen has the form

screen = < win1 / win2 / win3 / win4 / win5 / .... >

where ordering of windows determines how they overlay

 

Alternatively can realise screen as union of displays

screen = disp1 & disp2 & disp3 & disp4 & ....

 

 

T2.1. The Window Data Type

 

Layout design in Scout addresses the following three questions

What are the things to be displayed?

Where are they to be displayed?

How are they to be displayed?

=> Scout window data type

 

The type window is a union of subtypes:

one subtype for each definitive notation

each subtype has a number of fields

the number and types of the fields vary with the subtype

 

In general, a window should have fields that define

1) which definitive notation is concerned

2) what information is to be displayed

e.g. which DoNaLD picture or which text string

3) the region of the screen

onto which the required information is mapped

4) the supplementary info that that definitive notation needs.

In the current design and implementation, have 3 window types:

the text window, the DoNaLD window and the ARCA window.

 

Form of text window definition

Text Window

field name

type

description

type

content

Must be the value TEXT

string

string

The string to be displayed

frame

frame

The region in which the string is shown

border

integer

Width of the border of the boxes of the frame

alignment

just

NOADJ, LEFT, RIGHT, EXPAND and CENTRE are the possible values to denote no alignment, left justification, right justification, left and right justification and centre of the text inside each box in the frame

bgcolour

string

Colour name for the background colour of the text

fgcolour

string

Colour name for the (foreground) colour of the text

where point = integer ¥ integer

box = point ¥ point

frame = list of box

 

Form of DoNaLD window definition

DoNaLD Window

field name

type

description

type

content

Must be the value DONALD

box

box

The region in which the DoNaLD picture is shown

border

integer

Set the border width of the bounding box

pict

string

The name of the DoNaLD picture

xmin

point

 

ymin

point

Show the portion of the DoNaLD picture

xmax

point

bounded by the points (xmin, ymin) and (xmax, ymax)

ymax

point

 

 

 

Comments on the window data types:

 

1) Easy to add other attributes to windows

 

2) There is no formal restriction on how to define a region.

By convention

• for a DoNaLD or ARCA window a region is defined by a box

• for a text window, a region is defined by a list of boxes

 

3) Graphics & text window subtypes almost no fields in common

type window may be better understood by the abstract formula

window = region ¥ content ¥ attributes

rather than by a concrete set of fields.

 

 

T2.2. The Display Data Type

A display is a collection of windows

windows may overlap, => a partial ordering among the windows

A display = a list (total ordering) of windows.

A display variable represents a conceptual screen

 

Special display variable screen denotes the physical screen

Variable screen maps onto the physical screen so that:

1) origin = the top-left corner of the physical screen

2) x-coordinate counts from the origin to the R, one unit per pixel

3) y-coordinate counts down from the origin, one unit per pixel.

 

Interpretation of the Scout notation is hardware-dependent

cf idealisation in other definitive notations

Appearance of screen for a given script of Scout definitions

depends on resolution and aspect ratio

 

T2.3. Other Data Types and Operators

Underlying algebra for Scout

Primary data types in Scout: integer, point, window and display

Associated basic operators for

integer arithmetic

vector manipulation,

list manipulation, construction and selection

 

No independent definitive notation for text – SCOUT handles text

use text window subtype

content is a string defined within Scout

NOT

virtual screen prescribed by an independent definitive notation

Hence string is also Scout data type with operators:

string concatenation (//)

string length function (strlen)

sub-string function (substr)

integer-to-string conversion (itos)

 

Text specification in SCOUT

 

Two special postfix operators – .r and .c

Basic geometric unit in Scout is pixel BUT

size of a block of text = "number of rows by number of columns"

.r : int Æ pixel is "multiply by the row height in pixels"

.c : int Æ pixel is "multiply by the column width in pixels"

For example, {10.c, 3.r} refers to

a point 3 rows down and 10 columns right to the origin

Use related convention for specification of box for text:

[{0, 0}, 3, 10] = box with origin as its top-left corner suitable

for displaying three rows by ten columns of text.

Region for text window is a frame = list of boxes

Put strings into frame by "filling boxes in order"