From 232ff6e28d1fce08472a2f7a965d83d3e008d84c Mon Sep 17 00:00:00 2001 From: snowdrop Date: Fri, 27 May 2005 19:28:04 +0000 Subject: patch from mailinglist --- xsd2c/formatter.c | 24 ++++++++++++------------ xsd2c/tr.c | 4 +++- xsd2c/util.c | 3 ++- 3 files changed, 17 insertions(+), 14 deletions(-) (limited to 'xsd2c') diff --git a/xsd2c/formatter.c b/xsd2c/formatter.c index 6264fdf..c574b1a 100644 --- a/xsd2c/formatter.c +++ b/xsd2c/formatter.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: formatter.c,v 1.5 2004/10/15 13:35:39 snowdrop Exp $ + * $Id: formatter.c,v 1.6 2005/05/27 19:28:16 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -21,6 +21,8 @@ * * Email: ayaz@jprogrammer.net ******************************************************************/ +#include + #include "formatter.h" #include "tr.h" #include "util.h" @@ -42,8 +44,9 @@ static int genFunctionNameCreate(HCOMPLEXTYPE obj, char *buffer); static int genFunctionNameFree(HCOMPLEXTYPE obj, char *buffer); static int genFunctionNameSaxSerialize(HCOMPLEXTYPE obj, char *buffer); static int genFunctionNameDeserialize(HCOMPLEXTYPE obj, char *buffer); +#if 0 static int genFunctionNameSimpleMinMaxSetter(HCOMPLEXTYPE obj, char *buffer); - +#endif /* ------------------------------------------------------------- */ static void writeFieldDeclare(FILE* f, HFIELD field); @@ -117,7 +120,7 @@ void writeComplexTypeHeaderFile(FILE* f, HCOMPLEXTYPE obj) fprintf(f, "\n#define TO_%s(derived) (derived->__base) \n\n", buffer); /* write extern "C" for __cplusplus linking */ - fprintf(f, "\n#ifdef __cplusplus\nextern \"C\" {\n#endif \n\n", buffer); + fprintf(f, "\n#ifdef __cplusplus\nextern \"C\" {\n#endif \n\n"); /* write primitive type list structs */ enumFields(f, obj, writeFieldPrimitiveList); @@ -170,7 +173,7 @@ void writeComplexTypeHeaderFile(FILE* f, HCOMPLEXTYPE obj) } /* write extern "C" for __cplusplus linking */ - fprintf(f, "\n\n#ifdef __cplusplus\n};\n#endif /*__cplusplus*/\n\n", buffer); + fprintf(f, "\n\n#ifdef __cplusplus\n};\n#endif /*__cplusplus*/\n\n"); fprintf(f, "\n\n#endif\n"); } @@ -504,8 +507,6 @@ static void enumFields(FILE* f, HCOMPLEXTYPE obj, FieldEnumCallBack callb) void writeComplexTypeSourceFile(FILE* f, HCOMPLEXTYPE obj) { - HFIELD field; - char buffer[1054]; if (obj == NULL) { @@ -514,9 +515,9 @@ void writeComplexTypeSourceFile(FILE* f, HCOMPLEXTYPE obj) } fprintf(f, "/** Generated by xsd2c */\n"); - fprintf(f, "#include \n", obj->type); - fprintf(f, "#include \n", obj->type); - fprintf(f, "#include \n", obj->type); + fprintf(f, "#include \n"); + fprintf(f, "#include \n"); + fprintf(f, "#include \n"); fprintf(f, "#include \"%s.h\"\n\n\n", obj->type); /* _xsd*/ @@ -641,7 +642,6 @@ static void writeCodeSetter(FILE* f, HFIELD field) char ns[255]; char type[255]; char ctype[1054]; - char defvalue[255]; if (field->maxOccurs > 1 || field->maxOccurs == -1) return; @@ -659,7 +659,8 @@ static void writeCodeSetter(FILE* f, HFIELD field) { fprintf(f, "\tif (obj->%s != NULL) free(obj->%s);\n", field->name, field->name); - fprintf(f, "\tobj->%s = (char*)malloc(strlen(%s)+1);\n"); + fprintf(f, "\tobj->%s = (char*)malloc(strlen(%s)+1);\n", + field->name, field->name); fprintf(f, "\tstrcpy(obj->%s, %s);\n", field->name, field->name); } @@ -762,7 +763,6 @@ static void writeCodeFieldFree(FILE* f, HFIELD field) { char ns[255]; char type[255]; - char defvalue[255]; parseNS(field->type, ns, type); diff --git a/xsd2c/tr.c b/xsd2c/tr.c index 3e5bd75..56d3fb9 100644 --- a/xsd2c/tr.c +++ b/xsd2c/tr.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: tr.c,v 1.4 2004/10/15 13:35:39 snowdrop Exp $ + * $Id: tr.c,v 1.5 2005/05/27 19:28:16 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -24,6 +24,8 @@ #include "tr.h" #include +#include +#include #define XSD2C_MAP(xsdtype, ctype, builtin) \ trRegisterType(xsdtype, ctype, builtin); diff --git a/xsd2c/util.c b/xsd2c/util.c index 7083c5d..20db840 100644 --- a/xsd2c/util.c +++ b/xsd2c/util.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: util.c,v 1.1 2004/06/02 11:17:03 snowdrop Exp $ + * $Id: util.c,v 1.2 2005/05/27 19:28:16 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -24,6 +24,7 @@ #include #include +#include int parseNS(const char* fullname, char *ns, char *name) { -- cgit v1.1-32-gdbae