swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Related Concepts  
declaration/definition  

import, supply, prefixed by, unprefixed, use

 
 

Syntax

import file-name  ((export? prefixed by prefix) | export? unprefixed | only)
            ( (export? use declared-name (as new-name)?)
              |(export? use #conversion-functions)?
              |(supply declared-name (as required-name)?))*



Argument definitions

file-name
A quoted string containing the name of an OmniMark module.


Purpose

Use import to import a module into the current module or program. Some or all of the exported items in the module are processed as though they were declared at the point of the import declaration.

If prefixed by is used, all exported items not specifically named in a use clause have the given prefix prepended to their name in the importing module or program.

If unprefixed is used, all exported items not specifically mentioned in a use clause will be known in the importing program or module by the name they were given in the module being imported.

If only is used, exported items not specifically mentioned in a use clause are not imported.

You can choose to import specific functionality by means of a use clause with only.

You can rename imported items with a use clause. Avoid naming collisions by specifically re-naming imported items that conflict with previously defined named items in the importing module or program.

use #conversion-functions indicates that all of the exported conversion functions defined in a module should be exported. This is the default behavior with prefixed by and unprefixed, and so is only necessary when only has been specified.

Use supply clauses to provide items that the module has declared as required. These are in effect parameters to the module.

You can re-export imported items by using export in the import declaration. Put export in front of prefixed by or unprefixed to re-export all imported items that have not been named in a use clause. Put it in front of use to re-export particular imported items.

Examples:


  ; plain old import
  import "my-module.xmd" unprefixed
  
  ; all imported items have "my." prepended except "write" has been renamed
  import "my-module" prefixed by my.
     use write as output
  
  ; supply a stream global (that the module requires), and only import the 
  ;execute function
  
  global stream this-stream
  import "other-module.xmd" only
     supply this-stream as shared-stream
    use execute

      Related Concepts
 
 

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

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:51:21 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.