Adapted patch to Praat 5.4.09, e.g., changes in character width, char32/U/L
[sgc2.git] / praat_module / praatscript2cprogram.pl
blobe5df4c9305b57e28030e2444a26beaf41153667f
1 #!/usr/bin/perl
3 # Convert an expanded praat script into a single string
4 # Output a stand alone Praat main program
6 # Use:
7 # perl praatscript2cprogram.pl script.praat > demoapplication.h
8 #
9 print <<'ENDOFHEADER';
10 /* C const char string with Praat script
11 * Generated automatically
12 * For license, see Praat script text
16 static char32_t myDemoScript [] = L""
17 ENDOFHEADER
18 while(<>){
19 # Protect special characters
20 s/\\/\\\\/g;
21 s/[\n\r\l]/\\n/g;
22 s/\"/\\"/g;
23 print "\"$_\"\n";
25 print <<'ENDOFFOOTER';
28 ENDOFFOOTER