[gob] Fri Jul 10 14:34:38 2009 Jiri (George) Lebl <jirka 5z com>



commit 3771232238ac343ac7bcda0a3651bb3ed15a9f01
Author: Jiri (George) Lebl <jirka 5z com>
Date:   Fri Jul 10 14:38:12 2009 -0500

    Fri Jul 10 14:34:38 2009  Jiri (George) Lebl <jirka 5z com>
    
    	* configure.in: raise version
    
    	* src/Makefile.am: fixup for new files
    
    	* src/main.c, src/parse.y, src/lexer.l, src/test.gob: Apply patch by
    	  Jean-Yves Lefort to add %afterdecls{ %} code handling
    
    	* doc/gob2.1.in: document

 ChangeLog         |   11 +++++++++++
 README            |   12 +++++++-----
 configure.in      |    2 +-
 doc/gob2.1.in     |   32 ++++++++++++++++++++------------
 src/Makefile.am   |    2 +-
 src/lexer.l       |   12 +++++++++++-
 src/main.c        |   13 ++++++++++++-
 src/parse.y       |   13 +++++++++++--
 src/test.gob      |    7 ++++++-
 src/treefuncs.def |    1 +
 src/treefuncs.h   |    1 +
 11 files changed, 82 insertions(+), 24 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0139132..5f12f47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Fri Jul 10 14:34:38 2009  Jiri (George) Lebl <jirka 5z com>
+
+	* configure.in: raise version
+
+	* src/Makefile.am: fixup for new files
+
+	* src/main.c, src/parse.y, src/lexer.l, src/test.gob: Apply patch by
+	  Jean-Yves Lefort to add %afterdecls{ %} code handling
+
+	* doc/gob2.1.in: document
+
 Fri Jul 10 14:18:44 2009  Jiri (George) Lebl <jirka 5z com>
 
 	* src/main.c, src/parse.y, doc/gob2.1.in, src/treefuncs.def,
