.TITLE EXAMPLE - example user modified symbiont .ident 'V03-00' ;++ ; This program supplies a user written page header ; routine to the standard symbiont. the page header ; includes the submitters account name and user name, ; the full file specification, and the page number. ;-- ; ; system definitions ; .library /sys$share:lib/ $PSMDEF ; symbiont definitions $SMBDEF ; message item deinitions ; ; define argument offsets for user supplied services called by symbiont ; context = 04 ; symbiont context work_area = 08 ; user context func = 12 ; function code func_desc = 16 ; function dependent descriptor func_arg = 20 ; function dependent argument ; ; macro to create dynamic descriptors ; .macro d_desc .word 0 ; dsc$w_length = 0 .byte dsc$k_dtype_t ; dsc$b_dtype = string .byte dsc$k_class_d ; dsc$b_class = dynamic .long 0 ; dsc$a_pointer = 0 .endm ; ; Storage for page header information ; file: d_desc ; file name descriptor user: d_desc ; account name descriptor page: .long 0 ; page number line: .long 0 ; line number ; ; Fao control string and work buffer. Header format: ; "name, filename ....... Page 9999" ; fao_ctrl: .ascid '!70 Page 9999!/!/' fao_ctrl_2: .ascid '!4UL' fao_desc: .long 84 ; work buffer descriptor .address fao_buff fao_buff: .blkb 84 ; work buffer ; ; own storage for values passed by reference ; code: .long 0 ; service or item code streams: .long 1 ; number of simultaneous streams bufsiz: .long 2048 ; output buffer size ; ; main routine-- invoked at image startup ; start: .word 0 ; save nothing because this routine only uses R0 and R1 ; ; Supply private header routine ; movzbl #psm$k_page_header,code ; set the service code pushal header ; address of modified routine pushal code ; address of service code calls #2,g^psm$replace ; replace the routine blbc r0,10$ ; exit if any errors ; ; transfer control to the standard symbiont ; pushal bufsiz ; address of output buffer size pushal streams ; address of number of streams calls #2,g^psm$print ; invoke standard symbiont 10$: ret ; ; page header routine ; Header: .word 0 ; save nothing ; ; check function code ; cmpl #psm$k_open,@func(ap) ; open function? beql 15$ cmpl #psm$k_start_task,@func(ap) ; start task? beql 20$ cmpl #psm$k_read,@func(ap) ; read function? beql 50$ movl #psm$_funnotsup,r0 ; unsupported function ret ; return to symbiont ; ; open function (called for each page!) ; 15$: incl page movzbl #1,line movl #1,r0 ret ; ; starting a new task ; 20$: clrl page ; reset the page number ; ; get the file name ; movzbl #smbmsg$k_file_specification,code ; set item code pushal file ; address of descriptor pushal code ; address of item code pushl context(ap) ; address of symbiont ctx value calls #3,g^psm$read_item_dx ; read it blbc r0,40$ ; branch if any errors ; ; get the user name ; movzbl #smbmsg$k_user_name,code ; set item code pushal user ; address of descriptor pushal code ; address of item code pushl context(ap) ; address of symbiont ctx value calls #3,g^psm$read_item_dx ; read it blbc r0,40$ ; branch if any errors ; ; set up the static header information that is constant for the task ; $fao_s ctrstr = fao_ctrl,- ; fao control string desc outbuf = fao_desc,- ; output buffer descriptor p1 = #user,- ; user name descriptor p2 = #file ; file name descriptor 40$: ret ; return success or error ; ; read a page header ; 50$: decl line ; decrement the line number blss 70$ ; branch of second read ; ; insert the page number into the header ; movab fao_buff+76,fao_desc+4 ; point to page number buffer $fao_s ctrstr = fao_ctrl_2,- ; fao control string desc outbuf = fao_desc,- ; output buffer descriptor p1 = page ; page number movab fao_buff,fao_desc+4 ; point to work buffer blbc r0,55$ ; return if error ; ; copy the line to the symbiont's buffer ; pushab fao_desc ; work buffer descriptor pushl func_desc(ap) ; symbiont descriptor calls #2,g^str$copy_dx ; copy to symbiont buffer 55$: ret ; return success or any error ; ; done with this page header ; 70$: movl #psm$_eof,r0 ; return end of input ret ; return .end start