[comp.lang.pascal] running other files?

tpehrson@javelin.es.com (Tim Clinkenpeel) (03/19/91)

hi.  i'm programming in turbo 5.0 and was wondering if it is possible/efficient
to run other files from my program.  here's the scenario:  i have a large piece
of code that will only be used the first time a new user runs the program.
can i separate it out and only call it when needed to save space and memory?
include {$i } doesn't seem to be what i want; i'm talking run-this, exit-and-
run-this-other-one, exit-second-and-back-to-first.

any help := greatly appreciated;

nemossan@uitec.ac.jp (Sakurao NEMOTO) (03/20/91)

In article <1991Mar19.150541.18350@javelin.es.com> tpehrson@javelin.sim.es.com writes:
>to run other files from my program.  here's the scenario:  i have a large piece
>of code that will only be used the first time a new user runs the program.
>can i separate it out and only call it when needed to save space and memory?

For this purpose, Overlay is used.  Please see your manual.  Overlays can be
used in turbo-3,5,5.5 or 6 (I mean you cannot use in Turbo-4).

			nemossan@uitec.ac.jp

reeves@dvinci (Malcolm Reeves) (03/20/91)

From article <1991Mar19.150541.18350@javelin.es.com>, by tpehrson@javelin.es.com (Tim Clinkenpeel):
> hi.  i'm programming in turbo 5.0 and was wondering if it is possible/efficient
> to run other files from my program.  here's the scenario:  i have a large piece
> of code that will only be used the first time a new user runs the program.
> can i separate it out and only call it when needed to save space and memory?
> include {$i } doesn't seem to be what i want; i'm talking run-this, exit-and-
> run-this-other-one, exit-second-and-back-to-first.
>
What you need is the TP5.0 Exec procedure:

    SwapVectors;
    Exec(MyProgram,MyCommandLine);
    SwapVectors;

MyProgram, MyCommandLine are String types.

It appears that pages 264 and 265 of the copy of the TurboPascal Reference
Guide you received when you purchased the compiler are missing? You should
perhaps complain to Borland about this oversight :-)

CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) (03/21/91)

In article <1991Mar19.150541.18350@javelin.es.com>,
  tpehrson%javelin.es.com@BRL.MIL (Tim Clinkenpeel) wrote:

>hi.  i'm programming in turbo 5.0 and was wondering if it is
>possible/efficient to run other files from my program.  here's the
>scenario:  i have a large piece of code that will only be used the
>first time a new user runs the program. can i separate it out and
>only call it when needed to save space and memory? include {$i }
>doesn't seem to be what i want; i'm talking run-this, exit-and-
>run-this-other-one, exit-second-and-back-to-first.

One or both of overlays or procedure Exec should suit your
requirements. Both are available in TPas 5.0 and discussed in the
manuals. Read the references to those features, and inquire again if
you still have (specific) questions. You might mention what the
memory requirements of the one-time and every-type programs might
be, and what you want to do during the one-time program (write a
config file, send the user's VISA card, modify an .EXE file, etc.).

Cheers--

+--------------------------------------------------------------------+
| Karl Brendel                           Centers for Disease Control |
| Internet: CDCKAB@EMUVM1.BITNET         Epidemiology Program Office |
| Bitnet: CDCKAB@EMUVM1                  Atlanta GA  30093       USA |
|                        Home of Epi Info 5.0                        |
+--------------------------------------------------------------------+