Function prototype: Difference between revisions

Content added Content deleted
mNo edit summary
Line 130: Line 130:


<lang Amazing Hopper>
<lang Amazing Hopper>
#!/usr/bin/hopper
#proto noargs /* Declare a pseudo-function with no argument */

#proto twoargs(_X_,_Y_) /* Declare a pseudo-function with two arguments */
// Archivo Hopper
#include <hopper.h>

#context-free noargs /* Declare a pseudo-function with no argument */
#synon noargs no arguments
#context multiargs /* Declare a pseudo-function with multi arguments */
#proto twoargs(_X_,_Y_) /* Declare a pseudo-function with two arguments. #PROTO need arguments */

main:
main:
_no args
no arguments
_two args (2,2)
_two args(2,2) // pseudo-function #proto need "_" sufix
print
println
{1,2,3,"hola mundo!","\n"}, multiargs
exit(0)
exit(0)

.locals
.locals

multiargs:
_PARAMS_={},pushall(_PARAMS_)
[1:3]get(_PARAMS_),stats(SUMMATORY),println
{"Mensaje: "}[4:5]get(_PARAMS_),println
clear(_PARAMS_)
back

twoargs(a,b)
twoargs(a,b)
{a}mulby(b)
{a}mulby(b)
back
back


// This function is as useful as an ashtray on a motorcycle:
// This function is as useful a s an ashtray on a motorcycle:
no args:
no args:
{0}minus(0),kill
{0}minus(0),kill
back
back

{0}return
</lang>
</lang>