// utf8 的编码

#include "../include/zgl_language.hpp"


bool CZGLanguage::initLogicSck(unsigned int iNum)
{
    return initSck<struct stLogic>(&logicSck, &logicSckHead, iNum, &iLogicSckNum, &iLogicSckUabNum);
}
bool CZGLanguage::addLogicSck(unsigned int iNum)
{
    return addSck<struct stLogic>(&logicSck, &logicSckHead, iNum, &iLogicSckUabNum);
}
bool CZGLanguage::dropLogicSck()
{
    return dropSck(logicSck);
}
bool CZGLanguage::pushLogicSck()
{
    return pushSck<struct stLogic>(&logicSck, &logicSckHead, iLogicSckNum, &iLogicSckUabNum);
}
bool CZGLanguage::popLogicSck()
{
    return popSck<struct stLogic>(&logicSck, iLogicSckNum, &iLogicSckUabNum, &logicSckHead);
}
struct stLogic *CZGLanguage::goBackLogicSck(unsigned int iStep)
{
    return goBackSck<struct stLogic>(iStep, logicSck, iLogicSckNum, iLogicSckUabNum, logicSckHead);
}
unsigned int CZGLanguage::countUsedLogicSck()
{
    return countUsedSck(logicSck, iLogicSckNum, iLogicSckUabNum );
}
bool CZGLanguage::isLogicSckUsed()
{
    return isSckUsed(logicSck, iLogicSckNum, iLogicSckUabNum );
}

/////////////////////////////////////////////////////////

bool CZGLanguage::initStackSck(unsigned int iNum)
{
    return initSck<struct stStack>(&stackSck, &stackSckHead, iNum, &iStackSckNum, &iStackSckUabNum);
}
bool CZGLanguage::addStackSck(unsigned int iNum)
{
    return addSck<struct stStack>(&stackSck, &stackSckHead, iNum, &iStackSckUabNum);
}
bool CZGLanguage::dropStackSck()
{
    return dropSck(stackSck);
}
bool CZGLanguage::pushStackSck()
{
    return pushSck<struct stStack>(&stackSck, &stackSckHead, iStackSckNum, &iStackSckUabNum);
}
bool CZGLanguage::popStackSck()
{
    return popSck<struct stStack>(&stackSck, iStackSckNum, &iStackSckUabNum, &stackSckHead);
}
struct stStack *CZGLanguage::goBackStackSck(unsigned int iStep)
{
    return goBackSck<struct stStack>(iStep, stackSck, iStackSckNum, iStackSckUabNum, stackSckHead);
}
unsigned int CZGLanguage::countUsedStackSck()
{
    return countUsedSck(stackSck, iStackSckNum, iStackSckUabNum );
}
bool CZGLanguage::isStackSckUsed()
{
    return isSckUsed(stackSck, iStackSckNum, iStackSckUabNum );
}

////////////////////////////////////////////////////////////////


bool CZGLanguage::initStringPool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stString>(&stringPool, &stringNodeSrc, iBeginNum, iExpNum, &iStringBeginNum, &iStringExpNum);
}
bool CZGLanguage::addStringPool(unsigned int iNum)
{
    return addPool<struct stString>(&stringPool, &stringNodeSrc, iNum);
}
bool CZGLanguage::dropStringPool()
{
    return dropPool(stringPool);
}
struct stString *CZGLanguage::getStringNode()
{
    return getNode<struct stString>(&stringPool, &stringNodeSrc, iStringExpNum);
}
bool CZGLanguage::freeStringNode(struct stString **oneNode)
{
    return freeNode<struct stString>(oneNode, &stringNodeSrc);
}
bool CZGLanguage::freeStringList(struct stString **list)
{
    return freeList<struct stString>(list, &stringNodeSrc);
}

// struct stExprInfo
bool CZGLanguage::freeExprInfoNode(struct stExprInfo **oneNode)
{
    return freeNode<struct stExprInfo>(oneNode, (struct stExprInfo ** )(&stringNodeSrc));
}
bool CZGLanguage::freeExprInfoList(struct stExprInfo **list)
{
    return freeList<struct stExprInfo>(list, (struct stExprInfo ** )(&stringNodeSrc));
}

