version 1.7, 2003/12/06 02:49:22 |
version 1.9, 2020/10/06 11:33:47 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/Kclass/tree.c,v 1.6 2003/12/05 23:14:14 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/Kclass/tree.c,v 1.8 2005/06/16 05:07:24 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
|
#include <string.h> |
#include "../datatype.h" |
#include "../datatype.h" |
#include "../stackm.h" |
#include "../stackm.h" |
#include "../extern.h" |
#include "../extern.h" |
|
|
|
|
/* Data conversion function : see KclassDataConversion*/ |
/* Data conversion function : see KclassDataConversion*/ |
struct object KpoTree(struct object ob) { |
struct object KpoTree(struct object ob) { |
struct object rob; |
struct object rob = OINIT; |
struct object ob1,ob2,ob3; |
struct object ob1 = OINIT; |
|
struct object ob2 = OINIT; |
|
struct object ob3 = OINIT; |
struct object *newobp; |
struct object *newobp; |
rob.tag = Sclass; |
rob.tag = Sclass; |
rob.lc.ival = CLASSNAME_tree; |
rob.lc.ival = CLASSNAME_tree; |
Line 41 void fprintTree(FILE *fp,struct object op) |
|
Line 44 void fprintTree(FILE *fp,struct object op) |
|
} |
} |
|
|
int isTreeAdd(struct object ob) { |
int isTreeAdd(struct object ob) { |
struct object name; |
struct object name = OINIT; |
if (ob.tag != Sclass) { |
if (ob.tag != Sclass) { |
return(0); |
return(0); |
} |
} |
Line 65 int isTreeAdd(struct object ob) { |
|
Line 68 int isTreeAdd(struct object ob) { |
|
|
|
struct object addTree(struct object ob1, struct object ob2) |
struct object addTree(struct object ob1, struct object ob2) |
{ |
{ |
struct object rob,aob; |
struct object rob = OINIT; |
struct object ob3,ob4; |
struct object aob = OINIT; |
struct object attr; |
struct object ob3 = OINIT; |
struct object keyValue; |
struct object ob4 = OINIT; |
struct object to; |
struct object attr = OINIT; |
|
struct object keyValue = OINIT; |
|
struct object to = OINIT; |
int i; |
int i; |
to = ob2; ob2=ob1; ob1=to; /* Exchange ob1 and ob2 */ |
to = ob2; ob2=ob1; ob1=to; /* Exchange ob1 and ob2 */ |
if (isTreeAdd(ob1) && !isTreeAdd(ob2)) { |
if (isTreeAdd(ob1) && !isTreeAdd(ob2)) { |
Line 117 struct object addTree(struct object ob1, struct object |
|
Line 122 struct object addTree(struct object ob1, struct object |
|
return(KpoTree(rob)); |
return(KpoTree(rob)); |
} |
} |
struct object minusTree(struct object ob1,struct object ob2) { |
struct object minusTree(struct object ob1,struct object ob2) { |
struct object rob,aob; |
struct object rob = OINIT; |
struct object attr; |
struct object aob = OINIT; |
struct object keyValue; |
struct object attr = OINIT; |
struct object to; |
struct object keyValue = OINIT; |
|
struct object to = OINIT; |
|
|
rob = NullObject; |
rob = NullObject; |
attr = newObjectArray(1); |
attr = newObjectArray(1); |
Line 139 struct object minusTree(struct object ob1,struct objec |
|
Line 145 struct object minusTree(struct object ob1,struct objec |
|
return(rob); |
return(rob); |
} |
} |
struct object timesTree(struct object ob1,struct object ob2) { |
struct object timesTree(struct object ob1,struct object ob2) { |
struct object rob,aob; |
struct object rob = OINIT; |
struct object attr; |
struct object aob = OINIT; |
struct object keyValue; |
struct object attr = OINIT; |
struct object to; |
struct object keyValue = OINIT; |
|
struct object to = OINIT; |
|
|
rob = NullObject; |
rob = NullObject; |
attr = newObjectArray(1); |
attr = newObjectArray(1); |
Line 161 struct object timesTree(struct object ob1,struct objec |
|
Line 168 struct object timesTree(struct object ob1,struct objec |
|
return(rob); |
return(rob); |
} |
} |
struct object divideTree(struct object ob1,struct object ob2) { |
struct object divideTree(struct object ob1,struct object ob2) { |
struct object rob,aob; |
struct object rob = OINIT; |
struct object attr; |
struct object aob = OINIT; |
struct object keyValue; |
struct object attr = OINIT; |
struct object to; |
struct object keyValue = OINIT; |
|
struct object to = OINIT; |
|
|
rob = NullObject; |
rob = NullObject; |
attr = newObjectArray(1); |
attr = newObjectArray(1); |
Line 183 struct object divideTree(struct object ob1,struct obje |
|
Line 191 struct object divideTree(struct object ob1,struct obje |
|
return(rob); |
return(rob); |
} |
} |
struct object powerTree(struct object ob1,struct object ob2) { |
struct object powerTree(struct object ob1,struct object ob2) { |
struct object rob,aob; |
struct object rob = OINIT; |
struct object attr; |
struct object aob = OINIT; |
struct object keyValue; |
struct object attr = OINIT; |
struct object to; |
struct object keyValue = OINIT; |
|
struct object to = OINIT; |
|
|
rob = NullObject; |
rob = NullObject; |
attr = newObjectArray(1); |
attr = newObjectArray(1); |
Line 205 struct object powerTree(struct object ob1,struct objec |
|
Line 214 struct object powerTree(struct object ob1,struct objec |
|
return(rob); |
return(rob); |
} |
} |
struct object unaryminusTree(struct object ob1) { |
struct object unaryminusTree(struct object ob1) { |
struct object rob,aob; |
struct object rob = OINIT; |
struct object attr; |
struct object aob = OINIT; |
struct object keyValue; |
struct object attr = OINIT; |
struct object to; |
struct object keyValue = OINIT; |
|
struct object to = OINIT; |
|
|
rob = NullObject; |
rob = NullObject; |
attr = newObjectArray(1); |
attr = newObjectArray(1); |
Line 228 struct object unaryminusTree(struct object ob1) { |
|
Line 238 struct object unaryminusTree(struct object ob1) { |
|
|
|
/* XML DOM-like interfaces */ |
/* XML DOM-like interfaces */ |
struct object KtreeGetDocumentElement(struct object to) { |
struct object KtreeGetDocumentElement(struct object to) { |
struct object rob; |
struct object rob = OINIT; |
struct object ob; |
struct object ob = OINIT; |
if (to.tag != Sclass) errorKan1("%s\n","KtreeGetDocumentElement"); |
if (to.tag != Sclass) errorKan1("%s\n","KtreeGetDocumentElement"); |
if (ectag(to) != CLASSNAME_tree) errorKan1("%s\n","KtreeGetDocumentElement"); |
if (ectag(to) != CLASSNAME_tree) errorKan1("%s\n","KtreeGetDocumentElement"); |
ob = KopTree(to); |
ob = KopTree(to); |
Line 241 struct object KtreeGetDocumentElement(struct object to |
|
Line 251 struct object KtreeGetDocumentElement(struct object to |
|
} |
} |
|
|
struct object KtreeGetAttributes(struct object to) { |
struct object KtreeGetAttributes(struct object to) { |
struct object rob; |
struct object rob = OINIT; |
struct object ob; |
struct object ob = OINIT; |
if (to.tag != Sclass) errorKan1("%s\n","KtreeGetAttributes:"); |
if (to.tag != Sclass) errorKan1("%s\n","KtreeGetAttributes:"); |
if (ectag(to) != CLASSNAME_tree) errorKan1("%s\n","KtreeGetAttributes:"); |
if (ectag(to) != CLASSNAME_tree) errorKan1("%s\n","KtreeGetAttributes:"); |
ob = KopTree(to); |
ob = KopTree(to); |
Line 252 struct object KtreeGetAttributes(struct object to) { |
|
Line 262 struct object KtreeGetAttributes(struct object to) { |
|
} |
} |
|
|
struct object KtreeGetChildNodes(struct object to) { |
struct object KtreeGetChildNodes(struct object to) { |
struct object rob; |
struct object rob = OINIT; |
struct object ob; |
struct object ob = OINIT; |
if (to.tag != Sclass) errorKan1("%s\n","KtreeGetChildNodes:"); |
if (to.tag != Sclass) errorKan1("%s\n","KtreeGetChildNodes:"); |
if (ectag(to) != CLASSNAME_tree) errorKan1("%s\n","KtreeGetChildNodes:"); |
if (ectag(to) != CLASSNAME_tree) errorKan1("%s\n","KtreeGetChildNodes:"); |
ob = KopTree(to); |
ob = KopTree(to); |
Line 263 struct object KtreeGetChildNodes(struct object to) { |
|
Line 273 struct object KtreeGetChildNodes(struct object to) { |
|
} |
} |
|
|
struct object KtreeCreateElement(struct object ostr) { |
struct object KtreeCreateElement(struct object ostr) { |
struct object ob; |
struct object ob = OINIT; |
if (ostr.tag != Sdollar) errorKan1("%s\n","KtreeCreateElement: not a string."); |
if (ostr.tag != Sdollar) errorKan1("%s\n","KtreeCreateElement: not a string."); |
ob = newObjectArray(3); |
ob = newObjectArray(3); |
getoa(ob,0)=ostr; |
getoa(ob,0)=ostr; |