axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nand...@apache.org
Subject svn commit: r450420 [2/2] - /webservices/axis2/trunk/c/tools/codegen/src/util/
Date Wed, 27 Sep 2006 12:39:32 GMT
Modified: webservices/axis2/trunk/c/tools/codegen/src/util/cqname2name_maker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/cqname2name_maker.c?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/cqname2name_maker.c (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/cqname2name_maker.c Wed Sep 27 05:39:31 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+ 
 #include <w2c_cqname2name_maker.h>
 #include <axis2_hash.h>
 #include <axis2_string.h>
@@ -24,7 +24,7 @@
 #define W2C_TYPEMAPPER_UPPER_PARAM_LIMIT 1000
 #define W2C_TYPEMAPPER_PARAM_SUFFIX "param"
 
-/**
+/** 
  * @brief
  */
 typedef struct w2c_cqname2name_maker_impl
@@ -33,113 +33,112 @@
 
     axis2_hash_t *qname2name;
     axis2_hash_t *name2number;
-
-}
-w2c_cqname2name_maker_impl_t;
+       
+} w2c_cqname2name_maker_impl_t;
 
 #define W2C_INTF_TO_IMPL(cqname2name_maker) \
     ((w2c_cqname2name_maker_impl_t *) cqname2name_maker)
 
 /************************* Function prototypes ********************************/
 
-axis2_status_t AXIS2_CALL
-w2c_cqname2name_maker_free(w2c_cqname2name_maker_t *cqname2name_maker,
-        const axis2_env_t *env);
+axis2_status_t AXIS2_CALL 
+w2c_cqname2name_maker_free (w2c_cqname2name_maker_t *cqname2name_maker, 
+           const axis2_env_t *env);
 
 axis2_char_t* AXIS2_CALL
 w2c_cqname2name_maker_suggest_name(w2c_cqname2name_maker_t *cqname2name_maker,
-        const axis2_env_t *env,
-        axis2_qname_t *qname);
+            const axis2_env_t *env,
+            axis2_qname_t *qname);
 
 /************************** End of function prototypes ************************/
 
-AXIS2_EXTERN w2c_cqname2name_maker_t * AXIS2_CALL
-w2c_cqname2name_maker_create(const axis2_env_t *env)
+AXIS2_EXTERN w2c_cqname2name_maker_t * AXIS2_CALL 
+w2c_cqname2name_maker_create (const axis2_env_t *env)
 {
     w2c_cqname2name_maker_impl_t *cqname2name_maker_impl = NULL;
-
+   
     AXIS2_ENV_CHECK(env, NULL);
 
     cqname2name_maker_impl = (w2c_cqname2name_maker_impl_t *) AXIS2_MALLOC(env->
-            allocator, sizeof(w2c_cqname2name_maker_impl_t));
+               allocator, sizeof(w2c_cqname2name_maker_impl_t));
 
-    if (NULL == cqname2name_maker_impl)
+    if(NULL == cqname2name_maker_impl)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
         return NULL;
     }
     cqname2name_maker_impl->qname2name = axis2_hash_make(env);
     cqname2name_maker_impl->name2number = axis2_hash_make(env);
-
-    cqname2name_maker_impl->cqname2name_maker.ops =
-        AXIS2_MALLOC(env->allocator, sizeof(w2c_cqname2name_maker_ops_t));
-    if (NULL == cqname2name_maker_impl->cqname2name_maker.ops)
+    
+    cqname2name_maker_impl->cqname2name_maker.ops = 
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_cqname2name_maker_ops_t));
+    if(NULL == cqname2name_maker_impl->cqname2name_maker.ops)
     {
         w2c_cqname2name_maker_free(&(cqname2name_maker_impl->cqname2name_maker), env);
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
-
+    
     cqname2name_maker_impl->cqname2name_maker.ops->free = w2c_cqname2name_maker_free;
-    cqname2name_maker_impl->cqname2name_maker.ops->suggest_name =
-        w2c_cqname2name_maker_suggest_name;
+    cqname2name_maker_impl->cqname2name_maker.ops->suggest_name= 
+                                        w2c_cqname2name_maker_suggest_name;
 
     return &(cqname2name_maker_impl->cqname2name_maker);
 }
 
 /***************************Function implementation****************************/
 
-axis2_status_t AXIS2_CALL
-w2c_cqname2name_maker_free(w2c_cqname2name_maker_t *cqname2name_maker,
-        const axis2_env_t *env)
+axis2_status_t AXIS2_CALL 
+w2c_cqname2name_maker_free (w2c_cqname2name_maker_t *cqname2name_maker, 
+                            const axis2_env_t *env)
 {
     w2c_cqname2name_maker_impl_t *cqname2name_maker_impl = NULL;
-
+ 
     axis2_char_t *key = NULL;
-    axis2_char_t *value = NULL;
+    axis2_char_t *value =NULL;
     axis2_hash_index_t *hi = NULL;
     axis2_hash_t *h = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+    
     cqname2name_maker_impl = W2C_INTF_TO_IMPL(cqname2name_maker);
     h = cqname2name_maker_impl-> qname2name;
-
+    
     for (hi = axis2_hash_first(h, env) ;
-            hi; hi = axis2_hash_next(env, hi))
+                hi; hi = axis2_hash_next(env, hi))
     {
         axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
         if (key)
-            AXIS2_FREE(env-> allocator, key);
+            AXIS2_FREE( env-> allocator, key);
         if (value)
-            AXIS2_FREE(env-> allocator, value);
+            AXIS2_FREE( env-> allocator, value); 
     }
-    axis2_hash_free(h , env);
-
-    axis2_hash_free(cqname2name_maker_impl-> name2number, env);
-
-    if (cqname2name_maker->ops)
+    axis2_hash_free( h , env);
+ 
+    axis2_hash_free( cqname2name_maker_impl-> name2number, env);
+       
+    if(cqname2name_maker->ops)
     {
         AXIS2_FREE(env->allocator, cqname2name_maker->ops);
         cqname2name_maker->ops = NULL;
     }
-    if (cqname2name_maker_impl)
+    if(cqname2name_maker_impl)
     {
         AXIS2_FREE(env->allocator, cqname2name_maker_impl);
         cqname2name_maker_impl = NULL;
     }
-
+    
     return AXIS2_SUCCESS;
 }
 
 
 axis2_char_t* AXIS2_CALL
 w2c_cqname2name_maker_suggest_name(w2c_cqname2name_maker_t *cqname2name_maker,
-        const axis2_env_t *env,
-        axis2_qname_t *qname)
+            const axis2_env_t *env,
+            axis2_qname_t *qname)
 {
     w2c_cqname2name_maker_impl_t *cqname2name_maker_impl = NULL;
-
+ 
     axis2_char_t *key = NULL;
     axis2_char_t *local = NULL;
     int counter = 0;
@@ -147,33 +146,33 @@
     axis2_char_t *given_name = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+    
     cqname2name_maker_impl = W2C_INTF_TO_IMPL(cqname2name_maker);
 
     key = AXIS2_QNAME_TO_STRING(qname, env);
-    local = (axis2_char_t*)axis2_hash_get(cqname2name_maker_impl-> qname2name, key,
-            AXIS2_HASH_KEY_STRING);
-    if (local) /* key has been there somewhere */
+    local = (axis2_char_t*)axis2_hash_get( cqname2name_maker_impl-> qname2name, key,
+                         AXIS2_HASH_KEY_STRING );
+    if( local != NULL) /* key has been there somewhere */
     {
         return local;
     }
     /* otherwise */
-    local = AXIS2_QNAME_GET_LOCALPART(qname, env);
-    counter = (int)axis2_hash_get(cqname2name_maker_impl-> name2number, local,
-            AXIS2_HASH_KEY_STRING);
-    if (counter == 0) /** this means name doesnt exist */
+    local = AXIS2_QNAME_GET_LOCALPART( qname, env);
+    counter = (int)axis2_hash_get( cqname2name_maker_impl-> name2number, local,
+                         AXIS2_HASH_KEY_STRING );
+    if ( counter == 0 ) /** this means name doesnt exist */
     {
         axis2_hash_set(cqname2name_maker_impl-> qname2name, key, AXIS2_HASH_KEY_STRING, local);
-        axis2_hash_set(cqname2name_maker_impl-> name2number, local, AXIS2_HASH_KEY_STRING, (void*)1);
+        axis2_hash_set( cqname2name_maker_impl-> name2number, local, AXIS2_HASH_KEY_STRING, (void*)1);
         return local;
     }
-    /* else qname would already exist */
+    /* else qname would already exist */ 
     sprintf(counter_str, "%d", counter);
-    given_name = axis2_stracat(local, counter_str, env);
+    given_name = axis2_stracat( local, counter_str, env);
 
-    axis2_hash_set(cqname2name_maker_impl-> qname2name, key, AXIS2_HASH_KEY_STRING, given_name);
-    axis2_hash_set(cqname2name_maker_impl-> name2number, local, AXIS2_HASH_KEY_STRING, (void*)counter + 1);
+    axis2_hash_set( cqname2name_maker_impl-> qname2name, key, AXIS2_HASH_KEY_STRING, given_name);
+    axis2_hash_set( cqname2name_maker_impl-> name2number, local, AXIS2_HASH_KEY_STRING, (void*)counter+1);
 
-    return given_name;
+    return given_name;    
 }
 

