axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From din...@apache.org
Subject svn commit: r375848 - in /webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src: guththila_allocator.h guththila_error.h guththila_main.c guththila_stack.c guththila_token.c guththila_xml_pull_parser.c guththila_xml_pull_parser.h
Date Wed, 08 Feb 2006 04:36:29 GMT
Author: dinesh
Date: Tue Feb  7 20:36:27 2006
New Revision: 375848

URL: http://svn.apache.org/viewcvs?rev=375848&view=rev
Log:
Added some error codes. Modified exception method. Put guththila_event into the structure

Modified:
    webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_allocator.h
    webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.h
    webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_main.c
    webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.c
    webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.c
    webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.c
    webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.h

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_allocator.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_allocator.h?rev=375848&r1=375847&r2=375848&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_allocator.h
(original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_allocator.h
Tue Feb  7 20:36:27 2006
@@ -32,7 +32,7 @@
         void (*free)(void *ptr);
         void *(*calloc)(size_t nelem, size_t elsize);
         
-    } guththila_allocator_t;
+   } guththila_allocator_t;
 
 /**
 *   if the parsed allocator is null a default allocator is created

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.h?rev=375848&r1=375847&r2=375848&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.h Tue
Feb  7 20:36:27 2006
@@ -59,7 +59,30 @@
         GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_PREFIX,
         GUTHTHILA_STREAM_WRITER_ERROR_OUT_OF_MEMORY,
         GUTHTHILA_STREAM_WRITER_ERROR_FILE_NOT_FOUND,
-        GUTHTHILA_STREAM_READER_ERROR_OUT_OF_MEMORY
+        GUTHTHILA_STREAM_READER_ERROR_OUT_OF_MEMORY,
+	GUTHTHILA_ERROR_INVALID_ENCODING_DECLARATION,
+	GUTHTHILA_ERROR_UNEXPECTED_UTF16_EOF,
+	GUTHTHILA_ERROR_UNEXPECTED_EOF,
+	GUTHTHILA_ERROR_PROCESS_EQUAL,
+	GUTHTHILA_ERROR_INCORRECT_VERSION_INFO,
+	GUTHTHILA_ERROR_INCORRECT_XML_DECLARATION,
+	GUTHTHILA_ERROR_VERSION_INFO_NOT_FOUND,
+	GUTHTHILA_ERROR_ENCODING_DECLARATION_ERROR,
+	GUTHTHILA_ERROR_STANDALONE_ERROR_IN_YES,
+	GUTHTHILA_ERROR_STANDALONE_ERROR_IN_NO,
+	GUTHTHILA_ERROR_STANDALONE_ERROR_YES_OR_NO_NOT_AVAILABLE,
+	GUTHTHILA_ERROR_MISSING_GREATER_SIGN_IN_XML_DECLARATION,
+	GUTHTHILA_ERROR_INVALID_NAME_STARTING_CHARACTER,
+	GUTHTHILA_ERROR_QUOTES_NOT_FOUND_BEFORE_ATTRIBUTE_VALUE,
+	GUTHTHILA_ERROR_EMPTY_ELEMENT_NOT_CLOSED,
+	GUTHTHILA_ERROR_END_TAG_NOT_CLOSED,
+	GUTHTHILA_ERROR_MORE_HYPENS_OCCURED_IN_COMMENT,
+	GUTHTHILA_ERROR_TOKENIZE_ERROR,
+	GUTHTHILA_ERROR_INVALID_TOKEN_TYPE,
+	GUTHTHILA_ERROR_NULL_ATTRIBUTE_NAME,
+	GUTHTHILA_ERROR_NULL_ATTRIBUTE_VALUE,
+	GUTHTHILA_ERROR_NULL_ATTRIBUTE_PREFIX,
+	GUTHTHILA_ERROR_REQUESTED_NUMBER_GREATER_THAN_STACK_SIZE
     } guththila_error_codes_t;
 
 

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_main.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_main.c?rev=375848&r1=375847&r2=375848&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_main.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_main.c Tue Feb
 7 20:36:27 2006
@@ -73,7 +73,7 @@
                 char *p;
                 guththila_element_t *e;
                 printf ("<");
-
+		/* printf ("\n %s \n", guththila_xml_pull_parser_get_encoding (environment, parser)); */
                 p = guththila_xml_pull_parser_get_prefix (environment,
                                                           parser);
                 if (p)
