[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

672.0. "Dynamic Allocate of FAB/RAB" by ODIHAM::JONES_S (DEC OLTP is the one for me !) Thu Jan 21 1988 08:00

    Hi,
    
    has anyone got any examples of dynamic allocation of FAB's and RAB's
    in Macro-32...
    
    Reason is we're currently designing a table driven file handling
    system that needs to be able to open many files (Unknown to
    us at build time), and have many streams (Also an unknown quantity)
                      
    Thanks in advance
    
    Steve Jones
T.RTitleUserPersonal
Name
DateLines
672.1there's more than one way...CSC32::S_LEDOUXScott LeDoux -- 8-522-4953 -- CXO3/2F2Thu Jan 21 1988 12:3611
    Hi, I don't have an example for you but check the RMS routines
    documentation and if that fails...
    
    FABs and RABs are defined in one of the macro libraries
    (SYS$SHARE:STARLET.MLB or SYS$SHARE:LIB.MLB) and all you have to
    do is allocate some memory (via LIB$GET_VM) and then fill it in
    appropriately (maybe using the $FAB_STORE [and $RAB_STORE] macro[s]),
    and then you have a FAB (or RAB).
    
    Or...maybe you can just re-use the old FABs and RABs you just happen
    to have lying around.
672.2PASTIS::MONAHANI am not a free number, I am a telephone boxFri Jan 22 1988 15:1314
    	.1 is a good idea, particularly if your files all have similar
    characteristics. All you need is one FAB and one RAB, space to save all
    the IFIs and ISIs.
    
    	When you open a file, you plug the FAB to point to the file name,
    open, and save the IFI. Then connect and save the ISI.
    
    	For a get or put you plug the RAB with the ISI you saved.
    
    	For a close you plug the FAB with the IFI you saved.
    
    	Since IFIs and ISIs are 16 bits each this costs you 32 bits per
    open file. You could pre-allocate the 4k bytes for 1000 files without
    feeling too prodigal of virtual address space.
672.3example for fabCSSE32::KUEHNELFri Jan 22 1988 18:3723
;
;	create a nice FAB on the stack
;
	movl	4(ap),ap
	subl2	#fab$c_bln, sp			; get space for a fab
	movc5	#0,(sp),#0,#fab$c_bln,(sp)	; clean whole area
	movb	#fab$c_bid,fab$b_bid(sp)        ; init id
	movb	#fab$c_bln,fab$b_bln(sp)        ;   and lenght
;
;	basic fab done; now set options
;
	bisl2	#fab$m_cif!fab$m_ufo,fab$l_fop(sp)
	movl	#n_blocks,fab$l_alq(sp)
	bisb2	#fab$m_put,fab$b_fac(sp)
	movb	#fab$c_rfm_dflt,fab$b_rfm(sp)
	movl	filnam+4,fab$l_fna(sp)
	movb	filnam,fab$b_fns(sp)

	pushal	(sp)				; go, open it
	calls	#1,G^sys$create
	cmpl	r0, #rms$_normal
	bneq	...