The Meta Source Object Concept - CMSO.

The Concept.

Throughout the preceding pages you will have seen references to a current meta source object. This 'object' is very important in understanding how the meta generator operates and so deserves a page of its own.

Most of the power of meta code comes from being able to operate on groups of objects without explicitly listing each of the objects individually. Also, much of the code to be generated is based on properties of the objects being operated on,. These properties are stored as triples in the model and, to be able to find a triple, you need to know the source object of the triple.

To handle this, the meta generator uses the concept of a current meta source object (CMSO). When writing meta code, most of the time you can think of this as a type of object rather than a specific object. There are times when you know exactly which object is the CMSO, but these cases usually involve specialized uses of meta code.

The CMSO is used by the meta generator to find triples, and to decide if a particular piece of code should be generated for the particular object.

For instance, if the meta code has been written to test to see if a FLD default VAL triples exists, this can only ever be true for field objects and so, making this test a part of meta code that only looks at views is pointless.

At any point in the code there may actually be several CMSOs, depending on how the code is written and so you need to look at the structure to see if what you are trying to do at a particular point is meaningful. There is, however, only one CMSO for any object type available at any given point in the meta code.

Setting the CMSO.

There various ways of setting the CMSO, some explicitly to a defined object and some using a meta 'loop'. These details of all these 'loops' will be explained on later pages.

As an example of how to set the CMSO, look at the code from the class library function to validate the data before adding a row to table:

The first line here is a meta 'loop' which sets the view CMSO to each view in the Details variable in turn. It also sets the variable CMSO to the Details variable.

The line with the red arrow is within the view 'loop' and sets the field CMSO to all the fields in the view CMSO in turn.

This loop in a loop means that the ++Call FLD validated by FNC is processed for each field in the first view of Details, then for each field of the second view of Details, and so on. Inside this field 'loop' there are three CMSOs active and accessible: the current field, the current view and the Details variable. Operations for any of these object types will work inside this meta code.

This is also an example of explicitly setting a CMSO. It happens on the first line. The variable CMSO is set to the Details variable.

If you look at some of the other code in this picture, you will see examples of some of the generated assignment and function call instructions, as discussed on previous pages.

There are also some instructions which will be describe later.

Go to: Top : Next page