Fresh IDE . Artifact [4418b56f6e]
Not logged in

This repository is a mirror!

The original is located on: https://fresh.flatassembler.net/fossil/repo/fresh
If you want to follow the project, please update your remote-url

Artifact 4418b56f6e16e7de3d93af5374be8f6b22482ca8:


; _______________________________________________________________________________________
;|                                                                                       |
;| ..::FreshLib::..  Free, open source. Licensed under "Fresh artistic license."         |
;|_______________________________________________________________________________________|
;
;  Description: Win32 exception handling macros.
;
;  Target OS: Win32
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________

..TryLevel = 0

macro beginTry {
  common
    ptrExceptionContext equ esp+$0c
    ptrExceptionRecord  equ esp+$04

    local ..handler, ..endtry
    end@try equ ..endtry

  if defined ..handler
        ..TryLevel = ..TryLevel+1
        pushd   ..handler
        pushd   [fs:0]
        mov     [fs:0], esp
  end if

  macro onException \{
        jmp     ..endtry
    ..handler:
  \}

  macro Ignore \{
        mov     eax, [ptrExceptionContext]
        mov     [eax+CONTEXT.regEip], ..endtry
        xor     eax, eax
        retn
  \}

  macro Retry \{
        xor     eax, eax
        retn
  \}


  macro Next \{
        mov     eax, 1
        retn
  \}
}



macro endTry {
common
  label end@try
  if ..TryLevel > 0
        popd    [fs:0]
        add     esp, 4
        ..TryLevel = ..TryLevel - 1
  end if
  purge onException
  purge Ignore
  purge Next
  purge Retry
  restore end@try
  restore ptrExceptionContext
  restore ptrExceptionRecord
}