{this document gives the specification of new version of IIUWGRAPH
class
made in October 1994 by Frederic Pataud à Pau}
and added to Loglan system by Danuta Szczepanska 1987,
the recent versions were done at LITA, Pau,
by
Pawel Susicki (1991) for Unix,
Sebastien Bernard (1992) for ATARI, see a separate document,
Eric Becourt et Jerôme Larrieu (1993) for Unix and Xwindows, see a
separate document on Xiiuwgraf ,
fait à Pau, le 15 Novembre 1994, par Andrzej Salwicki, LITA}
{ the predefined class IIUWGRAPH is included in all versions of interpreter of Loglan, with the exception of the present version of interpreter for VAX/VMS.}
hidden MaxX, MaxY, current_X, current_Y, is_graphic_On, current_Colour, current_Background_Colour, current_Style, current_Palette, current_Pattern ; const MaxX = MaxY = { the screen's coordinates are (0,0) ----------------------> (MaxX,0) ¦ ¦ ¦ V (0, MaxY) (MaxX,MaxY) } var currentDriver : integer, { see NOCARD below } current_X, current_Y: integer { it is the current position } is_graphic_On: Boolean, { evidently tells whether we are in graphics mode } current_Colour : integer, { } current_Background_Colour : integer, current_Style : integer, { } current_Palette : integer, current_Pattern
An execution of instruction call gron(i) must precede any of the graphic commands described below.
case (i) { 0 : 640x480x16 1 : 640x480x256 2 : 800x600x16 3 : 800x600x256 4 : 1024x768x16 5 : 1024x768x256 6 : 1280x1024x16 7 : 1280x1024x256 8 : 1600x1280x16 9 : 1600x1280x256 }
DO NOT FORGET to set the monitor in the text mode before you terminate your program
}
}
of current color and background color (for mono -
white and black, respectively) according to 5 predefined
patterns:
0 .... 1 **** 2 ***. 3 **.. 4 *.*. 5 *...where '*' means current color, '.' background colour
When drawing the segments the subsequent pixels will have colour determined by cyclic application of style pattern. The first and the last pixels of a segment will have always current colour.
When filling contours the given style will be applied to horizontal lines with even coordinate. The style for odd lines is determined automatically.
The same applies for perpendicular lines.
}
{ sets actual background color to i ( i = 0,1,...,15 ) }
the codes of colors are usually i.e. when you have 16 colours, as follows
0 black 1 blue dark 2 green dark 3 turquoise dark 4 red dark 5 violet 6 brown 7 grey light 8 grey dark 9 blue 10 green 11 turquoise 12 red light 13 rose 14 yellow 15 white}
x - column,
y - line }
{ precondition of MOVE: 0<x<MaxX & 0<y<MaxY }
The stack is kept internally, max depth is 16
}
{ Example
unit DIAGONAL : procedure; var ix, iy : integer; begin call PUSHXY; ix := INXPOS; iy := INYPOS; call DRAW(ix+10, iy+10); call POPXY end DIAGONAL;}
}
moves to pixel (x,y) and returns its color setting;
}
draws a line from current screen position to (x,y);
sets current position to (x,y);
line is drawn in current color, with both terminal pixels
always turned white ( non-background) for non-black
( non-background ) line color.
}
{
draws a circle (or ellipse, depending on aspect value, see below),
optionally filling its interior;
does not preserve position;
(xi,yi) - are center coordinates,
rx - radius in pixels (horizontally),
ry - radius in pixels (perpendicularly),
alfa, beta - starting & ending angles; if alfa=beta a full
circle is drawn; values should be given in radians;
cbord - border color,
fill - if fill < > 0, interior is filled in current style& color
}
(x,currentY) with the current color, after it change the current
position to (x, currentY)
}
(currentX,y) with the current color, after it change the current
position to (currentX,y)
}
color c (the current color is not change). if b=0 then the box is
empty else it is filled.
}
top left corner and (ix,iy) as bottom right corner,
including border lines;
position remains unchanged.
array of integer should have
4+(rows**columns/8* *coeff)
bytes. The coefficient coeff is 1 for Hercules, 2 for CGA, 4 for EGA
card.
ATTENTION: in DOS 286 environment a bigger size of the array may necessitate the use of loglan with the option H+, see also memavail
}
by "getmap" in "iarray";
same size is restored, with top left corner in current
position;
position remains unchanged.
}
rather than just set.
}
rather than just set.
}
s is the string to be shown, in front_col colour letters on the back_col colour background
}
}
0 is returned if buffer is empty;
special keys are returned as negative numbers;
ALT-NUM method may be used for entering character codes
above 127 (this makes entering special keys 128-132
impossible);
if a character is returned, it is also removed
from the buffer, so MS-DOS will not see it (CTRL-C!);
typeahead is allowed, echo is suppressed.
}
in the current position;
moves current position by (8,0);
call hascii(0)- sets complete box to black ( =background ),
with no change in position.
}
the colour of the window is col_f,
the colour of the digits is col_e,
the colour of cursor is col_c
reads in graphic mode an integer in the window which begins at the (x,y) position, window is lg caracteres long. the maximum length of the
integer that is read is 10. there is a default value, a minimum value and a maximum value. the window is drawn with the col_f color, the cursor is in the col_c color and the integer is writing in the col_e
color. you can use 0..9,+,-,backspace,escape and return keys. }
the colour of the window is col_f,
the colour of the digits is col_e,
the colour of cursor is col_c
reads in graphic mode a text (i.e. an array of characters) in the window which begins at the (x,y) position, window is lg caracteres long. the maximum length of the text that is read is maxlg. there is a default text shown, the window is drawn with the col_f color, the cursor is in the col_c color and the integer is writing in the col_e
color.
You can use 0..9,+,-,backspace,escape and return keys. }
Making use of keys controlling the cursor {left, right, PgUp, PgDn}
the user can scroll the text (horizontally) in the window. Pressing the Enter key terminates the procedure}
end IIUWGRAPH;
You can safely skip the following french text if you can not read french.
It is put here for the convenience of my french students.
Une paire (1,1) va permettre de prendre en compte à la fois les événements de la souris et ceux du clavier; une paire (1,0) quand à elle ne prendra en compte que la souris. Pour une plus grande souplesse d'utilisation, il est possible lors du programme, après l'initalisation, de changer cette prise en compte, cela se fera par l'appel de la procedure getmovement, procédure ayant les mêmes paramètres (avec le même ordre) que la fonction init.
Pour detecter les événements, on utilisa la fonction getpress, qui retourne un booléen indiquant la présence ou l'absence d'événement (respectivement les valeurs true et false). Il est bon de noter qu'ainsi définie la fonction getpress n'est pas bloquante. Les paramètres en retour sont soit nuls (pas d'événement) soit correspondent:
bool:=getpress(v,p,h,l,r,c : integer);
v = position en y de la souris
p = keyboard status (Touche control_left,control_right, alt, alt_gr, shift_left, shift_right)
h = position en x de la souris
l = touche clavier
r = flags
c = boutons de la souris (0=aucun, 1=gauche, 2=droite, 3=gauche et droite)
Nb: le bouton central n'est pas géré.
NOTEZ BIEN! Lorsque les événements du clavier sont pris en compte dans le gestionnaire, il ne faut pas utiliser les fonctions d'entrées clavier readl, readln, hfont, hfont8, hpage, inkey,...) sous peine de plantage de l'ordinateur.
}
tells which events will be checked:
if checkMouse < > 0 then the events of Mouse will be reported to getpress, otherwise ignored;
if checkKeyboard < > 0 then the events of Keyboard will be reported to getpress, otherwise ignored
Attention please! While the events of the keyboard are taken under control by init or getmovement
do not use the functions or procedures: read, readln, hfont, hfont8, hpage, inkey that read keys
YOU RISK TO HANG YOUR SYSTEM!
}
end init
if checkMouse < > 0 then the events of Mouse will be reported to getpress, otherwise ignored;
if checkKeyboard < > 0 then the events of Keyboard will be reported to getpress, otherwise ignored
Attention please! While the events of the keyboard are taken under control by init or getmovement
do not use the functions or procedures: read, readln, hfont, hfont8, hpage, inkey that read keys
YOU RISK TO HANG YOUR SYSTEM!
end getmovement;
h = x coordinate of the cursor,
p = keybord status control_left,control_right, alt, alt_gr, shift_left, shift_right
l = code of key pressed
r = flags
c = buttons pressed (0=none, 1=left, 2=right, 3=both)
Nb: the middle button is not taken into account.
end getpress
end showcursor;
end hidecursor;
end MOUSE;
Program SystemeGraph; (* by Frederic Pataud, October 1994 *) Begin Pref iiuwgraph block (* inherit the graphic functions *) Begin Pref mouse block (* inherit the mouse functions *) (*********************************************************************) (* P r o g r a m m e P r i n c i p a l *) (*********************************************************************) var v,p,h,i : integer, l,r,c : integer, rep : arrayof char, d : boolean, xx,yy : arrayof integer, status,code,x,y,flags,button : integer; Begin call gron(0); (* enter the graphic mode *) call init(1,0); (* initialize the mouse, disregard the keyboard events, check for mouse events *) call showcursor; (* show cursor *) call patern(5,5,635,475,2,0); (* make a frame around the screen *) call outstring(10,10,"x=",2,0); call outstring(100,10,"y=",2,0); call outstring(10,30,"status = ",2,0); call outstring(10,50,"code = ",2,0); call outstring(10,70,"flags = ",2,0); call outstring(10,90,"button = ",2,0); call patern(100,210,300,320,3,1); (* make a rectangle filled in colour 3 *) array xx dim (1:6); array yy dim (1:6); xx(1):=410; yy(1):=10; xx(2):=450; yy(2):=30; xx(3):=460; yy(3):=50; xx(4):=430; yy(4):=80; xx(5):=420; yy(5):=40; xx(6):=480; yy(6):=30; call intens(6,xx,yy,8,1); (* show a polygon filled*) for i:=1 to 6 do yy(i):=yy(i)+100; od; call intens(6,xx,yy,15,0); (* show another polygon empty *) call cirb(500,300,50,40,100,3500,10,0); (* draw an empty pie or camembert *) call cirb(400,400,40,40,600,4000,11,1); (* draw a filled pie *) i:=hfont(100,350,6,-9999999,9999999,500,9,0,15); (* read integer from a window *) call hpage(100,400,10,unpack("Il fait beau dans ma verte campagne"),9,0); (* show text *) rep:=hfont8(100,430,10,80,unpack("tototutu"),9,0,15); (* read text *) call getmovement(1,1); (* take into consideration both key events and mouse events *) do d:=getpress(v,p,h,l,r,c); (* ask about an event *) if (d) then call outstring(10,400,"Event",2,0); call patern(80,25,130,100,0,1); call track(40,10,v,0,4); (* print integer *) call track(140,10,p,0,4); call track(80,30,h,0,4); call track(80,50,l,0,4); call track(80,70,r,0,4); call track(80,90,c,0,4); if((h=164 and l=27) or (c=3)) (* exit if either two buttons were pressed c=3 or Ctrl+Esc key *) then exit; fi; fi; od; call groff; (* leave the graphic mode and return to the text mode *) writeln("i=",i); for i:=lower(rep) to upper(rep) do write(rep(i)); od; writeln; End End End.