Got the basics running now. Seeing as in TCL 'everything is a string' the process of retrieving and setting values in the Tcl side is simple. I've got the information retrieval side working well and some skeletal bits for adding values which I'll bash into shape tomorrow. Here's my sample_config.ini file:
And the test script to access it.
# this is just an example
# there can be comments before the first group
[First Group]
Name=Key File Example\tthis value shows\nescaping
# localized strings are stored in multiple key-value pairs
Welcome=Hello
[Another Group]
Numbers=2;20;-200;0
Booleans=true;false;true;true
[Person]
#This is me!
name=William
sex=male
age=54
And the test script to access it.
#---------------
# test-keyfile.tcl
#---------------
# William J Giddings, 28/12/2010
#---------------
#!/bin/sh
#\
exec tclsh "$0" "$@"
package require Gnocl
set kf1 [gnocl::keyFile load sample_config.ini]
puts "1 [$kf1 get string -group Person -key name]"
puts "2 [$kf1 get string -key name -group Person ]"
puts "3 [$kf1 get value -group Person -key name]"
puts "4 [$kf1 get value -key name -group Person ]"
puts "5 [$kf1 get string -key age -group Person ]"
puts "6 [$kf1 get string -key sex -group Person ]"
puts "6 [$kf1 get string -key sex -group Person -locale UK ]"
puts "7 [$kf1 get comment -group Person -key name ]"
Comments