Giter VIP home page Giter VIP logo

fortlua's Introduction

FortLua 5.2
-----------

This is a fork of a simple set of Lua bindings for use in Fortran, tested to be compatible with Lua 5.2.3+.

Most of the original basis work is fully attributed to @adolgert and @adambrozier and creators of Aotus (see attribution clause) below.

==Motivation==

This project shows how to call a Lua file from Fortran.
You can also call a Lua file from C, but doing it from an
even older language seems more dramatic. This also demonstrates
how to call C libraries directly from Fortran using the
iso_c_binding.

==Compilation==

This project assumes that the Intel compiler suite and Lua are local to your path.  
On a machine with software modules support do the following:

   module load intel
   module load lua

In your environment, `LUA_INC` and `LUA_LIB` must be predefined.  Otherwise the Makefile is unhappy.

==Discussion==

Why call Lua from Fortran? I can think of two good uses for this.
Fortran's string parsing is not pretty, so you could
use a Lua file as a configuration file. You can query environment
variables and do pre-calculations in the configuration file, yielding
a result for Fortran to use. You can even pass in functions for
Fortran to execute.

You could also write a commonly-modified subroutine in Lua so that
there is no need to recompile the code when you make changes.

Why Lua? The language is relatively
simple and has basic math included. It's made to embed in programs.
That said, it is not a common language. You could do the same
exercise with Gnu Guile.

How? Lua is a very small language that is built to be embedded.
It passes all of its state back to the calling program through
a stack (the stack data structure, but stored on the heap) so that
it is simple to retrieve.

We use Fortran's iso_c_binding to call the Lua C library directly
from Fortran. That binding is a relatively new development in
Fortran, but it works fine.

Drew Dolgert
[email protected]
Adam Brazier
[email protected]
Kevin Manalo
[email protected]

This modification to FortLua was derived from routines provided by AOTUS, hence
their attribution is listed below:

Aotus License
-------------

Aotus is licensed under the terms of the MIT license reproduced below.
This means that Aotus is free software and can be used for both academic and
commercial purposes at absolutely no cost. You are free to do with the code
whatever you want.
The only requirement is that some credit to the authors is given by putting this
copyright notice somewhere in your project.
The MIT license is chosen for full compatibility with Lua.

For the license of the underlying Lua library have a look at
http://www.lua.org/license.html.

===============================================================================

Copyright (C) 2011-2013 German Research School for Simulation Sciences GmbH,
                        Aachen and others.
              2013-2015 University of Siegen.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

===============================================================================

fortlua's People

Contributors

kmanalo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.