Benjamin Otte
2007-Oct-14 18:06 UTC
[Swfdec] 2 commits - configure.ac libswfdec/Makefile.am libswfdec/swfdec_as_strings.c
configure.ac | 1 libswfdec/Makefile.am | 20 ++++++++++--------- libswfdec/swfdec_as_strings.c | 44 ------------------------------------------ 3 files changed, 12 insertions(+), 53 deletions(-) New commits: commit 997aca7ef578ec31baf1bae06daf015a04b42e84 Merge: d893510... 1d5c170... Author: Benjamin Otte <otte at gnome.org> Date: Sun Oct 14 20:05:45 2007 +0200 Merge branch 'master' of ssh://company at git.freedesktop.org/git/swfdec/swfdec commit d8935101077b7a291cf50aa63714ef0a00224a43 Author: Benjamin Otte <otte at gnome.org> Date: Sun Oct 14 20:05:21 2007 +0200 don't generate swfdec_as_strings.h with a self-compiled program, use awk instead This is a cross-compile fix, so we don't need to fiddle with HOSTCC vs TARGETCC. It's probably awesome code, but I'm neither a master of shell nor awk. Patches welcome. diff --git a/configure.ac b/configure.ac index 449c9c9..75e5a0a 100644 --- a/configure.ac +++ b/configure.ac @@ -53,6 +53,7 @@ AC_PROG_CC AM_PROG_CC_STDC AM_PROG_CC_C_O AM_PROG_AS +AC_PROG_AWK AC_HEADER_STDC([]) diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am index 07ca529..0c2e2a6 100644 --- a/libswfdec/Makefile.am +++ b/libswfdec/Makefile.am @@ -1,10 +1,5 @@ SUBDIRS = jpeg -noinst_PROGRAMS = compute-strings - -compute_strings_SOURCES = swfdec_as_strings.c -compute_strings_CFLAGS = -DCOMPUTE_SWFDEC_AS_STRINGS_H - CODECS if HAVE_FFMPEG @@ -310,10 +305,17 @@ swfdec_enums.c: $(public_headers) Makefile --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ --vtail " { 0, NULL, NULL }\n };\n etype = g_ at type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n }\n return etype;\n}\n" \ $(public_headers) ) > xgen-sec \ - && cp xgen-sec swfdec_enums.c \ + && (cmp -s xgen-sec swfdec_enums.c || cp xgen-sec swfdec_enums.c ) \ && rm -f xgen-sec -swfdec_as_strings.h: swfdec_as_strings.c compute-strings - ./compute-strings >> xgen-sas \ - && cp xgen-sas swfdec_as_strings.h \ +swfdec_as_strings.h: swfdec_as_strings.c + ( cd $(srcdir) && echo "/* This is a generated file. See swfdec_as_strings.c for details. */" \ + && echo "#ifndef _SWFDEC_AS_STRINGS_H_" \ + && echo "#define _SWFDEC_AS_STRINGS_H_" \ + && echo -e "\nextern const char swfdec_as_strings[];\n" \ + && grep " SWFDEC_AS_CONSTANT_STRING" swfdec_as_strings.c \ + | sed "s/.*(\"\(.*\)\").*/\1/" \ + | $(AWK) '{ if ($$0 == "") name = "EMPTY"; else if ($$0 == ",") name = "COMMA"; else if ($$0 == "/") name = "SLASH"; else name = $$0; gsub("[^a-zA-Z0-9]","_",name); print "#define SWFDEC_AS_STR_" name " &swfdec_as_strings[" x + 1 "]"; x = x + length ($$0) + 2 }' \ + && echo -e "\n#endif" ) > xgen-sas \ + && (cmp -s xgen-sas swfdec_as_strings.h || cp xgen-sas swfdec_as_strings.h ) \ && rm -f xgen-sas diff --git a/libswfdec/swfdec_as_strings.c b/libswfdec/swfdec_as_strings.c index 89431a3..1477395 100644 --- a/libswfdec/swfdec_as_strings.c +++ b/libswfdec/swfdec_as_strings.c @@ -399,47 +399,3 @@ const char swfdec_as_strings[] SWFDEC_AS_CONSTANT_STRING ("Key") /* add more here */ ; - -#ifdef COMPUTE_SWFDEC_AS_STRINGS_H -/* This code creates the offset */ -#include <stdio.h> -#include <string.h> - -int -main (int argc, char **argv) -{ - const char *cur = swfdec_as_strings; - char *name, *s; - - printf ("/* This is a generated file. See swfdec_as_strings.c for details. */\n"); - printf ("#ifndef _SWFDEC_AS_STRINGS_H_\n"); - printf ("#define _SWFDEC_AS_STRINGS_H_\n"); - printf ("\n"); - printf ("extern const char swfdec_as_strings[];\n"); - printf ("\n"); - while (*cur != 0) { - cur++; - if (!strcmp (cur, "")) { - name = strdup ("EMPTY"); - } else if (!strcmp (cur, ",")) { - name = strdup ("COMMA"); - } else if (!strcmp (cur, "/")) { - name = strdup ("SLASH"); - } else { - s = name = strdup (cur); - while (*s) { - if (!isalnum (*s)) - *s = '_'; - s++; - } - } - printf ("#define SWFDEC_AS_STR_%s &swfdec_as_strings[%u]\n", name, - (unsigned int) (cur - swfdec_as_strings)); - free (name); - cur += strlen (cur) + 1; - } - printf ("\n"); - printf ("#endif /* _SWFDEC_AS_STRINGS_H_ */\n"); - return 0; -} -#endif
Maybe Matching Threads
- libswfdec/Makefile.am
- 4 commits - libswfdec/Makefile.am libswfdec/swfdec_movie.c libswfdec/swfdec_shape_parser.c test/dump.c test/trace
- 17 commits - doc/swfdec-sections.txt libswfdec/compiler.c libswfdec/.gitignore libswfdec/Makefile.am libswfdec/swfdec_asbroadcaster.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_strings.c
- 14 commits - configure.ac swfdec/.gitignore swfdec-gtk/swfdec_gtk_loader.c swfdec-gtk/swfdec_playback_alsa.c swfdec/Makefile.am swfdec/swfdec_asnative.h swfdec/swfdec_as_string.c swfdec/swfdec_audio.c swfdec/swfdec_audio_load.c swfdec/swfdec_audio_load.h
- 5 commits - doc/Makefile.am doc/swfdec-sections.txt libswfdec/Makefile.am libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_initialize.as libswfdec/swfdec_initialize.h libswfdec/swfdec_player_as.c