Changeset 25491 in project


Ignore:
Timestamp:
11/11/11 02:43:31 (9 years ago)
Author:
evhan
Message:

document parameters

File:
1 edited

Legend:

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

    r25150 r25491  
    2020==== API
    2121
     22<procedure>(read-property [port])</procedure>
     23
     24Reads a single INI property from {{port}}. If it is a section header,
     25returns a symbol. If it is a property or property/value pair, a pair is
     26returned. Invalid properties will signal an error.
     27
     28Numeric values and quoted strings are read as such; everything else is treated
     29as a string literal.
     30
    2231<procedure>(read-ini [file-or-port])</procedure>
    2332
     
    2635source INI's SECTION -> PROPERTY -> VALUE structure.
    2736
    28 Numeric values are read as such; everything else is treated
    29 as a string literal. Properties appearing before any section
    30 heading are placed in an alist under the key given by the
    31 {{default-section}} parameter.
     37Properties appearing before any section heading are associated
     38with the key given by the {{default-section}} parameter.
    3239
    3340If {{file-or-port}} is a port, it is not closed.
     
    4956<parameter>(default-section [name])</parameter>
    5057
    51 Specifies the default section name (usually a symbol) under
    52 which properties without a section label will be placed when read
    53 by {{read-ini}}. Defaults to {{'default}}.
     58Specifies the default alist key (usually a symbol) under which properties
     59without a section label will be placed {{read-ini}}. Defaults to {{'default}}.
    5460
    5561<parameter>(property-separator [char-or-string])</parameter>
    5662
    57 Specifies the character or string to be used by {{write-ini}}
    58 to separate property names & values. Defaults to {{#\=}}.
     63Specifies the character or string to be used by {{write-ini}} to separate
     64property names & values. Defaults to {{#\=}}.
     65
     66<parameter>(allow-empty-values? [boolean])</parameter>
     67
     68Specifies whether the empty string should be treated as a valid property value.
     69If {{#f}}, an empty value will signal an error. Defaults to {{#f}}.
     70
     71<parameter>(allow-bare-properties? [boolean])</parameter>
     72
     73Specifies whether "bare" properties (those without a value) should be allowed.
     74If {{#f}}, a line not following "key separator value" format will signal an
     75error. Defaults to {{#t}}, making the default parsing behavior very forgiving.
    5976
    6077=== Example
     
    95112=== History
    96113
     114* 0.2 Use regex unit
    97115* 0.1 Initial release
    98116
    99117=== Author
    100118
    101 Evan Hanson
     119[[Evan Hanson]]
    102120
    103121=== License
    104122
    105   Copyright (c) 2011, Evan Hanson
    106   All rights reserved.
    107  
    108   Redistribution and use in source and binary forms, with or without
    109   modification, are permitted provided that the following conditions
    110   are met:
    111  
    112     * Redistributions of source code must retain the above copyright
    113       notice, this list of conditions and the following disclaimer.
    114     * Redistributions in binary form must reproduce the above copyright
    115       notice, this list of conditions and the following disclaimer in the
    116       documentation and/or other materials provided with the distribution.
    117     * The name of the author may not be used to endorse or promote products
    118       derived from this software without specific prior written permission.
    119  
    120   THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
    121   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    122   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    123   IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    124   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    125   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    126   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    127   ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    128   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    129   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     123Copyright (c) 2011 Evan Hanson, 3-Clause BSD.
Note: See TracChangeset for help on using the changeset viewer.