# << Usage >> # you can feed this README to irb and see the result # $ irb README # IMPORTANT NOTICE: # be careful with big *fixnum* (plain int) values in configs # int is 32 bit, but ruby fixnum is only 31! # For example, 2100000000 will be read as -47483648. require 'rconfig' c = Config.new c.read!('test.cfg') # => IOError c.read('test.cfg') # => false p c['some_var'] # => SettingNotFoundError # note: Config#lookup is alias for Config#[] c.append 'fixnum', Config::Fixnum.new(150) # # f1 = Config::Fixnum.new(1) c.append 'another_fixnum', f1 f2 = Config::Fixnum.new(256) c.append 'next_fixnum', f2 p c.size # => 3 c.delete(f1) # by element c.delete(0) # by index c.delete('next_fixnum') # by name # note: (at now) you cannot delete nested elements by Config#delete # you can do c['nested.element'].parent.delete(c['nested.element']) p c.size # => 0 l = Config::List.new c.append 'the_list', l l.append Config::String.new("abcdef") l << Config::Float.new(3.14) # note: Config::List#append and Config::Array#append both have # aliases Config::[Aggregate]#<< p l.name # => "the_list" p l.index # => 0 p l.root? # => false p l.size # => 3 l[0].format = Config::FORMAT_HEX p l[1].value # => 3.14 l[1].value = 2.71828 c.write 'test.cfg' # you will get test.cfg with following contents: # # the_list = ( "abcdef", 2.71828, 0x2A ); # 0d'>treecommitdiffstats
path: root/cfg.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2004-03-19[lcd4linux @ 2004-03-19 09:17:46 by reinelt]reinelt8-103/+128
removed the extra 'goto' function, row and col are additional parameters of the write() function now.
2004-03-19[lcd4linux @ 2004-03-19 06:37:47 by reinelt]reinelt11-21370/+545
asynchronous thread handling started
2004-03-14[lcd4linux @ 2004-03-14 07:14:05 by reinelt]reinelt3-195/+1
old battery.[ch] files removed
2004-03-14[lcd4linux @ 2004-03-14 07:11:42 by reinelt]reinelt7-42/+270
parameter count fixed for plugin_dvb() plugin_APM (battery status) ported
2004-03-14[lcd4linux @ 2004-03-14 06:07:33 by reinelt]reinelt2-2/+2
Status update. Fixed bug in configure.in with X11 disabled (thanks to Kevin Liu)
2004-03-13[lcd4linux @ 2004-03-13 19:06:01 by reinelt]reinelt3-5/+96
ChangeLog and Status update; small glitch in plugin_seti fixed.
2004-03-13[lcd4linux @ 2004-03-13 14:58:15 by nicowallmeier]nicowallmeier1-4/+7
Added clean termination of imond-connection (now correctly)
2004-03-13[lcd4linux @ 2004-03-13 14:55:14 by nicowallmeier]nicowallmeier1-3/+6
Added clean termination of imond-connection
2004-03-13[lcd4linux @ 2004-03-13 06:55:29 by reinelt]reinelt1-58/+0
(unnecessary) imon.h removed
2004-03-13[lcd4linux @ 2004-03-13 06:49:20 by reinelt]reinelt7-247/+179
seti@home plugin ported to NextGeneration
2004-03-12[lcd4linux @ 2004-03-12 13:58:14 by reinelt]reinelt1-468/+0
removed imon.c (has been replaced by plugin_imon.c)
2004-03-11[lcd4linux @ 2004-03-11 06:39:58 by reinelt]reinelt16-133/+350
big patch from Martin: - reuse filehandles - memory leaks fixed - earlier busy-flag checking with HD44780 - reuse memory for strings in RESULT and hash - netdev_fast to wavid time-consuming regex
2004-03-10[lcd4linux @ 2004-03-10 07:16:15 by reinelt]reinelt7-149/+693
MySQL plugin from Javier added
2004-03-08[lcd4linux @ 2004-03-08 18:46:21 by hejl]hejl1-3/+6
Fixed bug introduced with "caching" the loadavg values
2004-03-08[lcd4linux @ 2004-03-08 18:45:52 by hejl]hejl1-4/+7
fixed segfault when using string concatenation
2004-03-08[lcd4linux @ 2004-03-08 16:26:26 by reinelt]reinelt5-14/+46
re-introduced \nnn (octal) characters in strings text widgets can have a 'update' speed of 0 which means 'never' (may be used for static content)
2004-03-08[lcd4linux @ 2004-03-08 04:33:08 by reinelt]reinelt1-21/+41
string concatenation fixed
2004-03-06[lcd4linux @ 2004-03-06 20:31:16 by reinelt]reinelt12-640/+946
Complete rewrite of the evaluator to get rid of the code from mark Morley (because of license issues). The new Evaluator does a pre-compile of expressions, and stores them in trees. Therefore it should be reasonable faster...
2004-03-03[lcd4linux @ 2004-03-03 08:40:07 by hejl]hejl1-1/+6
Fixed memory leak in hash_get_regex
2004-03-03[lcd4linux @ 2004-03-03 04:44:16 by reinelt]reinelt13-63/+96
changes (cosmetics?) to the big patch from Martin hash patch un-applied
2004-03-03[lcd4linux @ 2004-03-03 03:47:04 by reinelt]reinelt46-167/+770
big patch from Martin Hejl: - use qprintf() where appropriate - save CPU cycles on gettimeofday() - add quit() functions to free allocated memory - fixed lots of memory leaks
2004-03-03[lcd4linux @ 2004-03-03 03:41:02 by reinelt]reinelt1-9/+11
Crystalfontz Contrast issue fixed
2004-03-01[lcd4linux @ 2004-03-01 04:29:51 by reinelt]reinelt4-24/+55
cfg_number() returns -1 on error, 0 if value not found (but default val used), and 1 if value was used from the configuration. HD44780 driver adopted to new cfg_number() Crystalfontz 631 driver nearly finished
2004-02-29[lcd4linux @ 2004-02-29 17:09:53 by reinelt]reinelt5-15/+226
ChangeLog updated Version number bumped to 0.10.0
2004-02-29[lcd4linux @ 2004-02-29 14:30:59 by reinelt]reinelt1-2/+10
icon visibility fix for generic graphics from Xavier
2004-02-27[lcd4linux @ 2004-02-27 07:06:24 by reinelt]reinelt5-11/+200
new function 'qprintf()' (simple but quick snprintf() replacement)
2004-02-27[lcd4linux @ 2004-02-27 06:07:55 by reinelt]reinelt2-21/+40
hash improvements from Martin
2004-02-26[lcd4linux @ 2004-02-26 21:42:45 by reinelt]reinelt1-3/+12
memory leak fixes from Martin