How to? Script support

Oct 18, 2008
339
2
Hello -- sorry if this has been asked, but, say, if python and perl ( or tcl ) is turned on in the INI file, how does tcc figure out when processing a *.cmd file which processor (python, perl, tcc ) to use?
 
Oct 18, 2008
339
2
TCC normally uses the file's extension (.py, .pl, .tcl, etc.) to determine the processor.

If you're using a .CMD extension for something other than a CMD or TCC batch file, TCC also includes EXTPROC / SHEBANG support (see the help for details).

Hello – thanks for the reply .... I was looking at the extproc / shebang hellp but the doc lead me to believe that what ever the command is noted on the first line in the file, the specified file would run as a child process to tcc, thus would not be able to change the environment owned by the TCC parent –

I been using rexx support for years and have many *.cmd file that are rexx scripts – I do start each *.cmd file with a rexx comment – is that the TCC trigger to process the file with rexx?

Lastly, unless there is a a custom version of a command , if file containing EXTPROC in the first line, would probable fail with a syntax error ... It would make more sense if that first line was imbedded in a comment
 

rconn

Administrator
Staff member
May 14, 2008
12,363
150
Hello – thanks for the reply .... I was looking at the extproc / shebang hellp but the doc lead me to believe that what ever the command is noted on the first line in the file, the specified file would run as a child process to tcc, thus would not be able to change the environment owned by the TCC parent –

That's true, except for REXX.

I been using rexx support for years and have many *.cmd file that are rexx scripts – I do start each *.cmd file with a rexx comment – is that the TCC trigger to process the file with rexx?

Yes, REXX is a special case (a carryover from 4OS2).

Lastly, unless there is a a custom version of a command , if file containing EXTPROC in the first line, would probable fail with a syntax error ... It would make more sense if that first line was imbedded in a comment

I don't know what you're asking. TCC knows what EXTPROC means, and it uses the EXTPROC argument as the command to execute (passing the filename as the command's argument). If you provide a bad argument, then you'll get a syntax error. This syntax is about 20 years old, and definitely cannot be changed without breaking every batch file that's using EXTPROC.

But CMD.EXE won't support EXTPROC.
 
Oct 18, 2008
339
2
Just to clarify, if tcc detects the “extproc” in the first line in the myfile.cmd and that first line is

extproc c:\pascal\pascal.exe

then, tcc closes myfile.cmd file and then executes

c:\pascal\pascal.exe myfile.cmd

I would think that unless this a custom version of pascal, it would it fail with a syntax error? Or does TCC some how pass a pointer to the file missing the first line?
 

rconn

Administrator
Staff member
May 14, 2008
12,363
150
Just to clarify, if tcc detects the “extproc” in the first line in the myfile.cmd and that first line is

extproc c:\pascal\pascal.exe

then, tcc closes myfile.cmd file and then executes

c:\pascal\pascal.exe myfile.cmd

Correct.

I would think that unless this a custom version of pascal, it would it fail with a syntax error? Or does TCC some how pass a pointer to the file missing the first line?

That has nothing to do with TCC -- it's up to the command you execute to know how to deal with the .CMD file (including skipping the first line). Since CMD in Windows no longer supports EXTPROC / Shebang (though the Linux shells still do), it's rarely used anymore. But some users have custom apps that rely on it.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,466
88
Albuquerque, NM
prospero.unm.edu
Just to clarify, if tcc detects the “extproc” in the first line in the myfile.cmd and that first line is

extproc c:\pascal\pascal.exe

then, tcc closes myfile.cmd file and then executes

c:\pascal\pascal.exe myfile.cmd

I would think that unless this a custom version of pascal, it would it fail with a syntax error? Or does TCC some how pass a pointer to the file missing the first line?

Many scripting languages, particularly those ported from the Unix world, will recognize a shebang at the start of a file and treat it as a comment -- i.e. ignore it. (Pascal won't, but then Pascal isn't a scripting language.)
 
Oct 18, 2008
339
2
umm ... As I understand it, if the first line in a "unix" shell script is "#!" then the next token is the executable for the shell to invoke to
run "this" script file ... I thought that "#" is the comment indicator in many languages, and is that not the case for pascal? I know that
tcl/tk works this way ... I have a short tcl/tk script in my cygwin environment to deal with window/dos files paths an then run a window base
editor that does not know about "posix paths" -- but is happed when those paths then convert by the tcl script to "native" format and then
having tcl run the editor
 
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly SCRIPT and GetObject Support 3
vefatica SCRIPT ... TCC disappears Support 2
T How can I send a simple parameter to a script, in tc 25? Support 2
vefatica PSHELL: How pass arguments to script? Support 15
EDerH Powershell call from script Support 24
Joe Caverly .PS1 script does not work with PSHELL Support 11
MickeyF running program from script and (not) returning to script Support 12
T Fixed Echo randomly activated in script Support 4
fpefpe How to? script error Support 1
fpefpe How to? script error Support 0
vefatica @SCRIPT bug persists Support 4
D Catching the result of an evaluated script expression Support 0
Joe Caverly Non-conforming @Script Support 6
M The Matrix: a useless script ... Support 5
fpefpe How to? LUA script Support 0
T Change language in script Support 4
Steve Pitts Documentation Script errors invoking help Support 15
R How to? Launch and execute commands in tcmd.exe through MSBuild Script. Support 3
Joe Caverly @SCRIPT does not like all comments Support 2
Mordachai Help! How to set parameters for script I'm debugging?! Support 6
JohnQSmith "SCRIPT" Support 7
rconn Script kiddies on the attack Support 4
krischik Stop Script after Syntax Error. Support 6
H Ruby - Running External Ruby script crashes TCC Support 11
Joe Caverly SCRIPT Command Support 2
T Obfuscating passwords in script Support 14
Stefano Piccardi IDE.exe start toobar button fails when % in script path Support 0
lassevk exit(1) in a python script exits console, by design or bug? Support 1
R break script on syntex error Support 7
K iftp script copy deletes target files Support 17
R script problem with mapped network drive Support 1
Alpengreis Python support for 3.8.3 in TCC v26.x? Support 2
C How to? Mouse support in WSL when in Take Command Tab Support 2
N Python 3.8.2 Support in 26? Support 3
J How to? tty support in V25? Support 5
M QUERYBOX /L support seems to only partially work Support 2
rconn News Windows 7 Support Support 0
rconn Dropping Windows 7 support in Take Command / TCC v26 Support 8
rconn Dropping 32-bit support in Take Command & TCC? Support 14
Steve Pitts REXX support - order of selection Support 2
T @execstr unicode support Support 6
M Please explain TCMD's ANSI x3.64 support Support 4
D Theme support partially broken? Support 1
D xp support and multi-license Support 5
fpefpe Documentation Python support Support 11
Brian Woodward How to? Does FTP.CFG only support SSL over port 21? (Newbie) Support 6
M Documentation Q.Search doesn't support selection? Support 1
fpefpe How to? tcl support Support 8
jwiede Is Ruby support EoL in "modern" TCC/TCmd? Support 1
epement File managers that support file descriptions Support 7

Similar threads