version 1.7, 2007/01/31 10:19:17
|
version 1.8, 2007/02/01 15:15:40
|
Line 65 static InsertableElementList InsertableE
|
Line 65 static InsertableElementList InsertableE
|
|
|
static void InsertableElementList_Destroy(InsertableElementList list) |
static void InsertableElementList_Destroy(InsertableElementList list) |
{ |
{ |
if(list->list) |
if (list->list) |
DLList_Destroy(list->list); |
DLList_Destroy(list->list); |
TtaFreeMemory(list); |
TtaFreeMemory(list); |
} |
} |
Line 76 static void InsertableElementList_Destro
|
Line 76 static void InsertableElementList_Destro
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void InsertableElement_Init() |
void InsertableElement_Init() |
{ |
{ |
if(!InsertableElementMap) |
if (!InsertableElementMap) |
InsertableElementMap = PointerHashMap_Create((Container_DestroyElementFunction)InsertableElementList_Destroy, 32); |
InsertableElementMap = PointerHashMap_Create((Container_DestroyElementFunction)InsertableElementList_Destroy, 32); |
} |
} |
|
|
Line 86 void InsertableElement_Init()
|
Line 86 void InsertableElement_Init()
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void InsertableElement_Final() |
void InsertableElement_Final() |
{ |
{ |
if(InsertableElementMap) |
if (InsertableElementMap) |
{ |
{ |
HashMap_Destroy(InsertableElementMap); |
HashMap_Destroy(InsertableElementMap); |
InsertableElementMap = NULL; |
InsertableElementMap = NULL; |
Line 108 static void FillUnionResolvedPossibleEle
|
Line 108 static void FillUnionResolvedPossibleEle
|
DLList list, int level) |
DLList list, int level) |
{ |
{ |
Declaration dec = Template_GetDeclaration (t, name); |
Declaration dec = Template_GetDeclaration (t, name); |
if(dec->declaredIn->isPredefined) |
if (dec == NULL) |
|
return; |
|
if (dec->declaredIn->isPredefined) |
{ |
{ |
DLList_Append(list, ElemListElement_CreateComponent(level, dec->name, |
DLList_Append(list, ElemListElement_CreateComponent(level, dec->name, |
(void*)dec, resolvedPath, elem)); |
(void*)dec, resolvedPath, elem)); |
} |
} |
else if(dec->nature==ComponentNat) |
else if (dec->nature==ComponentNat) |
{ |
{ |
DLList_Append(list, ElemListElement_CreateComponent(level, dec->name, (void*)dec, |
DLList_Append(list, ElemListElement_CreateComponent(level, dec->name, (void*)dec, |
resolvedPath, elem)); |
resolvedPath, elem)); |
} |
} |
else if(dec->nature==UnionNat) |
else if (dec->nature==UnionNat) |
{ |
{ |
DLList tempList = ElemList_Create(); |
DLList tempList = ElemList_Create(); |
|
|
Line 126 static void FillUnionResolvedPossibleEle
|
Line 128 static void FillUnionResolvedPossibleEle
|
Record rec = first; |
Record rec = first; |
|
|
int len1 = 0 , len2 = strlen(dec->name); |
int len1 = 0 , len2 = strlen(dec->name); |
if(resolvedPath!=NULL) |
if (resolvedPath!=NULL) |
len1 = strlen(resolvedPath); |
len1 = strlen(resolvedPath); |
char* newPath = (char*)TtaGetMemory(len1+len2+2); |
char* newPath = (char*)TtaGetMemory(len1+len2+2); |
if(len1>0) |
if (len1>0) |
{ |
{ |
strcpy(newPath, resolvedPath); |
strcpy(newPath, resolvedPath); |
newPath[len1] = '/'; |
newPath[len1] = '/'; |
Line 160 static void FillUnionResolvedPossibleEle
|
Line 162 static void FillUnionResolvedPossibleEle
|
|
|
/** todo Remove excluded elements.*/ |
/** todo Remove excluded elements.*/ |
} |
} |
else if(dec->nature==SimpleTypeNat) |
else if (dec->nature==SimpleTypeNat) |
{ |
{ |
DLList_Append(list, ElemListElement_CreateBaseType(level, dec->name, resolvedPath, elem)); |
DLList_Append(list, ElemListElement_CreateBaseType(level, dec->name, resolvedPath, elem)); |
/* Do nothing. */ |
/* Do nothing. */ |
Line 177 static void FillUnionResolvedPossibleEle
|
Line 179 static void FillUnionResolvedPossibleEle
|
ThotBool checkProfile; |
ThotBool checkProfile; |
MapXMLElementType(xmlType, dec->name, &elType, &mappedName, &content, |
MapXMLElementType(xmlType, dec->name, &elType, &mappedName, &content, |
&checkProfile, TtaGetDocument(elem)); |
&checkProfile, TtaGetDocument(elem)); |
if(elType.ElTypeNum!=0) |
if (elType.ElTypeNum!=0) |
{ |
{ |
DLList_Append(list, ElemListElement_CreateLanguageElement(level, elType, resolvedPath, elem)); |
DLList_Append(list, ElemListElement_CreateLanguageElement(level, elType, resolvedPath, elem)); |
break; |
break; |
Line 200 static void FillInsertableTemplateElemen
|
Line 202 static void FillInsertableTemplateElemen
|
char* types = strdup(strlist); |
char* types = strdup(strlist); |
while(pos<size) |
while(pos<size) |
{ |
{ |
if(isEOSorWhiteSpace(types[pos])) |
if (isEOSorWhiteSpace(types[pos])) |
{ |
{ |
if(pos>offset) |
if (pos>offset) |
{ |
{ |
types[pos] = 0; |
types[pos] = 0; |
FillUnionResolvedPossibleElement(t, types+offset, refelem, NULL, list, level); |
FillUnionResolvedPossibleElement(t, types+offset, refelem, NULL, list, level); |
Line 211 static void FillInsertableTemplateElemen
|
Line 213 static void FillInsertableTemplateElemen
|
} |
} |
pos++; |
pos++; |
} |
} |
if(pos>offset) |
if (pos>offset) |
{ |
{ |
types[pos] = 0; |
types[pos] = 0; |
FillUnionResolvedPossibleElement(t, types+offset, refelem, NULL, list, level); |
FillUnionResolvedPossibleElement(t, types+offset, refelem, NULL, list, level); |
Line 256 static void FillInsertableElemList(Docum
|
Line 258 static void FillInsertableElemList(Docum
|
int level; |
int level; |
ThotBool cont; |
ThotBool cont; |
|
|
if(elem){ |
if (elem){ |
if(doc==0) |
if (doc==0) |
doc = TtaGetDocument(elem); |
doc = TtaGetDocument(elem); |
|
|
#ifdef TEMPLATES |
#ifdef TEMPLATES |
Line 297 static void FillInsertableElemList(Docum
|
Line 299 static void FillInsertableElemList(Docum
|
break; |
break; |
case Template_EL_useEl: |
case Template_EL_useEl: |
// Fill for xt:use only if have no child. |
// Fill for xt:use only if have no child. |
if(TtaGetFirstChild(elem)==NULL){ |
if (TtaGetFirstChild(elem)==NULL){ |
FillInsertableElementFromElemAttribute(t, elem, elem, |
FillInsertableElementFromElemAttribute(t, elem, elem, |
Template_ATTR_types, list, level); |
Template_ATTR_types, list, level); |
cont = TRUE; |
cont = TRUE; |
Line 345 DLList InsertableElement_GetList(Documen
|
Line 347 DLList InsertableElement_GetList(Documen
|
DLList InsertableElement_Update(Document doc, Element el) |
DLList InsertableElement_Update(Document doc, Element el) |
{ |
{ |
InsertableElementList list; |
InsertableElementList list; |
if(doc==0) |
if (doc==0) |
doc= TtaGetDocument(el); |
doc= TtaGetDocument(el); |
list = (InsertableElementList) HashMap_Get(InsertableElementMap, (void*)doc); |
list = (InsertableElementList) HashMap_Get(InsertableElementMap, (void*)doc); |
if(list==NULL) |
if (list==NULL) |
{ |
{ |
list = InsertableElementList_Create(0, DLList_Create()); |
list = InsertableElementList_Create(0, DLList_Create()); |
HashMap_Set(InsertableElementMap, (void*)doc, list); |
HashMap_Set(InsertableElementMap, (void*)doc, list); |
Line 381 void InsertableElement_DoInsertElement(v
|
Line 383 void InsertableElement_DoInsertElement(v
|
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
case Template_EL_repeat: |
case Template_EL_repeat: |
if(elem->typeClass==DefinedComponent) |
if (elem->typeClass==DefinedComponent) |
Template_InsertRepeatChild(doc, ref, (Declaration)elem->elem.component.declaration, -1); |
Template_InsertRepeatChild(doc, ref, (Declaration)elem->elem.component.declaration, -1); |
break; |
break; |
#endif /* TEMPLATES */ |
#endif /* TEMPLATES */ |