2

I have few scripts developed in TCL and Shell

  1. TCL scripts (project.tcl) is used for automation of project creation and handling the multiple project runs)
  2. SHELL scripts (result.sh ) is created for result analysis Error handling with a set of commands using sed, awk and grep.

I want to create a single executable by embedding these scripts into any high level language like C/C++ file. we know that TCL is a C library. What kind of interface files APIs are useful for achieving this ?

bruno
  • 32,421
  • 7
  • 25
  • 37
Partha
  • 21
  • 2
  • Please don't sign you name at the end of questions or similar. See here for more information: https://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts – PiRocks Jul 13 '20 at 07:01
  • If you rewrite the shell scripts in tcl, then you only have two languages to worry about (C and tcl)... – Shawn Jul 13 '20 at 08:57
  • And if it's all in tcl, there are tools to create a binary that includes the tcl runtime and your scripts all in one: https://www.tcl.tk/software/tcltk/bindist.html and https://wiki.tcl-lang.org/page/Starpack – Shawn Jul 13 '20 at 09:00

1 Answers1

0
  1. TCL scripts are quite simple, as you can embed the TCL interpreter quite easy. (API-Reference: https://wiki.tcl-lang.org/page/Tcl+C+API)
  2. You can simply embed them, extract them at runtime (to /tmp) and use system(...), or you could try translating them to C: sed: https://github.com/lhoursquentin/sed-bin awk: awk2c grep: I didn't find some translator tool, but grep uses PCRE, so you could use these.

To have them in the executable, you could make a .tar(.gz) file from those scripts, embed it into the binary (Embedding binary blobs using gcc mingw), and load (and extract (with zlib, for example)) it at runtime, to a temporary directory.

JCWasmx86
  • 3,473
  • 2
  • 11
  • 29