| execute |
(Object source [, String arg0, Object arg1, ..., Object argN]) |
reserved |
| |
Translates and executes Yoix statements read from
source,
which currently must be a
String
or
Stream.
Execution occurs in a new global context with the optional arguments
available as
argv[0], argv[1], ..., argv[N]
in that context.
By convention
argv[0]
should be a name that identifies the input source, so
execute
supplies a name when
arg0
is missing or
NULL.
There is no default return value, but a Yoix statement
return(obj);
in
source
that is actually executed means
obj
will be the value returned by
execute.
When
source
is a
String
or
StringStream
argv[0]
or
-string-
will be used to identify
source
in error messages, otherwise
source
must be a
File
or
URL
and the value assigned to the
name
field in
source
will be used.
| |
| Example: |
If a file named
example.yx
contains
int n;
for(n = 0; n < argc; n++)
yoix.stdio.printf("argv[%d] = '%s'\n", n, argv[n]);
and we run the program
import yoix.stdio.*;
File file = fopen("example.yx", "r");
execute(file, NULL, "hello", "world");
if (defined("n"))
puts("n is defined");
else puts("n is not defined");
then
argv[0] = 'example.yx'
argv[1] = 'hello'
argv[2] = 'world'
n is not defined
prints on standard output.
| | |
| Return: |
any
| | |
| See Also: |
eval,
exit
|
|
Yoix is a registered trademark of AT&T Inc.
|