mousebinding to open links in new window
[vimprobable2.git] / js-merge-helper.pl
blob024d49c485342a05d1e6258d1101f5f192bc5f25
1 #!/bin/env perl -w
2 use strict;
4 my $js;
5 open(JSFILE, "input_hinting_mode.js") or die "Failed to open file: $!";
6 $_ = do { local $/; <JSFILE> };
7 close(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
15 $js = $_;
17 open(CFILE, "main.c") or die "Failed to open main.c: $!";
18 $_ = do { local $/; <CFILE> };
19 close(CFILE);
21 s/(#define JS_SETUP)/$1 "$js"/;
23 open(CFILE, ">tmp.c") or die "Failed to open tmp.c for writing: $!";
24 print CFILE $_;
25 close(CFILE);