[gob] Mon Jan 03 13:53:58 2011 Jiri (George) Lebl <jirka 5z com>
- From: George Lebl <jirka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gob] Mon Jan 03 13:53:58 2011 Jiri (George) Lebl <jirka 5z com>
- Date: Mon, 3 Jan 2011 21:54:18 +0000 (UTC)
commit 9d3ef62194f5b8051578144fd212cbff3a0a04c1
Author: Jiri (George) Lebl <jirka 5z com>
Date: Mon Jan 3 13:54:01 2011 -0800
Mon Jan 03 13:53:58 2011 Jiri (George) Lebl <jirka 5z com>
* src/main.c, src/lexer.l, src/parse.y, src/treefuncs.def: Add
%ct{ %ctop{ which is like alltop but only for the C file.
* src/test.gob: add test
* doc/gob2.1.in: document
* configure.in: bump version
ChangeLog | 11 +++++++++++
configure.in | 2 +-
doc/gob2.1.in | 19 +++++++++++++------
src/lexer.l | 12 +++++++++++-
src/main.c | 8 +++++---
src/parse.y | 11 ++++++++++-
src/test.gob | 11 ++++++++++-
src/treefuncs.def | 11 ++++++-----
src/treefuncs.h | 3 ++-
9 files changed, 69 insertions(+), 19 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f3ea219..a47721b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Mon Jan 03 13:53:58 2011 Jiri (George) Lebl <jirka 5z com>
+
+ * src/main.c, src/lexer.l, src/parse.y, src/treefuncs.def: Add
+ %ct{ %ctop{ which is like alltop but only for the C file.
+
+ * src/test.gob: add test
+
+ * doc/gob2.1.in: document
+
+ * configure.in: bump version
+
Sat Oct 09 12:20:06 2010 Jiri (George) Lebl <jirka 5z com>
* configure.in, src/Makefile.am: fixup some brokeneness, Thanks to
diff --git a/configure.in b/configure.in
index 39aa729..adfc645 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.17)
+AM_INIT_AUTOMAKE(gob2,2.0.18)
AM_MAINTAINER_MODE
GLIB_REQUIRED=2.0.0
diff --git a/doc/gob2.1.in b/doc/gob2.1.in
index 4022f92..31f7bfb 100644
--- a/doc/gob2.1.in
+++ b/doc/gob2.1.in
@@ -1,6 +1,6 @@
.\"
.\" gob manual page
-.\" (C) 1999,2000,2001,2002,2005 George Lebl <jirka 5z com>
+.\" (C) 1999-2011 Jiri (George) Lebl <jirka 5z com>
.\"
.\" This manual page is covered by the terms of the GNU General
.\" Public License.
@@ -104,14 +104,14 @@ some private data members without breaking binary compatibility.
The directory into which output should be placed.
.TP
.B \-\-file\-sep[=c]
-Replace default \`\-\' file name separator. If no separator character
+Replace default \'\-\' file name separator. If no separator character
is given then none is used. Only one character can be used.
.SH TYPENAMES
.PP
Because we need to parse out different parts of the typename, sometimes you
need to specify the typename with some special syntax. Types are specified in
-capitalized form and words are separated by \`:\'. The first word of the type
+capitalized form and words are separated by \':\'. The first word of the type
(which can be empty) is the "namespace". This fact is for example used for the
type checking macro and the type macro. For "Gtk:New:Button", the macros will
be GTK_IS_NEW_BUTTON and GTK_TYPE_NEW_BUTTON. This colon separated format of
@@ -121,7 +121,7 @@ types.
.SH OUTPUT FILES
.PP
The filenames are created from the typename. The words are
-separated by \`\-\' (this can be changed with
+separated by \'\-\' (this can be changed with
\fB\-\-file\-sep\fR option) and all in lower case. For example for an object named
"Gtk:New:Button", the files are \fBgtk\-new\-button.c\fR and
\fBgtk\-new\-button.h\fR.
@@ -150,14 +150,21 @@ 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. Finally,
+files go in the \'alltop\' (or \'at\') section. When you want code
+to appear as in alltop but only in the cfile you use the \'ctop\' (or \'ct\')
+section. Note that ctop requires 2.0.18. 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 at the very top of all output files */
+ %}
+
+ %ctop{
+ /* this will be at the very top of the C file */
+ /* Requires 2.0.18 */
%}
%headertop{
diff --git a/src/lexer.l b/src/lexer.l
index 1a58a9c..bad0c9a 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -1,7 +1,7 @@
/* GOB C Preprocessor
* Copyright (C) 1999-2000 the Free Software Foundation.
* Copyright (C) 2000 Eazel, Inc.
- * Copyright (C) 2001-2009 George (Jiri) Lebl
+ * Copyright (C) 2001-2011 George (Jiri) Lebl
*
* Author: George Lebl
*
@@ -346,6 +346,16 @@ REJECT;
if(look_for_includes==0)
look_for_includes=1;
}
+^\%(ct|ctop)\{ {
+ BEGIN(C_CODE);
+ parenth_depth = 1;
+ class_after_c = FALSE;
+ code_type = CTCODE;
+ clear_cbuf();
+ ccode_line = line_no;
+ if(look_for_includes==0)
+ look_for_includes=1;
+ }
^\%(ad|afterdecls)\{ {
BEGIN(C_CODE);
parenth_depth = 1;
diff --git a/src/main.c b/src/main.c
index 872ede3..734efa4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,7 @@
/* GOB C Preprocessor
* Copyright (C) 1999,2000 the Free Software Foundation.
* Copyright (C) 2000 Eazel, Inc.
- * Copyright (C) 2001-2009 George (Jiri) Lebl
+ * Copyright (C) 2001-2011 George (Jiri) Lebl
*
* Author: George (Jiri) Lebl
*
@@ -3390,6 +3390,7 @@ print_ccode_block(CCode *cc)
out_addline_infile(fp, cc->line_no);
break;
default:
+ case CT_CCODE:
case C_CCODE:
fp = out;
out_printf(fp, "\n");
@@ -3924,12 +3925,13 @@ print_all_top(void)
{
GList *li;
- /* print the AT_CCODE blocks */
+ /* print the AT_CCODE and CT_CCODE blocks */
for(li = nodes; li != NULL; li = li->next) {
Node *node = li->data;
if(node->type == CCODE_NODE) {
CCode *cc = (CCode *)node;
- if(cc->cctype == AT_CCODE)
+ if (cc->cctype == AT_CCODE ||
+ cc->cctype == CT_CCODE)
print_ccode_block((CCode *)node);
}
}
diff --git a/src/parse.y b/src/parse.y
index 9c880cf..5c8cc98 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -693,7 +693,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 ADCODE HTCODE PHCODE HCODE ACODE ATCODE STRING
+%token <cbuf> CCODE CTCODE 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
@@ -770,6 +770,15 @@ ccode: CCODE {
nodes = g_list_append(nodes,node);
g_string_free($<cbuf>1,FALSE);
}
+ | CTCODE {
+ Node *node = node_new (CCODE_NODE,
+ "cctype", CT_CCODE,
+ "cbuf:steal", ($<cbuf>1)->str,
+ "line_no", ccode_line,
+ NULL);
+ nodes = g_list_append(nodes,node);
+ g_string_free($<cbuf>1,FALSE);
+ }
;
ccodes: ccodes ccode { ; }
diff --git a/src/test.gob b/src/test.gob
index be742ef..25e2e8f 100644
--- a/src/test.gob
+++ b/src/test.gob
@@ -3,12 +3,21 @@
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 2.0.16
+requires 2.0.18
+
+%ct{
+ /* very very top of C file useful for "config.h" sort of like alltop
+ * but only for C file */
+%}
%at{
/* ALL TOP */
%}
+%ctop{
+ /* Just like ct above */
+%}
+
%headertop{
/* this should go on the very top of the header */
diff --git a/src/treefuncs.def b/src/treefuncs.def
index d0ad4b3..76e5e02 100644
--- a/src/treefuncs.def
+++ b/src/treefuncs.def
@@ -12,7 +12,8 @@ enum {
AD_CCODE,
H_CCODE,
HT_CCODE,
- PH_CCODE
+ PH_CCODE,
+ CT_CCODE
};
/* check type */
@@ -56,7 +57,7 @@ CLASS Class
STRING otype # this object class type
STRING ptype # parent class type
STRING bonobo_object_class # Class for BonoboObject
- BOOL glade_xml # Glade XML Class
+ BOOL glade_xml # Glade XML Class
STRING chunk_size # if the object should be allocated with mem_chunks
STRINGLIST interfaces # GObject interfaces this class exports
NODELIST nodes
@@ -137,13 +138,13 @@ CLASS Method
BOOL vararg
INT unique_id # A unique id for new methods
BOOL bonobo_object_func # Function for BonoboObject
- STRING interface # interface this belongs to
+ STRING interface # interface this belongs to
ENDCLASS
CLASS Variable
INT scope
TYPE vtype
- BOOL glade_widget
+ BOOL glade_widget
STRING id
INT line_no
BOOL destructor_unref
@@ -152,7 +153,7 @@ CLASS Variable
BOOL destructor_simple
STRING initializer
INT initializer_line
- BOOL initializer_simple
+ BOOL initializer_simple
ENDCLASS
CLASS EnumDef
diff --git a/src/treefuncs.h b/src/treefuncs.h
index a97ada3..27c7c43 100644
--- a/src/treefuncs.h
+++ b/src/treefuncs.h
@@ -13,7 +13,8 @@ enum {
AD_CCODE,
H_CCODE,
HT_CCODE,
- PH_CCODE
+ PH_CCODE,
+ CT_CCODE
};
/* check type */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]