$! ................... 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 31-MAR-1994 19:28:07.12. $! $! ATTENTION: To keep each article below 70 blocks (35840 bytes), this $! program has been transmitted in 5 parts. You should $! concatenate ALL parts to ONE file and execute (@) that file. $! $! It contains the following 16 files: $! DEFGBLINI.MAR $! FEHLER.C $! GENDEF.COM $! REDIRECT.C $! VAXC.OPT $! ZT-MAKE.COM $! ZT.H $! ZT1.C $! ZT1D.C $! ZT1T.C $! ZT2.C $! ZTDEF.MAR $! ZTNS.H $! ZTNS2.C $! ZTSERVER.MAR $! ZT_DRIVER.MAR $! $!============================================================================ $ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL ) $ VERSION = F$GETSYI( "VERSION" ) $ if f$getsyi("cpu").gt.127 then goto version_ok $ 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 = "DEFGBLINI.MAR" $ CHECKSUM_IS = 336551234 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X; $GBLINI macro modified for generating "definition files": X;`009calls to JL_EMIT added X; [after STARLET.MLB, $GBLINI unchanged since VMS V3.5] X; X; original idea: w.j.m. may 85 (VMS V3.5) X; change nov 85 wjm: generate fortran output directly via .PRINT X; mod 07-apr-1987 wjm: use separate JL_EMIT macro (after Jerry Leichter) X; chg 26-nov-1990 wjm: make generic by splitting off JL_EMIT X; X`009.MACRO`009$GBLINI`009GBL=LOCAL X`009.IF`009IDN X`009.MACRO`009$DEF`009SYM,ALLOC,SIZ X`009.IIF`009NB,SYM,`009SYM:: X`009.IIF`009NB,SYM,`009jl_emit`009SYM,\SYM X`009.IIF`009NB,ALLOC,`009ALLOC`009SIZ X`009.ENDM`009$DEF X`009.MACRO`009$EQU`009SYM,VAL X`009SYM==VAL X`009jl_emit`009SYM,\SYM X`009.ENDM`009$EQU X`009.MACRO`009$VIELD1`009MOD,SEP,SYM,SIZ,MSK X`009SIZ...=1 X`009.IIF`009NB,SIZ,`009SIZ...=SIZ X`009.IF`009NB,SYM X`009MOD'SEP'V_'SYM==BIT... X`009jl_emit`009MOD'SEP'V_'SYM,\MOD'SEP'V_'SYM X`009.IIF`009NB,SIZ,`009MOD'SEP'S_'SYM==SIZ X`009.IIF`009NB,SIZ,`009jl_emit`009MOD'SEP'S_'SYM,\MOD'SEP'S_'SYM X`009.IIF`009NB,MSK,`009MOD'SEP'M_'SYM==<<<1@SIZ...>-1>@BIT...> X`009.IIF`009NB,MSK,`009jl_emit`009MOD'SEP'M_'SYM,\MOD'SEP'M_'SYM X`009.ENDC X`009BIT...=BIT...+SIZ... X`009.ENDM`009$VIELD1 X`009.IFF X`009.IIF`009DIF ,.ERROR ;ARG MUST BE "GLOBAL","LOCAL",OR NULL X`009.MACRO`009$DEF`009SYM,ALLOC,SIZ X`009.IIF`009NB,SYM,`009SYM: X`009.IIF`009NB,SYM,`009jl_emit`009SYM,\SYM X`009.IIF`009NB,ALLOC,`009ALLOC`009SIZ X`009.ENDM`009$DEF X`009.MACRO`009$EQU`009SYM,VAL X`009SYM=VAL X`009jl_emit`009SYM,\SYM X`009.ENDM`009$EQU X`009.MACRO`009$VIELD1`009MOD,SEP,SYM,SIZ,MSK X`009SIZ...=1 X`009.IIF`009NB,SIZ,`009SIZ...=SIZ X`009.IF`009NB,SYM X`009MOD'SEP'V_'SYM=BIT... X`009jl_emit`009MOD'SEP'V_'SYM,\MOD'SEP'V_'SYM X`009.IIF`009NB,SIZ,`009MOD'SEP'S_'SYM=SIZ X`009.IIF`009NB,SIZ,`009jl_emit`009MOD'SEP'S_'SYM,\MOD'SEP'S_'SYM X`009.IIF`009NB,MSK,`009MOD'SEP'M_'SYM=<<<1@SIZ...>-1>@BIT...> X`009.IIF`009NB,MSK,`009jl_emit`009MOD'SEP'M_'SYM,\MOD'SEP'M_'SYM X`009.ENDC X`009BIT...=BIT...+SIZ... X`009.ENDM`009$VIELD1 X`009.ENDC X`009.ENDM`009$GBLINI $ GOSUB UNPACK_FILE $ FILE_IS = "FEHLER.C" $ CHECKSUM_IS = 1280136710 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X/* FEHLER [german for "error"] abort a program with a message. X * X * w.j.m. 1982 (FORTRAN version, would not always work) X * w.j.m. 1985 (MACRO version) X * w.j.m. 1991 (C version) X * X * usage: X *`009FEHLER(textdsc)`009`009`009`124* error message (length.le.255) *`124 V *`009struct dsc$descriptor *textdsc;`009`124* passed by descriptor `009 *`12 X4 X * X * *OR* X *`009FEHLER(text)`009`009`124* error message (length.gt.1) *`124 X *`009char *text;`009`009`124* passed by reference (.ASCIZ) *`124 X */ X X#include descrip X Xvoid FEHLER(unsigned short *ptr) X`123 X`009unsigned int s; X`009$DESCRIPTOR(msgdsc,"?");`009/* address & length to be filled in */ X`009unsigned int msgvec[4]; X`009static const $DESCRIPTOR(fehler_name,"FEHLER"); X`009globalvalue shr$_text; X`009extern unsigned lib$analyze_sdesc(); X`009extern void lib$stop(),sys$putmsg(); X X`009 X/* decide upon call format ... */ X X`009if(*ptr < 256) `123`009/* most probably a descriptor */ X`009`009s = lib$analyze_sdesc(ptr, X`009`009`009`009 &msgdsc.dsc$w_length, X`009`009`009`009 &msgdsc.dsc$a_pointer); X`009`125 else `123 X`009`009s = 0; X`009`125 X`009if((s & 1) == 0) `123`009/* got to be an .ASCIZ string */ X`009`009msgdsc.dsc$a_pointer = (char*)ptr; X`009`009`123 `009`009`009/* avoid VAXCRTL strlen() */ X`009`009`009char *p = (char*)ptr; while(*p) p++; X X`009`009`009msgdsc.dsc$w_length = p - (char*)ptr; X`009`009`125 X`009`125 X X/* setup for $PUTMSG */ X X`009msgvec[0] = 3;`009`009/* # of following longwords */ X`009msgvec[1] = (shr$_text & 0x0000fff8) `124 X`009`009 0x08000004;`009`009/* fake user facility (required for`032 X`009`009`009`009`009 * $FAO), and force severity = fatal */ X`009msgvec[2] = 1;`009`009/* # of $FAO arguments */ X`009msgvec[3] = (unsigned int)(&msgdsc); X X/* output the message (unless overriden process "message" default */ X X`009sys$putmsg(msgvec,0,&fehler_name,0);`009/* don't care for status now */ X X/* LIB$STOP for traceback (don't output the message again) */ X X`009lib$stop(msgvec[1] `124 0x10000000); X`125 X X X#ifdef TESTING Xmain(argc) X`123 X`009extern void FEHLER(); X X`009if(argc > 1) `123 X`009`009$DESCRIPTOR(dsc,"######## passed by descriptor #######"); X`009`009FEHLER(&dsc); X`009`125 else `123 X`009`009FEHLER("######## passed by reference #######"); X`009`125 X`125 X#endif $ GOSUB UNPACK_FILE $ FILE_IS = "GENDEF.COM" $ CHECKSUM_IS = 777289538 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$! generate C/FORTRAN/DCL "include" file from MACRO definitions X$! X$ ver_p = 'f$verify(0,f$environment("verify_image"))' X$! X$! wjm may 1985 (FORTRAN output only) X$! chg 15-nov-1985 wjm: use SYS$OUTPUT from MACRO directly, new FORGBLINI.MAR X$! mod 22-nov-1985 wjm: FORGBLINI in same directory as this file X$! fix 11-oct-1989 wjm: clear STS$M_INHIB_MSG, so $exit gives error msg V$! chg 26-nov-1990 wjm: adapt to VMS 5.4; re-organize into 1 command procedur Xe X$!`009`009`009`009(after ideas by J.Leichter & E.Gavron) X$! mod 15-oct-1993 wjm: adapt to AXP VMS (V1.5) X$! mod 27-oct-1993 wjm: add SET SYMBOL/SCOPE, delete output file on error X$! fix 27-dec-1993 wjm: consistent output of OSname X$! X$! input:`009module $'p1' in SYS$LIBRARY:STARLET.MLB or LIB.MLB X$! output:`009depending upon p2: X$!`009`009`009"C" (default)`009=> []'p1'.H X$!`009`009`009"FORTRAN"`009=> []'p1'.FD X$!`009`009`009"DCL"`009`009=> []'p1'.COM X$! files required: DEFGBLINI.MAR X$! X$!***** X$! X$ set := SET X$ set symbol/scope=(nolocal,noglobal) X$ if "''GENDEF\DEBUG'" then set verify=procedure X$! X$ set noon X$! X$ p2 = f$edit(p2,"upcase,collapse,uncomment") X$ lang = "C" X$ ftype = ".H" X$ if p2.eqs."" .or. p2.eqs."C" then goto p2ok X$ lang = "FORTRAN" X$ ftype = ".FD" X$ if f$locate(p2,"FORTRAN").eq.0 then goto p2ok X$ lang = "DCL" X$ ftype = ".COM" X$ if f$locate(p2,"DCL").eq.0 then goto p2ok X$ write SYS$OUTPUT "%-F-Bad parameter p2: C, FORTRAN, or DCL expected" X$ xstat = 4 X$ goto done X$! X$p2ok: X$ alpha = f$getsyi("CPU").gt.127 X$ vmsv = f$element(0,".",f$getsyi("version"))`009! major ... X$ vmsv = f$extract(1,f$length(vmsv)-1,vmsv)`009! ... w/o initial letter X$ vmsv2 = f$element(1,".",f$getsyi("version"))`009! minor ... X$ macro054 = alpha .or. - X`009((vmsv.eqs."5" .and. vmsv2 .ges."4") .or. vmsv.gts."5") X$! X$ defgblini=f$parse("DEFGBLINI.MAR;",f$env("procedure")) X$! X$ osname = "VMS " + f$edit(f$getsyi("version"),"trim") X$ if alpha then osname = "OpenVMS " + f$edit(f$getsyi("version"),"trim") X$! X$ open/write GENDEF_TMP []GENDEF.TMP X$ write GENDEF_TMP ".macro`009JL_EMIT`009SYM,VALUE" X$ goto write_'lang' X$! X$write_C: X$ write GENDEF_TMP ".if lt %locate(<->,VALUE)-%length(VALUE)" X$ write GENDEF_TMP "`009.print;#define`009SYM`009(VALUE)" X$ write GENDEF_TMP ".iff" X$ write GENDEF_TMP "`009.print;#define`009SYM`009VALUE" X$ write GENDEF_TMP ".endc" X$ write GENDEF_TMP ".endm`009JL_EMIT" X$ write GENDEF_TMP "`009.print;/*" X$ write GENDEF_TMP "`009.print; * definitions created by GENDEF at " +- X`009`009f$time() + " (" + osname + ")" X$ write GENDEF_TMP "`009.print; */" X$ write GENDEF_TMP "`009$" + p1 X$ write GENDEF_TMP "`009.print;/*" X$ write GENDEF_TMP "`009.print; * end of definitions created by GENDEF" X$ write GENDEF_TMP "`009.print; */" X$ goto write__end X$! X$write_FORTRAN: X$ write GENDEF_TMP "`009.print;`009integer*4 SYM" X$ write GENDEF_TMP "`009.print;`009parameter (SYM = VALUE)" X$ write GENDEF_TMP ".endm`009JL_EMIT" X$ write GENDEF_TMP "`009.print;*" X$ write GENDEF_TMP "`009.print;* definitions created by GENDEF at " +- X`009`009f$time() + " (" + osname + ")" X$ write GENDEF_TMP "`009.print;*" X$ write GENDEF_TMP "`009$" + p1 X$ write GENDEF_TMP "`009.print;*" X$ write GENDEF_TMP "`009.print;* end of definitions created by GENDEF" X$ write GENDEF_TMP "`009.print;*" X$ goto write__end X$! X$write_DCL: X$ write GENDEF_TMP "`009.print;$ SYM == VALUE" X$ write GENDEF_TMP ".endm`009JL_EMIT" X$ write GENDEF_TMP "`009.print;$!*" X$ write GENDEF_TMP "`009.print;$! definitions created by GENDEF at " +- X`009`009f$time() + " (" + osname + ")" X$ write GENDEF_TMP "`009.print;$!*" X$ write GENDEF_TMP "`009$" + p1 X$ write GENDEF_TMP "`009.print;$!*" X$ write GENDEF_TMP "`009.print;$! end of definitions created by GENDEF" X$ write GENDEF_TMP "`009.print;$!*" X$ goto write__end X$! X$write__end: X$ write GENDEF_TMP "`009.end" X$ close GENDEF_TMP X$! X$ outputfn = p1 + ftype X$ macoutfn = outputfn X$ if alpha then macoutfn = "[]GENDEF.TMP2" X$ timestamp = f$cvtim("") X! X$ if .not.macro054 then -`009`009`009! pre-5.4 MACRO: .PRINT output X`009define/user SYS$ERROR 'macoutfn'`009! ... goes to SYS$ERROR X$ if macro054 then - X`009create 'macoutfn' X$ if macro054 then -`009`009`009`009! 5.4 MACRO: .PRINT output X`009define/user SYS$OUTPUT 'macoutfn'`009! ... goes to SYS$OUTPUT X$ if macro054 then -`009`009`009`009! ... (appended) ... X`009define/user SYS$ERROR NL:`009`009! ... and somehow to SYS$ERROR X$! X$ if .not.alpha then - X`009$ macro/nolist/noobject - X`009`009'defgblini'+SYS$DISK:[]GENDEF.TMP+SYS$LIBRARY:LIB/LIB X$ if alpha then - X`009$ macro/migrate/nolist/noobject - X`009`009'defgblini'+SYS$DISK:[]GENDEF.TMP+SYS$LIBRARY:LIB/LIB X$ xstat = $status.and.%xEFFFFFFF`009`009! want to signal again X$! X$ delete []GENDEF.TMP; X$! X$ if xstat .and. alpha then goto alpha_strip X$ if xstat then goto done X$! X$ macoutfn = f$search(macoutfn) V$ if macoutfn.nes."" .and. f$cvtim(f$file(macoutfn,"cdt")).ges.timestamp then X - X`009delete/log 'macoutfn' X$! X$done: X$ exit xstat + f$verify(ver_p,f$environment("verify_image"))*0 X$! X$! X$!***** ALPHA MACRO32 makes .print output into long error messages ... X$! X$alpha_strip: X$! X$ prefix = "%AMAC-I-GENINFO, 0 " X$! X$ create 'outputfn' X$ open/read GENDEF_TMP 'macoutfn' X$ open/append GENDEF_OUT 'outputfn' X$cloop: X$ read/end=cloopend GENDEF_TMP line X$ if f$length(line).gt.0 .and. f$locate(prefix,line).eq.0 then - X`009write GENDEF_OUT (line - prefix) X$ goto cloop X$cloopend: X$ close GENDEF_OUT X$ close GENDEF_TMP X$! X$ delete []GENDEF.TMP2; X$! X$ goto done $ GOSUB UNPACK_FILE $ FILE_IS = "REDIRECT.C" $ CHECKSUM_IS = 1293102649 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X/*`009simulate SHELL redirection for VAXC X`009w.j.m. feb 86 X`009fix aug 86 wjm X`009mod apr 87 wjm: allow for ">>" X`009mod 26-may-1990 wjm: use "mbc=16" for efficiency (seq. I/O only!) X Xusage: X X`009main(argc,argv) X`009int argc; char **argv; X`009`123 X`009#ifdef VAXC X`009`009redirect(&argc,&argv); X`009#endif X`009`009... X Xbugs: X`009does not handle redirection of stderr. X X`009overwrites argument vector (*argv). X X*/ X X#include stdio X#include perror X#include errno X Xstatic myerr(str,flag) Xchar *str; int flag; X`123 X`009fprintf(stderr,"%%-F-REDIRECT, %s\n",str); X`009if(flag) `123 X`009`009exit(vaxc$errno); X`009`125 else`009exit(0x10000004); X`125 X Xredirect(argcp,argvp) Xint *argcp; char ***argvp; X`123 X`009char **av,**nav; X`009int ac,nac; X`009int inx = 0, outx = 0; X X`009av = nav = *argvp; X`009ac = *argcp; X X`009if(ac <= 0) return;`009`009/* no arg, no action */ X X`009av++; nav++; ac--; nac = 1;`009/* 1st arg untouched */ X X`009for( ; ac > 0; av++, ac--) `123 X`009`009switch(**av) `123 X`009`009 case '<': X`009`009`009if(inx++) myerr("double input redirection",0); X`009`009`009if((stdin=freopen(*av+1,"r",stdin,"mbc=16"))==NULL) X`009`009`009`009myerr("cannot redirect stdin",1); X`009`009`009break; X`009`009 case '>': X`009`009`009if(outx++) myerr("double output redirection",0); X`009`009`009if(*(*av+1) == '>') `123 X`009`009`009`009if((stdout=freopen(*av+2,"a",stdout,"mbc=16"))==NULL) X`009`009`009`009`009myerr("cannot redirect stdout",1); X`009`009`009`125 else `123 X`009`009`009`009if((stdout=freopen(*av+1,"w",stdout,"mbc=16"))==NULL) X`009`009`009`009`009myerr("cannot redirect stdout",1); X`009`009`009`125 X`009`009`009break; X`009`009 default: X`009`009`009*nav++ = *av; nac++; X`009`009`125 X`009`125 X X`009/* note: K&R does not say that argv[argc] == NULL */ X X`009*argcp = nac; X`125 $ GOSUB UNPACK_FILE $ FILE_IS = "VAXC.OPT" $ CHECKSUM_IS = 1394633292 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY XSYS$SHARE:VAXCRTL.EXE/share $ GOSUB UNPACK_FILE $ FILE_IS = "ZT-MAKE.COM" $ CHECKSUM_IS = 240540957 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$! "make" ZT* programs for VAX (assuming VMS V5.4 or greater), and for AXP X$! X$! w.j.m. 27-oct-1993 (AXP $LINK command after G.K.Newman's example driver) X$! mod 29-jan-1994 wjm: no longer require EVAX.MAR prefix X$! mod 31-jan-1994 wjm: add ZT1B0 (example server for "_ZTB0:") X$! mod 25-feb-1994 wjm: ZT1B0 obsoleted by new ZT1, add ZT1D/ZT1-D V$! mod 18-mar-1994 wjm: update for STEP2, LINK now from device support dev.gu Xide V$!--------------------------------------------------------------------------- X--- X$! X$ gosub := GOSUB X$ gosub mm_setup X$! X$ evax = f$getsyi("CPU").gt.127 X$ if evax then CC := CC/STANDARD=VAXC X$ if evax then MACRO := MACRO/MIGRATION/MACHINE X$! X$ q_sysexe = ""`009`009`009`009! SYS.STB on VAX implicit via .LINK X$ if evax then q_sysexe = "/SYSEXE" X$ dep_sysexe = "SYS$SYSTEM:SYS.STB" X$ if evax then dep_sysexe = "SYS$LOADABLE_IMAGES:SYS$BASE_IMAGE.EXE" X$! X$ d_vaxcopt = "VAXC.OPT"`009`009`009! assuming VAXC on VAX X$ q_vaxcopt = ",SYS$DISK:[]VAXC.OPT/OPTION" X$ if evax then d_vaxcopt = "" X$ if evax then q_vaxcopt = "" X! X$! X$!*****`009macro library is common to VAX and AXP X$! X$ mm_target `009ZT.MLB X$ mm_depend`009ZTDEF.MAR X$ mm_do write SYS$ERROR "Creating ZT.MLB ..." X$ mm_do`009library/log/macro/create=block=0 ZT.MLB ZTDEF.MAR X$! X$! X$!*****`009make the driver (architecture-dependent) X$! X$ mm_target`009ZT_DRIVER.OBJ X$ mm_depend`009ZT_DRIVER.MAR X$ mm_depend`009ZT.MLB`009SYS$LIBRARY:LIB.MLB X$ if evax X$ then X$`009mm_do write SYS$ERROR "... Expect 5 %AMAC-I diagnostic messages ...`007" X$ endif X$ mm_do write SYS$ERROR "Compiling ZT_DRIVER ..." X$ mm_do`009macro ZT_DRIVER.MAR/list/object X$! X$ mm_target`009ZT_DRIVER.EXE X$ mm_depend`009ZT_DRIVER.OBJ X$ mm_depend`009'dep_sysexe' X$ if evax then mm_depend`009SYS$LIBRARY:STARLET.OLB X$ mm_if_required X$ then X$`009write SYS$ERROR "Linking ZT_DRIVER ..." X$`009if evax`032 X$`009then X$`009 `009link/native/bpage=14/section/notrace/nodemand/nosysshr - X`009`009`009/sysexe/share=ZT_DRIVER.EXE/map=ZT_DRIVER.MAP/full - X`009`009`009`009SYS$INPUT:/options Xcluster=ZT_DRIVER,,,- X`009ZT_DRIVER.OBJ,- X`009SYS$LIBRARY:VMS$VOLATILE_PRIVATE_INTERFACES.OLB/LIB,- X`009SYS$LIBRARY:STARLET.OLB/include=(SYS$DOINIT,SYS$DRIVER_INIT) X Xcollect=NONPAGED_READONLY_PSECTS/attributes=resident,- X`009$$$115_DRIVER,- X $CODE$ X Xpsect_attr=$LINK$,`009`009wrt Xpsect_attr=$INITIAL$,`009`009wrt Xpsect_attr=$LITERAL$,`009`009nopic,noshr,wrt Xpsect_attr=$READONLY$,`009`009nopic,noshr,wrt Xpsect_attr=$$$105_PROLOGUE,`009nopic Xpsect_attr=$$$110_DATA,`009`009nopic Xpsect_attr=$$$115_LINKAGE,`009wrt X Xcollect=NONPAGED_READWRITE_PSECTS/attributes=resident,- X`009$$$105_PROLOGUE,- X`009$$$110_DATA,- X`009$$$115_LINKAGE,- X $PLIT$,- X $GLOBAL$,- X $OWN$,- X`009$INITIAL$,- X $LINK$,- X`009$BSS$,- X`009$DATA$,- X`009$LITERAL$,- X`009$READONLY$ X Xpsect_attr=EXEC$INIT_CODE,`009noshr Xpsect_attr=EXEC$INIT_LINKAGE,`009pic,exe,wrt X Xcollect=INITIALIZATION_PSECTS/attributes=initialization_code,- X EXEC$INIT_LINKAGE,- X EXEC$INIT_CODE,- X EXEC$INIT_000,- X EXEC$INIT_001,- X EXEC$INIT_002,- X EXEC$INIT_SSTBL_000,- X EXEC$INIT_SSTBL_001,- X EXEC$INIT_SSTBL_002 X$! X$`009else X$`009`009write SYS$ERROR "... Expect 1 %LINK-W diagnostic message ...`007" X$`009`009on error then goto mm__error X$ `009`009link ZT_DRIVER.OBJ/map/full,SYS$INPUT:/options Xbase=0 X$`009`009on warning then goto mm__error X$`009endif X$ endif X$! X$! X$!*****`009kernel mode stuff code used by 'server' images X$! X$ mm_target`009ZTSERVER.OBJ X$ mm_depend`009ZTSERVER.MAR X$ mm_depend`009ZT.MLB`009SYS$LIBRARY:LIB.MLB X$ mm_do write SYS$ERROR "Compiling ZTSERVER ..." X$ mm_do`009macro ZTSERVER.MAR/list/object X$! X$! X$!*****`009make some header files required by C programs X$! X$! NOTE: ZT.H _must_ reflect ZTDEF.MAR, X$!`009but I can't generate it automatically ... X$! X$ mm_target`009MTDEF.H`009IODEF.H X$ mm_depend`009SYS$LIBRARY:STARLET.MLB X$ mm_do write SYS$ERROR "Generating MTDEF.H and IODEF.H ..." X$ mm_do`009@GENDEF.COM`009MTDEF X$ mm_do`009@GENDEF.COM`009IODEF X$! X$ mm_target`009UCBDEF.H`009`009! not as critical as it seems, X$ mm_depend`009SYS$LIBRARY:LIB.MLB`009! since only UCB$M_VALID is used, X$ mm_do write SYS$ERROR "Generating UCBDEF.H ..." X$ mm_do`009@GENDEF.COM`009UCBDEF`009`009! and that's unlikely to ever change X$! X$! X$!*****`009a few subroutines X$! X$ mm_target`009FEHLER.OBJ`009`009! FEHLER = German for "error" X$ mm_depend`009FEHLER.C X$ mm_do write SYS$ERROR "Compiling FEHLER.C ..." X$ mm_do`009cc FEHLER.C X$! X$ mm_target`009REDIRECT.OBJ X$ mm_depend`009REDIRECT.C X$ mm_do write SYS$ERROR "Compiling REDIRECT.C ..." X$ mm_do`009cc REDIRECT.C X$! X$! X$!*****`009"memory tape" & "disk tape" servers (great for tests ...) X$! X$ mm_target`009ZT1.OBJ X$ mm_depend`009ZT1.C X$ mm_depend`009ZT.H`009UCBDEF.H`009MTDEF.H`009IODEF.H X$ mm_do write SYS$ERROR "Compiling ZT1 ..." X$ mm_do`009cc ZT1.C X$! X$ mm_target`009ZT1T.OBJ X$ mm_depend`009ZT1T.C X$ mm_do write SYS$ERROR "Compiling ZT1T ..." X$ mm_do`009cc ZT1T.C X$! X$ mm_target`009ZT1D.OBJ X$ mm_depend`009ZT1D.C X$ mm_do write SYS$ERROR "Compiling ZT1D ..." X$ mm_do`009cc ZT1D.C X$! X$ mm_target`009ZT1.EXE X$ mm_depend`009ZT1.OBJ`009ZT1T.OBJ X$ mm_depend`009ZTSERVER.OBJ X$ mm_depend`009FEHLER.OBJ`009REDIRECT.OBJ`009'd_vaxcopt' X$ mm_do write SYS$ERROR "Linking ZT1 ..." X$ mm_do`009link'q_sysexe' ZT1.OBJ,ZT1T.OBJ,ZTSERVER.OBJ,- X`009`009`009FEHLER.OBJ,REDIRECT.OBJ 'q_vaxcopt' X$! X$ mm_target`009ZT1-D.EXE X$ mm_depend`009ZT1.OBJ`009ZT1D.OBJ X$ mm_depend`009ZTSERVER.OBJ X$ mm_depend`009FEHLER.OBJ`009REDIRECT.OBJ`009'd_vaxcopt' X$ mm_do write SYS$ERROR "Linking ZT1-D ..." X$ mm_do`009link'q_sysexe' ZT1.OBJ,ZT1D.OBJ/exe=ZT1-D.EXE,ZTSERVER.OBJ,- X`009`009`009FEHLER.OBJ,REDIRECT.OBJ 'q_vaxcopt' X$! X$! X$!*****`009DECnet-based "remote tape" server X$! X$ mm_target`009ZT2.OBJ X$ mm_depend`009ZT2.C X$ mm_depend`009ZT.H`009ZTNS.H`009UCBDEF.H`009MTDEF.H`009IODEF.H X$ mm_do write SYS$ERROR "Compiling ZT2 ..." X$ mm_do`009cc ZT2.C X$! X$ mm_target`009ZT2.EXE X$ mm_depend`009ZT2.OBJ X$ mm_depend`009ZTSERVER.OBJ X$ mm_depend`009FEHLER.OBJ`009REDIRECT.OBJ`009'd_vaxcopt' X$ mm_do write SYS$ERROR "Linking ZT2 ..." V$ mm_do`009link'q_sysexe' ZT2.OBJ,ZTSERVER.OBJ,FEHLER.OBJ,REDIRECT.OBJ 'q_vax Xcopt' X$! X$! X$!*****`009DECnet-based VMS "remote tape" client X$! X$ mm_target`009ZTNS2.OBJ X$ mm_depend`009ZTNS2.C X$ mm_depend`009ZTNS.H`009MTDEF.H`009IODEF.H X$ mm_do write SYS$ERROR "Compiling ZTNS2 ..." X$ mm_do`009cc ZTNS2.C X$! X$ mm_target`009ZTNS2.EXE X$ mm_depend`009ZTNS2.OBJ X$ mm_depend`009FEHLER.OBJ`009'd_vaxcopt' X$ mm_do write SYS$ERROR "Linking ZTNS2 ..." X$ mm_do`009link ZTNS2.OBJ,FEHLER.OBJ 'q_vaxcopt' X$! X$! V$!****************** some more "private" programs *************************** X*** X$! X$!`009$ if f$search("ZT1B0.C").eqs."" then goto skip_zt1b0 X$!`009$! X$!`009$ mm_target`009ZT1B0.OBJ X$!`009$ mm_depend`009ZT1B0.C V$!`009$ mm_do write SYS$ERROR "Compiling ZT1B0 ..."`009! like ZT1, but using X _ZTB0: X$!`009$ mm_do`009cc ZT1B0.C X$!`009$! X$!`009$ mm_target`009ZT1B0.EXE X$!`009$ mm_depend`009ZT1B0.OBJ`009ZT1T.OBJ X$!`009$ mm_depend`009ZTSERVER.OBJ X$!`009$ mm_depend`009FEHLER.OBJ`009REDIRECT.OBJ`009'd_vaxcopt' X$!`009$ mm_do write SYS$ERROR "Linking ZT1B0 ..." X$!`009$ mm_do`009link'q_sysexe' ZT1B0.OBJ,ZT1T.OBJ,ZTSERVER.OBJ,- X$!`009`009`009`009`009FEHLER.OBJ,REDIRECT.OBJ 'q_vaxcopt' X$!`009$skip_zt1b0: X$! X$! X$ if f$search("ZT1T20.C").eqs."" then goto skip_zt1t20 X$! X$ mm_target`009ZT1T20.OBJ X$ mm_depend`009ZT1T20.C V$ mm_do write SYS$ERROR "Compiling ZT1T20 ..."`009! ZT offline (20s) after UN XLOAD X$ mm_do`009cc ZT1T20.C X$! X$ mm_target`009ZT1T20.EXE X$ mm_depend`009ZT1.OBJ`009ZT1T20.OBJ X$ mm_depend`009ZTSERVER.OBJ X$ mm_depend`009FEHLER.OBJ`009REDIRECT.OBJ`009'd_vaxcopt' X$ mm_do write SYS$ERROR "Linking ZT1T20 ..." X$ mm_do`009link'q_sysexe' ZT1.OBJ,ZT1T20.OBJ/exe,ZTSERVER.OBJ,- X`009`009`009`009FEHLER.OBJ,REDIRECT.OBJ 'q_vaxcopt' X$skip_zt1t20: X$! X$! X$ if f$search("ZT4.C").eqs."" then goto skip_zt4 X$ if f$search("MY_UCX_NETLIB").eqs."" X$ then X$`009write SYS$ERROR "=== MY_UCX_NETLIB not defined, ZT4_UCX not made ===" X$`009goto skip_zt4 X$ endif X$! X$ mm_target`009ZT4_UCX.OBJ X$ mm_depend`009ZT4.C X$ mm_depend`009ZT.H`009ZTNS4.H`009UCBDEF.H`009MTDEF.H`009IODEF.H X$ mm_do write SYS$ERROR "Compiling ZT4 for UCX ..."`009! ZT server via TCP/IP X$ mm_do`009cc ZT4.C/object=ZT4_UCX.OBJ/define=UCX X$! X$ mm_target`009ZT4_UCX.EXE X$ mm_depend`009ZT4_UCX.OBJ X$ mm_depend`009ZTSERVER.OBJ X$ mm_depend`009MY_UCX_NETLIB X$ mm_depend`009FEHLER.OBJ`009REDIRECT.OBJ`009'd_vaxcopt' X$ mm_do write SYS$ERROR "Linking ZT4_UCX ..." X$ mm_do`009link'q_sysexe' ZT4_UCX.OBJ,ZTSERVER.OBJ,FEHLER.OBJ,REDIRECT.OBJ,- X`009`009`009MY_UCX_NETLIB/lib 'q_vaxcopt' X$skip_zt4: X$! X$! V$!*************************************************************************** X*** X$! X$ gosub mm_cleanup X$! X$ exit X$! V$!--------------------------------------------------------------------------- X--- X$! subroutines for "make"-like dependency checking X$! w.j.m. 27-oct-1993 X$! X$! naming convention (both symbols and labels): X$!`009mm_*`009=> intended for use X$!`009mm__*`009=> visible locally (not to be used) X$!`009mm___*`009=> global symbols (not to be used) X$! X$mm_setup: mm__verify_p = 'f$verify(0,f$environ("verify_image"))'`009! GOSUB X$ mm__verify_i = f$environ("verify_image") X$ set = "set" X$ set symbol/scope=(noglobal,nolocal)/verb X$ set symbol/scope=(global,local)/general X$ if "''mm___debug'" then set verify X$ mm_target = "call mm__target"`009`009! usage: $ mm_target file[,...] ... X$ mm_depend = "call mm__depend"`009`009! usage: $ mm_depend file[,...] ... X$ mm_do = "if mm___reqd then"`009`009! usage: $ mm_do command X$ mm_if_required = "if mm___reqd"`009! usage: $ mm_if_required X$!`009`009`009`009`009!`009 $ then ... X$ mm__starttime = f$cvtim("") X$ mm___targetlist == "" X$ on warning then goto mm__error X$ on control_y then goto mm__ctly X$ return 1.or.f$verify(mm__verify_p,mm__verify_i) X$! X$mm_cleanup: ! 'f$verify(0,0)'`009`009`009`009`009`009! GOSUB X$ if "''mm___debug'" then set verify X$ if f$type(mm___targetlist).nes."" then delete/symbol/global mm___targetlist X$ if f$type(mm___tdate).nes."" then delete/symbol/global mm___tdate X$ if f$type(mm___reqd).nes."" then delete/symbol/global mm___reqd X$ return 1.or.f$verify(mm__verify_p,mm__verify_i) X$! X$! X$mm__target:`009subroutine`009! 'f$verify(0,0)' X$ if "''mm___debug'" then set verify X$ mm___targetlist == "" X$ mm___tdate == "9999-99-99"`009`009! w/o target, no reason to build X$ mm___reqd == 0 X$ args = f$edit(p1+","+p2+","+p3+","+ p4+","+ p5+","+p6+","+p7+","+p8,- X`009`009"collapse,trim") X$ i = 0 X$aloop: X$ arg = f$element(i,",",args) X$ if arg.eqs."," then goto aloop_end X$ if arg.nes."" X$ then X$`009if f$search(arg).eqs."" X$`009then X$`009`009mm___tdate == " "`009! target missing X$`009`009mm___reqd == 1 X$`009else X$`009`009rdt = f$cvtim(f$file(arg,"rdt")) X$`009`009if rdt.lts.mm___tdate then mm___tdate == rdt X$`009endif X$ endif X$ i = i + 1 X$ goto aloop X$aloop_end: X$ mm___targetlist == args X$ exit 1.or.f$verify(mm__verify_p,mm__verify_i) X$ endsubroutine X$! X$! X$mm__depend:`009subroutine`009! 'f$verify(0,0)' X$ if "''mm___debug'" then set verify X$ on warning then exit $status + f$verify(mm__verify_p,mm__verify_i)*0 X$ args = f$edit(p1+","+p2+","+p3+","+ p4+","+ p5+","+p6+","+p7+","+p8,- X`009`009"collapse,trim") X$ i = 0 X$aloop: X$ arg = f$element(i,",",args) X$ if arg.eqs."," then goto aloop_end X$ if arg.nes."" X$ then X$`009if f$cvtim(f$file(arg,"rdt")).gts.mm___tdate then mm___reqd == 1 X$ endif X$ i = i + 1 X$ goto aloop X$aloop_end: X$ exit 1.or.f$verify(mm__verify_p,mm__verify_i) X$ endsubroutine X$! X$! X$!-----`009error handler, will delete curerent target(s) and exit X$!`009... so we need not care for symbol naming here X$! X$mm__error: ! 'f$verify(0,0)'`009`009`009`009`009`009! GOTO X$ xstat = $status X$ goto mm__handler X$mm__ctly: ! 'f$verify(0,0)'`009`009`009`009`009`009! GOTO X$ xstat = %x00000614`009`009`009! F, SS$_CONTROLY X$mm__handler: X$ if "''mm___debug'" then set verify X$ set noon X$ if f$type(mm__starttime).eqs."" then goto mm__handler_del_done X$ if f$type(mm___targetlist).eqs."" then goto mm__handler_del_done X$ i = 0 X$mm__handler_del_loop:`009`009`009`009! ... delete targets on error X$ arg = f$element(i,",",mm___targetlist) X$ if arg.eqs."," then goto mm__handler_del_done X$ if arg.nes."" X$ then X$`009fn = f$search(arg) X$`009if fn.nes."" X$`009then X$`009`009cdt = f$cvtim(f$file(fn,"cdt")) X$`009`009if cdt.ges.mm__starttime then delete/log 'fn' X$`009endif X$ endif X$ i = i + 1 X$ goto mm__handler_del_loop X$mm__handler_del_done: X$ gosub mm_cleanup X$ exit xstat X$ stop $ GOSUB UNPACK_FILE $ FILE_IS = "ZT.H" $ CHECKSUM_IS = 1145650997 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X/* definitions used by ZT "server" programs calling ZTSERVER */ X/***** these definitions must match ZTDEF.MAR & ZTSERVER *****/ X X/*`009Version 0.99A`009`009*/ X Xtypedef struct ZTmsg `123 X#if defined(__alpha)`009/* goes with definition of EVAX in MACRO programs */ X`009union `123 X`009`009short w[4]; X`009`009unsigned short uw[4]; X`009`009unsigned int ul[2]; X`009`125 media; X`009unsigned int devdepend; X`009int record; X`009unsigned int ucbsts; X`009unsigned int devchar; X`009unsigned int func; X`009unsigned int bcnt; X`009unsigned int iosts; X`009unsigned int iobct; X#else X`009unsigned short iosts; X`009unsigned short iobct; X`009unsigned int devdepend; X`009int record; X`009unsigned short ucbsts; X`009unsigned short fill1; X`009unsigned int 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 int ul[2]; X`009`125 media; X#endif 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 int bct; X`009unsigned char *addr; X`125 ZT_BUFDSC; $ GOSUB UNPACK_FILE $ FILE_IS = "ZT1.C" $ CHECKSUM_IS = 393138267 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X/*`009first test of ZTDRIVER ... X`009w.j.m. jun 1989 X`009mod 28-dec-1990 wjm: VMS V5.4 *always* does end-of-volume recognition, X`009`009`009`009no longer dependent upon FOREIGN MOUNT. X`009`009`009 Old behaviour now only with PRE_V54 defined. X`009fix 14-jan-1991 wjm: fix(?) file count returned when reverse X`009`009`009`009SKIPFILE hits BOT (required for 5.4 MTAAACP) X`009mod 22-oct-1993 wjm: (AXP) split off "zt.h", replace 'long' by 'int' X`009mod 25-feb-1994 wjm: optionally argv[1] = "ZT" device name, X`009`009`009`009pass optional argv[2] to tape_init(). X*/ X X#ifndef TRACE X#define TRACE 1 X#endif X V#ifndef PRE_V54`009`009/* might be conditional on UCBDEF or IODEF;`009 */`0 X09 X#define PRE_V54 0`009/* e.g. UCB$L_SHAD & IO$V_MOVEFILE are new in V5.4 */ X#endif X X/* ZT definitions (must match ZTDEF.MAR & ZTSERVER.MAR) */ X#include "zt.h" 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#if PRE_V54 X#include devdef X#endif 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(char * /*disk file name*/); 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 int *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(char *argv2) X`123 X`009tape_init(argv2); 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: -+-+-+-+-+ End of part 1 +-+-+-+-+-