Modified: webservices/axis2/trunk/c/tools/codegen/src/util/file_writer.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/file_writer.c?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/file_writer.c (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/file_writer.c Wed Sep 27 05:39:31 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+ 
 #include <w2c_xslt_utils.h>
 #include <w2c_string.h>
 #include <platforms/axis2_platform_auto_sense.h>
@@ -22,44 +22,44 @@
 
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-w2c_file_writer_create_classfile_name(
+w2c_file_writer_create_classfile_name (
     const axis2_env_t *env,
     axis2_char_t *root_location,
     axis2_char_t *package_name,
     axis2_char_t *filename,
-    axis2_char_t *extension)
+    axis2_char_t *extension )
 {
     axis2_char_t *full_path = NULL;
     axis2_char_t *cp = NULL;
     axis2_bool_t end = AXIS2_FALSE;
     int error = 0;
     int length = 0;
-
-    if (NULL == root_location)
+        
+    if ( NULL == root_location )
     {
-        full_path = AXIS2_STRDUP(".", env);
+        full_path= AXIS2_STRDUP ( ".", env);
     }
     else
     {
-        full_path = AXIS2_STRDUP(root_location, env);
-        for (end = AXIS2_FALSE, cp = full_path; 1; cp ++)
+        full_path = AXIS2_STRDUP ( root_location,env );
+        for ( end = AXIS2_FALSE, cp = full_path; 1; cp ++)
         {
-            if (*cp == '\0')
+            if ( *cp == '\0' )
             {
                 end = AXIS2_TRUE;
             }
-            else if (*cp != AXIS2_PATH_SEP_CHAR)
+            else if ( *cp != AXIS2_PATH_SEP_CHAR)
             {
                 continue;
             }
             *cp = '\0';
             /* TODO: this should be placed in platform */
-            error = mkdir(full_path, 0755);
-            if (end)
+            error = mkdir ( full_path, 0755 ); 
+            if ( end )
             {
-                if (cp != full_path && *(cp - 1) == AXIS2_PATH_SEP_CHAR)
+                if ( cp != full_path && *(cp-1) == AXIS2_PATH_SEP_CHAR )
                 {
-                    *(cp - 1) = '\0';
+                    *(cp-1) = '\0';
                 }
                 break;
             }
@@ -70,29 +70,29 @@
         }
     }
     /* to seperate root location and package path */
-    full_path = w2c_string_add_string(full_path, AXIS2_PATH_SEP_STR, env);
+    full_path = w2c_string_add_string ( full_path, AXIS2_PATH_SEP_STR, env );
 
     /* this is related to adding folder hiearchy corrosponding to the package */
-    if (package_name && *package_name != '\0')
+    if ( package_name && *package_name != '\0')
     {
-        length = AXIS2_STRLEN(full_path);
-        full_path = w2c_string_add_string(full_path, package_name, env);
+        length = AXIS2_STRLEN ( full_path );
+        full_path = w2c_string_add_string ( full_path, package_name, env);
 
         /* the loop wil start from the package name */
-        for (end = AXIS2_FALSE, cp = full_path + length; 1; cp ++)
+        for ( end = AXIS2_FALSE, cp = full_path + length; 1; cp ++)
         {
-            if (*cp == '\0')
+            if ( *cp == '\0' )
             {
                 end = AXIS2_TRUE;
             }
-            else if (*cp != '.')
+            else if ( *cp !='.' )
             {
                 continue;
             }
             *cp = '\0';
             /* TODO:this should be placed in platform */
-            error = mkdir(full_path, 0755);
-            if (end)
+            error = mkdir ( full_path, 0755 ); 
+            if ( end )
             {
                 break;
             }
@@ -101,10 +101,10 @@
                 *cp = AXIS2_PATH_SEP_CHAR;
             }
         }
-        full_path = w2c_string_add_string(full_path, AXIS2_PATH_SEP_STR, env);
+        full_path = w2c_string_add_string ( full_path, AXIS2_PATH_SEP_STR, env );
     }
-    full_path = w2c_string_add_string(full_path, filename, env);
-    full_path = w2c_string_add_string(full_path, extension, env);/* extension has the .*/
+    full_path = w2c_string_add_string ( full_path, filename, env);
+    full_path = w2c_string_add_string ( full_path, extension, env );/* extension has the .*/
 
     return full_path;
 }

Modified: webservices/axis2/trunk/c/tools/codegen/src/util/messages.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/messages.c?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/messages.c (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/messages.c Wed Sep 27 05:39:31 2006
@@ -13,10 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+ 
 #include <w2c_messages.h>
-/*#include <w2c_property_parser.h>
-#include <w2c_property.h>*/
 #include <axis2_property.h>
 #include <axis2_hash.h>
 #include <axis2_string.h>
@@ -26,82 +24,82 @@
 
 AXIS2_EXTERN axis2_properties_t* AXIS2_CALL
 w2c_messages_get_message_properties(
-    const axis2_env_t *env)
+    const axis2_env_t *env )
 {
     axis2_properties_t *props = NULL;
     axis2_char_t *axis2c_home = NULL;
     axis2_char_t *filename = NULL;
-    axis2_char_t *filepath = NULL;
-    axis2_char_t *inter_path = NULL;
+    axis2_char_t *filepath= NULL;
+    axis2_char_t *inter_path= NULL;
     int path_len = 0;
     FILE *f = NULL;
-
-    axis2c_home = getenv("AXIS2C_HOME");
-    if (axis2c_home == NULL)
+   
+    axis2c_home = getenv( "AXIS2C_HOME");
+    if ( axis2c_home == NULL )
     {
-        fprintf(stderr, "failed to pick AXIS2C_HOME\n");
+        fprintf(stderr,"failed to pick AXIS2C_HOME\n" );
         return NULL;
     }
     inter_path = W2C_MESSAGES_INTER_PATH;
     filename = W2C_MESSAGES_FILENAME;
-
-    path_len = AXIS2_STRLEN(filename) + AXIS2_STRLEN(axis2c_home)
-            + AXIS2_STRLEN(inter_path)
-            + 2; /* for seperator and null char */
-    filepath = AXIS2_MALLOC(env-> allocator, path_len * sizeof(axis2_char_t));
-    sprintf(filepath, "%s%s%s", axis2c_home, inter_path, filename);
-
-    f = fopen(filepath, "r+");
+    
+    path_len = AXIS2_STRLEN ( filename ) + AXIS2_STRLEN (axis2c_home )
+               + AXIS2_STRLEN ( inter_path ) 
+               + 2; /* for seperator and null char */
+    filepath = AXIS2_MALLOC ( env-> allocator, path_len* sizeof(axis2_char_t) );
+    sprintf ( filepath, "%s%s%s", axis2c_home, inter_path, filename );
+  
+    f = fopen( filepath, "r+");
     props = axis2_properties_create(env);
-    AXIS2_PROPERTIES_LOAD(props, env, f);
+    AXIS2_PROPERTIES_LOAD( props, env, f); 
     fclose(f);
 
     return props;
 }
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-w2c_messages_get_message(const axis2_env_t *env, axis2_char_t *key)
+w2c_messages_get_message( const axis2_env_t *env, axis2_char_t *key )
 {
-    axis2_properties_t *props = NULL;
-    axis2_char_t *message = NULL;
-
-    props = w2c_messages_get_message_properties(env);
-    message = AXIS2_PROPERTIES_GET_PROPERTY(props, env, key);
-    if (message)
-    {
-        message = AXIS2_STRDUP(message, env);
-    }
-    AXIS2_PROPERTIES_FREE(props, env);
+     axis2_properties_t *props = NULL;
+     axis2_char_t *message = NULL;
+     
+     props = w2c_messages_get_message_properties( env);
+     message = AXIS2_PROPERTIES_GET_PROPERTY( props, env, key);
+     if ( message )
+     {
+         message = AXIS2_STRDUP ( message, env );
+     }
+     AXIS2_PROPERTIES_FREE( props, env);
 
-    return  message;
+     return  message;
 }
 
 AXIS2_EXTERN void AXIS2_CALL
-w2c_messages_print_n_log_error(const axis2_env_t *env, axis2_char_t *key)
+w2c_messages_print_n_log_error( const axis2_env_t *env, axis2_char_t *key )
 {
-    axis2_char_t *msg = NULL;
-    msg = w2c_messages_get_message(env, key);
-    if (msg)
-    {
-        fprintf(stderr, "%s\n", msg);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                msg);
-        AXIS2_FREE(env->allocator, msg);
-    }
+     axis2_char_t *msg = NULL;
+     msg = w2c_messages_get_message( env, key );
+     if ( msg )
+     {
+         fprintf ( stderr, "%s\n", msg );
+         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                         msg);
+         AXIS2_FREE( env->allocator, msg);
+     }
 }
 
 AXIS2_EXTERN void AXIS2_CALL
-w2c_messages_print_n_log_error_from_properties(const axis2_env_t *env,
-        axis2_properties_t *props,
-        axis2_char_t *key)
+w2c_messages_print_n_log_error_from_properties( const axis2_env_t *env, 
+                                          axis2_properties_t *props,
+                                          axis2_char_t *key )
 {
-    axis2_char_t *msg = NULL;
-    msg = AXIS2_PROPERTIES_GET_PROPERTY(props, env, key);
-    if (msg)
-    {
-        fprintf(stderr, "%s\n", msg);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                msg);
-    }
+     axis2_char_t *msg = NULL;
+     msg = AXIS2_PROPERTIES_GET_PROPERTY( props, env, key);
+     if ( msg )
+     {
+         fprintf ( stderr, "%s\n", msg );
+         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                         msg);
+     }
 }
 

Modified: webservices/axis2/trunk/c/tools/codegen/src/util/properties.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/properties.c?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/properties.c (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/properties.c Wed Sep 27 05:39:31 2006
@@ -13,47 +13,46 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+ 
 #include <w2c_properties.h>
 #include <axis2_array_list.h>
 #include <axis2_string.h>
 #include <w2c_string.h>
 #include <axis2_properties.h>
 
-/**
+/** 
  * @brief
  */
 typedef struct w2c_properties_impl
 {
     w2c_properties_t properties;
-
+    
     axis2_hash_t *prop_hash;
-
-}
-w2c_properties_impl_t;
+       
+} w2c_properties_impl_t;
 
 #define W2C_INTF_TO_IMPL(properties) \
     ((w2c_properties_impl_t *) properties)
 
 /************************* Function prototypes ********************************/
 
