From 93a16e060c48726b294a3e6357e6f2f3fde2283f Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 5 Aug 2009 15:41:37 -0400 Subject: [PATCH] [script] drop stringify, .script.h instead of .string stringify.py is written in perl, but doesn't do much to justify the dependency. We now just do sed in the Makefile. Also, rename .string to .script.h since that's a little more conventional. --- src/plugins/splash/script/Makefile.am | 20 +++++++++---------- src/plugins/splash/script/script-lib-image.c | 3 +-- src/plugins/splash/script/script-lib-math.c | 4 +--- .../splash/script/script-lib-plymouth.c | 4 +--- src/plugins/splash/script/script-lib-sprite.c | 3 +-- src/plugins/splash/script/stringify.pl | 14 ------------- 6 files changed, 13 insertions(+), 35 deletions(-) delete mode 100755 src/plugins/splash/script/stringify.pl diff --git a/src/plugins/splash/script/Makefile.am b/src/plugins/splash/script/Makefile.am index 8cafc3ef..6dde7cbc 100644 --- a/src/plugins/splash/script/Makefile.am +++ b/src/plugins/splash/script/Makefile.am @@ -45,16 +45,14 @@ script_la_SOURCES = $(srcdir)/plugin.c \ $(srcdir)/script-lib-math.script MAINTAINERCLEANFILES = Makefile.in -CLEANFILES = *.string +CLEANFILES = *.script.h -BUILT_SOURCES = script-lib-image.string script-lib-sprite.string script-lib-math.string script-lib-plymouth.string +BUILT_SOURCES = script-lib-image.script.h script-lib-sprite.script.h script-lib-math.script.h script-lib-plymouth.script.h -EXTRA_DIST = stringify.pl - -%.string: %.script stringify.pl - $(srcdir)/stringify.pl < $< > $@ - -script-lib-image.c : script-lib-image.string -script-lib-sprite.c : script-lib-sprite.string -script-lib-math.c : script-lib-math.string -script-lib-plymouth.c : script-lib-plymouth.string +%.script.h: %.script + sed -e 's/\\/\\\\/g' \ + -e 's/"/\\"/g' \ + -e 's/\(.*\)/ "\1\\n"/g' \ + -e '1istatic const char* $(subst -,_,$(@:.script.h=_string)) =' \ + -e '$$a;' \ + $< > $@ diff --git a/src/plugins/splash/script/script-lib-image.c b/src/plugins/splash/script/script-lib-image.c index e2ddb21c..5ea2f0f6 100644 --- a/src/plugins/splash/script/script-lib-image.c +++ b/src/plugins/splash/script/script-lib-image.c @@ -35,8 +35,7 @@ #include "config.h" -#define STRINGIFY_VAR script_lib_image_string -#include "script-lib-image.string" +#include "script-lib-image.script.h" static void image_free (script_obj_t *obj) { diff --git a/src/plugins/splash/script/script-lib-math.c b/src/plugins/splash/script/script-lib-math.c index 84e2a1cf..ecc1a90f 100644 --- a/src/plugins/splash/script/script-lib-math.c +++ b/src/plugins/splash/script/script-lib-math.c @@ -34,9 +34,7 @@ #include "config.h" -#define STRINGIFY_VAR script_lib_math_string - -#include "script-lib-math.string" +#include "script-lib-math.script.h" static script_return_t script_lib_math_float_from_float_function (script_state_t *state, void *user_data) diff --git a/src/plugins/splash/script/script-lib-plymouth.c b/src/plugins/splash/script/script-lib-plymouth.c index fd9fa154..d552af83 100644 --- a/src/plugins/splash/script/script-lib-plymouth.c +++ b/src/plugins/splash/script/script-lib-plymouth.c @@ -33,9 +33,7 @@ #include "config.h" -#define STRINGIFY_VAR script_lib_plymouth_string - -#include "script-lib-plymouth.string" +#include "script-lib-plymouth.script.h" static script_return_t plymouth_set_function (script_state_t *state, void *user_data) diff --git a/src/plugins/splash/script/script-lib-sprite.c b/src/plugins/splash/script/script-lib-sprite.c index a0366353..d6c1773f 100644 --- a/src/plugins/splash/script/script-lib-sprite.c +++ b/src/plugins/splash/script/script-lib-sprite.c @@ -35,8 +35,7 @@ #include #include -#define STRINGIFY_VAR script_lib_sprite_string -#include "script-lib-sprite.string" +#include "script-lib-sprite.script.h" static void sprite_free (script_obj_t *obj) { diff --git a/src/plugins/splash/script/stringify.pl b/src/plugins/splash/script/stringify.pl deleted file mode 100755 index a0c3b450..00000000 --- a/src/plugins/splash/script/stringify.pl +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/sh -exec perl -x $0 ${1+"$@"} - if 0; -#!perl - -print "static const char* STRINGIFY_VAR = "; -while (<>) -{ - chomp; - s/\\/\\\\/g; - s/"/\\"/g; - print "\"$_\\n\"\n"; -} -print ";";