📄 excepts.hhf
字号:
#if( ! @defined( except_hhf ))/*** Note: except_hhf is a special symbol known to the** compiler. If you change this, the compiler may not** be able to emit code to automatically call PrintExceptionError.**** Modifications:**** 10/02/2000, RLH: Added "ExecutedAbstract" exception value.** 02/21/2002, RLH: Added modifications for Linux.** 07/04/2002, RLH: Merged Windows and Linux files together.*/?except_hhf := true;?@exceptions := true;#includeonce( "os.hhf" )const assert :text := "?ex.linenumber := @linenumber; " "?ex.filename := @filename; " "ex.assert";val _ex_saveEnumSize_:dword := @enumSize;namespace ex; @fast; val NDEBUG := @global:false; linenumber :uns32; filename :uns32; type ExceptionValues : dword; static AssertionStr:string; @external; #macro assert( expr ): skipAssertion, msg; #if( !ex.NDEBUG ) readonly msg:string := @string:expr + " " + string( ex.filename ) + " (" + string( ex.linenumber ) + ")"; endreadonly; jt( expr ) skipAssertion; mov( msg, ex.AssertionStr ); raise( ex.AssertionFailed ); skipAssertion: #endif #endmacro type ?@enumSize := 4; exceptionCodes: enum {/* 0 */ UnknownException, // String related exceptions: /* 1 */ StringOverflow, /* 2 */ StringIndexError, // General exceptions: /* 3 */ ValueOutOfRange,/* 4 */ IllegalChar,/* 5 */ AttemptToDerefNULL,/* 6 */ TooManyCmdLnParms,/* 7 */ AssertionFailed,/* 8 */ ExecutedAbstract,/* 9 */ BadObjPtr,/* 10 */ InvalidAlignment, // Formatting and conversion errors: /* 11 */ ConversionError,/* 12 */ WidthTooBig, // File-related exceptions: /* 13 */ BadFileHandle,/* 14 */ FileNotFound, /* 15 */ FileOpenFailure,/* 16 */ FileCloseError, /* 17 */ FileWriteError, /* 18 */ FileReadError, /* 19 */ FileSeekError, /* 20 */ DiskFullError,/* 21 */ AccessDenied, /* 22 */ EndOfFile, // FileSys-related exceptions: /* 23 */ CannotCreateDir,/* 24 */ CannotRemoveDir,/* 25 */ CannotRemoveFile,/* 26 */ CDFailed,/* 27 */ CannotRenameFile, // Memory management exceptions: /* 28 */ MemoryAllocationFailure,/* 29 */ MemoryFreeFailure,/* 30 */ MemoryAllocationCorruption,/* 31 */ AttemptToFreeNULL,/* 32 */ BlockAlreadyFree,/* 33 */ CannotFreeMemory,/* 34 */ PointerNotInHeap, // Array exceptions: /* 35 */ ArrayShapeViolation,/* 36 */ ArrayBounds, // Time/date exceptions: /* 37 */ InvalidDate,/* 38 */ InvalidDateFormat,/* 39 */ TimeOverflow,/* 40 */ InvalidTime,/* 41 */ InvalidTimeFormat, // Hardware/OS related exceptions /* 42 */ AccessViolation,/* 43 */ InPageError,/* 44 */ NoMemory,/* 45 */ InvalidHandle,/* 46 */ ControlC,/* 47 */ StackOverflow,/* 48 */ Breakpoint, /* 49 */ SingleStep, /* 50 */ PrivInstr, /* 51 */ IllegalInstr, /* 52 */ BoundInstr, /* 53 */ IntoInstr, /* 54 */ DivideError, /* 55 */ fDivByZero, /* 56 */ fInexactResult, /* 57 */ fInvalidOperation,/* 58 */ fOverflow, /* 59 */ fUnderflow, /* 60 */ fStackCheck, /* 61 */ fDenormal }; ?@enumSize := @global:_ex_saveEnumSize_; const MaxExceptionValue := @dword( fDenormal ); Type #if( @global:os.win32 ) ExceptionRecord: record // Windows exception record. ExceptionCode: dword; ExceptionFlags: dword; ExceptionRecord: dword; ExceptionAddress: dword; NumberParameters: dword; ExceptionInformation: dword[ 15 ]; endrecord; // Context is Windows-only. Context: record dr: dword[ 6 ]; //Debug registers. ControlWord: dword; StatusWord: dword; TagWord: dword; ErrorOffset: dword; ErrorSelector: dword; DataOffset: dword; DataSelector: dword; RegisterArea: tbyte[ 8 ]; Cr0NpxState: dword; SegGS: dword; SegFS: dword; SegES: dword; SegDS: dword; regEDI: dword; regESI: dword; regEBX: dword; regEDX: dword; regECX: dword; regEAX: dword; regEBP: dword; regEIP: dword; SegCS: dword; EFlags: dword; regESP: dword; SegSS: dword; ExtendedRegisters: byte[ 512]; endrecord; ExceptionList: record next: dword; WinExHandler: procedure; HLAExHandler: procedure; ExceptionSPSave: dword; MinusOneMarker: dword; endrecord; #elseif( @global:os.linux ) ExceptionRecord: record // Linux exception record. next: dword; Signature: dword; curCoroutine: dword; SavedContext: dword; HLAExHandler: procedure; endrecord; #endif procedure exceptionMsg( exceptionCode:dword; msg:string ); @external( "EX_EXCEPTIONMSG" ); procedure printExceptionError; @external( "EX_PRINTEXCEPTIONERROR" ); // The following is for use by the HLA compiler and stdlib only. procedure defaultExceptionHandler; @external( "DefaultExceptionHandler__hla_" );end ex;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -