Example programs for fungw

Fungw examples are ordered: the ones on top are the easier to understand ones demonstrating features more commonly needed in practice. Any application developer should read and understand examples numbered lower than 50. The more advanced, exotic use case examples are above 50.

00_hello

The same example script written in each supported scripting language. Useful for example apps in other examples.

10_script

Script embedding example: register a function scripts can call, load a script, run the init part of the script then call a function of the script.

15_c_call_script

Demonstrates different ways to call a fungw registered (potentially script) function from C.

30_lnk_sys_pup

Demonstrate app build option: dynamic script plugin loading with puplug. Otherwise does the same as 10_script (loads and runs a script calling function forth and back).

31_lnk_sys_dl

Demonstrate app build option: dynamic script plugin loading with dlopen(). Otherwise does the same as 10_script (loads and runs a script calling function forth and back).

32_lnk_sys_dyn

Demonstrate app build option: script plugins dynamic linked with -l's. Otherwise does the same as 10_script (loads and runs a script calling function forth and back).

60_engine_c

Example engine written in C, implementing a simple math lib with my_sin(), my_cos() and my_tan(). The app registers the math lib engine and loads and runs an example fawk script that calls these functions.

80_multicall

Demo on registering multiple functions under the same short name within a context and using them as "event handlers" in a multi-call where a single call is directed to each function with matching name.

82_ucc

Example on using the User Call Context: the app can create a context struct at the initial call into fungw and the pointer of that context is passed through the call stack so when an engine or a function of the app is called back it can look at the context.

87_custom_type

Demonstrates how an app can register custom data types that then can be used as arguments and return values in fungw registered functions.