Changeset 26103 in project


Ignore:
Timestamp:
03/10/12 21:23:36 (8 years ago)
Author:
evhan
Message:

ini-file: update docs w/ value-map param

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/ini-file

    r25505 r26103  
    2828returned. Invalid properties will signal an error.
    2929
    30 Numeric values and quoted strings are read as such; everything else is treated
    31 as a string literal.
     30Numeric values and quoted strings are read as Scheme data; everything else is
     31treated as a string. Any such string mapped by the {{property-value-map}}
     32parameter will be replaced by its corresponding value.
    3233
    3334<procedure>(read-ini [file-or-port])</procedure>
     
    4748
    4849A symbol at the head of {{alist}} signifies a section of that name.
    49 The write order of {{alist}}'s properties is reverse that of {{alist}}.
     50The write order of sections and properties is reverse that of {{alist}}.
    5051
    5152The {{property-separator}} parameter specifies the character or
    5253string with which to separate property names & values.
     54
     55Any value mapped to by the {{property-value-map}} parameter will be
     56replaced by its first corresponding key.
    5357
    5458If {{file-or-port}} is a port, it is not closed.
     
    5963
    6064Specifies the default alist key (usually a symbol) under which properties
    61 without a section label will be placed {{read-ini}}. Defaults to {{'default}}.
     65without a section label will be placed by {{read-ini}}. Defaults to
     66{{'default}}.
    6267
    6368<parameter>(property-separator [char-or-string])</parameter>
     
    6570Specifies the character or string to be used by {{write-ini}} to separate
    6671property names & values. Defaults to {{#\=}}.
     72
     73<parameter>(property-value-map [alist])</parameter>
     74
     75Specifies an alist mapping strings to Scheme values, used to translate INI
     76values to & from Scheme data when reading & writing INI files.
     77
     78The default map is simply:
     79
     80    '(("true"  . #t)
     81      ("false" . #f))
    6782
    6883<parameter>(allow-empty-values? [boolean])</parameter>
     
    7590Specifies whether "bare" properties (those without a value) should be allowed.
    7691If {{#f}}, a line not following "key separator value" format will signal an
    77 error. Defaults to {{#t}}, making the default parsing behavior very forgiving.
     92error. Defaults to {{#f}}.
    7893
    7994=== Example
     
    106121    ; => ((core (gitproxy . "default-proxy")
    107122    ;           (gitproxy . "\"proxy-command\" for kernel.org"))
    108     ;     (diff (renames  . "true")
     123    ;     (diff (renames  . #t)
    109124    ;           (external . "/usr/local/bin/diff-wrapper"))
    110     ;     (core (filemode . "false")))
     125    ;     (core (filemode . #f)))
    111126
    112127Note that separate sections of the same name are not merged.
     
    114129=== History
    115130
     131* 0.3 Introduce property-value-map parameter
    116132* 0.2 Use regex unit
    117133* 0.1 Initial release
     
    123139=== License
    124140
    125 Copyright (c) 2011 Evan Hanson, 3-Clause BSD.
     141Copyright (c) 2012 Evan Hanson, 3-Clause BSD.
Note: See TracChangeset for help on using the changeset viewer.