axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r312601 - in /webservices/axis2/trunk/c/modules/common/src: axis2_allocator.c axis2_environment.c axis2_error.c axis2_stream.c
Date Mon, 10 Oct 2005 10:15:30 GMT
Author: samisa
Date: Mon Oct 10 03:15:18 2005
New Revision: 312601

URL: http://svn.apache.org/viewcvs?rev=312601&view=rev
Log:
Added the initial code for allocator, error, stream and environment

Added:
    webservices/axis2/trunk/c/modules/common/src/axis2_allocator.c
    webservices/axis2/trunk/c/modules/common/src/axis2_environment.c
    webservices/axis2/trunk/c/modules/common/src/axis2_error.c
    webservices/axis2/trunk/c/modules/common/src/axis2_stream.c

Added: webservices/axis2/trunk/c/modules/common/src/axis2_allocator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/common/src/axis2_allocator.c?rev=312601&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/common/src/axis2_allocator.c (added)
+++ webservices/axis2/trunk/c/modules/common/src/axis2_allocator.c Mon Oct 10 03:15:18 2005
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+#include <axis2_allocator.h>
+
+axis2_allocator_t *axis2_allocator_init(
+                axis2_allocator_t *allocator)
+{
+    if(allocator)
+        return allocator;
+        
+    else
+    {
+        allocator = (axis2_allocator_t*)malloc(sizeof(axis2_allocator_t));
+        if(allocator)
+        {
+            allocator->malloc = malloc;
+            allocator->realloc = realloc;
+            allocator->free = free;
+            
+            return allocator;
+        }
+     }
+    return NULL;
+}

Added: webservices/axis2/trunk/c/modules/common/src/axis2_environment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/common/src/axis2_environment.c?rev=312601&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/common/src/axis2_environment.c (added)
+++ webservices/axis2/trunk/c/modules/common/src/axis2_environment.c Mon Oct 10 03:15:18 2005
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+#include <axis2_environment.h>
+
+axis2_environment_t *axis2_environment_create(axis2_allocator_t *allocator, axis2_error_t
*error, axis2_stream_t *stream)
+{
+    if (!allocator)
+        return NULL;
+
+    axis2_environment_t *environment = (axis2_environment_t*)axis2_malloc(allocator, sizeof(axis2_environment_t));
+
+    if (!environment)
+        return NULL;
+
+    environment->allocator = allocator;
+
+    if (!error)
+        environment->error = axis2_error_create(allocator);
+
+    if (!stream)
+        environment->stream = axis2_stream_create(allocator, NULL);
+
+    return environment;
+}
+

Added: webservices/axis2/trunk/c/modules/common/src/axis2_error.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/common/src/axis2_error.c?rev=312601&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/common/src/axis2_error.c (added)
+++ webservices/axis2/trunk/c/modules/common/src/axis2_error.c Mon Oct 10 03:15:18 2005
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+#include <axis2_error.h>
+
+
+axis2_char* axis2_error_ops_get_message()
+{
+    return "This is the default error code";
+}
+
+axis2_error_t *axis2_error_create(axis2_allocator_t* allocator)
+{
+    if (!allocator)
+        return NULL;
+    
+    axis2_error_t *error = (axis2_error_t*)axis2_malloc(allocator, sizeof(axis2_error_t ));
+
+    if (!error)
+        return NULL;
+    
+    error->ops = (axis2_error_ops_t*)axis2_malloc(allocator, sizeof(axis2_error_ops_t));
+
+    if (!error->ops)
+    {
+        axis2_free(allocator, error);
+        return NULL;
+    }
+    
+    error->ops->get_message = axis2_error_ops_get_message;
+    
+    return error;
+}
+
+

Added: webservices/axis2/trunk/c/modules/common/src/axis2_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/common/src/axis2_stream.c?rev=312601&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/common/src/axis2_stream.c (added)
+++ webservices/axis2/trunk/c/modules/common/src/axis2_stream.c Mon Oct 10 03:15:18 2005
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+#include <axis2_stream.h>
+#include <stdio.h>
+
+int axis2_stream_ops_read (void *buffer, size_t count);
+int axis2_stream_ops_write(const void *buffer, size_t count);
+
+axis2_stream_t *axis2_stream_create(axis2_allocator_t* allocator, axis2_stream_ops_t* operations)
+{
+    if (!allocator)
+        return NULL;
+    axis2_stream_t *stream = (axis2_stream_t*)axis2_malloc(allocator, sizeof(axis2_stream_t));
+
+    if (!stream)
+        return NULL;
+    
+    if (operations)
+        stream->ops = operations;
+    else
+    {
+        stream->ops = (axis2_stream_ops_t*)axis2_malloc(allocator, sizeof(axis2_stream_ops_t));
+
+        if (!stream->ops)
+            return NULL;
+        
+        stream->ops->read = axis2_stream_ops_read;
+        stream->ops->write = axis2_stream_ops_write;
+    }
+    
+    return stream;
+}
+
+int axis2_stream_ops_read (void *buffer, size_t count)
+{
+    int i = 0;
+    for(i = 0; i < count -1; i++ )
+    {
+        ((axis2_char*)buffer)[i] = 'a';
+    }
+    ((axis2_char*)buffer)[i] = '\0';
+    return 0;
+}
+
+int axis2_stream_ops_write(const void *buffer, size_t count)
+{
+    int i =0;
+    for(i = 0; i < count; i++)
+        printf("%c", ((axis2_char*)buffer)[i]);
+    return 0;
+}
+



Mime
View raw message