; ; @ANO_SCRIPT_NAME remote_control ; @ANO_SCRIPT_VERSION 0.0.2 ; @ANO_SCRIPT_DESCRIPTION Example how to run functions remotely ; ; @ANO_FLAGS_USE_PROTOS [ ] ; @ANO_FLAGS_VAR_NAME_SUBS [ ] ; @ANO_FLAGS_VAR_WARN_UNUSED [ ] ; ; Copyright (c) 2016-2026, Jani Salonen ; All rights reserved. ; ; Detroit engine supports remote function calls either over the network or by ; using a FIFO. This means that every function declared in Ano script can be ; called remotely. Remote function call is handy in automated testing and such, ; or programs can be daisy chained to control each other. Remote control ; support must not be disabled when running configure script (do not use ; --disable-remote), and remote control must be initialized in Ano script in ; order it to work. ; ; Procedure remote call can be enabled or disabled by using ANO_REMOTE_FUNCS ; tag, where each function or callback has either allow or deny keyword. ; Each function and keyword pair must be quoted. When using remote funcs tag, ; function remote attribute is not needed. ; ; (at)ANO_REMOTE_FUNCS "remote_test = allow", "remote_end = allow", \ ; "remote_forbidden = deny" ; main { ; This is main program, just start remote thread and let it handle ; remote connections. Program terminates when "remote_end" label is ; called (see below) or is pressed. ; remote_init } function remote_test [remote: allow] (param1, param2, param3) { ; To call this function remotely (set SECRET with -na switch): ; ; $ telnet localhost 2109 ; SECRET remote_test int:1 uint:2 float:3.3 ; ; or by using remotetool: ; ; $ echo 'remote_test 1 2 3' | ./engine/tools/remotetool -na SECRET ; ; End code returned to caller is the sum of params or -1 if error ; occurs. ; dump param1 dump param2 dump param3 end (param1 + param2 + param3) } function remote_end [remote: allow] { ; To call this function remotely (set SECRET with -na switch): ; ; $ telnet localhost 2109 ; SECRET remote_end ; ; or by using remotetool: ; ; $ echo 'remote_end' | ./engine/tools/remotetool -na SECRET ; ; Exit code returned to caller is 123. ; exit (123) } function remote_forbidden { ; This function cannot be run remotely, as there is no remote: allow ; attribute. ; }