about summary refs log tree commit diff stats
path: root/js-merge-helper.pl
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2010-08-12 15:15:46 +0000
committerMarco Peereboom <marco@conformal.com>2010-08-12 15:15:46 +0000
commit1eef0403323c2f1eaa48ba2826c41cda54dbc358 (patch)
tree3ec9f41fe62bf2073261385406036460821824af /js-merge-helper.pl
parent71f6dcdd0c5bfbdb7c37070be9aa70844c05295b (diff)
downloadxombrero-1eef0403323c2f1eaa48ba2826c41cda54dbc358.tar.gz
unfuck build, help from jsing
Diffstat (limited to 'js-merge-helper.pl')
-rw-r--r--js-merge-helper.pl43
1 files changed, 27 insertions, 16 deletions
diff --git a/js-merge-helper.pl b/js-merge-helper.pl
index 050d871..35a72ed 100644
--- a/js-merge-helper.pl
+++ b/js-merge-helper.pl
@@ -13,21 +13,32 @@ sub escape_c_string {
 	return $_
 }
 
-open(JSFILE, "hinting.js") or die "Failed to open file: $!";
-$_ = do { local $/; <JSFILE> };
-close(JSFILE);
-my $js_hints = escape_c_string($_);
-
-open(JSFILE, "input-focus.js") or die "Failed to open file: $!";
-$_ = do { local $/; <JSFILE> };
-close(JSFILE);
-my $js_input = escape_c_string($_);
-
-open(HFILE, ">javascript.h") or die "Failed to open javascript.h: $!";
-print HFILE "#define JS_SETUP_HINTS ";
-printf  HFILE "\"%s\"\n", $js_hints;
-print HFILE "#define JS_SETUP_INPUT_FOCUS ";
-printf  HFILE "\"%s\"\n", $js_input;
-close(HFILE);
+if (scalar @ARGV < 1) {
+	print "usage: js-merge-helper.pl jsfile ... \n";
+	exit 1;
+}
+
+my ($jsfile, $define, $js);
+
+while (@ARGV) {
+
+	$jsfile = shift @ARGV;
+	my @fn = split /\//, $jsfile;
+	my $fn = pop @fn;
+	$fn =~ /^(.*)\.js$/;
+	
+	$define = "JS_".uc($1);
+	$define =~ s/\-/_/;
+
+	open(JSFILE, $jsfile) or die "Failed to open file: $!";
+	$_ = do { local $/; <JSFILE> };
+	close(JSFILE);
+
+	$js = escape_c_string($_);
+
+	print "#define $define ";
+	printf "\"%s\"\n", $js;
+
+}
 
 exit;