-axis2_status_t AXIS2_CALL
-w2c_properties_free(w2c_properties_t *properties,
-        const axis2_env_t *env);
+axis2_status_t AXIS2_CALL 
+w2c_properties_free (w2c_properties_t *properties, 
+           const axis2_env_t *env);
 
 axis2_hash_t* AXIS2_CALL
 w2c_properties_get_hash(w2c_properties_t *properties,
-        const axis2_env_t *env);
+           const axis2_env_t *env);
 
 axis2_char_t*
-w2c_properties_trunk_and_dup(axis2_char_t *start, axis2_char_t *end,
-        const axis2_env_t *env);
+w2c_properties_trunk_and_dup( axis2_char_t *start, axis2_char_t *end,
+                                   const axis2_env_t *env );
 /************************** End of function prototypes ************************/
 
-AXIS2_EXTERN w2c_properties_t * AXIS2_CALL
-w2c_properties_create(const axis2_env_t *env,
-        axis2_char_t *filename,
-        axis2_char_t seperator)
+AXIS2_EXTERN w2c_properties_t * AXIS2_CALL 
+w2c_properties_create (const axis2_env_t *env,
+                        axis2_char_t *filename,
+                        axis2_char_t seperator)
 {
     w2c_properties_impl_t *properties_impl = NULL;
     axis2_properties_t *main_props = NULL;
@@ -66,98 +65,98 @@
     FILE *f = NULL;
     axis2_array_list_t *arr_list = NULL;
     int i = 0;
-
+   
     AXIS2_ENV_CHECK(env, NULL);
 
-    f = fopen(filename, "r+");
-    if (f == NULL)
+    f = fopen ( filename, "r+");
+    if ( f == NULL )
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_COULD_NOT_OPEN_FILE, AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_COULD_NOT_OPEN_FILE, AXIS2_FAILURE); 
         return NULL;
     }
 
     properties_impl = (w2c_properties_impl_t *) AXIS2_MALLOC(env->
-            allocator, sizeof(w2c_properties_impl_t));
+               allocator, sizeof(w2c_properties_impl_t));
 
-    if (NULL == properties_impl)
+    if(NULL == properties_impl)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
         return NULL;
     }
     main_props = axis2_properties_create(env);
-    if (NULL == main_props)
+    if(NULL == main_props)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
         return NULL;
     }
-    AXIS2_PROPERTIES_LOAD(main_props, env, f);
+    AXIS2_PROPERTIES_LOAD( main_props, env, f );
     fclose(f);
 
 
-    tmp_hash = AXIS2_PROPERTIES_GET_ALL(main_props, env);
-
-    properties_impl-> prop_hash = axis2_hash_make(env);
-    if (NULL == properties_impl-> prop_hash)
+    tmp_hash = AXIS2_PROPERTIES_GET_ALL( main_props, env);
+    
+    properties_impl-> prop_hash = axis2_hash_make (env);
+    if(NULL == properties_impl-> prop_hash)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
         return NULL;
     }
 
-    if (tmp_hash)
+    if(tmp_hash)
     {
-        for (hi = axis2_hash_first(tmp_hash, env);
-                hi; hi = axis2_hash_next(env, hi))
+        for (hi = axis2_hash_first( tmp_hash, env);
+                            hi; hi = axis2_hash_next(env, hi))
         {
             axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
             if (key && value)
             {
                 i = 0;
                 arr_list = axis2_array_list_create(env, 10);
-                for (p = value, tag = value; *p; p ++)
+                for( p = value, tag = value; *p; p ++)
                 {
-                    if (*p == seperator)
+                    if ( *p == seperator)
                     {
                         *p = '\0';
-                        tag = w2c_properties_trunk_and_dup(tag, p, env);
-                        AXIS2_ARRAY_LIST_ADD_AT(arr_list, env, i, tag);
+                        tag = w2c_properties_trunk_and_dup( tag, p, env);
+                        AXIS2_ARRAY_LIST_ADD_AT( arr_list, env, i, tag);
                         tag = p + 1;
                         i ++;
                     }
                 }
-                if (p != tag)
+                if ( p != tag )
                 {
-                    tag = w2c_properties_trunk_and_dup(tag, p, env);
-                    AXIS2_ARRAY_LIST_ADD_AT(arr_list, env, i, tag);
+                    tag = w2c_properties_trunk_and_dup( tag, p, env);
+                    AXIS2_ARRAY_LIST_ADD_AT( arr_list, env, i, tag);
                 }
                 key = AXIS2_STRDUP(key, env);
-                axis2_hash_set(properties_impl-> prop_hash, key, AXIS2_HASH_KEY_STRING, arr_list);
+                axis2_hash_set( properties_impl-> prop_hash, key, AXIS2_HASH_KEY_STRING, arr_list);
             }
         }
     }
-    AXIS2_PROPERTIES_FREE(main_props, env);
+    AXIS2_PROPERTIES_FREE( main_props, env);
 
 
-    properties_impl->properties.ops =
-        AXIS2_MALLOC(env->allocator, sizeof(w2c_properties_ops_t));
-    if (NULL == properties_impl->properties.ops)
+    properties_impl->properties.ops = 
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_properties_ops_t));
+    if(NULL == properties_impl->properties.ops)
     {
         w2c_properties_free(&(properties_impl->properties), env);
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
-
+    
     properties_impl->properties.ops->free = w2c_properties_free;
     properties_impl->properties.ops->get_hash =
-        w2c_properties_get_hash;
+                                                w2c_properties_get_hash;
 
     return &(properties_impl->properties);
 }
 
 /***************************Function implementation****************************/
 
-axis2_status_t AXIS2_CALL
-w2c_properties_free(w2c_properties_t *properties,
-        const axis2_env_t *env)
+axis2_status_t AXIS2_CALL 
+w2c_properties_free (w2c_properties_t *properties, 
+                            const axis2_env_t *env)
 {
     w2c_properties_impl_t *properties_impl = NULL;
     axis2_array_list_t *values_arr = NULL;
@@ -166,70 +165,70 @@
     int i = 0;
     int size = 0;
     axis2_hash_index_t *hi = NULL;
-
+    
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+    
     properties_impl = W2C_INTF_TO_IMPL(properties);
-
-    if (properties_impl-> prop_hash)
+   
+    if(properties_impl-> prop_hash)
     {
-        for (hi = axis2_hash_first(properties_impl-> prop_hash, env);
-                hi; hi = axis2_hash_next(env, hi))
+        for (hi = axis2_hash_first( properties_impl-> prop_hash, env);
+                            hi; hi = axis2_hash_next(env, hi))
         {
             axis2_hash_this(hi, (void*)&key, NULL, (void*)&values_arr);
             if (key && values_arr)
             {
-                size = AXIS2_ARRAY_LIST_SIZE(values_arr, env);
+                size = AXIS2_ARRAY_LIST_SIZE( values_arr, env);
                 for (i = 0; i < size; i ++)
                 {
-                    value = (axis2_char_t*)AXIS2_ARRAY_LIST_GET(values_arr, env, i);
-                    if (value)
+                    value = (axis2_char_t*)AXIS2_ARRAY_LIST_GET( values_arr, env, i);
+                    if ( value != NULL)
                     {
-                        AXIS2_FREE(env-> allocator, value);
+                        AXIS2_FREE( env-> allocator, value);
                     }
                 }
-                AXIS2_ARRAY_LIST_FREE(values_arr, env);
+                AXIS2_ARRAY_LIST_FREE( values_arr, env);
                 AXIS2_FREE(env-> allocator, key);
             }
         }
-        axis2_hash_free(properties_impl-> prop_hash, env);
+        axis2_hash_free( properties_impl-> prop_hash, env);
     }
-
-    if (properties->ops)
+    
+    if(properties->ops)
     {
         AXIS2_FREE(env->allocator, properties->ops);
         properties->ops = NULL;
     }
-    if (properties_impl)
+    if(properties_impl)
     {
         AXIS2_FREE(env->allocator, properties_impl);
         properties_impl = NULL;
     }
-
+    
     return AXIS2_SUCCESS;
 }
 
 axis2_hash_t* AXIS2_CALL
 w2c_properties_get_hash(w2c_properties_t *properties,
-        const axis2_env_t *env)
+           const axis2_env_t *env)
 {
     w2c_properties_impl_t *properties_impl = NULL;
-
+    
     AXIS2_ENV_CHECK(env, NULL);
-
+    
     properties_impl = W2C_INTF_TO_IMPL(properties);
-
+    
     return properties_impl-> prop_hash;
 }
 
 axis2_char_t*
-w2c_properties_trunk_and_dup(axis2_char_t* start, axis2_char_t* end,
-        const axis2_env_t* env)
+w2c_properties_trunk_and_dup( axis2_char_t* start, axis2_char_t* end,
+                                   const axis2_env_t* env )
 {
-    for (; *start == ' '; start ++); /* remove front spaces */
-    for (end --; *end == ' '; end --); /* remove rear spaces */
-    *(++end) = '\0';
-    start = (axis2_char_t*)AXIS2_STRDUP(start, env);
+    for ( ; *start == ' '; start ++ ); /* remove front spaces */
+    for ( end --; *end == ' '; end -- ); /* remove rear spaces */
+    *(++end ) = '\0';
+    start = (axis2_char_t*)AXIS2_STRDUP ( start, env );
     return start;
 }
 