// struct stIndent
bool CZGLanguage::freeIndentNode(struct stIndent **oneNode)
{
    return freeNode<struct stIndent>(oneNode, (struct stIndent** )(&stringNodeSrc));
}
bool CZGLanguage::freeIndentList(struct stIndent **list)
{
    return freeList<struct stIndent>(list, (struct stIndent ** )(&stringNodeSrc));
}

////////////////////////////////////////////////////////////////

bool CZGLanguage::initStrLevelPool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stStrLevel>(&strLevelPool, &strLevelNodeSrc, iBeginNum, iExpNum, &iStrLevelBeginNum, &iStrLevelExpNum);
}
bool CZGLanguage::addStrLevelPool(unsigned int iNum)
{
    return addPool<struct stStrLevel>(&strLevelPool, &strLevelNodeSrc, iNum);
}
bool CZGLanguage::dropStrLevelPool()
{
    return dropPool(strLevelPool);
}
struct stStrLevel *CZGLanguage::getStrLevelNode()
{
    return getNode<struct stStrLevel>(&strLevelPool, &strLevelNodeSrc, iStrLevelExpNum);
}
bool CZGLanguage::freeStrLevelNode(struct stStrLevel **oneNode)
{
    return freeNode<struct stStrLevel>(oneNode, &strLevelNodeSrc);
}
bool CZGLanguage::freeStrLevelList(struct stStrLevel **list)
{
    return freeList<struct stStrLevel>(list, &strLevelNodeSrc);
}

////////////////////////////////////////////////////////////////

bool CZGLanguage::initStrPool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stStr>(&strPool, &strNodeSrc, iBeginNum, iExpNum, &iStrBeginNum, &iStrExpNum);
}
bool CZGLanguage::addStrPool(unsigned int iNum)
{
    return addPool<struct stStr>(&strPool, &strNodeSrc, iNum);
}
bool CZGLanguage::dropStrPool()
{
    return dropPool(strPool);
}
struct stStr *CZGLanguage::getStrNode()
{
    return getNode<struct stStr>(&strPool, &strNodeSrc, iStrExpNum);
}
bool CZGLanguage::freeStrNode(struct stStr **oneNode)
{
    return freeNode<struct stStr>(oneNode, &strNodeSrc);
}
bool CZGLanguage::freeStrList(struct stStr **list)
{
    return freeList<struct stStr>(list, &strNodeSrc);
}

/////////////////////////////////////////////////////////////////

bool CZGLanguage::initTreeCplLevelPool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stTreeCplLevel>(&treeCplLevelPool, &treeCplLevelNodeSrc, iBeginNum, iExpNum, &iTreeCplLevelBeginNum, &iTreeCplLevelExpNum);
}
bool CZGLanguage::addTreeCplLevelPool(unsigned int iNum)
{
    return addPool<struct stTreeCplLevel>(&treeCplLevelPool, &treeCplLevelNodeSrc, iNum);
}
bool CZGLanguage::dropTreeCplLevelPool()
{
    return dropPool(treeCplLevelPool);
}
struct stTreeCplLevel *CZGLanguage::getTreeCplLevelNode()
{
    return getNode<struct stTreeCplLevel>(&treeCplLevelPool, &treeCplLevelNodeSrc, iTreeCplLevelExpNum);
}
bool CZGLanguage::freeTreeCplLevelNode(struct stTreeCplLevel **oneNode)
{
    return freeNode<struct stTreeCplLevel>(oneNode, &treeCplLevelNodeSrc);
}
bool CZGLanguage::freeTreeCplLevelList(struct stTreeCplLevel **list)
{
    return freeList<struct stTreeCplLevel>(list, &treeCplLevelNodeSrc);
}

/////////////////////////////////////////////////////////////////