diff --git a/README b/README
index 93f7b12..2122ef4 100644
--- a/README
+++ b/README
@@ -1,8 +1,3 @@
-[
-  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!
-]
-
 GObject Builder (GOB-2)
 (George's Obfuscated Bits)
 
@@ -60,3 +55,10 @@ TODO:
 	- get a life (done, hence the lower rate of updates to gob!)
 
 George <jirka 5z com>
+
+[
+  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 old gnome CVS!  It is
+  not maintained anymore.
+]
+
diff --git a/configure.in b/configure.in
index c8821fb..da4b965 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(gob2,2.0.15)
+AM_INIT_AUTOMAKE(gob2,2.0.16)
 AM_MAINTAINER_MODE
 
 GLIB_REQUIRED=2.0.0
diff --git a/doc/gob2.1.in b/doc/gob2.1.in
index 48e21ca..904691e 100644
--- a/doc/gob2.1.in
+++ b/doc/gob2.1.in
@@ -150,36 +150,44 @@ the extern "C" and the protecting define.  To do this you can put them
 into the \'headertop\' (or \'ht\') section.  You may wish to include code or
 comments in all the files, which you can do by putting them into the \'all\'
 (or \'a\') section.  Similarly, code you wish to appear at the top of all
-files go in the \'alltop\' (or \'at\') section.  For example:
+files go in the \'alltop\' (or \'at\') section.  Finally,
+\'afterdecls\' includes code between the declarations and the method
+implementations, but note that \'afterdecls\' requires version 2.0.16.
+For example:
 .nf
 
   %alltop{
-  /* this will be on top of all output files */
+        /* this will be on top of all output files */
   %}
 
   %headertop{
-  /* this will be on top of the public header */
+        /* this will be on top of the public header */
   %}
 
   %privateheader{
-  /* this will go into the private header file */
+        /* this will go into the private header file */
   %}
 
   %h{
-  /* will be included in the header */
-  void somefunc(int i);
+        /* will be included in the header */
+        void somefunc(int i);
   %}
 
   %a{
-  /* will be included in all files */
+        /* will be included in all files */
+  %}
+
+  %afterdecls{
+        /* between the declarations and the method implementations */
+        /* Requires gob version 2.0.16 */
   %}
 
   %{
-  /* will be included in the C file */
-  void somefunc(int i)
-  {
-        /* some code */
-  }
+        /* will be included in the C file */
+        void somefunc(int i)
+        {
+              /* some code */
+        }
   %}
 
 .fi
diff --git a/src/Makefile.am b/src/Makefile.am
index 51e76ad..585fe09 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,7 +53,7 @@ gob2_LDADD = \
 
 CLEANFILES = @CLEANFILES@ $(BUILT_SOURCES) test-object.* test-object-private.h
 
-EXTRA_DIST = $(BUILT_SOURCES) test.gob generate_treefuncs.pl treefuncs.def
+EXTRA_DIST = $(BUILT_SOURCES) test.gob generate_treefuncs.pl treefuncs.def str.gob str_test.c Makefile.str
 
 # parse.h parse.c: parse.y
 # 	$(YACC) $(YFLAGS) $<
diff --git a/src/lexer.l b/src/lexer.l
index b3b2d59..0c8ef11 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -1,5 +1,7 @@
 /* GOB C Preprocessor
- * Copyright (C) 1999 the Free Software Foundation.
+ * Copyright (C) 1999-2000 the Free Software Foundation.
+ * Copyright (C) 2000 Eazel, Inc.
+ * Copyright (C) 2001-2009 George (Jiri) Lebl
  *
  * Author: George Lebl
  *
@@ -344,6 +346,14 @@ REJECT;
 			if(look_for_includes==0)
 				look_for_includes=1;
 		}
+^\%(ad|afterdecls)\{		{
+			BEGIN(C_CODE);
+			parenth_depth = 1;
+			class_after_c = FALSE;
+			code_type = ADCODE;
+			clear_cbuf();
+			ccode_line = line_no;
+		}
 <C_CODE>^\%\}	{
 			BEGIN(INITIAL);
 			yylval.cbuf = cbuf;
diff --git a/src/main.c b/src/main.c
index 4f6758b..f3142ad 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3406,6 +3406,7 @@ print_ccode_block(CCode *cc)
 	}
 	out_printf(fp, "%s\n", cc->cbuf);
 	if(cc->cctype == C_CCODE ||
+	   cc->cctype == AD_CCODE ||
 	   cc->cctype == A_CCODE ||
 	   cc->cctype == AT_CCODE ||
 	   cc->cctype == PH_CCODE)
@@ -3746,6 +3747,15 @@ print_class_block(Class *c)
 			    funcbase);
 	}
 
+	for (li = nodes; li != NULL; li = li->next) {
+		Node *node = li->data;
+		if (node->type == CCODE_NODE) {
+			CCode *cc = (CCode *)node;
+			if (cc->cctype == AD_CCODE)
+				print_ccode_block (cc);
+		}
+	}
+
 	if (need_constructor)
 		add_constructor (c);
 
@@ -4180,7 +4190,8 @@ generate_outfiles(void)
 		if (node->type == CCODE_NODE) {
 			CCode *cc = (CCode *)node;
 			if (cc->cctype != HT_CCODE &&
-			    cc->cctype != AT_CCODE)
+			    cc->cctype != AT_CCODE &&
+			    cc->cctype != AD_CCODE)
 				print_ccode_block ((CCode *)node);
 		} else if (node->type == CLASS_NODE) {
 			print_class_block ((Class *)node);
diff --git a/src/parse.y b/src/parse.y
index f03e8da..b8792bb 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -1,7 +1,7 @@
 /* GOB C Preprocessor
  * Copyright (C) 1999-2000 the Free Software Foundation.
  * Copyright (C) 2000 Eazel, Inc.
- * Copyright (C) 2001-2004 George (Jiri) Lebl
+ * Copyright (C) 2001-2009 George (Jiri) Lebl
  *
  * Author: George Lebl
  *
@@ -688,7 +688,7 @@ ensure_property (void)
 %token SIGNED UNSIGNED LONG SHORT INT FLOAT DOUBLE CHAR
 
 %token <id> TOKEN NUMBER TYPETOKEN ARRAY_DIM SINGLE_CHAR
-%token <cbuf> CCODE HTCODE PHCODE HCODE ACODE ATCODE STRING
+%token <cbuf> CCODE ADCODE HTCODE PHCODE HCODE ACODE ATCODE STRING
 %token <line> PUBLIC PRIVATE PROTECTED CLASSWIDE PROPERTY ARGUMENT
 %token <line> VIRTUAL SIGNAL OVERRIDE
 %token <line> NICK BLURB MAXIMUM MINIMUM DEFAULT_VALUE ERROR FLAGS TYPE
@@ -711,6 +711,15 @@ ccode:		CCODE			{
 			nodes = g_list_append(nodes,node);
 			g_string_free($<cbuf>1,FALSE);
 					}
+	|	ADCODE			{
+			Node *node = node_new (CCODE_NODE,
+					       "cctype", AD_CCODE,
+					       "cbuf:steal", ($<cbuf>1)->str,
+					       "line_no", ccode_line,
+					       NULL);
+			nodes = g_list_append(nodes,node);
+			g_string_free($<cbuf>1,FALSE);
+					}
 	|	HCODE			{
 			Node *node = node_new (CCODE_NODE,
 					       "cctype", H_CCODE,
diff --git a/src/test.gob b/src/test.gob
index c9b2ead..be742ef 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 1.99.0
+requires 2.0.16
 
 %at{
 /* ALL TOP */
@@ -23,6 +23,11 @@ requires 1.99.0
 /* this should go into the private header as well*/
 %}
 
+%afterdecls{
+	/* between the declarations and the method implementations */
+%}
+
+
 
 %{
 #include <stdio.h>
diff --git a/src/treefuncs.def b/src/treefuncs.def
index ce5e373..d0ad4b3 100644
--- a/src/treefuncs.def
+++ b/src/treefuncs.def
@@ -9,6 +9,7 @@ enum {
 	A_CCODE,
 	AT_CCODE,
 	C_CCODE,
+	AD_CCODE,
 	H_CCODE,
 	HT_CCODE,
 	PH_CCODE
diff --git a/src/treefuncs.h b/src/treefuncs.h
index a8aaf99..a97ada3 100644
--- a/src/treefuncs.h
+++ b/src/treefuncs.h
@@ -10,6 +10,7 @@ enum {
 	A_CCODE,
 	AT_CCODE,
 	C_CCODE,
+	AD_CCODE,
 	H_CCODE,
 	HT_CCODE,
 	PH_CCODE



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]