@@ -128,7 +128,7 @@
                     printf ("%s\" ", p);
                     GUTHTHILA_FREE (allocator, p);
                 }
-                if (guththila_event == GUTHTHILA_START_ELEMENT)
+                if (parser->guththila_event == GUTHTHILA_START_ELEMENT)
                     printf (">");
                 else
                     printf ("/>");

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.c?rev=375848&r1=375847&r2=375848&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.c Tue
Feb  7 20:36:27 2006
@@ -94,7 +94,7 @@
     {
         guththila_element_t *ele = stack->tail;
         guththila_stack_free_rec (environment, stack, ele);
-        GUTHTHILA_FREE (environment->allocator, ele);
+       /*  GUTHTHILA_FREE (environment->allocator, ele); */
         GUTHTHILA_FREE (environment->allocator, stack);
     }
 }
@@ -111,8 +111,8 @@
     }
     else
     {
-        elem = elem->prev;
-        guththila_stack_free_rec (environment, stack, elem);
+/*         elem = elem->prev; */
+        guththila_stack_free_rec (environment, stack, elem->prev);
         GUTHTHILA_FREE (environment->allocator, elem);
     }
 }
@@ -187,6 +187,7 @@
         {
             e->prev = stack->tail;
             stack->tail = e;
+
             stack->current = stack->tail;
             stack->pointer++;
             stack->current_pos = stack->pointer;

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.c?rev=375848&r1=375847&r2=375848&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.c Tue
Feb  7 20:36:27 2006
@@ -184,7 +184,7 @@
             memcpy (buffer, tok->start, length);
             buffer[length] = 0;
             if (tok->ref)
-                guththila_token_char_ref (environment, buffer);
+                return guththila_token_char_ref (environment, buffer);
             else
                 return buffer;
         }
@@ -203,8 +203,8 @@
                                                           length);
         }
     }
-
-    return NULL;
+    else
+      return NULL;
 }
 
 

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.c?rev=375848&r1=375847&r2=375848&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.c
(original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.c
Tue Feb  7 20:36:27 2006
@@ -73,7 +73,7 @@
 
 
 int
-guththila_xml_pull_parser_exception (guththila_char_t * file, int line)
+guththila_xml_pull_parser_exception (guththila_char_t * file, int line, int error_code)
 {
     printf ("Throws guththila_xml_pull_parser_exception \t %s \t %d \n", file,
             line);
@@ -82,7 +82,11 @@
        above string to the error message corresponding to the current error code
        please delete this comment once this is fixed
      */
-    return -1;
+
+    /* Dinesh: Modified exception function to print line number , file
+       and return error code for particular error. If we feel that
+       file and line number is not necessary lets remove them later.*/
+    return error_code;
 }
 
 
@@ -160,7 +164,7 @@
         if (eof)
             return -1;
         else
-            guththila_xml_pull_parser_exception (p_FILE, LINE);
+	  guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_UNEXPECTED_UTF16_EOF);
     }
     while (!c)
         c = parser->buffer->buff[parser->_next++];
@@ -179,7 +183,7 @@
         if (eof)
             return -1;
         else
-            guththila_xml_pull_parser_exception (p_FILE, LINE);
+            guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_UNEXPECTED_EOF);
     }
     if (parser->_next == 0)
     {
@@ -281,7 +285,7 @@
                                                       ic);
     }
     else
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_PROCESS_EQUAL);
     return 0;
 }
 
@@ -332,10 +336,10 @@
                                                           nc);
         }
         else
-            guththila_xml_pull_parser_exception (p_FILE, LINE);
+            guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_INCORRECT_VERSION_INFO);
     }
     else
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_VERSION_INFO_NOT_FOUND);
     return 0;
 }
 
@@ -375,7 +379,7 @@
                                                       nc);
     }
     else
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_ENCODING_DECLARATION_ERROR);
     return 0;
 }
 
