You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/11/21 04:57:03 UTC
svn commit: r345821 [5/8] - in /webservices/axis2/trunk/c: ./ include/
modules/test/om/src/ modules/util/src/ modules/xml/guththila/
modules/xml/om/src/ modules/xml/om/test/ modules/xml/parser/
modules/xml/parser/guththila/impl/src/ modules/xml/parser/...
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_allocator.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_allocator.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_allocator.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_allocator.h Sun Nov 20 19:53:26 2005
@@ -25,12 +25,13 @@
#endif
- GUTHTHILA_DECLARE_DATA typedef struct guththila_allocator
+ typedef struct guththila_allocator
{
- void *(*guththila_allocator_malloc) (size_t size);
- void *(*guththila_allocator_realloc) (void *ptr, size_t size);
- void (*guththila_allocator_free) (void *ptr);
- void *(*guththila_allocator_calloc) (size_t nelem, size_t elsize);
+ void *(*malloc)(size_t size);
+ void *(*realloc)(void *ptr, size_t size);
+ void (*free)(void *ptr);
+ void *(*calloc)(size_t nelem, size_t elsize);
+
} guththila_allocator_t;
/**
@@ -41,12 +42,21 @@
*/
GUTHTHILA_DECLARE (guththila_allocator_t *)
- guththila_allocator_init (guththila_allocator_t * allocator);
+ guththila_allocator_init (guththila_allocator_t * allocator);
+
+#define GUTHTHILA_MALLOC(allocator, size) \
+ ((allocator)->malloc(size))
+
+#define GUTHTHILA_REALLOC(allocator, ptr, size) \
+ ((allocator)->realloc(ptr, size))
+
+#define GUTHTHILA_FREE(allocator, ptr) \
+ ((allocator)->free(ptr))
+
+#define GUTHTHILA_CALLOC(allocator, size1, size2) \
+ ((allocator)->calloc(size1,size2));
+
-#define guththila_malloc(allocator, size) ((allocator)->guththila_allocator_malloc(size))
-#define guththila_realloc(allocator, ptr, size) ((allocator)->guththila_allocator_realloc(ptr, size))
-#define guththila_free(allocator, ptr) ((allocator)->guththila_allocator_free(ptr))
-#define guththila_calloc(allocator,size1,size2) ((allocator)->guththila_allocator_calloc((size1),(size2)));
#ifdef __cplusplus
}
#endif
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_array.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_array.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_array.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_array.c Sun Nov 20 19:53:26 2005
@@ -18,9 +18,10 @@
#include <string.h>
#include <stdio.h>
#include "guththila_array.h"
+#include "guththila_string.h"
/*****************************************************************
- * This file contains guththila_array and guththila_table_t functions only.
+ * This file contains guththila_array functions.
*/
/*****************************************************************
@@ -29,83 +30,73 @@
*/
static void
make_array_core (guththila_array_header_t * res,
- guththila_environment_t * environment,
int nelts,
- int elt_size, int clear)
+ guththila_environment_t * environment,
int nelts,
+ int elt_size,
+ int clear)
{
- /*
- * Assure sanity if someone asks for
- * array of zero elts.
- */
- if (nelts < 1)
+/*
+* Assure sanity if someone asks for
+* array of zero elts.
+*/
+ if (nelts < 1)
{
-
nelts = 1;
-
}
-
if (clear)
+ nelts = 1;
+ }
+
if (clear)
{
-
res->elts =
- guththila_malloc (environment->allocator, nelts * elt_size);
-
}
-
+ res->elts = GUTHTHILA_MALLOC (environment->allocator, nelts * elt_size);
+ }
else
{
-
res->elts =
- guththila_malloc (environment->allocator, nelts * elt_size);
-
}
-
res->environment = environment;
-
res->elt_size = elt_size;
-
res->nelts = 0; /* No active elements yet... */
-
res->nalloc = nelts; /* ...but this many allocated */
-
}
+ res->elts = GUTHTHILA_MALLOC (environment->allocator, nelts * elt_size);
+ }
+
res->environment = environment;
+ res->elt_size = elt_size;
+ res->nelts = 0; /* No active elements yet... */
+ res->nalloc = nelts; /* ...but this many allocated */
+}
GUTHTHILA_DECLARE (int)
guththila_is_empty_array (const guththila_array_header_t * a)
{
-
return ((a == NULL) || (a->nelts == 0));
-
}
-
-
GUTHTHILA_DECLARE (guththila_array_header_t *)
-guththila_array_make (guththila_environment_t * environment,
int nelts,
+ return ((a == NULL) || (a->nelts == 0));
+}
GUTHTHILA_DECLARE (guththila_array_header_t *)
+guththila_array_make (guththila_environment_t * environment,
int nelts,
int elt_size)
{
-
guththila_array_header_t * res;
-
res =
- (guththila_array_header_t *) guththila_malloc (environment->allocator,
- sizeof
- (guththila_array_header_t));
-
make_array_core (res, environment, nelts, elt_size, 1);
-
return res;
-
}
-
-
GUTHTHILA_DECLARE (void *) guththila_array_pop (guththila_array_header_t *
- arr)
+ guththila_array_header_t * res;
+ res = (guththila_array_header_t *) GUTHTHILA_MALLOC (environment->allocator,
+ sizeof(guththila_array_header_t));
+
make_array_core (res, environment, nelts, elt_size, 1);
+ return res;
+}
GUTHTHILA_DECLARE (void *)
+guththila_array_pop (guththila_array_header_t *arr)
{
-
if (guththila_is_empty_array (arr))
+
if (guththila_is_empty_array (arr))
{
-
return NULL;
-
}
-
return arr->elts + (arr->elt_size * (--arr->nelts));
-
}
-
-
GUTHTHILA_DECLARE (void *) guththila_array_push (guththila_array_header_t *
- arr)
+ return NULL;
+ }
+ return arr->elts + (arr->elt_size * (--arr->nelts));
+}
GUTHTHILA_DECLARE (void *)
+guththila_array_push (guththila_array_header_t *arr)
{
-
if (arr->nelts == arr->nalloc)
+
if (arr->nelts == arr->nalloc)
{
-
int new_size = (arr->nalloc <= 0) ? 1 : arr->nalloc * 2;
-
guththila_char_t * new_data;
-
new_data =
- guththila_malloc (arr->environment->allocator,
- arr->elt_size * new_size);
-
memcpy (new_data, arr->elts, arr->nalloc * arr->elt_size);
-
memset (new_data + arr->nalloc * arr->elt_size, 0,
-
arr->elt_size * (new_size - arr->nalloc));
-
arr->elts = new_data;
-
arr->nalloc = new_size;
-
}
-
++arr->nelts;
-
return arr->elts + (arr->elt_size * (arr->nelts - 1));
-
}
-
+ int new_size = (arr->nalloc <= 0) ? 1 : arr->nalloc * 2;
+ guththila_char_t * new_data;
+ new_data = GUTHTHILA_MALLOC (arr->environment->allocator,
+ arr->elt_size * new_size);
+
+ memcpy (new_data, arr->elts, arr->nalloc * arr->elt_size);
+ memset (new_data + arr->nalloc * arr->elt_size, 0,
+ arr->elt_size * (new_size - arr->nalloc));
+ arr->elts = new_data;
+ arr->nalloc = new_size;
+ }
+
+ ++arr->nelts;
+ return arr->elts + (arr->elt_size * (arr->nelts - 1));
+}
/*
static void *guththila_array_push_noclear(guththila_array_header_t *arr)
@@ -114,7 +105,7 @@
int new_size = (arr->nalloc <= 0) ? 1 : arr->nalloc * 2;
guththila_char_t *new_data;
- new_data = guththila_malloc(arr->environment->allocator, arr->elt_size * new_size);
+ new_data = GUTHTHILA_MALLOC(arr->environment->allocator, arr->elt_size * new_size);
memcpy(new_data, arr->elts, arr->nalloc * arr->elt_size);
arr->elts = new_data;
@@ -125,49 +116,49 @@
return arr->elts + (arr->elt_size * (arr->nelts - 1));
}
*/
- GUTHTHILA_DECLARE (void) guththila_array_cat (guththila_array_header_t *
- dst,
-
const
- guththila_array_header_t *
- src)
-{
-
int elt_size = dst->elt_size;
-
if (dst->nelts + src->nelts > dst->nalloc)
+
+GUTHTHILA_DECLARE (void)
+guththila_array_cat (guththila_array_header_t *dst,
+ const guththila_array_header_t *src)
+{
+
int elt_size = dst->elt_size;
+
+ if (dst->nelts + src->nelts > dst->nalloc)
{
-
int new_size = (dst->nalloc <= 0) ? 1 : dst->nalloc * 2;
-
guththila_char_t * new_data;
-
while (dst->nelts + src->nelts > new_size)
+
+ int new_size = (dst->nalloc <= 0) ? 1 : dst->nalloc * 2;
+ guththila_char_t * new_data;
+
while (dst->nelts + src->nelts > new_size)
{
-
new_size *= 2;
-
}
-
new_data =
- guththila_malloc (dst->environment->allocator,
- elt_size * new_size);
-
memcpy (new_data, dst->elts, dst->nalloc * elt_size);
-
dst->elts = new_data;
-
dst->nalloc = new_size;
-
}
-
memcpy (dst->elts + dst->nelts * elt_size, src->elts,
-
elt_size * src->nelts);
-
dst->nelts += src->nelts;
-
}
-
GUTHTHILA_DECLARE (guththila_array_header_t *)
+ new_size *= 2;
+ }
+
new_data = GUTHTHILA_MALLOC (dst->environment->allocator,
+ elt_size * new_size);
+
+ memcpy (new_data, dst->elts, dst->nalloc * elt_size);
+
dst->elts = new_data;
+ dst->nalloc = new_size;
+ }
+ memcpy (dst->elts + dst->nelts * elt_size, src->elts,
+ elt_size * src->nelts);
+ dst->nelts += src->nelts;
+}
GUTHTHILA_DECLARE (guththila_array_header_t *)
guththila_array_copy (guththila_environment_t * environment,
-
const guththila_array_header_t * arr)
+ const guththila_array_header_t * arr)
{
-
guththila_array_header_t * res =
- (guththila_array_header_t *) guththila_malloc (environment->allocator,
- sizeof
- (guththila_array_header_t));
-
make_array_core (res, environment, arr->nalloc, arr->elt_size, 0);
-
memcpy (res->elts, arr->elts, arr->elt_size * arr->nelts);
-
res->nelts = arr->nelts;
-
memset (res->elts + res->elt_size * res->nelts, 0,
-
res->elt_size * (res->nalloc - res->nelts));
-
return res;
-
}
-
-
+ guththila_array_header_t * res = (guththila_array_header_t *) GUTHTHILA_MALLOC(
+ environment->allocator,
+ sizeof(guththila_array_header_t));
+
+ make_array_core (res, environment, arr->nalloc, arr->elt_size, 0);
+
+ memcpy (res->elts, arr->elts, arr->elt_size * arr->nelts);
+
+ res->nelts = arr->nelts;
+
memset (res->elts + res->elt_size * res->nelts, 0,
+
res->elt_size * (res->nalloc - res->nelts));
+
return res;
+}
/* This cute function copies the array header *only*, but arranges
* for the data section to be copied on the first push or arraycat.
* It's useful when the elements of the array being copied are
@@ -176,120 +167,112 @@
*/
static void
copy_array_hdr_core (guththila_array_header_t * res,
-
const guththila_array_header_t * arr)
+ const guththila_array_header_t * arr)
{
-
res->elts = arr->elts;
-
res->elt_size = arr->elt_size;
-
res->nelts = arr->nelts;
-
res->nalloc = arr->nelts; /* Force overflow on push */
-
}
GUTHTHILA_DECLARE (guththila_array_header_t *)
+
res->elts = arr->elts;
+
res->elt_size = arr->elt_size;
+
res->nelts = arr->nelts;
+
res->nalloc = arr->nelts; /* Force overflow on push */
+}
GUTHTHILA_DECLARE (guththila_array_header_t *)
guththila_array_copy_hdr (guththila_environment_t * environment,
-
const guththila_array_header_t * arr)
+ const guththila_array_header_t * arr)
{
-
guththila_array_header_t * res;
-
res =
- (guththila_array_header_t *) guththila_malloc (environment->allocator,
- sizeof
- (guththila_array_header_t));
-
res->environment = environment;
-
copy_array_hdr_core (res, arr);
-
return res;
-
}
-
-
+ guththila_array_header_t * res;
+
res = (guththila_array_header_t *) GUTHTHILA_MALLOC (
+ environment->allocator,
+ sizeof(guththila_array_header_t));
+
res->environment = environment;
+
copy_array_hdr_core (res, arr);
+ return res;
+}
+
/* The above is used here to avoid consing multiple new array bodies... */
-
GUTHTHILA_DECLARE (guththila_array_header_t *)
+
GUTHTHILA_DECLARE (guththila_array_header_t *)
guththila_array_append (guththila_environment_t * environment,
-
const guththila_array_header_t * first,
-
const guththila_array_header_t * second)
+ const guththila_array_header_t * first,
+ const guththila_array_header_t * second)
{
-
guththila_array_header_t * res =
- guththila_array_copy_hdr (environment, first);
-
guththila_array_cat (res, second);
-
return res;
-
}
-
-
+
guththila_array_header_t * res = guththila_array_copy_hdr (environment, first);
+
+ guththila_array_cat (res, second);
+ return res;
+}
+
/* guththila_array_pstrcat generates a new string containing
* the concatenated sequence of substrings referenced as elements within
* the array. The string will be empty if all substrings are empty or null,
* or if there are no elements in the array.
* If sep is non-NUL, it will be inserted between elements as a separator.
*/
- GUTHTHILA_DECLARE (guththila_char_t *)
+
+
+GUTHTHILA_DECLARE (guththila_char_t *)
guththila_array_pstrcat (guththila_environment_t * environment,
-
const guththila_array_header_t * arr,
-
const guththila_char_t sep)
+ const guththila_array_header_t * arr,
+ const guththila_char_t sep)
{
-
guththila_char_t * cp, *res, **strpp;
-
guththila_ssize_t len;
-
int i;
-
if (arr->nelts <= 0 || arr->elts == NULL)
+
guththila_char_t * cp, *res, **strpp;
+
guththila_ssize_t len;
+
int i;
+
if (arr->nelts <= 0 || arr->elts == NULL)
{ /* Empty table? */
-
return (guththila_char_t *) guththila_malloc (environment->allocator,
- 1);
-
}
-
+ return (guththila_char_t *) GUTHTHILA_MALLOC (
+ environment->allocator, 1);
+ }
/* Pass one --- find length of required string */
-
len = 0;
-
for (i = 0, strpp = (guththila_char_t **) arr->elts;; ++strpp)
+
len = 0;
+
for (i = 0, strpp = (guththila_char_t **) arr->elts;; ++strpp)
{
-
if (strpp && *strpp != NULL)
+ if (strpp && *strpp != NULL)
+ {
+ len += GUTHTHILA_STRLEN ( *strpp);
+ }
+
if (++i >= arr->nelts)
{
-
len += guththila_strlen (environment->string, *strpp);
-
}
-
if (++i >= arr->nelts)
+ break;
+ }
+
if (sep)
{
-
break;
-
}
-
if (sep)
- {
-
++len;
-
}
-
}
-
+ ++len;
+ }
+ }
/* Allocate the required string */
-
res =
- (guththila_char_t *) guththila_malloc (environment->allocator,
- len + 1);
-
cp = res;
-
- /* Pass two --- copy the argument strings into the result space */
-
for (i = 0, strpp = (guththila_char_t **) arr->elts;; ++strpp)
+
res = (guththila_char_t *) GUTHTHILA_MALLOC (
+ environment->allocator, len + 1);
+ cp = res;
+
/* Pass two --- copy the argument strings into the result space */
+
for (i = 0, strpp = (guththila_char_t **) arr->elts;; ++strpp)
{
-
if (strpp && *strpp != NULL)
+ if (strpp && *strpp != NULL)
{
-
len = guththila_strlen (environment->string, *strpp);
-
memcpy (cp, *strpp, len);
-
cp += len;
-
}
-
if (++i >= arr->nelts)
+ len = GUTHTHILA_STRLEN (*strpp);
+ memcpy (cp, *strpp, len);
+ cp += len;
+ }
+
if (++i >= arr->nelts)
{
-
break;
-
}
-
if (sep)
+ break;
+ }
+
if (sep)
{
-
*cp++ = sep;
-
}
-
}
-
*cp = '\0';
-
- /* Return the result string */
-
return res;
-
}
+ *cp++ = sep;
+ }
+
}
+
*cp = '\0';
+
/* Return the result string */
+
return res;
+}
GUTHTHILA_DECLARE (guththila_status_t)
guththila_array_free (guththila_environment_t * environment,
-
guththila_array_header_t * header)
+ guththila_array_header_t * header)
{
-
if (header != NULL)
-
+ if (header != NULL)
{
-
if (header->elts != NULL)
-
guththila_free (environment->allocator, header->elts);
-
guththila_free (environment->allocator, header);
-
return GUTHTHILA_SUCCESS;
-
}
-
}
-
-
+
if (header->elts != NULL)
+ GUTHTHILA_FREE (environment->allocator, header->elts);
+ GUTHTHILA_FREE (environment->allocator, header);
+ return GUTHTHILA_SUCCESS;
+ }
+ return GUTHTHILA_FAILURE;
+}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_array.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_array.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_array.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_array.h Sun Nov 20 19:53:26 2005
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-#ifndef GUTHTHILA_TABLES_H
-#define GUTHTHILA_TABLES_H
+#ifndef GUTHTHILA_ARRAY_H
+#define GUTHTHILA_ARRAY_H
/**
- * @file guththila_tables.h
+ * @file guththila_array.h
* @brief GUTHTHILA array and table
*/
@@ -35,7 +35,7 @@
#endif /* __cplusplus */
/**
- * @defgroup guththila_array (stack) and table functions
+ * @defgroup guththila_array (stack) functions
* @ingroup GUTHTHILA
* Tables are used to store entirely opaque structures
* for applications, while Arrays are usually used to
@@ -72,9 +72,8 @@
* @return True if empty, False otherwise
*/
- GUTHTHILA_DECLARE (int) guththila_is_empty_array (const
- guththila_array_header_t
- * a);
+ GUTHTHILA_DECLARE (int)
+ guththila_is_empty_array (const guththila_array_header_t * a);
/**
* Create an array
@@ -86,7 +85,7 @@
GUTHTHILA_DECLARE (guththila_array_header_t *)
guththila_array_make (guththila_environment_t * environment,
-
int nelts, int elt_size);
+ int nelts, int elt_size);
/**
* Add a new element to an array (as a first-in, last-out stack)
@@ -116,11 +115,9 @@
* @param src The source array to add to the destination array
*/
- GUTHTHILA_DECLARE (void) guththila_array_cat (guththila_array_header_t
- * dst,
-
const
- guththila_array_header_t
- * src);
+ GUTHTHILA_DECLARE (void)
+ guththila_array_cat (guththila_array_header_t *dst,
+ const guththila_array_header_t * src);
/**
* Copy the entire array
@@ -134,7 +131,7 @@
GUTHTHILA_DECLARE (guththila_array_header_t *)
guththila_array_copy (guththila_environment_t * environment,
-
const guththila_array_header_t * arr);
+ const guththila_array_header_t * arr);
/**
* Copy the headers of the array, and arrange for the elements to be copied if
@@ -147,7 +144,7 @@
GUTHTHILA_DECLARE (guththila_array_header_t *)
guththila_array_copy_hdr (guththila_environment_t * environment,
-
const guththila_array_header_t * arr);
+ const guththila_array_header_t * arr);
/**
* Append one array to the end of another, creating a new array in the process.
@@ -156,11 +153,11 @@
* @param second The array to put second in the new array.
* @return A new array containing the data from the two arrays passed in.
*/
-
+
GUTHTHILA_DECLARE (guththila_array_header_t *)
guththila_array_append (guththila_environment_t * environment,
-
const guththila_array_header_t * first,
-
const guththila_array_header_t * second);
+ const guththila_array_header_t * first,
+ const guththila_array_header_t * second);
/**
* Generates a new string containing the concatenated
@@ -176,11 +173,11 @@
GUTHTHILA_DECLARE (guththila_char_t *)
guththila_array_pstrcat (guththila_environment_t * p,
-
const guththila_array_header_t * arr,
-
const guththila_char_t sep);
-
GUTHTHILA_DECLARE (guththila_status_t)
+ const guththila_array_header_t * arr,
+ const guththila_char_t sep);
+
GUTHTHILA_DECLARE (guththila_status_t)
guththila_array_free (guththila_environment_t * environment,
-
guththila_array_header_t * header);
+ guththila_array_header_t * header);
/** @} */
@@ -188,4 +185,4 @@
}
#endif /*
*/
-#endif /* ! GUTHTHILA__ARRAY_H */
+#endif /* ! GUTHTHILA__ARRAY_H */
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_buffer.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_buffer.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_buffer.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_buffer.c Sun Nov 20 19:53:26 2005
@@ -23,18 +23,16 @@
GUTHTHILA_DECLARE (guththila_buffer_t *)
guththila_buffer_create (guththila_environment_t * environment, int size)
{
- guththila_buffer_t *name =
- guththila_malloc (environment->allocator,
- sizeof (guththila_buffer_t));
+ guththila_buffer_t *name = GUTHTHILA_MALLOC (environment->allocator,
+ sizeof (guththila_buffer_t));
name->size = size;
name->offset = 0;
name->last = 0;
name->next = 0;
name->buff = NULL;
if (size != 0)
- name->buff =
- (guththila_char_t *) guththila_malloc (environment->allocator,
- size);
+ name->buff = (guththila_char_t *) GUTHTHILA_MALLOC (
+ environment->allocator, size);
return name;
}
@@ -47,9 +45,9 @@
{
if (name->buff)
{
- guththila_free (environment->allocator, name->buff);
+ GUTHTHILA_FREE (environment->allocator, name->buff);
}
- free (name);
+ GUTHTHILA_FREE (environment->allocator, name);
}
}
@@ -58,9 +56,10 @@
guththila_buffer_grow (guththila_environment_t * environment,
guththila_buffer_t * name)
{
- guththila_buffer_t *x;
+
+ guththila_buffer_t *x = NULL;
name->size <<= 1;
- x = (guththila_buffer_t *) guththila_realloc (environment->allocator,
+ x = (guththila_buffer_t *) GUTHTHILA_REALLOC (environment->allocator,
name, name->size);
if (x)
name = x;
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_buffer.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_buffer.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_buffer.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_buffer.h Sun Nov 20 19:53:26 2005
@@ -34,8 +34,10 @@
guththila_char_t *buff;
} guththila_buffer_t;
+
GUTHTHILA_DECLARE (guththila_buffer_t *)
guththila_buffer_create (guththila_environment_t * environment, int size);
+
GUTHTHILA_DECLARE (void)
guththila_buffer_free (guththila_environment_t * environment,
guththila_buffer_t * name);
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_depth.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_depth.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_depth.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_depth.h Sun Nov 20 19:53:26 2005
@@ -26,6 +26,7 @@
int total;
int count;
int first;
+
} guththila_depth_t;
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_environment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_environment.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_environment.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_environment.c Sun Nov 20 19:53:26 2005
@@ -15,22 +15,19 @@
*/
#include <guththila_environment.h>
+#include <stdlib.h>
GUTHTHILA_DECLARE (guththila_environment_t *)
guththila_environment_create (guththila_allocator_t * allocator,
guththila_error_t * error,
- guththila_stream_t * stream,
- guththila_log_t * log,
- guththila_string_t * string)
+ guththila_log_t * log)
{
guththila_environment_t *environment;
if (!allocator)
return NULL;
- environment =
- (guththila_environment_t *) guththila_malloc (allocator,
- sizeof
- (guththila_environment_t));
+ environment = (guththila_environment_t *) GUTHTHILA_MALLOC (allocator,
+ sizeof(guththila_environment_t));
if (!environment)
return NULL;
@@ -42,20 +39,23 @@
else
environment->error = error;
- if (!stream)
- environment->stream = guththila_stream_create (allocator, NULL);
- else
- environment->stream = stream;
-
if (!log)
environment->log = guththila_log_create (allocator, NULL);
else
environment->log = log;
+ return environment;
+}
- if (!string)
- environment->string = guththila_string_create (allocator, NULL);
- else
- environment->string = string;
-
- return environment;
+GUTHTHILA_DECLARE(guththila_status_t)
+guththila_environment_free(guththila_environment_t *environment)
+{
+ if(!environment) return GUTHTHILA_FAILURE;
+ if(environment->allocator)
+ free(environment->allocator);
+ if(environment->error)
+ GUTHTHILA_ERROR_FREE(environment->error);
+ if(environment->log)
+ GUTHTHILA_LOG_FREE(environment->log);
+ free(environment);
+ return GUTHTHILA_SUCCESS;
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_environment.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_environment.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_environment.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_environment.h Sun Nov 20 19:53:26 2005
@@ -19,40 +19,32 @@
#include <guththila_allocator.h>
#include <guththila_error.h>
-#include <guththila_stream.h>
#include <guththila_log.h>
#include "guththila_defines.h"
-#include <guththila_string.h>
+
#ifdef __cplusplus
extern "C"
{
#endif
- struct guththila_environment;
- struct guththila_environment_ops;
-
- typedef struct guththila_environment_ops
- {
- int test;
- } guththila_environment_ops_t;
-
- typedef struct guththila_environment
+
+
+ typedef struct guththila_environment_t
{
- struct guththila_environment_ops *ops;
guththila_allocator_t *allocator; /* memory allocation routines */
guththila_error_t *error; /* error handling */
- guththila_stream_t *stream; /* IO routines */
guththila_log_t *log; /* logging routines */
- guththila_string_t *string; /* string routines */
} guththila_environment_t;
+
- GUTHTHILA_DECLARE (guththila_environment_t *)
- guththila_environment_create (guththila_allocator_t * allocator,
- guththila_error_t * error,
- guththila_stream_t * stream,
- guththila_log_t * log,
- guththila_string_t * string);
+ GUTHTHILA_DECLARE (guththila_environment_t *)
+ guththila_environment_create (guththila_allocator_t * allocator,
+ guththila_error_t * error,
+ guththila_log_t * log);
+
+ GUTHTHILA_DECLARE(guththila_status_t)
+ guththila_environment_free(guththila_environment_t *environment);
#ifdef __cplusplus
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.c Sun Nov 20 19:53:26 2005
@@ -15,6 +15,8 @@
*/
#include <guththila_error.h>
+#include <guththila_defines.h>
+#include <stdlib.h>
guththila_char_t *GUTHTHILA_CALL
guththila_error_ops_get_message ()
@@ -22,6 +24,17 @@
return "This is the default error code";
}
+int GUTHTHILA_CALL
+guththila_error_free(guththila_error_t *error)
+{
+ if(!error) return 0;
+ if(error->ops)
+ free(error->ops);
+ free(error);
+ return 1;
+}
+
+
GUTHTHILA_DECLARE (guththila_error_t *)
guththila_error_create (guththila_allocator_t * allocator)
{
@@ -30,24 +43,24 @@
return NULL;
error =
- (guththila_error_t *) guththila_malloc (allocator,
- sizeof (guththila_error_t));
+ (guththila_error_t *) GUTHTHILA_MALLOC (allocator,
+ sizeof (guththila_error_t));
if (!error)
return NULL;
error->ops =
- (guththila_error_ops_t *) guththila_malloc (allocator,
- sizeof
- (guththila_error_ops_t));
+ (guththila_error_ops_t *) GUTHTHILA_MALLOC (allocator,
+ sizeof(guththila_error_ops_t));
if (!error->ops)
{
- guththila_free (allocator, error);
+ GUTHTHILA_FREE (allocator, error);
return NULL;
}
error->ops->get_message = guththila_error_ops_get_message;
-
+ error->ops->free = guththila_error_free;
+
return error;
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_error.h Sun Nov 20 19:53:26 2005
@@ -25,25 +25,6 @@
{
#endif
- struct guththila_error;
- struct guththila_error_ops;
-
- GUTHTHILA_DECLARE_DATA typedef struct guththila_error_ops
- {
- guththila_char_t *(GUTHTHILA_CALL * get_message) ();
- } guththila_error_ops_t;
-
- typedef struct guththila_error
- {
- struct guththila_error_ops *ops;
- int errorno;
- } guththila_error_t;
-
- GUTHTHILA_DECLARE (guththila_error_t *)
- guththila_error_create (guththila_allocator_t * allocator);
-
-#define guththila_error_get_message(error) ((error)->ops->get_message())
-
typedef enum guththila_status_codes
{
GUTHTHILA_FAILURE = 0,
@@ -79,6 +60,34 @@
GUTHTHILA_STREAM_WRITER_ERROR_OUT_OF_MEMORY,
GUTHTHILA_STREAM_READER_ERROR_OUT_OF_MEMORY
} guththila_error_codes_t;
+
+
+
+ typedef struct guththila_error guththila_error_t;
+ struct guththila_error_ops;
+
+
+GUTHTHILA_DECLARE_DATA typedef struct guththila_error_ops
+{
+ guththila_char_t *(GUTHTHILA_CALL * get_message) ();
+ int (GUTHTHILA_CALL *free)(guththila_error_t *error);
+} guththila_error_ops_t;
+
+struct guththila_error
+{
+ struct guththila_error_ops *ops;
+ int errorno;
+} ;
+
+
+GUTHTHILA_DECLARE (guththila_error_t *)
+guththila_error_create (guththila_allocator_t * allocator);
+
+
+#define GUTHTHILA_ERROR_GET_MESSAGE(error) ((error)->ops->get_message())
+
+#define GUTHTHILA_ERROR_FREE(error) ((error)->ops->free(error))
+
#ifdef __cplusplus
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_hash.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_hash.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_hash.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_hash.c Sun Nov 20 19:53:26 2005
@@ -81,7 +81,7 @@
static guththila_hash_entry_t **
alloc_array (guththila_hash_t * ht, unsigned int max)
{
- return memset (guththila_malloc (ht->environment->allocator,
+ return memset (GUTHTHILA_MALLOC (ht->environment->allocator,
sizeof (*ht->array) * (max + 1)), 0,
sizeof (*ht->array) * (max + 1));
}
@@ -90,7 +90,7 @@
guththila_hash_make (guththila_environment_t * environment)
{
guththila_hash_t *ht;
- ht = guththila_malloc (environment->allocator, sizeof (guththila_hash_t));
+ ht = GUTHTHILA_MALLOC (environment->allocator, sizeof (guththila_hash_t));
ht->environment = environment;
ht->free = NULL;
ht->count = 0;
@@ -135,7 +135,7 @@
{
guththila_hash_index_t *hi;
if (environment)
- hi = guththila_malloc (environment->allocator, sizeof (*hi));
+ hi = GUTHTHILA_MALLOC (environment->allocator, sizeof (*hi));
else
hi = &ht->iterator;
@@ -285,7 +285,7 @@
if ((he = ht->free) != NULL)
ht->free = he->next;
else
- he = guththila_malloc (ht->environment->allocator, sizeof (*he));
+ he = GUTHTHILA_MALLOC (ht->environment->allocator, sizeof (*he));
he->next = NULL;
he->hash = hash;
he->key = key;
@@ -304,7 +304,7 @@
guththila_hash_entry_t *new_vals;
unsigned int i, j;
- ht = guththila_malloc (environment->allocator, sizeof (guththila_hash_t) +
+ ht = GUTHTHILA_MALLOC (environment->allocator, sizeof (guththila_hash_t) +
sizeof (*ht->array) * (orig->max + 1) +
sizeof (guththila_hash_entry_t) * orig->count);
ht->environment = environment;
@@ -434,7 +434,7 @@
#endif
res =
- guththila_malloc (environment->allocator, sizeof (guththila_hash_t));
+ GUTHTHILA_MALLOC (environment->allocator, sizeof (guththila_hash_t));
res->environment = environment;
res->free = NULL;
res->hash_func = base->hash_func;
@@ -448,7 +448,7 @@
if (base->count + overlay->count)
{
new_vals =
- guththila_malloc (environment->allocator,
+ GUTHTHILA_MALLOC (environment->allocator,
sizeof (guththila_hash_entry_t) * (base->count +
overlay->
count));
@@ -506,4 +506,36 @@
}
}
return res;
+}
+
+
+static void
+guththila_hash_entry_free (guththila_environment_t *environment,
+ guththila_hash_entry_t *hash_entry)
+{
+ if(!environment) return;
+ if (!hash_entry)
+ return;
+ if (hash_entry->next)
+ {
+ guththila_hash_entry_free (environment, hash_entry->next);
+ }
+ GUTHTHILA_FREE (environment->allocator, hash_entry);
+ return;
+}
+
+GUTHTHILA_DECLARE(guththila_status_t)
+guththila_hash_free (guththila_environment_t *environment,
+ guththila_hash_t *ht)
+{
+ if(!environment) return GUTHTHILA_FAILURE;
+ if (ht)
+ {
+ if (ht->free)
+ guththila_hash_entry_free (environment, ht->free);
+ GUTHTHILA_FREE(environment->allocator, ht->array);
+ GUTHTHILA_FREE (environment->allocator, ht);
+ return GUTHTHILA_SUCCESS;
+ }
+ return GUTHTHILA_FAILURE;
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_hash.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_hash.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_hash.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_hash.h Sun Nov 20 19:53:26 2005
@@ -156,8 +156,8 @@
* </PRE>
*/
GUTHTHILA_DECLARE (guththila_hash_index_t *)
- guththila_hash_first (guththila_environment_t * environment,
- guththila_hash_t * ht);
+ guththila_hash_first (guththila_environment_t * environment,
+ guththila_hash_t * ht);
/**
* Continue iterating over the entries in a hash table.
@@ -166,7 +166,7 @@
* entries.
*/
GUTHTHILA_DECLARE (guththila_hash_index_t *)
- guththila_hash_next (guththila_hash_index_t * hi);
+ guththila_hash_next (guththila_hash_index_t * hi);
/**
* Get the current entry's details from the iteration state.
@@ -199,7 +199,7 @@
* @return A new hash table containing all of the data from the two passed in
*/
GUTHTHILA_DECLARE (guththila_hash_t *)
- guththila_hash_overlay (guththila_environment_t * environment,
+ guththila_hash_overlay (guththila_environment_t * environment,
const guththila_hash_t * overlay,
const guththila_hash_t * base);
@@ -218,7 +218,7 @@
* @return A new hash table containing all of the data from the two passed in
*/
GUTHTHILA_DECLARE (guththila_hash_t *)
- guththila_hash_merge (guththila_environment_t * environment,
+ guththila_hash_merge (guththila_environment_t * environment,
const guththila_hash_t * h1,
const guththila_hash_t * h2,
void *(*merger) (guththila_environment_t *
@@ -232,7 +232,12 @@
/**
* Get a pointer to the environment which the hash table was created in
*/
-/*GUTHTHILA_POOL_DECLARE_ACCESSOR(hash);*/
+
+
+
+GUTHTHILA_DECLARE(guththila_status_t) guththila_hash_free(
+ guththila_environment_t *environment,
+ guththila_hash_t *ht);
/** @} */
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_log.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_log.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_log.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_log.c Sun Nov 20 19:53:26 2005
@@ -15,10 +15,22 @@
*/
#include <guththila_log.h>
+#include <guththila_defines.h>
#include <stdio.h>
+#include <stdlib.h>
int GUTHTHILA_CALL guththila_log_impl_write (const void *buffer,
size_t count);
+
+int GUTHTHILA_CALL
+guththila_log_free(guththila_log_t *log)
+{
+ if(!log) return 0;
+ if(log->ops)
+ free(log->ops);
+ free(log);
+ return 1;
+}
GUTHTHILA_DECLARE (guththila_log_t *)
guththila_log_create (guththila_allocator_t * allocator,
@@ -29,7 +41,7 @@
return NULL;
log =
- (guththila_log_t *) guththila_malloc (allocator,
+ (guththila_log_t *) GUTHTHILA_MALLOC (allocator,
sizeof (guththila_log_t));
if (!log)
@@ -40,18 +52,18 @@
else
{
log->ops =
- (guththila_log_ops_t *) guththila_malloc (allocator,
- sizeof
- (guththila_log_ops_t));
+ (guththila_log_ops_t *) GUTHTHILA_MALLOC (allocator,
+ sizeof(guththila_log_ops_t));
if (!log->ops)
{
- guththila_free (allocator, log);
+ GUTHTHILA_FREE (allocator, log);
return NULL;
}
- log->ops->guththila_log_ops_write = guththila_log_impl_write;
+ log->ops->write = guththila_log_impl_write;
}
+ log->ops->free = guththila_log_free;
return log;
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_log.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_log.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_log.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_log.h Sun Nov 20 19:53:26 2005
@@ -33,27 +33,35 @@
GUTHTHILA_LOG_CRITICAL
} guththila_log_levels_t;
- struct guththila_log;
+ typedef struct guththila_log guththila_log_t;
struct guththila_log_ops;
GUTHTHILA_DECLARE_DATA typedef struct guththila_log_ops
{
- int (GUTHTHILA_CALL * guththila_log_ops_write) (const void *buffer,
- size_t count);
+ int (GUTHTHILA_CALL * write) (const void *buffer, size_t count);
+ int (GUTHTHILA_CALL* free)(guththila_log_t *log);
+
} guththila_log_ops_t;
- typedef struct guththila_log
+ struct guththila_log
{
struct guththila_log_ops *ops;
guththila_log_levels_t level;
int enabled; /*boolean */
- } guththila_log_t;
+ };
+
+
- GUTHTHILA_DECLARE (guththila_log_t *)
- guththila_log_create (guththila_allocator_t * allocator,
- guththila_log_ops_t * operations);
+GUTHTHILA_DECLARE (guththila_log_t *)
+guththila_log_create (guththila_allocator_t * allocator,
+ guththila_log_ops_t * operations);
+
+
+
+#define GUTHTHILA_LOG_WRITE( log, buffer, count) ((log)->ops->write(buffer, count))
+
+#define GUTHTHILA_LOG_FREE(log) ((log)->ops->free(log))
-#define guththila_log_write(log, buffer, count) ((log)->ops->guththila_log_ops_write(buffer, count))
#ifdef __cplusplus
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_main.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_main.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_main.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_main.c Sun Nov 20 19:53:26 2005
@@ -25,18 +25,14 @@
main (int argc, char *argv[])
{
int c;
- FILE *fp;
guththila_allocator_t *allocator;
guththila_reader_t *red;
guththila_environment_t *environment;
guththila_xml_pull_parser_t *parser;
-
-
- fp = fopen ("response.xml", "r");
allocator = guththila_allocator_init (NULL);
environment =
- guththila_environment_create (allocator, NULL, NULL, NULL, NULL);
- red = guththila_reader_create (environment, fp);
+ guththila_environment_create (allocator, NULL, NULL);
+ red = guththila_reader_create_for_file (environment, "response.xml");
parser = guththila_xml_pull_parser_create (environment, red);
guththila_xml_pull_parser_read (environment, parser);
@@ -60,11 +56,11 @@
p = guththila_xml_pull_parser_get_attribute_name
(environment, parser, a);
printf ("%s=\"", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
p = guththila_xml_pull_parser_get_attribute_value
(environment, parser, a);
printf ("%s\" ", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
}
printf ("?>");
}
@@ -83,11 +79,11 @@
if (p)
{
printf ("%s:", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
}
p = guththila_xml_pull_parser_get_name (environment, parser);
printf ("%s", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
ia = guththila_xml_pull_parser_get_attribute_count
(environment, parser);
@@ -99,22 +95,22 @@
if (p)
{
printf (" %s:", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
p = guththila_xml_pull_parser_get_attribute_name_by_number (environment, parser, ia);
printf ("%s=\"", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
p = guththila_xml_pull_parser_get_attribute_value_by_number (environment, parser, ia);
printf ("%s\"", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
}
else
{
p = guththila_xml_pull_parser_get_attribute_name_by_number (environment, parser, ia);
printf (" %s=\"", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
p = guththila_xml_pull_parser_get_attribute_value_by_number (environment, parser, ia);
printf ("%s\"", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
}
}
e = guththila_stack_last (environment, parser->dep);
@@ -126,11 +122,11 @@
if (strncmp (p, "xmlns", 5))
printf (" xmlns:");
printf ("%s=\"", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
p = guththila_xml_pull_parser_get_namespace_uri_by_number
(environment, parser, d);
printf ("%s\" ", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
}
if (guththila_event == GUTHTHILA_START_ELEMENT)
printf (">");
@@ -152,7 +148,7 @@
}
p = guththila_xml_pull_parser_get_name (environment, parser);
printf ("%s", p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
printf (">");
}
break;
@@ -161,7 +157,7 @@
char *p;
p = guththila_xml_pull_parser_get_value (environment, parser);
printf (p);
- free (p);
+ GUTHTHILA_FREE (allocator, p);
}
break;
case GUTHTHILA_COMMENT:
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_namespace.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_namespace.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_namespace.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_namespace.h Sun Nov 20 19:53:26 2005
@@ -28,6 +28,7 @@
int length;
guththila_char_t *uri;
int lengthuri;
+
} guththila_namespace_t;
#endif /* GUTHTHILA_NAMESPACE_H */
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.c Sun Nov 20 19:53:26 2005
@@ -21,15 +21,70 @@
#include "guththila_reader.h"
#include "guththila_defines.h"
+
+typedef struct guththila_file_reader_impl_t
+{
+ guththila_reader_t reader;
+ FILE *fp;
+}guththila_file_reader_impl_t;
+
+
+typedef struct guththila_memory_reader_impl_t
+{
+ guththila_reader_t reader;
+
+ int (*input_read_callback)(char *buffer,int size);
+
+ void (*input_close_callback)(void);
+
+}guththila_memory_reader_impl_t;
+
+
+
GUTHTHILA_DECLARE (guththila_reader_t *)
-guththila_reader_create (guththila_environment_t * environment, FILE * fp)
+guththila_reader_create_for_file (guththila_environment_t * environment,
+ char *filename)
+{
+
+ guththila_file_reader_impl_t *file_reader =
+ (guththila_file_reader_impl_t *) GUTHTHILA_MALLOC ( environment->allocator,
+ sizeof (guththila_file_reader_impl_t));
+ if(!file_reader)
+ return NULL;
+
+ file_reader->fp = fopen(filename,"r");
+
+ if(!(file_reader->fp ))
+ {
+ GUTHTHILA_FREE(environment->allocator,file_reader);
+ return NULL;
+ }
+
+ file_reader->reader.guththila_reader_type = GUTHTHILA_FILE_READER;
+
+ return &(file_reader->reader);
+}
+
+
+GUTHTHILA_DECLARE(guththila_reader_t *)
+guththila_reader_create_for_memory(
+ guththila_environment_t *environment,
+ int (*input_read_callback)(char *buffer,int size),
+ void (*input_close_callback)(void))
{
- guththila_reader_t *reader =
- (guththila_reader_t *) guththila_malloc (environment->allocator,
- sizeof (guththila_reader_t));
- if (fp)
- reader->fp = fp;
- return reader;
+ guththila_memory_reader_impl_t *memory_reader =
+ (guththila_memory_reader_impl_t *) GUTHTHILA_MALLOC (environment->allocator,
+ sizeof (guththila_memory_reader_impl_t));
+ if(!memory_reader)
+ {
+ return NULL;
+ }
+
+ memory_reader->input_read_callback = input_read_callback;
+ memory_reader->input_close_callback = input_close_callback;
+ memory_reader->reader.guththila_reader_type = GUTHTHILA_IN_MEMORY_READER;
+
+ return &(memory_reader->reader);
}
@@ -38,28 +93,38 @@
guththila_reader_t * r)
{
- if (r)
- guththila_free (environment->allocator, r);
+ if (!r)
+ return;
+
+ if(r->guththila_reader_type == GUTHTHILA_IN_MEMORY_READER);
+ {
+ ((guththila_memory_reader_impl_t*)r)->input_close_callback();
+ GUTHTHILA_FREE(environment->allocator,(guththila_memory_reader_impl_t*)r);
+ }
+ if(r->guththila_reader_type == GUTHTHILA_FILE_READER)
+ {
+ if(((guththila_file_reader_impl_t*)r)->fp)
+ fclose(((guththila_file_reader_impl_t*)r)->fp);
+ GUTHTHILA_FREE(environment->allocator, (guththila_file_reader_impl_t*)r);
+ }
+ return;
}
+
GUTHTHILA_DECLARE (int)
guththila_reader_read (guththila_environment_t * environment,
- guththila_char_t * buffer, int offset, int length,
+ guththila_char_t * buffer,
+ int offset,
+ int length,
guththila_reader_t * r)
{
- return (int) fread (buffer + offset, 1, length, r->fp);
-}
-
-
-GUTHTHILA_DECLARE (int)
-guththila_reader_set_input_stream (guththila_environment_t * environment,
- guththila_reader_t * r, FILE * fp)
-{
- if (fp)
+
+ if(r->guththila_reader_type == GUTHTHILA_FILE_READER)
{
- r->fp = fp;
- return 1;
+ return (int)fread (buffer + offset, 1, length,((guththila_file_reader_impl_t*)r)->fp);
}
- else
- return 0;
+ else if(r->guththila_reader_type == GUTHTHILA_IN_MEMORY_READER)
+ return ((guththila_memory_reader_impl_t*)r)->input_read_callback((buffer + offset), length);
+
+ return GUTHTHILA_FAILURE;
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_reader.h Sun Nov 20 19:53:26 2005
@@ -27,20 +27,34 @@
#include "guththila_environment.h"
#include "guththila_defines.h"
+typedef enum guththila_reader_types
+{
+ GUTHTHILA_FILE_READER = 1,
+ GUTHTHILA_IN_MEMORY_READER
+};
+
typedef struct guththila_reader_s
{
- FILE *fp;
+ int guththila_reader_type;
+
} guththila_reader_t;
+
GUTHTHILA_DECLARE (guththila_reader_t *)
-guththila_reader_create (guththila_environment_t * environment, FILE * fp);
+guththila_reader_create_for_file (guththila_environment_t * environment,
+ char* filename);
+
+GUTHTHILA_DECLARE(guththila_reader_t *)
+guththila_reader_create_for_memory(guththila_environment_t *environment,
+ int (*input_read_callback)
+ (char *buffer,int size),
+ void (*input_close_callback)(void));
+
GUTHTHILA_DECLARE (int)
guththila_reader_read (guththila_environment_t * environment,
guththila_char_t * buffer, int offset, int length,
guththila_reader_t * r);
-GUTHTHILA_DECLARE (int)
-guththila_reader_set_input_stream (guththila_environment_t * environment,
- guththila_reader_t * r, FILE * fp);
+
GUTHTHILA_DECLARE (void)
guththila_reader_free (guththila_environment_t * environment,
guththila_reader_t * r);
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.c Sun Nov 20 19:53:26 2005
@@ -24,7 +24,7 @@
guththila_stack_create (guththila_environment_t * environment)
{
guththila_stack_t *st =
- (guththila_stack_t *) guththila_malloc (environment->allocator,
+ (guththila_stack_t *) GUTHTHILA_MALLOC (environment->allocator,
sizeof (guththila_stack_t));
if (st)
{
@@ -46,10 +46,10 @@
{
if (stack)
{
- guththila_element_t *e =
- (guththila_element_t *) guththila_malloc (environment->allocator,
- sizeof
- (guththila_element_t));
+ guththila_element_t *e =
+ (guththila_element_t *) GUTHTHILA_MALLOC (environment->allocator,
+ sizeof (guththila_element_t));
+
e->token = tok;
e->attribute = attr;
if (stack->pointer == 0)
@@ -94,8 +94,8 @@
{
guththila_element_t *ele = stack->tail;
guththila_stack_free_rec (environment, stack, ele);
- guththila_free (environment->allocator, ele);
- guththila_free (environment->allocator, stack);
+ GUTHTHILA_FREE (environment->allocator, ele);
+ GUTHTHILA_FREE (environment->allocator, stack);
}
}
@@ -107,13 +107,13 @@
{
if (elem->prev == NULL)
{
- guththila_free (environment->allocator, elem);
+ GUTHTHILA_FREE (environment->allocator, elem);
}
else
{
elem = elem->prev;
guththila_stack_free_rec (environment, stack, elem);
- guththila_free (environment->allocator, elem);
+ GUTHTHILA_FREE (environment->allocator, elem);
}
}
@@ -133,7 +133,7 @@
guththila_stack_pull (guththila_environment_t * environment,
guththila_stack_t * stack)
{
- guththila_element_t *e;
+ guththila_element_t *e = NULL;
if (stack)
{
e = stack->tail;
@@ -170,9 +170,8 @@
if (stack)
{
guththila_element_t *e =
- (guththila_element_t *) guththila_malloc (environment->allocator,
- sizeof
- (guththila_element_t));
+ (guththila_element_t *) GUTHTHILA_MALLOC (environment->allocator,
+ sizeof(guththila_element_t));
e->namespace = ns;
e->attribute = NULL;
e->token = NULL;
@@ -203,7 +202,7 @@
guththila_stack_pull_current (guththila_environment_t * environment,
guththila_stack_t * stack)
{
- guththila_element_t *e;
+ guththila_element_t *e = NULL;
e = stack->current;
if (stack->current_pos != 0)
{
@@ -229,9 +228,8 @@
if (stack)
{
guththila_element_t *e =
- (guththila_element_t *) guththila_malloc (environment->allocator,
- sizeof
- (guththila_element_t));
+ (guththila_element_t *) GUTHTHILA_MALLOC (environment->allocator,
+ sizeof (guththila_element_t));
e->namespace = NULL;
e->attribute = NULL;
e->token = NULL;
@@ -263,7 +261,7 @@
guththila_stack_clear (guththila_environment_t * environment,
guththila_stack_t * stack)
{
- guththila_element_t *e;
+ guththila_element_t *e = NULL;
e = stack->tail;
if (e)
{
@@ -284,7 +282,7 @@
return stack->tail;
else
{
- guththila_element_t *e;
+ guththila_element_t *e = NULL;
int ix = stack->pointer;
e = stack->tail;
for (; ix > ((stack->pointer + 1) - i); ix--)
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_stack.h Sun Nov 20 19:53:26 2005
@@ -51,45 +51,62 @@
int current_pos;
guththila_element_t *tail;
guththila_element_t *current;
+
} guththila_stack_t;
/* stack implementation */
GUTHTHILA_DECLARE (guththila_stack_t *)
guththila_stack_create (guththila_environment_t * environment);
+
GUTHTHILA_DECLARE (int)
guththila_stack_push (guththila_environment_t * environment,
- guththila_stack_t * st, guththila_token_t * tok,
+ guththila_stack_t * st,
+ guththila_token_t * tok,
guththila_attribute_t * attr);
+
GUTHTHILA_DECLARE (int)
guththila_stack_size (guththila_environment_t * environment,
guththila_stack_t * st);
+
GUTHTHILA_DECLARE (void)
guththila_stack_free (guththila_environment_t * environment,
guththila_stack_t * st);
+
+
GUTHTHILA_DECLARE (void)
guththila_stack_free_rec (guththila_environment_t * environment,
- guththila_stack_t * st, guththila_element_t * el);
+ guththila_stack_t * st,
+ guththila_element_t * el);
+
GUTHTHILA_DECLARE (guththila_element_t *)
guththila_stack_last (guththila_environment_t * environment,
guththila_stack_t * st);
+
GUTHTHILA_DECLARE (guththila_element_t *)
guththila_stack_pull (guththila_environment_t * environment,
guththila_stack_t * st);
+
GUTHTHILA_DECLARE (int)
guththila_stack_push_namespace (guththila_environment_t * environment,
guththila_stack_t * st,
guththila_namespace_t * ns);
+
GUTHTHILA_DECLARE (guththila_element_t *)
guththila_stack_pull_current (guththila_environment_t * environment,
guththila_stack_t * st);
+
GUTHTHILA_DECLARE (int)
guththila_stack_push_depth (guththila_environment_t * environment,
- guththila_stack_t * st, guththila_depth_t * d);
+ guththila_stack_t * st,
+ guththila_depth_t * d);
+
GUTHTHILA_DECLARE (void)
guththila_stack_clear (guththila_environment_t * environment,
guththila_stack_t * st);
+
GUTHTHILA_DECLARE (guththila_element_t *)
guththila_stack_get (guththila_environment_t * environment,
guththila_stack_t * st, int i);
+
#endif /* GUTHTHILA_STACK_H */
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_string.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_string.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_string.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_string.c Sun Nov 20 19:53:26 2005
@@ -18,18 +18,30 @@
#include <stdlib.h>
#include <string.h>
-void *GUTHTHILA_CALL
-guththila_string_ops_strdup (const void *ptr)
+
+GUTHTHILA_DECLARE(void*)
+guththila_strdup (guththila_environment_t *environment,
+ const void *ptr)
{
if (ptr)
- return (void *) strdup ((const char *) ptr);
+ {
+ int len = strlen(ptr);
+ char* str = (char*) GUTHTHILA_MALLOC(environment->allocator,
+ sizeof(char) * (len + 1 ));
+ if (!str)
+ return NULL;
+ memcpy(str, ptr, len + 1);
+ return (void *) str;
+ }
else
+ {
return NULL;
+ }
}
-int GUTHTHILA_CALL
-guththila_string_ops_strcmp (const guththila_char_t * s1,
- const guththila_char_t * s2)
+GUTHTHILA_DECLARE(int)
+guththila_strcmp (const guththila_char_t * s1,
+ const guththila_char_t * s2)
{
if (s1 && s2)
return strcmp (s1, s2);
@@ -39,26 +51,26 @@
-int GUTHTHILA_CALL
-guththila_string_ops_strlen (const guththila_char_t * s)
+GUTHTHILA_DECLARE(int)
+guththila_strlen (const guththila_char_t * s)
{
if (s)
{
-
#ifdef __UNICODE__FUNCTIONS__
return guththila_strlen_unicode (x);
#else
return strlen (s);
#endif
-
}
else
return -1;
}
-guththila_char_t *GUTHTHILA_CALL
-guththila_string_ops_strndup (const guththila_char_t * s1, size_t len)
+GUTHTHILA_DECLARE(guththila_char_t *)
+guththila_strndup (guththila_environment_t *environment,
+ const guththila_char_t * s1,
+ int len)
{
if (s1)
{
@@ -70,10 +82,10 @@
register size_t n;
register guththila_char_t *dst;
- n = guththila_string_ops_strlen (s1);
+ n = guththila_strlen (s1);
if (len < n)
n = len;
- dst = (guththila_char_t *) malloc (n + 1);
+ dst = (guththila_char_t *) GUTHTHILA_MALLOC(environment->allocator ,(n + 1));
if (dst)
{
memcpy (dst, s1, n);
@@ -84,34 +96,4 @@
}
else
return NULL;
-}
-
-
-
-GUTHTHILA_DECLARE (guththila_string_t *)
-guththila_string_create (guththila_allocator_t * allocator,
- guththila_string_t * string)
-{
- if (string)
- return string;
-
- if (!allocator)
- return NULL;
-
- else
- {
- string =
- (guththila_string_t *) guththila_malloc (allocator,
- sizeof
- (guththila_string_t));
- if (string)
- {
- string->guththila_string_strdup = guththila_string_ops_strdup;
- string->guththila_string_strcmp = guththila_string_ops_strcmp;
- string->guththila_string_strndup = guththila_string_ops_strndup;
- string->guththila_string_strlen = guththila_string_ops_strlen;
- return string;
- }
- }
- return NULL;
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_string.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_string.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_string.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_string.h Sun Nov 20 19:53:26 2005
@@ -19,39 +19,36 @@
#include <guththila_defines.h>
#include <guththila_allocator.h>
+#include "guththila_environment.h"
+
#ifdef __cplusplus
extern "C"
{
#endif
- GUTHTHILA_DECLARE_DATA typedef struct guththila_string
- {
- void *(GUTHTHILA_CALL * guththila_string_strdup) (const void *ptr);
- int (GUTHTHILA_CALL *
- guththila_string_strcmp) (const guththila_char_t * s1,
- const guththila_char_t * s2);
- guththila_char_t *(GUTHTHILA_CALL *
- guththila_string_strndup) (const guththila_char_t *
- s1, size_t n);
- int (GUTHTHILA_CALL *
- guththila_string_strlen) (const guththila_char_t * s);
- } guththila_string_t;
-
-/**
-* if the parsed string is null a default string is created
-* otherwise the parsed string is returned. If there isn't enough
-* memory for allocation NULL is returned.
-* @param string user defined allcator
-*/
-
- GUTHTHILA_DECLARE (guththila_string_t *)
- guththila_string_create (guththila_allocator_t * allocator,
- guththila_string_t * string);
-
-#define guththila_strdup(string, ptr) ((string)->guththila_string_strdup(ptr))
-#define guththila_strcmp(string, s1, s2) ((string)->guththila_string_strcmp(s1, s2))
-#define guththila_strndup(string,s1,n) ((string)->guththila_string_strndup(s1,n))
-#define guththila_strlen(string,s1) ((string)->guththila_string_strlen(s1))
+
+GUTHTHILA_DECLARE(void*)
+guththila_strdup(guththila_environment_t *environment, const void *ptr);
+
+GUTHTHILA_DECLARE(int)
+guththila_strcmp(const guththila_char_t * s1,
+ const guththila_char_t * s2);
+
+GUTHTHILA_DECLARE(guththila_char_t *)
+guththila_strndup(guththila_environment_t *environment,
+ const guththila_char_t *s1, int n);
+
+GUTHTHILA_DECLARE(int)
+guththila_strlen(const guththila_char_t * s);
+
+
+#define GUTHTHILA_STRDUP(env, ptr) guththila_strdup(env, ptr)
+
+#define GUTHTHILA_STRCMP(s1, s2) guththila_strcmp( s1, s2)
+
+#define GUTHTHILA_STRNDUP(env, s1, n) guththila_strndup(env, s1, n)
+
+#define GUTHTHILA_STRLEN( s1) guththila_strlen( s1)
#ifdef __cplusplus
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.c?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.c (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.c Sun Nov 20 19:53:26 2005
@@ -20,15 +20,15 @@
#include "guththila_token.h"
#include "guththila_unicode.h"
+#include "guththila_string.h"
GUTHTHILA_DECLARE (guththila_token_t *)
-guththila_token_create_token_buffer (guththila_environment_t * environment,
+guththila_token_create_token_buffer (guththila_environment_t *environment,
int size)
{
guththila_token_t *tok =
- (guththila_token_t *) guththila_malloc (environment->allocator,
- sizeof (guththila_token_t) *
- size);
+ (guththila_token_t *) GUTHTHILA_MALLOC (environment->allocator,
+ sizeof (guththila_token_t) * size);
tok->size = size;
return tok;
}
@@ -39,7 +39,7 @@
guththila_token_t * tok)
{
if (tok)
- guththila_free (environment->allocator, tok);
+ GUTHTHILA_FREE (environment->allocator, tok);
}
@@ -71,10 +71,9 @@
guththila_token_t * tok)
{
tok->size <<= 1;
- tok =
- (guththila_token_t *) guththila_realloc (environment->allocator, tok,
- sizeof (guththila_token_t) *
- tok->size);
+ tok = (guththila_token_t *) GUTHTHILA_REALLOC (environment->allocator,
+ tok, sizeof (guththila_token_t) * tok->size);
+
return tok;
}
@@ -113,11 +112,13 @@
int len;
int ii;
int ix;
- guththila_char_t *ref_buffer;
- len = guththila_strlen (environment->string, buffer);
- ref_buffer =
- (guththila_char_t *) guththila_malloc (environment->allocator,
- len + 1);
+ guththila_char_t *ref_buffer = NULL;
+
+ len = GUTHTHILA_STRLEN ( buffer);
+ ref_buffer = (guththila_char_t *) GUTHTHILA_MALLOC (
+ environment->allocator, len + 1);
+
+
for (ii = 0, ix = 0; ii < len; ii++, ix++)
{
if (buffer[ii] == '&')
@@ -176,11 +177,10 @@
if (unicode == None)
{
int length;
- guththila_char_t *buffer;
+ guththila_char_t *buffer = NULL;
length = guththila_token_length (environment, tok);
- buffer =
- (guththila_char_t *) guththila_malloc (environment->allocator,
- length + 1);
+ buffer = (guththila_char_t *) GUTHTHILA_MALLOC (environment->allocator,
+ length + 1);
memcpy (buffer, tok->start, length);
buffer[length] = 0;
if (tok->ref)
@@ -191,11 +191,12 @@
else
{
int length;
- guththila_char_t *buffer;
+ guththila_char_t *buffer = NULL;
length = guththila_token_length (environment, tok);
- buffer =
- (guththila_char_t *) guththila_malloc (environment->allocator,
- length + 1);
+
+ buffer = (guththila_char_t *) GUTHTHILA_MALLOC (
+ environment->allocator, length + 1);
+
memcpy (buffer, tok->start, length);
buffer[length] = 0;
return guththila_token_convert_utf16_to_utf8 (environment, buffer,
@@ -225,7 +226,7 @@
return strncmp (tok->start, s, n);
else
{
- guththila_char_t *buffer;
+ guththila_char_t *buffer = NULL;
buffer = guththila_token_to_string (environment, tok, unicode_state);
return strncmp (buffer, s, n);
}
@@ -262,7 +263,7 @@
guththila_UTF8_char mask = 0;
int ii = 0;
guththila_char_t *buffer =
- (guththila_char_t *) guththila_calloc (environment->allocator,
+ (guththila_char_t *) GUTHTHILA_CALLOC (environment->allocator,
length + 1, 1);
if (length == 1)
buffer[0] = utf16_ch;
@@ -313,7 +314,7 @@
guththila_char_t *output_char = 0;
int ii = 0;
guththila_char_t *output_buffer =
- (guththila_char_t *) guththila_calloc (environment->allocator, 1, 1);
+ (guththila_char_t *) GUTHTHILA_CALLOC (environment->allocator, 1, 1);
for (ii = 0; length > ii;)
{
utf16_char = *((guththila_UTF16_char *) & input_buffer[ii]);
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_token.h Sun Nov 20 19:53:26 2005
@@ -52,47 +52,70 @@
GUTHTHILA_DECLARE (guththila_token_t *)
guththila_token_create_token_buffer (guththila_environment_t * environment,
int size);
+
GUTHTHILA_DECLARE (void)
guththila_token_free_token_buffer (guththila_environment_t * environment,
guththila_token_t * tok);
GUTHTHILA_DECLARE (int)
guththila_token_length (guththila_environment_t * environment,
guththila_token_t * tok);
+
GUTHTHILA_DECLARE (void)
guththila_token_exception ();
+
GUTHTHILA_DECLARE (guththila_token_t *)
guththila_token_append (guththila_environment_t * environment,
guththila_token_t * tok);
+
GUTHTHILA_DECLARE (guththila_token_t *)
guththila_token_grow (guththila_environment_t * environment,
guththila_token_t * tok);
+
GUTHTHILA_DECLARE (guththila_token_t *)
guththila_token_last (guththila_environment_t * environment,
guththila_token_t * tok);
+
GUTHTHILA_DECLARE (int)
guththila_token_count (guththila_environment_t * environment,
guththila_token_t * tok);
+
GUTHTHILA_DECLARE (guththila_char_t *)
guththila_token_to_string (guththila_environment_t * environment,
- guththila_token_t * tok, int unicode);
+ guththila_token_t * tok,
+ int unicode);
+
GUTHTHILA_DECLARE (void)
guththila_token_relocate (guththila_environment_t * environment,
- guththila_token_t * tok, int offset);
+ guththila_token_t * tok,
+ int offset);
+
+
GUTHTHILA_DECLARE (int)
guththila_token_compare (guththila_environment_t * environment,
- guththila_token_t * tok, const guththila_char_t * st,
- int n, int unicode_state);
+ guththila_token_t * tok,
+ const guththila_char_t * st,
+ int n,
+ int unicode_state);
+
+
GUTHTHILA_DECLARE (guththila_char_t *)
guththila_token_convert_utf16_to_utf8 (guththila_environment_t * environment,
- guththila_char_t * buffer, int length);
+ guththila_char_t * buffer,
+ int length);
+
GUTHTHILA_DECLARE (int)
guththila_token_length_utf16 (guththila_environment_t * environment,
unsigned int utf16_ch);
+
+
GUTHTHILA_DECLARE (guththila_char_t *)
guththila_token_build_utf8 (guththila_environment_t * environment,
- unsigned int utf16_ch, int length);
+ unsigned int utf16_ch,
+ int length);
+
GUTHTHILA_DECLARE (guththila_char_t *)
guththila_token_char_ref (guththila_environment_t * environment,
guththila_char_t * buffer);
+
#endif /* GUTHTHILA_TOKEN_H */
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_unicode.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_unicode.h?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_unicode.h (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/impl/src/guththila_unicode.h Sun Nov 20 19:53:26 2005
@@ -31,13 +31,12 @@
* LE = Little Endian UTF-16 Document
* BE = Big Endian UTF-16 Document
* For the time being Endianess make no effect to the parsing */
+
enum guththila_UTF16_endianess
{ None = 1, LE, BE };
#ifdef __UNICODE__FUNCTIONS__
-/* #define strlen(x) guththila_strlen_unicode(x)
-#define strndup(x, y) guththila_strdup_unicode(x, y)
-*/
+
guththila_UTF8_char guththila_strlen_unicode (guththila_char_t *);
guththila_char_t *guththila_strdup_unicode (guththila_char_t *, int);