# How to get your favorite language supported by fungw

## requirements

First find an implementation, preferably a reusable lib, and check if it meets the requirements:

- must be an interpreted language (it can feature its own VM, most languages do, but it shouldn't try to create a native host system executable)
- must feature a free/open source lib implementation with reasonable dependencies
- must offer a C API (having a C++ API is not enough)
- must support loading and executing multiple independent scripts in parallel
- must support loading and unloading scripts any time
- must support function calls between the host application and the script in both direction
- the API must be strong enough to support storing context pointers (see below)

## option 1: request

Request language support by sending a mail to: fungw (at) igor2.repo.hu

Please include the name of the scripting language, the name of the interpreter library you think is suitable for the job, the URL for the lib.

If you are a programmer, please consider option 2 for faster inclusion.

## option 2: craft an example

To help the process, you should write an example program. The example code must be placed in the public domain so code can be copied into fungw without affecting the license. The example should include:

1. a test script which implements exactly the same as any hello.* script under trunk/example
2. a C program, that demonstrates:
   1. how to init the lib and a script context
   2. how to store and retrieve a C pointer in the script context
   3. how register C functions (with multiple arguments and a return value) in the script context, before loading a script
   4. how the C function figures the function name that's being called (dispatched functions)
   5. how the C function figures the script context the call came from
   6. how to load and parse a script; how to execute the main part of a script
   7. how to call a function of the script by name, with multiple arguments, acquiring the return value
   8. how to uninit the lib and the script context

When writing the example C program, please try to be as simple as possible:

- prefer to use C89 (with gcc, compile with -std=c89 -pedantic)
- do not demonstrate any feature not requested above - fungw will not use anything more, so extras packed in the example are only noise that has to be ignored in the fungw implementation
- the example program doesn't need to know anything about fungw, only about the script language lib; it should be just a simple, single-source-file, standalone executable
- the example program doesn't need to be able to load and run the example script requested above, but a script that it can run must be supplied.