static int ReadDribbleCallback( Environment *theEnv, const char *logicalName, void *context) { int rv; /*===========================================*/ /* Deactivate the dribble router and get the */ /* character from another active router. */ /*===========================================*/ DeactivateRouter(theEnv,"dribble"); rv = ReadRouter(theEnv,logicalName); ActivateRouter(theEnv,"dribble"); /*==========================================*/ /* Put the character retrieved from another */ /* router into the dribble buffer. */ /*==========================================*/ PutcDribbleBuffer(theEnv,rv); /*=======================*/ /* Return the character. */ /*=======================*/ return(rv); }
static int UnreadDribbleCallback( Environment *theEnv, const char *logicalName, int ch, void *context) { int rv; /*===============================================*/ /* Remove the character from the dribble buffer. */ /*===============================================*/ if (FileCommandData(theEnv)->DribbleCurrentPosition > 0) FileCommandData(theEnv)->DribbleCurrentPosition--; FileCommandData(theEnv)->DribbleBuffer[FileCommandData(theEnv)->DribbleCurrentPosition] = EOS; /*=============================================*/ /* Deactivate the dribble router and pass the */ /* ungetc request to the other active routers. */ /*=============================================*/ DeactivateRouter(theEnv,"dribble"); rv = UnreadRouter(theEnv,logicalName,ch); ActivateRouter(theEnv,"dribble"); /*==========================================*/ /* Return the result of the ungetc request. */ /*==========================================*/ return(rv); }
static void WriteDribbleCallback( Environment *theEnv, const char *logicalName, const char *str, void *context) { int i; /*======================================*/ /* Send the output to the dribble file. */ /*======================================*/ for (i = 0 ; str[i] != EOS ; i++) { PutcDribbleBuffer(theEnv,str[i]); } /*===========================================================*/ /* Send the output to any routers interested in printing it. */ /*===========================================================*/ DeactivateRouter(theEnv,"dribble"); WriteString(theEnv,logicalName,str); ActivateRouter(theEnv,"dribble"); }
globle void Clear() { struct callFunctionItem *theFunction; /*==========================================*/ /* Activate the watch router which captures */ /* trace output so that it is not displayed */ /* during a clear. */ /*==========================================*/ #if DEBUGGING_FUNCTIONS ActivateRouter(WTRACE); #endif /*===================================*/ /* Determine if a clear is possible. */ /*===================================*/ ClearReadyInProgress = TRUE; if (ClearReady() == FALSE) { PrintErrorID("CONSTRCT",1,FALSE); PrintRouter(WERROR,"Some constructs are still in use. Clear cannot continue.\n"); #if DEBUGGING_FUNCTIONS DeactivateRouter(WTRACE); #endif ClearReadyInProgress = FALSE; return; } ClearReadyInProgress = FALSE; /*===========================*/ /* Call all clear functions. */ /*===========================*/ ClearInProgress = TRUE; for (theFunction = ListOfClearFunctions; theFunction != NULL; theFunction = theFunction->next) { (*theFunction->func)(); } /*=============================*/ /* Deactivate the watch router */ /* for capturing output. */ /*=============================*/ #if DEBUGGING_FUNCTIONS DeactivateRouter(WTRACE); #endif /*===========================================*/ /* Perform periodic cleanup if the clear was */ /* issued from an embedded controller. */ /*===========================================*/ if ((CurrentEvaluationDepth == 0) && (! EvaluatingTopLevelCommand) && (CurrentExpression == NULL)) { PeriodicCleanup(TRUE,FALSE); } /*===========================*/ /* Clear has been completed. */ /*===========================*/ ClearInProgress = FALSE; }