50g group photo

Yahoo Groups archive

50g

Archive for 50g.

Index last updated: 2026-03-30 00:59 UTC

Message

Re: [50g] Can someone answer a question about program sub-routines

2009-07-05 by Don Hart

AFAIK, there's no way to do what you want. You can't have named procedures within one program, I don't think there's even a goto command. SysRPL or assembler may have named procedures but I don't know for sure.

What you can do is put the main program, subroutines and data all in one subdirectory. Subroutines that can be used by other programs can go into a higher level directory because, when it's called, the calc searches up the directory tree until it finds something by that name (same is true with data variables). So you can have several programs, each in their own directory, sharing a common subroutine.

You can use the ORDER command to put your main program in the 1st group in the soft menu.

I don't understand why you think you have to delete the subroutines when using the CASE construct. And you can delete subroutines just like data from within a program using the PURGE command, if you really need to.

Of course, if the subroutines aren't too long and aren't called too many times, you can just write the code inline in your main program. Self-modifying code is too messy and may end up using more memory, and that's assuming the operating system will allow it.


--- On Sat, 7/4/09, rickwendel763242 <rickwendel763242@...> wrote:

> From: rickwendel763242 <rickwendel763242@...>
> Subject: [50g] Can someone answer a question about program sub-routines
> To: 50g@yahoogroups.com
> Date: Saturday, July 4, 2009, 6:18 AM
> I'm aware that sub-routines are very
> useful.  The thing I don't like is that the sub-routine
> is an object that must be stored in the same directory as
> the main program (I think).  If its a big program you
> have a bunch of little programs to sort through to find the
> main program.  Is their a way to tidy that up? 
> Not to mention that you have to purge them all if you plan
> to use them with a CASE statement as objects to be evaluated
> - unless you can call the sub-routine in the form of a
> compiled local variable and CASE statement object which I
> haven't actually tried yet.  (Compiled local variables
> automatically go away after program execution.) If their was
> a quick, neat way of doing all that it would be more useful
> than what I'm actually asking for help with.  But,
> never-the-less I feel that what I'm about to describe would
> be useful anyway.  That is, how do you write a small
> program (sub-routine) and copy and paste its contents into a
> larger one?  I'm not talking about calling the name,
> I'm talking about copying the contents.  How do you
> copy the contents of the small one and place it inside at a
> specific point in the larger program?  Or, is their a
> way to just use the sub-routine name without having to keep
> 20 subs in the same directory with the main program?
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>     mailto:50g-fullfeatured@yahoogroups.com
>
>
>

Attachments