1#!./xotclsh 2# $Id: mk_predefined.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ 3# A small script file that creates a static array from a tcl- 4# script for inclusion in c programs -gn 5set f [open predefined.xotcl] 6set content [read $f] 7close $f 8 9regsub -all {\\} $content && content 10regsub -all {"} $content {\"} content ;#" 11regsub -all "\[ \]+\n" $content \n content ;# remove trailing space 12regsub -all "\n\[ \t\]+" $content \n content ;# remove leading space 13regsub -all "\n#\[^\n\]*\n" $content \n content ;# remove comment lines 14regsub -all "\n#\[^\n\]*\n" $content \n content ;# remove comment lines 15regsub -all "\n#\[^\n\]*\n" $content \n content ;# remove comment lines 16regsub -all "\n#\[^\n\]*\n" $content \n content ;# remove comment lines 17regsub -all "\[\n\]+" $content \n content ;# remove empty lines 18regsub -all "\n}" $content "}" content ;# newlines btwn braces 19regsub -all "\n" $content "\\n\"\n\"" content 20 21puts "static char cmd\[\] = " 22puts "\"$content\";" 23puts "" 24 25 26