[comp.os.vms] VERB - decompiles DCLTABLES part 2/4

hydrovax@nmtsun.nmt.edu (M. Warner Losh) (02/02/88)

$Part2:
$ File_is="COMMAND.MAR"
$ Check_Sum_is=925912480
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X`009.title print command block
X
X; VERB Version 1.0 June 1st, 1985
X; Written  by Joe Meadows Jr.,  with thanks  to the
X; Fred Hutchinson Cancer Research Center for kindly
X; allowing  me to  use  their  computing  resources.
X;
X; If  you  have any  questions, comments, ideas, or
X; whatever, feel free to contact me via US Mail :
X;`009Joe Meadows Jr.
X;`0094841 268th Ave. N.E.
X;`009Redmond Wa. 98052
X; or via phone : (206) 827-7296
X
X`009.library 'clexlib'
X
X`009.entry`009clex_print_command,^m<r2,r3,r4,r5,r6,r7>
X`009; 4(ap) = address of command block
X
X`009movl`0094(ap),r6
X
X5$:`009bitw`009#cmd_m_parms,cmd_w_flags(r6)
X`009beql`00910$
X`009tstl`009cmd_l_parms(r6)
X`009beql`00910$
X`009addl3`009clex_table,cmd_l_parms(r6),-(sp)
X`009calls`009#1,clex_evaluate_entity
X
X10$:`009bitw`009#cmd_m_quals,cmd_w_flags(r6)
X`009beql`00920$
X`009tstl`009cmd_l_quals(r6)
X`009beql`00920$
X`009addl3`009clex_table,cmd_l_quals(r6),-(sp)
X`009calls`009#1,clex_evaluate_entity
X
X20$:`009movzwl`009cmd_w_name(r6),r7
X`009addl`009r6,r7
X`009case`009cmd_b_subtype(r6),type=b,limit=#1,<-
X`009`009_verb,-
X`009`009_syntax>
X
X`009movl`009#0,r0`009; invalid
X`009ret
X
X_verb:`009add_string`009<'define verb '>`009
X`009movzbl`009(r7),r2`009; save size of entire thing
X`009movzbl`0091(r7),r3`009; save size of verb name
X_verb1:`009incl`009r7`009; point to first ascic
X`009add_ascic_trunc`009r7,r3
X`009decl`009r2`009; subtract off extra byte for count byte
X
X`009movzbl`009(r7),r4`009; assume verb bigger than synonym
X`009cmpb`009(r7),r3`009; is synonym bigger than verb?
X`009bleq`009_verb2
X`009movzbl`009r3,r4`009; if so it got truncated by CDU
X`009add_string`009<'   !! warning, synonym truncated'>
X_verb2:`009calls`009#0,g^put_output
X`009subb`009r4,r2`009; subtract off printed portion.
X`009beql`009_verb3
X
X`009addl`009r4,r7
X`009tstb`0091(r7)
X`009beql`009_verb1`009; if zero length string , skip to next.
X`009add_string`009<'   synonym '>
X`009brb`009_verb1
X_verb3:`009brb`009_continue
X
X_syntax:
X`009add_string`009<'define syntax '>
X`009add_ascic`009r7
X
X_continue:
X`009calls`009#0,put_output
X
X`009movzwl`009cmd_w_image(r6),r7
X`009addl`009r6,r7
X`009clrl`009_clex_handler_flag
X
X`009case`009cmd_b_handler(r6),type=b,limit=#0,<-
X`009`009_print_prefix,-`009; no handler
X`009`009_handler_cli,-
X`009`009_handler_user,-
X`009`009_handler_image,-
X`009`009_handler_same>
X`009movl`009#0,r0`009; invalid handler
X`009ret
X
X_handler_cli:
X`009add_string`009<'   cliroutine '>
X`009add_ascic`009r7
X`009bitw`009#^x1F,cmd_w_flags(r6)`009; any cliflags?
X`009bneq`009_handler_cli1
X`009calls`009#0,g^put_output
X`009brw`009_print_prefix
X_handler_cli1:
X`009clrq`009r4
X`009add_string`009<' , cliflags ('>
X`009moval`009table_cli_flags,r3
X_handler_cli2:
X`009bbc`009r4,cmd_w_flags(r6),_handler_cli4
X`009tstl`009r5
X`009beql`009_handler_cli3
X`009add_string`009<','>
X_handler_cli3:
X`009incl`009r5
X`009add_ascic`009(r3)[r4]
X_handler_cli4:
X`009aobleq`009#4,r4,_handler_cli2
X`009add_string`009<')'>
X`009calls`009#0,g^put_output
X`009brw`009_print_prefix
X
X_handler_user:
X`009add_string`009<'   routine '>
X`009add_ascic`009r7
X`009calls`009#0,g^put_output
X`009brw`009_print_prefix
X
X_handler_image:
X`009add_string`009<'   image '>
X`009add_ascic`009r7
X`009calls`009#0,g^put_output
X`009brw`009_print_prefix
X
X_handler_same:
X`009movl`009#1,_clex_handler_flag
X`009brw`009_print_prefix
X
X_print_prefix:
X`009movzwl`009cmd_w_prefix(r6),r7
X`009beql`009_print_parms
X`009addl`009r6,r7
X`009add_string`009<'   prefix '>
X`009add_ascic`009r7
X`009calls`009#0,g^put_output
X
X_print_parms:
X`009bitw`009#cmd_m_parms,cmd_w_flags(r6)
X`009beql`009_print_quals
X`009tstl`009cmd_l_parms(r6)
X`009bneq`009_print_parms_1
X`009add_string`009<'   noparameters'>
X`009calls`009#0,g^put_output
X`009brb`009_print_quals
X_print_parms_1:
X`009addl3`009clex_table,cmd_l_parms(r6),-(sp)
X`009calls`009#1,clex_print_entity
X_print_quals:`009
X`009bitw`009#cmd_m_quals,cmd_w_flags(r6)
X`009beql`009_print_disallows
X`009tstl`009cmd_l_quals(r6)
X`009bneq`009_print_quals_1
X`009add_string`009<'   noqualifiers'>
X`009calls`009#0,g^put_output
X`009brb`009_print_disallows
X_print_quals_1:
X`009addl3`009clex_table,cmd_l_quals(r6),-(sp)
X`009calls`009#1,clex_print_entity
X_print_disallows:`009
X`009bitw`009#cmd_m_disallows,cmd_w_flags(r6)
X`009beql`009_print_outputs
X`009tstl`009cmd_l_disallow(r6)
X`009beql`009_print_outputs
X`009add_string`009<'   disallow '>
X
X`009pushl`009r6
X`009addl3`009clex_table,cmd_l_disallow(r6),-(sp)
X`009calls`009#2,clex_print_disallows
X`009calls`009#0,g^put_output
X`009brb`009_print_outputs
X
X_print_outputs:
X`009clrl`009r5
X`009movzwl`009cmd_w_outputs(r6),r3`009; BRO outputs list
X`009beql`009_end_of_command
X`009addl`009r6,r3`009`009`009; point to ascic of outputs
X`009movzbl`009(r3),r4`009; number of outputs
X`009beql`009_end_of_command`009; see if there is indeed any outputs
X`009incl`009r3
X`009add_string`009<'   outputs('>
X`009brb`009_print_continue
X_print_out_loop:
X`009add_string`009<','>
X_print_continue:
X`009movb`009(r3)[r5],r2
X`009blss`009_print_out_parm
X`009addl3`009clex_table,cmd_l_quals(r6),r7`009; r7 is address of first entity
X`009brb`009_get_entity_loop
X_print_out_parm:
X`009mnegb`009r2,r2
X`009addl3`009clex_table,cmd_l_parms(r6),r7
X_get_entity_loop:
X`009decb`009r2
X`009beql`009_print_this_output
X`009addl3`009clex_table,ent_l_next(r7),r7
X`009brb`009_get_entity_loop
X_print_this_output:
X`009movzwl`009ent_w_label(r7),r2
X`009addl`009r7,r2
X`009add_ascic`009r2
X`009aoblss`009r4,r5,_print_out_loop
X`009add_string`009<')'>`009
X`009calls`009#0,g^put_output
X
X_end_of_command:
X`009ret
X
X`009.psect`009string_table`009rd,nowrt,noexe
Xtable_cli_flags:
X`009string`009<'abbreviate'>
X`009string`009<'nostatus'>
X`009string`009<'foreign'>
X`009string`009<'immediate'>
X`009string`009<'mcrparse'>
X
X`009.end
$ GoSub Convert_File
$ File_is="COMPILE.COM"
$ Check_Sum_is=119238091
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X$ err=0
X$ if p1.nes."" then goto got_file
X$get_p1:
X$ if err then write sys$output "compile file not found"
X$ tmp=f$search("*.COMPILE")
X$ if tmp.nes."" then tmp=f$parse(tmp,,,"NAME")
X$ inquire p1 "control file <''tmp'> "
X$ if p1.eqs."" then p1=tmp
X$got_file:
X$ p1=f$search(f$parse(p1,".COMPILE"))
X$ err=1
X$ if p1.eqs."" then goto get_p1
X$ p1=p1+p2+p3+p4+p5+p6+p7+p8
X$ p1=f$edit(p1,"UNCOMMENT")
X$!
X$ file=f$element(0,",",p1)
X$ comp_opt=f$element(1,",",p1)
X$ if comp_opt.eqs."," then comp_opt=""
X$ link_opts=f$element(2,",",p1)
X$ if link_opts.eqs."," then link_opts=""
X$!
X$ on control_y then goto end
X$ on severe then goto end
X$ open/read files 'file'
X$ file_list=""
X$compile_loop:
X$ read/end=link_section files line
X$ line=f$edit(line,"UNCOMMENT")
X$ if line.eqs."" then goto compile_loop
X$ src_file=f$element(0,",",line)
X$ obj_file=f$element(1,",",line)
X$ if obj_file.eqs."," then obj_file=""
X$ obj_file=f$parse(obj_file,src_file)
X$ compile=f$element(2,",",line)
X$ if compile.eqs."," then compile=""
X$ link_opt=f$element(3,",",line)
X$ if link_opt.eqs."," then link_opt=""
X$ includes=f$element(4,",",line)
X$ if includes.eqs."," then includes=""
X$ include=0
X$!
X$ if compile.eqs."" then goto do_not_compile_it
X$ if "''f$search(obj_file,1)'".eqs."" then goto compile_it
X$ src_rdt=f$cvtime(f$file_attributes(src_file,"RDT"))
X$ obj_rdt=f$cvtime(f$file_attributes(obj_file,"RDT"))
X$ if obj_rdt.lts.src_rdt then goto compile_it
X$ if includes.eqs."" then goto do_not_compile_it
X$includes_loop:
X$ inc_file=f$element(include,"/",includes)
X$ if inc_file.eqs."/" then goto do_not_compile_it
X$ inc_rdt=f$cvtime(f$file_attributes(inc_file,"RDT"))
X$ if inc_rdt.gts.obj_rdt then goto compile_it
X$ include=include+1
X$ goto includes_loop
X$compile_it:
X$ write sys$output "''compile' ''comp_opt' ''src_file'"
X$ 'compile 'comp_opt' 'src_file
X$do_not_compile_it:
X$ if link_opt.eqs."%NOLINK" then goto compile_loop
X$ if "''link_file'".nes."" then goto add_name
X$ link_file="LINK"+f$getjpi("","PID")+".COM;"
X$ open/write linkcom 'link_file
X$ write linkcom "$ Link ''link_opts' -"
X$ write linkcom "`009 ''obj_file' ''link_opt' -"
X$ goto compile_loop
X$add_name:
X$ write linkcom "`009,''obj_file' ''link_opt' -"
X$ goto compile_loop
X$link_section:
X$ write linkcom ""
X$ close linkcom
X$ @'link_file
X$ delete 'link_file
X$end:
X$ close files
$ GoSub Convert_File
$ File_is="DISALLOWS.MAR"
$ Check_Sum_is=1057553910
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X`009.title print disallows block
X
X; VERB Version 1.0 June 1st, 1985
X; Written  by Joe Meadows Jr.,  with thanks  to the
X; Fred Hutchinson Cancer Research Center for kindly
X; allowing  me to  use  their  computing  resources.
X;
X; If  you  have any  questions, comments, ideas, or
X; whatever, feel free to contact me via US Mail :
X;`009Joe Meadows Jr.
X;`0094841 268th Ave. N.E.
X;`009Redmond Wa. 98052
X; or via phone : (206) 827-7296
X
X`009.library 'clexlib'
X
X_clex_l_bracket:`009string`009'<'
X_clex_r_bracket:`009string`009'>'
X
X`009.psect`009_clex_code`009rd,nowrt,exe
X
X`009.entry`009clex_print_disallows,^m<r2,r3,r4,r5,r6,r7>
X`009; 4(ap) = address of disallows block
X
X`009movl`0094(ap),r6
X
X`009movzwl`009exp_w_tro_count(r6),r3
X`009moval`009exp_l_operand_list(r6),r2
X
X`009case`009cmd_b_subtype(r6),type=b,limit=#1,<-
X`009`009_path,-
X`009`009_not,-
X`009`009_any2,-
X`009`009_and,-
X`009`009_or,-
X`009`009_xor,-
X`009`009_neg>
X
X_path:
X`009clrl`009r4
X`009tstl`009_clex_handler_flag
X`009beql`009_path2
X
X`009addl3`009clex_table,(r2)[r4],-(sp)`009; this entity
X`009calls`009#1,g^clex_find_entity
X`009cmpl`009r0,8(ap)
X`009beql`009_path2
X
X`009movl`009r0,r7
X`009beql`009_path2`009; hmm... How strange, it couldn't find it..
X
X`009movl`009r7,r1
X`009cmpb`009#block_k_command,cmd_b_type(r1)
X`009bneq`00910$
X`009movzwl`009cmd_w_name(r1),r7
X`009cmpb`009#cmd_k_verb,cmd_b_subtype(r1)
X`009bneq`00920$
X`009incl`009r7
X`009brb`00920$
X
X10$:`009cmpb`009#block_k_type,type_b_type(r1)`009; let's assume this is true
X`009bneq`009_path2
X`009movzwl`009type_w_name(r1),r7
X
X20$:`009addl`009r1,r7
X`009add_ascic`009_clex_l_bracket
X`009add_ascic`009r7
X`009add_ascic`009_clex_r_bracket
X`009brb`009_path2
X
X_path1:`009add_string`009<'.'>
X_path2:`009addl3`009clex_table,(r2)[r4],r5
X`009movzwl`009ent_w_label(r5),r1
X`009addl`009r5,r1
X`009add_ascic`009r1
X`009aoblss`009r3,r4,_path1
X`009brw`009_dis_end
X
X_and:
X`009clrl`009r4
X`009add_string`009<'('>
X`009brb`009_and2
X_and1:`009add_string`009<' and '>
X_and2:`009pushl`0098(ap)
X`009addl3`009clex_table,(r2)[r4],-(sp)
X`009calls`009#2,clex_print_disallows
X`009aoblss`009r3,r4,_and1
X`009add_string`009<')'>
X`009brw`009_dis_end
X
X_or:
X`009clrl`009r4
X`009cmpl`009r3,#1
X`009beql`009_or2
X`009add_string`009<'('>
X`009brb`009_or2
X_or1:`009add_string`009<' or '>
X_or2:`009pushl`0098(ap)
X`009addl3`009clex_table,(r2)[r4],-(sp)
X`009calls`009#2,clex_print_disallows
X`009aoblss`009r3,r4,_or1
X`009cmpl`009r3,#1
X`009beql`009_or3
X`009add_string`009<')'>
X_or3:`009brw`009_dis_end
X
X_xor:
X`009clrl`009r4
X`009add_string`009<'('>
X`009brb`009_xor2
X_xor1:`009add_string`009<' xor '>
X_xor2:`009pushl`0098(ap)
X`009addl3`009clex_table,(r2)[r4],-(sp)
X`009calls`009#2,clex_print_disallows
X`009aoblss`009r3,r4,_xor1
X`009add_string`009<')'>
X`009brw`009_dis_end
X
X_not:
X`009clrl`009r4
X`009add_string`009<'not'>
X_not1:`009add_string`009<' '>
X`009pushl`0098(ap)
X`009addl3`009clex_table,(r2)[r4],-(sp)
X`009calls`009#2,clex_print_disallows
X`009aoblss`009r3,r4,_not1
X;`009add_string`009<')'>
X`009brw`009_dis_end
X
X_neg:
X`009clrl`009r4
X`009add_string`009<'(neg'>
X_neg1:`009add_string`009<' '>
X_neg2:`009pushl`0098(ap)
X`009addl3`009clex_table,(r2)[r4],-(sp)
X`009calls`009#2,clex_print_disallows
X`009aoblss`009r3,r4,_neg1
X`009add_string`009<')'>
X`009brw`009_dis_end
X
X_any2:
X`009clrl`009r4
X`009add_string`009<'any2('>
X`009brb`009_any22
X_any21:`009add_string`009<','>
X_any22:`009pushl`0098(ap)
X`009addl3`009clex_table,(r2)[r4],-(sp)
X`009calls`009#2,clex_print_disallows
X`009aoblss`009r3,r4,_any21
X`009add_string`009<')'>
X`009brw`009_dis_end
X
X
X_dis_end:
X`009ret
X
X`009.end
$ GoSub Convert_File
$ Goto Part3

-- 
bitnet:	losh@nmt.csnet			M. Warner Losh
	warner@hydrovax.nmt.csnet    ! Don't know if this works, let me know.
csnet:	warner@hydrovax.nmt.edu
uucp:	...{cmcl2, ihnp4}!lanl!unmvax!nmtsun!warner%hydrovax