Modified: webservices/axis2/trunk/c/tools/codegen/src/util/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/resource.properties?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/resource.properties (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/resource.properties Wed Sep 27 05:39:31 2006
@@ -23,12 +23,12 @@
 wsdl2code.arg7=-id : indent the generated code. currently available for c language
 wsdl2code.arg8=-ss : Generate server side code (i.e. skeletons). Default is off
 wsdl2code.arg9=-sd : Generate service descriptor (i.e. services.xml). Default is off. Valid with -ss
-wsdl2code.arg10=-d <databinding> : valid databinding is none. Default is none 
+wsdl2code.arg10=-d <databinding> : valid databindings are adb, none. Default is none 
 #currently following cases are not tested correctly
 wsdl2code.arg11=-g Generates all the classes. valid only with the -ss
 wsdl2code.arg12=-pn <port_name> : name of port in the presence of multiple ports
 wsdl2code.arg13=-sn <service_name> : name of service in the presence of multiple services
-wsdl2code.arg14=-u : unpacks the databinding classes
+#wsdl2code.arg14=-u : unpacks the databinding classes
 wsdl2code.arg15=-r <repository_path> : path of the repository against which code is generated
 wsdl2code.arg16=-ns2p <namespace=packagename> :packages to replace the namespace
 wsdl2code.arg17=-ssi generate an interface for the serverside - off by default
@@ -69,3 +69,17 @@
 writer.svcSkelFailed=Failed in generating Service Skeleton
 writer.svcXmlFailed=Failed in generating Service XML
 writer.templateLoadFailed=Failed in loading template
+
+################## Schema Compiler ####################################
+schema.elementNull=Error: Null Element
+schema.anonymousExtension=Error: Anonymous Extension
+schema.simpletypeRestriction=Error: Simple Type Restriction
+schema.unknownContentError=Error: Unknown Content
+schema.unsupportedContentError=Error: Unsupported Content
+schema.unknowContentModelError=Error: Unknown Content Model
+schema.writerclassMissing=Error: Writer for Requested options is missing
+schema.notImplemented=Error: Not Implemented Feature is required
+
+schema2code.arg1=Argument1 - Source schema file name .Required.
+schema2code.arg2=Argument2 - Output folder name 
+schema2code.arg3=Argument3 - Language for code generation

Modified: webservices/axis2/trunk/c/tools/codegen/src/util/string.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/string.c?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/string.c (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/string.c Wed Sep 27 05:39:31 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+ 
 #include <w2c_string.h>
 #include <axis2_string.h>
 #include <string.h>
@@ -26,12 +26,12 @@
 
 
 AXIS2_EXTERN int AXIS2_CALL
-w2c_string_indexof(axis2_char_t* str, axis2_char_t c)
+w2c_string_indexof( axis2_char_t* str, axis2_char_t c )
 {
     int i;
-    for (i = 0; *str != '\0' ; str ++, i ++)
+    for ( i = 0; *str != '\0' ; str ++, i ++ )
     {
-        if (*str == c)
+        if ( *str == c )
         {
             return i;
         }
@@ -40,28 +40,28 @@
 }
 
 AXIS2_EXTERN int AXIS2_CALL
-w2c_string_indexof_cs(axis2_char_t* str, axis2_char_t* cs)
+w2c_string_indexof_cs( axis2_char_t* str, axis2_char_t* cs )
 {
     int i = 0;
     axis2_char_t* temp_cs = cs;
     int starting_i = -1;
-    for (i = 0; *str != '\0' && *temp_cs != '\0' ; str ++, i ++)
+    for ( i = 0; *str != '\0' && *temp_cs!= '\0' ; str ++, i ++ )
     {
-        if (*str == *temp_cs)
+        if ( *str == *temp_cs )
         {
             temp_cs ++;
-            if (starting_i < 0)
+            if ( starting_i < 0 ) 
             {
                 starting_i = i;
             }
         }
-        else if (starting_i > -1)
+        else if ( starting_i > -1 )
         {
             starting_i = -1;
             temp_cs = cs;
         }
     }
-    if (starting_i > -1 && *temp_cs == '\0')
+    if ( starting_i > -1 && *temp_cs =='\0' )
     {
         return starting_i;
     }
@@ -69,33 +69,33 @@
 }
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-w2c_string_add_string(axis2_char_t* string1, axis2_char_t* string2,
-        const axis2_env_t* env)
+w2c_string_add_string ( axis2_char_t* string1, axis2_char_t* string2,
+                        const axis2_env_t* env)
 {
     int current_len = 0;
     int additional_len = 0;
     axis2_char_t* new_location = NULL;
 
-    additional_len = strlen(string2);
-    if (0 == additional_len)
+    additional_len = strlen ( string2 );
+    if ( 0 == additional_len )
     {
         return string1;
     }
 
-    if (NULL == string1)
+    if ( NULL == string1 )
     {
-        string1 = AXIS2_MALLOC(env-> allocator,
-                sizeof(axis2_char_t) * (additional_len + 1));
+        string1 = AXIS2_MALLOC( env-> allocator, 
+                   sizeof(axis2_char_t) * (additional_len +1 ) );
     }
     else
     {
-        current_len = strlen(string1);
-        string1 = AXIS2_REALLOC(env-> allocator,
-                string1, sizeof(axis2_char_t) *
-                (current_len + additional_len + 1));
+        current_len = strlen ( string1 );
+        string1 = AXIS2_REALLOC( env-> allocator,
+                 string1, sizeof(axis2_char_t) *
+                 (current_len + additional_len + 1 ) );
     }
     new_location = string1 + sizeof(axis2_char_t) * current_len ;
-    memcpy(new_location , string2, sizeof(axis2_char_t) * additional_len);
+    memcpy ( new_location , string2, sizeof(axis2_char_t) * additional_len );
 
     string1[ additional_len + current_len ] = '\0';
 
@@ -104,8 +104,8 @@
 
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-w2c_string_make_c_simple_name(axis2_char_t *name,
-        const axis2_env_t *env)
+w2c_string_make_c_simple_name( axis2_char_t *name,
+                               const axis2_env_t *env)
 {
     char *p = NULL;
     int len = 0;
@@ -113,16 +113,16 @@
     int new_index = 0;
     int earlier_capital = 0;
 
-    name = (axis2_char_t*)AXIS2_STRDUP(name, env); /* so constansts are allowd */
-    len = AXIS2_STRLEN(name);
-    ret_val = (axis2_char_t*) AXIS2_MALLOC(env-> allocator,
-            sizeof(axis2_char_t) * len * 2);
+    name = (axis2_char_t*)AXIS2_STRDUP( name, env); /* so constansts are allowd */
+    len = AXIS2_STRLEN( name);
+    ret_val = (axis2_char_t*) AXIS2_MALLOC ( env-> allocator, 
+                                        sizeof(axis2_char_t) * len * 2);
 
-    for (p = name, new_index = 0, earlier_capital = 0; *p != '\0'; p ++)
+    for ( p = name, new_index = 0, earlier_capital = 0; *p != '\0'; p ++ )
     {
-        if (W2C_STRING_IS_CAPITAL(*p))
+        if ( W2C_STRING_IS_CAPITAL(*p) )
         {
-            if (new_index != 0 && ret_val[new_index-1] != '_' && !earlier_capital)
+            if ( new_index != 0 && ret_val[new_index-1] != '_' && !earlier_capital)
                 ret_val[new_index++] = '_';
             ret_val[new_index++] = tolower(*p);
             earlier_capital = 1;
@@ -135,22 +135,43 @@
     }
     ret_val[new_index] = '\0';
 
-    AXIS2_FREE(env-> allocator, name);
+    AXIS2_FREE( env-> allocator, name);
     return ret_val;
 }
-
+    
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-w2c_string_make_c_macro_name(axis2_char_t *name,
-        const axis2_env_t *env)
+w2c_string_make_c_macro_name( axis2_char_t *name,
+                               const axis2_env_t *env)
 {
     char *p = NULL;
     char *ret_val = NULL;
 
-    ret_val = w2c_string_make_c_simple_name(name, env);
+    ret_val = w2c_string_make_c_simple_name( name, env);
 
-    for (p = ret_val; *p != '\0'; p ++)
+    for ( p = ret_val; *p != '\0'; p ++ )
     {
         *p = toupper(*p);
     }
     return ret_val;
 }
+
+AXIS2_EXTERN axis2_char_t*
+w2c_string_make_key_from_qname( axis2_qname_t *qname, 
+                                     const axis2_env_t *env)
+{
+    axis2_char_t *local = NULL;
+    axis2_char_t *uri = NULL;
+    axis2_char_t *key = NULL;
+
+    local = AXIS2_QNAME_GET_LOCALPART( qname, env);
+    uri = AXIS2_QNAME_GET_URI( qname, env);
+    
+    key = AXIS2_STRDUP( local, env);
+    if ( uri != NULL && *uri != '\0' ) /* it should not be empty*/
+    {
+        key = w2c_string_add_string( key, "|", env);
+        key = w2c_string_add_string( key, uri, env);
+    }
+    return key;
+}
+

Modified: webservices/axis2/trunk/c/tools/codegen/src/util/typemapper.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/typemapper.c?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/typemapper.c (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/typemapper.c Wed Sep 27 05:39:31 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+ 
 #include <w2c_typemapper.h>
 #include <axis2_array_list.h>
 #include <axis2_string.h>
@@ -31,7 +31,7 @@
 #define W2C_TYPEMAPPER_UPPER_PARAM_LIMIT 1000
 #define W2C_TYPEMAPPER_PARAM_SUFFIX "param"
 
-/**
+/** 
  * @brief
  */
 typedef struct w2c_typemapper_impl
@@ -42,97 +42,107 @@
     axis2_hash_t *qname2name;
     axis2_char_t *default_type;
     axis2_qname_t *default_qname;
+    axis2_hash_t *primitive_map;
 
+    axis2_hash_t *qname2prefix;
 
-}
-w2c_typemapper_impl_t;
+       
+} w2c_typemapper_impl_t;
 
-typedef struct w2c_typemapper_type_info
-{
-    axis2_qname_t *qname;
-    axis2_char_t *type;
-}
-w2c_typemapper_type_info_t;
 #define W2C_INTF_TO_IMPL(typemapper) \
     ((w2c_typemapper_impl_t *) typemapper)
 
 /************************* Function prototypes ********************************/
 
-axis2_status_t AXIS2_CALL
-w2c_typemapper_free(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env);
+axis2_status_t AXIS2_CALL 
+w2c_typemapper_free (w2c_typemapper_t *typemapper, 
+           const axis2_env_t *env);
 
 axis2_char_t* AXIS2_CALL
 w2c_typemapper_get_parameter_name(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env,
-        axis2_qname_t *qname);
+            const axis2_env_t *env,
+            axis2_qname_t *qname);
 
 axis2_char_t* AXIS2_CALL
 w2c_typemapper_get_type_name(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env,
-        axis2_qname_t *qname);
+            const axis2_env_t *env,
+            axis2_qname_t *qname);
 
 axis2_status_t AXIS2_CALL
 w2c_typemapper_add_typemapping_name(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env,
-        axis2_qname_t *qname,
-        axis2_char_t *name);
+            const axis2_env_t *env,
+            axis2_qname_t *qname,
+            axis2_char_t *name);
 
 axis2_char_t* AXIS2_CALL
 w2c_typemapper_get_default_mapping_name(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env);
+            const axis2_env_t *env);
 
 axis2_qname_t* AXIS2_CALL
 w2c_typemapper_get_default_qname(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env);