bool CZGLanguage::initTreeTranLevelPool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stTreeTranLevel>(&treeTranLevelPool, &treeTranLevelNodeSrc, iBeginNum, iExpNum, &iTreeTranLevelBeginNum, &iTreeTranLevelExpNum);
}
bool CZGLanguage::addTreeTranLevelPool(unsigned int iNum)
{
    return addPool<struct stTreeTranLevel>(&treeTranLevelPool, &treeTranLevelNodeSrc, iNum);
}
bool CZGLanguage::dropTreeTranLevelPool()
{
    return dropPool(treeTranLevelPool);
}
struct stTreeTranLevel *CZGLanguage::getTreeTranLevelNode()
{
    return getNode<struct stTreeTranLevel>(&treeTranLevelPool, &treeTranLevelNodeSrc, iTreeTranLevelExpNum);
}
bool CZGLanguage::freeTreeTranLevelNode(struct stTreeTranLevel **oneNode)
{
    return freeNode<struct stTreeTranLevel>(oneNode, &treeTranLevelNodeSrc);
}
bool CZGLanguage::freeTreeTranLevelList(struct stTreeTranLevel **list)
{
    return freeList<struct stTreeTranLevel>(list, &treeTranLevelNodeSrc);
}

/////////////////////////////////////////////////////////////////

bool CZGLanguage::initTreePool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stTree>(&treePool, &treeNodeSrc, iBeginNum, iExpNum, &iTreeBeginNum, &iTreeExpNum);
}
bool CZGLanguage::addTreePool(unsigned int iNum)
{
    return addPool<struct stTree>(&treePool, &treeNodeSrc, iNum);
}
bool CZGLanguage::dropTreePool()
{
    return dropPool(treePool);
}
struct stTree *CZGLanguage::getTreeNode()
{
    return getNode<struct stTree>(&treePool, &treeNodeSrc, iTreeExpNum);
}
bool CZGLanguage::freeTreeNode(struct stTree **oneNode)
{
    return freeNode<struct stTree>(oneNode, &treeNodeSrc);
}
bool CZGLanguage::freeTreeList(struct stTree **list)
{
    return freeList<struct stTree>(list, &treeNodeSrc);
}


/////////////////////////////////////////////////////////////////


bool CZGLanguage::initLineLevelPool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stLineLevel>(&lineLevelPool, &lineLevelNodeSrc, iBeginNum, iExpNum, &iLineLevelBeginNum, &iLineLevelExpNum);
}
bool CZGLanguage::addLineLevelPool(unsigned int iNum)
{
    return addPool<struct stLineLevel>(&lineLevelPool, &lineLevelNodeSrc, iNum);
}
bool CZGLanguage::dropLineLevelPool()
{
    return dropPool(lineLevelPool);
}
struct stLineLevel *CZGLanguage::getLineLevelNode()
{
    return getNode<struct stLineLevel>(&lineLevelPool, &lineLevelNodeSrc, iLineLevelExpNum);
}
bool CZGLanguage::freeLineLevelNode(struct stLineLevel **oneNode)
{
    return freeNode<struct stLineLevel>(oneNode, &lineLevelNodeSrc);
}
bool CZGLanguage::freeLineLevelList(struct stLineLevel **list)
{
    return freeList<struct stLineLevel>(list, &lineLevelNodeSrc);
}

/////////////////////////////////////////////////////////////////

bool CZGLanguage::initLinePool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stLine>(&linePool, &lineNodeSrc, iBeginNum, iExpNum, &iLineBeginNum, &iLineExpNum);
}
bool CZGLanguage::addLinePool(unsigned int iNum)
{
    return addPool<struct stLine>(&linePool, &lineNodeSrc, iNum);
}
bool CZGLanguage::dropLinePool()
{
    return dropPool(linePool);
}
struct stLine *CZGLanguage::getLineNode()
{
    return getNode<struct stLine>(&linePool, &lineNodeSrc, iLineExpNum);
}
bool CZGLanguage::freeLineNode(struct stLine **oneNode)
{
    return freeNode<struct stLine>(oneNode, &lineNodeSrc);
}
bool CZGLanguage::freeLineList(struct stLine **list)
{
    return freeList<struct stLine>(list, &lineNodeSrc);
}

