Top Content Up

4.3.1 Using nested glocals

Next

the "glocal" tag may be used either at the start of a module or at the start of any "f" tag. Unfortunatly, for now, glocal nesting is not transparent. In the following example we want to create a complete /tmp/output file and one output file per file reference by the index.
<glocal>
	FILE *full;
</glocal>
glocal.full = fopen ("/tmp/output","w");
<call loadfile>("index",true);
	<f oneline>
		<glocal>
			FILE *fout;
		</glocal>
		char path[PATH_MAX];
		sprintf (path,"/tmp/output.%s",line);
		glocal.fout = fopen (path,"w");
		<call loadfile>(line,true);
			<f oneline>
				fprintf (glocal.fout,"oneline: %s\n",line);
				fprintf (glocal.glocal.full,"oneline: %s\n",line);
			</f>
		</call>
	</f>
</call>

Using nested glocals

We reference the variable "full" as glocal.glocal.full, showing the glocal nesting.
Top Content Up

Next
Table of content
One big HTML document