AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
include grammar
 
A directive that reads and executes the contents of a file in the current execution context. The included file is specified as an expression which must evaluate to a string that references a local file or URL that can be read by the interpreter. Its usage description can be summarized as follows:
Statement:
	include Expression ;
 
 Example:   In the following example, a specific file is created, some script lines are written into it, the file is closed and then it is included in the current script, where it is executed. Note the included script executes in the current context.
import yoix.stdio.*;
import yoix.system.*;
import yoix.util.*;

File fl;

fl.mode = yoix.io.WRITE;
fl.name = "__include_script";
fl.open = true;

if(fl.open) {
    fl.nextbuf = "\
Calendar c;\n\
printf(\"Time now is %s\\n\", date(c.unixtime));\n\
addCalendar(c, Calendar.SECOND, secs);\n\
printf(\"Time in %d seconds is %s\\n\", secs,  date(c.unixtime));\n\
";
    fl.open = false;
} else {
    printf("Could not open file for writing.\n");
    exit(1);
}

int secs = 1875;

include "__include_script";

unlink("__include_script");
The output would look something like:
Time now is Tue Oct 31 20:52:35 EST 2000
Time in 1875 seconds is Tue Oct 31 21:23:50 EST 2000
 
 Example:  
 
 See Also:   reference

 

Yoix is a registered trademark of AT&T Inc.