[srm-cvs] CVS Update: - Added support for objects in serialization

From: <d.rethans[@]jdimedia.nl>
Date: Thu Jun 06 2002 - 13:06:51 CEST

Date: Thu Jun 6 13:06:51 CEST 2002
User: Derick Rethans
Directory: srm/main/src

Log Message:
 [0.50]
 - Added support for objects in serialization
 
Modified files:
           srm/main/src/srm_value.c (version: 1.46)
           srm/main/src/srm_value.h (version: 1.51)

[FILE: /srm/main/src/srm_value.c]

--- srm/main/src/srm_value.c:1.45 Wed Apr 10 18:32:46 2002 GMT
+++ srm/main/src/srm_value.c Thu Jun 06 09:06:50 2002 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.45 2002/04/10 20:32:46 derick Exp $ */
+/* $Id: cvstemp,v 1.46 2002/06/06 11:06:50 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -96,6 +96,13 @@
                                 printf("srm_value_duplicate() called with SRM_VALUE_HASH: Not Implemented yet.\n");
                         #endif
                         return NULL;
+
+ case SRM_VALUE_OBJECT:
+ #ifdef SRM_DEBUG
+ printf("srm_value_duplicate() called with SRM_VALUE_HASH: Not Implemented yet.\n");
+ #endif
+ return NULL;
+
                 case SRM_VALUE_LIST:
                         #ifdef SRM_DEBUG
                                 printf("srm_value_duplicate() called with SRM_VALUE_LIST: Not Implemented yet.\n");
@@ -173,6 +180,7 @@
                         break;
                 }
                 case SRM_VALUE_HASH:
+ case SRM_VALUE_OBJECT:
                         printf ("hash(%lu) = \n", (long unsigned) SRMVALP_HASH(value)->size);
 /* FIX ME: convert to srm_hash_apply */
 
@@ -238,6 +246,9 @@
                 case SRM_VALUE_HASH:
                         SRMVALP_HASH (tmp) = SRMVALP_HASH (original);
                         break;
+ case SRM_VALUE_OBJECT:
+ SRMVALP_HASH (tmp) = SRMVALP_HASH (original);
+ break;
         }
         
         return tmp;
@@ -257,12 +268,15 @@
         else {
                 value->ref_count--;
         }
- if (VALP_IS_STR (value))
+ if (VALP_IS_STR (value)) {
                 free (SRMVALP_STR(value));
- if (VALP_IS_HASH (value))
+ }
+ if (VALP_IS_HASH (value) || VALP_IS_OBJECT (value)) {
                 srm_hash_destroy (SRMVALP_HASH(value));
- if (VALP_IS_LIST (value))
+ }
+ if (VALP_IS_LIST (value)) {
                 srm_llist_destroy (SRMVALP_LIST(value), (void *) NULL);
+ }
         free (value);
 
         return SRM_SUCCESS;
@@ -357,6 +371,7 @@
                         break;
                 }
                 case SRM_VALUE_HASH:
+ case SRM_VALUE_OBJECT:
                         /* {FIX ME: Save hash size too} */
                         temp = (srm_ui8*) malloc (8);
                         buffer_size = 8;
@@ -484,8 +499,13 @@
                         skip = skip2;
                         break;
                 case SRM_VALUE_HASH:
- skip2 = 8;
                         VALP_SET_HASH(temp);
+ goto combined_hash_object;
+ break;
+ case SRM_VALUE_OBJECT:
+ VALP_SET_OBJECT(temp);
+combined_hash_object:
+ skip2 = 8;
                         /* Skip over type: */
                         offset += 2;
                         /* Get size of hash from stream */

[FILE: /srm/main/src/srm_value.h]

--- srm/main/src/srm_value.h:1.50 Wed Apr 10 14:11:15 2002 GMT
+++ srm/main/src/srm_value.h Thu Jun 06 09:06:50 2002 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.50 2002/04/10 16:11:15 derick Exp $ */
+/* $Id: cvstemp,v 1.51 2002/06/06 11:06:50 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -89,6 +89,7 @@
 #define VAL_IS_STR(x) (((x).type & SRM_VALUE_STR) == SRM_VALUE_STR)
 #define VAL_IS_HASH(x) (((x).type & SRM_VALUE_HASH) == SRM_VALUE_HASH)
 #define VAL_IS_LIST(x) (((x).type & SRM_VALUE_LIST) == SRM_VALUE_LIST)
+#define VAL_IS_OBJECT(x) (((x).type & SRM_VALUE_OBJECT)== SRM_VALUE_OBJECT)
 
 #define VALP_IS_NULL(x) ((x)->type == SRM_VALUE_NULL)
 #define VALP_IS_BOOL(x) (((x)->type & SRM_VALUE_BOOL) == SRM_VALUE_BOOL)
@@ -98,6 +99,7 @@
 #define VALP_IS_STR(x) (((x)->type & SRM_VALUE_STR) == SRM_VALUE_STR)
 #define VALP_IS_HASH(x) (((x)->type & SRM_VALUE_HASH) == SRM_VALUE_HASH)
 #define VALP_IS_LIST(x) (((x)->type & SRM_VALUE_LIST) == SRM_VALUE_LIST)
+#define VALP_IS_OBJECT(x) (((x)->type & SRM_VALUE_OBJECT)== SRM_VALUE_OBJECT)
 
 #define VAL_SET_NULL(x) ((x).type = SRM_VALUE_NULL)
 #define VAL_SET_BOOL(x) ((x).type = (x).type | SRM_VALUE_BOOL)
@@ -107,6 +109,7 @@
 #define VAL_SET_STR(x) ((x).type = (x).type | SRM_VALUE_STR)
 #define VAL_SET_HASH(x) ((x).type = (x).type | SRM_VALUE_HASH)
 #define VAL_SET_LIST(x) ((x).type = (x).type | SRM_VALUE_LIST)
+#define VAL_SET_OBJECT(x) ((x).type = (x).type | SRM_VALUE_OBJECT)
 
 #define VAL_SET_WARNING(x) ((x).type = (x).type | SRM_VALUE_WARNING)
 #define VAL_SET_ERROR(x) ((x).type = (x).type | SRM_VALUE_ERROR)
@@ -120,6 +123,7 @@
 #define VALP_SET_STR(x) ((x)->type = (x)->type | SRM_VALUE_STR)
 #define VALP_SET_HASH(x) ((x)->type = (x)->type | SRM_VALUE_HASH)
 #define VALP_SET_LIST(x) ((x)->type = (x)->type | SRM_VALUE_LIST)
+#define VALP_SET_OBJECT(x) ((x)->type = (x)->type | SRM_VALUE_OBJECT)
 
 #define VALP_SET_WARNING(x) ((x)->type = (x)->type | SRM_VALUE_WARNING)
 #define VALP_SET_ERROR(x) ((x)->type = (x)->type | SRM_VALUE_ERROR)
Received on Thu Jun 6 13:56:41 2002

This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 04:00:03 CET