From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CUNYVM.CUNY.EDU::U0012%DGOGWDG5.BITNET" 30-AUG-1989 18:09
To:	MRGATE::"ARISIA::EVERHART"
Subj:	remainder of ZTDRIVER (1 of 1)

Message-Id:  <8908302153.AA20956@crdgw1.ge.com>
Received: from DGOGWDG5.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.2.1MX) with BSMTP id 6162; Wed, 30 Aug 89 17:51:57 EDT
Date:    Wed, 30 Aug 1989 23:39:04  +0200
From: "GWDGV1::MOELLER"  <U0012%DGOGWDG5.BITNET@CUNYVM.CUNY.EDU>
To: Everhart@Arisia.decnet
Subject: remainder of ZTDRIVER (1 of 1)

Glenn,

after packing & mailing the 2 preceding 2 parts, I thought I could
as well send you another mail of about the same size. So here goes ...

BTW, the UCBDEF.H I'm sending is now a single line, which makes
it clearer that it is not dependent on the VMS version.

$! ................... Cut between dotted lines and save. ...................
$!...........................................................................
$! VAX/VMS archive file created by VMS_SHARE V06.10 7-FEB-1989.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user MOELLER
$! on 30-AUG-1989 23:30:42.43.
$!
$! It contains the following 5 files:
$!        UCBDEF.H
$!        MTDEF.H
$!        IODEF.H
$!        ZT1.C
$!        ZT1T.C
$!
$!============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.10 7-FEB-1989 requires VMS V4.4 or higher."
$ EXIT 44 ! SS$_ABORT
$VERSION_OK:
$ GOTO START
$!
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY
b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) )
; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE
, b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors
:= 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN
& "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION
( BEGINNING_OF( b_part ) ); LOOP EXITIF SEARCH( SPAN( ' ' )@r_trail
& LINE_END, FORWARD) = 0; POSITION( r_trail ); ERASE( r_trail ); ENDLOOP
; POSITION( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK
( NONE ) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 )
; IF s_x = '+' THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip
<> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF
; ENDIF; IF s_x = '-' THEN r_skip := SEARCH( pat_end, FORWARD, EXACT )
; IF r_skip <> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip
:= MARK( NONE ); r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip
<> 0 THEN POSITION( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET )
; MOVE_VERTICAL( 1 ); MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part
) ); ENDIF; ERASE( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF
; IF s_x = 'V' THEN s_x := ''; IF i_append_line <> 0 THEN APPEND_LINE
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1
; MOVE_VERTICAL( 1 ); ENDIF; IF s_x = 'X' THEN s_x := ''; IF i_append_line
<> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF
; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> '' THEN i_errors
:= i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT
( "The following line could not be unpacked properly:" ); SPLIT_LINE
; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL
( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH
( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER
( 1 ); COPY_TEXT( ASCII( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDLOOP
; IF i_errors = 0 THEN SET( NO_WRITE, b_errors, ON ); ELSE POSITION
( BEGINNING_OF( b_errors ) ); COPY_TEXT( FAO
( "The following !UL errors were detected while unpacking !AS", i_errors
, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" )
; ENDIF; EXIT;
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!!,passed." )
$ RETURN
$!
$START:
$ FILE_IS = "UCBDEF.H"
$ CHECKSUM_IS = 1563770597
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X/*
X * this definition is valid for VMS versions  (...) 4.0 .. 5.1 (...)
X */
X#define`009UCB$M_VALID`0092048
$ GOSUB UNPACK_FILE

$ FILE_IS = "MTDEF.H"
$ CHECKSUM_IS = 1142296346
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X/*
X * definitions created by C_GBLINI at 23-JUN-1989 19:39:29.13
X */
X#define`009MT$M_SEREXCP`0091
X#define`009MT$M_ENSEREXCP`0094
X#define`009MT$M_PARITY`0098
X#define`009MT$M_FORMAT`009240
X#define`009MT$M_DENSITY`0097936
X#define`009MT$M_LOGSOFT`00916384
X#define`009MT$M_LOGSOFTOG`00932768
X#define`009MT$M_BOT`00965536
X#define`009MT$M_EOF`009131072
X#define`009MT$M_EOT`009262144
X#define`009MT$M_HWL`009524288
X#define`009MT$M_LOST`0091048576
X#define`009MT$M_SUP_NRZI`0092097152
X#define`009MT$M_SUP_PE`0094194304
X#define`009MT$M_SUP_GCR`0098388608
X#define`009MT$M_SPEED`009(-16777216)
X#define`009MT$K_DEFAULT`0090
X#define`009MT$K_NORMAL11`00912
X#define`009MT$K_CORDMP11`00913
X#define`009MT$K_NORMAL15`00914
X#define`009MT$K_NRZI_800`0093
X#define`009MT$K_PE_1600`0094
X#define`009MT$K_GCR_6250`0095
X#define`009MT$K_WOD_6250`0098
X#define`009MT$K_BLK_833`00917
X#define`009MT$K_BLK_1250`00918
X#define`009MT$K_SPEED_DEF`0090
X#define`009MT$K_SPEED_25`00925
X#define`009MT$K_SPEED_75`00975
X#define`009MT$S_MTDEF`0094
X#define`009MT$V_SEREXCP`0090
X#define`009MT$V_ENSEREXCP`0092
X#define`009MT$V_PARITY`0093
X#define`009MT$S_FORMAT`0094
X#define`009MT$V_FORMAT`0094
X#define`009MT$S_DENSITY`0095
X#define`009MT$V_DENSITY`0098
X#define`009MT$V_LOGSOFT`00914
X#define`009MT$V_LOGSOFTOG`00915
X#define`009MT$V_BOT`00916
X#define`009MT$V_EOF`00917
X#define`009MT$V_EOT`00918
X#define`009MT$V_HWL`00919
X#define`009MT$V_LOST`00920
X#define`009MT$V_SUP_NRZI`00921
X#define`009MT$V_SUP_PE`00922
X#define`009MT$V_SUP_GCR`00923
X#define`009MT$S_SPEED`0098
X#define`009MT$V_SPEED`00924
X/*
X * end of C_GBLINI definitions
X */
$ GOSUB UNPACK_FILE

$ FILE_IS = "IODEF.H"
$ CHECKSUM_IS = 7111405
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X/*
X * definitions created by C_GBLINI at 23-JUN-1989 19:40:16.87
X */
X#define`009IO$_NOP`0090
X#define`009IO$_UNLOAD`0091
X#define`009IO$_LOADMCODE`0091
X#define`009IO$_SEEK`0092
X#define`009IO$_SPACEFILE`0092
X#define`009IO$_STARTMPROC`0092
X#define`009IO$_RECAL`0093
X#define`009IO$_STOP`0093
X#define`009IO$_DRVCLR`0094
X#define`009IO$_INITIALIZE`0094
X#define`009IO$_RELEASE`0095
X#define`009IO$_SETCLOCKP`0095
X#define`009IO$_OFFSET`0096
X#define`009IO$_ERASETAPE`0096
X#define`009IO$_STARTDATAP`0096
X#define`009IO$_RETCENTER`0097
X#define`009IO$_QSTOP`0097
X#define`009IO$_PACKACK`0098
X#define`009IO$_SEARCH`0099
X#define`009IO$_SPACERECORD`0099
X#define`009IO$_READRCT`0099
X#define`009IO$_WRITECHECK`00910
X#define`009IO$_WRITEPBLK`00911
X#define`009IO$_READPBLK`00912
X#define`009IO$_WRITEHEAD`00913
X#define`009IO$_RDSTATS`00913
X#define`009IO$_CRESHAD`00913
X#define`009IO$_READHEAD`00914
X#define`009IO$_ADDSHAD`00914
X#define`009IO$_WRITETRACKD`00915
X#define`009IO$_COPYSHAD`00915
X#define`009IO$_READTRACKD`00916
X#define`009IO$_REMSHAD`00916
X#define`009IO$_AVAILABLE`00917
X#define`009IO$_SETPRFPATH`00918
X#define`009IO$_DSE`00921
X#define`009IO$_REREADN`00922
X#define`009IO$_REREADP`00923
X#define`009IO$_WRITERET`00924
X#define`009IO$_WRITECHECKH`00924
X#define`009IO$_READPRESET`00925
X#define`009IO$_STARTSPNDL`00925
X#define`009IO$_SETCHAR`00926
X#define`009IO$_SENSECHAR`00927
X#define`009IO$_WRITEMARK`00928
X#define`009IO$_WRTTMKR`00929
X#define`009IO$_DIAGNOSE`00929
X#define`009IO$_SHADMV`00929
X#define`009IO$_FORMAT`00930
X#define`009IO$_CLEAN`00930
X#define`009IO$_PHYSICAL`00931
X#define`009IO$_WRITELBLK`00932
X#define`009IO$_READLBLK`00933
X#define`009IO$_REWINDOFF`00934
X#define`009IO$_SETMODE`00935
X#define`009IO$_REWIND`00936
X#define`009IO$_SKIPFILE`00937
X#define`009IO$_SKIPRECORD`00938
X#define`009IO$_SENSEMODE`00939
X#define`009IO$_WRITEOF`00940
X#define`009IO$_TTY_PORT`00941
X#define`009IO$_LOGICAL`00947
X#define`009IO$_WRITEVBLK`00948
X#define`009IO$_READVBLK`00949
X#define`009IO$_ACCESS`00950
X#define`009IO$_CREATE`00951
X#define`009IO$_DEACCESS`00952
X#define`009IO$_DELETE`00953
X#define`009IO$_MODIFY`00954
X#define`009IO$_NETCONTROL`00954
X#define`009IO$_READPROMPT`00955
X#define`009IO$_SETCLOCK`00955
X#define`009IO$_ACPCONTROL`00956
X#define`009IO$_STARTDATA`00956
X#define`009IO$_MOUNT`00957
X#define`009IO$_TTYREADALL`00958
X#define`009IO$_TTYREADPALL`00959
X#define`009IO$_CONINTREAD`00960
X#define`009IO$_CONINTWRITE`00961
X#define`009IO$_VIRTUAL`00963
X#define`009IO$M_FCODE`00963
X#define`009IO$M_FMODIFIERS`00965472
X#define`009IO$M_INHERLOG`0092048
X#define`009IO$M_ERASE`0091024
X#define`009IO$M_ENCRYPT`0098192
X#define`009IO$M_DATACHECK`00916384
X#define`009IO$M_INHRETRY`00932768
X#define`009IO$M_INHSEEK`0094096
X#define`009IO$M_REVERSE`00964
X#define`009IO$M_NOWAIT`009128
X#define`009IO$M_INHEXTGAP`0094096
X#define`009IO$M_MSCPMODIFS`009256
X#define`009IO$M_SHADOW`00964
X#define`009IO$M_LOCATE`009128
X#define`009IO$M_ALLHOSTS`00964
X#define`009IO$M_DISSOLVE`009128
X#define`009IO$M_NOCLEANUP`009256
X#define`009IO$M_SPINDOWN`00964
X#define`009IO$M_FORCEPATH`00964
X#define`009IO$M_COMMOD`00964
X#define`009IO$M_MOVETRACKD`009128
X#define`009IO$M_DIAGNOSTIC`009256
X#define`009IO$M_SKPSECINH`009512
X#define`009IO$M_DELDATA`00964
X#define`009IO$M_NOMRSP`00964
X#define`009IO$M_SWAP`009256
X#define`009IO$M_OPPOSITE`009512
X#define`009IO$M_CLSEREXCP`009512
X#define`009IO$M_ACCESS`00964
X#define`009IO$M_CREATE`009128
X#define`009IO$M_DELETE`009256
X#define`009IO$M_MOUNT`009512
X#define`009IO$M_DMOUNT`0091024
X#define`009IO$M_REMOUNT`0092048
X#define`009IO$M_BINARY`00964
X#define`009IO$M_PACKED`009128
X#define`009IO$M_NOW`00964
X#define`009IO$M_READATTN`009128
X#define`009IO$M_WRTATTN`009256
X#define`009IO$M_SETPROT`009512
X#define`009IO$M_NORSWAIT`0091024
X#define`009IO$M_NOECHO`00964
X#define`009IO$M_TIMED`009128
X#define`009IO$M_CVTLOW`009256
X#define`009IO$M_NOFILTR`009512
X#define`009IO$M_DSABLMBX`0091024
X#define`009IO$M_PURGE`0092048
X#define`009IO$M_TRMNOECHO`0094096
X#define`009IO$M_REFRESH`0098192
X#define`009IO$M_ESCAPE`00916384
X#define`009IO$M_EXTEND`00932768
X#define`009IO$M_CANCTRLO`00964
X#define`009IO$M_ENABLMBX`009128
X#define`009IO$M_NOFORMAT`009256
X#define`009IO$M_BREAKTHRU`009512
X#define`009IO$M_NEWLINE`0091024
X#define`009IO$M_TYPEAHDCNT`00964
X#define`009IO$M_MAINT`00964
X#define`009IO$M_CTRLYAST`009128
X#define`009IO$M_CTRLCAST`009256
X#define`009IO$M_HANGUP`009512
X#define`009IO$M_OUTBAND`0091024
X#define`009IO$M_TT_CONNECT`0092048
X#define`009IO$M_TT_DISCON`0094096
X#define`009IO$M_TT_PROCESS`0098192
X#define`009IO$M_BRDCST`00916384
X#define`009IO$M_LOOP`009128
X#define`009IO$M_UNLOOP`009256
X#define`009IO$M_LINE_OFF`009512
X#define`009IO$M_SET_MODEM`0091024
X#define`009IO$M_LINE_ON`0092048
X#define`009IO$M_LOOP_EXT`0094096
X#define`009IO$M_AUTXOF_ENA`0098192
X#define`009IO$M_AUTXOF_DIS`00916384
X#define`009IO$M_INCLUDE`0092048
X#define`009IO$M_TT_ABORT`0094096
X#define`009IO$M_INTERRUPT`00964
X#define`009IO$M_MULTIPLE`009128
X#define`009IO$M_ABORT`009256
X#define`009IO$M_SYNCH`009512
X#define`009IO$M_RESPONSE`00964
X#define`009IO$M_STARTUP`00964
X#define`009IO$M_SHUTDOWN`009128
X#define`009IO$M_ATTNAST`009256
X#define`009IO$M_CTRL`009512
X#define`009IO$M_RD_MEM`00964
X#define`009IO$M_RD_MODEM`009128
X#define`009IO$M_RD_COUNT`009256
X#define`009IO$M_CLR_COUNT`0091024
X#define`009IO$K_SRRUNOUT`0090
X#define`009IO$K_PTPBSC`0098192
X#define`009IO$K_LOOPTEST`00957344
X#define`009IO$M_MORE`00964
X#define`009IO$M_QUALIFIED`009128
X#define`009IO$M_REDIRECT`00964
X#define`009IO$M_ACCEPT`009128
X#define`009IO$M_SETEVF`00964
X#define`009IO$M_WORD`00964
X#define`009IO$M_SETFNCT`009512
X#define`009IO$M_DATAPATH`0091024
X#define`009IO$M_CYCLE`0094096
X#define`009IO$M_RESET`0098192
X#define`009IO$M_SETCUADR`009256
X#define`009IO$M_SETBSIZE`009512
X#define`009IO$M_SETPOOLSZ`0091024
X#define`009IO$M_SETENQCNT`0092048
X#define`009IO$M_CLEAR`0094096
X#define`009IO$M_LPBEXT`0098192
X#define`009IO$M_LPBINT`00916384
X#define`009IO$M_READCSR`00932768
X#define`009IO$M_NOCTSWAIT`00964
X#define`009IO$M_SLAVLOOP`009128
X#define`009IO$M_NODSRWAIT`009256
X#define`009IO$M_MAINTLOOP`009512
X#define`009IO$M_LASTBLOCK`0091024
X#define`009IO$M_INTCLOCK`0094096
X#define`009IO$M_LT_CONNECT`00964
X#define`009IO$M_LT_DISCON`009128
X#define`009IO$M_LT_READPORT`009256
X#define`009IO$S_IODEF`0092
X#define`009IO$S_FCODE`0096
X#define`009IO$V_FCODE`0090
X#define`009IO$S_FMODIFIERS`00910
X#define`009IO$V_FMODIFIERS`0096
X#define`009IO$V_INHERLOG`00911
X#define`009IO$V_ERASE`00910
X#define`009IO$V_ENCRYPT`00913
X#define`009IO$V_DATACHECK`00914
X#define`009IO$V_INHRETRY`00915
X#define`009IO$V_INHSEEK`00912
X#define`009IO$V_REVERSE`0096
X#define`009IO$V_NOWAIT`0097
X#define`009IO$V_INHEXTGAP`00912
X#define`009IO$V_MSCPMODIFS`0098
X#define`009IO$V_SHADOW`0096
X#define`009IO$V_LOCATE`0097
X#define`009IO$V_ALLHOSTS`0096
X#define`009IO$V_DISSOLVE`0097
X#define`009IO$V_NOCLEANUP`0098
X#define`009IO$V_SPINDOWN`0096
X#define`009IO$V_FORCEPATH`0096
X#define`009IO$V_COMMOD`0096
X#define`009IO$V_MOVETRACKD`0097
X#define`009IO$V_DIAGNOSTIC`0098
X#define`009IO$V_SKPSECINH`0099
X#define`009IO$V_DELDATA`0096
X#define`009IO$V_NOMRSP`0096
X#define`009IO$V_SWAP`0098
X#define`009IO$V_OPPOSITE`0099
X#define`009IO$V_CLSEREXCP`0099
X#define`009IO$V_ACCESS`0096
X#define`009IO$V_CREATE`0097
X#define`009IO$V_DELETE`0098
X#define`009IO$V_MOUNT`0099
X#define`009IO$V_DMOUNT`00910
X#define`009IO$V_REMOUNT`00911
X#define`009IO$V_BINARY`0096
X#define`009IO$V_PACKED`0097
X#define`009IO$V_NOW`0096
X#define`009IO$V_READATTN`0097
X#define`009IO$V_WRTATTN`0098
X#define`009IO$V_SETPROT`0099
X#define`009IO$V_NORSWAIT`00910
X#define`009IO$V_NOECHO`0096
X#define`009IO$V_TIMED`0097
X#define`009IO$V_CVTLOW`0098
X#define`009IO$V_NOFILTR`0099
X#define`009IO$V_DSABLMBX`00910
X#define`009IO$V_PURGE`00911
X#define`009IO$V_TRMNOECHO`00912
X#define`009IO$V_REFRESH`00913
X#define`009IO$V_ESCAPE`00914
X#define`009IO$V_EXTEND`00915
X#define`009IO$V_CANCTRLO`0096
X#define`009IO$V_ENABLMBX`0097
X#define`009IO$V_NOFORMAT`0098
X#define`009IO$V_BREAKTHRU`0099
X#define`009IO$V_NEWLINE`00910
X#define`009IO$V_TYPEAHDCNT`0096
X#define`009IO$V_MAINT`0096
X#define`009IO$V_CTRLYAST`0097
X#define`009IO$V_CTRLCAST`0098
X#define`009IO$V_HANGUP`0099
X#define`009IO$V_OUTBAND`00910
X#define`009IO$V_TT_CONNECT`00911
X#define`009IO$V_TT_DISCON`00912
X#define`009IO$V_TT_PROCESS`00913
X#define`009IO$V_BRDCST`00914
X#define`009IO$V_LOOP`0097
X#define`009IO$V_UNLOOP`0098
X#define`009IO$V_LINE_OFF`0099
X#define`009IO$V_SET_MODEM`00910
X#define`009IO$V_LINE_ON`00911
X#define`009IO$V_LOOP_EXT`00912
X#define`009IO$V_AUTXOF_ENA`00913
X#define`009IO$V_AUTXOF_DIS`00914
X#define`009IO$V_INCLUDE`00911
X#define`009IO$V_TT_ABORT`00912
X#define`009IO$V_INTERRUPT`0096
X#define`009IO$V_MULTIPLE`0097
X#define`009IO$V_ABORT`0098
X#define`009IO$V_SYNCH`0099
X#define`009IO$V_RESPONSE`0096
X#define`009IO$V_STARTUP`0096
X#define`009IO$V_SHUTDOWN`0097
X#define`009IO$V_ATTNAST`0098
X#define`009IO$V_CTRL`0099
X#define`009IO$V_RD_MEM`0096
X#define`009IO$V_RD_MODEM`0097
X#define`009IO$V_RD_COUNT`0098
X#define`009IO$V_CLR_COUNT`00910
X#define`009IO$V_MORE`0096
X#define`009IO$V_QUALIFIED`0097
X#define`009IO$V_REDIRECT`0096
X#define`009IO$V_ACCEPT`0097
X#define`009IO$V_SETEVF`0096
X#define`009IO$V_WORD`0096
X#define`009IO$V_SETFNCT`0099
X#define`009IO$V_DATAPATH`00910
X#define`009IO$V_CYCLE`00912
X#define`009IO$V_RESET`00913
X#define`009IO$V_SETCUADR`0098
X#define`009IO$V_SETBSIZE`0099
X#define`009IO$V_SETPOOLSZ`00910
X#define`009IO$V_SETENQCNT`00911
X#define`009IO$V_CLEAR`00912
X#define`009IO$V_LPBEXT`00913
X#define`009IO$V_LPBINT`00914
X#define`009IO$V_READCSR`00915
X#define`009IO$V_NOCTSWAIT`0096
X#define`009IO$V_SLAVLOOP`0097
X#define`009IO$V_NODSRWAIT`0098
X#define`009IO$V_MAINTLOOP`0099
X#define`009IO$V_LASTBLOCK`00910
X#define`009IO$V_INTCLOCK`00912
X#define`009IO$V_LT_CONNECT`0096
X#define`009IO$V_LT_DISCON`0097
X#define`009IO$V_LT_READPORT`0098
X/*
X * end of C_GBLINI definitions
X */
$ GOSUB UNPACK_FILE

$ FILE_IS = "ZT1.C"
$ CHECKSUM_IS = 155736227
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X/*`009first test of ZTDRIVER ...
X`009w.j.m. jun 1989
X*/
X
X#ifndef TRACE
X#define TRACE 1
X#endif
X
V/* NOTE: following ZT definitions must match ZTDEF.MAR & ZTSERVER.MAR *******
X**/
X
Xtypedef struct ZTmsg `123
X`009unsigned short iosts;
X`009unsigned short iobct;
X`009unsigned long devdepend;
X`009long record;
X`009unsigned short ucbsts;
X`009unsigned short fill1;
X`009unsigned long devchar;
X`009unsigned short func;
X`009unsigned short bcnt;
X`009union `123
X`009`009short w[4];
X`009`009unsigned short uw[4];
X`009`009unsigned long ul[2];
X`009`125 media;
X`125 ZTmsg;
Xglobalref struct `123
X`009unsigned short l;
X`009unsigned short fill1;
X`009ZTmsg *p;
X`125 ZT_MSGDSC;
X
Xglobalref struct `123
X`009unsigned long bct;
X`009unsigned char *addr;
X`125 ZT_BUFDSC;
X
Xextern unsigned ZT_INIT(),ZT_WAIT(),ZT_TOUSER(),ZT_FRUSER(),ZT_REQCOM();
X
V/******* end of ZT definitions **********************************************
X**/
X
X
X#include ssdef
X
X#include "mtdef.h"
X#include "iodef.h"`009/* my own! */
X#include "ucbdef.h"`009/* note VMS version dependency */
X#include devdef
X
X#include stdio
X#include stddef
X#include string
X#include descrip
Xtypedef struct dsc$descriptor DESCR;
X
X#define CHECK(x) do `123unsigned s=x; if(!(s&1)) LIB$STOP(s);`125 while(0)
X#define FEHLER(m) do `123$DESCRIPTOR(d,m); Fehler(&d);`125 while(0)
X
Xvoid tape_init(void);
Xunsigned tape_writemark(void),
X`009tape_nop(void),
X`009tape_rewind(int/*logical*/ /*unload*/),
X`009tape_skiprec(int /*+-#blocks*/,int * /*#blocks skipped*/),
X`009tape_compare(int/*logical*/ /*reverse*/),
X`009tape_read(int/*logical*/ /*reverse*/,int/*logical*/ /*check*/),
X`009tape_write(int/*logical*/ /*check*/);
X
X/* data shared with 'tape' routines */
Xunsigned char *bufp;
Xunsigned long *bufbctp;
Xint /*logical*/ hw_online,hw_medonline,hw_bot,hw_eof,hw_eot,hw_hwl;
X
X
Xstatic ZTmsg *msgp;
X
Xstatic unsigned short fcode;
Xstatic unsigned short fmodif;
Xstatic enum `123no,yes,dunno`125 aftertm;`009/* tape positioned after mark? -
X`009`009`009`009`009shortcut to save tape movement */
X
X/*****/
X
Xstatic void do_init()
X`123
X`009tape_init();
X`009if(hw_bot) `123
X`009`009aftertm = no;
X`009`125 else `123
X`009`009aftertm = dunno;
X`009`125
X`125
X
Xstatic void do_writemark()
X`123
X`009/* fmodif: ... */
X
X`009msgp->iosts = tape_writemark();
X`009if(msgp->iosts & 1) `123
X`009`009msgp->record ++;
X`009`009aftertm = yes;
X`009`125
X`125
X
Xstatic void do_nop()
X`123
X`009/* give 'tape' a chance to update the state */
X`009msgp->iosts = tape_nop();
X
X`009/* 'aftertm' did not change, I hope ... */
X`125
X
Xstatic void do_rewind(int unload)
X`123
X`009/* fmodif: IO$M_NOWAIT ignored */
X
X`009msgp->iosts = tape_rewind(unload);
X`009msgp->record = 0;
X
X#if 0`009/* this works together with a VMS V.5 addition:
X`009   if tape is mounted foreign & MT$M_ENAUTOPACK is set,
X`009   then set UCB$M_VALID on "medium online" interrupt */
X`009/*...................................................*/
X`009if(!hw_medonline) `123
X`009`009msgp->ucbsts &= `126UCB$M_VALID;
X`009`125
X#endif`009/*...................................................*/
X`125
X
Xstatic unsigned set_aftertm()`009/* ggf. find out if tape is positioned
X`009`009`009`009`009after a tape mark */
X`123
X`009unsigned status;
X`009int sca;
X
X
X`009if(aftertm != dunno) return SS$_NORMAL;`009/* nothing to be done */
X
X`009status = tape_skiprec(-1,&sca);
X`009msgp->record -= sca;
X`009if(sca != 1) `123
X`009`009if(!hw_bot) `123
X`009`009`009return SS$_TAPEPOSLOST;
X`009`009`125 else `123
X`009`009`009aftertm = no;
X`009`009`009return SS$_NORMAL;
X`009`009`125
X`009`125
X`009status = tape_skiprec(1,&sca);
X`009msgp->record += sca;
X`009if(sca != 1) `123
X`009`009return SS$_TAPEPOSLOST;
X`009`125
X`009aftertm = hw_eof;
X`009return SS$_NORMAL;
X`125
X
Xstatic void`009/* "end of volume" recognized */
Xset_eov()`009/* backspace over 2nd eof mark, decrement spacing count etc. */
X`123
X`009unsigned status;
X`009int sca;
X
X
X`009status = tape_skiprec(-1,&sca);
X`009msgp->record -= sca;
X`009msgp->iobct --;
X`009if(!(status & 1) `124`124 !hw_eof `124`124 sca != 1) `123
X`009`009msgp->iosts = SS$_TAPEPOSLOST;
X`009`009aftertm = dunno;
X`009`125 else `123
X`009`009/* aftertm remains == yes */
X`009`009msgp->iosts = SS$_ENDOFVOLUME;
X`009`125
X`125
X
Xstatic void do_skiprec()
X`123
X`009int sc,sca;
X`009
X
X`009/* fmodif: ... */
X
X`009sc = msgp->media.w[0];
X`009if(sc == 0) `123
X`009`009do_nop();
X`009`009return;
X`009`125 else if(sc > 0) `123`009`009`009`009`009/* FORWARD */
X`009`009int/*logical*/ no_acp;
X
X
X`009`009no_acp =`009/* not mounted, or mounted foreign */
X`009`009`009((msgp->devchar & DEV$M_MNT) == 0) `124`124
X`009`009`009((msgp->devchar & DEV$M_FOR) != 0);
X`009`009if(no_acp) `123
X`009`009`009msgp->iosts = set_aftertm();
X`009`009`009if(!(msgp->iosts & 1)) return;`009/* ... tapeposlost */
X`009`009`125
X
X`009`009msgp->iosts = tape_skiprec(sc,&sca);
X`009`009msgp->record += sca;
X`009`009msgp->iobct = sca;
X
X`009`009if(!(msgp->iosts & 1)) `123
X`009`009`009aftertm = dunno;
X`009`009`125 else if(hw_eof) `123
X`009`009`009aftertm = yes;
X`009`009`009if(no_acp && (sca == 1)) `123
X`009`009`009`009/* "end of volume recognition" */
X`009`009`009`009set_eov();
X`009`009`009`125 else `123
X`009`009`009`009msgp->iosts = SS$_ENDOFFILE;
X`009`009`009`125
X`009`009`125 else `123
X`009`009`009aftertm = no;
X`009`009`125
X`009`125 else `123`009`009`009`009`009`009/* BACKWARD */
X`009`009msgp->iosts = tape_skiprec(sc,&sca);
X`009`009msgp->record -= sca;
X`009`009msgp->iobct = sca;
X
X`009`009aftertm = dunno;
X`009`009if((msgp->iosts & 1) && hw_eof) `123
X`009`009`009msgp->iosts = SS$_ENDOFFILE;
X`009`009`125
X`009`125
X`125
X
Xstatic void do_skipfile()
X`123
X`009int sc,sca;
X`009
X`009/* fmodif: ... */
X
X`009sc = msgp->media.w[0];
X`009if(sc == 0) `123
X`009`009do_nop();
X`009`009return;
X`009`125 else if(sc > 0) `123`009`009`009`009`009/* FORWARD */
X`009`009int/*logical*/ no_acp;
X`009`009int prevtm;`009`009/* 'record' after tape mark, or -2 */
X
X`009`009no_acp =`009/* not mounted, or mounted foreign */
X`009`009`009((msgp->devchar & DEV$M_MNT) == 0) `124`124
X`009`009`009((msgp->devchar & DEV$M_FOR) != 0);
X`009`009if(no_acp) `123
X`009`009`009msgp->iosts = set_aftertm();
X`009`009`009if(!(msgp->iosts & 1)) return;`009/* ... tapeposlost */
X`009`009`009if(aftertm == yes) `123
X`009`009`009`009prevtm = msgp->record;
X`009`009`009`125 else `123
X`009`009`009`009prevtm = -2;
X`009`009`009`125
X`009`009`125
X
X`009`009msgp->iobct = 0;
X`009`009do `123
X`009`009`009do `123
X`009`009`009`009msgp->iosts = tape_skiprec(0x7FFF,&sca);
X`009`009`009`009msgp->record += sca;
X`009`009`009`009if(!(msgp->iosts & 1)) `123
X`009`009`009`009`009aftertm = dunno;
X`009`009`009`009`009return;
X`009`009`009`009`125
X`009`009`009`125 while(!hw_eof);
X
X`009`009`009msgp->iobct ++;
X`009`009`009sc --;
X
X`009`009`009if(no_acp) `123
X`009`009`009`009if(msgp->record == prevtm+1) `123
X`009`009`009`009`009aftertm = yes;
X`009`009`009`009`009set_eov();
X`009`009`009`009`009return;
X`009`009`009`009`125 else `123
X`009`009`009`009`009prevtm = msgp->record;
X`009`009`009`009`125
X`009`009`009`125
X`009`009`125 while(sc > 0);
X`009`009aftertm = yes;
X`009`125 else `123`009`009`009`009`009`009/* BACKWARD */
X`009`009msgp->iobct = 0;
X`009`009do `123
X`009`009`009do `123
X`009`009`009`009msgp->iosts = tape_skiprec(-0x7FFF,&sca);
X`009`009`009`009msgp->record -= sca;
X`009`009`009`009if(!(msgp->iosts & 1)) `123
X`009`009`009`009`009aftertm = dunno;
X`009`009`009`009`009return;
X`009`009`009`009`125
X`009`009`009`125 while(!hw_eof && !hw_bot);
X
X`009`009`009msgp->iobct ++;
X`009`009`009sc ++;
X
X`009`009`125 while(sc < 0 && !hw_bot);
X`009`009aftertm = dunno;
X`009`125
X`125
X
Xstatic void do_writecheck()
X`123
X`009int /*logical*/ reverse;
X
X
X`009/* fmodif: ... */
X`009reverse = ((fmodif & IO$M_REVERSE) != 0);
X`009if(reverse) `123`009`009`009`009/* not supported so far */
X`009`009msgp->iosts = SS$_BADPARAM;
X`009`009return;
X`009`125
X
X`009CHECK(ZT_FRUSER());
X
X`009msgp->iosts = tape_compare(reverse);`009/* 'updates' *bufbctp`009*/
X`009if((msgp->iosts & 1) `124`124
X`009   (msgp->iosts == SS$_PARITY) `124`124
X`009   (msgp->iosts == SS$_DATACHECK)) `123`009/*** assume tape moved ***/
X`009`009if(reverse) `123
X`009`009`009msgp->record --;
X`009`009`009aftertm = dunno;
X`009`009`125 else `123
X`009`009`009msgp->record ++;
X`009`009`009aftertm = hw_eof;
X`009`009`125
X`009`125
X`009if(msgp->iosts & 1) `123
X`009`009if(hw_eof) `123
X`009`009`009msgp->iosts = SS$_ENDOFFILE;
X`009`009`125 else `123
X`009`009`009msgp->iobct = *bufbctp;
X`009`009`009if(*bufbctp > msgp->bcnt) `123
X`009`009`009`009msgp->iosts = SS$_DATAOVERUN;
X`009`009`009`125
X`009`009`125
X`009`125
X`125
X
Xstatic void do_read()
X`123
X`009int /*logical*/ reverse, check;
X
X
X`009/* fmodif: ... */
X`009reverse = ((fmodif & IO$M_REVERSE) != 0);
X`009if(reverse) `123`009`009`009`009/* not supported so far */
X`009`009msgp->iosts = SS$_BADPARAM;
X`009`009return;
X`009`125
X`009check = ((fmodif & IO$M_DATACHECK) != 0);
X
X`009msgp->iosts = tape_read(reverse,check);`009/* fills in *bufbctp`009*/
X`009if((msgp->iosts & 1) `124`124
X`009   (msgp->iosts == SS$_PARITY) `124`124
X`009   (msgp->iosts == SS$_DATACHECK)) `123`009/*** assume tape moved ***/
X`009`009if(reverse) `123
X`009`009`009msgp->record --;
X`009`009`009aftertm = dunno;
X`009`009`125 else `123
X`009`009`009msgp->record ++;
X`009`009`009aftertm = hw_eof;
X`009`009`125
X`009`125
X`009if(msgp->iosts & 1) `123
X`009`009if(hw_eof) `123
X`009`009`009msgp->iosts = SS$_ENDOFFILE;
X`009`009`125 else `123
X`009`009`009msgp->iobct = *bufbctp;
X`009`009`009if(*bufbctp > msgp->bcnt) `123
X`009`009`009`009msgp->iosts = SS$_DATAOVERUN;
X`009`009`009`009*bufbctp = msgp->bcnt;
X`009`009`009`125
X`009`009`009CHECK(ZT_TOUSER());
X`009`009`125
X`009`125
X`125
X`009`009
Xstatic void do_write()
X`123
X`009int/*logical*/ check;
X
X
X`009/* fmodif: the mysterious IO$M_ERASE flag is simply ignored,
X`009`009`009ditto IO$M_NOWAIT ("TU81plus only") ... */
X`009check = ((fmodif & IO$M_DATACHECK) != 0);
X
X`009CHECK(ZT_FRUSER());
X`009msgp->iosts = tape_write(check);
X`009if(msgp->iosts & 1) `123
X`009`009msgp->record ++;
X`009`009msgp->iobct = *bufbctp;
X`009`009aftertm = no;
X`009`125
X`125
X
X
X/*****/
X
X#if TRACE
Xstatic void trace_func();`009/* forward */
Xstatic void trace_result();`009/* forward */
X#endif
X
Xstatic void dispatch()
X`123
X`009fcode = msgp->func & IO$M_FCODE;
X`009fmodif = msgp->func & IO$M_FMODIFIERS;
X
X#if TRACE
X`009trace_func();
X#endif
X
X`009switch(fcode) `123
X
X`009  case IO$_WRITEMARK:
X`009  case IO$_WRITEOF:
X`009`009do_writemark();
X`009`009break;
X
X`009  case IO$_UNLOAD:
X`009  case IO$_REWINDOFF:
X`009`009do_rewind(1);
X`009`009break;
X
X`009  case IO$_RECAL:
X`009  case IO$_REWIND:
X`009  case IO$_AVAILABLE:`009`009/* NOTE: driver cleared VALID */
X`009`009do_rewind(0);
X`009`009break;
X`009`009
X`009  case IO$_PACKACK:
X`009`009do_nop();
X`009`009if((msgp->iosts & 1)) `123
X`009`009`009msgp->ucbsts `124= UCB$M_VALID;
X`009`009`125
X`009`009break;
X`009`009
X`009  case IO$_SPACEFILE:
X`009  case IO$_SKIPFILE:
X`009`009do_skipfile();
X`009`009break;
X
X`009  case IO$_SPACERECORD:
X`009  case IO$_SKIPRECORD:
X`009`009do_skiprec();
X`009`009break;
X
X`009  case IO$_WRITECHECK:
X`009`009do_writecheck();
X`009`009break;
X
X`009  case IO$_WRITEPBLK:
X`009  case IO$_WRITELBLK:
X`009`009do_write();
X`009`009break;
X
X`009  case IO$_READPBLK:
X`009  case IO$_READLBLK:
X`009`009do_read();
X`009`009break;
X
X`009  case IO$_NOP:
X`009  case IO$_SENSECHAR:
X`009  case IO$_SENSEMODE:
X`009  case IO$_SETCHAR:`009`009/* treat as no-op */
X`009  case IO$_SETMODE:`009`009/* treat as no-op */
X`009  case IO$_DRVCLR:`009`009/* treat as no-op */
X`009  case IO$_ERASETAPE:`009`009/* treat as no-op */
Xnoop:
X`009`009do_nop();
X`009`009break;
X
X`009  default:
X`009`009msgp->iosts = SS$_ILLIOFUNC;
X`009`009break;
X`009`125
X
X/* final processing:
X`009iosts`009`009- has been set
X`009iobct`009`009- has been set (or defaulted to 0)
X`009devdepend`009- to be set here
X`009record`009`009- has been updated (if changed)
X`009ucbsts`009`009- v_valid has been modified (if changed)
X*/
X
V`009if(msgp->iosts == SS$_TAPEPOSLOST) `123`009/* set 'LOST' BIT from status
X */
X`009`009msgp->devdepend `124= MT$M_LOST;
X`009`125
X
X`009if(hw_bot) `123`009`009`009/* "BOT" */
X`009`009msgp->devdepend `124= MT$M_BOT;`009`009/* set BOT */
X`009`009msgp->devdepend &= `126MT$M_LOST;`009`009/* clear pos. lost */
X`009`009aftertm = no;
X`009`125 else `123
X`009`009msgp->devdepend &= `126MT$M_BOT;`009`009/* clear BOT */
X`009`125
X
X`009if(hw_eof) `123`009`009`009/* "EOF" */
X`009`009msgp->devdepend `124= MT$M_EOF;`009`009/* set EOF */
X`009`125 else `123
X`009`009msgp->devdepend &= `126MT$M_EOF;`009`009/* clear EOF */
X`009`125
X
X`009if(hw_eot) `123`009`009`009/* "EOT" */
X`009`009msgp->devdepend `124= MT$M_EOT;`009`009/* set EOT */
X
X`009`009switch(fcode) `123`009`009`009/* usually set iosts=EOT */
X`009`009  case IO$_SPACEFILE:
X`009`009  case IO$_SKIPFILE:
X`009`009  case IO$_SPACERECORD:
X`009`009  case IO$_SKIPRECORD:
X`009`009`009if(msgp->media.w[0] >= 0) goto eotsts;
X`009`009`009break;`009`009`009/* not for space reverse */
X
X`009`009  case IO$_WRITECHECK:
X`009`009`009if(!(fmodif & IO$M_REVERSE)) goto eotsts;
X`009`009`009break;`009`009`009/* not for writecheck reverse */
X
X`009`009  case IO$_READPBLK:
X`009`009  case IO$_READVBLK:
X`009`009`009break;`009`009`009/* not for read */
X
X`009`009  default:
Xeotsts:
X`009`009`009if(msgp->iosts & 1) `123
X`009`009`009`009msgp->iosts = SS$_ENDOFTAPE;
X`009`009`009`125
X`009`009`009break;
X`009`009`125
X`009`125 else `123
X`009`009msgp->devdepend &= `126MT$M_EOT;`009`009/* clear EOT */
X`009`125
X
X`009if(hw_hwl) `123`009`009`009/* write lock */
X`009`009msgp->devdepend `124= MT$M_HWL;`009`009/* set HWL */
X`009`125 else `123
X`009`009msgp->devdepend &= `126MT$M_HWL;`009`009/* clear HWL */
X`009`125
X
X#if TRACE
X`009trace_result();
X#endif
X`125
X
X
X/*****/
X
Xmain(argc,argv)
Xint argc; char **argv;
X`123
X
X#ifdef VAXC
X`009redirect(&argc,&argv);
X#endif
X
X`009bufp = ZT_BUFDSC.addr;
X`009bufbctp = &(ZT_BUFDSC.bct);
X
X`009if(ZT_MSGDSC.l != sizeof(ZTmsg)) FEHLER("bad MSGDSC.len");
X`009msgp = ZT_MSGDSC.p;
X
X
X`009do_init();
X`009CHECK(ZT_INIT());
X
X
X`009do `123
X`009`009CHECK(ZT_WAIT());
X
X`009`009dispatch();
X
X`009`009CHECK(ZT_REQCOM());
X`009`125 while(hw_online);
X`125
X
X
X/*****/
X
X#if TRACE
X
Xtypedef enum `123zeroparm,oneparm,transfer,setchar`125 TRACE_FTYPE;
X
Xstatic void trace_f(char *fname,TRACE_FTYPE ftype)
X`123
X`009int i,fm;
X
X`009fprintf(stdout,"***** %s",fname);
X
X`009for(fm = fmodif>>IO$V_FMODIFIERS, i = IO$V_FMODIFIERS;
X`009    (fm != 0) && i < 16;
X`009    fm >>= 1, i++) `123
X`009`009if(fm & 1) switch(i) `123
X`009`009  case IO$V_REVERSE:
X`009`009`009fprintf(stdout,",REVERSE"); break;
X`009`009  case IO$V_NOWAIT:
X`009`009`009fprintf(stdout,",NOWAIT"); break;
X`009`009  case IO$V_ERASE:
X`009`009`009fprintf(stdout,",ERASE"); break;
X`009`009  case IO$V_INHERLOG:
X`009`009`009fprintf(stdout,",INHERLOG"); break;
X`009`009  case IO$V_INHEXTGAP:
X`009`009`009fprintf(stdout,",INHEXTGAP"); break;
X`009`009  case IO$V_DATACHECK:
X`009`009`009fprintf(stdout,",DATACHECK"); break;
X`009`009  case IO$V_INHRETRY:
X`009`009`009fprintf(stdout,",INHRETRY"); break;
X`009`009  default:
X`009`009`009fprintf(stdout,",1@%d",i);
X`009`009`009break;
X`009`009`125
X`009`125
X
X`009switch(ftype) `123
X`009  case zeroparm:
X`009`009break;
X`009  case oneparm:
X`009`009fprintf(stdout," media=%d",msgp->media.w[0]);
X`009`009break;
X`009  case transfer:
X`009`009fprintf(stdout," bcnt=%d",msgp->bcnt);
X`009`009break;
X`009  case setchar:
X`009`009fprintf(stdout," media: %04X %04X %04X",
X`009`009`009`009msgp->media.uw[0],
X`009`009`009`009msgp->media.uw[1],
X`009`009`009`009msgp->media.uw[2]);
X`009`009break;
X`009`125
X`009fprintf(stdout," record=%d\n",msgp->record);`009 `032
X`125
X
Xstatic void trace_func()
X`123
X`009switch(fcode) `123
X`009  case IO$_NOP:
X`009`009trace_f("IO$_NOP",zeroparm); break;
X`009  case IO$_UNLOAD:
X`009`009trace_f("IO$_UNLOAD",zeroparm); break;
X`009  case IO$_RECAL:
X`009`009trace_f("IO$_RECAL",zeroparm); break;
X`009  case IO$_DRVCLR:
X`009`009trace_f("IO$_DRVCLR",zeroparm); break;
X`009  case IO$_ERASETAPE:
X`009`009trace_f("IO$_ERASETAPE",zeroparm); break;
X`009  case IO$_PACKACK:
X`009`009trace_f("IO$_PACKACK",zeroparm); break;
X`009  case IO$_AVAILABLE:
X`009`009trace_f("IO$_AVAILABLE",zeroparm); break;
X`009  case IO$_WRITEMARK:
X`009`009trace_f("IO$_WRITEMARK",zeroparm); break;
X`009  case IO$_REWINDOFF:
X`009`009trace_f("IO$_REWINDOFF",zeroparm); break;
X`009  case IO$_REWIND:
X`009`009trace_f("IO$_REWIND",zeroparm); break;
X`009  case IO$_WRITEOF:
X`009`009trace_f("IO$_WRITEOF",zeroparm); break;
X`009  case IO$_SPACEFILE:
X`009`009trace_f("IO$_SPACEFILE",oneparm); break;
X`009  case IO$_SPACERECORD:
X`009`009trace_f("IO$_SPACERECORD",oneparm); break;
X`009  case IO$_SKIPFILE:
X`009`009trace_f("IO$_SKIPFILE",oneparm); break;
X`009  case IO$_SKIPRECORD:
X`009`009trace_f("IO$_SKIPRECORD",oneparm); break;
X`009  case IO$_SENSECHAR:
X`009`009trace_f("IO$_SENSECHAR",zeroparm); break;
X`009  case IO$_SENSEMODE:
X`009`009trace_f("IO$_SENSEMODE",zeroparm); break;
X`009  case IO$_SETCHAR:
X`009`009trace_f("IO$_SETCHAR",setchar); break;
X`009  case IO$_SETMODE:
X`009`009trace_f("IO$_SETMODE",setchar); break;
X`009  case IO$_WRITECHECK:
X`009`009trace_f("IO$_WRITECHECK",transfer); break;
X`009  case IO$_WRITEPBLK:
X`009`009trace_f("IO$_WRITEPBLK",transfer); break;
X`009  case IO$_READPBLK:
X`009`009trace_f("IO$_READPBLK",transfer); break;
X`009  case IO$_WRITELBLK:
X`009`009trace_f("IO$_WRITELBLK",transfer); break;
X`009  case IO$_READLBLK:
X`009`009trace_f("IO$_READLBLK",transfer); break;
X`009  default:
X`009`009`123`009char name[16];
X
X`009`009`009sprintf(name,"?%d?",fcode);
X`009`009`009trace_f(name,zeroparm);
X`009`009`125
X`009`009break;
X`009`125
X`125
X
Xstatic void trace_result()
X`123
X`009fprintf(stdout,"\tiosts=");
X`009switch(msgp->iosts) `123
X`009  case SS$_NORMAL:
X`009`009fprintf(stdout,"SS$_NORMAL"); break;
X`009  case SS$_BADPARAM:
X`009`009fprintf(stdout,"SS$_BADPARAM"); break;
X`009  case SS$_CTRLERR:
X`009`009fprintf(stdout,"SS$_CTRLERR"); break;
X`009  case SS$_DATACHECK:
X`009`009fprintf(stdout,"SS$_DATACHECK"); break;
X`009  case SS$_DEVOFFLINE:
X`009`009fprintf(stdout,"SS$_DEVOFFLINE"); break;
X`009  case SS$_DRVERR:
X`009`009fprintf(stdout,"SS$_DRVERR"); break;
X`009  case SS$_FORMAT:
X`009`009fprintf(stdout,"SS$_FORMAT"); break;
X`009  case SS$_ILLIOFUNC:
X`009`009fprintf(stdout,"SS$_ILLIOFUNC"); break;
X`009  case SS$_MEDOFL:
X`009`009fprintf(stdout,"SS$_MEDOFL"); break;
X`009  case SS$_NONEXDRV:
X`009`009fprintf(stdout,"SS$_NONEXDRV"); break;
X`009  case SS$_PARITY:
X`009`009fprintf(stdout,"SS$_PARITY"); break;
X`009  case SS$_TAPEPOSLOST:
X`009`009fprintf(stdout,"SS$_TAPEPOSLOST"); break;
X`009  case SS$_TIMEOUT:
X`009`009fprintf(stdout,"SS$_TIMEOUT"); break;
X`009  case SS$_UNSAFE:
X`009`009fprintf(stdout,"SS$_UNSAFE"); break;
X`009  case SS$_VOLINV:
X`009`009fprintf(stdout,"SS$_VOLINV"); break;
X`009  case SS$_WRITLCK:
X`009`009fprintf(stdout,"SS$_WRITLCK"); break;
X`009  case SS$_DATAOVERUN:
X`009`009fprintf(stdout,"SS$_DATAOVERUN"); break;
X`009  case SS$_ENDOFFILE:
X`009`009fprintf(stdout,"SS$_ENDOFFILE"); break;
X`009  case SS$_ENDOFTAPE:
X`009`009fprintf(stdout,"SS$_ENDOFTAPE"); break;
X`009  case SS$_ENDOFVOLUME:
X`009`009fprintf(stdout,"SS$_ENDOFVOLUME"); break;
X`009  case SS$_BEGOFTAPE:
X`009`009fprintf(stdout,"SS$_BEGOFTAPE"); break;
X`009  default:
X`009`009fprintf(stdout,"%04X",msgp->iosts);
X`009`009break;
X`009`125
X
X`009if(msgp->devdepend & MT$M_BOT) fprintf(stdout,",M_BOT");
X`009if(msgp->devdepend & MT$M_EOF) fprintf(stdout,",M_EOF");
X`009if(msgp->devdepend & MT$M_EOT) fprintf(stdout,",M_EOT");
X`009if(msgp->devdepend & MT$M_HWL) fprintf(stdout,",M_HWL");
X`009if(msgp->devdepend & MT$M_LOST) fprintf(stdout,",M_LOST");
X
X`009if(msgp->iobct != 0) `123
X`009`009fprintf(stdout," iobct=%d",msgp->iobct);
X`009`125
X
X`009fprintf(stdout," atm=%c",(aftertm == yes) ? '1' :
X`009`009`009`009`009(aftertm == no) ? '0' : '?');
X`009 `032
X`009fprintf(stdout," record=%d\n",msgp->record);`009 `032
X`125
X
X#endif /* TRACE */
$ GOSUB UNPACK_FILE

$ FILE_IS = "ZT1T.C"
$ CHECKSUM_IS = 560051951
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X/*`009memory-'tape' routines for first test of ZTDRIVER ...
X`009w.j.m. jun 1989
X*/
X
X#ifndef TRACE
X#define TRACE 1
X#endif
X
X#include ssdef
X
X#include stdio
X#include stddef
X#include string
X#include descrip
Xtypedef struct dsc$descriptor DESCR;
X
X#define CHECK(x) do `123unsigned s=x; if(!(s&1)) LIB$STOP(s);`125 while(0)
X#define FEHLER(m) do `123$DESCRIPTOR(d,m); Fehler(&d);`125 while(0)
X
X/* data & entries used by "main" program */
X
Xextern unsigned char *bufp;
Xextern unsigned long *bufbctp;
X
Xextern int /*logical*/ hw_online,hw_medonline,hw_bot,hw_eof,hw_eot,hw_hwl;
X
X/* forward */
Xvoid tape_init(void);
Xunsigned tape_writemark(void),
X`009tape_nop(void),
X`009tape_rewind(int/*logical*/ /*unload*/),
X`009tape_skiprec(int /*+-#blocks*/,int * /*#blocks skipped*/),
X`009tape_compare(int/*logical*/ /*reverse*/),
X`009tape_read(int/*logical*/ /*reverse*/,int/*logical*/ /*check*/),
X`009tape_write(int/*logical*/ /*check*/);
X
X#if TRACE
Xstatic void trace_tape(char *,int,int,int);`009/* forward */
Xstatic int tpos;`009/* true position (in blocks) */
X#endif
X
X/* the 'memory tape' */
X/* structure:
X`009short l1; char [l1]; short l1; short l2; char [l2]; short l1; ...
X`009`009l=0 stands for end of written area,
X`009`009l=1 stands for tape mark
X*/
X
X#define TAPELEN 2000000`009`009`009/* bytes */
X#define TAPEEOT (TAPELEN-200000)`009/* room after EOT */
Xstatic unsigned char tm[TAPELEN], *tp;
X
X#define T_eotape 0
X#define T_mark 1
X
X#define T_nextlen (*((unsigned short *) tp))
X#define T_prevlen (*(((unsigned short *) tp) - 1))
X#define T_data (tp + sizeof(unsigned short))
X
X#define T_bot (tp == tm)
X#define T_eot (tp >= (tm + TAPEEOT))
X
X#define T_toomuch(l) (tp >= (tm + TAPELEN - 3*sizeof(unsigned short) - l))
X
X#define T_prevpos (tp - (T_prevlen + 2*sizeof(unsigned short)))
X#define T_nextpos (tp + (T_nextlen + 2*sizeof(unsigned short)))
X
X
X/*****/
X
Xvoid tape_init(void)
X`123
X
X`009tp = tm;
X`009T_nextlen = T_eotape;
X#if TRACE
X`009tpos = 0;
X#endif
X
X`009hw_online = 1;
X`009hw_medonline = 1;
X`009hw_hwl = 0;
X
X`009hw_eof = 0;
X`009hw_bot = T_bot;
X`009hw_eot = T_eot;
X`125
X
Xunsigned tape_writemark(void)
X`123
X#if TRACE
X`009trace_tape("WRITEMARK",0,0,0);
X#endif
X`009if(!hw_online) return SS$_DEVOFFLINE;
X`009if(!hw_medonline) return SS$_MEDOFL;
X
X`009if(T_toomuch(T_mark)) return SS$_UNSAFE;
X
X`009T_nextlen = T_mark;
X`009tp = T_nextpos;
X`009T_prevlen = T_mark;
X`009T_nextlen = T_eotape;
X#if TRACE
X`009tpos ++;
X#endif
X
X`009hw_eof = 1; `009`009/* ??? */
X`009hw_bot = T_bot;
X`009hw_eot = T_eot;
X
X`009return SS$_NORMAL;
X`125
X
Xunsigned tape_nop(void)
X`123
X#if TRACE
X`009trace_tape("NOP",0,0,0);
X#endif
X`009/* tape status does not change ... */
X`009if(!hw_online) return SS$_DEVOFFLINE;
X`009if(!hw_medonline) return SS$_MEDOFL;
X`009return SS$_NORMAL;
X`125
X
Xunsigned tape_rewind(int/*logical*/ unload)
X`123
X#if TRACE
X`009trace_tape("REWIND",1,unload,0);
X#endif
X`009if(!hw_online) return SS$_DEVOFFLINE;
X`009if(!hw_medonline) return SS$_MEDOFL;
X
X`009/* leave (mysteriously) medium online in spite of unload */
X`009/* i.e. 'unload' is ignored(!) */
X
X`009tp = tm;
X#if TRACE
X`009tpos = 0;
X#endif
X
X`009hw_eof = 0;
X`009hw_bot = T_bot;
X`009hw_eot = T_eot;
X
X`009return SS$_NORMAL;
X`125
X
Xunsigned tape_skiprec(int sb,int *sap)
X/* sb = (signed) # blocks to be skipped
X   sap = pointer to return value: absolute # blocks skipped */
X/* terminate after EOF mark, or at BOT */
X`123
X`009unsigned xstat;
X
X
X#if TRACE
X`009trace_tape("SKIPREC",1,sb,0);
X#endif
X`009if(!hw_online) return SS$_DEVOFFLINE;
X`009if(!hw_medonline) return SS$_MEDOFL;
X
X`009*sap = 0;
X
X`009xstat = SS$_NORMAL;`009/* assume success,`032
X`009`009`009`009this includes EOF & BOT termination */
X`009if(sb > 0) `123
X`009`009do `123
X`009`009`009if(T_nextlen == T_eotape) `123
X`009`009`009`009xstat = SS$_TAPEPOSLOST;
X`009`009`009`009break;
X`009`009`009`125
X`009`009`009hw_eof = (T_nextlen == T_mark);
X`009`009`009tp = T_nextpos;
X#if TRACE
X`009`009`009tpos ++;
X#endif
X`009`009`009(*sap) ++;
X`009`009`125 while(!hw_eof && (*sap < sb));
X`009`125 else if(sb < 0) `123
X`009`009do `123
X`009`009`009if(T_bot) break;
X`009`009`009hw_eof = (T_prevlen == T_mark);
X`009`009`009tp = T_prevpos;
X#if TRACE
X`009`009`009tpos --;
X#endif
X`009`009`009(*sap) ++;
X`009`009`125 while(!hw_eof && ((*sap + sb) < 0));
X`009`125
X
X`009hw_bot = T_bot;
X`009hw_eot = T_eot;
X
X`009return xstat;
X`125
X
Xunsigned tape_compare(int/*logical*/ reverse)
X/* (buffer,bufbct) has memory data.
X`009compare to tape block,
X`009return length of tape block in bufbct */
X`123
X`009unsigned xstat;
X
X
X#if TRACE
X`009trace_tape("COMPARE",1,reverse,0);
X#endif
X`009if(!hw_online) return SS$_DEVOFFLINE;
X`009if(!hw_medonline) return SS$_MEDOFL;
X
X`009if(reverse) return SS$_BADPARAM;`009/* reverse not supported */
X
X
X`009xstat = SS$_NORMAL;`009/* assume success, includes EOF read */
X
X`009if(T_nextlen == T_eotape) `123
X`009`009xstat = SS$_TAPEPOSLOST;
X`009`125 else `123
X`009`009hw_eof = (T_nextlen == T_mark);
X`009`009if(hw_eof) `123
X`009`009`009*bufbctp = 0;
X`009`009`125 else `123
X`009`009`009if(*bufbctp < T_nextlen `124`124
X`009`009`009   memcmp(T_data,bufp,T_nextlen)) `123
X`009`009`009`009xstat = SS$_DATACHECK;
X`009`009`009`125
X`009`009`009*bufbctp = T_nextlen;
X`009`009`125
X`009`009tp = T_nextpos;
X#if TRACE
X`009`009tpos ++;
X#endif
X`009`125
X
X`009hw_bot = T_bot;
X`009hw_eot = T_eot;
X
X`009return xstat;
X`125
X
X
Xunsigned tape_read(int/*logical*/ reverse, int/*logical*/ check)
X/* put data into (buffer,bufbct) */
X/* 'check' (ignored) requests data checking */
X`123
X#if TRACE
X`009trace_tape("READ",2,reverse,check);
X#endif
X`009if(!hw_online) return SS$_DEVOFFLINE;
X`009if(!hw_medonline) return SS$_MEDOFL;
X
X`009if(reverse) return SS$_BADPARAM;`009/* reverse not supported */
X
X`009if(T_nextlen == T_eotape) return SS$_TAPEPOSLOST;
X
X`009hw_eof = (T_nextlen == T_mark);
X`009if(hw_eof) `123
X`009`009*bufbctp = 0;
X`009`125 else `123
X`009`009*bufbctp = T_nextlen;
X`009`009memcpy(bufp,T_data,T_nextlen);
X`009`125
X`009tp = T_nextpos;
X#if TRACE
X`009tpos ++;
X#endif
X
X`009hw_bot = T_bot;
X`009hw_eot = T_eot;
X
X`009return SS$_NORMAL;
X`125
X
Xunsigned tape_write(int/*logical*/ check)
X/* process data from (buffer,bufbct) */
X/* 'check' (ignored) requests data checking */
X`123
X#if TRACE
X`009trace_tape("WRITE",1,check,0);
X#endif
X`009if(!hw_online) return SS$_DEVOFFLINE;
X`009if(!hw_medonline) return SS$_MEDOFL;
X
X`009if(T_toomuch(*bufbctp)) return SS$_UNSAFE;
X
X`009T_nextlen = *bufbctp;
X`009memcpy(T_data,bufp,*bufbctp);
X`009tp = T_nextpos;
X`009T_prevlen = *bufbctp;
X`009T_nextlen = T_eotape;
X#if TRACE
X`009tpos ++;
X#endif
X
X`009hw_eof = 0;
X`009hw_bot = T_bot;
X`009hw_eot = T_eot;
X
X`009return SS$_NORMAL;
X`125
X
X
X/*****/
X
X#if TRACE
X
Xstatic void trace_tape(char *fname,int ac,int a1,int a2)
X`123
X`009fprintf(stdout,"\tTAPE_%s(",fname);
X`009if(ac > 0) `123
X`009`009fprintf(stdout,"%d",a1);
X`009`009if(ac > 1) `123
X`009`009`009fprintf(stdout,",%d",a2);
X`009`009`125
X`009`125
X`009fprintf(stdout,") tpos=%d\n",tpos);
X`125
X
X#endif
$ GOSUB UNPACK_FILE
$ EXIT

Wolfgang J. Moeller, GWDG, D-3400 Goettingen, F.R.Germany | Disclaimer ...
Bitnet/Earn: U0012@DGOGWDG5         Phone: +49 551 201516 | No claim intended
