makes inifile variables available through global arrays, and makes hal commands that don't conflict with builtins available without the "hal" prefix, then sources the underlying script --- scripts/.gitignore | 1 + scripts/haltcl.in | 35 +++++++++++++++++++++++++++++++++++ src/Makefile | 2 +- src/configure.in | 1 + 4 files changed, 38 insertions(+), 1 deletions(-) create mode 100644 scripts/haltcl.in
diff --git a/scripts/.gitignore b/scripts/.gitignore index 91585d7..11678c3 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,6 +1,7 @@ emc emc-environment halrun +haltcl realtime rtapi.conf emcmkdesktop diff --git a/scripts/haltcl.in b/scripts/haltcl.in new file mode 100644 index 0000000..ca92ccf --- /dev/null +++ b/scripts/haltcl.in @@ -0,0 +1,35 @@ +...@tclsh@ +load @EMC2_TCL_LIB_DIR@/hal.so + +proc parse_ini {filename} { + set f [open $filename] + + while {[gets $f line] >= 0} { + if {[regexp {^\[(.*)\]\s*$} $line _ section]} { + # nothing + } elseif {[regexp {^([^#]+?)\s*=\s*(.*?)\s*$} $line _ k v]} { + upvar $section s + lappend s($k) $v + } + } + + close $f +} + +if {[lindex $argv 0] == "-ini"} { + parse_ini [lindex $argv 1] + set argv [lrange $argv 2 end] +} + +foreach c [hal --commands] { + if {[info commands $c] == {}} { + proc $c args "eval hal $c \$args" + } +} + + +set filename [lindex $argv 0] +set argv [lindex $argv 1 end] + +set result [source $filename] + diff --git a/src/Makefile b/src/Makefile index 01598ce..0567f7e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -210,7 +210,7 @@ config.h: config.h.in config.status INFILES = \ ../docs/man/man1/emc.1 ../scripts/emc ../scripts/realtime \ - ../scripts/rtapi.conf Makefile.inc Makefile.modinc \ + ../scripts/haltcl ../scripts/rtapi.conf Makefile.inc Makefile.modinc \ ../tcl/emc.tcl ../scripts/halrun ../scripts/emc-environment \ ../scripts/emcmkdesktop ../lib/python/nf.py $(INFILES): %: %.in config.status diff --git a/src/configure.in b/src/configure.in index d6366f6..f2ac753 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1345,6 +1345,7 @@ AC_CONFIG_FILES([../docs/man/man1/emc.1]) AC_CONFIG_FILES([../scripts/emc], [chmod +x ../scripts/emc]) AC_CONFIG_FILES([../scripts/halrun], [chmod +x ../scripts/halrun]) AC_CONFIG_FILES([../scripts/emc-environment], [chmod +x ../scripts/emc-environment]) +AC_CONFIG_FILES([../scripts/haltcl], [chmod +x ../scripts/haltcl]) AC_CONFIG_FILES([../scripts/realtime], [chmod +x ../scripts/realtime]) AC_CONFIG_FILES(Makefile.inc) AC_CONFIG_FILES(Makefile.modinc) -- 1.6.2.1.469.gdffc ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers