inih 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/inih/LICENSE +27 -0
- data/ext/inih/ini.h +110 -0
- data/ext/inih/inih.h +11 -0
- data/lib/inih.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eb22c1756d5f3bc81e3f29cb73df77c292db0cf
|
4
|
+
data.tar.gz: 6cce3dc18f13b86a42b89d397a25989c173893b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a976d8a68fe06056611e3c73e2e7c4def3d364e2afc35548b2327218558ab465495b85f6069859bd3f9cd1abc151b8e7f6d95b16490f8ac1308f98f9463314
|
7
|
+
data.tar.gz: eadf9ccc7dd215b18ded6e60424b098010edbfb53358f0618cbda9289dc62bcbd4402e3bcd84fbb4da1035effb2287731004fc49fd87259ba19f7691ee242a8d
|
data/ext/inih/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
The "inih" library is distributed under the New BSD license:
|
3
|
+
|
4
|
+
Copyright (c) 2009, Ben Hoyt
|
5
|
+
All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without
|
8
|
+
modification, are permitted provided that the following conditions are met:
|
9
|
+
* Redistributions of source code must retain the above copyright
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
11
|
+
* Redistributions in binary form must reproduce the above copyright
|
12
|
+
notice, this list of conditions and the following disclaimer in the
|
13
|
+
documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Ben Hoyt nor the names of its contributors
|
15
|
+
may be used to endorse or promote products derived from this software
|
16
|
+
without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY BEN HOYT ''AS IS'' AND ANY
|
19
|
+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL BEN HOYT BE LIABLE FOR ANY
|
22
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
25
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/ext/inih/ini.h
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
/* inih -- simple .INI file parser
|
2
|
+
|
3
|
+
inih is released under the New BSD license (see LICENSE.txt). Go to the project
|
4
|
+
home page for more info:
|
5
|
+
|
6
|
+
https://github.com/benhoyt/inih
|
7
|
+
|
8
|
+
*/
|
9
|
+
|
10
|
+
#ifndef __INI_H__
|
11
|
+
#define __INI_H__
|
12
|
+
|
13
|
+
/* Make this header file easier to include in C++ code */
|
14
|
+
#ifdef __cplusplus
|
15
|
+
extern "C" {
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include <stdio.h>
|
19
|
+
|
20
|
+
/* Nonzero if ini_handler callback should accept lineno parameter. */
|
21
|
+
#ifndef INI_HANDLER_LINENO
|
22
|
+
#define INI_HANDLER_LINENO 0
|
23
|
+
#endif
|
24
|
+
|
25
|
+
/* Typedef for prototype of handler function. */
|
26
|
+
#if INI_HANDLER_LINENO
|
27
|
+
typedef int (*ini_handler)(void* user, const char* section,
|
28
|
+
const char* name, const char* value,
|
29
|
+
int lineno);
|
30
|
+
#else
|
31
|
+
typedef int (*ini_handler)(void* user, const char* section,
|
32
|
+
const char* name, const char* value);
|
33
|
+
#endif
|
34
|
+
|
35
|
+
/* Typedef for prototype of fgets-style reader function. */
|
36
|
+
typedef char* (*ini_reader)(char* str, int num, void* stream);
|
37
|
+
|
38
|
+
/* Parse given INI-style file. May have [section]s, name=value pairs
|
39
|
+
(whitespace stripped), and comments starting with ';' (semicolon). Section
|
40
|
+
is "" if name=value pair parsed before any section heading. name:value
|
41
|
+
pairs are also supported as a concession to Python's configparser.
|
42
|
+
|
43
|
+
For each name=value pair parsed, call handler function with given user
|
44
|
+
pointer as well as section, name, and value (data only valid for duration
|
45
|
+
of handler call). Handler should return nonzero on success, zero on error.
|
46
|
+
|
47
|
+
Returns 0 on success, line number of first error on parse error (doesn't
|
48
|
+
stop on first error), -1 on file open error, or -2 on memory allocation
|
49
|
+
error (only when INI_USE_STACK is zero).
|
50
|
+
*/
|
51
|
+
int ini_parse(const char* filename, ini_handler handler, void* user);
|
52
|
+
|
53
|
+
/* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't
|
54
|
+
close the file when it's finished -- the caller must do that. */
|
55
|
+
int ini_parse_file(FILE* file, ini_handler handler, void* user);
|
56
|
+
|
57
|
+
/* Same as ini_parse(), but takes an ini_reader function pointer instead of
|
58
|
+
filename. Used for implementing custom or string-based I/O (see also
|
59
|
+
ini_parse_string). */
|
60
|
+
int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
61
|
+
void* user);
|
62
|
+
|
63
|
+
/* Same as ini_parse(), but takes a zero-terminated string with the INI data
|
64
|
+
instead of a file. Useful for parsing INI data from a network socket or
|
65
|
+
already in memory. */
|
66
|
+
int ini_parse_string(const char* string, ini_handler handler, void* user);
|
67
|
+
|
68
|
+
/* Nonzero to allow multi-line value parsing, in the style of Python's
|
69
|
+
configparser. If allowed, ini_parse() will call the handler with the same
|
70
|
+
name for each subsequent line parsed. */
|
71
|
+
#ifndef INI_ALLOW_MULTILINE
|
72
|
+
#define INI_ALLOW_MULTILINE 1
|
73
|
+
#endif
|
74
|
+
|
75
|
+
/* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of
|
76
|
+
the file. See http://code.google.com/p/inih/issues/detail?id=21 */
|
77
|
+
#ifndef INI_ALLOW_BOM
|
78
|
+
#define INI_ALLOW_BOM 1
|
79
|
+
#endif
|
80
|
+
|
81
|
+
/* Nonzero to allow inline comments (with valid inline comment characters
|
82
|
+
specified by INI_INLINE_COMMENT_PREFIXES). Set to 0 to turn off and match
|
83
|
+
Python 3.2+ configparser behaviour. */
|
84
|
+
#ifndef INI_ALLOW_INLINE_COMMENTS
|
85
|
+
#define INI_ALLOW_INLINE_COMMENTS 1
|
86
|
+
#endif
|
87
|
+
#ifndef INI_INLINE_COMMENT_PREFIXES
|
88
|
+
#define INI_INLINE_COMMENT_PREFIXES ";"
|
89
|
+
#endif
|
90
|
+
|
91
|
+
/* Nonzero to use stack, zero to use heap (malloc/free). */
|
92
|
+
#ifndef INI_USE_STACK
|
93
|
+
#define INI_USE_STACK 1
|
94
|
+
#endif
|
95
|
+
|
96
|
+
/* Stop parsing on first error (default is to keep parsing). */
|
97
|
+
#ifndef INI_STOP_ON_FIRST_ERROR
|
98
|
+
#define INI_STOP_ON_FIRST_ERROR 0
|
99
|
+
#endif
|
100
|
+
|
101
|
+
/* Maximum line length for any line in INI file. */
|
102
|
+
#ifndef INI_MAX_LINE
|
103
|
+
#define INI_MAX_LINE 200
|
104
|
+
#endif
|
105
|
+
|
106
|
+
#ifdef __cplusplus
|
107
|
+
}
|
108
|
+
#endif
|
109
|
+
|
110
|
+
#endif /* __INI_H__ */
|
data/ext/inih/inih.h
ADDED
data/lib/inih.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inih
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
@@ -20,9 +20,12 @@ files:
|
|
20
20
|
- ".yardopts"
|
21
21
|
- LICENSE
|
22
22
|
- README.md
|
23
|
+
- ext/inih/LICENSE
|
23
24
|
- ext/inih/extconf.rb
|
24
25
|
- ext/inih/ini.c
|
26
|
+
- ext/inih/ini.h
|
25
27
|
- ext/inih/inih.c
|
28
|
+
- ext/inih/inih.h
|
26
29
|
- lib/inih.rb
|
27
30
|
homepage: https://github.com/woodruffw/ruby-inih
|
28
31
|
licenses:
|