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/11/23 03:46:17 UTC

svn commit: r348344 - in /webservices/axis2/trunk/c/modules: test/om/src/ xml/om/src/ xml/parser/ xml/parser/guththila/impl/src/ xml/parser/guththila/src/ xml/parser/guththila/test/ xml/parser/libxml2/test/

Author: samisa
Date: Tue Nov 22 18:45:59 2005
New Revision: 348344

URL: http://svn.apache.org/viewcvs?rev=348344&view=rev
Log:
doc comments added 

Modified:
    webservices/axis2/trunk/c/modules/test/om/src/test_om.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c
    webservices/axis2/trunk/c/modules/xml/parser/axis2_xml_writer.h
    webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.c
    webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_xml_pull_parser.c
    webservices/axis2/trunk/c/modules/xml/parser/guththila/src/axis2_guththila_wrapper.c
    webservices/axis2/trunk/c/modules/xml/parser/guththila/test/guththila_test.c
    webservices/axis2/trunk/c/modules/xml/parser/libxml2/test/libxml_test.c

Modified: webservices/axis2/trunk/c/modules/test/om/src/test_om.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/om/src/test_om.c?rev=348344&r1=348343&r2=348344&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/om/src/test_om.c (original)
+++ webservices/axis2/trunk/c/modules/test/om/src/test_om.c Tue Nov 22 18:45:59 2005
@@ -124,8 +124,10 @@
     om_output = axis2_om_output_create (&environment, NULL);
     AXIS2_OM_NODE_SERIALIZE (AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT(document, &environment), &environment , om_output);
     AXIS2_OM_DOCUMENT_FREE(document, &environment); 
-    axis2_om_output_free(om_output, &environment);
-    AXIS2_OM_STAX_BUILDER_FREE(builder, &environment); 
+    axis2_om_output_free(om_output, &environment);  
+    AXIS2_OM_STAX_BUILDER_FREE(builder, &environment);
+  
+    AXIS2_PULL_PARSER_FREE(pull_parser, &environment);    
     
 
     
@@ -227,10 +229,9 @@
     stream = axis2_stream_create(allocator, NULL);
     
     environment = axis2_env_create_with_error_stream_log(allocator, error, stream, log);
-
     test_om_build (file_name);
-    test_om_serialize ();  
+    test_om_serialize (); 
 
-    axis2_env_free(environment);
+    axis2_env_free(environment); 
     getchar();    
  }

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c?rev=348344&r1=348343&r2=348344&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c Tue Nov 22 18:45:59 2005
@@ -36,7 +36,7 @@
     om_output->xml_writer = NULL;
     if(xml_writer)
     {
-    om_output->xml_writer = xml_writer;
+        om_output->xml_writer = xml_writer;
     }
     else
     {
@@ -44,8 +44,11 @@
                                                         DEFAULT_CHAR_SET_ENCODING,
                                                         AXIS2_TRUE,
                                                         0);
