Next: 7.9 Unclassed
Up: 7 Internal programs
Prev: 7.7 Sorting and dichotomy
Contents
A certain number of routines were written to facilitate the implementation of the drivers:
SUBROUTINE GETUNF(UNIT, NAME, EXTEND) INTEGER UNIT CHARACTER NAME*(*) CHARACTER EXTEND*4
returns a free logical unit in UNIT to perform an OPEN. If name NAME exists already, an extension for NAME is found in EXTEND, if not EXTEND = ' '. NAME must be less than 64 characters.
SUBROUTINE RCHARS(TXT, STRING, L) CHARACTER*(*) STRING, TXT INTEGER L
prints string TXT concatenated with STRING(1:L), and then edits STRING:
Input: TXT*(*), STRING(1:L) (L> 0)
Output: L and STRING(1:L)
SUBROUTINE RINTG(TXT, VAL, VMIN, VMAX) CHARACTER*(*) TXT INTEGER VAL, VMIN, VMAX
prints string TXT and inputs VAL lying between VMIN and VMAX:
Input: TXT*(*), VMIN, VMAX
Output: VAL
SUBROUTINE RREAL(TXT, VAL, VMIN, VMAX) REAL VAL, VMIN, VMAX CHARACTER*(*) TXT
prints string TXT and inputs VAL lying between VMIN and VMAX:
Input: TXT*(*), VMIN, VMAX
Output: VAL
SUBROUTINE WCHARI(I, TXT) INTEGER I CHARACTER*(*) TXT
SUBROUTINE WCHARS(TXT) CHARACTER*(*) TXT
INTEGER FUNCTION LONGG(STRING) CHARACTER *(*) STRING
deletes the blanks to the left and right and frame the string on the left.
Input: STRING: the string under consideration
Output: STRING: the string framed on the left and without blanks , and
LONGG the number of characters in STRING on exit.
SUBROUTINE ENCOD(VAL,EPPS,TXT,LTXT) REAL VAL REAL EPPS CHARACTER*(*) TXT INTEGER LTXT
Input:
VAL: value to encode, and
EPPS: relative epsilon to determine if VAL is integer or real
Output:
TXT: the coding of VAL in characters, and
LTXT: the number of characters in TXT.
REAL FUNCTION DECOD(STRING) CHARACTER*(*) STRING
Input: STRING: the string to decode
Output: DECODE the value of the string
SUBROUTINE PPAUSE
INTEGER FUNCTION ZCENTR(CARAC, X, Y, TAILLE, DRWLIN) CHARACTER*1 CARAC REAL X, Y, TAILLE EXTERNAL DRWLIN
plots a generic centered character. It is used when the terminal
does not know how to plot a centered character.
This function can be used in a F3D driver or in a user program.
Plot character CARAC of size TAILLE at position X, Y, where:
X, Y: position of text in cm;
TAILLE: size of characters in cm;
DRWLIN: function to plot a line between two points whose coordinates are in cm, e.g. DRWLIN(X1, Y1, X2, Y2);
CARAC: the character to plot. The following characters are centered
. + * x X o O 0 ~ ^ |
The function returns the value 1 if it succeeded in plotting the character.
It returns the value 0 is it could not plot it.
SUBROUTINE ZCOLOR(ROUGE, VERT, BLEU, NBCOLO) INTEGER NBCOLO REAL ROUGE(0:NBCOLO-1), VERT(0:NBCOLO-1), BLEU(0:NBCOLO-1)
This subroutine enables lazy people to initialize a color table.
Note the color 0 is black...
However, dynamic people can do better for their particular terminal.
This function can be used in a F3D driver or in a user program.
On entry: NBCOLO: the number of colors
On exit: ROUGE, VERT, BLEU: the color table (the colors are 0...1)
SUBROUTINE SPINTC(HHMIN,HHMAX,NNCDEB,NNCFIN) REAL HHMIN,HHMAX INTEGER NNCDEB,NNCFIN
spins through the color table between hues HHMIN and HHMAX ( HHMIN and HHMAX = 0...1 ). The part of the color table which is modified lies between the indices NNCDEB and NNCFIN.
INTEGER FUNCTION ZFNDTC(RC, VC, BC, R, V, B, NBCOLO) REAL RC, VC, BC INTEGER NBCOLO REAL R(0:NBCOLO-1), V(0:NBCOLO-1), B(0:NBCOLO-1)
Generic subroutine , to search for the color closest to the color table.
It can serve as a model.
This function can be used in a F3D driver or in a user program.
It returns the index, in the color table, of the color closest to RC, VC, BC.
R, V, B: color table
NBCOLO: number of colors in the table
All the colors lie between 0. and 1.
SUBROUTINE ZGNUM(T1, T2, T3, IT1, IT2, IT3, STRING, ZGTXYC, MOUSE, N) CHARACTER*(*) STRING REAL T1(*), T2(*), T3(*) INTEGER IT1(*), IT2(*), IT3(*) INTEGER N EXTERNAL ZGTXYC
Generic GETNUM. This subroutine enables lazy people to obtain the function easily.
However, dynamic people can do better for their particular terminal.
This function can be used in a F3D driver or in a user program.
On entry:
T1(1): the abscissa of the beginning of the text to be printed in cm;
T2(1): the ordinate of the beginning of the text to be printed in cm;
STRING(1:IT1(1)): the text to be printed;
IT1(1): the number of characters in the text to be printed;
IT2(1): the type of number to by input (0 integer, 1 real, 2 boolean);
IT2(2): the constraint where:
0: no constraint, or
1, min and max constraint for the numbers;
The constraints are stored in:
IT3(1) = min, IT3(2) = max for integer number;
T3(1) = min, T3(2) = max for real numbers.
The external subroutine, ZGTXYC, has the following form:
SUBROUTINE ZGTXYC(X, Y, C, MOUSE, N) REAL X, Y { IN C.M. } INTEGER N CHARACTER*1 C,MOUSE(N)
On exit, according to the type, we have:
IT3(3): the integer or boolean number (0=true, 1=false);
T3(3): the real number.
If the user types (return), the variables are not modified on exit.
SUBROUTINE ZGTEXT(T1, T2, T3, IT1, IT2, IT3, STRING, ZGTXYC, MOUSE, N) CHARACTER*(*) STRING REAL T1(*), T2(*), T3(*) INTEGER IT1(*), IT2(*), IT3(*) INTEGER N CHARACTER*1 MOUSE(N) EXTERNAL ZGTXYC
Generic GETEXT. This subroutine enables lazy people
to obtain the function easily. However, dynamical people can do better for their
particular terminal.
This function can be used in a F3D driver or in a user program.
On entry:
T1(1): the abscissa of the beginning of the text to be printed, in cm;
T2(1): the ordinate of the beginning of the text to be printed, in cm;
STRING(1:IT1(1)): the non-editable text to be printed;
IT1(1): the number of characters in the text (not editable) to be printed;
IT2(1): the maximum number of characters to be input;
IT3(1): the number of characters in the initial editable text;
STRING(IT1(1)+1:IT1(1)+IT3(1)): the initial editable text.
Subroutine ZGTXYC has the following form:
SUBROUTINE ZGTXYC(X, Y, C, MOUSE, N) REAL X, Y INTEGER N CHARACTER*1 C,MOUSE(N)
On exit:
T3(1), T3(2): the abscissa and ordinate of the end of the text entered;
IT3(1) the number of characters entered;
STRING(IT1(1)+1:IT1(1)+IT3(1)): the text entered.
SUBROUTINE ZSTROK(T1, T2, T3, IT1, IT2, ZGTXYC, MOUSE, N) INTEGER IT1(*), IT2(*) REAL T1(*), T2(*), T3(*) INTEGER N CHARACTER*1 MOUSE(N) EXTERNAL ZGTXYC
Generic STROKE. This subroutine enables lazy people to obtain the function
easily. However, dynamic people can do better for their particular terminal.
This function can be used in a F3D driver or in a user program.
On entry:
IT1(1): the maximum number of points to input;
IT1(2): the constraint, where:
IT1(2) = 0: no constraints, and
IT1(2) = 1: two successive points on the curve input are separated by a minimum
of T3(1) cm. and a maximum of T3(2) cm.
Subroutine ZGTXYC has the following form:
SUBROUTINE ZGTXYC(X, Y, C, MOUSE, N) REAL X, Y EN C.M. INTEGER N CHARACTER*1 C,MOUSE(N)
On exit:
IT2(1): the number of points actually input;
T1: the array of x in cm;
T2: the array of y in cm.
SUBROUTINE ZTXT(TXT, N, X, Y, SENS, CTX, CTY, TAILLE, DRAWTX) CHARACTER*(*) TXT INTEGER N REAL X, Y, SENS, CTX, CTY, TAILLE EXTERNAL DRAWTX
plots a generic text by hardware. This subroutine is aimed at those
whose terminal does not know how to plot text obliquely, or
how to decentralize the text.
Note, the characters stay vertical, which makes the text almost illegible for certain angles...
This function can be used in a F3D driver or
in a user program.
Plot text TXT, of N characters, size TAILLE, direction SENS and centered at
CTX, CTY, at X, Y, where:
X, Y: the position of the text in cm;
SENS: the direction of the plot as a fractions of PI/2;
TAILLE: the size of the characters in cm;
CTX, CTY: the centering.
DRAWTX is a subroutine which plots a character of size TAILLE at a given position (in cm.). It has the form:
SUBROUTINE DRAWTX(CARAC, X, Y) CHARACTER*1 CARAC REAL X, Y
SUBROUTINE ZSFTXT(TXT, N, X, Y, SENS, CTX, CTY, TAILLE) CHARACTER*(*) TXT INTEGER N REAL X, Y, SENS, CTX, CTY, TAILLE
plots a generic text by software.
This subroutine is aimed at those
whose terminal does not know how to plot text obliquely, or
how to decentralize the text.
This function can be used in a F3D driver or in a user program.
Plot text TXT, of N characters, size TAILLE, direction SENS and centered at
CTX, CTY, at X, Y, where:
X, Y: the position of the text in cm;
SENS: the direction of the plot as a fractions of PI/2;
TAILLE: the size of the characters in cm;
CTX, CTY: the centering.
SUBROUTINE ZIVRVB(RIN,VIN,BIN,ROUT,VOUT,BOUT) REAL RIN,VIN,BIN,ROUT,VOUT,BOUT
computes the inverse color of RIN, VIN, BIN (red, green, blue) and outputs it in ROUT, VOUT, BOUT. The inverse color is the one which contrasts the most with color input.
SUBROUTINE ZIVHSL(HIN,SIN,LIN,HOUT,SOUT,LOUT) REAL HIN,SIN,LIN,HOUT,SOUT,LOUT
computes the inverse color of HIN, SIN, LIN (hue, saturation, light) and outputs it in HOUT, SOUT, LOUT. The inverse color is the one which contrasts the most with color input.
SUBROUTINE ZIVCOL(COLIN,COLOUT) INTEGER COLIN,COLOUT
computes the inverse color of the color with COLIN and outputs its number in COLOUT.