A FORTRAN IV subroutine DVITEM is now available on the ICL 1906A which reads an SD4020 tape and returns to a calling program values that indicate what graphical entity is present in the tape buffer. The routine is called once for each graphic entity. There are 2 further subroutines which return information about characters in the current text string - ISDCHA returns an SD4020 code, SPGCHA returns each character in SPROGS code. The routine CL15 unloads the magnetic tape.
Basically DVITEM performs the tasks of tape reading, instruction decoding and joining up of consecutive lines for the user; it should not be necessary for the calling program to concern itself with end-of-records, although a count is available in a COMMON block if necessary.
The information provided by DVITEM is structured in such a way that programs can be written in a moderately device-independent fashion. Codes 1-7 can be regarded as being applicable to other devices. Therefore, if it is necessary to produce further versions of VITEM for other graphic files, they can be based on this SD4020 version, and user programs will thus be similar.
DVITEM is provided in 2 versions and, since the calling FORTRAN program is different in the two cases, the user must make an initial decision about which version is used. One version is in the SPROGS library and is invoked automatically by the SPROGS macro; the other version can be used independently of SPROGS and is provided in a separate library, which the user must explicitly name.
Currently, DVITEM can process 500 lines per second mill-time.
SUBROUTINE DVITEM(IC,I,arg3,arg4,arg5,arg6)
None of the arguments are relevant on entry. IC and I (type INTEGER) are set to indicate the type of graphic entity which is next found in the tape buffer. If there are no further SD4020 orders in the buffer, a new record is read and the graphic entity is taken from that. The arguments arg3,...,arg6 are REAL in SPROGS and INTEGER if the non-SPROGS version is used. The significance of their values depends on IC and I and is shown in the table on the next page.
The first call to DVITEM initialises the tape, which is on channel MT15. In all cases X and Y are in SD4020 coordinates; (0,0) is in the top left corner.
Code 1: The same code is returned whether the instruction is arbitrary vector or axis.
Consecutive lines which are identical are amalgamated and a repeat count is returned to the caller. If 2 consecutive lines join and are approximately parallel, then they are regarded as one line. A similar comparison is then made with the next item in the buffer, if it is a line. The amalgamation of lines continues until either the next item is not a line or the line does not extend the currently saved line or the end of the tape record is reached.
To determine whether 2 lines are approximately parallel, suppose they are represented by (X1,Y1) to (X2,Y2) and (X2,Y2) to (X3,Y3), where the numbers are all integers. Then, the 3 points must satisfy:
(X1=X2=X3) and (Y3-Y2)*(Y2-Yl)>0 or (X3-X2)(X2-X1)>0 and (IDIFF=-1,0 or +1) where: IDIFF=(Y3-Y2)-IFIX(FLOAT((X3-X2)*(Y2-Y1))/FLOAT(X2-X1))
Code 2: This converts SD4020 codes 00 and 01. If the character is required in SPROGS code and the non-SPROGS version is being used, use the routine SPGCHA with an argument of 1 before calling DVITEM again.
Code 3: This converts SD4020 codes 20 and 22 (character string). If the character string ends with a RESET (code 56), a code 3 is indicated to the user on exit from DVITEM and the next exit from DVITEM returns a reset code (code 4/2).
If the string extends into the next tape record, DVITEM returns to the user at the end of the record (code 3) and, at the end of the string, it returns again, indicating a string drawn at the current point (code 3/1).
Code 4: Advance frame. Reset (DVITEM code 4/2 and SD4020 code 56) can occur as one control character in a text string or as one complete order.
INTEGERs for non-SPROGS version First 2 INTEGERSs, rest REAL for SPROGS version IC I arg3 arg4 arg 5 arg 6 class 1 N X Y dX dY Line from (X,Y) to (X+dx,Y+dy) repeated N times 2 - X Y C -1 Plot character with SD4020 code C at point (X,Y) (non-SPROGS version) . In SPROGS version, C is SPROGS character code, 2 - X Y C 0-15 Same but with specified intensity (arg6). 3 0 X Y N - Plot character string at (X, Y) 3 1 - - N - Same but at current point (rarely occurs). The string contains N characters. 4 0 - - - - Advance frame. 4 1 N - - - Advance repeat N times 4 2 - - - - Reset (SD4020 code 56) 5 N - - - - Filemark. N is count of filemarks to date. 6 - - - - - Read error. 7 N - - - - Invalid order code N. 8 N - - - - End-of-tape after N records 9 - - - - - Record too long 10 - X Y C - Expose heavy and plot C at (X,Y) (C as in IC=2 11 - X Y C - Expose light and plot C at (X,Y) (C as in IC=2) 12 C - - - - Select camera C 13 - - - - - Stop device 14 - - - - - Expand image 15 - - - - - Reduce image 16 - - - - - Project slide
Note: A hyphen indicates that the value is not significant.
Code 7: SD4020 codes recognized by DVITEM are those listed in the SPROGS Manual Appendix 10 with the addition of SD4020 code 01 for "plot character at specified intensity". Any others cause DVITEM to return code 7. The SD4020 order 12 is ignored. The SD4020 order 07 causes DVITEM to start the next tape record.
Codes 8-16: codes 8 and 9 refer to tape conditions. Codes 10-16 refer to orders which are specific to the SD4020.
When DVITEM returns a code 3, meaning a text string, it is necessary to use some functions to determine what characters are present. If code 2 is returned, the text string just has one character (in SPROGS, SPGCHA is superfluous with code 2).
SPGCHA
REAL FUNCTION SPGCHA(N)
This function has one integer argument N, whose value can be from 1 up to the number of characters in the current text string. The result of the function is the SPROGS code of the Nth character in the string.
The possible results are:
SPGCHA can only be used after DVITEM has indicated a text string or plot character; the next call to DVITEM may overwrite the character(s).
ISDCHA
INTEGER FUNCTION ISDCHA(N)
This function has one integer argument whose value can be from 1 up to the number of characters in the current text string. The result of the function is the SD4020 code of the Nth character in the string; no conversion is made.
The possible results are:
Note that when using the non-SPROGS version, ISDCHA is not necessary after a plot character order (see the table entry for code 2).
As for SPGCHA, the next call to DVITEM may overwrite the text string.
If we want to OUTPUT a frame of lines to the Tektronix (see SPROGS Paper 44 and 1906A Internal User Notice 93), we can set up the SPROGS device and regions and use DVITEM as follows (the example uses the SPROGS preprocessor):
: : *$START * STSPR C DON'T WANT 4020 AND LINEPRINTER * NOSD * NOLPG C SETUP SPROGs REGIONS AND TETRONIX DEVICE C WE WILL DRAW IN SPROGS REGION 2 * TKTRON * REGION 2 * LIMIT(0,1023,1023,0) * PLIMIT(1,244,0,1023,779) : : C IN SPR0GS WE NEED TO USE REALS 40 CALL DVITM(IC,I,A,B,C,D) IF(IC .NE. 1) GOTO 60 C VECTOR CALL SETXY(A,B) CALL TODXY(C,D) GOTO 40 60 IF(IC .NE.4) GOTO 120 C ADVANCE FRAME CALL ADVFLM C FINISH OFF OR GO ROUND AGAIN : : * ENDSPR C THIS SHOULD SORT OUT ERROR CODES C AND DEAL WITH THEM C AND OTHER 4020 CODES ALSO 100 CONTINUE : : : STOP *SEND END FINISH
If we want to output some text to the Tektronix, we can use any of the SPROGS fonts or simply use hardware characters:
C SETUP SPROGS REGIONS, PREPROCESSOR AND C TEKTRONIX AS IN EXAMPLE 1. ALSO SET CHARACTER SCALING * PLIMIT(1,244,0,1023,779) C CHOOSE A SUITABLE FONT (SEE SPROGS MANUAL FOR DETAILS) * GETFNT(2) * NUMBR(2) 40 CALL DVITEM(IC,A,B,C,D) IF(IC .NE. 2) GOTO 60 C PLOT CHARACTER - IGNORE INTENSITY C IN SPROGS WE DON'T NEED THE SPSCHA FUNCTION HERE CALL SETXY(A,B) CALL DRAW(C) 60 IF(C .NE. 3) GOTO 120 C TEXT CALL SETXY(A,B) L=IFIX(C) DO 100 INDEX=1,L CALL DRAW(SPGCHA(INDEX)) 100 CONTINUE GOTO 40 C OTHER CODES 122 CONTINUE : : :
If the SD4020 tape is finished with before the end of the run, use the subroutine CL15 to unload it and free the tape deck for another job, thus:
CALL CL15
Any use of DVITEM after this will cause error codes.
The program description must include:
COMPRESS INTEGER AND LOGICAL
If using SPROGS, other program description statements must be included (see SPROGS Manual Appendix 12).
DVITEM requires #MTI5 parameter to the SPROGS macro specifying the name or number of the tape and a READ qualifier (see Appendix 12 of the SPROGS Manual).
It is possible to use a NOTAPE parameter if no output SD4020 tape is required.
OBEY :SPROGS.SPROGS, ....·....·..,NOTAPE, #MT15 (7000999) (READ), ...
If not using SPROGS, the subroutines can be obtained from a library file :RMAG.DVITEM. In his macro the user must also on-line channel MT15 to the desired SD4020 tape.
For example:
TASK F,*CRMAINPROG,JT40,MEDIA(TAPE7,l,(7000999),ER, LINK, LIB: RMAG.DVITEM,- #MT 15 (7000999) (READ) ,other task parameters., EXIT
The SPROGS version of DVITEM just uses SPROGS standard COMMON blocks. The non-SPROGS version uses COMMON block DVTM.
Available to the user:
FORTRAN DVITEM, ISDCHA, SPGCHA PLAN CL15 Others: FORTRAN PGERR, READSD, SDDCOD, SDTXT, STDVTM PLAN ATOINT, RDTAPE
SPROGS Manual (January 1974)
GROATS Manual (June 1973)
SPROGS Paper No 44: New output devices in SPROGS
1906A Internal User Notice 93: FRSPLIT macro