|
Line 0
Link Here
|
|
|
1 |
--- object.c.orig 2009-03-03 17:41:46.000000000 +0200 |
| 2 |
+++ object.c 2009-03-03 17:58:19.000000000 +0200 |
| 3 |
@@ -20,8 +20,10 @@ |
| 4 |
SOBJ scm_mkobjdef(int ndefs) |
| 5 |
{ |
| 6 |
SOBJ new = scm_newcell(SOBJ_T_OBJDEF); |
| 7 |
- SCM_OBJDEF_AUX(new) = |
| 8 |
- scm_must_alloc(sizeof(SCM_ObjDefAux) + ((ndefs - 1) * sizeof(SCM_ObjDef))); |
| 9 |
+ /*SCM_OBJDEF_AUX(new) = |
| 10 |
+ scm_must_alloc(sizeof(SCM_ObjDefAux) + ((ndefs - 1) * sizeof(SCM_ObjDef)));*/ |
| 11 |
+ SCM_OBJDEF_AUX_SET(new, |
| 12 |
+ scm_must_alloc(sizeof(SCM_ObjDefAux) + ((ndefs - 1) * sizeof(SCM_ObjDef)))); |
| 13 |
|
| 14 |
SCM_OBJDEF_AUX(new)->ndefs = ndefs; |
| 15 |
return(new); |
| 16 |
@@ -43,7 +45,8 @@ |
| 17 |
{ |
| 18 |
if (SCM_OBJDEF_AUX(x)) { |
| 19 |
scm_free(SCM_OBJDEF_AUX(x)); |
| 20 |
- SCM_OBJDEF_AUX(x) = NULL; |
| 21 |
+ /*SCM_OBJDEF_AUX(x) = NULL;*/ |
| 22 |
+ SCM_OBJDEF_AUX_SET(x, NULL); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
@@ -64,9 +67,12 @@ |
| 27 |
{ |
| 28 |
SOBJ new = scm_newcell(SOBJ_T_OBJECT); |
| 29 |
|
| 30 |
- SCM_OBJECT_DEF(new) = def; |
| 31 |
+ /*SCM_OBJECT_DEF(new) = def; |
| 32 |
SCM_OBJECT_VAL(new) = |
| 33 |
- scm_must_alloc(sizeof(SCM_ObjVal) + ((nslots - 1) * sizeof(SOBJ))); |
| 34 |
+ scm_must_alloc(sizeof(SCM_ObjVal) + ((nslots - 1) * sizeof(SOBJ)));*/ |
| 35 |
+ SCM_OBJECT_DEF_SET(new, def); |
| 36 |
+ SCM_OBJECT_VAL_SET(new, |
| 37 |
+ scm_must_alloc(sizeof(SCM_ObjVal) + ((nslots - 1) * sizeof(SOBJ)))); |
| 38 |
|
| 39 |
SCM_OBJECT_VAL(new)->nslots = nslots; |
| 40 |
return(new); |
| 41 |
@@ -237,7 +243,8 @@ |
| 42 |
int nslots; |
| 43 |
|
| 44 |
if (SCM_OBJECT_VAL(obj) == NULL) { |
| 45 |
- SCM_OBJECT_VAL(obj) = scm_must_alloc(offsetof(SCM_ObjVal, slot[1])); |
| 46 |
+ /*SCM_OBJECT_VAL(obj) = scm_must_alloc(offsetof(SCM_ObjVal, slot[1]));*/ |
| 47 |
+ SCM_OBJECT_VAL_SET(obj, scm_must_alloc(offsetof(SCM_ObjVal, slot[1]))); |
| 48 |
SCM_OBJECT_VAL(obj)->nslots = 1; |
| 49 |
return(0); |
| 50 |
} |
| 51 |
@@ -246,7 +253,9 @@ |
| 52 |
memcpy(ov, SCM_OBJECT_VAL(obj), offsetof(SCM_ObjVal, slot[nslots])); |
| 53 |
ov->nslots++; |
| 54 |
ov->slot[nslots] = NULL; |
| 55 |
- scm_free(SCM_OBJECT_VAL(obj)); SCM_OBJECT_VAL(obj) = ov; |
| 56 |
+ scm_free(SCM_OBJECT_VAL(obj)); |
| 57 |
+ /*SCM_OBJECT_VAL(obj) = ov;*/ |
| 58 |
+ SCM_OBJECT_VAL_SET(obj, ov); |
| 59 |
return(nslots); |
| 60 |
} |
| 61 |
|
| 62 |
@@ -284,11 +293,13 @@ |
| 63 |
int nslots, size; |
| 64 |
SOBJ new = scm_newcell(SOBJ_T_OBJECT); |
| 65 |
|
| 66 |
- SCM_OBJECT_DEF(new) = SCM_OBJECT_DEF(obj); |
| 67 |
+ /*SCM_OBJECT_DEF(new) = SCM_OBJECT_DEF(obj);*/ |
| 68 |
+ SCM_OBJECT_DEF_SET(new, SCM_OBJECT_DEF(obj)); |
| 69 |
|
| 70 |
nslots = SCM_OBJECT_VAL(obj)->nslots; |
| 71 |
size = offsetof(SCM_ObjVal, slot[nslots]); |
| 72 |
- SCM_OBJECT_VAL(new) = scm_must_alloc(size); |
| 73 |
+ /*SCM_OBJECT_VAL(new) = scm_must_alloc(size);*/ |
| 74 |
+ SCM_OBJECT_VAL_SET(new, scm_must_alloc(size)); |
| 75 |
memcpy(SCM_OBJECT_VAL(new), SCM_OBJECT_VAL(obj), size); |
| 76 |
return(new); |
| 77 |
} |
| 78 |
@@ -377,7 +388,8 @@ |
| 79 |
/* make a new objdef with space for 2 more defs */ |
| 80 |
newdef = scm_newcell(SOBJ_T_OBJDEF); |
| 81 |
d = objdef_append_fields(SCM_OBJDEF_AUX(olddef), 2); |
| 82 |
- SCM_OBJDEF_AUX(newdef) = d; |
| 83 |
+ /*SCM_OBJDEF_AUX(newdef) = d;*/ |
| 84 |
+ SCM_OBJDEF_AUX_SET(newdef, d); |
| 85 |
|
| 86 |
/* prepare atom for the set! name */ |
| 87 |
i = strlen(SCM_ATOM_NAME(name)); |
| 88 |
@@ -414,7 +426,8 @@ |
| 89 |
if ((olddef = SCM_OBJECT_DEF(obj)) == NULL) SCM_ERR("bad objdef for object",obj); |
| 90 |
newdef = scm_newcell(SOBJ_T_OBJDEF); |
| 91 |
d = objdef_append_fields(SCM_OBJDEF_AUX(olddef), 1); |
| 92 |
- SCM_OBJDEF_AUX(newdef) = d; |
| 93 |
+ /*SCM_OBJDEF_AUX_SET(newdef) = d;*/ |
| 94 |
+ SCM_OBJDEF_AUX_SET(newdef, d); |
| 95 |
|
| 96 |
slotnr = object_new_slot(obj); /* alloc new slot and get index */ |
| 97 |
|
| 98 |
@@ -424,7 +437,8 @@ |
| 99 |
d->def[i].type = type; |
| 100 |
d->def[i].index= slotnr; |
| 101 |
|
| 102 |
- SCM_OBJECT_DEF(obj) = newdef; /* adjust object def pointer */ |
| 103 |
+ /*SCM_OBJECT_DEF(obj) = newdef;*/ |
| 104 |
+ SCM_OBJECT_DEF_SET(obj, newdef); /* adjust object def pointer */ |
| 105 |
SCM_OBJECT_SLOT(obj,slotnr) = value; |
| 106 |
return(obj); |
| 107 |
} |