[daip] Running a program inside another program
Eric Greisen
egreisen at nrao.edu
Mon Jun 25 10:50:23 EDT 2007
Nick Lee writes:
> Dear Aips Gurus,
>
> I was wondering if there was a way to call procedures inside another
> procedure. For instance, I have about 60 different procedures labeled
> something like NL0.207, NL1.207, etc. Each one goes through about 100
> different images and prints the results of a few measurements to a
> file. The reason I have it split up is that usually after I "run" 2 of
> these procedures, I'll get the message "BLEW CORE!" if I try to run
> another. So, I have been manually sitting at my desk and going through
> a cycle of typing in:
>
> restore 0
> version 'LFITS'
> run NL0.207
> NL0
>
> Then, after that procedure finishes, I'll repeat, except with NL1.207,
> on and on.
>
> I was wondering if it was possible to write a procedure of the form:
>
> PROC BigProcedure
> restore 0
> version 'LFITS'
> run NL0.207
> NL0
> restore 0
> version 'LFITS'
> run NL1.207
> NL1
> .
This cannot work. The language compiles a proc and makes the compiled
code part of the POPS memory. RESTORE 0 erases that memory and gets a
fresh copy, thereby destroying the proc that invoked it.
The blew core message comes from you using up what is now a very large
work space for procedures. The verb CORE allows you to monitor this
space and gives some clue to what you are doing.
If your RUN files are mostly just long scripts, it would be better to
leave them out of procedures and simply execute them in the RUN. Then
the core would not be used up. There is a verb compress which cannot
be used in a run or in a proc that eliminates wasted space in the
memory (each time you recompile a proc it uses new memory, but leaves
the old "occupied"). Thus
run aaaa
compress
aaa
If you have trouble with BLEW TEMP K there is a verb CLRTEMP which may
be used inside procs to clear that area which is used up by temporary
strings and arrays mostly.
Eric Greisen
More information about the Daip
mailing list