From 5dee322ce245ef858b3d0e6591cdc19d76e4cb30 Mon Sep 17 00:00:00 2001 From: snowdrop Date: Thu, 3 Jun 2004 13:13:07 +0000 Subject: initial import --- wsdl2c/CallFunc.c | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ wsdl2c/CallFunc.h | 70 ++++++++++++++++++++++++ wsdl2c/CallList.c | 116 +++++++++++++++++++++++++++++++++++++++ wsdl2c/CallList.h | 63 +++++++++++++++++++++ wsdl2c/CallVar.c | 126 ++++++++++++++++++++++++++++++++++++++++++ wsdl2c/CallVar.h | 64 ++++++++++++++++++++++ wsdl2c/call.xsd | 24 ++++++++ 7 files changed, 623 insertions(+) create mode 100644 wsdl2c/CallFunc.c create mode 100644 wsdl2c/CallFunc.h create mode 100644 wsdl2c/CallList.c create mode 100644 wsdl2c/CallList.h create mode 100644 wsdl2c/CallVar.c create mode 100644 wsdl2c/CallVar.h create mode 100755 wsdl2c/call.xsd (limited to 'wsdl2c') diff --git a/wsdl2c/CallFunc.c b/wsdl2c/CallFunc.c new file mode 100644 index 0000000..db13579 --- /dev/null +++ b/wsdl2c/CallFunc.c @@ -0,0 +1,160 @@ +/** Generated by xsd2c */ +#include +#include +#include +#include "CallFunc.h" + + +struct CallFunc* CallFunc_Create() +{ + struct CallFunc* _res; + _res = (struct CallFunc*)malloc(sizeof(struct CallFunc)); + + _res->name = NULL; + _res->in_head = NULL; + _res->in_tail = NULL; + _res->out = NULL; + + return _res; +} + +void CallFunc_Free(struct CallFunc* obj) +{ + struct CallVar_List* in_cur; + struct CallVar_List* in_tmp; + if (obj == NULL) return; + if (obj->name != NULL) + { + free(obj->name); + obj->name = NULL; + } + + in_cur = obj->in_head; + while (in_cur != NULL) + { + in_tmp = in_cur->next; + free(in_cur); + in_cur = in_tmp; + } + free(obj); +} + +void CallFunc_Sax_Serialize(struct CallFunc* obj, + const char *root_element_name, + void (*OnStartElement)(const char* element_name, int attr_count, char **keys, char **values, void* userData), + void (*OnCharacters)(const char* element_name, const char* chars, void* userData), + void (*OnEndElement)(const char* element_name, void* userData), + void* userData) +{ + int attrCount, curCount; + char **keys; + char **values; + char buffer[255]; + + struct CallVar_List* in_cur; + + attrCount = 0; + + keys = (char**)malloc(sizeof(char*)*attrCount); + values = (char**)malloc(sizeof(char*)*attrCount); + + curCount = 0; + + + OnStartElement(root_element_name, attrCount, keys, values, userData); + + OnStartElement("name", 0, NULL, NULL, userData); + if (obj->name != NULL) + OnCharacters("name", obj->name, userData); + OnEndElement("name", userData); + in_cur = obj->in_head; + while (in_cur != NULL) + { + if (in_cur->value) + CallVar_Sax_Serialize(in_cur->value, "in", OnStartElement, OnCharacters, OnEndElement, userData); + + in_cur = in_cur->next; + } + if (obj->out) + CallVar_Sax_Serialize(obj->out, "out", OnStartElement, OnCharacters, OnEndElement, userData); + + OnEndElement(root_element_name, userData); +} + +#ifndef _DESERIALIZER_DISABLED_ + +struct CallFunc* CallFunc_Deserialize(xmlNodePtr xmlRoot) +{ + xmlNodePtr cur; + xmlChar *key; + struct CallFunc* obj; + obj = CallFunc_Create(); + cur = xmlRoot->xmlChildrenNode; + while (cur != NULL) { + if (cur->type != XML_ELEMENT_NODE) { + cur = cur->next; + continue; + } + printf("CallFunc->%s\n", cur->name); + if ((!xmlStrcmp(cur->name, (const xmlChar *)"name"))){ + key = xmlNodeListGetString(cur->doc, cur->xmlChildrenNode, 1); + CallFunc_Set_name(obj, (const char*)key); + xmlFree(key); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"in"))){ + CallFunc_Add_in( obj, CallVar_Deserialize(cur) ); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"out"))){ + CallFunc_Set_out( obj, CallVar_Deserialize(cur) ); + } + // TODO: + cur = cur->next; + } + return obj; +} + +#endif +char* CallFunc_Get_name(struct CallFunc* obj) +{ + return obj->name; +} + +struct CallVar_List* CallFunc_Get_in(struct CallFunc* obj) +{ + return obj->in_head; +} + +struct CallVar* CallFunc_Get_out(struct CallFunc* obj) +{ + return obj->out; +} + +void CallFunc_Set_name(struct CallFunc* obj, const char* name) +{ + if (obj->name != NULL) free(obj->name); + obj->name = (char*)malloc(strlen(name)+1); + strcpy(obj->name, name); +} + +void CallFunc_Set_out(struct CallFunc* obj, struct CallVar* out) +{ + obj->out = out; +} + +void CallFunc_Add_in(struct CallFunc* obj, struct CallVar* in) +{ + struct CallVar_List* in_node; + in_node = (struct CallVar_List*)malloc(sizeof(struct CallVar_List)); + in_node->value = in; + in_node->next = NULL; + if (obj->in_tail) + { + obj->in_tail->next = in_node; + } + if (obj->in_head == NULL) + { + obj->in_head = in_node; + } + obj->in_tail = in_node; +} + diff --git a/wsdl2c/CallFunc.h b/wsdl2c/CallFunc.h new file mode 100644 index 0000000..8382912 --- /dev/null +++ b/wsdl2c/CallFunc.h @@ -0,0 +1,70 @@ +/** Generated by xsd2c*/ +#ifndef __CallFunc_H__ +#define __CallFunc_H__ + + +#include "CallVar.h" +#include "CallVar.h" + +#ifndef _DESERIALIZER_DISABLE_ + #include +#endif + + +#define TO_CALLFUNC(derived) (derived->__base) + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * OBJECT: CallFunc + */ +struct CallFunc +{ + char* name; + struct CallVar_List* in_head; + struct CallVar_List* in_tail; + struct CallVar* out; +}; + +/** + * LIST: CallFunc_List + */ +struct CallFunc_List +{ + struct CallFunc* value; + struct CallFunc_List* next; +}; + + +struct CallFunc* CallFunc_Create(); +void CallFunc_Free(struct CallFunc* obj); +void CallFunc_Sax_Serialize(struct CallFunc* obj, + const char *root_element_name, + void (*OnStartElement)(const char* element_name, int attr_count, char **keys, char **values, void* userData), + void (*OnCharacters)(const char* element_name, const char* chars, void* userData), + void (*OnEndElement)(const char* element_name, void* userData), + void* userData); + +#ifndef _DESERIALIZER_DISABLE_ +struct CallFunc* CallFunc_Deserialize(xmlNodePtr xmlRoot); +#endif + +void CallFunc_Set_name(struct CallFunc* obj, const char* name); +void CallFunc_Set_out(struct CallFunc* obj, struct CallVar* out); +void CallFunc_Add_in(struct CallFunc* obj, struct CallVar* in); +char* CallFunc_Get_name(struct CallFunc* obj); +struct CallVar_List* CallFunc_Get_in(struct CallFunc* obj); +struct CallVar* CallFunc_Get_out(struct CallFunc* obj); + + +#ifdef __cplusplus +}; +#endif /*__cplusplus*/ + + + +#endif diff --git a/wsdl2c/CallList.c b/wsdl2c/CallList.c new file mode 100644 index 0000000..62eafcb --- /dev/null +++ b/wsdl2c/CallList.c @@ -0,0 +1,116 @@ +/** Generated by xsd2c */ +#include +#include +#include +#include "CallList.h" + + +struct CallList* CallList_Create() +{ + struct CallList* _res; + _res = (struct CallList*)malloc(sizeof(struct CallList)); + + _res->operation_head = NULL; + _res->operation_tail = NULL; + + return _res; +} + +void CallList_Free(struct CallList* obj) +{ + struct CallFunc_List* operation_cur; + struct CallFunc_List* operation_tmp; + if (obj == NULL) return; + + operation_cur = obj->operation_head; + while (operation_cur != NULL) + { + operation_tmp = operation_cur->next; + free(operation_cur); + operation_cur = operation_tmp; + } + free(obj); +} + +void CallList_Sax_Serialize(struct CallList* obj, + const char *root_element_name, + void (*OnStartElement)(const char* element_name, int attr_count, char **keys, char **values, void* userData), + void (*OnCharacters)(const char* element_name, const char* chars, void* userData), + void (*OnEndElement)(const char* element_name, void* userData), + void* userData) +{ + int attrCount, curCount; + char **keys; + char **values; + char buffer[255]; + + struct CallFunc_List* operation_cur; + + attrCount = 0; + + keys = (char**)malloc(sizeof(char*)*attrCount); + values = (char**)malloc(sizeof(char*)*attrCount); + + curCount = 0; + + + OnStartElement(root_element_name, attrCount, keys, values, userData); + operation_cur = obj->operation_head; + while (operation_cur != NULL) + { + if (operation_cur->value) + CallFunc_Sax_Serialize(operation_cur->value, "operation", OnStartElement, OnCharacters, OnEndElement, userData); + + operation_cur = operation_cur->next; + } + + OnEndElement(root_element_name, userData); +} + +#ifndef _DESERIALIZER_DISABLED_ + +struct CallList* CallList_Deserialize(xmlNodePtr xmlRoot) +{ + xmlNodePtr cur; + xmlChar *key; + struct CallList* obj; + obj = CallList_Create(); + cur = xmlRoot->xmlChildrenNode; + while (cur != NULL) { + if (cur->type != XML_ELEMENT_NODE) { + cur = cur->next; + continue; + } + printf("CallList->%s\n", cur->name); + if ((!xmlStrcmp(cur->name, (const xmlChar *)"operation"))){ + CallList_Add_operation( obj, CallFunc_Deserialize(cur) ); + } + // TODO: + cur = cur->next; + } + return obj; +} + +#endif +struct CallFunc_List* CallList_Get_operation(struct CallList* obj) +{ + return obj->operation_head; +} + +void CallList_Add_operation(struct CallList* obj, struct CallFunc* operation) +{ + struct CallFunc_List* operation_node; + operation_node = (struct CallFunc_List*)malloc(sizeof(struct CallFunc_List)); + operation_node->value = operation; + operation_node->next = NULL; + if (obj->operation_tail) + { + obj->operation_tail->next = operation_node; + } + if (obj->operation_head == NULL) + { + obj->operation_head = operation_node; + } + obj->operation_tail = operation_node; +} + diff --git a/wsdl2c/CallList.h b/wsdl2c/CallList.h new file mode 100644 index 0000000..6db6b88 --- /dev/null +++ b/wsdl2c/CallList.h @@ -0,0 +1,63 @@ +/** Generated by xsd2c*/ +#ifndef __CallList_H__ +#define __CallList_H__ + + +#include "CallFunc.h" + +#ifndef _DESERIALIZER_DISABLE_ + #include +#endif + + +#define TO_CALLLIST(derived) (derived->__base) + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * OBJECT: CallList + */ +struct CallList +{ + struct CallFunc_List* operation_head; + struct CallFunc_List* operation_tail; +}; + +/** + * LIST: CallList_List + */ +struct CallList_List +{ + struct CallList* value; + struct CallList_List* next; +}; + + +struct CallList* CallList_Create(); +void CallList_Free(struct CallList* obj); +void CallList_Sax_Serialize(struct CallList* obj, + const char *root_element_name, + void (*OnStartElement)(const char* element_name, int attr_count, char **keys, char **values, void* userData), + void (*OnCharacters)(const char* element_name, const char* chars, void* userData), + void (*OnEndElement)(const char* element_name, void* userData), + void* userData); + +#ifndef _DESERIALIZER_DISABLE_ +struct CallList* CallList_Deserialize(xmlNodePtr xmlRoot); +#endif + +void CallList_Add_operation(struct CallList* obj, struct CallFunc* operation); +struct CallFunc_List* CallList_Get_operation(struct CallList* obj); + + +#ifdef __cplusplus +}; +#endif /*__cplusplus*/ + + + +#endif diff --git a/wsdl2c/CallVar.c b/wsdl2c/CallVar.c new file mode 100644 index 0000000..035f56c --- /dev/null +++ b/wsdl2c/CallVar.c @@ -0,0 +1,126 @@ +/** Generated by xsd2c */ +#include +#include +#include +#include "CallVar.h" + + +struct CallVar* CallVar_Create() +{ + struct CallVar* _res; + _res = (struct CallVar*)malloc(sizeof(struct CallVar)); + + _res->name = NULL; + _res->type = NULL; + + return _res; +} + +void CallVar_Free(struct CallVar* obj) +{ + if (obj == NULL) return; + if (obj->name != NULL) + { + free(obj->name); + obj->name = NULL; + } + if (obj->type != NULL) + { + free(obj->type); + obj->type = NULL; + } + free(obj); +} + +void CallVar_Sax_Serialize(struct CallVar* obj, + const char *root_element_name, + void (*OnStartElement)(const char* element_name, int attr_count, char **keys, char **values, void* userData), + void (*OnCharacters)(const char* element_name, const char* chars, void* userData), + void (*OnEndElement)(const char* element_name, void* userData), + void* userData) +{ + int attrCount, curCount; + char **keys; + char **values; + char buffer[255]; + + + attrCount = 0; + + keys = (char**)malloc(sizeof(char*)*attrCount); + values = (char**)malloc(sizeof(char*)*attrCount); + + curCount = 0; + + + OnStartElement(root_element_name, attrCount, keys, values, userData); + + OnStartElement("name", 0, NULL, NULL, userData); + if (obj->name != NULL) + OnCharacters("name", obj->name, userData); + OnEndElement("name", userData); + + OnStartElement("type", 0, NULL, NULL, userData); + if (obj->type != NULL) + OnCharacters("type", obj->type, userData); + OnEndElement("type", userData); + + OnEndElement(root_element_name, userData); +} + +#ifndef _DESERIALIZER_DISABLED_ + +struct CallVar* CallVar_Deserialize(xmlNodePtr xmlRoot) +{ + xmlNodePtr cur; + xmlChar *key; + struct CallVar* obj; + obj = CallVar_Create(); + cur = xmlRoot->xmlChildrenNode; + while (cur != NULL) { + if (cur->type != XML_ELEMENT_NODE) { + cur = cur->next; + continue; + } + printf("CallVar->%s\n", cur->name); + if ((!xmlStrcmp(cur->name, (const xmlChar *)"name"))){ + key = xmlNodeListGetString(cur->doc, cur->xmlChildrenNode, 1); + CallVar_Set_name(obj, (const char*)key); + xmlFree(key); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"type"))){ + key = xmlNodeListGetString(cur->doc, cur->xmlChildrenNode, 1); + CallVar_Set_type(obj, (const char*)key); + xmlFree(key); + } + // TODO: + cur = cur->next; + } + return obj; +} + +#endif +char* CallVar_Get_name(struct CallVar* obj) +{ + return obj->name; +} + +char* CallVar_Get_type(struct CallVar* obj) +{ + return obj->type; +} + +void CallVar_Set_name(struct CallVar* obj, const char* name) +{ + if (obj->name != NULL) free(obj->name); + obj->name = (char*)malloc(strlen(name)+1); + strcpy(obj->name, name); +} + +void CallVar_Set_type(struct CallVar* obj, const char* type) +{ + if (obj->type != NULL) free(obj->type); + obj->type = (char*)malloc(strlen(type)+1); + strcpy(obj->type, type); +} + diff --git a/wsdl2c/CallVar.h b/wsdl2c/CallVar.h new file mode 100644 index 0000000..d3484fc --- /dev/null +++ b/wsdl2c/CallVar.h @@ -0,0 +1,64 @@ +/** Generated by xsd2c*/ +#ifndef __CallVar_H__ +#define __CallVar_H__ + + + +#ifndef _DESERIALIZER_DISABLE_ + #include +#endif + + +#define TO_CALLVAR(derived) (derived->__base) + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * OBJECT: CallVar + */ +struct CallVar +{ + char* name; + char* type; +}; + +/** + * LIST: CallVar_List + */ +struct CallVar_List +{ + struct CallVar* value; + struct CallVar_List* next; +}; + + +struct CallVar* CallVar_Create(); +void CallVar_Free(struct CallVar* obj); +void CallVar_Sax_Serialize(struct CallVar* obj, + const char *root_element_name, + void (*OnStartElement)(const char* element_name, int attr_count, char **keys, char **values, void* userData), + void (*OnCharacters)(const char* element_name, const char* chars, void* userData), + void (*OnEndElement)(const char* element_name, void* userData), + void* userData); + +#ifndef _DESERIALIZER_DISABLE_ +struct CallVar* CallVar_Deserialize(xmlNodePtr xmlRoot); +#endif + +void CallVar_Set_name(struct CallVar* obj, const char* name); +void CallVar_Set_type(struct CallVar* obj, const char* type); +char* CallVar_Get_name(struct CallVar* obj); +char* CallVar_Get_type(struct CallVar* obj); + + +#ifdef __cplusplus +}; +#endif /*__cplusplus*/ + + + +#endif diff --git a/wsdl2c/call.xsd b/wsdl2c/call.xsd new file mode 100755 index 0000000..5e5a832 --- /dev/null +++ b/wsdl2c/call.xsd @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.1-32-gdbae