+            const axis2_env_t *env);
+
+axis2_hash_t* AXIS2_CALL
+w2c_typemapper_get_all(w2c_typemapper_t *typemapper,
+            const axis2_env_t *env);
 
-/************************** End of function prototypes ************************/
+axis2_bool_t AXIS2_CALL
+w2c_typemapper_is_primitive(w2c_typemapper_t *typemapper,
+                    const axis2_env_t *env,
+                    axis2_qname_t *qname);
 
-AXIS2_EXTERN w2c_typemapper_t * AXIS2_CALL
-w2c_typemapper_create(const axis2_env_t *env)
+ /************************** End of function prototypes ************************/
+
+AXIS2_EXTERN w2c_typemapper_t * AXIS2_CALL 
+w2c_typemapper_create (const axis2_env_t *env)
 {
     w2c_typemapper_impl_t *typemapper_impl = NULL;
-
+   
     AXIS2_ENV_CHECK(env, NULL);
 
     typemapper_impl = (w2c_typemapper_impl_t *) AXIS2_MALLOC(env->
-            allocator, sizeof(w2c_typemapper_impl_t));
+               allocator, sizeof(w2c_typemapper_impl_t));
 
-    if (NULL == typemapper_impl)
+    if(NULL == typemapper_impl)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
         return NULL;
     }
     typemapper_impl->qname2name = NULL;
+    typemapper_impl->qname2prefix = NULL;
     typemapper_impl->default_type = NULL;
-
-    typemapper_impl->typemapper.ops =
-        AXIS2_MALLOC(env->allocator, sizeof(w2c_typemapper_ops_t));
-    if (NULL == typemapper_impl->typemapper.ops)
+    
+    typemapper_impl->typemapper.ops = 
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_typemapper_ops_t));
+    if(NULL == typemapper_impl->typemapper.ops)
     {
         w2c_typemapper_free(&(typemapper_impl->typemapper), env);
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
-
+    
     typemapper_impl->typemapper.ops->free = w2c_typemapper_free;
-    typemapper_impl->typemapper.ops->get_parameter_name =
-        w2c_typemapper_get_parameter_name;
-    typemapper_impl->typemapper.ops->get_type_name =
-        w2c_typemapper_get_type_name;
-    typemapper_impl->typemapper.ops->add_typemapping_name =
-        w2c_typemapper_add_typemapping_name;
-    typemapper_impl->typemapper.ops->get_default_mapping_name =
-        w2c_typemapper_get_default_mapping_name;
-    typemapper_impl->typemapper.ops->get_default_qname =
-        w2c_typemapper_get_default_qname;
+    typemapper_impl->typemapper.ops->get_parameter_name = 
+                                        w2c_typemapper_get_parameter_name;
+    typemapper_impl->typemapper.ops->get_type_name= 
+                                        w2c_typemapper_get_type_name;
+    typemapper_impl->typemapper.ops->add_typemapping_name = 
+                                        w2c_typemapper_add_typemapping_name;
+    typemapper_impl->typemapper.ops->get_default_mapping_name = 
+                                        w2c_typemapper_get_default_mapping_name;
+    typemapper_impl->typemapper.ops->get_default_qname= 
+                                        w2c_typemapper_get_default_qname;
+    typemapper_impl->typemapper.ops->get_all= 
+                                        w2c_typemapper_get_all;
+    typemapper_impl->typemapper.ops->is_primitive= 
+                                        w2c_typemapper_is_primitive;
 
     return &(typemapper_impl->typemapper);
 }
 
-AXIS2_EXTERN w2c_typemapper_t * AXIS2_CALL
+AXIS2_EXTERN w2c_typemapper_t * AXIS2_CALL 
 w2c_typemapper_create_from_file(const axis2_env_t *env,
-        axis2_char_t *filename)
+                          axis2_char_t *filename)
 {
     w2c_typemapper_impl_t *typemapper_impl = NULL;
     axiom_xml_reader_t *xml_reader      = NULL;
@@ -148,247 +158,269 @@
     axis2_char_t *uri = NULL;
     axis2_char_t *prefix = NULL;
     axis2_char_t *local_name = NULL;
-    axis2_qname_t *qname = NULL;
+    axis2_char_t *attri_val = NULL;
     axis2_char_t *type_val = NULL;
-    w2c_typemapper_type_info_t *type_info = NULL;
     axis2_char_t *qname2str = NULL;
-    axis2_char_t *attri_val = NULL;
-
 
+  
     AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK(env->error, filename, NULL);
-
+    
     typemapper_impl = (w2c_typemapper_impl_t *) w2c_typemapper_create(env);
-    if (!typemapper_impl)
+    if(!typemapper_impl)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        return NULL;
+        return NULL;  
     }
     file_path = getenv("AXIS2C_HOME");
-    file_path = AXIS2_STRDUP(file_path, env);
-    file_path = w2c_string_add_string(file_path, W2C_TYPEMAPPER_MAPPING_PATH, env);
-    file_path = w2c_string_add_string(file_path, filename, env);
+    file_path = AXIS2_STRDUP( file_path, env);
+    file_path = w2c_string_add_string(file_path, W2C_TYPEMAPPER_MAPPING_PATH, env );
+    file_path = w2c_string_add_string(file_path, filename, env );
 
     xml_reader =
         axiom_xml_reader_create_for_file(env, file_path, NULL);
-    if (!xml_reader)
+    if(!xml_reader)
         return AXIS2_FAILURE;
     om_builder = axiom_stax_builder_create(env, xml_reader);
     om_doc = axiom_document_create(env, NULL, om_builder);
     AXIOM_DOCUMENT_BUILD_ALL(om_doc, env);
 
-    typemapper_impl-> qname2name = axis2_hash_make(env);
+    typemapper_impl-> qname2name = axis2_hash_make ( env);
+    typemapper_impl-> qname2prefix = axis2_hash_make ( env);
+    typemapper_impl-> primitive_map = axis2_hash_make ( env);
     root = AXIOM_DOCUMENT_GET_ROOT_ELEMENT(om_doc, env);
     root_ele = AXIOM_NODE_GET_DATA_ELEMENT(root, env);
     typemapper_impl-> mapper_name =
         AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(root_ele, env, "dbf");
-    typemapper_impl-> mapper_name =
-        AXIS2_STRDUP(typemapper_impl-> mapper_name, env);
+    typemapper_impl-> mapper_name = 
+        AXIS2_STRDUP( typemapper_impl-> mapper_name, env);
     it = AXIOM_ELEMENT_GET_CHILDREN(root_ele, env, root);
-    while ((child = AXIOM_CHILDREN_ITERATOR_NEXT(it, env)))
+    while ( (child = AXIOM_CHILDREN_ITERATOR_NEXT(it, env )) != NULL )
     {
-        child_ele = AXIOM_NODE_GET_DATA_ELEMENT(child, env);
+        child_ele = AXIOM_NODE_GET_DATA_ELEMENT( child, env);
         is_default = AXIS2_FALSE;
-        if ((attri_val = AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME
-                (child_ele, env, "default")))
+        if ( (attri_val = AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME
+                    (child_ele, env, "default") ) != NULL )
         {
             is_default = AXIS2_TRUE;
         }
-        child = AXIOM_NODE_GET_FIRST_CHILD(child, env);
-        child_ele = AXIOM_NODE_GET_DATA_ELEMENT(child, env);
+        child = AXIOM_NODE_GET_FIRST_CHILD( child, env);
+        child_ele = AXIOM_NODE_GET_DATA_ELEMENT( child, env);
         uri = AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME
-                (child_ele, env, "namespace");
-        uri = AXIS2_STRDUP(uri, env);
+                    (child_ele, env, "namespace");
         prefix = AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME
-                (child_ele, env, "prefix");
-        prefix = AXIS2_STRDUP(prefix, env);
+                                (child_ele, env, "prefix");
+        prefix = AXIS2_STRDUP( prefix, env);
         local_name = AXIOM_ELEMENT_GET_TEXT(child_ele, env, child);
-        local_name = AXIS2_STRDUP(local_name, env);
-        qname = axis2_qname_create(env, local_name, uri, prefix);
-        qname2str = AXIS2_QNAME_TO_STRING(qname, env);
-        qname2str = AXIS2_STRDUP(qname2str, env);
-
-        child = AXIOM_NODE_GET_NEXT_SIBLING(child, env);
-        child_ele = AXIOM_NODE_GET_DATA_ELEMENT(child, env);
-        type_val = AXIOM_ELEMENT_GET_TEXT(child_ele, env, child);
-        type_val = AXIS2_STRDUP(type_val, env);
-        if (is_default)
+        qname2str = AXIS2_STRDUP( local_name, env);
+        qname2str = w2c_string_add_string( qname2str, "|", env);
+        qname2str = w2c_string_add_string( qname2str, uri, env);
+
+        child = AXIOM_NODE_GET_NEXT_SIBLING( child, env );
+        child_ele = AXIOM_NODE_GET_DATA_ELEMENT( child, env);
+        type_val = AXIOM_ELEMENT_GET_TEXT( child_ele, env, child);
+        type_val = AXIS2_STRDUP( type_val, env);
+        if ( is_default )
         {
-            typemapper_impl-> default_type = AXIS2_STRDUP(type_val, env);
-            typemapper_impl-> default_qname = qname;
+            uri = AXIS2_STRDUP( uri, env);
+            local_name = AXIS2_STRDUP( local_name, env);
+            prefix = AXIS2_STRDUP( prefix, env);
+            typemapper_impl-> default_qname = 
+                axis2_qname_create( env, local_name, uri, prefix);
+            typemapper_impl-> default_type = AXIS2_STRDUP( type_val, env);
         }
-        type_info = (w2c_typemapper_type_info_t*) AXIS2_MALLOC
-                (env-> allocator, sizeof(w2c_typemapper_type_info_t));
-        type_info-> qname =  qname;
-        type_info-> type = type_val;
-        axis2_hash_set(typemapper_impl-> qname2name, qname2str,
-                AXIS2_HASH_KEY_STRING, type_info);
+        axis2_hash_set( typemapper_impl-> qname2name, qname2str,
+                        AXIS2_HASH_KEY_STRING, type_val );
+        qname2str = AXIS2_STRDUP( qname2str, env);
+        axis2_hash_set( typemapper_impl-> qname2prefix, qname2str,
+                        AXIS2_HASH_KEY_STRING, prefix );
+        qname2str = AXIS2_STRDUP( qname2str, env);
+        axis2_hash_set( typemapper_impl-> primitive_map, qname2str,
+                        AXIS2_HASH_KEY_STRING, (void*)1);
     }
 
     AXIOM_STAX_BUILDER_FREE(om_builder, env);
     axiom_xml_reader_cleanup();
 
