[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/geas lib/classdefs/classdata.c lib/classde...
From: |
Neil Tiffin |
Subject: |
gnue/geas lib/classdefs/classdata.c lib/classde... |
Date: |
Mon, 07 May 2001 09:34:13 -0700 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Neil Tiffin <address@hidden> 01/05/07 09:34:13
Modified files:
geas/lib/classdefs: classdata.c gcdparser.c gcdparser.h
geas/src : header.txt
geas/tools : gcdverifier.c
Log message:
Update to GNU coding standards, add lots of asserts(), fix argument
processing in gcdverifier.c.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/classdata.c.diff?cvsroot=OldCVS&tr1=1.42&tr2=1.43&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/gcdparser.c.diff?cvsroot=OldCVS&tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/gcdparser.h.diff?cvsroot=OldCVS&tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/header.txt.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/tools/gcdverifier.c.diff?cvsroot=OldCVS&tr1=1.13&tr2=1.14&r1=text&r2=text
Patches:
Index: gnue/geas/lib/classdefs/classdata.c
diff -u gnue/geas/lib/classdefs/classdata.c:1.42
gnue/geas/lib/classdefs/classdata.c:1.43
--- gnue/geas/lib/classdefs/classdata.c:1.42 Sun May 6 16:20:42 2001
+++ gnue/geas/lib/classdefs/classdata.c Mon May 7 09:34:12 2001
@@ -1,23 +1,29 @@
-/*
- geas - GNU Enterprise Application Server
-
+/*
+ $RCSfile: classdata.c,v $
+
+ This file is part of:
+
+ GNU Enterprise Application Server (GEAS)
+
Copyright (C) 2001 Free Software Foundation
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
+
+ $Id: classdata.c,v 1.43 2001/05/07 16:34:12 ntiffin Exp $
+
*/
#include <glib.h>
@@ -1497,7 +1503,6 @@
p = qualifiedname;
names = NULL;
}
-
while (*p != '\0')
{
q = strstr (p, "::");
@@ -1585,8 +1590,8 @@
}
/* ------------------------------------------------------------------------- *\
- * Scan the data base and replace all fields that are TYPES with the
- * resultant exploded fields.
+ * Scan the data base and replace all fields that are TYPES (not real fields)
+ * with the wanted exploded fields from the TYPE definition.
\* ------------------------------------------------------------------------- */
static void
odl_process_coumpound_types (odl_container * c)
Index: gnue/geas/lib/classdefs/gcdparser.c
diff -u gnue/geas/lib/classdefs/gcdparser.c:1.28
gnue/geas/lib/classdefs/gcdparser.c:1.29
--- gnue/geas/lib/classdefs/gcdparser.c:1.28 Tue Apr 3 16:33:11 2001
+++ gnue/geas/lib/classdefs/gcdparser.c Mon May 7 09:34:12 2001
@@ -1,23 +1,29 @@
-/*
- geas - GNU Enterprise Application Server
-
+/*
+ $RCSfile: gcdparser.c,v $
+
+ This file is part of:
+
+ GNU Enterprise Application Server (GEAS)
+
Copyright (C) 2001 Free Software Foundation
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
+
+ $Id: gcdparser.c,v 1.29 2001/05/07 16:34:12 ntiffin Exp $
+
*/
/** \file gcdparser.h
@@ -26,6 +32,7 @@
*/
#include <glib.h>
+#include <assert.h>
#include "gcdparser.h"
#include "classdata.h"
@@ -34,102 +41,132 @@
int yyerrorcount = 0;
int yywarncount = 0;
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
struct _odl_tree *
- alloc_odl_tree()
- {
- struct _odl_tree *t = g_new0(struct _odl_tree, 1);
-
- if (t)
- {
- t->root = alloc_odl_container(NULL, -1);
+alloc_odl_tree ()
+{
+ struct _odl_tree *t = g_new0 (struct _odl_tree, 1);
+#ifdef DEBUG
+ assert (t != NULL);
+#endif
+ if (t)
+ {
+ t->root = alloc_odl_container (NULL, -1);
+#ifdef DEBUG
+ assert (t->root != NULL);
+#endif
if (t->root)
- {
- /* root module stores all other modules */
- t->root->base.type = IT_module;
- t->root->base.name = g_strdup("root");
- if (!t->root->base.name)
+ {
+ /* root module stores all other modules */
+ t->root->base.type = IT_module;
+ t->root->base.name = g_strdup ("root");
+ if (!t->root->base.name)
{
- free_odl_tree(t);
- return (NULL);
+ free_odl_tree (t);
+ return (NULL);
}
- }
+ }
else
- {
- /* error allocating root */
- free_odl_tree(t);
- t = NULL;
- }
- }
- return (t);
- }
-
-void
-free_odl_tree(struct _odl_tree *tree)
- {
- if (tree)
- {
+ {
+ /* error allocating root */
+ free_odl_tree (t);
+ t = NULL;
+ }
+ }
+ return (t);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+free_odl_tree (struct _odl_tree *tree)
+{
+#ifdef DEBUG
+ assert (tree != NULL);
+#endif
+ if (tree)
+ {
if (tree->root)
- free_odl_container(tree->root);
- g_free(tree);
- }
- }
-
+ {
+ free_odl_container (tree->root);
+ }
+ g_free (tree);
+ }
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
struct _odl_container *
- alloc_odl_container()
- {
- struct _odl_container *o = g_new0(struct _odl_container, 1);
-
- if (o)
- {
- init_odl_base((struct _odl_base *)o);
+alloc_odl_container ()
+{
+ struct _odl_container *o = g_new0 (struct _odl_container, 1);
+
+#ifdef DEBUG
+ assert (o != NULL);
+#endif
+ if (o)
+ {
+ init_odl_base ((struct _odl_base *) o);
o->contents = NULL;
-
o->istype = FALSE;
o->parents = NULL;
o->indexes = NULL;
o->orderby = NULL;
- }
- return (o);
- }
-
-void
-free_odl_container(struct _odl_container *c)
- {
- if (c)
- {
- free_odl_base((struct _odl_base *)c);
-
+ }
+ return (o);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+free_odl_container (struct _odl_container *c)
+{
+#ifdef DEBUG
+ assert (c != NULL);
+#endif
+ if (c)
+ {
+ free_odl_base ((struct _odl_base *) c);
if (c->contents)
- {
- /* free contained objects */
- }
+ {
+ /* free contained objects */
+ }
if (c->orderby)
- g_free(c->orderby);
+ {
+ g_free (c->orderby);
+ }
if (c->parents)
- {
- /* free links to parent classes */
- g_list_free(c->parents);
- }
+ {
+ /* free links to parent classes */
+ g_list_free (c->parents);
+ }
if (c->indexes)
- {
- /* free index data */
- }
-
- g_free(c);
- }
- }
-
+ {
+ /* free index data */
+ }
+ g_free (c);
+ }
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
struct _odl_item *
- alloc_odl_item()
- {
-
- struct _odl_item *i = g_new0(struct _odl_item, 1);
-
- if (i)
- {
- init_odl_base((struct _odl_base *)i);
-
+alloc_odl_item ()
+{
+ struct _odl_item *i = g_new0 (struct _odl_item, 1);
+#ifdef DEBUG
+ assert (i != NULL);
+#endif
+ if (i)
+ {
+ init_odl_base ((struct _odl_base *) i);
i->fieldtype = FT_unknown;
i->datatype = DT_unknown;
i->datatypeclass = NULL;
@@ -145,206 +182,306 @@
i->calculation = NULL;
i->elements = NULL;
i->bounds = -1;
- }
- return (i);
- }
+ }
+ return (i);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+free_odl_item (struct _odl_item *item)
+{
+#ifdef DEBUG
+ assert (item != NULL);
+#endif
+ if (item)
+ {
+ free_odl_base ((struct _odl_base *) item);
-void
-free_odl_item(struct _odl_item *item)
- {
- if (item)
- {
- free_odl_base((struct _odl_base *)item);
-
/* TODO: free everything else */
-
- g_free(item);
- }
- }
+ g_free (item);
+ }
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
struct _odl_argument *
- alloc_odl_argument()
- {
- struct _odl_argument *a = g_new0(struct _odl_argument, 1);
-
- if (a)
- {
+alloc_odl_argument ()
+{
+ struct _odl_argument *a = g_new0 (struct _odl_argument, 1);
+#ifdef DEBUG
+ assert (a != NULL);
+#endif
+ if (a)
+ {
a->method = NULL;
a->name = NULL;
a->datatype = DT_unknown;
a->classdatatype = NULL;
- }
- return (a);
- }
-
-void
-free_odl_argument(struct _odl_argument *argument)
- {}
-
-
-void
-init_odl_base(struct _odl_base *base)
- {
- base->name = NULL;
- base->fullname = NULL;
- base->mangledname = NULL;
- base->type = IT_unknown;
- base->access = ODL_ACCESS_PUBLIC;
- base->triggers = ODL_TRIG_NONE;
- base->parent = NULL;
- base->tree = NULL;
- }
-
-void
-free_odl_base(struct _odl_base *base)
- {
- if (base->name)
- g_free(base->name);
- }
-
+ }
+ return (a);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+free_odl_argument (struct _odl_argument *argument)
+{
+#ifdef DEBUG
+ assert (argument != NULL);
+#endif
+ /* TODO - there must be something to do here, neilt */
+}
+
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+init_odl_base (struct _odl_base *base)
+{
+#ifdef DEBUG
+ assert (base != NULL);
+#endif
+ base->name = NULL;
+ base->fullname = NULL;
+ base->mangledname = NULL;
+ base->type = IT_unknown;
+ base->access = ODL_ACCESS_PUBLIC;
+ base->triggers = ODL_TRIG_NONE;
+ base->parent = NULL;
+ base->tree = NULL;
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+free_odl_base (struct _odl_base *base)
+{
+#ifdef DEBUG
+ assert (base != NULL);
+ assert (base->name != NULL);
+#endif
+ if (base->name)
+ {
+ g_free (base->name);
+ }
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
struct _odl_container *
- odl_tree_get_root(struct _odl_tree *tree)
- {
- if (tree)
+odl_tree_get_root (struct _odl_tree *tree)
+{
+#ifdef DEBUG
+ assert (tree != NULL);
+#endif
+ if (tree)
+ {
return (tree->root);
- else
+ }
+ else
+ {
return (NULL);
- }
+ }
+}
-void
-odl_container_insert_container(struct _odl_container *parent,
- struct _odl_container *child)
- {
- parent->contents = g_list_append(parent->contents, child);
- }
-
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+odl_container_insert_container (struct _odl_container *parent,
+ struct _odl_container *child)
+{
+#ifdef DEBUG
+ assert (parent != NULL);
+ assert (child != NULL);
+#endif
+ parent->contents = g_list_append (parent->contents, child);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
odl_module *
-odl_new_module(unsigned long int access, const char *name)
- {
- odl_module *m = alloc_odl_container();
-
- if (m)
- {
+odl_new_module (unsigned long int access, const char *name)
+{
+ odl_module *m = alloc_odl_container ();
+#ifdef DEBUG
+ assert (name != NULL);
+ assert (m != NULL);
+#endif
+ if (m)
+ {
m->base.type = IT_module;
m->base.access = access;
- m->base.name = g_strdup(name);
- }
- return (m);
- }
-
+ m->base.name = g_strdup (name);
+ }
+ return (m);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
odl_class *
-odl_new_class(unsigned long int access, const char *name)
- {
- odl_class *c = alloc_odl_container();
- odl_field *f;
- GList *fields;
- _odl_index *i;
-
- if (c)
- {
+odl_new_class (unsigned long int access, const char *name)
+{
+ odl_field *f;
+ GList *fields;
+ _odl_index *i;
+ odl_class *c = alloc_odl_container ();
+#ifdef DEBUG
+ assert (name != NULL);
+ assert (c != NULL);
+#endif
+ if (c)
+ {
c->base.type = IT_class;
c->base.access = access;
- c->base.name = g_strdup(name);
+ c->base.name = g_strdup (name);
/* add the objectid field */
- f = alloc_odl_item();
+ f = alloc_odl_item ();
f->base.parent = (odl_base *) c;
f->base.access = ODL_ACCESS_SYSTEM;
- f->base.name = g_strdup("objectid");
+ f->base.name = g_strdup ("objectid");
f->base.type = IT_field;
f->properties = ODL_PROP_NOTNULL | ODL_PROP_READONLY;
f->fieldtype = FT_basic;
f->datatype = DT_object;
/* add it to the class */
- c->contents = g_list_append(c->contents, f);
+ c->contents = g_list_append (c->contents, f);
/* add indexes */
- fields = g_list_append(NULL, g_strdup("objectid"));
- i = odl_make_index(c, TRUE, fields);
+ fields = g_list_append (NULL, g_strdup ("objectid"));
+ i = odl_make_index (c, TRUE, fields);
i->primary = TRUE;
- }
- return (c);
- }
-
+ }
+ return (c);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
odl_item *
-odl_new_enum(unsigned long int access, const char *name)
- {
- odl_item *c = alloc_odl_item();
-
- if (c)
- {
+odl_new_enum (unsigned long int access, const char *name)
+{
+ odl_item *c = alloc_odl_item ();
+#ifdef DEBUG
+ assert (name != NULL);
+ assert (c != NULL);
+#endif
+ if (c)
+ {
c->base.type = IT_enum;
c->base.access = access;
- c->base.name = g_strdup(name);
- }
- return (c);
- }
-
-void
-odl_enum_add_element(odl_item * e, char *element)
- {
- GList *l = e->elements;
-
- while (l)
- {
- if (g_strcasecmp(l->data, element) == 0)
- {
- g_free(element);
- return ;
- }
- l = g_list_next(l);
- }
- e->elements = g_list_append(e->elements, g_strdup(element));
- }
-
+ c->base.name = g_strdup (name);
+ }
+ return (c);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+odl_enum_add_element (odl_item * e, char *element)
+{
+ GList *l;
+#ifdef DEBUG
+ assert (element != NULL);
+ assert (e != NULL);
+ assert (e->elements);
+#endif
+ l = e->elements;
+ while (l)
+ {
+ if (g_strcasecmp (l->data, element) == 0)
+ {
+ g_free (element);
+ return;
+ }
+ l = g_list_next (l);
+ }
+ e->elements = g_list_append (e->elements, g_strdup (element));
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
_odl_datatype *
-alloc_odl_datatype(gboolean unsignedval, char *name,
- unsigned long int bound, enum odl_datatype dt)
- {
- _odl_datatype *d = g_new0(_odl_datatype, 1);
-
- if (d)
- {
- if (g_strcasecmp(name, "void") == 0)
- {
- d->unsignedval = FALSE;
- d->name = name;
- d->bound = 0;
- d->dt = DT_void;
- }
+alloc_odl_datatype (gboolean unsignedval, char *name,
+ unsigned long int bound, enum odl_datatype dt)
+{
+ _odl_datatype *d = g_new0 (_odl_datatype, 1);
+
+#ifdef DEBUG
+ assert (name != NULL);
+ assert (d != NULL);
+#endif
+ if (d)
+ {
+ if (g_strcasecmp (name, "void") == 0)
+ {
+ d->unsignedval = FALSE;
+ d->name = name;
+ d->bound = 0;
+ d->dt = DT_void;
+ }
else
- {
- d->unsignedval = unsignedval;
- d->name = name;
- d->bound = bound;
- d->dt = dt;
- }
- }
- return (d);
- }
-
-void
-free_odl_datatype(_odl_datatype * d)
- {
- if (d)
- {
+ {
+ d->unsignedval = unsignedval;
+ d->name = name;
+ d->bound = bound;
+ d->dt = dt;
+ }
+ }
+ return (d);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+free_odl_datatype (_odl_datatype * d)
+{
+#ifdef DEBUG
+ assert (d != NULL);
+#endif
+ if (d)
+ {
if (d->name)
- g_free(d->name);
- g_free(d);
- }
- }
-
+ {
+ g_free (d->name);
+ }
+ g_free (d);
+ }
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
GList *
-odl_reprocess_fields(_odl_datatype * datatype, GList * fields)
- {
- GList *append = NULL;
- GList *f = fields;
- odl_item *i;
- odl_item *a;
-
- while (f)
- {
+odl_reprocess_fields (_odl_datatype * datatype, GList * fields)
+{
+ GList *append = NULL;
+ GList *f;
+ odl_item *i;
+ odl_item *a;
+
+#ifdef DEBUG
+ assert (datatype != NULL);
+ assert (fields != NULL);
+#endif
+ f = fields;
+ while (f)
+ {
/* get the field */
i = (odl_item *) f->data;
@@ -354,303 +491,341 @@
i->datatype = datatype->dt;
if (datatype->unsignedval)
- {
- if (i->datatype == DT_int)
- i->datatype = DT_unsignedint;
- }
+ {
+ if (i->datatype == DT_int)
+ {
+ i->datatype = DT_unsignedint;
+ }
+ }
/* skip 'type' created fields til later */
if (datatype->dt == DT_type)
- {
- i->base.type = IT_field;
- i->base.access = i->base.access;
- i->datatype = DT_type;
- i->datatypeclass = g_strdup(datatype->name);
- }
-
- if ((datatype->dt == DT_class || datatype->dt == DT_enum) &&
- datatype->dt != DT_type)
- {
- if (i->fieldtype == FT_basic && i->datatype == DT_class)
+ {
+ i->base.type = IT_field;
+ i->base.access = i->base.access;
+ i->datatype = DT_type;
+ i->datatypeclass = g_strdup (datatype->name);
+ }
+
+ if ((datatype->dt == DT_class || datatype->dt == DT_enum)
+ && datatype->dt != DT_type)
+ {
+ if (i->fieldtype == FT_basic && i->datatype == DT_class)
{
- /* turn it into a reference or list class */
- if (i->bounds == ( -1))
- {
- /* reference */
- /* convert this to a reference field */
- i->base.type = IT_field;
- i->base.access = i->base.access;
- i->fieldtype = FT_reference;
- i->source_fields =
- (odl_namelist *) g_list_append(NULL,
- g_strdup
- ("objectid"));
- i->this_fields =
- (odl_namelist *) g_list_append(NULL,
- g_strdup_printf
- ("_%s",
- i->base.name));
- i->sourceclass = g_strdup(datatype->name);
-
- /* create the _fieldname objectreference field */
- a = alloc_odl_item();
- if (a)
- {
- a->base.parent =
- (odl_base *) yycurrent_container;
- a->base.name =
- g_strdup_printf("_%s", i->base.name);
- a->base.access = i->base.access;
- a->base.type = IT_field;
- a->fieldtype = FT_basic;
- a->datatype = DT_object;
- a->properties = ODL_PROP_NONE;
- append = g_list_append(append, a);
- }
- else
- yyerror("Out of memory");
- }
- else
- {
- /* list */
- /* delayed until full tree is built */
- if (current_pass == 2)
- {
- char *name;
- odl_field *fl = (odl_field *) i;
- odl_class *cont =
- (odl_class *) fl->base.parent;
- odl_class *load =
- odl_find_class(yycurrenttree,
- datatype->name, NULL);
-
- if (!load)
- {
- yyerror("Could not find class '%s'",
- datatype->name);
- }
+ /* turn it into a reference or list class */
+ if (i->bounds == (-1))
+ {
+ /* reference */
+ /* convert this to a reference field */
+ i->base.type = IT_field;
+ i->base.access = i->base.access;
+ i->fieldtype = FT_reference;
+ i->source_fields =
+ (odl_namelist *) g_list_append (NULL,
+ g_strdup ("objectid"));
+ i->this_fields =
+ (odl_namelist *) g_list_append (NULL,
+ g_strdup_printf
+ ("_%s", i->base.name));
+ i->sourceclass = g_strdup (datatype->name);
+
+ /* create the _fieldname objectreference field */
+ a = alloc_odl_item ();
+ if (a)
+ {
+ a->base.parent = (odl_base *) yycurrent_container;
+ a->base.name = g_strdup_printf ("_%s", i->base.name);
+ a->base.access = i->base.access;
+ a->base.type = IT_field;
+ a->fieldtype = FT_basic;
+ a->datatype = DT_object;
+ a->properties = ODL_PROP_NONE;
+ append = g_list_append (append, a);
+ }
else
- {
- name =
- g_strdup_printf("_%s_%s",
- odl_class_get_mangled_name
- (cont),
- fl->base.name);
- a = alloc_odl_item();
- if (a)
+ {
+ yyerror ("Out of memory");
+ }
+ }
+ else
+ {
+ /* list */
+ /* delayed until full tree is built */
+ if (current_pass == 2)
+ {
+ char *name;
+ odl_field *fl = (odl_field *) i;
+ odl_class *cont = (odl_class *) fl->base.parent;
+ odl_class *load = odl_find_class (yycurrenttree,
+ datatype->name, NULL);
+ if (!load)
{
- a->base.parent = (odl_base *) load;
- a->base.name = g_strdup(name);
- a->base.access = i->base.access;
- a->base.type = IT_field;
- a->fieldtype = FT_basic;
- a->datatype = DT_object;
- a->properties = ODL_PROP_NONE;
- load->contents =
- g_list_append(load->contents,
- a);
+ yyerror ("Could not find class '%s'",
+ datatype->name);
}
- else
- yyerror("Out of memory");
-
- /* turn 'fl' into a list field */
- a = alloc_odl_item();
- if (a)
+ else
{
- a->base.name =
- g_strdup(fl->base.name);
- a->base.access = i->base.access;
- a->base.type = IT_field;
- a->fieldtype = FT_list;
- a->datatype = DT_class;
- a->properties = ODL_PROP_NONE;
- a->sourceclass =
- g_strdup(datatype->name);
- a->source_fields =
- g_list_append(NULL, name);
- a->this_fields =
- g_list_append(NULL,
- g_strdup
- ("objectid"));
- /* find the 'real' version in the
- class tree */
- cont =
- odl_find_class(yycurrenttree,
- odl_class_get_full_name
- (cont), NULL);
- a->base.parent = (odl_base *) cont;
- cont->contents =
- g_list_append(cont->contents,
- a);
+ name =
+ g_strdup_printf ("_%s_%s",
+ odl_class_get_mangled_name
+ (cont), fl->base.name);
+ a = alloc_odl_item ();
+ if (a)
+ {
+ a->base.parent = (odl_base *) load;
+ a->base.name = g_strdup (name);
+ a->base.access = i->base.access;
+ a->base.type = IT_field;
+ a->fieldtype = FT_basic;
+ a->datatype = DT_object;
+ a->properties = ODL_PROP_NONE;
+ load->contents =
+ g_list_append (load->contents, a);
+ }
+ else
+ {
+ yyerror ("Out of memory");
+ }
+ /* turn 'fl' into a list field */
+ a = alloc_odl_item ();
+ if (a)
+ {
+ a->base.name = g_strdup (fl->base.name);
+ a->base.access = i->base.access;
+ a->base.type = IT_field;
+ a->fieldtype = FT_list;
+ a->datatype = DT_class;
+ a->properties = ODL_PROP_NONE;
+ a->sourceclass = g_strdup (datatype->name);
+ a->source_fields = g_list_append (NULL, name);
+ a->this_fields =
+ g_list_append (NULL, g_strdup ("objectid"));
+ /* find the 'real' version in the class tree */
+ cont =
+ odl_find_class (yycurrenttree,
+ odl_class_get_full_name
+ (cont), NULL);
+ a->base.parent = (odl_base *) cont;
+ cont->contents =
+ g_list_append (cont->contents, a);
+ }
+ else
+ {
+ yyerror ("Out of memory");
+ }
+ fl->fieldtype = FT_list;
}
- else
- yyerror("Out of memory");
-
- fl->fieldtype = FT_list;
- }
- }
- else
- ((odl_base *) i)->type = IT_ignore;
- }
+ }
+ else
+ {
+ ((odl_base *) i)->type = IT_ignore;
+ }
+ }
}
- else
+ else
{
- i->datatypeclass = g_strdup(datatype->name);
+ i->datatypeclass = g_strdup (datatype->name);
}
- }
-
+ }
/* next */
- f = g_list_next(f);
- }
-
- if (append)
- fields = g_list_concat(fields, append);
-
- free_odl_datatype(datatype);
-
- return (fields);
- }
-
+ f = g_list_next (f);
+ }
+ if (append)
+ {
+ fields = g_list_concat (fields, append);
+ }
+ free_odl_datatype (datatype);
+ return (fields);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
odl_item *
-set_method_datatype(_odl_datatype * datatype, odl_item * method)
- {
- method->datatype = datatype->dt;
- return (method);
- }
-
+set_method_datatype (_odl_datatype * datatype, odl_item * method)
+{
+#ifdef DEBUG
+ assert (method != NULL);
+ assert (datatype != NULL);
+#endif
+ method->datatype = datatype->dt;
+ return (method);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
_odl_datasource *
-alloc_odl_datasource()
- {
- _odl_datasource *d = g_new(_odl_datasource, 1);
-
- if (d)
- {
+alloc_odl_datasource ()
+{
+ _odl_datasource *d = g_new (_odl_datasource, 1);
+
+#ifdef DEBUG
+ assert (d != NULL);
+#endif
+ if (d)
+ {
d->fields = NULL;
d->classname = NULL;
d->field = NULL;
- }
- return (d);
- }
-
-void
-free_odl_datasource(_odl_datasource * d)
- {
- if (d)
- {
+ }
+ return (d);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+free_odl_datasource (_odl_datasource * d)
+{
+#ifdef DEBUG
+ assert (d != NULL);
+#endif
+ if (d)
+ {
if (d->classname)
- g_free(d->classname);
+ {
+ g_free (d->classname);
+ }
if (d->field)
- g_free(d->field);
- g_free(d);
- }
- }
-
+ {
+ g_free (d->field);
+ }
+ g_free (d);
+ }
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
const char *
-odl_get_base_full_name(odl_base * b)
- {
- odl_base *tmp;
- GList *l = NULL;
- GList *l2;
- GString *buf;
- char *retval;
-
- if (b->fullname)
- {
+odl_get_base_full_name (odl_base * b)
+{
+ odl_base *tmp;
+ GList *l = NULL;
+ GList *l2;
+ GString *buf;
+ char *retval;
+
+#ifdef DEBUG
+ assert (b != NULL);
+#endif
+ if (b->fullname)
+ {
return (b->fullname);
- }
- buf = g_string_new("");
- tmp = b;
-
- while (b)
- {
+ }
+ buf = g_string_new ("");
+ tmp = b;
+ while (b)
+ {
if (b->name)
- l = g_list_prepend(l, b->name);
+ {
+ l = g_list_prepend (l, b->name);
+ }
b = b->parent;
- }
-
- l2 = l;
- while (l2)
- {
- g_string_append(buf, l2->data);
- g_string_append(buf, "::");
- l2 = g_list_next(l2);
- }
-
- if (l)
- g_list_free(l);
-
- retval = buf->str;
- while (retval[strlen(retval) - 1] == ':')
- retval[strlen(retval) - 1] = '\0';
- buf->str = NULL;
- g_string_free(buf, TRUE);
-
- tmp->fullname = retval;
- return (retval);
- }
-
-void
-odl_standardise_parents(odl_class * c)
- {
- char *buf;
- GList *l;
- odl_base *ptr;
- odl_base *item = NULL;
- GList *parents = NULL;
-
- /* no parents, so is very quick */
- if (c->parents == NULL)
- return ;
-
- l = c->parents;
- while (l)
- {
+ }
+ l2 = l;
+ while (l2)
+ {
+ g_string_append (buf, l2->data);
+ g_string_append (buf, "::");
+ l2 = g_list_next (l2);
+ }
+ if (l)
+ {
+ g_list_free (l);
+ }
+ retval = buf->str;
+ while (retval[strlen (retval) - 1] == ':')
+ {
+ retval[strlen (retval) - 1] = '\0';
+ }
+ buf->str = NULL;
+ g_string_free (buf, TRUE);
+
+ tmp->fullname = retval;
+ return (retval);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
+void
+odl_standardise_parents (odl_class * c)
+{
+ char *buf;
+ GList *l;
+ odl_base *ptr;
+ odl_base *item = NULL;
+ GList *parents = NULL;
+
+#ifdef DEBUG
+ assert (c != NULL);
+#endif
+ /* no parents, so is very quick */
+ if (c->parents == NULL)
+ {
+ return;
+ }
+ l = c->parents;
+ while (l)
+ {
ptr = c->base.parent;
-
/* look for it in immediate parent, and keep moving up until */
/* there's nowhere to go */
while (ptr)
- {
- item = odl_find_relative(ptr, l->data);
- if (item)
- ptr = NULL;
- else
- ptr = ptr->parent;
- }
+ {
+ item = odl_find_relative (ptr, l->data);
+ if (item)
+ {
+ ptr = NULL;
+ }
+ else
+ {
+ ptr = ptr->parent;
+ }
+ }
if (item)
- {
- char *tmp = g_strdup(odl_item_get_full_name(item));
-
- parents = g_list_append(parents, tmp);
- }
-
- l = g_list_next(l);
- }
- odl_namelist_free(c->parents);
- c->parents = parents;
- }
-
+ {
+ char *tmp = g_strdup (odl_item_get_full_name (item));
+ parents = g_list_append (parents, tmp);
+ }
+ l = g_list_next (l);
+ }
+ odl_namelist_free (c->parents);
+ c->parents = parents;
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
_odl_index *
-odl_make_index(odl_class * c, gboolean unique, GList * fieldnames)
- {
- _odl_index *i = g_new0(_odl_index, 1);
-
- if (i)
- {
+odl_make_index (odl_class * c, gboolean unique, GList * fieldnames)
+{
+ _odl_index *i = g_new0 (_odl_index, 1);
+
+#ifdef DEBUG
+ assert (c != NULL);
+ assert (fieldnames != NULL);
+ assert (i != NULL);
+#endif
+ if (i)
+ {
fieldnames =
- g_list_sort(fieldnames, (GCompareFunc) odl_sort_string_name);
-
+ g_list_sort (fieldnames, (GCompareFunc) odl_sort_string_name);
i->primary = FALSE;
i->unique = unique;
i->fields = fieldnames;
-
- c->indexes = g_list_append(c->indexes, i);
- }
- return (i);
- }
-
+ c->indexes = g_list_append (c->indexes, i);
+ }
+ return (i);
+}
+
+/* ------------------------------------------------------------------------- *\
+ *
+\* ------------------------------------------------------------------------- */
int
-odl_sort_string_name(gpointer a, gpointer b)
- {
- return (g_strcasecmp(a, b));
- }
+odl_sort_string_name (gpointer a, gpointer b)
+{
+ return (g_strcasecmp (a, b));
+}
Index: gnue/geas/lib/classdefs/gcdparser.h
diff -u gnue/geas/lib/classdefs/gcdparser.h:1.18
gnue/geas/lib/classdefs/gcdparser.h:1.19
--- gnue/geas/lib/classdefs/gcdparser.h:1.18 Tue Apr 3 16:33:11 2001
+++ gnue/geas/lib/classdefs/gcdparser.h Mon May 7 09:34:12 2001
@@ -1,22 +1,29 @@
-/*
- geas - GNU Enterprise Application Server
-
- Copyright (C) 2001 Free Software Foundation
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
+/*
+ $RCSfile: gcdparser.h,v $
+
+ This file is part of:
+
+ GNU Enterprise Application Server (GEAS)
+
+ Copyright (C) 2001 Free Software Foundation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ $Id: gcdparser.h,v 1.19 2001/05/07 16:34:12 ntiffin Exp $
+
+*/
/** \file gcdparser.h
@@ -30,153 +37,142 @@
#include "classdata.h"
-extern int yyerrorcount;
-extern int yywarncount;
+extern int yyerrorcount;
+extern int yywarncount;
struct _odl_base
- {
- /* generic data */
- char *name;
- char *fullname;
- char *mangledname;
- enum odl_itemtype type;
- unsigned long int access;
- unsigned long int triggers;
- struct _odl_base *parent;
- odl_tree *tree;
- };
+{
+ /* generic data */
+ char *name;
+ char *fullname;
+ char *mangledname;
+ enum odl_itemtype type;
+ unsigned long int access;
+ unsigned long int triggers;
+ struct _odl_base *parent;
+ odl_tree *tree;
+};
-/* stores modules, classes, etc */
+ /* stores modules, classes, etc */
struct _odl_container
- {
- struct _odl_base base;
-
- /* generic data */
- GList *contents; /* must be an instance of
_odl_base */
-
- /* business class data */
- gboolean istype; /* true if 'type' keyword was used */
- char *orderby;
- GList *parents;
- GList *indexes;
- };
+{
+ struct _odl_base base;
+ /* generic data */
+ GList *contents; /* must be an instance of _odl_base */
+ /* business class data */
+ gboolean istype; /* true if 'type' keyword was used */
+ char *orderby;
+ GList *parents;
+ GList *indexes;
+};
-/* items that can not have containers */
+ /* items that can not have containers */
struct _odl_item
- {
- struct _odl_base base;
-
- /* class fields - generic data */
- enum odl_fieldtype fieldtype;
- enum odl_datatype datatype;
- char *datatypeclass; /* when datatype == DT_class
*/
- unsigned long int properties;
-
- /* basic fields */
- char *format, *defaultval;
- char *tmpdefault;
-
- /* lookup/reference/list/readonly fields */
- char *sourcefield, *sourceclass;
- odl_namelist *this_fields;
- odl_namelist *source_fields;
- signed long int bounds;
-
- /* method */
- odl_argumentlist *arguments;
-
- /* calculated */
- char *calculation;
-
- /* enum */
- GList *elements;
- };
+{
+ struct _odl_base base;
+ /* class fields - generic data */
+ enum odl_fieldtype fieldtype;
+ enum odl_datatype datatype;
+ char *datatypeclass; /* when datatype == DT_class */
+ unsigned long int properties;
+ /* basic fields */
+ char *format;
+ char *defaultval;
+ char *tmpdefault;
+ /* lookup/reference/list */
+ /* readonly fields */
+ char *sourcefield;
+ char *sourceclass;
+ odl_namelist *this_fields;
+ odl_namelist *source_fields;
+ signed long int bounds;
+ /* method */
+ odl_argumentlist *arguments;
+ /* calculated */
+ char *calculation;
+ /* enum */
+ GList *elements;
+};
struct _odl_argument
- {
- struct _odl_item *method;
- char *name;
- enum odl_datatype datatype;
- char *classdatatype;
- };
+{
+ struct _odl_item *method;
+ char *name;
+ enum odl_datatype datatype;
+ char *classdatatype;
+};
struct _odl_tree
- {
- struct _odl_container *root;
- };
+{
+ struct _odl_container *root;
+};
typedef struct
- {
- gboolean unsignedval;
- char *name;
- unsigned long int bound;
- enum odl_datatype dt;
- }
+{
+ gboolean unsignedval;
+ char *name;
+ unsigned long int bound;
+ enum odl_datatype dt;
+}
_odl_datatype;
typedef struct
- {
- GList *fields;
- char *classname;
- char *field;
- }
+{
+ GList *fields;
+ char *classname;
+ char *field;
+}
_odl_datasource;
typedef struct
{
- gboolean unique;
- gboolean primary;
- GList *fields;
-} _odl_index;
-
-_odl_datatype *alloc_odl_datatype(gboolean unsignedval, char *name,
- unsigned long int bound,
- enum odl_datatype dt);
-void free_odl_datatype(_odl_datatype * _datatype);
-
-_odl_datasource *alloc_odl_datasource();
-void free_odl_datasource(_odl_datasource * ds);
-
-/* memory functions */
-struct _odl_tree *alloc_odl_tree();
-void free_odl_tree(struct _odl_tree *tree);
-struct _odl_container *alloc_odl_container();
-
-void free_odl_container(struct _odl_container *c);
-struct _odl_item *alloc_odl_item();
-void free_odl_item(struct _odl_item *item);
-struct _odl_argument *alloc_odl_argument();
-void free_odl_argument(struct _odl_argument *argument);
-
-void free_odl_unknown_item(struct _odl_base *base);
-
-void init_odl_base(struct _odl_base *base);
-
-void free_odl_base(struct _odl_base *base);
-
-/* functions for creating a class tree */
-
-struct _odl_container *odl_tree_get_root(struct _odl_tree *tree);
-
-void odl_container_insert_container(struct _odl_container *parent,
- struct _odl_container *child);
-
-odl_module *odl_new_module(unsigned long int access, const char *name);
-odl_class *odl_new_class(unsigned long int access, const char *name);
-
-odl_item *odl_new_enum(unsigned long int access, const char *name);
-void odl_enum_add_element(odl_item * e, char *element);
-
-GList *odl_reprocess_fields(_odl_datatype * datatype, GList * fields);
-
-odl_item *set_method_datatype(_odl_datatype * datatype, odl_item * method);
-
-const char *odl_get_base_full_name(odl_base * b);
-
-void odl_standardise_parents(odl_class * classd);
-
-_odl_index *odl_make_index(odl_class *c,gboolean unique,GList *fieldnames);
-
-int odl_sort_string_name( gpointer a , gpointer b );
+ gboolean unique;
+ gboolean primary;
+ GList *fields;
+}
+_odl_index;
+
+_odl_datatype *alloc_odl_datatype (gboolean unsignedval, char *name,
+ unsigned long int bound,
+ enum odl_datatype dt);
+void free_odl_datatype (_odl_datatype * _datatype);
+_odl_datasource *alloc_odl_datasource ();
+void free_odl_datasource (_odl_datasource * ds);
+
+ /* memory functions */
+struct _odl_tree *alloc_odl_tree ();
+void free_odl_tree (struct _odl_tree *tree);
+struct _odl_container *alloc_odl_container ();
+void free_odl_container (struct _odl_container *c);
+struct _odl_item *alloc_odl_item ();
+void free_odl_item (struct _odl_item *item);
+struct _odl_argument *alloc_odl_argument ();
+void free_odl_argument (struct _odl_argument *argument);
+void free_odl_unknown_item (struct _odl_base *base);
+void init_odl_base (struct _odl_base *base);
+void free_odl_base (struct _odl_base *base);
+
+ /* functions for creating a class tree */
+struct _odl_container *odl_tree_get_root (struct _odl_tree *tree);
+void odl_container_insert_container (struct _odl_container
+ *parent,
+ struct _odl_container
+ *child);
+odl_module *odl_new_module (unsigned long int access,
+ const char *name);
+odl_class *odl_new_class (unsigned long int access,
+ const char *name);
+odl_item *odl_new_enum (unsigned long int access,
+ const char *name);
+void odl_enum_add_element (odl_item * e, char *element);
+GList *odl_reprocess_fields (_odl_datatype * datatype,
+ GList * fields);
+odl_item *set_method_datatype (_odl_datatype * datatype,
+ odl_item * method);
+const char *odl_get_base_full_name (odl_base * b);
+void odl_standardise_parents (odl_class * classd);
+_odl_index *odl_make_index (odl_class * c, gboolean unique,
+ GList * fieldnames);
+int odl_sort_string_name (gpointer a, gpointer b);
#endif
Index: gnue/geas/src/header.txt
diff -u gnue/geas/src/header.txt:1.2 gnue/geas/src/header.txt:1.3
--- gnue/geas/src/header.txt:1.2 Thu Jan 4 19:59:44 2001
+++ gnue/geas/src/header.txt Mon May 7 09:34:12 2001
@@ -1,6 +1,10 @@
/*
- geas - GNU Enterprise Application Server
+ $RCSfile: header.txt,v $
+ This file is part of:
+
+ GNU Enterprise Application Server (GEAS)
+
Copyright (C) 2001 Free Software Foundation
This program is free software; you can redistribute it and/or modify
@@ -17,5 +21,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ $Id: header.txt,v 1.3 2001/05/07 16:34:12 ntiffin Exp $
+
*/
Index: gnue/geas/tools/gcdverifier.c
diff -u gnue/geas/tools/gcdverifier.c:1.13 gnue/geas/tools/gcdverifier.c:1.14
--- gnue/geas/tools/gcdverifier.c:1.13 Sat May 5 09:03:53 2001
+++ gnue/geas/tools/gcdverifier.c Mon May 7 09:34:12 2001
@@ -20,7 +20,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: gcdverifier.c,v 1.13 2001/05/05 16:03:53 ntiffin Exp $
+ $Id: gcdverifier.c,v 1.14 2001/05/07 16:34:12 ntiffin Exp $
*/
#include <glib.h>
@@ -118,14 +118,14 @@
{
fullname = TRUE;
}
- if (strcmp (argv[i], "-verbose") == 0)
+ else if (strcmp (argv[i], "--verbose") == 0)
{
verbose = TRUE;
}
- else if (strcmp (argv[i], "-version") == 0)
+ else if (strcmp (argv[i], "--version") == 0)
{
GString *revision;
- revision = g_string_new ("$Revision: 1.13 $");
+ revision = g_string_new ("$Revision: 1.14 $");
if (revision->len > 14)
{
revision = g_string_erase (revision, 0, 11); /* remove the
'$Revsion:' part */
@@ -146,22 +146,28 @@
number_entries++;
fl = odl_filenamelist_add (fl, argv[i]);
}
- else /* must be a directory */
- { /* means directories with .gcd at the end will
not work */
+ else
+ {
+ /* must be a directory */
+ /* means directories with .gcd at the end will not work */
number_entries++;
verify_class_files (argv[i]);
}
}
if (number_entries > 0)
{
- /* load them */
+ /* load the files that have been tagged */
t = odl_load_files (fl, NULL);
- odl_display_tree (stdout, t, fullname);
- /* free memory */
- if (verbose)
+ if (t != NULL)
{
- printf ("Freeing class data.\n");
+ /* diaplay the files that have been loaded */
+ odl_display_tree (stdout, t, fullname);
}
+ }
+ /* free memory */
+ if (verbose)
+ {
+ printf ("Freeing class data.\n");
}
odl_free_tree (t);
odl_filenamelist_free (fl);
- gnue/geas lib/classdefs/classdata.c lib/classde...,
Neil Tiffin <=