home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / Perl / Non-RPC / Docs / RISCOS-Library-Docs / PrettyPrint.pm < prev    next >
Text File  |  1999-04-17  |  2KB  |  52 lines

  1. NAME
  2.     RISCOS::Text::PrettyPrint -- perl module that emulates
  3.     OS_PrettyPrint
  4.  
  5. SYNOPSIS
  6.         use RISCOS::Text::PrettyPrint;
  7.         $expand = prettyprint_expand ($sometext, $special);
  8.  
  9.         @kernel_dict = read_riscosdict ('Resources:$.Resources.Kernel.Dictionary');
  10.         $expand = prettyprint_expand ($sometext, '', @kernel_dict);
  11.  
  12.  
  13. DESCRIPTION
  14.     RISC OS provides a call `OS_PrettyPrint' that both formats text
  15.     in a *pretty* fashion and allows a limited form of text
  16.     compaction by using a dictionary. `prettyprint_expand' does not
  17.     perform the line wrapping or tab expansion of `OS_PrettyPrint'
  18.     (see the Text::Wrap manpage and the Text::Tabs manpage if this
  19.     is needed) but does perform the dictionary expansion and
  20.     converts the `OS_PrettyPrint' codes for non-breaking space and
  21.     newline (`<31>' and `<13>' respectively) to `<160>' and `<10>'
  22.     (a newline).
  23.  
  24.     The second (optional) parameter to `prettyprint_expand' is a
  25.     *special string* which is used as dictionary entry zero. The
  26.     remaining parameters are form the dictionary. If no dictionary
  27.     is supplied then the default RISC OS dictionary is used (as in
  28.     `OS_PrettyPrint'), which contains text common to the syntax
  29.     messages of many modules.
  30.  
  31.     `read_riscosdict' reads the `OS_PrettyPrint' dictionary format
  32.     and converts it to an array. If passed a string this will be
  33.     taken as a filename and opened. If passed a reference to a
  34.     filehandle this will be read from. (This allows reading of the
  35.     default dictionary from the `DATA' filehadle of this module.
  36.  
  37. EXAMPLE
  38.     This will print out the default dictionary.
  39.  
  40.         use RISCOS::Text::PrettyPrint ':DEFAULT', '@default_dict';
  41.  
  42.         foreach $entry (0 .. $#default_dict)
  43.         {
  44.         print prettyprint_expand (sprintf ("%2d: \c[%c\n", $entry, $entry),
  45.                       '<Special string>');
  46.         }
  47.  
  48.  
  49. AUTHOR
  50.     Nicholas Clark <nick@unfortu.net>
  51.  
  52.