home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OL.LZH
/
PROCS.LZH
/
FEVAL.ICN
< prev
next >
Wrap
Text File
|
1991-09-05
|
1KB
|
57 lines
############################################################################
#
# Name: feval.icn
#
# Title: Evaluate string for function call
#
# Author: Ralph E. Griswold
#
# Date: June 29, 1990
#
############################################################################
#
# This procedure analyzes a string representing an Icon function or
# procedure call and evaluates the result.
#
# It assumes the string is well-formed. The arguments can only be
# Icon literals. Escapes, commas, and parentheses in strings literals
# are not handled.
#
############################################################################
#
# Links: ivalue
#
############################################################################
link ivalue
procedure feval(s)
local fnc, argl
s ? {
fnc := getfnc()
argl := []
while put(argl,getarg())
suspend fnc!argl
}
end
#
# Get an argument. This procedure is naive and could be improved.
#
procedure getarg()
return 1(ivalue(tab(upto(',)'))), move(1))
end
#
# Get the function name. Could be extended.
#
procedure getfnc()
return 1(tab(upto('(')), move(1))
end