You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/10/27 08:08:48 UTC
svn commit: r328799 [2/5] -
/webservices/axis2/trunk/c/modules/xml/guththila/src/
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_main.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_main.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_main.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_main.c Wed Oct 26 23:05:49 2005
@@ -21,143 +21,153 @@
#include "guththila_defines.h"
#include "guththila_environment.h"
-int main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
- int c;
- FILE *fp ;
- guththila_allocator_t *allocator;
- guththila_reader_t *red;
- guththila_environment_t *environment;
- guththila_xml_pull_parser_t *parser;
-
-
- fp = fopen ("response.xml", "r");
- allocator = guththila_allocator_init(NULL);
- environment = guththila_environment_create(allocator,NULL,NULL,NULL,NULL);
- red = guththila_reader_create (environment,fp);
- parser = guththila_xml_pull_parser_create (environment,red);
- guththila_xml_pull_parser_read (environment,parser);
-
- while ((c = guththila_xml_pull_parser_next (environment,parser)) != -1)
+ int c;
+ FILE *fp;
+ guththila_allocator_t *allocator;
+ guththila_reader_t *red;
+ guththila_environment_t *environment;
+ guththila_xml_pull_parser_t *parser;
+
+
+ fp = fopen ("response.xml", "r");
+ allocator = guththila_allocator_init (NULL);
+ environment =
+ guththila_environment_create (allocator, NULL, NULL, NULL, NULL);
+ red = guththila_reader_create (environment, fp);
+ parser = guththila_xml_pull_parser_create (environment, red);
+ guththila_xml_pull_parser_read (environment, parser);
+
+ while ((c = guththila_xml_pull_parser_next (environment, parser)) != -1)
{
- switch (c)
- {
- case GUTHTHILA_START_DOCUMENT :
- {
- int ix;
- printf ("<?xml ");
-
- ix = guththila_xml_pull_parser_get_attribute_count (environment,parser);
- for (; ix > 0; ix--)
- {
- guththila_attribute_t *a;
- char *p;
- a = guththila_xml_pull_parser_get_attribute (environment,parser);
- p = guththila_xml_pull_parser_get_attribute_name (environment,parser, a);
- printf ("%s=\"", p);
- free (p);
- p = guththila_xml_pull_parser_get_attribute_value (environment,parser, a);
- printf ("%s\" ", p);
- free (p);
- }
- printf ("?>");
- }
- break;
- case GUTHTHILA_START_ELEMENT:
- case GUTHTHILA_EMPTY_ELEMENT:
- {
- int ia;
- int d;
- char *p;
- guththila_element_t *e;
- printf ("<");
-
- p = guththila_xml_pull_parser_get_prefix (environment,parser);
- if (p)
- {
- printf ("%s:", p);
- free (p);
- }
- p = guththila_xml_pull_parser_get_name (environment,parser);
- printf ("%s", p);
- free (p);
-
- ia = guththila_xml_pull_parser_get_attribute_count (environment,parser);
- for ( ; ia > 0; ia--)
- {
- /* p = guththila_xml_pull_parser_get_attribute_prefix_by_number
- (parser, ia); */
- p = guththila_xml_pull_parser_get_attribute_namespace_by_number (environment,parser, ia);
- if (p)
- {
- printf (" %s:", p);
- free (p);
- p = guththila_xml_pull_parser_get_attribute_name_by_number (environment,parser, ia);
- printf ("%s=\"", p);
- free (p);
- p = guththila_xml_pull_parser_get_attribute_value_by_number (environment,parser, ia);
- printf ("%s\"", p);
- free (p);
- }
- else
- {
- p = guththila_xml_pull_parser_get_attribute_name_by_number (environment,parser, ia);
- printf (" %s=\"", p);
- free (p);
- p = guththila_xml_pull_parser_get_attribute_value_by_number (environment,parser, ia);
- printf ("%s\"", p);
- free (p);
- }
- }
- e = guththila_stack_last (environment,parser->dep);
- d = e->depth->count;
-
- for (; d > 0; d--)
- {
- p = guththila_xml_pull_parser_get_namespace_prefix_by_number (environment,parser, d);
- if (strncmp (p, "xmlns", 5))
- printf (" xmlns:");
- printf ("%s=\"", p);
- free (p);
- p = guththila_xml_pull_parser_get_namespace_uri_by_number (environment,parser, d);
- printf ("%s\" ", p);
- free (p);
- }
- if (guththila_event == GUTHTHILA_START_ELEMENT)
- printf (">");
- else
- printf ("/>");
- }
- break;
- case GUTHTHILA_END_ELEMENT:
- {
- char *p;
- printf ("</");
-
- p = guththila_xml_pull_parser_get_prefix (environment,parser);
- if (p)
- {
- printf ("%s:", p);
- free (p);
- }
- p = guththila_xml_pull_parser_get_name (environment,parser);
- printf ("%s", p);
- free (p);
- printf (">");
- }
- break;
- case GUTHTHILA_CHARACTER:
- {
- char *p;
- p = guththila_xml_pull_parser_get_value (environment,parser);
- printf (p);
- free (p);
- }
- break;
- case GUTHTHILA_COMMENT:
- break;
- };
+ switch (c)
+ {
+ case GUTHTHILA_START_DOCUMENT:
+ {
+ int ix;
+ printf ("<?xml ");
+
+ ix = guththila_xml_pull_parser_get_attribute_count
+ (environment, parser);
+ for (; ix > 0; ix--)
+ {
+ guththila_attribute_t *a;
+ char *p;
+ a = guththila_xml_pull_parser_get_attribute (environment,
+ parser);
+ p = guththila_xml_pull_parser_get_attribute_name
+ (environment, parser, a);
+ printf ("%s=\"", p);
+ free (p);
+ p = guththila_xml_pull_parser_get_attribute_value
+ (environment, parser, a);
+ printf ("%s\" ", p);
+ free (p);
+ }
+ printf ("?>");
+ }
+ break;
+ case GUTHTHILA_START_ELEMENT:
+ case GUTHTHILA_EMPTY_ELEMENT:
+ {
+ int ia;
+ int d;
+ char *p;
+ guththila_element_t *e;
+ printf ("<");
+
+ p = guththila_xml_pull_parser_get_prefix (environment,
+ parser);
+ if (p)
+ {
+ printf ("%s:", p);
+ free (p);
+ }
+ p = guththila_xml_pull_parser_get_name (environment, parser);
+ printf ("%s", p);
+ free (p);
+
+ ia = guththila_xml_pull_parser_get_attribute_count
+ (environment, parser);
+ for (; ia > 0; ia--)
+ {
+ /* p = guththila_xml_pull_parser_get_attribute_prefix_by_number
+ (parser, ia); */
+ p = guththila_xml_pull_parser_get_attribute_namespace_by_number (environment, parser, ia);
+ if (p)
+ {
+ printf (" %s:", p);
+ free (p);
+ p = guththila_xml_pull_parser_get_attribute_name_by_number (environment, parser, ia);
+ printf ("%s=\"", p);
+ free (p);
+ p = guththila_xml_pull_parser_get_attribute_value_by_number (environment, parser, ia);
+ printf ("%s\"", p);
+ free (p);
+ }
+ else
+ {
+ p = guththila_xml_pull_parser_get_attribute_name_by_number (environment, parser, ia);
+ printf (" %s=\"", p);
+ free (p);
+ p = guththila_xml_pull_parser_get_attribute_value_by_number (environment, parser, ia);
+ printf ("%s\"", p);
+ free (p);
+ }
+ }
+ e = guththila_stack_last (environment, parser->dep);
+ d = e->depth->count;
+
+ for (; d > 0; d--)
+ {
+ p = guththila_xml_pull_parser_get_namespace_prefix_by_number (environment, parser, d);
+ if (strncmp (p, "xmlns", 5))
+ printf (" xmlns:");
+ printf ("%s=\"", p);
+ free (p);
+ p = guththila_xml_pull_parser_get_namespace_uri_by_number
+ (environment, parser, d);
+ printf ("%s\" ", p);
+ free (p);
+ }
+ if (guththila_event == GUTHTHILA_START_ELEMENT)
+ printf (">");
+ else
+ printf ("/>");
+ }
+ break;
+ case GUTHTHILA_END_ELEMENT:
+ {
+ char *p;
+ printf ("</");
+
+ p = guththila_xml_pull_parser_get_prefix (environment,
+ parser);
+ if (p)
+ {
+ printf ("%s:", p);
+ free (p);
+ }
+ p = guththila_xml_pull_parser_get_name (environment, parser);
+ printf ("%s", p);
+ free (p);
+ printf (">");
+ }
+ break;
+ case GUTHTHILA_CHARACTER:
+ {
+ char *p;
+ p = guththila_xml_pull_parser_get_value (environment, parser);
+ printf (p);
+ free (p);
+ }
+ break;
+ case GUTHTHILA_COMMENT:
+ break;
+ };
}
- guththila_xml_pull_parser_free (environment,parser);
- return 0;
+ guththila_xml_pull_parser_free (environment, parser);
+ return 0;
}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_namespace.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_namespace.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_namespace.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_namespace.h Wed Oct 26 23:05:49 2005
@@ -24,10 +24,10 @@
typedef struct guththila_namespace_s
{
- guththila_char_t *name;
- int length;
- guththila_char_t *uri;
- int lengthuri;
+ guththila_char_t *name;
+ int length;
+ guththila_char_t *uri;
+ int lengthuri;
} guththila_namespace_t;
#endif /* GUTHTHILA_NAMESPACE_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.c Wed Oct 26 23:05:49 2005
@@ -21,39 +21,45 @@
#include "guththila_reader.h"
#include "guththila_defines.h"
-GUTHTHILA_DECLARE(guththila_reader_t *)
-guththila_reader_create (guththila_environment_t *environment,FILE *fp)
+GUTHTHILA_DECLARE (guththila_reader_t *)
+guththila_reader_create (guththila_environment_t * environment, FILE * fp)
{
- guththila_reader_t *reader = (guththila_reader_t *)guththila_malloc (environment->allocator,sizeof(guththila_reader_t));
- if (fp)
- reader->fp = fp;
- return reader;
+ guththila_reader_t *reader =
+ (guththila_reader_t *) guththila_malloc (environment->allocator,
+ sizeof (guththila_reader_t));
+ if (fp)
+ reader->fp = fp;
+ return reader;
}
-GUTHTHILA_DECLARE(void)
-guththila_reader_free (guththila_environment_t *environment,guththila_reader_t *r)
+GUTHTHILA_DECLARE (void)
+guththila_reader_free (guththila_environment_t * environment,
+ guththila_reader_t * r)
{
-
- if (r)
- guththila_free (environment->allocator,r);
+
+ if (r)
+ guththila_free (environment->allocator, r);
}
-GUTHTHILA_DECLARE(int)
-guththila_reader_read (guththila_environment_t *environment,guththila_char_t *buffer, int offset, int length, guththila_reader_t *r)
+GUTHTHILA_DECLARE (int)
+guththila_reader_read (guththila_environment_t * environment,
+ guththila_char_t * buffer, int offset, int length,
+ guththila_reader_t * r)
{
- return (int)fread (buffer+offset, 1, length, r->fp);
+ return (int) fread (buffer + offset, 1, length, r->fp);
}
-GUTHTHILA_DECLARE(int)
-guththila_reader_set_input_stream (guththila_environment_t *environment,guththila_reader_t *r, FILE *fp)
+GUTHTHILA_DECLARE (int)
+guththila_reader_set_input_stream (guththila_environment_t * environment,
+ guththila_reader_t * r, FILE * fp)
{
- if (fp)
+ if (fp)
{
- r->fp = fp;
- return 1;
+ r->fp = fp;
+ return 1;
}
- else
- return 0;
-}
\ No newline at end of file
+ else
+ return 0;
+}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.h Wed Oct 26 23:05:49 2005
@@ -29,12 +29,20 @@
typedef struct guththila_reader_s
{
- FILE *fp;
+ FILE *fp;
} guththila_reader_t;
-GUTHTHILA_DECLARE(guththila_reader_t*) guththila_reader_create (guththila_environment_t *environment,FILE *fp);
-GUTHTHILA_DECLARE(int) guththila_reader_read (guththila_environment_t *environment,guththila_char_t *buffer, int offset, int length, guththila_reader_t *r);
-GUTHTHILA_DECLARE(int) guththila_reader_set_input_stream (guththila_environment_t *environment,guththila_reader_t *r, FILE *fp);
-GUTHTHILA_DECLARE(void) guththila_reader_free (guththila_environment_t *environment,guththila_reader_t *r);
+GUTHTHILA_DECLARE (guththila_reader_t *)
+guththila_reader_create (guththila_environment_t * environment, FILE * fp);
+GUTHTHILA_DECLARE (int)
+guththila_reader_read (guththila_environment_t * environment,
+ guththila_char_t * buffer, int offset, int length,
+ guththila_reader_t * r);
+GUTHTHILA_DECLARE (int)
+guththila_reader_set_input_stream (guththila_environment_t * environment,
+ guththila_reader_t * r, FILE * fp);
+GUTHTHILA_DECLARE (void)
+guththila_reader_free (guththila_environment_t * environment,
+ guththila_reader_t * r);
#endif /* GUTHTHILA_READER_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.c Wed Oct 26 23:05:49 2005
@@ -20,253 +20,278 @@
#include "guththila_environment.h"
#include "guththila_stack.h"
-GUTHTHILA_DECLARE(guththila_stack_t *)
-guththila_stack_create (guththila_environment_t *environment)
+GUTHTHILA_DECLARE (guththila_stack_t *)
+guththila_stack_create (guththila_environment_t * environment)
{
- guththila_stack_t *st = (guththila_stack_t *) guththila_malloc (environment->allocator,sizeof (guththila_stack_t));
- if (st)
- {
- st->pointer = 0;
- st->current_pos = 0;
- st->tail = NULL;
- st->current = NULL;
- return st;
- }
- else
- return NULL;
+ guththila_stack_t *st =
+ (guththila_stack_t *) guththila_malloc (environment->allocator,
+ sizeof (guththila_stack_t));
+ if (st)
+ {
+ st->pointer = 0;
+ st->current_pos = 0;
+ st->tail = NULL;
+ st->current = NULL;
+ return st;
+ }
+ else
+ return NULL;
}
-GUTHTHILA_DECLARE(int)
-guththila_stack_push (guththila_environment_t *environment,guththila_stack_t *stack, guththila_token_t *tok, guththila_attribute_t *attr)
-{
- if (stack)
- {
- guththila_element_t *e = (guththila_element_t *) guththila_malloc (environment->allocator,sizeof (guththila_element_t));
- e->token = tok;
- e->attribute = attr;
- if (stack->pointer == 0)
- {
- e->prev = NULL;
- stack->tail = e;
- stack->current = stack->tail;
- stack->pointer ++;
- stack->current_pos = stack->pointer;
- }
- else
- {
- e->prev = stack->tail;
- stack->tail = e;
- stack->current = stack->tail;
- stack->pointer ++;
- stack->current_pos = stack->pointer;
- }
- }
- else
- guththila_token_exception ();
- return 0;
+GUTHTHILA_DECLARE (int)
+guththila_stack_push (guththila_environment_t * environment,
+ guththila_stack_t * stack, guththila_token_t * tok,
+ guththila_attribute_t * attr)
+{
+ if (stack)
+ {
+ guththila_element_t *e =
+ (guththila_element_t *) guththila_malloc (environment->allocator,
+ sizeof
+ (guththila_element_t));
+ e->token = tok;
+ e->attribute = attr;
+ if (stack->pointer == 0)
+ {
+ e->prev = NULL;
+ stack->tail = e;
+ stack->current = stack->tail;
+ stack->pointer++;
+ stack->current_pos = stack->pointer;
+ }
+ else
+ {
+ e->prev = stack->tail;
+ stack->tail = e;
+ stack->current = stack->tail;
+ stack->pointer++;
+ stack->current_pos = stack->pointer;
+ }
+ }
+ else
+ guththila_token_exception ();
+ return 0;
}
-GUTHTHILA_DECLARE(int)
-guththila_stack_size (guththila_environment_t *environment,guththila_stack_t *stack)
-{
- if (stack->pointer)
- return stack->pointer;
- else
- return 0;
+GUTHTHILA_DECLARE (int)
+guththila_stack_size (guththila_environment_t * environment,
+ guththila_stack_t * stack)
+{
+ if (stack->pointer)
+ return stack->pointer;
+ else
+ return 0;
}
-GUTHTHILA_DECLARE(void)
-guththila_stack_free (guththila_environment_t *environment,guththila_stack_t *stack)
+GUTHTHILA_DECLARE (void)
+guththila_stack_free (guththila_environment_t * environment,
+ guththila_stack_t * stack)
{
- if (stack && (stack->pointer > 0))
+ if (stack && (stack->pointer > 0))
{
- guththila_element_t *ele = stack->tail;
- guththila_stack_free_rec (environment,stack, ele);
- guththila_free (environment->allocator,ele);
- guththila_free (environment->allocator,stack);
+ guththila_element_t *ele = stack->tail;
+ guththila_stack_free_rec (environment, stack, ele);
+ guththila_free (environment->allocator, ele);
+ guththila_free (environment->allocator, stack);
}
}
-GUTHTHILA_DECLARE(void)
-guththila_stack_free_rec (guththila_environment_t *environment,guththila_stack_t *stack, guththila_element_t *elem)
+GUTHTHILA_DECLARE (void)
+guththila_stack_free_rec (guththila_environment_t * environment,
+ guththila_stack_t * stack,
+ guththila_element_t * elem)
{
- if (elem->prev == NULL)
+ if (elem->prev == NULL)
{
- guththila_free (environment->allocator,elem);
+ guththila_free (environment->allocator, elem);
}
- else
+ else
{
- elem = elem->prev;
- guththila_stack_free_rec (environment,stack, elem);
- guththila_free (environment->allocator,elem);
+ elem = elem->prev;
+ guththila_stack_free_rec (environment, stack, elem);
+ guththila_free (environment->allocator, elem);
}
}
-GUTHTHILA_DECLARE(guththila_element_t *)
-guththila_stack_last (guththila_environment_t *environment,guththila_stack_t *stack)
+GUTHTHILA_DECLARE (guththila_element_t *)
+guththila_stack_last (guththila_environment_t * environment,
+ guththila_stack_t * stack)
{
- if (stack)
- return stack->tail;
- else
- return NULL;
+ if (stack)
+ return stack->tail;
+ else
+ return NULL;
}
-GUTHTHILA_DECLARE(guththila_element_t *)
-guththila_stack_pull (guththila_environment_t *environment,guththila_stack_t *stack)
+GUTHTHILA_DECLARE (guththila_element_t *)
+guththila_stack_pull (guththila_environment_t * environment,
+ guththila_stack_t * stack)
{
- guththila_element_t *e;
- if (stack)
+ guththila_element_t *e;
+ if (stack)
{
- e = stack->tail;
- if (stack->pointer != 0)
- {
- if (e->prev)
- {
- stack->tail = e->prev;
- stack->current = stack->tail;
- e->prev = NULL;
- stack->pointer --;
- stack->current_pos = stack->pointer;
- }
- else
- {
- stack->tail = e;
- stack->current = stack->tail;
- stack->pointer = 0;
- stack->current_pos = stack->pointer;
- }
- }
- return e;
+ e = stack->tail;
+ if (stack->pointer != 0)
+ {
+ if (e->prev)
+ {
+ stack->tail = e->prev;
+ stack->current = stack->tail;
+ e->prev = NULL;
+ stack->pointer--;
+ stack->current_pos = stack->pointer;
+ }
+ else
+ {
+ stack->tail = e;
+ stack->current = stack->tail;
+ stack->pointer = 0;
+ stack->current_pos = stack->pointer;
+ }
+ }
+ return e;
}
- else
- return NULL;
+ else
+ return NULL;
}
-GUTHTHILA_DECLARE(int)
-guththila_stack_push_namespace (guththila_environment_t *environment,guththila_stack_t *stack, guththila_namespace_t *ns)
+GUTHTHILA_DECLARE (int)
+guththila_stack_push_namespace (guththila_environment_t * environment,
+ guththila_stack_t * stack,
+ guththila_namespace_t * ns)
{
- if (stack)
+ if (stack)
{
- guththila_element_t *e = (guththila_element_t *) guththila_malloc (environment->allocator,sizeof (guththila_element_t));
- e->namespace = ns;
- e->attribute = NULL;
- e->token = NULL;
- if (stack->pointer == 0)
- {
- e->prev = NULL;
- stack->tail = e;
- stack->current = stack->tail;
- stack->pointer ++;
- stack->current_pos = stack->pointer;
- }
- else
- {
- e->prev = stack->tail;
- stack->tail = e;
- stack->current = stack->tail;
- stack->pointer ++;
- stack->current_pos = stack->pointer;
- }
+ guththila_element_t *e =
+ (guththila_element_t *) guththila_malloc (environment->allocator,
+ sizeof
+ (guththila_element_t));
+ e->namespace = ns;
+ e->attribute = NULL;
+ e->token = NULL;
+ if (stack->pointer == 0)
+ {
+ e->prev = NULL;
+ stack->tail = e;
+ stack->current = stack->tail;
+ stack->pointer++;
+ stack->current_pos = stack->pointer;
+ }
+ else
+ {
+ e->prev = stack->tail;
+ stack->tail = e;
+ stack->current = stack->tail;
+ stack->pointer++;
+ stack->current_pos = stack->pointer;
+ }
}
- else
- guththila_token_exception ();
- return 0;
+ else
+ guththila_token_exception ();
+ return 0;
}
-GUTHTHILA_DECLARE(guththila_element_t *)
-guththila_stack_pull_current (guththila_environment_t *environment,guththila_stack_t *stack)
-{
- guththila_element_t *e;
- e = stack->current;
- if (stack->current_pos != 0)
+GUTHTHILA_DECLARE (guththila_element_t *)
+guththila_stack_pull_current (guththila_environment_t * environment,
+ guththila_stack_t * stack)
+{
+ guththila_element_t *e;
+ e = stack->current;
+ if (stack->current_pos != 0)
{
- if (e->prev)
- {
- stack->current = e->prev;
- stack->current_pos --;
- }
- else
- {
- stack->current = e;
- stack->current_pos = 0;
- }
+ if (e->prev)
+ {
+ stack->current = e->prev;
+ stack->current_pos--;
+ }
+ else
+ {
+ stack->current = e;
+ stack->current_pos = 0;
+ }
}
- return e;
+ return e;
}
-GUTHTHILA_DECLARE(int)
-guththila_stack_push_depth (guththila_environment_t *environment,guththila_stack_t *stack, guththila_depth_t *d)
+GUTHTHILA_DECLARE (int)
+guththila_stack_push_depth (guththila_environment_t * environment,
+ guththila_stack_t * stack, guththila_depth_t * d)
{
- if (stack)
+ if (stack)
{
- guththila_element_t *e = (guththila_element_t *) guththila_malloc (environment->allocator,sizeof (guththila_element_t));
- e->namespace = NULL;
- e->attribute = NULL;
- e->token = NULL;
- e->depth = d;
- if (stack->pointer == 0)
- {
- e->prev = NULL;
- stack->tail = e;
- stack->current = stack->tail;
- stack->pointer ++;
- stack->current_pos = stack->pointer;
- }
- else
- {
- e->prev = stack->tail;
- stack->tail = e;
- stack->current = stack->tail;
- stack->pointer ++;
- stack->current_pos = stack->pointer;
- }
+ guththila_element_t *e =
+ (guththila_element_t *) guththila_malloc (environment->allocator,
+ sizeof
+ (guththila_element_t));
+ e->namespace = NULL;
+ e->attribute = NULL;
+ e->token = NULL;
+ e->depth = d;
+ if (stack->pointer == 0)
+ {
+ e->prev = NULL;
+ stack->tail = e;
+ stack->current = stack->tail;
+ stack->pointer++;
+ stack->current_pos = stack->pointer;
+ }
+ else
+ {
+ e->prev = stack->tail;
+ stack->tail = e;
+ stack->current = stack->tail;
+ stack->pointer++;
+ stack->current_pos = stack->pointer;
+ }
}
- else
- guththila_token_exception ();
- return 0;
+ else
+ guththila_token_exception ();
+ return 0;
}
-GUTHTHILA_DECLARE(void)
-guththila_stack_clear (guththila_environment_t *environment,guththila_stack_t *stack)
+GUTHTHILA_DECLARE (void)
+guththila_stack_clear (guththila_environment_t * environment,
+ guththila_stack_t * stack)
{
- guththila_element_t *e;
- e = stack->tail;
- if (e)
+ guththila_element_t *e;
+ e = stack->tail;
+ if (e)
{
- guththila_stack_pull (environment,stack);
- e = stack->tail;
+ guththila_stack_pull (environment, stack);
+ e = stack->tail;
}
- stack->pointer = 0 ;
+ stack->pointer = 0;
}
-GUTHTHILA_DECLARE(guththila_element_t *)
-guththila_stack_get (guththila_environment_t *environment,guththila_stack_t *stack , int i)
+GUTHTHILA_DECLARE (guththila_element_t *)
+guththila_stack_get (guththila_environment_t * environment,
+ guththila_stack_t * stack, int i)
{
- if (i)
+ if (i)
{
- if ( i == 1)
- return stack->tail;
- else
+ if (i == 1)
+ return stack->tail;
+ else
{
- guththila_element_t *e;
- int ix = stack->pointer;
- e = stack->tail;
- for ( ; ix > ((stack->pointer+1) - i); ix--)
- e = e->prev;
- return e;
+ guththila_element_t *e;
+ int ix = stack->pointer;
+ e = stack->tail;
+ for (; ix > ((stack->pointer + 1) - i); ix--)
+ e = e->prev;
+ return e;
}
}
- else
- return NULL;
+ else
+ return NULL;
}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.h Wed Oct 26 23:05:49 2005
@@ -27,44 +27,69 @@
#include "guththila_depth.h"
enum guththila_element_types
- {
+{
token_element,
attribute_element,
namespace_element
- };
+};
typedef struct guththila_element_s guththila_element_t;
struct guththila_element_s
{
- guththila_token_t *token;
- guththila_attribute_t *attribute;
- guththila_namespace_t *namespace;
- guththila_depth_t *depth;
- guththila_element_t *prev;
+ guththila_token_t *token;
+ guththila_attribute_t *attribute;
+ guththila_namespace_t *namespace;
+ guththila_depth_t *depth;
+ guththila_element_t *prev;
};
typedef struct guththila_stack_s
{
- enum guththila_element_types element_type;
- int pointer;
- int current_pos;
- guththila_element_t *tail;
- guththila_element_t *current;
+ enum guththila_element_types element_type;
+ int pointer;
+ int current_pos;
+ guththila_element_t *tail;
+ guththila_element_t *current;
} guththila_stack_t;
/* stack implementation */
-GUTHTHILA_DECLARE(guththila_stack_t*) guththila_stack_create (guththila_environment_t *environment);
-GUTHTHILA_DECLARE(int) guththila_stack_push (guththila_environment_t *environment,guththila_stack_t *st, guththila_token_t *tok, guththila_attribute_t *attr);
-GUTHTHILA_DECLARE(int) guththila_stack_size (guththila_environment_t *environment,guththila_stack_t *st);
-GUTHTHILA_DECLARE(void) guththila_stack_free (guththila_environment_t *environment,guththila_stack_t *st);
-GUTHTHILA_DECLARE(void) guththila_stack_free_rec (guththila_environment_t *environment,guththila_stack_t *st, guththila_element_t *el);
-GUTHTHILA_DECLARE(guththila_element_t*) guththila_stack_last (guththila_environment_t *environment,guththila_stack_t *st);
-GUTHTHILA_DECLARE(guththila_element_t*) guththila_stack_pull (guththila_environment_t *environment,guththila_stack_t *st);
-GUTHTHILA_DECLARE(int) guththila_stack_push_namespace (guththila_environment_t *environment,guththila_stack_t *st, guththila_namespace_t *ns);
-GUTHTHILA_DECLARE(guththila_element_t*) guththila_stack_pull_current (guththila_environment_t *environment,guththila_stack_t *st);
-GUTHTHILA_DECLARE(int) guththila_stack_push_depth (guththila_environment_t *environment,guththila_stack_t *st, guththila_depth_t *d);
-GUTHTHILA_DECLARE(void) guththila_stack_clear (guththila_environment_t *environment,guththila_stack_t *st);
-GUTHTHILA_DECLARE(guththila_element_t*) guththila_stack_get (guththila_environment_t *environment,guththila_stack_t *st, int i);
+GUTHTHILA_DECLARE (guththila_stack_t *)
+guththila_stack_create (guththila_environment_t * environment);
+GUTHTHILA_DECLARE (int)
+guththila_stack_push (guththila_environment_t * environment,
+ guththila_stack_t * st, guththila_token_t * tok,
+ guththila_attribute_t * attr);
+GUTHTHILA_DECLARE (int)
+guththila_stack_size (guththila_environment_t * environment,
+ guththila_stack_t * st);
+GUTHTHILA_DECLARE (void)
+guththila_stack_free (guththila_environment_t * environment,
+ guththila_stack_t * st);
+GUTHTHILA_DECLARE (void)
+guththila_stack_free_rec (guththila_environment_t * environment,
+ guththila_stack_t * st, guththila_element_t * el);
+GUTHTHILA_DECLARE (guththila_element_t *)
+guththila_stack_last (guththila_environment_t * environment,
+ guththila_stack_t * st);
+GUTHTHILA_DECLARE (guththila_element_t *)
+guththila_stack_pull (guththila_environment_t * environment,
+ guththila_stack_t * st);
+GUTHTHILA_DECLARE (int)
+guththila_stack_push_namespace (guththila_environment_t * environment,
+ guththila_stack_t * st,
+ guththila_namespace_t * ns);
+GUTHTHILA_DECLARE (guththila_element_t *)
+guththila_stack_pull_current (guththila_environment_t * environment,
+ guththila_stack_t * st);
+GUTHTHILA_DECLARE (int)
+guththila_stack_push_depth (guththila_environment_t * environment,
+ guththila_stack_t * st, guththila_depth_t * d);
+GUTHTHILA_DECLARE (void)
+guththila_stack_clear (guththila_environment_t * environment,
+ guththila_stack_t * st);
+GUTHTHILA_DECLARE (guththila_element_t *)
+guththila_stack_get (guththila_environment_t * environment,
+ guththila_stack_t * st, int i);
#endif /* GUTHTHILA_STACK_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.c Wed Oct 26 23:05:49 2005
@@ -18,60 +18,70 @@
#include <stdio.h>
int GUTHTHILA_CALL guththila_stream_ops_read (void *buffer, size_t count);
-int GUTHTHILA_CALL guththila_stream_ops_write(const void *buffer, size_t count);
+int GUTHTHILA_CALL guththila_stream_ops_write (const void *buffer,
+ size_t count);
-GUTHTHILA_DECLARE(guththila_stream_t*) guththila_stream_create(guththila_allocator_t* allocator, guththila_stream_ops_t* operations)
+GUTHTHILA_DECLARE (guththila_stream_t *)
+guththila_stream_create (guththila_allocator_t * allocator,
+ guththila_stream_ops_t * operations)
{
guththila_stream_t *stream;
if (!allocator)
return NULL;
- stream = (guththila_stream_t*)guththila_malloc(allocator, sizeof(guththila_stream_t));
+ stream =
+ (guththila_stream_t *) guththila_malloc (allocator,
+ sizeof (guththila_stream_t));
if (!stream)
return NULL;
-
+
if (operations)
stream->ops = operations;
else
{
- stream->ops = (guththila_stream_ops_t*)guththila_malloc(allocator, sizeof(guththila_stream_ops_t));
+ stream->ops =
+ (guththila_stream_ops_t *) guththila_malloc (allocator,
+ sizeof
+ (guththila_stream_ops_t));
if (!stream->ops)
{
- guththila_free(allocator, stream);
+ guththila_free (allocator, stream);
return NULL;
}
-
+
stream->ops->guththila_stream_read = guththila_stream_ops_read;
stream->ops->guththila_stream_write = guththila_stream_ops_write;
}
-
+
return stream;
}
-int GUTHTHILA_CALL guththila_stream_ops_read (void *buffer, size_t count)
+int GUTHTHILA_CALL
+guththila_stream_ops_read (void *buffer, size_t count)
{
int i;
if (!buffer)
return -1;
i = 0;
- for(i = 0; i < count -1; i++ )
+ for (i = 0; i < count - 1; i++)
{
- ((guththila_char_t*)buffer)[i] = 'a';
+ ((guththila_char_t *) buffer)[i] = 'a';
}
- ((guththila_char_t*)buffer)[i] = '\0';
+ ((guththila_char_t *) buffer)[i] = '\0';
return 0;
}
-int GUTHTHILA_CALL guththila_stream_ops_write(const void *buffer, size_t count)
+int GUTHTHILA_CALL
+guththila_stream_ops_write (const void *buffer, size_t count)
{
- int i ;
+ int i;
if (!buffer)
return -1;
-
- i =0;
- for(i = 0; i < count; i++)
- printf("%c", ((guththila_char_t*)buffer)[i]);
+
+ i = 0;
+ for (i = 0; i < count; i++)
+ printf ("%c", ((guththila_char_t *) buffer)[i]);
return 0;
}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.h Wed Oct 26 23:05:49 2005
@@ -20,22 +20,29 @@
#include <guththila_allocator.h>
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-struct guththila_stream;
-struct guththila_stream_ops;
+ struct guththila_stream;
+ struct guththila_stream_ops;
- GUTHTHILA_DECLARE_DATA typedef struct guththila_stream_ops {
- int (GUTHTHILA_CALL *guththila_stream_read)(void *buffer, size_t count);
- int (GUTHTHILA_CALL *guththila_stream_write)(const void *buffer, size_t count);
-} guththila_stream_ops_t;
-
-typedef struct guththila_stream {
- struct guththila_stream_ops *ops;
-} guththila_stream_t;
-
-GUTHTHILA_DECLARE(guththila_stream_t*) guththila_stream_create(guththila_allocator_t* allocator, guththila_stream_ops_t* operations);
+ GUTHTHILA_DECLARE_DATA typedef struct guththila_stream_ops
+ {
+ int (GUTHTHILA_CALL * guththila_stream_read) (void *buffer,
+ size_t count);
+ int (GUTHTHILA_CALL * guththila_stream_write) (const void *buffer,
+ size_t count);
+ } guththila_stream_ops_t;
+
+ typedef struct guththila_stream
+ {
+ struct guththila_stream_ops *ops;
+ } guththila_stream_t;
+
+ GUTHTHILA_DECLARE (guththila_stream_t *)
+ guththila_stream_create (guththila_allocator_t * allocator,
+ guththila_stream_ops_t * operations);
#define guththila_stream_read(stream, buffer, count) ((stream)->ops->guththila_stream_read(buffer, count))
#define guththila_stream_write(stream, buffer, count) ((stream)->ops->guththila_stream_write(buffer, count))
@@ -43,5 +50,5 @@
#ifdef __cplusplus
}
#endif
-
-#endif /* GUTHTHILA_STREAM_H */
+
+#endif /* GUTHTHILA_STREAM_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.c Wed Oct 26 23:05:49 2005
@@ -18,62 +18,68 @@
#include <stdlib.h>
#include <string.h>
-void* GUTHTHILA_CALL guththila_string_ops_strdup(const void* ptr)
+void *GUTHTHILA_CALL
+guththila_string_ops_strdup (const void *ptr)
{
if (ptr)
- return (void*)strdup((const char*)ptr);
+ return (void *) strdup ((const char *) ptr);
else
return NULL;
}
-int GUTHTHILA_CALL guththila_string_ops_strcmp(const guththila_char_t *s1, const guththila_char_t *s2)
+int GUTHTHILA_CALL
+guththila_string_ops_strcmp (const guththila_char_t * s1,
+ const guththila_char_t * s2)
{
if (s1 && s2)
- return strcmp(s1, s2);
+ return strcmp (s1, s2);
else
return -1;
}
-int GUTHTHILA_CALL guththila_string_ops_strlen(const guththila_char_t *s)
+int GUTHTHILA_CALL
+guththila_string_ops_strlen (const guththila_char_t * s)
{
- if(s)
+ if (s)
{
-
+
#ifdef __UNICODE__FUNCTIONS__
-
- return guththila_strlen_unicode(x);
-#else
- return strlen(s);
-#endif
+
+ return guththila_strlen_unicode (x);
+#else
+ return strlen (s);
+#endif
}
else
return -1;
}
-guththila_char_t* GUTHTHILA_CALL guththila_string_ops_strndup(const guththila_char_t *s1,size_t len)
+
+guththila_char_t *GUTHTHILA_CALL
+guththila_string_ops_strndup (const guththila_char_t * s1, size_t len)
{
- if(s1)
+ if (s1)
{
-#ifdef __UNICODE__FUNCTIONS__
-
- return guththila_strdup_unicode(x, y);
-
-#else
+#ifdef __UNICODE__FUNCTIONS__
+
+ return guththila_strdup_unicode (x, y);
+
+#else
register size_t n;
- register guththila_char_t *dst;
+ register guththila_char_t *dst;
- n = guththila_string_ops_strlen(s1);
- if (len < n)
- n = len;
- dst = (guththila_char_t *) malloc(n+1);
- if (dst)
- {
- memcpy(dst, s1, n);
- dst[n] = '\0';
- }
- return dst;
+ n = guththila_string_ops_strlen (s1);
+ if (len < n)
+ n = len;
+ dst = (guththila_char_t *) malloc (n + 1);
+ if (dst)
+ {
+ memcpy (dst, s1, n);
+ dst[n] = '\0';
+ }
+ return dst;
#endif
}
else
@@ -82,19 +88,23 @@
-GUTHTHILA_DECLARE(guththila_string_t*) guththila_string_create(guththila_allocator_t *allocator,
- guththila_string_t *string)
+GUTHTHILA_DECLARE (guththila_string_t *)
+guththila_string_create (guththila_allocator_t * allocator,
+ guththila_string_t * string)
{
- if(string)
+ if (string)
return string;
if (!allocator)
return NULL;
-
+
else
{
- string = (guththila_string_t*)guththila_malloc(allocator, sizeof(guththila_string_t));
- if(string)
+ string =
+ (guththila_string_t *) guththila_malloc (allocator,
+ sizeof
+ (guththila_string_t));
+ if (string)
{
string->guththila_string_strdup = guththila_string_ops_strdup;
string->guththila_string_strcmp = guththila_string_ops_strcmp;
@@ -102,6 +112,6 @@
string->guththila_string_strlen = guththila_string_ops_strlen;
return string;
}
- }
+ }
return NULL;
}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.h Wed Oct 26 23:05:49 2005
@@ -20,16 +20,22 @@
#include <guththila_defines.h>
#include <guththila_allocator.h>
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-GUTHTHILA_DECLARE_DATA typedef struct guththila_string
-{
- void* (GUTHTHILA_CALL *guththila_string_strdup)(const void *ptr);
- int (GUTHTHILA_CALL *guththila_string_strcmp)(const guththila_char_t *s1, const guththila_char_t *s2);
- guththila_char_t *(GUTHTHILA_CALL *guththila_string_strndup)(const guththila_char_t *s1,size_t n);
- int (GUTHTHILA_CALL *guththila_string_strlen)(const guththila_char_t *s);
-}guththila_string_t;
+ GUTHTHILA_DECLARE_DATA typedef struct guththila_string
+ {
+ void *(GUTHTHILA_CALL * guththila_string_strdup) (const void *ptr);
+ int (GUTHTHILA_CALL *
+ guththila_string_strcmp) (const guththila_char_t * s1,
+ const guththila_char_t * s2);
+ guththila_char_t *(GUTHTHILA_CALL *
+ guththila_string_strndup) (const guththila_char_t *
+ s1, size_t n);
+ int (GUTHTHILA_CALL *
+ guththila_string_strlen) (const guththila_char_t * s);
+ } guththila_string_t;
/**
* if the parsed string is null a default string is created
@@ -38,9 +44,10 @@
* @param string user defined allcator
*/
-GUTHTHILA_DECLARE(guththila_string_t*)
- guththila_string_create(guththila_allocator_t *allocator, guththila_string_t *string);
-
+ GUTHTHILA_DECLARE (guththila_string_t *)
+ guththila_string_create (guththila_allocator_t * allocator,
+ guththila_string_t * string);
+
#define guththila_strdup(string, ptr) ((string)->guththila_string_strdup(ptr))
#define guththila_strcmp(string, s1, s2) ((string)->guththila_string_strcmp(s1, s2))
#define guththila_strndup(string,s1,n) ((string)->guththila_string_strndup(s1,n))
@@ -50,4 +57,4 @@
}
#endif
-#endif /* GUTHTHILA_STRING_H */
+#endif /* GUTHTHILA_STRING_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.c Wed Oct 26 23:05:49 2005
@@ -21,281 +21,309 @@
#include "guththila_token.h"
#include "guththila_unicode.h"
-GUTHTHILA_DECLARE(guththila_token_t *)
-guththila_token_create_token_buffer (guththila_environment_t *environment,int size)
+GUTHTHILA_DECLARE (guththila_token_t *)
+guththila_token_create_token_buffer (guththila_environment_t * environment,
+ int size)
{
- guththila_token_t *tok = (guththila_token_t *)guththila_malloc (environment->allocator,sizeof(guththila_token_t)*size);
- tok->size = size;
- return tok;
+ guththila_token_t *tok =
+ (guththila_token_t *) guththila_malloc (environment->allocator,
+ sizeof (guththila_token_t) *
+ size);
+ tok->size = size;
+ return tok;
}
-GUTHTHILA_DECLARE(void)
-guththila_token_free_token_buffer (guththila_environment_t *environment,guththila_token_t *tok)
+GUTHTHILA_DECLARE (void)
+guththila_token_free_token_buffer (guththila_environment_t * environment,
+ guththila_token_t * tok)
{
- if (tok)
- guththila_free (environment->allocator,tok);
+ if (tok)
+ guththila_free (environment->allocator, tok);
}
-GUTHTHILA_DECLARE(void )
+GUTHTHILA_DECLARE (void)
guththila_token_exception ()
{
- printf ("Throws new token Exception");
- /* Samisa : we should define the error code and error desctioption and return error code to user
- no use of using printf within a library
- please delete this comment once this is fixed.
- */
+ printf ("Throws new token Exception");
+ /* Samisa : we should define the error code and error desctioption and return error code to user
+ no use of using printf within a library
+ please delete this comment once this is fixed.
+ */
}
-GUTHTHILA_DECLARE(int)
-guththila_token_length (guththila_environment_t *environment,guththila_token_t *tok)
+GUTHTHILA_DECLARE (int)
+guththila_token_length (guththila_environment_t * environment,
+ guththila_token_t * tok)
{
- if (tok->end)
- return (tok->end) - (tok->start) + 1;
- else
- guththila_token_exception ();
- return 0;
+ if (tok->end)
+ return (tok->end) - (tok->start) + 1;
+ else
+ guththila_token_exception ();
+ return 0;
}
-GUTHTHILA_DECLARE(guththila_token_t *)
-guththila_token_grow (guththila_environment_t *environment,guththila_token_t *tok)
+GUTHTHILA_DECLARE (guththila_token_t *)
+guththila_token_grow (guththila_environment_t * environment,
+ guththila_token_t * tok)
{
- tok->size <<= 1;
- tok = (guththila_token_t *) guththila_realloc (environment->allocator,tok, sizeof(guththila_token_t)*tok->size);
- return tok;
+ tok->size <<= 1;
+ tok =
+ (guththila_token_t *) guththila_realloc (environment->allocator, tok,
+ sizeof (guththila_token_t) *
+ tok->size);
+ return tok;
}
-GUTHTHILA_DECLARE(guththila_token_t *)
-guththila_token_append (guththila_environment_t *environment,guththila_token_t *tok)
+GUTHTHILA_DECLARE (guththila_token_t *)
+guththila_token_append (guththila_environment_t * environment,
+ guththila_token_t * tok)
{
- if (++ (tok->last) > (tok->size))
- guththila_token_grow (environment,tok);
- return &tok[tok->last];
+ if (++(tok->last) > (tok->size))
+ guththila_token_grow (environment, tok);
+ return &tok[tok->last];
}
-GUTHTHILA_DECLARE(guththila_token_t *)
-guththila_token_last (guththila_environment_t *environment,guththila_token_t *tok)
+GUTHTHILA_DECLARE (guththila_token_t *)
+guththila_token_last (guththila_environment_t * environment,
+ guththila_token_t * tok)
{
- if (tok->last < 0)
- guththila_token_exception ();
- return &tok[tok->last];
+ if (tok->last < 0)
+ guththila_token_exception ();
+ return &tok[tok->last];
}
-GUTHTHILA_DECLARE(int)
-guththila_token_count (guththila_environment_t *environment,guththila_token_t *tok)
+GUTHTHILA_DECLARE (int)
+guththila_token_count (guththila_environment_t * environment,
+ guththila_token_t * tok)
{
- return tok->last;
+ return tok->last;
}
-GUTHTHILA_DECLARE(guththila_char_t*)
-guththila_token_char_ref (guththila_environment_t *environment,guththila_char_t *buffer)
+GUTHTHILA_DECLARE (guththila_char_t *)
+guththila_token_char_ref (guththila_environment_t * environment,
+ guththila_char_t * buffer)
{
- int len;
- int ii;
- int ix;
- guththila_char_t *ref_buffer;
- len = guththila_strlen (environment->string,buffer);
- ref_buffer = (guththila_char_t *) guththila_malloc (environment->allocator,len+1);
- for (ii = 0, ix = 0; ii < len; ii++, ix++)
+ int len;
+ int ii;
+ int ix;
+ guththila_char_t *ref_buffer;
+ len = guththila_strlen (environment->string, buffer);
+ ref_buffer =
+ (guththila_char_t *) guththila_malloc (environment->allocator,
+ len + 1);
+ for (ii = 0, ix = 0; ii < len; ii++, ix++)
{
- if (buffer[ii] == '&')
- {
- if (buffer[ii+1] == 'a'
- && buffer[ii+2] == 'm'
- && buffer[ii+3] == 'p'
- && buffer[ii+4] == ';')
- {
- ref_buffer[ix] = '&';
- ii += 4;
- }
- else if (buffer[ii+1] == 'g'
- && buffer[ii+2] == 't'
- && buffer[ii+3] == ';')
- {
- ref_buffer[ix] = '>';
- ii += 3;
- }
- else if (buffer[ii+1] == 'l'
- && buffer[ii+2] == 't'
- && buffer[ii+3] == ';')
- {
- ref_buffer[ix] = '<';
- ii += 3;
- }
- else if (buffer[ii+1] == 'q'
- && buffer[ii+2] == 'u'
- && buffer[ii+3] == 'o'
- && buffer[ii+4] == 't'
- && buffer[ii+5] == ';')
- {
- ref_buffer[ix] = '"';
- ii +=5;
- }
- else if (buffer[ii+1] == 'a'
- && buffer[ii+2] == 'p'
- && buffer[ii+3] == 'o'
- && buffer[ii+4] == 's'
- && buffer[ii+5] == ';')
- {
- ref_buffer[ix] = '\'';
- ii +=5;
- }
- else
- guththila_token_exception ();
- }
- else
- ref_buffer[ix] = buffer[ii];
+ if (buffer[ii] == '&')
+ {
+ if (buffer[ii + 1] == 'a'
+ && buffer[ii + 2] == 'm'
+ && buffer[ii + 3] == 'p' && buffer[ii + 4] == ';')
+ {
+ ref_buffer[ix] = '&';
+ ii += 4;
+ }
+ else if (buffer[ii + 1] == 'g'
+ && buffer[ii + 2] == 't' && buffer[ii + 3] == ';')
+ {
+ ref_buffer[ix] = '>';
+ ii += 3;
+ }
+ else if (buffer[ii + 1] == 'l'
+ && buffer[ii + 2] == 't' && buffer[ii + 3] == ';')
+ {
+ ref_buffer[ix] = '<';
+ ii += 3;
+ }
+ else if (buffer[ii + 1] == 'q'
+ && buffer[ii + 2] == 'u'
+ && buffer[ii + 3] == 'o'
+ && buffer[ii + 4] == 't' && buffer[ii + 5] == ';')
+ {
+ ref_buffer[ix] = '"';
+ ii += 5;
+ }
+ else if (buffer[ii + 1] == 'a'
+ && buffer[ii + 2] == 'p'
+ && buffer[ii + 3] == 'o'
+ && buffer[ii + 4] == 's' && buffer[ii + 5] == ';')
+ {
+ ref_buffer[ix] = '\'';
+ ii += 5;
+ }
+ else
+ guththila_token_exception ();
+ }
+ else
+ ref_buffer[ix] = buffer[ii];
}
- return ref_buffer;
+ return ref_buffer;
}
-GUTHTHILA_DECLARE(guththila_char_t *)
-guththila_token_to_string (guththila_environment_t *environment,guththila_token_t *tok, int unicode)
+GUTHTHILA_DECLARE (guththila_char_t *)
+guththila_token_to_string (guththila_environment_t * environment,
+ guththila_token_t * tok, int unicode)
{
- if (tok)
+ if (tok)
{
- if (unicode == None)
- {
- int length;
- guththila_char_t *buffer;
- length = guththila_token_length (environment,tok);
- buffer = (guththila_char_t *) guththila_malloc (environment->allocator,length + 1);
- memcpy (buffer, tok->start, length);
- buffer[length] = 0;
- if (tok->ref)
- guththila_token_char_ref (environment,buffer);
- else
- return buffer;
- }
- else
- {
- int length;
- guththila_char_t *buffer;
- length = guththila_token_length (environment,tok);
- buffer = (guththila_char_t *) guththila_malloc (environment->allocator,length + 1);
- memcpy (buffer, tok->start, length);
- buffer[length] = 0;
- return guththila_token_convert_utf16_to_utf8 (environment,buffer, length);
- }
+ if (unicode == None)
+ {
+ int length;
+ guththila_char_t *buffer;
+ length = guththila_token_length (environment, tok);
+ buffer =
+ (guththila_char_t *) guththila_malloc (environment->allocator,
+ length + 1);
+ memcpy (buffer, tok->start, length);
+ buffer[length] = 0;
+ if (tok->ref)
+ guththila_token_char_ref (environment, buffer);
+ else
+ return buffer;
+ }
+ else
+ {
+ int length;
+ guththila_char_t *buffer;
+ length = guththila_token_length (environment, tok);
+ buffer =
+ (guththila_char_t *) guththila_malloc (environment->allocator,
+ length + 1);
+ memcpy (buffer, tok->start, length);
+ buffer[length] = 0;
+ return guththila_token_convert_utf16_to_utf8 (environment, buffer,
+ length);
+ }
}
-
+
return NULL;
}
-GUTHTHILA_DECLARE(void)
-guththila_token_relocate (guththila_environment_t *environment,guththila_token_t *tok, int offset)
+GUTHTHILA_DECLARE (void)
+guththila_token_relocate (guththila_environment_t * environment,
+ guththila_token_t * tok, int offset)
{
- tok->start -= offset;
- tok->end -= offset;
+ tok->start -= offset;
+ tok->end -= offset;
}
-GUTHTHILA_DECLARE(int)
-guththila_token_compare (guththila_environment_t *environment,guththila_token_t *tok, const guththila_char_t *s, int n, int unicode_state)
+GUTHTHILA_DECLARE (int)
+guththila_token_compare (guththila_environment_t * environment,
+ guththila_token_t * tok, const guththila_char_t * s,
+ int n, int unicode_state)
{
- if (unicode_state == None)
- return strncmp (tok->start, s, n);
- else
+ if (unicode_state == None)
+ return strncmp (tok->start, s, n);
+ else
{
- guththila_char_t *buffer;
- buffer = guththila_token_to_string (environment,tok,unicode_state);
- return strncmp (buffer, s, n);
+ guththila_char_t *buffer;
+ buffer = guththila_token_to_string (environment, tok, unicode_state);
+ return strncmp (buffer, s, n);
}
}
-GUTHTHILA_DECLARE(int)
-guththila_token_length_utf16 (guththila_environment_t *environment,unsigned int utf16_ch)
-{
- int length;
-
- if (0x80 > utf16_ch)
- length = 1;
- else if (0x800 > utf16_ch)
- length = 2;
- else if (0x10000 > utf16_ch)
- length = 3;
- else if (0x200000 > utf16_ch)
- length = 4;
- else if (0x4000000 > utf16_ch)
- length = 5;
- else
- length = 6;
-
- return length;
+GUTHTHILA_DECLARE (int)
+guththila_token_length_utf16 (guththila_environment_t * environment,
+ unsigned int utf16_ch)
+{
+ int length;
+
+ if (0x80 > utf16_ch)
+ length = 1;
+ else if (0x800 > utf16_ch)
+ length = 2;
+ else if (0x10000 > utf16_ch)
+ length = 3;
+ else if (0x200000 > utf16_ch)
+ length = 4;
+ else if (0x4000000 > utf16_ch)
+ length = 5;
+ else
+ length = 6;
+
+ return length;
}
-GUTHTHILA_DECLARE(guththila_char_t*)
-guththila_token_build_utf8 (guththila_environment_t *environment,unsigned int utf16_ch, int length)
-{
- guththila_UTF8_char mask = 0;
- int ii = 0;
- guththila_char_t *buffer = (guththila_char_t *) guththila_calloc (environment->allocator,length + 1, 1);
- if (length == 1)
- buffer[0] = utf16_ch;
- else
+GUTHTHILA_DECLARE (guththila_char_t *)
+guththila_token_build_utf8 (guththila_environment_t * environment,
+ unsigned int utf16_ch, int length)
+{
+ guththila_UTF8_char mask = 0;
+ int ii = 0;
+ guththila_char_t *buffer =
+ (guththila_char_t *) guththila_calloc (environment->allocator,
+ length + 1, 1);
+ if (length == 1)
+ buffer[0] = utf16_ch;
+ else
{
- switch (length)
- {
- case 1:
- break;
- case 2:
- mask = 0xc0;
- break;
- case 3:
- mask = 0xe0;
- break;
- case 4:
- mask = 0xf0;
- break;
- case 5:
- mask = 0xf8;
- break;
- case 6:
- mask = 0xfc;
- break;
- };
-
- for (ii = length - 1; ii > 0; ii--)
- {
- buffer[ii] = (utf16_ch & 0x3f) | 0x80;
- utf16_ch >>= 6;
- }
+ switch (length)
+ {
+ case 1:
+ break;
+ case 2:
+ mask = 0xc0;
+ break;
+ case 3:
+ mask = 0xe0;
+ break;
+ case 4:
+ mask = 0xf0;
+ break;
+ case 5:
+ mask = 0xf8;
+ break;
+ case 6:
+ mask = 0xfc;
+ break;
+ };
+
+ for (ii = length - 1; ii > 0; ii--)
+ {
+ buffer[ii] = (utf16_ch & 0x3f) | 0x80;
+ utf16_ch >>= 6;
+ }
- buffer[0] = utf16_ch | mask;
- buffer[length] = 0;
+ buffer[0] = utf16_ch | mask;
+ buffer[length] = 0;
}
- return buffer;
+ return buffer;
}
-GUTHTHILA_DECLARE(guththila_char_t *)
-guththila_token_convert_utf16_to_utf8 (guththila_environment_t *environment,guththila_char_t *buffer, int length)
-{
- unsigned int utf16_char = 0;
- int length_utf16 = 0;
- int total_length = 0;
- guththila_char_t *input_buffer = buffer;
- guththila_char_t *output_char = 0;
- int ii = 0;
- guththila_char_t *output_buffer = (guththila_char_t *) guththila_calloc (environment->allocator ,1, 1);
- for (ii = 0; length > ii ; )
+GUTHTHILA_DECLARE (guththila_char_t *)
+guththila_token_convert_utf16_to_utf8 (guththila_environment_t * environment,
+ guththila_char_t * buffer, int length)
+{
+ unsigned int utf16_char = 0;
+ int length_utf16 = 0;
+ int total_length = 0;
+ guththila_char_t *input_buffer = buffer;
+ guththila_char_t *output_char = 0;
+ int ii = 0;
+ guththila_char_t *output_buffer =
+ (guththila_char_t *) guththila_calloc (environment->allocator, 1, 1);
+ for (ii = 0; length > ii;)
{
- utf16_char = *((guththila_UTF16_char *)&input_buffer[ii]);
- ii += 2;
- length_utf16 = guththila_token_length_utf16 (environment,utf16_char);
- output_char = guththila_token_build_utf8 (environment,utf16_char, length_utf16);
- total_length += length_utf16;
- output_buffer = strcat (output_buffer, output_char);
+ utf16_char = *((guththila_UTF16_char *) & input_buffer[ii]);
+ ii += 2;
+ length_utf16 = guththila_token_length_utf16 (environment, utf16_char);
+ output_char =
+ guththila_token_build_utf8 (environment, utf16_char,
+ length_utf16);
+ total_length += length_utf16;
+ output_buffer = strcat (output_buffer, output_char);
}
- return output_buffer;
+ return output_buffer;
}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.h Wed Oct 26 23:05:49 2005
@@ -28,17 +28,17 @@
typedef struct guththila_token_s
{
- int type;
- guththila_char_t *start;
- guththila_char_t *end;
- int last;
- int size;
- int ref;
+ int type;
+ guththila_char_t *start;
+ guththila_char_t *end;
+ int last;
+ int size;
+ int ref;
} guththila_token_t;
enum guththila_token_type
- {
+{
Unknown = 1,
_name,
_value,
@@ -46,23 +46,53 @@
_attribute_value,
_prefix,
_char_data
- };
+};
-GUTHTHILA_DECLARE(guththila_token_t*) guththila_token_create_token_buffer(guththila_environment_t *environment,int size);
-GUTHTHILA_DECLARE(void) guththila_token_free_token_buffer (guththila_environment_t *environment,guththila_token_t *tok);
-GUTHTHILA_DECLARE(int) guththila_token_length (guththila_environment_t *environment,guththila_token_t *tok);
-GUTHTHILA_DECLARE(void) guththila_token_exception ();
-GUTHTHILA_DECLARE(guththila_token_t*) guththila_token_append (guththila_environment_t *environment,guththila_token_t *tok);
-GUTHTHILA_DECLARE(guththila_token_t*) guththila_token_grow (guththila_environment_t *environment,guththila_token_t *tok);
-GUTHTHILA_DECLARE(guththila_token_t*) guththila_token_last (guththila_environment_t *environment,guththila_token_t *tok);
-GUTHTHILA_DECLARE(int) guththila_token_count (guththila_environment_t *environment,guththila_token_t *tok);
-GUTHTHILA_DECLARE(guththila_char_t*) guththila_token_to_string (guththila_environment_t *environment,guththila_token_t *tok, int unicode);
-GUTHTHILA_DECLARE(void) guththila_token_relocate (guththila_environment_t *environment,guththila_token_t *tok, int offset);
-GUTHTHILA_DECLARE(int) guththila_token_compare (guththila_environment_t *environment,guththila_token_t *tok, const guththila_char_t *st, int n, int unicode_state);
-GUTHTHILA_DECLARE(guththila_char_t*) guththila_token_convert_utf16_to_utf8 (guththila_environment_t *environment,guththila_char_t *buffer, int length);
-GUTHTHILA_DECLARE(int) guththila_token_length_utf16 (guththila_environment_t *environment,unsigned int utf16_ch);
-GUTHTHILA_DECLARE(guththila_char_t*) guththila_token_build_utf8 (guththila_environment_t *environment,unsigned int utf16_ch, int length);
-GUTHTHILA_DECLARE(guththila_char_t*) guththila_token_char_ref (guththila_environment_t *environment,guththila_char_t *buffer);
+GUTHTHILA_DECLARE (guththila_token_t *)
+guththila_token_create_token_buffer (guththila_environment_t * environment,
+ int size);
+GUTHTHILA_DECLARE (void)
+guththila_token_free_token_buffer (guththila_environment_t * environment,
+ guththila_token_t * tok);
+GUTHTHILA_DECLARE (int)
+guththila_token_length (guththila_environment_t * environment,
+ guththila_token_t * tok);
+GUTHTHILA_DECLARE (void)
+guththila_token_exception ();
+GUTHTHILA_DECLARE (guththila_token_t *)
+guththila_token_append (guththila_environment_t * environment,
+ guththila_token_t * tok);
+GUTHTHILA_DECLARE (guththila_token_t *)
+guththila_token_grow (guththila_environment_t * environment,
+ guththila_token_t * tok);
+GUTHTHILA_DECLARE (guththila_token_t *)
+guththila_token_last (guththila_environment_t * environment,
+ guththila_token_t * tok);
+GUTHTHILA_DECLARE (int)
+guththila_token_count (guththila_environment_t * environment,
+ guththila_token_t * tok);
+GUTHTHILA_DECLARE (guththila_char_t *)
+guththila_token_to_string (guththila_environment_t * environment,
+ guththila_token_t * tok, int unicode);
+GUTHTHILA_DECLARE (void)
+guththila_token_relocate (guththila_environment_t * environment,
+ guththila_token_t * tok, int offset);
+GUTHTHILA_DECLARE (int)
+guththila_token_compare (guththila_environment_t * environment,
+ guththila_token_t * tok, const guththila_char_t * st,
+ int n, int unicode_state);
+GUTHTHILA_DECLARE (guththila_char_t *)
+guththila_token_convert_utf16_to_utf8 (guththila_environment_t * environment,
+ guththila_char_t * buffer, int length);
+GUTHTHILA_DECLARE (int)
+guththila_token_length_utf16 (guththila_environment_t * environment,
+ unsigned int utf16_ch);
+GUTHTHILA_DECLARE (guththila_char_t *)
+guththila_token_build_utf8 (guththila_environment_t * environment,
+ unsigned int utf16_ch, int length);
+GUTHTHILA_DECLARE (guththila_char_t *)
+guththila_token_char_ref (guththila_environment_t * environment,
+ guththila_char_t * buffer);
#endif /* GUTHTHILA_TOKEN_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.c Wed Oct 26 23:05:49 2005
@@ -21,45 +21,45 @@
#include "guththila_unicode.h"
#include <stdlib.h>
#include <string.h>
-#ifdef UNICODE_OUT /* This variable for Obtain UTF-16 Output */
+#ifdef UNICODE_OUT /* This variable for Obtain UTF-16 Output */
/*! In order to determine length of UTF-16 Buffer
* Basicall guththila_char_t *p should be a Utf-16 Buffer */
-guththila_UTF8_char
-guththila_strlen_unicode (guththila_char_t *p)
+guththila_UTF8_char
+guththila_strlen_unicode (guththila_char_t * p)
{
- guththila_UTF8_char len = 0;
- guththila_UTF8_char d;
- guththila_UTF16_char c ;
- guththila_char_t* s = p;
- c = *((guththila_UTF16_char *)&s[len]);
- if (c)
+ guththila_UTF8_char len = 0;
+ guththila_UTF8_char d;
+ guththila_UTF16_char c;
+ guththila_char_t *s = p;
+ c = *((guththila_UTF16_char *) & s[len]);
+ if (c)
{
- while (c)
- {
- c = *((guththila_UTF16_char *)&s[len]);
- len +=2;
- d = s[len];
- if(!d)
- {
- return len;
- break;
- }
- }
- return (len-2);
+ while (c)
+ {
+ c = *((guththila_UTF16_char *) & s[len]);
+ len += 2;
+ d = s[len];
+ if (!d)
+ {
+ return len;
+ break;
+ }
+ }
+ return (len - 2);
}
- else
- return 0;
+ else
+ return 0;
}
/*!To Duplicate UTF-16 String */
-guththila_char_t *
-guththila_strdup_unicode (guththila_char_t* p, int length)
+guththila_char_t *
+guththila_strdup_unicode (guththila_char_t * p, int length)
{
- guththila_char_t *s;
- s = (guththila_char_t *)calloc (length+1, 1);
- s[length] = 0;
- return (guththila_char_t *)memcpy (s, p, length);
+ guththila_char_t *s;
+ s = (guththila_char_t *) calloc (length + 1, 1);
+ s[length] = 0;
+ return (guththila_char_t *) memcpy (s, p, length);
}
#endif /*end of UNICODE_OUT definition */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.h Wed Oct 26 23:05:49 2005
@@ -31,7 +31,8 @@
* LE = Little Endian UTF-16 Document
* BE = Big Endian UTF-16 Document
* For the time being Endianess make no effect to the parsing */
-enum guththila_UTF16_endianess {None=1, LE, BE};
+enum guththila_UTF16_endianess
+{ None = 1, LE, BE };
#ifdef __UNICODE__FUNCTIONS__
/* #define strlen(x) guththila_strlen_unicode(x)
@@ -39,7 +40,7 @@
*/
guththila_UTF8_char guththila_strlen_unicode (guththila_char_t *);
-guththila_char_t * guththila_strdup_unicode (guththila_char_t *, int);
+guththila_char_t *guththila_strdup_unicode (guththila_char_t *, int);
#endif /* __UNICODE__FUNCTIONS__ */
#endif /* GUTHTHILA_UNICODE_H */