ICI Modules: utype


Modules by name : by type

Overview

The utype module provides ICI with a form of user defined types, which could be called user controlled types. The module adds the ability to define new types of struct objects and give the object a new type name (as returned by typeof()). The type's access functions may be specified by the user and used to control access or cause side-affects upon reading or writing members of this new type of struct. At a minimum utype allows specific uses of struct objects to be identified by using it to give these types names other than "struct".

Interface

Two functions are added, utype.def() and utype.new. The utype.def() function is used to define a new type and returns a utype object (user type). A utype represents a dynamically created ICI interpreter type structure that is specific to this type of object. The utype.new function creates a new instance of a user-defined type. It is passed the utype object that represents the type and returns a new instance, it is akin to the standard struct() function except it uses the user type rather than the standard struct type implementation.