示例#1
0
文件: LSystem.c 项目: dgu123/dc-lib
static void _PrintH(const i1* inMsg){
    ui4 theCount, theMsgLen, thePrevBlockLen;
    _TStackEntry theEntry;
    if (sStack==NULL) Throw(LSystem_INTERNAL_ERROR);
    theCount = LArray_GetItemsCount(sStack);
    if (theCount==0) Throw(LSystem_INTERNAL_ERROR);
    LArray_FetchItemAt(sStack,theCount-1,&theEntry);
    theMsgLen = LString_Len(inMsg);
    thePrevBlockLen = LArray_GetItemsCount(theEntry.mBlock);
    LArray_ResizeBy(theEntry.mBlock,(i4)theMsgLen);
    LMemory_Copy(inMsg,
        (i1*)LArray_GetData(theEntry.mBlock)+thePrevBlockLen,
        theMsgLen);
}
示例#2
0
/* ---------------------------------------------------------------------------------
*  LEdgeInfo_FetchItemAt
*  ---------------------------------------------------------------------------------
*  Returns the info of a specified Edge in the memory pointed by out item *
*  NOTE: only if the methods returns TRUE the data are valid			  */
Bool LEdgeInfo_FetchItemAt  (LEdgeInfo* This, LGraph_TEdge* inEdge, void* outItem)
{
	LException* theException;
	Bool theResult;

    if (This == NULL) Throw(LEdgeInfo_OBJECT_NULL_POINTER);
    if (inEdge == NULL) Throw(LEdgeInfo_EDGE_NULL_POINTER);
    if (outItem == NULL) Throw(LEdgeInfo_ITEM_NULL_POINTER);

	Try
		theResult = LArray_FetchItemAt(This->mData, inEdge->mIndex, outItem);
	Catch(theException)
		LException_Dump(theException);

	return theResult;
}
示例#3
0
文件: LSystem.c 项目: dgu123/dc-lib
/* ---------------------------------------------------------------------------------
 *  CloseBlock
 * ---------------------------------------------------------------------------------
*/
void LSystem_CloseBlock(i1** outBlock,ui4* outSize){
    ui4 theItemsCount;
    _TStackEntry theEntry;
    if (sStack==NULL) Throw(LSystem_INTERNAL_ERROR);
    theItemsCount = LArray_GetItemsCount(sStack);
    if (theItemsCount==0) Throw(LSystem_INTERNAL_ERROR);

    LArray_FetchItemAt(sStack,theItemsCount-1,&theEntry);
    LArray_RemoveLastItem(sStack);
    *outSize = LArray_GetItemsCount(theEntry.mBlock);
    *outBlock = (i1*)LMemory_Malloc(*outSize);
    LMemory_Copy(LArray_GetData(theEntry.mBlock),(void*)*outBlock,*outSize);
    LArray_Delete(&theEntry.mBlock);
    sPrintH = theEntry.mPrintH;

    if (theItemsCount==1) LArray_Delete(&sStack);
}