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

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

$Part4:
$ File_is="GET_TERM.MAR"
$ Check_Sum_is=319492446
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X`009.title`009get terminal characteristics
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
X; calling sequence
X;`009ret-stat = get_terminal_characteristics( terminal, characteristics )
X; ret-stat is a longword return status from any of the following
X; `009system services : ASSIGN,DASSGN,GETDVI,QIOW
X; terminal is the address of a descriptor containing the name of the
X;`009device to get information on
X; characteristics is the address of the quadword to return
X;`009the characteristics in.
X
X$devdef`009`009; device characteristics
X$ttdef`009`009; terminal characteristics
X$dvidef`009`009; device information
X$dcdef`009`009; device class
X
Xdvi_list:
X`009.word`0094,dvi$_devclass`009; buffer length, item code
X`009.long`009dev_class`009; buffer address
X`009.long`0090`009`009; return length (0 = don't bother)
X
Xdev_class:`009.long
Xdev_chan:`009.word`009; channel
Xdev_buff:`009.quad`009; device characteristics buffer
X
X`009.entry`009get_terminal_characteristics,0
X
X`009; call getdvi to determine if SYS$INPUT is a terminal
X`009$getdviw_s -
X`009`009devnam=@4(ap),itmlst=dvi_list
X`009blbs`009r0,5$
X`009ret`009; punt if error
X
X`009; is it a terminal?
X5$:`009cmpl`009#dc$_term,dev_class
X`009beql`00910$`009; branch to 10$ if it is a terminal
X
X`009movl`009#0,r0
X`009brb`00930$`009; no sense in asking if isn't a terminal
X
X10$:`009$assign_s -
X`009`009devnam=@4(ap),chan=dev_chan
X`009blbc`009r0,30$
X
X`009$qiow_s`009chan=dev_chan,func=#io$_sensemode,p1=@8(ap),p2=#8
X`009blbc`009r0,20$
X
X20$:`009$dassgn_s -
X`009`009chan=dev_chan
X30$:`009ret
X
X`009.end
$ GoSub Convert_File
$ File_is="INIT.MAR"
$ Check_Sum_is=1226603965
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X`009.title`009initialization routines
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`009'clexlib'
X
X`009.psect`009_clex_common`009rd,wrt,noexe
Xclex_table::`009.long`009; table address
Xclex_verbs::`009.long`009; verb list
Xclex_commands::`009.long`009; command list
Xclex_cmd_cnt::`009.long`009; number of verbs
Xclex_output::`009.long`009; output routine address
Xclex_width::`009.long`009; width of output buffer
X_clex_handler_flag::
X`009.long
X_clex_cmd_block::
X`009.long
X
X`009.sbttl`009initialize table address
X
X`009.psect`009_clex_code`009rd,nowrt,exe
X
X`009.entry`009clex_use_process_table,0
X`009; ret-status = clex_use_process_table()
X`009movl`009ctl$ag_clitable,clex_table
X`009jsb`009_clex_initialize
X`009ret
X
X`009.psect`009_clex_local`009rd,wrt,noexe
Xfab:`009$fab`009dnm=<SYS$SHARE:DCLTABLES.EXE>,fac=get,fop=ufo
Xinadr:`009.long`009^x200,^x200
Xretadr:`009.quad
X$secdef
X
X`009.psect`009_clex_code`009rd,nowrt,exe
X
X`009.entry`009clex_use_command_table,0
X`009; ret-status = clex_use_command_table( table )
X`009movl`0094(ap),r0
X`009movb`009(r0),fab+fab$b_fns
X`009movl`0094(r0),fab+fab$l_fna
X`009$open`009fab=fab
X`009blbc`009r0,10$
X`009$crmpsc_s -
X`009`009inadr=inadr,retadr=retadr,flags=#<sec$m_expreg>,-
X`009`009chan=fab+fab$l_stv,vbn=#2
X`009blbc`009r0,10$
X`009movl`009retadr,clex_table`009
X`009jsb`009_clex_initialize
X10$:`009ret
X
X_clex_initialize:
X`009movl`009clex_table,r0
X`009addl3`009r0,vec_l_verbtbl(r0),clex_verbs
X`009addl3`009r0,vec_l_comdptr(r0),r1
X`009movzwl`009vec_w_tro_count(r1),clex_cmd_cnt
X`009addl`009#8,clex_verbs
X`009addl3`009#8,r1,clex_commands
X`009movl`009#1,r0
X`009rsb
X
X`009.entry`009clex_init_output,0
X`009movl`0094(ap),clex_output
X`009movl`009@8(ap),clex_width
X`009ret
X
X`009.end
$ GoSub Convert_File
$ File_is="LIST.MAR"
$ Check_Sum_is=1125143275
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X`009.title print verb name
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_verb,^m<r2,r3,r4,r5,r6,r7>
X`009; 4(ap) = address of command block
X
X`009movl`0094(ap),r6
X`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:`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<' (synonym truncated)'>
X_verb2:`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<' , '>
X`009brb`009_verb1
X_verb3:`009brb`009_continue
X
X_syntax:
X`009add_string`009<'(syntax) '>
X`009add_ascic`009r7
X
X_continue:
X`009calls`009#0,put_output
X
X`009ret
X
X`009.entry`009clex_get_verb_name,^m<r2,r3,r4,r5,r6,r7>
X`009; 4(ap) = address of command block
X
X`009movl`0094(ap),r6
X`009movzwl`009cmd_w_name(r6),r7
X`009addl`009r6,r7
X`009case`009cmd_b_subtype(r6),type=b,limit=#1,<-
X`009`009_get_verb>
X`009movl`009#0,r0`009; invalid
X`009ret
X
X_get_verb:
X`009movzbl`009(r7),r2`009; save size of entire thing
X`009movzbl`0091(r7),r3`009; save size of verb name
X`009incl`009r7`009; point to first ascic
X`009add_ascic_trunc`009r7,r3
X
X`009pushaq`009_clex_desc
X`009pushl`0098(ap)
X`009calls`009#2,g^str$copy_dx
X`009movl`009_clex_pos,@12(ap)
X`009clrl`009_clex_pos
X
X`009ret
X
X`009.end
$ GoSub Convert_File
$ File_is="README_FIRST.TXT"
$ Check_Sum_is=726222568
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X
XYou ask for it.  Due to numerous requests, I am posting this to the
Xnet.  After looking at the files that were there, I noticed one small
Xommission : how do I compile this beast?
X
XThe answer to that is simple :
X
X`009$ @COMPILE VERB
X
Xand it will compile the thing for you.  Note, that this means that you
Xneed the COMPILE.COM command file AND VERB.COMPILE in your current
Xdirectory.
X
XFor info on how to run the program see BLURB.TXT
X
XFor info about the CLI tables, see CLITABLES.TXT
X
XAll of the files in this distribution (except the one you are reading now)
Xare from the DECUS 1985 FALL symposia tapes in [VAX85%.TIMELINE.VERB] and
X[VAX85%.TIMELINE.CLD].  The % here is either C or D, but I can't recall
Xfor sure, since we don't have this tape at this site.
$ GoSub Convert_File
$ File_is="TYPE.MAR"
$ Check_Sum_is=875250241
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X`009.title print type 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_type,^m<r2,r3>
X`009; 4(ap) = address of type block
X
X`009movl`0094(ap),r2
X
X`009movzwl`009type_w_name(r2),r3
X`009addl`009r2,r3
X`009add_string`009<'define type '>
X`009add_ascic`009r3
X`009calls`009#0,g^put_output
X
X`009movzwl`009type_w_prefix(r2),r3
X`009beql`009type_1
X
X`009addl`009r2,r3
X`009add_string`009<'   prefix '>
X`009add_ascic`009r3
X`009calls`009#0,g^put_output
X
Xtype_1:`009addl3`009clex_table,type_l_keywords(r2),-(sp)
X`009calls`009#1,clex_print_entity
X
X`009ret
X`009.end
$ GoSub Convert_File
$ File_is="VERB.CLD"
$ Check_Sum_is=827398921
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
V!*************************************VERB************************************
X**
Xdefine verb VERB
X   image EXE$DIR:VERB
X   parameter P1 , label=VERB , prompt="Verb"
X      value (list)
X   qualifier ALL
X      nonnegatable
X   qualifier PROCESS
X      nonnegatable
X   qualifier TABLE
X      nonnegatable
X      value (default="SYS$SHARE:DCLTABLES",type=$infile)
X   qualifier OUTPUT
X      nonnegatable
X      value (type=$outfile)
X   qualifier WIDTH
X      nonnegatable
X      value (required,type=$number)
X   qualifier LIST
X      nonnegatable
X   disallow (TABLE and PROCESS)
$ GoSub Convert_File
$ File_is="VERB.COMPILE"
$ Check_Sum_is=2120305786
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X! Source name, object name, compile command, link options, required files
X! 
XClexlib.mar,.mlb,Library/macro/create clexlib,%NOLINK
XVerb.for,.obj,Fortran
XBuffer.mar,.obj,Macro
XCommand.mar,.obj,Macro
XDisallows.mar,.obj,Macro
XEntity.mar,.obj,Macro
XEvalentity.mar,.obj,Macro
XFind.mar,.obj,Macro
XFindentity.mar,.obj,Macro
XGet_term.mar,.obj,Macro
XInit.mar,.obj,Macro
XList.mar,.obj,Macro
XType.mar,.obj,Macro
XSys$system:sys.stb,,,/sel
XSys$system:dcldef.stb,,,/sel
$ GoSub Convert_File
$ File_is="VERB.FOR"
$ Check_Sum_is=1866652416
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X`009program verb_extractor
X
X`009! VERB Version 1.0 June 1st, 1985
X`009! Written  by Joe Meadows Jr.,  with thanks  to the
X`009! Fred Hutchinson Cancer Research Center for kindly
X`009! allowing  me to  use  their  computing  resources.
X`009!
X`009! If  you  have any  questions, comments, ideas, or
X`009! whatever, feel free to contact me via US Mail :
X`009!`009Joe Meadows Jr.
X`009!`0094841 268th Ave. N.E.
X`009!`009Redmond Wa. 98052
X`009! or via phone : (206) 827-7296
X
X`009implicit integer (a-z)
X`009character buffer*80,comment*132,verb*32
X`009logical all,out,list, found, anyfound, openfile
X`009external lib$put_output,output
X`009byte term_char(8)
X`009integer*2 term_width
X`009equivalence (term_char(3),term_width)
X
X`009integer cli$_entnf/'38934'x/
X
X`009comment=
X`0091  '!***************************************'
X`0091//'****************************************'
X`0091//'****************************************'
X`0091//'************'`009! I just love a huge comment...
X
X`009! let user specifywidth of output stream (for the heck of it, okay?)
X`009if (cli$present('width')) then
X`009 call error(cli$get_value('width',buffer,buff_len))
X`009 call error(ots$cvt_ti_l(buffer(:buff_len),width))
X`009else
X`009 i=get_terminal_characteristics('SYS$INPUT',term_char)
X`009 if (.not.i) term_width=132
X`009 width=term_width`009! default to screen width for the heck of it
X`009end if
X
X`009! just want a listng of the verbs?
X`009list=cli$present('list')
X
X`009! use file or actual process mapped version?
X`009if (cli$present('table')) then
X`009 call error(cli$get_value('Table',buffer,buff_len))
X`009 call error(clex_use_command_table(buffer(:buff_len)))
X`009else
X`009 call clex_use_process_table
X`009end if
X
X`009! is output going to a file?
X`009if (cli$get_value('output',buffer,buff_len)) then
X`009 openfile=.true. ! wait till we've found a verb before opening file
X`009 call clex_init_output(output,width)
X`009 out=.true.
X`009else
X`009 call clex_init_output(lib$put_output,width)
X`009end if
X
X`009anyfound=.false.
X
X`009! they want all the verbs?
X`009if (cli$present('all')) then
X`009 verb='*'
X`009 verb_len=1
X`009 goto 15
X`009end if
X
X`009! get the next verb down the line
X10`009i=cli$get_value('Verb',verb,verb_len)`009
X`009if (.not.i) then
X`009 if (anyfound) then
X`009  call exit
X`009 else
X`009  call exit(cli$_entnf)
X`009 end if
X`009end if
X
X`009call str$upcase(verb(:verb_len),verb(:verb_len))
X15`009j=0
X
X`009! locate the little bugger
X`009found = .false.
X20`009i=clex_find_verb(verb(:verb_len),j,cmd_block)
X`009if (.not.i) then
X`009 if (found) then
X`009  goto 10
X`009 else
X`009  call lib$signal(%val(cli$_entnf-4))
X`009  goto 10
X`009 end if
X`009end if
X`009anyfound=.true.
X`009found=.true.
X`009if (openfile) then ! we need to open the output file
X`009 open(file=buffer(:buff_len),err=30,unit=1,status='new'
X`0091`009,defaultfile='.CLD',carriagecontrol='list')
X`009 openfile=.false.
X`009end if
X
X`009! get ready to output the verb
X`009if (list) then
X`009 i=clex_print_verb(%val(cmd_block))
X`009else
X`009 call clex_get_verb_name(%val(cmd_block),buffer,buff_len)
X`009 i=min(width,132)
X`009 k=i/2-buff_len/2
X`009 if (k.lt.1) k=1
X`009 i=max(i-buff_len,0)`009! center verb name in middle of comment
X`009 if (out) then
X`009  call output
X`0091`009(comment(:k)//buffer(:buff_len)//comment(k+1:i))
X`009 else
X`009  call lib$put_output
X`0091`009(comment(:k)//buffer(:buff_len)//comment(k+1:i))
X`009 end if
X
X`009 ! okay, here it is
X`009 i=clex_print_command(%val(cmd_block))
X`009end if
X
X`009j=j+1`009! continue search with next verb
X`009goto 20
X
X30`009end
X
X`009subroutine error(i)
X`009if (.not.i) call exit(i)
X`009return
X`009end
X
X`009integer function output (a)
X`009character*(*) a
X`009output=0
X`009write(1,'(a)',err=10) a
X`009output=1
X10`009return
X`009end
$ GoSub Convert_File
$ Exit

-- 
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