@@ -414,7 +418,7 @@
                 guththila_xml_pull_parser_next_char (environment, parser, 0)
                 || 's' != guththila_xml_pull_parser_next_char (environment,
                                                                parser, 0))
-                guththila_xml_pull_parser_exception (p_FILE, LINE);
+                guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_STANDALONE_ERROR_IN_YES);
             else
                 nc = guththila_xml_pull_parser_next_char (environment, parser,
                                                           0);
@@ -423,13 +427,13 @@
         {
             if ('o' !=
                 guththila_xml_pull_parser_next_char (environment, parser, 0))
-                guththila_xml_pull_parser_exception (p_FILE, LINE);
+	      guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_STANDALONE_ERROR_IN_NO);
             else
                 nc = guththila_xml_pull_parser_next_char (environment, parser,
                                                           0);
         }
         else
-            guththila_xml_pull_parser_exception (p_FILE, LINE);
+            guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_STANDALONE_ERROR_YES_OR_NO_NOT_AVAILABLE);
     }
     guththila_xml_pull_parser_close_token (environment, parser,
                                            _attribute_value, 0);
@@ -465,13 +469,13 @@
         {
             if ('>' !=
                 guththila_xml_pull_parser_next_char (environment, parser, 0))
-                guththila_xml_pull_parser_exception (p_FILE, LINE);
+                guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_MISSING_GREATER_SIGN_IN_XML_DECLARATION);
             else
-                guththila_event = GUTHTHILA_START_DOCUMENT;
+                parser->guththila_event = GUTHTHILA_START_DOCUMENT;
         }
     }
     else
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_INCORRECT_XML_DECLARATION);
     return 0;
 }
 
@@ -486,8 +490,8 @@
     parser->value = NULL;
     guththila_stack_clear (environment, parser->attrib);
     guththila_stack_clear (environment, parser->stack);
-    if (guththila_event == GUTHTHILA_END_ELEMENT
-        || guththila_event == GUTHTHILA_EMPTY_ELEMENT)
+    if (parser->guththila_event == GUTHTHILA_END_ELEMENT
+        || parser->guththila_event == GUTHTHILA_EMPTY_ELEMENT)
         guththila_xml_pull_parser_close_element (environment, parser);
 }
 
@@ -525,7 +529,7 @@
     x = guththila_xml_pull_parser_last_char (environment, parser);
     if (!guththila_xml_pull_parser_is_valid_starting_char
         (environment, parser, x[0]))
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_INVALID_NAME_STARTING_CHARACTER);
 
     guththila_xml_pull_parser_open_token (environment, parser);
     c = guththila_xml_pull_parser_next_char (environment, parser, 0);
@@ -574,7 +578,7 @@
         while ('<' != c || '&' != c);
     }
     else
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE,  GUTHTHILA_ERROR_QUOTES_NOT_FOUND_BEFORE_ATTRIBUTE_VALUE
);
     return c;
 }
 
@@ -604,17 +608,17 @@
     int c;
     c = guththila_xml_pull_parser_process_name (environment, parser);
     c = guththila_xml_pull_parser_skip_spaces (environment, parser, c);
-    guththila_event = GUTHTHILA_START_ELEMENT;
+    parser->guththila_event = GUTHTHILA_START_ELEMENT;
     for (;;)
     {
         if ('/' == c)
         {
-            guththila_event = GUTHTHILA_EMPTY_ELEMENT;
+            parser->guththila_event = GUTHTHILA_EMPTY_ELEMENT;
             if ('>' ==
                 guththila_xml_pull_parser_next_char (environment, parser, 0))
                 return c;
             else
-                guththila_xml_pull_parser_exception (p_FILE, LINE);
+                guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_EMPTY_ELEMENT_NOT_CLOSED);
         }
         else if ('>' == c)
             return c;
