
-----------------------------------
Rocket
Tue Jun 06, 2006 5:26 pm

Calling on other programs
-----------------------------------
Here what i would like to do

i have program A

A gives a choice to call on program B , C, and D

when B, C, or D is finished it will again call on A

Is it possible to have program B,C and D as seperate t files but have prgram a load them and display them in the same run window

if yes how do i do this

-----------------------------------
Cervantes
Tue Jun 06, 2006 6:23 pm


-----------------------------------
Check out "include".

-----------------------------------
bluedevils_77
Tue Jun 06, 2006 7:38 pm


-----------------------------------
its called importing and exporting 

in program B,C,D hvae

unit
export  (name) hello
procedure(name) hello

end (name) hello

if name was hello

then in program A hvae

import "hello.tu"

then when want it to run

(program name , what u save it as).hello

-----------------------------------
HellblazerX
Tue Jun 06, 2006 8:30 pm


-----------------------------------
I've never gotten into classes in Turing, but if I'm not mistaken, import and export is generally for classes right?  I think Rocket just wants general programs or code, so include would be the method for him.

-----------------------------------
Rocket
Tue Jun 06, 2006 9:25 pm


-----------------------------------
no blue devil did what i want i think, plus if i use units, im gonna get super marks! thanks dude

-----------------------------------
TheOneTrueGod
Tue Jun 06, 2006 9:29 pm


-----------------------------------
I think what bluedevils_77 said will only work in one file.  If you have two different .t files, you're going to need to include them...  It doesn't matter if the other file is a unit or not.

-----------------------------------
Rocket
Tue Jun 06, 2006 9:32 pm


-----------------------------------
sorry for the double post but i cant find an edit button...

#1 from program B, C, D how would i call on A again. 

#2 if i have varibales in B,C,D will my code still run if they are declared in B,C, D

-----------------------------------
Clayton
Tue Jun 06, 2006 9:47 pm


-----------------------------------
ok lets get this straight : units are generally modules,not classes, modules are only a collection of procedures, functions, and processes and nothing else, so for your purposes i believe you wish to include your programs, not units :D

-----------------------------------
bluedevils_77
Wed Jun 07, 2006 7:57 pm


-----------------------------------
first of all whats an include

and second u can import many other .tu files in other turing programs

-----------------------------------
Clayton
Wed Jun 07, 2006 8:01 pm


-----------------------------------
include is a command that looks for the program name specified after it and basically copies and pastes it into that part of your code ex. (assume we have a program called test.t in the folder with this)


inclue test.t


that simple :D

-----------------------------------
bluedevils_77
Wed Jun 07, 2006 8:04 pm


-----------------------------------
first of all whats an include

and second u can import many other .tu files in other turing programs

-----------------------------------
Clayton
Wed Jun 07, 2006 8:19 pm


-----------------------------------
why did you post the exact same thing an hour after you posted the first one? did you even read my post? look through the Turing Walkthrough and read through it, you might learn something on the way

-----------------------------------
Rocket
Wed Jun 07, 2006 9:44 pm


-----------------------------------
well from the above posts it sounds like include will work, but howif i ahve it in a procedure would it go like this

%this program is called A.t

proc runB

include B.t

end runB

%and then progrma B would look like this

proc runA

include A.t

end runA
and this will all stay in te same window

-----------------------------------
Clayton
Wed Jun 07, 2006 10:02 pm


-----------------------------------
thats exactly how it would work, because like i said, include basically just copies the file in question and pastes it into the program you have running :D

-----------------------------------
Rocket
Thu Jun 08, 2006 2:02 pm


-----------------------------------
and then if a was called again the varables wouldn't be screwed up?

-----------------------------------
Clayton
Thu Jun 08, 2006 3:29 pm


-----------------------------------
actually i cant really tell you, because i dont usually include programs into others, however, if you really want to check just try it and see what happens, check and see if your variables stay the same :D

-----------------------------------
Rocket
Thu Jun 08, 2006 5:12 pm


-----------------------------------
all right, well thanks for the help. Snip! Personal comment removed. Please use the Private Message system to talk to other individuals rather than spamming the forum with personal questions.

-----------------------------------
Rocket
Thu Jun 08, 2006 6:02 pm


-----------------------------------
the include isnt working for me.

it cant place it in procedures or if statements, and becasuase i need to be able to choose from b ,c or d from a im not sure what to do

-----------------------------------
Rocket
Thu Jun 08, 2006 6:28 pm


-----------------------------------
sorry for double post but the other thing is i can include program b from program a, but if i put iclude a in b it wont compile

-----------------------------------
Rocket
Thu Jun 08, 2006 8:31 pm


-----------------------------------
its called importing and exporting 

in program B,C,D hvae

unit
export  (name) hello
procedure(name) hello

end (name) hello

if name was hello

then in program A hvae

import "hello.tu"

then when want it to run

(program name , what u save it as).hello
sorry for posting again but this is very urgent, could you be a little more clear in those instructions

-----------------------------------
TheOneTrueGod
Thu Jun 08, 2006 9:08 pm


-----------------------------------
Why are you trying to do this?  In order to recieve more specific help, you're going to have to post a more specific question.  Give some sample code, or at least describe your program in-depth.
