Something I did in some subroutines which makes them more of a multi
tasker (I-descriptors) and flexible, is to pass file variables as
parameters - when you can. So, the subroutine would look something
like;
<snip>
SUBROUTINE GET.NEXT.IJKEY(FILE.CN, ERR, F.STAT, IJKEY)
$INCLUDE HEADERS STD.EQUATES
$INCLUDE HEADERS ERRCODES.EQUATES
$INCLUDE HEADERS IM.CTRL.EQUATES
$INCLUDE SYSCOM FILEINFO.INS.IBAS
*
* THE FILE(S) MAY OR MAY NOT BE OPENED
*
*
OPENED.CN = FALSE
NEED.TO.OPEN = FILEINFO(FILE.CN,0)
IF NEED.TO.OPEN = 0 THEN
OPEN '','CN' TO FILE.CN ELSE
ERR = ERR$CODE.OPENERR
F.STAT = STATUS()
GO STOP.RUN
END
OPENED.CN = TRUE
END
</snip>
We are using Universe. You never know what need you might have in the
future and this can make things much easier. Actually, I thought 2
dynamic array params (passed and returned) and a headers file as
pointers is probably more ideal. Then you can do any of this sort of
thing on the fly and you wouldn't have too much code to change/recompile
when needs arise.
Anthony
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Wendy Smoak
Sent: Thursday, June 23, 2005 12:18 PM
To: [email protected]
Subject: Re: [U2] Custom Functions
From: "Ray Wurlod" <[EMAIL PROTECTED]>
>
> Try using the SUBR() function, as I mentioned in another post.
>
Ouch. Granted my function opens a file and [currently, for debug]
prints to the screen, but attempting to call it with SUBR from an
I-Descriptor caused... '25945 Bus error' and left the session
unresponsive.
Leaving aside the I-Descriptor issue for a moment...
Is there a way for it a function to "assume" that the last file opened
is the one I want to use? I thought there might be an @FILE or
something, the way there is @ID and you can have a 'default' file for
READ.
http://www.pickwiki.com/cgi-bin/wiki.pl?TreeTraversal
I thought of opening the file in the calling program, and passing a file
handle instead of the filename. But I need this to work when called
[indirectly] from UOJ also, and historically I've seen 'Error 30102' if
I attempt to pass file handles around in any code called from UOJ.
Advice on how to improve this would be gratefully accepted [see code in
Wiki link above].
While the first one isn't TOO bad... there's a companion function that
finds all of the children of a particular node, and it calls the first
function to look back up the tree for any child that has multiple
parents. In that case I open the same file over, and over and over.
Thanks,
Wendy Smoak
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/