5 open(JSFILE
, "input_hinting_mode.js") or die "Failed to open file: $!";
6 $_ = do { local $/; <JSFILE
> };
8 s/\t|\r|\n/ /g; # convert spacings to whitespaces
9 s/[^\/]\/\
*.*?\
*\
///g
; # remove comments (careful: hinttags look like comment!)
10 s/ {2,}/ /g; # strip whitespaces
11 s/(^|\(|\)|;|,|:|\}|\{|=|\+|\-|\*|\&|\||\<|\>|!) +/$1/g;
12 s/ +($|\(|\)|;|,|:|\}|\{|=|\+|\-|\*|\&|\||\<|\>|!)/$1/g;
13 s/\\/\\\\/g; # escape backslashes
14 s/\"/\\\"/g; # escape quotes
17 open(CFILE
, "main.c") or die "Failed to open main.c: $!";
18 $_ = do { local $/; <CFILE
> };
21 s/(#define JS_SETUP)/$1 "$js"/;
23 open(CFILE
, ">tmp.c") or die "Failed to open tmp.c for writing: $!";