\ work with configuration files \ Copyright (C) 2000 Alex Malyshev (alexript@mail.ru) \ This is free software; you can redistribute it and/or \ modify it under the terms of the GNU General Public License \ as published by the Free Software Foundation; either version 2 \ of the License, or (at your option) any later version. \ This program is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied warranty of \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \ GNU General Public License for more details. \ You should have received a copy of the GNU General Public License \ along with this program; if not, write to the Free Software \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. uses StartUp uses oof uses Ext.comment uses Ext.sets uses Strings.tokens /* work with configuration files by Alex Malyshev (alexript@mail.ru) define string parameter: s" default value" StrParam : TestStr after this, in configuration file: TestStr = New Value and in program: TestStr @ ( -- addr u ) Types: StrParam, IntParam, BoolParam. */ \ Comments in ConfigFile are usual: \, ( ), /* */ string class StrParam method = how: : = #lf GetString ! ; class; int class IntParam method = how: : = 0 0 #lf word convert drop drop ! ; class; 11 setof BoolYes yes Yes YES 1 on On ON Rules rules true True int class BoolParam method = how: : = #lf GetString BoolYes IN ! ; class; \ example: /* s" test1" StrParam : TestStr 12 IntParam : TestInt false BoolParam : TestBool TestStr . cr TestInt . cr TestBool . cr cr TestStr = test2 TestInt = 24 TestBool = Yes TestStr . cr TestInt . cr TestBool . cr */
Make your own free website on Tripod.com