/////////////////////////////////////////////////////////////////

bool CZGLanguage::initPathPool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stPath>(&pathPool, &pathNodeSrc, iBeginNum, iExpNum, &iPathBeginNum, &iPathExpNum);
}
bool CZGLanguage::addPathPool(unsigned int iNum)
{
    return addPool<struct stPath>(&pathPool, &pathNodeSrc, iNum);
}
bool CZGLanguage::dropPathPool()
{
    return dropPool(pathPool);
}
struct stPath *CZGLanguage::getPathNode()
{
    return getNode<struct stPath>(&pathPool, &pathNodeSrc, iPathExpNum);
}
bool CZGLanguage::freePathNode(struct stPath **oneNode)
{
    return freeNode<struct stPath>(oneNode, &pathNodeSrc);
}
bool CZGLanguage::freePathList(struct stPath **list)
{
    return freeList<struct stPath>(list, &pathNodeSrc);
}

/////////////////////////////////////////////////////////////////

bool CZGLanguage::initPathHeadPool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stPathHead>(&pathHeadPool, &pathHeadNodeSrc, iBeginNum, iExpNum, &iPathHeadBeginNum, &iPathHeadExpNum);
}
bool CZGLanguage::addPathHeadPool(unsigned int iNum)
{
    return addPool<struct stPathHead>(&pathHeadPool, &pathHeadNodeSrc, iNum);
}
bool CZGLanguage::dropPathHeadPool()
{
    return dropPool(pathHeadPool);
}
struct stPathHead *CZGLanguage::getPathHeadNode()
{
    return getNode<struct stPathHead>(&pathHeadPool, &pathHeadNodeSrc, iPathHeadExpNum);
}
bool CZGLanguage::freePathHeadNode(struct stPathHead **oneNode)
{
    return freeNode<struct stPathHead>(oneNode, &pathHeadNodeSrc);
}
bool CZGLanguage::freePathHeadList(struct stPathHead **list)
{
    return freeList<struct stPathHead>(list, &pathHeadNodeSrc);
}

/////////////////////////////////////////////////////////////////

bool CZGLanguage::initCompileInfoPool(unsigned int iBeginNum, unsigned int iExpNum)
{
    return initPool<struct stCompileInfo>(&compileInfoPool, &compileInfoNodeSrc, iBeginNum, iExpNum, &iCompileInfoBeginNum, &iCompileInfoExpNum);
}
bool CZGLanguage::addCompileInfoPool(unsigned int iNum)
{
    return addPool<struct stCompileInfo>(&compileInfoPool, &compileInfoNodeSrc, iNum);
}
bool CZGLanguage::dropCompileInfoPool()
{
    return dropPool(compileInfoPool);
}
struct stCompileInfo *CZGLanguage::getCompileInfoNode()
{
    struct stCompileInfo *pNew = getNode<struct stCompileInfo>(&compileInfoPool, &compileInfoNodeSrc, iCompileInfoExpNum);
// printf("%p = 1 getCompileInfoNode\n", pNew);

    return pNew;
    // return getNode<struct stCompileInfo>(&compileInfoPool, &compileInfoNodeSrc, iCompileInfoExpNum);
}
bool CZGLanguage::freeCompileInfoNode(struct stCompileInfo **oneNode)
{
// printf("freeCompileInfoNode = %p\n", *oneNode);
    return freeNode<struct stCompileInfo>(oneNode, &compileInfoNodeSrc);
}
bool CZGLanguage::freeCompileInfoList(struct stCompileInfo **list)
{
/***************************
struct stCompileInfo * pTmp = *list;
for( ; pTmp; pTmp=pTmp->next )
	printf("freeCompileInfoList = %p\n", pTmp);
/***************************/

    return freeList<struct stCompileInfo>(list, &compileInfoNodeSrc);
}

