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 di...@apache.org on 2007/07/16 18:43:11 UTC

svn commit: r556666 [3/7] - in /webservices/axis2/scratch/c/dinesh/602/c: ./ build/win32/ guththila/ guththila/include/ guththila/src/ ides/vc/axis2c/ ides/vc/axis2c/axis2_engine/ ides/vc/axis2c/clients/echo_blocking/ ides/vc/axis2c/clients/echo_blocki...

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_error.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_error.h?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_error.h (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_error.h Mon Jul 16 09:42:53 2007
@@ -1,107 +1,99 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef GUTHTHILA_ERROR_H
-#define GUTHTHILA_ERROR_H
-
-#include <guththila_defines.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-  typedef enum guththila_status_codes
-    {
-      GUTHTHILA_FAILURE = 0,
-      GUTHTHILA_SUCCESS
-    } guththila_status_codes_t;
-
-  typedef enum guththila_error_codes
-    {
-      GUTHTHILA_ERROR_NONE = 0,
-      GUTHTHILA_ERROR_NO_MEMORY,
-      GUTHTHILA_ERROR_INVALID_NULL_PARAMETER,
-      GUTHTHILA_ERROR_INVALID_ITERATOR_STATE,
-      GUTHTHILA_ERROR_INVALID_NODE_TYPE,
-      GUTHTHILA_STREAM_WRITER_ERROR_NOT_IN_GUTHTHILA_START_ELEMENT,
-      GUTHTHILA_STREAM_WRITER_ERROR_WRITING_TO_STREAM,
-      GUTHTHILA_STREAM_WRITER_ERROR_STREAM_STRUCT_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_LOCAL_NAME_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_guththila_namespace_t_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_PREFIX_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_guththila_namespace_t_NOT_DECLARED,
-      GUTHTHILA_STREAM_WRITER_ERROR_guththila_element_t_guththila_stack_t_EMPTY,
-      GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_STATE,
-      GUTHTHILA_STREAM_WRITER_ERROR_GUTHTHILA_COMMENT_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_GUTHTHILA_COMMENT,
-      GUTHTHILA_STREAM_WRITER_ERROR_PROCESSING_INSTRUCTION_TARGET_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_CDATA_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_CDATA,
-      GUTHTHILA_STREAM_WRITER_ERROR_DTD_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_ENTITY_REF_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_XML_VERSION,
-      GUTHTHILA_STREAM_WRITER_ERROR_TEXT_NULL,
-      GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_PREFIX,
-      GUTHTHILA_STREAM_WRITER_ERROR_OUT_OF_MEMORY,
-      GUTHTHILA_STREAM_WRITER_ERROR_FILE_NOT_FOUND,
-      GUTHTHILA_STREAM_READER_ERROR_OUT_OF_MEMORY,
-      GUTHTHILA_ERROR_INVALID_ENCODING_DECLARATION,
-      GUTHTHILA_ERROR_UNEXPECTED_UTF16_EOF,
-      GUTHTHILA_ERROR_UNEXPECTED_EOF,
-      GUTHTHILA_ERROR_PROCESS_EQUAL,
-      GUTHTHILA_ERROR_INCORRECT_VERSION_INFO,
-      GUTHTHILA_ERROR_INCORRECT_XML_DECLARATION,
-      GUTHTHILA_ERROR_VERSION_INFO_NOT_FOUND,
-      GUTHTHILA_ERROR_ENCODING_DECLARATION_ERROR,
-      GUTHTHILA_ERROR_STANDALONE_ERROR_IN_YES,
-      GUTHTHILA_ERROR_STANDALONE_ERROR_IN_NO,
-      GUTHTHILA_ERROR_STANDALONE_ERROR_YES_OR_NO_NOT_AVAILABLE,
-      GUTHTHILA_ERROR_MISSING_GREATER_SIGN_IN_XML_DECLARATION,
-      GUTHTHILA_ERROR_INVALID_NAME_STARTING_CHARACTER,
-      GUTHTHILA_ERROR_QUOTES_NOT_FOUND_BEFORE_ATTRIBUTE_VALUE,
-      GUTHTHILA_ERROR_EMPTY_ELEMENT_NOT_CLOSED,
-      GUTHTHILA_ERROR_END_TAG_NOT_CLOSED,
-      GUTHTHILA_ERROR_MORE_HYPENS_OCCURED_IN_COMMENT,
-      GUTHTHILA_ERROR_TOKENIZE_ERROR,
-      GUTHTHILA_ERROR_INVALID_TOKEN_TYPE,
-      GUTHTHILA_ERROR_NULL_ATTRIBUTE_NAME,
-      GUTHTHILA_ERROR_NULL_ATTRIBUTE_VALUE,
-      GUTHTHILA_ERROR_NULL_ATTRIBUTE_PREFIX,
-      GUTHTHILA_ERROR_REQUESTED_NUMBER_GREATER_THAN_STACK_SIZE,
-      GUTHTHILA_WRITER_ERROR_EMPTY_ARGUMENTS,
-      GUTHTHILA_WRITER_ERROR_NON_EXSISTING_PREFIX,
-      GUTHTHILA_WRITER_ERROR_EMPTY_WRITER,
-      GUTHTHILA_WRITER_ERROR_NON_MATCHING_ELEMENTS,
-      GUTHTHILA_WRITER_ERROR_INVALID_BUFFER,
-      GUTHTHILA_WRITER_ERROR_INVALID_CHAR_IN_NAME,
-      GUTHTHILA_WRITER_ERROR_XML_STRING_IN_NAME,
-      GUTHTHILA_WRITER_ERROR_EXCESS_HYPENS_IN_COMMENT,
-      GUTHTHILA_WRITER_ERROR_INVALID_CHAR_IN_ATTRIBUTE,
-      GUTHTHILA_WRITER_ERROR_NON_EXSISTING_URI,
-      GUTHTHILA_WRITER_ERROR_SAME_ATTRIBUTE_REPEAT,
-	  GUTHTHILA_ERROR_ATTRIBUTE_FREE
-    } guththila_error_codes_t;
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif                          /* GUTHTHILA_ERROR_H */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <guththila_defines.h>
+
+#ifndef GUTHTHILA_ERROR_H
+#define GUTHTHILA_ERROR_H
+
+EXTERN_C_START()
+
+typedef enum guththila_error_l{
+	GUTHTHILA_VALIDITY_ERROR,
+	GUTHTHILA_VALIDITY_WARNING,
+	GUTHTHILA_PARSER_ERROR,
+	GUTHTHILA_PARSER_WARNING,
+} guththila_error_level;
+
+enum guththila_error_codes {							
+	GUTHTHILA_ERROR_NONE = 0,
+	GUTHTHILA_ERROR_NO_MEMORY,
+	GUTHTHILA_ERROR_INVALID_NULL_PARAMETER,
+	GUTHTHILA_ERROR_INVALID_ITERATOR_STATE,
+	GUTHTHILA_ERROR_INVALID_NODE_TYPE,
+	GUTHTHILA_STREAM_WRITER_ERROR_NOT_IN_GUTHTHILA_START_ELEMENT,
+	GUTHTHILA_STREAM_WRITER_ERROR_WRITING_TO_STREAM,
+	GUTHTHILA_STREAM_WRITER_ERROR_STREAM_STRUCT_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_LOCAL_NAME_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_GUTHTHILA_namespace_t_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_PREFIX_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_GUTHTHILA_namespace_t_NOT_DECLARED,
+	GUTHTHILA_STREAM_WRITER_ERROR_GUTHTHILA_element_t_GUTHTHILA_stack_t_EMPTY,
+	GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_STATE,
+	GUTHTHILA_STREAM_WRITER_ERROR_GUTHTHILA_COMMENT_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_GUTHTHILA_COMMENT,
+	GUTHTHILA_STREAM_WRITER_ERROR_PROCESSING_INSTRUCTION_TARGET_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_CDATA_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_CDATA,
+	GUTHTHILA_STREAM_WRITER_ERROR_DTD_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_ENTITY_REF_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_XML_VERSION,
+	GUTHTHILA_STREAM_WRITER_ERROR_TEXT_NULL,
+	GUTHTHILA_STREAM_WRITER_ERROR_ILLEGAL_PREFIX,
+	GUTHTHILA_STREAM_WRITER_ERROR_OUT_OF_MEMORY,
+	GUTHTHILA_STREAM_WRITER_ERROR_FILE_NOT_FOUND,
+	GUTHTHILA_STREAM_READER_ERROR_OUT_OF_MEMORY,
+	GUTHTHILA_ERROR_INVALID_ENCODING_DECLARATION,
+	GUTHTHILA_ERROR_UNEXPECTED_UTF16_EOF,
+	GUTHTHILA_ERROR_UNEXPECTED_EOF,
+	GUTHTHILA_ERROR_PROCESS_EQUAL,
+	GUTHTHILA_ERROR_INCORRECT_VERSION_INFO,
+	GUTHTHILA_ERROR_INCORRECT_XML_DECLARATION,
+	GUTHTHILA_ERROR_VERSION_INFO_NOT_FOUND,
+	GUTHTHILA_ERROR_ENCODING_DECLARATION_ERROR,
+	GUTHTHILA_ERROR_STANDALONE_ERROR_IN_YES,
+	GUTHTHILA_ERROR_STANDALONE_ERROR_IN_NO,
+	GUTHTHILA_ERROR_STANDALONE_ERROR_YES_OR_NO_NOT_AVAILABLE,
+	GUTHTHILA_ERROR_MISSING_GREATER_SIGN_IN_XML_DECLARATION,
+	GUTHTHILA_ERROR_INVALID_NAME_STARTING_CHARACTER,
+	GUTHTHILA_ERROR_QUOTES_NOT_FOUND_BEFORE_ATTRIBUTE_VALUE,
+	GUTHTHILA_ERROR_EMPTY_ELEMENT_NOT_CLOSED,
+	GUTHTHILA_ERROR_END_TAG_NOT_CLOSED,
+	GUTHTHILA_ERROR_MORE_HYPENS_OCCURED_IN_COMMENT,
+	GUTHTHILA_ERROR_TOKENIZE_ERROR,
+	GUTHTHILA_ERROR_INVALID_TOKEN_TYPE,
+	GUTHTHILA_ERROR_NULL_ATTRIBUTE_NAME,
+	GUTHTHILA_ERROR_NULL_ATTRIBUTE_VALUE,
+	GUTHTHILA_ERROR_NULL_ATTRIBUTE_PREFIX,
+	GUTHTHILA_ERROR_REQUESTED_NUMBER_GREATER_THAN_STACK_SIZE,
+	GUTHTHILA_WRITER_ERROR_EMPTY_ARGUMENTS,
+	GUTHTHILA_WRITER_ERROR_NON_EXSISTING_PREFIX,
+	GUTHTHILA_WRITER_ERROR_EMPTY_WRITER,
+	GUTHTHILA_WRITER_ERROR_NON_MATCHING_ELEMENTS,
+	GUTHTHILA_WRITER_ERROR_INVALID_BUFFER,
+	GUTHTHILA_WRITER_ERROR_INVALID_CHAR_IN_NAME,
+	GUTHTHILA_WRITER_ERROR_XML_STRING_IN_NAME,
+	GUTHTHILA_WRITER_ERROR_EXCESS_HYPENS_IN_COMMENT,
+	GUTHTHILA_WRITER_ERROR_INVALID_CHAR_IN_ATTRIBUTE,
+	GUTHTHILA_WRITER_ERROR_NON_EXSISTING_URI,
+	GUTHTHILA_WRITER_ERROR_SAME_ATTRIBUTE_REPEAT,
+	GUTHTHILA_ERROR_ATTRIBUTE_FREE												
+};
+
+EXTERN_C_END()
+
+#endif
+

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_namespace.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_namespace.h?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_namespace.h (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_namespace.h Mon Jul 16 09:42:53 2007
@@ -1,33 +1,54 @@
-/*
- *   Copyright 2004,2005 The Apache Software Foundation.
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- *   
- */
-
-
-#ifndef GUTHTHILA_NAMESPACE_H
-#define GUTHTHILA_NAMESPACE_H
-#include "guththila_token.h"
-
-typedef struct guththila_namespace_s
-{
-    guththila_char_t *name;
-    int length;
-    guththila_char_t *uri;
-    int lengthuri;
-    
-} guththila_namespace_t;
-
-#endif /* GUTHTHILA_NAMESPACE_H */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef GUTHTHILA_NAMESPACE_H
+#define GUTHTHILA_NAMESPACE_H
+
+#include <guththila_defines.h>
+#include <guththila_token.h> 
+#include <axutil_utils.h>
+
+EXTERN_C_START()
+
+#ifndef GUTHTHILA_NAMESPACE_DEF_SIZE
+#define GUTHTHILA_NAMESPACE_DEF_SIZE 4
+#endif
+
+typedef struct guththila_namespace_s
+{
+    guththila_token_t *name;
+    guththila_token_t *uri;	 
+} guththila_namespace_t;
+
+typedef struct guththila_namespace_list_s
+{
+	guththila_namespace_t *list;
+	guththila_stack_t fr_stack;
+	int size;
+	int capacity;		
+} guththila_namespace_list_t;
+
+guththila_namespace_list_t * GUTHTHILA_CALL guththila_namespace_list_create(const axutil_env_t *env);
+int GUTHTHILA_CALL guththila_namespace_list_init(guththila_namespace_list_t *at_list, const axutil_env_t *env);
+guththila_namespace_t * GUTHTHILA_CALL guththila_namespace_list_get(guththila_namespace_list_t *at_list, const axutil_env_t *env);
+int GUTHTHILA_CALL guththila_namespace_list_release(guththila_namespace_list_t *at_list, guththila_namespace_t *namesp, const axutil_env_t *env);
+void GUTHTHILA_CALL msuila_namespace_list_free_data(guththila_namespace_list_t *at_list, const axutil_env_t *env);
+void GUTHTHILA_CALL guththila_namespace_list_free(guththila_namespace_list_t *at_list, const axutil_env_t *env);
+
+EXTERN_C_END()
+
+#endif
+

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_reader.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_reader.h?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_reader.h (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_reader.h Mon Jul 16 09:42:53 2007
@@ -1,83 +1,73 @@
 /*
- *   Copyright 2004,2005 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- *   
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 #ifndef GUTHTHILA_READER_H
 #define GUTHTHILA_READER_H
 
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "guththila_buffer.h"
-#include "guththila_defines.h"
-#include <axutil_env.h>
-#include "guththila_error.h"
+#include <guththila_defines.h>
 #include <axutil_utils.h>
 
-typedef enum guththila_reader_types
-  {
-    GUTHTHILA_FILE_READER = 1,
+EXTERN_C_START()
+
+typedef int (GUTHTHILA_CALL *GUTHTHILA_READ_INPUT_CALLBACK)(char *buffer, int size, 
+    void* ctx);
+
+enum guththila_reader_type
+{
+	GUTHTHILA_FILE_READER = 1,
     GUTHTHILA_IO_READER,
     GUTHTHILA_MEMORY_READER
-  } guththila_reader_types_t;
+};
 
 typedef struct guththila_reader_s
 {
-    int guththila_reader_type;
-    
+	int type;
+	FILE *fp;
+	int last_start; /*if -1 we are not in a token*/
+	char *buff;
+	int buff_size;
+	GUTHTHILA_READ_INPUT_CALLBACK input_read_callback;
+	void* context;	
 } guththila_reader_t;
 
+#ifndef GUTHTHILA_READER_SET_LAST_START
+#define GUTHTHILA_READER_SET_LAST_START(_reader, _start) ((_reader)->start = _start)
+#endif
 
+#ifndef GUTHTHILA_READER_STEP_BACK
+#define GUTHTHILA_READER_STEP_BACK(_reader) ((_reader->next--))
+#endif
 
-typedef struct guththila_reader_impl_t
-{
-	guththila_reader_t reader;
-	int buffer_size;
-	FILE *fp;
-	char *buffer;
-	AXIS2_READ_INPUT_CALLBACK input_read_callback;
-	void* context;
-}guththila_reader_impl_t;
-
-
-AXIS2_EXTERN guththila_reader_t * AXIS2_CALL
-guththila_reader_create_for_file (axutil_env_t * environment,
-                                  char* filename);
-
-AXIS2_EXTERN guththila_reader_t * AXIS2_CALL 
-guththila_reader_create_for_io(axutil_env_t *environment,
-							   AXIS2_READ_INPUT_CALLBACK input_read_callback, void *ctx);
-
-AXIS2_EXTERN guththila_reader_t * AXIS2_CALL
-guththila_reader_create_for_memory(axutil_env_t *environment,
-                                   void *buffer,
-                                    int size,
-				   void *ctx); 
-
-
-AXIS2_EXTERN int AXIS2_CALL
-guththila_reader_read (axutil_env_t * environment,
-                       guththila_char_t * buffer, int offset, int length,
-                       guththila_reader_t * r);
+GUTHTHILA_EXPORT guththila_reader_t * GUTHTHILA_CALL
+guththila_reader_create_for_file (char* filename, const axutil_env_t *env);
+
+GUTHTHILA_EXPORT guththila_reader_t * GUTHTHILA_CALL 
+guththila_reader_create_for_io(GUTHTHILA_READ_INPUT_CALLBACK input_read_callback, void *ctx, const axutil_env_t *env);
 
+GUTHTHILA_EXPORT guththila_reader_t * GUTHTHILA_CALL
+guththila_reader_create_for_memory(void *buffer, int size, const axutil_env_t *env); 
+
+GUTHTHILA_EXPORT int GUTHTHILA_CALL
+guththila_reader_read (guththila_reader_t *r, guththila_char *buffer, int offset, int length, const axutil_env_t *env);
                        
-AXIS2_EXTERN void AXIS2_CALL
-guththila_reader_free (axutil_env_t * environment,
-                       guththila_reader_t * r);
+GUTHTHILA_EXPORT void GUTHTHILA_CALL
+guththila_reader_free (guththila_reader_t * r, const axutil_env_t *env);
+
+EXTERN_C_END()
+
+#endif
 
-#endif /* GUTHTHILA_READER_H */

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_token.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_token.h?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_token.h (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_token.h Mon Jul 16 09:42:53 2007
@@ -1,133 +1,87 @@
-/*
- *   Copyright 2004,2005 The Apache Software Foundation.
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- *   
- */
-
-
-#ifndef GUTHTHILA_TOKEN_H
-#define GUTHTHILA_TOKEN_H
-
-/* #include "guththila_environment.h" */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <axutil_env.h>
-#include <axutil_stack.h>
-#include <guththila_defines.h>
-
-
-typedef struct guththila_token_s
-{
-    int type;
-    guththila_char_t *start;
-    guththila_char_t *end;
-    int last;
-    int size;
-    int ref;
-} guththila_token_t;
-
-
-enum guththila_token_type
-{
-    Unknown = 1,
-    _name,
-    _value,
-    _attribute,
-    _attribute_value,
-    _prefix,
-    _char_data
-};
-
-
-AXIS2_EXTERN guththila_token_t *
-guththila_token_create_token_buffer (axutil_env_t * environment,
-                                     int size);
-                                     
-AXIS2_EXTERN void
-guththila_token_free (axutil_env_t * environment,
-					  guththila_token_t * tok);
-AXIS2_EXTERN int
-guththila_token_length (axutil_env_t * environment,
-                        guththila_token_t * tok);
-                        
-AXIS2_EXTERN void
-guththila_token_exception ();
-
-AXIS2_EXTERN guththila_token_t *
-guththila_token_append (axutil_env_t * environment,
-                        guththila_token_t * tok);
-                        
-AXIS2_EXTERN guththila_token_t *
-guththila_token_grow (axutil_env_t * environment,
-                      guththila_token_t * tok);
-                      
-AXIS2_EXTERN guththila_token_t *
-guththila_token_last (axutil_env_t * environment,
-                      guththila_token_t * tok);
-                      
-AXIS2_EXTERN int
-guththila_token_count (axutil_env_t * environment,
-                       guththila_token_t * tok);
-                       
-AXIS2_EXTERN guththila_char_t *
-guththila_token_to_string (axutil_env_t * environment,
-                           guththila_token_t * tok,
-                           int unicode);
-                           
-AXIS2_EXTERN void
-guththila_token_relocate (axutil_env_t * environment,
-                          guththila_token_t * tok,
-                          int offset);
-                          
-                          
-AXIS2_EXTERN int
-guththila_token_compare (axutil_env_t * environment,
-                         guththila_token_t * tok,
-                         const guththila_char_t * st,
-                         int n, 
-                         int unicode_state);
-                         
-                         
-AXIS2_EXTERN guththila_char_t *
-guththila_token_convert_utf16_to_utf8 (axutil_env_t * environment,
-                                       guththila_char_t * buffer,
-                                       int length);
-                                       
-AXIS2_EXTERN int
-guththila_token_length_utf16 (axutil_env_t * environment,
-                              unsigned int utf16_ch);
-                              
-                              
-AXIS2_EXTERN guththila_char_t *
-guththila_token_build_utf8 (axutil_env_t * environment,
-                            unsigned int utf16_ch,
-                            int length);
-                            
-AXIS2_EXTERN guththila_char_t *
-guththila_token_char_ref (axutil_env_t * environment,
-                          guththila_char_t * buffer);
-                          
-AXIS2_EXTERN void AXIS2_CALL
-guththila_relocate_tokens(axutil_env_t *environment,
-						  axutil_stack_t *stack,
-						  int offset);
-
-#endif /* GUTHTHILA_TOKEN_H */
-
-
-
-
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef GUTHTHILA_TOKEN_H
+#define GUTHTHILA_TOKEN_H
+
+#include <guththila_defines.h>
+#include <guththila_stack.h>
+
+EXTERN_C_START()
+
+typedef struct guththila_token_s
+{
+	short type;
+	char *start;
+	int _start;
+	size_t size;
+	int last;
+	int ref;	
+} guththila_token_t;
+
+enum guththila_token_type
+{  
+	_Unknown = 1,
+    _name,
+	_attribute_name,
+    _attribute_value,
+    _prefix,
+    _char_data
+};
+
+typedef struct guththila_tok_list_s
+{
+	guththila_stack_t fr_stack;
+	guththila_token_t **list;
+	int no_list;
+	int cur_list;	
+	int *capacity;
+} guththila_tok_list_t;
+
+#ifndef GUTHTHILA_TOK_DEF_SIZE
+#define GUTHTHILA_TOK_DEF_SIZE 4
+#endif
+
+#ifndef GUTHTHILA_TOK_DEF_LIST_SIZE
+#define GUTHTHILA_TOK_DEF_LIST_SIZE 16
+#endif
+
+#ifndef GUTHTHILA_TOKEN_LEN
+#define GUTHTHILA_TOKEN_LEN(tok) (tok->size)
+#endif
+
+#ifndef GUTHTHILA_TOKEN_TO_STRING
+#define GUTHTHILA_TOKEN_TO_STRING(tok, string, _env) \
+	string = (char *)AXIS2_MALLOC(_env->allocator, (GUTHTHILA_TOKEN_LEN(tok) + 1) * sizeof (char));	\
+	memcpy(string, (tok)->start, GUTHTHILA_TOKEN_LEN(tok));						\
+	string[GUTHTHILA_TOKEN_LEN(tok)] = 0;										
+#endif
+
+guththila_tok_list_t * GUTHTHILA_CALL guththila_tok_list_create(const axutil_env_t *env);
+int GUTHTHILA_CALL guththila_tok_list_init(guththila_tok_list_t *tok_list, const axutil_env_t *env);
+void GUTHTHILA_CALL guththila_tok_list_free(guththila_tok_list_t *tok_list, const axutil_env_t *env);
+guththila_token_t * GUTHTHILA_CALL guththila_tok_list_get_token(guththila_tok_list_t *tok_list, const axutil_env_t *env);
+int GUTHTHILA_CALL guththila_tok_list_release_token(guththila_tok_list_t *tok_list, guththila_token_t *token, const axutil_env_t *env);
+void GUTHTHILA_CALL guththila_tok_list_free_data(guththila_tok_list_t *tok_list, const axutil_env_t *env);
+int GUTHTHILA_CALL guththila_tok_list_grow(guththila_tok_list_t *tok_list, const axutil_env_t *env);
+
+int GUTHTHILA_CALL guththila_tok_str_cmp(guththila_token_t *tok, char *str, size_t str_len, const axutil_env_t *env);
+int GUTHTHILA_CALL guththila_tok_tok_cmp(guththila_token_t *tok1, guththila_token_t *tok2, const axutil_env_t *env);
+
+EXTERN_C_END()
+
+#endif
+

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_xml_writer.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_xml_writer.h?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_xml_writer.h (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/include/guththila_xml_writer.h Mon Jul 16 09:42:53 2007
@@ -1,43 +1,262 @@
 /*
- *   Copyright 2004,2005 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- *	
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
+#ifndef GUTHTHILA_XML_WRITER_H
+#define GUTHTHILA_XML_WRITER_H
+
+#include <guththila_token.h>
+#include <guththila_defines.h>
+#include <guththila_buffer.h>
+#include <guththila.h>
+#include <axutil_utils.h>
+
+EXTERN_C_START()
+
+#define GUTHTHILA_XML_WRITER_TOKEN
+/*
+Design notes:-
+namesp member of guththila_xml_writer_s is populated with malloc created objects. 
+Providing a list for this seems expensive because most of the times only few 
+namespaces are present in a XML document.  
+
+element member of guththila_xml_writer_s must be povided the list capablity. This 
+is particularly important in very deep XML documents.
+*/
+typedef enum guththila_writer_type_s
+{
+	GUTHTHILA_WRITER_FILE = 1,
+	GUTHTHILA_WRITER_MEMORY
+} guththila_writer_type_t;
+
+typedef struct guththila_writer_s
+{
+	short type;
+	FILE *out_stream;
+	guththila_buffer_t *buffer;
+	int next;
+} guththila_writer_t;
 
-#ifndef XML_STREAMWRITER_H
-#define XML_STREAMWRITER_H
-#include "guththila_writer.h"
-#include "guththila_buffer.h"
-#include <axutil_env.h>
-#include <axutil_stack.h>
+typedef enum guththila_writer_status_s
+{
+	/*Started writing a non empty element*/
+	START = 1,
+	/*Started writing a empty element*/
+	START_EMPTY,
+	/*We are in a position to begin wrting an element*/
+	BEGINING
+} guththila_writer_status_t;
 
+/*Main structure which provides the writer capability*/
 typedef struct guththila_xml_writer_s
 {
-	axutil_stack_t *element;
-	axutil_stack_t *attribute;
-	axutil_stack_t *namespace;
-	axutil_stack_t *depth;
+	guththila_stack_t element;
+	guththila_stack_t namesp;
 	guththila_writer_t *writer;
+#ifdef GUTHTHILA_XML_WRITER_TOKEN
+	guththila_tok_list_t tok_list;
+#endif
+	/* Type of this writer. Can be file writer or memory writer*/ 
+	guththila_writer_type_t type;
+
+	FILE *out_stream;
+	guththila_buffer_t buffer;
+	guththila_writer_status_t status;
 	int next;
-	int last;
-	int offset;
-	int start_element_open;
-	int empty_element_open;
-}guththila_xml_writer_t;
+} guththila_xml_writer_t;
+
+/*TODO: we need to came up with common implementation of followng two structures in writer and reader*/
+/* 
+This is a private structure for keeping track of the elements. When we start to write an element this structure will be pop
+*/
+typedef struct guththila_xml_writer_element_s
+{
+#ifdef GUTHTHILA_XML_WRITER_TOKEN
+	guththila_token_t *prefix;
+	guththila_token_t *name;	
+#else 
+	guththila_char *prefix;
+	guththila_char *name;
+#endif
+	/* contains the number of the stack which holds the namespaces 
+	for this element. When we close this element all the namespaces 
+	that are below this should also must be closed*/
+	int name_sp_stack_no;
+} guththila_xml_writer_element_t;
+
+typedef struct guththila_xml_writer_namesp_s
+{
+	/* These are double pointers because a single element may contain multple 
+	namespace declarations */
+#ifdef GUTHTHILA_XML_WRITER_TOKEN
+	guththila_token_t **name;
+	guththila_token_t **uri;	
+#else
+	guththila_char **name;
+	guththila_char **uri;
+#endif
+	int no;	/*number of namespaces*/
+	int size;
+} guththila_xml_writer_namesp_t;
+
+#define GUTHTHILA_XML_WRITER_NAMESP_DEF_SIZE 4
+
+/*Writer functions*/
+GUTHTHILA_EXPORT guththila_xml_writer_t *  GUTHTHILA_CALL
+guththila_create_xml_stream_writer(char *file_name, const axutil_env_t *env);
+
+GUTHTHILA_EXPORT guththila_xml_writer_t *  GUTHTHILA_CALL
+guththila_create_xml_stream_writer_for_memory(const axutil_env_t *env);
+
+GUTHTHILA_EXPORT int GUTHTHILA_CALL
+guththila_write_to_buffer (guththila_xml_writer_t *wr, char *buff, int size, const axutil_env_t *env);
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_namespace (guththila_xml_writer_t *wr, char *prefix, char *uri, const axutil_env_t *env);
+
+GUTHTHILA_EXPORT int GUTHTHILA_CALL
+guththila_do_write_attribute_with_prefix_and_namespace (guththila_xml_writer_t *wr,
+									char *prefix, 
+									char *namespace_uri,
+									char *local_name, 
+									char *value,
+									const axutil_env_t *env);
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_start_document (guththila_xml_writer_t *wr, const axutil_env_t *env);
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_start_element ( guththila_xml_writer_t *wr, char *start_element, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_end_element ( guththila_xml_writer_t *wr, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_close ( guththila_xml_writer_t *wr, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_characters (guththila_xml_writer_t *wr, char  *buff, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_comment (guththila_xml_writer_t *wr, char *buff, const axutil_env_t *env);
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_escape_character (guththila_xml_writer_t *wr, char *buff, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_empty_element (guththila_xml_writer_t *wr, char *empty_element, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_default_namespace (guththila_xml_writer_t *wr, char *namespace_uri, const axutil_env_t *env);
+
+
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_attribute (guththila_xml_writer_t *wr, char *localname, char *value, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_attribute_with_prefix_and_namespace (guththila_xml_writer_t *wr, char *prefix, 
+								     char *namespace_uri, char *localname, char *value, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_attribute_with_prefix ( guththila_xml_writer_t *wr, char *prefix,
+						       char *localname, char *value, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int   GUTHTHILA_CALL
+guththila_write_attribute_with_namespace (guththila_xml_writer_t *wr, char *namesp,
+	char *localname, char *value, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_start_element_with_prefix_and_namespace (guththila_xml_writer_t *wr, char* prefix,
+									 char *namespace_uri, char *local_name, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_start_element_with_namespace (guththila_xml_writer_t *wr, char *namespace_uri, 
+							      char *local_name, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_start_element_with_prefix ( guththila_xml_writer_t *wr, char *prefix, char *local_name, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_empty_element_with_prefix_and_namespace (guththila_xml_writer_t *wr, char* prefix,
+									 char *namespace_uri, char *local_name, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_empty_element_with_namespace ( guththila_xml_writer_t *wr, char *namespace_uri, char *local_name, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_empty_element_with_prefix ( guththila_xml_writer_t *wr, char *prefix, char *local_name, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_end_document ( guththila_xml_writer_t *wr, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT int  GUTHTHILA_CALL
+guththila_write_line ( guththila_xml_writer_t *wr, char *element_name, char *characters, const axutil_env_t *env);
+
+GUTHTHILA_EXPORT char * GUTHTHILA_CALL
+guththila_get_memory_buffer (guththila_xml_writer_t *wr, const axutil_env_t *env);
+
+GUTHTHILA_EXPORT unsigned int GUTHTHILA_CALL
+guththila_get_memory_buffer_size(guththila_xml_writer_t *wr, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT void GUTHTHILA_CALL
+guththila_xml_writer_free (guththila_xml_writer_t *wr, const axutil_env_t *env);
+
+
+GUTHTHILA_EXPORT char * GUTHTHILA_CALL
+guththila_get_prefix_for_namespace (guththila_xml_writer_t *wr, 
+								 char *namespace, const axutil_env_t *env);
+
+/**@description 
+  *
+  */
+int GUTHTHILA_CALL 
+guththila_write(guththila_xml_writer_t *wr, 
+			 char *buff, 
+			 size_t buff_size, const axutil_env_t *env);
 
+/**@description 
+  *
+  */
+int GUTHTHILA_CALL 
+guththila_write_token(guththila_xml_writer_t *wr, 
+				   guththila_token_t *tok, const axutil_env_t *env);
 
+/**@description 
+  *
+  */
+int GUTHTHILA_CALL guththila_write_xtoken(guththila_xml_writer_t *wr, char *buff, size_t buff_len, const axutil_env_t *env);
+EXTERN_C_END()
 
-#endif /* XML_STREAMWRITER_H */
+#endif
 

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/src/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/src/Makefile.am?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/src/Makefile.am (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/src/Makefile.am Mon Jul 16 09:42:53 2007
@@ -1,12 +1,12 @@
 lib_LTLIBRARIES = libguththila.la
 
 libguththila_la_SOURCES = guththila_buffer.c \
+			  guththila_namespace.c \			  
 	 		  guththila_token.c \
 			  guththila_reader.c \
-			  guththila_writer.c \
 			  guththila_attribute.c \
-			  guththila_xml_pull_parser.c \
-			  guththila_unicode.c \
+			  guththila_xml_parser.c \
+			  guththila_stack.c \
 			  guththila_xml_writer.c
 
 libguththila_la_LIBADD = ../../util/src/libaxutil.la

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_attribute.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_attribute.c?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_attribute.c (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_attribute.c Mon Jul 16 09:42:53 2007
@@ -1,42 +1,101 @@
-#include <guththila_token.h>
-#include <guththila_attribute.h>
-
-AXIS2_EXTERN guththila_attribute_t *AXIS2_CALL
-guththila_attribute_create (
-	axutil_env_t *env, 
-	guththila_token_t *prefix, 
-	guththila_token_t *name, 
-	guththila_token_t *value,
-	guththila_token_t *namespace_uri)
-{
-	guththila_attribute_t *att = NULL;
-	att =
-        (guththila_attribute_t *) AXIS2_MALLOC(env->allocator,
-                sizeof (guththila_attribute_t));
-    att->name = name;
-    att->value = value;
-    att->prefix = prefix;
-	att->namespace_uri = namespace_uri;
-	return att;
-}
-
-AXIS2_EXTERN void AXIS2_CALL
-guththila_attribute_free (
-	axutil_env_t *env,
-	guththila_attribute_t *attribute)
-{
-	if (attribute)
-	{
-		if (attribute->prefix)
-			guththila_token_free (env, attribute->prefix);
-		if (attribute->name)
-			guththila_token_free (env, attribute->name);
-		if (attribute->value)
-			guththila_token_free (env, attribute->value);
-		if (attribute->namespace_uri)
-			guththila_token_free (env, attribute->namespace_uri);
-		AXIS2_FREE (env->allocator, attribute);
-		attribute = NULL;
-	}
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <guththila_attribute.h>
+#include <guththila_stack.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int GUTHTHILA_CALL guththila_attr_list_grow(guththila_attr_list_t *at_list, int addition, const axutil_env_t *env)
+{
+	int  i = 0;
+	if (addition > 0 || (addition < 0 && at_list->capacity + addition > 0 && at_list->capacity + addition >= at_list->size)) {
+		at_list->list = (guththila_attr_t *)realloc(at_list->list, sizeof(guththila_attr_t) * (at_list->capacity + addition));
+		if (at_list->list){			
+			for (i = at_list->capacity; i < at_list->capacity + addition; i++){
+				guththila_stack_push(&at_list->fr_stack, at_list->list + i, env);
+			}
+			at_list->capacity += addition;
+		} else {
+			return GUTHTHILA_FAILURE;
+		}
+	}
+	return 0;
+}
+
+guththila_attr_list_t * GUTHTHILA_CALL guththila_attr_list_create(const axutil_env_t *env)
+{
+	int i = 0;
+	guththila_attr_list_t *at_list = (guththila_attr_list_t *) AXIS2_MALLOC(env->allocator, sizeof(guththila_attr_list_t));
+	if (!at_list) return NULL;
+
+	at_list->list = (guththila_attr_t *)AXIS2_MALLOC(env->allocator, sizeof(guththila_attr_t) * GUTHTHILA_ATTR_DEF_SIZE);
+
+	if (at_list->list && guththila_stack_init(&at_list->fr_stack, env))
+    {
+		at_list->capacity = GUTHTHILA_ATTR_DEF_SIZE;
+		at_list->size = 0;
+		for (i = 0;i < GUTHTHILA_ATTR_DEF_SIZE; i++){
+			guththila_stack_push(&at_list->fr_stack, at_list->list + i, env);
+		}
+		return at_list;	
+	}
+	return NULL;
+}
+
+int GUTHTHILA_CALL guththila_attr_list_init(guththila_attr_list_t *at_list, const axutil_env_t *env)
+{
+	int i = 0;	
+	at_list->list = (guththila_attr_t *)AXIS2_MALLOC(env->allocator, sizeof(guththila_attr_t) * GUTHTHILA_ATTR_DEF_SIZE);
+
+	if (at_list->list && guththila_stack_init(&at_list->fr_stack, env))
+    {
+		at_list->capacity = GUTHTHILA_ATTR_DEF_SIZE;
+		at_list->size = 0;
+		for (i = 0;i < GUTHTHILA_ATTR_DEF_SIZE; i++){
+			guththila_stack_push(&at_list->fr_stack, at_list->list + i, env);
+		}
+		return GUTHTHILA_SUCCESS;	
+	}
+	return GUTHTHILA_FAILURE;
+}
+
+guththila_attr_t * GUTHTHILA_CALL guththila_attr_list_get(guththila_attr_list_t *at_list, const axutil_env_t *env)
+{
+	if (at_list->fr_stack.top > 0 || guththila_attr_list_grow(at_list, GUTHTHILA_ATTR_DEF_SIZE, env)){
+		return guththila_stack_pop(&at_list->fr_stack, env);			
+	} 	
+	return NULL;
+}
+int GUTHTHILA_CALL guththila_attr_list_release(guththila_attr_list_t *at_list, guththila_attr_t *attr, const axutil_env_t *env)
+{
+	return guththila_stack_push(&at_list->fr_stack, attr, env); 			
+}
+
+void GUTHTHILA_CALL msuila_attr_list_free_data(guththila_attr_list_t *at_list, const axutil_env_t *env)
+{
+	AXIS2_FREE(env->allocator, at_list->list);
+	guththila_stack_un_init(&at_list->fr_stack, env);
+}
+
+void GUTHTHILA_CALL guththila_attr_list_free(guththila_attr_list_t *at_list, const axutil_env_t *env)
+{
+	AXIS2_FREE(env->allocator, at_list->list);
+	guththila_stack_un_init(&at_list->fr_stack, env);
+	AXIS2_FREE(env->allocator, at_list);
+}
+

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_buffer.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_buffer.c?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_buffer.c (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_buffer.c Mon Jul 16 09:42:53 2007
@@ -1,115 +1,95 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/* #include "guththila_environment.h" */
-#include <string.h>
-#include "guththila_buffer.h"
-#include <axutil_env.h>
-#include <stdio.h>
-
-AXIS2_EXTERN guththila_buffer_t * AXIS2_CALL
-guththila_buffer_create(axutil_env_t * environment, int size)
-{
-    guththila_buffer_t *name;
-    name = NULL;
-    name  = AXIS2_MALLOC(environment->allocator,
-            sizeof(guththila_buffer_t));
-    if (name)
-    {
-        name->size = size;
-        name->offset = 0;
-        name->last = 0;
-        name->next = 0;
-        name->is_memory = 0;
-        name->buff = NULL;
-        if (size)
-		{
-            name->buff = (guththila_char_t *) AXIS2_MALLOC(
-				environment->allocator, (size+1) * sizeof (guththila_char_t));
-			memset (name->buff, 0, size + 1);
-		}
-    }
-    return name;
-}
-
-AXIS2_EXTERN guththila_buffer_t *
-guththila_buffer_create_for_buffer(axutil_env_t * environment, char *buffer, int size)
-{
-    guththila_buffer_t *name;
-    name = NULL;
-    name  = AXIS2_MALLOC(environment->allocator,
-            sizeof(guththila_buffer_t));
-    if (name)
-    {
-        name->size = size;
-        name->offset = 0;
-        name->is_memory = 1;
-        name->last = size;
-        name->next = 0;
-        name->buff = NULL;
-        if (buffer)
-            name->buff = buffer;
-    }
-    return name;
-}
-
-AXIS2_EXTERN void
-guththila_buffer_free(axutil_env_t * environment,
-        guththila_buffer_t * name)
-{
-    if (name)
-    {
-        if (name->buff && !name->is_memory)
-        {
-            AXIS2_FREE(environment->allocator, name->buff);
-            name->buff = NULL;
-        }
-        AXIS2_FREE(environment->allocator, name);
-        name = NULL;
-    }
-}
-
-
-AXIS2_EXTERN guththila_buffer_t *
-guththila_buffer_grow(axutil_env_t * environment,
-					  guththila_buffer_t * name,
-					  int buffer_length)
-{
-
-    guththila_char_t *x = NULL;
-	unsigned int length = 0;
-	length = strlen (name->buff);
-	name->size <<= 1;
-
-	if (length + buffer_length > name->size)
-	{
-		name->size += buffer_length;
-	}
-
-    x = (guththila_char_t *) AXIS2_MALLOC(environment->allocator, name->size + 1);
-
-    if (x)
-	{
-		memset (x, 0, name->size + 1);
-		memcpy (x, name->buff, length);
-		name->buff = x;
-	}
-    else
-        name->size >>= 1;
-    return name;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <guththila_buffer.h>
+
+int GUTHTHILA_CALL guththila_buffer_init(guththila_buffer_t *buffer, int size, const axutil_env_t *env)
+{
+	buffer->type = GUTHTHILA_MULTIPLE_BUFFER;
+
+	buffer->data_size = (size_t *)AXIS2_MALLOC(env->allocator, sizeof(size_t) * GUTHTHILA_BUFFER_NUMBER_OF_BUFFERS);
+	buffer->buffs_size = (size_t *)AXIS2_MALLOC(env->allocator, sizeof(size_t) * GUTHTHILA_BUFFER_NUMBER_OF_BUFFERS);
+	buffer->buff = (char **)AXIS2_MALLOC(env->allocator, sizeof(char *) * GUTHTHILA_BUFFER_NUMBER_OF_BUFFERS);
+	buffer->cur_buff = -1;
+	buffer->pre_tot_data = 0;
+	buffer->no_buffers = GUTHTHILA_BUFFER_NUMBER_OF_BUFFERS;
+	if (size > 0 ){
+		buffer->buff[0] = (guththila_char *)AXIS2_MALLOC(env->allocator, sizeof(guththila_char) * size);	
+		buffer->data_size[0] = 0;
+		buffer->buffs_size[0] = size;
+		buffer->cur_buff = 0;
+	}		
+	return GUTHTHILA_SUCCESS;
+}
+
+int GUTHTHILA_CALL guththila_buffer_un_init(guththila_buffer_t *buffer, const axutil_env_t *env) 
+{
+	int i = 0;	
+	if (buffer->type == GUTHTHILA_SINGLE_BUFFER && buffer->buff && buffer->cur_buff == 0) {
+		if (buffer->buff[0]) AXIS2_FREE(env->allocator, buffer->buff[0]);
+		if (buffer->buffs_size) AXIS2_FREE(env->allocator, buffer->buffs_size);
+		if (buffer->data_size) AXIS2_FREE(env->allocator, buffer->data_size);
+		AXIS2_FREE(env->allocator, buffer->buff);
+	} else if (buffer->type == GUTHTHILA_MULTIPLE_BUFFER && buffer->buff){
+		for (i = 0; i <= buffer->cur_buff; i++) {
+			AXIS2_FREE(env->allocator, buffer->buff[i]);
+		}
+		AXIS2_FREE(env->allocator, buffer->buff);
+		if (buffer->data_size) AXIS2_FREE(env->allocator, buffer->data_size);
+		if (buffer->buffs_size) AXIS2_FREE(env->allocator, buffer->buffs_size);
+	}
+	return GUTHTHILA_SUCCESS;
+}
+
+int GUTHTHILA_CALL guththila_buffer_init_for_buffer(guththila_buffer_t *buffer, char *buff, int size, const axutil_env_t *env)
+{
+	buffer->type = GUTHTHILA_SINGLE_BUFFER;	
+
+	buffer->buff = (char **)AXIS2_MALLOC(env->allocator, sizeof(char *) * GUTHTHILA_BUFFER_DEF_SIZE);
+	buffer->buff[0] = buff;
+	buffer->cur_buff = 0;
+	buffer->buffs_size = (size_t *)AXIS2_MALLOC(env->allocator, sizeof(size_t) * GUTHTHILA_BUFFER_DEF_SIZE);
+	buffer->buffs_size[0] = size;
+	buffer->pre_tot_data = 0;
+	buffer->data_size = (size_t *)AXIS2_MALLOC(env->allocator, sizeof(size_t) * GUTHTHILA_BUFFER_DEF_SIZE);
+	buffer->data_size[0] = size;
+	buffer->no_buffers = 1;
+	return GUTHTHILA_SUCCESS;
+}
+
+void * GUTHTHILA_CALL guththila_buffer_get(guththila_buffer_t * buffer, const axutil_env_t *env)
+{
+	size_t size = 0, current_size = 0;
+	int i = 0;
+	char *buff = NULL;
+	for (i = 0; i <= buffer->cur_buff; i++) {
+		size += buffer->data_size[i];
+	}
+	buff = (char *) AXIS2_MALLOC(env->allocator, sizeof(char) * (size + 1));
+
+	for (i = 0; i <= buffer->cur_buff; i++) {
+		memcpy(buff + current_size, buffer->buff[i] , buffer->data_size[i]);
+		current_size += buffer->data_size[i];
+	}
+	buff[current_size] = '\0';
+	return buff;
+}
+
+
+

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_reader.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_reader.c?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_reader.c (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_reader.c Mon Jul 16 09:42:53 2007
@@ -1,138 +1,94 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include "guththila_reader.h"
-#include "guththila_defines.h"
-
-
-
-
-
-AXIS2_EXTERN guththila_reader_t * AXIS2_CALL
-guththila_reader_create_for_file(axutil_env_t * environment,
-        char *filename)
-{
-    guththila_reader_impl_t *file_reader = NULL;
-    if (!filename)
-        return NULL;
-
-    file_reader = (guththila_reader_impl_t *) AXIS2_MALLOC(environment->allocator,
-            sizeof(guththila_reader_impl_t));
-    if (!file_reader)
-        return NULL;
-
-    file_reader->fp  = fopen(filename, "r");
-
-    if (!(file_reader->fp))
-    {
-        AXIS2_FREE(environment->allocator, file_reader);
-        return NULL;
-    }
-
-    file_reader->reader.guththila_reader_type = GUTHTHILA_FILE_READER;
-
-    return &(file_reader->reader);
-}
-
-
-AXIS2_EXTERN guththila_reader_t * AXIS2_CALL
-guththila_reader_create_for_io(
-    axutil_env_t *environment,
-    AXIS2_READ_INPUT_CALLBACK input_read_callback, void* ctx)
-{
-    guththila_reader_impl_t *io_reader =
-        (guththila_reader_impl_t *) AXIS2_MALLOC(environment->allocator,
-                sizeof(guththila_reader_impl_t));
-    if (!io_reader)
-    {
-        return NULL;
-    }
-
-    io_reader->input_read_callback  = input_read_callback;
-    io_reader->context = ctx;
-    io_reader->reader.guththila_reader_type = GUTHTHILA_IO_READER;
-
-    return &(io_reader->reader);
-}
-
-AXIS2_EXTERN guththila_reader_t * AXIS2_CALL
-guththila_reader_create_for_memory(
-    axutil_env_t *environment,
-    void *buffer,
-    int size,
-    void* ctx)
-{
-    guththila_reader_impl_t *memory_reader =
-        (guththila_reader_impl_t *) AXIS2_MALLOC(environment->allocator,
-                sizeof(guththila_reader_impl_t));
-    if (!memory_reader)
-    {
-        return NULL;
-    }
-
-    if (buffer)
-    {
-        memory_reader->buffer  = (char *)buffer;
-        memory_reader->buffer_size =  strlen((const char *) buffer);
-    }
-    memory_reader->context = ctx;
-    memory_reader->reader.guththila_reader_type = GUTHTHILA_MEMORY_READER;
-
-    return &(memory_reader->reader);
-}
-
-AXIS2_EXTERN void AXIS2_CALL
-guththila_reader_free(axutil_env_t * environment,
-        guththila_reader_t * r)
-{
-
-    if (!r)
-        return;
-
-    if (r->guththila_reader_type == GUTHTHILA_FILE_READER)
-    {
-        if (((guththila_reader_impl_t*)r)->fp)
-            fclose(((guththila_reader_impl_t*)r)->fp);
-    }
-    AXIS2_FREE(environment->allocator, (guththila_reader_impl_t*)r);
-    return;
-}
-
-
-AXIS2_EXTERN int AXIS2_CALL
-guththila_reader_read(axutil_env_t * environment,
-        guththila_char_t * buffer,
-        int offset,
-        int length,
-        guththila_reader_t * r)
-{
-
-    if (r->guththila_reader_type == GUTHTHILA_FILE_READER)
-    {
-        return (int)fread(buffer + offset, 1, length, ((guththila_reader_impl_t*)r)->fp);
-    }
-    else if (r->guththila_reader_type == GUTHTHILA_IO_READER)
-        return ((guththila_reader_impl_t*)r)->input_read_callback((buffer + offset), length,
-                ((guththila_reader_impl_t*)r)->context);
-    else if (r->guththila_reader_type == GUTHTHILA_MEMORY_READER)
-    {
-        return ((guththila_reader_impl_t *)r)->buffer_size;
-    }
-
-    return GUTHTHILA_FAILURE;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdlib.h>
+#include <string.h>
+#include <guththila_reader.h>
+
+GUTHTHILA_EXPORT guththila_reader_t * GUTHTHILA_CALL
+guththila_reader_create_for_file (char* file_name, const axutil_env_t *env)
+{
+	guththila_reader_t *reader = NULL;
+	FILE *f = NULL;
+	if (!file_name)
+		return NULL;
+	reader = (guththila_reader_t *) AXIS2_MALLOC(env->allocator, sizeof(guththila_reader_t));
+	if (!reader)
+		return NULL;
+	f = fopen(file_name, "r");
+
+	if (!f) {
+		AXIS2_FREE(env->allocator, reader);
+		return NULL;
+	}
+	reader->fp = f;
+	reader->type = GUTHTHILA_FILE_READER;	
+	return reader;
+}
+
+GUTHTHILA_EXPORT guththila_reader_t * GUTHTHILA_CALL
+guththila_reader_create_for_memory(void *buffer, int size, const axutil_env_t *env)
+{
+	guththila_reader_t *reader = (guththila_reader_t *) AXIS2_MALLOC(env->allocator, sizeof(guththila_reader_t));	
+	if (reader) {
+		reader->type = GUTHTHILA_MEMORY_READER;		
+		reader->buff = buffer;		
+		reader->buff_size = size;
+		reader->fp = NULL;		
+		return reader;
+	}
+	return NULL;
+}
+
+GUTHTHILA_EXPORT guththila_reader_t * GUTHTHILA_CALL 
+guththila_reader_create_for_io(GUTHTHILA_READ_INPUT_CALLBACK input_read_callback, void *ctx, const axutil_env_t *env)
+{
+	guththila_reader_t *reader = (guththila_reader_t *)AXIS2_MALLOC(env->allocator, sizeof(guththila_reader_t));
+    if (reader){
+		reader->input_read_callback = input_read_callback;
+		reader->context = ctx;
+		reader->type = GUTHTHILA_IO_READER;		
+		return reader;
+    }
+    return NULL;
+}
+
+GUTHTHILA_EXPORT void GUTHTHILA_CALL
+guththila_reader_free(guththila_reader_t * r, const axutil_env_t *env)
+{
+	if (r->type == GUTHTHILA_FILE_READER && r->fp){
+		fclose(r->fp);
+	}		
+	AXIS2_FREE(env->allocator, r);
+}
+
+GUTHTHILA_EXPORT int GUTHTHILA_CALL
+guththila_reader_read (guththila_reader_t *r, guththila_char *buffer, int offset, int length, const axutil_env_t *env)
+{
+	int rt = r->type;
+	switch (rt) {
+		case GUTHTHILA_FILE_READER :	
+			return (int)fread(buffer + offset, 1, length, r->fp);		
+		case GUTHTHILA_IO_READER :
+			return r->input_read_callback((buffer + offset), length, r->context);
+		default:	
+			return 0;	
+	}
+	return 0;
+}
+
+
+                       

Modified: webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_token.c?view=diff&rev=556666&r1=556665&r2=556666
==============================================================================
--- webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_token.c (original)
+++ webservices/axis2/scratch/c/dinesh/602/c/guththila/src/guththila_token.c Mon Jul 16 09:42:53 2007
@@ -1,365 +1,163 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-#include "guththila_token.h"
-#include "guththila_unicode.h"
-/* #include "guththila_string.h" */
-#include <axutil_string.h>
-
-
-AXIS2_EXTERN guththila_token_t *
-guththila_token_create_token_buffer(axutil_env_t *environment,
-        int size)
-{
-    guththila_token_t *tok =
-        (guththila_token_t *) AXIS2_MALLOC(environment->allocator,
-                sizeof(guththila_token_t) * size);
-    tok->size = size;
-    return tok;
-}
-
-
-AXIS2_EXTERN void
-guththila_token_free (axutil_env_t * environment,
-					  guththila_token_t * tok)
-{
-    if (tok)
-	{
-/*		if (tok->start)
-			AXIS2_FREE(environment->allocator, tok->start);
-		if (tok->end)
-		AXIS2_FREE(environment->allocator, tok->end);*/
-		AXIS2_FREE (environment->allocator, tok);
-	}
-}
-
-
-AXIS2_EXTERN void
-guththila_token_exception()
-{
-    printf("Throws new token Exception");
-    /* Samisa : we should define the error code and error desctioption and return error code to user
-       no use of using printf within a library
-       please delete this comment once this is fixed.
-     */
-}
-
-
-AXIS2_EXTERN int
-guththila_token_length(axutil_env_t * environment,
-        guththila_token_t * tok)
-{
-    if (tok->end)
-        return (tok->end) - (tok->start) + 1;
-    else
-        guththila_token_exception();
-    return 0;
-}
-
-
-AXIS2_EXTERN guththila_token_t *
-guththila_token_grow(axutil_env_t * environment,
-        guththila_token_t * tok)
-{
-	guththila_token_t *dest;
-    tok->size <<= 1;
-    dest = (guththila_token_t *) AXIS2_MALLOC(environment->allocator,
-											  sizeof(guththila_token_t) * tok->size);
-	if (dest)
-	{
-		memcpy (dest, tok, tok->size < 1);
-		tok = dest;
-	}
-
-    return tok;
-}
-
-
-AXIS2_EXTERN guththila_token_t *
-guththila_token_append(axutil_env_t * environment,
-        guththila_token_t * tok)
-{
-    if (++(tok->last) > (tok->size))
-        guththila_token_grow(environment, tok);
-    return &tok[tok->last];
-}
-
-
-AXIS2_EXTERN guththila_token_t *
-guththila_token_last(axutil_env_t * environment,
-        guththila_token_t * tok)
-{
-    if (tok->last < 0)
-        guththila_token_exception();
-    return &tok[tok->last];
-}
-
-
-AXIS2_EXTERN int
-guththila_token_count(axutil_env_t * environment,
-        guththila_token_t * tok)
-{
-    return tok->last;
-}
-
-AXIS2_EXTERN guththila_char_t *
-guththila_token_char_ref(axutil_env_t * environment,
-        guththila_char_t * buffer)
-{
-    int len = 0;
-    int ii = 0;
-    int ix = 0;
-    guththila_char_t *ref_buffer = NULL;
-
-    len = axutil_strlen(buffer);
-    ref_buffer = (guththila_char_t *) AXIS2_MALLOC(
-                environment->allocator, len + 1);
-
-	ref_buffer[len] = 0;
-    for (ii = 0, ix = 0; ii < len; ii++, ix++)
-    {
-        if (buffer[ii] == '&')
-        {
-            if (buffer[ii + 1] == 'a'
-                    && buffer[ii + 2] == 'm'
-                    && buffer[ii + 3] == 'p' && buffer[ii + 4] == ';')
-            {
-                ref_buffer[ix] = '&';
-                ii += 4;
-            }
-            else if (buffer[ii + 1] == 'g'
-                    && buffer[ii + 2] == 't' && buffer[ii + 3] == ';')
-            {
-                ref_buffer[ix] = '>';
-                ii += 3;
-            }
-            else if (buffer[ii + 1] == 'l'
-                    && buffer[ii + 2] == 't' && buffer[ii + 3] == ';')
-            {
-                ref_buffer[ix] = '<';
-                ii += 3;
-            }
-            else if (buffer[ii + 1] == 'q'
-                    && buffer[ii + 2] == 'u'
-                    && buffer[ii + 3] == 'o'
-                    && buffer[ii + 4] == 't' && buffer[ii + 5] == ';')
-            {
-                ref_buffer[ix] = '"';
-                ii += 5;
-            }
-            else if (buffer[ii + 1] == 'a'
-                    && buffer[ii + 2] == 'p'
-                    && buffer[ii + 3] == 'o'
-                    && buffer[ii + 4] == 's' && buffer[ii + 5] == ';')
-            {
-                ref_buffer[ix] = '\'';
-                ii += 5;
-            }
-            else
-                guththila_token_exception();
-        }
-        else
-            ref_buffer[ix] = buffer[ii];
-    }
-	AXIS2_FREE (environment->allocator, buffer);
-    return ref_buffer;
-}
-
-
-AXIS2_EXTERN guththila_char_t *
-guththila_token_to_string(axutil_env_t * environment,
-        guththila_token_t * tok, int unicode)
-{
-    if (tok)
-    {
-        if (unicode == None)
-        {
-            int length;
-            guththila_char_t *buffer = NULL;
-            length = guththila_token_length(environment, tok);
-            buffer = (guththila_char_t *) AXIS2_MALLOC(environment->allocator,
-                    length + 1);
-            memcpy(buffer, tok->start, length);
-            buffer[length] = 0;
-            if (tok->ref)
-                return guththila_token_char_ref(environment, buffer);
-            else
-                return buffer;
-        }
-        else
-        {
-            int length;
-            guththila_char_t *buffer = NULL;
-            length = guththila_token_length(environment, tok);
-
-            buffer = (guththila_char_t *) AXIS2_MALLOC(
-                        environment->allocator, length + 1);
-
-            memcpy(buffer, tok->start, length);
-            buffer[length] = 0;
-            return guththila_token_convert_utf16_to_utf8(environment, buffer,
-                    length);
-        }
-    }
-    else
-        return NULL;
-}
-
-
-AXIS2_EXTERN void
-guththila_token_relocate(axutil_env_t * environment,
-        guththila_token_t * tok, int offset)
-{
-    tok->start -= offset;
-    tok->end -= offset;
-}
-
-
-AXIS2_EXTERN int
-guththila_token_compare(axutil_env_t * environment,
-        guththila_token_t * tok, const guththila_char_t * s,
-        int n, int unicode_state)
-{
-    if (unicode_state == None)
-        return strncmp(tok->start, s, n);
-    else
-    {
-        guththila_char_t *buffer = NULL;
-        buffer = guththila_token_to_string(environment, tok, unicode_state);
-        return strncmp(buffer, s, n);
-    }
-}
-
-
-AXIS2_EXTERN int
-guththila_token_length_utf16(axutil_env_t * environment,
-        unsigned int utf16_ch)
-{
-    int length;
-
-    if (0x80 > utf16_ch)
-        length = 1;
-    else if (0x800 > utf16_ch)
-        length = 2;
-    else if (0x10000 > utf16_ch)
-        length = 3;
-    else if (0x200000 > utf16_ch)
-        length = 4;
-    else if (0x4000000 > utf16_ch)
-        length = 5;
-    else
-        length = 6;
-
-    return length;
-}
-
-
-AXIS2_EXTERN guththila_char_t *
-guththila_token_build_utf8(axutil_env_t * environment,
-        unsigned int utf16_ch, int length)
-{
-    guththila_UTF8_char mask = 0;
-    int ii = 0;
-    guththila_char_t *buffer =
-        (guththila_char_t *) AXIS2_MALLOC(environment->allocator,
-                length + 1);
-    memset(buffer, 0, length + 1);
-
-    if (length == 1)
-        buffer[0] = utf16_ch;
-    else
-    {
-        switch (length)
-        {
-            case 1:
-                break;
-            case 2:
-                mask = 0xc0;
-                break;
-            case 3:
-                mask = 0xe0;
-                break;
-            case 4:
-                mask = 0xf0;
-                break;
-            case 5:
-                mask = 0xf8;
-                break;
-            case 6:
-                mask = 0xfc;
-                break;
-        };
-
-        for (ii = length - 1; ii > 0; ii--)
-        {
-            buffer[ii] = (utf16_ch & 0x3f) | 0x80;
-            utf16_ch >>= 6;
-        }
-
-        buffer[0] = utf16_ch | mask;
-        buffer[length] = 0;
-    }
-    return buffer;
-}
-
-
-AXIS2_EXTERN guththila_char_t *
-guththila_token_convert_utf16_to_utf8(axutil_env_t * environment,
-        guththila_char_t * buffer, int length)
-{
-    unsigned int utf16_char = 0;
-    int length_utf16 = 0;
-    int total_length = 0;
-    guththila_char_t *input_buffer = buffer;
-    guththila_char_t *output_char = 0;
-    int ii = 0;
-    guththila_char_t *output_buffer =
-        (guththila_char_t *) AXIS2_MALLOC(environment->allocator, 1);
-    memset(output_buffer, 0, 1);
-    for (ii = 0; length > ii;)
-    {
-        utf16_char = *((guththila_UTF16_char *) & input_buffer[ii]);
-        ii += 2;
-        length_utf16 = guththila_token_length_utf16(environment, utf16_char);
-        output_char =
-            guththila_token_build_utf8(environment, utf16_char,
-                    length_utf16);
-        total_length += length_utf16;
-        output_buffer = strcat(output_buffer, output_char);
-    }
-    return output_buffer;
-}
-
-AXIS2_EXTERN void AXIS2_CALL
-guththila_relocate_tokens(axutil_env_t *environment,
-						  axutil_stack_t *stack,
-						  int offset)
-{
-    guththila_token_t *el = NULL;
-    int isize = 0;
-    isize = axutil_stack_size(stack, environment);
-    /*   el = (guththila_token_t *) axutil_stack_get_at (stack, environment, isize-1); */
-    for (; isize > 0; isize--)
-    {
-        el = (guththila_token_t *) axutil_stack_get_at(stack, 
-													  environment, 
-													  isize - 1);
-        guththila_token_relocate(environment, el, offset);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <guththila_token.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#define TOK_LIST_FREE(tok_list) \
+	(if (tok_list) {AXIS2_FREE(tok_list)})
+
+#define TOK_LIST_SIZE(tok_list) (tok_list->size)
+
+guththila_tok_list_t * GUTHTHILA_CALL guththila_tok_list_create(const axutil_env_t *env)
+{
+	int i = 0;
+	guththila_tok_list_t *tok_list = (guththila_tok_list_t *)AXIS2_MALLOC(env->allocator, sizeof(guththila_tok_list_t));
+	if (!tok_list) return NULL;
+	
+	tok_list->list = (guththila_token_t **)AXIS2_MALLOC(env->allocator, sizeof(guththila_token_t *) * GUTHTHILA_TOK_DEF_LIST_SIZE);
+	
+	if (tok_list->list && guththila_stack_init(&tok_list->fr_stack, env)){
+		tok_list->capacity = (int *)AXIS2_MALLOC(env->allocator, sizeof(int) * GUTHTHILA_TOK_DEF_LIST_SIZE);
+		if (tok_list->capacity) {
+			tok_list->no_list = GUTHTHILA_TOK_DEF_LIST_SIZE;			
+			tok_list->list[0] = (guththila_token_t *)AXIS2_MALLOC(env->allocator, sizeof(guththila_token_t ) * GUTHTHILA_TOK_DEF_SIZE);
+			for (i = 0;i < GUTHTHILA_TOK_DEF_SIZE; i++){
+				guththila_stack_push(&tok_list->fr_stack, &tok_list->list[0][i], env);
+			}
+			tok_list->capacity[0] = GUTHTHILA_TOK_DEF_SIZE;
+			tok_list->cur_list = 0;
+			tok_list->no_list = GUTHTHILA_TOK_DEF_LIST_SIZE;
+			return tok_list;	
+		}
+	}		
+	AXIS2_FREE(env->allocator, tok_list);
+	return NULL;	
+}
+
+int GUTHTHILA_CALL guththila_tok_list_grow(guththila_tok_list_t *tok_list, const axutil_env_t *env)
+{	
+	int i = 0;
+	int cur = 0;
+	int cur_cap = 0;
+	guththila_token_t **list = NULL;
+	if (tok_list->cur_list < tok_list->no_list -1) {
+		cur = ++tok_list->cur_list;
+		cur_cap = tok_list->capacity[cur -1] * 2;
+		tok_list->list[cur] = (guththila_token_t *)AXIS2_MALLOC(env->allocator, sizeof(guththila_token_t ) * cur_cap);
+		for (i = 0;i < cur_cap; i++){
+			guththila_stack_push(&tok_list->fr_stack, &tok_list->list[cur][i], env);
+		}
+		tok_list->capacity[cur] = cur_cap;		
+		return GUTHTHILA_SUCCESS;
+	} else {
+		list = (guththila_token_t **)AXIS2_MALLOC(env->allocator, sizeof(guththila_token_t *) * tok_list->no_list * 2);															
+		if (list) {
+			for (i = 0; i <= tok_list->cur_list; i++) {
+				list[i] = tok_list->list[i];
+			}
+			tok_list->no_list = tok_list->no_list * 2;
+			AXIS2_FREE(env->allocator, tok_list->list);
+			tok_list->list = list;
+			guththila_tok_list_grow(tok_list, env);
+		}
+	}
+	return GUTHTHILA_FAILURE;
+}
+
+int GUTHTHILA_CALL guththila_tok_list_init(guththila_tok_list_t *tok_list, const axutil_env_t *env)
+{		
+	int i = 0;
+	tok_list->list = (guththila_token_t **)AXIS2_MALLOC(env->allocator, sizeof(guththila_token_t *) * GUTHTHILA_TOK_DEF_LIST_SIZE);
+	
+	if (tok_list->list && guththila_stack_init(&tok_list->fr_stack, env)){
+		tok_list->capacity = (int *)AXIS2_MALLOC(env->allocator, sizeof(int) * GUTHTHILA_TOK_DEF_LIST_SIZE);
+		if (tok_list->capacity) {
+			tok_list->no_list = GUTHTHILA_TOK_DEF_LIST_SIZE;			
+			tok_list->list[0] = (guththila_token_t *)AXIS2_MALLOC(env->allocator, sizeof(guththila_token_t ) * GUTHTHILA_TOK_DEF_SIZE);
+			for (i = 0;i < GUTHTHILA_TOK_DEF_SIZE; i++){
+				guththila_stack_push(&tok_list->fr_stack, &tok_list->list[0][i], env);
+			}
+			tok_list->capacity[0] = GUTHTHILA_TOK_DEF_SIZE;
+			tok_list->cur_list = 0;
+			tok_list->no_list = GUTHTHILA_TOK_DEF_LIST_SIZE;
+			return GUTHTHILA_SUCCESS;	
+		}
+	}		
+	return GUTHTHILA_FAILURE;	
+}
+
+void GUTHTHILA_CALL guththila_tok_list_free(guththila_tok_list_t *tok_list, const axutil_env_t *env)
+{	
+	int i = 0;
+	guththila_stack_un_init(&tok_list->fr_stack, env);
+	for (; i <= tok_list->cur_list; i++) {
+		AXIS2_FREE(env->allocator, tok_list->list[i]);
+	}
+	AXIS2_FREE(env->allocator, tok_list->list);	
+	AXIS2_FREE(env->allocator, tok_list);
+}
+
+void GUTHTHILA_CALL guththila_tok_list_free_data(guththila_tok_list_t *tok_list, const axutil_env_t *env)
+{
+	int i = 0;
+	guththila_stack_un_init(&tok_list->fr_stack, env);
+	
+	for (; i <= tok_list->cur_list; i++) {
+		AXIS2_FREE(env->allocator, tok_list->list[i]);
+	}
+	AXIS2_FREE(env->allocator, tok_list->list);	
+}
+
+guththila_token_t * GUTHTHILA_CALL guththila_tok_list_get_token(guththila_tok_list_t *tok_list, const axutil_env_t *env)
+{
+	if (tok_list->fr_stack.top > 0 || guththila_tok_list_grow(tok_list, env)){
+		return guththila_stack_pop(&tok_list->fr_stack, env);			
+	} 	
+	return NULL;
+}
+
+int GUTHTHILA_CALL guththila_tok_list_release_token(guththila_tok_list_t *tok_list, guththila_token_t *token, const axutil_env_t *env)
+{
+	return guththila_stack_push(&tok_list->fr_stack, token, env); 										
+}
+
+int GUTHTHILA_CALL guththila_tok_str_cmp(guththila_token_t *tok, char *str, size_t str_len, const axutil_env_t *env)
+{
+	unsigned int i = 0;
+	if (tok->size != str_len) return -1;
+	for (; i < tok->size; i++) {
+		if (tok->start[i] != str[i]) {
+			return -1;
+		}
+	}
+	return 0;
+}
+
+int GUTHTHILA_CALL guththila_tok_tok_cmp(guththila_token_t *tok1, guththila_token_t *tok2, const axutil_env_t *env)
+{
+	unsigned int i = 0;
+	if (tok1->size != tok2->size) return -1;
+	for (; i < tok1->size; i++) {
+		if (tok1->start[i] != tok2->start[i]) {
+			return -1;
+		}
+	}
+	return 0;
+}
+



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