@@ -637,16 +641,16 @@
 {
     int c;
     int ref = 0;
-    int all_spaces = 1;
-/*  int last_event = guththila_event; */
-    guththila_event = GUTHTHILA_CHARACTER;
+    /*     int all_spaces = 1; */
+    /*  int last_event = parser->guththila_event; */
+    parser->guththila_event = GUTHTHILA_CHARACTER;
     guththila_xml_pull_parser_open_token (environment, parser);
     do
     {
         c = guththila_xml_pull_parser_next_char (environment, parser, -1);
 
-        if (c != '<')
-            all_spaces = (all_spaces && guththila_is_space (c));
+        /* if (c != '<') */
+	/*             all_spaces = (all_spaces && guththila_is_space (c)); */
 
         if (c == '&')
             ref = 1;
@@ -660,8 +664,8 @@
     }
     while (c != '<');
 
-    if (all_spaces)
-        guththila_event = GUTHTHILA_SPACE;
+    /*  if (all_spaces) */
+    /*         parser->guththila_event = GUTHTHILA_SPACE; */
     guththila_xml_pull_parser_close_token (environment, parser, _char_data,
                                            ref);
     return c;
@@ -669,7 +673,7 @@
 
 
 int
-guththila_xml_pull_parser_process_empty_tag (guththila_environment_t *
+guththila_xml_pull_parser_process_end_tag (guththila_environment_t *
                                              environment,
                                              guththila_xml_pull_parser_t *
                                              parser)
@@ -679,9 +683,9 @@
     c = guththila_xml_pull_parser_process_name (environment, parser);
     c = guththila_xml_pull_parser_skip_spaces (environment, parser, c);
     if ('>' == c)
-        guththila_event = GUTHTHILA_END_ELEMENT;
+        parser->guththila_event = GUTHTHILA_END_ELEMENT;
     else
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_END_TAG_NOT_CLOSED);
     return c;
 }
 
@@ -691,7 +695,7 @@
                                       guththila_xml_pull_parser_t * parser)
 {
     int c;
-    guththila_event = GUTHTHILA_COMMENT;
+    parser->guththila_event = GUTHTHILA_COMMENT;
     c = guththila_xml_pull_parser_next_char (environment, parser, 0);
     while ('<' != c)
         c = guththila_xml_pull_parser_next_char (environment, parser, 0);
@@ -724,7 +728,7 @@
                         guththila_xml_pull_parser_next_char (environment,
                                                              parser, 0))
                     {
-                        guththila_event = GUTHTHILA_COMMENT;
+                        parser->guththila_event = GUTHTHILA_COMMENT;
                         while ('<' != c)
                         {
                             c = guththila_xml_pull_parser_next_char
@@ -735,7 +739,7 @@
                         return c;
                     }
                     else
-                        guththila_xml_pull_parser_exception (p_FILE, LINE);
+                        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_MORE_HYPENS_OCCURED_IN_COMMENT);
                 }
             }
         }
@@ -801,7 +805,7 @@
                 if ('<' == c)
                 {
                     parser->status = S_4;
-                    return guththila_event;
+                    return parser->guththila_event;
                 }
                 else if ('\0' == c)
                     parser->status = S_3;
@@ -812,7 +816,7 @@
         case S_4:
             if ('/' == c)
             {
-                guththila_xml_pull_parser_process_empty_tag (environment,
+                guththila_xml_pull_parser_process_end_tag (environment,
                                                              parser);
                 parser->status = S_3;
             }
@@ -829,11 +833,11 @@
             }
             break;
         case S_0:
-            guththila_xml_pull_parser_exception (p_FILE, LINE);
+            guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_TOKENIZE_ERROR);
         }
     }
     while (parser->status != S_3);
-    return guththila_event;
+    return parser->guththila_event;
 }
 
 
@@ -944,7 +948,7 @@
                     }
                 }
                 else
-                    guththila_xml_pull_parser_exception (p_FILE, LINE);
+                    guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_INVALID_TOKEN_TYPE);
             }
             guththila_xml_pull_parser_open_element (environment, parser);
         }
@@ -973,7 +977,7 @@
         break;
 
     };
-    return guththila_event;
+    return parser->guththila_event;
 }
 
 
@@ -1136,7 +1140,7 @@
                                               guththila_attribute_t * att)
 {
     if (!att)
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_NULL_ATTRIBUTE_NAME);
     if (att->name->end)
         return guththila_token_to_string (environment, att->name,
                                           parser->unicode_state);
