Changeset 25491 in project
- Timestamp:
- 11/11/11 02:43:31 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wiki/eggref/4/ini-file
r25150 r25491 20 20 ==== API 21 21 22 <procedure>(read-property [port])</procedure> 23 24 Reads a single INI property from {{port}}. If it is a section header, 25 returns a symbol. If it is a property or property/value pair, a pair is 26 returned. Invalid properties will signal an error. 27 28 Numeric values and quoted strings are read as such; everything else is treated 29 as a string literal. 30 22 31 <procedure>(read-ini [file-or-port])</procedure> 23 32 … … 26 35 source INI's SECTION -> PROPERTY -> VALUE structure. 27 36 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. 37 Properties appearing before any section heading are associated 38 with the key given by the {{default-section}} parameter. 32 39 33 40 If {{file-or-port}} is a port, it is not closed. … … 49 56 <parameter>(default-section [name])</parameter> 50 57 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}}. 58 Specifies the default alist key (usually a symbol) under which properties 59 without a section label will be placed {{read-ini}}. Defaults to {{'default}}. 54 60 55 61 <parameter>(property-separator [char-or-string])</parameter> 56 62 57 Specifies the character or string to be used by {{write-ini}} 58 to separate property names & values. Defaults to {{#\=}}. 63 Specifies the character or string to be used by {{write-ini}} to separate 64 property names & values. Defaults to {{#\=}}. 65 66 <parameter>(allow-empty-values? [boolean])</parameter> 67 68 Specifies whether the empty string should be treated as a valid property value. 69 If {{#f}}, an empty value will signal an error. Defaults to {{#f}}. 70 71 <parameter>(allow-bare-properties? [boolean])</parameter> 72 73 Specifies whether "bare" properties (those without a value) should be allowed. 74 If {{#f}}, a line not following "key separator value" format will signal an 75 error. Defaults to {{#t}}, making the default parsing behavior very forgiving. 59 76 60 77 === Example … … 95 112 === History 96 113 114 * 0.2 Use regex unit 97 115 * 0.1 Initial release 98 116 99 117 === Author 100 118 101 Evan Hanson 119 [[Evan Hanson]] 102 120 103 121 === License 104 122 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. 123 Copyright (c) 2011 Evan Hanson, 3-Clause BSD.
Note: See TracChangeset
for help on using the changeset viewer.