DefMod Syntax

Jonathan Coxhead jonathan at doves.demon.co.uk
Wed Mar 8 19:46:06 GMT 2000


   Are you committed to "FullMessage" everywhere? I think that the 
full message will be more commonly used, so it deserves a shorter 
form of the name. My proposal was to give the full message the same 
name as the message body, but with "Message" deleted. (Ideally, the 
full message would have had the name with "Message", and the message 
body would have had the name with "MessageBody", but it's too late 
for that now.) I don't know if this would lead to any name clashes 
with other types.

   Anyway, here's your answer ...

      TYPE
         InetSuite_FullMessageOpenURL =
            .Struct: Wimp_MessageHeader
            (
               .Union
               (  [236] .Char: url,
                  .Struct
                  (  .Int: tag,
                     OS_StringValue: url,
                     InetSuite_OpenURLFlags: flags,
                     OS_StringValue: body_file,
                     OS_StringValue: target,
                     OS_StringValue: body_mimetype
                  ): indirect
               )
                ^^^^^^^^^^^^^
            )

   The problem's here---the union needs a name.

   A different way to do it is to declare 2 different message types

      TYPE
         InetSuite_OpenURLDirect =
            .Struct: Wimp_MessageHeader
            (
               [236] .Char: url
            ),

         InetSuite_OpenURLIndirect =
            .Struct: Wimp_MessageHeader
            (
               .Int: tag,
               ...
            )

and then make a union from them separately

      TYPE
         InetSuite_OpenURL =
            .Union
            (
               InetSuite_OpenURLDirect:   direct,
               InetSuite_OpenURLIndirect: indirect
            )

   I don't know which of these would be more useful in practice.

        /|
 o o o (_|/
        /|
       (_/



More information about the oslib-team mailing list