#libpath
Full Description
swirl
Syntax
  #libpath


Purpose

A built-in stream shelf whose items contain the values of all "-libpath" command-line arguments (alternate paths for the system identifiers specified in library declarations).

#libpath starts out with one item for each "-libpath" argument on the command line, in the order in which they appear on the command line.

The default "current-item" is the last item on the shelf, as in programmer-defined shelves.

#libpath is used by the default external text entity manager. The manager uses the values of items as prefixes when it tries to find files to provide replacement text for the current external text entity.

#libpath can be changed at any time, but these changes will affect the processing of the default external-text-entity rule. The default external text entity manager assumes that the items on this shelf are closed and attached to either buffers or referents that can return a value.

This example illustrates how a repeat over loop can be used to iterate over the items on the #libpath shelf. The external text entity rule shown in this example does what OmniMark's built-in entity manager does for entities with system identifiers.

In this example, provision is made for there not being a -libpath command-line argument, which is used as a prefix to produce the name of an existing file. If the external-text-entity rule was missing the halt action, then, apart from the message being written to #error, the OmniMark program would simply continue.

  external-text-entity #implied when entity is system
     local stream file-name
     do when file "%eq" exists
        set file-name to "%eq"
     else
        repeat over #libpath
           do when file "%g(#libpath)%eq" exists
              set file-name to "%g(#libpath)%eq"
              exit
           done
        again
     done
     do when file-name is attached
        output file file-name
     else
        put #error
            "no file found for entity %"%q%", system id = %"%eq%"%n"
        halt
     done

Copyright © OmniMark Technologies Corporation, 1988-1998.