⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errors.h

📁 eC++编译器源码
💻 H
字号:
#pragma Errors
//DEFINITION MODULE Errors;

/******************************** Errors *********************************/
/*                                                                       */
/* This MODULE is responsible for halting the system when something      */
/* drastic goes wrong.  In general, when the SoftwareError routine is    */
/* called, a diagnostics message will be printed and then all user       */
/* procedures that were registered with this module (via a call of       */
/* OnErrorCall(MyProcedure)) will be called (allowing any clean-up to    */
/* be done prior to halting) and then the system will be halted.         */
/* An example of using this module follows:                              */
/*                                                                       */
/*                                                                       */
/* MODULE testme;                                                        */
/*                                                                       */
/* FROM SYSTEM IMPORT ADDRESS, CODE;                                     */
/* FROM Devices IMPORT SaveInterruptVector, RestoreInterruptVector;      */
/*                                                                       */
/* CONST TICK = 1CH;                                                     */
/* VAR oldVector : ADDRESS;                                              */
/*                                                                       */
/* PROCEDURE MyCleanUp;                                                  */
/* BEGIN                                                                 */
/*   restore the original interrupt vector before the system halts       */
/*   RestoreInterruptVector(TICK, oldVector);                            */
/* END MyCleanUp;                                                        */
/*                                                                       */
/*                                                                       */
/* PROCEDURE MyTickProcedure;                                            */
/* BEGIN                                                                 */
/*      execute this code every tick as long as we are still running     */
/*   .                                                                   */
/*   .                                                                   */
/* END MyTickProcedure;                                                  */
/*                                                                       */
/*                                                                       */
/* VAR                                                                   */
/*   somethingWentReallyWrong : BOOLEAN;                                 */
/* BEGIN                                                                 */
/*      save the address of the original interrupt service routine       */
/*   SaveInterruptVector(TICK, oldVector);                               */
/*      make sure to resotre it before the system halts                  */
/*   OnErrorCall(MyCleanUp);                                             */
/*   then install our interrupt service routine                          */
/*   RestoreInterruptVector(TICK, ADDRESS(MyTickProcedure));             */
/*   .                                                                   */
/*   .                                                                   */
/*   IF somethingWentReallyWrong THEN                                    */
/*        the system is going down.  clean-up and halt.                  */
/*     SoftwareError("testme.INITIALIZATION : I screwed up.");           */
/*   END;                                                                */
/*   .                                                                   */
/*   .                                                                   */
/* END testme.                                                           */
/*                                                                       */
/*************************************************************************/


//EXPORT QUALIFIED SoftwareError, OnErrorCall, OffErrorCall;


/*************************** SoftwareError *******************************/
/*                                                                       */
/* This routine shuts down the system in the event of an unrecoverable   */
/* software error.  It calls all procedures that have been registered    */
/* using the "OnErrorCall" routine so that they may do any remedial      */
/* clean-up to make the shutdown more graceful (i.e. un-install          */
/* interrupt vectors referencing procedures that are about to go away.)  */
/*                                                                       */
/*************************************************************************/

//PROCEDURE SoftwareError(s : ARRAY OF CHAR);
void SoftwareError(char s[]);

/***************************** OnErrorCall *******************************/
/*                                                                       */
/* This procedure adds the specified procedure to the list of procedures */
/* that the SoftwareError routine will call before halting the system.   */
/*                                                                       */
/*************************************************************************/

//PROCEDURE OnErrorCall(p : PROC);
void OnErrorCall(PROC p);

/***************************** OffErrorCall ******************************/
/*                                                                       */
/* This procedure deletes the specified procedure from the list of       */
/* procedures that the SoftwareError routine will call before halting    */
/* the system.                                                           */
/*                                                                       */
/*************************************************************************/

//PROCEDURE OffErrorCall(p : PROC);
void OffErrorCall(PROC p);

/*************************************************************************/

//END Errors.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -