From a26c02b7222c99a5ebfa87eed5469c467e484e24 Mon Sep 17 00:00:00 2001 From: snowdrop Date: Wed, 2 Jun 2004 14:57:21 +0000 Subject: integration xsd2c and wsdl2c projects --- xsd2c/Makefile.am | 2 +- xsd2c/formatter.h | 4 +- xsd2c/obj.c | 4 +- xsd2c/obj.h | 4 +- xsd2c/util.h | 4 +- xsd2c/xsd2c.c | 164 +++++++----------------------------------------------- 6 files changed, 29 insertions(+), 153 deletions(-) (limited to 'xsd2c') diff --git a/xsd2c/Makefile.am b/xsd2c/Makefile.am index fbcdec0..1475ad0 100755 --- a/xsd2c/Makefile.am +++ b/xsd2c/Makefile.am @@ -3,6 +3,6 @@ bin_PROGRAMS=xsd2c INCLUDES=$(LIBXML_CFLAGS) LDFLAGS=$(LIBXML_LIBS) -xsd2c_SOURCES=tr.c util.c obj.c formatter.c xsd2c.c +xsd2c_SOURCES=tr.c util.c obj.c formatter.c xsd2c.c main.c xsd2c_LDFLAGS=$(LDFLAGS) diff --git a/xsd2c/formatter.h b/xsd2c/formatter.h index 3833c96..629c061 100644 --- a/xsd2c/formatter.h +++ b/xsd2c/formatter.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: formatter.h,v 1.1 2004/06/02 11:17:03 snowdrop Exp $ + * $Id: formatter.h,v 1.2 2004/06/02 14:57:23 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -19,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Email: ayaz@jprogrammet.net + * Email: ayaz@jprogrammer.net ******************************************************************/ #ifndef XSD2C_FORMATTER_H #define XSD2C_FORMATTER_H diff --git a/xsd2c/obj.c b/xsd2c/obj.c index 58598de..804cf4f 100644 --- a/xsd2c/obj.c +++ b/xsd2c/obj.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: obj.c,v 1.1 2004/06/02 11:17:03 snowdrop Exp $ + * $Id: obj.c,v 1.2 2004/06/02 14:57:23 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -19,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Email: ayaz@jprogrammet.net + * Email: ayaz@jprogrammer.net ******************************************************************/ #include "obj.h" #include "tr.h" diff --git a/xsd2c/obj.h b/xsd2c/obj.h index 6f1b753..a51fb17 100644 --- a/xsd2c/obj.h +++ b/xsd2c/obj.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: obj.h,v 1.1 2004/06/02 11:17:03 snowdrop Exp $ + * $Id: obj.h,v 1.2 2004/06/02 14:57:23 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -19,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Email: ayaz@jprogrammet.net + * Email: ayaz@jprogrammer.net ******************************************************************/ #ifndef XSD2C_OBJ_H #define XSD2C_OBJ_H diff --git a/xsd2c/util.h b/xsd2c/util.h index 7f7ef09..7a1bc24 100644 --- a/xsd2c/util.h +++ b/xsd2c/util.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: util.h,v 1.1 2004/06/02 11:17:03 snowdrop Exp $ + * $Id: util.h,v 1.2 2004/06/02 14:57:23 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -19,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Email: ayaz@jprogrammet.net + * Email: ayaz@jprogrammer.net ******************************************************************/ #ifndef XSD2C_UTIL_H #define XSD2C_UTIL_H diff --git a/xsd2c/xsd2c.c b/xsd2c/xsd2c.c index 973dbfa..37b3497 100644 --- a/xsd2c/xsd2c.c +++ b/xsd2c/xsd2c.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: xsd2c.c,v 1.1 2004/06/02 11:17:03 snowdrop Exp $ + * $Id: xsd2c.c,v 1.2 2004/06/02 14:57:23 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -27,102 +27,17 @@ #include +#include #include "obj.h" #include "tr.h" #include "formatter.h" +#include "xsd2c.h" +#include #define NODE_NAME_EQUALS(xmlnode, text) \ (!xmlStrcmp(xmlnode->name, (const xmlChar *)text)) - -#define XSD_ALL_STR "all" -#define XSD_ANNOTATION_STR "annotation" -#define XSD_ANY_STR "" -#define XSD_ANY_ATTRIBUTE_STR "any" -#define XSD_APPINFO_STR "appInfo" -#define XSD_ATTRIBUTE_STR "attribute" -#define XSD_ATTRIBUTE_GROUP_STR "attributeGroup" -#define XSD_CHOICE_STR "choice" -#define XSD_COMPLEX_TYPE_STR "complexType" -#define XSD_COMPLEX_CONTENT_STR "complexContent" -#define XSD_DOCUMENTATION_STR "documentation" -#define XSD_ELEMENT_STR "element" -#define XSD_EXTENSION_STR "extension" -#define XSD_FIELD_STR "field" -#define XSD_GROUP_STR "group" -#define XSD_IMPORT_STR "import" -#define XSD_INCLUDE_STR "include" -#define XSD_KEY_STR "key" -#define XSD_KEYREF_STR "keyref" -#define XSD_LIST_STR "list" -#define XSD_NOTATION_STR "notation" -#define XSD_REDEFINE_STR "redefine" -#define XSD_RESTRICTION_STR "restriction" -#define XSD_SCHEMA_STR "schema" -#define XSD_SELECTOR_STR "selector" -#define XSD_SEQUENCE_STR "sequence" -#define XSD_SIMPLE_CONTENT_STR "simpleContent" -#define XSD_SIMPLE_TYPE_STR "simpleType" -#define XSD_UNION_STR "union" -#define XSD_UNIQUE_STR "unique" - -#define ATTR_TYPE_STR "type" -#define ATTR_NAME_STR "name" -#define ATTR_BASE_STR "base" -#define ATTR_MIN_OCCURS_STR "minOccurs" -#define ATTR_MAX_OCCURS_STR "maxOccurs" - -#define ATTR_VALUE_UNBOUNDED "unbounded" - -enum _xsdAttr -{ - ATTR_UNKNOWN, - ATTR_TYPE, - ATTR_NAME, - ATTR_BASE, - ATTR_MIN_OCCURS, - ATTR_MAX_OCCURS -}; - -enum _xsdKeyword -{ - XSD_UNKNOWN, - XSD_ALL, - XSD_ANNOTATION, - XSD_ANY, - XSD_ANY_ATTRIBUTE, - XSD_APPINFO, - XSD_ATTRIBUTE, - XSD_ATTRIBUTE_GROUP, - XSD_CHOICE, - XSD_COMPLEX_TYPE, - XSD_COMPLEX_CONTENT, - XSD_DOCUMENTATION, - XSD_ELEMENT, - XSD_EXTENSION, - XSD_FIELD, - XSD_GROUP, - XSD_IMPORT, - XSD_INCLUDE, - XSD_KEY, - XSD_KEYREF, - XSD_LIST, - XSD_NOTATION, - XSD_REDEFINE, - XSD_RESTRICTION, - XSD_SCHEMA, - XSD_SELECTOR, - XSD_SEQUENCE, - XSD_SIMPLE_CONTENT, - XSD_SIMPLE_TYPE, - XSD_UNION, - XSD_UNIQUE -}; - -typedef enum _xsdKeyword xsdKeyword; -typedef enum _xsdAttr xsdAttr; - static xmlNodePtr _xmlGetChild(xmlNodePtr node); static xmlNodePtr _xmlGetNext(xmlNodePtr node); static HCOMPLEXTYPE xsdProcComplexType(xmlNodePtr node, const char* type); @@ -171,9 +86,6 @@ static char outDir[1054]; -static -void usage(); - static xmlNodePtr xmlFindSubElement(xmlNodePtr root, const char* element_name) @@ -198,7 +110,6 @@ xmlNodePtr xmlFindSubElement(xmlNodePtr root, const char* element_name) return NULL; } -static xmlNodePtr xsdLoadFile(const char* filename) { xmlDocPtr doc; @@ -213,7 +124,6 @@ xmlNodePtr xsdLoadFile(const char* filename) } -static xmlNodePtr wsdlLoadFile(const char* filename) { xmlDocPtr doc; @@ -246,6 +156,8 @@ xmlNodePtr wsdlLoadFile(const char* filename) case XSD_SIMPLE_TYPE: case XSD_SCHEMA: return sub; + default: + fprintf(stderr, "Unexpected node: '%s'\n", cur->name); } return NULL; @@ -286,9 +198,9 @@ static void xsdProcAttribute(HCOMPLEXTYPE parent, xmlNodePtr node) { char *name, *type; - xmlNodePtr cur; +/* xmlNodePtr cur; char buffer[1054]; - + */ name = xmlGetProp(node, ATTR_NAME_STR); type = xmlGetProp(node, ATTR_TYPE_STR); @@ -374,6 +286,9 @@ void xsdProcElement(HCOMPLEXTYPE parent, xmlNodePtr node) objAddElement(parent, name, buffer,0, mino, maxo); } break; + + default: + fprintf(stderr, "Unexpected node: '%s'\n", cur->name); } } while ((cur = _xmlGetNext(cur)) != NULL); @@ -557,7 +472,7 @@ HCOMPLEXTYPE xsdProcComplexType(xmlNodePtr node, const char* type) if (!name) { - fprintf(stderr, "\nWARNING: complexType has no typename!\n", name); + fprintf(stderr, "\nWARNING: complexType has no typename!\n"); return NULL; } @@ -767,69 +682,30 @@ int xsdInitObjModule(xmlNodePtr xsdNode) } -int main(int argc, char *argv[]) +int xsdEngineRun(xmlNodePtr xsdNode, const char* destDir) { - int i; - xmlNodePtr xsdNode = NULL; - char fname[255]; - int wsdl = 0; - - if (argc < 2) { - usage(argv[0]); - return 1; - } - - - strcpy(outDir, "."); - - for (i=1;idoc); trFreeModule(); objFreeModule(); - + return 0; } -void usage(const char* execName) -{ - printf("usage: %s [-d -S -D] \n", execName); -} - - - -- cgit v1.1-32-gdbae