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/10/27 08:08:48 UTC
svn commit: r328799 [1/5] -
/webservices/axis2/trunk/c/modules/xml/guththila/src/
Author: samisa
Date: Wed Oct 26 23:05:49 2005
New Revision: 328799
URL: http://svn.apache.org/viewcvs?rev=328799&view=rev
Log:
indentation was done on guththila code
Modified:
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_attribute.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_defines.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_depth.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_main.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_namespace.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_reader.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stack.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_stream.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_string.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_token.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_unicode.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_xml_pull_parser.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_xml_pull_parser.h
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_xml_stream_writer.c
webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_xml_stream_writer.h
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.c Wed Oct 26 23:05:49 2005
@@ -18,16 +18,17 @@
#include <stdlib.h>
#include <string.h>
-GUTHTHILA_DECLARE(guththila_allocator_t*) guththila_allocator_init(
- guththila_allocator_t *allocator)
+GUTHTHILA_DECLARE (guththila_allocator_t *)
+guththila_allocator_init (guththila_allocator_t * allocator)
{
- if(allocator)
+ if (allocator)
return allocator;
-
+
else
{
- allocator = (guththila_allocator_t*)malloc(sizeof(guththila_allocator_t));
- if(allocator)
+ allocator =
+ (guththila_allocator_t *) malloc (sizeof (guththila_allocator_t));
+ if (allocator)
{
allocator->guththila_allocator_malloc = malloc;
allocator->guththila_allocator_realloc = realloc;
@@ -35,6 +36,6 @@
allocator->guththila_allocator_calloc = calloc;
return allocator;
}
- }
+ }
return NULL;
}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_allocator.h Wed Oct 26 23:05:49 2005
@@ -20,17 +20,18 @@
#include <guththila_defines.h>
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-GUTHTHILA_DECLARE_DATA 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);
-}guththila_allocator_t;
+ GUTHTHILA_DECLARE_DATA 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);
+ } guththila_allocator_t;
/**
* if the parsed allocator is null a default allocator is created
@@ -39,9 +40,9 @@
* @param allocator user defined allcator
*/
-GUTHTHILA_DECLARE(guththila_allocator_t*)
- guththila_allocator_init(guththila_allocator_t *allocator);
-
+ GUTHTHILA_DECLARE (guththila_allocator_t *)
+ guththila_allocator_init (guththila_allocator_t * allocator);
+
#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))
@@ -50,4 +51,4 @@
}
#endif
-#endif /* GUTHTHILA_ALLOCATOR_H */
+#endif /* GUTHTHILA_ALLOCATOR_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.c Wed Oct 26 23:05:49 2005
@@ -12,91 +12,101 @@
* 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 <stdio.h>
#include "guththila_array.h"
-
+
/*****************************************************************
* This file contains guththila_array and guththila_table_t functions only.
- */
-
+ */
+
/*****************************************************************
*
* The 'array' functions...
- */
-
-static void make_array_core(guththila_array_header_t *res, guththila_environment_t *environment,
- int nelts, int elt_size, int clear)
-{
- /*
- * Assure sanity if someone asks for
- * array of zero elts.
- */
- if (nelts < 1) {
- nelts = 1;
- }
-
- if (clear) {
- 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 */
-}
-
-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, 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;
-}
+ */
+
static void
+make_array_core (guththila_array_header_t * res,
+ guththila_environment_t * environment,
int nelts,
+ int elt_size, int clear)
+{
+
+ /*
+ * Assure sanity if someone asks for
+ * array of zero elts.
+ */
+ if (nelts < 1)
+ {
+
nelts = 1;
+
}
+
if (clear)
+ {
+
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 */
+
}
+
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,
+ 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)
+{
+
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)
+{
+
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));
+
}
+
-GUTHTHILA_DECLARE(void *) guththila_array_pop(guththila_array_header_t *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)
-{
- 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));
-}
/*
static void *guththila_array_push_noclear(guththila_array_header_t *arr)
{
@@ -114,158 +124,172 @@
++arr->nelts;
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) {
- 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 *) guththila_array_copy(guththila_environment_t *environment,
- 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_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)
+ {
+
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)
+{
+
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
* read only, but new stuff *might* get added on the end; we have the
* overhead of the full copy only where it is really needed.
- */
-
-static void copy_array_hdr_core(guththila_array_header_t *res,
- 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 *)
- guththila_array_copy_hdr(guththila_environment_t *environment,
- 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;
-}
-
-/* The above is used here to avoid consing multiple new array bodies... */
-
-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)
-{
- guththila_array_header_t *res = guththila_array_copy_hdr(environment, first);
-
- guththila_array_cat(res, second);
- return res;
-}
-
+ */
+
static void
+copy_array_hdr_core (guththila_array_header_t * res,
+
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 *)
+guththila_array_copy_hdr (guththila_environment_t * environment,
+
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;
+
}
+
+
+/* The above is used here to avoid consing multiple new array bodies... */
+
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)
+{
+
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_array_pstrcat(guththila_environment_t *environment,
- 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) { /* Empty table? */
- 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) {
- if (strpp && *strpp != NULL) {
- len += guththila_strlen(environment->string,*strpp);
- }
- if (++i >= arr->nelts) {
- break;
- }
- if (sep) {
- ++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) {
- if (strpp && *strpp != NULL) {
- len = guththila_strlen(environment->string,*strpp);
- memcpy(cp, *strpp, len);
- cp += len;
- }
- if (++i >= arr->nelts) {
- break;
- }
- if (sep) {
- *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)
- {
- if(header != NULL)
- {
- if(header->elts != NULL)
- guththila_free(environment->allocator,header->elts);
- guththila_free(environment->allocator,header);
- return GUTHTHILA_SUCCESS;
- }
- }
-
-
+ */
+ GUTHTHILA_DECLARE (guththila_char_t *)
+guththila_array_pstrcat (guththila_environment_t * environment,
+
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)
+ { /* Empty table? */
+
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)
+ {
+
if (strpp && *strpp != NULL)
+ {
+
len += guththila_strlen (environment->string, *strpp);
+
}
+
if (++i >= arr->nelts)
+ {
+
break;
+
}
+
if (sep)
+ {
+
++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)
+ {
+
if (strpp && *strpp != NULL)
+ {
+
len = guththila_strlen (environment->string, *strpp);
+
memcpy (cp, *strpp, len);
+
cp += len;
+
}
+
if (++i >= arr->nelts)
+ {
+
break;
+
}
+
if (sep)
+ {
+
*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)
+{
+
if (header != NULL)
+
+ {
+
if (header->elts != NULL)
+
guththila_free (environment->allocator, header->elts);
+
guththila_free (environment->allocator, header);
+
return GUTHTHILA_SUCCESS;
+
}
+
}
+
+
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_array.h Wed Oct 26 23:05:49 2005
@@ -12,28 +12,28 @@
* 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_TABLES_H
#define GUTHTHILA_TABLES_H
-
+
/**
* @file guththila_tables.h
* @brief GUTHTHILA array and table
- */
-
+ */
+
#include "guththila_defines.h"
#include "guththila_environment.h"
#include "guththila_defines.h"
-
-
+
#include <stdarg.h> /* for va_list */
-
-
+
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+extern "C"
+{
+
+#endif /* __cplusplus */
+
/**
* @defgroup guththila_array (stack) and table functions
* @ingroup GUTHTHILA
@@ -41,70 +41,87 @@
* for applications, while Arrays are usually used to
* deal with string lists.
* @{
- */
-
-
-/** @see guththila_array_header_t */
-typedef struct guththila_array_header_t guththila_array_header_t;
-
-/** An opaque array type */
-struct guththila_array_header_t {
- /** The environment pointer of guththila */
- guththila_environment_t *environment;
- /** The amount of memory allocated for each element of the array */
- int elt_size;
- /** The number of active elements in the array */
- int nelts;
- /** The number of elements allocated in the array */
- int nalloc;
- /** The elements in the array */
- guththila_char_t *elts;
-};
-
-
+ */
+
+/** @see guththila_array_header_t */
+ typedef struct guththila_array_header_t guththila_array_header_t;
+
+/** An opaque array type */
+ struct guththila_array_header_t
+ {
+
+ /** The environment pointer of guththila */
+ guththila_environment_t * environment;
+
+ /** The amount of memory allocated for each element of the array */
+ int elt_size;
+
+ /** The number of active elements in the array */
+ int nelts;
+
+ /** The number of elements allocated in the array */
+ int nalloc;
+
+ /** The elements in the array */
+ guththila_char_t * elts;
+
};
+
/**
* Determine if the array is empty
* @param a The array to check
* @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
* @param environment guththila_environment pointer
* @param nelts the number of elements in the initial array
* @param elt_size The size of each element in the array.
* @return The new array
- */
-GUTHTHILA_DECLARE(guththila_array_header_t *) guththila_array_make(guththila_environment_t *environment,
- int nelts, int elt_size);
-
+ */
+
+ GUTHTHILA_DECLARE (guththila_array_header_t *)
+ guththila_array_make (guththila_environment_t * environment,
+
int nelts, int elt_size);
+
/**
* Add a new element to an array (as a first-in, last-out stack)
* @param arr The array to add an element to.
* @return Location for the new element in the array.
* @remark If there are no free spots in the array, then this function will
* allocate new space for the new element.
- */
-GUTHTHILA_DECLARE(void *) guththila_array_push(guththila_array_header_t *arr);
-
+ */
+
+ GUTHTHILA_DECLARE (void *)
+ guththila_array_push (guththila_array_header_t * arr);
+
/**
* Remove an element from an array (as a first-in, last-out stack)
* @param arr The array to remove an element from.
* @return Location of the element in the array.
* @remark If there are no elements in the array, NULL is returned.
- */
-GUTHTHILA_DECLARE(void *) guththila_array_pop(guththila_array_header_t *arr);
-
+ */
+
+ GUTHTHILA_DECLARE (void *)
+ guththila_array_pop (guththila_array_header_t * arr);
+
/**
* Concatenate two arrays together
* @param dst The destination array, and the one to go first in the combined
* array
* @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
* @param environment guththila_environment
@@ -113,9 +130,12 @@
* @remark The alternate guththila_array_copy_hdr copies only the header, and arranges
* for the elements to be copied if (and only if) the code subsequently
* does a push or arraycat.
- */
-GUTHTHILA_DECLARE(guththila_array_header_t *) guththila_array_copy(guththila_environment_t *environment,
- const guththila_array_header_t *arr);
+ */
+
+ GUTHTHILA_DECLARE (guththila_array_header_t *)
+ guththila_array_copy (guththila_environment_t * environment,
+
const guththila_array_header_t * arr);
+
/**
* Copy the headers of the array, and arrange for the elements to be copied if
* and only if the code subsequently does a push or arraycat.
@@ -123,21 +143,25 @@
* @param arr The array to copy
* @return An exact copy of the array passed in
* @remark The alternate guththila_array_copy copies the *entire* array.
- */
-GUTHTHILA_DECLARE(guththila_array_header_t *) guththila_array_copy_hdr(guththila_environment_t *environment,
- const guththila_array_header_t *arr);
-
+ */
+
+ GUTHTHILA_DECLARE (guththila_array_header_t *)
+ guththila_array_copy_hdr (guththila_environment_t * environment,
+
const guththila_array_header_t * arr);
+
/**
* Append one array to the end of another, creating a new array in the process.
* @param environment guththila_envioronment
* @param first The array to put first in the new array.
* @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);
-
+*/
+
+ 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);
+
/**
* Generates a new string containing the concatenated
* sequence of substrings referenced as elements within the array. The string
@@ -148,19 +172,20 @@
* @param arr The array to generate the string from
* @param sep The separator to use
* @return A string containing all of the data in the array.
- */
-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) guththila_array_free(guththila_environment_t *environment,
- guththila_array_header_t *header);
-/** @} */
-
+ */
+
+ 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)
+ guththila_array_free (guththila_environment_t * environment,
+
guththila_array_header_t * header);
+
+/** @} */
+
#ifdef __cplusplus
-}
-#endif
-
-#endif /* ! GUTHTHILA__ARRAY_H */
+}
+#endif /*
*/
+
+#endif /* ! GUTHTHILA__ARRAY_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_attribute.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_attribute.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_attribute.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_attribute.h Wed Oct 26 23:05:49 2005
@@ -24,9 +24,9 @@
typedef struct guththila_attribute_s
{
- guththila_token_t *prefix;
- guththila_token_t *name;
- guththila_token_t *value;
+ guththila_token_t *prefix;
+ guththila_token_t *name;
+ guththila_token_t *value;
} guththila_attribute_t;
#endif /* GUTHTHILA_ATTRIBUTE_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.c Wed Oct 26 23:05:49 2005
@@ -20,44 +20,51 @@
#include "guththila_environment.h"
#include "guththila_buffer.h"
-GUTHTHILA_DECLARE(guththila_buffer_t *)
-guththila_buffer_create (guththila_environment_t *environment,int size)
+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));
- 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);
- return name;
+ 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);
+ return name;
}
-GUTHTHILA_DECLARE(void)
-guththila_buffer_free (guththila_environment_t *environment, guththila_buffer_t *name)
+GUTHTHILA_DECLARE (void)
+guththila_buffer_free (guththila_environment_t * environment,
+ guththila_buffer_t * name)
{
- if (name)
+ if (name)
{
- if (name->buff)
- {
- guththila_free (environment->allocator,name->buff);
- }
- free (name);
+ if (name->buff)
+ {
+ guththila_free (environment->allocator, name->buff);
+ }
+ free (name);
}
}
-GUTHTHILA_DECLARE(guththila_buffer_t *)
-guththila_buffer_grow (guththila_environment_t *environment,guththila_buffer_t *name)
+GUTHTHILA_DECLARE (guththila_buffer_t *)
+guththila_buffer_grow (guththila_environment_t * environment,
+ guththila_buffer_t * name)
{
- guththila_buffer_t *x;
- name->size <<= 1;
- x = (guththila_buffer_t *)guththila_realloc (environment->allocator,name, name->size);
- if (x)
- name = x;
- else
- return NULL;
- return name;
+ guththila_buffer_t *x;
+ name->size <<= 1;
+ x = (guththila_buffer_t *) guththila_realloc (environment->allocator,
+ name, name->size);
+ if (x)
+ name = x;
+ else
+ return NULL;
+ return name;
}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_buffer.h Wed Oct 26 23:05:49 2005
@@ -27,16 +27,21 @@
typedef struct guththila_buffer_s
{
- int size;
- int next;
- int last;
- int offset;
- guththila_char_t *buff;
+ int size;
+ int next;
+ int last;
+ int offset;
+ 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);
+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);
-GUTHTHILA_DECLARE(guththila_buffer_t*) guththila_buffer_grow (guththila_environment_t *environment,guththila_buffer_t *name);
+GUTHTHILA_DECLARE (guththila_buffer_t *)
+guththila_buffer_grow (guththila_environment_t * environment,
+ guththila_buffer_t * name);
#endif /* GUTHTHILA_BUFFER_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_defines.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_defines.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_defines.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_defines.h Wed Oct 26 23:05:49 2005
@@ -4,18 +4,19 @@
* @file guththila_defines.h
* @brief Useful definitions, which may have platform concerns
*/
-
+
#include <stddef.h>
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-typedef char guththila_char_t;
-typedef unsigned char guththila_unsigned_char_t;
-typedef int guththila_bool_t;
-typedef int guththila_status_t;
-typedef unsigned int guththila_ssize_t;
+ typedef char guththila_char_t;
+ typedef unsigned char guththila_unsigned_char_t;
+ typedef int guththila_bool_t;
+ typedef int guththila_status_t;
+ typedef unsigned int guththila_ssize_t;
#define GUTHTHILA_TRUE 1
#define GUTHTHILA_FALSE 0
@@ -126,4 +127,4 @@
}
#endif
-#endif /* GUTHTHILA_DEFINES_H */
+#endif /* GUTHTHILA_DEFINES_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_depth.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_depth.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_depth.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_depth.h Wed Oct 26 23:05:49 2005
@@ -23,10 +23,10 @@
typedef struct guththila_depth_s
{
- int total;
- int count;
- int first;
+ int total;
+ int count;
+ int first;
} guththila_depth_t;
-#endif /*GUTHTHILA_DEPTH_H*/
+#endif /*GUTHTHILA_DEPTH_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.c Wed Oct 26 23:05:49 2005
@@ -16,13 +16,21 @@
#include <guththila_environment.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_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_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;
@@ -30,25 +38,24 @@
environment->allocator = allocator;
if (!error)
- environment->error = guththila_error_create(allocator);
+ environment->error = guththila_error_create (allocator);
else
environment->error = error;
if (!stream)
- environment->stream = guththila_stream_create(allocator, NULL);
+ environment->stream = guththila_stream_create (allocator, NULL);
else
environment->stream = stream;
if (!log)
- environment->log = guththila_log_create(allocator, NULL);
+ environment->log = guththila_log_create (allocator, NULL);
else
environment->log = log;
if (!string)
- environment->string = guththila_string_create(allocator, NULL);
+ environment->string = guththila_string_create (allocator, NULL);
else
environment->string = string;
return environment;
}
-
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_environment.h Wed Oct 26 23:05:49 2005
@@ -25,29 +25,37 @@
#include <guththila_string.h>
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-struct guththila_environment;
-struct guththila_environment_ops;
+ struct guththila_environment;
+ struct guththila_environment_ops;
-typedef struct guththila_environment_ops {
-int test;
-} guththila_environment_ops_t;
-
-typedef struct guththila_environment {
- 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);
+ typedef struct guththila_environment_ops
+ {
+ int test;
+ } guththila_environment_ops_t;
+
+ typedef struct guththila_environment
+ {
+ 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);
#ifdef __cplusplus
}
#endif
-#endif /* GUTHTHILA_ENVIRONMENT_H */
+#endif /* GUTHTHILA_ENVIRONMENT_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.c Wed Oct 26 23:05:49 2005
@@ -16,31 +16,38 @@
#include <guththila_error.h>
-guththila_char_t* GUTHTHILA_CALL guththila_error_ops_get_message()
+guththila_char_t *GUTHTHILA_CALL
+guththila_error_ops_get_message ()
{
return "This is the default error code";
}
-GUTHTHILA_DECLARE(guththila_error_t *) guththila_error_create(guththila_allocator_t* allocator)
+GUTHTHILA_DECLARE (guththila_error_t *)
+guththila_error_create (guththila_allocator_t * allocator)
{
guththila_error_t *error;
if (!allocator)
return NULL;
-
- error = (guththila_error_t*)guththila_malloc(allocator, sizeof(guththila_error_t ));
+
+ error =
+ (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));
+
+ error->ops =
+ (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;
-
+
return error;
}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_error.h Wed Oct 26 23:05:49 2005
@@ -21,66 +21,68 @@
#include <guththila_allocator.h>
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-struct guththila_error;
-struct guththila_error_ops;
+ 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_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);
+ 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,
- 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_READER_ERROR_OUT_OF_MEMORY
-
-
-
-
-} guththila_error_codes_t;
+ 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_READER_ERROR_OUT_OF_MEMORY
+ } guththila_error_codes_t;
#ifdef __cplusplus
}
#endif
-#endif /* GUTHTHILA_ERROR_H */
+#endif /* GUTHTHILA_ERROR_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.c Wed Oct 26 23:05:49 2005
@@ -31,12 +31,13 @@
typedef struct guththila_hash_entry_t guththila_hash_entry_t;
-struct guththila_hash_entry_t {
+struct guththila_hash_entry_t
+{
guththila_hash_entry_t *next;
- unsigned int hash;
- const void *key;
- guththila_ssize_t klen;
- const void *val;
+ unsigned int hash;
+ const void *key;
+ guththila_ssize_t klen;
+ const void *val;
};
/*
@@ -46,10 +47,11 @@
* hash entry to be freed or otherwise mangled between calls to
* guththila_hash_next().
*/
-struct guththila_hash_index_t {
- guththila_hash_t *ht;
- guththila_hash_entry_t *this, *next;
- unsigned int index;
+struct guththila_hash_index_t
+{
+ guththila_hash_t *ht;
+ guththila_hash_entry_t *this, *next;
+ unsigned int index;
};
/*
@@ -59,45 +61,50 @@
* The count of hash entries may be greater depending on the chosen
* collision rate.
*/
-struct guththila_hash_t {
- guththila_environment_t *environment;
- guththila_hash_entry_t **array;
- guththila_hash_index_t iterator; /* For guththila_hash_first(NULL, ...) */
- unsigned int count, max;
- guththila_hashfunc_t hash_func;
- guththila_hash_entry_t *free; /* List of recycled entries */
+struct guththila_hash_t
+{
+ guththila_environment_t *environment;
+ guththila_hash_entry_t **array;
+ guththila_hash_index_t iterator; /* For guththila_hash_first(NULL, ...) */
+ unsigned int count, max;
+ guththila_hashfunc_t hash_func;
+ guththila_hash_entry_t *free; /* List of recycled entries */
};
-#define INITIAL_MAX 15 /* tunable == 2^n - 1 */
+#define INITIAL_MAX 15 /* tunable == 2^n - 1 */
/*
* Hash creation functions.
*/
-static guththila_hash_entry_t **alloc_array(guththila_hash_t *ht, unsigned int max)
+static guththila_hash_entry_t **
+alloc_array (guththila_hash_t * ht, unsigned int max)
{
- return memset (guththila_malloc(ht->environment->allocator,
- sizeof(*ht->array) * (max + 1)), 0, sizeof(*ht->array) * (max + 1) );
+ return memset (guththila_malloc (ht->environment->allocator,
+ sizeof (*ht->array) * (max + 1)), 0,
+ sizeof (*ht->array) * (max + 1));
}
-GUTHTHILA_DECLARE(guththila_hash_t *) guththila_hash_make(guththila_environment_t *environment)
+GUTHTHILA_DECLARE (guththila_hash_t *)
+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;
ht->max = INITIAL_MAX;
- ht->array = alloc_array(ht, ht->max);
+ ht->array = alloc_array (ht, ht->max);
ht->hash_func = guththila_hashfunc_default;
return ht;
}
-GUTHTHILA_DECLARE(guththila_hash_t*) guththila_hash_make_custom(guththila_environment_t *environment,
- guththila_hashfunc_t hash_func)
+GUTHTHILA_DECLARE (guththila_hash_t *)
+guththila_hash_make_custom (guththila_environment_t * environment,
+ guththila_hashfunc_t hash_func)
{
- guththila_hash_t *ht = guththila_hash_make(environment);
+ guththila_hash_t *ht = guththila_hash_make (environment);
ht->hash_func = hash_func;
return ht;
}
@@ -107,10 +114,12 @@
* Hash iteration functions.
*/
-GUTHTHILA_DECLARE(guththila_hash_index_t*) guththila_hash_next(guththila_hash_index_t *hi)
+GUTHTHILA_DECLARE (guththila_hash_index_t *)
+guththila_hash_next (guththila_hash_index_t * hi)
{
hi->this = hi->next;
- while (!hi->this) {
+ while (!hi->this)
+ {
if (hi->index > hi->ht->max)
return NULL;
@@ -120,11 +129,13 @@
return hi;
}
-GUTHTHILA_DECLARE(guththila_hash_index_t*) guththila_hash_first(guththila_environment_t *environment, guththila_hash_t *ht)
+GUTHTHILA_DECLARE (guththila_hash_index_t *)
+guththila_hash_first (guththila_environment_t * environment,
+ guththila_hash_t * ht)
{
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;
@@ -132,17 +143,20 @@
hi->index = 0;
hi->this = NULL;
hi->next = NULL;
- return guththila_hash_next(hi);
+ return guththila_hash_next (hi);
}
-GUTHTHILA_DECLARE(void) guththila_hash_this(guththila_hash_index_t *hi,
- const void **key,
- guththila_ssize_t *klen,
- void **val)
-{
- if (key) *key = hi->this->key;
- if (klen) *klen = hi->this->klen;
- if (val) *val = (void *)hi->this->val;
+GUTHTHILA_DECLARE (void) guththila_hash_this (guththila_hash_index_t * hi,
+ const void **key,
+ guththila_ssize_t * klen,
+ void **val)
+{
+ if (key)
+ *key = hi->this->key;
+ if (klen)
+ *klen = hi->this->klen;
+ if (val)
+ *val = (void *) hi->this->val;
}
@@ -150,15 +164,18 @@
* Expanding a hash table
*/
-static void expand_array(guththila_hash_t *ht)
+static void
+expand_array (guththila_hash_t * ht)
{
guththila_hash_index_t *hi;
guththila_hash_entry_t **new_array;
unsigned int new_max;
new_max = ht->max * 2 + 1;
- new_array = alloc_array(ht, new_max);
- for (hi = guththila_hash_first(NULL, ht); hi; hi = guththila_hash_next(hi)) {
+ new_array = alloc_array (ht, new_max);
+ for (hi = guththila_hash_first (NULL, ht); hi;
+ hi = guththila_hash_next (hi))
+ {
unsigned int i = hi->this->hash & new_max;
hi->this->next = new_array[i];
new_array[i] = hi->this;
@@ -167,13 +184,16 @@
ht->max = new_max;
}
-unsigned int guththila_hashfunc_default(const guththila_char_t *char_key, guththila_ssize_t *klen)
+unsigned int
+guththila_hashfunc_default (const guththila_char_t * char_key,
+ guththila_ssize_t * klen)
{
unsigned int hash = 0;
- const guththila_unsigned_char_t *key = (const guththila_unsigned_char_t *)char_key;
+ const guththila_unsigned_char_t *key =
+ (const guththila_unsigned_char_t *) char_key;
const guththila_unsigned_char_t *p;
guththila_ssize_t i;
-
+
/*
* This is the popular `times 33' hash algorithm which is used by
* perl and also appears in Berkeley DB. This is one of the best
@@ -211,15 +231,19 @@
*
* -- Ralf S. Engelschall <rs...@engelschall.com>
*/
-
- if (*klen == GUTHTHILA_HASH_KEY_STRING) {
- for (p = key; *p; p++) {
+
+ if (*klen == GUTHTHILA_HASH_KEY_STRING)
+ {
+ for (p = key; *p; p++)
+ {
hash = hash * 33 + *p;
}
*klen = p - key;
}
- else {
- for (p = key, i = *klen; i; i--, p++) {
+ else
+ {
+ for (p = key, i = *klen; i; i--, p++)
+ {
hash = hash * 33 + *p;
}
}
@@ -237,22 +261,21 @@
* that hash entries can be removed.
*/
-static guththila_hash_entry_t **find_entry(guththila_hash_t *ht,
- const void *key,
- guththila_ssize_t klen,
- const void *val)
+static guththila_hash_entry_t **
+find_entry (guththila_hash_t * ht,
+ const void *key, guththila_ssize_t klen, const void *val)
{
guththila_hash_entry_t **hep, *he;
unsigned int hash;
- hash = ht->hash_func(key, &klen);
+ hash = ht->hash_func (key, &klen);
/* scan linked list */
for (hep = &ht->array[hash & ht->max], he = *hep;
- he; hep = &he->next, he = *hep) {
+ he; hep = &he->next, he = *hep)
+ {
if (he->hash == hash
- && he->klen == klen
- && memcmp(he->key, key, klen) == 0)
+ && he->klen == klen && memcmp (he->key, key, klen) == 0)
break;
}
if (he || !val)
@@ -262,41 +285,48 @@
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;
+ he->key = key;
he->klen = klen;
- he->val = val;
+ he->val = val;
*hep = he;
ht->count++;
return hep;
}
-GUTHTHILA_DECLARE(guththila_hash_t*) guththila_hash_copy(guththila_environment_t *environment,
- const guththila_hash_t *orig)
+GUTHTHILA_DECLARE (guththila_hash_t *)
+guththila_hash_copy (guththila_environment_t * environment,
+ const guththila_hash_t * orig)
{
guththila_hash_t *ht;
guththila_hash_entry_t *new_vals;
unsigned int i, j;
- ht = guththila_malloc(environment->allocator, sizeof(guththila_hash_t) +
- sizeof(*ht->array) * (orig->max + 1) +
- sizeof(guththila_hash_entry_t) * orig->count);
+ 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;
ht->free = NULL;
ht->count = orig->count;
ht->max = orig->max;
ht->hash_func = orig->hash_func;
- ht->array = (guththila_hash_entry_t **)((guththila_char_t *)ht + sizeof(guththila_hash_t));
-
- new_vals = (guththila_hash_entry_t *)((guththila_char_t *)(ht) + sizeof(guththila_hash_t) +
- sizeof(*ht->array) * (orig->max + 1));
+ ht->array =
+ (guththila_hash_entry_t **) ((guththila_char_t *) ht +
+ sizeof (guththila_hash_t));
+
+ new_vals =
+ (guththila_hash_entry_t *) ((guththila_char_t *) (ht) +
+ sizeof (guththila_hash_t) +
+ sizeof (*ht->array) * (orig->max + 1));
j = 0;
- for (i = 0; i <= ht->max; i++) {
+ for (i = 0; i <= ht->max; i++)
+ {
guththila_hash_entry_t **new_entry = &(ht->array[i]);
guththila_hash_entry_t *orig_entry = orig->array[i];
- while (orig_entry) {
+ while (orig_entry)
+ {
*new_entry = &new_vals[j++];
(*new_entry)->hash = orig_entry->hash;
(*new_entry)->key = orig_entry->key;
@@ -310,27 +340,29 @@
return ht;
}
-GUTHTHILA_DECLARE(void*) guththila_hash_get(guththila_hash_t *ht,
- const void *key,
- guththila_ssize_t klen)
+GUTHTHILA_DECLARE (void *) guththila_hash_get (guththila_hash_t * ht,
+ const void *key,
+ guththila_ssize_t klen)
{
guththila_hash_entry_t *he;
- he = *find_entry(ht, key, klen, NULL);
+ he = *find_entry (ht, key, klen, NULL);
if (he)
- return (void *)he->val;
+ return (void *) he->val;
else
return NULL;
}
-GUTHTHILA_DECLARE(void) guththila_hash_set(guththila_hash_t *ht,
- const void *key,
- guththila_ssize_t klen,
- const void *val)
+GUTHTHILA_DECLARE (void) guththila_hash_set (guththila_hash_t * ht,
+ const void *key,
+ guththila_ssize_t klen,
+ const void *val)
{
guththila_hash_entry_t **hep;
- hep = find_entry(ht, key, klen, val);
- if (*hep) {
- if (!val) {
+ hep = find_entry (ht, key, klen, val);
+ if (*hep)
+ {
+ if (!val)
+ {
/* delete entry */
guththila_hash_entry_t *old = *hep;
*hep = (*hep)->next;
@@ -338,81 +370,94 @@
ht->free = old;
--ht->count;
}
- else {
+ else
+ {
/* replace entry */
(*hep)->val = val;
/* check that the collision rate isn't too high */
- if (ht->count > ht->max) {
- expand_array(ht);
+ if (ht->count > ht->max)
+ {
+ expand_array (ht);
}
}
}
/* else key not present and val==NULL */
}
-unsigned int guththila_hash_count(guththila_hash_t *ht)
+unsigned int
+guththila_hash_count (guththila_hash_t * ht)
{
return ht->count;
}
-GUTHTHILA_DECLARE(guththila_hash_t*) guththila_hash_overlay(guththila_environment_t *environment,
- const guththila_hash_t *overlay,
- const guththila_hash_t *base)
-{
- return guththila_hash_merge(environment, overlay, base, NULL, NULL);
-}
-
-GUTHTHILA_DECLARE(guththila_hash_t*) guththila_hash_merge(guththila_environment_t *environment,
- const guththila_hash_t *overlay,
- const guththila_hash_t *base,
- void * (*merger)(guththila_environment_t *environment,
- const void *key,
- guththila_ssize_t klen,
- const void *h1_val,
- const void *h2_val,
- const void *data),
- const void *data)
+GUTHTHILA_DECLARE (guththila_hash_t *)
+guththila_hash_overlay (guththila_environment_t * environment,
+ const guththila_hash_t * overlay,
+ const guththila_hash_t * base)
+{
+ return guththila_hash_merge (environment, overlay, base, NULL, NULL);
+}
+
+GUTHTHILA_DECLARE (guththila_hash_t *)
+guththila_hash_merge (guththila_environment_t * environment,
+ const guththila_hash_t * overlay,
+ const guththila_hash_t * base,
+ void *(*merger) (guththila_environment_t * environment,
+ const void *key,
+ guththila_ssize_t klen,
+ const void *h1_val, const void *h2_val,
+ const void *data), const void *data)
{
guththila_hash_t *res;
guththila_hash_entry_t *new_vals = NULL;
guththila_hash_entry_t *iter;
guththila_hash_entry_t *ent;
- unsigned int i,j,k;
+ unsigned int i, j, k;
#if GUTHTHILA_POOL_DEBUG
/* we don't copy keys and values, so it's necessary that
* overlay->a.environment and base->a.environment have a life span at least
* as long as p
*/
- if (!guththila_environment_is_ancestor(overlay->environment, p)) {
- fprintf(stderr,
- "guththila_hash_merge: overlay's environment is not an ancestor of p\n");
- abort();
- }
- if (!guththila_environment_is_ancestor(base->environment, p)) {
- fprintf(stderr,
- "guththila_hash_merge: base's environment is not an ancestor of p\n");
- abort();
+ if (!guththila_environment_is_ancestor (overlay->environment, p))
+ {
+ fprintf (stderr,
+ "guththila_hash_merge: overlay's environment is not an ancestor of p\n");
+ abort ();
+ }
+ if (!guththila_environment_is_ancestor (base->environment, p))
+ {
+ fprintf (stderr,
+ "guththila_hash_merge: base's environment is not an ancestor of p\n");
+ abort ();
}
#endif
- res = guththila_malloc(environment->allocator, sizeof(guththila_hash_t));
+ res =
+ guththila_malloc (environment->allocator, sizeof (guththila_hash_t));
res->environment = environment;
res->free = NULL;
res->hash_func = base->hash_func;
res->count = base->count;
res->max = (overlay->max > base->max) ? overlay->max : base->max;
- if (base->count + overlay->count > res->max) {
+ if (base->count + overlay->count > res->max)
+ {
res->max = res->max * 2 + 1;
}
- res->array = alloc_array(res, res->max);
- if (base->count + overlay->count) {
- new_vals = guththila_malloc(environment->allocator, sizeof(guththila_hash_entry_t) *
- (base->count + overlay->count));
+ res->array = alloc_array (res, res->max);
+ if (base->count + overlay->count)
+ {
+ new_vals =
+ guththila_malloc (environment->allocator,
+ sizeof (guththila_hash_entry_t) * (base->count +
+ overlay->
+ count));
}
j = 0;
- for (k = 0; k <= base->max; k++) {
- for (iter = base->array[k]; iter; iter = iter->next) {
+ for (k = 0; k <= base->max; k++)
+ {
+ for (iter = base->array[k]; iter; iter = iter->next)
+ {
i = iter->hash & res->max;
new_vals[j].klen = iter->klen;
new_vals[j].key = iter->key;
@@ -424,23 +469,31 @@
}
}
- for (k = 0; k <= overlay->max; k++) {
- for (iter = overlay->array[k]; iter; iter = iter->next) {
+ for (k = 0; k <= overlay->max; k++)
+ {
+ for (iter = overlay->array[k]; iter; iter = iter->next)
+ {
i = iter->hash & res->max;
- for (ent = res->array[i]; ent; ent = ent->next) {
+ for (ent = res->array[i]; ent; ent = ent->next)
+ {
if ((ent->klen == iter->klen) &&
- (memcmp(ent->key, iter->key, iter->klen) == 0)) {
- if (merger) {
- ent->val = (*merger)(environment, iter->key, iter->klen,
- iter->val, ent->val, data);
+ (memcmp (ent->key, iter->key, iter->klen) == 0))
+ {
+ if (merger)
+ {
+ ent->val =
+ (*merger) (environment, iter->key, iter->klen,
+ iter->val, ent->val, data);
}
- else {
+ else
+ {
ent->val = iter->val;
}
break;
}
}
- if (!ent) {
+ if (!ent)
+ {
new_vals[j].klen = iter->klen;
new_vals[j].key = iter->key;
new_vals[j].val = iter->val;
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_hash.h Wed Oct 26 23:05:49 2005
@@ -26,7 +26,8 @@
#include <guththila_environment.h>
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
/**
@@ -50,12 +51,12 @@
/**
* Abstract type for hash tables.
*/
-typedef struct guththila_hash_t guththila_hash_t;
+ typedef struct guththila_hash_t guththila_hash_t;
/**
* Abstract type for scanning hash tables.
*/
-typedef struct guththila_hash_index_t guththila_hash_index_t;
+ typedef struct guththila_hash_index_t guththila_hash_index_t;
/**
* Callback functions for calculating hash values.
@@ -63,19 +64,23 @@
* @param klen The length of the key, or GUTHTHILA_HASH_KEY_STRING to use the string
* length. If GUTHTHILA_HASH_KEY_STRING then returns the actual key length.
*/
-typedef unsigned int (*guththila_hashfunc_t)(const guththila_char_t *key, guththila_ssize_t *klen);
+ typedef unsigned int (*guththila_hashfunc_t) (const guththila_char_t *
+ key,
+ guththila_ssize_t * klen);
/**
* The default hash function.
*/
-unsigned int guththila_hashfunc_default(const guththila_char_t *key, guththila_ssize_t *klen);
+ unsigned int guththila_hashfunc_default (const guththila_char_t * key,
+ guththila_ssize_t * klen);
/**
* Create a hash table.
* @param environment The environment to allocate the hash table out of
* @return The hash table just created
*/
-GUTHTHILA_DECLARE(guththila_hash_t *) guththila_hash_make(guththila_environment_t *environment);
+ GUTHTHILA_DECLARE (guththila_hash_t *)
+ guththila_hash_make (guththila_environment_t * environment);
/**
* Create a hash table with a custom hash function
@@ -83,8 +88,9 @@
* @param hash_func A custom hash function.
* @return The hash table just created
*/
-GUTHTHILA_DECLARE(guththila_hash_t *) guththila_hash_make_custom(guththila_environment_t *environment,
- guththila_hashfunc_t hash_func);
+ GUTHTHILA_DECLARE (guththila_hash_t *)
+ guththila_hash_make_custom (guththila_environment_t * environment,
+ guththila_hashfunc_t hash_func);
/**
* Make a copy of a hash table
@@ -93,8 +99,9 @@
* @return The hash table just created
* @remark Makes a shallow copy
*/
-GUTHTHILA_DECLARE(guththila_hash_t*) guththila_hash_copy(guththila_environment_t *environment,
- const guththila_hash_t *h);
+ GUTHTHILA_DECLARE (guththila_hash_t *)
+ guththila_hash_copy (guththila_environment_t * environment,
+ const guththila_hash_t * h);
/**
* Associate a value with a key in a hash table.
@@ -104,8 +111,10 @@
* @param val Value to associate with the key
* @remark If the value is NULL the hash entry is deleted.
*/
-GUTHTHILA_DECLARE(void) guththila_hash_set(guththila_hash_t *ht, const void *key,
- guththila_ssize_t klen, const void *val);
+ GUTHTHILA_DECLARE (void) guththila_hash_set (guththila_hash_t * ht,
+ const void *key,
+ guththila_ssize_t klen,
+ const void *val);
/**
* Look up the value associated with a key in a hash table.
@@ -114,8 +123,9 @@
* @param klen Length of the key. Can be GUTHTHILA_HASH_KEY_STRING to use the string length.
* @return Returns NULL if the key is not present.
*/
-GUTHTHILA_DECLARE(void*) guththila_hash_get(guththila_hash_t *ht, const void *key,
- guththila_ssize_t klen);
+ GUTHTHILA_DECLARE (void *) guththila_hash_get (guththila_hash_t * ht,
+ const void *key,
+ guththila_ssize_t klen);
/**
* Start iterating over the entries in a hash table.
@@ -145,7 +155,9 @@
* }
* </PRE>
*/
-GUTHTHILA_DECLARE(guththila_hash_index_t*) guththila_hash_first(guththila_environment_t *environment, guththila_hash_t *ht);
+ GUTHTHILA_DECLARE (guththila_hash_index_t *)
+ guththila_hash_first (guththila_environment_t * environment,
+ guththila_hash_t * ht);
/**
* Continue iterating over the entries in a hash table.
@@ -153,7 +165,8 @@
* @return a pointer to the updated iteration state. NULL if there are no more
* entries.
*/
-GUTHTHILA_DECLARE(guththila_hash_index_t*) guththila_hash_next(guththila_hash_index_t *hi);
+ GUTHTHILA_DECLARE (guththila_hash_index_t *)
+ guththila_hash_next (guththila_hash_index_t * hi);
/**
* Get the current entry's details from the iteration state.
@@ -164,15 +177,17 @@
* @remark The return pointers should point to a variable that will be set to the
* corresponding data, or they may be NULL if the data isn't interesting.
*/
-GUTHTHILA_DECLARE(void) guththila_hash_this(guththila_hash_index_t *hi, const void **key,
- guththila_ssize_t *klen, void **val);
+ GUTHTHILA_DECLARE (void) guththila_hash_this (guththila_hash_index_t *
+ hi, const void **key,
+ guththila_ssize_t * klen,
+ void **val);
/**
* Get the number of key/value pairs in the hash table.
* @param ht The hash table
* @return The number of key/value pairs in the hash table.
*/
-unsigned int guththila_hash_count(guththila_hash_t *ht);
+ unsigned int guththila_hash_count (guththila_hash_t * ht);
/**
* Merge two hash tables into one new hash table. The values of the overlay
@@ -183,9 +198,10 @@
* @param base The table that represents the initial values of the new table
* @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,
- const guththila_hash_t *overlay,
- const guththila_hash_t *base);
+ GUTHTHILA_DECLARE (guththila_hash_t *)
+ guththila_hash_overlay (guththila_environment_t * environment,
+ const guththila_hash_t * overlay,
+ const guththila_hash_t * base);
/**
* Merge two hash tables into one new hash table. If the same key
@@ -201,16 +217,17 @@
* @param data Client data to pass to the merger function
* @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,
- const guththila_hash_t *h1,
- const guththila_hash_t *h2,
- void * (*merger)(guththila_environment_t *environment,
- const void *key,
- guththila_ssize_t klen,
- const void *h1_val,
- const void *h2_val,
- const void *data),
- const void *data);
+ GUTHTHILA_DECLARE (guththila_hash_t *)
+ guththila_hash_merge (guththila_environment_t * environment,
+ const guththila_hash_t * h1,
+ const guththila_hash_t * h2,
+ void *(*merger) (guththila_environment_t *
+ environment, const void *key,
+ guththila_ssize_t klen,
+ const void *h1_val,
+ const void *h2_val,
+ const void *data),
+ const void *data);
/**
* Get a pointer to the environment which the hash table was created in
@@ -223,4 +240,4 @@
}
#endif
-#endif /* !GUTHTHILA_HASH_H */
+#endif /* !GUTHTHILA_HASH_H */
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.c?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.c (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.c Wed Oct 26 23:05:49 2005
@@ -17,46 +17,55 @@
#include <guththila_log.h>
#include <stdio.h>
-int GUTHTHILA_CALL guththila_log_impl_write(const void *buffer, size_t count);
+int GUTHTHILA_CALL guththila_log_impl_write (const void *buffer,
+ size_t count);
-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)
+{
guththila_log_t *log;
if (!allocator)
return NULL;
- log = (guththila_log_t*)guththila_malloc(allocator, sizeof(guththila_log_t));
+ log =
+ (guththila_log_t *) guththila_malloc (allocator,
+ sizeof (guththila_log_t));
if (!log)
return NULL;
-
+
if (operations)
log->ops = operations;
else
{
- log->ops = (guththila_log_ops_t*)guththila_malloc(allocator, sizeof(guththila_log_ops_t));
+ log->ops =
+ (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;
}
-
+
return log;
}
-int GUTHTHILA_CALL guththila_log_impl_write(const void *buffer, size_t count)
+int GUTHTHILA_CALL
+guththila_log_impl_write (const void *buffer, size_t count)
{
int i;
if (!buffer)
return -1;
-
- i =0;
- for(i = 0; i < count; i++)
- fprintf(stderr, "%c", ((guththila_char_t*)buffer)[i]);
- printf("\n");
+
+ i = 0;
+ for (i = 0; i < count; i++)
+ fprintf (stderr, "%c", ((guththila_char_t *) buffer)[i]);
+ printf ("\n");
return 0;
}
Modified: webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.h?rev=328799&r1=328798&r2=328799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.h (original)
+++ webservices/axis2/trunk/c/modules/xml/guththila/src/guththila_log.h Wed Oct 26 23:05:49 2005
@@ -20,35 +20,38 @@
#include <guththila_allocator.h>
#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum guththila_log_levels
-{
- GUTHTHILA_LOG_DEBUG = 0,
- GUTHTHILA_LOG_INFO,
- GUTHTHILA_LOG_WARNING,
- GUTHTHILA_LOG_ERROR,
- GUTHTHILA_LOG_CRITICAL
-} guththila_log_levels_t;
-
-struct guththila_log;
-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);
-} guththila_log_ops_t;
-
-typedef struct guththila_log
+extern "C"
{
- struct guththila_log_ops *ops;
- guththila_log_levels_t level;
- int enabled; /*boolean */
-} guththila_log_t;
+#endif
-GUTHTHILA_DECLARE(guththila_log_t*) guththila_log_create (guththila_allocator_t * allocator,
- guththila_log_ops_t * operations);
+ typedef enum guththila_log_levels
+ {
+ GUTHTHILA_LOG_DEBUG = 0,
+ GUTHTHILA_LOG_INFO,
+ GUTHTHILA_LOG_WARNING,
+ GUTHTHILA_LOG_ERROR,
+ GUTHTHILA_LOG_CRITICAL
+ } guththila_log_levels_t;
+
+ struct guththila_log;
+ 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);
+ } guththila_log_ops_t;
+
+ typedef 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);
#define guththila_log_write(log, buffer, count) ((log)->ops->guththila_log_ops_write(buffer, count))
@@ -56,4 +59,4 @@
}
#endif
-#endif /* GUTHTHILA_LOG_H */
+#endif /* GUTHTHILA_LOG_H */