@@ -1152,7 +1156,7 @@
                                                guththila_attribute_t * att)
 {
     if (!att)
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_NULL_ATTRIBUTE_VALUE);
     if (att->value->end)
         return guththila_token_to_string (environment, att->value,
                                           parser->unicode_state);
@@ -1168,7 +1172,7 @@
                                                 guththila_attribute_t * att)
 {
     if (!att)
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_NULL_ATTRIBUTE_PREFIX);
     if (att->prefix->end)
         return guththila_token_to_string (environment, att->prefix,
                                           parser->unicode_state);
@@ -1184,7 +1188,7 @@
     guththila_element_t *e;
     guththila_attribute_t *att = NULL;
     if (i > ix)
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_REQUESTED_NUMBER_GREATER_THAN_STACK_SIZE);
     else
     {
         e = guththila_stack_last (environment, parser->attrib);
@@ -1209,7 +1213,7 @@
     guththila_element_t *e;
     guththila_attribute_t *att = NULL;
     if (i > ix)
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_REQUESTED_NUMBER_GREATER_THAN_STACK_SIZE);
     else
     {
         e = guththila_stack_last (environment, parser->attrib);
@@ -1234,7 +1238,7 @@
     guththila_element_t *e;
     guththila_attribute_t *att = NULL;
     if (i > ix)
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_REQUESTED_NUMBER_GREATER_THAN_STACK_SIZE);
     else
     {
         e = guththila_stack_last (environment, parser->attrib);
@@ -1269,7 +1273,8 @@
     if (parser->value->end)
         return guththila_token_to_string (environment, parser->value,
                                           parser->unicode_state);
-    return NULL;
+    else
+      return NULL;
 }
 
 
@@ -1347,7 +1352,7 @@
     guththila_element_t *e;
     guththila_namespace_t *ns = NULL;
     if (i > ix)
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_REQUESTED_NUMBER_GREATER_THAN_STACK_SIZE);
     else
     {
         e = guththila_stack_get (environment, parser->namesp, i);
@@ -1368,7 +1373,7 @@
     guththila_element_t *e;
     guththila_namespace_t *ns = NULL;
     if (i > ix)
-        guththila_xml_pull_parser_exception (p_FILE, LINE);
+        guththila_xml_pull_parser_exception (p_FILE, LINE, GUTHTHILA_ERROR_REQUESTED_NUMBER_GREATER_THAN_STACK_SIZE);
     else
     {
         e = guththila_stack_get (environment, parser->namesp, i);
@@ -1408,4 +1413,21 @@
         }
     }
     return 0;
