You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2005/10/31 09:48:46 UTC
svn commit: r329771 - in /webservices/axis2/trunk/c: include/
modules/util/src/
Author: damitha
Date: Mon Oct 31 00:48:24 2005
New Revision: 329771
URL: http://svn.apache.org/viewcvs?rev=329771&view=rev
Log:
Please refer to the mail "[Axis2] Changes to environment"
Added:
webservices/axis2/trunk/c/modules/util/src/axis2_allocator_default.h
webservices/axis2/trunk/c/modules/util/src/axis2_log_default.h
webservices/axis2/trunk/c/modules/util/src/axis2_stream_default.h
Modified:
webservices/axis2/trunk/c/include/axis2_allocator.h
webservices/axis2/trunk/c/include/axis2_environment.h
webservices/axis2/trunk/c/include/axis2_error.h
webservices/axis2/trunk/c/include/axis2_log.h
webservices/axis2/trunk/c/include/axis2_stream.h
webservices/axis2/trunk/c/include/axis2_string.h
webservices/axis2/trunk/c/modules/util/src/axis2_allocator.c
webservices/axis2/trunk/c/modules/util/src/axis2_environment.c
webservices/axis2/trunk/c/modules/util/src/axis2_log.c
webservices/axis2/trunk/c/modules/util/src/axis2_qname.c
webservices/axis2/trunk/c/modules/util/src/axis2_stream.c
webservices/axis2/trunk/c/modules/util/src/axis2_string.c
Modified: webservices/axis2/trunk/c/include/axis2_allocator.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_allocator.h?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_allocator.h (original)
+++ webservices/axis2/trunk/c/include/axis2_allocator.h Mon Oct 31 00:48:24 2005
@@ -69,7 +69,7 @@
* @param allocator user defined allcator. Optional, can be NULL. If NULL, a default allocator will be returned.
* @return initialized allocator. NULL on error.
*/
- AXIS2_DECLARE(axis2_allocator_t *) axis2_allocator_init (axis2_allocator_t * allocator);
+ /*AXIS2_DECLARE(axis2_allocator_t *) axis2_allocator_init (axis2_allocator_t * allocator);*/
#define axis2_malloc(allocator, size) ((allocator)->axis2_allocator_malloc(size))
#define axis2_realloc(allocator, ptr, size) ((allocator)->axis2_allocator_realloc(ptr, size))
Modified: webservices/axis2/trunk/c/include/axis2_environment.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_environment.h?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_environment.h (original)
+++ webservices/axis2/trunk/c/include/axis2_environment.h Mon Oct 31 00:48:24 2005
@@ -26,7 +26,6 @@
#include <axis2_error.h>
#include <axis2_stream.h>
#include <axis2_log.h>
-#include <axis2_string.h>
#ifdef __cplusplus
extern "C"
@@ -50,25 +49,12 @@
*/
/**
- * \brief Axis2 Environment operations struct
- *
- * Encapsulator struct for operations of axis2_environment
- */
- typedef struct axis2_environment_ops
- {
- /** This is a dummy member */
- int dummy;
- } axis2_environment_ops_t;
-
- /**
* \brief Axis2 Environment struct
*
* Environment acts as a container for error, log, memory allocator and other routines
*/
typedef struct axis2_environment
{
- /** Environment related operations */
- axis2_environment_ops_t *ops;
/** Memory allocation routines */
axis2_allocator_t *allocator;
/** Error handling */
@@ -77,8 +63,6 @@
axis2_stream_t *stream;
/** Logging routines */
axis2_log_t *log;
- /** String routines */
- axis2_string_t *string;
} axis2_environment_t;
/**
@@ -94,8 +78,7 @@
allocator,
axis2_error_t * error,
axis2_stream_t * stream,
- axis2_log_t * log,
- axis2_string_t * string);
+ axis2_log_t * log);
/** @} */
Modified: webservices/axis2/trunk/c/include/axis2_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_error.h?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_error.h (original)
+++ webservices/axis2/trunk/c/include/axis2_error.h Mon Oct 31 00:48:24 2005
@@ -45,7 +45,7 @@
* get error message for the last error
* @return error message for the last error. NULL on error.
*/
- axis2_char_t * (AXIS2_CALL *axis2_error_ops_get_message) ();
+ axis2_char_t * (AXIS2_CALL *axis2_error_ops_get_message) (int error_number);
} axis2_error_ops_t;
/**
@@ -58,7 +58,7 @@
/** error related operations */
struct axis2_error_ops *ops;
/** last error number */
- int errorno;
+ int error_number;
} axis2_error_t;
/**
Modified: webservices/axis2/trunk/c/include/axis2_log.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_log.h?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_log.h (original)
+++ webservices/axis2/trunk/c/include/axis2_log.h Mon Oct 31 00:48:24 2005
@@ -86,8 +86,8 @@
* @param allocator allocator to be used. Mandatory, cannot be NULL
* @return pointer to the newly created log struct
*/
- AXIS2_DECLARE(axis2_log_t *) axis2_log_create (axis2_allocator_t * allocator,
- axis2_log_ops_t * operations);
+ /* AXIS2_DECLARE(axis2_log_t *) axis2_log_create (axis2_allocator_t * allocator,
+ axis2_log_ops_t * operations);*/
#define axis2_log_write(log, buffer, count) ((log)->ops->axis2_log_ops_write(buffer, count))
Modified: webservices/axis2/trunk/c/include/axis2_stream.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_stream.h?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_stream.h (original)
+++ webservices/axis2/trunk/c/include/axis2_stream.h Mon Oct 31 00:48:24 2005
@@ -110,8 +110,8 @@
* @param operations operations struct. Optional, can be NULL. If null default operations would be assigned.
* @return pointer to the newly created log struct
*/
- AXIS2_DECLARE(axis2_stream_t *) axis2_stream_create (axis2_allocator_t * allocator,
- axis2_stream_t * stream);
+/* AXIS2_DECLARE(axis2_stream_t *) axis2_stream_create (axis2_allocator_t * allocator,
+ axis2_stream_t * stream);*/
#define axis2_stream_read(stream, buffer, count) \
((stream)->ops->axis2_stream_ops_read(buffer, count))
Modified: webservices/axis2/trunk/c/include/axis2_string.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_string.h?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_string.h (original)
+++ webservices/axis2/trunk/c/include/axis2_string.h Mon Oct 31 00:48:24 2005
@@ -32,40 +32,11 @@
* @{
*/
-/**
- * \brief Axis2 string operations
- *
- * Encapsulator for string handling routines
- */
- AXIS2_DECLARE_DATA typedef struct axis2_string
- {
- /**
- * duplicates the given string
- * @param ptr string to be duplicated
- * @return pointer to the duplicated string
- */
- void * (AXIS2_CALL *axis2_string_strdup) (const void *ptr);
- /**
- * compares the given two strings
- * @param s1 first string to be compared
- * @param s2 second string to be compared
- * @return 0 if the two strings are equal, else non zero
- */
- int (AXIS2_CALL *axis2_string_strcmp) (const axis2_char_t * s1,
- const axis2_char_t * s2);
- } axis2_string_t;
+void* AXIS2_CALL
+axis2_strdup (const void *ptr);
- /**
- * Creates) a string struct
- * @param allocator allocator to be used. Mandatory, cannot be NULL
- * @param string user defined string. Optional, can be NULL. If NULL, a default string will be returned.
- * @return pointer to newly created string. NULL on error.
- */
- AXIS2_DECLARE(axis2_string_t *) axis2_string_create (axis2_allocator_t * allocator,
- axis2_string_t * string);
-
-#define axis2_strdup(string, ptr) ((string)->axis2_string_strdup(ptr))
-#define axis2_strcmp(string, s1, s2) ((string)->axis2_string_strcmp(s1, s2))
+int AXIS2_CALL
+axis2_strcmp (const axis2_char_t * s1, const axis2_char_t * s2);
/** @} */
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_allocator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_allocator.c?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_allocator.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_allocator.c Mon Oct 31 00:48:24 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <axis2_allocator.h>
+#include <axis2_allocator_default.h>
#include <stdlib.h>
AXIS2_DECLARE(axis2_allocator_t *)
Added: webservices/axis2/trunk/c/modules/util/src/axis2_allocator_default.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_allocator_default.h?rev=329771&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_allocator_default.h (added)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_allocator_default.h Mon Oct 31 00:48:24 2005
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_ALLOCATOR_DEFAULT_H
+#define AXIS2_ALLOCATOR_DEFAULT_H
+
+/**
+ * @file axis2_allocator_default.h
+ * @brief Axis2 default memory allocator interface
+ */
+
+#include <axis2_defines.h>
+
+#include <axis2_allocator.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @defgroup axis2_allocator Default Memory Allocator
+ * @ingroup axis2_util
+ * @{
+ */
+
+ /**
+ * Initializes (creates) an allocator.
+ * @param allocator user defined allcator. Optional, can be NULL. If NULL, a default allocator will be returned.
+ * @return initialized allocator. NULL on error.
+ */
+ AXIS2_DECLARE(axis2_allocator_t *) axis2_allocator_init (axis2_allocator_t * allocator);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AXIS2_ALLOCATOR_DEFAULT_H */
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_environment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_environment.c?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_environment.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_environment.c Mon Oct 31 00:48:24 2005
@@ -19,7 +19,7 @@
AXIS2_DECLARE(axis2_environment_t *)
axis2_environment_create (axis2_allocator_t * allocator,
axis2_error_t * error, axis2_stream_t * stream,
- axis2_log_t * log, axis2_string_t * string)
+ axis2_log_t * log)
{
axis2_environment_t *environment;
if (!allocator)
@@ -45,8 +45,6 @@
environment->log = axis2_log_create (allocator, NULL);
else
environment->log = log;
-
- environment->string = axis2_string_create (allocator, string);
return environment;
}
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_log.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_log.c?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_log.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_log.c Mon Oct 31 00:48:24 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <axis2_log.h>
+#include <axis2_log_default.h>
#include <stdio.h>
axis2_status_t AXIS2_CALL axis2_log_impl_write (const void *buffer, size_t count);
Added: webservices/axis2/trunk/c/modules/util/src/axis2_log_default.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_log_default.h?rev=329771&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_log_default.h (added)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_log_default.h Mon Oct 31 00:48:24 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_LOG_DEFAULT_H
+#define AXIS2_LOG_DEFAULT_H
+
+#include <axis2_log.h>
+
+#include "axis2_allocator_default.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/**
+ * @defgroup axis2_log Log
+ * @ingroup axis2_util
+ * @{
+ */
+
+ /**
+ * Creates a log struct
+ * @param allocator allocator to be used. Mandatory, cannot be NULL
+ * @return pointer to the newly created log struct
+ */
+ AXIS2_DECLARE(axis2_log_t *) axis2_log_create (axis2_allocator_t * allocator,
+ axis2_log_ops_t * operations);
+
+#define axis2_log_write(log, buffer, count) ((log)->ops->axis2_log_ops_write(buffer, count))
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AXIS2_LOG_DEFAULT_H */
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_qname.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_qname.c?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_qname.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_qname.c Mon Oct 31 00:48:24 2005
@@ -36,7 +36,7 @@
{
if (!qname)
{
- environment->error->errorno = AXIS2_ERROR_INVALID_NULL_PARAMETER;
+ environment->error->error_number = AXIS2_ERROR_INVALID_NULL_PARAMETER;
return AXIS2_FAILURE;
}
if (qname->localpart)
@@ -70,7 +70,7 @@
if (!qn1 || !qn2)
{
- environment->error->errorno = AXIS2_ERROR_INVALID_NULL_PARAMETER;
+ environment->error->error_number = AXIS2_ERROR_INVALID_NULL_PARAMETER;
return AXIS2_FALSE;
}
@@ -78,7 +78,7 @@
if (qn1->localpart && qn2->localpart)
{
localparts_differ =
- axis2_strcmp (environment->string, qn1->localpart,
+ axis2_strcmp (qn1->localpart,
qn2->localpart);
}
else
@@ -88,7 +88,7 @@
if (qn1->namespace_uri && qn2->namespace_uri)
{
uris_differ =
- axis2_strcmp (environment->string, qn1->namespace_uri,
+ axis2_strcmp (qn1->namespace_uri,
qn2->namespace_uri);
}
else
@@ -111,7 +111,7 @@
/* localpart or prefix can't be null */
if (!localpart)
{
- environment->error->errorno = AXIS2_ERROR_INVALID_NULL_PARAMETER;
+ environment->error->error_number = AXIS2_ERROR_INVALID_NULL_PARAMETER;
return NULL;
}
@@ -119,48 +119,48 @@
sizeof (axis2_qname_t));
if (!qn)
{
- environment->error->errorno = AXIS2_ERROR_INVALID_NULL_PARAMETER;
+ environment->error->error_number = AXIS2_ERROR_INVALID_NULL_PARAMETER;
return NULL;
}
/* set properties */
- qn->localpart = axis2_strdup (environment->string, localpart);
+ qn->localpart = axis2_strdup (localpart);
if (!(qn->localpart))
{
axis2_free (environment->allocator, qn);
- environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+ environment->error->error_number = AXIS2_ERROR_NO_MEMORY;
return NULL;
}
if (!prefix)
{
- qn->prefix = axis2_strdup (environment->string, "");
+ qn->prefix = axis2_strdup ("");
}
else
{
- qn->prefix = axis2_strdup (environment->string, prefix);
+ qn->prefix = axis2_strdup (prefix);
}
if (!(qn->prefix))
{
axis2_free (environment->allocator, qn->localpart);
axis2_free (environment->allocator, qn);
- environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+ environment->error->error_number = AXIS2_ERROR_NO_MEMORY;
return NULL;
}
if (!namespace_uri)
{
- qn->namespace_uri = axis2_strdup (environment->string, "");
+ qn->namespace_uri = axis2_strdup ("");
}
else
{
- qn->namespace_uri = axis2_strdup (environment->string, namespace_uri);
+ qn->namespace_uri = axis2_strdup (namespace_uri);
}
if (!(qn->namespace_uri))
{
axis2_free (environment->allocator, qn->localpart);
axis2_free (environment->allocator, qn->prefix);
axis2_free (environment->allocator, qn);
- environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+ environment->error->error_number = AXIS2_ERROR_NO_MEMORY;
return NULL;
}
@@ -176,7 +176,7 @@
axis2_free (environment->allocator, qn->namespace_uri);
axis2_free (environment->allocator, qn->prefix);
axis2_free (environment->allocator, qn);
- environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+ environment->error->error_number = AXIS2_ERROR_NO_MEMORY;
return NULL;
}
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_stream.c?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_stream.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_stream.c Mon Oct 31 00:48:24 2005
@@ -18,7 +18,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include <axis2_stream.h>
+#include <axis2_stream_default.h>
axis2_status_t AXIS2_CALL axis2_stream_impl_write (const void *buffer, size_t count);
axis2_status_t AXIS2_CALL axis2_stream_impl_read (void *buffer, size_t count);
Added: webservices/axis2/trunk/c/modules/util/src/axis2_stream_default.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_stream_default.h?rev=329771&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_stream_default.h (added)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_stream_default.h Mon Oct 31 00:48:24 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain count copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_STREAM_DEFAULT_H
+#define AXIS2_STREAM_DEFAULT_H
+
+#include <axis2_stream.h>
+#include "axis2_allocator_default.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @defgroup axis2_stream Stream
+ * @ingroup axis2_util
+ * @{
+ */
+
+ /**
+ * Creates a stream struct
+ * @param allocator allocator to be used. Mandatory, cannot be NULL
+ * @param operations operations struct. Optional, can be NULL. If null default operations would be assigned.
+ * @return pointer to the newly created log struct
+ */
+ AXIS2_DECLARE(axis2_stream_t *) axis2_stream_create (axis2_allocator_t * allocator,
+ axis2_stream_t * stream);
+
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AXIS2_STREAM_DEFAULT_H */
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_string.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_string.c?rev=329771&r1=329770&r2=329771&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_string.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_string.c Mon Oct 31 00:48:24 2005
@@ -19,7 +19,7 @@
#include <string.h>
void* AXIS2_CALL
-axis2_string_ops_strdup (const void *ptr)
+axis2_strdup (const void *ptr)
{
if (ptr)
{
@@ -32,7 +32,7 @@
}
int AXIS2_CALL
-axis2_string_ops_strcmp (const axis2_char_t * s1, const axis2_char_t * s2)
+axis2_strcmp (const axis2_char_t * s1, const axis2_char_t * s2)
{
if (s1 && s2)
return strcmp (s1, s2);
@@ -40,27 +40,3 @@
return -1;
}
-AXIS2_DECLARE(axis2_string_t *)
-axis2_string_create (axis2_allocator_t * allocator, axis2_string_t * string)
-{
- if(string)
- {
- if(!string->axis2_string_strdup)
- string->axis2_string_strdup = axis2_string_ops_strdup;
- if(!string->axis2_string_strcmp)
- string->axis2_string_strcmp = axis2_string_ops_strcmp;
- }
- else if (allocator)
- {
- string =
- (axis2_string_t *) axis2_malloc (allocator,
- sizeof (axis2_string_t));
- if (string)
- {
- string->axis2_string_strdup = axis2_string_ops_strdup;
- string->axis2_string_strcmp = axis2_string_ops_strcmp;
- return string;
- }
- }
- return NULL;
-}