void TA_FatalReport( FILE *out ) { TA_TraceGlobal *global; TA_RetCode retCode; unsigned int i, pos; TA_TracePosition *tracePosition; retCode = TA_GetGlobal( &TA_TraceGlobalControl, (void **)&global ); if( retCode != TA_SUCCESS ) return; if( global->fatalErrorRecorded ) printFatalError( &global->fatalError, out ); else fprintf( out, "No fatal error" ); /* Output the calling sequence. */ fprintf( out, "Execution Sequence:\n" ); pos = global->posForNextTrace; for( i=0; i < TA_CODE_TRACE_SIZE; i++ ) { tracePosition = &global->codeTrace[pos]; if( tracePosition && tracePosition->repetition ) printTracePosition( tracePosition, out ); pos++; if( pos >= TA_CODE_TRACE_SIZE ) pos = 0; } }
/*------add_PO------------------------------------------------------- adds a PO gate at each primary output should be called before levelize() modified by Hyung K Lee 2/15/1991 --------------------------------------------------------------------*/ int addPOGates() //add_PO { //PO Gates only have 1 input from now on !! register int i, j; GATEPTR pGate, pNewPOGate, *pOutList; char strNewPOName[MAXSTRING]; for (i = 0; i < g_iNoPO; i++) { pGate = g_net[g_PrimaryOut[i]]; if ((pNewPOGate = g_net[g_iNoGate]) == NULL) { //ALWAYS Come Here !! ALLOCATE(pNewPOGate, GATETYPE, 1); } pNewPOGate->index = g_iNoGate; pNewPOGate->type = PO; pNewPOGate->inCount = 1; ALLOCATE(pNewPOGate->inList, GATEPTR, 1); pNewPOGate->inList[0] = pGate; pNewPOGate->outCount = 0; pNewPOGate->outList = NULL; #ifdef LEARNFLG pNewPOGate->plearn = NULL; #endif strcpy(strNewPOName, pGate->hash->symbol); strcat(strNewPOName, "_PO"); while ((pNewPOGate->hash = FindHash(pArrSymbolTable, HASHSIZE, strNewPOName, 0)) != NULL) { //Avoid name conflict strcat(strNewPOName, "_PO"); } if ((pNewPOGate->hash = InsertHash(pArrSymbolTable, HASHSIZE, strNewPOName, 0)) == NULL) { printFatalError(HASHERROR); } else { //ALWAYS Come Here !! pNewPOGate->hash->gate = pNewPOGate; } //////////////Memory Leak // pOutList = pGate->outList; // ALLOCATE(pGate->outList, GATEPTR, pGate->outCount + 1); // for (j = 0; j< pGate->outCount; j++) // pGate->outList[j] = pOutList[j]; /////////////////////////// GATEPTR *pTempOutList; pOutList = pGate->outList; ALLOCATE(pTempOutList, GATEPTR, pGate->outCount + 1); for (j = 0; j< pGate->outCount; j++) { pTempOutList[j] = pOutList[j]; } free(pGate->outList); // If not, then memory leak !! pGate->outList = pTempOutList; ////////////////////////////////// pGate->outList[pGate->outCount] = pNewPOGate; pGate->outCount += 1; g_PrimaryOut[i] = g_iNoGate; g_net[g_iNoGate++] = pNewPOGate; /* if(pOutList!=NULL) FREE(pOutList); */ } return(g_iNoPO); }