SchemaDefine

Create a new Dervish type at run-time.  Tricky to use, but extremely valuable
in many situations.

In the following, "schema" and "schema_elem" are TCL arrays.

FORMAT:
   schemaDefine schema schema_elems
                       Load a schema definition. schema and schema_elems are
			TCL arrays.   Format is

schema(1)		{<TYPE> <PRIM | STRUCT | ENUM> size  nelems}
schema_elems(1)(1)	{<name> <type> <nstar> <"dim1 dim2 ..." | NULL> offset}
...
schema_elems(nelems)(1)
...

	Peruse the Dervish diskio_gen.c files to understand the meanings of the
	above.  Use this command with caution, because the schema facility
	in Dervish does not handle errors well.  Also, you should load schema
	definitions only at the beginning of the program.  Once a type is
	defined, further redefinitions are useless.  (Note added July 8,1995:
	no more!  Addition of hash table to schema facility now means that
	redefinitions do take effect).

EXAMPLE:
   set schema(1) {CONTRIB STRUCT 24 3}
   set schemaElem(1)(1) {iparam int 0 NULL 0}
   set schemaElem(1)(2) {iarray int 0 4 4}
   set schemaElem(1)(3) {reg REGION 1 NULL 20}
   schemaDefine schema schemaElem
   unset schema
   unset schemaElem

This would define a dervish TYPE called "CONTRIB".  One could equivalently
have created a .h file with the following C code and included it in a
diskio_gen.c type file

typedef struct {
	int iparam;
	int iarray[4];
	REGION *reg;
	} CONTRIB;	/* pragma SCHEMA */

This command is DANGEROUS because it is necessary to specify the offsets
for each schemaElem explicitly, and it requires knowledge of the
sizes of various primitive types plus alignment rules for hardware. Thus,
it is not recommended for pipeline use.  However, it comes in handy
for QA work.

There are now TCL interfaces to the schemaDefine function that make the process of defining new types easier. See the following: