6 s/\t|\r|\n/ /g; # convert spacings to whitespaces
7 s/[^\/]\/\
*.*?\
*\
///g
; # remove comments (careful: hinttags look like comment!)
8 s/ {2,}/ /g; # strip whitespaces
9 s/(^|\(|\)|;|,|:|\}|\{|=|\+|\-|\*|\&|\||\<|\>|!) +/$1/g;
10 s/ +($|\(|\)|;|,|:|\}|\{|=|\+|\-|\*|\&|\||\<|\>|!)/$1/g;
11 s/\\/\\\\/g; # escape backslashes
12 s/\"/\\\"/g; # escape quotes
16 open(JSFILE
, "hinting.js") or die "Failed to open file: $!";
17 $_ = do { local $/; <JSFILE
> };
19 my $js_hints = escape_c_string
($_);
21 open(HFILE
, ">javascript.h") or die "Failed to open javascript.h: $!";
22 print HFILE
"#define JS_SETUP_HINTS ";
23 printf HFILE
"\"%s\"\n", $js_hints;