Expand/Shrink

ppOpt

Definition: ppOpt(sequence options)
Description: Permanently (or until next ppOpt call) change selected formatting options.
pwa/p2js: Supported.
Comments: The options are specified as a pair-sequence, selected from:

Odd element Even element
pp_File 0:no output (used by ppf())
1:display to Screen (the default),
n:an open file handle (not pwa/p2js, obviously)
pp_Nest nest level (see main page for examples), default 0
pp_Maxlen Split lines at column, default 78
pp_Indent Auto-indent amount, default 0
pp_Pause Pause every n lines, default=23. Specify 0 for no pause (ignored/treated as 0 on pwa/p2js, obviously)
pp_StrFmt  0: print strings as eg "abc" (default)
-1: ditto, but without quotes.
 3: as numbers, eg {97a, 98b, 99c} (with pp_IntCh applying to each)
Settings of -2, -3, and 1 are deprecated:
use {pp_IntCh,false[,pp_StrFmt,0]} instead of -2: as 0, but chars number-only
use {pp_IntCh,false,pp_StrFmt,-1} instead of -3: as -1, ""
use {pp_IntCh,false,pp_StrFmt, 3} instead of 1: strings [and chars] as number only, eg {97, 98, 99}
pp_IntCh Display characters as eg 65'A' when true(1). Default false(0), which displays that as just 65, and when -1 (and the character is #20..#7E aka ' '..'~') it displays that as just 'A'.
pp_IntFmt Integer format, default "%d". NB: applies to pp_StrFmt 1 as well.
pp_FltFmt Float format, default "%.10g"
Both pp_IntFmt and pp_FltFmt can contain extra text, eg "#%08x (integer)", "%04.1 km", or "%.2f US$"
When using these routines to format values which may or may not have a fractional element, both the integer and float formats should be set.
pp_Ascii Min/max ascii character, default {' ',#7F}
If sequences are passed, they define ranges.
Eg, for ISO 8859-1, use {{#20,#A0},{#7E,#FF}}, since characters 0..31 and 127..159 are system codes.
(Note it is {start1,start2,...},{end1,end2,...})
pp_Date "": no special date handling (Default)
"%04d-%02d-%02d": eg 2003-12-31
"%02d/%02d/%04d": eg 31/12/2003
Sequences of 3 integers, in the form {day,month,year} or {year,month,day},
with 1<=day<=31, 1<=month<=12, and 1900<=year<=3000 recognised as dates.
pp_Brkt "{}" (default) outputs '{' at the start of a (nested) sequence and '}' at the end.
Must be two characters.
pp_Q22 true: Show quotes as #22, default false, ie \"

 
The odd elements (first column) are builtin constants [automatically defined in psym.e/syminit(), and p2js.js].
Example:
ppOpt({pp_StrFmt,0,pp_Nest,2,pp_Pause,0}})
ppOpt({pp_Maxlen,9999999})  -- stop ppf() putting \n in results.
See Also: pp, ppf