-    return &(typemapper_impl->typemapper);
+   return &(typemapper_impl->typemapper);
 }
 
 /***************************Function implementation****************************/
 
-axis2_status_t AXIS2_CALL
-w2c_typemapper_free(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env)
+axis2_status_t AXIS2_CALL 
+w2c_typemapper_free (w2c_typemapper_t *typemapper, 
+                            const axis2_env_t *env)
 {
     w2c_typemapper_impl_t *typemapper_impl = NULL;
-
+ 
     axis2_char_t *key = NULL;
-    w2c_typemapper_type_info_t* value = NULL;
     axis2_hash_index_t *hi = NULL;
     axis2_hash_t *h = NULL;
+    axis2_char_t *value = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+    
     typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
     h = typemapper_impl-> qname2name;
-
+    
     for (hi = axis2_hash_first(h, env) ;
-            hi; hi = axis2_hash_next(env, hi))
+                hi; hi = axis2_hash_next(env, hi))
     {
         axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
         if (value)
         {
-            if (value-> type)
-                AXIS2_FREE(env-> allocator, value-> type);
-            if (value-> qname)
-                AXIS2_QNAME_FREE(value-> qname, env);
+            AXIS2_FREE ( env-> allocator, value);
         }
-        if (key) AXIS2_FREE(env-> allocator, key);
+        if (key) AXIS2_FREE ( env-> allocator, key); 
     }
-    axis2_hash_free(h , env);
+    axis2_hash_free( h , env);
+    
+    h = typemapper_impl-> qname2prefix;
+    for (hi = axis2_hash_first(h, env) ;
+                hi; hi = axis2_hash_next(env, hi))
+    {
+        axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
+        if (value)
+        {
+            AXIS2_FREE ( env-> allocator, value);
+        }
+        if (key) AXIS2_FREE ( env-> allocator, key); 
+    }
+    axis2_hash_free( h , env);
+    
+    h = typemapper_impl-> primitive_map;
+    for (hi = axis2_hash_first(h, env) ;
+                hi; hi = axis2_hash_next(env, hi))
+    {
+        axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
+        if (key) AXIS2_FREE ( env-> allocator, key); 
+    }
+    axis2_hash_free( h , env);
 
     if (typemapper_impl-> mapper_name)
     {
-        AXIS2_FREE(env-> allocator, typemapper_impl-> mapper_name);
+        AXIS2_FREE (env-> allocator, typemapper_impl-> mapper_name);
     }
     if (typemapper_impl-> default_type)
     {
-        AXIS2_FREE(env-> allocator, typemapper_impl-> default_type);
+        AXIS2_FREE (env-> allocator, typemapper_impl-> default_type);
+    }
+    if (typemapper_impl-> default_qname)
+    {
+        AXIS2_QNAME_FREE( typemapper_impl-> default_qname, env);
     }
-    if (typemapper->ops)
+    if(typemapper->ops)
     {
         AXIS2_FREE(env->allocator, typemapper->ops);
         typemapper->ops = NULL;
     }
-    if (typemapper_impl)
+    if(typemapper_impl)
     {
         AXIS2_FREE(env->allocator, typemapper_impl);
         typemapper_impl = NULL;
     }
-
+    
     return AXIS2_SUCCESS;
 }
 
 
 axis2_char_t* AXIS2_CALL
 w2c_typemapper_get_parameter_name(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env,
-        axis2_qname_t *qname)
+            const axis2_env_t *env,
+            axis2_qname_t *qname)
 {
-    w2c_typemapper_impl_t *typemapper_impl = NULL;
-
-    axis2_char_t *key = NULL;
-    w2c_typemapper_type_info_t *value = NULL;
-    axis2_hash_t *h = NULL;
-    axis2_char_t *prefix = NULL;
+    axis2_char_t *local= NULL;
     static int counter = 0;
     axis2_char_t counter_str[32];
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
-    h = typemapper_impl-> qname2name;
-
-    key = AXIS2_QNAME_TO_STRING(qname, env);
-    value = axis2_hash_get(h, key, AXIS2_HASH_KEY_STRING);
-    if (NULL == value)
-    {
-        return NULL;
-    }
-
-    qname = value-> qname;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
 
-    prefix = AXIS2_QNAME_GET_LOCALPART(qname, env);
-    prefix = AXIS2_STRDUP(prefix, env);
+    local = AXIS2_STRDUP( "param", env);
 
     if (counter == W2C_TYPEMAPPER_UPPER_PARAM_LIMIT)
     {
         counter = 0;
     }
-    sprintf(counter_str, "%d", counter++);
-    prefix = w2c_string_add_string(prefix, counter_str, env);
-
-    return prefix;
+    sprintf(counter_str,"%d",counter++);
+    local = w2c_string_add_string(local, counter_str, env );
+    
+    return local;    
 }
 
 axis2_char_t* AXIS2_CALL
 w2c_typemapper_get_type_name(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env,
-        axis2_qname_t *qname)
+            const axis2_env_t *env,
+            axis2_qname_t *qname)
 {
     w2c_typemapper_impl_t *typemapper_impl = NULL;
-
+ 
+    axis2_char_t *str = NULL;
     axis2_char_t *key = NULL;
-    w2c_typemapper_type_info_t *value = NULL;
+    axis2_char_t *value =NULL;
     axis2_hash_t *h = NULL;
-    axis2_char_t *type = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+    
     typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
     h = typemapper_impl-> qname2name;
 
-    key = AXIS2_QNAME_TO_STRING(qname, env);
-    value = axis2_hash_get(h, key, AXIS2_HASH_KEY_STRING);
-    if (NULL == value)
-        return NULL;
+    str = w2c_string_make_key_from_qname(qname, env);
 
-    type = value-> type;
-    return type;
+    for ( key = str ; *key != ':' && *key != '\0' && *key != '|'; key ++ );
+    if(  *key == '\0' || *key == '|')
+    {
+        key = str;
+    }
+    else
+    {
+        key++;
+    }
+    value = axis2_hash_get( h, key, AXIS2_HASH_KEY_STRING );
+    AXIS2_FREE( env-> allocator, str); 
+    return value;    
 }
 
 
 axis2_status_t AXIS2_CALL
 w2c_typemapper_add_typemapping_name(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env,
-        axis2_qname_t *qname,
-        axis2_char_t *name)
+            const axis2_env_t *env,
+            axis2_qname_t *qname,
+            axis2_char_t *name)
 {
     w2c_typemapper_impl_t *typemapper_impl = NULL;
-    axis2_hash_t *h = NULL;
-    axis2_char_t *key = NULL;
-    w2c_typemapper_type_info_t *type_info = NULL;
+    axis2_char_t *key= NULL;
+    axis2_char_t *prefix = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+    
     typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
-    h = typemapper_impl-> qname2name;
 
-    key = AXIS2_QNAME_TO_STRING(qname, env);
-    type_info = (w2c_typemapper_type_info_t*) AXIS2_MALLOC
-            (env-> allocator, sizeof(w2c_typemapper_type_info_t));
-    type_info-> qname =  qname;
-    type_info-> type = name;
-    axis2_hash_set(typemapper_impl-> qname2name, key,
-            AXIS2_HASH_KEY_STRING, type_info);
+    prefix = AXIS2_QNAME_GET_PREFIX( qname, env);
+    key = w2c_string_make_key_from_qname( qname, env);
+    key = AXIS2_STRDUP( key, env);
+    name = AXIS2_STRDUP( name, env);
+
+    axis2_hash_set( typemapper_impl-> qname2name, key,
+                        AXIS2_HASH_KEY_STRING, name);
+    if ( prefix && AXIS2_STRLEN( prefix) > 0 )
+    {
+        key = AXIS2_STRDUP( key, env);
+        axis2_hash_set( typemapper_impl-> qname2prefix , key,
+                        AXIS2_HASH_KEY_STRING, prefix);
+    }
     return AXIS2_SUCCESS;
 }
-
+ 
 axis2_char_t* AXIS2_CALL
 w2c_typemapper_get_default_mapping_name(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env)
