##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: October 2016 # Modified: 2016-10-25/02:12-0400 ##+ # # unificl.icn, Forth scripting with ficl # # tectonics: # gcc -o unificl.so -shared -fpic unificl.c -lficl # procedure main() unificl := loadfunc("./unificl.so", "unificl") unificlRundown := loadfunc("./unificl.so", "unificlRundown") # say hello, and leave a number on the stack code := "cr .( Hello, world) cr 123454321" write("\nEvaluate: ", image(code), "\n") result := unificl(code) write("Unicon result: ", result) # display the left over number from previous invocation code := ". cr" write("\nEvaluate: ", image(code), "\n") result := unificl(code) write("Unicon result: ", result) # rundown the ficl system unificlRundown() # start a fresh copy code := ": unificl-test 6 7 * . cr ; unificl-test" write("\nEvaluate: ", image(code), "\n") result := unificl(code) write("Unicon result: ", result) # display the default ficl word list code := "words" write("\nEvaluate: ", image(code), "\n") result := unificl(code) write("Unicon result: ", result) # and a test with an error code := "nonsense forth code" write("\nEvaluate: ", image(code)) write("Expect ficl error", "\n") result := unificl(code) write("Unicon result: ", result) end