INCLUDE statement

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Jun 8, 2010
4
0
#1
Add an include statement.
This will work similar to the include statement found in c++.
ie INCLUDE "c:\Library\subs.btm"
The include command tells tcc to treat the contents of a specified file as if those contents had appeared in the source batch at the point where the include appears. This will allow for better code re-use and the ON ERROR statement will be active for the included file without breaking cmd compatibility
 
#2
Add an include statement.
This will work similar to the include statement found in c++.
ie INCLUDE "c:\Library\subs.btm"
The include command tells tcc to treat the contents of a specified file as if those contents had appeared in the source batch at the point where the include appears. This will allow for better code re-use and the ON ERROR statement will be active for the included file without breaking cmd compatibility
Hi,
At present, you can do the following;

Code:
gosub "c:\library\subs.btm" MyLabel [%1 %2  %3]
This allows re-use of routines among various batch files. Is this similar to what you would like to do?

Joe
 
Jun 8, 2010
4
0
#3
Yes that's the intent, but using the gosub .... keeps me from having a common error handler in the main.btm. If an error is generated in the subroutine it is not handled by the main error handler

This I believe will solve the problem that I posted subj "ON ERRORLEVEL not being trapped" on 2010-06-10
 
#4
| Yes that's the intent, but using the gosub .... keeps me from having
| a common error handler in the main.btm. If an error is generated in
| the subroutine it is not handled by the main error handler
|
| This I believe will solve the problem that I posted subj "ON
| ERRORLEVEL not being trapped" on 2010-06-10

Instead of a new command, there could be a new option for GOSUB, e.g.,
/O, to mean "propagate all ON states of the caller", which would mean, among
others, that ON ERROR or ON ERRORMSG in the called routine would perform
whatever commands the caller specified. If those commands include continuing
the interrupted program (batch file), the control would revert to the called
routine (the normal behavior of ON).
--
Steve