+            const axis2_env_t *env)
 {
     w2c_typemapper_impl_t *typemapper_impl = NULL;
-
+ 
     AXIS2_ENV_CHECK(env, NULL);
-
+    
     typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
 
     return typemapper_impl-> default_type;
@@ -397,15 +429,43 @@
 
 axis2_qname_t* AXIS2_CALL
 w2c_typemapper_get_default_qname(w2c_typemapper_t *typemapper,
-        const axis2_env_t *env)
+            const axis2_env_t *env)
 {
     w2c_typemapper_impl_t *typemapper_impl = NULL;
-
+ 
     AXIS2_ENV_CHECK(env, NULL);
-
+    
     typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
 
     return typemapper_impl-> default_qname;
 }
 
+axis2_hash_t* AXIS2_CALL
+w2c_typemapper_get_all(w2c_typemapper_t *typemapper,
+            const axis2_env_t *env)
+{
+    w2c_typemapper_impl_t *typemapper_impl = NULL;
+ 
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
+
+    return typemapper_impl-> qname2name;
+}
+
+axis2_bool_t AXIS2_CALL
+w2c_typemapper_is_primitive(w2c_typemapper_t *typemapper,
+                    const axis2_env_t *env,
+                    axis2_qname_t *qname)
+{
+    w2c_typemapper_impl_t *typemapper_impl = NULL;
+    axis2_char_t *key = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
 
+    typemapper_impl = W2C_INTF_TO_IMPL(typemapper);
+
+    key = w2c_string_make_key_from_qname(qname, env);
+    return (axis2_bool_t)axis2_hash_get( typemapper_impl-> primitive_map, 
+                key, AXIS2_HASH_KEY_STRING );
+}

