swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Related Concepts  
modifier  

: (field selection operator)

 
 

Syntax

  record variable:field name


Purpose

You can use : (colon) to select an individual field of a record:

  declare record metadata-label
     field stream author
     field stream title
     field stream publisher
     field integer year
     field switch in-print initial {true}

  process
     local metadata-label doc-info

     set doc-info:author to "Mark Baker"
     set doc-info:title to "Internet Programming with OmniMark"
     set doc-info:publisher to "Kluwer Academic Publishers"
     set doc-info:year to 2000

     set author-name to doc-info:author
     output doc-info:title

The field selection operator can also be used to select a field from an expression of a record type. Thus, the field selection oeprator can be applied to a function call if that function returns a record type:

  declare record point
   field integer x
   field integer y

  declare record pixel
   extends point
   field stream color

  define dynamic point function move-point
   value point a
   to value point b
   as
     local point c
     set c:x to b:x
     set c:y to b:y
     return c

  define overriding point function move-point
   value pixel a
   to value point b
   as
     local pixel c
     set c:x to b:x
     set c:y to b:y
     return c

  process
   local point a variable
   local pixel b
   local point c

   set b:x to 5
   set b:y to 78
   set b:color to "red"

   set c:x to 87
   set c:y to 56

   output "d" % (move-point b to c):x

      Related Concepts
   Records
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:44:55 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.