Modifier statements

A modifier statement gives additional implementation information about IDL definitions, such as interfaces, attributes, methods, and types. Modifiers can be unqualified or qualified: An unqualified modifier is associated with the interface it is defined in. An unqualified modifier statement has the following two syntactic forms: modifier
modifier
= value
where "modifier" is either a SOM Compiler-defined identifier or a user-defined identifier, and where "value" is an identifier, a string enclosed in double quotes (" "), or a number.

For example:

   filestem = foo;
   nodata;
   persistent;
   dllname = "E:/som/dlls";

A qualified modifier is associated with a qualifier. The qualified modifier has the syntax:

   qualifier : modifier
   qualifier : modifier = value
   #pragma modifier qualifier : modifier
   #pragma modifier qualifier : modifier = value

where "qualifier" is the identifier of an IDL definition or is user defined. If the "qualifier" is an IDL definition introduced in the current interface, module, or global scope, then the modifier is attached to that definition. Otherwise, if the qualifier is user defined, the modifier is attached to the interface it occurs in. If a user-defined modifier is defined outside of an interface body (by using #pragma modifier), then it is ignored.

For example, consider the following IDL file. (Notice that qualified modifiers can be defined with the "qualifier" and "modifier[=value]" in either order. Also observe that additional modifiers can be included by separating them with commas.)

   #include <somobj.idl>
   #include <somcls.idl>


   typedef long newInt;
   #pragma somemittypes on
   #pragma modifier newInt : nonportable;
   #pragma somemittypes off
   module M {
       typedef long long_t;
       module  N {
           typedef short short_t;
           interface M_I : SOMClass {
               implementation {
                   somInit : override;
               };
           };
           interface I : SOMObject {
               void op ();
               #pragma modifier op : persistent;


               typedef char char_t;
               implementation {
                   releaseorder : op;
                   metaclass = M_I;
                   callstyle = oidl;
                   mymod : a, b;
                   mymod : c, d;
                   e     : mymod;
                   f     : mymod;
                   op : persistent;
               };
          };
       };
    };

From the preceding IDL file, we associate modifiers with the following definitions:

   TypeDef "::newInt"             1  modifier: nonportable
   InterfaceDef "::M::N::M_I"     1  modifier: override = somInit
   InterfaceDef "::M::N::I"       9 modifiers: metaclass = M_I,
                                               releaseorder = op
                                               callstyle = oidl
                                               mymod = a,b,c,d,e,f
                                               a = mymod
                                               b = mymod
                                               c = mymod
                                               d = mymod
                                               e = mymod
                                               f = mymod
   OperationDef "::M::N::I::op"   1 modifier: persistent

Notice, how the modifiers for the user-defined qualifier "mymod":

   mymod : a, b;
   mymod : c, d;
   e     : mymod;
   f     : mymod;

map onto:

   mymod = a,b,c,d,e,f
   a     = mymod
   b     = mymod
   c     = mymod
   d     = mymod
   e     = mymod
   f     = mymod

This enables users to look up the modifiers with "mymod", either by looking for "mymod" or by using each individual value that uses "mymod". These user-defined modifiers are available for Emitter writers (see the Emitter Writer's Guide and Reference) and from the Interface Repository (see Chapter 7, "The Interface Repository Framework").


[Back: Implementation statements]
[Next: SOM Compiler unqualified modifiers]