summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2006-12-22 12:09:04 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:14:33 +0200
commit39758996c449e6759add7862c625c3de22e0718c (patch)
tree2e594619c461d62196a20c8607fadf832398203e
parentd7e21212a0a075f9888c490ff7cdcdfbde61c716 (diff)
downloadexternal_gettext-39758996c449e6759add7862c625c3de22e0718c.zip
external_gettext-39758996c449e6759add7862c625c3de22e0718c.tar.gz
external_gettext-39758996c449e6759add7862c625c3de22e0718c.tar.bz2
New options --dllexport, --help, --version.
-rw-r--r--gnulib-local/ChangeLog8
-rwxr-xr-xgnulib-local/build-aux/moopp84
2 files changed, 89 insertions, 3 deletions
diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog
index a4522c0..5b08cdc 100644
--- a/gnulib-local/ChangeLog
+++ b/gnulib-local/ChangeLog
@@ -1,5 +1,13 @@
2006-12-21 Bruno Haible <bruno@clisp.org>
+ * build-aux/moopp (func_usage, func_version): New functions.
+ (dllexports): New variable.
+ Parse command-line options.
+ (func_emit_source_h): Emit DLL_VARIABLE marks if the class is to be
+ exported.
+
+2006-12-21 Bruno Haible <bruno@clisp.org>
+
* modules/moo (Makefile.am): Declare MOOPPFLAGS.
* modules/moo-tests (Makefile.am): Pass the MOOPPFLAGS to every moopp
invocation.
diff --git a/gnulib-local/build-aux/moopp b/gnulib-local/build-aux/moopp
index 151f90e..2792df8 100755
--- a/gnulib-local/build-aux/moopp
+++ b/gnulib-local/build-aux/moopp
@@ -44,6 +44,39 @@
# - ...
# Someday this should be rewritten to use a proper tokenizer and parser.
+# func_usage
+# outputs to stdout the --help usage message.
+func_usage ()
+{
+ echo "\
+Usage: moopp [OPTION]... SOURCE.oo.c SOURCE.oo.h SUPERCLASS.oo.h ...
+
+Preprocesses SOURCE.oo.c into CLASS.c and SOURCE.oo.h into CLASS.h,
+where CLASS is the name of the class defined in these files.
+
+See moo.h for the object-oriented features and the syntax of the input files.
+
+Options:
+ --help print this help and exit
+ --version print version information and exit
+ --dllexport=NAME Arrange so that the specified class name can be accessed
+ from outside the shared library it is compiled into.
+ This option can be repeated.
+
+Report bugs to <bruno@clisp.org>."
+}
+
+# func_version
+# outputs to stdout the --version message.
+func_version ()
+{
+ echo "$progname (GNU $package) $version"
+ echo "Copyright (C) 2006 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+ echo "Written by" "Bruno Haible"
+}
+
# func_fatal_error message
# outputs to stderr a fatal error message, and terminates the program.
func_fatal_error ()
@@ -53,8 +86,44 @@ func_fatal_error ()
exit 1
}
+# Command-line option processing.
+# Removes the OPTIONS from the arguments. Sets the variables:
+# - dllexports list of class names to export from Woe32 DLLs
+dllexports=
+while test $# -gt 0; do
+ case "$1" in
+ --dllexport | --dllexpor | --dllexpo | --dllexp | --dllex | --dlle )
+ shift
+ if test $# = 0; then
+ func_fatal_error "missing argument for --dllexport"
+ fi
+ case "$1" in
+ -*) func_fatal_error "missing argument for --dllexport" ;;
+ esac
+ dllexports="$dllexports $1"
+ shift ;;
+ --dllexport=* )
+ arg=`echo "X$1" | sed -e 's/^X--dllexport=//'`
+ dllexports="$dllexports $arg"
+ shift ;;
+ --help | --hel | --he | --h )
+ func_usage
+ exit 0 ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v )
+ func_version
+ exit 0 ;;
+ -- ) # Stop option prcessing
+ shift; break ;;
+ -* )
+ func_fatal_error "unrecognized option: $option"
+ ;;
+ * )
+ break ;;
+ esac
+done
+
if test $# -lt 2; then
- func_fatal_error "Usage: $0 source.oo.c source.oo.h superclass.oo.h ..."
+ func_fatal_error "Usage: $0 [OPTION]... source.oo.c source.oo.h superclass.oo.h ..."
fi
# Check that all files exist.
@@ -380,6 +449,15 @@ source_header_file_base=`echo "$source_header_file" | sed -e 's,^.*/,,'`
func_emit_source_h ()
{
newfile="$1"
+ # Use DLL_VARIABLE if and only if the main classname is among the names
+ # specified with --dllexport options.
+ dllexport_for_variables=
+ for name in $dllexports; do
+ if test "${main_classname}" = "${name}"; then
+ dllexport_for_variables=" DLL_VARIABLE"
+ break
+ fi
+ done
{
echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'
echo
@@ -490,7 +568,7 @@ func_emit_source_h ()
done
echo "#endif"
echo
- echo "extern const typeinfo_t ${main_classname}_typeinfo;"
+ echo "extern${dllexport_for_variables} const typeinfo_t ${main_classname}_typeinfo;"
if test -n "${main_superclassname}"; then
superclasses_array_initializer="${main_superclassname}_SUPERCLASSES"
else
@@ -503,7 +581,7 @@ func_emit_source_h ()
echo "#define ${main_classname}_SUPERCLASSES_LENGTH (1 + 1)"
fi
echo
- echo "extern const struct ${main_classname}_implementation ${main_classname}_vtable;"
+ echo "extern${dllexport_for_variables} const struct ${main_classname}_implementation ${main_classname}_vtable;"
echo
echo "#line "`expr $main_class_end_lineno + 1`" \"${source_header_file_base}\""
cat "$source_header_file" | sed -e "1,${main_class_end_lineno}d"