chemical (config) unload function basic working, still needs more testing
This commit is contained in:
parent
ba467ac6b6
commit
e698fb54a2
2 changed files with 24 additions and 2 deletions
|
|
@ -431,8 +431,25 @@ void ARC_ChemicalData_RunGroupTag(ARC_ParserTagToken *tagToken, ARC_Chemical *ch
|
||||||
|
|
||||||
//check if removing
|
//check if removing
|
||||||
if(chemical->load == ARC_False){
|
if(chemical->load == ARC_False){
|
||||||
//TODO: check if the group is empty and remove it if it is
|
/* ~ <groupArgs> ~ */
|
||||||
ARC_String_Destroy(groupVariable);
|
childTagToken = (ARC_ParserTagToken *)ARC_Vector_Get(tagToken->tagTokens, 6);
|
||||||
|
|
||||||
|
//<groupArgs> -> <whitespace> <variableLines> | LAMBDA
|
||||||
|
if(childTagToken->token == NULL && ARC_Vector_GetSize(childTagToken->tagTokens) == 2){
|
||||||
|
ARC_ParserTagToken *variableLines = (ARC_ParserTagToken *)ARC_Vector_Get(childTagToken->tagTokens, 1);
|
||||||
|
ARC_ChemicalData_RunVariableLinesTag(variableLines, chemical);
|
||||||
|
|
||||||
|
//log error if it happens
|
||||||
|
if(arc_errno != 0){
|
||||||
|
ARC_DEBUG_LOG_ERROR("ARC_ChemicalData_RunGroupTag(tagToken, chemical), chemical errored when trying to used parsed data for variable lines");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove an empty hashtable if it is now empty
|
||||||
|
if(ARC_Hashtable_GetSize(chemical->groups)){
|
||||||
|
ARC_String_Destroy(groupVariable);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,11 @@ ARC_TEST(Chemical_BasicTest){
|
||||||
int32_t testVal = *(int32_t *)ARC_Chemical_GetWithCStr(chemical, "test::test");
|
int32_t testVal = *(int32_t *)ARC_Chemical_GetWithCStr(chemical, "test::test");
|
||||||
ARC_CHECK(testVal == 5);
|
ARC_CHECK(testVal == 5);
|
||||||
|
|
||||||
|
ARC_Chemical_UnloadFromFile(chemical, tempString);
|
||||||
|
|
||||||
|
void *nullVal = ARC_Chemical_GetWithCStr(chemical, "test::test");
|
||||||
|
ARC_CHECK(nullVal == NULL);
|
||||||
|
|
||||||
//cleanup
|
//cleanup
|
||||||
ARC_String_Destroy(tempString);
|
ARC_String_Destroy(tempString);
|
||||||
ARC_Chemical_Destroy(chemical);
|
ARC_Chemical_Destroy(chemical);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue