swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
     

Filter Functions

OmniMark supports filter functions: functions that can filter a source of data, or can filter while data is being written.

Often some conversion of data is required on inbound or outbound data: for example, conversion on output from UTF-8 to one of the Japanese Industry Standard character codes, or conversion into an encrypted form, such as Blowfish.

Two types are allowed to be specified for function arguments types and function return types: string source and string sink.

A string source argument can be passed anything that can be scanned or submitted, including calls to other string source functions. A string source argument allows read-in data to be converted by the function, and the converted data to be used as an input. Amongst other things, it can be passed to another filter function -- they can be chained together.

A string sink argument does the same thing as a string source argument in the other direction: it can be any use of file or a call to a string sink function of the sort that's allowed on the right-hand-side of an open action, following as.

string source and string sink arguments must be value arguments.

Here's what two functions look like:

  
  export external string source function reader
                      from value string source input-data
  
  export external string sink function writer
     bom value switch add-bom optional initial {true}
     big-endian value switch make-big-endian optional initial {true}
     into value string sink output-data

     
 

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

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:25:49 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.