Modified: webservices/axis2/trunk/c/tools/codegen/src/util/url_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/url_processor.c?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/url_processor.c (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/url_processor.c Wed Sep 27 05:39:31 2006
@@ -13,33 +13,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+ 
 #include <w2c_url_processor.h>
 #include <w2c_string.h>
-#include <axis2_string.h>
 #include <axis2_url.h>
 
 
 static axis2_bool_t AXIS2_CALL
-w2c_url_processor_is_token(axis2_char_t *str);
+w2c_url_processor_is_token ( axis2_char_t *str );
 
 static axis2_char_t* axis2_add_word_to_package_name
-(axis2_char_t *package_name ,
-        axis2_char_t *long_path,
-        const axis2_env_t *env);
-
-static const axis2_char_t *w2c_url_processor_c_tokens[] =
-    {
-        "auto", "break", "case", "axis2_char_t", "const", "continue",
-        "default", "do", "double", "else", "enum", "extern",
-        "float", "for", "goto", "if", "int", "long", "register",
-        "return", "short", "signed", "sizeof", "static",
-        "struct", "switch", "typedef", "union", "unsigned",
-        "void", "volatile", "while", NULL
-    };
+              ( axis2_char_t *package_name ,
+                axis2_char_t *long_path,
+                const axis2_env_t *env );
+
+static const axis2_char_t *w2c_url_processor_c_tokens[]={ 
+                      "auto", "break", "case", "axis2_char_t", "const", "continue",
+                      "default", "do", "double", "else", "enum", "extern",
+                      "float", "for", "goto", "if", "int", "long", "register",
+                      "return", "short", "signed", "sizeof", "static",
+                      "struct", "switch", "typedef", "union", "unsigned",
+                      "void", "volatile", "while", NULL };
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-w2c_url_processor_make_package_name(
+    w2c_url_processor_make_package_name(
     const axis2_env_t *env,
     axis2_char_t *namespace)
 {
@@ -53,25 +50,27 @@
     axis2_char_t *long_path_rev = NULL;
     axis2_char_t *ptr = NULL;
 
-    AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-
-    url = axis2_url_parse_string(env, namespace);
-    host_name = AXIS2_URL_GET_SERVER(url, env);
-    path = AXIS2_URL_GET_PATH(url, env);
+    url = axis2_url_parse_string (env, namespace );
+    if ( NULL == url )
+    {
+        return AXIS2_STRDUP( namespace, env);
+    }
+    host_name = AXIS2_URL_GET_SERVER ( url, env );
+    path = AXIS2_URL_GET_PATH ( url, env );
 
-    if (NULL == host_name)
+    if ( NULL == host_name )
     {
-        index = w2c_string_indexof(host_name, ':');
-        if (index > -1)
+        index = w2c_string_indexof ( host_name, ':');
+        if ( index > -1 )
         {
-            host_name =
-                axis2_string_substring_starting_at(host_name, index);
-
-            index =  w2c_string_indexof(host_name, '/');
-            if (index > -1)
+            host_name = 
+              axis2_string_substring_starting_at ( host_name, index );
+        
+            index =  w2c_string_indexof ( host_name, '/');
+            if ( index > -1 )
             {
                 host_name =
-                    axis2_string_substring_ending_at(host_name, index);
+                 axis2_string_substring_ending_at ( host_name, index);
             }
         }
         else
@@ -79,29 +78,29 @@
             host_name = namespace;
         }
     }
-
-    if (NULL == host_name || *host_name == '\0')
+    
+    if ( NULL == host_name || *host_name =='\0' )
     {
         return NULL;
     }
 
-    long_path = (axis2_char_t*)AXIS2_STRDUP(host_name, env);
+    long_path = (axis2_char_t* )AXIS2_STRDUP ( host_name,env );
 
-    /** make path_name legal */
+    /** make path_name legal */    
 
-    path_length = strlen(long_path);
-
-    for (long_path_rev = long_path + path_length ; ; long_path_rev --)
+    path_length = strlen ( long_path );    
+    
+    for ( long_path_rev = long_path + path_length ; ; long_path_rev -- )
     {
-        if (long_path - 1 == long_path_rev ||
-                '.' == *long_path_rev || ':' == *long_path_rev)
+        if ( long_path -1 == long_path_rev ||
+                 '.' == *long_path_rev ||':' == *long_path_rev )
         {
             /** go up one */
             long_path_rev ++;
             package_name =
-                axis2_add_word_to_package_name(package_name , long_path_rev, env);
+             axis2_add_word_to_package_name( package_name , long_path_rev, env);
 
-            if (long_path_rev == long_path)  /** loop should be ended */
+            if ( long_path_rev == long_path )  /** loop should be ended */
             {
                 break;
             }
@@ -109,82 +108,82 @@
             {
                 long_path_rev --;
                 *long_path_rev = '\0';
-                package_name =
-                    w2c_string_add_string(package_name, ".", env);
+                package_name = 
+                    w2c_string_add_string ( package_name, ".", env);
             }
         }
     }
-    free(long_path);
-
-    if (path)
-        path_length = strlen(path);
-    if (0 != path_length)
+    free (long_path );    
+  
+    if ( NULL != path )
+        path_length = strlen ( path );
+    if ( 0 != path_length )
     {
-        if ('/' == path[path_length-1])
+        if ( '/' == path[path_length-1] )
         {
             path[ path_length -1] = '\0';
         }
-        if ('/' ==  *path)
+        if ('/' ==  *path )
         {
             path ++;
         }
+        
+        long_path = ( axis2_char_t* )AXIS2_STRDUP( path, env );
+        long_path = axis2_string_replace ( long_path, '-', '_' );
+        long_path = axis2_string_replace ( long_path, ':', '_' );
 
-        long_path = (axis2_char_t*)AXIS2_STRDUP(path, env);
-        long_path = axis2_string_replace(long_path, '-', '_');
-        long_path = axis2_string_replace(long_path, ':', '_');
-
-        for (ptr = long_path_rev = long_path;
-                path_length ; ptr ++, path_length --)
+        for ( ptr = long_path_rev = long_path; 
+                         path_length ; ptr ++, path_length -- )
         {
-            if ('/' == *ptr || '\0' == *ptr)
+            if ( '/' == *ptr || '\0' == *ptr)
             {
-                *ptr = '\0';
+                *ptr ='\0';
                 package_name =
-                    w2c_string_add_string(package_name, ".", env);
+                    w2c_string_add_string ( package_name, ".", env);               
                 package_name =
-                    axis2_add_word_to_package_name
-                    (package_name , long_path_rev, env);
+                  axis2_add_word_to_package_name
+                           ( package_name , long_path_rev, env);
                 long_path_rev = ptr + 1;
             }
         }
-        free(long_path);
+        free ( long_path );
     }
-
+                
     return package_name;
 }
 
 /** internal methods */
 
 static axis2_char_t* axis2_add_word_to_package_name
-(axis2_char_t *package_name ,
-        axis2_char_t *long_path,
-        const axis2_env_t *env)
+              ( axis2_char_t *package_name ,
+                axis2_char_t *long_path,
+                const axis2_env_t *env )
 {
     /** make non keyword */
-    if (w2c_url_processor_is_token(long_path))
+    if ( w2c_url_processor_is_token( long_path) )
     {
-        package_name = w2c_string_add_string(package_name,
-                "_", env);
+        package_name = w2c_string_add_string ( package_name,
+                                "_", env );
     }
     /** starting with digit -> prefix _ */
-    if (isdigit(*long_path))
+    if ( isdigit(*long_path ) )
     {
-        package_name = w2c_string_add_string(package_name,
-                "_", env);
+        package_name = w2c_string_add_string ( package_name,
+                                "_", env );
     }
-    long_path = axis2_string_replace(long_path, '.', '_');
-    package_name = w2c_string_add_string(package_name, long_path, env);
-
+    long_path = axis2_string_replace ( long_path, '.', '_' );
+    package_name = w2c_string_add_string ( package_name, long_path, env );
+   
     return package_name;
 }
 
 static axis2_bool_t AXIS2_CALL
-w2c_url_processor_is_token(axis2_char_t *str)
+w2c_url_processor_is_token ( axis2_char_t *str )
 {
     int i = 0;
-    while (w2c_url_processor_c_tokens[i])
+    while ( w2c_url_processor_c_tokens[i] )
     {
-        if (!strcmp(w2c_url_processor_c_tokens[i], str))
+        if ( !strcmp (w2c_url_processor_c_tokens[i], str ) )
         {
             return AXIS2_TRUE;
         }

Modified: webservices/axis2/trunk/c/tools/codegen/src/util/xslt_template_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/xslt_template_processor.c?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/xslt_template_processor.c (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/xslt_template_processor.c Wed Sep 27 05:39:31 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+ 
 #include <w2c_xslt_template_processor.h>
 #include <string.h>
 #include <libxml/xmlmemory.h>
@@ -35,30 +35,33 @@
     axis2_char_t *xslt_filename,
     axis2_char_t *out_filename)
 {
-    xsltStylesheetPtr ssheet = NULL;
-    xmlDocPtr doc = NULL;
-    xmlDocPtr res = NULL;
-    FILE *out = NULL;
-
-    xmlSubstituteEntitiesDefault(1);
-    xmlLoadExtDtdDefaultValue = 1;
-
-    ssheet = xsltParseStylesheetFile((const xmlChar *)xslt_filename);
-    doc = (xmlDocPtr)xmlParseMemory(xml_stream,
-            (unsigned int)strlen(xml_stream));
-    res = xsltApplyStylesheet(ssheet, doc, NULL);
-
-    out = fopen(out_filename, "w+");
-    xsltSaveResultToFile(out, res, ssheet);
-
-    xsltFreeStylesheet(ssheet);
-    xmlFreeDoc(res);
-    xmlFreeDoc(doc);
+ 	xsltStylesheetPtr ssheet = NULL;
+	xmlDocPtr doc = NULL;
+	xmlDocPtr res = NULL;
+	FILE *out = NULL;
+    /* printf("%s\n --------%s\n\n", xslt_filename, xml_stream); */
+
+	xmlSubstituteEntitiesDefault(1);
+	xmlLoadExtDtdDefaultValue = 1;
+
+	ssheet = xsltParseStylesheetFile((const xmlChar *)xslt_filename);
+	doc = (xmlDocPtr)xmlParseMemory(xml_stream,
+                              (unsigned int)strlen (xml_stream));
+	res = xsltApplyStylesheet(ssheet, doc, NULL);
+      
+	out = fopen ( out_filename, "w+");
+	xsltSaveResultToFile(out, res, ssheet);
+
+
+    /*TODO: following freeing has some inpact to the external code*/
+	/*xmlFreeDoc(res);
+	xsltFreeStylesheet(ssheet);
+	xmlFreeDoc(doc);
+    xsltCleanupGlobals();*/
+    /*xmlCleanupParser();*/
 
-    xsltCleanupGlobals();
-    xmlCleanupParser();
     /* adding new line at the end */
-    fprintf(out, "\n");
-    fclose(out);
+    fprintf( out, "\n");
+    fclose( out);
 }
 

Modified: webservices/axis2/trunk/c/tools/codegen/src/util/xslt_utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/util/xslt_utils.c?view=diff&rev=450420&r1=450419&r2=450420
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/util/xslt_utils.c (original)
+++ webservices/axis2/trunk/c/tools/codegen/src/util/xslt_utils.c Wed Sep 27 05:39:31 2006
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+ 
 #include <w2c_xslt_utils.h>
 #include <axis2_qname.h>
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL 
 w2c_xslt_utils_add_attribute(
     const axis2_env_t *env,
     axiom_node_t *om_node,
@@ -26,12 +26,12 @@
 {
     axiom_element_t *om_ele = NULL;
     axiom_attribute_t *attri = NULL;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
-    om_ele = AXIOM_NODE_GET_DATA_ELEMENT(om_node, env);
-    attri = axiom_attribute_create(env, attribute, attrib_value, NULL);
-    AXIOM_ELEMENT_ADD_ATTRIBUTE(om_ele, env, attri, om_node);
+    AXIS2_ENV_CHECK ( env, AXIS2_FAILURE );
 
+    om_ele = AXIOM_NODE_GET_DATA_ELEMENT ( om_node, env );
+    attri = axiom_attribute_create ( env, attribute, attrib_value, NULL );
+    AXIOM_ELEMENT_ADD_ATTRIBUTE ( om_ele, env, attri, om_node );
+    
     return AXIS2_SUCCESS;
 }
 
@@ -43,30 +43,30 @@
 {
     axiom_node_t *child_node = NULL;
     axiom_element_t *child_ele = NULL;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_ENV_CHECK ( env, AXIS2_FAILURE );
 
-    child_ele = axiom_element_create(env,
-            parent_node,
-            element_name,
-            NULL,
-            &child_node);
+    child_ele = axiom_element_create ( env,
+                    parent_node,
+                    element_name,
+                    NULL,
+                    &child_node );
     return child_node;
 }
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 w2c_xslt_utils_serialize(
-    const axis2_env_t *env,
-    axiom_node_t *root)
+                const axis2_env_t *env,
+                axiom_node_t *root)
 {
     axiom_output_t *om_output = NULL;
     axiom_xml_writer_t *xml_writer = NULL;
     axis2_char_t *buffer = NULL;
 
     xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
-            AXIS2_XML_PARSER_TYPE_BUFFER);
-    om_output = axiom_output_create(env, xml_writer);
+                                      AXIS2_XML_PARSER_TYPE_BUFFER);
+    om_output = axiom_output_create (env, xml_writer);
 
-    AXIOM_NODE_SERIALIZE(root, env, om_output);
+    AXIOM_NODE_SERIALIZE (root, env, om_output);
     buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(xml_writer, env);
     return buffer;
 }
@@ -77,18 +77,18 @@
     axiom_node_t *node,
     axis2_char_t *text)
 {
-    axiom_element_t *ele = NULL;
-
-    ele = AXIOM_NODE_GET_DATA_ELEMENT(node, env);
-    AXIOM_ELEMENT_SET_TEXT(ele, env, text, node);
-    return node;
+   axiom_element_t *ele = NULL;
+   
+   ele = AXIOM_NODE_GET_DATA_ELEMENT ( node, env);
+   AXIOM_ELEMENT_SET_TEXT( ele, env, text, node);
+   return node;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 w2c_xslt_utils_copy_node_tree(
-    const axis2_env_t *env,
-    axiom_node_t *to,
-    axiom_node_t *from)
+     const axis2_env_t *env,
+     axiom_node_t *to,
+     axiom_node_t *from )
 {
     axiom_element_t *to_ele = NULL;
     axiom_element_t *from_ele = NULL;
@@ -104,43 +104,43 @@
     void *val = NULL;
     axiom_attribute_t *om_attri = NULL;
 
-    to_ele = AXIOM_NODE_GET_DATA_ELEMENT(to, env);
-    from_ele = AXIOM_NODE_GET_DATA_ELEMENT(from, env);
+    to_ele = AXIOM_NODE_GET_DATA_ELEMENT ( to, env );
+    from_ele = AXIOM_NODE_GET_DATA_ELEMENT ( from, env );
 
-    it = AXIOM_ELEMENT_GET_CHILDREN(from_ele, env, from);
-    AXIOM_CHILDREN_ITERATOR_RESET(it, env);
+    it = AXIOM_ELEMENT_GET_CHILDREN ( from_ele, env, from );
+    AXIOM_CHILDREN_ITERATOR_RESET( it, env);
 
-    while ((from_child = AXIOM_CHILDREN_ITERATOR_NEXT(it, env)))
+    while ( (from_child = AXIOM_CHILDREN_ITERATOR_NEXT( it, env )) != NULL )
     {
-        if (AXIOM_NODE_GET_NODE_TYPE(from_child, env) == AXIOM_TEXT)
+        if ( AXIOM_NODE_GET_NODE_TYPE ( from_child, env ) == AXIOM_TEXT )
         {
-            text = AXIOM_ELEMENT_GET_TEXT(from_ele, env, from);
-            text = AXIS2_STRDUP(text, env);
-            AXIOM_ELEMENT_SET_TEXT(to_ele, env, text, to);
+            text = AXIOM_ELEMENT_GET_TEXT ( from_ele, env, from );
+            text = AXIS2_STRDUP ( text, env);
+            AXIOM_ELEMENT_SET_TEXT ( to_ele, env, text, to);
         }
         else
         {
-            from_child_ele = AXIOM_NODE_GET_DATA_ELEMENT(from_child, env);
-            qname = AXIOM_ELEMENT_GET_QNAME(from_child_ele, env, from_child);
-            qname = AXIS2_QNAME_CLONE(qname, env);
-
-            axiom_element_create_with_qname(env, to, qname, &to_child);
-            w2c_xslt_utils_copy_node_tree(env, to_child, from_child);
+            from_child_ele = AXIOM_NODE_GET_DATA_ELEMENT ( from_child, env );
+            qname = AXIOM_ELEMENT_GET_QNAME ( from_child_ele, env, from_child );
+            qname = AXIS2_QNAME_CLONE ( qname, env );
+    
+            axiom_element_create_with_qname ( env, to, qname, &to_child );
+            w2c_xslt_utils_copy_node_tree ( env, to_child, from_child );
         }
     }
 
     attr_ht = AXIOM_ELEMENT_GET_ALL_ATTRIBUTES(from_ele, env);
-    if (attr_ht)
+    if(NULL != attr_ht)
     {
-        for (hi = axis2_hash_first(attr_ht, env);  hi;
+        for( hi = axis2_hash_first(attr_ht, env);  hi;
                 hi = axis2_hash_next(env, hi))
         {
             axis2_hash_this(hi, NULL, NULL, &val);
-            if (val)
+            if(NULL != val)
             {
                 om_attri = (axiom_attribute_t *)val;
-                om_attri = AXIOM_ATTRIBUTE_CLONE(om_attri, env);
-                AXIOM_ELEMENT_ADD_ATTRIBUTE(to_ele, env, om_attri, to);
+                om_attri = AXIOM_ATTRIBUTE_CLONE ( om_attri, env );
+                AXIOM_ELEMENT_ADD_ATTRIBUTE ( to_ele, env, om_attri, to);
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message