User Tools

Site Tools


prop_asserthook2.htm
Navigation:  Language Reference > App C - PROP: Runtime Properties > Complete Property List >====== PROP:AssertHook2 ====== Previous pageReturn to chapter overviewNext page

A property of the SYSTEM built-in variable that sets the override procedure for the ASSERT internal Clarion procedure. Equivalent to {PROP:LibHook,13}. Assign the ADDRESS of the overriding procedure, and the runtime library will call the overriding procedure instead of the ASSERT procedure. Assign zero and the runtime library will once again call its internal procedure. The overriding procedure's prototype must be exactly the same as the ASSERT procedure (UNSIGNED LineNumber, STRING filename, STRING message). (WRITE-ONLY)

See Also: ASSERT

Example:

PROGRAM

 MAP

AssertMy1   PROCEDURE(STRING filename,UNSIGNED LineNumber)

AssertMy2   PROCEDURE(UNSIGNED LineNumber, STRING filename, STRING message)

 END

PRAGMA('define(zero_divide ⇒ on'))

 CODE

 SYSTEM{prop:asserthook} = ADDRESS(AssertMy1)

 SYSTEM{prop:asserthook2} = ADDRESS(AssertMy2)

 assert(0)

 assert(0,'i am a message')

AssertMy1   PROCEDURE(STRING filename,UNSIGNED LineNumber)

 CODE

 AssertMy2(LineNumber, FileName,'')

AssertMy2   PROCEDURE(UNSIGNED LineNumber, STRING filename, STRING message)

l long

 CODE

 SYSTEM{prop:asserthook}  = 0  !Stop recursive calls into assert handler

 SYSTEM{prop:asserthook2} = 0  !Stop recursive calls into assert handler

 IF MESSAGE('Assert 1|filename=' & CLIP(filename) & '|line=' & LineNumber & |

            '|Message=' & CLIP(message) & '|Do you want me to GPF?',|

            'ASSERT', ICON:Exclamation, BUTTON:Yes + BUTTON:No)

  l = l / l                    ! Causes a divide by zero GPF

 END

prop_asserthook2.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1