js@UW-JUNE.ARPA (Joe Meadows) (06/28/86)
Heres FILE. It needs BASIC and MACRO to compile. Sorry that I didn't include a help file. Guess I'm just too lazy. You should be able to figure it out from the .CLD file. Note that you can say FILE/DISPLAY=restore.com Filename, and then after you've munged a file to no avail, you can restore it by saying @restore. Happy bit twiddling. Joe Meadows Jr. js@uw-june.arpa $say:=write sys$output $say "Creating fat_fch.def" $create fat_fch.def $deck ! FAT_FCH.DEF - include file for FILE.BAS declare long constant & FAT$B_BKTSIZE =x'000000E'l, & FAT$B_RATTRIB =x'0000001'l, & FAT$B_RTYPE =x'0000000'l, & FAT$B_VFCSIZE =x'000000F'l, & FAT$C_DIRECT =x'0000003'l, & FAT$C_FIXED =x'0000001'l, & FAT$C_INDEXED =x'0000002'l, & FAT$C_LENGTH =x'0000020'l, & FAT$C_RELATIVE =x'0000001'l, & FAT$C_SEQUENTIAL=x'0000000'l, & FAT$C_STREAM =x'0000004'l, & FAT$C_STREAMCR =x'0000006'l, & FAT$C_STREAMLF =x'0000005'l, & FAT$C_UNDEFINED =x'0000000'l, & FAT$C_VARIABLE =x'0000002'l, & FAT$C_VFC =x'0000003'l, & FAT$K_LENGTH =x'0000020'l, & FAT$L_EFBLK =x'0000008'l, & FAT$L_HIBLK =x'0000004'l, & FAT$M_FORTRANCC =x'0000001'l, & FAT$M_IMPLIEDCC =x'0000002'l, & FAT$M_NOSPAN =x'0000008'l, & FAT$M_PRINTCC =x'0000004'l, & FAT$S_FATDEF =x'0000020'l, & FAT$S_FILEORG =x'0000004'l, & FAT$S_RTYPE =x'0000004'l, & FAT$V_FILEORG =x'0000004'l, & FAT$V_FORTRANCC =x'0000000'l, & FAT$V_IMPLIEDCC =x'0000001'l, & FAT$V_NOSPAN =x'0000003'l, & FAT$V_PRINTCC =x'0000002'l, & FAT$V_RTYPE =x'0000000'l, & FAT$W_DEFEXT =x'0000012'l, & FAT$W_EFBLKH =x'0000008'l, & FAT$W_EFBLKL =x'000000A'l, & FAT$W_FFBYTE =x'000000C'l, & FAT$W_GBC =x'0000014'l, & FAT$W_HIBLKH =x'0000004'l, & FAT$W_HIBLKL =x'0000006'l, & FAT$W_MAXREC =x'0000010'l, & FAT$W_RSIZE =x'0000002'l, & FAT$W_VERSIONS =x'000001E'l, & FCH$M_BADACL =x'0000800'l, & FCH$M_BADBLOCK =x'0004000'l, & FCH$M_CONTIG =x'0000080'l, & FCH$M_CONTIGB =x'0000020'l, & FCH$M_DIRECTORY =x'0002000'l, & FCH$M_ERASE =x'0020000'l, & FCH$M_LOCKED =x'0000040'l, & FCH$M_MARKDEL =x'0008000'l, & FCH$M_NOBACKUP =x'0000002'l, & FCH$M_NOCHARGE =x'0010000'l, & FCH$M_READCHECK =x'0000008'l, & FCH$M_SPOOL =x'0001000'l, & FCH$M_WRITCHECK =x'0000010'l, & FCH$M_WRITEBACK =x'0000004'l, & FCH$S_FCHDEF =x'0000004'l, & FCH$V_BADACL =x'000000B'l, & FCH$V_BADBLOCK =x'000000E'l, & FCH$V_CONTIG =x'0000007'l, & FCH$V_CONTIGB =x'0000005'l, & FCH$V_DIRECTORY =x'000000D'l, & FCH$V_ERASE =x'0000011'l, & FCH$V_LOCKED =x'0000006'l, & FCH$V_MARKDEL =x'000000F'l, & FCH$V_NOBACKUP =x'0000001'l, & FCH$V_NOCHARGE =x'0000010'l, & FCH$V_READCHECK =x'0000003'l, & FCH$V_SPOOL =x'000000C'l, & FCH$V_WRITCHECK =x'0000004'l, & FCH$V_WRITEBACK =x'0000002'l $eod $say "Creating fat_fch.mar" $create fat_fch.mar $deck .title modify file attributes .library /sys$share:lib/ $atrdef $fabdef $fatdef $fibdef $iodef $namdef $rmsdef .psect write_data pic,rd,wrt,noexe,noshr fab_blk: $fab nam_blk: $nam ess=nam$c_maxrss,- rss=nam$c_maxrss atr_block: .word atr$s_uchar .word atr$c_uchar f1: .long 0 ;.address fch .word atr$s_recattr .word atr$c_recattr f2: .long 0 ;.address fat .long 0 fib_block: .blkb fib$k_length fib_desc: .long fib$k_length .long fib_block dev_desc: .blkl 1 f3: .long 0 ;.address nam_blk+nam$t_dvi+1 dev_chan: .blkw 1 es_name: .blkb nam$c_maxrss rs_name: .blkb nam$c_maxrss fat: .blkb 32 fch: .blkl 1 iostatus: .quad f_flg: .byte 0 ; fixup vectors flag filename = 4 filechar = 8 .psect code pic,rd,nowrt,exe,shr .entry get_file_char,^m<r2,r3,r4,r5,r6,r7> jsb fixups movq @filename(ap),r6 ; move filename descriptor into r6,r7 movb r6,fab_blk+fab$b_fns ; file name size movl r7,fab_blk+fab$l_fna ; file name address ; parse the filename $parse fab=fab_blk jsb error ; find the file $search fab=fab_blk jsb error ; assign a channel to the device movzbl nam_blk+nam$t_dvi,dev_desc $assign_s - devnam=dev_desc,- chan=dev_chan jsb error ; store the file id in the FIB structure movc3 #6,nam_blk+nam$w_fid,fib_block+fib$w_fid $qiow_s - chan=dev_chan,- func=#io$_access,- iosb=iostatus,- p1=fib_desc,- p5=#atr_block jsb error ; get the real return status movzwl iostatus,r0 jsb error ; deassign the channel to the device $dassgn_s - chan=dev_chan jsb error ; send the file attributes/characteristics back to the caller movc3 #36,fat,@filechar(ap) movl #1,r0 ret .entry set_file_char,0 jsb fixups movq @filename(ap),r6 ; move filename descriptor into r6,r7 movb r6,fab_blk+fab$b_fns ; file name size movl r7,fab_blk+fab$l_fna ; file name address $parse fab=fab_blk jsb error $search fab=fab_blk jsb error movw nam_blk+nam$w_fid,fib_block+fib$w_fid movw nam_blk+nam$w_fid+2,fib_block+fib$w_fid+2 movw nam_blk+nam$w_fid+4,fib_block+fib$w_fid+4 movzbl nam_blk+nam$t_dvi,dev_desc $assign_s - devnam=dev_desc,- chan=dev_chan jsb error movc3 #36,@filechar(ap),fat $qiow_s - chan=dev_chan,- func=#io$_modify,- iosb=iostatus,- p1=fib_desc,- p5=#atr_block jsb error movzwl iostatus,r0 jsb error $dassgn_s - chan=dev_chan jsb error movl #1,r0 ret error: blbc r0,10$ rsb 10$: ret fixups: tstb f_flg ; have we already fixed these addresses? bneq 10$ ; yes, skip the following $fab_store - fab=fab_blk, - nam=nam_blk $nam_store - nam=nam_blk, - esa=es_name, - rsa=rs_name movab fch,f1 movab fat,f2 movab nam_blk+nam$t_dvi+1,f3 incb f_flg ; remember that we already did the fixups 10$: rsb .end $eod $say "Creating file.bas" $create file.bas $deck 10 ! FILE Version 1.0 June 1st, 1985 ! Written by Joe Meadows Jr., with thanks to the ! Fred Hutchinson Cancer Research Center for kindly ! allowing me to use their computing resources. ! ! If you have any questions, comments, ideas, or ! whatever, feel free to contact me via US Mail : ! Joe Meadows Jr. ! 4841 268th Ave. N.E. ! Redmond Wa. 98052 ! or via phone : (206) 827-7296 map (fatfch) & byte rtype, & byte rattrib, & word rsize, & word hiblkh, & word hiblkl, & word efblkh, & word efblkl, & word ffbyte, & byte bktsize, & byte vfcsize, & word maxrec, & word defext, & word gbc, & byte fill(6), & word notused, & word versions, & long fch external long function get_file_char external long function set_file_char external long function cli$present(string) external long function cli$get_value(string,string) external long function lib$find_file(string,string,long) external long function lib$find_file_end(long) external long function changeit external long function antichangeit %include "fat_fch.def" declare long context declare long retstat declare word organ declare byte display declare long efblk declare long hiblk display=(cli$present('DISPLAY') and 1%) goto 15 unless display if (cli$get_value('DISPLAY',OUT$) and 1%) then open out$ for output as file #1 else open "SYS$OUTPUT:" for output as file #1 end if nomargin #1 15 retstat=cli$present('P1') call sys$exit(retstat by value) unless (retstat and 1%) retstat=cli$get_value('P1',Filename$) ! What? No file specified? CLD doesn't allow this.... call sys$exit(retstat by value) unless (retstat and 1%) ! okay, we have our first file on the list, doin good. ! there may be more.. Who cares, anyway, let's go find the meat goto 30 20 retstat=cli$get_value('P1',Filename$) goto 90 unless (retstat and 1%) 30 context=0 retstat=lib$find_file(filename$,real$,context) ! What? They specified a bogus file? call sys$exit(retstat by value) unless (retstat and 1%) ! okay, at least one file exists, let's keep going goto 50 40 retstat=lib$find_file(filename$,real$,context) goto 20 unless (retstat and 1%) 50 retstat = get_file_char(real$,rtype) call lib$signal(retstat by value) unless (retstat and 1%) goto 60 unless (display and 1%) print #1, "$ FILE ";real$;" -" organ = (rtype and x'00f0'w)/16% rtype=rtype and x'0f'b print #1, " /TYPE="; select rtype case fat$c_undefined print #1, "undefined -" case fat$c_fixed print #1, "fixed -" case fat$c_variable print #1, "variable -" case fat$c_vfc print #1, "vfc -" case fat$c_stream print #1, "stream -" case fat$c_streamlf print #1, "lfstream -" case fat$c_streamcr print #1, "crstream -" end select print #1, " /ORGANIZATION="; select organ case fat$c_sequential print #1, "sequential -" case fat$c_relative print #1, "relative -" case fat$c_indexed print #1, "indexed -" case fat$c_direct print #1, "direct -" end select A$=" /ATTRIBUTES=(" A$=A$+"no" unless (rattrib and fat$m_fortrancc) A$=A$+"fortrancc," A$=A$+"no" unless (rattrib and fat$m_impliedcc) A$=A$+"impliedcc," A$=A$+"no" unless (rattrib and fat$m_printcc) A$=A$+"printcc," A$=A$+"no" if (rattrib and fat$m_nospan) A$=A$+"span) -" print #1, a$ print #1, " /RECORD_SIZE=";num1$(rsize);" -" hiblk = hiblkl+hiblkh*x'100'w print #1, " /HIGHEST_ALLOCATED_BLOCK=";num1$(hiblk);" -" efblk = efblkl+efblkh*x'100'w print #1, " /END_OF_FILE_BLOCK=";num1$(efblk);" -" print #1, " /FIRST_FREE_BYTE=";num1$(ffbyte);" -" print #1, " /BUCKET_SIZE=";num1$(bktsize);" -" print #1, " /VFC_SIZE=";num1$(vfcsize);" -" print #1, " /MAXIMUM_RECORD_SIZE=";num1$(maxrec);" -" print #1, " /DEFAULT_EXTEND_QUANTITY=";num1$(defext);" -" print #1, " /GLOBAL_BUFFER_COUNT=";num1$(gbc);" -" print #1, " /VERSIONS=";num1$(versions);" -" A$=" /CHARACTERISTICS=(" a$=a$+"no" if (fch and fch$m_nobackup) a$=a$+"backup," a$=a$+"no" unless (fch and fch$m_writeback) a$=a$+"write_back," a$=a$+"no" unless (fch and fch$m_readcheck) a$=a$+"read_verify," a$=a$+"no" unless (fch and fch$m_writcheck) a$=a$+"write_verify," a$=a$+"no" unless (fch and fch$m_contigb) a$=a$+"best_try_contiguous," a$=a$+"no" unless (fch and fch$m_locked) a$=a$+"locked," a$=a$+"no" unless (fch and fch$m_contig) a$=a$+"contiguous," a$=a$+"no" unless (fch and fch$m_badacl) a$=a$+"acl_corrupt," a$=a$+"no" unless (fch and fch$m_spool) a$=a$+"spool," a$=a$+"no" unless (fch and fch$m_directory) a$=a$+"directory," a$=a$+"no" unless (fch and fch$m_badblock) a$=a$+"file_corrupt," a$=a$+"no" unless (fch and fch$m_markdel) a$=a$+"marked_for_delete," a$=a$+"no" if (fch and fch$m_nocharge) a$=a$+"charge," a$=a$+"no" unless (fch and fch$m_erase) a$=a$+"erase_on_delete)" print #1, a$ 60 ! parse the /TYPE if (cli$present('TYPE') and 1%) then call cli$get_value('TYPE',a$) rtype=fat$c_undefined if (a$=left$("undefined",len(a$))) rtype=fat$c_fixed if (a$=left$("fixed",len(a$))) rtype=fat$c_variable if (a$=left$("variable",len(a$))) rtype=fat$c_vfc if (a$=left$("vfc",len(a$))) rtype=fat$c_stream if (a$=left$("stream",len(a$))) rtype=fat$c_streamlf if (a$=left$("lfstream",len(a$))) rtype=fat$c_streamcr if (a$=left$("crstream",len(a$))) end if ! parse the /organization if (cli$present('ORGANIZATION') and 1%) then call cli$get_value('ORGANIZATION',a$) organ=fat$c_direct if (a$=left$("direct",len(a$))) organ=fat$c_indexed if (a$=left$("indexed",len(a$))) organ=fat$c_relative if (a$=left$("relative",len(a$))) organ=fat$c_sequential if (a$=left$("sequential",len(a$))) end if rtype=rtype or organ*16% ! parse the /attributes A$="ATTRIBUTES." retstat=rattrib retstat=changeit(retstat,cli$present(A$+"FORTRANCC"),fat$m_fortrancc) retstat=changeit(retstat,cli$present(A$+"IMPLIEDCC"),fat$m_impliedcc) retstat=changeit(retstat,cli$present(A$+"PRINTCC"),fat$m_printcc) retstat=changeit(retstat,cli$present(A$+"SPAN"),fat$m_nospan) rattrib=(retstat and x'ff'b) ! parse the /record_size if (cli$present('RECORD_SIZE') and 1%) then call cli$get_value('RECORD_SIZE',a$) rsize=val(a$) end if ! parse the /highest_allocated_block if (cli$present('HIGHEST_ALLOCATED_BLOCK') and 1%) then call cli$get_value('HIGHEST_ALLOCATED_BLOCK',a$) hiblk = val(a$) hiblkl = (hiblk and x'ffff'w) hiblkh = hiblk/x'100'w end if ! parse the /end_of_file_block if (cli$present('END_OF_FILE_BLOCK') and 1%) then call cli$get_value('END_OF_FILE_BLOCK',a$) efblk = val(a$) efblkl = (efblk and x'ffff'w) efblkh = efblk/x'100'w end if ! parse the /first_free_byte if (cli$present('FIRST_FREE_BYTE') and 1%) then call cli$get_value('FIRST_FREE_BYTE',a$) ffbyte = val(a$) end if ! parse the /bucket_size if (cli$present('BUCKET_SIZE') and 1%) then call cli$get_value('BUCKET_SIZE',a$) bktsize = val(a$) end if ! parse the /vfc_size if (cli$present('VFC_SIZE') and 1%) then call cli$get_value('VFC_SIZE',a$) vfcsize = val(a$) end if ! parse the /maximum_record_size if (cli$present('MAXIMUM_RECORD_SIZE') and 1%) then call cli$get_value('MAXIMUM_RECORD_SIZE',a$) maxrec = val(a$) end if ! parse the /default_extend_quantity if (cli$present('DEFAULT_EXTEND_QUANTITY') and 1%) then call cli$get_value('DEFAULT_EXTEND_QUANTITY',a$) defext = val(a$) end if ! parse the /global_buffer_count if (cli$present('GLOBAL_BUFFER_COUNT') and 1%) then call cli$get_value('GLOBAL_BUFFER_COUNT',a$) gbc = val(a$) end if ! parse the /versions if (cli$present('VERSIONS') and 1%) then call cli$get_value('VERSIONS',a$) versions = val(a$) end if ! parse the /characteristics A$="CHARACTERISTICS." fch=antichangeit(fch,cli$present(A$+"BACKUP"),fch$m_nobackup) fch=changeit(fch,cli$present(A$+"WRITE_BACK"),fch$m_writeback) fch=changeit(fch,cli$present(A$+"READ_VERIFY"),fch$m_readcheck) fch=changeit(fch,cli$present(A$+"WRITE_VERIFY"),fch$m_writcheck) fch=changeit(fch,cli$present(A$+"LOCKED"),fch$m_locked) fch=changeit(fch,cli$present(A$+"CONTIGUOUS"),fch$m_contig) fch=changeit(fch,cli$present(A$+"BEST_TRY_CONTIGUOUS"),fch$m_contigb) fch=changeit(fch,cli$present(A$+"ACL_CORRUPT"),fch$m_badacl) fch=changeit(fch,cli$present(A$+"SPOOL"),fch$m_spool) fch=changeit(fch,cli$present(A$+"DIRECTORY"),fch$m_directory) fch=changeit(fch,cli$present(A$+"FILE_CORRUPT"),fch$m_badblock) fch=changeit(fch,cli$present(A$+"MARKED_FOR_DELETE"),fch$m_markdel) fch=changeit(fch,cli$present(A$+"ERASE_ON_DELETE"),fch$m_erase) fch=antichangeit(fch,cli$present(A$+"CHARGE"),fch$m_nocharge) retstat = set_file_char(real$,rtype) goto 40 90 end 100 function long changeit(long what, long condition, long thebit) external long constant cli$_negated external long constant cli$_present select condition case cli$_negated what=what and not thebit case cli$_present what=what or thebit end select changeit=what functionend 200 function long antichangeit(long what, long condition, long thebit) external long constant cli$_negated external long constant cli$_present select condition case cli$_present what=what and not thebit case cli$_negated what=what or thebit end select antichangeit=what functionend $eod $say "Creating file.cld" $create file.cld $deck !*************************************FILE************************************** define type RECORD_TYPE keyword FIXED keyword VARIABLE keyword VFC keyword UNDEFINED keyword STREAM keyword LFSTREAM keyword CRSTREAM define type FILE_ORGANIZATION keyword DIRECT keyword INDEXED keyword RELATIVE keyword SEQUENTIAL define type RECORD_ATTRIBUTES keyword FORTRANCC negatable keyword IMPLIEDCC negatable keyword PRINTCC negatable keyword SPAN negatable define type FILE_CHARACTERISTICS keyword BACKUP negatable keyword WRITE_BACK negatable keyword READ_VERIFY negatable keyword WRITE_VERIFY negatable keyword LOCKED negatable keyword CONTIGUOUS negatable keyword BEST_TRY_CONTIGUOUS negatable keyword ACL_CORRUPT negatable keyword SPOOL negatable keyword DIRECTORY negatable keyword FILE_CORRUPT negatable keyword MARKED_FOR_DELETE negatable keyword ERASE_ON_DELETE negatable keyword CHARGE negatable define verb FILE image EXE$DIR:FILE parameter P1 , prompt="File" value (required,list,type=$infile) qualifier TYPE value (required,type=RECORD_TYPE) qualifier ORGANIZATION value (required,type=FILE_ORGANIZATION) qualifier ATTRIBUTES value (required,list,type=RECORD_ATTRIBUTES) qualifier RECORD_SIZE value (required,type=$number) qualifier HIGHEST_ALLOCATED_BLOCK value (required,type=$number) qualifier END_OF_FILE_BLOCK value (required,type=$number) qualifier FIRST_FREE_BYTE value (required,type=$number) qualifier BUCKET_SIZE value (required,type=$number) qualifier VFC_SIZE value (required,type=$number) qualifier MAXIMUM_RECORD_SIZE value (required,type=$number) qualifier DEFAULT_EXTEND_QUANTITY value (required,type=$number) qualifier GLOBAL_BUFFER_COUNT value (required,type=$number) qualifier VERSIONS value (required,type=$number) qualifier CHARACTERISTICS value (required,list,type=FILE_CHARACTERISTICS) qualifier DISPLAY value (type=$outfile) $eod $say "Compiling file.bas" $basic file $say "Compiling fat_fch.mar" $macro fat_fch $say "Linking file,fat_fch" $link file,fat_fch $say "Defining command FILE (file.cld)" $set command file $say "Define EXE$DIR to point to where you store FILE.EXE (or change FILE.CLD)" $say "Sorry that there is no help. The CLD should clarify what the program does" $say "If you can't figure it out, then you probably shouldn't try using it." $say "Good luck."
Rudy.Nedved@A.CS.CMU.EDU.UUCP (06/28/86)
Don't send programs in the mail to a mailing list!!! It is bad enough half the people on this list don't bother reading the documentation but to send programs that I would not be caught trying to compile is totally anti-social and a massive hemmorage of many disk drives and communication channels. Make the programs available by requests or thru BITSERVER or a anonymous tcp/ip ftp access or by posting to USENET mod.sources. I can't wait for sites to start charging for mail. -Rudy
js@UW-JUNE.ARPA.UUCP (06/28/86)
Sorry about that. Noones ever said anything in the past, so I assumed it was kosher. But then again, I probably let it use the default distribution of 'mod' and this time I said 'world'. Perhaps that makes a difference? I guess I'll have to take some time and figure out how to do that (making things available through Bitnet or Ftp). Better yet, I need to figure out how this whole darn thing works.. Little things like, how many requests warrants a posting, where to post, etc. would be nice to know too. I suppose I should go find the netiquette. Thanks for making me aware of the problem.. Cheers. Joe Meadows Jr. js@uw-june.arpa
LEICHTER-JERRY@YALE.ARPA (07/02/86)
Don't send programs in the mail to a mailing list!!! It is bad enough half the people on this list don't bother reading the documentation but to send programs that I would not be caught trying to compile is totally anti-social and a massive hemmorage of many disk drives and communication channels. Make the programs available by requests or thru BITSERVER or a anonymous tcp/ip ftp access or by posting to USENET mod.sources. I can't wait for sites to start charging for mail. -Rudy I disagree; I find nothing objectionable in the posting of programs as a general practice, or in the particular programs in question. There is nothing "anti-social" about the FILE program; the worst you can do is screw up one of your own files, and perhaps your own process. (Yes, I know there is a VMS 4.3 bug - fixed in 4.4 - that FILE could trigger, causing a crash. The "anti-social" message was the recent one pointing out the details of this bug.) My own feelings on program postings are: - Post only programs of general utility. It can be hard to determine "general utility" in some cases, but often there's little doubt. Certainly, any program that is a response to a request to "anyone who has a program to do...", is likely to be of general interest. - Post only reasonably short programs (say, up to 30 blocks or so); - Don't post anything until you are pretty sure it's fully debugged. The last thing we need is a posting followed by 100 bug fixes. - DON'T post system crashers. The volume of program posting to this list has been fairly small, well below the point where I, for one, would see it as a problem. To the contrary, I've picked up some really useful stuff this way. If it DOES become a problem, we can deal with it then. Obviously, there are differences of opinion on this issue. Comments? -- Jerry -------