-        if(!(om_output->xml_writer)) 
-            printf(" writer null");
+        if(!(om_output->xml_writer))
+        {
+            AXIS2_FREE((*env)->allocator, om_output);
+            AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        }
     }
     om_output->do_optimize = AXIS2_FALSE;
     om_output->mime_boundary = 0;

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c?rev=348344&r1=348343&r2=348344&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c Tue Nov 22 18:45:59 2005
@@ -85,7 +85,7 @@
 													
 AXIS2_DECLARE(axis2_om_stax_builder_t *)
 axis2_om_stax_builder_create (axis2_env_t **env,
-                                       axis2_pull_parser_t *parser)
+                              axis2_pull_parser_t *parser)
 {
     axis2_om_stax_builder_impl_t *builder = NULL;
     AXIS2_ENV_CHECK(env, NULL);
@@ -702,10 +702,6 @@
                                       axis2_env_t **env)
 {
     AXIS2_FUNC_PARAM_CHECK(builder, env, AXIS2_FAILURE);
- 	if(AXIS2_INTF_TO_IMPL(builder)->parser)
-    {
-		AXIS2_PULL_PARSER_FREE(AXIS2_INTF_TO_IMPL(builder)->parser, env);
-    }   
 	if(builder->ops)
 		AXIS2_FREE ((*env)->allocator,builder->ops);
 	AXIS2_FREE ((*env)->allocator, AXIS2_INTF_TO_IMPL(builder));

Modified: webservices/axis2/trunk/c/modules/xml/parser/axis2_xml_writer.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/axis2_xml_writer.h?rev=348344&r1=348343&r2=348344&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/axis2_xml_writer.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/axis2_xml_writer.h Tue Nov 22 18:45:59 2005
@@ -60,28 +60,53 @@
         axis2_status_t (AXIS2_CALL *free)(axis2_xml_writer_t *writer,
                                           axis2_env_t **env);
        /**
-        *  Write the localname of an xml element
-        * 
-        *   
+        *  Write a start tag to output stream with localname.
+        *  Internally the writer keeps track of the opened tags 
+        *  @param writer pointer to xml writer struct
+        *  @param env environment. MUST NOT be NULL.
+        *  @param localname localname of the tag, May not be NULL.
+        *  @return the status of the operation, AXIS2_SUCCESS on success
+                    AXIS2_FAILURE on error.
         */
         axis2_status_t (AXIS2_CALL *write_start_element)(
                                     axis2_xml_writer_t *writer,
                                     axis2_env_t **env, axis2_char_t *localname);
        /**
-        *        writer end part of start element
+        *  write an end tag to the output relying on the internal
+        *  state of writer to determine the prefix and localname of
+        *  the element
+        *  @param writer xml_writer struct
+        *  @param env environment, MUST NOT be NULL.
+        *  @return status of the operation. AXIS2_SUCCESS on success.
+        *           AXIS2_FAILURE on error.
         */
         axis2_status_t (AXIS2_CALL *end_start_element)(axis2_xml_writer_t *writer,
                                                        axis2_env_t **env);
         /**
-         * Write element with namespace uri
+         * Write an element tag with localname and namespace uri 
+         * @param writer pointer to xml writer struct
+         * @param env environment struct
+         * @param localname localname of the tag, May not be null.
+         * @param namespace_uri the namespace URI of the the pefix
+         *        to use.may not be null.
+         * @returns status of the operation, AXIS2_SUCCESS on success.
+         *          AXIS2_FAILURE on error
          */
         axis2_status_t (AXIS2_CALL *write_start_element_with_namespace)(
                                         axis2_xml_writer_t *writer,
                                         axis2_env_t **env,
                                         axis2_char_t *localname,
                                         axis2_char_t *namespace_uri);
+       
         /**
-         * Write element with namespace uri and prefix
+         * write a start tag to output
+         * @param writer pointer to xml_writer struct
+         * @param environment, MUST NOT be NULL.
+         * @param localname localname of the tag, May not be null.
+         * @param namespace_uri namespace to bind the prefix to
+         * @param prefix the prefix to the tag.May not be NULL.
+         * @return status of the operation 
+                   AXIS2_SUCCESS on success. AXIS2_FAILURE on error.
          */
         axis2_status_t (AXIS2_CALL *write_start_element_with_namespace_prefix)(
                                         axis2_xml_writer_t *writer,

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.c?rev=348344&r1=348343&r2=348344&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.c Tue Nov 22 18:45:59 2005
@@ -95,14 +95,15 @@
         
     if(r->guththila_reader_type == GUTHTHILA_IN_MEMORY_READER);
     {
-        GUTHTHILA_FREE(environment->allocator,(guththila_memory_reader_impl_t*)r);
+        GUTHTHILA_FREE(environment->allocator,(guththila_memory_reader_impl_t*)r); 
     }
     if(r->guththila_reader_type == GUTHTHILA_FILE_READER)
-    {
+    {   
         if(((guththila_file_reader_impl_t*)r)->fp)
             fclose(((guththila_file_reader_impl_t*)r)->fp);
-        GUTHTHILA_FREE(environment->allocator, (guththila_file_reader_impl_t*)r);
+        GUTHTHILA_FREE(environment->allocator, (guththila_file_reader_impl_t*)r); 
     }
+    
     return;    
 }
 

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=348344&r1=348343&r2=348344&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 Nov 22 18:45:59 2005
@@ -60,8 +60,6 @@
 {
     if (parser->buffer)
         guththila_buffer_free (environment, (void *) parser->buffer);
-    if (parser->reader)
-        GUTHTHILA_FREE (environment->allocator, parser->reader);
     if (parser->stack)
         guththila_stack_free (environment, parser->stack);
     if (parser->attrib)

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/src/axis2_guththila_wrapper.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/src/axis2_guththila_wrapper.c?rev=348344&r1=348343&r2=348344&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/src/axis2_guththila_wrapper.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/src/axis2_guththila_wrapper.c Tue Nov 22 18:45:59 2005
@@ -114,6 +114,7 @@
     axis2_pull_parser_t parser;    
     guththila_xml_pull_parser_t *guththila_parser;
     guththila_environment_t *guththila_env;
+    guththila_reader_t *reader;
     int event_map[10];
     
 }axis2_guththila_wrapper_impl_t;
@@ -154,7 +155,6 @@
     axis2_guththila_wrapper_impl_t *guththila_impl = NULL;
     guththila_allocator_t *allocator = NULL;
     guththila_environment_t *guththila_env = NULL;
-    guththila_reader_t *reader = NULL;
     guththila_xml_pull_parser_t *guththila = NULL;
     
     AXIS2_ENV_CHECK(env, NULL);
@@ -168,19 +168,20 @@
     allocator = guththila_allocator_init(NULL);
     guththila_env  = guththila_environment_create(allocator,NULL, NULL);
     
-    reader = guththila_reader_create_for_file(guththila_env, filename);
+    guththila_impl->reader = 
+            guththila_reader_create_for_file(guththila_env, filename);
     
-    if(!reader)
+    if(!(guththila_impl->reader))
     {
         AXIS2_FREE((*env)->allocator,guththila_impl);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
     }    
     
-    guththila = guththila_xml_pull_parser_create(guththila_env,reader);
+    guththila = guththila_xml_pull_parser_create(guththila_env,
+                                            guththila_impl->reader);
     if(!guththila)
     {
         AXIS2_FREE((*env)->allocator,guththila_impl);
-        AXIS2_FREE((*env)->allocator,reader);
         AXIS2_ERROR_SET((*env)->error,AXIS2_ERROR_NO_MEMORY, NULL);
     }
     
@@ -194,7 +195,6 @@
     if(!(guththila_impl->parser.ops))
     {   guththila_xml_pull_parser_free( guththila_env, guththila);
         AXIS2_FREE((*env)->allocator,guththila_impl);
-        AXIS2_FREE((*env)->allocator,reader);
         AXIS2_ERROR_SET((*env)->error,AXIS2_ERROR_NO_MEMORY, NULL);
     }
     
@@ -248,7 +248,6 @@
     axis2_guththila_wrapper_impl_t *guththila_impl = NULL;
     guththila_allocator_t *allocator = NULL;
     guththila_environment_t *guththila_env = NULL;
-    guththila_reader_t *reader = NULL;
     guththila_xml_pull_parser_t *guththila = NULL;
     
     AXIS2_ENV_CHECK(env, NULL);
@@ -263,20 +262,20 @@
     guththila_env  = guththila_environment_create(allocator,NULL, NULL);
     
     /*-------difference of two create function is here--------*/
-    reader = guththila_reader_create_for_memory(guththila_env,
-                     read_input_callback); 
+    guththila_impl->reader = 
+        guththila_reader_create_for_memory(guththila_env,read_input_callback); 
                                                    
-    if(!reader)
+    if(!(guththila_impl->reader))
     {
         AXIS2_FREE((*env)->allocator,guththila_impl);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
     }    
     
-    guththila = guththila_xml_pull_parser_create(guththila_env,reader);
+    guththila = guththila_xml_pull_parser_create(guththila_env,
+                                                guththila_impl->reader);
     if(!guththila)
     {
         AXIS2_FREE((*env)->allocator,guththila_impl);
-        AXIS2_FREE((*env)->allocator,reader);
         AXIS2_ERROR_SET((*env)->error,AXIS2_ERROR_NO_MEMORY, NULL);
     }
     
@@ -290,7 +289,6 @@
     if(!(guththila_impl->parser.ops))
     {   guththila_xml_pull_parser_free( guththila_env, guththila);
         AXIS2_FREE((*env)->allocator,guththila_impl);
-        AXIS2_FREE((*env)->allocator,reader);
         AXIS2_ERROR_SET((*env)->error,AXIS2_ERROR_NO_MEMORY, NULL);
     }
     
@@ -347,17 +345,23 @@
 axis2_guththila_wrapper_free(axis2_pull_parser_t *parser,
                              axis2_env_t **env)
 {
+    axis2_guththila_wrapper_impl_t *parser_impl = NULL;
     AXIS2_FUNC_PARAM_CHECK(parser,env,AXIS2_FAILURE);
-    if(AXIS2_INTF_TO_IMPL(parser)->guththila_parser)
-      /*  guththila_xml_pull_parser_free(
-                    AXIS2_INTF_TO_IMPL(parser)->guththila_env,
-                    AXIS2_INTF_TO_IMPL(parser)->guththila_parser);
-        */            
-   // guththila_environment_free((*env)->allocator, AXIS2_INTF_TO_IMPL(parser)->guththila_env);
+    parser_impl = AXIS2_INTF_TO_IMPL(parser);
+    if(parser_impl->reader)
+        guththila_reader_free(parser_impl->guththila_env,
+                              parser_impl->reader);    
+    
+    if(parser_impl->guththila_parser)
+        guththila_xml_pull_parser_free(
+                    parser_impl->guththila_env,
+                    parser_impl->guththila_parser);
+                  
+    guththila_environment_free(parser_impl->guththila_env);
     
     if(parser->ops)
         AXIS2_FREE((*env)->allocator, parser->ops);
-    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(parser));
+    AXIS2_FREE((*env)->allocator, parser_impl);
     return AXIS2_SUCCESS;   
 }
            

Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/test/guththila_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/test/guththila_test.c?rev=348344&r1=348343&r2=348344&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/test/guththila_test.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/test/guththila_test.c Tue Nov 22 18:45:59 2005
@@ -42,10 +42,13 @@
         filename = argv[1];
     
     f =fopen(filename,"r");
+    if(!f)
+        return;
+    
     allocator = guththila_allocator_init(NULL);
     env       = guththila_environment_create(allocator,NULL,NULL);
   
-    reader_mem = guththila_reader_create_for_memory(env, read_input, close_input);
+    reader_mem = guththila_reader_create_for_memory(env, read_input);
     parser = guththila_xml_pull_parser_create(env,reader_mem);
     guththila_xml_pull_parser_read(env,parser);
 
@@ -171,7 +174,7 @@
 
 printf("\n");
 guththila_xml_pull_parser_free(env,parser);
-
+guththila_reader_free(env,reader_mem);
 
 
 

Modified: webservices/axis2/trunk/c/modules/xml/parser/libxml2/test/libxml_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/libxml2/test/libxml_test.c?rev=348344&r1=348343&r2=348344&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/libxml2/test/libxml_test.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/libxml2/test/libxml_test.c Tue Nov 22 18:45:59 2005
@@ -1,6 +1,9 @@
 #include <axis2_pull_parser.h>
 #include <axis2_env.h>
 #include <axis2_defines.h>
+#include <axis2_stream_default.h>
+#include <axis2_log_default.h>
+#include <axis2_error_default.h>
 #include <axis2.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -10,6 +13,9 @@
     axis2_env_t *env = NULL;
     axis2_allocator_t *allocator = NULL;
     axis2_pull_parser_t *parser = NULL;
+    axis2_stream_t *stream = NULL;
+    axis2_error_t *error = NULL;
+    axis2_log_t *log     = NULL;
     int token = 0;
     char *p = NULL;
     int attr_count =0;
@@ -20,7 +26,10 @@
         filename = argv[1];
     
     allocator = axis2_allocator_init(NULL);
-    env       = axis2_env_create(allocator);
+    log = axis2_log_create(allocator, NULL);
+    error = axis2_error_create(allocator);
+    stream = axis2_stream_create(allocator, NULL);
+    env       = axis2_env_create_with_error_stream_log(allocator, error, stream, log);
     parser = axis2_pull_parser_create_for_file(&env,filename,NULL);
     
     printf("running test\n\n\n");
@@ -184,5 +193,6 @@
     AXIS2_PULL_PARSER_FREE(parser, &env);
     axis2_env_free(env);
     printf("\n\n");
+    getchar();
     return 0;
 }