Coder Social home page Coder Social logo

forex's Introduction

#ForEx

Fortran User Defined Exceptions Handler

Build Status codecov.io

##License

License

##What is ForEx?

ForEx is fortran 2003 project taking advance of the C preprocessor capabilities in order to emulate exception handling.

##Features

  • Exception hierarchy: ForEx can handle any error object extended from the Exception base class.
  • Local flow control: throwing an exception changes the local flow. THROW performs local jumps to the end of the TRY frame or FINALLY.
  • Global handling: the exception stack is a global object under the singleton pattern.
  • Single THROW call per scope:
    • Single throw call per local TRY scope.
    • Single throw call per local CATCH scope.
    • Single throw call per local FINALLY scope.
  • Re-throwing: a exception can be raised again in the CATCH scope.
  • Handle any previously throwed exception: CATCH iterate over all the exceptions looking for the first that matches the same class. It only handle a single exception per TRY frame.
  • Customizable catching action: Exception class contains the Catch procedure to customize the action performed when cathing it.
  • Automatic Backtrace of non handled exceptions: going out of the main TRY/ENDTRY scope with non handled exceptions in the stack causes exception backtrace flush.

##How to get ForEx

git clone https://github.com/victorsndvg/Forex.git

##Compilation

ForEx compile with GNU Fortran compiler 5.1 (and newer versions) and Intel Fortran compiler 15.0.1 (and newer versions).

ForEx uses CMake as a portable compilation system.

The easiest way to compile ForEx under Linux is:

$ cd ForEx
$ mkdir build
$ cd build
$ cmake ../
$ make

To compile ForEx under Windows use de equivalent commands

Remember, ForEx take advantage of the C preprocessor. To include it in your project, you have to add the preprocessor flags while compiling. Preprocesor flags depending on the compiler vendor:

  • GNU Fortran: -cpp
  • Intel Fortran: -fpp
  • IBM XLF: -qsuffix=f=f90:cpp=f90

###Using ForEx in your program

program test
USE ForEx

implicit none
#include "ExceptionHandler.i90"

TRY
    ! Variable allocation
    if(Error) then
        THROW(Exception(Code=-1, Message='An error message')
    endif
CATCH(Exception, Ex)
    call Ex%Print()
FINALLY:
    ! Variable deallocation
ENDTRY

end program test

forex's People

Contributors

femparadmin avatar szaghi avatar victorsndvg avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.