From: George Lebl Date: Fri, 5 Oct 2001 10:59:00 +0000 (-0800) Subject: Release 1.99.1 X-Git-Tag: v1.99.1 X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/commitdiff_plain/7231d76fbf4ae0b501af648e1216b88714aa7353 Release 1.99.1 --- diff --git a/ChangeLog b/ChangeLog index b4190e2..99e9511 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,178 @@ +Sat Sep 29 17:00:39 2001 George Lebl + + * doc/Makefile.am: update + +Sat Sep 29 16:44:13 2001 George Lebl + + * doc/gob2.1.in: update a tad and add a note that the manual + is now out of date + +Sat Sep 29 16:33:57 2001 George Lebl + + * gob2.spec.in: update for gob2 + +Fri Sep 28 17:39:57 2001 George Lebl + + * **/*: Merge from gob-2 to HEAD + +Fri Sep 28 17:08:19 2001 George Lebl + + * configure.in, gob2.spec.in, gob2.m4, doc/gob2.1.in, Makefile.am, + doc/Makefile.am: rename rest of files for gob2 + + * src/main.c: minor cleanup + +Thu Sep 27 21:56:17 2001 George Lebl + + * src/generate_treefuncs.pl, src/treefuncs.def, src/parse.y, + src/main.c: Revamp the tree funcs stuff to be saner and cooler, + and fix some crashes and other things related to this. + + * src/parse.y, src/lexer.l, src/main.c, src/util.[ch], + src/checks.[ch], treefuncs.def: Add properties (GParam), fix + C++ generation, add GET_NEW_VARG, whack the propname alias for + arguments setters/getters (they're deprecated anyway) + + * src/test.gob: update tests + +Sun Sep 16 13:07:37 2001 George Lebl + + * src/main.c: replace GOB_ prefix for local functions with + self_. This makes much more sense. + +Sun Sep 16 12:43:24 2001 George Lebl + + * src/lexer.l, src/parse.y, src/main.c, src/treefuncs.(def|c|h), + src/util.[ch], src/test.gob: Add syntax for properties (GParam + or whatever you call these:). The code behind them is not yet + there though. + +Sun Aug 12 16:15:46 2001 George Lebl + + * src/main.c, src/parse.y, src/test.gob, src/util.c: Things now + make compilable objects, including with signals, how well it + works I don't know. cpp support seems broken in glib mostly. + +Sat Jun 30 15:01:26 2001 George Lebl + + * Applied the following from HEAD + + Sat Jun 30 14:57:37 2001 George Lebl + + * doc/gob.1.in: add documentation for (export) + + Tue Jun 26 15:54:08 2001 George Lebl + + * src/Makefile.am: add built sources to EXTRA_DIST + + 2001-06-24 Mark Brown + + * src/main.c: Default to PRIVATE_HEADER_ONDEMAND rather than + PRIVATE_HEADER_ALWAYS as per documentation. + + * doc/gob.1.in: Fix cut & paste error in object_{get,set} + examples. + + Sat Jun 09 13:38:53 2001 George Lebl + + * src/parse.y: was freeing the wrong token + + 2001-06-03 Eskil Heyn Olsen + + * examples/my-person.gob: + Fixed some comments + + * examples/test-export.gob: + File that tests the (export) keyword. + + * src/parse.y: + Added a (export) keyword to argument, so gob will + autodefine the my_object_[get|set]_var functions. + +Sun May 13 02:45:43 2001 George Lebl + + * src/main.c: revert the GET_NEW_VARG since it just won't work + with non-gcc systems + +Sun May 13 02:31:52 2001 George Lebl + + * src/main.c: add GET_NEW_VARG macro/static func (for non-gcc) + and add TYPE_SELF macro + +Sun May 13 02:02:47 2001 George Lebl + + * src/util.c: patch from Frederic Crozat + to fix warning + +Sat Apr 21 20:06:10 2001 George Lebl + + * examples/Makefile.am, examples/README, + examples/GNOME_Foo_SomeInterface.idl, + examples/foo-some-interface.gob: Add an example for BonoboXObject + +Sat Apr 21 19:33:08 2001 George Lebl + + * configure.in: Raise version to 1.0.9 + + * src/lexer.l: Properly check major version requirements (majors + must match in the requires line) + + * src/parse.y, src/main.c, src/treefuncs.(def|c|h), src/checks.c: + Add direct BonoboXObject support + + * src/parse.y: fix the chunks usage + + * doc/gob.1.in: document BonoboXObject stuff, fix the bugs section + wrt gtk-doc which has been supported for quite some time + +Sat Apr 14 00:11:50 2001 George Lebl + + * configure.in: compile with glib 2.0 + + * src/test.gob, src/Makefile.am: make the test glib pure, or mostly + so + + * src/lexer.l: added fixme + + * src/main.c: work on signals a little bit + +Fri Apr 13 21:23:19 2001 George Lebl + + * src/checks.[ch], src/lexer.l, src/main.c, src/parse.y, + src/treefuncs.[ch], src/treefuncs.def: Work on gobject support, + based on the patch Sven sent me. Also do add unref as well as + destroy handlers to vars, and moved the destructors to finalize and + unreffers to shutdown. This all compiles, but that doesn't mean it + makes usable objects. + +Fri Apr 13 17:45:14 2001 George Lebl + + * src/parse.y, doc/gob.1.in: Fix a problem found by Eric Kidd + , where objectlink was not completely + refcounting safe. Could underref if you set the same object. + +Sat Mar 31 00:24:58 2001 George Lebl + + * src/main.c: fix crash with marshallers of signals with a return + type and no arguments. + +Sun Mar 04 19:14:03 2001 George Lebl + + * src/main.c, src/checks.c, src/util.[ch]: Remove the underscore + hack, remove the 1.2 code from the 1.3 compat hacks, make all + short names start with GOB_. Start of the direct GObject + support, gob compiles, but it will not create useful object + files yet. + +Tue Feb 27 06:14:59 2001 George Lebl + + * configure.in, src/Makefile.am, README: this is the gob-2 branch + for GObject support + +Tue Feb 27 00:53:41 2001 Jonathan Blandford + + * README: Use my new-found maintainer status!!! The power! + Sun Feb 25 17:17:46 2001 George Lebl * Release 1.0.7 diff --git a/Makefile.am b/Makefile.am index 4809e57..c8c5081 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,9 @@ SUBDIRS = @SUBDIRS@ DIST_SUBDIRS = src doc examples m4dir=$(datadir)/aclocal -m4_DATA=gob.m4 +m4_DATA=gob2.m4 -EXTRA_DIST = gob.spec.in $(m4_DATA) +EXTRA_DIST = gob2.spec.in $(m4_DATA) -dist-hook: gob.spec - cp gob.spec $(distdir) +dist-hook: gob2.spec + cp gob2.spec $(distdir) diff --git a/Makefile.in b/Makefile.in index d25d6d4..7385530 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -63,8 +63,10 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ DOINSTGOB = @DOINSTGOB@ GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ MAINT = @MAINT@ @@ -72,6 +74,7 @@ MAKEINFO = @MAKEINFO@ MV = @MV@ NOINSTGOB = @NOINSTGOB@ PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ RM = @RM@ TAR = @TAR@ VERSION = @VERSION@ @@ -81,18 +84,18 @@ SUBDIRS = @SUBDIRS@ DIST_SUBDIRS = src doc examples m4dir = $(datadir)/aclocal -m4_DATA = gob.m4 +m4_DATA = gob2.m4 -EXTRA_DIST = gob.spec.in $(m4_DATA) +EXTRA_DIST = gob2.spec.in $(m4_DATA) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = gob.spec +CONFIG_CLEAN_FILES = gob2.spec DATA = $(m4_DATA) DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ Makefile.am Makefile.in NEWS TODO aclocal.m4 config.h.in configure \ -configure.in gob.spec.in install-sh missing mkinstalldirs +configure.in gob2.spec.in install-sh missing mkinstalldirs DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -110,7 +113,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in cd $(srcdir) && $(ACLOCAL) -config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) +config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) @@ -142,7 +145,7 @@ distclean-hdr: -rm -f config.h maintainer-clean-hdr: -gob.spec: $(top_builddir)/config.status gob.spec.in +gob2.spec: $(top_builddir)/config.status gob2.spec.in cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status install-m4DATA: $(m4_DATA) @@ -294,7 +297,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ + cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ @@ -388,8 +391,8 @@ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean -dist-hook: gob.spec - cp gob.spec $(distdir) +dist-hook: gob2.spec + cp gob2.spec $(distdir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/README b/README index cb1c740..4ce0a2d 100644 --- a/README +++ b/README @@ -1,12 +1,18 @@ -GTK+ Object Builder (GOB) +[ + Note: if you are looking for the old GOB (for GTK+ objects), which is what + used to be here, look into the gob-1-0 branch in CVS! +] -Very simple preprocessor for making GTK+ objects with inline C code so that +GObject Builder (GOB-2) +(George's Obfuscated Bits) + +Very simple preprocessor for making GObject objects with inline C code so that generated files are not editted. Syntax is inspired by java and yacc or lex. The implementation is intentionaly kept simple, and no C code parsing is done. Reasons: - C is a perfect (well mostly) language, no need for another language - - Writing a fully featured GTK+ object is a hassle + - Writing a fully featured GObject object is a hassle - Need for a generator that doesn't require changes to generated code - I like how Java writes method code directly into the class definition. @@ -16,31 +22,31 @@ To build: run "./configure;make" To install: - run "make install" as root, or just take the gob binary and place + run "make install" as root, or just take the gob2 binary and place it anywhere you want. To use: - run gob with the .gob file on the command line + run gob2 with the .gob file on the command line What's generated: two (.c and .h) files named by the object name with words separated by a hyphen (not neccessairly the .gob file prefix) How to write .gob files? - 1) read "man gob" for some documenation on how to use GOB + 1) read "man gob2" for some documenation on how to use GOB 2) if you can't find what you need, read src/test.gob for an example of GOB code 3) If you still can't find what you need, read src/lexer.l and src/parse.y (in other words: RTFS) -How to include gob inside your project: +How to include gob2 inside your project: - Put the gob distribution into a subdirectory in your main + Put the gob2 distribution into a subdirectory in your main project directory. Use the AC_CONFIG_SUBDIRS to include that directory in your configure run. And finally add a file called NOINST_GOB into your toplevel project directory (this can be done - inside your configure script in fact) so that gob doesn't install - itself. Then just use the made gob binary as you would other + inside your configure script in fact) so that gob2 doesn't install + itself. Then just use the made gob2 binary as you would other preprocessors. TODO: diff --git a/aclocal.m4 b/aclocal.m4 index 3a5eda4..05af4e4 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 +dnl aclocal.m4 generated automatically by aclocal 1.4-p4 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -135,62 +135,76 @@ AC_PROG_LEX AC_DECL_YYTEXT]) # Configure paths for GLIB -# Owen Taylor 97-11-3 +# Owen Taylor 1997-2001 -dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) -dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or -dnl gthread is specified in MODULES, pass to glib-config +dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or +dnl gthread is specified in MODULES, pass to pkg-config dnl -AC_DEFUN(AM_PATH_GLIB, +AC_DEFUN(AM_PATH_GLIB_2_0, [dnl -dnl Get the cflags and libraries from the glib-config script +dnl Get the cflags and libraries from pkg-config dnl -AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)], - glib_config_prefix="$withval", glib_config_prefix="") -AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)], - glib_config_exec_prefix="$withval", glib_config_exec_prefix="") AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program], , enable_glibtest=yes) - if test x$glib_config_exec_prefix != x ; then - glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix" - if test x${GLIB_CONFIG+set} != xset ; then - GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config - fi - fi - if test x$glib_config_prefix != x ; then - glib_config_args="$glib_config_args --prefix=$glib_config_prefix" - if test x${GLIB_CONFIG+set} != xset ; then - GLIB_CONFIG=$glib_config_prefix/bin/glib-config - fi - fi - + pkg_config_args=glib-2.0 for module in . $4 do case "$module" in gmodule) - glib_config_args="$glib_config_args gmodule" + pkg_config_args="$pkg_config_args gmodule-2.0" + ;; + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" ;; gthread) - glib_config_args="$glib_config_args gthread" + pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done - AC_PATH_PROG(GLIB_CONFIG, glib-config, no) - min_glib_version=ifelse([$1], ,0.99.7,$1) - AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + no_glib="" - if test "$GLIB_CONFIG" = "no" ; then - no_glib=yes + + if test x$PKG_CONFIG != xno ; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_glib=yes + PKG_CONFIG=no + fi + fi + + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + min_glib_version=ifelse([$1], ,1.3.3,$1) + AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : else - GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags` - GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs` - glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \ + no_glib = yes + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \ + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \ + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_glibtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" @@ -199,7 +213,7 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and ru LIBS="$GLIB_LIBS $LIBS" dnl dnl Now check if the installed GLIB is sufficiently new. (Also sanity -dnl checks the results of glib-config to some extent +dnl checks the results of pkg-config to some extent) dnl rm -f conf.glibtest AC_TRY_RUN([ @@ -226,17 +240,16 @@ main () (glib_minor_version != $glib_config_minor_version) || (glib_micro_version != $glib_config_micro_version)) { - printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, glib_major_version, glib_minor_version, glib_micro_version); - printf ("*** was found! If glib-config was correct, then it is best\n"); - printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n"); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); - printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n"); - printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n"); - printf("*** before re-running configure\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); } else if ((glib_major_version != GLIB_MAJOR_VERSION) || (glib_minor_version != GLIB_MINOR_VERSION) || @@ -264,10 +277,10 @@ main () printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the glib-config shell script is\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n"); - printf("*** correct copy of glib-config. (In this case, you will have to\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } @@ -280,15 +293,13 @@ main () fi fi if test "x$no_glib" = x ; then - AC_MSG_RESULT(yes) + AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) - if test "$GLIB_CONFIG" = "no" ; then - echo "*** The glib-config script installed by GLIB could not be found" - echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the GLIB_CONFIG environment variable to the" - echo "*** full path to glib-config." + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" else if test -f conf.glibtest ; then : @@ -308,26 +319,27 @@ main () echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" - echo "***" - echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" - echo "*** came with the system with the command" - echo "***" - echo "*** rpm --erase --nodeps gtk gtk-devel" ], + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GLIB was incorrectly installed" echo "*** or that you have moved GLIB since it was installed. In the latter case, you" - echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ]) + echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GLIB_CFLAGS="" GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) + AC_SUBST(GLIB_GENMARSHAL) + AC_SUBST(GOBJECT_QUERY) + AC_SUBST(GLIB_MKENUMS) rm -f conf.glibtest ]) diff --git a/config.h.in b/config.h.in index d97a883..7c600b9 100644 --- a/config.h.in +++ b/config.h.in @@ -1,14 +1,14 @@ /* config.h.in. Generated automatically from configure.in by autoheader. */ -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if lex declares yytext as a char * by default, not a char[]. */ -#undef YYTEXT_POINTER - /* Name of package */ #undef PACKAGE +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + /* Version number of package */ #undef VERSION +/* Define if `lex' declares `yytext' as a `char *' by default, not a `char[]'. + */ +#undef YYTEXT_POINTER diff --git a/configure b/configure index d013f62..59e47ec 100755 --- a/configure +++ b/configure @@ -1,35 +1,119 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by Autoconf 2.52. # +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -# Defaults: -ac_help= +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --with-glib-prefix=PFX Prefix where GLIB is installed (optional)" -ac_help="$ac_help - --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)" -ac_help="$ac_help - --disable-glibtest Do not try to compile and run a test GLIB program" -ac_help="$ac_help - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="src/treefuncs.h" # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -38,10 +122,15 @@ program_transform_name=s,x,x, silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -55,17 +144,16 @@ oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= ac_prev= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -73,59 +161,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -134,95 +222,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -231,12 +271,12 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. @@ -257,26 +297,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; + program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; + program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -293,7 +333,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -303,7 +343,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -314,58 +354,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -376,98 +415,98 @@ EOF ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; + x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -exec 5>./config.log -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac done -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=src/treefuncs.h +test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then @@ -478,13 +517,307 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat < if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 </dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -495,43 +828,111 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:831: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:842: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:850: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:866: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:870: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:876: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:878: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:880: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:899: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:901: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:921: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:924: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' else - ac_n= ac_c='\c' ac_t= + ac_path_separator=: fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh +ac_config_headers="$ac_config_headers config.h" - - +ac_config_commands="$ac_config_commands default-1" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do @@ -543,14 +944,20 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + { { echo "$as_me:954: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -559,31 +966,39 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:568: checking for a BSD compatible install" >&5 +echo "$as_me:974: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + ac_save_IFS=$IFS; IFS=$ac_path_separator for ac_dir in $PATH; do + IFS=$ac_save_IFS # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + if $as_executable_p "$ac_dir/$ac_prog"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 @@ -593,31 +1008,31 @@ else ;; esac done - IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:1023: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:621: checking whether build environment is sane" >&5 +echo "$as_me:1034: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftestfile @@ -639,8 +1054,11 @@ if ( # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } + { { echo "$as_me:1057: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } fi test "$2" = conftestfile @@ -649,366 +1067,737 @@ then # Ok. : else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } + { { echo "$as_me:1070: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } fi rm -f conftest* -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi +echo "$as_me:1077: result: yes" >&5 +echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" + program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:678: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +echo "$as_me:1092: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftestmake <<\EOF + cat >conftest.make <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi -rm -f conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:1112: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:1116: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi +PACKAGE=gob2 -PACKAGE=gob - -VERSION=1.0.7 +VERSION=1.99.1 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } + { { echo "$as_me:1126: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } fi -cat >> confdefs.h <>confdefs.h <> confdefs.h <>confdefs.h <&6 -echo "configure:724: checking for working aclocal" >&5 +echo "$as_me:1140: checking for working aclocal" >&5 +echo $ECHO_N "checking for working aclocal... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (aclocal --version) < /dev/null > /dev/null 2>&1; then ACLOCAL=aclocal - echo "$ac_t""found" 1>&6 + echo "$as_me:1147: result: found" >&5 +echo "${ECHO_T}found" >&6 else ACLOCAL="$missing_dir/missing aclocal" - echo "$ac_t""missing" 1>&6 + echo "$as_me:1151: result: missing" >&5 +echo "${ECHO_T}missing" >&6 fi -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:737: checking for working autoconf" >&5 +echo "$as_me:1155: checking for working autoconf" >&5 +echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoconf --version) < /dev/null > /dev/null 2>&1; then AUTOCONF=autoconf - echo "$ac_t""found" 1>&6 + echo "$as_me:1162: result: found" >&5 +echo "${ECHO_T}found" >&6 else AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 + echo "$as_me:1166: result: missing" >&5 +echo "${ECHO_T}missing" >&6 fi -echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:750: checking for working automake" >&5 +echo "$as_me:1170: checking for working automake" >&5 +echo $ECHO_N "checking for working automake... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (automake --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake - echo "$ac_t""found" 1>&6 + echo "$as_me:1177: result: found" >&5 +echo "${ECHO_T}found" >&6 else AUTOMAKE="$missing_dir/missing automake" - echo "$ac_t""missing" 1>&6 + echo "$as_me:1181: result: missing" >&5 +echo "${ECHO_T}missing" >&6 fi -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:763: checking for working autoheader" >&5 +echo "$as_me:1185: checking for working autoheader" >&5 +echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoheader --version) < /dev/null > /dev/null 2>&1; then AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 + echo "$as_me:1192: result: found" >&5 +echo "${ECHO_T}found" >&6 else AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 + echo "$as_me:1196: result: missing" >&5 +echo "${ECHO_T}missing" >&6 fi -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:776: checking for working makeinfo" >&5 +echo "$as_me:1200: checking for working makeinfo" >&5 +echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (makeinfo --version) < /dev/null > /dev/null 2>&1; then MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 + echo "$as_me:1207: result: found" >&5 +echo "${ECHO_T}found" >&6 else MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 + echo "$as_me:1211: result: missing" >&5 +echo "${ECHO_T}missing" >&6 fi - - if test -f ../NOINST_GOB ; then DOINSTGOB= - NOINSTGOB=gob - echo "$ac_t""*** NOT Going to install GOB ***" 1>&6 + NOINSTGOB=gob2 + echo "$as_me:1218: result: *** NOT Going to install GOB ***" >&5 +echo "${ECHO_T}*** NOT Going to install GOB ***" >&6 SUBDIRS="src examples" - + else - DOINSTGOB=gob + DOINSTGOB=gob2 NOINSTGOB= SUBDIRS="src examples doc" - + fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:1237: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1252: found $ac_dir/$ac_word" >&5 +break +done +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1260: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1263: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -# Extract the first word of "gcc", so it can be a program name with args. +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:808: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:1272: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1287: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1295: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1298: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1311: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1326: found $ac_dir/$ac_word" >&5 +break +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:1334: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1337: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1346: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1361: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1369: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1372: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC else - echo "$ac_t""no" 1>&6 + CC="$ac_cv_prog_CC" fi +fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:838: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:1385: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1405: found $ac_dir/$ac_word" >&5 +break +done + if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# -gt 0; then + if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$ac_dir/$ac_word" "$@" + set dummy "$ac_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:1427: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:1430: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:889: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1441: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1456: found $ac_dir/$ac_word" >&5 +break +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:1464: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:1467: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1480: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1495: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1503: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1506: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:921: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + test -n "$ac_ct_CC" && break +done -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross + CC=$ac_ct_CC +fi -cat > conftest.$ac_ext << EOF +fi -#line 932 "configure" +test -z "$CC" && { { echo "$as_me:1518: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1523:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1526: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:1529: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1531: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:1534: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1536: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:1539: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1543 "configure" #include "confdefs.h" -main(){return(0);} -EOF -if { (eval echo configure:937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:1559: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1562: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1565: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1588: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1594: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1599: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1605: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1608: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no else - ac_cv_prog_cc_cross=yes + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1615: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi fi +fi +echo "$as_me:1623: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1630: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1632: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1635: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1637: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1640: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no + { { echo "$as_me:1656: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:963: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:968: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes + +rm -f conftest$ac_cv_exeext +echo "$as_me:1662: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1668: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_prog_gcc=no + cat >conftest.$ac_ext <<_ACEOF +#line 1674 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1686: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1689: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1701: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext fi +echo "$as_me:1708: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1712: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1718 "configure" +#include "confdefs.h" -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +int +main () +{ +#ifndef __GNUC__ + choke me +#endif -if test $ac_cv_prog_gcc = yes; then - GCC=yes + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1733: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1736: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1739: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1742: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes else - GCC= + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:996: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +echo "$as_me:1754: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1760: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + cat >conftest.$ac_ext <<_ACEOF +#line 1766 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1778: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1781: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1784: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1787: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else - ac_cv_prog_cc_g=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no fi -rm -f conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +echo "$as_me:1797: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" + CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -1022,127 +1811,368 @@ else CFLAGS= fi fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1824: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1827: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1830: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1833: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1845 "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1858: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1861: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1864: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1867: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1877 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1889: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1892: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1895: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1898: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1028: checking how to run the C preprocessor" >&5 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:1930: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 1951 "configure" #include "confdefs.h" #include -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1049: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + Syntax error +_ACEOF +if { (eval echo "$as_me:1956: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1962: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 1985 "configure" #include "confdefs.h" -#include -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : +#include +_ACEOF +if { (eval echo "$as_me:1989: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1995: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2042 "configure" #include "confdefs.h" #include -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1083: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + Syntax error +_ACEOF +if { (eval echo "$as_me:2047: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2053: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* + # Broken: fails on valid input. +continue fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2076 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2080: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2086: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break fi - CPP="$ac_cv_prog_CPP" +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : else - ac_cv_prog_CPP="$CPP" + { { echo "$as_me:2114: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$CPP" 1>&6 -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1108: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:2125: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 2131 "configure" #include "confdefs.h" #include #include #include #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +_ACEOF +if { (eval echo "$as_me:2139: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2145: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 2167 "configure" #include "confdefs.h" #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1151,16 +2181,16 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 2185 "configure" #include "confdefs.h" #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1169,39 +2199,62 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 2206 "configure" #include "confdefs.h" #include -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:1188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:2232: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2235: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:2237: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2240: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +echo "$as_me:2253: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF @@ -1209,157 +2262,235 @@ fi for ac_prog in 'bison -y' byacc do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1216: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:2267: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_YACC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_YACC="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_YACC="$ac_prog" +echo "$as_me:2282: found $ac_dir/$ac_word" >&5 +break +done + fi fi -YACC="$ac_cv_prog_YACC" +YACC=$ac_cv_prog_YACC if test -n "$YACC"; then - echo "$ac_t""$YACC" 1>&6 + echo "$as_me:2290: result: $YACC" >&5 +echo "${ECHO_T}$YACC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:2293: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -n "$YACC" && break + test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" missing_dir=`cd $ac_aux_dir && pwd` for ac_prog in flex lex do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1252: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:2306: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LEX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LEX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_LEX="$ac_prog" +echo "$as_me:2321: found $ac_dir/$ac_word" >&5 +break +done + fi fi -LEX="$ac_cv_prog_LEX" +LEX=$ac_cv_prog_LEX if test -n "$LEX"; then - echo "$ac_t""$LEX" 1>&6 + echo "$as_me:2329: result: $LEX" >&5 +echo "${ECHO_T}$LEX" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:2332: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -n "$LEX" && break + test -n "$LEX" && break done test -n "$LEX" || LEX=""$missing_dir/missing flex"" -# Extract the first word of "flex", so it can be a program name with args. -set dummy flex; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1285: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +for ac_prog in flex lex +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2344: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LEX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LEX="flex" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_LEX="$ac_prog" +echo "$as_me:2359: found $ac_dir/$ac_word" >&5 +break +done + fi fi -LEX="$ac_cv_prog_LEX" +LEX=$ac_cv_prog_LEX if test -n "$LEX"; then - echo "$ac_t""$LEX" 1>&6 + echo "$as_me:2367: result: $LEX" >&5 +echo "${ECHO_T}$LEX" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:2370: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + test -n "$LEX" && break +done +test -n "$LEX" || LEX=":" + if test -z "$LEXLIB" then - case "$LEX" in - flex*) ac_lib=fl ;; - *) ac_lib=l ;; - esac - echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1319: checking for yywrap in -l$ac_lib" >&5 -ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-l$ac_lib $LIBS" -cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 +if test "${ac_cv_lib_fl_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2388 "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap(); - -int main() { -yywrap() -; return 0; } -EOF -if { (eval echo configure:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2407: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2410: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2413: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2416: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fl_yywrap=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_fl_yywrap=no fi -rm -f conftest* -LIBS="$ac_save_LIBS" - +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LEXLIB="-l$ac_lib" +echo "$as_me:2427: result: $ac_cv_lib_fl_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 +if test $ac_cv_lib_fl_yywrap = yes; then + LEXLIB="-lfl" +else + echo "$as_me:2432: checking for yywrap in -ll" >&5 +echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 +if test "${ac_cv_lib_l_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ll $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2440 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2459: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2462: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2465: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2468: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_l_yywrap=yes else - echo "$ac_t""no" 1>&6 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_l_yywrap=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2479: result: $ac_cv_lib_l_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 +if test $ac_cv_lib_l_yywrap = yes; then + LEXLIB="-ll" fi fi -echo $ac_n "checking lex output file root""... $ac_c" 1>&6 -echo "configure:1361: checking lex output file root" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi + +if test "x$LEX" != "x:"; then + echo "$as_me:2490: checking lex output file root" >&5 +echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_root+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # The minimal lex program is just a single line: %%. But some broken lexes # (Solaris, I think it was) want two %% lines, so accommodate them. @@ -1370,54 +2501,64 @@ if test -f lex.yy.c; then elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else - { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; } + { { echo "$as_me:2504: error: cannot find output from $LEX; giving up" >&5 +echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} + { (exit 1); exit 1; }; } fi fi - -echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 +echo "$as_me:2509: result: $ac_cv_prog_lex_root" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root -echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 -echo "configure:1382: checking whether yytext is a pointer" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:2513: checking whether yytext is a pointer" >&5 +echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c -ac_save_LIBS="$LIBS" +ac_save_LIBS=$LIBS LIBS="$LIBS $LEXLIB" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` -int main() { - -; return 0; } -EOF -if { (eval echo configure:1401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2529: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2532: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2535: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2538: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_lex_yytext_pointer=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -f conftest* -LIBS="$ac_save_LIBS" +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_save_LIBS rm -f "${LEX_OUTPUT_ROOT}.c" fi - -echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6 +echo "$as_me:2550: result: $ac_cv_prog_lex_yytext_pointer" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 if test $ac_cv_prog_lex_yytext_pointer = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define YYTEXT_POINTER 1 EOF fi +fi + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1425,31 +2566,39 @@ fi # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1434: checking for a BSD compatible install" >&5 +echo "$as_me:2574: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + ac_save_IFS=$IFS; IFS=$ac_path_separator for ac_dir in $PATH; do + IFS=$ac_save_IFS # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + if $as_executable_p "$ac_dir/$ac_prog"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 @@ -1459,317 +2608,445 @@ else ;; esac done - IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:2623: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1487: checking how to run the C preprocessor" >&5 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:2639: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 2660 "configure" #include "confdefs.h" #include -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + Syntax error +_ACEOF +if { (eval echo "$as_me:2665: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2671: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 2694 "configure" #include "confdefs.h" -#include -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : +#include +_ACEOF +if { (eval echo "$as_me:2698: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2704: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2751 "configure" #include "confdefs.h" #include -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1542: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + Syntax error +_ACEOF +if { (eval echo "$as_me:2756: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2762: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* + # Broken: fails on valid input. +continue fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2785 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2789: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2795: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break fi - CPP="$ac_cv_prog_CPP" +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : else - ac_cv_prog_CPP="$CPP" + { { echo "$as_me:2823: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$CPP" 1>&6 + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1569: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:2836: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_RM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$RM" in - /*) + case $RM in + [\\/]* | ?:[\\/]*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_RM="$RM" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_RM="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_RM="$ac_dir/$ac_word" + echo "$as_me:2853: found $ac_dir/$ac_word" >&5 + break +fi +done + test -z "$ac_cv_path_RM" && ac_cv_path_RM="/bin/rm" ;; esac fi -RM="$ac_cv_path_RM" +RM=$ac_cv_path_RM + if test -n "$RM"; then - echo "$ac_t""$RM" 1>&6 + echo "$as_me:2865: result: $RM" >&5 +echo "${ECHO_T}$RM" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:2868: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Extract the first word of "mv", so it can be a program name with args. set dummy mv; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1605: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:2874: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MV+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$MV" in - /*) + case $MV in + [\\/]* | ?:[\\/]*) ac_cv_path_MV="$MV" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_MV="$MV" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_MV="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_MV="$ac_dir/$ac_word" + echo "$as_me:2891: found $ac_dir/$ac_word" >&5 + break +fi +done + test -z "$ac_cv_path_MV" && ac_cv_path_MV="/bin/mv" ;; esac fi -MV="$ac_cv_path_MV" +MV=$ac_cv_path_MV + if test -n "$MV"; then - echo "$ac_t""$MV" 1>&6 + echo "$as_me:2903: result: $MV" >&5 +echo "${ECHO_T}$MV" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:2906: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Extract the first word of "tar", so it can be a program name with args. set dummy tar; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1641: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:2912: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_TAR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$TAR" in - /*) + case $TAR in + [\\/]* | ?:[\\/]*) ac_cv_path_TAR="$TAR" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_TAR="$TAR" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_TAR="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_TAR="$ac_dir/$ac_word" + echo "$as_me:2929: found $ac_dir/$ac_word" >&5 + break +fi +done + test -z "$ac_cv_path_TAR" && ac_cv_path_TAR="/bin/tar" ;; esac fi -TAR="$ac_cv_path_TAR" -if test -n "$TAR"; then - echo "$ac_t""$TAR" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi +TAR=$ac_cv_path_TAR -# Check whether --with-glib-prefix or --without-glib-prefix was given. -if test "${with_glib_prefix+set}" = set; then - withval="$with_glib_prefix" - glib_config_prefix="$withval" -else - glib_config_prefix="" -fi - -# Check whether --with-glib-exec-prefix or --without-glib-exec-prefix was given. -if test "${with_glib_exec_prefix+set}" = set; then - withval="$with_glib_exec_prefix" - glib_config_exec_prefix="$withval" +if test -n "$TAR"; then + echo "$as_me:2941: result: $TAR" >&5 +echo "${ECHO_T}$TAR" >&6 else - glib_config_exec_prefix="" + echo "$as_me:2944: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Check whether --enable-glibtest or --disable-glibtest was given. if test "${enable_glibtest+set}" = set; then enableval="$enable_glibtest" - : + else enable_glibtest=yes -fi +fi; - - if test x$glib_config_exec_prefix != x ; then - glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix" - if test x${GLIB_CONFIG+set} != xset ; then - GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config - fi - fi - if test x$glib_config_prefix != x ; then - glib_config_args="$glib_config_args --prefix=$glib_config_prefix" - if test x${GLIB_CONFIG+set} != xset ; then - GLIB_CONFIG=$glib_config_prefix/bin/glib-config - fi - fi - - for module in . + pkg_config_args=glib-2.0 + for module in . do case "$module" in - gmodule) - glib_config_args="$glib_config_args gmodule" + gmodule) + pkg_config_args="$pkg_config_args gmodule-2.0" ;; - gthread) - glib_config_args="$glib_config_args gthread" + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" + ;; + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done - # Extract the first word of "glib-config", so it can be a program name with args. -set dummy glib-config; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1727: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:2974: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$GLIB_CONFIG" in - /*) - ac_cv_path_GLIB_CONFIG="$GLIB_CONFIG" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GLIB_CONFIG="$GLIB_CONFIG" # Let the user override the test with a dos path. + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GLIB_CONFIG="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GLIB_CONFIG" && ac_cv_path_GLIB_CONFIG="no" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:2991: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi -GLIB_CONFIG="$ac_cv_path_GLIB_CONFIG" -if test -n "$GLIB_CONFIG"; then - echo "$ac_t""$GLIB_CONFIG" 1>&6 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:3003: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:3006: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - min_glib_version=1.2.0 - echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6 -echo "configure:1762: checking for GLIB - version >= $min_glib_version" >&5 no_glib="" - if test "$GLIB_CONFIG" = "no" ; then - no_glib=yes + + if test x$PKG_CONFIG != xno ; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_glib=yes + PKG_CONFIG=no + fi + fi + + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + min_glib_version=1.3.3 + echo "$as_me:3029: checking for GLIB - version >= $min_glib_version" >&5 +echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6 + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : else - GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags` - GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs` - glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \ + no_glib = yes + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \ + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \ + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_glibtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" @@ -1780,15 +3057,15 @@ echo "configure:1762: checking for GLIB - version >= $min_glib_version" >&5 if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 3061 "configure" #include "confdefs.h" #include #include #include -int +int main () { int major, minor, micro; @@ -1807,18 +3084,17 @@ main () (glib_minor_version != $glib_config_minor_version) || (glib_micro_version != $glib_config_micro_version)) { - printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, glib_major_version, glib_minor_version, glib_micro_version); - printf ("*** was found! If glib-config was correct, then it is best\n"); - printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n"); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); - printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n"); - printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n"); - printf("*** before re-running configure\n"); - } + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } else if ((glib_major_version != GLIB_MAJOR_VERSION) || (glib_minor_version != GLIB_MINOR_VERSION) || (glib_micro_version != GLIB_MICRO_VERSION)) @@ -1845,10 +3121,10 @@ main () printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the glib-config shell script is\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n"); - printf("*** correct copy of glib-config. (In this case, you will have to\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } @@ -1856,33 +3132,41 @@ main () return 1; } -EOF -if { (eval echo configure:1861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:3137: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3140: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:3142: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3145: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - no_glib=yes + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +no_glib=yes fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_glib" = x ; then - echo "$ac_t""yes" 1>&6 - : + echo "$as_me:3161: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 +echo "${ECHO_T}yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6 + : else - echo "$ac_t""no" 1>&6 - if test "$GLIB_CONFIG" = "no" ; then - echo "*** The glib-config script installed by GLIB could not be found" - echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the GLIB_CONFIG environment variable to the" - echo "*** full path to glib-config." + echo "$as_me:3165: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" else if test -f conf.glibtest ; then : @@ -1890,19 +3174,33 @@ fi echo "*** Could not run GLIB test program, checking why..." CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line 3178 "configure" #include "confdefs.h" #include #include -int main() { - return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); -; return 0; } -EOF -if { (eval echo configure:1905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +int +main () +{ + return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3193: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3196: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3199: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3202: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" @@ -1912,48 +3210,40 @@ if { (eval echo configure:1905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && t echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" - echo "***" - echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" - echo "*** came with the system with the command" - echo "***" - echo "*** rpm --erase --nodeps gtk gtk-devel" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "*** The test program failed to compile or link. See the file config.log for the" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GLIB was incorrectly installed" echo "*** or that you have moved GLIB since it was installed. In the latter case, you" - echo "*** may want to edit the glib-config script: $GLIB_CONFIG" + echo "*** may want to edit the pkg-config script: $PKG_CONFIG" fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GLIB_CFLAGS="" GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" : fi - - - rm -f conf.glibtest - - + rm -f conf.glibtest -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:1947: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "$as_me:3236: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no -fi - - echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - +fi; + echo "$as_me:3245: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= @@ -1963,404 +3253,877 @@ else MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE - - - - - - -trap '' 1 2 15 -cat > confcache <<\EOF +ac_config_files="$ac_config_files gob2.spec Makefile src/Makefile doc/Makefile examples/Makefile doc/gob2.1" +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - DEFS=-DHAVE_CONFIG_H -# Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL # Generated automatically by configure. # Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# # Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. +# configure, is in config.log if it exists. -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 do - case "\$ac_option" in + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:3513: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:3532: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + esac + shift done -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +exec 5>>config.log +cat >&5 << _ACEOF -trap 'rm -fr `echo " -gob.spec -Makefile -src/Makefile -doc/Makefile -examples/Makefile -doc/gob.1 config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@SET_MAKE@%$SET_MAKE%g -s%@SUBDIRS@%$SUBDIRS%g -s%@DOINSTGOB@%$DOINSTGOB%g -s%@NOINSTGOB@%$NOINSTGOB%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@YACC@%$YACC%g -s%@LEX@%$LEX%g -s%@LEXLIB@%$LEXLIB%g -s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g -s%@RM@%$RM%g -s%@MV@%$MV%g -s%@TAR@%$TAR%g -s%@GLIB_CONFIG@%$GLIB_CONFIG%g -s%@GLIB_CFLAGS@%$GLIB_CFLAGS%g -s%@GLIB_LIBS@%$GLIB_LIBS%g -s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g -s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g -s%@MAINT@%$MAINT%g +cat >>$CONFIG_STATUS <> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "gob2.spec" ) CONFIG_FILES="$CONFIG_FILES gob2.spec" ;; + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "doc/gob2.1" ) CONFIG_FILES="$CONFIG_FILES doc/gob2.1" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:3582: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@SUBDIRS@,$SUBDIRS,;t t +s,@DOINSTGOB@,$DOINSTGOB,;t t +s,@NOINSTGOB@,$NOINSTGOB,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@YACC@,$YACC,;t t +s,@LEX@,$LEX,;t t +s,@LEXLIB@,$LEXLIB,;t t +s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t +s,@RM@,$RM,;t t +s,@MV@,$MV,;t t +s,@TAR@,$TAR,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@GLIB_CFLAGS@,$GLIB_CFLAGS,;t t +s,@GLIB_LIBS@,$GLIB_LIBS,;t t +s,@GLIB_GENMARSHAL@,$GLIB_GENMARSHAL,;t t +s,@GOBJECT_QUERY@,$GOBJECT_QUERY,;t t +s,@GLIB_MKENUMS@,$GLIB_MKENUMS,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +CEOF + EOF -cat >> $CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" -CONFIG_FILES=\${CONFIG_FILES-"gob.spec -Makefile -src/Makefile -doc/Makefile -examples/Makefile -doc/gob.1"} EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` else ac_dir_suffix= ac_dots= fi - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; esac - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac + if test x"$ac_file" != x-; then + { echo "$as_me:3816: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:3834: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:3847: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF +cat >>$CONFIG_STATUS <<\EOF - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* +# +# CONFIG_HEADER section. +# # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' - -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - echo creating $ac_file - - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in + test x"$ac_file" != x- && { echo "$as_me:3908: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:3919: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:3932: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in EOF -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +cat >>conftest.undefs <<\EOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, EOF -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail -while : +while grep . conftest.undefs >/dev/null do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs done -rm -f conftest.vals - -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:4049: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file fi - rm -f $ac_file - mv conftest.h $ac_file + else + cat $tmp/config.h + rm -f $tmp/config.h fi -fi; done - +done EOF -cat >> $CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + case $ac_dest in + default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; + esac +done EOF -cat >> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h -exit 0 +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } EOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi diff --git a/configure.in b/configure.in index 91e1277..caebd1b 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.2) AC_INIT(src/treefuncs.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(gob,1.0.7) +AM_INIT_AUTOMAKE(gob2,1.99.1) dnl dnl An utter hack to allow embedding of gob inside other packages. @@ -11,12 +11,12 @@ dnl gob is not installed dnl if test -f ../NOINST_GOB ; then DOINSTGOB= - NOINSTGOB=gob + NOINSTGOB=gob2 AC_MSG_RESULT([*** NOT Going to install GOB ***]) SUBDIRS="src examples" AC_SUBST(SUBDIRS) else - DOINSTGOB=gob + DOINSTGOB=gob2 NOINSTGOB= SUBDIRS="src examples doc" AC_SUBST(SUBDIRS) @@ -34,7 +34,7 @@ AC_PROG_CPP AC_PATH_PROG(RM, rm, /bin/rm) AC_PATH_PROG(MV, mv, /bin/mv) AC_PATH_PROG(TAR, tar, /bin/tar) -AM_PATH_GLIB(1.2.0,,,) +AM_PATH_GLIB_2_0(1.3.3,,,) dnl We don't check popt since we're not using it at the moment, but dnl We just might use it later dnl AC_CHECK_LIB(popt,poptGetContext, [POPT_LIB="-lpopt"], @@ -51,9 +51,9 @@ AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) AC_OUTPUT([ -gob.spec +gob2.spec Makefile src/Makefile doc/Makefile examples/Makefile -doc/gob.1]) +doc/gob2.1]) diff --git a/doc/Makefile.am b/doc/Makefile.am index ffe8556..4654781 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,4 +1,7 @@ -man_MANS = gob.1 +man_MANS = gob2.1 SUBDIRS = -EXTRA_DIST = gob.1.in +EXTRA_DIST = gob2.1.in makehtml.pl + +html: + perl $(top_srcdir)/doc/makehtml.pl < $(top_srcdir)/doc/gob2.1 > $(top_builddir)/doc/gob2.1.html diff --git a/doc/Makefile.in b/doc/Makefile.in index ce6de43..e162ae1 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -63,8 +63,10 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ DOINSTGOB = @DOINSTGOB@ GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ MAINT = @MAINT@ @@ -72,23 +74,24 @@ MAKEINFO = @MAKEINFO@ MV = @MV@ NOINSTGOB = @NOINSTGOB@ PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ RM = @RM@ TAR = @TAR@ VERSION = @VERSION@ YACC = @YACC@ -man_MANS = gob.1 +man_MANS = gob2.1 SUBDIRS = -EXTRA_DIST = gob.1.in +EXTRA_DIST = gob2.1.in makehtml.pl mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = gob.1 +CONFIG_CLEAN_FILES = gob2.1 man1dir = $(mandir)/man1 MANS = $(man_MANS) NROFF = nroff -DIST_COMMON = Makefile.am Makefile.in gob.1.in +DIST_COMMON = Makefile.am Makefile.in gob2.1.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -103,7 +106,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -gob.1: $(top_builddir)/config.status gob.1.in +gob2.1: $(top_builddir)/config.status gob2.1.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status install-man1: @@ -242,7 +245,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ + cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ @@ -329,6 +332,9 @@ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean +html: + perl $(top_srcdir)/doc/makehtml.pl < $(top_srcdir)/doc/gob2.1 > $(top_builddir)/doc/gob2.1.html + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/doc/gob.1.in b/doc/gob2.1.in similarity index 92% rename from doc/gob.1.in rename to doc/gob2.1.in index 81aa107..adf08b0 100644 --- a/doc/gob.1.in +++ b/doc/gob2.1.in @@ -1,22 +1,29 @@ .\" .\" gob manual page -.\" (C) 1999 George Lebl +.\" (C) 1999,2000,2001 George Lebl .\" .\" This manual page is covered by the terms of the GNU General .\" Public License. .\" -.TH GOB 1 "GOB @VERSION@" +.TH GOB2 1 "GOB2 @VERSION@" .SH NAME -GOB \- The GTK+ Object Builder +GOB2 \- The GObject Builder .SH SYNOPSIS .PP .B gob [ option ] ... file +.SH OUT OF DATE +.PP +This manual is out of date. I will be updating it when I can but it +mostly covers the GOB 1.0.x versions and not GOB2 yet. There ARE wrong +things in this manual for now. Keep that in mind. However most things +still apply. Just not all. + .SH DESCRIPTION .PP -GTK+ Object Builder is a simple preprocessor for easily creating -GTK+ objects. It does not parse any C code and ignores any C errors. It +GObject Builder is a simple preprocessor for easily creating +GObject objects. It does not parse any C code and ignores any C errors. It is in spirit similar to things like lex or yacc. .SH OPTIONS @@ -26,7 +33,7 @@ is in spirit similar to things like lex or yacc. Display a simple help screen. .TP .B --version -Display version information (note, --version was not added until 0.92.0) +Display version information .TP .B -w --exit-on-warn Exit with an error code even when you encounter a warning. @@ -391,7 +398,7 @@ And for getting, you would use: .nf int height; - gtk_object_set (GTK_OBJECT (object), + gtk_object_get (GTK_OBJECT (object), MY_OBJECT_GET_ARG_HEIGHT (&height), NULL); @@ -466,11 +473,11 @@ is just like get { ARG = self->foo; } set { - if(self->foo) + if(ARG != NULL) + gtk_object_ref(ARG); + if(self->foo != NULL) gtk_object_unref(self->foo); self->foo = ARG; - if(self->foo) - gtk_object_ref(self->foo); } .fi @@ -481,6 +488,19 @@ For objectlink, just a pointer is returned on get, if you wish to keep it around you should call gtk_object_ref on it. For stringlink, get makes a copy of the string which you should free after use. This is the behaviour since 1.0.2. .PP +You can also automatically export get and set methods for each of the arguments +by appending '(export)' flag before the get and set statements. For example: +.nf + + public int foo; + argument INT (type int) foo (export) + get { ARG = self->foo; } + set { self->foo = ARG; }; + +.fi +Will export public methods get_foo(self) and set_foo(self, int foo) for you +automatically. Note that this behaviour is new in 1.0.10. +.PP Methods: .PP There is a whole array of possible methods. The three normal, @@ -696,55 +716,26 @@ you can use. It will return whatever the parent handler returned, or the Method names: .PP Inside the code, aliases are set for the methods, so that you don't -have to type the class name before each call, just the name of the method. +have to type the class name before each call, just type \fBself_\fR instead +of the name of the class. So to call a method called \fBblah\fR, you +would use the name \fBself_blah\fR. Example: .nf private int - foo(self) + foo (self) { return self->len; } private int - bar(self,int i) + bar (self,int i) { - return foo(self) + i; + return self_foo (self) + i; } .fi .PP -Underscore removal (0.93.5+): -.PP -Sometimes this causes conflicts with other libraries. For example a library -might have already used the identifier foo. You can prepend an underscore to -the name in the .gob file. This will make the local short alias have an -initial underscore, but it will not change the name of the actual name of the -function. For example: -.nf - class My:Object from Gtk:Object { - public void - _foo(self) { - /* foo body */ - } - public void - bar(self) { - /* short calling convention */ - _foo(self); - /* long calling convention */ - my_object_foo(self); - } - } -.fi -Thus you see that the "_foo" method still generates the method "my_object_foo" -just as "foo" would generate. You can turn off this behavior if you depend -on the old (pre 0.93.5) behavior with the --no-kill-underscores option. This -also means that if both "_foo" and "foo" are defined, it is treated as a -conflict. -.PP -This does not apply to override methods. Override methods are special beasts -and this is not necessary and would make the code behave in weird ways. -.PP Making new objects: .PP You should define a new method which should be a normal public method. Inside @@ -828,7 +819,8 @@ compile with a C++ compiler. .PP The get_type is not really a method, but a function which initializes your object. Recently objects appeared which require you to make a custom -get_type function (BonoboXObject currently). So in 1.0.7 it is now possible +get_type function (BonoboXObject currently, see next section for direct +BonoboXObject support). So in 1.0.7 it is now possible to override this function. To do so, just define a new public method called get_type, with no arguments. Example: .nf @@ -842,6 +834,45 @@ get_type, with no arguments. Example: .fi +.SH DIRECT BonoboXObject SUPPORT +.PP +If you want to build a BonoboXObject class gob has direct support for these +classes since 1.0.9. Just create a new object that derives from +Bonobo:X:Object. Then use a "BonoboX" class flag with the interface name as an +argument. The interface name should be as you would type it in C, that is with +underscores as namespace separators. Then you add the methods (using exact +same names as in the idl file) and prepend those methods with a BonoboX +keyword. For example imagine you have an interface GNOME/Foo/SomeInterface, +with a method fooBar that takes a single string: +.nf + + class Foo:Some:Interface from Bonobo:X:Object + (BonoboX GNOME_Foo_SomeInterface) { + + BonoboX + private void + fooBar (PortableServer_Servant servant, + const CORBA_char *string, + CORBA_Environment *ev) + { + Self *self = SELF (bonobo_object_from_servant (servant)); + + /* your code here */ + } + + /* rest of class */ + } + +.fi +Note that the implementation method can be private, in fact that's probably +a good idea to do. It won't work to make this a signal, it can however +be a virtual. Note that the method prototype must match the one from the +interface header file, or you will get a bad assignment warning. You should +check the header file generated by orbit-idl and see the epv structure +for the correct prototypes if you can't figure them out from the idl itself. +Also note that the first argument is not "self", but the servant and you must +use bonobo_object_from_servant function to get the actual object pointer. + .SH IDENTIFIER CONFLICTS .PP Gob will need to define some local variables and functions in the generated @@ -866,7 +897,7 @@ the same as defining it as "name" except that the local alias will be "_name" rather then "name". .PP There are a couple of defines which you shouldn't be redefining in the code -or other headers. These are SELF, IS_SELF, SELF_CLASS, ARG, VAR, +or other headers. These are SELF, IS_SELF, SELF_CLASS, SELF_TYPE, ARG, VAR, PARENT_HANDLER, GET_NEW, GOB_VERSION_MAJOR, GOB_VERSION_MINOR and GOB_VERSION_PATCHLEVEL. .PP @@ -1028,8 +1059,7 @@ that's about as far as I can really take it and even that is problematic. Basically, if you use gob, just don't use the C preprocessor too extensively. .PP Comments will not get through to the generated files unless inside C code. -This makes using something like gtk-doc harder. However I'm planning to -fix this somehow. +This is not the case for gtk-doc style comments which are supported. .PP The short name aliases are actually implemented as pointers to functions. Thus if you want to get the pointer of a function using the short name alias you diff --git a/doc/makehtml.pl b/doc/makehtml.pl new file mode 100755 index 0000000..8b14c5d --- /dev/null +++ b/doc/makehtml.pl @@ -0,0 +1,82 @@ +#!/usr/bin/perl +$printbr = 1; +$printtable = 0; +while (<>) { + s/&/&/g; + s/\/>/g; + if ($printtable == 1) { + $printtable = 2; + } elsif ($printtable == 2) { + $printtable = 3; + print ""; + } + + #hack, we're inside .nf so highlight comments and + # other such stuff + if ($printbr == 0) { + s/\/\*/\/\*/g; + s/\*\//\*\/<\/FONT>/g; + } + + if (/^\.\\"/) { + # comment ignore + } elsif (/^\.TH .*\"([^"]*)\"/) { + # must be at the front + print "$1 Manual page\n"; + print "\n"; + print "

$1 Manual page

\n"; + } elsif (/^\.SH (.*)$/) { + if ($printtable == 3) { + $printtable = 0; + print "\n"; + } + print "

$1

\n"; + } elsif (/^\.PP/) { + if ($printtable == 3) { + $printtable = 0; + print "\n"; + } + print "

\n"; + } elsif (/^\.B (.*)$/) { + print "$1\n"; + } elsif (/^\.I (.*)$/) { + print "$1\n"; + } elsif (/^\.nf/) { + if ($printtable == 3) { + $printtable = 0; + print "\n"; + } + print "
\n";
+		$printbr = 0;
+	} elsif (/^\.fi/) {
+		print "
\n"; + print "
\n"; + $printbr = 1; + } elsif (/^[ ]*$/) { + if ($printtable == 3) { + $printtable = 0; + print "\n"; + } + if ($printbr) { + print "
\n"; + } else { + print "\n"; + } + } elsif (/^\.TP/) { + if ($printtable == 3) { + $printtable = 1; + print "\n"; + } else { + $printtable = 1; + print "\n
"; + } + } else { + s/\\fB([^\\]*)\\fR/\1<\/B>/gm; + s/\\fI([^\\]*)\\fR/\1<\/I>/gm; + s/\\(.)/\1>/g; + print; + } +} + +print "\n"; diff --git a/examples/GNOME_Foo_SomeInterface.idl b/examples/GNOME_Foo_SomeInterface.idl new file mode 100644 index 0000000..c6a3d0d --- /dev/null +++ b/examples/GNOME_Foo_SomeInterface.idl @@ -0,0 +1,26 @@ +#include + +/* An example interface + * + * Do note that the GNOME namespace is not just a freeforall, + * so this file should not be installed as Foo is not a registered + * name. To see the current namespece setup see doc/NAMESPACE + * in the bonobo cvs module or from a recent bonobo tarball. + * To register a new name under the GNOME namespace just drop + * a mail to: + * Michael Meeks or George Lebl + * and we'll get you all set. (This is just to avoid conflicts in + * the namespace, and no it doesn't cost anything) + */ + +module GNOME { + +module Foo { + +interface SomeInterface { + void fooBar (in string foo); +}; + +}; + +}; diff --git a/examples/Makefile.am b/examples/Makefile.am index 9197fa7..b92c413 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -2,6 +2,8 @@ EXTRA_DIST = \ README \ gtk-button-count.gob \ my-person.gob \ - my-person2.gob + my-person2.gob \ + GNOME_Foo_SomeInterface.idl \ + foo-some-interface.gob SUBDIRS = diff --git a/examples/Makefile.in b/examples/Makefile.in index 3695c56..43b648c 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -63,8 +63,10 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ DOINSTGOB = @DOINSTGOB@ GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ MAINT = @MAINT@ @@ -72,12 +74,13 @@ MAKEINFO = @MAKEINFO@ MV = @MV@ NOINSTGOB = @NOINSTGOB@ PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ RM = @RM@ TAR = @TAR@ VERSION = @VERSION@ YACC = @YACC@ -EXTRA_DIST = README gtk-button-count.gob my-person.gob my-person2.gob +EXTRA_DIST = README gtk-button-count.gob my-person.gob my-person2.gob GNOME_Foo_SomeInterface.idl foo-some-interface.gob SUBDIRS = @@ -197,7 +200,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ + cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/examples/README b/examples/README index 1eebe55..dba804d 100644 --- a/examples/README +++ b/examples/README @@ -15,3 +15,8 @@ my-person.gob A simple file which can store some identity my-person2.gob The same as above but using automatic initialization, destruction and argument linking features of 0.93.0+ + +GNOME_Foo_SomeInterface.idl +foo-some-interface.gob Example idl and gob file for a BonoboXClass + implementation. It can be this easy to write + Bonobo classes. diff --git a/examples/foo-some-interface.gob b/examples/foo-some-interface.gob new file mode 100644 index 0000000..15aa928 --- /dev/null +++ b/examples/foo-some-interface.gob @@ -0,0 +1,36 @@ +/* + * Example BonoboXObject class + * + * see GNOME_Foo_SomeInterface.idl + */ +requires 1.0.9 + +%{ +/* some standard includes */ +#include +#include + +/* this requires you to use orbit-idl on GNOME_Foo_SomeInterface.idl first */ +#include "GNOME_Foo_SomeInterface.h" + +#include "foo-some-interface.h" +#include "foo-some-interface-private.h" +%} + +class Foo:Some:Interface from Bonobo:X:Object + (BonoboX GNOME_Foo_SomeInterface) +{ + + BonoboX + private void + fooBar (PortableServer_Servant servant, + const CORBA_char *string, + CORBA_Environment *ev) + { + Self *self = SELF (bonobo_object_from_servant (servant)); + + /* your code here */ + } + + /* rest of class */ +} diff --git a/examples/my-person.gob b/examples/my-person.gob index cad0672..d895a62 100644 --- a/examples/my-person.gob +++ b/examples/my-person.gob @@ -16,14 +16,14 @@ class My:Person from Gtk:Object { public long dod; /* date of death as a time_t */ private int rounds_in_shotgun; /* number of rounds in our shotgun */ - + argument POINTER (type char *) name get { - /* note that strdup handles NULL correctly */ + /* note that g_strdup handles NULL correctly */ ARG = g_strdup(self->name); } set { - /* note that strdup handles NULL correctly */ + /* note that g_free and g_strdup handles NULL correctly */ g_free(self->name); self->name = g_strdup(ARG); }; diff --git a/gob.m4 b/gob2.m4 similarity index 84% rename from gob.m4 rename to gob2.m4 index 6250073..70a78bb 100644 --- a/gob.m4 +++ b/gob2.m4 @@ -4,11 +4,11 @@ dnl if fail = "failure", abort if GOB not found dnl -AC_DEFUN(GOB_HOOK,[ - AC_PATH_PROG(GOB,gob) - if test ! x$GOB = x; then +AC_DEFUN(GOB2_HOOK,[ + AC_PATH_PROG(GOB2,gob2) + if test ! x$GOB2 = x; then if test ! x$1 = x; then - AC_MSG_CHECKING(for gob >= $1) + AC_MSG_CHECKING(for gob-2 >= $1) g_r_ve=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` g_r_ma=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` g_r_mi=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` @@ -46,13 +46,13 @@ AC_DEFUN(GOB_HOOK,[ unset g_r_ma unset g_r_mi fi - AC_SUBST(GOB) + AC_SUBST(GOB2) $2 else $3 fi ]) -AC_DEFUN([GOB_CHECK],[ - GOB_HOOK($1,[],[AC_MSG_WARN([Cannot find GOB, check http://www.5z.com/jirka/gob.html])]) +AC_DEFUN([GOB2_CHECK],[ + GOB2_HOOK($1,[],[AC_MSG_WARN([Cannot find GOB-2, check http://www.5z.com/jirka/gob.html])]) ]) diff --git a/gob.spec b/gob2.spec similarity index 63% rename from gob.spec rename to gob2.spec index 06064db..592628b 100644 --- a/gob.spec +++ b/gob2.spec @@ -1,24 +1,27 @@ -%define ver 1.0.7 -%define rel 1 +%define ver 1.99.1 +%define rel SNAP %define prefix /usr -Summary: GOB, The GTK+ Object Builder -Name: gob +Summary: GOB2, The GObject Builder +Name: gob2 Version: %ver Release: %rel Copyright: GPL Group: Development/Tools -Source: gob-%{ver}.tar.gz +Source: gob2-%{ver}.tar.gz Url: http://www.5z.com/jirka/linux.html#gob -BuildRoot: /var/tmp/gob-%{ver}-root +BuildRoot: /var/tmp/gob2-%{ver}-root Prefix: %prefix %description -GOB is a simple preprocessor for making GTK+ objects. It makes objects -from a single file which has inline C code so that you don't have to edit -the generated files. Syntax is somewhat inspired by java and yacc. +GOB is a simple preprocessor for making GObject objects (glib objects). +It makes objects from a single file which has inline C code so that +you don't have to edit the generated files. Syntax is somewhat inspired +by java and yacc. It supports generating C++ code %changelog +* Fri Sep 28 2001 George Lebl +- Updated for gob2 * Tue Feb 7 2000 George Lebl - added %{prefix}/share/aclocal/* to %files * Tue Dec 14 1999 George Lebl diff --git a/gob.spec.in b/gob2.spec.in similarity index 66% rename from gob.spec.in rename to gob2.spec.in index c4ed4e7..c90c857 100644 --- a/gob.spec.in +++ b/gob2.spec.in @@ -2,23 +2,26 @@ %define rel SNAP %define prefix /usr -Summary: GOB, The GTK+ Object Builder -Name: gob +Summary: GOB2, The GObject Builder +Name: gob2 Version: %ver Release: %rel Copyright: GPL Group: Development/Tools -Source: gob-%{ver}.tar.gz +Source: gob2-%{ver}.tar.gz Url: http://www.5z.com/jirka/linux.html#gob -BuildRoot: /var/tmp/gob-%{ver}-root +BuildRoot: /var/tmp/gob2-%{ver}-root Prefix: %prefix %description -GOB is a simple preprocessor for making GTK+ objects. It makes objects -from a single file which has inline C code so that you don't have to edit -the generated files. Syntax is somewhat inspired by java and yacc. +GOB is a simple preprocessor for making GObject objects (glib objects). +It makes objects from a single file which has inline C code so that +you don't have to edit the generated files. Syntax is somewhat inspired +by java and yacc. It supports generating C++ code %changelog +* Fri Sep 28 2001 George Lebl +- Updated for gob2 * Tue Feb 7 2000 George Lebl - added %{prefix}/share/aclocal/* to %files * Tue Dec 14 1999 George Lebl diff --git a/src/Makefile.am b/src/Makefile.am index ffe9113..769bfc8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,11 +8,11 @@ INCLUDES = @GLIB_CFLAGS@ -I$(includedir) bin_PROGRAMS = @DOINSTGOB@ noinst_PROGRAMS = @NOINSTGOB@ -EXTRA_PROGRAMS = gob +EXTRA_PROGRAMS = gob2 BUILT_SOURCES = parse.h parse.c lexer.c -gob_SOURCES = \ +gob2_SOURCES = \ main.c \ main.h \ treefuncs.c \ @@ -26,7 +26,7 @@ gob_SOURCES = \ parse.y \ lexer.l -gob_LDADD = \ +gob2_LDADD = \ -lm \ $(GLIB_LIBS) \ @LEXLIB@ @@ -34,25 +34,25 @@ gob_LDADD = \ # we might want popt back in the future # @POPT_LIB@ -CLEANFILES += $(BUILT_SOURCES) gtk-weird-button.* gtk-weird-button-private.h +CLEANFILES += $(BUILT_SOURCES) test-object.* test-object-private.h -EXTRA_DIST = test.gob generate_treefuncs.pl treefuncs.def +EXTRA_DIST = $(BUILT_SOURCES) test.gob generate_treefuncs.pl treefuncs.def parse.h parse.c: parse.y $(YACC) $(YFLAGS) $< test -f y.tab.c && mv -f y.tab.c parse.c test -f y.tab.h && mv -f y.tab.h parse.h -test: gtk-weird-button.c gtk-weird-button.h - $(CC) -g -Wall `gtk-config --cflags` -c gtk-weird-button.c +test: test-object.c test-object.h + $(CC) -g -Wall `pkg-config --cflags gobject-2.0` -c test-object.c -gtk-weird-button.c gtk-weird-button.h: test.gob gob - ./gob test.gob +test-object.c test-object.h: test.gob gob2 + ./gob2 test.gob # can't depend on the header file as that would break the above rule # since it's just for testing, who cares -testcpp: gtk-weird-button.cc - g++ -g -Wall `gtk-config --cflags` -c gtk-weird-button.cc +testcpp: test-object.cc + g++ -g -Wall `pkg-config --cflags gobject-2.0` -c test-object.cc -gtk-weird-button.cc: test.gob gob - ./gob --for-cpp test.gob +test-object.cc: test.gob gob2 + ./gob2 --for-cpp test.gob diff --git a/src/Makefile.in b/src/Makefile.in index d4e16e4..fc33b67 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -64,8 +64,10 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ DOINSTGOB = @DOINSTGOB@ GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ MAINT = @MAINT@ @@ -73,6 +75,7 @@ MAKEINFO = @MAKEINFO@ MV = @MV@ NOINSTGOB = @NOINSTGOB@ PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ RM = @RM@ TAR = @TAR@ VERSION = @VERSION@ @@ -87,22 +90,22 @@ INCLUDES = @GLIB_CFLAGS@ -I$(includedir) bin_PROGRAMS = @DOINSTGOB@ noinst_PROGRAMS = @NOINSTGOB@ -EXTRA_PROGRAMS = gob +EXTRA_PROGRAMS = gob2 BUILT_SOURCES = parse.h parse.c lexer.c -gob_SOURCES = main.c main.h treefuncs.c treefuncs.h out.c out.h util.c util.h checks.c checks.h parse.y lexer.l +gob2_SOURCES = main.c main.h treefuncs.c treefuncs.h out.c out.h util.c util.h checks.c checks.h parse.y lexer.l -gob_LDADD = -lm $(GLIB_LIBS) @LEXLIB@ +gob2_LDADD = -lm $(GLIB_LIBS) @LEXLIB@ # we might want popt back in the future # @POPT_LIB@ -CLEANFILES = $(BUILT_SOURCES) gtk-weird-button.* gtk-weird-button-private.h +CLEANFILES = $(BUILT_SOURCES) test-object.* test-object-private.h -EXTRA_DIST = test.gob generate_treefuncs.pl treefuncs.def +EXTRA_DIST = $(BUILT_SOURCES) test.gob generate_treefuncs.pl treefuncs.def mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = @@ -111,9 +114,9 @@ PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ -gob_OBJECTS = main.o treefuncs.o out.o util.o checks.o parse.o lexer.o -gob_DEPENDENCIES = -gob_LDFLAGS = +gob2_OBJECTS = main.o treefuncs.o out.o util.o checks.o parse.o lexer.o +gob2_DEPENDENCIES = +gob2_LDFLAGS = LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LEXLIB = @LEXLIB@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -125,8 +128,8 @@ DIST_COMMON = Makefile.am Makefile.in lexer.c parse.c DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) GZIP_ENV = --best -SOURCES = $(gob_SOURCES) -OBJECTS = $(gob_OBJECTS) +SOURCES = $(gob2_SOURCES) +OBJECTS = $(gob2_OBJECTS) all: all-redirect .SUFFIXES: @@ -192,9 +195,9 @@ distclean-compile: maintainer-clean-compile: -gob: $(gob_OBJECTS) $(gob_DEPENDENCIES) - @rm -f gob - $(LINK) $(gob_LDFLAGS) $(gob_OBJECTS) $(gob_LDADD) $(LIBS) +gob2: $(gob2_OBJECTS) $(gob2_DEPENDENCIES) + @rm -f gob2 + $(LINK) $(gob2_LDFLAGS) $(gob2_OBJECTS) $(gob2_LDADD) $(LIBS) .l.c: $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ .y.c: @@ -302,7 +305,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ + cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ @@ -319,14 +322,6 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -checks.o: checks.c ../config.h treefuncs.h main.h util.h checks.h -lexer.o: lexer.c ../config.h treefuncs.h parse.h main.h util.h -main.o: main.c ../config.h treefuncs.h parse.h out.h util.h checks.h \ - main.h -out.o: out.c main.h out.h -parse.o: parse.c ../config.h treefuncs.h main.h util.h -treefuncs.o: treefuncs.c treefuncs.h -util.o: util.c ../config.h treefuncs.h main.h util.h info-am: info: info-recursive @@ -417,19 +412,19 @@ parse.h parse.c: parse.y test -f y.tab.c && mv -f y.tab.c parse.c test -f y.tab.h && mv -f y.tab.h parse.h -test: gtk-weird-button.c gtk-weird-button.h - $(CC) -g -Wall `gtk-config --cflags` -c gtk-weird-button.c +test: test-object.c test-object.h + $(CC) -g -Wall `pkg-config --cflags gobject-2.0` -c test-object.c -gtk-weird-button.c gtk-weird-button.h: test.gob gob - ./gob test.gob +test-object.c test-object.h: test.gob gob2 + ./gob2 test.gob # can't depend on the header file as that would break the above rule # since it's just for testing, who cares -testcpp: gtk-weird-button.cc - g++ -g -Wall `gtk-config --cflags` -c gtk-weird-button.cc +testcpp: test-object.cc + g++ -g -Wall `pkg-config --cflags gobject-2.0` -c test-object.cc -gtk-weird-button.cc: test.gob gob - ./gob --for-cpp test.gob +test-object.cc: test.gob gob2 + ./gob2 --for-cpp test.gob # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/checks.c b/src/checks.c index 062d635..b30d0f8 100644 --- a/src/checks.c +++ b/src/checks.c @@ -1,6 +1,7 @@ /* GOB C Preprocessor * Copyright (C) 1999-2000 the Free Software Foundation. * Copyright (C) 2000 Eazel, Inc. + * Copyright (C) 2001 George Lebl * * Author: George Lebl * @@ -32,15 +33,13 @@ #include "checks.h" static void -check_duplicate(Class *c, Node *node, const char *id, int line_no, - gboolean underscore) +check_duplicate (Class *c, Node *node, const char *id, int line_no) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; const char *nid; int nline_no; - gboolean here_underscore = FALSE; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -48,11 +47,8 @@ check_duplicate(Class *c, Node *node, const char *id, int line_no, if(m->method == OVERRIDE_METHOD) continue; - nid = get_real_id(m->id); + nid = m->id; nline_no = m->line_no; - - if(m->id[0] == '_' && m->id[1] != '\0') - here_underscore = TRUE; } else if(n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; nid = v->id; @@ -64,52 +60,40 @@ check_duplicate(Class *c, Node *node, const char *id, int line_no, n->type != node->type || strcmp(nid, id) != 0) continue; - /* this can only happen if the things were methods and - * one had an underscore and the other one didn't */ - if( ! no_kill_underscores && underscore != here_underscore) - error_printf(GOB_ERROR, nline_no, - "symbol '%s' ('_%s') redefined, " - "first defined on line %d. " - "Note that '%s' and '_%s' are " - "eqivalent.", - id, id, line_no, id, id); - else - error_printf(GOB_ERROR, nline_no, - "symbol '%s' redefined, " - "first defined on line %d", - id, line_no); + + error_printf (GOB_ERROR, nline_no, + "symbol '%s' redefined, " + "first defined on line %d", + id, line_no); } } void -check_duplicate_symbols(Class *c) +check_duplicate_symbols (Class *c) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; - if(n->type == METHOD_NODE) { + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + + if (n->type == METHOD_NODE) { Method *m = (Method *)n; - gboolean underscore = FALSE; /* override methods are checked separately */ - if(m->method == OVERRIDE_METHOD) - continue; - if(m->id[0] == '_' && m->id[1] != '\0') - underscore = TRUE; - check_duplicate(c, n, get_real_id(m->id), m->line_no, - underscore); - } else if(n->type == VARIABLE_NODE) { + if (m->method != OVERRIDE_METHOD) { + check_duplicate (c, n, m->id, m->line_no); + } + } else if (n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; - check_duplicate(c, n, v->id, v->line_no, FALSE); + check_duplicate (c, n, v->id, v->line_no); } } } static void -check_duplicate_override(Class *c, Method *method) +check_duplicate_override (Class *c, Method *method) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; Method *m = (Method *)n; if(n->type != METHOD_NODE || m->method != OVERRIDE_METHOD) @@ -117,22 +101,22 @@ check_duplicate_override(Class *c, Method *method) if(method == m || method->line_no > m->line_no || - strcmp(get_real_id(m->id), get_real_id(method->id)) != 0 || + strcmp(m->id, method->id) != 0 || strcmp(m->otype, method->otype) != 0) continue; error_printf(GOB_ERROR, m->line_no, "override '%s(%s)' redefined, " "first defined on line %d", - get_real_id(m->id), m->otype, method->line_no); + m->id, m->otype, method->line_no); } } void check_duplicate_overrides(Class *c) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; Method *m = (Method *)n; if(n->type != METHOD_NODE || m->method != OVERRIDE_METHOD) @@ -144,15 +128,16 @@ check_duplicate_overrides(Class *c) void check_bad_symbols(Class *c) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; if((m->method == SIGNAL_LAST_METHOD || m->method == SIGNAL_FIRST_METHOD || m->method == VIRTUAL_METHOD) && - (strcmp(m->id, "__parent__")==0 || + (strcmp(m->id, "_epv")==0 || + strcmp(m->id, "__parent__")==0 || strcmp(m->id, "___parent__")==0)) { error_printf(GOB_ERROR, m->line_no, "'%s' not allowed as an " @@ -162,8 +147,8 @@ check_bad_symbols(Class *c) } if(m->method != INIT_METHOD && m->method != CLASS_INIT_METHOD && - (strcmp(get_real_id(m->id), "init")==0 || - strcmp(get_real_id(m->id), "class_init")==0)) { + (strcmp(m->id, "init")==0 || + strcmp(m->id, "class_init")==0)) { error_print(GOB_ERROR, m->line_no, "init, or class_init not " "allowed as an " @@ -183,54 +168,63 @@ check_bad_symbols(Class *c) } static void -check_duplicate_named(Class *c, Node *node, const char *id, int line_no) +check_duplicate_named (Class *c, Node *node, const char *id, int line_no) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; const char *nid; int nline_no; - if(n->type == METHOD_NODE) { + if (n->type == METHOD_NODE) { Method *m = (Method *)n; - if(m->method == SIGNAL_LAST_METHOD || - m->method == SIGNAL_FIRST_METHOD) { - nid = get_real_id(m->id); + if (m->method == SIGNAL_LAST_METHOD || + m->method == SIGNAL_FIRST_METHOD) { + nid = m->id; nline_no = m->line_no; - } else + } else { continue; - } else if(n->type == ARGUMENT_NODE) { + } + } else if (n->type == ARGUMENT_NODE) { Argument *a = (Argument *)n; nid = a->name; nline_no = a->line_no; - } else + } else if (n->type == PROPERTY_NODE) { + Property *p = (Property *)n; + nid = p->name; + nline_no = p->line_no; + } else { continue; - if(n == node || - line_no >= nline_no || - g_strcasecmp(nid, id)!=0) + } + if (n == node || + line_no >= nline_no || + g_strcasecmp (nid, id) != 0) continue; - error_printf(GOB_ERROR, nline_no, - "named symbol (argument or signal) '%s' " - "redefined, first defined on line %d " - "(case insensitive)", - id, line_no); + error_printf (GOB_ERROR, nline_no, + "named symbol (argument or signal) '%s' " + "redefined, first defined on line %d " + "(case insensitive)", + id, line_no); } } void -check_duplicate_signals_args(Class *c) +check_duplicate_signals_args (Class *c) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; - if(n->type == METHOD_NODE) { + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + if (n->type == METHOD_NODE) { Method *m = (Method *)n; if(m->method == SIGNAL_LAST_METHOD || m->method == SIGNAL_FIRST_METHOD) - check_duplicate_named(c, n, get_real_id(m->id), - m->line_no); - } else if(n->type == ARGUMENT_NODE) { + check_duplicate_named (c, n, m->id, + m->line_no); + } else if (n->type == PROPERTY_NODE) { + Property *p = (Property *)n; + check_duplicate_named (c, n, p->name, p->line_no); + } else if (n->type == ARGUMENT_NODE) { Argument *a = (Argument *)n; - check_duplicate_named(c, n, a->name, a->line_no); + check_duplicate_named (c, n, a->name, a->line_no); } } } @@ -238,12 +232,12 @@ check_duplicate_signals_args(Class *c) void check_public_new(Class *c) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; - if((strcmp(get_real_id(m->id), "new")==0) && + if((strcmp(m->id, "new")==0) && (m->method != REGULAR_METHOD || m->scope != PUBLIC_SCOPE)) error_print(GOB_WARN, m->line_no, @@ -256,9 +250,9 @@ check_public_new(Class *c) void check_vararg(Class *c) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; if( ! m->vararg) @@ -279,9 +273,9 @@ check_vararg(Class *c) void check_firstarg(Class *c) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; if(m->args) @@ -302,7 +296,7 @@ void check_nonvoidempty(Class *c) { GList *li; - for(li = c->nodes; li != NULL; li = g_list_next(li)) { + for(li = c->nodes; li != NULL; li = li->next) { Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -327,10 +321,10 @@ check_nonvoidempty(Class *c) } void -check_signal_args(Class *c) +check_signal_args (Class *c) { GList *li; - for(li = c->nodes; li != NULL; li = g_list_next(li)) { + for (li = c->nodes; li != NULL; li = li->next) { Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -339,39 +333,54 @@ check_signal_args(Class *c) m->method != SIGNAL_FIRST_METHOD) continue; - for(l=m->gtktypes;l;l=l->next) { - if(get_cast(l->data, FALSE)) + for (l = m->gtktypes; l != NULL; l = l->next) { + if (get_cast (l->data, FALSE)) continue; - error_printf(GOB_ERROR, m->line_no, - "Unknown GTK+ type '%s' " - "among signal types", - (char *)l->data); + error_printf (GOB_ERROR, m->line_no, + "Unknown GTK+ type '%s' " + "among signal types", + (char *)l->data); } } } } void -check_argument_types(Class *c) +check_argument_types (Class *c) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == ARGUMENT_NODE) { Argument *a = (Argument *)n; if(get_cast(a->gtktype, FALSE)) continue; - /* this could perhaps be a warning, but - can there really be a type beyond the - fundementals? */ error_printf(GOB_ERROR, a->line_no, - "Unknown GTK+ type '%s' " + "Unknown GLib type '%s' " "as argument type", a->gtktype); } } } +void +check_property_types (Class *c) +{ + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + if (n->type == PROPERTY_NODE) { + Property *p = (Property *)n; + if (get_cast (p->gtktype, FALSE)) + continue; + error_printf (GOB_ERROR, p->line_no, + "Unknown GLib type '%s' " + "as property type", + p->gtktype); + } + } +} + static void check_func_arg_check_func_arg(Method *m, FuncArg *fa) { @@ -388,7 +397,7 @@ check_func_arg_check_func_arg(Method *m, FuncArg *fa) return; } - for(li = fa->checks; li; li = g_list_next(li)) { + for(li = fa->checks; li; li = li->next) { Check *ch = li->data; if(ch->chtype == TYPE_CHECK) { char *p; @@ -437,7 +446,7 @@ static void check_func_arg_check_method(Method *m) { GList *li; - for(li = m->args; li; li = g_list_next(li)) { + for(li = m->args; li; li = li->next) { FuncArg *fa = li->data; check_func_arg_check_func_arg(m, fa); } @@ -447,7 +456,7 @@ void check_func_arg_checks(Class *c) { GList *li; - for(li = c->nodes; li != NULL; li = g_list_next(li)) { + for(li = c->nodes; li != NULL; li = li->next) { Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -460,9 +469,9 @@ int count_signals(Class *c) { int num = 0; - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; if(m->method == SIGNAL_LAST_METHOD || @@ -473,12 +482,43 @@ count_signals(Class *c) return num; } +int +count_set_properties (Class *c) +{ + int num = 0; + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + Property *p = li->data; + if (n->type == PROPERTY_NODE && + p->set != NULL) + num ++; + } + return num; +} + +int +count_get_properties (Class *c) +{ + int num = 0; + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + Property *p = li->data; + if (n->type == PROPERTY_NODE && + p->get != NULL) + num ++; + } + return num; +} + + int count_set_arguments(Class *c) { int num = 0; GList *li; - for(li = c->nodes; li != NULL; li = g_list_next(li)) { + for(li = c->nodes; li != NULL; li = li->next) { Node *n = li->data; Argument *a = li->data; if(n->type == ARGUMENT_NODE && @@ -493,7 +533,7 @@ count_get_arguments(Class *c) { int num = 0; GList *li; - for(li = c->nodes; li != NULL; li = g_list_next(li)) { + for(li = c->nodes; li != NULL; li = li->next) { Node *n = li->data; Argument *a = li->data; if(n->type == ARGUMENT_NODE && @@ -507,9 +547,9 @@ int count_overrides(Class *c) { int num = 0; - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; if(m->method == OVERRIDE_METHOD) @@ -523,9 +563,9 @@ int count_privates(Class *c) { int num = 0; - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; if(v->scope == PRIVATE_SCOPE) @@ -536,12 +576,12 @@ count_privates(Class *c) } int -count_protecteds(Class *c) +count_protecteds (Class *c) { int num = 0; - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; if(m->scope == PROTECTED_SCOPE) @@ -552,15 +592,16 @@ count_protecteds(Class *c) } int -count_destructors(Class *c) +count_unreftors (Class *c) { int num = 0; - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; - if(n->type == VARIABLE_NODE) { + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + if (n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; - if(v->destructor) + if (v->destructor != NULL && + v->destructor_unref) num++; } } @@ -568,15 +609,32 @@ count_destructors(Class *c) } int -count_initializers(Class *c) +count_destructors (Class *c) { int num = 0; - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; - if(n->type == VARIABLE_NODE) { + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + if (n->type == VARIABLE_NODE) { + Variable *v = (Variable *)n; + if (v->destructor != NULL && + ! v->destructor_unref) + num++; + } + } + return num; +} + +int +count_initializers (Class *c) +{ + int num = 0; + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + if (n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; - if(v->initializer) + if (v->initializer != NULL) num++; } } @@ -586,12 +644,12 @@ count_initializers(Class *c) gboolean find_get_type (Class *c) { - GList *l; - for(l = c->nodes; l != NULL; l = g_list_next(l)) { - Node *n = l->data; + GList *li; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; Method *m = (Method *)n; - if(n->type == METHOD_NODE && - strcmp (m->id, "get_type") == 0) { + if (n->type == METHOD_NODE && + strcmp (m->id, "get_type") == 0) { if (m->method != REGULAR_METHOD || m->scope != PUBLIC_SCOPE || m->args != NULL) { diff --git a/src/checks.h b/src/checks.h index 7966f17..4d12b38 100644 --- a/src/checks.h +++ b/src/checks.h @@ -1,6 +1,7 @@ /* GOB C Preprocessor * Copyright (C) 1999-2000 the Free Software Foundation. * Copyright (C) 2000 Eazel, Inc. + * Copyright (C) 2001 George Lebl * * Author: George Lebl * @@ -20,29 +21,33 @@ * USA. */ -#ifndef _CHECKS_H_ -#define _CHECKS_H_ +#ifndef CHECKS_H +#define CHECKS_H -void check_duplicate_symbols(Class *c); -void check_duplicate_overrides(Class *c); -void check_bad_symbols(Class *c); -void check_duplicate_signals_args(Class *c); -void check_public_new(Class *c); -void check_vararg(Class *c); -void check_firstarg(Class *c); -void check_nonvoidempty(Class *c); -void check_signal_args(Class *c); -void check_argument_types(Class *c); -void check_func_arg_checks(Class *c); +void check_duplicate_symbols (Class *c); +void check_duplicate_overrides (Class *c); +void check_bad_symbols (Class *c); +void check_duplicate_signals_args (Class *c); +void check_public_new (Class *c); +void check_vararg (Class *c); +void check_firstarg (Class *c); +void check_nonvoidempty (Class *c); +void check_signal_args (Class *c); +void check_argument_types (Class *c); +void check_property_types (Class *c); +void check_func_arg_checks (Class *c); -int count_signals(Class *c); -int count_set_arguments(Class *c); -int count_get_arguments(Class *c); -int count_overrides(Class *c); -int count_privates(Class *c); -int count_protecteds(Class *c); -int count_destructors(Class *c); -int count_initializers(Class *c); -gboolean find_get_type (Class *c); +int count_signals (Class *c); +int count_set_properties (Class *c); +int count_get_properties (Class *c); +int count_set_arguments (Class *c); +int count_get_arguments (Class *c); +int count_overrides (Class *c); +int count_privates (Class *c); +int count_protecteds (Class *c); +int count_unreftors (Class *c); +int count_destructors (Class *c); +int count_initializers (Class *c); +gboolean find_get_type (Class *c); #endif diff --git a/src/generate_treefuncs.pl b/src/generate_treefuncs.pl index de6c4b6..31d9151 100755 --- a/src/generate_treefuncs.pl +++ b/src/generate_treefuncs.pl @@ -1,8 +1,8 @@ #!/usr/bin/perl -w -open(FILE, "treefuncs.def") || die("Can't open treefuncs.def"); -open(OUTC, ">treefuncs.c") || die("Can't open treefuncs.c"); -open(OUTH, ">treefuncs.h") || die("Can't open treefuncs.h"); +open (FILE, "treefuncs.def") || die ("Can't open treefuncs.def"); +open (OUTC, ">treefuncs.c") || die ("Can't open treefuncs.c"); +open (OUTH, ">treefuncs.h") || die ("Can't open treefuncs.h"); print OUTC "/* Generated by generate_treefuncs.pl from treefuncs.def!\n"; print OUTC " * Do not edit by hand! */\n\n"; @@ -14,37 +14,36 @@ $typeenums = "enum {\n"; $typename = ""; %typestruct = (); -%newfunc = (); -%newfunc_prot = (); %freefunc = (); %freefunc_prot = (); %copyfunc = (); %copyfunc_prot = (); +%setfunc = (); +%setfunc_prot = (); + +$quarks = "static gboolean quarks_set_up = FALSE;\n" . + "static GHashTable *quark_ht;\n" . + "enum {\n\tQUARK_0,\n"; +$setupquarks = "static void\nensure_quarks (void)\n{\n" . + "\tif (quarks_set_up)\n\t\treturn;\n" . + "\tquark_ht = g_hash_table_new (g_str_hash, g_str_equal);\n" . + "\tquarks_set_up = TRUE;\n"; +%got_quarks = (); $var = ""; $type = ""; $copy = ""; $free = ""; +$steal = 0; $headercode = ""; $inheadercode = 0; -$vars = 0; - sub end_var { $typestruct{$typename} .= "\t$type $var;\n"; - if($vars == 0) { - $newfunc_prot{$typename} .= "$type $var"; - } else { - $newfunc_prot{$typename} .= ", $type $var"; - } - $vars++; - - $newfunc{$typename} .= "\tself->$var = $var;\n"; - - if($copy ne "") { + if ($copy ne "") { $tmp = $copy; $tmp =~ s/__VAL__/self->$var/g; $tmp =~ s/__LVAL__/new->$var/g; @@ -52,16 +51,58 @@ sub end_var { } else { $copyfunc{$typename} .= "\tnew->$var = self->$var;\n"; } - if($free ne "") { + if ($free ne "") { $tmp = $free; $tmp =~ s/__VAL__/self->$var/g; $freefunc{$typename} .= "\t$tmp\n"; } + + if ( ! $got_quarks{$var}) { + $quarks .= "\tQUARK_$var,\n"; + $setupquarks .= "\tg_hash_table_insert (quark_ht, \"$var\", " . + "GINT_TO_POINTER (QUARK_$var));\n"; + $got_quarks{$var} = 1; + } + if ($steal && ! $got_quarks{$var . ":steal"}) { + $quarks .= "\tQUARK_$var" . "_STEAL,\n"; + $setupquarks .= "\tg_hash_table_insert (quark_ht, \"$var" . + ":steal\", " . + "GINT_TO_POINTER (QUARK_$var" . "_STEAL));\n"; + $got_quarks{$var . ":steal"} = 1; + } + + $setfunc{$typename} .= "\t\tcase QUARK_$var: {\n"; + $setfunc{$typename} .= "\t\t\t$type $var = va_arg (__ap, $type);\n"; + if ($free ne "") { + $setfunc{$typename} .= "\t\t\t$type __old_value = self->$var;\n"; + } + + if ($copy ne "") { + $tmp = $copy; + $tmp =~ s/__VAL__/$var/g; + $tmp =~ s/__LVAL__/self->$var/g; + $setfunc{$typename} .= "\t\t\t$tmp\n"; + } else { + $setfunc{$typename} .= "\t\t\tself->$var = $var;\n"; + } + if ($free ne "") { + $tmp = $free; + $tmp =~ s/__VAL__/__old_value/g; + $setfunc{$typename} .= "\t\t\t$tmp\n"; + } + $setfunc{$typename} .= "\t\t\tbreak;\n\t\t}\n"; + + if ($steal) { + $setfunc{$typename} .= "\t\tcase QUARK_$var" . "_STEAL: {\n"; + $setfunc{$typename} .= "\t\t\t$type $var = va_arg (__ap, $type);\n"; + $setfunc{$typename} .= "\t\t\tself->$var = $var;\n"; + $setfunc{$typename} .= "\t\t\tbreak;\n\t\t}\n"; + } } -while() { - if($inheadercode) { - if(/^ENDHEADER$/) { +while () { + if ($inheadercode) { + if (/^ENDHEADER$/) { $inheadercode = 0; next; } @@ -71,117 +112,132 @@ while() { s/#.*$//; - if(/^[ \t]*HEADER[ \t]*$/) { + if (/^[ \t]*HEADER[ \t]*$/) { $inheadercode = 1; next; } - if(/^[ \t]*CLASS[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + if (/^[ \t]*CLASS[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { $typename = $1; $lct = lc $typename; $uct = uc $typename; - $vars = 0; - $typeenums .= "\t$uct"."_NODE,\n"; $typedefs .= "typedef struct _$typename $typename;\n"; - $typestruct{$typename} = "struct _$typename {\n\tint type;\n"; - $newfunc_prot{$typename} = "Node * new_$lct ("; - $copyfunc_prot{$typename} = "$typename * copy_$lct ($typename * self)"; - $freefunc_prot{$typename} = "void free_$lct ($typename * self)"; - - $newfunc{$typename} = "{\n" . - "\t$typename * self = g_new0($typename, 1);\n" . - "\tself->type = $uct"."_NODE;\n"; + $typestruct{$typename} = "struct _$typename {\n\tNodeType type;\n"; + $copyfunc_prot{$typename} = "static $typename *\ncopy_$lct ($typename * self)"; + $setfunc_prot{$typename} = "static void\nsetv_$lct ($typename * self, va_list __ap)"; + $freefunc_prot{$typename} = "void\nfree_$lct ($typename * self)"; + + $setfunc{$typename} = "{\n" . + "\tint quark;\n" . + "\tconst char *arg;\n" . + "\tensure_quarks ();\n" . + "\twhile ((arg = va_arg (__ap, char *)) != NULL) {\n" . + "\t\tquark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg));\n" . + "\t\tswitch (quark) {\n"; $copyfunc{$typename} = "{\n" . "\t$typename * new;\n" . - "\tg_return_val_if_fail(self != NULL, NULL);\n" . - "\tg_return_val_if_fail(self->type == $uct"."_NODE, NULL);\n" . + "\tg_return_val_if_fail (self != NULL, NULL);\n" . + "\tg_return_val_if_fail (self->type == $uct"."_NODE, NULL);\n" . "\tnew = g_new0($typename, 1);\n" . "\tnew->type = $uct"."_NODE;\n"; - $freefunc{$typename} = "{\n\tg_return_if_fail(self != NULL);\n" . - "\tg_return_if_fail(self->type == $uct"."_NODE);\n"; + $freefunc{$typename} = "{\n\tg_return_if_fail (self != NULL);\n" . + "\tg_return_if_fail (self->type == $uct"."_NODE);\n"; next; } #ignore everything until we get some typename - if($typename eq "") { + if ($typename eq "") { next; } #some predefined VARIABLE types - if(/^[ \t]*INT[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + if (/^[ \t]*INT[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { $var = $1; $type = "int"; $copy = "__LVAL__ = __VAL__;"; $free = ""; + $steal = 0; end_var; next; - } elsif(/^[ \t]*BOOL[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + } elsif (/^[ \t]*BOOL[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { $var = $1; $type = "gboolean"; $copy = "__LVAL__ = __VAL__;"; $free = ""; + $steal = 0; end_var; next; - } elsif(/^[ \t]*STRING[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + } elsif (/^[ \t]*STRING[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { $var = $1; $type = "char *"; - $copy = "__LVAL__ = g_strdup(__VAL__);"; - $free = "g_free(__VAL__);"; + $copy = "__LVAL__ = g_strdup (__VAL__);"; + $free = "g_free (__VAL__);"; + $steal = 1; end_var; next; - } elsif(/^[ \t]*STRINGLIST[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + } elsif (/^[ \t]*STRINGLIST[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { $var = $1; $type = "GList *"; - $copy = "__LVAL__ = g_list_copy(__VAL__); COPY_LIST_VALS(__LVAL__, g_strdup);"; - $free = "g_list_foreach(__VAL__, (GFunc)g_free, NULL); g_list_free(__VAL__);"; + $copy = "__LVAL__ = g_list_copy (__VAL__); COPY_LIST_VALS(__LVAL__, g_strdup);"; + $free = "g_list_foreach (__VAL__, (GFunc)g_free, NULL); g_list_free (__VAL__);"; + $steal = 1; end_var; next; - } elsif(/^[ \t]*NODELIST[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + } elsif (/^[ \t]*NODELIST[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { $var = $1; $type = "GList *"; - $copy = "__LVAL__ = copy_node_list(__VAL__);"; - $free = "free_node_list(__VAL__);"; + $copy = "__LVAL__ = node_list_copy (__VAL__);"; + $free = "node_list_free (__VAL__);"; + $steal = 1; end_var; next; #We assume one of the classes we are creating is named Type - } elsif(/^[ \t]*TYPE[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + } elsif (/^[ \t]*TYPE[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { $var = $1; $type = "Type *"; - $copy = "__LVAL__ = copy_type(__VAL__);"; - $free = "free_type(__VAL__);"; + $copy = "__LVAL__ = copy_type (__VAL__);"; + $free = "free_type (__VAL__);"; + $steal = 1; end_var; next; #generic variable type - } elsif(/^[ \t]*VAR[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + } elsif (/^[ \t]*VAR[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { $var = $1; $type = "int"; $copy = "__LVAL__ = __VAL__;"; $free = ""; + $steal = 0; next; - } elsif(/^[ \t]*CTYPE[ \t]+(.+)[ \t]*$/) { + } elsif (/^[ \t]*CTYPE[ \t]+(.+)[ \t]*$/) { $type = $1; next; - } elsif(/^[ \t]*COPY[ \t]+(.+)$/) { + } elsif (/^[ \t]*COPY[ \t]+(.+)$/) { $copy = $1; + $steal = 1; next; - } elsif(/^[ \t]*FREE[ \t]+(.+)$/) { + } elsif (/^[ \t]*FREE[ \t]+(.+)$/) { $free = $1; + $steal = 1; next; - } elsif(/^[ \t]*ENDVAR[ \t]*$/) { + } elsif (/^[ \t]*ENDVAR[ \t]*$/) { end_var; next; - } elsif(/^[ \t]*ENDCLASS[ \t]*$/) { + } elsif (/^[ \t]*ENDCLASS[ \t]*$/) { $typestruct{$typename} .= "};"; - $newfunc_prot{$typename} .= ")"; - $newfunc{$typename} .= "\treturn (Node *)self;\n}"; $copyfunc{$typename} .= "\treturn new;\n}"; - $freefunc{$typename} .= "\tg_free(self);\n}"; + $freefunc{$typename} .= "\tg_free (self);\n}"; + $setfunc{$typename} .= "\t\tdefault:\n" . + "\t\t\tg_warning (\"Argument named '" . $typename . "::\%s' does not exist\", arg);\n" . + "\t\t\tbreak;\n" . + "\t\t}\n" . + "\t}\n" . + "}"; $typename = ""; next; } else { @@ -191,10 +247,11 @@ while() { $typeenums .= "\tLAST_NODE_TYPE\n};"; -print OUTH "\n#ifndef _TREEFUNCS_H_\n"; -print OUTH "\n#define _TREEFUNCS_H_\n"; +print OUTH "\n#ifndef TREEFUNCS_H\n"; +print OUTH "#define TREEFUNCS_H\n"; print OUTH "\n$headercode\n\n"; +print OUTH "typedef long NodeType;\n"; print OUTH "$typeenums\n\n"; print OUTH "$typedefs\n\n"; @@ -202,11 +259,11 @@ foreach $t (sort keys %typestruct) { print OUTH "$typestruct{$t}\n\n"; } -print OUTH "union _Node {\n\tint type;\n"; +print OUTH "union _Node {\n\tNodeType type;\n"; foreach $t (sort keys %typestruct) { $foo = lc $t; - if($foo eq "type") { + if ($foo eq "type") { print OUTH "\t$t _type;\n"; } else { print OUTH "\t$t $foo;\n"; @@ -214,39 +271,43 @@ foreach $t (sort keys %typestruct) { } print OUTH "};\n\n"; +print OUTH "\n/* General copy/free functions */\n"; +print OUTH "Node * node_copy (Node *node);\n"; +print OUTH "void node_free (Node *node);\n\n"; +print OUTH "GList * node_list_copy (GList *nodes);\n"; +print OUTH "void node_list_free (GList *nodes);\n"; -print OUTH "/* New functions */\n"; +print OUTH "\n/* Node new/set functions */\n"; +print OUTH "Node * node_new (NodeType type, ...);\n"; +print OUTH "void node_set (Node *node, ...);\n\n"; -foreach $t (sort keys %newfunc_prot) { - print OUTH "$newfunc_prot{$t};\n"; -} +print OUTH "\n#endif /* TREEFUNCS_H */\n"; -print OUTH "\n/* General copy/free functions */\n"; -print OUTH "Node * copy_node(Node *node);\n"; -print OUTH "void free_node(Node *node);\n\n"; -print OUTH "GList * copy_node_list(GList *nodes);\n"; -print OUTH "void free_node_list(GList *nodes);\n"; +close (OUTH); + +print OUTC "#include \n"; +print OUTC "#include \n"; +print OUTC "#include \"treefuncs.h\"\n\n"; +print OUTC "#define COPY_LIST_VALS(list,func) " . + "{ GList *li; for (li=(list);li;li=li->next) { li->data=func (li->data); } }\n\n"; -print OUTH "\n/* Copy functions */\n"; foreach $t (sort keys %copyfunc_prot) { - print OUTH "$copyfunc_prot{$t};\n"; + print OUTC "$copyfunc_prot{$t};\n"; } -print OUTH "\n/* Free functions */\n"; +print OUTC "\n"; + foreach $t (sort keys %freefunc_prot) { - print OUTH "$freefunc_prot{$t};\n"; + print OUTC "$freefunc_prot{$t};\n"; } +print OUTC "\n"; -print OUTH "\n#endif /*_TREEFUNCS_H_*/\n"; - -close(OUTH); - -print OUTC "#include \n#include \"treefuncs.h\"\n\n"; -print OUTC "#define COPY_LIST_VALS(list,func) " . - "{ GList *li; for(li=(list);li;li=li->next) { li->data=func(li->data); } }\n\n"; - -foreach $t (sort keys %newfunc_prot) { - print OUTC "$newfunc_prot{$t}\n$newfunc{$t}\n\n"; +foreach $t (sort keys %setfunc_prot) { + print OUTC "$setfunc_prot{$t};\n"; } +print OUTC "\n"; + +print OUTC $quarks . "\tQUARK_LAST\n};\n\n"; +print OUTC $setupquarks . "}\n\n"; foreach $t (sort keys %copyfunc_prot) { print OUTC "$copyfunc_prot{$t}\n$copyfunc{$t}\n\n"; @@ -256,43 +317,84 @@ foreach $t (sort keys %freefunc_prot) { print OUTC "$freefunc_prot{$t}\n$freefunc{$t}\n\n"; } -print OUTC "Node * copy_node(Node *node)\n" . +foreach $t (sort keys %setfunc_prot) { + print OUTC "$setfunc_prot{$t}\n$setfunc{$t}\n\n"; +} + +print OUTC "Node *\nnode_copy (Node *node)\n" . "{\n" . - "\tg_return_val_if_fail(node != NULL, NULL);\n" . - "\tg_return_val_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE, NULL);\n" . - "\tswitch(node->type) {\n"; + "\tg_return_val_if_fail (node != NULL, NULL);\n" . + "\tg_return_val_if_fail (node->type >= 0 && node->type < LAST_NODE_TYPE, NULL);\n" . + "\tswitch (node->type) {\n"; foreach $t (sort keys %typestruct) { - print OUTC "\tcase " . uc($t) . "_NODE: return (Node *)copy_" . lc($t) . " (($t *)node);\n"; + print OUTC "\tcase " . uc ($t) . "_NODE: return (Node *)copy_" . lc ($t) . " (($t *)node);\n"; } print OUTC "\tdefault: return NULL;\n\t}\n}\n\n"; -print OUTC "void free_node(Node *node)\n" . +print OUTC "static void\nnode_setv (Node *node, va_list __ap)\n" . + "{\n" . + "\tg_return_if_fail (node != NULL);\n" . + "\tg_return_if_fail (node->type >= 0 && node->type < LAST_NODE_TYPE);\n" . + "\tswitch (node->type) {\n"; +foreach $t (sort keys %typestruct) { + print OUTC "\tcase " . uc ($t) . "_NODE: setv_" . lc ($t) . " (($t *)node, __ap); break;\n"; +} +print OUTC "\tdefault: break;\n\t}\n}\n\n"; + +print OUTC "void\nnode_set (Node *node, ...)\n" . + "{\n" . + "\tva_list __ap;\n" . + "\tva_start (__ap, node);\n" . + "\tnode_setv (node, __ap);\n" . + "\tva_end (__ap);\n" . + "}\n\n"; + +print OUTC "Node *\nnode_new (NodeType type, ...)\n" . + "{\n" . + "\tva_list __ap;\n" . + "\tNode *node = NULL;\n" . + "\tva_start (__ap, type);\n" . + "\tg_return_val_if_fail (type >= 0 && type < LAST_NODE_TYPE, NULL);\n" . + "\tswitch (type) {\n"; +foreach $t (sort keys %typestruct) { + print OUTC "\tcase " . uc ($t) . "_NODE:\n" . + "\t\tnode = (Node *)g_new0 ($t, 1);\n" . + "\t\tnode->type = type;\n" . + "\t\tsetv_" . lc ($t) . " (($t *)node, __ap);\n" . + "\t\tbreak;\n"; +} +print OUTC "\tdefault: break;\n\t}\n" . + "\tva_end (__ap);\n" . + "\treturn node;\n" . + "}\n\n"; + +print OUTC "void\nnode_free (Node *node)\n" . "{\n" . - "\tg_return_if_fail(node != NULL);\n" . - "\tg_return_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE);\n" . - "\tswitch(node->type) {\n"; + "\tg_return_if_fail (node != NULL);\n" . + "\tg_return_if_fail (node->type >= 0 && node->type < LAST_NODE_TYPE);\n" . + "\tswitch (node->type) {\n"; foreach $t (sort keys %typestruct) { - print OUTC "\tcase " . uc($t) . "_NODE: free_" . lc($t) . " (($t *)node); return;\n"; + print OUTC "\tcase " . uc ($t) . "_NODE: free_" . lc ($t) . " (($t *)node); return;\n"; } print OUTC "\tdefault: return;\n\t}\n}\n\n"; -print OUTC "GList * copy_node_list(GList *nodes)\n" . +print OUTC "GList *\nnode_list_copy (GList *nodes)\n" . "{\n" . "\tGList *li;\n" . - "\tnodes = g_list_copy(nodes);\n" . - "\tfor(li = nodes; li != NULL; li = li->next) {\n" . - "\t\tli->data = copy_node(li->data);\n" . + "\tnodes = g_list_copy (nodes);\n" . + "\tfor (li = nodes; li != NULL; li = li->next) {\n" . + "\t\tli->data = node_copy (li->data);\n" . "\t}\n" . "\treturn nodes;\n" . "}\n\n"; -print OUTC "void free_node_list(GList *nodes)\n" . +print OUTC "void\nnode_list_free (GList *nodes)\n" . "{\n" . "\tGList *li;\n" . - "\tfor(li = nodes; li != NULL; li = li->next) {\n" . - "\t\tfree_node(li->data);\n" . + "\tfor (li = nodes; li != NULL; li = li->next) {\n" . + "\t\tnode_free (li->data);\n" . "\t}\n" . - "\tg_list_free(nodes);\n" . + "\tg_list_free (nodes);\n" . "}\n\n"; -close(OUTC); +close (OUTC); diff --git a/src/lexer.c b/src/lexer.c index fe904e5..8c57c6e 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -284,97 +284,127 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 88 -#define YY_END_OF_BUFFER 89 -static yyconst short int yy_acclist[401] = +#define YY_NUM_RULES 106 +#define YY_END_OF_BUFFER 107 +static yyconst short int yy_acclist[554] = { 0, - 89, 86, 88, 85, 86, 88, 1, 87, 88, 86, - 87, 88, 86, 88, 86, 88, 85, 86, 88, 86, - 88, 86, 88, 26, 86, 88, 1, 27, 87, 88, - 26, 86, 87, 88, 26, 86, 88, 26, 86, 88, - 49, 86, 88, 1, 50, 87, 88, 49, 86, 87, - 88, 42, 49, 86, 88, 49, 86, 88, 49, 86, - 88, 49, 86, 88, 47, 49, 86, 88, 48, 49, - 86, 88, 49, 86, 88, 49, 86, 88, 45, 86, - 88, 1, 46, 87, 88, 45, 86, 87, 88, 44, - 45, 86, 88, 45, 86, 88, 86, 88, 86, 88, - - 77, 86, 88, 77, 86, 88, 86, 88, 80, 86, - 88, 80, 86, 88, 80, 86, 88, 80, 86, 88, - 82, 86, 88, 86, 88, 86, 88, 86, 88, 80, - 86, 88, 80, 86, 88, 80, 86, 88, 80, 86, - 88, 80, 86, 88, 80, 86, 88, 80, 86, 88, - 80, 86, 88, 80, 86, 88, 80, 86, 88, 80, - 86, 88, 80, 86, 88, 83, 86, 88, 84, 86, - 88, 9, 86, 88, 9, 86, 87, 88, 9, 86, - 88, 9, 86, 88, 9, 86, 88, 14, 86, 88, - 14, 86, 87, 88, 14, 86, 88, 14, 86, 88, - - 14, 86, 88, 17, 86, 88, 17, 86, 87, 88, - 17, 86, 88, 21, 33, 25, 22, 41, 34, 43, - 77, 23, 77, 77, 79, 80, 78, 80, 80, 80, - 24, 81, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 8, 6, 13, 10, 12, 11, 13, 16, 15, 3, - 28, 32, 39, 35, 37, 18, 77, 19, 77, 77, - 79, 79, 78, 80, 80, 80, 68, 20, 80, 80, - 80, 80, 80, 80, 80, 63, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 11, - - 29, 30, 31, 40, 36, 38, 79, 80, 54, 80, - 53, 80, 5, 80, 66, 80, 80, 80, 80, 58, - 80, 80, 61, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 55, 80, 7, 51, 80, 53, - 80, 67, 80, 80, 64, 80, 80, 80, 80, 80, - 62, 80, 80, 80, 80, 57, 80, 80, 80, 80, - 80, 65, 80, 80, 80, 80, 69, 80, 75, 80, - 59, 80, 56, 80, 80, 80, 80, 80, 80, 70, - 80, 80, 80, 74, 80, 73, 80, 80, 76, 80, - 80, 60, 80, 72, 80, 71, 80, 2, 4, 52 - + 107, 104, 106, 103, 104, 106, 1, 105, 106, 104, + 105, 106, 104, 106, 104, 106, 103, 104, 106, 104, + 106, 104, 106, 26, 104, 106, 1, 27, 105, 106, + 26, 104, 105, 106, 26, 104, 106, 26, 104, 106, + 50, 104, 106, 1, 51, 105, 106, 50, 104, 105, + 106, 42, 50, 104, 106, 50, 104, 106, 50, 104, + 106, 50, 104, 106, 48, 50, 104, 106, 49, 50, + 104, 106, 50, 104, 106, 50, 104, 106, 46, 104, + 106, 1, 47, 105, 106, 46, 104, 105, 106, 45, + 46, 104, 106, 46, 104, 106, 104, 106, 104, 106, + + 104, 106, 94, 104, 106, 94, 104, 106, 104, 106, + 97, 104, 106, 97, 104, 106, 97, 104, 106, 97, + 104, 106, 100, 104, 106, 104, 106, 104, 106, 104, + 106, 97, 104, 106, 97, 104, 106, 97, 104, 106, + 97, 104, 106, 97, 104, 106, 97, 104, 106, 97, + 104, 106, 97, 104, 106, 97, 104, 106, 97, 104, + 106, 97, 104, 106, 97, 104, 106, 101, 104, 106, + 102, 104, 106, 91, 104, 106, 43, 104, 106, 92, + 104, 106, 93, 104, 106, 97, 104, 106, 97, 104, + 106, 97, 104, 106, 97, 104, 106, 97, 104, 106, + + 97, 104, 106, 97, 104, 106, 97, 104, 106, 97, + 104, 106, 97, 104, 106, 97, 104, 106, 97, 104, + 106, 9, 104, 106, 9, 104, 105, 106, 9, 104, + 106, 9, 104, 106, 9, 104, 106, 14, 104, 106, + 14, 104, 105, 106, 14, 104, 106, 14, 104, 106, + 14, 104, 106, 17, 104, 106, 17, 104, 105, 106, + 17, 104, 106, 21, 33, 25, 22, 41, 34, 44, + 94, 23, 94, 94, 96, 97, 95, 97, 97, 97, + 24, 99, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 8, 6, 13, 10, 12, 11, 13, 16, + 15, 3, 28, 32, 39, 35, 37, 18, 98, 98, + 94, 19, 94, 94, 96, 96, 95, 97, 97, 97, + 69, 20, 97, 97, 97, 97, 97, 97, 97, 64, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 11, 29, 30, 31, 40, + 36, 38, 96, 97, 55, 97, 54, 97, 5, 97, + 67, 97, 97, 97, 97, 59, 97, 97, 62, 97, + + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 56, 97, 97, 97, 97, 59, 97, 97, 97, + 97, 79, 97, 97, 97, 97, 85, 97, 7, 52, + 97, 54, 97, 68, 97, 97, 65, 97, 97, 97, + 97, 97, 97, 63, 97, 97, 97, 97, 58, 97, + 97, 97, 80, 97, 97, 97, 97, 84, 97, 97, + 97, 97, 97, 97, 97, 66, 97, 97, 97, 97, + 97, 70, 97, 76, 97, 60, 97, 57, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 71, 97, 97, 97, 97, 75, 97, 97, + + 97, 97, 97, 81, 97, 82, 97, 97, 97, 74, + 97, 97, 77, 97, 78, 97, 97, 61, 97, 97, + 97, 97, 97, 97, 97, 73, 97, 72, 97, 97, + 97, 87, 97, 97, 97, 97, 2, 89, 97, 97, + 86, 97, 97, 88, 97, 4, 97, 90, 97, 97, + 83, 97, 53 } ; -static yyconst short int yy_accept[359] = +static yyconst short int yy_accept[472] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 4, 7, 10, 13, 15, 17, 20, 22, 24, 27, - 31, 35, 38, 41, 44, 48, 52, 56, 59, 62, - 65, 69, 73, 76, 79, 82, 86, 90, 94, 97, - 99, 101, 104, 107, 109, 112, 115, 118, 121, 124, - 126, 128, 130, 133, 136, 139, 142, 145, 148, 151, - 154, 157, 160, 163, 166, 169, 172, 175, 179, 182, - 185, 188, 191, 195, 198, 201, 204, 207, 211, 214, - 215, 215, 215, 215, 215, 215, 215, 215, 216, 216, - - 217, 217, 217, 217, 217, 217, 218, 218, 219, 219, - 219, 220, 221, 222, 223, 223, 223, 224, 224, 224, - 225, 226, 227, 228, 229, 230, 231, 231, 232, 232, - 232, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 252, 252, 252, 253, 253, 254, 254, 254, - 254, 255, 256, 256, 258, 259, 260, 260, 261, 261, - 261, 261, 262, 262, 262, 263, 263, 263, 263, 263, - 264, 264, 264, 264, 265, 266, 266, 267, 267, 268, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - - 278, 278, 278, 279, 279, 279, 280, 281, 282, 283, - 284, 285, 286, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 300, 301, 301, 301, - 302, 302, 303, 304, 304, 304, 304, 305, 306, 307, - 307, 308, 309, 311, 313, 313, 314, 315, 317, 318, - 319, 320, 322, 323, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 334, 335, 337, 337, 338, 338, 338, - 339, 339, 339, 339, 339, 339, 339, 340, 342, 344, - 345, 347, 348, 349, 350, 351, 353, 354, 355, 356, - 358, 359, 360, 360, 360, 360, 360, 360, 360, 361, - - 362, 364, 365, 366, 367, 369, 371, 373, 375, 376, - 377, 377, 377, 377, 377, 377, 378, 379, 380, 382, - 383, 384, 386, 386, 386, 386, 386, 386, 388, 389, - 391, 392, 394, 394, 394, 394, 394, 394, 394, 396, - 398, 398, 398, 398, 399, 399, 399, 399, 399, 400, - 400, 400, 400, 400, 400, 400, 401, 401 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 2, 4, 7, 10, 13, 15, 17, + 20, 22, 24, 27, 31, 35, 38, 41, 44, 48, + 52, 56, 59, 62, 65, 69, 73, 76, 79, 82, + 86, 90, 94, 97, 99, 101, 103, 106, 109, 111, + 114, 117, 120, 123, 126, 128, 130, 132, 135, 138, + 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, + 171, 174, 177, 180, 183, 186, 189, 192, 195, 198, + 201, 204, 207, 210, 213, 216, 219, 222, 225, 229, + + 232, 235, 238, 241, 245, 248, 251, 254, 257, 261, + 264, 265, 265, 265, 265, 265, 265, 265, 265, 266, + 266, 267, 267, 267, 267, 267, 267, 268, 268, 269, + 269, 269, 270, 271, 271, 271, 272, 273, 273, 273, + 274, 274, 274, 275, 276, 277, 278, 279, 280, 281, + 281, 282, 282, 282, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 314, 314, 314, + 315, 315, 316, 316, 316, 316, 317, 318, 318, 320, + + 321, 322, 322, 323, 323, 323, 323, 324, 324, 324, + 325, 325, 325, 325, 325, 326, 326, 326, 326, 327, + 328, 328, 329, 329, 330, 330, 331, 332, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 341, 342, 342, + 342, 343, 343, 343, 344, 345, 346, 347, 348, 349, + 350, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 376, 377, 377, 377, + 378, 378, 379, 380, 380, 380, 380, 381, 382, 383, + 383, 384, 385, 387, 389, 389, 390, 391, 393, 394, + + 395, 396, 398, 399, 401, 402, 403, 404, 405, 406, + 407, 408, 409, 410, 411, 412, 414, 415, 416, 417, + 419, 420, 421, 422, 424, 425, 426, 427, 429, 429, + 430, 430, 430, 431, 431, 431, 431, 431, 431, 431, + 432, 434, 436, 437, 439, 440, 441, 442, 443, 444, + 446, 447, 448, 449, 451, 452, 453, 455, 456, 457, + 458, 460, 461, 462, 463, 464, 464, 464, 464, 464, + 464, 464, 465, 466, 468, 469, 470, 471, 472, 474, + 476, 478, 480, 481, 482, 483, 484, 485, 486, 487, + 488, 489, 490, 490, 490, 490, 490, 490, 491, 492, + + 493, 495, 496, 497, 498, 500, 501, 502, 503, 504, + 506, 508, 509, 510, 510, 510, 510, 510, 510, 512, + 513, 515, 517, 518, 520, 521, 522, 523, 524, 525, + 526, 526, 526, 526, 526, 526, 526, 528, 530, 531, + 532, 534, 535, 536, 537, 537, 537, 537, 538, 538, + 540, 541, 543, 544, 546, 546, 546, 546, 547, 548, + 550, 550, 550, 551, 551, 551, 553, 553, 553, 554, + 554 } ; static yyconst int yy_ec[256] = @@ -388,11 +418,11 @@ static yyconst int yy_ec[256] = 1, 21, 1, 1, 22, 22, 22, 22, 23, 22, 24, 24, 25, 24, 24, 24, 24, 24, 24, 24, 24, 26, 27, 24, 24, 24, 24, 24, 24, 24, - 28, 29, 30, 1, 24, 1, 31, 32, 33, 34, + 28, 29, 30, 1, 31, 1, 32, 33, 34, 35, - 35, 36, 37, 38, 39, 24, 24, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 24, 24, 53, 1, 54, 1, 1, 1, 1, 1, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 24, 57, 1, 58, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -409,314 +439,394 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[55] = +static yyconst int yy_meta[59] = { 0, 1, 2, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 5, 1, 1, 6, 6, 7, 7, 7, 7, 1, 1, 8, - 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, + 7, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 1, 1 + 7, 7, 7, 7, 7, 7, 1, 1 } ; -static yyconst short int yy_base[384] = +static yyconst short int yy_base[499] = { 0, - 0, 4, 7, 13, 17, 69, 24, 36, 123, 0, - 165, 0, 31, 52, 48, 77, 55, 81, 848, 849, - 849, 849, 849, 1, 807, 42, 56, 811, 849, 849, - 849, 831, 817, 849, 849, 849, 849, 57, 10, 0, - 849, 849, 27, 789, 849, 849, 849, 849, 0, 86, - 78, 168, 99, 0, 823, 22, 49, 80, 849, 174, - 93, 206, 50, 187, 78, 161, 176, 169, 183, 163, - 188, 209, 175, 210, 849, 849, 849, 849, 827, 230, - 236, 849, 849, 826, 249, 253, 836, 835, 105, 849, - 834, 805, 238, 800, 220, 211, 206, 849, 789, 849, - - 0, 824, 225, 823, 822, 849, 827, 849, 261, 787, - 849, 849, 254, 849, 825, 259, 270, 276, 0, 286, - 808, 807, 806, 17, 262, 243, 811, 811, 819, 280, - 791, 792, 271, 30, 214, 287, 288, 290, 292, 26, - 294, 293, 295, 178, 297, 296, 298, 302, 299, 303, - 849, 318, 322, 345, 849, 349, 849, 341, 353, 357, - 849, 361, 805, 849, 849, 849, 815, 849, 770, 776, - 762, 849, 783, 760, 849, 759, 772, 761, 783, 849, - 799, 798, 797, 849, 849, 802, 849, 771, 353, 800, - 849, 357, 0, 783, 782, 781, 338, 72, 342, 849, - - 374, 796, 849, 768, 365, 359, 365, 367, 368, 300, - 369, 371, 778, 372, 373, 374, 375, 377, 379, 378, - 380, 384, 382, 385, 388, 429, 849, 749, 278, 849, - 761, 849, 849, 744, 754, 767, 849, 849, 849, 751, - 771, 381, 770, 769, 433, 849, 399, 768, 394, 397, - 386, 767, 411, 766, 393, 418, 423, 424, 425, 431, - 87, 427, 428, 432, 765, 450, 849, 465, 469, 849, - 740, 747, 750, 734, 0, 730, 441, 435, 759, 442, - 758, 456, 437, 445, 460, 757, 461, 463, 464, 756, - 468, 469, 725, 715, 698, 710, 716, 686, 471, 470, - - 678, 472, 473, 475, 664, 651, 643, 580, 479, 477, - 451, 563, 550, 586, 560, 483, 484, 486, 575, 492, - 488, 574, 549, 553, 514, 508, 527, 570, 501, 559, - 496, 549, 522, 519, 532, 523, 540, 522, 534, 516, - 502, 546, 554, 849, 539, 423, 558, 546, 849, 371, - 564, 234, 568, 585, 541, 849, 849, 603, 611, 619, - 627, 635, 643, 651, 659, 667, 670, 674, 678, 686, - 694, 702, 710, 715, 718, 722, 729, 734, 741, 745, - 751, 758, 766 + 0, 4, 7, 12, 17, 73, 26, 36, 131, 0, + 177, 0, 33, 34, 230, 0, 24, 47, 54, 91, + 57, 60, 1099, 1100, 1100, 1100, 1100, 21, 1055, 190, + 60, 1061, 1100, 1100, 1100, 1082, 1068, 1100, 1100, 1100, + 1100, 190, 42, 0, 1100, 1100, 81, 1036, 1100, 1100, + 1100, 1100, 0, 1064, 93, 86, 236, 107, 0, 1073, + 54, 69, 6, 1100, 184, 92, 97, 70, 179, 59, + 187, 185, 188, 82, 184, 207, 239, 197, 175, 1100, + 1100, 1100, 1100, 1100, 1100, 226, 249, 265, 212, 219, + 266, 22, 227, 97, 270, 236, 267, 1100, 1100, 1077, + + 291, 302, 1100, 1100, 1076, 310, 315, 1086, 1085, 247, + 1100, 1084, 1054, 292, 1049, 257, 283, 284, 1100, 1036, + 1100, 0, 1074, 293, 1073, 1072, 1100, 1077, 1100, 323, + 1034, 1100, 1100, 1069, 1068, 320, 1100, 1073, 327, 339, + 349, 0, 355, 1056, 1055, 1054, 307, 312, 313, 1059, + 1059, 1067, 331, 1039, 1040, 340, 350, 355, 341, 191, + 356, 357, 358, 360, 361, 364, 362, 365, 369, 366, + 372, 370, 373, 371, 374, 377, 375, 398, 379, 380, + 174, 283, 382, 383, 381, 1100, 430, 434, 438, 1100, + 443, 1100, 445, 449, 453, 1100, 457, 1053, 1100, 1100, + + 1100, 1063, 1100, 1015, 1021, 1006, 1100, 1030, 1004, 1100, + 1003, 1019, 1006, 1031, 1100, 1047, 1046, 1045, 1100, 1100, + 1050, 1100, 1018, 1100, 1042, 1041, 449, 1046, 1100, 453, + 0, 1029, 1028, 1027, 399, 434, 453, 1100, 471, 1042, + 1100, 1014, 464, 456, 458, 464, 465, 387, 466, 467, + 1024, 468, 469, 470, 473, 474, 472, 471, 476, 479, + 482, 478, 477, 481, 397, 494, 483, 500, 492, 512, + 514, 515, 516, 517, 518, 538, 1100, 992, 488, 1100, + 1006, 1100, 1100, 987, 999, 1013, 1100, 1100, 1100, 994, + 1017, 523, 1016, 1015, 544, 1100, 525, 1014, 531, 534, + + 536, 1013, 539, 1012, 540, 542, 541, 544, 546, 545, + 551, 548, 547, 553, 549, 1011, 405, 559, 552, 557, + 556, 565, 574, 1010, 576, 578, 579, 1009, 597, 1100, + 609, 614, 1100, 981, 990, 993, 975, 0, 971, 584, + 586, 1003, 588, 1002, 589, 594, 602, 604, 607, 1001, + 606, 608, 611, 1000, 612, 614, 999, 613, 615, 616, + 617, 618, 620, 623, 628, 970, 967, 964, 978, 990, + 977, 631, 633, 992, 634, 635, 636, 637, 991, 990, + 984, 976, 641, 642, 644, 645, 646, 647, 649, 656, + 659, 660, 629, 944, 929, 963, 918, 662, 664, 665, + + 920, 663, 670, 672, 904, 673, 678, 675, 684, 890, + 877, 685, 686, 842, 841, 710, 700, 718, 798, 689, + 797, 791, 691, 790, 702, 695, 705, 708, 709, 711, + 753, 756, 729, 735, 745, 737, 772, 761, 718, 740, + 760, 745, 719, 748, 707, 758, 771, 1100, 762, 490, + 750, 486, 758, 485, 391, 780, 764, 1100, 759, 311, + 235, 786, 771, 77, 797, 3, 803, 730, 1100, 1100, + 821, 829, 837, 845, 853, 861, 869, 877, 885, 893, + 896, 900, 904, 912, 920, 928, 936, 944, 949, 952, + 956, 963, 968, 975, 979, 985, 992, 1000 + } ; -static yyconst short int yy_def[384] = +static yyconst short int yy_def[499] = { 0, - 358, 358, 359, 359, 360, 360, 361, 361, 357, 9, - 9, 11, 362, 362, 363, 363, 364, 364, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 365, - 357, 357, 357, 357, 357, 357, 357, 357, 366, 357, - 357, 357, 357, 367, 368, 368, 368, 368, 357, 357, - 357, 369, 368, 368, 368, 368, 368, 368, 368, 368, - 368, 368, 368, 368, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 370, 357, 357, 357, 357, 357, 357, 357, 357, 357, - - 371, 357, 357, 357, 357, 357, 372, 357, 357, 357, - 357, 357, 357, 357, 373, 357, 357, 357, 374, 357, - 375, 368, 376, 368, 368, 368, 357, 357, 377, 357, - 378, 357, 368, 368, 368, 368, 368, 368, 368, 368, - 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, - 357, 357, 357, 357, 357, 379, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 370, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 372, 357, 357, 357, 373, - 357, 357, 374, 375, 380, 376, 368, 368, 368, 357, - - 357, 377, 357, 378, 369, 368, 368, 368, 368, 368, - 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, - 368, 368, 368, 368, 368, 381, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 380, 368, 368, 368, 357, 357, 368, 368, 368, 368, - 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, - 368, 368, 368, 368, 368, 357, 357, 381, 357, 357, - 357, 357, 357, 357, 382, 357, 368, 368, 368, 368, - 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, - 368, 368, 357, 357, 357, 357, 357, 357, 368, 368, - - 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, - 357, 357, 357, 357, 357, 368, 368, 368, 368, 368, - 368, 368, 357, 357, 357, 357, 357, 368, 368, 368, - 368, 368, 357, 357, 357, 357, 357, 357, 368, 368, - 357, 357, 357, 357, 383, 357, 357, 383, 357, 357, - 357, 357, 357, 357, 357, 357, 0, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357 + 471, 471, 472, 472, 473, 473, 474, 474, 470, 9, + 9, 11, 9, 9, 9, 15, 475, 475, 476, 476, + 477, 477, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 478, 470, 470, 470, 470, 470, 470, + 470, 470, 479, 480, 470, 470, 470, 470, 481, 482, + 482, 482, 482, 470, 470, 470, 483, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 470, + 470, 470, 470, 470, 470, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 470, 470, 470, + + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 484, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 485, 470, 470, 470, 470, 470, 486, 470, 470, + 470, 470, 470, 470, 487, 470, 470, 488, 470, 470, + 470, 489, 470, 490, 482, 491, 482, 482, 482, 470, + 470, 492, 470, 493, 470, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 470, 470, 470, 470, 470, + 494, 470, 470, 470, 470, 470, 470, 470, 470, 470, + + 470, 484, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 486, 470, 470, 470, 470, 470, 470, 488, 470, 470, + 489, 490, 495, 491, 482, 482, 482, 470, 470, 492, + 470, 493, 483, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 496, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 495, 482, 482, 482, 470, 470, 482, 482, 482, 482, + + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 470, 470, + 496, 470, 470, 470, 470, 470, 470, 497, 470, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 470, 470, 470, 470, 470, + 470, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 470, 470, 470, 470, 470, 482, 482, 482, + + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 470, 470, 470, 470, 470, 482, 482, + 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, + 470, 470, 470, 470, 470, 470, 482, 482, 482, 482, + 482, 482, 482, 482, 470, 470, 470, 470, 498, 482, + 482, 482, 482, 482, 470, 470, 498, 470, 482, 482, + 470, 470, 482, 470, 470, 482, 470, 470, 470, 0, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470 + } ; -static yyconst short int yy_nxt[904] = +static yyconst short int yy_nxt[1159] = { 0, - 357, 21, 22, 23, 21, 26, 22, 23, 26, 30, - 31, 27, 90, 24, 91, 30, 31, 24, 32, 35, - 36, 106, 37, 107, 32, 38, 46, 47, 109, 48, - 39, 109, 25, 22, 78, 123, 25, 33, 46, 47, - 123, 48, 79, 93, 123, 40, 93, 197, 123, 28, - 22, 83, 49, 80, 22, 78, 80, 22, 88, 84, - 207, 124, 102, 81, 49, 110, 89, 123, 123, 41, - 42, 35, 36, 213, 37, 43, 44, 38, 85, 22, - 83, 85, 39, 22, 88, 103, 95, 94, 86, 114, - 123, 115, 89, 96, 125, 133, 123, 40, 123, 97, - - 113, 113, 113, 113, 128, 123, 129, 165, 98, 104, - 105, 116, 243, 120, 120, 120, 120, 126, 166, 289, - 137, 41, 42, 20, 21, 22, 23, 21, 20, 20, - 20, 20, 20, 20, 20, 50, 51, 52, 53, 53, - 53, 54, 20, 20, 55, 55, 55, 55, 55, 55, - 20, 20, 20, 55, 55, 56, 55, 55, 57, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 58, 55, 55, 55, 55, 59, 20, 60, 61, 123, - 116, 123, 117, 117, 117, 118, 127, 123, 113, 113, - 113, 113, 62, 123, 123, 63, 123, 64, 65, 66, - - 67, 123, 138, 68, 69, 123, 123, 70, 71, 218, - 140, 72, 142, 73, 74, 139, 148, 75, 76, 119, - 130, 130, 130, 130, 134, 141, 135, 123, 123, 136, - 181, 152, 123, 143, 152, 132, 144, 154, 155, 93, - 156, 153, 93, 176, 208, 173, 145, 146, 149, 151, - 158, 177, 150, 158, 160, 161, 147, 162, 174, 170, - 159, 123, 109, 175, 163, 109, 164, 171, 189, 189, - 189, 189, 172, 192, 192, 192, 192, 182, 183, 176, - 123, 199, 116, 94, 117, 117, 117, 118, 116, 123, - 118, 118, 118, 118, 130, 130, 130, 130, 116, 110, - - 120, 120, 120, 120, 198, 123, 123, 206, 123, 132, - 123, 123, 123, 123, 123, 123, 123, 123, 123, 152, - 123, 123, 152, 154, 155, 271, 156, 215, 209, 153, - 172, 251, 220, 216, 212, 214, 210, 217, 211, 219, - 222, 225, 158, 221, 224, 158, 154, 155, 223, 154, - 154, 155, 159, 154, 160, 161, 123, 162, 160, 161, - 123, 160, 160, 161, 163, 160, 227, 189, 189, 189, - 189, 192, 192, 192, 192, 245, 246, 123, 245, 130, - 130, 130, 130, 123, 242, 123, 123, 123, 244, 123, - 123, 123, 123, 123, 132, 123, 123, 123, 123, 123, - - 123, 253, 123, 123, 123, 352, 123, 247, 254, 252, - 248, 123, 123, 249, 250, 123, 258, 123, 255, 260, - 263, 265, 257, 256, 259, 280, 262, 244, 261, 123, - 266, 267, 264, 266, 245, 246, 123, 245, 282, 277, - 278, 123, 123, 123, 279, 123, 123, 269, 283, 123, - 123, 266, 267, 123, 266, 123, 350, 284, 281, 123, - 123, 287, 285, 123, 291, 288, 266, 267, 290, 266, - 266, 267, 286, 266, 123, 299, 301, 304, 123, 123, - 292, 123, 123, 269, 303, 300, 123, 123, 123, 123, - 123, 123, 305, 123, 302, 123, 307, 123, 323, 310, - - 306, 123, 123, 175, 123, 318, 123, 319, 317, 309, - 123, 308, 316, 321, 123, 335, 322, 329, 335, 123, - 330, 332, 320, 336, 337, 337, 331, 345, 338, 340, - 328, 338, 346, 335, 123, 339, 335, 343, 343, 343, - 343, 345, 355, 356, 349, 355, 342, 342, 342, 342, - 344, 349, 123, 341, 343, 343, 343, 343, 347, 349, - 342, 342, 342, 342, 344, 174, 349, 123, 343, 343, - 343, 343, 351, 351, 351, 351, 353, 123, 351, 351, - 351, 351, 354, 354, 354, 354, 355, 356, 123, 355, - 334, 333, 123, 123, 327, 326, 325, 324, 123, 354, - - 354, 354, 354, 20, 20, 20, 20, 20, 20, 20, - 20, 29, 29, 29, 29, 29, 29, 29, 29, 34, - 34, 34, 34, 34, 34, 34, 34, 45, 45, 45, - 45, 45, 45, 45, 45, 77, 77, 77, 77, 77, - 77, 77, 77, 82, 82, 82, 82, 82, 82, 82, - 82, 87, 87, 87, 87, 87, 87, 87, 87, 108, - 108, 123, 108, 108, 108, 108, 108, 112, 112, 123, - 112, 112, 112, 112, 112, 121, 121, 122, 122, 122, - 122, 131, 123, 131, 131, 131, 167, 167, 167, 167, - 167, 167, 167, 167, 179, 179, 123, 179, 179, 179, - - 179, 179, 186, 186, 186, 186, 186, 186, 186, 186, - 190, 190, 190, 190, 190, 190, 190, 190, 193, 315, - 193, 194, 194, 194, 194, 196, 196, 196, 196, 202, - 202, 202, 202, 202, 202, 202, 202, 204, 314, 204, - 204, 204, 226, 226, 313, 312, 226, 226, 241, 241, - 241, 241, 268, 268, 268, 268, 268, 268, 297, 297, - 311, 297, 297, 297, 297, 297, 348, 348, 171, 348, - 348, 348, 348, 348, 123, 123, 123, 123, 298, 296, - 295, 294, 293, 123, 123, 123, 123, 123, 123, 195, - 276, 275, 274, 273, 272, 270, 123, 132, 203, 123, - - 195, 195, 191, 240, 187, 239, 238, 237, 236, 235, - 234, 233, 232, 231, 230, 229, 228, 168, 227, 205, - 132, 203, 201, 200, 123, 123, 195, 191, 188, 187, - 185, 184, 180, 178, 99, 169, 168, 165, 165, 157, - 151, 123, 111, 101, 100, 99, 92, 357, 19, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - - 357, 357, 357 + 470, 25, 26, 27, 25, 30, 26, 27, 30, 34, + 35, 31, 470, 28, 34, 35, 470, 28, 36, 39, + 40, 146, 41, 36, 146, 42, 26, 99, 50, 51, + 43, 52, 111, 29, 112, 100, 37, 29, 50, 51, + 146, 52, 82, 82, 149, 44, 24, 24, 101, 26, + 99, 101, 32, 127, 53, 128, 26, 104, 102, 26, + 109, 181, 26, 109, 53, 105, 60, 60, 110, 60, + 60, 110, 146, 45, 46, 39, 40, 146, 41, 47, + 48, 42, 130, 60, 60, 130, 43, 146, 146, 24, + 24, 116, 106, 26, 104, 106, 147, 137, 117, 138, + + 146, 44, 107, 151, 160, 152, 118, 136, 136, 136, + 136, 153, 153, 153, 153, 146, 119, 148, 156, 139, + 131, 143, 143, 143, 143, 211, 155, 164, 183, 45, + 46, 24, 25, 26, 27, 25, 24, 24, 24, 54, + 24, 24, 24, 55, 56, 57, 58, 58, 58, 59, + 24, 24, 60, 60, 60, 60, 60, 60, 24, 24, + 24, 60, 60, 60, 61, 60, 60, 62, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 63, 60, 60, 60, 60, 60, 64, 24, 65, + 66, 114, 146, 146, 114, 123, 150, 146, 136, 136, + + 136, 136, 146, 146, 67, 146, 146, 271, 68, 146, + 69, 70, 71, 72, 172, 146, 73, 157, 124, 74, + 173, 158, 75, 76, 159, 146, 77, 162, 78, 79, + 146, 161, 163, 80, 81, 83, 165, 146, 115, 84, + 85, 171, 248, 24, 146, 146, 125, 126, 139, 200, + 140, 140, 140, 141, 146, 166, 177, 146, 167, 182, + 201, 178, 86, 87, 88, 89, 90, 146, 174, 73, + 464, 175, 74, 91, 92, 93, 94, 168, 169, 95, + 96, 78, 97, 146, 146, 146, 24, 157, 146, 170, + 142, 185, 187, 114, 159, 187, 114, 179, 216, 205, + + 176, 146, 188, 189, 190, 180, 191, 206, 168, 184, + 160, 193, 173, 207, 193, 186, 195, 196, 208, 197, + 170, 194, 211, 272, 130, 146, 198, 130, 199, 146, + 146, 146, 212, 209, 227, 227, 227, 227, 235, 210, + 115, 230, 230, 230, 230, 153, 153, 153, 153, 217, + 218, 139, 237, 140, 140, 140, 141, 236, 146, 146, + 155, 139, 131, 141, 141, 141, 141, 139, 146, 143, + 143, 143, 143, 146, 146, 146, 146, 244, 146, 146, + 146, 245, 146, 146, 146, 247, 246, 146, 146, 146, + 146, 146, 146, 146, 256, 146, 253, 146, 146, 146, + + 146, 146, 250, 254, 252, 146, 258, 249, 251, 255, + 257, 260, 263, 266, 259, 146, 146, 146, 262, 301, + 274, 261, 264, 146, 270, 461, 267, 275, 265, 268, + 273, 187, 318, 269, 187, 189, 190, 357, 191, 189, + 190, 188, 189, 250, 189, 190, 193, 189, 292, 193, + 195, 196, 146, 197, 195, 196, 194, 195, 195, 196, + 198, 195, 277, 227, 227, 227, 227, 230, 230, 230, + 230, 146, 295, 296, 146, 295, 146, 293, 153, 153, + 153, 153, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 155, 146, 146, 146, 146, 303, 146, + + 146, 146, 294, 146, 146, 304, 298, 297, 146, 302, + 146, 316, 146, 299, 300, 311, 309, 305, 146, 307, + 310, 314, 306, 308, 313, 319, 320, 312, 315, 317, + 146, 322, 146, 146, 146, 146, 146, 321, 334, 329, + 330, 146, 329, 146, 207, 295, 296, 326, 295, 146, + 325, 323, 146, 328, 146, 324, 332, 146, 146, 146, + 146, 327, 146, 146, 146, 146, 146, 146, 340, 146, + 146, 146, 294, 346, 146, 146, 347, 146, 343, 348, + 341, 353, 351, 146, 342, 349, 352, 360, 345, 344, + 355, 354, 146, 358, 146, 350, 146, 146, 329, 330, + + 356, 329, 146, 359, 146, 361, 146, 146, 362, 364, + 329, 330, 146, 329, 352, 329, 330, 363, 329, 372, + 146, 365, 146, 374, 146, 146, 146, 332, 375, 146, + 146, 146, 146, 146, 146, 146, 146, 378, 146, 373, + 379, 146, 381, 385, 376, 384, 146, 388, 380, 146, + 377, 146, 146, 146, 146, 146, 383, 386, 392, 146, + 146, 382, 146, 146, 146, 146, 387, 146, 400, 389, + 401, 390, 399, 391, 146, 398, 404, 146, 146, 414, + 146, 146, 146, 146, 405, 210, 402, 403, 146, 412, + 146, 146, 410, 146, 406, 407, 146, 409, 420, 411, + + 421, 408, 146, 146, 146, 423, 424, 146, 426, 146, + 413, 433, 419, 146, 433, 434, 435, 435, 422, 436, + 146, 427, 436, 146, 437, 438, 146, 146, 425, 146, + 433, 468, 469, 433, 468, 429, 146, 146, 455, 428, + 441, 430, 449, 446, 446, 446, 446, 440, 439, 447, + 447, 447, 447, 450, 442, 448, 449, 444, 146, 447, + 447, 447, 447, 146, 443, 453, 146, 458, 146, 458, + 456, 451, 446, 446, 446, 446, 146, 146, 146, 146, + 452, 448, 458, 454, 458, 447, 447, 447, 447, 146, + 146, 445, 459, 460, 462, 462, 462, 462, 465, 209, + + 462, 462, 462, 462, 468, 469, 466, 468, 146, 146, + 463, 467, 467, 467, 467, 146, 146, 467, 467, 467, + 467, 24, 24, 24, 24, 24, 24, 24, 24, 33, + 33, 33, 33, 33, 33, 33, 33, 38, 38, 38, + 38, 38, 38, 38, 38, 49, 49, 49, 49, 49, + 49, 49, 49, 98, 98, 98, 98, 98, 98, 98, + 98, 103, 103, 103, 103, 103, 103, 103, 103, 108, + 108, 108, 108, 108, 108, 108, 108, 129, 129, 432, + 129, 129, 129, 129, 129, 133, 133, 431, 133, 133, + 133, 133, 133, 134, 134, 146, 134, 134, 134, 134, + + 134, 144, 144, 145, 145, 145, 145, 154, 146, 154, + 154, 154, 202, 202, 202, 202, 202, 202, 202, 202, + 214, 214, 146, 214, 214, 214, 214, 214, 221, 221, + 221, 221, 221, 221, 221, 221, 225, 225, 146, 225, + 225, 225, 225, 225, 228, 228, 228, 228, 228, 228, + 228, 228, 231, 418, 231, 232, 232, 232, 232, 234, + 234, 234, 234, 240, 240, 240, 240, 240, 240, 240, + 240, 242, 417, 242, 242, 242, 276, 276, 416, 415, + 276, 276, 291, 291, 291, 291, 331, 331, 331, 331, + 331, 331, 370, 370, 146, 370, 370, 370, 370, 370, + + 457, 457, 146, 457, 457, 457, 457, 457, 146, 146, + 146, 397, 396, 395, 394, 393, 206, 146, 146, 146, + 146, 146, 371, 369, 368, 367, 366, 146, 146, 146, + 146, 146, 146, 146, 146, 233, 339, 338, 337, 336, + 335, 333, 146, 155, 241, 146, 233, 233, 229, 224, + 224, 290, 222, 289, 288, 287, 286, 285, 284, 283, + 282, 281, 280, 279, 278, 203, 277, 243, 155, 241, + 239, 238, 146, 146, 233, 229, 226, 224, 223, 222, + 220, 219, 215, 213, 120, 204, 203, 200, 200, 192, + 186, 146, 135, 132, 122, 121, 120, 113, 470, 23, + + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470 } ; -static yyconst short int yy_chk[904] = +static yyconst short int yy_chk[1159] = { 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, - 3, 2, 24, 1, 24, 4, 4, 2, 3, 5, - 5, 39, 5, 39, 4, 5, 7, 7, 43, 7, - 5, 43, 1, 13, 13, 124, 2, 4, 8, 8, - 56, 8, 13, 26, 140, 5, 26, 124, 134, 2, - 15, 15, 7, 14, 14, 14, 14, 17, 17, 15, - 134, 56, 38, 14, 8, 43, 17, 57, 63, 5, - 5, 6, 6, 140, 6, 6, 6, 6, 16, 16, - 16, 16, 6, 18, 18, 38, 27, 26, 16, 51, - 198, 51, 18, 27, 57, 63, 65, 6, 58, 27, - - 50, 50, 50, 50, 61, 261, 61, 89, 27, 38, - 38, 53, 198, 53, 53, 53, 53, 58, 89, 261, - 65, 6, 6, 9, 9, 9, 9, 9, 9, 9, + 3, 2, 0, 1, 4, 4, 0, 2, 3, 5, + 5, 466, 5, 4, 63, 5, 17, 17, 7, 7, + 5, 7, 28, 1, 28, 17, 4, 2, 8, 8, + 92, 8, 13, 14, 63, 5, 13, 14, 18, 18, + 18, 18, 2, 43, 7, 43, 19, 19, 18, 21, + 21, 92, 22, 22, 8, 19, 13, 14, 21, 13, + 14, 22, 61, 5, 5, 6, 6, 70, 6, 6, + 6, 6, 47, 13, 14, 47, 6, 62, 68, 13, + 14, 31, 20, 20, 20, 20, 61, 56, 31, 56, + + 74, 6, 20, 66, 70, 66, 31, 55, 55, 55, + 55, 67, 67, 67, 67, 94, 31, 62, 68, 58, + 47, 58, 58, 58, 58, 464, 67, 74, 94, 6, + 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 11, 11, 66, - 52, 70, 52, 52, 52, 52, 60, 68, 60, 60, - 60, 60, 11, 73, 67, 11, 144, 11, 11, 11, - - 11, 69, 66, 11, 11, 64, 71, 11, 11, 144, - 68, 11, 70, 11, 11, 67, 73, 11, 11, 52, - 62, 62, 62, 62, 64, 69, 64, 72, 74, 64, - 103, 80, 135, 71, 80, 62, 71, 81, 81, 93, - 81, 80, 93, 97, 135, 96, 72, 72, 74, 81, - 85, 97, 74, 85, 86, 86, 72, 86, 96, 95, - 85, 126, 109, 96, 86, 109, 86, 95, 113, 113, - 113, 113, 95, 116, 116, 116, 116, 103, 103, 352, - 125, 126, 117, 93, 117, 117, 117, 117, 118, 133, - 118, 118, 118, 118, 130, 130, 130, 130, 120, 109, - - 120, 120, 120, 120, 125, 136, 137, 133, 138, 130, - 139, 142, 141, 143, 146, 145, 147, 149, 210, 152, - 148, 150, 152, 153, 153, 229, 153, 142, 136, 152, - 229, 210, 146, 143, 139, 141, 137, 143, 138, 145, - 148, 150, 158, 147, 149, 158, 154, 154, 148, 154, - 156, 156, 158, 156, 159, 159, 197, 159, 160, 160, - 199, 160, 162, 162, 159, 162, 159, 189, 189, 189, - 189, 192, 192, 192, 192, 201, 201, 206, 201, 205, - 205, 205, 205, 207, 197, 208, 209, 211, 199, 212, - 214, 215, 216, 217, 205, 218, 220, 219, 221, 242, - - 223, 212, 222, 224, 251, 350, 225, 206, 214, 211, - 207, 255, 249, 208, 209, 250, 218, 247, 215, 220, - 223, 225, 217, 216, 219, 251, 222, 242, 221, 253, - 226, 226, 224, 226, 245, 245, 256, 245, 255, 247, - 249, 257, 258, 259, 250, 262, 263, 226, 256, 260, - 264, 266, 266, 278, 266, 283, 346, 257, 253, 277, - 280, 260, 258, 284, 263, 260, 268, 268, 262, 268, - 269, 269, 259, 269, 282, 277, 280, 284, 285, 287, - 264, 288, 289, 268, 283, 278, 291, 292, 300, 299, - 302, 303, 285, 304, 282, 310, 288, 309, 311, 292, - - 287, 316, 317, 311, 318, 302, 321, 303, 300, 291, - 320, 289, 299, 309, 331, 325, 310, 317, 325, 329, - 318, 321, 304, 326, 326, 326, 320, 338, 327, 331, - 316, 327, 341, 335, 340, 329, 335, 336, 336, 336, - 336, 338, 355, 355, 345, 355, 335, 335, 335, 335, - 337, 348, 339, 334, 337, 337, 337, 337, 342, 345, - 342, 342, 342, 342, 343, 333, 348, 332, 343, 343, - 343, 343, 347, 347, 347, 347, 351, 330, 351, 351, - 351, 351, 353, 353, 353, 353, 354, 354, 328, 354, - 324, 323, 322, 319, 315, 314, 313, 312, 308, 354, - - 354, 354, 354, 358, 358, 358, 358, 358, 358, 358, - 358, 359, 359, 359, 359, 359, 359, 359, 359, 360, - 360, 360, 360, 360, 360, 360, 360, 361, 361, 361, - 361, 361, 361, 361, 361, 362, 362, 362, 362, 362, - 362, 362, 362, 363, 363, 363, 363, 363, 363, 363, - 363, 364, 364, 364, 364, 364, 364, 364, 364, 365, - 365, 307, 365, 365, 365, 365, 365, 366, 366, 306, - 366, 366, 366, 366, 366, 367, 367, 368, 368, 368, - 368, 369, 305, 369, 369, 369, 370, 370, 370, 370, - 370, 370, 370, 370, 371, 371, 301, 371, 371, 371, - - 371, 371, 372, 372, 372, 372, 372, 372, 372, 372, - 373, 373, 373, 373, 373, 373, 373, 373, 374, 298, - 374, 375, 375, 375, 375, 376, 376, 376, 376, 377, - 377, 377, 377, 377, 377, 377, 377, 378, 297, 378, - 378, 378, 379, 379, 296, 295, 379, 379, 380, 380, - 380, 380, 381, 381, 381, 381, 381, 381, 382, 382, - 294, 382, 382, 382, 382, 382, 383, 383, 293, 383, - 383, 383, 383, 383, 290, 286, 281, 279, 276, 274, - 273, 272, 271, 265, 254, 252, 248, 244, 243, 241, - 240, 236, 235, 234, 231, 228, 213, 204, 202, 196, - - 195, 194, 190, 188, 186, 183, 182, 181, 179, 178, - 177, 176, 174, 173, 171, 170, 169, 167, 163, 132, - 131, 129, 128, 127, 123, 122, 121, 115, 110, 107, - 105, 104, 102, 99, 94, 92, 91, 88, 87, 84, - 79, 55, 44, 33, 32, 28, 25, 19, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - - 357, 357, 357 + 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, + 11, 30, 181, 79, 30, 42, 65, 69, 65, 65, + + 65, 65, 75, 72, 11, 71, 73, 181, 11, 160, + 11, 11, 11, 11, 79, 78, 11, 69, 42, 11, + 79, 69, 11, 11, 69, 76, 11, 72, 11, 11, + 89, 71, 73, 11, 11, 15, 75, 90, 30, 15, + 15, 78, 160, 15, 86, 93, 42, 42, 57, 110, + 57, 57, 57, 57, 96, 76, 89, 77, 76, 93, + 110, 90, 15, 15, 15, 15, 15, 87, 86, 15, + 461, 86, 15, 15, 15, 15, 15, 77, 77, 15, + 15, 15, 15, 88, 91, 97, 15, 87, 95, 77, + 57, 96, 101, 114, 87, 101, 114, 91, 124, 116, + + 88, 182, 101, 102, 102, 91, 102, 116, 95, 95, + 88, 106, 97, 116, 106, 102, 107, 107, 117, 107, + 95, 106, 118, 182, 130, 147, 107, 130, 107, 460, + 148, 149, 118, 117, 136, 136, 136, 136, 147, 117, + 114, 139, 139, 139, 139, 153, 153, 153, 153, 124, + 124, 140, 149, 140, 140, 140, 140, 148, 156, 159, + 153, 141, 130, 141, 141, 141, 141, 143, 157, 143, + 143, 143, 143, 158, 161, 162, 163, 156, 164, 165, + 167, 157, 166, 168, 170, 159, 158, 169, 172, 174, + 171, 173, 175, 177, 167, 176, 165, 179, 180, 185, + + 183, 184, 162, 166, 164, 248, 169, 161, 163, 166, + 168, 171, 173, 176, 170, 265, 178, 235, 172, 248, + 184, 171, 174, 317, 180, 455, 177, 185, 175, 178, + 183, 187, 265, 179, 187, 188, 188, 317, 188, 189, + 189, 187, 189, 178, 191, 191, 193, 191, 235, 193, + 194, 194, 236, 194, 195, 195, 193, 195, 197, 197, + 194, 197, 194, 227, 227, 227, 227, 230, 230, 230, + 230, 237, 239, 239, 244, 239, 245, 236, 243, 243, + 243, 243, 246, 247, 249, 250, 252, 253, 254, 258, + 257, 255, 256, 243, 259, 263, 262, 260, 250, 264, + + 261, 267, 237, 454, 452, 252, 245, 244, 450, 249, + 269, 263, 266, 246, 247, 258, 256, 253, 268, 255, + 257, 261, 254, 255, 260, 266, 267, 259, 262, 264, + 270, 269, 271, 272, 273, 274, 275, 268, 279, 276, + 276, 292, 276, 297, 279, 295, 295, 273, 295, 299, + 272, 270, 300, 275, 301, 271, 276, 303, 305, 307, + 306, 274, 308, 310, 309, 313, 312, 315, 297, 311, + 319, 314, 292, 306, 321, 320, 307, 318, 301, 308, + 299, 312, 311, 322, 300, 309, 311, 320, 305, 303, + 314, 313, 323, 318, 325, 310, 326, 327, 329, 329, + + 315, 329, 340, 319, 341, 321, 343, 345, 322, 325, + 331, 331, 346, 331, 327, 332, 332, 323, 332, 340, + 347, 326, 348, 343, 351, 349, 352, 331, 345, 353, + 355, 358, 356, 359, 360, 361, 362, 348, 363, 341, + 349, 364, 352, 358, 346, 356, 365, 361, 351, 372, + 347, 373, 375, 376, 377, 378, 355, 359, 365, 383, + 384, 353, 385, 386, 387, 388, 360, 389, 375, 362, + 376, 363, 373, 364, 390, 372, 383, 391, 392, 393, + 398, 402, 399, 400, 384, 393, 377, 378, 403, 391, + 404, 406, 389, 408, 385, 386, 407, 388, 399, 390, + + 400, 387, 409, 412, 413, 403, 404, 420, 407, 423, + 392, 416, 398, 426, 416, 417, 417, 417, 402, 418, + 425, 408, 418, 427, 420, 423, 428, 429, 406, 430, + 433, 468, 468, 433, 468, 412, 439, 443, 445, 409, + 427, 413, 436, 433, 433, 433, 433, 426, 425, 434, + 434, 434, 434, 439, 428, 435, 436, 430, 440, 435, + 435, 435, 435, 442, 429, 443, 444, 449, 451, 457, + 446, 440, 446, 446, 446, 446, 453, 459, 441, 438, + 442, 447, 449, 444, 457, 447, 447, 447, 447, 463, + 437, 432, 451, 453, 456, 456, 456, 456, 462, 431, + + 462, 462, 462, 462, 467, 467, 463, 467, 424, 422, + 459, 465, 465, 465, 465, 421, 419, 467, 467, 467, + 467, 471, 471, 471, 471, 471, 471, 471, 471, 472, + 472, 472, 472, 472, 472, 472, 472, 473, 473, 473, + 473, 473, 473, 473, 473, 474, 474, 474, 474, 474, + 474, 474, 474, 475, 475, 475, 475, 475, 475, 475, + 475, 476, 476, 476, 476, 476, 476, 476, 476, 477, + 477, 477, 477, 477, 477, 477, 477, 478, 478, 415, + 478, 478, 478, 478, 478, 479, 479, 414, 479, 479, + 479, 479, 479, 480, 480, 411, 480, 480, 480, 480, + + 480, 481, 481, 482, 482, 482, 482, 483, 410, 483, + 483, 483, 484, 484, 484, 484, 484, 484, 484, 484, + 485, 485, 405, 485, 485, 485, 485, 485, 486, 486, + 486, 486, 486, 486, 486, 486, 487, 487, 401, 487, + 487, 487, 487, 487, 488, 488, 488, 488, 488, 488, + 488, 488, 489, 397, 489, 490, 490, 490, 490, 491, + 491, 491, 491, 492, 492, 492, 492, 492, 492, 492, + 492, 493, 396, 493, 493, 493, 494, 494, 395, 394, + 494, 494, 495, 495, 495, 495, 496, 496, 496, 496, + 496, 496, 497, 497, 382, 497, 497, 497, 497, 497, + + 498, 498, 381, 498, 498, 498, 498, 498, 380, 379, + 374, 371, 370, 369, 368, 367, 366, 357, 354, 350, + 344, 342, 339, 337, 336, 335, 334, 328, 324, 316, + 304, 302, 298, 294, 293, 291, 290, 286, 285, 284, + 281, 278, 251, 242, 240, 234, 233, 232, 228, 226, + 225, 223, 221, 218, 217, 216, 214, 213, 212, 211, + 209, 208, 206, 205, 204, 202, 198, 155, 154, 152, + 151, 150, 146, 145, 144, 138, 135, 134, 131, 128, + 126, 125, 123, 120, 115, 113, 112, 109, 108, 105, + 100, 60, 54, 48, 37, 36, 32, 29, 23, 470, + + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + 470, 470, 470, 470, 470, 470, 470, 470 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -770,6 +880,8 @@ static int parenth_depth = 0; static int before_comment = INITIAL; static gboolean class_after_c = FALSE; static int code_type = CCODE; +static int before_string; +static int property_paren_depth = 0; /* GTK+ doc stuff */ static char *gtk_doc_func = NULL; /* current gtk-doc func */ @@ -827,19 +939,23 @@ int yylex(void); #define C_CODE 2 -#define C_CODE_STRING 3 +#define CODE_STRING 3 #define CLASS_CODE 4 #define CLASS_CODE_I 5 -#define GTK_DOC_BEFORE_NAME 6 +#define PROPERTY_CODE 6 -#define GTK_DOC 7 +#define PROPERTY_CODE_I 7 -#define GTK_DOC_LINE 8 +#define GTK_DOC_BEFORE_NAME 8 -#line 843 "lex.yy.c" +#define GTK_DOC 9 + +#define GTK_DOC_LINE 10 + +#line 959 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -993,10 +1109,18 @@ YY_DECL register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 102 "lexer.l" +#line 106 "lexer.l" + + + +/* Avoid warning from flex, cuz flex sucks */ +#ifdef FLEX_SCANNER +yy_current_state = 0; +#endif + -#line 1000 "lex.yy.c" +#line 1124 "lex.yy.c" if ( yy_init ) { @@ -1045,14 +1169,14 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 358 ) + if ( yy_current_state >= 471 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_base[yy_current_state] != 849 ); + while ( yy_base[yy_current_state] != 1100 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -1083,7 +1207,7 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 104 "lexer.l" +#line 116 "lexer.l" { line_no++; REJECT; } YY_BREAK case 2: @@ -1091,7 +1215,7 @@ case 2: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 106 "lexer.l" +#line 118 "lexer.l" { /* Thy evil easter egg */ #define QQ(x) long x @@ -1119,12 +1243,12 @@ case 3: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 128 "lexer.l" +#line 140 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 4: YY_RULE_SETUP -#line 129 "lexer.l" +#line 141 "lexer.l" { if(look_for_includes==1) { char *p; @@ -1147,7 +1271,7 @@ case 5: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 146 "lexer.l" +#line 158 "lexer.l" { /* eat out gtk doc stuff */ BEGIN(GTK_DOC_BEFORE_NAME); @@ -1159,7 +1283,7 @@ case 6: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 151 "lexer.l" +#line 163 "lexer.l" { /* empty doc lines */ ; @@ -1170,7 +1294,7 @@ case 7: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 155 "lexer.l" +#line 167 "lexer.l" { char *p; BEGIN(GTK_DOC); @@ -1184,14 +1308,14 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 165 "lexer.l" +#line 177 "lexer.l" { BEGIN(CLASS_CODE_I); } YY_BREAK case 9: YY_RULE_SETUP -#line 168 "lexer.l" +#line 180 "lexer.l" { BEGIN(COMMENT); before_comment = CLASS_CODE_I; @@ -1202,7 +1326,7 @@ case 10: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 172 "lexer.l" +#line 184 "lexer.l" { /* empty doc lines */ add_to_cbuf(" *\n"); @@ -1210,7 +1334,7 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 176 "lexer.l" +#line 188 "lexer.l" { BEGIN(CLASS_CODE_I); add_gtk_doc_func(); @@ -1218,7 +1342,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 180 "lexer.l" +#line 192 "lexer.l" { fflush(stdout); add_to_cbuf(" * "); @@ -1227,14 +1351,14 @@ YY_RULE_SETUP YY_BREAK case 13: YY_RULE_SETUP -#line 185 "lexer.l" +#line 197 "lexer.l" { BEGIN(CLASS_CODE_I); } YY_BREAK case 14: YY_RULE_SETUP -#line 188 "lexer.l" +#line 200 "lexer.l" { BEGIN(COMMENT); before_comment = CLASS_CODE_I; @@ -1242,7 +1366,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 192 "lexer.l" +#line 204 "lexer.l" { BEGIN(CLASS_CODE_I); add_to_cbuf("\n"); @@ -1254,7 +1378,7 @@ case 16: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 197 "lexer.l" +#line 209 "lexer.l" { BEGIN(GTK_DOC); add_to_cbuf(yytext); @@ -1263,7 +1387,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 202 "lexer.l" +#line 214 "lexer.l" { fflush(stdout); add_to_cbuf(yytext); @@ -1274,7 +1398,7 @@ case 18: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 207 "lexer.l" +#line 219 "lexer.l" { add_to_cbuf(yytext); /*comment, ignore*/ } YY_BREAK case 19: @@ -1282,7 +1406,7 @@ case 19: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 208 "lexer.l" +#line 220 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 20: @@ -1290,17 +1414,17 @@ case 20: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 209 "lexer.l" +#line 221 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 21: YY_RULE_SETUP -#line 210 "lexer.l" +#line 222 "lexer.l" {BEGIN(COMMENT); before_comment = INITIAL; } YY_BREAK case 22: YY_RULE_SETUP -#line 211 "lexer.l" +#line 223 "lexer.l" { add_to_cbuf(yytext); BEGIN(COMMENT); @@ -1309,17 +1433,17 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 216 "lexer.l" +#line 228 "lexer.l" {BEGIN(COMMENT); before_comment = CLASS_CODE; } YY_BREAK case 24: YY_RULE_SETUP -#line 217 "lexer.l" +#line 229 "lexer.l" {BEGIN(COMMENT); before_comment = CLASS_CODE_I; } YY_BREAK case 25: YY_RULE_SETUP -#line 218 "lexer.l" +#line 230 "lexer.l" { if(before_comment == C_CODE) add_to_cbuf(yytext); BEGIN(before_comment); @@ -1327,7 +1451,7 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 222 "lexer.l" +#line 234 "lexer.l" { /* comment, ignore */ if(before_comment == C_CODE) add_to_cbuf(yytext); @@ -1335,7 +1459,7 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -#line 226 "lexer.l" +#line 238 "lexer.l" { /* comment, ignore */ if(before_comment == C_CODE) add_to_cbuf(yytext); @@ -1343,7 +1467,7 @@ YY_RULE_SETUP YY_BREAK case 28: YY_RULE_SETUP -#line 231 "lexer.l" +#line 243 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1355,7 +1479,7 @@ YY_RULE_SETUP YY_BREAK case 29: YY_RULE_SETUP -#line 239 "lexer.l" +#line 251 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1367,7 +1491,7 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 248 "lexer.l" +#line 260 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1379,7 +1503,7 @@ YY_RULE_SETUP YY_BREAK case 31: YY_RULE_SETUP -#line 256 "lexer.l" +#line 268 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1391,7 +1515,7 @@ YY_RULE_SETUP YY_BREAK case 32: YY_RULE_SETUP -#line 264 "lexer.l" +#line 276 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1403,7 +1527,7 @@ YY_RULE_SETUP YY_BREAK case 33: YY_RULE_SETUP -#line 272 "lexer.l" +#line 284 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1417,7 +1541,7 @@ YY_RULE_SETUP YY_BREAK case 34: YY_RULE_SETUP -#line 282 "lexer.l" +#line 294 "lexer.l" { BEGIN(INITIAL); yylval.cbuf = cbuf; @@ -1429,81 +1553,97 @@ YY_RULE_SETUP YY_BREAK case 35: YY_RULE_SETUP -#line 291 "lexer.l" +#line 303 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 36: YY_RULE_SETUP -#line 292 "lexer.l" +#line 304 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 37: YY_RULE_SETUP -#line 293 "lexer.l" +#line 305 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 38: YY_RULE_SETUP -#line 294 "lexer.l" +#line 306 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 39: YY_RULE_SETUP -#line 295 "lexer.l" +#line 307 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 40: YY_RULE_SETUP -#line 296 "lexer.l" +#line 308 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 41: YY_RULE_SETUP -#line 298 "lexer.l" +#line 310 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 42: YY_RULE_SETUP -#line 299 "lexer.l" +#line 313 "lexer.l" { - BEGIN(C_CODE_STRING); + BEGIN(CODE_STRING); + before_string = C_CODE; add_to_cbuf(yytext); } YY_BREAK case 43: YY_RULE_SETUP -#line 303 "lexer.l" -{ add_to_cbuf(yytext); } +#line 318 "lexer.l" +{ + BEGIN(CODE_STRING); + before_string = PROPERTY_CODE_I; + add_to_cbuf(yytext); + } YY_BREAK case 44: YY_RULE_SETUP -#line 304 "lexer.l" -{ - BEGIN(C_CODE); - add_to_cbuf(yytext); - } +#line 323 "lexer.l" +{ add_to_cbuf(yytext); } YY_BREAK case 45: YY_RULE_SETUP -#line 308 "lexer.l" -{ add_to_cbuf(yytext); } +#line 324 "lexer.l" +{ + BEGIN(before_string); + add_to_cbuf(yytext); + if (before_string == PROPERTY_CODE_I) { + yylval.id = cbuf->str; + g_string_free (cbuf, FALSE); + cbuf = NULL; + return STRING; + } + } YY_BREAK case 46: YY_RULE_SETUP -#line 309 "lexer.l" +#line 334 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 47: YY_RULE_SETUP -#line 311 "lexer.l" +#line 335 "lexer.l" +{ add_to_cbuf(yytext); } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 337 "lexer.l" { parenth_depth++; add_to_cbuf(yytext); } YY_BREAK -case 48: +case 49: YY_RULE_SETUP -#line 315 "lexer.l" +#line 341 "lexer.l" { parenth_depth--; if(parenth_depth<0) { @@ -1517,19 +1657,19 @@ YY_RULE_SETUP add_to_cbuf(yytext); } YY_BREAK -case 49: +case 50: YY_RULE_SETUP -#line 328 "lexer.l" +#line 354 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK -case 50: +case 51: YY_RULE_SETUP -#line 329 "lexer.l" +#line 355 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK -case 51: +case 52: YY_RULE_SETUP -#line 331 "lexer.l" +#line 357 "lexer.l" { static int found_classes = 0; look_for_includes = 2; @@ -1543,36 +1683,56 @@ YY_RULE_SETUP return CLASS; } YY_BREAK -case 52: +case 53: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 344 "lexer.l" +#line 370 "lexer.l" { - int maj = 0,min = 0,pl = 0; - int rmaj = 0,rmin = 0,rpl = 0; + int maj = 0, min = 0, pl = 0; + int rmaj = 0, rmin = 0, rpl = 0; + int effective_maj = 0; + int effective_rmaj = 0; char *p; - sscanf(VERSION,"%d.%d.%d",&rmaj,&rmin,&rpl); - p = strchr(yytext,'r'); - g_assert(p); /* we MUST have found it */ - sscanf(p,"requires %d.%d.%d",&maj,&min,&pl); + sscanf (VERSION, "%d.%d.%d", &rmaj, &rmin, &rpl); + effective_rmaj = rmaj; + if (rmin >= 90) + effective_rmaj = rmaj + 1; + + p = strchr (yytext,'r'); + g_assert (p); /* we MUST have found it */ + sscanf (p, "requires %d.%d.%d", &maj, &min, &pl); + effective_maj = maj; + if (min >= 90) + effective_maj = maj + 1; + if(rmaj < maj || (rmaj == maj && rmin < min) || (rmaj == maj && rmin == min && rpl < pl)) { + error_printf (GOB_ERROR, line_no, + "GOB version at least %d.%d.%d required " + "(this is %s)\n" + "To upgrade your gob, see: " + "http://www.5z.com/jirka/gob.html", + maj, min, pl, VERSION); + } + + if(effective_rmaj != effective_maj) { error_printf(GOB_ERROR, line_no, - "GOB version %d.%d.%d required " + "GOB major version %d required " "(this is %s)\n" "To upgrade your gob, see: " "http://www.5z.com/jirka/gob.html", - maj, min, pl, VERSION); + maj, VERSION); } + } YY_BREAK -case 53: +case 54: YY_RULE_SETUP -#line 365 "lexer.l" +#line 411 "lexer.l" { if(for_cpp) { error_printf(GOB_WARN, line_no, @@ -1583,174 +1743,282 @@ YY_RULE_SETUP REJECT; } YY_BREAK -case 54: +case 55: YY_RULE_SETUP -#line 375 "lexer.l" +#line 421 "lexer.l" {return FROM;} YY_BREAK -case 55: +case 56: YY_RULE_SETUP -#line 377 "lexer.l" +#line 423 "lexer.l" {return VOID;} YY_BREAK -case 56: +case 57: YY_RULE_SETUP -#line 378 "lexer.l" +#line 424 "lexer.l" {return STRUCT;} YY_BREAK -case 57: +case 58: YY_RULE_SETUP -#line 379 "lexer.l" +#line 425 "lexer.l" {return UNION;} YY_BREAK -case 58: +case 59: YY_RULE_SETUP -#line 380 "lexer.l" +#line 426 "lexer.l" {return ENUM;} YY_BREAK -case 59: +case 60: YY_RULE_SETUP -#line 381 "lexer.l" +#line 427 "lexer.l" {return SIGNED;} YY_BREAK -case 60: +case 61: YY_RULE_SETUP -#line 382 "lexer.l" +#line 428 "lexer.l" {return UNSIGNED;} YY_BREAK -case 61: +case 62: YY_RULE_SETUP -#line 383 "lexer.l" +#line 429 "lexer.l" {return LONG;} YY_BREAK -case 62: +case 63: YY_RULE_SETUP -#line 384 "lexer.l" +#line 430 "lexer.l" {return SHORT;} YY_BREAK -case 63: +case 64: YY_RULE_SETUP -#line 385 "lexer.l" +#line 431 "lexer.l" {return INT;} YY_BREAK -case 64: +case 65: YY_RULE_SETUP -#line 386 "lexer.l" +#line 432 "lexer.l" {return FLOAT;} YY_BREAK -case 65: +case 66: YY_RULE_SETUP -#line 387 "lexer.l" +#line 433 "lexer.l" {return DOUBLE;} YY_BREAK -case 66: +case 67: YY_RULE_SETUP -#line 388 "lexer.l" +#line 434 "lexer.l" {return CHAR;} YY_BREAK -case 67: +case 68: YY_RULE_SETUP -#line 389 "lexer.l" +#line 435 "lexer.l" {return CONST;} YY_BREAK -case 68: +case 69: YY_RULE_SETUP -#line 391 "lexer.l" +#line 437 "lexer.l" {return THREEDOTS;} YY_BREAK -case 69: +case 70: YY_RULE_SETUP -#line 393 "lexer.l" +#line 439 "lexer.l" {yylval.line = line_no; return PUBLIC;} YY_BREAK -case 70: +case 71: YY_RULE_SETUP -#line 394 "lexer.l" +#line 440 "lexer.l" {yylval.line = line_no; return PRIVATE;} YY_BREAK -case 71: +case 72: YY_RULE_SETUP -#line 395 "lexer.l" +#line 441 "lexer.l" {yylval.line = line_no; return PROTECTED;} YY_BREAK -case 72: +case 73: YY_RULE_SETUP -#line 396 "lexer.l" +#line 442 "lexer.l" {yylval.line = line_no; return CLASSWIDE;} YY_BREAK -case 73: +case 74: YY_RULE_SETUP -#line 397 "lexer.l" +#line 443 "lexer.l" {yylval.line = line_no; return ARGUMENT;} YY_BREAK -case 74: +case 75: YY_RULE_SETUP -#line 398 "lexer.l" +#line 444 "lexer.l" {yylval.line = line_no; return VIRTUAL;} YY_BREAK -case 75: +case 76: YY_RULE_SETUP -#line 399 "lexer.l" +#line 445 "lexer.l" {yylval.line = line_no; return SIGNAL;} YY_BREAK -case 76: +case 77: YY_RULE_SETUP -#line 400 "lexer.l" +#line 446 "lexer.l" {yylval.line = line_no; return OVERRIDE;} YY_BREAK -case 77: +case 78: YY_RULE_SETUP -#line 401 "lexer.l" +#line 447 "lexer.l" +{ + yylval.line = line_no; + BEGIN(PROPERTY_CODE); + return PROPERTY; + } + YY_BREAK +case 79: +YY_RULE_SETUP +#line 452 "lexer.l" +{ yylval.line = line_no; return NICK; } + YY_BREAK +case 80: +YY_RULE_SETUP +#line 453 "lexer.l" +{ yylval.line = line_no; return BLURB; } + YY_BREAK +case 81: +YY_RULE_SETUP +#line 454 "lexer.l" +{ yylval.line = line_no; return MAXIMUM; } + YY_BREAK +case 82: +YY_RULE_SETUP +#line 455 "lexer.l" +{ yylval.line = line_no; return MINIMUM; } + YY_BREAK +case 83: +YY_RULE_SETUP +#line 456 "lexer.l" +{ yylval.line = line_no; return DEFAULT_VALUE; } + YY_BREAK +case 84: +YY_RULE_SETUP +#line 457 "lexer.l" +{ yylval.line = line_no; return FLAGS; } + YY_BREAK +case 85: +YY_RULE_SETUP +#line 458 "lexer.l" +{ yylval.line = line_no; return TYPE; } + YY_BREAK +case 86: +YY_RULE_SETUP +#line 459 "lexer.l" +{ yylval.line = line_no; return FLAGS_TYPE; } + YY_BREAK +case 87: +YY_RULE_SETUP +#line 460 "lexer.l" +{ yylval.line = line_no; return ENUM_TYPE; } + YY_BREAK +case 88: +YY_RULE_SETUP +#line 461 "lexer.l" +{ yylval.line = line_no; return PARAM_TYPE; } + YY_BREAK +case 89: +YY_RULE_SETUP +#line 462 "lexer.l" +{ yylval.line = line_no; return BOXED_TYPE; } + YY_BREAK +case 90: +YY_RULE_SETUP +#line 463 "lexer.l" +{ yylval.line = line_no; return OBJECT_TYPE; } + YY_BREAK +case 91: +YY_RULE_SETUP +#line 464 "lexer.l" +{ + yylval.line = line_no; + property_paren_depth = 1; + BEGIN(PROPERTY_CODE_I); + return '('; + } + YY_BREAK +case 92: +YY_RULE_SETUP +#line 470 "lexer.l" +{ + yylval.line = line_no; + property_paren_depth++; + return '('; + } + YY_BREAK +case 93: +YY_RULE_SETUP +#line 475 "lexer.l" +{ + yylval.line = line_no; + property_paren_depth--; + if (property_paren_depth == 0) { + BEGIN(CLASS_CODE_I); + } + return ')'; + } + YY_BREAK +case 94: +YY_RULE_SETUP +#line 484 "lexer.l" { yylval.id = g_strdup(yytext); return NUMBER; } YY_BREAK -case 78: +case 95: YY_RULE_SETUP -#line 405 "lexer.l" +#line 488 "lexer.l" { /* this one is for a classname with a namespace */ yylval.id = g_strdup(yytext); return TYPETOKEN; } YY_BREAK -case 79: +case 96: YY_RULE_SETUP -#line 410 "lexer.l" +#line 493 "lexer.l" { /* this is for a classname with an empty namespace */ yylval.id = g_strdup(yytext); return TYPETOKEN; } YY_BREAK -case 80: +case 97: YY_RULE_SETUP -#line 415 "lexer.l" +#line 498 "lexer.l" { yylval.id = g_strdup(yytext); return TOKEN; } YY_BREAK -case 81: +case 98: YY_RULE_SETUP -#line 420 "lexer.l" +#line 502 "lexer.l" +{ + yylval.id = g_strdup(yytext); + return SINGLE_CHAR; + } + YY_BREAK +case 99: +YY_RULE_SETUP +#line 507 "lexer.l" { yylval.id = g_strdup(yytext); return ARRAY_DIM; } YY_BREAK -case 82: +case 100: YY_RULE_SETUP -#line 425 "lexer.l" +#line 512 "lexer.l" { BEGIN(CLASS_CODE_I); return '{'; } YY_BREAK -case 83: +case 101: YY_RULE_SETUP -#line 429 "lexer.l" +#line 516 "lexer.l" { BEGIN(C_CODE); parenth_depth=1; @@ -1761,44 +2029,46 @@ YY_RULE_SETUP return '{'; } YY_BREAK -case 84: +case 102: YY_RULE_SETUP -#line 438 "lexer.l" +#line 525 "lexer.l" { BEGIN(INITIAL); return '}'; } YY_BREAK -case 85: +case 103: YY_RULE_SETUP -#line 443 "lexer.l" +#line 530 "lexer.l" ; /*ignore*/ YY_BREAK -case 86: +case 104: YY_RULE_SETUP -#line 445 "lexer.l" +#line 532 "lexer.l" { yylval.line = line_no; return yytext[0]; } YY_BREAK -case 87: +case 105: YY_RULE_SETUP -#line 450 "lexer.l" +#line 537 "lexer.l" ; /*ignore*/ YY_BREAK -case 88: +case 106: YY_RULE_SETUP -#line 452 "lexer.l" +#line 539 "lexer.l" ECHO; YY_BREAK -#line 1796 "lex.yy.c" +#line 2064 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(C_CODE): - case YY_STATE_EOF(C_CODE_STRING): + case YY_STATE_EOF(CODE_STRING): case YY_STATE_EOF(CLASS_CODE): case YY_STATE_EOF(CLASS_CODE_I): + case YY_STATE_EOF(PROPERTY_CODE): + case YY_STATE_EOF(PROPERTY_CODE_I): case YY_STATE_EOF(GTK_DOC_BEFORE_NAME): case YY_STATE_EOF(GTK_DOC): case YY_STATE_EOF(GTK_DOC_LINE): @@ -2090,7 +2360,7 @@ static yy_state_type yy_get_previous_state() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 358 ) + if ( yy_current_state >= 471 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2120,11 +2390,11 @@ yy_state_type yy_current_state; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 358 ) + if ( yy_current_state >= 471 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 357); + yy_is_jam = (yy_current_state == 470); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2682,7 +2952,7 @@ int main() return 0; } #endif -#line 452 "lexer.l" +#line 539 "lexer.l" /* Ugly warning avoiding */ diff --git a/src/lexer.l b/src/lexer.l index f45fcc5..e102286 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -33,6 +33,8 @@ static int parenth_depth = 0; static int before_comment = INITIAL; static gboolean class_after_c = FALSE; static int code_type = CCODE; +static int before_string; +static int property_paren_depth = 0; /* GTK+ doc stuff */ static char *gtk_doc_func = NULL; /* current gtk-doc func */ @@ -90,9 +92,11 @@ int yylex(void); %x COMMENT %x C_CODE -%x C_CODE_STRING +%x CODE_STRING %x CLASS_CODE %x CLASS_CODE_I +%x PROPERTY_CODE +%x PROPERTY_CODE_I %x GTK_DOC_BEFORE_NAME %x GTK_DOC %x GTK_DOC_LINE @@ -101,6 +105,14 @@ int yylex(void); %% +%{ +/* Avoid warning from flex, cuz flex sucks */ +#ifdef FLEX_SCANNER +yy_current_state = 0; +#endif +%} + + <*>\n { line_no++; REJECT; } ^(I(S.RI).E\(([1-9][0-9]+|[2-9]))/(\)) { @@ -296,17 +308,31 @@ REJECT; \'\\\"\' { add_to_cbuf(yytext); } \\. { add_to_cbuf(yytext); } + + \" { - BEGIN(C_CODE_STRING); + BEGIN(CODE_STRING); + before_string = C_CODE; + add_to_cbuf(yytext); + } +\" { + BEGIN(CODE_STRING); + before_string = PROPERTY_CODE_I; add_to_cbuf(yytext); } -\\. { add_to_cbuf(yytext); } -\" { - BEGIN(C_CODE); - add_to_cbuf(yytext); +\\. { add_to_cbuf(yytext); } +\" { + BEGIN(before_string); + add_to_cbuf(yytext); + if (before_string == PROPERTY_CODE_I) { + yylval.id = cbuf->str; + g_string_free (cbuf, FALSE); + cbuf = NULL; + return STRING; } -. { add_to_cbuf(yytext); } -\n { add_to_cbuf(yytext); } + } +. { add_to_cbuf(yytext); } +\n { add_to_cbuf(yytext); } \{ { parenth_depth++; @@ -342,24 +368,44 @@ class { } ^[ \t]*requires[ \t]+[0-9]+\.[0-9]+\.[0-9]+[\t ]*$ { - int maj = 0,min = 0,pl = 0; - int rmaj = 0,rmin = 0,rpl = 0; + int maj = 0, min = 0, pl = 0; + int rmaj = 0, rmin = 0, rpl = 0; + int effective_maj = 0; + int effective_rmaj = 0; char *p; - sscanf(VERSION,"%d.%d.%d",&rmaj,&rmin,&rpl); - p = strchr(yytext,'r'); - g_assert(p); /* we MUST have found it */ - sscanf(p,"requires %d.%d.%d",&maj,&min,&pl); + sscanf (VERSION, "%d.%d.%d", &rmaj, &rmin, &rpl); + effective_rmaj = rmaj; + if (rmin >= 90) + effective_rmaj = rmaj + 1; + + p = strchr (yytext,'r'); + g_assert (p); /* we MUST have found it */ + sscanf (p, "requires %d.%d.%d", &maj, &min, &pl); + effective_maj = maj; + if (min >= 90) + effective_maj = maj + 1; + if(rmaj < maj || (rmaj == maj && rmin < min) || (rmaj == maj && rmin == min && rpl < pl)) { + error_printf (GOB_ERROR, line_no, + "GOB version at least %d.%d.%d required " + "(this is %s)\n" + "To upgrade your gob, see: " + "http://www.5z.com/jirka/gob.html", + maj, min, pl, VERSION); + } + + if(effective_rmaj != effective_maj) { error_printf(GOB_ERROR, line_no, - "GOB version %d.%d.%d required " + "GOB major version %d required " "(this is %s)\n" "To upgrade your gob, see: " "http://www.5z.com/jirka/gob.html", - maj, min, pl, VERSION); + maj, VERSION); } + } class|this { @@ -374,19 +420,19 @@ class { from {return FROM;} -void {return VOID;} -struct {return STRUCT;} -union {return UNION;} -enum {return ENUM;} -signed {return SIGNED;} -unsigned {return UNSIGNED;} -long {return LONG;} -short {return SHORT;} -int {return INT;} -float {return FLOAT;} -double {return DOUBLE;} -char {return CHAR;} -const {return CONST;} +void {return VOID;} +struct {return STRUCT;} +union {return UNION;} +enum {return ENUM;} +signed {return SIGNED;} +unsigned {return UNSIGNED;} +long {return LONG;} +short {return SHORT;} +int {return INT;} +float {return FLOAT;} +double {return DOUBLE;} +char {return CHAR;} +const {return CONST;} \.\.\. {return THREEDOTS;} @@ -398,24 +444,65 @@ class { virtual {yylval.line = line_no; return VIRTUAL;} signal {yylval.line = line_no; return SIGNAL;} override {yylval.line = line_no; return OVERRIDE;} -0|[1-9][0-9]*|0x[0-9a-fA-F]+|0[0-7]+|[0-9]*\.[0-9]+|\.[0-9][0-9]* { +property { + yylval.line = line_no; + BEGIN(PROPERTY_CODE); + return PROPERTY; + } +nick { yylval.line = line_no; return NICK; } +blurb { yylval.line = line_no; return BLURB; } +maximum { yylval.line = line_no; return MAXIMUM; } +minimum { yylval.line = line_no; return MINIMUM; } +default_value { yylval.line = line_no; return DEFAULT_VALUE; } +flags { yylval.line = line_no; return FLAGS; } +type { yylval.line = line_no; return TYPE; } +flags_type { yylval.line = line_no; return FLAGS_TYPE; } +enum_type { yylval.line = line_no; return ENUM_TYPE; } +param_type { yylval.line = line_no; return PARAM_TYPE; } +boxed_type { yylval.line = line_no; return BOXED_TYPE; } +object_type { yylval.line = line_no; return OBJECT_TYPE; } +[(] { + yylval.line = line_no; + property_paren_depth = 1; + BEGIN(PROPERTY_CODE_I); + return '('; + } +[(] { + yylval.line = line_no; + property_paren_depth++; + return '('; + } +[)] { + yylval.line = line_no; + property_paren_depth--; + if (property_paren_depth == 0) { + BEGIN(CLASS_CODE_I); + } + return ')'; + } + +0|[1-9][0-9]*|0x[0-9a-fA-F]+|0[0-7]+|[0-9]*\.[0-9]+|\.[0-9][0-9]* { yylval.id = g_strdup(yytext); return NUMBER; } -[A-Za-z_][A-Za-z0-9_]*(:[A-Za-z0-9_]*)+ { +[A-Za-z_][A-Za-z0-9_]*(:[A-Za-z0-9_]*)+ { /* this one is for a classname with a namespace */ yylval.id = g_strdup(yytext); return TYPETOKEN; } -:[A-Za-z_][A-Za-z0-9_]*(:[A-Za-z0-9_]*)* { +:[A-Za-z_][A-Za-z0-9_]*(:[A-Za-z0-9_]*)* { /* this is for a classname with an empty namespace */ yylval.id = g_strdup(yytext); return TYPETOKEN; } -[A-Za-z_][A-Za-z0-9_]* { +[A-Za-z_][A-Za-z0-9_]* { yylval.id = g_strdup(yytext); return TOKEN; } +\'\\.\'|\'.\' { + yylval.id = g_strdup(yytext); + return SINGLE_CHAR; + } (\[[0-9]*\]|\[[A-Za-z_][A-Za-z0-9_]*\])+ { yylval.id = g_strdup(yytext); @@ -440,7 +527,7 @@ class { return '}'; } -[\t ] ; /*ignore*/ +[\t ] ; /*ignore*/ <*>. { yylval.line = line_no; diff --git a/src/main.c b/src/main.c index d94361a..fe74942 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,7 @@ /* GOB C Preprocessor * Copyright (C) 1999,2000 the Free Software Foundation. * Copyright (C) 2000 Eazel, Inc. + * Copyright (C) 2001 George Lebl * * Author: George Lebl * @@ -55,17 +56,20 @@ static char *funcbase; static char *pfuncbase; static char *macrobase; static char *macrois; +static char *pmacrois; static char *macrotype; +static char *pmacrotype; static char *typebase; static char *ptypebase; static int signals = 0; /* number of signals */ -static int set_arguments = 0; /* number of named (set) arguments */ -static int get_arguments = 0; /* number of named (get) arguments */ +static int set_properties = 0; /* number of named (set) properties */ +static int get_properties = 0; /* number of named (get) properties */ static int overrides = 0; /* number of override methods */ static int privates = 0; /* number of private data members */ static int protecteds = 0; /* number of protected methods */ -static int destructors = 0; /* number of variable destructors */ +static int unreftors = 0; /* number of variable unreffing destructors */ +static int destructors = 0; /* number of variable non-unreffing destructors */ static int initializers = 0; /* number of variable initializers */ static gboolean overrode_get_type = FALSE; /* provided your won _get_type */ @@ -77,8 +81,8 @@ static gboolean made_aliases = FALSE; /* if we made any shorthand aliases static gboolean special_array[SPECIAL_LAST] = {0}; static gboolean any_special = FALSE; -static gboolean need_destroy = FALSE; -static Method * destroy_handler = NULL; +static gboolean need_shutdown = FALSE; +static Method * shutdown_handler = NULL; static gboolean need_finalize = FALSE; static Method * finalize_handler = NULL; @@ -94,41 +98,43 @@ gboolean no_gnu = FALSE; gboolean exit_on_warn = FALSE; gboolean exit_on_error = TRUE; gboolean got_error = FALSE; -gint private_header = PRIVATE_HEADER_ALWAYS; +gint private_header = PRIVATE_HEADER_ONDEMAND; gboolean no_extern_c = FALSE; gboolean no_write = FALSE; gboolean no_lines = FALSE; gboolean no_self_alias = FALSE; -gboolean no_kill_underscores = FALSE; gboolean always_private_struct = FALSE; int method_unique_id = 1; static void -make_bases(void) +make_bases (void) { - filebase = replace_sep(((Class *)class)->otype, '-'); - g_strdown(filebase); + filebase = replace_sep (((Class *)class)->otype, '-'); + g_strdown (filebase); - funcbase = replace_sep(((Class *)class)->otype, '_'); - g_strdown(funcbase); + funcbase = replace_sep (((Class *)class)->otype, '_'); + g_strdown (funcbase); - pfuncbase = replace_sep(((Class *)class)->ptype, '_'); - g_strdown(pfuncbase); + pfuncbase = replace_sep (((Class *)class)->ptype, '_'); + g_strdown (pfuncbase); - macrobase = replace_sep(((Class *)class)->otype, '_'); - g_strup(macrobase); + macrobase = replace_sep (((Class *)class)->otype, '_'); + g_strup (macrobase); - macrois = make_pre_macro(((Class *)class)->otype, "IS"); - macrotype = make_pre_macro(((Class *)class)->otype, "TYPE"); + macrois = make_pre_macro (((Class *)class)->otype, "IS"); + pmacrois = make_pre_macro (((Class *)class)->ptype, "IS"); - typebase = remove_sep(((Class *)class)->otype); + macrotype = make_pre_macro (((Class *)class)->otype, "TYPE"); + pmacrotype = make_pre_macro (((Class *)class)->ptype, "TYPE"); - ptypebase = remove_sep(((Class *)class)->ptype); + typebase = remove_sep (((Class *)class)->otype); + + ptypebase = remove_sep (((Class *)class)->ptype); } static char * -get_type(const Type *t, gboolean postfix_to_stars) +get_type (const Type *t, gboolean postfix_to_stars) { char *s; int i; @@ -140,31 +146,31 @@ get_type(const Type *t, gboolean postfix_to_stars) g_free(s); extra = 0; - if(postfix_to_stars) { + if (postfix_to_stars) { const char *p; /*XXX: this is ugly perhaps we can do this whole postfix thing in a nicer way, we just count the number of '[' s and from that we deduce the number of dimensions, so that we can print that many stars */ - for(p=t->postfix; p && *p; p++) + for (p = t->postfix; p && *p; p++) if(*p == '[') extra++; } g_string_append_c(gs, ' '); - if(t->pointer) { - g_string_append(gs, t->pointer); - for(i=0; i < extra; i++) - g_string_append_c(gs, '*'); - g_string_append_c(gs, ' '); + if (t->pointer != NULL) { + g_string_append (gs, t->pointer); + for (i=0; i < extra; i++) + g_string_append_c (gs, '*'); + g_string_append_c (gs, ' '); } s = gs->str; - g_string_free(gs, FALSE); + g_string_free (gs, FALSE); return s; } static char * -get_gtk_doc(const char *id) +get_gtk_doc (const char *id) { char *val; @@ -174,11 +180,11 @@ get_gtk_doc(const char *id) val = g_hash_table_lookup(gtk_doc_hash, id); if(val) return g_strdup_printf("/**\n * %s_%s:\n%s **/\n", - funcbase, get_real_id(id), val); - val = g_hash_table_lookup(gtk_doc_hash, get_real_id(id)); + funcbase, id, val); + val = g_hash_table_lookup(gtk_doc_hash, id); if(val) return g_strdup_printf("/**\n * %s_%s:\n%s **/\n", - funcbase, get_real_id(id), val); + funcbase, id, val); return NULL; } @@ -212,10 +218,7 @@ print_method (FILE *fp, out_printf(fp, "%s", typeprefix); print_type(fp, m->mtype, TRUE); - if(kill_underscore) - id = get_real_id(m->id); - else - id = m->id; + id = m->id; if(no_funcbase) out_printf(fp, "%s%s%s%s(", @@ -286,18 +289,14 @@ make_method_gnu_aliases(Class *c) m->method == OVERRIDE_METHOD) continue; - /* in C++ mode don't alias new */ - if(for_cpp && strcmp(m->id, "new")==0) - continue; - if(m->args != NULL) - out_printf(out, "#define %s(args...) " + out_printf(out, "#define self_%s(args...) " "%s_%s(args)\n", m->id, - funcbase, get_real_id(m->id)); + funcbase, m->id); else - out_printf(out, "#define %s() " + out_printf(out, "#define self_%s() " "%s_%s()\n", m->id, - funcbase, get_real_id(m->id)); + funcbase, m->id); } } } @@ -319,18 +318,14 @@ make_method_nongnu_aliases(Class *c) m->method == OVERRIDE_METHOD) continue; - /* in C++ mode don't alias new */ - if(for_cpp && strcmp(m->id, "new")==0) - continue; - if( ! local_made_aliases) out_printf(out, "\n/* Short form pointers */\n"); - print_method(out, "static ", "(* const ", "", ") ", + print_method(out, "static ", "(* const self_", "", ") ", "", "", m, FALSE, TRUE, FALSE); out_printf(out, " = %s_%s;\n", funcbase, - get_real_id(m->id)); + m->id); local_made_aliases = TRUE; } @@ -361,6 +356,7 @@ add_bad_hack_to_avoid_unused_warnings(Class *c) "static void\n" "___%s_really_bad_hack_to_avoid_warnings(void)\n" "{\n", funcbase); + out_printf(out, "\t((void (*)(void))GET_NEW_VARG)();\n"); for(li=c->nodes;li;li=g_list_next(li)) { Node *node = li->data; if(node->type == METHOD_NODE) { @@ -375,7 +371,7 @@ add_bad_hack_to_avoid_unused_warnings(Class *c) if(for_cpp && strcmp(m->id, "new")==0) continue; - out_printf(out, "\t((void (*)(void))%s)();\n", m->id); + out_printf(out, "\t((void (*)(void))self_%s)();\n", m->id); } } out_printf(out, "\t___%s_really_bad_hack_to_avoid_warnings();\n", @@ -439,15 +435,15 @@ put_signal_macro (const Method *m, gboolean gnu) if ( ! gnu) { out_printf (outh, "#define %s_SIGNAL_%s(func)\t" - "\"%s\",GTK_SIGNAL_FUNC(func)\n", - macrobase, id, get_real_id (m->id)); + "\"%s\",(GCallback)(func)\n", + macrobase, id, m->id); } else { out_printf (outh, "#define %s_SIGNAL_%s(func)\t" - "\"%s\",GTK_SIGNAL_FUNC(({", - macrobase, id, get_real_id (m->id)); + "\"%s\",(GCallback)(({", + macrobase, id, m->id); print_method (outh, "", "(* ___", "", ") ", ", gpointer data ", " = func; ", m, FALSE, TRUE, TRUE); - out_printf (outh, "___%s; }))\n", get_real_id (m->id)); + out_printf (outh, "___%s; }))\n", m->id); } g_free (id); @@ -507,10 +503,11 @@ put_priv_method_prot(Method *m) g_free(s); } else if(m->scope == PRIVATE_SCOPE || m->method == INIT_METHOD || - m->method == CLASS_INIT_METHOD) + m->method == CLASS_INIT_METHOD) { print_method(out, "static ", "", "", " ", "", no_gnu?";\n":" G_GNUC_UNUSED;\n", m, FALSE, FALSE, TRUE); + } } static GList * @@ -525,8 +522,14 @@ make_func_arg(char *typename, int is_class, char *name) else tn = g_strdup(typename); - type = new_type(tn, g_strdup("*"), NULL); - node = new_funcarg((Type *)type, name, NULL); + type = node_new (TYPE_NODE, + "name:steal", tn, + "pointer", "*", + NULL); + node = node_new (FUNCARG_NODE, + "atype:steal", (Type *)type, + "name:steal", name, + NULL); return g_list_prepend(NULL, node); } @@ -553,52 +556,60 @@ make_inits(Class *cl) } } if(!got_class_init) { - node = new_method(NO_SCOPE, CLASS_INIT_METHOD, - (Type *)new_type(g_strdup("void"), - NULL, NULL), - NULL, NULL, NULL, g_strdup("class_init"), - make_func_arg(cl->otype, TRUE, g_strdup("c")), - NULL, NULL, NULL, 0, 0, FALSE, - method_unique_id++); + Type *type = (Type *)node_new (TYPE_NODE, + "name", "void", + NULL); + node = node_new (METHOD_NODE, + "scope", NO_SCOPE, + "method", CLASS_INIT_METHOD, + "mtype:steal", type, + "id", "class_init", + "args:steal", make_func_arg (cl->otype, TRUE, g_strdup("c")), + "unique_id", method_unique_id++, + NULL); cl->nodes = g_list_prepend(cl->nodes, node); } if(!got_init) { - node = new_method(NO_SCOPE, INIT_METHOD, - (Type *)new_type(g_strdup("void"), - NULL, NULL), - NULL, NULL, NULL, g_strdup("init"), - make_func_arg(cl->otype, FALSE, g_strdup("o")), - NULL, NULL, NULL, 0, 0, FALSE, - method_unique_id++); + Type *type = (Type *)node_new (TYPE_NODE, + "name", "void", + NULL); + node = node_new (METHOD_NODE, + "scope", NO_SCOPE, + "method", INIT_METHOD, + "mtype:steal", type, + "id", "init", + "args:steal", make_func_arg (cl->otype, TRUE, g_strdup("o")), + "unique_id", method_unique_id++, + NULL); cl->nodes = g_list_prepend(cl->nodes, node); } } static void -find_destroy(Class *cl) +find_shutdown(Class *cl) { GList *li; - destroy_handler = NULL; + shutdown_handler = NULL; for(li=cl->nodes;li;li=g_list_next(li)) { Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; if(m->method == OVERRIDE_METHOD && - strcmp(m->id, "destroy")==0) { - if(strcmp(m->otype, "Gtk:Object") != 0) { + strcmp(m->id, "shutdown")==0) { + if(strcmp(m->otype, "G:Object") != 0) { error_print(GOB_ERROR, m->line_no, - "destroy method override " + "shutdown method override " "of class other then " - "Gtk:Object"); + "G:Object"); } if(g_list_length(m->args) != 1) { error_print(GOB_ERROR, m->line_no, - "destroy method override " + "shutdown method override " "with more then one " "parameter"); } - destroy_handler = m; + shutdown_handler = m; break; } } @@ -617,13 +628,11 @@ find_finalize(Class *cl) Method *m = (Method *)n; if(m->method == OVERRIDE_METHOD && strcmp(m->id, "finalize")==0) { - if(strcmp(m->otype, "Gtk:Object") != 0 && - strcmp(m->otype, "G:Object") != 0) { + if(strcmp(m->otype, "G:Object") != 0) { error_print(GOB_ERROR, m->line_no, "finalize method override " "of class other then " - "Gtk:Object (or G:Object" - "for GTK+ 2.0)"); + "G:Object"); } if(g_list_length(m->args) != 1) { error_print(GOB_ERROR, m->line_no, @@ -675,25 +684,25 @@ find_same_type_signal(Method *m) } static void -print_signal_marsal_args(Method *m) +print_signal_marsal_args (Method *m) { - if(strcmp(m->gtktypes->next->data, "NONE")!=0) { + if (strcmp (m->gtktypes->next->data, "NONE") != 0) { GList *li; int i; - for(i=0, li=m->gtktypes->next;li; - i++, li=g_list_next(li)) { - if(!for_cpp) - out_printf(out, ",\n\t\tGTK_VALUE_%s(args[%d])", - (char *)li->data, i); - else { - out_printf(out, ",\n\t\t(%s)" - "GTK_VALUE_%s(args[%d])", - get_cast(li->data, FALSE), - (char *)li->data, i); - } + for (i = 0, li = m->gtktypes->next; + li != NULL; + i++, li = li->next) { + char *get_func = g_strdup_printf + ("g_value_get_%s", (char *)li->data); + g_strdown (get_func); + out_printf (out, ",\n\t\t(%s) " + "%s (param_values + %d)", + get_cast (li->data, FALSE), + get_func, i + 1); + g_free (get_func); } } - out_printf(out, ",\n\t\tfunc_data);\n}\n\n"); + out_printf (out, ",\n\t\tdata2);\n"); } @@ -704,25 +713,37 @@ add_signal_prots(Method *m) static int sig = 1; char *s; Method *mm; + gboolean ret_none = FALSE; + gboolean arglist_none = FALSE; + const char *retcast; - if(m->method != SIGNAL_LAST_METHOD && - m->method != SIGNAL_FIRST_METHOD) + if (m->method != SIGNAL_LAST_METHOD && + m->method != SIGNAL_FIRST_METHOD) return; - if(!marsh) + if (marsh == NULL) marsh = g_hash_table_new(NULL, NULL); + + g_assert (m->gtktypes->next != NULL); + + ret_none = strcmp(m->gtktypes->data, "NONE") == 0; + arglist_none = strcmp(m->gtktypes->next->data, "NONE") == 0; - if(strcmp(m->gtktypes->data, "NONE")==0 && - strcmp(m->gtktypes->next->data, "NONE")==0) + if (ret_none && arglist_none) return; /* if we already did a signal prototype just use that */ - mm = find_same_type_signal(m); - if(mm) { - s = g_hash_table_lookup(marsh, mm); - g_hash_table_insert(marsh, m, s); + mm = find_same_type_signal (m); + if (mm != NULL) { + s = g_hash_table_lookup (marsh, mm); + g_hash_table_insert (marsh, m, s); return; } + + if (ret_none) + retcast = NULL; + else + retcast = get_cast (m->gtktypes->data, FALSE); s = g_strdup_printf("Sig%d", sig++); @@ -733,36 +754,71 @@ add_signal_prots(Method *m) out_printf(out, "\ntypedef %s (*___%s) (%s *, ", get_cast(m->gtktypes->data, FALSE), s, typebase); - if(strcmp(m->gtktypes->next->data, "NONE")!=0) { - for(li=m->gtktypes->next; li; li=g_list_next(li)) - out_printf(out, "%s, ", get_cast(li->data, FALSE)); + if ( ! arglist_none) { + for (li = m->gtktypes->next; li != NULL; li = li->next) + out_printf (out, "%s, ", get_cast (li->data, FALSE)); } - out_printf(out, "gpointer);\n"); + out_printf (out, "gpointer);\n"); - out_printf(out, "\nstatic void\n" - "___marshal_%s (GtkObject * object,\n" - "\tGtkSignalFunc func,\n" - "\tgpointer func_data,\n" - "\tGtkArg * args)\n" - "{\n", s); + out_printf (out, "\nstatic void\n" + "___marshal_%s (GClosure *closure,\n" + "\tGValue *return_value,\n" + "\tguint n_param_values,\n" + "\tconst GValue *param_values,\n" + "\tgpointer invocation_hint,\n" + "\tgpointer marshal_data)\n" + "{\n", s); + + if ( ! ret_none) + out_printf (out, "\t%s v_return;\n", retcast); + + out_printf (out, "\tregister ___%s callback;\n" + "\tregister GCClosure *cc = (GCClosure*) closure;\n" + "\tregister gpointer data1, data2;\n\n", + s); + + out_printf (out, "\tg_return_if_fail (n_param_values == %d);\n\n", + arglist_none ? 1 : g_list_length (m->gtktypes)); + + out_printf (out, + "\tif (G_CCLOSURE_SWAP_DATA (closure)) {\n" + "\t\tdata1 = closure->data;\n" + "\t\tdata2 = g_value_peek_pointer (param_values + 0);\n" + "\t} else {\n" + "\t\tdata1 = g_value_peek_pointer (param_values + 0);\n" + "\t\tdata2 = closure->data;\n" + "\t}\n\n"); + + out_printf (out, "\tcallback = (___%s) " + "(marshal_data != NULL ? marshal_data : cc->callback);" + "\n\n", s); - if(strcmp(m->gtktypes->data, "NONE")==0) { - out_printf(out, "\t___%s rfunc;\n\n" - "\trfunc = (___%s)func;\n\n" - "\t(*rfunc)((%s *)object", s, s, typebase); + if (ret_none) { + out_printf (out, "\tcallback ((%s *)data1", typebase); } else { - const char *retcast = get_cast(m->gtktypes->data, FALSE); - out_printf(out, - "\t___%s rfunc;\n\t" - "%s *retval;\n\n" - "\trfunc = (___%s)func;\n\n" - "\tretval = GTK_RETLOC_%s(args[%d]);\n\n" - "\t*retval = (*rfunc)((%s *)object", - s, retcast, s, (char *)m->gtktypes->data, - g_list_length(m->gtktypes)-1, typebase); + out_printf (out, "\tv_return = callback ((%s *)data1", + typebase); } - print_signal_marsal_args(m); + print_signal_marsal_args (m); + + if ( ! ret_none) { + /* FIXME: This code is so fucking ugly it hurts */ + gboolean take_ownership = + (strcmp ((char *)m->gtktypes->data, "STRING") == 0 || + strcmp ((char *)m->gtktypes->data, "BOXED") == 0); + char *set_func = g_strdup_printf ("g_value_set_%s%s", + (char *)m->gtktypes->data, + take_ownership ? + "_take_ownership" : ""); + g_strdown (set_func); + + out_printf (out, "\n\t%s (return_value, v_return);\n", + set_func); + + g_free (set_func); + } + out_printf (out, "}\n\n"); } static void @@ -778,7 +834,7 @@ add_enums(Class *c) Method *m = (Method *)n; if(m->method == SIGNAL_LAST_METHOD || m->method == SIGNAL_FIRST_METHOD) { - char *s = g_strdup(get_real_id(m->id)); + char *s = g_strdup(m->id); g_strup(s); out_printf(out, "\t%s_SIGNAL,\n", s); g_free(s); @@ -787,22 +843,29 @@ add_enums(Class *c) } out_printf(out, "\tLAST_SIGNAL\n};\n\n"); } - if(set_arguments > 0 || get_arguments > 0) { - out_printf(out, "enum {\n\tARG_0"); + if (set_properties > 0 || + get_properties > 0) { + out_printf(out, "enum {\n\tPROP_0"); for(li=c->nodes;li;li=g_list_next(li)) { Node *n = li->data; - if(n->type == ARGUMENT_NODE) { + if (n->type == PROPERTY_NODE) { + Property *p = (Property *)n; + char *s = g_strdup (p->name); + g_strup (s); + out_printf (out, ",\n\tPROP_%s", s); + g_free(s); + } else if (n->type == ARGUMENT_NODE) { Argument *a = (Argument *)n; char *s = g_strdup(a->name); g_strup(s); - out_printf(out, ",\n\tARG_%s", s); + out_printf(out, ",\n\tPROP_%s", s); g_free(s); } } out_printf(out, "\n};\n\n"); } - if(signals>0) + if (signals > 0) out_printf(out, "static guint object_signals[LAST_SIGNAL] = {0};\n\n"); @@ -813,7 +876,51 @@ add_enums(Class *c) static void add_get_type(void) { - char *chunk_size = ((Class*)class)->chunk_size; + /*char *chunk_size = ((Class*)class)->chunk_size;*/ + + out_printf(out, + "GType\n" + "%s_get_type (void)\n" + "{\n" + "\tstatic GType type = 0;\n\n" + "\tif (type == 0) {\n" + "\t\tstatic const GTypeInfo info = {\n" + "\t\t\tsizeof (%sClass),\n" + "\t\t\t(GBaseInitFunc) NULL,\n" + "\t\t\t(GBaseFinalizeFunc) NULL,\n" + "\t\t\t(GClassInitFunc) %s_class_init,\n" + "\t\t\t(GClassFinalizeFunc) NULL,\n" + "\t\t\tNULL /* class_data */,\n" + "\t\t\tsizeof (%s),\n" + "\t\t\t0 /* n_preallocs */,\n" + "\t\t\t(GInstanceInitFunc) %s_init,\n" + "\t\t};\n\n" + "\t\ttype = g_type_register_static (%s, \"%s\", &info, (GTypeFlags)0);\n", + funcbase, typebase, funcbase, typebase, funcbase, + pmacrotype, typebase); + /* + if(chunk_size) { + out_printf(out, + "#if %s > 0\n" + "\t\tgtk_type_set_chunk_alloc(type, %s);\n" + "#endif\n", + chunk_size, chunk_size); + } + */ + out_printf(out, + "\t}\n\n" + "\treturn type;\n" + "}\n\n"); +} + +static void +add_bonobo_x_get_type (void) +{ + /* char *chunk_size = ((Class*)class)->chunk_size; */ + + out_printf(out, + "\n#error \"BonoboX isn't ported to glib 2.0 and " + "gob2 doesn't support it yet\""); out_printf(out, "GtkType\n" @@ -831,16 +938,22 @@ add_get_type(void) "\t\t\t/* reserved_2 */ NULL,\n" "\t\t\t(GtkClassInitFunc) NULL\n" "\t\t};\n\n" - "\t\ttype = gtk_type_unique (%s_get_type(), &info);\n", + "\t\ttype = bonobo_x_type_unique\n" + "\t\t\t(%s_get_type (),\n" + "\t\t\tPOA_%s__init, NULL,\n" + "\t\t\tGTK_STRUCT_OFFSET (%sClass, _epv),\n" + "\t\t\t&info);\n", funcbase, typebase, typebase, typebase, - funcbase, funcbase, pfuncbase); - if(chunk_size) { + funcbase, funcbase, pfuncbase, + ((Class*)class)->bonobo_x_class, + typebase); + /*if(chunk_size) { out_printf(out, "#if %s > 0\n" "\t\tgtk_type_set_chunk_alloc(type, %s);\n" "#endif\n", chunk_size, chunk_size); - } + }*/ out_printf(out, "\t}\n\n" "\treturn type;\n" @@ -848,20 +961,19 @@ add_get_type(void) } static void -add_overrides(Class *c, const char *oname, gboolean did_base_obj) +add_overrides(Class *c, const char *oname, + gboolean did_base_obj) { GList *li; GHashTable *done; char *s; - done = g_hash_table_new(g_str_hash, g_str_equal); - if(did_base_obj) { - s = g_strdup("GtkObject"); /* This was already done */ - g_hash_table_insert(done, s, s); - s = g_strdup("GObject"); /* This was probably already done as well (if using Gtk/Glib 1.3/2.0) */ - g_hash_table_insert(done, s, s); + done = g_hash_table_new (g_str_hash, g_str_equal); + if (did_base_obj) { + s = g_strdup ("GObject"); + g_hash_table_insert (done, s, s); } - for(li=c->nodes; li; li=g_list_next(li)) { + for (li = c->nodes; li != NULL; li = li->next) { Node *n = li->data; char *f; Method *m = (Method *)n; @@ -885,8 +997,8 @@ add_overrides(Class *c, const char *oname, gboolean did_base_obj) g_free(f); } - g_hash_table_foreach(done, (GHFunc)g_free, NULL); - g_hash_table_destroy(done); + g_hash_table_foreach (done, (GHFunc)g_free, NULL); + g_hash_table_destroy (done); } static char * @@ -895,10 +1007,11 @@ make_run_signal_flags(Method *m, gboolean last) GList *li; GString *gs; char *flags[] = { - "FIRST", - "LAST", - "BOTH", + "RUN_FIRST", + "RUN_LAST", + "RUN_CLEANUP", "NO_RECURSE", + "DETAILED", "ACTION", "NO_HOOKS", NULL @@ -907,12 +1020,12 @@ make_run_signal_flags(Method *m, gboolean last) gs = g_string_new(NULL); if(last) - g_string_assign(gs, "GTK_RUN_LAST"); + g_string_assign(gs, "G_SIGNAL_RUN_LAST"); else - g_string_assign(gs, "GTK_RUN_FIRST"); + g_string_assign(gs, "G_SIGNAL_RUN_FIRST"); if(m->scope == PUBLIC_SCOPE) - g_string_append(gs, " | GTK_RUN_ACTION"); + g_string_append(gs, " | G_SIGNAL_ACTION"); for(li = m->flags; li; li = li->next) { char *flag = li->data; @@ -928,7 +1041,7 @@ make_run_signal_flags(Method *m, gboolean last) "perhaps it was misspelled", flag); } - g_string_sprintfa(gs, " | GTK_RUN_%s", flag); + g_string_sprintfa(gs, " | G_SIGNAL_%s", flag); } { @@ -966,25 +1079,26 @@ add_signals(Class *c) (char *)g_hash_table_lookup(marsh, m), NULL); else - mar = g_strdup("gtk_signal_default_marshaller"); + mar = g_strdup("g_cclosure_marshal_VOID__VOID"); is_none = (strcmp(m->gtktypes->next->data, "NONE")==0); - sig = g_strdup(get_real_id(m->id)); - g_strup(sig); - flags = make_run_signal_flags(m, last); - out_printf(out, "\tobject_signals[%s_SIGNAL] =\n" - "\t\tgtk_signal_new (\"%s\",\n" - "\t\t\t(GtkSignalRunType)(%s),\n" - "\t\t\tGTK_CLASS_TYPE(gtk_object_class),\n" - "\t\t\tGTK_SIGNAL_OFFSET (%sClass, %s),\n" - "\t\t\t%s,\n" - "\t\t\tGTK_TYPE_%s, %d", - sig, get_real_id(m->id), - flags, - typebase, get_real_id(m->id), mar, - (char *)m->gtktypes->data, - is_none ? 0 : g_list_length(m->gtktypes->next)); + sig = g_strdup (m->id); + g_strup (sig); + flags = make_run_signal_flags (m, last); + out_printf (out, "\tobject_signals[%s_SIGNAL] =\n" + "\t\tg_signal_new (\"%s\",\n" + "\t\t\tG_TYPE_FROM_CLASS (g_object_class),\n" + "\t\t\t(GSignalFlags)(%s),\n" + "\t\t\tG_STRUCT_OFFSET (%sClass, %s),\n" + "\t\t\tNULL, NULL,\n" + "\t\t\t%s,\n" + "\t\t\tG_TYPE_%s, %d", + sig, m->id, + flags, + typebase, m->id, mar, + (char *)m->gtktypes->data, + is_none ? 0 : g_list_length(m->gtktypes->next)); g_free(mar); g_free(sig); g_free(flags); @@ -992,7 +1106,7 @@ add_signals(Class *c) if( ! is_none) { GList *l; for(l = m->gtktypes->next; l != NULL; l = l->next) - out_printf(out, ",\n\t\t\tGTK_TYPE_%s", + out_printf(out, ",\n\t\t\tG_TYPE_%s", (char *)l->data); } @@ -1035,12 +1149,10 @@ add_signals(Class *c) "\t\tg_error(\"%s line %d: Type mismatch " "of \\\"%s\\\" signal signature\");\n" "\t}\n", - filename, m->line_no, get_real_id(m->id)); + filename, m->line_no, m->id); } } - out_printf(out, "\tgtk_object_class_add_signals (gtk_object_class,\n" - "\t\tobject_signals, LAST_SIGNAL);\n\n"); } static void @@ -1070,41 +1182,37 @@ set_def_handlers(Class *c, const char *oname) } - if(m->method == OVERRIDE_METHOD) { + if (m->method == OVERRIDE_METHOD) { char *s; - s = replace_sep(m->otype, '_'); - g_strdown(s); - - if(need_destroy && - destroy_handler && - strcmp(get_real_id(m->id), "destroy") == 0) - out_printf(out, "\tgtk_object_class->destroy " - "= ___destroy;\n"); - else if(need_finalize && + s = replace_sep (m->otype, '_'); + g_strdown (s); + + if (need_shutdown && + shutdown_handler != NULL && + strcmp (m->id, "shutdown") == 0) + out_printf (out, "\tg_object_class->shutdown " + "= ___shutdown;\n"); + else if (need_finalize && finalize_handler && - strcmp(get_real_id(m->id), "finalize") == 0) + strcmp(m->id, "finalize") == 0) out_printf(out, - "#ifdef G_OBJECT_CLASS\n" - "\tg_object_class->finalize = ___finalize;\n" - "#else /* !G_OBJECT_CLASS */\n" - "\tgtk_object_class->finalize = ___finalize;\n" - "#endif /* G_OBJECT_CLASS */\n"); - else if(m->cbuf) + "\tg_object_class->finalize = ___finalize;\n"); + else if (m->cbuf != NULL) out_printf(out, "\t%s_class->%s = ___%x_%s_%s;\n", - s, get_real_id(m->id), (guint)m->unique_id, - funcbase, get_real_id(m->id)); + s, m->id, (guint)m->unique_id, + funcbase, m->id); else out_printf(out, "\t%s_class->%s = NULL;\n", - s, get_real_id(m->id)); + s, m->id); } else { if(m->cbuf) out_printf(out, "\t%s->%s = ___real_%s_%s;\n", - oname, get_real_id(m->id), - funcbase, get_real_id(m->id)); + oname, m->id, + funcbase, m->id); else out_printf(out, "\t%s->%s = NULL;\n", - oname, get_real_id(m->id)); + oname, m->id); } } if(set_line) @@ -1112,9 +1220,11 @@ set_def_handlers(Class *c, const char *oname) } static void -make_arguments(Class *c) +make_argument (Argument *a) { - GList *li; + GString *flags; + GList *l; + char *s; char *argflags[] = { "CONSTRUCT", "CONSTRUCT_ONLY", @@ -1123,68 +1233,482 @@ make_arguments(Class *c) NULL }; - out_printf(out, "\n"); - for(li=c->nodes;li;li=g_list_next(li)) { - Node *n = li->data; - Argument *a; - GString *flags; - GList *l; - char *s; - if(n->type != ARGUMENT_NODE) + flags = g_string_new ("(GParamFlags)("); + + if(a->get && a->set) + g_string_append (flags, "G_PARAM_READABLE | G_PARAM_WRITABLE"); + else if(a->get) + g_string_append (flags, "G_PARAM_READABLE"); + else + g_string_append (flags, "G_PARAM_WRITABLE"); + + g_assert(a->get || a->set); + + for (l = a->flags; l != NULL; l = l->next) { + char *flag = l->data; + int i; + if(strcmp (flag, "READABLE") == 0 || + strcmp (flag, "WRITABLE") == 0) { + error_print(GOB_WARN, a->line_no, + "READABLE and " + "WRITABLE argument flags are " + "set automatically"); continue; + } + for(i = 0; argflags[i]; i++) { + if(strcmp(argflags[i], flag)==0) + break; + } + /* if we haven't found it in our list */ + if( ! argflags[i]) { + error_printf(GOB_WARN, a->line_no, + "Unknown flag '%s' used, " + "perhaps it was misspelled", flag); + } + g_string_sprintfa(flags, " | G_PARAM_%s", flag); + } - a = (Argument *)n; - - if(a->get && a->set) - flags = g_string_new("GTK_ARG_READWRITE"); - else if(a->get) - flags = g_string_new("GTK_ARG_READABLE"); - else - flags = g_string_new("GTK_ARG_WRITABLE"); + g_string_append (flags, ")"); - g_assert(a->get || a->set); - - for(l=a->flags;l;l=g_list_next(l)) { - char *flag = l->data; - int i; - if(strcmp(flag, "READWRITE")==0 || - strcmp(flag, "READABLE")==0 || - strcmp(flag, "WRITABLE")==0) { - error_print(GOB_WARN, a->line_no, - "READWRITE, READABLE and " - "WRITABLE argument flags are " - "set automatically"); - continue; - } - for(i = 0; argflags[i]; i++) { - if(strcmp(argflags[i], flag)==0) - break; - } - /* if we haven't found it in our list */ - if( ! argflags[i]) { - error_printf(GOB_WARN, a->line_no, - "Unknown flag '%s' used, " - "perhaps it was misspelled", flag); - } - g_string_sprintfa(flags, " | GTK_ARG_%s", flag); + s = g_strdup(a->name); + g_strup(s); + if (!strcmp (a->gtktype, "ENUM")) + out_printf(out, "\tparam_spec = g_param_spec_enum (\"%s\", NULL, NULL,\n" + "\t\tG_TYPE_ENUM, 0,\n" + "\t\t%s);\n", + a->name, flags->str); + if (!strcmp (a->gtktype, "FLAGS")) + out_printf(out, "\tparam_spec = g_param_spec_flags (\"%s\", NULL, NULL,\n" + "\t\tG_TYPE_FLAGS, 0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "OBJECT")) + out_printf(out, "\tparam_spec = g_param_spec_object (\"%s\", NULL, NULL,\n" + "\t\tG_TYPE_OBJECT,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "STRING")) + out_printf(out, "\tparam_spec = g_param_spec_string (\"%s\", NULL, NULL,\n" + "\t\tNULL,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "INT")) + out_printf(out, "\tparam_spec = g_param_spec_int (\"%s\", NULL, NULL,\n" + "\t\tG_MININT, G_MAXINT,\n" + "\t\t0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "UINT")) + out_printf(out, "\tparam_spec = g_param_spec_uint (\"%s\", NULL, NULL,\n" + "\t\t0, G_MAXUINT,\n" + "\t\t0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "INT")) + out_printf(out, "\tparam_spec = g_param_spec_int (\"%s\", NULL, NULL,\n" + "\t\tG_MININT, G_MAXINT,\n" + "\t\t0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "CHAR")) + out_printf(out, "\tparam_spec = g_param_spec_char (\"%s\", NULL, NULL,\n" + "\t\t-128, 127,\n" + "\t\t0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "UCHAR")) + out_printf(out, "\tparam_spec = g_param_spec_uchar (\"%s\", NULL, NULL,\n" + "\t\t0, 0xFF,\n" + "\t\t0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "BOOL") || + !strcmp (a->gtktype, "BOOLEAN")) + out_printf(out, "\tparam_spec = g_param_spec_boolean (\"%s\", NULL, NULL,\n" + "\t\tFALSE,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "LONG")) + out_printf(out, "\tparam_spec = g_param_spec_long (\"%s\", NULL, NULL,\n" + "\t\tG_MINLONG, G_MAXLONG,\n" + "\t\t0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "ULONG")) + out_printf(out, "\tparam_spec = g_param_spec_ulong (\"%s\", NULL, NULL,\n" + "\t\t0, G_MAXULONG,\n" + "\t\t0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "FLOAT")) + out_printf(out, "\tparam_spec = g_param_spec_float (\"%s\", NULL, NULL,\n" + "\t\tG_MINFLOAT, G_MAXFLOAT,\n" + "\t\t0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "DOUBLE")) + out_printf(out, "\tparam_spec = g_param_spec_double (\"%s\", NULL, NULL,\n" + "\t\tG_MINDOUBLE, G_MAXDOUBLE,\n" + "\t\t0,\n" + "\t\t%s);\n", + a->name, flags->str); + else if (!strcmp (a->gtktype, "POINTER")) + out_printf(out, "\tparam_spec = g_param_spec_pointer (\"%s\", NULL, NULL,\n" + "\t\t%s);\n", + a->name, flags->str); + else + error_printf (GOB_ERROR, a->line_no, + "%s type is not supported for arguments, try using properties", + a->gtktype); + + out_printf(out, "\tg_object_class_install_property (g_object_class,\n" + "\t\tPROP_%s, param_spec);\n", s); + + + g_free(s); + g_string_free(flags, TRUE); +} + +#define value_for_print(str, alt) (str != NULL ? str : alt) + +static void +make_property (Property *p) +{ + GString *flags; + GList *l; + char *s; + char *argflags[] = { + "CONSTRUCT", + "CONSTRUCT_ONLY", + "CHILD_ARG", + "MASK", + NULL + }; + + flags = g_string_new ("(GParamFlags)("); + + if (p->get != NULL && p->set != NULL) + g_string_append (flags, "G_PARAM_READABLE | G_PARAM_WRITABLE"); + else if (p->get != NULL) + g_string_append (flags, "G_PARAM_READABLE"); + else + g_string_append (flags, "G_PARAM_WRITABLE"); + + if (p->get == NULL && p->set == NULL) { + error_print (GOB_ERROR, p->line_no, + "Property has no getter nor setter"); + } + + for (l = p->flags; l != NULL; l = l->next) { + char *flag = l->data; + int i; + if(strcmp (flag, "READABLE") == 0 || + strcmp (flag, "WRITABLE") == 0) { + error_print(GOB_WARN, p->line_no, + "READABLE and " + "WRITABLE argument flags are " + "set automatically"); + continue; + } + for(i = 0; argflags[i]; i++) { + if(strcmp(argflags[i], flag)==0) + break; } + /* if we haven't found it in our list */ + if( ! argflags[i]) { + error_printf(GOB_WARN, p->line_no, + "Unknown flag '%s' used, " + "perhaps it was misspelled", flag); + } + g_string_sprintfa(flags, " | G_PARAM_%s", flag); + } + + g_string_append (flags, ")"); + + if (strcmp (p->gtktype, "CHAR") == 0) + out_printf (out, "\tparam_spec = g_param_spec_char\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* minimum */,\n" + "\t\t %s /* maximum */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->minimum, "-128"), + value_for_print (p->maximum, "127"), + value_for_print (p->default_value, "0"), + flags->str); + else if (strcmp (p->gtktype, "UCHAR") == 0) + out_printf (out, "\tparam_spec = g_param_spec_uchar\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* minimum */,\n" + "\t\t %s /* maximum */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->minimum, "0"), + value_for_print (p->maximum, "0xFF"), + value_for_print (p->default_value, "0"), + flags->str); + else if (strcmp (p->gtktype, "BOOLEAN") == 0) + out_printf (out, "\tparam_spec = g_param_spec_boolean\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->default_value, "FALSE"), + flags->str); + else if (strcmp (p->gtktype, "INT") == 0) + out_printf (out, "\tparam_spec = g_param_spec_int\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* minimum */,\n" + "\t\t %s /* maximum */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->minimum, "G_MININT"), + value_for_print (p->maximum, "G_MAXINT"), + value_for_print (p->default_value, "0"), + flags->str); + else if (strcmp (p->gtktype, "UINT") == 0) + out_printf (out, "\tparam_spec = g_param_spec_uint\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* minimum */,\n" + "\t\t %s /* maximum */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->minimum, "0"), + value_for_print (p->maximum, "G_MAXUINT"), + value_for_print (p->default_value, "0"), + flags->str); + else if (strcmp (p->gtktype, "LONG") == 0) + out_printf (out, "\tparam_spec = g_param_spec_long\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* minimum */,\n" + "\t\t %s /* maximum */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->minimum, "G_MINLONG"), + value_for_print (p->maximum, "G_MAXLONG"), + value_for_print (p->default_value, "0"), + flags->str); + else if (strcmp (p->gtktype, "ULONG") == 0) + out_printf (out, "\tparam_spec = g_param_spec_ulong\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* minimum */,\n" + "\t\t %s /* maximum */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->minimum, "0"), + value_for_print (p->maximum, "G_MAXULONG"), + value_for_print (p->default_value, "0"), + flags->str); + else if (strcmp (p->gtktype, "UNICHAR") == 0) + out_printf (out, "\tparam_spec = g_param_spec_unichar\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->default_value, "0"), + flags->str); + else if (strcmp (p->gtktype, "ENUM") == 0) + out_printf (out, "\tparam_spec = g_param_spec_enum\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* enum_type */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->extra_gtktype, "G_TYPE_ENUM"), + value_for_print (p->default_value, "0"), + flags->str); + else if (strcmp (p->gtktype, "FLAGS") == 0) + out_printf (out, "\tparam_spec = g_param_spec_flags\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* flags_type */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->extra_gtktype, "G_TYPE_FLAGS"), + value_for_print (p->default_value, "0"), + flags->str); + else if (strcmp (p->gtktype, "FLOAT") == 0) + out_printf (out, "\tparam_spec = g_param_spec_float\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* minimum */,\n" + "\t\t %s /* maximum */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->minimum, "G_MINFLOAT"), + value_for_print (p->maximum, "G_MAXFLOAT"), + value_for_print (p->default_value, "0.0"), + flags->str); + else if (strcmp (p->gtktype, "DOUBLE") == 0) + out_printf (out, "\tparam_spec = g_param_spec_double\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* minimum */,\n" + "\t\t %s /* maximum */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->minimum, "G_MINDOUBLE"), + value_for_print (p->maximum, "G_MAXDOUBLE"), + value_for_print (p->default_value, "0.0"), + flags->str); + else if (strcmp (p->gtktype, "STRING") == 0) + out_printf (out, "\tparam_spec = g_param_spec_string\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* default_value */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->default_value, "NULL"), + flags->str); + else if (strcmp (p->gtktype, "PARAM") == 0) + out_printf (out, "\tparam_spec = g_param_spec_param\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* param_type */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->extra_gtktype, "G_TYPE_PARAM"), + flags->str); + else if (strcmp (p->gtktype, "BOXED") == 0) + out_printf (out, "\tparam_spec = g_param_spec_boxed\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* boxed_type */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->extra_gtktype, "G_TYPE_BOXED"), + flags->str); + else if (strcmp (p->gtktype, "POINTER") == 0) + out_printf (out, "\tparam_spec = g_param_spec_pointer\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + flags->str); + /* FIXME: VALUE_ARRAY */ + else if (strcmp (p->gtktype, "CLOSURE") == 0) + out_printf (out, "\tparam_spec = g_param_spec_pointer\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + flags->str); + else if (strcmp (p->gtktype, "OBJECT") == 0) + out_printf (out, "\tparam_spec = g_param_spec_object\n" + "\t\t(\"%s\" /* name */,\n" + "\t\t %s /* nick */,\n" + "\t\t %s /* blurb */,\n" + "\t\t %s /* object_type */,\n" + "\t\t %s);\n", + p->name, + value_for_print (p->nick, "NULL"), + value_for_print (p->blurb, "NULL"), + value_for_print (p->extra_gtktype, "G_TYPE_OBJECT"), + flags->str); + else + error_printf (GOB_ERROR, p->line_no, + "%s type is not supported by properties", + p->gtktype); + + s = g_strdup (p->name); + g_strup (s); + out_printf (out, "\tg_object_class_install_property (g_object_class,\n" + "\t\tPROP_%s,\n" + "\t\tparam_spec);\n", s); + g_free (s); + + g_string_free (flags, TRUE); +} - s = g_strdup(a->name); - g_strup(s); - out_printf(out, "\tgtk_object_add_arg_type(\"%s::%s\",\n" - "\t\tGTK_TYPE_%s,\n" - "\t\t%s,\n" - "\t\tARG_%s);\n", - typebase, a->name, a->gtktype, flags->str, s); - g_free(s); - g_string_free(flags, TRUE); +static void +make_arguments(Class *c) +{ + GList *li; + out_printf (out, " {\n" + "\tGParamSpec *param_spec;\n\n"); + + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + if (n->type == PROPERTY_NODE) + make_property ((Property *)n); + else if (n->type == ARGUMENT_NODE) + make_argument ((Argument *)n); } + out_printf(out, " }\n"); - out_printf(out, "\n"); - if(get_arguments > 0) - out_printf(out, "\tgtk_object_class->get_arg = ___object_get_arg;\n"); - if(set_arguments > 0) - out_printf(out, "\tgtk_object_class->set_arg = ___object_set_arg;\n"); + if (get_properties > 0) + out_printf(out, "\tg_object_class->get_property = ___object_get_property;\n"); + if (set_properties > 0) + out_printf(out, "\tg_object_class->set_property = ___object_set_property;\n"); } static void @@ -1214,7 +1738,7 @@ print_initializer(Method *m, Variable *v) } static void -print_destructor(Variable *v) +print_destructor (Variable *v) { char *root; @@ -1239,7 +1763,8 @@ print_destructor(Variable *v) if(v->destructor_line > 0) out_addline_outfile(out); } else { - out_printf(out, "#define VAR (%s->%s)\n", root, v->id); + out_printf(out, "#define %s (%s->%s)\n", v->id, root, v->id); + out_printf(out, "#define VAR %s\n", v->id); out_printf(out, "\t{\n"); if(v->destructor_line > 0) out_addline_infile(out, v->destructor_line); @@ -1248,80 +1773,80 @@ print_destructor(Variable *v) if(v->destructor_line > 0) out_addline_outfile(out); - out_printf(out, "\tmemset(&VAR, 0, sizeof(VAR));\n"); + out_printf(out, "\tmemset(&%s, 0, sizeof(%s));\n", + v->id, v->id); out_printf(out, "#undef VAR\n"); + out_printf(out, "#undef %s\n", v->id); } } static void -add_destroy(Class *c) +add_shutdown (Class *c) { out_printf(out, "\nstatic void\n" - "___destroy(GtkObject *obj_self)\n" + "___shutdown (GObject *obj_self)\n" "{\n"); out_printf(out, - "#define __GOB_FUNCTION__ \"%s::destroy\"\n", + "#define __GOB_FUNCTION__ \"%s::shutdown\"\n", c->otype); - if(destructors > 0) { - out_printf(out, "\t%s *self = %s (obj_self);\n", - typebase, macrobase); + if (unreftors > 0) { + out_printf (out, "\t%s *self = %s (obj_self);\n", + typebase, macrobase); } - if(destroy_handler) { + if (shutdown_handler != NULL) { /* so we get possible bad argument warning */ - if(destroy_handler->line_no > 0) - out_addline_infile(out, destroy_handler->line_no); - out_printf(out, "\t___%x_%s_destroy(obj_self);\n", - (guint)destroy_handler->unique_id, funcbase); - if(destroy_handler->line_no > 0) - out_addline_outfile(out); + if (shutdown_handler->line_no > 0) + out_addline_infile (out, shutdown_handler->line_no); + out_printf (out, "\t___%x_%s_shutdown(obj_self);\n", + (guint)shutdown_handler->unique_id, funcbase); + if (shutdown_handler->line_no > 0) + out_addline_outfile (out); } else { - out_printf(out, - "\tif(GTK_OBJECT_CLASS(parent_class)->destroy) \\\n" - "\t\t(* GTK_OBJECT_CLASS(parent_class)->destroy)(obj_self);\n"); + out_printf (out, + "\tif (G_OBJECT_CLASS (parent_class)->shutdown) \\\n" + "\t\t(* G_OBJECT_CLASS (parent_class)->shutdown) (obj_self);\n"); } - if(destructors > 0) { + if (unreftors > 0) { GList *li; for(li = ((Class *)class)->nodes; li != NULL; li = li->next) { Node *n = li->data; Variable *v = (Variable *)n; - if(n->type == VARIABLE_NODE && - v->scope != CLASS_SCOPE) - print_destructor(v); + if (n->type == VARIABLE_NODE && + v->scope != CLASS_SCOPE && + v->destructor_unref) + print_destructor (v); } } - out_printf(out, "\treturn;\n"); - if(destructors > 0) + out_printf (out, "\treturn;\n"); + if (unreftors > 0) out_printf(out, "\tself = NULL;\n"); out_printf(out, "}\n" "#undef __GOB_FUNCTION__\n\n"); } static void -add_finalize(Class *c) +add_finalize (Class *c) { - /* Sort of a hack to make it work with gtk+ 1.3/2.0 */ out_printf(out, - "\n#ifdef G_OBJECT_CLASS\n" - "static void\n" + "\nstatic void\n" "___finalize(GObject *obj_self)\n" - "#else /* !G_OBJECT_CLASS */\n" - "static void\n" - "___finalize(GtkObject *obj_self)\n" - "#endif /* G_OBJECT_CLASS */\n" "{\n"); out_printf(out, "#define __GOB_FUNCTION__ \"%s::finalize\"\n", c->otype); - if(privates > 0) { + if (privates > 0 || + destructors > 0) { out_printf(out, "\t%s *self = %s (obj_self);\n", typebase, macrobase); + } + if (privates > 0) { out_printf(out, "\tgpointer priv = self->_priv;\n"); } @@ -1334,25 +1859,67 @@ add_finalize(Class *c) if(finalize_handler->line_no > 0) out_addline_outfile(out); } else { - /* Sort of a hack to make it work with gtk+ 1.3/2.0 */ out_printf(out, - "#ifdef G_OBJECT_CLASS\n" "\tif(G_OBJECT_CLASS(parent_class)->finalize) \\\n" - "\t\t(* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);\n" - "#else /* !G_OBJECT_CLASS */\n" - "\tif(GTK_OBJECT_CLASS(parent_class)->finalize) \\\n" - "\t\t(* GTK_OBJECT_CLASS(parent_class)->finalize)(obj_self);\n" - "#endif /* G_OBJECT_CLASS */\n"); + "\t\t(* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);\n"); + } + + if (destructors > 0) { + GList *li; + for (li = ((Class *)class)->nodes; + li != NULL; + li = li->next) { + Node *n = li->data; + Variable *v = (Variable *)n; + if (n->type == VARIABLE_NODE && + v->scope != CLASS_SCOPE && + ! v->destructor_unref) + print_destructor (v); + } } - if(privates > 0) { - out_printf(out, "\tg_free(priv);\n"); + if (privates > 0) { + out_printf(out, "\tg_free (priv);\n"); } + out_printf (out, "\treturn;\n"); + if (destructors > 0 || + privates > 0) + out_printf (out, "\tself = NULL;\n"); out_printf(out, "}\n" "#undef __GOB_FUNCTION__\n\n"); } +static void +make_bonobo_x_epv (Class *c, const char *classname) +{ + GList *li; + gboolean added_line = FALSE; + + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; + Method *m = (Method *)n; + if(n->type != METHOD_NODE || + m->method == OVERRIDE_METHOD) + continue; + + if (m->bonobo_x_func) { + if(m->line_no > 0) { + out_addline_infile(out, m->line_no); + added_line = TRUE; + } else if (m->line_no == 0 && + added_line) { + out_addline_outfile(out); + added_line = FALSE; + } + out_printf (out, "\t%s->_epv.%s = %s;\n", + classname, m->id, m->id); + } + } + if (added_line) + out_addline_outfile(out); +} + static void add_inits(Class *c) { @@ -1410,33 +1977,26 @@ add_inits(Class *c) out_printf(out, "{\n" "#define __GOB_FUNCTION__ \"%s::class_init\"\n", c->otype); - if(signals > 0 || - set_arguments > 0 || - get_arguments > 0 || - need_destroy || - need_finalize) { - add_unused_class = TRUE; + if (set_properties > 0 || + get_properties > 0 || + signals > 0 || + need_shutdown || + need_finalize) { out_printf(out, - "\tGtkObjectClass *" - "gtk_object_class = " - "(GtkObjectClass*) %s;\n", - ((FuncArg *)m->args->data)->name); - out_printf(out, - "#ifdef G_OBJECT_CLASS\n" "\tGObjectClass *" "g_object_class = " - "(GObjectClass*) %s;\n" - "#endif /* G_OBJECT_CLASS */\n", + "(GObjectClass*) %s;\n", ((FuncArg *)m->args->data)->name); + add_unused_class = TRUE; did_base_obj = TRUE; } - if(overrides > 0) - add_overrides(c, - ((FuncArg *)m->args->data)->name, - did_base_obj); + if (overrides > 0) + add_overrides (c, + ((FuncArg *)m->args->data)->name, + did_base_obj); - if(initializers > 0) { + if (initializers > 0) { GList *li; for(li = ((Class *)class)->nodes; li != NULL; @@ -1452,8 +2012,8 @@ add_inits(Class *c) out_printf(out, "\n\tparent_class = "); if(for_cpp) out_printf(out, "(%sClass *)", ptypebase); - out_printf(out, "gtk_type_class (%s_get_type ());\n", - pfuncbase); + out_printf(out, "g_type_class_ref (%s);\n", + pmacrotype); if(signals > 0) add_signals(c); @@ -1462,20 +2022,19 @@ add_inits(Class *c) /* if there are no handlers for these things, we * need to set them up here */ - if(need_destroy && !destroy_handler) - out_printf(out, "\tgtk_object_class->destroy " - "= ___destroy;\n"); + if(need_shutdown && !shutdown_handler) + out_printf(out, "\tg_object_class->shutdown " + "= ___shutdown;\n"); if(need_finalize && !finalize_handler) - out_printf(out, - "#ifdef G_OBJECT_CLASS\n" - "\tg_object_class->finalize = ___finalize;\n" - "#else /* !G_OBJECT_CLASS */\n" - "\tgtk_object_class->finalize = ___finalize;\n" - "#endif /* G_OBJECT_CLASS */\n"); + out_printf(out, "\tg_object_class->finalize = " + "___finalize;\n"); - if(get_arguments > 0 || set_arguments > 0) + if(get_properties > 0 || set_properties > 0) make_arguments(c); + if (c->bonobo_x_class != NULL) { + make_bonobo_x_epv (c, ((FuncArg *)m->args->data)->name); + } } else continue; @@ -1491,110 +2050,169 @@ add_inits(Class *c) "\t%s = NULL;\n", ((FuncArg *)m->args->data)->name); if(add_unused_class) { - out_printf(out, - "\tgtk_object_class = NULL;\n" - "#ifdef G_OBJECT_CLASS\n" - "\tg_object_class = NULL;\n" - "#endif /* G_OBJECT_CLASS */\n"); + out_printf (out, "\tg_object_class = NULL;\n"); } out_printf(out, "}\n" "#undef __GOB_FUNCTION__\n"); } } +static void +add_argument (Argument *a, gboolean is_set) +{ + char *s; + char *cbuf; + char *the_type_lower; + int line_no; + + if(is_set) { + cbuf = a->set; + line_no = a->set_line; + } else { + cbuf = a->get; + line_no = a->get_line; + } + if (cbuf == NULL) + return; + s = g_strdup(a->name); + g_strup(s); + out_printf(out, "\tcase PROP_%s:\n\t{", s); + + the_type_lower = g_strdup (a->gtktype); + g_strdown (the_type_lower); + + if (is_set) { + char *cast; + + if (a->atype != NULL) + cast = get_type (a->atype, TRUE); + else + cast = g_strdup (get_cast (a->gtktype, FALSE)); + + out_printf (out, "\t%s ARG = (%s) g_value_get_%s (VAL);\n", + cast, cast, the_type_lower); + + g_free (cast); + } else if ( ! is_set) { + char *cast; + + if (a->atype != NULL) + cast = get_type (a->atype, TRUE); + else + cast = g_strdup (get_cast (a->gtktype, FALSE)); + out_printf (out, "\t%s ARG;\n" + "\tmemset (&ARG, 0, sizeof (%s));\n", + cast, cast); + + g_free(cast); + } + g_free (s); + out_printf(out, "\t\t{\n"); + if (line_no > 0) + out_addline_infile (out, line_no); + out_printf (out, "%s\n", cbuf); + if (line_no > 0) + out_addline_outfile (out); + out_printf (out, "\t\t}\n"); + if ( ! is_set) { + if (strcmp (a->gtktype, "OBJECT") == 0) + out_printf (out, "\t\tg_value_set_%s (VAL, G_OBJECT (ARG))\n", + the_type_lower); + else + out_printf (out, "\t\t" + "g_value_set_%s (VAL, ARG);\n", + the_type_lower); + } + g_free (the_type_lower); + + if (is_set) { + out_printf (out, "\t\tif (&ARG) ;\n"); + } + + out_printf (out, "\t\tbreak;\n"); + + out_printf (out, "\t}\n"); +} + +static void +add_property (Property *p, gboolean is_set) +{ + const char *cbuf; + char *the_type_lower; + char *name_upper; + int line_no; + + if (is_set) { + cbuf = p->set; + line_no = p->set_line; + } else { + cbuf = p->get; + line_no = p->get_line; + } + if (cbuf == NULL) + return; + + name_upper = g_strdup (p->name); + g_strup (name_upper); + the_type_lower = g_strdup (p->gtktype); + g_strdown (the_type_lower); + + out_printf (out, "\tcase PROP_%s:\n", name_upper); + + out_printf(out, "\t\t{\n"); + if (line_no > 0) + out_addline_infile (out, line_no); + out_printf (out, "%s\n", cbuf); + if (line_no > 0) + out_addline_outfile (out); + out_printf (out, "\t\t}\n"); + + g_free (name_upper); + g_free (the_type_lower); + + out_printf (out, "\t\tbreak;\n"); +} + static void add_getset_arg(Class *c, gboolean is_set) { GList *li; out_printf(out, "\nstatic void\n" - "___object_%s_arg (GtkObject *object,\n" - "\tGtkArg *arg,\n" - "\tguint arg_id)\n" - "#define __GOB_FUNCTION__ \"%s::%s_arg\"\n" + "___object_%s_property (GObject *object,\n" + "\tguint property_id,\n" + "\t%sGValue *VAL,\n" + "\tGParamSpec *pspec)\n" + "#define __GOB_FUNCTION__ \"%s::%s_property\"\n" "{\n" "\t%s *self;\n\n" "\tself = %s (object);\n\n" - "\tswitch (arg_id) {\n", + "\tswitch (property_id) {\n", is_set ? "set" : "get", + is_set ? "const " : "", c->otype, is_set ? "set" : "get", typebase, macrobase); - for(li=c->nodes;li;li=g_list_next(li)) { + for (li = c->nodes; li != NULL; li = li->next) { Node *n = li->data; - Argument *a; - char *s; - char *cbuf; - int line_no; - if(n->type != ARGUMENT_NODE) - continue; - a = (Argument *)n; - if(is_set) { - cbuf = a->set; - line_no = a->set_line; - } else { - cbuf = a->get; - line_no = a->get_line; - } - if(!cbuf) - continue; - s = g_strdup(a->name); - g_strup(s); - out_printf(out, "\tcase ARG_%s:\n", s); - if(is_set && a->atype) { - char *cast = get_type(a->atype, TRUE); - if(no_gnu || for_cpp) { - out_printf(out, "#define ARG " - "((%s)GTK_VALUE_%s(*arg))\n", - cast, a->gtktype); - } else { - out_printf(out, "#if defined(__GNUC__) && !defined(__STRICT_ANSI__)\n"); - if(strcmp(a->gtktype, "OBJECT")==0) { - out_printf(out, "#define ARG " - "({%s foo = " - "GTK_VALUE_POINTER(*arg); " - "foo; })\n", - cast); - } else { - out_printf(out, "#define ARG " - "({%s foo = " - "GTK_VALUE_%s(*arg); " - "foo; })\n", - cast, a->gtktype); - } - out_printf(out, "#else /* __GNUC__ && !__STRICT_ANSI__ */\n"); - out_printf(out, "#define ARG " - "((%s)GTK_VALUE_%s(*arg))\n", - cast, a->gtktype); - out_printf(out, "#endif /* __GNUC__ && !__STRICT_ANSI__ */\n\n"); - } - out_printf(out, "\t\t{\n"); - g_free(cast); - } else if(!is_set && strcmp(a->gtktype, "OBJECT")==0) { - out_printf(out, - "#define ARG (GTK_VALUE_POINTER(*arg))\n" - "\t\t{\n"); - } else { - out_printf(out, - "#define ARG (GTK_VALUE_%s(*arg))\n" - "\t\t{\n", - a->gtktype); - } - g_free(s); - if(line_no > 0) - out_addline_infile(out, line_no); - out_printf(out, "%s\n", cbuf); - if(line_no > 0) - out_addline_outfile(out); - out_printf(out, "\t\t}\n\t\tbreak;\n" - "#undef ARG\n"); - } - out_printf(out, "\tdefault:\n\t\tbreak;\n\t}\n" - "\treturn;\n\tself = NULL;\n\targ = NULL;\n}\n" - "#undef __GOB_FUNCTION__\n"); + if (n->type == PROPERTY_NODE) + add_property ((Property *)n, is_set); + else if (n->type == ARGUMENT_NODE) + add_argument ((Argument *)n, is_set); + } + out_printf (out, "\tdefault:\n" + "/* Apparently in g++ this is needed, glib is b0rk */\n" + "#ifndef __PRETTY_FUNCTION__\n" + "# undef G_STRLOC\n" + "# define G_STRLOC __FILE__ \":\" G_STRINGIFY (__LINE__)\n" + "#endif\n" + "\t\tG_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);\n" + "\t\tbreak;\n\t}\n" + "\treturn;\n\tself = NULL;\n\tVAL = NULL;\n\tpspec = NULL;\n}\n" + "#undef __GOB_FUNCTION__\n"); } static void -print_checks(Method *m, FuncArg *fa) +print_checks (Method *m, FuncArg *fa) { GList *li; gboolean is_void; @@ -1602,7 +2220,7 @@ print_checks(Method *m, FuncArg *fa) is_void = (strcmp(m->mtype->name, "void")==0 && m->mtype->pointer == NULL); - for(li = fa->checks; li; li = g_list_next(li)) { + for(li = fa->checks; li != NULL; li = li->next) { Check *ch = li->data; char *s; /* point to the method prot in .gob for failed checks */ @@ -1674,10 +2292,12 @@ print_preconditions(Method *m) static void print_method_body(Method *m, int pre) { + if (m->line_no > 0) + out_addline_outfile(out); out_printf(out, "{\n" "#define __GOB_FUNCTION__ \"%s::%s\"\n", ((Class *)class)->otype, - get_real_id(m->id)); + m->id); if(pre) print_preconditions(m); @@ -1704,21 +2324,27 @@ print_method_body(Method *m, int pre) } static void -put_signal_args(Method *m) +put_signal_args (Method *m) { GList *li; GList *ali; - for(ali = m->gtktypes->next, li=m->args->next; - li && ali; - li=li->next, ali=ali->next) { + for (ali = m->gtktypes->next, li=m->args->next; + li != NULL && ali != NULL; + li = li->next, ali = ali->next) { FuncArg *fa = li->data; - const char *cast = get_cast(ali->data, FALSE); + char *cast = g_strdup (get_cast (ali->data, FALSE)); + + if (cast == NULL) { + cast = get_type (fa->atype, TRUE); + } /* we should have already proved before that the we know all the types */ - g_assert(cast); + g_assert (cast != NULL); + + out_printf (out, ",\n\t\t(%s)%s", cast, + fa->name); - out_printf(out, ",\n\t\t(%s)%s", cast, - fa->name); + g_free (cast); } } @@ -1779,16 +2405,16 @@ put_method(Method *m) m, FALSE, FALSE, TRUE); out_addline_outfile(out); out_printf(out, "{\n"); - s = g_strdup(get_real_id(m->id)); + s = g_strdup(m->id); g_strup(s); if(strcmp(m->mtype->name, "void") == 0 && m->mtype->pointer == NULL) { print_preconditions(m); if(((FuncArg *)m->args->data)->name) - out_printf(out, "\tgtk_signal_emit (GTK_OBJECT (%s),\n" - "\t\tobject_signals[%s_SIGNAL]", + out_printf(out, "\tg_signal_emit (G_OBJECT (%s),\n" + "\t\tobject_signals[%s_SIGNAL], 0", ((FuncArg *)m->args->data)->name, s); - put_signal_args(m); + put_signal_args (m); out_printf(out, ");\n}\n"); } else { out_printf(out, "\t"); @@ -1802,8 +2428,8 @@ put_method(Method *m) else out_printf(out, ")(0);\n"); print_preconditions(m); - out_printf(out, "\tgtk_signal_emit (GTK_OBJECT (%s),\n" - "\t\tobject_signals[%s_SIGNAL]", + out_printf(out, "\tg_signal_emit (G_OBJECT (%s),\n" + "\t\tobject_signals[%s_SIGNAL], 0", ((FuncArg *)m->args->data)->name, s); put_signal_args(m); out_printf(out, ",\n\t\t&return_val);\n" @@ -1835,12 +2461,12 @@ put_method(Method *m) out_printf(out, "\tklass = %s_GET_CLASS(%s);\n\n" "\tif(klass->%s)\n", macrobase, ((FuncArg *)m->args->data)->name, - get_real_id(m->id)); + m->id); if(strcmp(m->mtype->name, "void") == 0 && m->mtype->pointer == NULL) { GList *li; out_printf(out, "\t\t(*klass->%s)(%s", - get_real_id(m->id), + m->id, ((FuncArg *)m->args->data)->name); for(li=m->args->next;li;li=g_list_next(li)) { FuncArg *fa = li->data; @@ -1850,7 +2476,7 @@ put_method(Method *m) } else { GList *li; out_printf(out, "\t\treturn (*klass->%s)(%s", - get_real_id(m->id), + m->id, ((FuncArg *)m->args->data)->name); for(li=m->args->next;li;li=g_list_next(li)) { FuncArg *fa = li->data; @@ -1894,13 +2520,13 @@ put_method(Method *m) out_printf(out, "#define PARENT_HANDLER(%s) \\\n" "\t{ if(%s_CLASS(parent_class)->%s) \\\n" "\t\t(* %s_CLASS(parent_class)->%s)(%s); }\n", - args, s, get_real_id(m->id), s, get_real_id(m->id), args); + args, s, m->id, s, m->id, args); } else { out_printf(out, "#define PARENT_HANDLER(%s) \\\n" "\t((%s_CLASS(parent_class)->%s)? \\\n" "\t\t(* %s_CLASS(parent_class)->%s)(%s): \\\n" "\t\t(", - args, s, get_real_id(m->id), s, get_real_id(m->id), args); + args, s, m->id, s, m->id, args); out_printf(out, "("); print_type(out, m->mtype, TRUE); out_printf(out, ")%s))\n", @@ -1922,93 +2548,110 @@ open_files(void) { char *outfile, *outfileh, *outfileph; - if(!for_cpp) - outfile = g_strconcat(filebase, ".c", NULL); + if ( ! for_cpp) + outfile = g_strconcat (filebase, ".c", NULL); else - outfile = g_strconcat(filebase, ".cc", NULL); - if(no_touch_headers) - outfileh = g_strconcat("#gob#", filebase, ".h#gob#", NULL); + outfile = g_strconcat (filebase, ".cc", NULL); + if (no_touch_headers) + outfileh = g_strconcat ("#gob#", filebase, ".h#gob#", NULL); else - outfileh = g_strconcat(filebase, ".h", NULL); + outfileh = g_strconcat (filebase, ".h", NULL); - if((privates > 0 || protecteds > 0 || - private_header == PRIVATE_HEADER_ALWAYS) && - private_header != PRIVATE_HEADER_NEVER) - outfileph = g_strconcat(filebase, "-private.h", NULL); + if ((privates > 0 || protecteds > 0 || + private_header == PRIVATE_HEADER_ALWAYS) && + private_header != PRIVATE_HEADER_NEVER) + outfileph = g_strconcat (filebase, "-private.h", NULL); else outfileph = NULL; - if(no_write) { - devnull = fopen("/dev/null", "w"); - if(!devnull) - g_error("Cannot open null device"); + if (no_write) { + devnull = fopen ("/dev/null", "w"); + if (devnull == NULL) + g_error ("Cannot open null device"); out = devnull; outh = devnull; - if(outfileph) + if (outfileph != NULL) outph = devnull; } else { - out = fopen(outfile, "w"); - if(!out) { - g_error("Cannot open outfile: %s", outfile); + out = fopen (outfile, "w"); + if (out == NULL) { + g_error ("Cannot open outfile: %s", outfile); } - outh = fopen(outfileh, "w"); - if(!outh) - g_error("Cannot open outfile: %s", outfileh); - if(outfileph) { - outph = fopen(outfileph, "w"); - if(!outph) - g_error("Cannot open outfile: %s", outfileh); + outh = fopen (outfileh, "w"); + if (outh == NULL) + g_error ("Cannot open outfile: %s", outfileh); + if (outfileph != NULL) { + outph = fopen (outfileph, "w"); + if (outph == NULL) + g_error ("Cannot open outfile: %s", outfileh); } } } static void -put_argument_nongnu_wrappers(Class *c) +put_argument_nongnu_wrappers (Class *c) { GList *li; - if(get_arguments < 0 && set_arguments < 0) + if (get_properties < 0 && set_properties < 0) return; - for(li=c->nodes;li;li=g_list_next(li)) { + for (li = c->nodes; li != NULL; li = li->next) { Node *n = li->data; - Argument *a = (Argument *)n; + const char *name, *gtktype; + gboolean get, set; + Type *atype; char *aname; char *cast; - if(n->type != ARGUMENT_NODE) + if (n->type == ARGUMENT_NODE) { + Argument *a = (Argument *)n; + name = a->name; + gtktype = a->gtktype; + atype = a->atype; + get = a->get != NULL; + set = a->set != NULL; + } else if (n->type == PROPERTY_NODE) { + Property *p = (Property *)n; + name = p->name; + gtktype = p->gtktype; + atype = p->ptype; + get = p->get != NULL; + set = p->set != NULL; + } else { continue; + } - aname = g_strdup(a->name); - g_strup(aname); + aname = g_strdup (name); + g_strup (aname); - if(a->atype) - cast = get_type(a->atype, TRUE); + if (atype != NULL) + cast = get_type (atype, TRUE); else - cast = g_strdup(get_cast(a->gtktype, TRUE)); - - if(cast) { - if(a->set) - out_printf(outh, "#define %s_ARG_%s(arg) \t" - "\"%s\",(%s)(arg)\n", - macrobase, aname, a->name, cast); - if(a->get) - out_printf(outh, "#define %s_GET_ARG_%s(arg)\t" - "\"%s\",(%s*)(arg)\n", - macrobase, aname, a->name, cast); + cast = g_strdup (get_cast (gtktype, TRUE)); + + if (cast != NULL) { + if (set) + out_printf (outh, "#define %s_PROP_%s(arg) \t" + "\"%s\",(%s)(arg)\n", + macrobase, aname, name, cast); + if (get) + out_printf (outh, "#define %s_GET_PROP_%s(arg)\t" + "\"%s\",(%s*)(arg)\n", + macrobase, aname, name, cast); } else { - if(a->set) - out_printf(outh, "#define %s_ARG_%s(arg) \t" - "\"%s\",(arg)\n", - macrobase, aname, a->name); - if(a->get) - out_printf(outh, "#define %s_GET_ARG_%s(arg)\t" - "\"%s\",(arg)\n", - macrobase, aname, a->name); + if(set) + out_printf (outh, "#define %s_PROP_%s(arg) \t" + "\"%s\",(arg)\n", + macrobase, aname, name); + if(get) + out_printf (outh, "#define %s_GET_PROP_%s(arg)\t" + "\"%s\",(arg)\n", + macrobase, aname, name); } - g_free(cast); - g_free(aname); + g_free (cast); + g_free (aname); } } @@ -2017,43 +2660,64 @@ put_argument_gnu_wrappers(Class *c) { GList *li; - if(get_arguments < 0 && set_arguments < 0) + if(get_properties < 0 && set_properties < 0) return; - for(li=c->nodes;li;li=g_list_next(li)) { + for (li = c->nodes; li != NULL; li = li->next) { Node *n = li->data; - Argument *a = (Argument *)n; - char *s; + const char *name, *gtktype; + gboolean get, set; + Type *atype; + char *aname; char *cast; - if(n->type != ARGUMENT_NODE) + + if (n->type == ARGUMENT_NODE) { + Argument *a = (Argument *)n; + name = a->name; + gtktype = a->gtktype; + atype = a->atype; + get = a->get != NULL; + set = a->set != NULL; + } else if (n->type == PROPERTY_NODE) { + Property *p = (Property *)n; + name = p->name; + gtktype = p->gtktype; + atype = p->ptype; + get = p->get != NULL; + set = p->set != NULL; + } else { continue; - s = g_strdup(a->name); - g_strup(s); - if(a->atype) - cast = get_type(a->atype, TRUE); + } + + aname = g_strdup (name); + g_strup (aname); + + if (atype != NULL) + cast = get_type (atype, TRUE); else - cast = g_strdup(get_cast(a->gtktype, TRUE)); - if(cast) { - if(a->set) - out_printf(outh, "#define %s_ARG_%s(arg) \t" + cast = g_strdup (get_cast (gtktype, TRUE)); + + if (cast != NULL) { + if (set) + out_printf (outh, "#define %s_PROP_%s(arg) \t" "\"%s\",({%sz = (arg); z;})\n", - macrobase, s, a->name, cast); - if(a->get) - out_printf(outh, "#define %s_GET_ARG_%s(arg)\t" + macrobase, aname, name, cast); + if (get) + out_printf (outh, "#define %s_GET_PROP_%s(arg)\t" "\"%s\",({%s*z = (arg); z;})\n", - macrobase, s, a->name, cast); + macrobase, aname, name, cast); } else { - if(a->set) - out_printf(outh, "#define %s_ARG_%s(arg) \t" + if (set) + out_printf (outh, "#define %s_PROP_%s(arg) \t" "\"%s\",(arg)\n", - macrobase, s, a->name); - if(a->get) - out_printf(outh, "#define %s_GET_ARG_%s(arg)\t" + macrobase, aname, name); + if (get) + out_printf (outh, "#define %s_GET_PROP_%s(arg)\t" "\"%s\",(arg)\n", - macrobase, s, a->name); + macrobase, aname, name); } - g_free(cast); - g_free(s); + g_free (cast); + g_free (aname); } } @@ -2111,7 +2775,7 @@ print_ccode_block(CCode *cc) static void print_class_block(Class *c) { - GList *l; + GList *li; char *s; gboolean printed_private = FALSE; @@ -2140,32 +2804,28 @@ print_class_block(Class *c) "(%s_get_type())\n", macrotype, funcbase); out_printf(outh, "#define %s(obj)\t" - "GTK_CHECK_CAST((obj), %s_get_type(), %s)\n", + "G_TYPE_CHECK_INSTANCE_CAST((obj), %s_get_type(), %s)\n", macrobase, funcbase, typebase); out_printf(outh, "#define %s_CONST(obj)\t" - "GTK_CHECK_CAST((obj), %s_get_type(), %s const)\n", + "G_TYPE_CHECK_INSTANCE_CAST((obj), %s_get_type(), %s const)\n", macrobase, funcbase, typebase); out_printf(outh, "#define %s_CLASS(klass)\t" - "GTK_CHECK_CLASS_CAST((klass), %s_get_type(), %sClass)\n", + "G_TYPE_CHECK_CLASS_CAST((klass), %s_get_type(), %sClass)\n", macrobase, funcbase, typebase); out_printf(outh, "#define %s(obj)\t" - "GTK_CHECK_TYPE((obj), %s_get_type ())\n\n", + "G_TYPE_CHECK_INSTANCE_TYPE((obj), %s_get_type ())\n\n", macrois, funcbase); - out_printf(outh, "#ifdef GTK_CHECK_GET_CLASS\n" + out_printf(outh, "#define %s_GET_CLASS(obj)\t" - "GTK_CHECK_GET_CLASS((obj), %s_get_type(), %sClass)\n", + "G_TYPE_INSTANCE_GET_CLASS((obj), %s_get_type(), %sClass)\n", macrobase, funcbase, typebase); - out_printf(outh, "#else /* !GTK_CHECK_GET_CLASS */\n" - "#define %s_GET_CLASS(obj)\t" - "((%sClass *)GTK_OBJECT(obj)->klass)\n" - "#endif /* GTK_CHECK_GET_CLASS */\n", - macrobase, typebase); - if( ! no_self_alias) { + if ( ! no_self_alias) { out_printf(out, "/* self casting macros */\n"); out_printf(out, "#define SELF(x) %s(x)\n", macrobase); out_printf(out, "#define SELF_CONST(x) %s_CONST(x)\n", macrobase); out_printf(out, "#define IS_SELF(x) %s(x)\n", macrois); + out_printf(out, "#define TYPE_SELF %s\n", macrotype); out_printf(out, "#define SELF_CLASS(x) %s_CLASS(x)\n\n", macrobase); out_printf(out, "#define SELF_GET_CLASS(x) %s_GET_CLASS(x)\n\n", @@ -2176,36 +2836,31 @@ print_class_block(Class *c) out_printf(out, "typedef %sClass SelfClass;\n\n", typebase); } - out_printf(out, "/* GTK_CLASS_TYPE for 1.2<->1.3/2.0 GTK+ compatibility */\n"); - out_printf(out, - "#ifndef GTK_CLASS_TYPE\n" - "#define GTK_CLASS_TYPE(x) (GTK_OBJECT_CLASS(x)->type)\n" - "#endif /* GTK_CLASS_TYPE */\n\n"); - - if(privates > 0 || always_private_struct) { - out_printf(outh, "\n/* Private structure type */\n"); - out_printf(outh, "typedef struct _%sPrivate %sPrivate;\n", + if (privates > 0 || + always_private_struct) { + out_printf (outh, "\n/* Private structure type */\n"); + out_printf (outh, "typedef struct _%sPrivate %sPrivate;\n", typebase, typebase); - if(privates == 0) - out_printf(outh, "/* There are no privates, this " - "structure is thus never defined */\n"); - } - - out_printf(outh, "\n/*\n" - " * Main object structure\n" - " */\n"); - s = replace_sep(c->otype, '_'); - g_strup(s); - out_printf(outh, "#ifndef __TYPEDEF_%s__\n" - "#define __TYPEDEF_%s__\n", s, s); - g_free(s); - out_printf(outh, "typedef struct _%s %s;\n" - "#endif\n", typebase, typebase); - out_printf(outh, "struct _%s {\n\t%s __parent__;\n", - typebase, ptypebase); - for(l=c->nodes; l; l=g_list_next(l)) { + if (privates == 0) + out_printf (outh, "/* There are no privates, this " + "structure is thus never defined */\n"); + } + + out_printf (outh, "\n/*\n" + " * Main object structure\n" + " */\n"); + s = replace_sep (c->otype, '_'); + g_strup (s); + out_printf (outh, "#ifndef __TYPEDEF_%s__\n" + "#define __TYPEDEF_%s__\n", s, s); + g_free (s); + out_printf (outh, "typedef struct _%s %s;\n" + "#endif\n", typebase, typebase); + out_printf (outh, "struct _%s {\n\t%s __parent__;\n", + typebase, ptypebase); + for (li = c->nodes; li; li=li->next) { static gboolean printed_public = FALSE; - Node *n = l->data; + Node *n = li->data; Variable *v = (Variable *)n; if(n->type == VARIABLE_NODE && v->scope == PUBLIC_SCOPE) { @@ -2217,40 +2872,41 @@ print_class_block(Class *c) } } /* put protecteds always AFTER publics */ - for(l=c->nodes; l; l=g_list_next(l)) { - Node *n = l->data; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; Variable *v = (Variable *)n; - if(n->type == VARIABLE_NODE && - v->scope == PROTECTED_SCOPE) { - if( ! printed_private) { - out_printf(outh, "\t/*< private >*/\n"); + if (n->type == VARIABLE_NODE && + v->scope == PROTECTED_SCOPE) { + if ( ! printed_private) { + out_printf (outh, "\t/*< private >*/\n"); printed_private = TRUE; } - put_variable((Variable *)n, outh); + put_variable ((Variable *)n, outh); } } - if(privates > 0 || always_private_struct) { - if( ! printed_private) - out_printf(outh, "\t/*< private >*/\n"); - out_printf(outh, "\t%sPrivate *_priv;\n", typebase); + if (privates > 0 || + always_private_struct) { + if ( ! printed_private) + out_printf (outh, "\t/*< private >*/\n"); + out_printf (outh, "\t%sPrivate *_priv;\n", typebase); } - out_printf(outh, "};\n"); + out_printf (outh, "};\n"); - if(privates > 0) { + if (privates > 0) { FILE *outfp; /* if we are to stick this into the private header, if not stick it directly into the C file */ - if(outph) + if (outph != NULL) outfp = outph; else outfp = out; - out_printf(outfp, "struct _%sPrivate {\n", - typebase); - for(l=c->nodes; l; l=l->next) { - Node *n = l->data; + out_printf (outfp, "struct _%sPrivate {\n", + typebase); + for(li=c->nodes; li; li=li->next) { + Node *n = li->data; Variable *v = (Variable *)n; if(n->type == VARIABLE_NODE && v->scope == PRIVATE_SCOPE) { @@ -2270,46 +2926,55 @@ print_class_block(Class *c) out_printf(outh, "struct _%sClass {\n\t%sClass __parent__;\n", typebase, ptypebase); - for(l = c->nodes; l != NULL; l = l->next) { - Node *n = l->data; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) put_vs_method((Method *)n); } + /* If BonoboX type class put down the epv */ + if (c->bonobo_x_class != NULL) { + out_printf (outh, + "\t/* Bonobo object epv */\n" + "\tPOA_%s__epv _epv;\n", + c->bonobo_x_class); + } /* put class scope variables */ - for(l = c->nodes; l != NULL; l = l->next) { - Node *n = l->data; + for (li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; Variable *v = (Variable *)n; - if(n->type == VARIABLE_NODE && - v->scope == CLASS_SCOPE) - put_variable((Variable *)n, outh); + if (n->type == VARIABLE_NODE && + v->scope == CLASS_SCOPE) + put_variable ((Variable *)n, outh); } - out_printf(outh, "};\n\n"); + out_printf (outh, "};\n\n"); - out_printf(out, "/* here are local prototypes */\n"); - if(set_arguments > 0) { - out_printf(out, "static void ___object_set_arg " - "(GtkObject *object, GtkArg *arg, " - "guint arg_id);\n"); + out_printf (out, "/* here are local prototypes */\n"); + if (set_properties > 0) { + out_printf (out, "static void ___object_set_property " + "(GObject *object, guint property_id, " + "const GValue *value, GParamSpec *pspec);\n"); } - if(get_arguments > 0) { - out_printf(out, "static void ___object_get_arg " - "(GtkObject *object, GtkArg *arg, " - "guint arg_id);\n"); + if (get_properties > 0) { + out_printf (out, "static void ___object_get_property " + "(GObject *object, guint property_id, " + "GValue *value, GParamSpec *pspec);\n"); } - out_printf(outh, "\n/*\n" - " * Public methods\n" - " */\n"); + out_printf (outh, "\n/*\n" + " * Public methods\n" + " */\n"); - out_printf(outh, "GtkType\t%s_get_type\t(void)", funcbase); - if ( ! no_gnu) { - out_printf(outh, " G_GNUC_CONST;\n"); - } else { - out_printf(outh, ";\n"); + if ( ! overrode_get_type) { + out_printf (outh, "GType\t%s_get_type\t(void)", funcbase); + if ( ! no_gnu) { + out_printf (outh, " G_GNUC_CONST;\n"); + } else { + out_printf (outh, ";\n"); + } } - for(l = c->nodes; l != NULL; l = l->next) { - Node *n = l->data; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) { put_pub_method((Method *)n); put_prot_method((Method *)n); @@ -2334,7 +2999,7 @@ print_class_block(Class *c) } /* argument wrapping macros */ - if(get_arguments > 0 || set_arguments > 0) { + if(get_properties > 0 || set_properties > 0) { out_printf(outh, "\n/*\n" " * Argument wrapping macros\n" " */\n"); @@ -2350,8 +3015,8 @@ print_class_block(Class *c) } if(signals > 0) { - for(l = c->nodes; l != NULL; l = l->next) { - Node *n = l->data; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) add_signal_prots((Method *)n); } @@ -2359,8 +3024,12 @@ print_class_block(Class *c) add_enums(c); - if ( ! overrode_get_type) - add_get_type(); + if ( ! overrode_get_type) { + if (c->bonobo_x_class != NULL) + add_bonobo_x_get_type (); + else + add_get_type (); + } if(any_method_to_alias(c)) { if( ! no_gnu) { @@ -2372,29 +3041,44 @@ print_class_block(Class *c) make_method_nongnu_aliases(c); } - out_printf(out, "/* a macro for creating a new object of our type */\n"); - out_printf(out, - "#define GET_NEW ((%s *)gtk_type_new(%s_get_type()))\n\n", - typebase, funcbase); - - if(need_destroy) - add_destroy(c); - - if(need_finalize) - add_finalize(c); + out_printf (out, "/* a macro for creating a new object of our type */\n"); + out_printf (out, + "#define GET_NEW ((%s *)g_object_new(%s_get_type(), NULL))\n\n", + typebase, funcbase); + + out_printf (out, "/* a function for creating a new object of our type */\n"); + out_printf (out, "#include \n"); + out_printf (out, + "static %s * GET_NEW_VARG (const char *first, ...)%s;\n" + "static %s *\nGET_NEW_VARG (const char *first, ...)\n" + "{\n\t%s *ret;\n\tva_list ap;\n" + "\tva_start (ap, first);\n" + "\tret = (%s *)g_object_new_valist (%s_get_type (), " + "first, ap);\n" + "\tva_end (ap);\n" + "\treturn ret;\n}\n\n", + typebase, + no_gnu ? "" : " G_GNUC_UNUSED", + typebase, typebase, typebase, funcbase); + + if (need_shutdown) + add_shutdown (c); + + if (need_finalize) + add_finalize (c); add_inits(c); - if(set_arguments > 0) { + if(set_properties > 0) { add_getset_arg(c, TRUE); } - if(get_arguments > 0) { + if(get_properties > 0) { add_getset_arg(c, FALSE); } - for(l = c->nodes; l != NULL; l = l->next) { - Node *n = l->data; + for(li = c->nodes; li != NULL; li = li->next) { + Node *n = li->data; if(n->type == METHOD_NODE) put_method((Method *)n); } @@ -2403,14 +3087,20 @@ print_class_block(Class *c) } static void -print_version_macros(void) +print_useful_macros(void) { - int major=0, minor=0, pl=0; - sscanf(VERSION, "%d.%d.%d", &major, &minor, &pl); - - out_printf(out, "#define GOB_VERSION_MAJOR %d\n", major); - out_printf(out, "#define GOB_VERSION_MINOR %d\n", minor); - out_printf(out, "#define GOB_VERSION_PATCHLEVEL %d\n\n", pl); + int major = 0, minor = 0, pl = 0; + + /* Version stuff */ + sscanf (VERSION, "%d.%d.%d", &major, &minor, &pl); + out_printf (out, "#define GOB_VERSION_MAJOR %d\n", major); + out_printf (out, "#define GOB_VERSION_MINOR %d\n", minor); + out_printf (out, "#define GOB_VERSION_PATCHLEVEL %d\n\n", pl); + + /* Useful priv macro thingie */ + /* FIXME: this should be done the same way that priv is, as a var, + * not a define */ + out_printf (out, "#define selfp (self->_priv)\n\n"); } static void @@ -2535,11 +3225,16 @@ print_header_top(void) { GList *li; - /* mandatory include */ - out_printf(outh, "#include \n\n"); + /* mandatory includes */ + out_printf(outh, "#include \n"); + out_printf(outh, "#include \n"); + out_printf(outh, "#include \n"); + out_printf(outh, "#include \n"); + out_printf(outh, "#include \n"); + out_printf(outh, "#include \n\n"); /* print the HT_CCODE blocks */ - for(li=nodes;li;li=g_list_next(li)) { + for (li = nodes; li != NULL; li = li->next) { Node *node = li->data; if(node->type == CCODE_NODE) { CCode *cc = (CCode *)node; @@ -2562,7 +3257,7 @@ generate_outfiles(void) print_header_prefixes(); - print_version_macros(); + print_useful_macros(); print_includes(); @@ -2616,9 +3311,7 @@ print_help(void) "\t--no-lines Don't print '#line' to output\n" "\t--no-self-alias Don't create self type and macro " "aliases\n" - "\t--no-kill-underscores Don't remove the leading underscore " - "from\n" - "\t short id names\n"); + "\t--no-kill-underscores Ignored for compatibility\n"); } static void @@ -2672,7 +3365,7 @@ parse_options(int argc, char *argv[]) } else if(strcmp(argv[i], "--no-self-alias")==0) { no_self_alias = TRUE; } else if(strcmp(argv[i], "--no-kill-underscores")==0) { - no_kill_underscores = TRUE; + /* no op */; } else if(strcmp(argv[i], "--always-private-struct")==0) { always_private_struct = TRUE; } else if(strcmp(argv[i], "--")==0) { @@ -2767,61 +3460,66 @@ main(int argc, char *argv[]) exit_on_error = FALSE; - signals = count_signals((Class *)class); - set_arguments = count_set_arguments((Class *)class); - get_arguments = count_get_arguments((Class *)class); - overrides = count_overrides((Class *)class); - privates = count_privates((Class *)class); - protecteds = count_protecteds((Class *)class); - destructors = count_destructors((Class *)class); - initializers = count_initializers((Class *)class); - overrode_get_type = find_get_type((Class *)class); - - make_bases(); - make_inits((Class *)class); - if(destructors > 0) { - need_destroy = TRUE; - find_destroy((Class *)class); - } - if(privates > 0) { + signals = count_signals ((Class *)class); + set_properties = count_set_properties ((Class *)class) + + count_set_arguments ((Class *)class); + get_properties = count_get_properties ((Class *)class) + + count_get_arguments ((Class *)class); + overrides = count_overrides ((Class *)class); + privates = count_privates ((Class *)class); + protecteds = count_protecteds ((Class *)class); + unreftors = count_unreftors ((Class *)class); + destructors = count_destructors ((Class *)class); + initializers = count_initializers ((Class *)class); + overrode_get_type = find_get_type ((Class *)class); + + make_bases (); + make_inits ((Class *)class); + if(unreftors > 0) { + need_shutdown = TRUE; + find_shutdown ((Class *)class); + } + if (destructors > 0 || + privates > 0) { need_finalize = TRUE; - find_finalize((Class *)class); - } - check_bad_symbols((Class *)class); - check_duplicate_symbols((Class *)class); - check_duplicate_overrides((Class *)class); - check_duplicate_signals_args((Class *)class); - check_public_new((Class *)class); - check_vararg((Class *)class); - check_firstarg((Class *)class); - check_nonvoidempty((Class *)class); - check_signal_args((Class *)class); - check_argument_types((Class *)class); - check_func_arg_checks((Class *)class); + find_finalize ((Class *)class); + } + check_bad_symbols ((Class *)class); + check_duplicate_symbols ((Class *)class); + check_duplicate_overrides ((Class *)class); + check_duplicate_signals_args ((Class *)class); + check_public_new ((Class *)class); + check_vararg ((Class *)class); + check_firstarg ((Class *)class); + check_nonvoidempty ((Class *)class); + check_signal_args ((Class *)class); + check_property_types ((Class *)class); + check_argument_types ((Class *)class); + check_func_arg_checks ((Class *)class); exit_on_error = TRUE; - if(got_error) - exit(1); + if (got_error) + exit (1); - any_special = setup_special_array((Class *)class, special_array); + any_special = setup_special_array ((Class *)class, special_array); - open_files(); + open_files (); - generate_outfiles(); + generate_outfiles (); - if(devnull) - fclose(devnull); - else { - fclose(out); - fclose(outh); - if(outph) - fclose(outph); + if (devnull) { + fclose (devnull); + } else { + fclose (out); + fclose (outh); + if (outph) + fclose (outph); } - if(no_touch_headers && - ! no_write) - compare_and_move_header(); + if (no_touch_headers && + ! no_write) + compare_and_move_header (); return 0; } diff --git a/src/parse.c b/src/parse.c index 9fdfed3..8a806d8 100644 --- a/src/parse.c +++ b/src/parse.c @@ -24,22 +24,37 @@ #define NUMBER 274 #define TYPETOKEN 275 #define ARRAY_DIM 276 -#define CCODE 277 -#define HTCODE 278 -#define PHCODE 279 -#define HCODE 280 -#define ACODE 281 -#define ATCODE 282 -#define PUBLIC 283 -#define PRIVATE 284 -#define PROTECTED 285 -#define CLASSWIDE 286 -#define ARGUMENT 287 -#define VIRTUAL 288 -#define SIGNAL 289 -#define OVERRIDE 290 - -#line 21 "parse.y" +#define SINGLE_CHAR 277 +#define CCODE 278 +#define HTCODE 279 +#define PHCODE 280 +#define HCODE 281 +#define ACODE 282 +#define ATCODE 283 +#define STRING 284 +#define PUBLIC 285 +#define PRIVATE 286 +#define PROTECTED 287 +#define CLASSWIDE 288 +#define PROPERTY 289 +#define ARGUMENT 290 +#define VIRTUAL 291 +#define SIGNAL 292 +#define OVERRIDE 293 +#define NICK 294 +#define BLURB 295 +#define MAXIMUM 296 +#define MINIMUM 297 +#define DEFAULT_VALUE 298 +#define FLAGS 299 +#define TYPE 300 +#define FLAGS_TYPE 301 +#define ENUM_TYPE 302 +#define PARAM_TYPE 303 +#define BOXED_TYPE 304 +#define OBJECT_TYPE 305 + +#line 22 "parse.y" #include "config.h" @@ -58,15 +73,18 @@ GList *nodes = NULL; static GList *class_nodes = NULL; Node *class = NULL; -char *chunk_size = NULL; +static char *chunk_size = NULL; +static char *bonobo_x_class = NULL; static GList *typestack = NULL; static GList *funcargs = NULL; static GList *checks = NULL; static int has_self = FALSE; static int vararg = FALSE; +static Method *last_added_method = NULL; /* destructor and initializer for variables */ +static gboolean destructor_unref = FALSE; static char *destructor = NULL; static int destructor_line = 0; static gboolean destructor_simple = TRUE; @@ -78,6 +96,8 @@ static char *defreturn = NULL; static GList *gtktypes = NULL; +static Property *property = NULL; + /* this can be a global as we will only do one function at a time anyway */ static int the_scope = NO_SCOPE; @@ -124,24 +144,32 @@ pop_type(void) } static void -push_variable(char *name, int scope, int line_no, char *postfix) +push_variable (char *name, int scope, int line_no, char *postfix) { Node *var; - Type *type = pop_type(); + Type *type = pop_type (); type->postfix = postfix; - var = new_variable(scope, type, name, line_no, - destructor, destructor_line, - destructor_simple, - initializer, initializer_line); + var = node_new (VARIABLE_NODE, + "scope", scope, + "vtype:steal", type, + "id:steal", name, + "line_no", line_no, + "destructor_unref", destructor_unref, + "destructor:steal", destructor, + "destructor_line", destructor_line, + "destructor_simple", destructor_simple, + "initializer:steal", initializer, + "initializer_line", initializer_line, + NULL); class_nodes = g_list_append(class_nodes, var); } static void -push_function(int scope, int method, char *oid, char *id, - GString *cbuf, int line_no, int ccode_line, - gboolean vararg, GList *flags) +push_function (int scope, int method, char *oid, char *id, + GString *cbuf, int line_no, int ccode_line, + gboolean vararg, GList *flags) { Node *node; Type *type; @@ -150,7 +178,9 @@ push_function(int scope, int method, char *oid, char *id, g_assert(scope != CLASS_SCOPE); if(method == INIT_METHOD || method == CLASS_INIT_METHOD) { - type = (Type *)new_type(g_strdup("void"), NULL, NULL); + type = (Type *)node_new (TYPE_NODE, + "name", "void", + NULL); } else { type = pop_type(); } @@ -188,9 +218,25 @@ push_function(int scope, int method, char *oid, char *id, } else c_cbuf = NULL; - node = new_method(scope, method, type, oid, gtktypes, flags, - id, funcargs, onerror, defreturn, c_cbuf, line_no, - ccode_line, vararg, method_unique_id++); + node = node_new (METHOD_NODE, + "scope", scope, + "method", method, + "mtype:steal", type, + "otype:steal", oid, + "gtktypes:steal", gtktypes, + "flags:steal", flags, + "id:steal", id, + "args:steal", funcargs, + "onerror:steal", onerror, + "defreturn:steal", defreturn, + "cbuf:steal", c_cbuf, + "line_no", line_no, + "ccode_line", ccode_line, + "vararg", vararg, + "unique_id", method_unique_id++, + NULL); + + last_added_method = (Method *)node; if(cbuf) g_string_free(cbuf, @@ -221,7 +267,7 @@ free_all_global_state(void) g_list_free(gtktypes); gtktypes = NULL; - free_node_list(funcargs); + node_list_free (funcargs); funcargs = NULL; } @@ -233,7 +279,11 @@ push_funcarg(char *name, char *postfix) type->postfix = postfix; - node = new_funcarg(type, name, checks); + node = node_new (FUNCARG_NODE, + "atype:steal", type, + "name:steal", name, + "checks:steal", checks, + NULL); checks = NULL; funcargs = g_list_append(funcargs, node); @@ -251,8 +301,14 @@ push_init_arg(char *name, int is_class) else tn = g_strdup(((Class *)class)->otype); - type = new_type(tn, g_strdup("*"), NULL); - node = new_funcarg((Type *)type,name,NULL); + type = node_new (TYPE_NODE, + "name:steal", tn, + "pointer", "*", + NULL); + node = node_new (FUNCARG_NODE, + "atype:steal", (Type *)type, + "name:steal", name, + NULL); funcargs = g_list_prepend(funcargs, node); } @@ -262,11 +318,21 @@ push_self(char *id, gboolean constant) Node *node; Node *type; GList *ch = NULL; - type = new_type(g_strdup(((Class *)class)->otype), - g_strdup(constant ? "const *" : "*"), NULL); - ch = g_list_append(ch,new_check(NULL_CHECK,NULL)); - ch = g_list_append(ch,new_check(TYPE_CHECK,NULL)); - node = new_funcarg((Type *)type,id,ch); + type = node_new (TYPE_NODE, + "name", ((Class *)class)->otype, + "pointer", constant ? "const *" : "*", + NULL); + ch = g_list_append (ch, node_new (CHECK_NODE, + "chtype", NULL_CHECK, + NULL)); + ch = g_list_append (ch, node_new (CHECK_NODE, + "chtype", TYPE_CHECK, + NULL)); + node = node_new (FUNCARG_NODE, + "atype:steal", (Type *)type, + "name:steal", id, + "checks:steal", ch, + NULL); funcargs = g_list_prepend(funcargs, node); } @@ -310,8 +376,233 @@ set_return_value(char *type, char *val) return FALSE; } +static void +export_accessors (const char *var_name, + gboolean do_get, + gboolean do_set, + int get_lineno, + int set_lineno, + Type *type, + const char *gtktype, + int lineno) +{ + Type *the_type; + + if (type != NULL) + the_type = (Type *)node_copy ((Node *)type); + else + the_type = get_tree_type (gtktype, TRUE); + + if (the_type == NULL) { + error_print (GOB_ERROR, line_no, + _("Cannot determine type of property or argument")); + return; + } + + if (do_get) { + char *get_id = g_strdup_printf ("get_%s", var_name); + GString *get_cbuf = g_string_new (NULL); + Node *node1 = node_new (TYPE_NODE, + "name", the_type->name, + "pointer", the_type->pointer, + "postfix", the_type->postfix, + NULL); + Node *node3 = node_new (TYPE_NODE, + "name", class->class.otype, + "pointer", "*", + NULL); + + g_string_sprintf (get_cbuf, + "\t%s%s val; " + "g_object_get (G_OBJECT (self), \"%s\", " + "&val, NULL); " + "return val;\n", + the_type->name, + the_type->pointer ? the_type->pointer : "", + var_name); + + typestack = g_list_prepend (typestack, node1); + typestack = g_list_prepend (typestack, node3); + + push_funcarg ("self", FALSE); + + push_function (PUBLIC_SCOPE, REGULAR_METHOD, NULL, + get_id, get_cbuf, get_lineno, + lineno, FALSE, NULL); + } + + if (do_set) { + char *set_id = g_strdup_printf ("set_%s", var_name); + GString *set_cbuf = g_string_new (NULL); + Node *node1 = node_new (TYPE_NODE, + "name", the_type->name, + "pointer", the_type->pointer, + "postfix", the_type->postfix, + NULL); + Node *node2 = node_new (TYPE_NODE, + "name", "void", + NULL); + Node *node3 = node_new (TYPE_NODE, + "name", class->class.otype, + "pointer", "*", + NULL); + + g_string_sprintf (set_cbuf, + "\tg_object_set (G_OBJECT (self), " + "\"%s\", val, NULL);\n", + var_name); + + typestack = g_list_prepend (typestack, node2); + typestack = g_list_prepend (typestack, node1); + typestack = g_list_prepend (typestack, node3); + + push_funcarg ("self", FALSE); + push_funcarg ("val", FALSE); + + typestack = g_list_prepend (typestack, node2); + push_function (PUBLIC_SCOPE, REGULAR_METHOD, NULL, + set_id, set_cbuf, set_lineno, + lineno, FALSE, NULL); + } + + node_free ((Node *)the_type); +} + +static void +property_link_and_export (Node *node) +{ + Property *prop = (Property *)node; + + if (prop->link) { + const char *root; + char *get = NULL, *set = NULL; + Variable *var; + + if (prop->set != NULL || + prop->get != NULL) { + error_print (GOB_ERROR, prop->line_no, + _("Property linking requested, but " + "getters and setters exist")); + } -#line 293 "parse.y" + var = find_var_or_die (prop->name, prop->line_no); + if(var->scope == PRIVATE_SCOPE) { + root = "self->_priv"; + } else if (var->scope == CLASS_SCOPE) { + root = "SELF_GET_CLASS(self)"; + if (no_self_alias) + error_print (GOB_ERROR, prop->line_no, + _("Self aliases needed when autolinking to a classwide member")); + } else { + root = "self"; + } + + if (strcmp (prop->gtktype, "STRING") == 0) { + set = g_strdup_printf("g_free (%s->%s); " + "%s->%s = g_value_dup_string (VAL);", + root, prop->name, + root, prop->name); + get = g_strdup_printf("g_value_set_string (VAL, %s->%s);", + root, prop->name); + } else if (strcmp (prop->gtktype, "OBJECT") == 0) { + set = g_strdup_printf("{ GtkObject *___old = (GtkObject *)%s->%s; " + "GtkObject *___new = (GtkObject *)gtk_value_get_object (VAL); " + "if (___new != NULL) { " + "gtk_object_ref (GTK_OBJECT (___new)); " + "%s->%s = GTK_OBJECT (___new); " + "} else { " + "%s->%s = NULL; " + "} " + "if (___old != NULL) { " + "gtk_object_unref (GTK_OBJECT (___old)); " + "} " + "}", + root, prop->name, + root, prop->name, + root, prop->name); + get = g_strdup_printf("g_value_set_object (VAL, %s->%s);", + root, prop->name); + } else if (strcmp (prop->gtktype, "BOXED") == 0) { + if (prop->extra_gtktype == NULL) { + error_print (GOB_ERROR, prop->line_no, + _("Property linking requested for BOXED, but " + "boxed_type not set")); + } + set = g_strdup_printf("{ gpointer ___old = (gpointer)%s->%s; " + "gpointer ___new = (gpointer)gtk_value_get_boxed (VAL); " + "if (___new != ___old) { " + "if (___old != NULL) g_boxed_free (%s, ___old); " + "if (___new != NULL) %s->%s = g_boxed_copy (%s, ___new); " + "else %s->%s = NULL;" + "} " + "}", + root, prop->name, + prop->extra_gtktype, + root, prop->name, + prop->extra_gtktype, + root, prop->name); + get = g_strdup_printf("g_value_set_object (VAL, %s->%s);", + root, prop->name); + } else { + char *set_func; + char *get_func; + set_func = g_strdup_printf ("g_value_set_%s", prop->gtktype); + g_strdown (set_func); + get_func = g_strdup_printf ("g_value_get_%s", prop->gtktype); + g_strdown (get_func); + + set = g_strdup_printf("%s->%s = %s (VAL);", + root, prop->name, + get_func); + get = g_strdup_printf("%s (VAL, %s->%s);", + set_func, + root, prop->name); + + g_free (get_func); + g_free (set_func); + } + + node_set (node, + "get:steal", get, + "get_line", prop->line_no, + "set:steal", set, + "set_line", prop->line_no, + NULL); + } + + if (prop->export) { + export_accessors (prop->name, + prop->get != NULL, prop->get_line, + prop->set != NULL, prop->get_line, + prop->ptype, + prop->gtktype, + prop->line_no); + } +} + + +static char * +debool (char *s) +{ + if (strcmp (s, "BOOL") == 0) { + error_print (GOB_WARN, line_no, + _("BOOL type is deprecated, please use BOOLEAN")); + g_free (s); + return g_strdup ("BOOLEAN"); + } else { + return s; + } +} + +static void +ensure_property (void) +{ + if (property == NULL) + property = (Property *)node_new (PROPERTY_NODE, NULL); +} + + +#line 570 "parse.y" typedef union { char *id; GString *cbuf; @@ -333,26 +624,26 @@ typedef union { -#define YYFINAL 263 +#define YYFINAL 340 #define YYFLAG -32768 -#define YYNTBASE 50 +#define YYNTBASE 65 -#define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 88) +#define YYTRANSLATE(x) ((unsigned)(x) <= 305 ? yytranslate[x] : 110) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 48, 2, 2, 2, 2, 2, 2, 39, - 40, 44, 2, 45, 49, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 41, 47, - 42, 46, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 63, 2, 2, 2, 2, 2, 2, 54, + 55, 60, 2, 58, 64, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 56, 62, + 57, 61, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 37, 43, 38, 2, 2, 2, 2, 2, + 2, 2, 52, 59, 53, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -368,95 +659,114 @@ static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 4, 7, 10, 12, 14, 16, 18, 20, 22, - 24, 27, 29, 34, 38, 44, 45, 50, 55, 58, - 60, 62, 64, 66, 68, 70, 72, 74, 76, 79, - 83, 86, 90, 93, 96, 98, 100, 101, 107, 114, - 126, 135, 141, 147, 149, 153, 154, 158, 160, 163, - 165, 167, 169, 172, 175, 178, 182, 186, 189, 192, - 195, 197, 200, 202, 205, 207, 209, 211, 213, 215, - 217, 219, 221, 223, 225, 227, 229, 231, 234, 237, - 241, 244, 246, 250, 254, 257, 259, 264, 268, 270, - 273, 275, 286, 298, 308, 318, 327, 339, 348, 354, - 357, 362, 363, 365, 368, 370, 372, 375, 378, 382, - 387, 392, 394, 398, 400, 404, 406, 409, 413, 420, - 428, 431, 433, 435, 438, 441, 445, 449, 453, 457, - 459, 462 + 24, 27, 29, 34, 38, 44, 45, 51, 57, 60, + 62, 64, 67, 69, 71, 73, 75, 77, 79, 81, + 83, 86, 90, 93, 97, 100, 103, 105, 107, 108, + 114, 121, 134, 144, 151, 155, 156, 168, 177, 183, + 187, 188, 192, 194, 196, 201, 203, 205, 209, 213, + 217, 221, 225, 229, 233, 237, 241, 245, 249, 253, + 255, 261, 263, 267, 268, 272, 274, 277, 279, 281, + 283, 286, 289, 292, 296, 300, 303, 306, 309, 311, + 314, 316, 319, 321, 323, 325, 327, 329, 331, 333, + 335, 337, 339, 341, 343, 345, 348, 351, 355, 358, + 360, 364, 368, 371, 373, 378, 382, 384, 387, 389, + 400, 412, 422, 432, 441, 453, 462, 468, 471, 476, + 477, 479, 482, 484, 486, 489, 492, 496, 501, 506, + 508, 512, 514, 518, 520, 523, 527, 534, 542, 545, + 547, 549, 552, 555, 559, 563, 567, 571, 573, 576, + 578 }; -static const short yyrhs[] = { 52, - 53, 52, 0, 53, 52, 0, 52, 53, 0, 53, - 0, 23, 0, 26, 0, 24, 0, 25, 0, 27, - 0, 28, 0, 52, 51, 0, 51, 0, 54, 37, - 56, 38, 0, 54, 37, 38, 0, 3, 21, 4, - 21, 55, 0, 0, 39, 19, 19, 40, 0, 39, - 19, 20, 40, 0, 56, 57, 0, 57, 0, 78, - 0, 62, 0, 63, 0, 41, 0, 29, 0, 30, - 0, 31, 0, 32, 0, 19, 19, 0, 19, 37, - 23, 0, 42, 87, 0, 42, 37, 23, 0, 59, - 60, 0, 60, 59, 0, 60, 0, 59, 0, 0, - 58, 67, 19, 61, 41, 0, 58, 67, 19, 22, - 61, 41, 0, 33, 65, 64, 19, 19, 37, 23, - 19, 37, 23, 41, 0, 33, 65, 64, 19, 19, - 37, 23, 41, 0, 33, 65, 64, 19, 19, 0, - 19, 39, 19, 67, 40, 0, 19, 0, 39, 66, - 40, 0, 0, 19, 43, 66, 0, 19, 0, 68, - 72, 0, 68, 0, 69, 0, 19, 0, 5, 19, - 0, 19, 5, 0, 71, 19, 0, 5, 71, 19, - 0, 71, 19, 5, 0, 70, 69, 0, 21, 69, - 0, 5, 69, 0, 21, 0, 21, 5, 0, 70, - 0, 70, 5, 0, 6, 0, 18, 0, 14, 0, - 15, 0, 13, 0, 16, 0, 17, 0, 11, 0, - 12, 0, 7, 0, 8, 0, 9, 0, 44, 0, - 44, 5, 0, 44, 72, 0, 44, 5, 72, 0, - 19, 75, 0, 75, 0, 58, 19, 75, 0, 19, - 58, 75, 0, 58, 75, 0, 73, 0, 19, 39, - 76, 40, 0, 76, 45, 19, 0, 19, 0, 37, - 23, 0, 41, 0, 35, 65, 74, 67, 19, 39, - 81, 40, 79, 77, 0, 58, 35, 65, 73, 67, - 19, 39, 81, 40, 79, 77, 0, 34, 58, 67, - 19, 39, 81, 40, 79, 77, 0, 58, 34, 67, - 19, 39, 81, 40, 79, 77, 0, 34, 67, 19, - 39, 81, 40, 79, 77, 0, 36, 39, 21, 40, - 67, 19, 39, 81, 40, 79, 77, 0, 58, 67, - 19, 39, 81, 40, 79, 77, 0, 19, 39, 19, - 40, 77, 0, 19, 80, 0, 19, 80, 19, 80, - 0, 0, 87, 0, 37, 23, 0, 6, 0, 19, - 0, 19, 5, 0, 5, 19, 0, 19, 45, 82, - 0, 19, 5, 45, 82, 0, 5, 19, 45, 82, - 0, 82, 0, 83, 45, 10, 0, 83, 0, 83, - 45, 84, 0, 84, 0, 67, 19, 0, 67, 19, - 22, 0, 67, 19, 39, 19, 85, 40, 0, 67, - 19, 22, 39, 19, 85, 40, 0, 85, 86, 0, - 86, 0, 19, 0, 46, 87, 0, 47, 87, 0, - 46, 42, 87, 0, 47, 42, 87, 0, 42, 42, - 87, 0, 48, 42, 87, 0, 20, 0, 49, 20, - 0, 19, 0 +static const short yyrhs[] = { 67, + 68, 67, 0, 68, 67, 0, 67, 68, 0, 68, + 0, 24, 0, 27, 0, 25, 0, 26, 0, 28, + 0, 29, 0, 67, 66, 0, 66, 0, 69, 52, + 71, 53, 0, 69, 52, 53, 0, 3, 21, 4, + 21, 70, 0, 0, 54, 19, 19, 55, 70, 0, + 54, 19, 20, 55, 70, 0, 71, 72, 0, 72, + 0, 100, 0, 19, 100, 0, 77, 0, 78, 0, + 80, 0, 56, 0, 31, 0, 32, 0, 33, 0, + 34, 0, 19, 19, 0, 19, 52, 24, 0, 57, + 109, 0, 57, 52, 24, 0, 74, 75, 0, 75, + 74, 0, 75, 0, 74, 0, 0, 73, 89, 19, + 76, 56, 0, 73, 89, 19, 22, 76, 56, 0, + 36, 87, 86, 19, 79, 19, 52, 24, 19, 52, + 24, 56, 0, 36, 87, 86, 19, 79, 19, 52, + 24, 56, 0, 36, 87, 86, 19, 79, 19, 0, + 54, 19, 55, 0, 0, 35, 19, 19, 81, 19, + 52, 24, 19, 52, 24, 56, 0, 35, 19, 19, + 81, 19, 52, 24, 56, 0, 35, 19, 19, 81, + 56, 0, 54, 82, 55, 0, 0, 82, 58, 85, + 0, 85, 0, 30, 0, 19, 54, 30, 55, 0, + 109, 0, 83, 0, 40, 57, 83, 0, 41, 57, + 83, 0, 42, 57, 109, 0, 43, 57, 109, 0, + 44, 57, 84, 0, 45, 57, 88, 0, 46, 57, + 89, 0, 47, 57, 19, 0, 48, 57, 19, 0, + 49, 57, 19, 0, 50, 57, 19, 0, 51, 57, + 19, 0, 19, 0, 19, 54, 19, 89, 55, 0, + 19, 0, 54, 88, 55, 0, 0, 19, 59, 88, + 0, 19, 0, 90, 94, 0, 90, 0, 91, 0, + 19, 0, 5, 19, 0, 19, 5, 0, 93, 19, + 0, 5, 93, 19, 0, 93, 19, 5, 0, 92, + 91, 0, 21, 91, 0, 5, 91, 0, 21, 0, + 21, 5, 0, 92, 0, 92, 5, 0, 6, 0, + 18, 0, 14, 0, 15, 0, 13, 0, 16, 0, + 17, 0, 11, 0, 12, 0, 7, 0, 8, 0, + 9, 0, 60, 0, 60, 5, 0, 60, 94, 0, + 60, 5, 94, 0, 19, 97, 0, 97, 0, 73, + 19, 97, 0, 19, 73, 97, 0, 73, 97, 0, + 95, 0, 19, 54, 98, 55, 0, 98, 58, 19, + 0, 19, 0, 52, 24, 0, 56, 0, 38, 87, + 96, 89, 19, 54, 103, 55, 101, 99, 0, 73, + 38, 87, 95, 89, 19, 54, 103, 55, 101, 99, + 0, 37, 73, 89, 19, 54, 103, 55, 101, 99, + 0, 73, 37, 89, 19, 54, 103, 55, 101, 99, + 0, 37, 89, 19, 54, 103, 55, 101, 99, 0, + 39, 54, 21, 55, 89, 19, 54, 103, 55, 101, + 99, 0, 73, 89, 19, 54, 103, 55, 101, 99, + 0, 19, 54, 19, 55, 99, 0, 19, 102, 0, + 19, 102, 19, 102, 0, 0, 109, 0, 52, 24, + 0, 6, 0, 19, 0, 19, 5, 0, 5, 19, + 0, 19, 58, 104, 0, 19, 5, 58, 104, 0, + 5, 19, 58, 104, 0, 104, 0, 105, 58, 10, + 0, 105, 0, 105, 58, 106, 0, 106, 0, 89, + 19, 0, 89, 19, 22, 0, 89, 19, 54, 19, + 107, 55, 0, 89, 19, 22, 54, 19, 107, 55, + 0, 107, 108, 0, 108, 0, 19, 0, 61, 109, + 0, 62, 109, 0, 61, 57, 109, 0, 62, 57, + 109, 0, 57, 57, 109, 0, 63, 57, 109, 0, + 20, 0, 64, 20, 0, 23, 0, 19, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 311, 312, 313, 314, 317, 323, 329, 335, 341, 347, - 355, 356, 359, 364, 371, 376, 377, 385, 396, 397, - 400, 401, 402, 403, 406, 407, 408, 409, 412, 425, - 441, 445, 453, 454, 455, 456, 457, 463, 466, 470, - 506, 535, 609, 618, 624, 625, 628, 631, 637, 641, - 648, 651, 654, 658, 662, 666, 671, 679, 683, 688, - 692, 695, 699, 702, 707, 708, 709, 710, 711, 712, - 713, 714, 715, 718, 719, 720, 723, 724, 725, 729, - 736, 748, 754, 766, 778, 781, 787, 792, 795, 800, - 801, 805, 821, 837, 853, 869, 880, 886, 896, 919, - 930, 949, 955, 956, 962, 963, 974, 985, 996, 1006, - 1016, 1026, 1029, 1030, 1033, 1034, 1037, 1040, 1043, 1051, - 1061, 1062, 1065, 1078, 1082, 1086, 1090, 1094, 1098, 1104, - 1105, 1109 + 591, 592, 593, 594, 597, 606, 615, 624, 633, 642, + 653, 654, 657, 662, 669, 679, 680, 692, 706, 707, + 710, 711, 719, 720, 721, 722, 725, 726, 727, 728, + 731, 751, 775, 779, 787, 788, 789, 790, 791, 797, + 800, 805, 873, 927, 1015, 1023, 1028, 1076, 1112, 1128, + 1129, 1132, 1133, 1136, 1137, 1149, 1150, 1153, 1159, 1165, + 1171, 1177, 1183, 1189, 1196, 1202, 1208, 1214, 1220, 1226, + 1246, 1255, 1261, 1262, 1265, 1268, 1274, 1281, 1290, 1293, + 1296, 1300, 1304, 1308, 1313, 1321, 1325, 1330, 1334, 1337, + 1341, 1344, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, + 1357, 1360, 1361, 1362, 1365, 1366, 1367, 1371, 1378, 1390, + 1396, 1408, 1420, 1423, 1429, 1434, 1437, 1442, 1443, 1447, + 1463, 1479, 1495, 1511, 1522, 1528, 1538, 1561, 1572, 1591, + 1597, 1598, 1604, 1605, 1616, 1627, 1638, 1648, 1658, 1668, + 1671, 1672, 1675, 1676, 1679, 1682, 1685, 1693, 1703, 1704, + 1707, 1724, 1731, 1738, 1745, 1752, 1759, 1768, 1769, 1773, + 1774 }; #endif @@ -466,11 +776,14 @@ static const short yyrline[] = { 0, static const char * const yytname[] = { "$","error","$undefined.","CLASS", "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED", "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM", -"CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED", -"CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","'('","')'", -"';'","'='","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes", -"class","classdec","chunk","classcode","thing","scope","destructor","initializer", -"varoptions","variable","argument","argtype","flags","flaglist","type","specifier_list", +"SINGLE_CHAR","CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","STRING","PUBLIC", +"PRIVATE","PROTECTED","CLASSWIDE","PROPERTY","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE", +"NICK","BLURB","MAXIMUM","MINIMUM","DEFAULT_VALUE","FLAGS","TYPE","FLAGS_TYPE", +"ENUM_TYPE","PARAM_TYPE","BOXED_TYPE","OBJECT_TYPE","'{'","'}'","'('","')'", +"';'","'='","','","'|'","'*'","'>'","'<'","'!'","'-'","prog","ccode","ccodes", +"class","classdec","classflags","classcode","thing","scope","destructor","initializer", +"varoptions","variable","argument","export","property","param_spec","param_spec_list", +"string","anyval","param_spec_value","argtype","flags","flaglist","type","specifier_list", "spec_list","specifier","strunionenum","pointer","simplesigtype","fullsigtype", "sigtype","tokenlist","codenocode","method","returnvals","retcode","funcargs", "arglist","arglist1","arg","checklist","check","numtok", NULL @@ -478,205 +791,243 @@ static const char * const yytname[] = { "$","error","$undefined.","CLASS", #endif static const short yyr1[] = { 0, - 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, - 52, 52, 53, 53, 54, 55, 55, 55, 56, 56, - 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, - 60, 60, 61, 61, 61, 61, 61, 62, 62, 63, - 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, - 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, - 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, - 73, 73, 74, 74, 74, 74, 75, 76, 76, 77, - 77, 78, 78, 78, 78, 78, 78, 78, 78, 79, - 79, 79, 80, 80, 81, 81, 81, 81, 81, 81, - 81, 81, 82, 82, 83, 83, 84, 84, 84, 84, - 85, 85, 86, 86, 86, 86, 86, 86, 86, 87, - 87, 87 + 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, + 67, 67, 68, 68, 69, 70, 70, 70, 71, 71, + 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, + 74, 74, 75, 75, 76, 76, 76, 76, 76, 77, + 77, 78, 78, 78, 79, 79, 80, 80, 80, 81, + 81, 82, 82, 83, 83, 84, 84, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, + 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, + 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 93, 93, 93, 94, 94, 94, 94, 95, 95, + 96, 96, 96, 96, 97, 98, 98, 99, 99, 100, + 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, + 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, + 104, 104, 105, 105, 106, 106, 106, 106, 107, 107, + 108, 108, 108, 108, 108, 108, 108, 109, 109, 109, + 109 }; static const short yyr2[] = { 0, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 2, 1, 4, 3, 5, 0, 4, 4, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 2, 3, 2, 2, 1, 1, 0, 5, 6, 11, - 8, 5, 5, 1, 3, 0, 3, 1, 2, 1, - 1, 1, 2, 2, 2, 3, 3, 2, 2, 2, - 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, - 2, 1, 3, 3, 2, 1, 4, 3, 1, 2, - 1, 10, 11, 9, 9, 8, 11, 8, 5, 2, - 4, 0, 1, 2, 1, 1, 2, 2, 3, 4, - 4, 1, 3, 1, 3, 1, 2, 3, 6, 7, - 2, 1, 1, 2, 2, 3, 3, 3, 3, 1, - 2, 1 + 2, 1, 4, 3, 5, 0, 5, 5, 2, 1, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 3, 2, 3, 2, 2, 1, 1, 0, 5, + 6, 12, 9, 6, 3, 0, 11, 8, 5, 3, + 0, 3, 1, 1, 4, 1, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, + 5, 1, 3, 0, 3, 1, 2, 1, 1, 1, + 2, 2, 2, 3, 3, 2, 2, 2, 1, 2, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 2, 3, 2, 1, + 3, 3, 2, 1, 4, 3, 1, 2, 1, 10, + 11, 9, 9, 8, 11, 8, 5, 2, 4, 0, + 1, 2, 1, 1, 2, 2, 3, 4, 4, 1, + 3, 1, 3, 1, 2, 3, 6, 7, 2, 1, + 1, 2, 2, 3, 3, 3, 3, 1, 2, 1, + 1 }; static const short yydefact[] = { 0, 0, 5, 7, 8, 6, 9, 10, 12, 0, 4, - 0, 0, 11, 3, 2, 0, 0, 1, 0, 25, - 26, 27, 28, 46, 0, 46, 0, 14, 24, 0, - 20, 0, 22, 23, 21, 16, 0, 0, 0, 0, - 65, 74, 75, 76, 72, 73, 69, 67, 68, 70, - 71, 66, 52, 61, 0, 0, 50, 51, 63, 0, - 0, 0, 13, 19, 0, 46, 0, 0, 15, 0, - 48, 0, 44, 0, 0, 53, 60, 0, 54, 62, - 59, 0, 0, 77, 49, 64, 58, 55, 0, 0, - 86, 0, 82, 0, 0, 0, 37, 0, 0, 0, - 45, 0, 0, 56, 0, 0, 78, 79, 57, 0, - 0, 0, 81, 0, 85, 0, 0, 0, 0, 0, - 0, 37, 0, 0, 36, 35, 0, 0, 0, 0, - 91, 99, 47, 0, 42, 0, 0, 65, 52, 0, - 0, 112, 114, 116, 80, 89, 0, 84, 83, 0, - 0, 0, 0, 29, 0, 0, 0, 132, 130, 0, - 0, 31, 33, 34, 38, 17, 18, 90, 0, 0, - 0, 53, 54, 0, 117, 102, 0, 87, 0, 0, - 0, 0, 0, 30, 39, 102, 32, 131, 43, 0, - 102, 0, 0, 109, 118, 0, 0, 0, 113, 115, - 88, 0, 0, 102, 0, 0, 0, 41, 0, 111, - 110, 0, 0, 0, 100, 103, 96, 102, 0, 0, - 0, 98, 0, 94, 0, 123, 0, 0, 0, 0, - 0, 122, 104, 0, 0, 102, 95, 102, 0, 0, - 0, 0, 124, 0, 125, 0, 119, 121, 101, 92, - 0, 0, 40, 120, 128, 126, 127, 129, 97, 93, - 0, 0, 0 + 0, 0, 11, 3, 2, 0, 0, 1, 0, 27, + 28, 29, 30, 0, 74, 0, 74, 0, 14, 26, + 0, 20, 0, 23, 24, 25, 21, 16, 0, 0, + 0, 22, 0, 0, 0, 0, 93, 102, 103, 104, + 100, 101, 97, 95, 96, 98, 99, 94, 80, 89, + 0, 0, 78, 79, 91, 0, 0, 0, 13, 19, + 0, 74, 0, 0, 15, 0, 0, 51, 76, 0, + 72, 0, 0, 81, 88, 0, 82, 90, 87, 0, + 0, 105, 77, 92, 86, 83, 0, 0, 114, 0, + 110, 0, 0, 0, 39, 0, 0, 0, 0, 0, + 0, 73, 0, 46, 84, 0, 0, 106, 107, 85, + 0, 0, 0, 109, 0, 113, 0, 0, 0, 0, + 0, 0, 39, 0, 0, 38, 37, 0, 0, 0, + 0, 119, 127, 70, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 53, 0, 49, + 75, 0, 0, 0, 0, 0, 93, 80, 0, 0, + 140, 142, 144, 108, 117, 0, 112, 111, 0, 0, + 0, 0, 31, 0, 0, 0, 161, 158, 160, 0, + 0, 33, 35, 36, 40, 16, 16, 118, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 50, 0, 0, 0, 0, 44, 0, 81, 82, 0, + 145, 130, 0, 115, 0, 0, 0, 0, 0, 32, + 41, 130, 34, 159, 17, 18, 0, 54, 58, 59, + 60, 61, 161, 57, 62, 56, 63, 64, 65, 66, + 67, 68, 69, 52, 0, 71, 45, 0, 130, 0, + 0, 137, 146, 0, 0, 0, 141, 143, 116, 0, + 0, 130, 0, 0, 0, 0, 48, 0, 0, 139, + 138, 0, 0, 0, 128, 131, 124, 130, 0, 0, + 0, 126, 0, 0, 0, 43, 122, 0, 151, 0, + 0, 0, 0, 0, 150, 132, 0, 0, 130, 123, + 130, 55, 0, 0, 0, 0, 0, 152, 0, 153, + 0, 147, 149, 129, 120, 0, 0, 47, 0, 148, + 156, 154, 155, 157, 125, 121, 42, 0, 0, 0 }; -static const short yydefgoto[] = { 261, - 8, 9, 10, 11, 69, 30, 31, 32, 125, 126, - 127, 33, 34, 74, 39, 72, 140, 57, 58, 59, - 60, 85, 91, 92, 93, 147, 132, 35, 198, 215, - 141, 142, 143, 144, 231, 232, 216 +static const short yydefgoto[] = { 338, + 8, 9, 10, 11, 75, 31, 32, 33, 136, 137, + 138, 34, 35, 164, 36, 110, 157, 239, 245, 158, + 82, 45, 80, 169, 63, 64, 65, 66, 93, 99, + 100, 101, 176, 143, 37, 266, 285, 170, 171, 172, + 173, 304, 305, 286 }; -static const short yypact[] = { 88, - -12,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88, 347, - -15, 15,-32768, 347, 347, 157, 18, 347, 7,-32768, --32768,-32768,-32768, 25, 153, 25, 36,-32768,-32768, 175, --32768, 118,-32768,-32768,-32768, 67, 102, 122, 135, 245, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 22, 313, 262, 144, 131,-32768, 327, 160, - 198, 159,-32768,-32768, 262, 25, 162, 180,-32768, 161, - 171, 178, 164, 181, 341,-32768,-32768, 183,-32768, 341, --32768, 196, 182, 8,-32768, 341,-32768, 214, 193, 201, --32768, 262,-32768, 186, 212, 229, 48, 62, 57, 122, --32768, 236, 246,-32768, 233, 279, 131,-32768,-32768, 243, - 270, 280,-32768, 50,-32768, 287, 262, 277, 50, 262, - -1, 9, 279, -5, 278, 302, 281, 283, 295, 314, --32768,-32768,-32768, 262, 299, 279, 296, 309, 0, 331, - 311,-32768, 316,-32768,-32768,-32768, 98,-32768,-32768, 324, - 345, 279, 346,-32768, 344, 335, 328,-32768,-32768, 354, - 358,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 339, 357, - 342, 104, 105, 262, 38, 362, 228,-32768, 364, 279, - 348, 349, 352,-32768,-32768, 362,-32768,-32768,-32768, 16, - 362, 262, 262,-32768, 353, 365, 10, 57,-32768,-32768, --32768, 350, 279, 362, 279, 57, 356,-32768, 57,-32768, --32768, 366, 109, 363, 369,-32768,-32768, 362, 355, 57, - 359,-32768, 371,-32768, 109,-32768, 360, 43, 53, 361, - 61,-32768,-32768, 10, 57, 362,-32768, 362, 367, 100, - 6, 6,-32768, 6,-32768, 6,-32768,-32768,-32768,-32768, - 57, 57,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 396, 397,-32768 +static const short yypact[] = { 144, + -7,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 144, 407, + -21, 40,-32768, 407, 407, 121, 71, 407, 166,-32768, +-32768,-32768,-32768, 78, 45, 266, 45, 54,-32768,-32768, + 156,-32768, 216,-32768,-32768,-32768,-32768, 92, 94, 97, + 216,-32768, 157, 159, 160, 313,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 158, 381, + 330, 164, 136,-32768, 395, 183, 257, 185,-32768,-32768, + 330, 45, 200, 207,-32768, 184, 221, 187, 188, 189, + 192, 223, 409,-32768,-32768, 229,-32768, 409,-32768, 230, + 197, 1,-32768, 409,-32768, 247, 182, 236,-32768, 330, +-32768, 201, 238, 239, 68, 10, 61, 232, 219, 22, + 159,-32768, 273, 240,-32768, 241, 347, 136,-32768,-32768, + 242, 274, 297,-32768, -4,-32768, 304, 330, 279, -4, + 330, 60, -9, 347, 0, 283, 331, 301, 312, 319, + 360,-32768,-32768,-32768, 332, 333, 334, 346, 348, 361, + 362, 371, 372, 380, 382, 383, 106,-32768, 336,-32768, +-32768, 330, 385, 398, 347, 364, 386, 7, 419, 387, +-32768, 388,-32768,-32768,-32768, 107,-32768,-32768, 389, 425, + 347, 426,-32768, 423, 392, 394,-32768,-32768,-32768, 427, + 430,-32768,-32768,-32768,-32768, 92, 92,-32768, 13, 13, + 37, 37, 5, 159, 330, 433, 434, 435, 436, 437, +-32768, 219, 438, 402, 403, 408, 404, 152, 153, 330, + 66, 442, 296,-32768, 444, 347, 410, 411, 413,-32768, +-32768, 442,-32768,-32768,-32768,-32768, 414,-32768,-32768,-32768, +-32768,-32768, 414,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768, 39,-32768,-32768, 441, 442, 330, + 330,-32768, 415, 451, 19, 61,-32768,-32768,-32768, 416, + 347, 442, 347, 61, 443, 420,-32768, 53, 61,-32768, +-32768, 455, 88, 452, 456,-32768,-32768, 442, 422, 61, + 424,-32768, 428, 454, 429,-32768,-32768, 88,-32768, 431, + 57, 62, 432, 72,-32768,-32768, 19, 61, 442,-32768, + 442,-32768, 439, 458, 81, 37, 37,-32768, 37,-32768, + 37,-32768,-32768,-32768,-32768, 61, 61,-32768, 440,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768, 480, 484,-32768 }; static const short yypgoto[] = {-32768, - 351, 163, 389,-32768,-32768,-32768, 370, -18, 275, 282, - 284,-32768,-32768,-32768, -16, 304, -24,-32768, -38,-32768, - -37, -10, 315,-32768, -36,-32768, -186,-32768, -180, 176, - -119, 4,-32768, 232, 187, -152, -124 + 87, 118, 476,-32768, -66,-32768, 459, -8, 349, 351, + 358,-32768,-32768,-32768,-32768,-32768,-32768, -85,-32768, 280, +-32768, -18, -106, -25,-32768, -43,-32768, -42, -65, 390, +-32768, 120,-32768, -253, 474, -225, 190, -132, -150,-32768, + 275, 202, -211, -135 }; -#define YYLAST 412 - - -static const short yytable[] = { 162, - 56, 77, 78, 157, 173, 206, 55, 67, 12, 61, - 209, 217, 107, 158, 159, 81, 171, 154, 17, 222, - 87, 16, 224, 220, 158, 159, 79, 121, 158, 159, - 82, 160, 182, 237, 207, 155, 77, 235, 36, -106, - 95, 77, 90, 161, 174, 37, 214, 77, 250, 96, - 124, 84, 113, 115, 161, 251, 208, 252, 161, 195, - 202, 158, 159, 38, 259, 260, 121, 116, 110, 122, - 112, 158, 159, 108, 62, 148, 196, 149, 248, 226, - 128, 129, 113, 219, 242, 221, 123, 248, 111, 124, - 1, 161, 151, 130, 244, 153, 145, 131, 77, 78, - 247, 161, 227, 243, 245, 68, 228, 229, 230, 169, - 2, 3, 4, 5, 6, 7, 255, 256, 226, 257, - 70, 258, 40, 41, 42, 43, 44, 226, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 178, 54, 254, - 71, 227, 179, -108, -107, 228, 229, 230, 192, 193, - 227, 65, 66, 73, 228, 229, 230, 40, 41, 42, - 43, 44, 83, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 15, 54, 84, 19, 18, 194, 88, 94, - 97, 20, 21, 22, 23, 20, 21, 22, 23, 24, - 25, 26, 27, 19, 28, 210, 211, 29, 98, 103, - 99, 104, 102, 20, 21, 22, 23, 24, 25, 26, - 27, 110, 63, 100, 105, 29, 89, 101, 109, 114, - 106, 20, 21, 22, 23, 117, 20, 21, 22, 23, - 118, 111, 40, 41, 42, 43, 44, 199, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 119, 54, 75, - 41, 42, 43, 44, 134, 45, 46, 47, 48, 49, - 50, 51, 52, 76, 135, 54, 40, 41, 42, 43, - 44, 136, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 111, 54, 137, 138, 42, 43, 44, 146, 45, - 46, 47, 48, 49, 50, 51, 52, 139, 110, 54, - 75, 41, 42, 43, 44, 150, 45, 46, 47, 48, - 49, 50, 51, 52, 172, 152, 54, 80, 41, 124, - 121, 165, 166, 45, 46, 47, 48, 49, 50, 51, - 52, 86, 41, 54, 167, 170, 168, 45, 46, 47, - 48, 49, 50, 51, 52, 75, 41, 54, -105, 175, - 176, 45, 46, 47, 48, 49, 50, 51, 52, 13, - 177, 54, 180, 181, 183, 13, 184, 186, 13, 2, - 3, 4, 5, 6, 7, 185, 187, 188, 189, 190, - 197, 191, 201, 213, 225, 233, 203, 234, 204, 218, - 205, 212, 223, 239, 236, 262, 263, 14, 238, 64, - 164, 241, 246, 133, 0, 156, 163, 253, 200, 249, - 120, 240 +#define YYLAST 500 + + +static const short yytable[] = { 192, + 62, 186, 85, 86, 161, 118, 274, 73, 67, 132, + 41, 219, 287, 12, 121, 77, 89, 61, 187, 188, + 292, 95, 189, 243, 188, 297, 119, 189, 139, 140, + 16, 237, 217, 279, 238, 90, 310, 187, 188, 85, + 159, 189, 238, 17, 85, 103, 290, 135, 228, 122, + 85, 190, 174, 104, 325, 187, 188, 276, 98, 189, + 92, -134, 308, 191, 220, 241, 242, 246, 191, 262, + 284, 295, 335, 336, 127, 187, 188, 160, 183, 189, + 187, 188, 191, 326, 189, 327, 132, 263, 123, 133, + 299, 38, 323, 270, 277, 13, 43, 247, 44, 299, + 191, 13, 180, 323, 13, 182, 299, 68, 296, 280, + 281, 184, 141, 317, 240, 76, 142, 244, 319, 264, + 191, 134, 85, 86, 135, 191, 322, 15, 300, 235, + 236, 18, 301, 302, 303, 330, 214, 300, 289, 19, + 291, 301, 302, 303, 300, 74, 1, 40, 301, 302, + 303, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 211, 224, 87, 212, 225, 318, 320, 2, 3, 4, + 5, 6, 7, 29, 19, 78, 30, 79, 81, 248, + 331, 332, 91, 333, 39, 334, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 92, 20, 21, 22, 23, + 121, 96, 26, 27, 28, 102, -136, -135, 69, 260, + 261, 30, 20, 21, 22, 23, 124, 126, 105, 40, + 46, 47, 48, 49, 50, 106, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 122, 60, 144, 107, 108, + 109, 114, 177, 112, 178, 113, 111, 115, 116, 124, + 117, 120, 71, 72, 125, 128, 129, 130, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 46, 47, 48, 49, 50, 97, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 134, 60, 20, 21, 22, + 23, 162, 175, 163, 165, 122, 20, 21, 22, 23, + 46, 47, 48, 49, 50, 267, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 121, 60, 83, 47, 48, + 49, 50, 179, 51, 52, 53, 54, 55, 56, 57, + 58, 84, 181, 60, 46, 47, 48, 49, 50, 135, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 132, + 60, 166, 167, 48, 49, 50, 195, 51, 52, 53, + 54, 55, 56, 57, 58, 168, 196, 60, 83, 47, + 48, 49, 50, 197, 51, 52, 53, 54, 55, 56, + 57, 58, 218, 198, 60, 88, 47, 213, 199, 200, + 201, 51, 52, 53, 54, 55, 56, 57, 58, 94, + 47, 60, 202, 215, 203, 51, 52, 53, 54, 55, + 56, 57, 58, 83, 47, 60, 216, 204, 205, 51, + 52, 53, 54, 55, 56, 57, 58, 206, 207, 60, + 2, 3, 4, 5, 6, 7, 208, 221, 209, 210, + -133, 222, 226, 227, 229, 223, 230, 231, 232, 234, + 233, 249, 250, 251, 252, 253, 256, 257, 259, 258, + 265, 255, 269, 271, 278, 272, 273, 275, 282, 283, + 288, 294, 293, 298, 307, 306, 309, 313, 311, 339, + 314, 329, 312, 340, 14, 194, 193, 316, 321, 70, + 185, 254, 42, 131, 328, 337, 324, 268, 0, 315 }; -static const short yycheck[] = { 124, - 25, 40, 40, 123, 5, 186, 25, 32, 21, 26, - 191, 198, 5, 19, 20, 54, 136, 19, 4, 206, - 59, 37, 209, 204, 19, 20, 5, 19, 19, 20, - 55, 37, 152, 220, 19, 37, 75, 218, 21, 40, - 65, 80, 61, 49, 45, 39, 37, 86, 235, 66, - 42, 44, 89, 90, 49, 236, 41, 238, 49, 22, - 180, 19, 20, 39, 251, 252, 19, 92, 19, 22, - 89, 19, 20, 84, 39, 112, 39, 114, 231, 19, - 19, 20, 119, 203, 42, 205, 39, 240, 39, 42, - 3, 49, 117, 37, 42, 120, 107, 41, 137, 137, - 40, 49, 42, 228, 229, 39, 46, 47, 48, 134, - 23, 24, 25, 26, 27, 28, 241, 242, 19, 244, - 19, 246, 5, 6, 7, 8, 9, 19, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 40, 21, 40, - 19, 42, 45, 40, 40, 46, 47, 48, 45, 45, - 42, 34, 35, 19, 46, 47, 48, 5, 6, 7, - 8, 9, 19, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 10, 21, 44, 19, 14, 174, 19, 21, - 19, 29, 30, 31, 32, 29, 30, 31, 32, 33, - 34, 35, 36, 19, 38, 192, 193, 41, 19, 19, - 40, 19, 39, 29, 30, 31, 32, 33, 34, 35, - 36, 19, 38, 43, 19, 41, 19, 40, 5, 19, - 39, 29, 30, 31, 32, 40, 29, 30, 31, 32, - 19, 39, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 19, 21, 5, - 6, 7, 8, 9, 19, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 19, 21, 5, 6, 7, 8, - 9, 39, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 39, 21, 5, 6, 7, 8, 9, 19, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 19, 21, +static const short yycheck[] = { 135, + 26, 134, 46, 46, 111, 5, 232, 33, 27, 19, + 19, 5, 266, 21, 19, 41, 60, 26, 19, 20, + 274, 65, 23, 19, 20, 279, 92, 23, 19, 20, + 52, 19, 165, 259, 30, 61, 290, 19, 20, 83, + 19, 23, 30, 4, 88, 71, 272, 57, 181, 54, + 94, 52, 118, 72, 308, 19, 20, 19, 67, 23, + 60, 55, 288, 64, 58, 201, 202, 203, 64, 220, + 52, 19, 326, 327, 100, 19, 20, 56, 19, 23, + 19, 20, 64, 309, 23, 311, 19, 22, 97, 22, + 19, 21, 304, 226, 56, 9, 19, 204, 54, 19, + 64, 15, 128, 315, 18, 131, 19, 54, 56, 260, + 261, 52, 52, 57, 200, 19, 56, 203, 57, 54, + 64, 54, 166, 166, 57, 64, 55, 10, 57, 196, + 197, 14, 61, 62, 63, 55, 162, 57, 271, 19, + 273, 61, 62, 63, 57, 54, 3, 54, 61, 62, + 63, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 55, 55, 5, 58, 58, 301, 302, 24, 25, 26, + 27, 28, 29, 53, 19, 19, 56, 19, 19, 205, + 316, 317, 19, 319, 19, 321, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 60, 31, 32, 33, 34, + 19, 19, 37, 38, 39, 21, 55, 55, 53, 58, + 58, 56, 31, 32, 33, 34, 97, 98, 19, 54, + 5, 6, 7, 8, 9, 19, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 54, 21, 19, 55, 19, + 54, 19, 123, 55, 125, 54, 59, 19, 19, 130, + 54, 5, 37, 38, 19, 55, 19, 19, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 5, 6, 7, 8, 9, 19, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 39, 21, 5, 6, 42, - 19, 41, 40, 11, 12, 13, 14, 15, 16, 17, - 18, 5, 6, 21, 40, 37, 23, 11, 12, 13, - 14, 15, 16, 17, 18, 5, 6, 21, 40, 19, - 40, 11, 12, 13, 14, 15, 16, 17, 18, 9, - 45, 21, 39, 19, 19, 15, 23, 40, 18, 23, - 24, 25, 26, 27, 28, 41, 23, 20, 40, 23, - 19, 40, 19, 19, 19, 23, 39, 19, 40, 40, - 39, 39, 37, 23, 40, 0, 0, 9, 40, 30, - 126, 42, 42, 100, -1, 122, 125, 41, 177, 234, - 96, 225 + 15, 16, 17, 18, 19, 54, 21, 31, 32, 33, + 34, 19, 19, 54, 54, 54, 31, 32, 33, 34, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 19, 21, 5, 6, 7, + 8, 9, 19, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 54, 21, 5, 6, 7, 8, 9, 57, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, + 21, 5, 6, 7, 8, 9, 56, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 55, 21, 5, 6, + 7, 8, 9, 55, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 24, 21, 5, 6, 52, 57, 57, + 57, 11, 12, 13, 14, 15, 16, 17, 18, 5, + 6, 21, 57, 19, 57, 11, 12, 13, 14, 15, + 16, 17, 18, 5, 6, 21, 19, 57, 57, 11, + 12, 13, 14, 15, 16, 17, 18, 57, 57, 21, + 24, 25, 26, 27, 28, 29, 57, 19, 57, 57, + 55, 55, 54, 19, 19, 58, 24, 56, 55, 20, + 24, 19, 19, 19, 19, 19, 55, 55, 55, 52, + 19, 24, 19, 54, 24, 55, 54, 54, 54, 19, + 55, 52, 30, 19, 19, 24, 55, 24, 55, 0, + 52, 24, 55, 0, 9, 137, 136, 57, 57, 31, + 133, 212, 19, 104, 56, 56, 307, 223, -1, 298 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/lib/bison.simple" @@ -1222,85 +1573,103 @@ yyreduce: switch (yyn) { case 1: -#line 311 "parse.y" +#line 591 "parse.y" { ; ; break;} case 2: -#line 312 "parse.y" +#line 592 "parse.y" { ; ; break;} case 3: -#line 313 "parse.y" +#line 593 "parse.y" { ; ; break;} case 4: -#line 314 "parse.y" +#line 594 "parse.y" { ; ; break;} case 5: -#line 317 "parse.y" +#line 597 "parse.y" { - Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", C_CCODE, + "cbuf:steal", (yyvsp[0].cbuf)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free(yyvsp[0].cbuf,FALSE); ; break;} case 6: -#line 323 "parse.y" +#line 606 "parse.y" { - Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", H_CCODE, + "cbuf:steal", (yyvsp[0].cbuf)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free(yyvsp[0].cbuf,FALSE); ; break;} case 7: -#line 329 "parse.y" +#line 615 "parse.y" { - Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", HT_CCODE, + "cbuf:steal", (yyvsp[0].cbuf)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free(yyvsp[0].cbuf,FALSE); ; break;} case 8: -#line 335 "parse.y" +#line 624 "parse.y" { - Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", PH_CCODE, + "cbuf:steal", (yyvsp[0].cbuf)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free(yyvsp[0].cbuf,FALSE); ; break;} case 9: -#line 341 "parse.y" +#line 633 "parse.y" { - Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", A_CCODE, + "cbuf:steal", (yyvsp[0].cbuf)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free(yyvsp[0].cbuf,FALSE); ; break;} case 10: -#line 347 "parse.y" +#line 642 "parse.y" { - Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", AT_CCODE, + "cbuf:steal", (yyvsp[0].cbuf)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free(yyvsp[0].cbuf,FALSE); ; break;} case 11: -#line 355 "parse.y" +#line 653 "parse.y" { ; ; break;} case 12: -#line 356 "parse.y" +#line 654 "parse.y" { ; ; break;} case 13: -#line 359 "parse.y" +#line 657 "parse.y" { ((Class *)class)->nodes = class_nodes; class_nodes = NULL; @@ -1308,7 +1677,7 @@ case 13: ; break;} case 14: -#line 364 "parse.y" +#line 662 "parse.y" { ((Class *)class)->nodes = NULL; class_nodes = NULL; @@ -1316,16 +1685,25 @@ case 14: ; break;} case 15: -#line 371 "parse.y" -{ - class = new_class(yyvsp[-3].id,yyvsp[-1].id,chunk_size,NULL); +#line 669 "parse.y" +{ + class = node_new (CLASS_NODE, + "otype:steal", yyvsp[-3].id, + "ptype:steal", yyvsp[-1].id, + "bonobo_x_class:steal", bonobo_x_class, + "chunk_size:steal", chunk_size, + NULL); ; break;} case 17: -#line 377 "parse.y" -{ - if(strcmp(yyvsp[-2].id,"chunks") == 0) { - chunk_size = g_strdup(yyvsp[0].id); +#line 680 "parse.y" +{ + if(strcmp(yyvsp[-3].id,"chunks") == 0) { + g_free (chunk_size); + chunk_size = g_strdup(yyvsp[-2].id); + } else if(strcmp(yyvsp[-3].id,"BonoboX") == 0) { + g_free (bonobo_x_class); + bonobo_x_class = g_strdup(yyvsp[-2].id); } else { yyerror(_("parse error")); YYERROR; @@ -1333,11 +1711,14 @@ case 17: ; break;} case 18: -#line 385 "parse.y" +#line 692 "parse.y" { - if(strcmp(yyvsp[-2].id,"chunks") == 0) { - if(atoi(yyvsp[0].id) != 0) - chunk_size = g_strdup(yyvsp[0].id); + if(strcmp(yyvsp[-3].id,"chunks") == 0) { + g_free (chunk_size); + if(atoi(yyvsp[-2].id) != 0) + chunk_size = g_strdup(yyvsp[-2].id); + else + chunk_size = NULL; } else { yyerror(_("parse error")); YYERROR; @@ -1345,201 +1726,288 @@ case 18: ; break;} case 19: -#line 396 "parse.y" +#line 706 "parse.y" { ; ; break;} case 20: -#line 397 "parse.y" +#line 707 "parse.y" { ; ; break;} case 21: -#line 400 "parse.y" +#line 710 "parse.y" { ; ; break;} case 22: -#line 401 "parse.y" -{ ; ; +#line 711 "parse.y" +{ + if (strcmp (yyvsp[-1].id, "BonoboX") != 0) { + g_free(yyvsp[-1].id); + yyerror(_("parse error")); + YYERROR; + } + last_added_method->bonobo_x_func = TRUE; + ; break;} case 23: -#line 402 "parse.y" +#line 719 "parse.y" { ; ; break;} case 24: -#line 403 "parse.y" +#line 720 "parse.y" { ; ; break;} case 25: -#line 406 "parse.y" -{ the_scope = PUBLIC_SCOPE; ; +#line 721 "parse.y" +{ ; ; break;} case 26: -#line 407 "parse.y" -{ the_scope = PRIVATE_SCOPE; ; +#line 722 "parse.y" +{ ; ; break;} case 27: -#line 408 "parse.y" -{ the_scope = PROTECTED_SCOPE; ; +#line 725 "parse.y" +{ the_scope = PUBLIC_SCOPE; ; break;} case 28: -#line 409 "parse.y" -{ the_scope = CLASS_SCOPE; ; +#line 726 "parse.y" +{ the_scope = PRIVATE_SCOPE; ; break;} case 29: -#line 412 "parse.y" +#line 727 "parse.y" +{ the_scope = PROTECTED_SCOPE; ; + break;} +case 30: +#line 728 "parse.y" +{ the_scope = CLASS_SCOPE; ; + break;} +case 31: +#line 731 "parse.y" { - if(strcmp(yyvsp[-1].id, "destroywith")==0) { - g_free(yyvsp[-1].id); + if (strcmp (yyvsp[-1].id, "destroywith") == 0) { + g_free (yyvsp[-1].id); + destructor_unref = FALSE; + destructor = yyvsp[0].id; + destructor_line = line_no; + destructor_simple = TRUE; + } else if (strcmp (yyvsp[-1].id, "unrefwith") == 0) { + g_free (yyvsp[-1].id); + destructor_unref = TRUE; destructor = yyvsp[0].id; destructor_line = line_no; destructor_simple = TRUE; } else { - g_free(yyvsp[-1].id); - g_free(yyvsp[0].id); - yyerror(_("parse error")); + g_free (yyvsp[-1].id); + g_free (yyvsp[0].id); + yyerror (_("parse error")); YYERROR; } ; break;} -case 30: -#line 425 "parse.y" +case 32: +#line 751 "parse.y" { - if(strcmp(yyvsp[-2].id, "destroy")==0) { + if (strcmp (yyvsp[-2].id, "destroy") == 0) { g_free(yyvsp[-2].id); + destructor_unref = FALSE; destructor = (yyvsp[0].cbuf)->str; g_string_free(yyvsp[0].cbuf, FALSE); destructor_line = ccode_line; destructor_simple = FALSE; + } else if (strcmp (yyvsp[-2].id, "unref") == 0) { + g_free (yyvsp[-2].id); + destructor_unref = TRUE; + destructor = (yyvsp[0].cbuf)->str; + g_string_free (yyvsp[0].cbuf, FALSE); + destructor_line = ccode_line; + destructor_simple = FALSE; } else { - g_free(yyvsp[-2].id); - g_string_free(yyvsp[0].cbuf, TRUE); - yyerror(_("parse error")); + g_free (yyvsp[-2].id); + g_string_free (yyvsp[0].cbuf, TRUE); + yyerror (_("parse error")); YYERROR; } ; break;} -case 31: -#line 441 "parse.y" +case 33: +#line 775 "parse.y" { initializer = yyvsp[0].id; initializer_line = ccode_line; ; break;} -case 32: -#line 445 "parse.y" +case 34: +#line 779 "parse.y" { initializer = (yyvsp[0].cbuf)->str; initializer_line = ccode_line; g_string_free(yyvsp[0].cbuf, FALSE); ; break;} -case 33: -#line 453 "parse.y" +case 35: +#line 787 "parse.y" { ; ; break;} -case 34: -#line 454 "parse.y" +case 36: +#line 788 "parse.y" { ; ; break;} -case 35: -#line 455 "parse.y" +case 37: +#line 789 "parse.y" { destructor = NULL; ; break;} -case 36: -#line 456 "parse.y" +case 38: +#line 790 "parse.y" { initializer = NULL; ; break;} -case 37: -#line 457 "parse.y" +case 39: +#line 791 "parse.y" { destructor = NULL; initializer = NULL; ; break;} -case 38: -#line 463 "parse.y" +case 40: +#line 797 "parse.y" { push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL); ; break;} -case 39: -#line 466 "parse.y" +case 41: +#line 800 "parse.y" { push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id); ; break;} -case 40: -#line 470 "parse.y" +case 42: +#line 805 "parse.y" { + Node *node = NULL; if(strcmp(yyvsp[-6].id,"get")==0 && strcmp(yyvsp[-3].id,"set")==0) { - Node *node; Type *type = pop_type(); - g_free(yyvsp[-6].id); g_free(yyvsp[-3].id); - node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id, - (yyvsp[-4].cbuf)->str,yyvsp[-5].line, - (yyvsp[-1].cbuf)->str,yyvsp[-2].line, - yyvsp[-10].line); - g_string_free(yyvsp[-4].cbuf,FALSE); - g_string_free(yyvsp[-1].cbuf,FALSE); + g_free (yyvsp[-6].id); + g_free (yyvsp[-3].id); + node = node_new (ARGUMENT_NODE, + "gtktype:steal", yyvsp[-9].id, + "atype:steal", type, + "flags:steal", yyvsp[-10].list, + "name:steal", yyvsp[-8].id, + "get:steal", (yyvsp[-4].cbuf)->str, + "get_line", yyvsp[-5].line, + "set:steal", (yyvsp[-1].cbuf)->str, + "set_line", yyvsp[-2].line, + "line_no", yyvsp[-11].line, + NULL); + class_nodes = g_list_append(class_nodes,node); + + g_string_free (yyvsp[-4].cbuf, FALSE); + g_string_free (yyvsp[-1].cbuf, FALSE); + } else if(strcmp(yyvsp[-6].id,"set")==0 && strcmp(yyvsp[-3].id,"get")==0) { - Node *node; Type *type = pop_type(); - g_free(yyvsp[-6].id); g_free(yyvsp[-3].id); - node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id, - (yyvsp[-1].cbuf)->str,yyvsp[-2].line, - (yyvsp[-4].cbuf)->str,yyvsp[-5].line, - yyvsp[-10].line); - g_string_free(yyvsp[-1].cbuf,FALSE); - g_string_free(yyvsp[-4].cbuf,FALSE); + g_free (yyvsp[-6].id); + g_free (yyvsp[-3].id); + node = node_new (ARGUMENT_NODE, + "gtktype:steal", yyvsp[-9].id, + "atype:steal", type, + "flags:steal", yyvsp[-10].list, + "name:steal", yyvsp[-8].id, + "get:steal", (yyvsp[-1].cbuf)->str, + "get_line", yyvsp[-2].line, + "set:steal", (yyvsp[-4].cbuf)->str, + "set_line", yyvsp[-5].line, + "line_no", yyvsp[-11].line, + NULL); + g_string_free (yyvsp[-1].cbuf, FALSE); + g_string_free (yyvsp[-4].cbuf, FALSE); class_nodes = g_list_append(class_nodes,node); } else { - g_free(yyvsp[-8].id); g_free(yyvsp[-7].id); - g_free(yyvsp[-6].id); g_free(yyvsp[-3].id); - g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL); - g_list_free(yyvsp[-9].list); - g_string_free(yyvsp[-1].cbuf,TRUE); - g_string_free(yyvsp[-4].cbuf,TRUE); - yyerror(_("parse error")); + g_free (yyvsp[-9].id); + g_free (yyvsp[-8].id); + g_free (yyvsp[-6].id); + g_free (yyvsp[-3].id); + g_list_foreach (yyvsp[-10].list, (GFunc)g_free, NULL); + g_list_free (yyvsp[-10].list); + g_string_free (yyvsp[-1].cbuf, TRUE); + g_string_free (yyvsp[-4].cbuf, TRUE); + yyerror (_("parse error")); YYERROR; } + + if (yyvsp[-7].id != NULL) { + Argument *arg = (Argument *)node; + export_accessors (arg->name, + arg->get != NULL, arg->get_line, + arg->set != NULL, arg->set_line, + arg->atype, + arg->gtktype, + arg->line_no); + g_free (yyvsp[-7].id); + } + ; break;} -case 41: -#line 506 "parse.y" +case 43: +#line 873 "parse.y" { + Node *node = NULL; if(strcmp(yyvsp[-3].id, "get") == 0) { - Node *node; Type *type = pop_type(); - g_free(yyvsp[-3].id); - node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id, - (yyvsp[-1].cbuf)->str, yyvsp[-2].line, - NULL, 0, yyvsp[-7].line); - g_string_free(yyvsp[-1].cbuf, FALSE); + g_free (yyvsp[-3].id); + node = node_new (ARGUMENT_NODE, + "gtktype:steal", yyvsp[-6].id, + "atype:steal", type, + "flags:steal", yyvsp[-7].list, + "name:steal", yyvsp[-5].id, + "get:steal", (yyvsp[-1].cbuf)->str, + "get_line", yyvsp[-2].line, + "line_no", yyvsp[-8].line, + NULL); + + g_string_free (yyvsp[-1].cbuf, FALSE); class_nodes = g_list_append(class_nodes, node); } else if(strcmp(yyvsp[-3].id, "set") == 0) { - Node *node; Type *type = pop_type(); - g_free(yyvsp[-3].id); - node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id, - NULL, 0, (yyvsp[-1].cbuf)->str, - yyvsp[-2].line, yyvsp[-7].line); - g_string_free(yyvsp[-1].cbuf, FALSE); - class_nodes = g_list_append(class_nodes, node); + g_free (yyvsp[-3].id); + node = node_new (ARGUMENT_NODE, + "gtktype:steal", yyvsp[-6].id, + "atype:steal", type, + "flags:steal", yyvsp[-7].list, + "name:steal", yyvsp[-5].id, + "set:steal", (yyvsp[-1].cbuf)->str, + "set_line", yyvsp[-2].line, + "line_no", yyvsp[-8].line, + NULL); + + g_string_free (yyvsp[-1].cbuf, FALSE); + class_nodes = g_list_append (class_nodes, node); } else { - g_free(yyvsp[-3].id); g_free(yyvsp[-5].id); - g_free(yyvsp[-4].id); - g_list_foreach(yyvsp[-6].list, (GFunc)g_free, NULL); - g_list_free(yyvsp[-6].list); - g_string_free(yyvsp[-1].cbuf, TRUE); + g_free (yyvsp[-3].id); + g_free (yyvsp[-6].id); + g_free (yyvsp[-5].id); + g_list_foreach (yyvsp[-7].list, (GFunc)g_free, NULL); + g_list_free (yyvsp[-7].list); + g_string_free (yyvsp[-1].cbuf, TRUE); yyerror(_("parse error")); YYERROR; } + + if (yyvsp[-4].id != NULL) { + Argument *arg = (Argument *)node; + export_accessors (arg->name, + arg->get != NULL, arg->get_line, + arg->set != NULL, arg->set_line, + arg->atype, + arg->gtktype, + arg->line_no); + g_free (yyvsp[-4].id); + } ; break;} -case 42: -#line 535 "parse.y" +case 44: +#line 927 "parse.y" { Node *node; char *get, *set = NULL; @@ -1548,73 +2016,382 @@ case 42: char *root; if(strcmp(yyvsp[0].id, "link")!=0 && - strcmp(yyvsp[0].id, "stringlink")!=0 && + strcmp(yyvsp[0].id, "stringlink")!=0 && strcmp(yyvsp[0].id, "objectlink")!=0) { - g_free(yyvsp[0].id); g_free(yyvsp[-2].id); - g_free(yyvsp[-1].id); - g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL); - g_list_free(yyvsp[-3].list); + g_free(yyvsp[0].id); + g_free(yyvsp[-3].id); + g_free(yyvsp[-2].id); + g_list_foreach(yyvsp[-4].list,(GFunc)g_free,NULL); + g_list_free(yyvsp[-4].list); yyerror(_("parse error")); YYERROR; } type = pop_type(); - var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line); + var = find_var_or_die(yyvsp[-2].id, yyvsp[-5].line); if(var->scope == PRIVATE_SCOPE) root = "self->_priv"; else if(var->scope == CLASS_SCOPE) { root = "SELF_GET_CLASS(self)"; if(no_self_alias) - error_print(GOB_ERROR, yyvsp[-4].line, + error_print(GOB_ERROR, yyvsp[-5].line, _("Self aliases needed when autolinking to a classwide member")); } else root = "self"; if(strcmp(yyvsp[0].id, "link")==0) { set = g_strdup_printf("%s->%s = ARG;", - root, yyvsp[-1].id); + root, yyvsp[-2].id); } else if(strcmp(yyvsp[0].id, "stringlink")==0) { - set = g_strdup_printf("g_free(%s->%s); " - "%s->%s = g_strdup(ARG);", - root, yyvsp[-1].id, - root, yyvsp[-1].id); + set = g_strdup_printf("g_free (%s->%s); " + "%s->%s = g_strdup (ARG);", + root, yyvsp[-2].id, + root, yyvsp[-2].id); } else if(strcmp(yyvsp[0].id, "objectlink")==0) { set = g_strdup_printf( - "if(%s->%s) " - "gtk_object_unref(GTK_OBJECT(%s->%s)); " - "%s->%s = ARG; " - "if(%s->%s) " - "gtk_object_ref(GTK_OBJECT(%s->%s));", - root, yyvsp[-1].id, - root, yyvsp[-1].id, - root, yyvsp[-1].id, - root, yyvsp[-1].id, - root, yyvsp[-1].id); + "if (ARG != NULL) " + "g_object_ref (G_OBJECT (ARG)); " + "if (%s->%s != NULL) " + "g_object_unref (G_OBJECT (%s->%s)); " + "%s->%s = ARG;", + root, yyvsp[-2].id, + root, yyvsp[-2].id, + root, yyvsp[-2].id); } else { g_assert_not_reached(); } - if(strcmp(yyvsp[0].id, "stringlink")==0) { - get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, yyvsp[-1].id); - } else - /* For everything else, get is just straight assignment */ - get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id); - - g_free(yyvsp[0].id); - - - if(!type) - type = copy_type(var->vtype); - - node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list, - yyvsp[-1].id, get, yyvsp[-4].line, - set, yyvsp[-4].line, yyvsp[-4].line); - class_nodes = g_list_append(class_nodes,node); + get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-2].id); + + g_free (yyvsp[0].id); + + if (type == NULL) + type = (Type *)node_copy ((Node *)var->vtype); + + node = node_new (ARGUMENT_NODE, + "gtktype:steal", yyvsp[-3].id, + "atype:steal", type, + "flags:steal", yyvsp[-4].list, + "name:steal", yyvsp[-2].id, + "get:steal", get, + "get_line", yyvsp[-5].line, + "set:steal", set, + "set_line", yyvsp[-5].line, + "line_no", yyvsp[-5].line, + NULL); + + if (yyvsp[-1].id != NULL) { + Argument *arg = (Argument *)node; + export_accessors (arg->name, + arg->get != NULL, arg->get_line, + arg->set != NULL, arg->set_line, + arg->atype, + arg->gtktype, + arg->line_no); + g_free (yyvsp[-1].id); + } + + class_nodes = g_list_append (class_nodes, node); ; break;} -case 43: -#line 609 "parse.y" +case 45: +#line 1015 "parse.y" +{ + if (strcmp (yyvsp[-1].id, "export")!=0) { + g_free (yyvsp[-1].id); + yyerror (_("parse error")); + YYERROR; + } + yyval.id = yyvsp[-1].id; + ; + break;} +case 46: +#line 1023 "parse.y" +{ + yyval.id = NULL; + ; + break;} +case 47: +#line 1028 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "line_no", yyvsp[-10].line, + "gtktype:steal", debool (yyvsp[-9].id), + "name:steal", yyvsp[-8].id, + NULL); + if (strcmp (yyvsp[-6].id, "get") == 0 && + strcmp (yyvsp[-3].id, "set") == 0) { + node_set ((Node *)property, + "get:steal", (yyvsp[-4].cbuf)->str, + "get_line", yyvsp[-5].line, + "set:steal", (yyvsp[-1].cbuf)->str, + "set_line", yyvsp[-2].line, + NULL); + g_string_free (yyvsp[-4].cbuf, FALSE); + g_string_free (yyvsp[-1].cbuf, FALSE); + g_free (yyvsp[-6].id); + g_free (yyvsp[-3].id); + } else if (strcmp (yyvsp[-6].id, "set") == 0 && + strcmp (yyvsp[-3].id, "get") == 0) { + node_set ((Node *)property, + "get:steal", (yyvsp[-1].cbuf)->str, + "get_line", yyvsp[-2].line, + "set:steal", (yyvsp[-4].cbuf)->str, + "set_line", yyvsp[-5].line, + NULL); + g_string_free (yyvsp[-4].cbuf, FALSE); + g_string_free (yyvsp[-1].cbuf, FALSE); + g_free (yyvsp[-6].id); + g_free (yyvsp[-3].id); + } else { + g_string_free (yyvsp[-4].cbuf, TRUE); + g_string_free (yyvsp[-1].cbuf, TRUE); + g_free (yyvsp[-6].id); + g_free (yyvsp[-3].id); + node_free ((Node *)property); + property = NULL; + yyerror (_("parse error")); + YYERROR; + } + property_link_and_export ((Node *)property); + if (property != NULL) { + class_nodes = g_list_append (class_nodes, + property); + property = NULL; + } + ; + break;} +case 48: +#line 1076 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "line_no", yyvsp[-7].line, + "gtktype:steal", debool (yyvsp[-6].id), + "name:steal", yyvsp[-5].id, + NULL); + if (strcmp (yyvsp[-3].id, "get") == 0) { + node_set ((Node *)property, + "get:steal", (yyvsp[-1].cbuf)->str, + "get_line", yyvsp[-2].line, + NULL); + g_string_free (yyvsp[-1].cbuf, FALSE); + g_free (yyvsp[-3].id); + } else if (strcmp (yyvsp[-3].id, "set") == 0) { + node_set ((Node *)property, + "set:steal", (yyvsp[-1].cbuf)->str, + "set_line", yyvsp[-2].line, + NULL); + g_string_free (yyvsp[-1].cbuf, FALSE); + g_free (yyvsp[-3].id); + } else { + g_string_free (yyvsp[-1].cbuf, TRUE); + g_free (yyvsp[-3].id); + node_free ((Node *)property); + property = NULL; + yyerror (_("parse error")); + YYERROR; + } + property_link_and_export ((Node *)property); + if (property != NULL) { + class_nodes = g_list_append (class_nodes, + property); + property = NULL; + } + ; + break;} +case 49: +#line 1112 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "line_no", yyvsp[-4].line, + "gtktype:steal", debool (yyvsp[-3].id), + "name:steal", yyvsp[-2].id, + NULL); + property_link_and_export ((Node *)property); + if (property != NULL) { + class_nodes = g_list_append (class_nodes, + property); + property = NULL; + } + ; + break;} +case 50: +#line 1128 "parse.y" +{ ; ; + break;} +case 51: +#line 1129 "parse.y" +{ ; ; + break;} +case 52: +#line 1132 "parse.y" +{ ; ; + break;} +case 53: +#line 1133 "parse.y" +{ ; ; + break;} +case 54: +#line 1136 "parse.y" +{ yyval.id = yyvsp[0].id; ; + break;} +case 55: +#line 1137 "parse.y" +{ + if (strcmp (yyvsp[-3].id, "_") != 0) { + g_free (yyvsp[-3].id); + yyerror(_("parse error")); + YYERROR; + } + g_free (yyvsp[-3].id); + yyval.id = g_strconcat ("_(", yyvsp[-1].id, ")", NULL); + g_free (yyvsp[-1].id); + ; + break;} +case 56: +#line 1149 "parse.y" +{ yyval.id = yyvsp[0].id; ; + break;} +case 57: +#line 1150 "parse.y" +{ yyval.id = yyvsp[0].id; ; + break;} +case 58: +#line 1153 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "nick:steal", yyvsp[0].id, + NULL); + ; + break;} +case 59: +#line 1159 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "blurb:steal", yyvsp[0].id, + NULL); + ; + break;} +case 60: +#line 1165 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "maximum:steal", yyvsp[0].id, + NULL); + ; + break;} +case 61: +#line 1171 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "minimum:steal", yyvsp[0].id, + NULL); + ; + break;} +case 62: +#line 1177 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "default_value:steal", yyvsp[0].id, + NULL); + ; + break;} +case 63: +#line 1183 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "flags:steal", yyvsp[0].list, + NULL); + ; + break;} +case 64: +#line 1189 "parse.y" +{ + Type *type = pop_type (); + ensure_property (); + node_set ((Node *)property, + "ptype:steal", type, + NULL); + ; + break;} +case 65: +#line 1196 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", yyvsp[0].id, + NULL); + ; + break;} +case 66: +#line 1202 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", yyvsp[0].id, + NULL); + ; + break;} +case 67: +#line 1208 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", yyvsp[0].id, + NULL); + ; + break;} +case 68: +#line 1214 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", yyvsp[0].id, + NULL); + ; + break;} +case 69: +#line 1220 "parse.y" +{ + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", yyvsp[0].id, + NULL); + ; + break;} +case 70: +#line 1226 "parse.y" +{ + ensure_property (); + if (strcmp (yyvsp[0].id, "link") == 0) { + g_free(yyvsp[0].id); + node_set ((Node *)property, + "link", TRUE, + NULL); + } else if (strcmp (yyvsp[0].id, "export") == 0) { + g_free(yyvsp[0].id); + node_set ((Node *)property, + "export", TRUE, + NULL); + } else { + g_free(yyvsp[0].id); + yyerror(_("parse error")); + YYERROR; + } + ; + break;} +case 71: +#line 1246 "parse.y" { if(strcmp(yyvsp[-2].id,"type")!=0) { g_free(yyvsp[-4].id); @@ -1622,218 +2399,223 @@ case 43: yyerror(_("parse error")); YYERROR; } - yyval.id = yyvsp[-4].id; + yyval.id = debool (yyvsp[-4].id); ; break;} -case 44: -#line 618 "parse.y" +case 72: +#line 1255 "parse.y" { - yyval.id = yyvsp[0].id; + yyval.id = debool (yyvsp[0].id); typestack = g_list_prepend(typestack,NULL); ; break;} -case 45: -#line 624 "parse.y" +case 73: +#line 1261 "parse.y" { yyval.list = yyvsp[-1].list; ; break;} -case 46: -#line 625 "parse.y" +case 74: +#line 1262 "parse.y" { yyval.list = NULL; ; break;} -case 47: -#line 628 "parse.y" +case 75: +#line 1265 "parse.y" { yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id); ; break;} -case 48: -#line 631 "parse.y" +case 76: +#line 1268 "parse.y" { yyval.list = g_list_append(NULL,yyvsp[0].id); ; break;} -case 49: -#line 637 "parse.y" +case 77: +#line 1274 "parse.y" { - Node *node = new_type(yyvsp[-1].id, yyvsp[0].id, NULL); + Node *node = node_new (TYPE_NODE, + "name:steal", yyvsp[-1].id, + "pointer:steal", yyvsp[0].id, + NULL); typestack = g_list_prepend(typestack,node); ; break;} -case 50: -#line 641 "parse.y" +case 78: +#line 1281 "parse.y" { - Node *node = new_type(yyvsp[0].id, NULL, NULL); + Node *node = node_new (TYPE_NODE, + "name:steal", yyvsp[0].id, + NULL); typestack = g_list_prepend(typestack,node); ; break;} -case 51: -#line 648 "parse.y" +case 79: +#line 1290 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 52: -#line 651 "parse.y" +case 80: +#line 1293 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 53: -#line 654 "parse.y" +case 81: +#line 1296 "parse.y" { yyval.id = g_strconcat("const ", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} -case 54: -#line 658 "parse.y" +case 82: +#line 1300 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL); g_free(yyvsp[-1].id); ; break;} -case 55: -#line 662 "parse.y" +case 83: +#line 1304 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} -case 56: -#line 666 "parse.y" +case 84: +#line 1308 "parse.y" { yyval.id = g_strconcat("const ", yyvsp[-1].id, " ", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} -case 57: -#line 671 "parse.y" +case 85: +#line 1313 "parse.y" { yyval.id = g_strconcat(yyvsp[-2].id, " ", yyvsp[-1].id, " const", NULL); g_free(yyvsp[-1].id); ; break;} -case 58: -#line 679 "parse.y" +case 86: +#line 1321 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} -case 59: -#line 683 "parse.y" +case 87: +#line 1325 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL); g_free(yyvsp[-1].id); g_free(yyvsp[0].id); ; break;} -case 60: -#line 688 "parse.y" +case 88: +#line 1330 "parse.y" { yyval.id = g_strconcat("const ", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} -case 61: -#line 692 "parse.y" +case 89: +#line 1334 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 62: -#line 695 "parse.y" +case 90: +#line 1337 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL); g_free(yyvsp[-1].id); ; break;} -case 63: -#line 699 "parse.y" +case 91: +#line 1341 "parse.y" { yyval.id = g_strdup(yyvsp[0].id); ; break;} -case 64: -#line 702 "parse.y" +case 92: +#line 1344 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL); ; break;} -case 65: -#line 707 "parse.y" +case 93: +#line 1349 "parse.y" { yyval.id = "void"; ; break;} -case 66: -#line 708 "parse.y" +case 94: +#line 1350 "parse.y" { yyval.id = "char"; ; break;} -case 67: -#line 709 "parse.y" +case 95: +#line 1351 "parse.y" { yyval.id = "short"; ; break;} -case 68: -#line 710 "parse.y" +case 96: +#line 1352 "parse.y" { yyval.id = "int"; ; break;} -case 69: -#line 711 "parse.y" +case 97: +#line 1353 "parse.y" { yyval.id = "long"; ; break;} -case 70: -#line 712 "parse.y" +case 98: +#line 1354 "parse.y" { yyval.id = "float"; ; break;} -case 71: -#line 713 "parse.y" +case 99: +#line 1355 "parse.y" { yyval.id = "double"; ; break;} -case 72: -#line 714 "parse.y" +case 100: +#line 1356 "parse.y" { yyval.id = "signed"; ; break;} -case 73: -#line 715 "parse.y" +case 101: +#line 1357 "parse.y" { yyval.id = "unsigned"; ; break;} -case 74: -#line 718 "parse.y" +case 102: +#line 1360 "parse.y" { yyval.id = "struct"; ; break;} -case 75: -#line 719 "parse.y" +case 103: +#line 1361 "parse.y" { yyval.id = "union"; ; break;} -case 76: -#line 720 "parse.y" +case 104: +#line 1362 "parse.y" { yyval.id = "enum"; ; break;} -case 77: -#line 723 "parse.y" +case 105: +#line 1365 "parse.y" { yyval.id = g_strdup("*"); ; break;} -case 78: -#line 724 "parse.y" +case 106: +#line 1366 "parse.y" { yyval.id = g_strdup("* const"); ; break;} -case 79: -#line 725 "parse.y" +case 107: +#line 1367 "parse.y" { yyval.id = g_strconcat("*", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} -case 80: -#line 729 "parse.y" +case 108: +#line 1371 "parse.y" { yyval.id = g_strconcat("* const", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} -case 81: -#line 736 "parse.y" +case 109: +#line 1378 "parse.y" { if(strcmp(yyvsp[-1].id, "first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1847,14 +2629,14 @@ case 81: g_free(yyvsp[-1].id); ; break;} -case 82: -#line 748 "parse.y" +case 110: +#line 1390 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} -case 83: -#line 754 "parse.y" +case 111: +#line 1396 "parse.y" { if(strcmp(yyvsp[-1].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1868,8 +2650,8 @@ case 83: g_free(yyvsp[-1].id); ; break;} -case 84: -#line 766 "parse.y" +case 112: +#line 1408 "parse.y" { if(strcmp(yyvsp[-2].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1883,47 +2665,47 @@ case 84: g_free(yyvsp[-2].id); ; break;} -case 85: -#line 778 "parse.y" +case 113: +#line 1420 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} -case 86: -#line 781 "parse.y" +case 114: +#line 1423 "parse.y" { /* the_scope was default thus public */ the_scope = PUBLIC_SCOPE; ; break;} -case 87: -#line 787 "parse.y" +case 115: +#line 1429 "parse.y" { - gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id); + gtktypes = g_list_prepend(gtktypes, debool (yyvsp[-3].id)); ; break;} -case 88: -#line 792 "parse.y" +case 116: +#line 1434 "parse.y" { - gtktypes = g_list_append(gtktypes, yyvsp[0].id); + gtktypes = g_list_append(gtktypes, debool (yyvsp[0].id)); ; break;} -case 89: -#line 795 "parse.y" +case 117: +#line 1437 "parse.y" { - gtktypes = g_list_append(gtktypes, yyvsp[0].id); + gtktypes = g_list_append(gtktypes, debool (yyvsp[0].id)); ; break;} -case 90: -#line 800 "parse.y" +case 118: +#line 1442 "parse.y" { yyval.cbuf = yyvsp[0].cbuf; ; break;} -case 91: -#line 801 "parse.y" +case 119: +#line 1443 "parse.y" { yyval.cbuf = NULL; ; break;} -case 92: -#line 805 "parse.y" +case 120: +#line 1447 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1941,8 +2723,8 @@ case 92: ccode_line, vararg, yyvsp[-8].list); ; break;} -case 93: -#line 821 "parse.y" +case 121: +#line 1463 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1960,8 +2742,8 @@ case 93: ccode_line, vararg, yyvsp[-8].list); ; break;} -case 94: -#line 837 "parse.y" +case 122: +#line 1479 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1979,8 +2761,8 @@ case 94: ccode_line, vararg, NULL); ; break;} -case 95: -#line 853 "parse.y" +case 123: +#line 1495 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1998,8 +2780,8 @@ case 95: ccode_line, vararg, NULL); ; break;} -case 96: -#line 869 "parse.y" +case 124: +#line 1511 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -2012,8 +2794,8 @@ case 96: ccode_line, vararg, NULL); ; break;} -case 97: -#line 880 "parse.y" +case 125: +#line 1522 "parse.y" { push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id, yyvsp[-5].id, yyvsp[0].cbuf, @@ -2021,8 +2803,8 @@ case 97: vararg, NULL); ; break;} -case 98: -#line 886 "parse.y" +case 126: +#line 1528 "parse.y" { if(the_scope == CLASS_SCOPE) { yyerror(_("a method cannot be of class scope")); @@ -2034,8 +2816,8 @@ case 98: vararg, NULL); ; break;} -case 99: -#line 896 "parse.y" +case 127: +#line 1538 "parse.y" { if(strcmp(yyvsp[-4].id, "init")==0) { push_init_arg(yyvsp[-2].id,FALSE); @@ -2058,8 +2840,8 @@ case 99: } ; break;} -case 100: -#line 919 "parse.y" +case 128: +#line 1561 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; @@ -2072,8 +2854,8 @@ case 100: g_free(yyvsp[-1].id); ; break;} -case 101: -#line 930 "parse.y" +case 129: +#line 1572 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; @@ -2094,30 +2876,30 @@ case 101: g_free(yyvsp[-1].id); ; break;} -case 102: -#line 949 "parse.y" +case 130: +#line 1591 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; ; break;} -case 103: -#line 955 "parse.y" +case 131: +#line 1597 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 104: -#line 956 "parse.y" +case 132: +#line 1598 "parse.y" { yyval.id = (yyvsp[1].cbuf)->str; g_string_free(yyvsp[1].cbuf, FALSE); ; break;} -case 105: -#line 962 "parse.y" +case 133: +#line 1604 "parse.y" { vararg = FALSE; has_self = FALSE; ; break;} -case 106: -#line 963 "parse.y" +case 134: +#line 1605 "parse.y" { vararg = FALSE; has_self = TRUE; @@ -2130,8 +2912,8 @@ case 106: } ; break;} -case 107: -#line 974 "parse.y" +case 135: +#line 1616 "parse.y" { vararg = FALSE; has_self = TRUE; @@ -2144,8 +2926,8 @@ case 107: } ; break;} -case 108: -#line 985 "parse.y" +case 136: +#line 1627 "parse.y" { vararg = FALSE; has_self = TRUE; @@ -2158,8 +2940,8 @@ case 108: } ; break;} -case 109: -#line 996 "parse.y" +case 137: +#line 1638 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[-2].id,"self")==0) @@ -2171,8 +2953,8 @@ case 109: } ; break;} -case 110: -#line 1006 "parse.y" +case 138: +#line 1648 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[-3].id,"self")==0) @@ -2184,8 +2966,8 @@ case 110: } ; break;} -case 111: -#line 1016 "parse.y" +case 139: +#line 1658 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[-2].id,"self")==0) @@ -2197,40 +2979,40 @@ case 111: } ; break;} -case 112: -#line 1026 "parse.y" +case 140: +#line 1668 "parse.y" { has_self = FALSE; ; break;} -case 113: -#line 1029 "parse.y" +case 141: +#line 1671 "parse.y" { vararg = TRUE; ; break;} -case 114: -#line 1030 "parse.y" +case 142: +#line 1672 "parse.y" { vararg = FALSE; ; break;} -case 115: -#line 1033 "parse.y" +case 143: +#line 1675 "parse.y" { ; ; break;} -case 116: -#line 1034 "parse.y" +case 144: +#line 1676 "parse.y" { ; ; break;} -case 117: -#line 1037 "parse.y" +case 145: +#line 1679 "parse.y" { push_funcarg(yyvsp[0].id,NULL); ; break;} -case 118: -#line 1040 "parse.y" +case 146: +#line 1682 "parse.y" { push_funcarg(yyvsp[-1].id,yyvsp[0].id); ; break;} -case 119: -#line 1043 "parse.y" +case 147: +#line 1685 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -2240,8 +3022,8 @@ case 119: push_funcarg(yyvsp[-4].id,NULL); ; break;} -case 120: -#line 1051 "parse.y" +case 148: +#line 1693 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -2251,22 +3033,26 @@ case 120: push_funcarg(yyvsp[-5].id,yyvsp[-4].id); ; break;} -case 121: -#line 1061 "parse.y" +case 149: +#line 1703 "parse.y" { ; ; break;} -case 122: -#line 1062 "parse.y" +case 150: +#line 1704 "parse.y" { ; ; break;} -case 123: -#line 1065 "parse.y" +case 151: +#line 1707 "parse.y" { if(strcmp(yyvsp[0].id,"type")==0) { - Node *node = new_check(TYPE_CHECK,NULL); + Node *node = node_new (CHECK_NODE, + "chtype", TYPE_CHECK, + NULL); checks = g_list_append(checks,node); } else if(strcmp(yyvsp[0].id,"null")==0) { - Node *node = new_check(NULL_CHECK,NULL); + Node *node = node_new (CHECK_NODE, + "chtype", NULL_CHECK, + NULL); checks = g_list_append(checks,node); } else { yyerror(_("parse error")); @@ -2275,61 +3061,83 @@ case 123: g_free(yyvsp[0].id); ; break;} -case 124: -#line 1078 "parse.y" +case 152: +#line 1724 "parse.y" { - Node *node = new_check(GT_CHECK,yyvsp[0].id); + Node *node = node_new (CHECK_NODE, + "chtype", GT_CHECK, + "number:steal", yyvsp[0].id, + NULL); checks = g_list_append(checks,node); ; break;} -case 125: -#line 1082 "parse.y" +case 153: +#line 1731 "parse.y" { - Node *node = new_check(LT_CHECK,yyvsp[0].id); + Node *node = node_new (CHECK_NODE, + "chtype", LT_CHECK, + "number:steal", yyvsp[0].id, + NULL); checks = g_list_append(checks,node); ; break;} -case 126: -#line 1086 "parse.y" +case 154: +#line 1738 "parse.y" { - Node *node = new_check(GE_CHECK,yyvsp[0].id); + Node *node = node_new (CHECK_NODE, + "chtype", GE_CHECK, + "number:steal", yyvsp[0].id, + NULL); checks = g_list_append(checks,node); ; break;} -case 127: -#line 1090 "parse.y" +case 155: +#line 1745 "parse.y" { - Node *node = new_check(LE_CHECK,yyvsp[0].id); + Node *node = node_new (CHECK_NODE, + "chtype", LE_CHECK, + "number:steal", yyvsp[0].id, + NULL); checks = g_list_append(checks,node); ; break;} -case 128: -#line 1094 "parse.y" +case 156: +#line 1752 "parse.y" { - Node *node = new_check(EQ_CHECK,yyvsp[0].id); + Node *node = node_new (CHECK_NODE, + "chtype", EQ_CHECK, + "number:steal", yyvsp[0].id, + NULL); checks = g_list_append(checks,node); ; break;} -case 129: -#line 1098 "parse.y" +case 157: +#line 1759 "parse.y" { - Node *node = new_check(NE_CHECK,yyvsp[0].id); + Node *node = node_new (CHECK_NODE, + "chtype", NE_CHECK, + "number:steal", yyvsp[0].id, + NULL); checks = g_list_append(checks,node); ; break;} -case 130: -#line 1104 "parse.y" +case 158: +#line 1768 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 131: -#line 1105 "parse.y" +case 159: +#line 1769 "parse.y" { yyval.id = g_strconcat("-",yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} -case 132: -#line 1109 "parse.y" +case 160: +#line 1773 "parse.y" +{ yyval.id = yyvsp[0].id; ; + break;} +case 161: +#line 1774 "parse.y" { yyval.id = yyvsp[0].id; ; break;} } @@ -2554,5 +3362,5 @@ yyerrhandle: } return 1; } -#line 1112 "parse.y" +#line 1777 "parse.y" diff --git a/src/parse.h b/src/parse.h new file mode 100644 index 0000000..6ebbe8d --- /dev/null +++ b/src/parse.h @@ -0,0 +1,59 @@ +typedef union { + char *id; + GString *cbuf; + GList *list; + int line; + int sigtype; +} YYSTYPE; +#define CLASS 257 +#define FROM 258 +#define CONST 259 +#define VOID 260 +#define STRUCT 261 +#define UNION 262 +#define ENUM 263 +#define THREEDOTS 264 +#define SIGNED 265 +#define UNSIGNED 266 +#define LONG 267 +#define SHORT 268 +#define INT 269 +#define FLOAT 270 +#define DOUBLE 271 +#define CHAR 272 +#define TOKEN 273 +#define NUMBER 274 +#define TYPETOKEN 275 +#define ARRAY_DIM 276 +#define SINGLE_CHAR 277 +#define CCODE 278 +#define HTCODE 279 +#define PHCODE 280 +#define HCODE 281 +#define ACODE 282 +#define ATCODE 283 +#define STRING 284 +#define PUBLIC 285 +#define PRIVATE 286 +#define PROTECTED 287 +#define CLASSWIDE 288 +#define PROPERTY 289 +#define ARGUMENT 290 +#define VIRTUAL 291 +#define SIGNAL 292 +#define OVERRIDE 293 +#define NICK 294 +#define BLURB 295 +#define MAXIMUM 296 +#define MINIMUM 297 +#define DEFAULT_VALUE 298 +#define FLAGS 299 +#define TYPE 300 +#define FLAGS_TYPE 301 +#define ENUM_TYPE 302 +#define PARAM_TYPE 303 +#define BOXED_TYPE 304 +#define OBJECT_TYPE 305 + + +extern YYSTYPE yylval; diff --git a/src/parse.y b/src/parse.y index ba4615b..36f9abc 100644 --- a/src/parse.y +++ b/src/parse.y @@ -1,5 +1,6 @@ /* GOB C Preprocessor - * Copyright (C) 1999 the Free Software Foundation. + * Copyright (C) 1999-2000 the Free Software Foundation. + * Copyright (C) 2001 George Lebl * * Author: George Lebl * @@ -36,15 +37,18 @@ GList *nodes = NULL; static GList *class_nodes = NULL; Node *class = NULL; -char *chunk_size = NULL; +static char *chunk_size = NULL; +static char *bonobo_x_class = NULL; static GList *typestack = NULL; static GList *funcargs = NULL; static GList *checks = NULL; static int has_self = FALSE; static int vararg = FALSE; +static Method *last_added_method = NULL; /* destructor and initializer for variables */ +static gboolean destructor_unref = FALSE; static char *destructor = NULL; static int destructor_line = 0; static gboolean destructor_simple = TRUE; @@ -56,6 +60,8 @@ static char *defreturn = NULL; static GList *gtktypes = NULL; +static Property *property = NULL; + /* this can be a global as we will only do one function at a time anyway */ static int the_scope = NO_SCOPE; @@ -102,24 +108,32 @@ pop_type(void) } static void -push_variable(char *name, int scope, int line_no, char *postfix) +push_variable (char *name, int scope, int line_no, char *postfix) { Node *var; - Type *type = pop_type(); + Type *type = pop_type (); type->postfix = postfix; - var = new_variable(scope, type, name, line_no, - destructor, destructor_line, - destructor_simple, - initializer, initializer_line); + var = node_new (VARIABLE_NODE, + "scope", scope, + "vtype:steal", type, + "id:steal", name, + "line_no", line_no, + "destructor_unref", destructor_unref, + "destructor:steal", destructor, + "destructor_line", destructor_line, + "destructor_simple", destructor_simple, + "initializer:steal", initializer, + "initializer_line", initializer_line, + NULL); class_nodes = g_list_append(class_nodes, var); } static void -push_function(int scope, int method, char *oid, char *id, - GString *cbuf, int line_no, int ccode_line, - gboolean vararg, GList *flags) +push_function (int scope, int method, char *oid, char *id, + GString *cbuf, int line_no, int ccode_line, + gboolean vararg, GList *flags) { Node *node; Type *type; @@ -128,7 +142,9 @@ push_function(int scope, int method, char *oid, char *id, g_assert(scope != CLASS_SCOPE); if(method == INIT_METHOD || method == CLASS_INIT_METHOD) { - type = (Type *)new_type(g_strdup("void"), NULL, NULL); + type = (Type *)node_new (TYPE_NODE, + "name", "void", + NULL); } else { type = pop_type(); } @@ -166,9 +182,25 @@ push_function(int scope, int method, char *oid, char *id, } else c_cbuf = NULL; - node = new_method(scope, method, type, oid, gtktypes, flags, - id, funcargs, onerror, defreturn, c_cbuf, line_no, - ccode_line, vararg, method_unique_id++); + node = node_new (METHOD_NODE, + "scope", scope, + "method", method, + "mtype:steal", type, + "otype:steal", oid, + "gtktypes:steal", gtktypes, + "flags:steal", flags, + "id:steal", id, + "args:steal", funcargs, + "onerror:steal", onerror, + "defreturn:steal", defreturn, + "cbuf:steal", c_cbuf, + "line_no", line_no, + "ccode_line", ccode_line, + "vararg", vararg, + "unique_id", method_unique_id++, + NULL); + + last_added_method = (Method *)node; if(cbuf) g_string_free(cbuf, @@ -199,7 +231,7 @@ free_all_global_state(void) g_list_free(gtktypes); gtktypes = NULL; - free_node_list(funcargs); + node_list_free (funcargs); funcargs = NULL; } @@ -211,7 +243,11 @@ push_funcarg(char *name, char *postfix) type->postfix = postfix; - node = new_funcarg(type, name, checks); + node = node_new (FUNCARG_NODE, + "atype:steal", type, + "name:steal", name, + "checks:steal", checks, + NULL); checks = NULL; funcargs = g_list_append(funcargs, node); @@ -229,8 +265,14 @@ push_init_arg(char *name, int is_class) else tn = g_strdup(((Class *)class)->otype); - type = new_type(tn, g_strdup("*"), NULL); - node = new_funcarg((Type *)type,name,NULL); + type = node_new (TYPE_NODE, + "name:steal", tn, + "pointer", "*", + NULL); + node = node_new (FUNCARG_NODE, + "atype:steal", (Type *)type, + "name:steal", name, + NULL); funcargs = g_list_prepend(funcargs, node); } @@ -240,11 +282,21 @@ push_self(char *id, gboolean constant) Node *node; Node *type; GList *ch = NULL; - type = new_type(g_strdup(((Class *)class)->otype), - g_strdup(constant ? "const *" : "*"), NULL); - ch = g_list_append(ch,new_check(NULL_CHECK,NULL)); - ch = g_list_append(ch,new_check(TYPE_CHECK,NULL)); - node = new_funcarg((Type *)type,id,ch); + type = node_new (TYPE_NODE, + "name", ((Class *)class)->otype, + "pointer", constant ? "const *" : "*", + NULL); + ch = g_list_append (ch, node_new (CHECK_NODE, + "chtype", NULL_CHECK, + NULL)); + ch = g_list_append (ch, node_new (CHECK_NODE, + "chtype", TYPE_CHECK, + NULL)); + node = node_new (FUNCARG_NODE, + "atype:steal", (Type *)type, + "name:steal", id, + "checks:steal", ch, + NULL); funcargs = g_list_prepend(funcargs, node); } @@ -288,6 +340,231 @@ set_return_value(char *type, char *val) return FALSE; } +static void +export_accessors (const char *var_name, + gboolean do_get, + gboolean do_set, + int get_lineno, + int set_lineno, + Type *type, + const char *gtktype, + int lineno) +{ + Type *the_type; + + if (type != NULL) + the_type = (Type *)node_copy ((Node *)type); + else + the_type = get_tree_type (gtktype, TRUE); + + if (the_type == NULL) { + error_print (GOB_ERROR, line_no, + _("Cannot determine type of property or argument")); + return; + } + + if (do_get) { + char *get_id = g_strdup_printf ("get_%s", var_name); + GString *get_cbuf = g_string_new (NULL); + Node *node1 = node_new (TYPE_NODE, + "name", the_type->name, + "pointer", the_type->pointer, + "postfix", the_type->postfix, + NULL); + Node *node3 = node_new (TYPE_NODE, + "name", class->class.otype, + "pointer", "*", + NULL); + + g_string_sprintf (get_cbuf, + "\t%s%s val; " + "g_object_get (G_OBJECT (self), \"%s\", " + "&val, NULL); " + "return val;\n", + the_type->name, + the_type->pointer ? the_type->pointer : "", + var_name); + + typestack = g_list_prepend (typestack, node1); + typestack = g_list_prepend (typestack, node3); + + push_funcarg ("self", FALSE); + + push_function (PUBLIC_SCOPE, REGULAR_METHOD, NULL, + get_id, get_cbuf, get_lineno, + lineno, FALSE, NULL); + } + + if (do_set) { + char *set_id = g_strdup_printf ("set_%s", var_name); + GString *set_cbuf = g_string_new (NULL); + Node *node1 = node_new (TYPE_NODE, + "name", the_type->name, + "pointer", the_type->pointer, + "postfix", the_type->postfix, + NULL); + Node *node2 = node_new (TYPE_NODE, + "name", "void", + NULL); + Node *node3 = node_new (TYPE_NODE, + "name", class->class.otype, + "pointer", "*", + NULL); + + g_string_sprintf (set_cbuf, + "\tg_object_set (G_OBJECT (self), " + "\"%s\", val, NULL);\n", + var_name); + + typestack = g_list_prepend (typestack, node2); + typestack = g_list_prepend (typestack, node1); + typestack = g_list_prepend (typestack, node3); + + push_funcarg ("self", FALSE); + push_funcarg ("val", FALSE); + + typestack = g_list_prepend (typestack, node2); + push_function (PUBLIC_SCOPE, REGULAR_METHOD, NULL, + set_id, set_cbuf, set_lineno, + lineno, FALSE, NULL); + } + + node_free ((Node *)the_type); +} + +static void +property_link_and_export (Node *node) +{ + Property *prop = (Property *)node; + + if (prop->link) { + const char *root; + char *get = NULL, *set = NULL; + Variable *var; + + if (prop->set != NULL || + prop->get != NULL) { + error_print (GOB_ERROR, prop->line_no, + _("Property linking requested, but " + "getters and setters exist")); + } + + var = find_var_or_die (prop->name, prop->line_no); + if(var->scope == PRIVATE_SCOPE) { + root = "self->_priv"; + } else if (var->scope == CLASS_SCOPE) { + root = "SELF_GET_CLASS(self)"; + if (no_self_alias) + error_print (GOB_ERROR, prop->line_no, + _("Self aliases needed when autolinking to a classwide member")); + } else { + root = "self"; + } + + if (strcmp (prop->gtktype, "STRING") == 0) { + set = g_strdup_printf("g_free (%s->%s); " + "%s->%s = g_value_dup_string (VAL);", + root, prop->name, + root, prop->name); + get = g_strdup_printf("g_value_set_string (VAL, %s->%s);", + root, prop->name); + } else if (strcmp (prop->gtktype, "OBJECT") == 0) { + set = g_strdup_printf("{ GtkObject *___old = (GtkObject *)%s->%s; " + "GtkObject *___new = (GtkObject *)gtk_value_get_object (VAL); " + "if (___new != NULL) { " + "gtk_object_ref (GTK_OBJECT (___new)); " + "%s->%s = GTK_OBJECT (___new); " + "} else { " + "%s->%s = NULL; " + "} " + "if (___old != NULL) { " + "gtk_object_unref (GTK_OBJECT (___old)); " + "} " + "}", + root, prop->name, + root, prop->name, + root, prop->name); + get = g_strdup_printf("g_value_set_object (VAL, %s->%s);", + root, prop->name); + } else if (strcmp (prop->gtktype, "BOXED") == 0) { + if (prop->extra_gtktype == NULL) { + error_print (GOB_ERROR, prop->line_no, + _("Property linking requested for BOXED, but " + "boxed_type not set")); + } + set = g_strdup_printf("{ gpointer ___old = (gpointer)%s->%s; " + "gpointer ___new = (gpointer)gtk_value_get_boxed (VAL); " + "if (___new != ___old) { " + "if (___old != NULL) g_boxed_free (%s, ___old); " + "if (___new != NULL) %s->%s = g_boxed_copy (%s, ___new); " + "else %s->%s = NULL;" + "} " + "}", + root, prop->name, + prop->extra_gtktype, + root, prop->name, + prop->extra_gtktype, + root, prop->name); + get = g_strdup_printf("g_value_set_object (VAL, %s->%s);", + root, prop->name); + } else { + char *set_func; + char *get_func; + set_func = g_strdup_printf ("g_value_set_%s", prop->gtktype); + g_strdown (set_func); + get_func = g_strdup_printf ("g_value_get_%s", prop->gtktype); + g_strdown (get_func); + + set = g_strdup_printf("%s->%s = %s (VAL);", + root, prop->name, + get_func); + get = g_strdup_printf("%s (VAL, %s->%s);", + set_func, + root, prop->name); + + g_free (get_func); + g_free (set_func); + } + + node_set (node, + "get:steal", get, + "get_line", prop->line_no, + "set:steal", set, + "set_line", prop->line_no, + NULL); + } + + if (prop->export) { + export_accessors (prop->name, + prop->get != NULL, prop->get_line, + prop->set != NULL, prop->get_line, + prop->ptype, + prop->gtktype, + prop->line_no); + } +} + + +static char * +debool (char *s) +{ + if (strcmp (s, "BOOL") == 0) { + error_print (GOB_WARN, line_no, + _("BOOL type is deprecated, please use BOOLEAN")); + g_free (s); + return g_strdup ("BOOLEAN"); + } else { + return s; + } +} + +static void +ensure_property (void) +{ + if (property == NULL) + property = (Property *)node_new (PROPERTY_NODE, NULL); +} + %} %union { @@ -302,9 +579,12 @@ set_return_value(char *type, char *val) %token CONST VOID STRUCT UNION ENUM THREEDOTS %token SIGNED UNSIGNED LONG SHORT INT FLOAT DOUBLE CHAR -%token TOKEN NUMBER TYPETOKEN ARRAY_DIM -%token CCODE HTCODE PHCODE HCODE ACODE ATCODE -%token PUBLIC PRIVATE PROTECTED CLASSWIDE ARGUMENT VIRTUAL SIGNAL OVERRIDE +%token TOKEN NUMBER TYPETOKEN ARRAY_DIM SINGLE_CHAR +%token CCODE HTCODE PHCODE HCODE ACODE ATCODE STRING +%token PUBLIC PRIVATE PROTECTED CLASSWIDE PROPERTY ARGUMENT +%token VIRTUAL SIGNAL OVERRIDE +%token NICK BLURB MAXIMUM MINIMUM DEFAULT_VALUE FLAGS TYPE +%token FLAGS_TYPE ENUM_TYPE PARAM_TYPE BOXED_TYPE OBJECT_TYPE %% @@ -315,38 +595,56 @@ prog: ccodes class ccodes { ; } ; ccode: CCODE { - Node *node = new_ccode(C_CCODE,($1)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", C_CCODE, + "cbuf:steal", ($1)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free($1,FALSE); } | HCODE { - Node *node = new_ccode(H_CCODE,($1)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", H_CCODE, + "cbuf:steal", ($1)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free($1,FALSE); } | HTCODE { - Node *node = new_ccode(HT_CCODE,($1)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", HT_CCODE, + "cbuf:steal", ($1)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free($1,FALSE); } | PHCODE { - Node *node = new_ccode(PH_CCODE,($1)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", PH_CCODE, + "cbuf:steal", ($1)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free($1,FALSE); } | ACODE { - Node *node = new_ccode(A_CCODE,($1)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", A_CCODE, + "cbuf:steal", ($1)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free($1,FALSE); } | ATCODE { - Node *node = new_ccode(AT_CCODE,($1)->str, - ccode_line); + Node *node = node_new (CCODE_NODE, + "cctype", AT_CCODE, + "cbuf:steal", ($1)->str, + "line_no", ccode_line, + NULL); nodes = g_list_append(nodes,node); g_string_free($1,FALSE); } @@ -368,24 +666,36 @@ class: classdec '{' classcode '}' { } ; -classdec: CLASS TYPETOKEN FROM TYPETOKEN chunk { - class = new_class($2,$4,chunk_size,NULL); +classdec: CLASS TYPETOKEN FROM TYPETOKEN classflags { + class = node_new (CLASS_NODE, + "otype:steal", $2, + "ptype:steal", $4, + "bonobo_x_class:steal", bonobo_x_class, + "chunk_size:steal", chunk_size, + NULL); } ; -chunk: - | '(' TOKEN TOKEN ')' { +classflags: + | '(' TOKEN TOKEN ')' classflags { if(strcmp($2,"chunks") == 0) { - chunk_size = g_strdup($4); + g_free (chunk_size); + chunk_size = g_strdup($3); + } else if(strcmp($2,"BonoboX") == 0) { + g_free (bonobo_x_class); + bonobo_x_class = g_strdup($3); } else { yyerror(_("parse error")); YYERROR; } } - | '(' TOKEN NUMBER ')' { + | '(' TOKEN NUMBER ')' classflags { if(strcmp($2,"chunks") == 0) { - if(atoi($4) != 0) - chunk_size = g_strdup($4); + g_free (chunk_size); + if(atoi($3) != 0) + chunk_size = g_strdup($3); + else + chunk_size = NULL; } else { yyerror(_("parse error")); YYERROR; @@ -398,8 +708,17 @@ classcode: classcode thing { ; } ; thing: method { ; } + | TOKEN method { + if (strcmp ($1, "BonoboX") != 0) { + g_free($1); + yyerror(_("parse error")); + YYERROR; + } + last_added_method->bonobo_x_func = TRUE; + } | variable { ; } | argument { ; } + | property { ; } | ';' { ; } ; @@ -410,29 +729,44 @@ scope: PUBLIC { the_scope = PUBLIC_SCOPE; } ; destructor: TOKEN TOKEN { - if(strcmp($1, "destroywith")==0) { - g_free($1); + if (strcmp ($1, "destroywith") == 0) { + g_free ($1); + destructor_unref = FALSE; + destructor = $2; + destructor_line = line_no; + destructor_simple = TRUE; + } else if (strcmp ($1, "unrefwith") == 0) { + g_free ($1); + destructor_unref = TRUE; destructor = $2; destructor_line = line_no; destructor_simple = TRUE; } else { - g_free($1); - g_free($2); - yyerror(_("parse error")); + g_free ($1); + g_free ($2); + yyerror (_("parse error")); YYERROR; } } | TOKEN '{' CCODE { - if(strcmp($1, "destroy")==0) { + if (strcmp ($1, "destroy") == 0) { g_free($1); + destructor_unref = FALSE; destructor = ($3)->str; g_string_free($3, FALSE); destructor_line = ccode_line; destructor_simple = FALSE; + } else if (strcmp ($1, "unref") == 0) { + g_free ($1); + destructor_unref = TRUE; + destructor = ($3)->str; + g_string_free ($3, FALSE); + destructor_line = ccode_line; + destructor_simple = FALSE; } else { - g_free($1); - g_string_free($3, TRUE); - yyerror(_("parse error")); + g_free ($1); + g_string_free ($3, TRUE); + yyerror (_("parse error")); YYERROR; } } @@ -467,82 +801,141 @@ variable: scope type TOKEN varoptions ';' { push_variable($3, the_scope, $1, $4); } ; -argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { - if(strcmp($5,"get")==0 && - strcmp($8,"set")==0) { - Node *node; + +argument: ARGUMENT flags argtype TOKEN export TOKEN '{' CCODE TOKEN '{' CCODE ';' { + Node *node = NULL; + if(strcmp($6,"get")==0 && + strcmp($9,"set")==0) { Type *type = pop_type(); - g_free($5); g_free($8); - node = new_argument($3,type,$2,$4, - ($7)->str,$6, - ($10)->str,$9, - $1); - g_string_free($7,FALSE); - g_string_free($10,FALSE); + g_free ($6); + g_free ($9); + node = node_new (ARGUMENT_NODE, + "gtktype:steal", $3, + "atype:steal", type, + "flags:steal", $2, + "name:steal", $4, + "get:steal", ($8)->str, + "get_line", $7, + "set:steal", ($11)->str, + "set_line", $10, + "line_no", $1, + NULL); + class_nodes = g_list_append(class_nodes,node); - } else if(strcmp($5,"set")==0 && - strcmp($8,"get")==0) { - Node *node; + + g_string_free ($8, FALSE); + g_string_free ($11, FALSE); + + } else if(strcmp($6,"set")==0 && + strcmp($9,"get")==0) { Type *type = pop_type(); - g_free($5); g_free($8); - node = new_argument($3,type,$2,$4, - ($10)->str,$9, - ($7)->str,$6, - $1); - g_string_free($10,FALSE); - g_string_free($7,FALSE); + g_free ($6); + g_free ($9); + node = node_new (ARGUMENT_NODE, + "gtktype:steal", $3, + "atype:steal", type, + "flags:steal", $2, + "name:steal", $4, + "get:steal", ($11)->str, + "get_line", $10, + "set:steal", ($8)->str, + "set_line", $7, + "line_no", $1, + NULL); + g_string_free ($11, FALSE); + g_string_free ($8, FALSE); class_nodes = g_list_append(class_nodes,node); } else { - g_free($3); g_free($4); - g_free($5); g_free($8); - g_list_foreach($2,(GFunc)g_free,NULL); - g_list_free($2); - g_string_free($10,TRUE); - g_string_free($7,TRUE); - yyerror(_("parse error")); + g_free ($3); + g_free ($4); + g_free ($6); + g_free ($9); + g_list_foreach ($2, (GFunc)g_free, NULL); + g_list_free ($2); + g_string_free ($11, TRUE); + g_string_free ($8, TRUE); + yyerror (_("parse error")); YYERROR; } + + if ($5 != NULL) { + Argument *arg = (Argument *)node; + export_accessors (arg->name, + arg->get != NULL, arg->get_line, + arg->set != NULL, arg->set_line, + arg->atype, + arg->gtktype, + arg->line_no); + g_free ($5); + } + } - | ARGUMENT flags argtype TOKEN TOKEN '{' CCODE ';' { - if(strcmp($5, "get") == 0) { - Node *node; + | ARGUMENT flags argtype TOKEN export TOKEN '{' CCODE ';' { + Node *node = NULL; + if(strcmp($6, "get") == 0) { Type *type = pop_type(); - g_free($5); - node = new_argument($3, type, $2, $4, - ($7)->str, $6, - NULL, 0, $1); - g_string_free($7, FALSE); + g_free ($6); + node = node_new (ARGUMENT_NODE, + "gtktype:steal", $3, + "atype:steal", type, + "flags:steal", $2, + "name:steal", $4, + "get:steal", ($8)->str, + "get_line", $7, + "line_no", $1, + NULL); + + g_string_free ($8, FALSE); class_nodes = g_list_append(class_nodes, node); - } else if(strcmp($5, "set") == 0) { - Node *node; + } else if(strcmp($6, "set") == 0) { Type *type = pop_type(); - g_free($5); - node = new_argument($3, type, $2, $4, - NULL, 0, ($7)->str, - $6, $1); - g_string_free($7, FALSE); - class_nodes = g_list_append(class_nodes, node); + g_free ($6); + node = node_new (ARGUMENT_NODE, + "gtktype:steal", $3, + "atype:steal", type, + "flags:steal", $2, + "name:steal", $4, + "set:steal", ($8)->str, + "set_line", $7, + "line_no", $1, + NULL); + + g_string_free ($8, FALSE); + class_nodes = g_list_append (class_nodes, node); } else { - g_free($5); g_free($3); - g_free($4); - g_list_foreach($2, (GFunc)g_free, NULL); - g_list_free($2); - g_string_free($7, TRUE); + g_free ($6); + g_free ($3); + g_free ($4); + g_list_foreach ($2, (GFunc)g_free, NULL); + g_list_free ($2); + g_string_free ($8, TRUE); yyerror(_("parse error")); YYERROR; } + + if ($5 != NULL) { + Argument *arg = (Argument *)node; + export_accessors (arg->name, + arg->get != NULL, arg->get_line, + arg->set != NULL, arg->set_line, + arg->atype, + arg->gtktype, + arg->line_no); + g_free ($5); + } } - | ARGUMENT flags argtype TOKEN TOKEN { + | ARGUMENT flags argtype TOKEN export TOKEN { Node *node; char *get, *set = NULL; Variable *var; Type *type; char *root; - if(strcmp($5, "link")!=0 && - strcmp($5, "stringlink")!=0 && - strcmp($5, "objectlink")!=0) { - g_free($5); g_free($3); + if(strcmp($6, "link")!=0 && + strcmp($6, "stringlink")!=0 && + strcmp($6, "objectlink")!=0) { + g_free($6); + g_free($3); g_free($4); g_list_foreach($2,(GFunc)g_free,NULL); g_list_free($2); @@ -563,23 +956,21 @@ argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { } else root = "self"; - if(strcmp($5, "link")==0) { + if(strcmp($6, "link")==0) { set = g_strdup_printf("%s->%s = ARG;", root, $4); - } else if(strcmp($5, "stringlink")==0) { - set = g_strdup_printf("g_free(%s->%s); " - "%s->%s = g_strdup(ARG);", + } else if(strcmp($6, "stringlink")==0) { + set = g_strdup_printf("g_free (%s->%s); " + "%s->%s = g_strdup (ARG);", root, $4, root, $4); - } else if(strcmp($5, "objectlink")==0) { + } else if(strcmp($6, "objectlink")==0) { set = g_strdup_printf( - "if(%s->%s) " - "gtk_object_unref(GTK_OBJECT(%s->%s)); " - "%s->%s = ARG; " - "if(%s->%s) " - "gtk_object_ref(GTK_OBJECT(%s->%s));", - root, $4, - root, $4, + "if (ARG != NULL) " + "g_object_ref (G_OBJECT (ARG)); " + "if (%s->%s != NULL) " + "g_object_unref (G_OBJECT (%s->%s)); " + "%s->%s = ARG;", root, $4, root, $4, root, $4); @@ -587,23 +978,269 @@ argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { g_assert_not_reached(); } - if(strcmp($5, "stringlink")==0) { - get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, $4); - } else - /* For everything else, get is just straight assignment */ - get = g_strdup_printf("ARG = %s->%s;", root, $4); + get = g_strdup_printf("ARG = %s->%s;", root, $4); + + g_free ($6); + + if (type == NULL) + type = (Type *)node_copy ((Node *)var->vtype); + + node = node_new (ARGUMENT_NODE, + "gtktype:steal", $3, + "atype:steal", type, + "flags:steal", $2, + "name:steal", $4, + "get:steal", get, + "get_line", $1, + "set:steal", set, + "set_line", $1, + "line_no", $1, + NULL); + + if ($5 != NULL) { + Argument *arg = (Argument *)node; + export_accessors (arg->name, + arg->get != NULL, arg->get_line, + arg->set != NULL, arg->set_line, + arg->atype, + arg->gtktype, + arg->line_no); + g_free ($5); + } + + class_nodes = g_list_append (class_nodes, node); + } + ; - g_free($5); +export: '(' TOKEN ')' { + if (strcmp ($2, "export")!=0) { + g_free ($2); + yyerror (_("parse error")); + YYERROR; + } + $$ = $2; + } + | { + $$ = NULL; + } + ; + +property: PROPERTY TOKEN TOKEN param_spec TOKEN '{' CCODE TOKEN '{' CCODE ';' { + ensure_property (); + node_set ((Node *)property, + "line_no", $1, + "gtktype:steal", debool ($2), + "name:steal", $3, + NULL); + if (strcmp ($5, "get") == 0 && + strcmp ($8, "set") == 0) { + node_set ((Node *)property, + "get:steal", ($7)->str, + "get_line", $6, + "set:steal", ($10)->str, + "set_line", $9, + NULL); + g_string_free ($7, FALSE); + g_string_free ($10, FALSE); + g_free ($5); + g_free ($8); + } else if (strcmp ($5, "set") == 0 && + strcmp ($8, "get") == 0) { + node_set ((Node *)property, + "get:steal", ($10)->str, + "get_line", $9, + "set:steal", ($7)->str, + "set_line", $6, + NULL); + g_string_free ($7, FALSE); + g_string_free ($10, FALSE); + g_free ($5); + g_free ($8); + } else { + g_string_free ($7, TRUE); + g_string_free ($10, TRUE); + g_free ($5); + g_free ($8); + node_free ((Node *)property); + property = NULL; + yyerror (_("parse error")); + YYERROR; + } + property_link_and_export ((Node *)property); + if (property != NULL) { + class_nodes = g_list_append (class_nodes, + property); + property = NULL; + } + } + | PROPERTY TOKEN TOKEN param_spec TOKEN '{' CCODE ';' { + ensure_property (); + node_set ((Node *)property, + "line_no", $1, + "gtktype:steal", debool ($2), + "name:steal", $3, + NULL); + if (strcmp ($5, "get") == 0) { + node_set ((Node *)property, + "get:steal", ($7)->str, + "get_line", $6, + NULL); + g_string_free ($7, FALSE); + g_free ($5); + } else if (strcmp ($5, "set") == 0) { + node_set ((Node *)property, + "set:steal", ($7)->str, + "set_line", $6, + NULL); + g_string_free ($7, FALSE); + g_free ($5); + } else { + g_string_free ($7, TRUE); + g_free ($5); + node_free ((Node *)property); + property = NULL; + yyerror (_("parse error")); + YYERROR; + } + property_link_and_export ((Node *)property); + if (property != NULL) { + class_nodes = g_list_append (class_nodes, + property); + property = NULL; + } + } + | PROPERTY TOKEN TOKEN param_spec ';' { + ensure_property (); + node_set ((Node *)property, + "line_no", $1, + "gtktype:steal", debool ($2), + "name:steal", $3, + NULL); + property_link_and_export ((Node *)property); + if (property != NULL) { + class_nodes = g_list_append (class_nodes, + property); + property = NULL; + } + } + ; +param_spec: '(' param_spec_list ')' { ; } + | { ; } + ; - if(!type) - type = copy_type(var->vtype); +param_spec_list: param_spec_list ',' param_spec_value { ; } + | param_spec_value { ; } + ; - node = new_argument($3, type, $2, - $4, get, $1, - set, $1, $1); - class_nodes = g_list_append(class_nodes,node); - } +string: STRING { $$ = $1; } + | TOKEN '(' STRING ')' { + if (strcmp ($1, "_") != 0) { + g_free ($1); + yyerror(_("parse error")); + YYERROR; + } + g_free ($1); + $$ = g_strconcat ("_(", $3, ")", NULL); + g_free ($3); + } + ; + +anyval: numtok { $$ = $1; } + | string { $$ = $1; } + ; + +param_spec_value: NICK '=' string { + ensure_property (); + node_set ((Node *)property, + "nick:steal", $3, + NULL); + } + | BLURB '=' string { + ensure_property (); + node_set ((Node *)property, + "blurb:steal", $3, + NULL); + } + | MAXIMUM '=' numtok { + ensure_property (); + node_set ((Node *)property, + "maximum:steal", $3, + NULL); + } + | MINIMUM '=' numtok { + ensure_property (); + node_set ((Node *)property, + "minimum:steal", $3, + NULL); + } + | DEFAULT_VALUE '=' anyval { + ensure_property (); + node_set ((Node *)property, + "default_value:steal", $3, + NULL); + } + | FLAGS '=' flaglist { + ensure_property (); + node_set ((Node *)property, + "flags:steal", $3, + NULL); + } + | TYPE '=' type { + Type *type = pop_type (); + ensure_property (); + node_set ((Node *)property, + "ptype:steal", type, + NULL); + } + | FLAGS_TYPE '=' TOKEN { + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", $3, + NULL); + } + | ENUM_TYPE '=' TOKEN { + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", $3, + NULL); + } + | PARAM_TYPE '=' TOKEN { + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", $3, + NULL); + } + | BOXED_TYPE '=' TOKEN { + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", $3, + NULL); + } + | OBJECT_TYPE '=' TOKEN { + ensure_property (); + node_set ((Node *)property, + "extra_gtktype:steal", $3, + NULL); + } + | TOKEN { + ensure_property (); + if (strcmp ($1, "link") == 0) { + g_free($1); + node_set ((Node *)property, + "link", TRUE, + NULL); + } else if (strcmp ($1, "export") == 0) { + g_free($1); + node_set ((Node *)property, + "export", TRUE, + NULL); + } else { + g_free($1); + yyerror(_("parse error")); + YYERROR; + } + } ; argtype: TOKEN '(' TOKEN type ')' { @@ -613,10 +1250,10 @@ argtype: TOKEN '(' TOKEN type ')' { yyerror(_("parse error")); YYERROR; } - $$ = $1; + $$ = debool ($1); } | TOKEN { - $$ = $1; + $$ = debool ($1); typestack = g_list_prepend(typestack,NULL); } ; @@ -635,11 +1272,16 @@ flaglist: TOKEN '|' flaglist { type: specifier_list pointer { - Node *node = new_type($1, $2, NULL); + Node *node = node_new (TYPE_NODE, + "name:steal", $1, + "pointer:steal", $2, + NULL); typestack = g_list_prepend(typestack,node); } | specifier_list { - Node *node = new_type($1, NULL, NULL); + Node *node = node_new (TYPE_NODE, + "name:steal", $1, + NULL); typestack = g_list_prepend(typestack,node); } ; @@ -785,15 +1427,15 @@ fullsigtype: scope TOKEN sigtype { ; sigtype: TOKEN '(' tokenlist ')' { - gtktypes = g_list_prepend(gtktypes, $1); + gtktypes = g_list_prepend(gtktypes, debool ($1)); } ; tokenlist: tokenlist ',' TOKEN { - gtktypes = g_list_append(gtktypes, $3); + gtktypes = g_list_append(gtktypes, debool ($3)); } | TOKEN { - gtktypes = g_list_append(gtktypes, $1); + gtktypes = g_list_append(gtktypes, debool ($1)); } ; @@ -1064,10 +1706,14 @@ checklist: checklist check { ; } check: TOKEN { if(strcmp($1,"type")==0) { - Node *node = new_check(TYPE_CHECK,NULL); + Node *node = node_new (CHECK_NODE, + "chtype", TYPE_CHECK, + NULL); checks = g_list_append(checks,node); } else if(strcmp($1,"null")==0) { - Node *node = new_check(NULL_CHECK,NULL); + Node *node = node_new (CHECK_NODE, + "chtype", NULL_CHECK, + NULL); checks = g_list_append(checks,node); } else { yyerror(_("parse error")); @@ -1076,27 +1722,45 @@ check: TOKEN { g_free($1); } | '>' numtok { - Node *node = new_check(GT_CHECK,$2); + Node *node = node_new (CHECK_NODE, + "chtype", GT_CHECK, + "number:steal", $2, + NULL); checks = g_list_append(checks,node); } | '<' numtok { - Node *node = new_check(LT_CHECK,$2); + Node *node = node_new (CHECK_NODE, + "chtype", LT_CHECK, + "number:steal", $2, + NULL); checks = g_list_append(checks,node); } | '>' '=' numtok { - Node *node = new_check(GE_CHECK,$3); + Node *node = node_new (CHECK_NODE, + "chtype", GE_CHECK, + "number:steal", $3, + NULL); checks = g_list_append(checks,node); } | '<' '=' numtok { - Node *node = new_check(LE_CHECK,$3); + Node *node = node_new (CHECK_NODE, + "chtype", LE_CHECK, + "number:steal", $3, + NULL); checks = g_list_append(checks,node); } | '=' '=' numtok { - Node *node = new_check(EQ_CHECK,$3); + Node *node = node_new (CHECK_NODE, + "chtype", EQ_CHECK, + "number:steal", $3, + NULL); checks = g_list_append(checks,node); } | '!' '=' numtok { - Node *node = new_check(NE_CHECK,$3); + Node *node = node_new (CHECK_NODE, + "chtype", NE_CHECK, + "number:steal", $3, + NULL); checks = g_list_append(checks,node); } ; @@ -1106,6 +1770,7 @@ numtok: NUMBER { $$ = $1; } $$ = g_strconcat("-",$2,NULL); g_free($2); } + | SINGLE_CHAR { $$ = $1; } | TOKEN { $$ = $1; } ; diff --git a/src/test.gob b/src/test.gob index 9ea1d90..8c7cf85 100644 --- a/src/test.gob +++ b/src/test.gob @@ -3,7 +3,7 @@ look in here to see a whole array of different syntax options, but don't expect this to be an easy to read file */ -requires 0.93.0 +requires 1.99.0 %at{ /* ALL TOP */ @@ -30,8 +30,8 @@ requires 0.93.0 the %{ %} sections above the class definitions, it will not put it in the file itself. So you can this way select where the include file is at */ -#include "gtk-weird-button.h" -#include "gtk-weird-button-private.h" +#include "test-object.h" +#include "test-object-private.h" /* this is to test if the lexer won't get confused by requires inside some c code @@ -39,6 +39,8 @@ requires 99.99.99 */ static void jjjj(void); + +#define _(x) x %} %h{ @@ -59,7 +61,7 @@ void bubu(void); #define TEST_ARRAY 5 %} -class Gtk:Weird:Button from Gtk:Button { +class Test:Object from G:Object { public int test_array[TEST_ARRAY]; public int i; @@ -72,21 +74,21 @@ class Gtk:Weird:Button from Gtk:Button { destroywith g_free; argument POINTER testingstring stringlink; - public Gtk:Weird:Button * testingobj - destroywith gtk_object_unref; + public Test:Object * testingobj + destroywith g_object_unref; argument POINTER testingobj objectlink; classwide int foo = 20; argument INT foo link; - public Gtk:Object * testingobj2 + public G:Object * testingobj2 destroy { if(VAR) - gtk_object_unref(GTK_OBJECT(VAR)); + g_object_unref(G_OBJECT(VAR)); }; - argument POINTER (type Gtk:Object *) testingobj2 objectlink; + argument POINTER (type G:Object *) testingobj2 objectlink; - argument POINTER (type GtkObject *) some_object + argument POINTER (type GObject *) some_object set { /* set some_object */ } get { /* get some_object */ ARG=NULL; }; @@ -95,8 +97,32 @@ class Gtk:Weird:Button from Gtk:Button { argument POINTER (type char *) read_only_string get { /* get readonly_long */ ARG = g_strdup("BLAH"); }; + + private char a_property; + property CHAR a_property + (nick = _("Nick"), + blurb = _("Blurb"), + minimum = 'a', + maximum = 'Z', + default_value = 'C', + export) + set { self->_priv->a_property = g_value_get_char (VAL); } + get { g_value_set_char (VAL, self->_priv->a_property); }; + + + private char *b_property; + property STRING b_property + (nick = _("Nick b"), + blurb = _("Blurb b"), + default_value = "default", + type = char *, + flags = CONSTRUCT, + export, + link); + + private int j; - public GtkWidget * h; + public GObject * h; public char *bleh; public double array[23][18]; protected unsigned long int wagawaga; @@ -115,21 +141,19 @@ class Gtk:Weird:Button from Gtk:Button { * * Returns: new object */ - public GtkWidget * new(int j (check > 0)) { - GtkWidget *ret; - ret = GTK_WIDGET (GET_NEW); + public GObject * new(int j (check > 0)) { + GObject *ret; + ret = G_OBJECT (GET_NEW); SELF(ret)->_priv->j = j; return ret; } - private int _blah(self, Gtk:Widget * wid (check null type), + private int blah(self, G:Object * wid (check null type), int h (check > 0)) onerror -1 { - gtk_container_add(GTK_CONTAINER(self),wid); - - gtk_object_set(GTK_OBJECT(self), - GTK_WEIRD_BUTTON_ARG_I(99), - NULL); + g_object_set (G_OBJECT (self), + TEST_OBJECT_PROP_I (99), + NULL); return h; } /** @@ -142,15 +166,15 @@ class Gtk:Weird:Button from Gtk:Button { * * Returns: new object **/ - signal last INT (POINTER, INT) - int bleh(self, Gtk:Widget * wid (check null type), + signal last STRING (POINTER, INT) + char * bleh(self, G:Object * wid (check null type), int h (check > 0)) { - return _blah(self,wid,h); + return self_blah(self,wid,h) > 0 ? g_strdup ("foo") : g_strdup ("bar"); } private int - test_handler (self, GtkWidget *w, int h, gpointer data) + test_handler (self, GObject *w, int h, gpointer data) { return -1; } @@ -165,11 +189,11 @@ class Gtk:Weird:Button from Gtk:Button { * * Returns: new object */ signal last INT (POINTER, INT) - int bleh2(self, const Gtk:Widget * wid (check null type), + int bleh2(self, const G:Object * wid (check null type), int h (check > 0)) { - gtk_signal_connect (GTK_OBJECT (self), + /*gtk_signal_connect (GTK_OBJECT (self), GTK_WEIRD_BUTTON_SIGNAL_BLEH (test_handler), - NULL); + NULL);*/ /* testing multiple marshaller support */ return 0; @@ -201,14 +225,14 @@ class Gtk:Weird:Button from Gtk:Button { signal first NONE (NONE) void bloh(self); virtual void * bah(self, int h (check > 0)) onerror NULL defreturn 0 { - beh(self,h); + self_beh(self,h); return NULL; } virtual int beh(self, int h (check > 0)); - override(Gtk:Container) void add(Gtk:Container * self (check null type), + /*override(G:Object) void add(Gtk:Container * self (check null type), Gtk:Widget * wid (check null type)) { PARENT_HANDLER(self,wid); - } + }*/ public int consttest(self, const gchar *text, ...) { return 25; @@ -217,7 +241,7 @@ class Gtk:Weird:Button from Gtk:Button { { return 25; } - public int consttest3(self, Gtk:Widget const *wid (check null type)) + public int consttest3(self, G:Object const *wid (check null type)) { return 25; } @@ -241,7 +265,7 @@ class Gtk:Weird:Button from Gtk:Button { { Self const *selfconst1, *selfconst2; selfconst1 = SELF_CONST(self); - selfconst2 = GTK_WEIRD_BUTTON_CONST(self); + selfconst2 = TEST_OBJECT_CONST(self); return 25; } public int consttest9(const self, int i, double b) @@ -256,7 +280,7 @@ class Gtk:Weird:Button from Gtk:Button { void googlegoogle(self) { puts("TEST1"); - googlegoogle2(self); + self_googlegoogle2(self); } signal first private NONE (NONE) void googlegoogle2(self) @@ -264,7 +288,7 @@ class Gtk:Weird:Button from Gtk:Button { int array[5][8][9]={{{0}}}; Self *foo = self; puts("TEST2"); - testprivvirtual(foo, array); + self_testprivvirtual(foo, array); } private signal first NONE (NONE) void googlegoogle3(self) @@ -290,7 +314,7 @@ class Gtk:Weird:Button from Gtk:Button { void testprivvirtual(self, int some_array[5][8][9]) { puts("TEST3"); - googlegoogle(self); + self_googlegoogle(self); } private virtual void testprivvirtual2(self, const int some_array[5][8][9]) @@ -324,28 +348,28 @@ class Gtk:Weird:Button from Gtk:Button { { } - override (Gtk:Widget) - int event(Gtk:Widget *self (check null type), - GdkEvent *event (check null)) onerror FALSE - { - int ret; - /* some code */ - ret = PARENT_HANDLER(self,event); - /* some code */ - return ret; - } - override(Gtk:Container) - void - remove(Gtk:Container * self (check null type), - Gtk:Widget * wid (check null type)); - - override(Gtk:Object) - void - destroy(Gtk:Object * self (check null type)) - { - /* foo bar */ - PARENT_HANDLER(self); - } +// override (Gtk:Widget) +// int event(Gtk:Widget *self (check null type), +// GdkEvent *event (check null)) onerror FALSE +// { +// int ret; +// /* some code */ +// ret = PARENT_HANDLER(self,event); +// /* some code */ +// return ret; +// } +// override(Gtk:Container) +// void +// remove(Gtk:Container * self (check null type), +// Gtk:Widget * wid (check null type)); +// +// override(Gtk:Object) +// void +// destroy(Gtk:Object * self (check null type)) +// { +// /* foo bar */ +// PARENT_HANDLER(self); +// } protected int foobar(self) { @@ -353,12 +377,12 @@ class Gtk:Weird:Button from Gtk:Button { return 5; } - signal last NONE(CHAR,UCHAR,BOOL,INT,UINT,LONG,ULONG,FLOAT,DOUBLE, + signal last NONE(CHAR,UCHAR,BOOLEAN,INT,UINT,LONG,ULONG,FLOAT,DOUBLE, STRING,ENUM,FLAGS,BOXED,POINTER,OBJECT) void testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f, gulong g, gfloat h, gdouble i, gchar * j, gint k, - guint l, gpointer m, gpointer o, GtkObject *p) + guint l, gpointer m, gpointer o, GObject *p) { /* ugh, testing casting */ } @@ -370,7 +394,7 @@ class Gtk:Weird:Button from Gtk:Button { } /* testing NONE */ - signal BOOL (NONE) + signal BOOLEAN (NONE) gboolean test_none_thing (self) { @@ -404,7 +428,7 @@ class Gtk:Weird:Button from Gtk:Button { /* testing calling the above method */ public void foo (self) { - method_with_no_arguments (); + self_method_with_no_arguments (); } /* this is to test custom get_type */ diff --git a/src/treefuncs.c b/src/treefuncs.c index e424df3..486a599 100644 --- a/src/treefuncs.c +++ b/src/treefuncs.c @@ -2,379 +2,1460 @@ * Do not edit by hand! */ #include +#include #include "treefuncs.h" -#define COPY_LIST_VALS(list,func) { GList *li; for(li=(list);li;li=li->next) { li->data=func(li->data); } } - -Node * new_argument (char * gtktype, Type * atype, GList * flags, char * name, char * get, int get_line, char * set, int set_line, int line_no) -{ - Argument * self = g_new0(Argument, 1); - self->type = ARGUMENT_NODE; - self->gtktype = gtktype; - self->atype = atype; - self->flags = flags; - self->name = name; - self->get = get; - self->get_line = get_line; - self->set = set; - self->set_line = set_line; - self->line_no = line_no; - return (Node *)self; -} +#define COPY_LIST_VALS(list,func) { GList *li; for (li=(list);li;li=li->next) { li->data=func (li->data); } } -Node * new_ccode (int cctype, char * cbuf, int line_no) -{ - CCode * self = g_new0(CCode, 1); - self->type = CCODE_NODE; - self->cctype = cctype; - self->cbuf = cbuf; - self->line_no = line_no; - return (Node *)self; -} +static Argument * +copy_argument (Argument * self); +static CCode * +copy_ccode (CCode * self); +static Check * +copy_check (Check * self); +static Class * +copy_class (Class * self); +static FuncArg * +copy_funcarg (FuncArg * self); +static Method * +copy_method (Method * self); +static Property * +copy_property (Property * self); +static Type * +copy_type (Type * self); +static Variable * +copy_variable (Variable * self); -Node * new_check (int chtype, char * number) -{ - Check * self = g_new0(Check, 1); - self->type = CHECK_NODE; - self->chtype = chtype; - self->number = number; - return (Node *)self; -} +void +free_argument (Argument * self); +void +free_ccode (CCode * self); +void +free_check (Check * self); +void +free_class (Class * self); +void +free_funcarg (FuncArg * self); +void +free_method (Method * self); +void +free_property (Property * self); +void +free_type (Type * self); +void +free_variable (Variable * self); -Node * new_class (char * otype, char * ptype, char * chunk_size, GList * nodes) -{ - Class * self = g_new0(Class, 1); - self->type = CLASS_NODE; - self->otype = otype; - self->ptype = ptype; - self->chunk_size = chunk_size; - self->nodes = nodes; - return (Node *)self; -} - -Node * new_funcarg (Type * atype, char * name, GList * checks) -{ - FuncArg * self = g_new0(FuncArg, 1); - self->type = FUNCARG_NODE; - self->atype = atype; - self->name = name; - self->checks = checks; - return (Node *)self; -} +static void +setv_argument (Argument * self, va_list __ap); +static void +setv_ccode (CCode * self, va_list __ap); +static void +setv_check (Check * self, va_list __ap); +static void +setv_class (Class * self, va_list __ap); +static void +setv_funcarg (FuncArg * self, va_list __ap); +static void +setv_method (Method * self, va_list __ap); +static void +setv_property (Property * self, va_list __ap); +static void +setv_type (Type * self, va_list __ap); +static void +setv_variable (Variable * self, va_list __ap); -Node * new_method (int scope, int method, Type * mtype, char * otype, GList * gtktypes, GList * flags, char * id, GList * args, char * onerror, char * defreturn, char * cbuf, int line_no, int ccode_line, gboolean vararg, int unique_id) -{ - Method * self = g_new0(Method, 1); - self->type = METHOD_NODE; - self->scope = scope; - self->method = method; - self->mtype = mtype; - self->otype = otype; - self->gtktypes = gtktypes; - self->flags = flags; - self->id = id; - self->args = args; - self->onerror = onerror; - self->defreturn = defreturn; - self->cbuf = cbuf; - self->line_no = line_no; - self->ccode_line = ccode_line; - self->vararg = vararg; - self->unique_id = unique_id; - return (Node *)self; -} +static gboolean quarks_set_up = FALSE; +static GHashTable *quark_ht; +enum { + QUARK_0, + QUARK_otype, + QUARK_otype_STEAL, + QUARK_ptype, + QUARK_ptype_STEAL, + QUARK_bonobo_x_class, + QUARK_bonobo_x_class_STEAL, + QUARK_chunk_size, + QUARK_chunk_size_STEAL, + QUARK_nodes, + QUARK_nodes_STEAL, + QUARK_name, + QUARK_name_STEAL, + QUARK_pointer, + QUARK_pointer_STEAL, + QUARK_postfix, + QUARK_postfix_STEAL, + QUARK_cctype, + QUARK_cbuf, + QUARK_cbuf_STEAL, + QUARK_line_no, + QUARK_chtype, + QUARK_number, + QUARK_number_STEAL, + QUARK_atype, + QUARK_atype_STEAL, + QUARK_checks, + QUARK_checks_STEAL, + QUARK_gtktype, + QUARK_gtktype_STEAL, + QUARK_flags, + QUARK_flags_STEAL, + QUARK_get, + QUARK_get_STEAL, + QUARK_get_line, + QUARK_set, + QUARK_set_STEAL, + QUARK_set_line, + QUARK_nick, + QUARK_nick_STEAL, + QUARK_blurb, + QUARK_blurb_STEAL, + QUARK_minimum, + QUARK_minimum_STEAL, + QUARK_maximum, + QUARK_maximum_STEAL, + QUARK_default_value, + QUARK_default_value_STEAL, + QUARK_extra_gtktype, + QUARK_extra_gtktype_STEAL, + QUARK_link, + QUARK_export, + QUARK_scope, + QUARK_method, + QUARK_mtype, + QUARK_mtype_STEAL, + QUARK_gtktypes, + QUARK_gtktypes_STEAL, + QUARK_id, + QUARK_id_STEAL, + QUARK_args, + QUARK_args_STEAL, + QUARK_onerror, + QUARK_onerror_STEAL, + QUARK_defreturn, + QUARK_defreturn_STEAL, + QUARK_ccode_line, + QUARK_vararg, + QUARK_unique_id, + QUARK_bonobo_x_func, + QUARK_vtype, + QUARK_vtype_STEAL, + QUARK_destructor_unref, + QUARK_destructor, + QUARK_destructor_STEAL, + QUARK_destructor_line, + QUARK_destructor_simple, + QUARK_initializer, + QUARK_initializer_STEAL, + QUARK_initializer_line, + QUARK_LAST +}; -Node * new_type (char * name, char * pointer, char * postfix) +static void +ensure_quarks (void) { - Type * self = g_new0(Type, 1); - self->type = TYPE_NODE; - self->name = name; - self->pointer = pointer; - self->postfix = postfix; - return (Node *)self; + if (quarks_set_up) + return; + quark_ht = g_hash_table_new (g_str_hash, g_str_equal); + quarks_set_up = TRUE; + g_hash_table_insert (quark_ht, "otype", GINT_TO_POINTER (QUARK_otype)); + g_hash_table_insert (quark_ht, "otype:steal", GINT_TO_POINTER (QUARK_otype_STEAL)); + g_hash_table_insert (quark_ht, "ptype", GINT_TO_POINTER (QUARK_ptype)); + g_hash_table_insert (quark_ht, "ptype:steal", GINT_TO_POINTER (QUARK_ptype_STEAL)); + g_hash_table_insert (quark_ht, "bonobo_x_class", GINT_TO_POINTER (QUARK_bonobo_x_class)); + g_hash_table_insert (quark_ht, "bonobo_x_class:steal", GINT_TO_POINTER (QUARK_bonobo_x_class_STEAL)); + g_hash_table_insert (quark_ht, "chunk_size", GINT_TO_POINTER (QUARK_chunk_size)); + g_hash_table_insert (quark_ht, "chunk_size:steal", GINT_TO_POINTER (QUARK_chunk_size_STEAL)); + g_hash_table_insert (quark_ht, "nodes", GINT_TO_POINTER (QUARK_nodes)); + g_hash_table_insert (quark_ht, "nodes:steal", GINT_TO_POINTER (QUARK_nodes_STEAL)); + g_hash_table_insert (quark_ht, "name", GINT_TO_POINTER (QUARK_name)); + g_hash_table_insert (quark_ht, "name:steal", GINT_TO_POINTER (QUARK_name_STEAL)); + g_hash_table_insert (quark_ht, "pointer", GINT_TO_POINTER (QUARK_pointer)); + g_hash_table_insert (quark_ht, "pointer:steal", GINT_TO_POINTER (QUARK_pointer_STEAL)); + g_hash_table_insert (quark_ht, "postfix", GINT_TO_POINTER (QUARK_postfix)); + g_hash_table_insert (quark_ht, "postfix:steal", GINT_TO_POINTER (QUARK_postfix_STEAL)); + g_hash_table_insert (quark_ht, "cctype", GINT_TO_POINTER (QUARK_cctype)); + g_hash_table_insert (quark_ht, "cbuf", GINT_TO_POINTER (QUARK_cbuf)); + g_hash_table_insert (quark_ht, "cbuf:steal", GINT_TO_POINTER (QUARK_cbuf_STEAL)); + g_hash_table_insert (quark_ht, "line_no", GINT_TO_POINTER (QUARK_line_no)); + g_hash_table_insert (quark_ht, "chtype", GINT_TO_POINTER (QUARK_chtype)); + g_hash_table_insert (quark_ht, "number", GINT_TO_POINTER (QUARK_number)); + g_hash_table_insert (quark_ht, "number:steal", GINT_TO_POINTER (QUARK_number_STEAL)); + g_hash_table_insert (quark_ht, "atype", GINT_TO_POINTER (QUARK_atype)); + g_hash_table_insert (quark_ht, "atype:steal", GINT_TO_POINTER (QUARK_atype_STEAL)); + g_hash_table_insert (quark_ht, "checks", GINT_TO_POINTER (QUARK_checks)); + g_hash_table_insert (quark_ht, "checks:steal", GINT_TO_POINTER (QUARK_checks_STEAL)); + g_hash_table_insert (quark_ht, "gtktype", GINT_TO_POINTER (QUARK_gtktype)); + g_hash_table_insert (quark_ht, "gtktype:steal", GINT_TO_POINTER (QUARK_gtktype_STEAL)); + g_hash_table_insert (quark_ht, "flags", GINT_TO_POINTER (QUARK_flags)); + g_hash_table_insert (quark_ht, "flags:steal", GINT_TO_POINTER (QUARK_flags_STEAL)); + g_hash_table_insert (quark_ht, "get", GINT_TO_POINTER (QUARK_get)); + g_hash_table_insert (quark_ht, "get:steal", GINT_TO_POINTER (QUARK_get_STEAL)); + g_hash_table_insert (quark_ht, "get_line", GINT_TO_POINTER (QUARK_get_line)); + g_hash_table_insert (quark_ht, "set", GINT_TO_POINTER (QUARK_set)); + g_hash_table_insert (quark_ht, "set:steal", GINT_TO_POINTER (QUARK_set_STEAL)); + g_hash_table_insert (quark_ht, "set_line", GINT_TO_POINTER (QUARK_set_line)); + g_hash_table_insert (quark_ht, "nick", GINT_TO_POINTER (QUARK_nick)); + g_hash_table_insert (quark_ht, "nick:steal", GINT_TO_POINTER (QUARK_nick_STEAL)); + g_hash_table_insert (quark_ht, "blurb", GINT_TO_POINTER (QUARK_blurb)); + g_hash_table_insert (quark_ht, "blurb:steal", GINT_TO_POINTER (QUARK_blurb_STEAL)); + g_hash_table_insert (quark_ht, "minimum", GINT_TO_POINTER (QUARK_minimum)); + g_hash_table_insert (quark_ht, "minimum:steal", GINT_TO_POINTER (QUARK_minimum_STEAL)); + g_hash_table_insert (quark_ht, "maximum", GINT_TO_POINTER (QUARK_maximum)); + g_hash_table_insert (quark_ht, "maximum:steal", GINT_TO_POINTER (QUARK_maximum_STEAL)); + g_hash_table_insert (quark_ht, "default_value", GINT_TO_POINTER (QUARK_default_value)); + g_hash_table_insert (quark_ht, "default_value:steal", GINT_TO_POINTER (QUARK_default_value_STEAL)); + g_hash_table_insert (quark_ht, "extra_gtktype", GINT_TO_POINTER (QUARK_extra_gtktype)); + g_hash_table_insert (quark_ht, "extra_gtktype:steal", GINT_TO_POINTER (QUARK_extra_gtktype_STEAL)); + g_hash_table_insert (quark_ht, "link", GINT_TO_POINTER (QUARK_link)); + g_hash_table_insert (quark_ht, "export", GINT_TO_POINTER (QUARK_export)); + g_hash_table_insert (quark_ht, "scope", GINT_TO_POINTER (QUARK_scope)); + g_hash_table_insert (quark_ht, "method", GINT_TO_POINTER (QUARK_method)); + g_hash_table_insert (quark_ht, "mtype", GINT_TO_POINTER (QUARK_mtype)); + g_hash_table_insert (quark_ht, "mtype:steal", GINT_TO_POINTER (QUARK_mtype_STEAL)); + g_hash_table_insert (quark_ht, "gtktypes", GINT_TO_POINTER (QUARK_gtktypes)); + g_hash_table_insert (quark_ht, "gtktypes:steal", GINT_TO_POINTER (QUARK_gtktypes_STEAL)); + g_hash_table_insert (quark_ht, "id", GINT_TO_POINTER (QUARK_id)); + g_hash_table_insert (quark_ht, "id:steal", GINT_TO_POINTER (QUARK_id_STEAL)); + g_hash_table_insert (quark_ht, "args", GINT_TO_POINTER (QUARK_args)); + g_hash_table_insert (quark_ht, "args:steal", GINT_TO_POINTER (QUARK_args_STEAL)); + g_hash_table_insert (quark_ht, "onerror", GINT_TO_POINTER (QUARK_onerror)); + g_hash_table_insert (quark_ht, "onerror:steal", GINT_TO_POINTER (QUARK_onerror_STEAL)); + g_hash_table_insert (quark_ht, "defreturn", GINT_TO_POINTER (QUARK_defreturn)); + g_hash_table_insert (quark_ht, "defreturn:steal", GINT_TO_POINTER (QUARK_defreturn_STEAL)); + g_hash_table_insert (quark_ht, "ccode_line", GINT_TO_POINTER (QUARK_ccode_line)); + g_hash_table_insert (quark_ht, "vararg", GINT_TO_POINTER (QUARK_vararg)); + g_hash_table_insert (quark_ht, "unique_id", GINT_TO_POINTER (QUARK_unique_id)); + g_hash_table_insert (quark_ht, "bonobo_x_func", GINT_TO_POINTER (QUARK_bonobo_x_func)); + g_hash_table_insert (quark_ht, "vtype", GINT_TO_POINTER (QUARK_vtype)); + g_hash_table_insert (quark_ht, "vtype:steal", GINT_TO_POINTER (QUARK_vtype_STEAL)); + g_hash_table_insert (quark_ht, "destructor_unref", GINT_TO_POINTER (QUARK_destructor_unref)); + g_hash_table_insert (quark_ht, "destructor", GINT_TO_POINTER (QUARK_destructor)); + g_hash_table_insert (quark_ht, "destructor:steal", GINT_TO_POINTER (QUARK_destructor_STEAL)); + g_hash_table_insert (quark_ht, "destructor_line", GINT_TO_POINTER (QUARK_destructor_line)); + g_hash_table_insert (quark_ht, "destructor_simple", GINT_TO_POINTER (QUARK_destructor_simple)); + g_hash_table_insert (quark_ht, "initializer", GINT_TO_POINTER (QUARK_initializer)); + g_hash_table_insert (quark_ht, "initializer:steal", GINT_TO_POINTER (QUARK_initializer_STEAL)); + g_hash_table_insert (quark_ht, "initializer_line", GINT_TO_POINTER (QUARK_initializer_line)); } -Node * new_variable (int scope, Type * vtype, char * id, int line_no, char * destructor, int destructor_line, gboolean destructor_simple, char * initializer, int initializer_line) -{ - Variable * self = g_new0(Variable, 1); - self->type = VARIABLE_NODE; - self->scope = scope; - self->vtype = vtype; - self->id = id; - self->line_no = line_no; - self->destructor = destructor; - self->destructor_line = destructor_line; - self->destructor_simple = destructor_simple; - self->initializer = initializer; - self->initializer_line = initializer_line; - return (Node *)self; -} - -Argument * copy_argument (Argument * self) +static Argument * +copy_argument (Argument * self) { Argument * new; - g_return_val_if_fail(self != NULL, NULL); - g_return_val_if_fail(self->type == ARGUMENT_NODE, NULL); + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (self->type == ARGUMENT_NODE, NULL); new = g_new0(Argument, 1); new->type = ARGUMENT_NODE; - new->gtktype = g_strdup(self->gtktype); - new->atype = copy_type(self->atype); - new->flags = g_list_copy(self->flags); COPY_LIST_VALS(new->flags, g_strdup); - new->name = g_strdup(self->name); - new->get = g_strdup(self->get); + new->gtktype = g_strdup (self->gtktype); + new->atype = copy_type (self->atype); + new->flags = g_list_copy (self->flags); COPY_LIST_VALS(new->flags, g_strdup); + new->name = g_strdup (self->name); + new->get = g_strdup (self->get); new->get_line = self->get_line; - new->set = g_strdup(self->set); + new->set = g_strdup (self->set); new->set_line = self->set_line; new->line_no = self->line_no; return new; } -CCode * copy_ccode (CCode * self) +static CCode * +copy_ccode (CCode * self) { CCode * new; - g_return_val_if_fail(self != NULL, NULL); - g_return_val_if_fail(self->type == CCODE_NODE, NULL); + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (self->type == CCODE_NODE, NULL); new = g_new0(CCode, 1); new->type = CCODE_NODE; new->cctype = self->cctype; - new->cbuf = g_strdup(self->cbuf); + new->cbuf = g_strdup (self->cbuf); new->line_no = self->line_no; return new; } -Check * copy_check (Check * self) +static Check * +copy_check (Check * self) { Check * new; - g_return_val_if_fail(self != NULL, NULL); - g_return_val_if_fail(self->type == CHECK_NODE, NULL); + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (self->type == CHECK_NODE, NULL); new = g_new0(Check, 1); new->type = CHECK_NODE; new->chtype = self->chtype; - new->number = g_strdup(self->number); + new->number = g_strdup (self->number); return new; } -Class * copy_class (Class * self) +static Class * +copy_class (Class * self) { Class * new; - g_return_val_if_fail(self != NULL, NULL); - g_return_val_if_fail(self->type == CLASS_NODE, NULL); + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (self->type == CLASS_NODE, NULL); new = g_new0(Class, 1); new->type = CLASS_NODE; - new->otype = g_strdup(self->otype); - new->ptype = g_strdup(self->ptype); - new->chunk_size = g_strdup(self->chunk_size); - new->nodes = copy_node_list(self->nodes); + new->otype = g_strdup (self->otype); + new->ptype = g_strdup (self->ptype); + new->bonobo_x_class = g_strdup (self->bonobo_x_class); + new->chunk_size = g_strdup (self->chunk_size); + new->nodes = node_list_copy (self->nodes); return new; } -FuncArg * copy_funcarg (FuncArg * self) +static FuncArg * +copy_funcarg (FuncArg * self) { FuncArg * new; - g_return_val_if_fail(self != NULL, NULL); - g_return_val_if_fail(self->type == FUNCARG_NODE, NULL); + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (self->type == FUNCARG_NODE, NULL); new = g_new0(FuncArg, 1); new->type = FUNCARG_NODE; - new->atype = copy_type(self->atype); - new->name = g_strdup(self->name); - new->checks = copy_node_list(self->checks); + new->atype = copy_type (self->atype); + new->name = g_strdup (self->name); + new->checks = node_list_copy (self->checks); return new; } -Method * copy_method (Method * self) +static Method * +copy_method (Method * self) { Method * new; - g_return_val_if_fail(self != NULL, NULL); - g_return_val_if_fail(self->type == METHOD_NODE, NULL); + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (self->type == METHOD_NODE, NULL); new = g_new0(Method, 1); new->type = METHOD_NODE; new->scope = self->scope; new->method = self->method; - new->mtype = copy_type(self->mtype); - new->otype = g_strdup(self->otype); - new->gtktypes = g_list_copy(self->gtktypes); COPY_LIST_VALS(new->gtktypes, g_strdup); - new->flags = g_list_copy(self->flags); COPY_LIST_VALS(new->flags, g_strdup); - new->id = g_strdup(self->id); - new->args = copy_node_list(self->args); - new->onerror = g_strdup(self->onerror); - new->defreturn = g_strdup(self->defreturn); - new->cbuf = g_strdup(self->cbuf); + new->mtype = copy_type (self->mtype); + new->otype = g_strdup (self->otype); + new->gtktypes = g_list_copy (self->gtktypes); COPY_LIST_VALS(new->gtktypes, g_strdup); + new->flags = g_list_copy (self->flags); COPY_LIST_VALS(new->flags, g_strdup); + new->id = g_strdup (self->id); + new->args = node_list_copy (self->args); + new->onerror = g_strdup (self->onerror); + new->defreturn = g_strdup (self->defreturn); + new->cbuf = g_strdup (self->cbuf); new->line_no = self->line_no; new->ccode_line = self->ccode_line; new->vararg = self->vararg; new->unique_id = self->unique_id; + new->bonobo_x_func = self->bonobo_x_func; return new; } -Type * copy_type (Type * self) +static Property * +copy_property (Property * self) +{ + Property * new; + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (self->type == PROPERTY_NODE, NULL); + new = g_new0(Property, 1); + new->type = PROPERTY_NODE; + new->gtktype = g_strdup (self->gtktype); + new->ptype = copy_type (self->ptype); + new->flags = g_list_copy (self->flags); COPY_LIST_VALS(new->flags, g_strdup); + new->name = g_strdup (self->name); + new->nick = g_strdup (self->nick); + new->blurb = g_strdup (self->blurb); + new->minimum = g_strdup (self->minimum); + new->maximum = g_strdup (self->maximum); + new->default_value = g_strdup (self->default_value); + new->extra_gtktype = g_strdup (self->extra_gtktype); + new->link = self->link; + new->export = self->export; + new->get = g_strdup (self->get); + new->get_line = self->get_line; + new->set = g_strdup (self->set); + new->set_line = self->set_line; + new->line_no = self->line_no; + return new; +} + +static Type * +copy_type (Type * self) { Type * new; - g_return_val_if_fail(self != NULL, NULL); - g_return_val_if_fail(self->type == TYPE_NODE, NULL); + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (self->type == TYPE_NODE, NULL); new = g_new0(Type, 1); new->type = TYPE_NODE; - new->name = g_strdup(self->name); - new->pointer = g_strdup(self->pointer); - new->postfix = g_strdup(self->postfix); + new->name = g_strdup (self->name); + new->pointer = g_strdup (self->pointer); + new->postfix = g_strdup (self->postfix); return new; } -Variable * copy_variable (Variable * self) +static Variable * +copy_variable (Variable * self) { Variable * new; - g_return_val_if_fail(self != NULL, NULL); - g_return_val_if_fail(self->type == VARIABLE_NODE, NULL); + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (self->type == VARIABLE_NODE, NULL); new = g_new0(Variable, 1); new->type = VARIABLE_NODE; new->scope = self->scope; - new->vtype = copy_type(self->vtype); - new->id = g_strdup(self->id); + new->vtype = copy_type (self->vtype); + new->id = g_strdup (self->id); new->line_no = self->line_no; - new->destructor = g_strdup(self->destructor); + new->destructor_unref = self->destructor_unref; + new->destructor = g_strdup (self->destructor); new->destructor_line = self->destructor_line; new->destructor_simple = self->destructor_simple; - new->initializer = g_strdup(self->initializer); + new->initializer = g_strdup (self->initializer); new->initializer_line = self->initializer_line; return new; } -void free_argument (Argument * self) +void +free_argument (Argument * self) +{ + g_return_if_fail (self != NULL); + g_return_if_fail (self->type == ARGUMENT_NODE); + g_free (self->gtktype); + free_type (self->atype); + g_list_foreach (self->flags, (GFunc)g_free, NULL); g_list_free (self->flags); + g_free (self->name); + g_free (self->get); + g_free (self->set); + g_free (self); +} + +void +free_ccode (CCode * self) +{ + g_return_if_fail (self != NULL); + g_return_if_fail (self->type == CCODE_NODE); + g_free (self->cbuf); + g_free (self); +} + +void +free_check (Check * self) +{ + g_return_if_fail (self != NULL); + g_return_if_fail (self->type == CHECK_NODE); + g_free (self->number); + g_free (self); +} + +void +free_class (Class * self) +{ + g_return_if_fail (self != NULL); + g_return_if_fail (self->type == CLASS_NODE); + g_free (self->otype); + g_free (self->ptype); + g_free (self->bonobo_x_class); + g_free (self->chunk_size); + node_list_free (self->nodes); + g_free (self); +} + +void +free_funcarg (FuncArg * self) +{ + g_return_if_fail (self != NULL); + g_return_if_fail (self->type == FUNCARG_NODE); + free_type (self->atype); + g_free (self->name); + node_list_free (self->checks); + g_free (self); +} + +void +free_method (Method * self) { - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == ARGUMENT_NODE); - g_free(self->gtktype); - free_type(self->atype); - g_list_foreach(self->flags, (GFunc)g_free, NULL); g_list_free(self->flags); - g_free(self->name); - g_free(self->get); - g_free(self->set); - g_free(self); + g_return_if_fail (self != NULL); + g_return_if_fail (self->type == METHOD_NODE); + free_type (self->mtype); + g_free (self->otype); + g_list_foreach (self->gtktypes, (GFunc)g_free, NULL); g_list_free (self->gtktypes); + g_list_foreach (self->flags, (GFunc)g_free, NULL); g_list_free (self->flags); + g_free (self->id); + node_list_free (self->args); + g_free (self->onerror); + g_free (self->defreturn); + g_free (self->cbuf); + g_free (self); } -void free_ccode (CCode * self) +void +free_property (Property * self) { - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == CCODE_NODE); - g_free(self->cbuf); - g_free(self); + g_return_if_fail (self != NULL); + g_return_if_fail (self->type == PROPERTY_NODE); + g_free (self->gtktype); + free_type (self->ptype); + g_list_foreach (self->flags, (GFunc)g_free, NULL); g_list_free (self->flags); + g_free (self->name); + g_free (self->nick); + g_free (self->blurb); + g_free (self->minimum); + g_free (self->maximum); + g_free (self->default_value); + g_free (self->extra_gtktype); + g_free (self->get); + g_free (self->set); + g_free (self); } -void free_check (Check * self) +void +free_type (Type * self) { - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == CHECK_NODE); - g_free(self->number); - g_free(self); + g_return_if_fail (self != NULL); + g_return_if_fail (self->type == TYPE_NODE); + g_free (self->name); + g_free (self->pointer); + g_free (self->postfix); + g_free (self); } -void free_class (Class * self) +void +free_variable (Variable * self) { - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == CLASS_NODE); - g_free(self->otype); - g_free(self->ptype); - g_free(self->chunk_size); - free_node_list(self->nodes); - g_free(self); + g_return_if_fail (self != NULL); + g_return_if_fail (self->type == VARIABLE_NODE); + free_type (self->vtype); + g_free (self->id); + g_free (self->destructor); + g_free (self->initializer); + g_free (self); } -void free_funcarg (FuncArg * self) +static void +setv_argument (Argument * self, va_list __ap) { - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == FUNCARG_NODE); - free_type(self->atype); - g_free(self->name); - free_node_list(self->checks); - g_free(self); + int quark; + const char *arg; + ensure_quarks (); + while ((arg = va_arg (__ap, char *)) != NULL) { + quark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg)); + switch (quark) { + case QUARK_gtktype: { + char * gtktype = va_arg (__ap, char *); + char * __old_value = self->gtktype; + self->gtktype = g_strdup (gtktype); + g_free (__old_value); + break; + } + case QUARK_gtktype_STEAL: { + char * gtktype = va_arg (__ap, char *); + self->gtktype = gtktype; + break; + } + case QUARK_atype: { + Type * atype = va_arg (__ap, Type *); + Type * __old_value = self->atype; + self->atype = copy_type (atype); + free_type (__old_value); + break; + } + case QUARK_atype_STEAL: { + Type * atype = va_arg (__ap, Type *); + self->atype = atype; + break; + } + case QUARK_flags: { + GList * flags = va_arg (__ap, GList *); + GList * __old_value = self->flags; + self->flags = g_list_copy (flags); COPY_LIST_VALS(self->flags, g_strdup); + g_list_foreach (__old_value, (GFunc)g_free, NULL); g_list_free (__old_value); + break; + } + case QUARK_flags_STEAL: { + GList * flags = va_arg (__ap, GList *); + self->flags = flags; + break; + } + case QUARK_name: { + char * name = va_arg (__ap, char *); + char * __old_value = self->name; + self->name = g_strdup (name); + g_free (__old_value); + break; + } + case QUARK_name_STEAL: { + char * name = va_arg (__ap, char *); + self->name = name; + break; + } + case QUARK_get: { + char * get = va_arg (__ap, char *); + char * __old_value = self->get; + self->get = g_strdup (get); + g_free (__old_value); + break; + } + case QUARK_get_STEAL: { + char * get = va_arg (__ap, char *); + self->get = get; + break; + } + case QUARK_get_line: { + int get_line = va_arg (__ap, int); + self->get_line = get_line; + break; + } + case QUARK_set: { + char * set = va_arg (__ap, char *); + char * __old_value = self->set; + self->set = g_strdup (set); + g_free (__old_value); + break; + } + case QUARK_set_STEAL: { + char * set = va_arg (__ap, char *); + self->set = set; + break; + } + case QUARK_set_line: { + int set_line = va_arg (__ap, int); + self->set_line = set_line; + break; + } + case QUARK_line_no: { + int line_no = va_arg (__ap, int); + self->line_no = line_no; + break; + } + default: + g_warning ("Argument named 'Argument::%s' does not exist", arg); + break; + } + } +} + +static void +setv_ccode (CCode * self, va_list __ap) +{ + int quark; + const char *arg; + ensure_quarks (); + while ((arg = va_arg (__ap, char *)) != NULL) { + quark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg)); + switch (quark) { + case QUARK_cctype: { + int cctype = va_arg (__ap, int); + self->cctype = cctype; + break; + } + case QUARK_cbuf: { + char * cbuf = va_arg (__ap, char *); + char * __old_value = self->cbuf; + self->cbuf = g_strdup (cbuf); + g_free (__old_value); + break; + } + case QUARK_cbuf_STEAL: { + char * cbuf = va_arg (__ap, char *); + self->cbuf = cbuf; + break; + } + case QUARK_line_no: { + int line_no = va_arg (__ap, int); + self->line_no = line_no; + break; + } + default: + g_warning ("Argument named 'CCode::%s' does not exist", arg); + break; + } + } +} + +static void +setv_check (Check * self, va_list __ap) +{ + int quark; + const char *arg; + ensure_quarks (); + while ((arg = va_arg (__ap, char *)) != NULL) { + quark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg)); + switch (quark) { + case QUARK_chtype: { + int chtype = va_arg (__ap, int); + self->chtype = chtype; + break; + } + case QUARK_number: { + char * number = va_arg (__ap, char *); + char * __old_value = self->number; + self->number = g_strdup (number); + g_free (__old_value); + break; + } + case QUARK_number_STEAL: { + char * number = va_arg (__ap, char *); + self->number = number; + break; + } + default: + g_warning ("Argument named 'Check::%s' does not exist", arg); + break; + } + } } -void free_method (Method * self) +static void +setv_class (Class * self, va_list __ap) { - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == METHOD_NODE); - free_type(self->mtype); - g_free(self->otype); - g_list_foreach(self->gtktypes, (GFunc)g_free, NULL); g_list_free(self->gtktypes); - g_list_foreach(self->flags, (GFunc)g_free, NULL); g_list_free(self->flags); - g_free(self->id); - free_node_list(self->args); - g_free(self->onerror); - g_free(self->defreturn); - g_free(self->cbuf); - g_free(self); + int quark; + const char *arg; + ensure_quarks (); + while ((arg = va_arg (__ap, char *)) != NULL) { + quark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg)); + switch (quark) { + case QUARK_otype: { + char * otype = va_arg (__ap, char *); + char * __old_value = self->otype; + self->otype = g_strdup (otype); + g_free (__old_value); + break; + } + case QUARK_otype_STEAL: { + char * otype = va_arg (__ap, char *); + self->otype = otype; + break; + } + case QUARK_ptype: { + char * ptype = va_arg (__ap, char *); + char * __old_value = self->ptype; + self->ptype = g_strdup (ptype); + g_free (__old_value); + break; + } + case QUARK_ptype_STEAL: { + char * ptype = va_arg (__ap, char *); + self->ptype = ptype; + break; + } + case QUARK_bonobo_x_class: { + char * bonobo_x_class = va_arg (__ap, char *); + char * __old_value = self->bonobo_x_class; + self->bonobo_x_class = g_strdup (bonobo_x_class); + g_free (__old_value); + break; + } + case QUARK_bonobo_x_class_STEAL: { + char * bonobo_x_class = va_arg (__ap, char *); + self->bonobo_x_class = bonobo_x_class; + break; + } + case QUARK_chunk_size: { + char * chunk_size = va_arg (__ap, char *); + char * __old_value = self->chunk_size; + self->chunk_size = g_strdup (chunk_size); + g_free (__old_value); + break; + } + case QUARK_chunk_size_STEAL: { + char * chunk_size = va_arg (__ap, char *); + self->chunk_size = chunk_size; + break; + } + case QUARK_nodes: { + GList * nodes = va_arg (__ap, GList *); + GList * __old_value = self->nodes; + self->nodes = node_list_copy (nodes); + node_list_free (__old_value); + break; + } + case QUARK_nodes_STEAL: { + GList * nodes = va_arg (__ap, GList *); + self->nodes = nodes; + break; + } + default: + g_warning ("Argument named 'Class::%s' does not exist", arg); + break; + } + } } -void free_type (Type * self) +static void +setv_funcarg (FuncArg * self, va_list __ap) { - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == TYPE_NODE); - g_free(self->name); - g_free(self->pointer); - g_free(self->postfix); - g_free(self); + int quark; + const char *arg; + ensure_quarks (); + while ((arg = va_arg (__ap, char *)) != NULL) { + quark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg)); + switch (quark) { + case QUARK_atype: { + Type * atype = va_arg (__ap, Type *); + Type * __old_value = self->atype; + self->atype = copy_type (atype); + free_type (__old_value); + break; + } + case QUARK_atype_STEAL: { + Type * atype = va_arg (__ap, Type *); + self->atype = atype; + break; + } + case QUARK_name: { + char * name = va_arg (__ap, char *); + char * __old_value = self->name; + self->name = g_strdup (name); + g_free (__old_value); + break; + } + case QUARK_name_STEAL: { + char * name = va_arg (__ap, char *); + self->name = name; + break; + } + case QUARK_checks: { + GList * checks = va_arg (__ap, GList *); + GList * __old_value = self->checks; + self->checks = node_list_copy (checks); + node_list_free (__old_value); + break; + } + case QUARK_checks_STEAL: { + GList * checks = va_arg (__ap, GList *); + self->checks = checks; + break; + } + default: + g_warning ("Argument named 'FuncArg::%s' does not exist", arg); + break; + } + } } -void free_variable (Variable * self) +static void +setv_method (Method * self, va_list __ap) { - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == VARIABLE_NODE); - free_type(self->vtype); - g_free(self->id); - g_free(self->destructor); - g_free(self->initializer); - g_free(self); + int quark; + const char *arg; + ensure_quarks (); + while ((arg = va_arg (__ap, char *)) != NULL) { + quark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg)); + switch (quark) { + case QUARK_scope: { + int scope = va_arg (__ap, int); + self->scope = scope; + break; + } + case QUARK_method: { + int method = va_arg (__ap, int); + self->method = method; + break; + } + case QUARK_mtype: { + Type * mtype = va_arg (__ap, Type *); + Type * __old_value = self->mtype; + self->mtype = copy_type (mtype); + free_type (__old_value); + break; + } + case QUARK_mtype_STEAL: { + Type * mtype = va_arg (__ap, Type *); + self->mtype = mtype; + break; + } + case QUARK_otype: { + char * otype = va_arg (__ap, char *); + char * __old_value = self->otype; + self->otype = g_strdup (otype); + g_free (__old_value); + break; + } + case QUARK_otype_STEAL: { + char * otype = va_arg (__ap, char *); + self->otype = otype; + break; + } + case QUARK_gtktypes: { + GList * gtktypes = va_arg (__ap, GList *); + GList * __old_value = self->gtktypes; + self->gtktypes = g_list_copy (gtktypes); COPY_LIST_VALS(self->gtktypes, g_strdup); + g_list_foreach (__old_value, (GFunc)g_free, NULL); g_list_free (__old_value); + break; + } + case QUARK_gtktypes_STEAL: { + GList * gtktypes = va_arg (__ap, GList *); + self->gtktypes = gtktypes; + break; + } + case QUARK_flags: { + GList * flags = va_arg (__ap, GList *); + GList * __old_value = self->flags; + self->flags = g_list_copy (flags); COPY_LIST_VALS(self->flags, g_strdup); + g_list_foreach (__old_value, (GFunc)g_free, NULL); g_list_free (__old_value); + break; + } + case QUARK_flags_STEAL: { + GList * flags = va_arg (__ap, GList *); + self->flags = flags; + break; + } + case QUARK_id: { + char * id = va_arg (__ap, char *); + char * __old_value = self->id; + self->id = g_strdup (id); + g_free (__old_value); + break; + } + case QUARK_id_STEAL: { + char * id = va_arg (__ap, char *); + self->id = id; + break; + } + case QUARK_args: { + GList * args = va_arg (__ap, GList *); + GList * __old_value = self->args; + self->args = node_list_copy (args); + node_list_free (__old_value); + break; + } + case QUARK_args_STEAL: { + GList * args = va_arg (__ap, GList *); + self->args = args; + break; + } + case QUARK_onerror: { + char * onerror = va_arg (__ap, char *); + char * __old_value = self->onerror; + self->onerror = g_strdup (onerror); + g_free (__old_value); + break; + } + case QUARK_onerror_STEAL: { + char * onerror = va_arg (__ap, char *); + self->onerror = onerror; + break; + } + case QUARK_defreturn: { + char * defreturn = va_arg (__ap, char *); + char * __old_value = self->defreturn; + self->defreturn = g_strdup (defreturn); + g_free (__old_value); + break; + } + case QUARK_defreturn_STEAL: { + char * defreturn = va_arg (__ap, char *); + self->defreturn = defreturn; + break; + } + case QUARK_cbuf: { + char * cbuf = va_arg (__ap, char *); + char * __old_value = self->cbuf; + self->cbuf = g_strdup (cbuf); + g_free (__old_value); + break; + } + case QUARK_cbuf_STEAL: { + char * cbuf = va_arg (__ap, char *); + self->cbuf = cbuf; + break; + } + case QUARK_line_no: { + int line_no = va_arg (__ap, int); + self->line_no = line_no; + break; + } + case QUARK_ccode_line: { + int ccode_line = va_arg (__ap, int); + self->ccode_line = ccode_line; + break; + } + case QUARK_vararg: { + gboolean vararg = va_arg (__ap, gboolean); + self->vararg = vararg; + break; + } + case QUARK_unique_id: { + int unique_id = va_arg (__ap, int); + self->unique_id = unique_id; + break; + } + case QUARK_bonobo_x_func: { + gboolean bonobo_x_func = va_arg (__ap, gboolean); + self->bonobo_x_func = bonobo_x_func; + break; + } + default: + g_warning ("Argument named 'Method::%s' does not exist", arg); + break; + } + } } -Node * copy_node(Node *node) +static void +setv_property (Property * self, va_list __ap) { - g_return_val_if_fail(node != NULL, NULL); - g_return_val_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE, NULL); - switch(node->type) { + int quark; + const char *arg; + ensure_quarks (); + while ((arg = va_arg (__ap, char *)) != NULL) { + quark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg)); + switch (quark) { + case QUARK_gtktype: { + char * gtktype = va_arg (__ap, char *); + char * __old_value = self->gtktype; + self->gtktype = g_strdup (gtktype); + g_free (__old_value); + break; + } + case QUARK_gtktype_STEAL: { + char * gtktype = va_arg (__ap, char *); + self->gtktype = gtktype; + break; + } + case QUARK_ptype: { + Type * ptype = va_arg (__ap, Type *); + Type * __old_value = self->ptype; + self->ptype = copy_type (ptype); + free_type (__old_value); + break; + } + case QUARK_ptype_STEAL: { + Type * ptype = va_arg (__ap, Type *); + self->ptype = ptype; + break; + } + case QUARK_flags: { + GList * flags = va_arg (__ap, GList *); + GList * __old_value = self->flags; + self->flags = g_list_copy (flags); COPY_LIST_VALS(self->flags, g_strdup); + g_list_foreach (__old_value, (GFunc)g_free, NULL); g_list_free (__old_value); + break; + } + case QUARK_flags_STEAL: { + GList * flags = va_arg (__ap, GList *); + self->flags = flags; + break; + } + case QUARK_name: { + char * name = va_arg (__ap, char *); + char * __old_value = self->name; + self->name = g_strdup (name); + g_free (__old_value); + break; + } + case QUARK_name_STEAL: { + char * name = va_arg (__ap, char *); + self->name = name; + break; + } + case QUARK_nick: { + char * nick = va_arg (__ap, char *); + char * __old_value = self->nick; + self->nick = g_strdup (nick); + g_free (__old_value); + break; + } + case QUARK_nick_STEAL: { + char * nick = va_arg (__ap, char *); + self->nick = nick; + break; + } + case QUARK_blurb: { + char * blurb = va_arg (__ap, char *); + char * __old_value = self->blurb; + self->blurb = g_strdup (blurb); + g_free (__old_value); + break; + } + case QUARK_blurb_STEAL: { + char * blurb = va_arg (__ap, char *); + self->blurb = blurb; + break; + } + case QUARK_minimum: { + char * minimum = va_arg (__ap, char *); + char * __old_value = self->minimum; + self->minimum = g_strdup (minimum); + g_free (__old_value); + break; + } + case QUARK_minimum_STEAL: { + char * minimum = va_arg (__ap, char *); + self->minimum = minimum; + break; + } + case QUARK_maximum: { + char * maximum = va_arg (__ap, char *); + char * __old_value = self->maximum; + self->maximum = g_strdup (maximum); + g_free (__old_value); + break; + } + case QUARK_maximum_STEAL: { + char * maximum = va_arg (__ap, char *); + self->maximum = maximum; + break; + } + case QUARK_default_value: { + char * default_value = va_arg (__ap, char *); + char * __old_value = self->default_value; + self->default_value = g_strdup (default_value); + g_free (__old_value); + break; + } + case QUARK_default_value_STEAL: { + char * default_value = va_arg (__ap, char *); + self->default_value = default_value; + break; + } + case QUARK_extra_gtktype: { + char * extra_gtktype = va_arg (__ap, char *); + char * __old_value = self->extra_gtktype; + self->extra_gtktype = g_strdup (extra_gtktype); + g_free (__old_value); + break; + } + case QUARK_extra_gtktype_STEAL: { + char * extra_gtktype = va_arg (__ap, char *); + self->extra_gtktype = extra_gtktype; + break; + } + case QUARK_link: { + gboolean link = va_arg (__ap, gboolean); + self->link = link; + break; + } + case QUARK_export: { + gboolean export = va_arg (__ap, gboolean); + self->export = export; + break; + } + case QUARK_get: { + char * get = va_arg (__ap, char *); + char * __old_value = self->get; + self->get = g_strdup (get); + g_free (__old_value); + break; + } + case QUARK_get_STEAL: { + char * get = va_arg (__ap, char *); + self->get = get; + break; + } + case QUARK_get_line: { + int get_line = va_arg (__ap, int); + self->get_line = get_line; + break; + } + case QUARK_set: { + char * set = va_arg (__ap, char *); + char * __old_value = self->set; + self->set = g_strdup (set); + g_free (__old_value); + break; + } + case QUARK_set_STEAL: { + char * set = va_arg (__ap, char *); + self->set = set; + break; + } + case QUARK_set_line: { + int set_line = va_arg (__ap, int); + self->set_line = set_line; + break; + } + case QUARK_line_no: { + int line_no = va_arg (__ap, int); + self->line_no = line_no; + break; + } + default: + g_warning ("Argument named 'Property::%s' does not exist", arg); + break; + } + } +} + +static void +setv_type (Type * self, va_list __ap) +{ + int quark; + const char *arg; + ensure_quarks (); + while ((arg = va_arg (__ap, char *)) != NULL) { + quark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg)); + switch (quark) { + case QUARK_name: { + char * name = va_arg (__ap, char *); + char * __old_value = self->name; + self->name = g_strdup (name); + g_free (__old_value); + break; + } + case QUARK_name_STEAL: { + char * name = va_arg (__ap, char *); + self->name = name; + break; + } + case QUARK_pointer: { + char * pointer = va_arg (__ap, char *); + char * __old_value = self->pointer; + self->pointer = g_strdup (pointer); + g_free (__old_value); + break; + } + case QUARK_pointer_STEAL: { + char * pointer = va_arg (__ap, char *); + self->pointer = pointer; + break; + } + case QUARK_postfix: { + char * postfix = va_arg (__ap, char *); + char * __old_value = self->postfix; + self->postfix = g_strdup (postfix); + g_free (__old_value); + break; + } + case QUARK_postfix_STEAL: { + char * postfix = va_arg (__ap, char *); + self->postfix = postfix; + break; + } + default: + g_warning ("Argument named 'Type::%s' does not exist", arg); + break; + } + } +} + +static void +setv_variable (Variable * self, va_list __ap) +{ + int quark; + const char *arg; + ensure_quarks (); + while ((arg = va_arg (__ap, char *)) != NULL) { + quark = GPOINTER_TO_INT (g_hash_table_lookup (quark_ht, arg)); + switch (quark) { + case QUARK_scope: { + int scope = va_arg (__ap, int); + self->scope = scope; + break; + } + case QUARK_vtype: { + Type * vtype = va_arg (__ap, Type *); + Type * __old_value = self->vtype; + self->vtype = copy_type (vtype); + free_type (__old_value); + break; + } + case QUARK_vtype_STEAL: { + Type * vtype = va_arg (__ap, Type *); + self->vtype = vtype; + break; + } + case QUARK_id: { + char * id = va_arg (__ap, char *); + char * __old_value = self->id; + self->id = g_strdup (id); + g_free (__old_value); + break; + } + case QUARK_id_STEAL: { + char * id = va_arg (__ap, char *); + self->id = id; + break; + } + case QUARK_line_no: { + int line_no = va_arg (__ap, int); + self->line_no = line_no; + break; + } + case QUARK_destructor_unref: { + gboolean destructor_unref = va_arg (__ap, gboolean); + self->destructor_unref = destructor_unref; + break; + } + case QUARK_destructor: { + char * destructor = va_arg (__ap, char *); + char * __old_value = self->destructor; + self->destructor = g_strdup (destructor); + g_free (__old_value); + break; + } + case QUARK_destructor_STEAL: { + char * destructor = va_arg (__ap, char *); + self->destructor = destructor; + break; + } + case QUARK_destructor_line: { + int destructor_line = va_arg (__ap, int); + self->destructor_line = destructor_line; + break; + } + case QUARK_destructor_simple: { + gboolean destructor_simple = va_arg (__ap, gboolean); + self->destructor_simple = destructor_simple; + break; + } + case QUARK_initializer: { + char * initializer = va_arg (__ap, char *); + char * __old_value = self->initializer; + self->initializer = g_strdup (initializer); + g_free (__old_value); + break; + } + case QUARK_initializer_STEAL: { + char * initializer = va_arg (__ap, char *); + self->initializer = initializer; + break; + } + case QUARK_initializer_line: { + int initializer_line = va_arg (__ap, int); + self->initializer_line = initializer_line; + break; + } + default: + g_warning ("Argument named 'Variable::%s' does not exist", arg); + break; + } + } +} + +Node * +node_copy (Node *node) +{ + g_return_val_if_fail (node != NULL, NULL); + g_return_val_if_fail (node->type >= 0 && node->type < LAST_NODE_TYPE, NULL); + switch (node->type) { case ARGUMENT_NODE: return (Node *)copy_argument ((Argument *)node); case CCODE_NODE: return (Node *)copy_ccode ((CCode *)node); case CHECK_NODE: return (Node *)copy_check ((Check *)node); case CLASS_NODE: return (Node *)copy_class ((Class *)node); case FUNCARG_NODE: return (Node *)copy_funcarg ((FuncArg *)node); case METHOD_NODE: return (Node *)copy_method ((Method *)node); + case PROPERTY_NODE: return (Node *)copy_property ((Property *)node); case TYPE_NODE: return (Node *)copy_type ((Type *)node); case VARIABLE_NODE: return (Node *)copy_variable ((Variable *)node); default: return NULL; } } -void free_node(Node *node) +static void +node_setv (Node *node, va_list __ap) +{ + g_return_if_fail (node != NULL); + g_return_if_fail (node->type >= 0 && node->type < LAST_NODE_TYPE); + switch (node->type) { + case ARGUMENT_NODE: setv_argument ((Argument *)node, __ap); break; + case CCODE_NODE: setv_ccode ((CCode *)node, __ap); break; + case CHECK_NODE: setv_check ((Check *)node, __ap); break; + case CLASS_NODE: setv_class ((Class *)node, __ap); break; + case FUNCARG_NODE: setv_funcarg ((FuncArg *)node, __ap); break; + case METHOD_NODE: setv_method ((Method *)node, __ap); break; + case PROPERTY_NODE: setv_property ((Property *)node, __ap); break; + case TYPE_NODE: setv_type ((Type *)node, __ap); break; + case VARIABLE_NODE: setv_variable ((Variable *)node, __ap); break; + default: break; + } +} + +void +node_set (Node *node, ...) +{ + va_list __ap; + va_start (__ap, node); + node_setv (node, __ap); + va_end (__ap); +} + +Node * +node_new (NodeType type, ...) +{ + va_list __ap; + Node *node = NULL; + va_start (__ap, type); + g_return_val_if_fail (type >= 0 && type < LAST_NODE_TYPE, NULL); + switch (type) { + case ARGUMENT_NODE: + node = (Node *)g_new0 (Argument, 1); + node->type = type; + setv_argument ((Argument *)node, __ap); + break; + case CCODE_NODE: + node = (Node *)g_new0 (CCode, 1); + node->type = type; + setv_ccode ((CCode *)node, __ap); + break; + case CHECK_NODE: + node = (Node *)g_new0 (Check, 1); + node->type = type; + setv_check ((Check *)node, __ap); + break; + case CLASS_NODE: + node = (Node *)g_new0 (Class, 1); + node->type = type; + setv_class ((Class *)node, __ap); + break; + case FUNCARG_NODE: + node = (Node *)g_new0 (FuncArg, 1); + node->type = type; + setv_funcarg ((FuncArg *)node, __ap); + break; + case METHOD_NODE: + node = (Node *)g_new0 (Method, 1); + node->type = type; + setv_method ((Method *)node, __ap); + break; + case PROPERTY_NODE: + node = (Node *)g_new0 (Property, 1); + node->type = type; + setv_property ((Property *)node, __ap); + break; + case TYPE_NODE: + node = (Node *)g_new0 (Type, 1); + node->type = type; + setv_type ((Type *)node, __ap); + break; + case VARIABLE_NODE: + node = (Node *)g_new0 (Variable, 1); + node->type = type; + setv_variable ((Variable *)node, __ap); + break; + default: break; + } + va_end (__ap); + return node; +} + +void +node_free (Node *node) { - g_return_if_fail(node != NULL); - g_return_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE); - switch(node->type) { + g_return_if_fail (node != NULL); + g_return_if_fail (node->type >= 0 && node->type < LAST_NODE_TYPE); + switch (node->type) { case ARGUMENT_NODE: free_argument ((Argument *)node); return; case CCODE_NODE: free_ccode ((CCode *)node); return; case CHECK_NODE: free_check ((Check *)node); return; case CLASS_NODE: free_class ((Class *)node); return; case FUNCARG_NODE: free_funcarg ((FuncArg *)node); return; case METHOD_NODE: free_method ((Method *)node); return; + case PROPERTY_NODE: free_property ((Property *)node); return; case TYPE_NODE: free_type ((Type *)node); return; case VARIABLE_NODE: free_variable ((Variable *)node); return; default: return; } } -GList * copy_node_list(GList *nodes) +GList * +node_list_copy (GList *nodes) { GList *li; - nodes = g_list_copy(nodes); - for(li = nodes; li != NULL; li = li->next) { - li->data = copy_node(li->data); + nodes = g_list_copy (nodes); + for (li = nodes; li != NULL; li = li->next) { + li->data = node_copy (li->data); } return nodes; } -void free_node_list(GList *nodes) +void +node_list_free (GList *nodes) { GList *li; - for(li = nodes; li != NULL; li = li->next) { - free_node(li->data); + for (li = nodes; li != NULL; li = li->next) { + node_free (li->data); } - g_list_free(nodes); + g_list_free (nodes); } diff --git a/src/treefuncs.def b/src/treefuncs.def index e7a16b0..fde15cb 100644 --- a/src/treefuncs.def +++ b/src/treefuncs.def @@ -40,11 +40,13 @@ enum { SIGNAL_FIRST_METHOD, OVERRIDE_METHOD }; + ENDHEADER CLASS Class STRING otype # this object class type STRING ptype # parent class type + STRING bonobo_x_class # Class for BonoboXObject STRING chunk_size # if the object should be allocated with mem_chunks NODELIST nodes ENDCLASS @@ -84,13 +86,33 @@ CLASS Argument INT line_no ENDCLASS +CLASS Property + STRING gtktype + TYPE ptype + STRINGLIST flags + STRING name + STRING nick + STRING blurb + STRING minimum + STRING maximum + STRING default_value + STRING extra_gtktype + BOOL link + BOOL export + STRING get + INT get_line + STRING set + INT set_line + INT line_no +ENDCLASS + CLASS Method INT scope # scope type INT method # method type TYPE mtype STRING otype # for override methods - STRINGLIST gtktypes # GTK types for a signal - STRINGLIST flags # GTK_RUN_* flags for a signal + STRINGLIST gtktypes # GObject types for a signal + STRINGLIST flags # G_SIGNAL_* flags for a signal STRING id NODELIST args STRING onerror @@ -100,6 +122,7 @@ CLASS Method INT ccode_line BOOL vararg INT unique_id # A unique id for new methods + BOOL bonobo_x_func # Function for BonoboXObject ENDCLASS CLASS Variable @@ -107,6 +130,7 @@ CLASS Variable TYPE vtype STRING id INT line_no + BOOL destructor_unref STRING destructor INT destructor_line BOOL destructor_simple diff --git a/src/treefuncs.h b/src/treefuncs.h index 4d60558..f7ba204 100644 --- a/src/treefuncs.h +++ b/src/treefuncs.h @@ -2,9 +2,8 @@ * Do not edit by hand! */ -#ifndef _TREEFUNCS_H_ - -#define _TREEFUNCS_H_ +#ifndef TREEFUNCS_H +#define TREEFUNCS_H /* for ccode type */ enum { @@ -49,6 +48,8 @@ enum { }; + +typedef long NodeType; enum { CLASS_NODE, TYPE_NODE, @@ -56,6 +57,7 @@ enum { CHECK_NODE, FUNCARG_NODE, ARGUMENT_NODE, + PROPERTY_NODE, METHOD_NODE, VARIABLE_NODE, LAST_NODE_TYPE @@ -68,12 +70,13 @@ typedef struct _CCode CCode; typedef struct _Check Check; typedef struct _FuncArg FuncArg; typedef struct _Argument Argument; +typedef struct _Property Property; typedef struct _Method Method; typedef struct _Variable Variable; struct _Argument { - int type; + NodeType type; char * gtktype; Type * atype; GList * flags; @@ -86,35 +89,36 @@ struct _Argument { }; struct _CCode { - int type; + NodeType type; int cctype; char * cbuf; int line_no; }; struct _Check { - int type; + NodeType type; int chtype; char * number; }; struct _Class { - int type; + NodeType type; char * otype; char * ptype; + char * bonobo_x_class; char * chunk_size; GList * nodes; }; struct _FuncArg { - int type; + NodeType type; Type * atype; char * name; GList * checks; }; struct _Method { - int type; + NodeType type; int scope; int method; Type * mtype; @@ -130,21 +134,44 @@ struct _Method { int ccode_line; gboolean vararg; int unique_id; + gboolean bonobo_x_func; +}; + +struct _Property { + NodeType type; + char * gtktype; + Type * ptype; + GList * flags; + char * name; + char * nick; + char * blurb; + char * minimum; + char * maximum; + char * default_value; + char * extra_gtktype; + gboolean link; + gboolean export; + char * get; + int get_line; + char * set; + int set_line; + int line_no; }; struct _Type { - int type; + NodeType type; char * name; char * pointer; char * postfix; }; struct _Variable { - int type; + NodeType type; int scope; Type * vtype; char * id; int line_no; + gboolean destructor_unref; char * destructor; int destructor_line; gboolean destructor_simple; @@ -153,52 +180,29 @@ struct _Variable { }; union _Node { - int type; + NodeType type; Argument argument; CCode ccode; Check check; Class class; FuncArg funcarg; Method method; + Property property; Type _type; Variable variable; }; -/* New functions */ -Node * new_argument (char * gtktype, Type * atype, GList * flags, char * name, char * get, int get_line, char * set, int set_line, int line_no); -Node * new_ccode (int cctype, char * cbuf, int line_no); -Node * new_check (int chtype, char * number); -Node * new_class (char * otype, char * ptype, char * chunk_size, GList * nodes); -Node * new_funcarg (Type * atype, char * name, GList * checks); -Node * new_method (int scope, int method, Type * mtype, char * otype, GList * gtktypes, GList * flags, char * id, GList * args, char * onerror, char * defreturn, char * cbuf, int line_no, int ccode_line, gboolean vararg, int unique_id); -Node * new_type (char * name, char * pointer, char * postfix); -Node * new_variable (int scope, Type * vtype, char * id, int line_no, char * destructor, int destructor_line, gboolean destructor_simple, char * initializer, int initializer_line); /* General copy/free functions */ -Node * copy_node(Node *node); -void free_node(Node *node); - -GList * copy_node_list(GList *nodes); -void free_node_list(GList *nodes); - -/* Copy functions */ -Argument * copy_argument (Argument * self); -CCode * copy_ccode (CCode * self); -Check * copy_check (Check * self); -Class * copy_class (Class * self); -FuncArg * copy_funcarg (FuncArg * self); -Method * copy_method (Method * self); -Type * copy_type (Type * self); -Variable * copy_variable (Variable * self); - -/* Free functions */ -void free_argument (Argument * self); -void free_ccode (CCode * self); -void free_check (Check * self); -void free_class (Class * self); -void free_funcarg (FuncArg * self); -void free_method (Method * self); -void free_type (Type * self); -void free_variable (Variable * self); - -#endif /*_TREEFUNCS_H_*/ +Node * node_copy (Node *node); +void node_free (Node *node); + +GList * node_list_copy (GList *nodes); +void node_list_free (GList *nodes); + +/* Node new/set functions */ +Node * node_new (NodeType type, ...); +void node_set (Node *node, ...); + + +#endif /* TREEFUNCS_H */ diff --git a/src/util.c b/src/util.c index acc112e..cc523ed 100644 --- a/src/util.c +++ b/src/util.c @@ -21,6 +21,7 @@ */ #include "config.h" +#include #include #include #include @@ -163,26 +164,36 @@ typedef struct _OurGtkType OurGtkType; struct _OurGtkType { gboolean simple; char *gtkname; - char *typename; + char *cast; + char *type_name; + char *type_pointer; int special; }; const OurGtkType our_gtk_type_table[] = { - { TRUE, "NONE", "void ", -1 }, - { TRUE, "CHAR", "gchar ", -1 }, - { TRUE, "UCHAR", "guchar ", -1 }, - { TRUE, "BOOL", "gboolean ", -1 }, - { TRUE, "INT", "gint ", -1 }, - { TRUE, "UINT", "guint ", -1 }, - { TRUE, "LONG", "glong ", -1 }, - { TRUE, "ULONG", "gulong ", -1 }, - { TRUE, "FLOAT", "gfloat ", -1 }, - { TRUE, "DOUBLE", "gdouble ", -1 }, - { TRUE, "STRING", /*"GtkString"*/"gchar *", -1 }, - { TRUE, "ENUM", /*"GtkEnum"*/"gint ", -1 }, - { TRUE, "FLAGS", /*"GtkFlags"*/"guint ", -1 }, - { TRUE, "BOXED", /*"GtkBoxed"*/"gpointer ", -1 }, - { TRUE, "POINTER", "gpointer ", -1 }, - { TRUE, "OBJECT", "GtkObject *", -1 }, + { TRUE, "NONE", "void ", "void", NULL, -1 }, + { TRUE, "CHAR", "gchar ", "gchar", NULL, -1 }, + { TRUE, "UCHAR", "guchar ", "guchar", NULL, -1 }, + { TRUE, "BOOLEAN", "gboolean ", "gboolean", NULL, -1 }, + { TRUE, "INT", "gint ", "gint", NULL, -1 }, + { TRUE, "UINT", "guint ", "guint", NULL, -1 }, + { TRUE, "LONG", "glong ", "glong", NULL, -1 }, + { TRUE, "ULONG", "gulong ", "gulong", NULL, -1 }, + { TRUE, "ENUM", /*"enum"*/"gint ", "gint", NULL, -1 }, + { TRUE, "FLAGS", /*"flags"*/"guint ", "guint", NULL, -1 }, + { TRUE, "FLOAT", "gfloat ", "gfloat", NULL, -1 }, + { TRUE, "DOUBLE", "gdouble ", "gdouble", NULL, -1 }, + { TRUE, "STRING", /*"string"*/"gchar *", "gchar", "*", -1 }, + { TRUE, "POINTER", "gpointer ", "gpointer", NULL, -1 }, + { TRUE, "BOXED", /*"boxed"*/"gpointer ", "gpointer", NULL, -1 }, + { TRUE, "OBJECT", "GObject *", "GObject", "*", -1 }, + { TRUE, "PARAM", "GParamSpec *", "GParamSpec", "*", -1 }, + + /* FIXME: VALUE_ARRAY, CLOSURE, UNICHAR */ + /* Note that those have some issues with g_value_ calls etc... so + * we can't just add them */ + + /* Do we need this??? */ +#if 0 { FALSE, "SIGNAL", /*"GtkSignal"*/"___twopointertype ", SPECIAL_2POINTER }, { FALSE, "ARGS", /*"GtkArgs"*/"___intpointertype ", @@ -193,6 +204,7 @@ const OurGtkType our_gtk_type_table[] = { SPECIAL_2POINTER }, { FALSE, "FOREIGN", /*"GtkForeign"*/"___twopointertype ", SPECIAL_2POINTER }, +#endif { FALSE, NULL, NULL } }; @@ -215,20 +227,43 @@ init_type_hash(void) } const char * -get_cast(char *type, gboolean simple_only) +get_cast (const char *type, gboolean simple_only) { OurGtkType *gtype; - init_type_hash(); + init_type_hash (); - gtype = g_hash_table_lookup(type_hash, type); + gtype = g_hash_table_lookup (type_hash, type); - if(!gtype || - (simple_only && - !gtype->simple)) + if (gtype == NULL || + (simple_only && + ! gtype->simple)) return NULL; - return gtype->typename; + return gtype->cast; +} + +Type * +get_tree_type (const char *type, gboolean simple_only) +{ + OurGtkType *gtype; + Node *node; + + init_type_hash (); + + gtype = g_hash_table_lookup (type_hash, type); + + if (gtype == NULL || + (simple_only && + ! gtype->simple)) + return NULL; + + node = node_new (TYPE_NODE, + "name", gtype->type_name, + "pointer", gtype->type_pointer, + NULL); + + return (Type *)node; } static void @@ -275,15 +310,3 @@ setup_special_array(Class *c, gboolean *special_array) return any_special; } - -/* get the id without the first underscore, but only if we're removing them */ -const char * -get_real_id(const char *id) -{ - if( ! no_kill_underscores && - id[0] == '_' && - id[1] != '\0') - return &id[1]; - else - return id; -} diff --git a/src/util.h b/src/util.h index 20692b0..f80eafc 100644 --- a/src/util.h +++ b/src/util.h @@ -20,8 +20,8 @@ * USA. */ -#ifndef _UTIL_H_ -#define _UTIL_H_ +#ifndef UTIL_H +#define UTIL_H enum { GOB_WARN, @@ -47,7 +47,8 @@ void separns_replace_sep(const char *base, char **ns, char **name, char r); char * make_pre_macro(const char *base,const char *pre); /* get a name usable for a cast from a GTK+ type (without GTK_TYPE_)*/ -const char * get_cast(char *type, gboolean simple_only); +const char * get_cast (const char *type, gboolean simple_only); +Type * get_tree_type (const char *type, gboolean simple_only); enum { SPECIAL_2POINTER, @@ -58,8 +59,4 @@ enum { /* returns TRUE if there are any special types at all */ gboolean setup_special_array(Class *c, gboolean *special_array); -/* get the id without the first underscore, but only if we're removing them */ -const char *get_real_id(const char *id); - -#endif - +#endif /* UTIL_H */ diff --git a/stamp-h.in b/stamp-h.in index 9788f70..e69de29 100644 --- a/stamp-h.in +++ b/stamp-h.in @@ -1 +0,0 @@ -timestamp