+}
+
+GUTHTHILA_DECLARE (guththila_char_t *)
+     guththila_xml_pull_parser_get_encoding(guththila_environment_t *environment,
+				       guththila_xml_pull_parser_t *parser)
+{
+  switch (parser->unicode_state)
+    {
+    case None:
+      return "UTF-8";
+    case BE:
+      return "UTF-16";
+    case LE:
+      return "UTF-16";
+    default:
+      return (guththila_char_t *) GUTHTHILA_ERROR_INVALID_ENCODING_DECLARATION;
+    };
 }

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.h?rev=375848&r1=375847&r2=375848&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.h
(original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.h
Tue Feb  7 20:36:27 2006
@@ -44,16 +44,16 @@
  */
 
 enum guththila_status
-{
+  {
     S_0 = 0,
     S_1,
     S_2,
     S_3,
     S_4
-};
+  };
 
 enum guththila_event_types
-{
+  {
     GUTHTHILA_START_DOCUMENT = 0,
     GUTHTHILA_START_ELEMENT,
     GUTHTHILA_END_ELEMENT,
@@ -62,55 +62,56 @@
     GUTHTHILA_CHARACTER,
     GUTHTHILA_ENTITY_REFERANCE,
     GUTHTHILA_COMMENT
-};
+  };
+
 
-enum guththila_event_types guththila_event;
 
 
 typedef struct guththila_xml_pull_parser_s
 {
-    guththila_buffer_t *buffer;
-    guththila_reader_t *reader;
-    guththila_token_t *prefix;
-    guththila_token_t *name;
-    guththila_token_t *value;
-    guththila_stack_t *stack;
-    guththila_stack_t *attrib;
-    guththila_stack_t *namesp;
-    guththila_stack_t *dep;
-    int _next;
-    int offset;
-    int last;
-    int unicode_state;
-    enum guththila_status status;
+  guththila_buffer_t *buffer;
+  guththila_reader_t *reader;
+  guththila_token_t *prefix;
+  guththila_token_t *name;
+  guththila_token_t *value;
+  guththila_stack_t *stack;
+  guththila_stack_t *attrib;
+  guththila_stack_t *namesp;
+  guththila_stack_t *dep;
+  int _next;
+  int offset;
+  int last;
+  int unicode_state;
+  enum guththila_status status;
+  enum guththila_event_types guththila_event;
 } guththila_xml_pull_parser_t;
 
 
 GUTHTHILA_DECLARE (int)
-guththila_xml_pull_parser_read (guththila_environment_t * environment,
-                                guththila_xml_pull_parser_t * p);
+     guththila_xml_pull_parser_read (guththila_environment_t * environment,
+				     guththila_xml_pull_parser_t * p);
                                 
-int 
-guththila_xml_pull_parser_next_char (guththila_environment_t *environment,
-                                         guththila_xml_pull_parser_t * p,
-                                         int eof);
+     int 
+     guththila_xml_pull_parser_next_char (guththila_environment_t *environment,
+					  guththila_xml_pull_parser_t * p,
+					  int eof);
 
 int 
 guththila_xml_pull_parser_tokenize (guththila_environment_t *environment,
-                                        guththila_xml_pull_parser_t * p);
+				    guththila_xml_pull_parser_t * p);
                                         
                                         
 int 
-guththila_xml_pull_parser_exception (guththila_char_t * s, int line);
+guththila_xml_pull_parser_exception (guththila_char_t * s, int line, int error_code);
 
 int 
 guththila_xml_pull_parser_skip_spaces (guththila_environment_t *environment,
-                                           guththila_xml_pull_parser_t *p,
-                                           int c);
+				       guththila_xml_pull_parser_t *p,
+				       int c);
                                            
 int 
 guththila_xml_pull_parser_process_xml_decl(guththila_environment_t *environment,
-                                            guththila_xml_pull_parser_t * p);
+					   guththila_xml_pull_parser_t * p);
                                             
 int 
 guththila_xml_pull_parser_process_version_info(guththila_environment_t * environment,
@@ -152,11 +153,11 @@
                                          
 void 
 guththila_xml_pull_parser_add_attribute_with_prefix
-                                        (guththila_environment_t *environment,
-                                         guththila_xml_pull_parser_t *p,
-                                         guththila_token_t * prefix,
-                                         guththila_token_t * name,
-                                         guththila_token_t * value);
+(guththila_environment_t *environment,
+ guththila_xml_pull_parser_t *p,
+ guththila_token_t * prefix,
+ guththila_token_t * name,
+ guththila_token_t * value);
                                          
 int 
 guththila_xml_pull_parser_process_char_data (guththila_environment_t *environment,
@@ -164,8 +165,8 @@
                                              
 int 
 guththila_xml_pull_parser_process_space_tag_or_empty_element
-                                            (guththila_environment_t * environment,
-                                             guththila_xml_pull_parser_t *p);
+(guththila_environment_t * environment,
+ guththila_xml_pull_parser_t *p);
                                              
 int 
 guththila_xml_pull_parser_process_comment (guththila_environment_t *environment,
@@ -176,7 +177,7 @@
                                       guththila_xml_pull_parser_t *p);
                                       
 int 
-guththila_xml_pull_parser_process_empty_tag (guththila_environment_t *environment,
+guththila_xml_pull_parser_process_end_tag (guththila_environment_t *environment,
                                              guththila_xml_pull_parser_t *p);
                                              
 void 
@@ -194,9 +195,9 @@
                                              
 int 
 guththila_xml_pull_parser_process_attribute_value
-                                             (guththila_environment_t * environment,
-                                              guththila_xml_pull_parser_t * p,
-                                              int c);
+(guththila_environment_t * environment,
+ guththila_xml_pull_parser_t * p,
+ int c);
                                               
                                               
 int 
@@ -233,134 +234,139 @@
                                       
 int 
 guththila_xml_pull_parser_is_valid_starting_char 
-                                        (guththila_environment_t * environment,
-                                         guththila_xml_pull_parser_t * p,
-                                         int c);
+(guththila_environment_t * environment,
+ guththila_xml_pull_parser_t * p,
+ int c);
                                          
 
 GUTHTHILA_DECLARE (int)
-guththila_xml_pull_parser_next (guththila_environment_t * environment,
-                                guththila_xml_pull_parser_t * p);
+     guththila_xml_pull_parser_next (guththila_environment_t * environment,
+				     guththila_xml_pull_parser_t * p);
                                 
 GUTHTHILA_DECLARE (guththila_xml_pull_parser_t *)
-guththila_xml_pull_parser_create (guththila_environment_t * environment,
-                                  guththila_reader_t * r);
+     guththila_xml_pull_parser_create (guththila_environment_t * environment,
+				       guththila_reader_t * r);
                                   
 GUTHTHILA_DECLARE (void)
-guththila_xml_pull_parser_free (guththila_environment_t * environment,
-                                guththila_xml_pull_parser_t * parser);
-                                
+     guththila_xml_pull_parser_free (guththila_environment_t * environment,
+				     guththila_xml_pull_parser_t * parser);
+                               
 GUTHTHILA_DECLARE (int)
-guththila_xml_pull_parser_get_attribute_count 
-                                (guththila_environment_t * environment,
-                                 guththila_xml_pull_parser_t *p);
+  guththila_xml_pull_parser_get_attribute_count 
+     (guththila_environment_t * environment,
+      guththila_xml_pull_parser_t *p);
                                  
                                  
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_attribute_name 
-                                (guththila_environment_t *environment,
-                                 guththila_xml_pull_parser_t * p,
-                                 guththila_attribute_t * att);
+     guththila_xml_pull_parser_get_attribute_name 
+(guththila_environment_t *environment,
+ guththila_xml_pull_parser_t * p,
+ guththila_attribute_t * att);
                                  
                                  
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_attribute_value 
-                                (guththila_environment_t *environment,
-                                 guththila_xml_pull_parser_t *p,
-                                 guththila_attribute_t * att);
+     guththila_xml_pull_parser_get_attribute_value 
+(guththila_environment_t *environment,
+ guththila_xml_pull_parser_t *p,
+ guththila_attribute_t * att);
                                  
                                  
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_attribute_prefix 
-                                (guththila_environment_t *environment,
-                                 guththila_xml_pull_parser_t *p,
-                                 guththila_attribute_t * att);
+     guththila_xml_pull_parser_get_attribute_prefix 
+(guththila_environment_t *environment,
+ guththila_xml_pull_parser_t *p,
+ guththila_attribute_t * att);
                                  
                                  
 GUTHTHILA_DECLARE (guththila_attribute_t *)
-guththila_xml_pull_parser_get_attribute (guththila_environment_t *environment,
-                                         guththila_xml_pull_parser_t * p);
+     guththila_xml_pull_parser_get_attribute (guththila_environment_t *environment,
+					      guththila_xml_pull_parser_t * p);
                                          
                                          
-GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_attribute_name_by_number
-                                        (guththila_environment_t * environment,
-                                         guththila_xml_pull_parser_t * p,
-                                         int i);
+     GUTHTHILA_DECLARE (guththila_char_t *)
+     guththila_xml_pull_parser_get_attribute_name_by_number
+     (guththila_environment_t * environment,
+      guththila_xml_pull_parser_t * p,
+      int i);
                                          
                                          
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_attribute_value_by_number
-                                        (guththila_environment_t * environment,
-                                         guththila_xml_pull_parser_t * p,
-                                         int i);
+     guththila_xml_pull_parser_get_attribute_value_by_number
+(guththila_environment_t * environment,
+ guththila_xml_pull_parser_t * p,
+ int i);
                                          
                                          
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_attribute_prefix_by_number
-                                        (guththila_environment_t * environment,
-                                         guththila_xml_pull_parser_t * p,
-                                         int i);
+     guththila_xml_pull_parser_get_attribute_prefix_by_number
+(guththila_environment_t * environment,
+ guththila_xml_pull_parser_t * p,
+ int i);
                                          
                                          
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_name (guththila_environment_t * environment,
-                                    guththila_xml_pull_parser_t * p);
+     guththila_xml_pull_parser_get_name (guththila_environment_t * environment,
+					 guththila_xml_pull_parser_t * p);
                                     
                                     
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_prefix (guththila_environment_t * environment,
-                                      guththila_xml_pull_parser_t * p);
+     guththila_xml_pull_parser_get_prefix (guththila_environment_t * environment,
+					   guththila_xml_pull_parser_t * p);
                                       
                                       
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_value (guththila_environment_t * environment,
-                                     guththila_xml_pull_parser_t * p);
+     guththila_xml_pull_parser_get_value (guththila_environment_t * environment,
+					  guththila_xml_pull_parser_t * p);
                                      
                                      
 GUTHTHILA_DECLARE (guththila_namespace_t *)
-guththila_xml_pull_parser_get_namespace (guththila_environment_t *environment,
-                                         guththila_xml_pull_parser_t * p);
+     guththila_xml_pull_parser_get_namespace (guththila_environment_t *environment,
+					      guththila_xml_pull_parser_t * p);
                                          
                                          
 GUTHTHILA_DECLARE (int)
-guththila_xml_pull_parser_get_namespace_count 
-                                        (guththila_environment_t *environment,
-                                         guththila_xml_pull_parser_t *p);
+     guththila_xml_pull_parser_get_namespace_count 
+     (guththila_environment_t *environment,
+      guththila_xml_pull_parser_t *p);
                                          
                                          
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_namespace_uri 
-                                (guththila_environment_t *environment,
-                                 guththila_xml_pull_parser_t * p,
-                                 guththila_namespace_t * ns);
+     guththila_xml_pull_parser_get_namespace_uri 
+(guththila_environment_t *environment,
+ guththila_xml_pull_parser_t * p,
+ guththila_namespace_t * ns);
                                              
                                              
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_namespace_prefix 
-                                    (guththila_environment_t *environment,
-                                     guththila_xml_pull_parser_t *p,
-                                     guththila_namespace_t * ns);
+     guththila_xml_pull_parser_get_namespace_prefix 
+(guththila_environment_t *environment,
+ guththila_xml_pull_parser_t *p,
+ guththila_namespace_t * ns);
                                      
                                      
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_namespace_prefix_by_number
-                                    (guththila_environment_t * environment,
-                                     guththila_xml_pull_parser_t * p,
-                                     int i);
+     guththila_xml_pull_parser_get_namespace_prefix_by_number
+(guththila_environment_t * environment,
+ guththila_xml_pull_parser_t * p,
+ int i);
                                      
                                      
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_namespace_uri_by_number 
-                                      (guththila_environment_t *environment,
-                                       guththila_xml_pull_parser_t * p,
-                                       int i);
+     guththila_xml_pull_parser_get_namespace_uri_by_number 
+(guththila_environment_t *environment,
+ guththila_xml_pull_parser_t * p,
+ int i);
                                        
                                        
 GUTHTHILA_DECLARE (guththila_char_t *)
-guththila_xml_pull_parser_get_attribute_namespace_by_number
-                                      (guththila_environment_t * environment,
-                                       guththila_xml_pull_parser_t * p,
-                                       int i);
+     guththila_xml_pull_parser_get_attribute_namespace_by_number
+(guththila_environment_t * environment,
+ guththila_xml_pull_parser_t * p,
+ int i);
+
+GUTHTHILA_DECLARE (guththila_char_t *)
+     guththila_xml_pull_parser_get_encoding 
+(guththila_environment_t *environment,
+ guththila_xml_pull_parser_t *p);
 
 #endif /* GUTHTHILA_XML_PULL_PARSER_H */



Mime
View raw message