From 545706afdcf29b8f584e78275452cca715e284db Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:02:53 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- korundum/ChangeLog | 12 +- korundum/rubylib/Makefile.am | 2 +- korundum/rubylib/korundum/Korundum.cpp | 16 +- korundum/rubylib/korundum/kdehandlers.cpp | 12 +- korundum/rubylib/rbkconfig_compiler/Makefile.am | 28 - korundum/rubylib/rbkconfig_compiler/README.dox | 251 ---- korundum/rubylib/rbkconfig_compiler/TODO | 1 - korundum/rubylib/rbkconfig_compiler/autoexample.rb | 49 - korundum/rubylib/rbkconfig_compiler/checkkcfg.pl | 83 -- korundum/rubylib/rbkconfig_compiler/example.kcfg | 55 - korundum/rubylib/rbkconfig_compiler/example.rb | 40 - .../rbkconfig_compiler/exampleprefs_base.kcfgc | 18 - .../rubylib/rbkconfig_compiler/general_base.ui | 46 - korundum/rubylib/rbkconfig_compiler/kcfg.xsd | 191 --- .../rubylib/rbkconfig_compiler/myoptions_base.ui | 35 - .../rbkconfig_compiler/rbkconfig_compiler.cpp | 1330 -------------------- .../rubylib/rbkconfig_compiler/tests/Makefile.am | 40 - .../rubylib/rbkconfig_compiler/tests/myprefs.rb | 5 - .../rubylib/rbkconfig_compiler/tests/test1.kcfg | 55 - .../rubylib/rbkconfig_compiler/tests/test1.kcfgc | 18 - .../rubylib/rbkconfig_compiler/tests/test1main.rb | 4 - .../rubylib/rbkconfig_compiler/tests/test2.kcfg | 78 -- .../rubylib/rbkconfig_compiler/tests/test2.kcfgc | 11 - .../rubylib/rbkconfig_compiler/tests/test2main.rb | 5 - .../rubylib/rbkconfig_compiler/tests/test3.kcfg | 26 - .../rubylib/rbkconfig_compiler/tests/test3.kcfgc | 12 - .../rubylib/rbkconfig_compiler/tests/test3main.rb | 4 - .../rubylib/rbkconfig_compiler/tests/test4.kcfg | 42 - .../rubylib/rbkconfig_compiler/tests/test4.kcfgc | 11 - .../rubylib/rbkconfig_compiler/tests/test4main.rb | 4 - .../rubylib/rbkconfig_compiler/tests/test5.kcfg | 42 - .../rubylib/rbkconfig_compiler/tests/test5.kcfgc | 11 - .../rubylib/rbkconfig_compiler/tests/test5main.rb | 4 - korundum/rubylib/rbtdeconfig_compiler/Makefile.am | 28 + korundum/rubylib/rbtdeconfig_compiler/README.dox | 251 ++++ korundum/rubylib/rbtdeconfig_compiler/TODO | 1 + .../rubylib/rbtdeconfig_compiler/autoexample.rb | 49 + korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl | 83 ++ korundum/rubylib/rbtdeconfig_compiler/example.kcfg | 55 + korundum/rubylib/rbtdeconfig_compiler/example.rb | 40 + .../rbtdeconfig_compiler/exampleprefs_base.kcfgc | 18 + .../rubylib/rbtdeconfig_compiler/general_base.ui | 46 + korundum/rubylib/rbtdeconfig_compiler/kcfg.xsd | 191 +++ .../rubylib/rbtdeconfig_compiler/myoptions_base.ui | 35 + .../rbtdeconfig_compiler/rbtdeconfig_compiler.cpp | 1330 ++++++++++++++++++++ .../rubylib/rbtdeconfig_compiler/tests/Makefile.am | 40 + .../rubylib/rbtdeconfig_compiler/tests/myprefs.rb | 5 + .../rubylib/rbtdeconfig_compiler/tests/test1.kcfg | 55 + .../rubylib/rbtdeconfig_compiler/tests/test1.kcfgc | 18 + .../rbtdeconfig_compiler/tests/test1main.rb | 4 + .../rubylib/rbtdeconfig_compiler/tests/test2.kcfg | 78 ++ .../rubylib/rbtdeconfig_compiler/tests/test2.kcfgc | 11 + .../rbtdeconfig_compiler/tests/test2main.rb | 5 + .../rubylib/rbtdeconfig_compiler/tests/test3.kcfg | 26 + .../rubylib/rbtdeconfig_compiler/tests/test3.kcfgc | 12 + .../rbtdeconfig_compiler/tests/test3main.rb | 4 + .../rubylib/rbtdeconfig_compiler/tests/test4.kcfg | 42 + .../rubylib/rbtdeconfig_compiler/tests/test4.kcfgc | 11 + .../rbtdeconfig_compiler/tests/test4main.rb | 4 + .../rubylib/rbtdeconfig_compiler/tests/test5.kcfg | 42 + .../rubylib/rbtdeconfig_compiler/tests/test5.kcfgc | 11 + .../rbtdeconfig_compiler/tests/test5main.rb | 4 + 62 files changed, 2520 insertions(+), 2520 deletions(-) delete mode 100644 korundum/rubylib/rbkconfig_compiler/Makefile.am delete mode 100644 korundum/rubylib/rbkconfig_compiler/README.dox delete mode 100644 korundum/rubylib/rbkconfig_compiler/TODO delete mode 100644 korundum/rubylib/rbkconfig_compiler/autoexample.rb delete mode 100755 korundum/rubylib/rbkconfig_compiler/checkkcfg.pl delete mode 100644 korundum/rubylib/rbkconfig_compiler/example.kcfg delete mode 100644 korundum/rubylib/rbkconfig_compiler/example.rb delete mode 100644 korundum/rubylib/rbkconfig_compiler/exampleprefs_base.kcfgc delete mode 100644 korundum/rubylib/rbkconfig_compiler/general_base.ui delete mode 100644 korundum/rubylib/rbkconfig_compiler/kcfg.xsd delete mode 100644 korundum/rubylib/rbkconfig_compiler/myoptions_base.ui delete mode 100644 korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/Makefile.am delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/myprefs.rb delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test1.kcfg delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test1.kcfgc delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test1main.rb delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test2.kcfg delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test2.kcfgc delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test2main.rb delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test3.kcfg delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test3.kcfgc delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test3main.rb delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test4.kcfg delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test4.kcfgc delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test4main.rb delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test5.kcfg delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test5.kcfgc delete mode 100644 korundum/rubylib/rbkconfig_compiler/tests/test5main.rb create mode 100644 korundum/rubylib/rbtdeconfig_compiler/Makefile.am create mode 100644 korundum/rubylib/rbtdeconfig_compiler/README.dox create mode 100644 korundum/rubylib/rbtdeconfig_compiler/TODO create mode 100644 korundum/rubylib/rbtdeconfig_compiler/autoexample.rb create mode 100755 korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl create mode 100644 korundum/rubylib/rbtdeconfig_compiler/example.kcfg create mode 100644 korundum/rubylib/rbtdeconfig_compiler/example.rb create mode 100644 korundum/rubylib/rbtdeconfig_compiler/exampleprefs_base.kcfgc create mode 100644 korundum/rubylib/rbtdeconfig_compiler/general_base.ui create mode 100644 korundum/rubylib/rbtdeconfig_compiler/kcfg.xsd create mode 100644 korundum/rubylib/rbtdeconfig_compiler/myoptions_base.ui create mode 100644 korundum/rubylib/rbtdeconfig_compiler/rbtdeconfig_compiler.cpp create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/Makefile.am create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/myprefs.rb create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test1.kcfg create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test1.kcfgc create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test1main.rb create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test2.kcfg create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test2.kcfgc create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test2main.rb create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test3.kcfg create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test3.kcfgc create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test3main.rb create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test4.kcfg create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test4.kcfgc create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test4main.rb create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test5.kcfg create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test5.kcfgc create mode 100644 korundum/rubylib/rbtdeconfig_compiler/tests/test5main.rb (limited to 'korundum') diff --git a/korundum/ChangeLog b/korundum/ChangeLog index 7a715f39..3e60a6d6 100644 --- a/korundum/ChangeLog +++ b/korundum/ChangeLog @@ -135,7 +135,7 @@ 2005-04-03 Richard Dale * Added some #ifdefs so the bindings build with KDE 3.1.x - * Fixed problem with rbkconfig_compile Makefile.am + * Fixed problem with rbtdeconfig_compile Makefile.am 2005-03-30 Richard Dale @@ -150,7 +150,7 @@ 2005-01-27 Richard Dale - * Added some fixes for the rbkconfig_compiler code generation and + * Added some fixes for the rbtdeconfig_compiler code generation and example code. * The method 'isImmutable' is added to KDE::ConfigSkeletonItems as a special case - it's missing from the Smoke runtime as it's @@ -158,12 +158,12 @@ 2005-01-26 Richard Dale - * Translated the rbkconfig_compiler examples from C++ to ruby, + * Translated the rbtdeconfig_compiler examples from C++ to ruby, and improved the build rules in the Makefile.ams 2005-01-20 Richard Dale - * The rbkconfig_compiler now uses TQt::Variants to hold the values in KDE::ConfigSkeleton + * The rbtdeconfig_compiler now uses TQt::Variants to hold the values in KDE::ConfigSkeleton instance variables. * The values of the KDE::ConfigSkeletonItems are then set as properties with the TQt::Variants. It wasn't possible to handle references to primitive types such as 'int&' via ruby, so properties are @@ -172,13 +172,13 @@ 2005-01-20 Richard Dale - * Tidied up the rbkconfig_compiler code + * Tidied up the rbtdeconfig_compiler code * Added marshaller for TDEConfigSkeleton::ItemEnum::Choice lists to and from ruby Arrays, and accessor methods for the Item::Enum::Choice struct. 2005-01-18 Richard Dale - * Added rbkconfig_compiler for compiling .kcfg files to ruby + * Added rbtdeconfig_compiler for compiling .kcfg files to ruby 2004-12-29 Richard Dale diff --git a/korundum/rubylib/Makefile.am b/korundum/rubylib/Makefile.am index 754d1b00..aea0db81 100644 --- a/korundum/rubylib/Makefile.am +++ b/korundum/rubylib/Makefile.am @@ -1 +1 @@ -SUBDIRS = korundum rbkconfig_compiler +SUBDIRS = korundum rbtdeconfig_compiler diff --git a/korundum/rubylib/korundum/Korundum.cpp b/korundum/rubylib/korundum/Korundum.cpp index c6c9a548..24fedc82 100644 --- a/korundum/rubylib/korundum/Korundum.cpp +++ b/korundum/rubylib/korundum/Korundum.cpp @@ -27,9 +27,9 @@ #include #include #if TDE_VERSION >= 0x030200 -#include +#include #endif -#include +#include #include #include @@ -52,8 +52,8 @@ extern "C" { extern VALUE qt_internal_module; -extern VALUE kconfigskeleton_class; -extern VALUE kconfigskeleton_itemenum_choice_class; +extern VALUE tdeconfigskeleton_class; +extern VALUE tdeconfigskeleton_itemenum_choice_class; extern VALUE kio_udsatom_class; extern VALUE konsole_part_class; extern VALUE set_obj_info(const char * className, smokeruby_object * o); @@ -907,7 +907,7 @@ public: extern "C" { extern void Init_qtruby(); extern void set_new_kde(VALUE (*new_kde) (int, VALUE *, VALUE)); -extern void set_kconfigskeletonitem_immutable(VALUE (*kconfigskeletonitem_immutable) (VALUE)); +extern void set_tdeconfigskeletonitem_immutable(VALUE (*tdeconfigskeletonitem_immutable) (VALUE)); extern void set_kde_resolve_classname(const char * (*kde_resolve_classname) (Smoke*, int, void *)); extern const char * kde_resolve_classname(Smoke* smoke, int classId, void * ptr); extern VALUE new_qt(int argc, VALUE * argv, VALUE klass); @@ -1054,7 +1054,7 @@ new_kde(int argc, VALUE * argv, VALUE klass) #if TDE_VERSION >= 0x030200 static VALUE -kconfigskeletonitem_immutable(VALUE self) +tdeconfigskeletonitem_immutable(VALUE self) { smokeruby_object *o = value_obj_info(self); TDEConfigSkeletonItem * item = (TDEConfigSkeletonItem *) o->ptr; @@ -1156,7 +1156,7 @@ Init_korundum() set_new_kde(new_kde); #if TDE_VERSION >= 0x030200 - set_kconfigskeletonitem_immutable(kconfigskeletonitem_immutable); + set_tdeconfigskeletonitem_immutable(tdeconfigskeletonitem_immutable); #endif set_kde_resolve_classname(kde_resolve_classname); @@ -1174,7 +1174,7 @@ Init_korundum() rb_define_singleton_method(kde_module, "dcop_send", (VALUE (*) (...)) dcop_send, -1); #if TDE_VERSION >= 0x030200 - rb_define_method(kconfigskeleton_class, "addItem", (VALUE (*) (...)) config_additem, -1); + rb_define_method(tdeconfigskeleton_class, "addItem", (VALUE (*) (...)) config_additem, -1); #endif rb_define_method(konsole_part_class, "startProgram", (VALUE (*) (...)) konsole_part_startprogram, 2); diff --git a/korundum/rubylib/korundum/kdehandlers.cpp b/korundum/rubylib/korundum/kdehandlers.cpp index fa696791..56d7d11b 100644 --- a/korundum/rubylib/korundum/kdehandlers.cpp +++ b/korundum/rubylib/korundum/kdehandlers.cpp @@ -28,25 +28,25 @@ #include #include #include -#include -#include +#include +#include #include #include #include #include -#include -#include +#include +#include #include #include #include #include #include #if TDE_VERSION >= 0x030200 -#include +#include #include #include #endif -#include +#include #include #include #include diff --git a/korundum/rubylib/rbkconfig_compiler/Makefile.am b/korundum/rubylib/rbkconfig_compiler/Makefile.am deleted file mode 100644 index 276e32f7..00000000 --- a/korundum/rubylib/rbkconfig_compiler/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -SUBDIRS = . tests - -RBUIC=rbuic - -.ui.rb: - $(RBUIC) -tr ${UIC_TR} -kde $*.ui -o $@ - -exampleprefs_base.rb: $(srcdir)/example.kcfg rbkconfig_compiler $(srcdir)/exampleprefs_base.kcfgc - ./rbkconfig_compiler $(srcdir)/example.kcfg $(srcdir)/exampleprefs_base.kcfgc - -AM_CPPFLAGS = -I$(top_srcdir)/tdecore -I$(top_srcdir) $(all_includes) - -bin_PROGRAMS = rbkconfig_compiler - -rbkconfig_compiler_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -rbkconfig_compiler_LDADD = $(LIB_TDECORE) -rbkconfig_compiler_SOURCES = rbkconfig_compiler.cpp - -METASOURCES = AUTO - -TESTFILES = test1.kcfg test2.kcfg test3.kcfg test4.kcfg test5.kcfg - -check-local: - for i in $(TESTFILES); \ - do xmllint --noout --schema $(srcdir)/kcfg.xsd $(srcdir)/tests/$$i; \ - perl $(top_srcdir)/korundum/rubylib/rbkconfig_compiler/checkkcfg.pl \ - $(top_srcdir)/korundum/rubylib/rbkconfig_compiler/tests/$$i; done - diff --git a/korundum/rubylib/rbkconfig_compiler/README.dox b/korundum/rubylib/rbkconfig_compiler/README.dox deleted file mode 100644 index 5eb9bd17..00000000 --- a/korundum/rubylib/rbkconfig_compiler/README.dox +++ /dev/null @@ -1,251 +0,0 @@ -/** -\page rbkconfig_compiler The KDE Configuration Compiler for Ruby - -rbkconfig_compiler generates Ruby source code from an XML file containing -information about configuration options (.kcfg) and a file that provides -the code generation options (.kcfgc) The generated class is based on -KDE::ConfigSkeleton and provides an API for the application to access its -configuration data. - -

XML description of the configuration options

- -The structure of the .kcfg file is described by its DTD kcfg.dtd. - -The \ tag contains the name of the configuration file described. -Omitting the name will make the generated class use the default configuration -file ("rc"). - -The remaining entries in the XML file are grouped by the tag \ -which describes the corresponding group in the configuration file. - -The individual entries must have at least a name or a key. The name is used to -create accessor and modifier functions. It's also used as the key in the config -file. If \ is given, but not \, the name is constructed by removing -all spaces from \. - -An entry must also have a type. The list of allowable types is -specified in the DTD and loosely follows the list of types supported -by the TQt::Variant with exception of the clearly binary types -(e.g. Pixmap, Image...) which are not supported. Besides those basic -type the following special types are supported: - -- Path This is a string that is specially treated as a file-path. - In particular paths in the home directory are prefixed with $HOME in - when being stored in the configuration file. - -- Enum This indicates an enumeration. The possible enum values should - be provided via the \ tag. Enum values are accessed as integers - by the application but stored as string in the configuration file. This - makes it possible to add more values at a later date without breaking - compatibility. - -- IntList This indicates a list of integers. This information is provided - to the application as an Array of Integers. Useful for storing TQt::Splitter - geometries. - -An entry can optionally have a default value which is used as default when -the value isn't specified in any config file. Default values are interpreted -as literal constant values. If a default value needs to be computed -or if it needs to be obtained from a function call, the \ tag -should contain the code="true" attribute. The contents of the \ -tag is then considered to be a ruby expression. - -Additional code for computing default values can be provided via -the \ tag. The contents of the \ tag is inserted as-is. A -typical use for this is to compute a common default value which can -then be referenced by multiple entries that follow. - -

Code generation options

- -The options for generating the Ruby sources are read from the file with the -extension .kcfgc. To generate a class add the corresponding kcfgc file to the -SOURCES line in the Makefile.am. - -The following options are read from the kcfgc file: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
Filestringprogramname.kcfgName of kcfg file containing the options the class is generated for
NameSpacestring-Optional namespace for generated class
ClassNamestring-Name of generated class (required)
InheritsstringTDEConfigSkeletonClass the generated class inherits from. This class must inherit - TDEConfigSkeleton.
Visibilitystring-Inserts visibility directive (for example KDE_EXPORT) between "class" keyword and class - name in header file
SingletonboolfalseGenerated class is a singleton.
CustomAdditionsbool-
MemberVariablesstring: public|protected|privateprivateC++ access modifier used for memeber variables holding the configuration - valuse
IncludeFilescomma separated list of strings-Names of files to be included in the header of the generated class
Mutatorstrue, false or a comma seperated list of options-If true, mutator functions for all configuration options are generated. - If false, no mutator functions are generated. If a list is provided, - mutator functions are generated for the options that are listed.
ItemAccessorsboolfalseGenerate accessor functions for the TDEConfigSkeletonItem objects - corresponding to the configuration options. If SetUserTexts is set, - ItemAccessors also has to be set.
SetUserTextsboolfalseSet the label and whatthis texts of the items from the kcfg file.If - SetUserTexts is set, ItemAccessors also has to be set.
GlobalEnumsboolfalseIf set to true all choices of Enum items will be created in the global - scope of the generated class. If set to false, each Enum item will get an own - namespace for its choices.
- - -

Advanced options

- -There are several possibilities to parameterize entries. - -- Parameterized entries - -An entry can be parameterized using a fixed range parameter specified with -the \ tag. Such parameter can either be an Enum or an int. An Enum -parameter should specify the possible enumeration values with the \ -tag. An int parameter should specify its maximum value. Its minimum value -is always 0. - -A parameterized entry is expanded to a number of entries, one for each -value in the parameter range. The name and key should contain a reference -to the parameter in the form of $(parameter-name). When expanding the entries -the $(parameter-name) part is replaced with the value of the parameter. -In the case of an Enum parameter it is replaced with the name of the -enumuration value. In the case of an int parameter it is replaced with -the numeric value of the parameter. - -Parameterized entries all share the same default value unless different -default values have been specified for specific parameter values. -This can be done with the param= attribute of the \. When a -param attribute is specified the default value only applies to that -particular parameter value. - -Example 1: -\verbatim - - - #ff0000 - #00ff00 - #0000ff - #ffff00 - -\endverbatim - -The above describes 4 color configuration entries with the following defaults: - -color_0=#ff0000 -color_1=#00ff00 -color_2=#0000ff -color_3=#ffff00 - -The configuration options will be accessible to the application via -a color(colorIndex) and a -setColor(colorIndex, v) method. - -Example 2: -\verbatim - - - - Explosion - Crash - Missile - - - boom.wav - crash.wav - missile.wav - -\endverbatim - -The above describes 3 string configuration entries with the following defaults: - -sound_Explosion=boom.wav -sound_Crash=crash.wav -sound_Missile=missile.wav - -The configuration options will be accessible to the application via -a sound(soundEvent) and a -setSound(soundEvent, v) method. - -- Parameterized groups - -...STILL TODO... - - - - - -If you have questions or comments please contact Cornelius Schumacher - or Waldo Bastian - -For Ruby specific questions please contact Richard Dale - -*/ diff --git a/korundum/rubylib/rbkconfig_compiler/TODO b/korundum/rubylib/rbkconfig_compiler/TODO deleted file mode 100644 index db4137ed..00000000 --- a/korundum/rubylib/rbkconfig_compiler/TODO +++ /dev/null @@ -1 +0,0 @@ -- Support linebreaks in whasthis texts in the kcfg file. diff --git a/korundum/rubylib/rbkconfig_compiler/autoexample.rb b/korundum/rubylib/rbkconfig_compiler/autoexample.rb deleted file mode 100644 index 8526c93d..00000000 --- a/korundum/rubylib/rbkconfig_compiler/autoexample.rb +++ /dev/null @@ -1,49 +0,0 @@ -=begin - This file is part of KDE. - - Copyright (c) 2003 Cornelius Schumacher - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -=end - -require 'Korundum' -require 'exampleprefs_base.rb' -require 'general_base.rb' -require 'myoptions_base.rb' - - aboutData = KDE::AboutData.new( "example", I18N_NOOP("autoconfig example"), "0.1" ) - aboutData.addAuthor( "Cornelius Schumacher", nil, "schumacher@kde.org" ) - - KDE::CmdLineArgs.init( ARGV, aboutData ) - - app = KDE::Application.new - - configSkeleton = ExamplePrefsBase.new( "dummy1", "dummy2" ) - configSkeleton.readConfig() - - dialog = KDE::ConfigDialog.new( nil, "settings", configSkeleton ) - - general = GeneralBase.new(nil) - dialog.addPage( general, app.i18n("General"), "General", "" ) - - myOptions = MyOptionsBase.new( nil ) - dialog.addPage( myOptions, app.i18n("MyOptions"), "MyOptions", "" ) - - app.mainWidget = dialog - - dialog.show() - - app.exec diff --git a/korundum/rubylib/rbkconfig_compiler/checkkcfg.pl b/korundum/rubylib/rbkconfig_compiler/checkkcfg.pl deleted file mode 100755 index 2eddbeee..00000000 --- a/korundum/rubylib/rbkconfig_compiler/checkkcfg.pl +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/perl - -if ( @ARGV != 1 ) { - print STDERR "Missing arg: filename\n"; - exit 1; -} - -$file = $ARGV[0]; - -$file =~ /^(.*)\.[^\.]*$/; -$filebase = $1; - -$file_h = "$filebase.h"; -$file_cpp = "$filebase.cpp"; - -$kcfgc = $file . "c"; - -$cmd = "./kconfig_compiler $file $kcfgc"; - -#print "CMD $cmd\n"; - -if ( system( $cmd ) != 0 ) { - print STDERR "Unable to run kconfig_compiler\n"; - exit 1; -} - -checkfile( $file_h ); -checkfile( $file_cpp ); - -exit 0; - -sub checkfile() -{ - my $file = shift; - - $file =~ /\/([^\/]*)$/; - my $filename = $1; - - print "Checking '$filename':\n"; - - my @ref; - if ( !open( REF, "$file.ref" ) ) { - print STDERR "Unable to open $file.ref\n"; - exit 1; - } - while( ) { - push @ref, $_; - } - close REF; - - if ( !open( READ, $filename ) ) { - print STDERR "Unable to open $filename\n"; - exit 1; - } - - $error = 0; - $i = 0; - $line = 1; - while( ) { - $out = $_; - $ref = @ref[$i++]; - - if ( $out ne $ref ) { - $error++; - print " Line $line: Expected : $ref"; - print " Line $line: Compiler output : $out"; - } - - $line++; - } - - close READ; - - if ( $error > 0 ) { - print "\n FAILED: $error errors found.\n"; - if ( $error > 5 ) { - system( "diff -u $file.ref $filename" ); - } - exit 1; - } else { - print " OK\n"; - } -} diff --git a/korundum/rubylib/rbkconfig_compiler/example.kcfg b/korundum/rubylib/rbkconfig_compiler/example.kcfg deleted file mode 100644 index 055958b4..00000000 --- a/korundum/rubylib/rbkconfig_compiler/example.kcfg +++ /dev/null @@ -1,55 +0,0 @@ - - - qdir.h - - - - - - - - true - - - - 5 - - - - And this is a longer description of this option. Just wondering, how will the translations of those be handled? - - - - - - One - - - - - - Default String - - - - TQt::Dir.homeDirPath()+".hidden_file" - - - - 10 - - - up,down - - - - - 1 - - - diff --git a/korundum/rubylib/rbkconfig_compiler/example.rb b/korundum/rubylib/rbkconfig_compiler/example.rb deleted file mode 100644 index 9ed4d9c4..00000000 --- a/korundum/rubylib/rbkconfig_compiler/example.rb +++ /dev/null @@ -1,40 +0,0 @@ -=begin - This file is part of KDE. - - Copyright (c) 2003 Cornelius Schumacher - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -=end - -require 'Korundum' -require 'exampleprefs_base.rb' - - aboutData = KDE::AboutData.new( "example", I18N_NOOP("cfgc example"), "0.1" ) - aboutData.addAuthor( "Cornelius Schumacher", nil, "schumacher@kde.org" ) - - KDE::CmdLineArgs.init( ARGV, aboutData ) - - app = KDE::Application.new - - prefs = ExamplePrefsBase.new("Trans1", "Folder2") - - prefs.readConfig() - - prefs.setAnotherOption(17) - - - tqWarning("Another Option = %d" % prefs.anotherOption()) - tqWarning("Another Option2 = %d" % prefs.anotherOption2()) diff --git a/korundum/rubylib/rbkconfig_compiler/exampleprefs_base.kcfgc b/korundum/rubylib/rbkconfig_compiler/exampleprefs_base.kcfgc deleted file mode 100644 index a9ac98dc..00000000 --- a/korundum/rubylib/rbkconfig_compiler/exampleprefs_base.kcfgc +++ /dev/null @@ -1,18 +0,0 @@ -# Code generation options for kconfig_compiler -ClassName=ExamplePrefsBase -# -# Singleton=false -# -# Inherits=TDEConfigSkeleton -# -# IncludeFiles=libtdepim/kpimprefs.h -# -# MemberVariables=public -# -### The following line includes the file exampleprefs_base_addon.h -### It can be used to add extra functions and variables to the -### class. -# CustomAdditions=true -# -### Provide setFooBar(int) style functions -Mutators=true diff --git a/korundum/rubylib/rbkconfig_compiler/general_base.ui b/korundum/rubylib/rbkconfig_compiler/general_base.ui deleted file mode 100644 index 4a76cc34..00000000 --- a/korundum/rubylib/rbkconfig_compiler/general_base.ui +++ /dev/null @@ -1,46 +0,0 @@ - -GeneralBase - - - GeneralBase - - - - 0 - 0 - 600 - 486 - - - - AutoExampleDialog - - - - unnamed - - - - kcfg_OneOption - - - OneOption - - - - - kcfg_AnotherOption2 - - - - - textLabel1 - - - AnotherOption: - - - - - - diff --git a/korundum/rubylib/rbkconfig_compiler/kcfg.xsd b/korundum/rubylib/rbkconfig_compiler/kcfg.xsd deleted file mode 100644 index d505a514..00000000 --- a/korundum/rubylib/rbkconfig_compiler/kcfg.xsd +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> - Copyright (c) 2003 Waldo Bastian <bastian@kde.org> - Copyright (c) 2003 Zack Rusin <zack@kde.org> - Copyright (c) 2004 Frans Englich <frans.englich@telia.com> - - Permission to use, copy, modify and distribute this DTD - and its accompanying documentation for any purpose and without fee - is hereby granted in perpetuity, provided that the above copyright - notice and this paragraph appear in all copies. The copyright - holders make no representation about the suitability of the DTD for - any purpose. It is provided "as is" without expressed or implied - warranty. - - - - - - - A Schema for KDE's TDEConfigXT XML format. It is similar to the DTD - found at: - - http://www.kde.org/standards/kcfg/1.0/kcfg.dtd - - Documents valid against the Schema version are backwards compatible - to the DTD. Validating against the Schema instead of the DTD is - recommended, since the former provides better validation. - - A document instance of this Schema should have a declaration - looking like this: - - - - - - - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/korundum/rubylib/rbkconfig_compiler/myoptions_base.ui b/korundum/rubylib/rbkconfig_compiler/myoptions_base.ui deleted file mode 100644 index aa3148a4..00000000 --- a/korundum/rubylib/rbkconfig_compiler/myoptions_base.ui +++ /dev/null @@ -1,35 +0,0 @@ - -MyOptionsBase - - - MyOptionsBase - - - - 0 - 0 - 600 - 486 - - - - - unnamed - - - - textLabel1 - - - MyString: - - - - - kcfg_MyString - - - - - - diff --git a/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp b/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp deleted file mode 100644 index c29cb838..00000000 --- a/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp +++ /dev/null @@ -1,1330 +0,0 @@ -// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- -/* - This file is part of KDE. - - Copyright (c) 2003 Cornelius Schumacher - Copyright (c) 2003 Waldo Bastian - Copyright (c) 2003 Zack Rusin - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -static const KCmdLineOptions options[] = -{ - { "d", 0, 0 }, - { "directory ", I18N_NOOP("Directory to generate files in"), "." }, - { "+file.kcfg", I18N_NOOP("Input kcfg XML file"), 0 }, - { "+file.kcfgc", I18N_NOOP("Code generation options file"), 0 }, - KCmdLineLastOption -}; - - -bool globalEnums; -bool itemAccessors; -TQStringList allNames; -TQRegExp *validNameRegexp; - -class CfgEntry -{ - public: - struct Choice - { - TQString name; - TQString label; - TQString whatsThis; - }; - - CfgEntry( const TQString &group, const TQString &type, const TQString &key, - const TQString &name, const TQString &label, - const TQString &whatsThis, const TQString &code, - const TQString &defaultValue, const TQValueList &choices, - bool hidden ) - : mGroup( group ), mType( type ), mKey( key ), mName( name ), - mLabel( label ), mWhatsThis( whatsThis ), mCode( code ), - mDefaultValue( defaultValue ), - mChoices( choices ), mHidden( hidden ) - { - } - - void setGroup( const TQString &group ) { mGroup = group; } - TQString group() const { return mGroup; } - - void setType( const TQString &type ) { mType = type; } - TQString type() const { return mType; } - - void setKey( const TQString &key ) { mKey = key; } - TQString key() const { return mKey; } - - void setName( const TQString &name ) { mName = name; } - TQString name() const { return mName; } - - void setLabel( const TQString &label ) { mLabel = label; } - TQString label() const { return mLabel; } - - void setWhatsThis( const TQString &whatsThis ) { mWhatsThis = whatsThis; } - TQString whatsThis() const { return mWhatsThis; } - - void setDefaultValue( const TQString &d ) { mDefaultValue = d; } - TQString defaultValue() const { return mDefaultValue; } - - void setCode( const TQString &d ) { mCode = d; } - TQString code() const { return mCode; } - - void setMinValue( const TQString &d ) { mMin = d; } - TQString minValue() const { return mMin; } - - void setMaxValue( const TQString &d ) { mMax = d; } - TQString maxValue() const { return mMax; } - - void setParam( const TQString &d ) { mParam = d; } - TQString param() const { return mParam; } - - void setParamName( const TQString &d ) { mParamName = d; } - TQString paramName() const { return mParamName; } - - void setParamType( const TQString &d ) { mParamType = d; } - TQString paramType() const { return mParamType; } - - void setChoices( const TQValueList &d ) { mChoices = d; } - TQValueList choices() const { return mChoices; } - - void setParamValues( const TQStringList &d ) { mParamValues = d; } - TQStringList paramValues() const { return mParamValues; } - - void setParamDefaultValues( const TQStringList &d ) { mParamDefaultValues = d; } - TQString paramDefaultValue(int i) const { return mParamDefaultValues[i]; } - - void setParamMax( int d ) { mParamMax = d; } - int paramMax() const { return mParamMax; } - - bool hidden() const { return mHidden; } - - void dump() const - { - kdDebug() << "" << endl; - kdDebug() << " group: " << mGroup << endl; - kdDebug() << " type: " << mType << endl; - kdDebug() << " key: " << mKey << endl; - kdDebug() << " name: " << mName << endl; - kdDebug() << " label: " << mLabel << endl; -// whatsthis - kdDebug() << " code: " << mCode << endl; -// kdDebug() << " values: " << mValues.join(":") << endl; - - if (!param().isEmpty()) - { - kdDebug() << " param name: "<< mParamName << endl; - kdDebug() << " param type: "<< mParamType << endl; - kdDebug() << " paramvalues: " << mParamValues.join(":") << endl; - } - kdDebug() << " default: " << mDefaultValue << endl; - kdDebug() << " hidden: " << mHidden << endl; - kdDebug() << " min: " << mMin << endl; - kdDebug() << " max: " << mMax << endl; - kdDebug() << "" << endl; - } - - private: - TQString mGroup; - TQString mType; - TQString mKey; - TQString mName; - TQString mLabel; - TQString mWhatsThis; - TQString mCode; - TQString mDefaultValue; - TQString mParam; - TQString mParamName; - TQString mParamType; - TQValueList mChoices; - TQStringList mParamValues; - TQStringList mParamDefaultValues; - int mParamMax; - bool mHidden; - TQString mMin; - TQString mMax; -}; - - -static TQString varName(const TQString &n) -{ - TQString result = "@"+n; - result[1] = result[1].lower(); - return result; -} - -static TQString enumName(const TQString &n) -{ - TQString result = "Enum"+n; - result[4] = result[4].upper(); - return result; -} - -static TQString enumValue(const TQString &n) -{ - TQString result = n; - result[0] = result[0].upper(); - return result; -} - -static TQString setFunction(const TQString &n) -{ - TQString result = "set"+n; - result[3] = result[3].upper(); - return result; -} - - -static TQString getFunction(const TQString &n) -{ - TQString result = n; - result[0] = result[0].lower(); - return result; -} - - -static void addQuotes( TQString &s ) -{ - if ( s.left( 1 ) != "\"" ) s.prepend( "\"" ); - if ( s.right( 1 ) != "\"" ) s.append( "\"" ); -} - -static TQString quoteString( const TQString &s ) -{ - TQString r = s; - r.replace( "\\", "\\\\" ); - r.replace( "\"", "\\\"" ); - r.replace( "\r", "" ); - r.replace( "\n", "\\n\"\n\"" ); - return "\"" + r + "\""; -} - -static TQString literalString( const TQString &s ) -{ - bool isAscii = true; - for(int i = s.length(); i--;) - if (s[i].unicode() > 127) isAscii = false; - - return quoteString(s); - -// if (isAscii) -// return "TQString::fromLatin1( " + quoteString(s) + " )"; -// else -// return "TQString::fromUtf8( " + quoteString(s) + " )"; -} - -static TQString dumpNode(const TQDomNode &node) -{ - TQString msg; - TQTextStream s(&msg, IO_WriteOnly ); - node.save(s, 0); - - msg = msg.simplifyWhiteSpace(); - if (msg.length() > 40) - return msg.left(37)+"..."; - return msg; -} - -static TQString filenameOnly(TQString path) -{ - int i = path.findRev('/'); - if (i >= 0) - return path.mid(i+1); - return path; -} - -static void preProcessDefault( TQString &defaultValue, const TQString &name, - const TQString &type, - const TQValueList &choices, - TQString &code ) -{ - if ( type == "String" && !defaultValue.isEmpty() ) { - defaultValue = literalString(defaultValue); - - } else if ( type == "Path" && !defaultValue.isEmpty() ) { - defaultValue = literalString( defaultValue ); - - } else if ( type == "StringList" && !defaultValue.isEmpty() ) { - TQTextStream rb( &code, IO_WriteOnly | IO_Append ); - if (!code.isEmpty()) - rb << endl; - -// rb << " TQStringList default" << name << ";" << endl; - rb << " default" << name << " = []" << endl; - TQStringList defaults = TQStringList::split( ",", defaultValue ); - TQStringList::ConstIterator it; - for( it = defaults.begin(); it != defaults.end(); ++it ) { - rb << " default" << name << " << \"" << *it << "\"" - << endl; - } - defaultValue = "default" + name; - - } else if ( type == "Color" && !defaultValue.isEmpty() ) { - TQRegExp colorRe("\\d+,\\s*\\d+,\\s*\\d+"); - if (colorRe.exactMatch(defaultValue)) - { - defaultValue = "TQt::Color.new( " + defaultValue + " )"; - } - else - { - defaultValue = "TQt::Color.new( \"" + defaultValue + "\" )"; - } - - } else if ( type == "Enum" ) { - if ( !globalEnums ) { - TQValueList::ConstIterator it; - for( it = choices.begin(); it != choices.end(); ++it ) { - if ( (*it).name == defaultValue ) { - defaultValue.prepend( enumName(name) + "_"); - break; - } - } - } - - } else if ( type == "IntList" ) { - TQTextStream rb( &code, IO_WriteOnly | IO_Append ); - if (!code.isEmpty()) - rb << endl; - - rb << " default" << name << " = []" << endl; - TQStringList defaults = TQStringList::split( ",", defaultValue ); - TQStringList::ConstIterator it; - for( it = defaults.begin(); it != defaults.end(); ++it ) { - rb << " default" << name << " << " << *it << "" - << endl; - } - defaultValue = "default" + name; - } -} - - -CfgEntry *parseEntry( const TQString &group, const TQDomElement &element ) -{ - bool defaultCode = false; - TQString type = element.attribute( "type" ); - TQString name = element.attribute( "name" ); - TQString key = element.attribute( "key" ); - TQString hidden = element.attribute( "hidden" ); - TQString label; - TQString whatsThis; - TQString defaultValue; - TQString code; - TQString param; - TQString paramName; - TQString paramType; - TQValueList choices; - TQStringList paramValues; - TQStringList paramDefaultValues; - TQString minValue; - TQString maxValue; - int paramMax = 0; - - TQDomNode n; - for ( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { - TQDomElement e = n.toElement(); - TQString tag = e.tagName(); - if ( tag == "label" ) label = e.text(); - else if ( tag == "whatsthis" ) whatsThis = e.text(); - else if ( tag == "min" ) minValue = e.text(); - else if ( tag == "max" ) maxValue = e.text(); - else if ( tag == "code" ) code = e.text(); - else if ( tag == "parameter" ) - { - param = e.attribute( "name" ); - paramType = e.attribute( "type" ); - if ( param.isEmpty() ) { - kdError() << "Parameter must have a name: " << dumpNode(e) << endl; - return 0; - } - if ( paramType.isEmpty() ) { - kdError() << "Parameter must have a type: " << dumpNode(e) << endl; - return 0; - } - if ((paramType == "Int") || (paramType == "UInt")) - { - bool ok; - paramMax = e.attribute("max").toInt(&ok); - if (!ok) - { - kdError() << "Integer parameter must have a maximum (e.g. max=\"0\"): " << dumpNode(e) << endl; - return 0; - } - } - else if (paramType == "Enum") - { - TQDomNode n2; - for ( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { - TQDomElement e2 = n2.toElement(); - if (e2.tagName() == "values") - { - TQDomNode n3; - for ( n3 = e2.firstChild(); !n3.isNull(); n3 = n3.nextSibling() ) { - TQDomElement e3 = n3.toElement(); - if (e3.tagName() == "value") - { - paramValues.append( e3.text() ); - } - } - break; - } - } - if (paramValues.isEmpty()) - { - kdError() << "No values specified for parameter '" << param << "'." << endl; - return 0; - } - paramMax = paramValues.count()-1; - } - else - { - kdError() << "Parameter '" << param << "' has type " << paramType << " but must be of type int, uint or Enum." << endl; - return 0; - } - } - else if ( tag == "default" ) - { - if (e.attribute("param").isEmpty()) - { - defaultValue = e.text(); - if (e.attribute( "code" ) == "true") - defaultCode = true; - } - } - else if ( tag == "choices" ) { - TQDomNode n2; - for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { - TQDomElement e2 = n2.toElement(); - if ( e2.tagName() == "choice" ) { - TQDomNode n3; - CfgEntry::Choice choice; - choice.name = e2.attribute( "name" ); - if ( choice.name.isEmpty() ) { - kdError() << "Tag requires attribute 'name'." << endl; - } - for( n3 = e2.firstChild(); !n3.isNull(); n3 = n3.nextSibling() ) { - TQDomElement e3 = n3.toElement(); - if ( e3.tagName() == "label" ) choice.label = e3.text(); - if ( e3.tagName() == "whatsthis" ) choice.whatsThis = e3.text(); - } - choices.append( choice ); - } - } - } - } - - bool nameIsEmpty = name.isEmpty(); - if ( nameIsEmpty && key.isEmpty() ) { - kdError() << "Entry must have a name or a key: " << dumpNode(element) << endl; - return 0; - } - - if ( key.isEmpty() ) { - key = name; - } - - if ( nameIsEmpty ) { - name = key; - name.replace( " ", TQString::null ); - } else if ( name.contains( ' ' ) ) { - kdWarning()<<"Entry '"< elements can't contain speces!"< paramMax)) - { - kdError() << "Index '" << i << "' for default value is out of range [0, "<< paramMax<<"]." << endl; - return 0; - } - - TQString tmpDefaultValue = e.text(); - - if (e.attribute( "code" ) != "true") - preProcessDefault(tmpDefaultValue, name, type, choices, code); - - paramDefaultValues[i] = tmpDefaultValue; - } - } - } - - if (!validNameRegexp->exactMatch(name)) - { - if (nameIsEmpty) - kdError() << "The key '" << key << "' can not be used as name for the entry because " - "it is not a valid name. You need to specify a valid name for this entry." << endl; - else - kdError() << "The name '" << name << "' is not a valid name for an entry." << endl; - return 0; - } - - if (allNames.contains(name)) - { - if (nameIsEmpty) - kdError() << "The key '" << key << "' can not be used as name for the entry because " - "it does not result in a unique name. You need to specify a unique name for this entry." << endl; - else - kdError() << "The name '" << name << "' is not unique." << endl; - return 0; - } - allNames.append(name); - - if (!defaultCode) - { - preProcessDefault(defaultValue, name, type, choices, code); - } - - CfgEntry *result = new CfgEntry( group, type, key, name, label, whatsThis, - code, defaultValue, choices, - hidden == "true" ); - if (!param.isEmpty()) - { - result->setParam(param); - result->setParamName(paramName); - result->setParamType(paramType); - result->setParamValues(paramValues); - result->setParamDefaultValues(paramDefaultValues); - result->setParamMax(paramMax); - } - result->setMinValue(minValue); - result->setMaxValue(maxValue); - - return result; -} - -/** - Return parameter declaration for given type. -*/ -TQString param( const TQString &type ) -{ - if ( type == "String" ) return "const TQString &"; - else if ( type == "StringList" ) return "const TQStringList &"; - else if ( type == "Font" ) return "const TQFont &"; - else if ( type == "Rect" ) return "const TQRect &"; - else if ( type == "Size" ) return "const TQSize &"; - else if ( type == "Color" ) return "const TQColor &"; - else if ( type == "Point" ) return "const TQPoint &"; - else if ( type == "Int" ) return "int"; - else if ( type == "UInt" ) return "uint"; - else if ( type == "Bool" ) return "bool"; - else if ( type == "Double" ) return "double"; - else if ( type == "DateTime" ) return "const TQDateTime &"; - else if ( type == "Int64" ) return "TQ_INT64"; - else if ( type == "UInt64" ) return "TQ_UINT64"; - else if ( type == "IntList" ) return "const TQValueList &"; - else if ( type == "Enum" ) return "int"; - else if ( type == "Path" ) return "const TQString &"; - else if ( type == "Password" ) return "const TQString &"; - else { - kdError() <<"rbkconfig_compiler does not support type \""<< type <<"\""<name() ) + "Item"; - - return "item" + e->name(); - -} - -TQString newItem( const TQString &type, const TQString &name, const TQString &key, - const TQString &defaultValue, const TQString ¶m = TQString::null) -{ - TQString t = "Item" + itemType( type ) + - ".new( currentGroup(), " + key + ", " + varName( name ) + param; - if ( type == "Enum" ) { - t += ".toInt"; - t += ", values" + name; - } else if ( type == "Path" ) { - t += ".toString"; - } else if ( type == "Int64" ) { - t += ".toLongLong"; - } else { - t += ".to" + itemType( type ); - } - if ( !defaultValue.isEmpty() ) { - t += ", "; - if ( type == "String" ) t += defaultValue; - else t+= defaultValue; - } - t += " )"; - - return t; -} - -TQString addItem( const TQString &type, const TQString &name, const TQString &key, - const TQString &defaultValue, const TQString ¶m = TQString::null, - const TQString ¶mName = TQString::null ) -{ - TQString t = "addItem" + itemType( type ) + - "( " + key + ", " + varName( name ) + param; - if ( type == "Enum" ) t += ", values" + name; - if ( !defaultValue.isEmpty() ) { - t += ", "; - if ( type == "String" ) t += defaultValue; - else if ( type == "Enum" ) t += enumValue(defaultValue); - else t+= defaultValue; - } - - if (!paramName.isNull()) { - t += ", \"" + paramName + "\""; - } - - t += " )"; - - return t; -} - -TQString paramString(const TQString &s, const CfgEntry *e, int i) -{ - TQString result = s; - TQString needle = "$("+e->param()+")"; - if (result.contains(needle)) - { - TQString tmp; - if (e->paramType() == "Enum") - { - tmp = e->paramValues()[i]; - } - else - { - tmp = TQString::number(i); - } - - result.replace(needle, tmp); - } - return result; -} - -TQString paramString(const TQString &group, const TQStringList ¶meters) -{ - TQString paramString = group; - TQString arguments; - int i = 0; - for( TQStringList::ConstIterator it = parameters.begin(); - it != parameters.end(); ++it) - { - if (paramString.contains("$("+*it+")")) - { - i++; - paramString.replace("$("+*it+")", "%s"); - if (i > 1) { - arguments += ", "; - } - arguments += " @param"+*it; - } - } - if (arguments.isEmpty()) - return "\""+group+"\""; - - if (i == 1) { - return "\""+paramString+"\" % "+arguments; - } else { - return "\""+paramString+"\" % ["+arguments+"]"; - } -} - -/* int i is the value of the parameter */ -TQString userTextsFunctions( CfgEntry *e, TQString itemVarStr=TQString::null, TQString i=TQString::null ) -{ - TQString txt; - if (itemVarStr.isNull()) itemVarStr=itemVar(e); - if ( !e->label().isEmpty() ) { - txt += " " + itemVarStr + ".setLabel( i18n("; - if ( !e->param().isEmpty() ) - txt += quoteString(e->label().replace("$("+e->param()+")", i)); - else - txt+= quoteString(e->label()); - txt+= ") )\n"; - } - if ( !e->whatsThis().isEmpty() ) { - txt += " " + itemVarStr + ".setWhatsThis( i18n("; - if ( !e->param().isEmpty() ) - txt += quoteString(e->whatsThis().replace("$("+e->param()+")", i)); - else - txt+= quoteString(e->whatsThis()); - txt+=") )\n"; - } - return txt; -} - -int main( int argc, char **argv ) -{ - TDEAboutData aboutData( "rbkconfig_compiler", I18N_NOOP("TDE .kcfg compiler"), "0.3", - I18N_NOOP("Ruby TDEConfig Compiler") , TDEAboutData::License_LGPL ); - aboutData.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org" ); - aboutData.addAuthor( "Waldo Bastian", 0, "bastian@kde.org" ); - aboutData.addAuthor( "Zack Rusin", 0, "zack@kde.org" ); - aboutData.addCredit( "Reinhold Kainhofer", "Fix for parametrized entries", - "reinhold@kainhofer.com", "http://reinhold.kainhofer.com" ); - aboutData.addCredit( "Richard Dale", "Ruby port", - "Richard_Dale@tipitina.demon.co.uk", "" ); - - TDECmdLineArgs::init( argc, argv, &aboutData ); - TDECmdLineArgs::addCmdLineOptions( options ); - - TDEInstance app( &aboutData ); - - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - - if ( args->count() < 2 ) { - kdError() << "Too few arguments." << endl; - return 1; - } - if ( args->count() > 2 ) { - kdError() << "Too many arguments." << endl; - return 1; - } - - validNameRegexp = new TQRegExp("[a-zA-Z_][a-zA-Z0-9_]*"); - - TQString baseDir = TQFile::decodeName(args->getOption("directory")); - if (!baseDir.endsWith("/")) - baseDir.append("/"); - - TQString inputFilename = args->url( 0 ).path(); - TQString codegenFilename = args->url( 1 ).path(); - - if (!codegenFilename.endsWith(".kcfgc")) - { - kdError() << "Codegen options file must have extension .kcfgc" << endl; - return 1; - } - TQString baseName = args->url( 1 ).fileName(); - baseName = baseName.left(baseName.length() - 6); - - KSimpleConfig codegenConfig( codegenFilename, true ); - - TQString nameSpace = codegenConfig.readEntry("NameSpace"); - TQString className = codegenConfig.readEntry("ClassName"); - TQString inherits = codegenConfig.readEntry("Inherits"); - TQString visibility = codegenConfig.readEntry("Visibility"); - if (!visibility.isEmpty()) visibility+=" "; - bool singleton = codegenConfig.readBoolEntry("Singleton", false); - bool customAddons = codegenConfig.readBoolEntry("CustomAdditions"); - TQString memberVariables = codegenConfig.readEntry("MemberVariables"); - TQStringList headerIncludes = codegenConfig.readListEntry("IncludeFiles"); - TQStringList mutators = codegenConfig.readListEntry("Mutators"); - bool allMutators = false; - if ((mutators.count() == 1) && (mutators[0].lower() == "true")) - allMutators = true; - itemAccessors = codegenConfig.readBoolEntry( "ItemAccessors", false ); - bool setUserTexts = codegenConfig.readBoolEntry( "SetUserTexts", false ); - - globalEnums = codegenConfig.readBoolEntry( "GlobalEnums", false ); - - TQFile input( inputFilename ); - - TQDomDocument doc; - TQString errorMsg; - int errorRow; - int errorCol; - if ( !doc.setContent( &input, &errorMsg, &errorRow, &errorCol ) ) { - kdError() << "Unable to load document." << endl; - kdError() << "Parse error in " << args->url( 0 ).fileName() << ", line " << errorRow << ", col " << errorCol << ": " << errorMsg << endl; - return 1; - } - - TQDomElement cfgElement = doc.documentElement(); - - if ( cfgElement.isNull() ) { - kdError() << "No document in kcfg file" << endl; - return 1; - } - - TQString cfgFileName; - bool cfgFileNameArg = false; - TQStringList parameters; - TQStringList includes; - - TQPtrList entries; - entries.setAutoDelete( true ); - - TQDomNode n; - for ( n = cfgElement.firstChild(); !n.isNull(); n = n.nextSibling() ) { - TQDomElement e = n.toElement(); - - TQString tag = e.tagName(); - - if ( tag == "include" ) { - TQString includeFile = e.text(); - if (!includeFile.isEmpty()) - includes.append(includeFile); - - } else if ( tag == "kcfgfile" ) { - cfgFileName = e.attribute( "name" ); - cfgFileNameArg = e.attribute( "arg" ).lower() == "true"; - TQDomNode n2; - for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { - TQDomElement e2 = n2.toElement(); - if ( e2.tagName() == "parameter" ) { - parameters.append( e2.attribute( "name" ) ); - } - } - - } else if ( tag == "group" ) { - TQString group = e.attribute( "name" ); - if ( group.isEmpty() ) { - kdError() << "Group without name" << endl; - return 1; - } - TQDomNode n2; - for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { - TQDomElement e2 = n2.toElement(); - if ( e2.tagName() != "entry" ) continue; - CfgEntry *entry = parseEntry( group, e2 ); - if ( entry ) entries.append( entry ); - else { - kdError() << "Can't parse entry." << endl; - return 1; - } - } - } - } - - if ( inherits.isEmpty() ) inherits = "KDE::ConfigSkeleton"; - - if ( className.isEmpty() ) { - kdError() << "Class name missing" << endl; - return 1; - } - - if ( singleton && !parameters.isEmpty() ) { - kdError() << "Singleton class can not have parameters" << endl; - return 1; - } - - if ( singleton && cfgFileNameArg) - { - kdError() << "Singleton class can not use filename as argument." << endl; - return 1; - } - - if ( !cfgFileName.isEmpty() && cfgFileNameArg) - { - kdError() << "Having both a fixed filename and a filename as argument is not possible." << endl; - return 1; - } - - if ( entries.isEmpty() ) { - kdWarning() << "No entries." << endl; - } - -#if 0 - CfgEntry *cfg; - for( cfg = entries.first(); cfg; cfg = entries.next() ) { - cfg->dump(); - } -#endif - - TQString implementationFileName = baseName + ".rb"; - - TQFile implementation( baseDir + implementationFileName ); - if ( !implementation.open( IO_WriteOnly ) ) { - kdError() << "Can't open '" << implementationFileName << "for writing." << endl; - return 1; - } - - TQTextStream rb( &implementation ); - - rb << "# This file is generated by rbkconfig_compiler from " << args->url(0).fileName() << "." << endl; - rb << "# All changes you do to this file will be lost." << endl; - rb << endl << "require 'Korundum'" << endl; - - if (singleton) { - rb << "require 'singleton'" << endl; - } - - rb << endl; - -// rb << "#ifndef " << ( !nameSpace.isEmpty() ? nameSpace.upper() + "_" : "" ) -// << className.upper() << "_H" << endl; -// rb << "#define " << ( !nameSpace.isEmpty() ? nameSpace.upper() + "_" : "" ) -// << className.upper() << "_H" << endl << endl; - - // Includes -// TQStringList::ConstIterator it; -// for( it = headerIncludes.begin(); it != headerIncludes.end(); ++it ) { -// rb << "#include <" << *it << ">" << endl; -// } - - if ( headerIncludes.count() > 0 ) rb << endl; - -// rb << "#include " << endl << endl; - - if ( !nameSpace.isEmpty() ) - rb << "module " << nameSpace << endl << endl; - - // Class declaration header - rb << "class " << className << " < " << inherits << endl; - - if (singleton) { - rb << " include Singleton" << endl << endl; - } - - // enums - CfgEntry *e; - for( e = entries.first(); e; e = entries.next() ) { - TQValueList choices = e->choices(); - if ( !choices.isEmpty() ) { - TQStringList values; - TQValueList::ConstIterator itChoice; - for( itChoice = choices.begin(); itChoice != choices.end(); ++itChoice ) { - if (globalEnums) { - values.append( enumValue((*itChoice).name) ); - } else { - values.append( enumName(e->name()) + "_" + (*itChoice).name ); - } - } - if (!globalEnums) { - values.append( enumName(e->name()) + "_COUNT" ); - } - int count = 0; - for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { - rb << " " << *it << " = " << count << endl; - } - rb << endl; - } - - TQStringList values = e->paramValues(); - if ( !values.isEmpty() ) { - int count = 0; - for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { - if (globalEnums) { - rb << " " << enumValue(*it) << " = " << count << endl; - } else { - rb << " " << enumName(e->param()) << "_" << *it << " = " << count << endl; - } - } - if (!globalEnums) { - rb << " " << enumName(e->param()) << "_COUNT = " << count << endl; - } - rb << endl; - - rb << " def " << enumName(e->param()) << "ToString(i)" << endl; - rb << " ["; - count = 0; - for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { - if (count > 0) { - rb << ", "; - } - - rb << "\"" << *it << "\""; - } - - rb << "].at(i)" << endl; - rb << " end" << endl; - } - } - - rb << endl; - - for( e = entries.first(); e; e = entries.next() ) { - TQString n = e->name(); - TQString t = e->type(); - - // Manipulator - if (allMutators || mutators.contains(n)) - { - rb << " #" << endl; - rb << " # Set " << e->label() << endl; - rb << " #" << endl; - rb << " def " << setFunction(n) << "( "; - if (!e->param().isEmpty()) - rb << " i, "; - rb << " v )" << endl; - rb << " item = findItem( \""; - if (!e->param().isEmpty()) { - rb << e->paramName().replace("$("+e->param()+")", "%s") << "\" % "; - if ( e->paramType() == "Enum" ) { - rb << " "; - if (globalEnums) - rb << enumName(e->param()) << "ToString(i)"; - else - rb << enumName(e->param()) << "ToString(i)"; - } else { - rb << "i"; - } - } else { - rb << n << "\""; - } - rb << " )" << endl; - rb << " if !item.immutable? " << endl; - rb << " item.property = " << varName(n); - if (!e->param().isEmpty()) - rb << "[i]"; - rb << " = TQt::Variant.new( v )" << endl; - rb << " end" << endl; - rb << " end" << endl << endl; - } - - // Accessor - rb << " #" << endl; - rb << " # Get " << e->label() << endl; - rb << " #" << endl; - rb << " def " << getFunction(n) << "("; - if (!e->param().isEmpty()) - rb << " " <<" i "; - rb << ")" << endl; - rb << " " << varName(n); - if (!e->param().isEmpty()) rb << "[i]"; - rb << " = findItem( \""; - if (!e->param().isEmpty()) { - rb << e->paramName().replace("$("+e->param()+")", "%s") << "\" % "; - if ( e->paramType() == "Enum" ) { - rb << " "; - if (globalEnums) - rb << enumName(e->param()) << "ToString(i)"; - else - rb << enumName(e->param()) << "ToString(i)"; - } else { - rb << "i"; - } - } else { - rb << n << "\""; - } - rb << " ).property" << endl; - rb << " return " << varName(n); - if (!e->param().isEmpty()) rb << "[i]"; - if ( e->type() == "Enum" ) { - rb << ".toInt" << endl; - } else if ( e->type() == "Int64" ) { - rb << ".toLongLong" << endl; - } else if ( e->type() == "Path" ) { - rb << ".toString" << endl; - } else { - rb << ".to" << itemType( e->type() ) << endl; - } - rb << " end" << endl; - - // Item accessor - if ( itemAccessors ) { - rb << endl; - rb << " #" << endl; - rb << " # Get Item object corresponding to " << n << "()" - << endl; - rb << " #" << endl; - rb << " def " - << getFunction( n ) << "Item("; - if (!e->param().isEmpty()) { - rb << " " << " i "; - } - rb << ")" << endl; - rb << " return " << itemVar(e); - if (!e->param().isEmpty()) rb << "[i]"; - rb << endl << " end" << endl; - } - - rb << endl; - } - - - if (customAddons) - { - rb << " # Include custom additions" << endl; - } - - - // Constructor - rb << " def initialize( "; - if (cfgFileNameArg) - rb << " config" << (parameters.isEmpty() ? " " : ", "); - for (TQStringList::ConstIterator it = parameters.begin(); - it != parameters.end(); ++it) - { - if (it != parameters.begin()) - rb << ","; - rb << " " << *it; - } - rb << " )" << endl; - - rb << " super("; - if ( !cfgFileName.isEmpty() ) rb << " \"" << cfgFileName << "\" "; - if ( cfgFileNameArg ) rb << " config "; -// if ( !cfgFileName.isEmpty() ) rb << ") "; - rb << ")" << endl; - - // Store parameters - for (TQStringList::ConstIterator it = parameters.begin(); - it != parameters.end(); ++it) - { - rb << " @param" << *it << " = TQt::Variant.new( " << *it << " )" << endl; - } - - TQString group; - for( e = entries.first(); e; e = entries.next() ) { - if ( e->group() != group ) { - group = e->group(); - rb << endl; - rb << " # " << group << endl; - } - if (e->param().isEmpty()) { - rb << " " << varName(e->name()) << " = TQt::Variant.new( " << rbType(e->type()) << " )"; - } else { - rb << " " << varName(e->name()) << " = [ "; - for (int i = 0; i < e->paramMax()+1; i++) { - if (i > 0) { - rb << ", "; - } - rb << "TQt::Variant.new( " << rbType(e->type()) << " )"; - } - rb << " ]"; - } - rb << endl; - } - - rb << endl; - - - group = TQString::null; - for( e = entries.first(); e; e = entries.next() ) { - if ( e->group() != group ) { - if ( !group.isEmpty() ) rb << endl; - group = e->group(); - rb << " setCurrentGroup( " << paramString(group, parameters) << " )" << endl << endl; - } - - TQString key = paramString(e->key(), parameters); - if ( !e->code().isEmpty()) - { - rb << e->code() << endl; - } - if ( e->type() == "Enum" ) { - rb << " values" - << e->name() << " = []" << endl; - TQValueList choices = e->choices(); - TQValueList::ConstIterator it; - for( it = choices.begin(); it != choices.end(); ++it ) { - rb << " choice = ItemEnum::Choice.new" << endl; - rb << " choice.name = \"" << enumValue((*it).name) << "\" " << endl; - if ( setUserTexts ) { - if ( !(*it).label.isEmpty() ) - rb << " choice.label = i18n(" << quoteString((*it).label) << ")" << endl; - if ( !(*it).whatsThis.isEmpty() ) - rb << " choice.whatsThis = i18n(" << quoteString((*it).whatsThis) << ")" << endl; - } - rb << " values" << e->name() << " << choice" << endl; - } - } - - if (e->param().isEmpty()) - { - // Normal case - rb << " " << itemVar(e) << " = " - << newItem( e->type(), e->name(), key, e->defaultValue() ) << endl; - - rb << " " << itemVar(e) << ".property = " << varName(e->name()) << endl; - - if ( !e->minValue().isEmpty() ) - rb << " " << itemVar(e) << ".setMinValue(" << e->minValue() << ")" << endl; - if ( !e->maxValue().isEmpty() ) - rb << " " << itemVar(e) << ".setMaxValue(" << e->maxValue() << ")" << endl; - - if ( setUserTexts ) - rb << userTextsFunctions( e ); - - rb << " addItem( " << itemVar(e); - TQString quotedName = e->name(); - addQuotes( quotedName ); - if ( quotedName != key ) rb << ", \"" << e->name() << "\""; - rb << " )" << endl; - } - else - { - // Indexed - rb << " " << itemVar(e) << " = Array.new(" << e->paramMax()+1 << ")" << endl; - for(int i = 0; i <= e->paramMax(); i++) - { - TQString defaultStr; - TQString itemVarStr(itemVar(e)+TQString("[%1]").arg(i)); - - if ( !e->paramDefaultValue(i).isEmpty() ) - defaultStr = e->paramDefaultValue(i); - else if ( !e->defaultValue().isEmpty() ) - defaultStr = paramString(e->defaultValue(), e, i); - else - defaultStr = defaultValue( e->type() ); - - rb << " " << itemVarStr << " = " - << newItem( e->type(), e->name(), paramString(key, e, i), defaultStr, TQString("[%1]").arg(i) ) - << endl; - - rb << " " << itemVarStr << ".property = " << varName(e->name())+TQString("[%1]").arg(i) << endl; - - if ( setUserTexts ) - rb << userTextsFunctions( e, itemVarStr, e->paramName() ); - - // Make mutators for enum parameters work by adding them with $(..) replaced by the - // param name. The check for isImmutable in the set* functions doesn't have the param - // name available, just the corresponding enum value (int), so we need to store the - // param names in a separate static list!. - rb << " addItem( " << itemVarStr << ", \""; - if ( e->paramType()=="Enum" ) - rb << e->paramName().replace( "$("+e->param()+")", "%1").arg(e->paramValues()[i] ); - else - rb << e->paramName().replace( "$("+e->param()+")", "%1").arg(i); - rb << "\" )" << endl; - - } - } - } - - rb << " end" << endl << endl; - - rb << "end" << endl << endl; - - if ( !nameSpace.isEmpty() ) rb << "end" << endl << endl; - - implementation.close(); -} diff --git a/korundum/rubylib/rbkconfig_compiler/tests/Makefile.am b/korundum/rubylib/rbkconfig_compiler/tests/Makefile.am deleted file mode 100644 index ce61f658..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -check_PROGRAMS = test1 test2 test3 test4 test5 - -CLEANFILES = test1.rb \ - test2.rb \ - test3.rb \ - test4.rb \ - test5.rb \ - md5sums - -all: $(SOURCES) - -# Splitting this with backslashses produces broken Makefiles -SOURCES = test1main.rb test1.rb test2main.rb test2.rb test3main.rb test3.rb test4main.rb test4.rb test5main.rb test5.rb - -# avoid running the below command in parallel -test1.rb: $(srcdir)/test1.kcfg ../rbkconfig_compiler $(srcdir)/test1.kcfgc - ../rbkconfig_compiler $(srcdir)/test1.kcfg $(srcdir)/test1.kcfgc - -# avoid running the below command in parallel -test2.rb: $(srcdir)/test2.kcfg ../rbkconfig_compiler $(srcdir)/test2.kcfgc - ../rbkconfig_compiler $(srcdir)/test2.kcfg $(srcdir)/test2.kcfgc - -# avoid running the below command in parallel -test3.rb: $(srcdir)/test3.kcfg ../rbkconfig_compiler $(srcdir)/test3.kcfgc - ../rbkconfig_compiler $(srcdir)/test3.kcfg $(srcdir)/test3.kcfgc - -# avoid running the below command in parallel -test4.rb: $(srcdir)/test4.kcfg ../rbkconfig_compiler $(srcdir)/test4.kcfgc - ../rbkconfig_compiler $(srcdir)/test4.kcfg $(srcdir)/test4.kcfgc - -# avoid running the below command in parallel -test5.rb: $(srcdir)/test5.kcfg ../rbkconfig_compiler $(srcdir)/test5.kcfgc - ../rbkconfig_compiler $(srcdir)/test5.kcfg $(srcdir)/test5.kcfgc - -md5sums: - $(MD5SUM) $(srcdir)/test*.ref | sed -e "s,$(srcdir)/,,; s,\.ref$$,," > md5sums - -md5check: test1.rb test2.rb test3.rb test4.rb test5.rb md5sums - $(MD5SUM) --check md5sums - diff --git a/korundum/rubylib/rbkconfig_compiler/tests/myprefs.rb b/korundum/rubylib/rbkconfig_compiler/tests/myprefs.rb deleted file mode 100644 index a4f1f082..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/myprefs.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MyPrefs < KDE::ConfigSkeleton - def initialize( a ) - super( a ) - end -end diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfg deleted file mode 100644 index b8c23c15..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfg +++ /dev/null @@ -1,55 +0,0 @@ - - - qdir.h - - - - - - - - true - - - - 5 - - - - And this is a longer description of this option. Just wondering, how will the translations of those be handled? - - - - - - One - - - - - - Default String - - - - TQt::Dir.homeDirPath()+".hidden_file" - - - - 10 - - - up,down - - - - - 1 - - - diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfgc deleted file mode 100644 index ecab7b85..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfgc +++ /dev/null @@ -1,18 +0,0 @@ -# Code generation options for kconfig_compiler -ClassName=Test1 -# -# Singleton=false -# -# Inherits=TDEConfigSkeleton -# -# IncludeFiles=libtdepim/kpimprefs.h -# -# MemberVariables=public -# -### The following line includes the file exampleprefs_base_addon.h -### It can be used to add extra functions and variables to the -### class. -# CustomAdditions=true -# -### Provide setFooBar(int) style functions -Mutators=true diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test1main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test1main.rb deleted file mode 100644 index 88a151a6..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test1main.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'Korundum' -require 'test1.rb' - -t = Test1.new(nil, nil) diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfg deleted file mode 100644 index 3b19e270..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - WhatsThis text for AutoSave option - false - - - 10 - - - - true - - - - - - - - - - - - - - - Argl2 Whatsthis - - - - Argl3 Whatsthis - - - standardDestination - - - - - - 10 - - - - false - - - - - - holidays,webexport - - - - - - - 100, 100, 255 - - - - 255, 255, 255 - - - - - - - - - - diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfgc deleted file mode 100644 index 56620d2f..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfgc +++ /dev/null @@ -1,11 +0,0 @@ -# Code generation options for kconfig_compiler -File=test2.kcfg -ClassName=Test2 -Singleton=false -Mutators=true -Inherits=MyPrefs -IncludeFiles=myprefs.h -MemberVariables=public -GlobalEnums=true -ItemAccessors=true -SetUserTexts=true diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test2main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test2main.rb deleted file mode 100644 index 85d18f07..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test2main.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'Korundum' -require 'myprefs.rb' -require 'test2.rb' - -t = Test2.new() diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfg deleted file mode 100644 index 77916da4..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfg +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - WhatsThis text for AutoSave option - false - - - - - - 10 - - - a string - - - - - diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfgc deleted file mode 100644 index ca2c2205..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfgc +++ /dev/null @@ -1,12 +0,0 @@ -# Code generation options for kconfig_compiler -File=test3.kcfg -NameSpace=TestNameSpace -ClassName=Test3 -#Singleton=false -Mutators=true -#Inherits=MyPrefs -#IncludeFiles=myprefs.h -#MemberVariables=public -GlobalEnums=true -ItemAccessors=true -#SetUserTexts=true diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test3main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test3main.rb deleted file mode 100644 index 8c19b442..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test3main.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'Korundum' -require 'test3.rb' - -t = TestNameSpace::Test3.new() diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfg deleted file mode 100644 index c834aa9f..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - defaultColor = [ TQt::red, TQt::blue, TQt::green, TQt::black ] - defaultColor[$(Number)] - - - - - right - mid - left - - - - - - - - - - Decrypt - Encrypt - PumpNDump - - - - 35 - 8 - 88 - - - - diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfgc deleted file mode 100644 index 754706df..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfgc +++ /dev/null @@ -1,11 +0,0 @@ -# Code generation options for kconfig_compiler -File=test4.kcfg -ClassName=Test4 -Singleton=true -Mutators=true -#Inherits=MyPrefs -#IncludeFiles=myprefs.h -#MemberVariables=public -GlobalEnums=false -ItemAccessors=false -#SetUserTexts=true diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test4main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test4main.rb deleted file mode 100644 index c75f0995..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test4main.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'Korundum' -require 'test4.rb' - -t = Test4.instance() diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfg deleted file mode 100644 index c834aa9f..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - defaultColor = [ TQt::red, TQt::blue, TQt::green, TQt::black ] - defaultColor[$(Number)] - - - - - right - mid - left - - - - - - - - - - Decrypt - Encrypt - PumpNDump - - - - 35 - 8 - 88 - - - - diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfgc deleted file mode 100644 index 663005e5..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfgc +++ /dev/null @@ -1,11 +0,0 @@ -# Code generation options for kconfig_compiler -File=test5.kcfg -ClassName=Test5 -Singleton=true -Mutators=true -#Inherits=MyPrefs -#IncludeFiles=myprefs.h -#MemberVariables=public -GlobalEnums=true -ItemAccessors=false -#SetUserTexts=true diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test5main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test5main.rb deleted file mode 100644 index cd0fbeb7..00000000 --- a/korundum/rubylib/rbkconfig_compiler/tests/test5main.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'Korundum' -require 'test5.rb' - -t = Test5.instance() diff --git a/korundum/rubylib/rbtdeconfig_compiler/Makefile.am b/korundum/rubylib/rbtdeconfig_compiler/Makefile.am new file mode 100644 index 00000000..8931f18a --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/Makefile.am @@ -0,0 +1,28 @@ +SUBDIRS = . tests + +RBUIC=rbuic + +.ui.rb: + $(RBUIC) -tr ${UIC_TR} -kde $*.ui -o $@ + +exampleprefs_base.rb: $(srcdir)/example.kcfg rbtdeconfig_compiler $(srcdir)/exampleprefs_base.kcfgc + ./rbtdeconfig_compiler $(srcdir)/example.kcfg $(srcdir)/exampleprefs_base.kcfgc + +AM_CPPFLAGS = -I$(top_srcdir)/tdecore -I$(top_srcdir) $(all_includes) + +bin_PROGRAMS = rbtdeconfig_compiler + +rbtdeconfig_compiler_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +rbtdeconfig_compiler_LDADD = $(LIB_TDECORE) +rbtdeconfig_compiler_SOURCES = rbtdeconfig_compiler.cpp + +METASOURCES = AUTO + +TESTFILES = test1.kcfg test2.kcfg test3.kcfg test4.kcfg test5.kcfg + +check-local: + for i in $(TESTFILES); \ + do xmllint --noout --schema $(srcdir)/kcfg.xsd $(srcdir)/tests/$$i; \ + perl $(top_srcdir)/korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl \ + $(top_srcdir)/korundum/rubylib/rbtdeconfig_compiler/tests/$$i; done + diff --git a/korundum/rubylib/rbtdeconfig_compiler/README.dox b/korundum/rubylib/rbtdeconfig_compiler/README.dox new file mode 100644 index 00000000..5601395c --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/README.dox @@ -0,0 +1,251 @@ +/** +\page rbtdeconfig_compiler The KDE Configuration Compiler for Ruby + +rbtdeconfig_compiler generates Ruby source code from an XML file containing +information about configuration options (.kcfg) and a file that provides +the code generation options (.kcfgc) The generated class is based on +KDE::ConfigSkeleton and provides an API for the application to access its +configuration data. + +

XML description of the configuration options

+ +The structure of the .kcfg file is described by its DTD kcfg.dtd. + +The \ tag contains the name of the configuration file described. +Omitting the name will make the generated class use the default configuration +file ("rc"). + +The remaining entries in the XML file are grouped by the tag \ +which describes the corresponding group in the configuration file. + +The individual entries must have at least a name or a key. The name is used to +create accessor and modifier functions. It's also used as the key in the config +file. If \ is given, but not \, the name is constructed by removing +all spaces from \. + +An entry must also have a type. The list of allowable types is +specified in the DTD and loosely follows the list of types supported +by the TQt::Variant with exception of the clearly binary types +(e.g. Pixmap, Image...) which are not supported. Besides those basic +type the following special types are supported: + +- Path This is a string that is specially treated as a file-path. + In particular paths in the home directory are prefixed with $HOME in + when being stored in the configuration file. + +- Enum This indicates an enumeration. The possible enum values should + be provided via the \ tag. Enum values are accessed as integers + by the application but stored as string in the configuration file. This + makes it possible to add more values at a later date without breaking + compatibility. + +- IntList This indicates a list of integers. This information is provided + to the application as an Array of Integers. Useful for storing TQt::Splitter + geometries. + +An entry can optionally have a default value which is used as default when +the value isn't specified in any config file. Default values are interpreted +as literal constant values. If a default value needs to be computed +or if it needs to be obtained from a function call, the \ tag +should contain the code="true" attribute. The contents of the \ +tag is then considered to be a ruby expression. + +Additional code for computing default values can be provided via +the \ tag. The contents of the \ tag is inserted as-is. A +typical use for this is to compute a common default value which can +then be referenced by multiple entries that follow. + +

Code generation options

+ +The options for generating the Ruby sources are read from the file with the +extension .kcfgc. To generate a class add the corresponding kcfgc file to the +SOURCES line in the Makefile.am. + +The following options are read from the kcfgc file: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDefaultDescription
Filestringprogramname.kcfgName of kcfg file containing the options the class is generated for
NameSpacestring-Optional namespace for generated class
ClassNamestring-Name of generated class (required)
InheritsstringTDEConfigSkeletonClass the generated class inherits from. This class must inherit + TDEConfigSkeleton.
Visibilitystring-Inserts visibility directive (for example KDE_EXPORT) between "class" keyword and class + name in header file
SingletonboolfalseGenerated class is a singleton.
CustomAdditionsbool-
MemberVariablesstring: public|protected|privateprivateC++ access modifier used for memeber variables holding the configuration + valuse
IncludeFilescomma separated list of strings-Names of files to be included in the header of the generated class
Mutatorstrue, false or a comma seperated list of options-If true, mutator functions for all configuration options are generated. + If false, no mutator functions are generated. If a list is provided, + mutator functions are generated for the options that are listed.
ItemAccessorsboolfalseGenerate accessor functions for the TDEConfigSkeletonItem objects + corresponding to the configuration options. If SetUserTexts is set, + ItemAccessors also has to be set.
SetUserTextsboolfalseSet the label and whatthis texts of the items from the kcfg file.If + SetUserTexts is set, ItemAccessors also has to be set.
GlobalEnumsboolfalseIf set to true all choices of Enum items will be created in the global + scope of the generated class. If set to false, each Enum item will get an own + namespace for its choices.
+ + +

Advanced options

+ +There are several possibilities to parameterize entries. + +- Parameterized entries + +An entry can be parameterized using a fixed range parameter specified with +the \ tag. Such parameter can either be an Enum or an int. An Enum +parameter should specify the possible enumeration values with the \ +tag. An int parameter should specify its maximum value. Its minimum value +is always 0. + +A parameterized entry is expanded to a number of entries, one for each +value in the parameter range. The name and key should contain a reference +to the parameter in the form of $(parameter-name). When expanding the entries +the $(parameter-name) part is replaced with the value of the parameter. +In the case of an Enum parameter it is replaced with the name of the +enumuration value. In the case of an int parameter it is replaced with +the numeric value of the parameter. + +Parameterized entries all share the same default value unless different +default values have been specified for specific parameter values. +This can be done with the param= attribute of the \. When a +param attribute is specified the default value only applies to that +particular parameter value. + +Example 1: +\verbatim + + + #ff0000 + #00ff00 + #0000ff + #ffff00 + +\endverbatim + +The above describes 4 color configuration entries with the following defaults: + +color_0=#ff0000 +color_1=#00ff00 +color_2=#0000ff +color_3=#ffff00 + +The configuration options will be accessible to the application via +a color(colorIndex) and a +setColor(colorIndex, v) method. + +Example 2: +\verbatim + + + + Explosion + Crash + Missile + + + boom.wav + crash.wav + missile.wav + +\endverbatim + +The above describes 3 string configuration entries with the following defaults: + +sound_Explosion=boom.wav +sound_Crash=crash.wav +sound_Missile=missile.wav + +The configuration options will be accessible to the application via +a sound(soundEvent) and a +setSound(soundEvent, v) method. + +- Parameterized groups + +...STILL TODO... + + + + + +If you have questions or comments please contact Cornelius Schumacher + or Waldo Bastian + +For Ruby specific questions please contact Richard Dale + +*/ diff --git a/korundum/rubylib/rbtdeconfig_compiler/TODO b/korundum/rubylib/rbtdeconfig_compiler/TODO new file mode 100644 index 00000000..db4137ed --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/TODO @@ -0,0 +1 @@ +- Support linebreaks in whasthis texts in the kcfg file. diff --git a/korundum/rubylib/rbtdeconfig_compiler/autoexample.rb b/korundum/rubylib/rbtdeconfig_compiler/autoexample.rb new file mode 100644 index 00000000..8526c93d --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/autoexample.rb @@ -0,0 +1,49 @@ +=begin + This file is part of KDE. + + Copyright (c) 2003 Cornelius Schumacher + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +=end + +require 'Korundum' +require 'exampleprefs_base.rb' +require 'general_base.rb' +require 'myoptions_base.rb' + + aboutData = KDE::AboutData.new( "example", I18N_NOOP("autoconfig example"), "0.1" ) + aboutData.addAuthor( "Cornelius Schumacher", nil, "schumacher@kde.org" ) + + KDE::CmdLineArgs.init( ARGV, aboutData ) + + app = KDE::Application.new + + configSkeleton = ExamplePrefsBase.new( "dummy1", "dummy2" ) + configSkeleton.readConfig() + + dialog = KDE::ConfigDialog.new( nil, "settings", configSkeleton ) + + general = GeneralBase.new(nil) + dialog.addPage( general, app.i18n("General"), "General", "" ) + + myOptions = MyOptionsBase.new( nil ) + dialog.addPage( myOptions, app.i18n("MyOptions"), "MyOptions", "" ) + + app.mainWidget = dialog + + dialog.show() + + app.exec diff --git a/korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl b/korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl new file mode 100755 index 00000000..26b12bad --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/checkkcfg.pl @@ -0,0 +1,83 @@ +#!/usr/bin/perl + +if ( @ARGV != 1 ) { + print STDERR "Missing arg: filename\n"; + exit 1; +} + +$file = $ARGV[0]; + +$file =~ /^(.*)\.[^\.]*$/; +$filebase = $1; + +$file_h = "$filebase.h"; +$file_cpp = "$filebase.cpp"; + +$kcfgc = $file . "c"; + +$cmd = "./tdeconfig_compiler $file $kcfgc"; + +#print "CMD $cmd\n"; + +if ( system( $cmd ) != 0 ) { + print STDERR "Unable to run tdeconfig_compiler\n"; + exit 1; +} + +chectdefile( $file_h ); +chectdefile( $file_cpp ); + +exit 0; + +sub chectdefile() +{ + my $file = shift; + + $file =~ /\/([^\/]*)$/; + my $filename = $1; + + print "Checking '$filename':\n"; + + my @ref; + if ( !open( REF, "$file.ref" ) ) { + print STDERR "Unable to open $file.ref\n"; + exit 1; + } + while( ) { + push @ref, $_; + } + close REF; + + if ( !open( READ, $filename ) ) { + print STDERR "Unable to open $filename\n"; + exit 1; + } + + $error = 0; + $i = 0; + $line = 1; + while( ) { + $out = $_; + $ref = @ref[$i++]; + + if ( $out ne $ref ) { + $error++; + print " Line $line: Expected : $ref"; + print " Line $line: Compiler output : $out"; + } + + $line++; + } + + close READ; + + if ( $error > 0 ) { + print "\n FAILED: $error errors found.\n"; + if ( $error > 5 ) { + system( "diff -u $file.ref $filename" ); + } + exit 1; + } else { + print " OK\n"; + } +} diff --git a/korundum/rubylib/rbtdeconfig_compiler/example.kcfg b/korundum/rubylib/rbtdeconfig_compiler/example.kcfg new file mode 100644 index 00000000..055958b4 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/example.kcfg @@ -0,0 +1,55 @@ + + + qdir.h + + + + + + + + true + + + + 5 + + + + And this is a longer description of this option. Just wondering, how will the translations of those be handled? + + + + + + One + + + + + + Default String + + + + TQt::Dir.homeDirPath()+".hidden_file" + + + + 10 + + + up,down + + + + + 1 + + + diff --git a/korundum/rubylib/rbtdeconfig_compiler/example.rb b/korundum/rubylib/rbtdeconfig_compiler/example.rb new file mode 100644 index 00000000..9ed4d9c4 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/example.rb @@ -0,0 +1,40 @@ +=begin + This file is part of KDE. + + Copyright (c) 2003 Cornelius Schumacher + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +=end + +require 'Korundum' +require 'exampleprefs_base.rb' + + aboutData = KDE::AboutData.new( "example", I18N_NOOP("cfgc example"), "0.1" ) + aboutData.addAuthor( "Cornelius Schumacher", nil, "schumacher@kde.org" ) + + KDE::CmdLineArgs.init( ARGV, aboutData ) + + app = KDE::Application.new + + prefs = ExamplePrefsBase.new("Trans1", "Folder2") + + prefs.readConfig() + + prefs.setAnotherOption(17) + + + tqWarning("Another Option = %d" % prefs.anotherOption()) + tqWarning("Another Option2 = %d" % prefs.anotherOption2()) diff --git a/korundum/rubylib/rbtdeconfig_compiler/exampleprefs_base.kcfgc b/korundum/rubylib/rbtdeconfig_compiler/exampleprefs_base.kcfgc new file mode 100644 index 00000000..9b72fdb0 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/exampleprefs_base.kcfgc @@ -0,0 +1,18 @@ +# Code generation options for tdeconfig_compiler +ClassName=ExamplePrefsBase +# +# Singleton=false +# +# Inherits=TDEConfigSkeleton +# +# IncludeFiles=libtdepim/kpimprefs.h +# +# MemberVariables=public +# +### The following line includes the file exampleprefs_base_addon.h +### It can be used to add extra functions and variables to the +### class. +# CustomAdditions=true +# +### Provide setFooBar(int) style functions +Mutators=true diff --git a/korundum/rubylib/rbtdeconfig_compiler/general_base.ui b/korundum/rubylib/rbtdeconfig_compiler/general_base.ui new file mode 100644 index 00000000..4a76cc34 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/general_base.ui @@ -0,0 +1,46 @@ + +GeneralBase + + + GeneralBase + + + + 0 + 0 + 600 + 486 + + + + AutoExampleDialog + + + + unnamed + + + + kcfg_OneOption + + + OneOption + + + + + kcfg_AnotherOption2 + + + + + textLabel1 + + + AnotherOption: + + + + + + diff --git a/korundum/rubylib/rbtdeconfig_compiler/kcfg.xsd b/korundum/rubylib/rbtdeconfig_compiler/kcfg.xsd new file mode 100644 index 00000000..d505a514 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/kcfg.xsd @@ -0,0 +1,191 @@ + + + + + + + + Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2003 Waldo Bastian <bastian@kde.org> + Copyright (c) 2003 Zack Rusin <zack@kde.org> + Copyright (c) 2004 Frans Englich <frans.englich@telia.com> + + Permission to use, copy, modify and distribute this DTD + and its accompanying documentation for any purpose and without fee + is hereby granted in perpetuity, provided that the above copyright + notice and this paragraph appear in all copies. The copyright + holders make no representation about the suitability of the DTD for + any purpose. It is provided "as is" without expressed or implied + warranty. + + + + + + + A Schema for KDE's TDEConfigXT XML format. It is similar to the DTD + found at: + + http://www.kde.org/standards/kcfg/1.0/kcfg.dtd + + Documents valid against the Schema version are backwards compatible + to the DTD. Validating against the Schema instead of the DTD is + recommended, since the former provides better validation. + + A document instance of this Schema should have a declaration + looking like this: + + + + + + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/korundum/rubylib/rbtdeconfig_compiler/myoptions_base.ui b/korundum/rubylib/rbtdeconfig_compiler/myoptions_base.ui new file mode 100644 index 00000000..aa3148a4 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/myoptions_base.ui @@ -0,0 +1,35 @@ + +MyOptionsBase + + + MyOptionsBase + + + + 0 + 0 + 600 + 486 + + + + + unnamed + + + + textLabel1 + + + MyString: + + + + + kcfg_MyString + + + + + + diff --git a/korundum/rubylib/rbtdeconfig_compiler/rbtdeconfig_compiler.cpp b/korundum/rubylib/rbtdeconfig_compiler/rbtdeconfig_compiler.cpp new file mode 100644 index 00000000..8db55019 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/rbtdeconfig_compiler.cpp @@ -0,0 +1,1330 @@ +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- +/* + This file is part of KDE. + + Copyright (c) 2003 Cornelius Schumacher + Copyright (c) 2003 Waldo Bastian + Copyright (c) 2003 Zack Rusin + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static const KCmdLineOptions options[] = +{ + { "d", 0, 0 }, + { "directory ", I18N_NOOP("Directory to generate files in"), "." }, + { "+file.kcfg", I18N_NOOP("Input kcfg XML file"), 0 }, + { "+file.kcfgc", I18N_NOOP("Code generation options file"), 0 }, + KCmdLineLastOption +}; + + +bool globalEnums; +bool itemAccessors; +TQStringList allNames; +TQRegExp *validNameRegexp; + +class CfgEntry +{ + public: + struct Choice + { + TQString name; + TQString label; + TQString whatsThis; + }; + + CfgEntry( const TQString &group, const TQString &type, const TQString &key, + const TQString &name, const TQString &label, + const TQString &whatsThis, const TQString &code, + const TQString &defaultValue, const TQValueList &choices, + bool hidden ) + : mGroup( group ), mType( type ), mKey( key ), mName( name ), + mLabel( label ), mWhatsThis( whatsThis ), mCode( code ), + mDefaultValue( defaultValue ), + mChoices( choices ), mHidden( hidden ) + { + } + + void setGroup( const TQString &group ) { mGroup = group; } + TQString group() const { return mGroup; } + + void setType( const TQString &type ) { mType = type; } + TQString type() const { return mType; } + + void setKey( const TQString &key ) { mKey = key; } + TQString key() const { return mKey; } + + void setName( const TQString &name ) { mName = name; } + TQString name() const { return mName; } + + void setLabel( const TQString &label ) { mLabel = label; } + TQString label() const { return mLabel; } + + void setWhatsThis( const TQString &whatsThis ) { mWhatsThis = whatsThis; } + TQString whatsThis() const { return mWhatsThis; } + + void setDefaultValue( const TQString &d ) { mDefaultValue = d; } + TQString defaultValue() const { return mDefaultValue; } + + void setCode( const TQString &d ) { mCode = d; } + TQString code() const { return mCode; } + + void setMinValue( const TQString &d ) { mMin = d; } + TQString minValue() const { return mMin; } + + void setMaxValue( const TQString &d ) { mMax = d; } + TQString maxValue() const { return mMax; } + + void setParam( const TQString &d ) { mParam = d; } + TQString param() const { return mParam; } + + void setParamName( const TQString &d ) { mParamName = d; } + TQString paramName() const { return mParamName; } + + void setParamType( const TQString &d ) { mParamType = d; } + TQString paramType() const { return mParamType; } + + void setChoices( const TQValueList &d ) { mChoices = d; } + TQValueList choices() const { return mChoices; } + + void setParamValues( const TQStringList &d ) { mParamValues = d; } + TQStringList paramValues() const { return mParamValues; } + + void setParamDefaultValues( const TQStringList &d ) { mParamDefaultValues = d; } + TQString paramDefaultValue(int i) const { return mParamDefaultValues[i]; } + + void setParamMax( int d ) { mParamMax = d; } + int paramMax() const { return mParamMax; } + + bool hidden() const { return mHidden; } + + void dump() const + { + kdDebug() << "" << endl; + kdDebug() << " group: " << mGroup << endl; + kdDebug() << " type: " << mType << endl; + kdDebug() << " key: " << mKey << endl; + kdDebug() << " name: " << mName << endl; + kdDebug() << " label: " << mLabel << endl; +// whatsthis + kdDebug() << " code: " << mCode << endl; +// kdDebug() << " values: " << mValues.join(":") << endl; + + if (!param().isEmpty()) + { + kdDebug() << " param name: "<< mParamName << endl; + kdDebug() << " param type: "<< mParamType << endl; + kdDebug() << " paramvalues: " << mParamValues.join(":") << endl; + } + kdDebug() << " default: " << mDefaultValue << endl; + kdDebug() << " hidden: " << mHidden << endl; + kdDebug() << " min: " << mMin << endl; + kdDebug() << " max: " << mMax << endl; + kdDebug() << "" << endl; + } + + private: + TQString mGroup; + TQString mType; + TQString mKey; + TQString mName; + TQString mLabel; + TQString mWhatsThis; + TQString mCode; + TQString mDefaultValue; + TQString mParam; + TQString mParamName; + TQString mParamType; + TQValueList mChoices; + TQStringList mParamValues; + TQStringList mParamDefaultValues; + int mParamMax; + bool mHidden; + TQString mMin; + TQString mMax; +}; + + +static TQString varName(const TQString &n) +{ + TQString result = "@"+n; + result[1] = result[1].lower(); + return result; +} + +static TQString enumName(const TQString &n) +{ + TQString result = "Enum"+n; + result[4] = result[4].upper(); + return result; +} + +static TQString enumValue(const TQString &n) +{ + TQString result = n; + result[0] = result[0].upper(); + return result; +} + +static TQString setFunction(const TQString &n) +{ + TQString result = "set"+n; + result[3] = result[3].upper(); + return result; +} + + +static TQString getFunction(const TQString &n) +{ + TQString result = n; + result[0] = result[0].lower(); + return result; +} + + +static void addQuotes( TQString &s ) +{ + if ( s.left( 1 ) != "\"" ) s.prepend( "\"" ); + if ( s.right( 1 ) != "\"" ) s.append( "\"" ); +} + +static TQString quoteString( const TQString &s ) +{ + TQString r = s; + r.replace( "\\", "\\\\" ); + r.replace( "\"", "\\\"" ); + r.replace( "\r", "" ); + r.replace( "\n", "\\n\"\n\"" ); + return "\"" + r + "\""; +} + +static TQString literalString( const TQString &s ) +{ + bool isAscii = true; + for(int i = s.length(); i--;) + if (s[i].unicode() > 127) isAscii = false; + + return quoteString(s); + +// if (isAscii) +// return "TQString::fromLatin1( " + quoteString(s) + " )"; +// else +// return "TQString::fromUtf8( " + quoteString(s) + " )"; +} + +static TQString dumpNode(const TQDomNode &node) +{ + TQString msg; + TQTextStream s(&msg, IO_WriteOnly ); + node.save(s, 0); + + msg = msg.simplifyWhiteSpace(); + if (msg.length() > 40) + return msg.left(37)+"..."; + return msg; +} + +static TQString filenameOnly(TQString path) +{ + int i = path.findRev('/'); + if (i >= 0) + return path.mid(i+1); + return path; +} + +static void preProcessDefault( TQString &defaultValue, const TQString &name, + const TQString &type, + const TQValueList &choices, + TQString &code ) +{ + if ( type == "String" && !defaultValue.isEmpty() ) { + defaultValue = literalString(defaultValue); + + } else if ( type == "Path" && !defaultValue.isEmpty() ) { + defaultValue = literalString( defaultValue ); + + } else if ( type == "StringList" && !defaultValue.isEmpty() ) { + TQTextStream rb( &code, IO_WriteOnly | IO_Append ); + if (!code.isEmpty()) + rb << endl; + +// rb << " TQStringList default" << name << ";" << endl; + rb << " default" << name << " = []" << endl; + TQStringList defaults = TQStringList::split( ",", defaultValue ); + TQStringList::ConstIterator it; + for( it = defaults.begin(); it != defaults.end(); ++it ) { + rb << " default" << name << " << \"" << *it << "\"" + << endl; + } + defaultValue = "default" + name; + + } else if ( type == "Color" && !defaultValue.isEmpty() ) { + TQRegExp colorRe("\\d+,\\s*\\d+,\\s*\\d+"); + if (colorRe.exactMatch(defaultValue)) + { + defaultValue = "TQt::Color.new( " + defaultValue + " )"; + } + else + { + defaultValue = "TQt::Color.new( \"" + defaultValue + "\" )"; + } + + } else if ( type == "Enum" ) { + if ( !globalEnums ) { + TQValueList::ConstIterator it; + for( it = choices.begin(); it != choices.end(); ++it ) { + if ( (*it).name == defaultValue ) { + defaultValue.prepend( enumName(name) + "_"); + break; + } + } + } + + } else if ( type == "IntList" ) { + TQTextStream rb( &code, IO_WriteOnly | IO_Append ); + if (!code.isEmpty()) + rb << endl; + + rb << " default" << name << " = []" << endl; + TQStringList defaults = TQStringList::split( ",", defaultValue ); + TQStringList::ConstIterator it; + for( it = defaults.begin(); it != defaults.end(); ++it ) { + rb << " default" << name << " << " << *it << "" + << endl; + } + defaultValue = "default" + name; + } +} + + +CfgEntry *parseEntry( const TQString &group, const TQDomElement &element ) +{ + bool defaultCode = false; + TQString type = element.attribute( "type" ); + TQString name = element.attribute( "name" ); + TQString key = element.attribute( "key" ); + TQString hidden = element.attribute( "hidden" ); + TQString label; + TQString whatsThis; + TQString defaultValue; + TQString code; + TQString param; + TQString paramName; + TQString paramType; + TQValueList choices; + TQStringList paramValues; + TQStringList paramDefaultValues; + TQString minValue; + TQString maxValue; + int paramMax = 0; + + TQDomNode n; + for ( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { + TQDomElement e = n.toElement(); + TQString tag = e.tagName(); + if ( tag == "label" ) label = e.text(); + else if ( tag == "whatsthis" ) whatsThis = e.text(); + else if ( tag == "min" ) minValue = e.text(); + else if ( tag == "max" ) maxValue = e.text(); + else if ( tag == "code" ) code = e.text(); + else if ( tag == "parameter" ) + { + param = e.attribute( "name" ); + paramType = e.attribute( "type" ); + if ( param.isEmpty() ) { + kdError() << "Parameter must have a name: " << dumpNode(e) << endl; + return 0; + } + if ( paramType.isEmpty() ) { + kdError() << "Parameter must have a type: " << dumpNode(e) << endl; + return 0; + } + if ((paramType == "Int") || (paramType == "UInt")) + { + bool ok; + paramMax = e.attribute("max").toInt(&ok); + if (!ok) + { + kdError() << "Integer parameter must have a maximum (e.g. max=\"0\"): " << dumpNode(e) << endl; + return 0; + } + } + else if (paramType == "Enum") + { + TQDomNode n2; + for ( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { + TQDomElement e2 = n2.toElement(); + if (e2.tagName() == "values") + { + TQDomNode n3; + for ( n3 = e2.firstChild(); !n3.isNull(); n3 = n3.nextSibling() ) { + TQDomElement e3 = n3.toElement(); + if (e3.tagName() == "value") + { + paramValues.append( e3.text() ); + } + } + break; + } + } + if (paramValues.isEmpty()) + { + kdError() << "No values specified for parameter '" << param << "'." << endl; + return 0; + } + paramMax = paramValues.count()-1; + } + else + { + kdError() << "Parameter '" << param << "' has type " << paramType << " but must be of type int, uint or Enum." << endl; + return 0; + } + } + else if ( tag == "default" ) + { + if (e.attribute("param").isEmpty()) + { + defaultValue = e.text(); + if (e.attribute( "code" ) == "true") + defaultCode = true; + } + } + else if ( tag == "choices" ) { + TQDomNode n2; + for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { + TQDomElement e2 = n2.toElement(); + if ( e2.tagName() == "choice" ) { + TQDomNode n3; + CfgEntry::Choice choice; + choice.name = e2.attribute( "name" ); + if ( choice.name.isEmpty() ) { + kdError() << "Tag requires attribute 'name'." << endl; + } + for( n3 = e2.firstChild(); !n3.isNull(); n3 = n3.nextSibling() ) { + TQDomElement e3 = n3.toElement(); + if ( e3.tagName() == "label" ) choice.label = e3.text(); + if ( e3.tagName() == "whatsthis" ) choice.whatsThis = e3.text(); + } + choices.append( choice ); + } + } + } + } + + bool nameIsEmpty = name.isEmpty(); + if ( nameIsEmpty && key.isEmpty() ) { + kdError() << "Entry must have a name or a key: " << dumpNode(element) << endl; + return 0; + } + + if ( key.isEmpty() ) { + key = name; + } + + if ( nameIsEmpty ) { + name = key; + name.replace( " ", TQString::null ); + } else if ( name.contains( ' ' ) ) { + kdWarning()<<"Entry '"< elements can't contain speces!"< paramMax)) + { + kdError() << "Index '" << i << "' for default value is out of range [0, "<< paramMax<<"]." << endl; + return 0; + } + + TQString tmpDefaultValue = e.text(); + + if (e.attribute( "code" ) != "true") + preProcessDefault(tmpDefaultValue, name, type, choices, code); + + paramDefaultValues[i] = tmpDefaultValue; + } + } + } + + if (!validNameRegexp->exactMatch(name)) + { + if (nameIsEmpty) + kdError() << "The key '" << key << "' can not be used as name for the entry because " + "it is not a valid name. You need to specify a valid name for this entry." << endl; + else + kdError() << "The name '" << name << "' is not a valid name for an entry." << endl; + return 0; + } + + if (allNames.contains(name)) + { + if (nameIsEmpty) + kdError() << "The key '" << key << "' can not be used as name for the entry because " + "it does not result in a unique name. You need to specify a unique name for this entry." << endl; + else + kdError() << "The name '" << name << "' is not unique." << endl; + return 0; + } + allNames.append(name); + + if (!defaultCode) + { + preProcessDefault(defaultValue, name, type, choices, code); + } + + CfgEntry *result = new CfgEntry( group, type, key, name, label, whatsThis, + code, defaultValue, choices, + hidden == "true" ); + if (!param.isEmpty()) + { + result->setParam(param); + result->setParamName(paramName); + result->setParamType(paramType); + result->setParamValues(paramValues); + result->setParamDefaultValues(paramDefaultValues); + result->setParamMax(paramMax); + } + result->setMinValue(minValue); + result->setMaxValue(maxValue); + + return result; +} + +/** + Return parameter declaration for given type. +*/ +TQString param( const TQString &type ) +{ + if ( type == "String" ) return "const TQString &"; + else if ( type == "StringList" ) return "const TQStringList &"; + else if ( type == "Font" ) return "const TQFont &"; + else if ( type == "Rect" ) return "const TQRect &"; + else if ( type == "Size" ) return "const TQSize &"; + else if ( type == "Color" ) return "const TQColor &"; + else if ( type == "Point" ) return "const TQPoint &"; + else if ( type == "Int" ) return "int"; + else if ( type == "UInt" ) return "uint"; + else if ( type == "Bool" ) return "bool"; + else if ( type == "Double" ) return "double"; + else if ( type == "DateTime" ) return "const TQDateTime &"; + else if ( type == "Int64" ) return "TQ_INT64"; + else if ( type == "UInt64" ) return "TQ_UINT64"; + else if ( type == "IntList" ) return "const TQValueList &"; + else if ( type == "Enum" ) return "int"; + else if ( type == "Path" ) return "const TQString &"; + else if ( type == "Password" ) return "const TQString &"; + else { + kdError() <<"rbtdeconfig_compiler does not support type \""<< type <<"\""<name() ) + "Item"; + + return "item" + e->name(); + +} + +TQString newItem( const TQString &type, const TQString &name, const TQString &key, + const TQString &defaultValue, const TQString ¶m = TQString::null) +{ + TQString t = "Item" + itemType( type ) + + ".new( currentGroup(), " + key + ", " + varName( name ) + param; + if ( type == "Enum" ) { + t += ".toInt"; + t += ", values" + name; + } else if ( type == "Path" ) { + t += ".toString"; + } else if ( type == "Int64" ) { + t += ".toLongLong"; + } else { + t += ".to" + itemType( type ); + } + if ( !defaultValue.isEmpty() ) { + t += ", "; + if ( type == "String" ) t += defaultValue; + else t+= defaultValue; + } + t += " )"; + + return t; +} + +TQString addItem( const TQString &type, const TQString &name, const TQString &key, + const TQString &defaultValue, const TQString ¶m = TQString::null, + const TQString ¶mName = TQString::null ) +{ + TQString t = "addItem" + itemType( type ) + + "( " + key + ", " + varName( name ) + param; + if ( type == "Enum" ) t += ", values" + name; + if ( !defaultValue.isEmpty() ) { + t += ", "; + if ( type == "String" ) t += defaultValue; + else if ( type == "Enum" ) t += enumValue(defaultValue); + else t+= defaultValue; + } + + if (!paramName.isNull()) { + t += ", \"" + paramName + "\""; + } + + t += " )"; + + return t; +} + +TQString paramString(const TQString &s, const CfgEntry *e, int i) +{ + TQString result = s; + TQString needle = "$("+e->param()+")"; + if (result.contains(needle)) + { + TQString tmp; + if (e->paramType() == "Enum") + { + tmp = e->paramValues()[i]; + } + else + { + tmp = TQString::number(i); + } + + result.replace(needle, tmp); + } + return result; +} + +TQString paramString(const TQString &group, const TQStringList ¶meters) +{ + TQString paramString = group; + TQString arguments; + int i = 0; + for( TQStringList::ConstIterator it = parameters.begin(); + it != parameters.end(); ++it) + { + if (paramString.contains("$("+*it+")")) + { + i++; + paramString.replace("$("+*it+")", "%s"); + if (i > 1) { + arguments += ", "; + } + arguments += " @param"+*it; + } + } + if (arguments.isEmpty()) + return "\""+group+"\""; + + if (i == 1) { + return "\""+paramString+"\" % "+arguments; + } else { + return "\""+paramString+"\" % ["+arguments+"]"; + } +} + +/* int i is the value of the parameter */ +TQString userTextsFunctions( CfgEntry *e, TQString itemVarStr=TQString::null, TQString i=TQString::null ) +{ + TQString txt; + if (itemVarStr.isNull()) itemVarStr=itemVar(e); + if ( !e->label().isEmpty() ) { + txt += " " + itemVarStr + ".setLabel( i18n("; + if ( !e->param().isEmpty() ) + txt += quoteString(e->label().replace("$("+e->param()+")", i)); + else + txt+= quoteString(e->label()); + txt+= ") )\n"; + } + if ( !e->whatsThis().isEmpty() ) { + txt += " " + itemVarStr + ".setWhatsThis( i18n("; + if ( !e->param().isEmpty() ) + txt += quoteString(e->whatsThis().replace("$("+e->param()+")", i)); + else + txt+= quoteString(e->whatsThis()); + txt+=") )\n"; + } + return txt; +} + +int main( int argc, char **argv ) +{ + TDEAboutData aboutData( "rbtdeconfig_compiler", I18N_NOOP("TDE .kcfg compiler"), "0.3", + I18N_NOOP("Ruby TDEConfig Compiler") , TDEAboutData::License_LGPL ); + aboutData.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org" ); + aboutData.addAuthor( "Waldo Bastian", 0, "bastian@kde.org" ); + aboutData.addAuthor( "Zack Rusin", 0, "zack@kde.org" ); + aboutData.addCredit( "Reinhold Kainhofer", "Fix for parametrized entries", + "reinhold@kainhofer.com", "http://reinhold.kainhofer.com" ); + aboutData.addCredit( "Richard Dale", "Ruby port", + "Richard_Dale@tipitina.demon.co.uk", "" ); + + TDECmdLineArgs::init( argc, argv, &aboutData ); + TDECmdLineArgs::addCmdLineOptions( options ); + + TDEInstance app( &aboutData ); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if ( args->count() < 2 ) { + kdError() << "Too few arguments." << endl; + return 1; + } + if ( args->count() > 2 ) { + kdError() << "Too many arguments." << endl; + return 1; + } + + validNameRegexp = new TQRegExp("[a-zA-Z_][a-zA-Z0-9_]*"); + + TQString baseDir = TQFile::decodeName(args->getOption("directory")); + if (!baseDir.endsWith("/")) + baseDir.append("/"); + + TQString inputFilename = args->url( 0 ).path(); + TQString codegenFilename = args->url( 1 ).path(); + + if (!codegenFilename.endsWith(".kcfgc")) + { + kdError() << "Codegen options file must have extension .kcfgc" << endl; + return 1; + } + TQString baseName = args->url( 1 ).fileName(); + baseName = baseName.left(baseName.length() - 6); + + KSimpleConfig codegenConfig( codegenFilename, true ); + + TQString nameSpace = codegenConfig.readEntry("NameSpace"); + TQString className = codegenConfig.readEntry("ClassName"); + TQString inherits = codegenConfig.readEntry("Inherits"); + TQString visibility = codegenConfig.readEntry("Visibility"); + if (!visibility.isEmpty()) visibility+=" "; + bool singleton = codegenConfig.readBoolEntry("Singleton", false); + bool customAddons = codegenConfig.readBoolEntry("CustomAdditions"); + TQString memberVariables = codegenConfig.readEntry("MemberVariables"); + TQStringList headerIncludes = codegenConfig.readListEntry("IncludeFiles"); + TQStringList mutators = codegenConfig.readListEntry("Mutators"); + bool allMutators = false; + if ((mutators.count() == 1) && (mutators[0].lower() == "true")) + allMutators = true; + itemAccessors = codegenConfig.readBoolEntry( "ItemAccessors", false ); + bool setUserTexts = codegenConfig.readBoolEntry( "SetUserTexts", false ); + + globalEnums = codegenConfig.readBoolEntry( "GlobalEnums", false ); + + TQFile input( inputFilename ); + + TQDomDocument doc; + TQString errorMsg; + int errorRow; + int errorCol; + if ( !doc.setContent( &input, &errorMsg, &errorRow, &errorCol ) ) { + kdError() << "Unable to load document." << endl; + kdError() << "Parse error in " << args->url( 0 ).fileName() << ", line " << errorRow << ", col " << errorCol << ": " << errorMsg << endl; + return 1; + } + + TQDomElement cfgElement = doc.documentElement(); + + if ( cfgElement.isNull() ) { + kdError() << "No document in kcfg file" << endl; + return 1; + } + + TQString cfgFileName; + bool cfgFileNameArg = false; + TQStringList parameters; + TQStringList includes; + + TQPtrList entries; + entries.setAutoDelete( true ); + + TQDomNode n; + for ( n = cfgElement.firstChild(); !n.isNull(); n = n.nextSibling() ) { + TQDomElement e = n.toElement(); + + TQString tag = e.tagName(); + + if ( tag == "include" ) { + TQString includeFile = e.text(); + if (!includeFile.isEmpty()) + includes.append(includeFile); + + } else if ( tag == "kcfgfile" ) { + cfgFileName = e.attribute( "name" ); + cfgFileNameArg = e.attribute( "arg" ).lower() == "true"; + TQDomNode n2; + for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { + TQDomElement e2 = n2.toElement(); + if ( e2.tagName() == "parameter" ) { + parameters.append( e2.attribute( "name" ) ); + } + } + + } else if ( tag == "group" ) { + TQString group = e.attribute( "name" ); + if ( group.isEmpty() ) { + kdError() << "Group without name" << endl; + return 1; + } + TQDomNode n2; + for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { + TQDomElement e2 = n2.toElement(); + if ( e2.tagName() != "entry" ) continue; + CfgEntry *entry = parseEntry( group, e2 ); + if ( entry ) entries.append( entry ); + else { + kdError() << "Can't parse entry." << endl; + return 1; + } + } + } + } + + if ( inherits.isEmpty() ) inherits = "KDE::ConfigSkeleton"; + + if ( className.isEmpty() ) { + kdError() << "Class name missing" << endl; + return 1; + } + + if ( singleton && !parameters.isEmpty() ) { + kdError() << "Singleton class can not have parameters" << endl; + return 1; + } + + if ( singleton && cfgFileNameArg) + { + kdError() << "Singleton class can not use filename as argument." << endl; + return 1; + } + + if ( !cfgFileName.isEmpty() && cfgFileNameArg) + { + kdError() << "Having both a fixed filename and a filename as argument is not possible." << endl; + return 1; + } + + if ( entries.isEmpty() ) { + kdWarning() << "No entries." << endl; + } + +#if 0 + CfgEntry *cfg; + for( cfg = entries.first(); cfg; cfg = entries.next() ) { + cfg->dump(); + } +#endif + + TQString implementationFileName = baseName + ".rb"; + + TQFile implementation( baseDir + implementationFileName ); + if ( !implementation.open( IO_WriteOnly ) ) { + kdError() << "Can't open '" << implementationFileName << "for writing." << endl; + return 1; + } + + TQTextStream rb( &implementation ); + + rb << "# This file is generated by rbtdeconfig_compiler from " << args->url(0).fileName() << "." << endl; + rb << "# All changes you do to this file will be lost." << endl; + rb << endl << "require 'Korundum'" << endl; + + if (singleton) { + rb << "require 'singleton'" << endl; + } + + rb << endl; + +// rb << "#ifndef " << ( !nameSpace.isEmpty() ? nameSpace.upper() + "_" : "" ) +// << className.upper() << "_H" << endl; +// rb << "#define " << ( !nameSpace.isEmpty() ? nameSpace.upper() + "_" : "" ) +// << className.upper() << "_H" << endl << endl; + + // Includes +// TQStringList::ConstIterator it; +// for( it = headerIncludes.begin(); it != headerIncludes.end(); ++it ) { +// rb << "#include <" << *it << ">" << endl; +// } + + if ( headerIncludes.count() > 0 ) rb << endl; + +// rb << "#include " << endl << endl; + + if ( !nameSpace.isEmpty() ) + rb << "module " << nameSpace << endl << endl; + + // Class declaration header + rb << "class " << className << " < " << inherits << endl; + + if (singleton) { + rb << " include Singleton" << endl << endl; + } + + // enums + CfgEntry *e; + for( e = entries.first(); e; e = entries.next() ) { + TQValueList choices = e->choices(); + if ( !choices.isEmpty() ) { + TQStringList values; + TQValueList::ConstIterator itChoice; + for( itChoice = choices.begin(); itChoice != choices.end(); ++itChoice ) { + if (globalEnums) { + values.append( enumValue((*itChoice).name) ); + } else { + values.append( enumName(e->name()) + "_" + (*itChoice).name ); + } + } + if (!globalEnums) { + values.append( enumName(e->name()) + "_COUNT" ); + } + int count = 0; + for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { + rb << " " << *it << " = " << count << endl; + } + rb << endl; + } + + TQStringList values = e->paramValues(); + if ( !values.isEmpty() ) { + int count = 0; + for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { + if (globalEnums) { + rb << " " << enumValue(*it) << " = " << count << endl; + } else { + rb << " " << enumName(e->param()) << "_" << *it << " = " << count << endl; + } + } + if (!globalEnums) { + rb << " " << enumName(e->param()) << "_COUNT = " << count << endl; + } + rb << endl; + + rb << " def " << enumName(e->param()) << "ToString(i)" << endl; + rb << " ["; + count = 0; + for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { + if (count > 0) { + rb << ", "; + } + + rb << "\"" << *it << "\""; + } + + rb << "].at(i)" << endl; + rb << " end" << endl; + } + } + + rb << endl; + + for( e = entries.first(); e; e = entries.next() ) { + TQString n = e->name(); + TQString t = e->type(); + + // Manipulator + if (allMutators || mutators.contains(n)) + { + rb << " #" << endl; + rb << " # Set " << e->label() << endl; + rb << " #" << endl; + rb << " def " << setFunction(n) << "( "; + if (!e->param().isEmpty()) + rb << " i, "; + rb << " v )" << endl; + rb << " item = findItem( \""; + if (!e->param().isEmpty()) { + rb << e->paramName().replace("$("+e->param()+")", "%s") << "\" % "; + if ( e->paramType() == "Enum" ) { + rb << " "; + if (globalEnums) + rb << enumName(e->param()) << "ToString(i)"; + else + rb << enumName(e->param()) << "ToString(i)"; + } else { + rb << "i"; + } + } else { + rb << n << "\""; + } + rb << " )" << endl; + rb << " if !item.immutable? " << endl; + rb << " item.property = " << varName(n); + if (!e->param().isEmpty()) + rb << "[i]"; + rb << " = TQt::Variant.new( v )" << endl; + rb << " end" << endl; + rb << " end" << endl << endl; + } + + // Accessor + rb << " #" << endl; + rb << " # Get " << e->label() << endl; + rb << " #" << endl; + rb << " def " << getFunction(n) << "("; + if (!e->param().isEmpty()) + rb << " " <<" i "; + rb << ")" << endl; + rb << " " << varName(n); + if (!e->param().isEmpty()) rb << "[i]"; + rb << " = findItem( \""; + if (!e->param().isEmpty()) { + rb << e->paramName().replace("$("+e->param()+")", "%s") << "\" % "; + if ( e->paramType() == "Enum" ) { + rb << " "; + if (globalEnums) + rb << enumName(e->param()) << "ToString(i)"; + else + rb << enumName(e->param()) << "ToString(i)"; + } else { + rb << "i"; + } + } else { + rb << n << "\""; + } + rb << " ).property" << endl; + rb << " return " << varName(n); + if (!e->param().isEmpty()) rb << "[i]"; + if ( e->type() == "Enum" ) { + rb << ".toInt" << endl; + } else if ( e->type() == "Int64" ) { + rb << ".toLongLong" << endl; + } else if ( e->type() == "Path" ) { + rb << ".toString" << endl; + } else { + rb << ".to" << itemType( e->type() ) << endl; + } + rb << " end" << endl; + + // Item accessor + if ( itemAccessors ) { + rb << endl; + rb << " #" << endl; + rb << " # Get Item object corresponding to " << n << "()" + << endl; + rb << " #" << endl; + rb << " def " + << getFunction( n ) << "Item("; + if (!e->param().isEmpty()) { + rb << " " << " i "; + } + rb << ")" << endl; + rb << " return " << itemVar(e); + if (!e->param().isEmpty()) rb << "[i]"; + rb << endl << " end" << endl; + } + + rb << endl; + } + + + if (customAddons) + { + rb << " # Include custom additions" << endl; + } + + + // Constructor + rb << " def initialize( "; + if (cfgFileNameArg) + rb << " config" << (parameters.isEmpty() ? " " : ", "); + for (TQStringList::ConstIterator it = parameters.begin(); + it != parameters.end(); ++it) + { + if (it != parameters.begin()) + rb << ","; + rb << " " << *it; + } + rb << " )" << endl; + + rb << " super("; + if ( !cfgFileName.isEmpty() ) rb << " \"" << cfgFileName << "\" "; + if ( cfgFileNameArg ) rb << " config "; +// if ( !cfgFileName.isEmpty() ) rb << ") "; + rb << ")" << endl; + + // Store parameters + for (TQStringList::ConstIterator it = parameters.begin(); + it != parameters.end(); ++it) + { + rb << " @param" << *it << " = TQt::Variant.new( " << *it << " )" << endl; + } + + TQString group; + for( e = entries.first(); e; e = entries.next() ) { + if ( e->group() != group ) { + group = e->group(); + rb << endl; + rb << " # " << group << endl; + } + if (e->param().isEmpty()) { + rb << " " << varName(e->name()) << " = TQt::Variant.new( " << rbType(e->type()) << " )"; + } else { + rb << " " << varName(e->name()) << " = [ "; + for (int i = 0; i < e->paramMax()+1; i++) { + if (i > 0) { + rb << ", "; + } + rb << "TQt::Variant.new( " << rbType(e->type()) << " )"; + } + rb << " ]"; + } + rb << endl; + } + + rb << endl; + + + group = TQString::null; + for( e = entries.first(); e; e = entries.next() ) { + if ( e->group() != group ) { + if ( !group.isEmpty() ) rb << endl; + group = e->group(); + rb << " setCurrentGroup( " << paramString(group, parameters) << " )" << endl << endl; + } + + TQString key = paramString(e->key(), parameters); + if ( !e->code().isEmpty()) + { + rb << e->code() << endl; + } + if ( e->type() == "Enum" ) { + rb << " values" + << e->name() << " = []" << endl; + TQValueList choices = e->choices(); + TQValueList::ConstIterator it; + for( it = choices.begin(); it != choices.end(); ++it ) { + rb << " choice = ItemEnum::Choice.new" << endl; + rb << " choice.name = \"" << enumValue((*it).name) << "\" " << endl; + if ( setUserTexts ) { + if ( !(*it).label.isEmpty() ) + rb << " choice.label = i18n(" << quoteString((*it).label) << ")" << endl; + if ( !(*it).whatsThis.isEmpty() ) + rb << " choice.whatsThis = i18n(" << quoteString((*it).whatsThis) << ")" << endl; + } + rb << " values" << e->name() << " << choice" << endl; + } + } + + if (e->param().isEmpty()) + { + // Normal case + rb << " " << itemVar(e) << " = " + << newItem( e->type(), e->name(), key, e->defaultValue() ) << endl; + + rb << " " << itemVar(e) << ".property = " << varName(e->name()) << endl; + + if ( !e->minValue().isEmpty() ) + rb << " " << itemVar(e) << ".setMinValue(" << e->minValue() << ")" << endl; + if ( !e->maxValue().isEmpty() ) + rb << " " << itemVar(e) << ".setMaxValue(" << e->maxValue() << ")" << endl; + + if ( setUserTexts ) + rb << userTextsFunctions( e ); + + rb << " addItem( " << itemVar(e); + TQString quotedName = e->name(); + addQuotes( quotedName ); + if ( quotedName != key ) rb << ", \"" << e->name() << "\""; + rb << " )" << endl; + } + else + { + // Indexed + rb << " " << itemVar(e) << " = Array.new(" << e->paramMax()+1 << ")" << endl; + for(int i = 0; i <= e->paramMax(); i++) + { + TQString defaultStr; + TQString itemVarStr(itemVar(e)+TQString("[%1]").arg(i)); + + if ( !e->paramDefaultValue(i).isEmpty() ) + defaultStr = e->paramDefaultValue(i); + else if ( !e->defaultValue().isEmpty() ) + defaultStr = paramString(e->defaultValue(), e, i); + else + defaultStr = defaultValue( e->type() ); + + rb << " " << itemVarStr << " = " + << newItem( e->type(), e->name(), paramString(key, e, i), defaultStr, TQString("[%1]").arg(i) ) + << endl; + + rb << " " << itemVarStr << ".property = " << varName(e->name())+TQString("[%1]").arg(i) << endl; + + if ( setUserTexts ) + rb << userTextsFunctions( e, itemVarStr, e->paramName() ); + + // Make mutators for enum parameters work by adding them with $(..) replaced by the + // param name. The check for isImmutable in the set* functions doesn't have the param + // name available, just the corresponding enum value (int), so we need to store the + // param names in a separate static list!. + rb << " addItem( " << itemVarStr << ", \""; + if ( e->paramType()=="Enum" ) + rb << e->paramName().replace( "$("+e->param()+")", "%1").arg(e->paramValues()[i] ); + else + rb << e->paramName().replace( "$("+e->param()+")", "%1").arg(i); + rb << "\" )" << endl; + + } + } + } + + rb << " end" << endl << endl; + + rb << "end" << endl << endl; + + if ( !nameSpace.isEmpty() ) rb << "end" << endl << endl; + + implementation.close(); +} diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/Makefile.am b/korundum/rubylib/rbtdeconfig_compiler/tests/Makefile.am new file mode 100644 index 00000000..cabfed4d --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/Makefile.am @@ -0,0 +1,40 @@ +check_PROGRAMS = test1 test2 test3 test4 test5 + +CLEANFILES = test1.rb \ + test2.rb \ + test3.rb \ + test4.rb \ + test5.rb \ + md5sums + +all: $(SOURCES) + +# Splitting this with backslashses produces broken Makefiles +SOURCES = test1main.rb test1.rb test2main.rb test2.rb test3main.rb test3.rb test4main.rb test4.rb test5main.rb test5.rb + +# avoid running the below command in parallel +test1.rb: $(srcdir)/test1.kcfg ../rbtdeconfig_compiler $(srcdir)/test1.kcfgc + ../rbtdeconfig_compiler $(srcdir)/test1.kcfg $(srcdir)/test1.kcfgc + +# avoid running the below command in parallel +test2.rb: $(srcdir)/test2.kcfg ../rbtdeconfig_compiler $(srcdir)/test2.kcfgc + ../rbtdeconfig_compiler $(srcdir)/test2.kcfg $(srcdir)/test2.kcfgc + +# avoid running the below command in parallel +test3.rb: $(srcdir)/test3.kcfg ../rbtdeconfig_compiler $(srcdir)/test3.kcfgc + ../rbtdeconfig_compiler $(srcdir)/test3.kcfg $(srcdir)/test3.kcfgc + +# avoid running the below command in parallel +test4.rb: $(srcdir)/test4.kcfg ../rbtdeconfig_compiler $(srcdir)/test4.kcfgc + ../rbtdeconfig_compiler $(srcdir)/test4.kcfg $(srcdir)/test4.kcfgc + +# avoid running the below command in parallel +test5.rb: $(srcdir)/test5.kcfg ../rbtdeconfig_compiler $(srcdir)/test5.kcfgc + ../rbtdeconfig_compiler $(srcdir)/test5.kcfg $(srcdir)/test5.kcfgc + +md5sums: + $(MD5SUM) $(srcdir)/test*.ref | sed -e "s,$(srcdir)/,,; s,\.ref$$,," > md5sums + +md5check: test1.rb test2.rb test3.rb test4.rb test5.rb md5sums + $(MD5SUM) --check md5sums + diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/myprefs.rb b/korundum/rubylib/rbtdeconfig_compiler/tests/myprefs.rb new file mode 100644 index 00000000..a4f1f082 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/myprefs.rb @@ -0,0 +1,5 @@ +class MyPrefs < KDE::ConfigSkeleton + def initialize( a ) + super( a ) + end +end diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test1.kcfg b/korundum/rubylib/rbtdeconfig_compiler/tests/test1.kcfg new file mode 100644 index 00000000..b8c23c15 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test1.kcfg @@ -0,0 +1,55 @@ + + + qdir.h + + + + + + + + true + + + + 5 + + + + And this is a longer description of this option. Just wondering, how will the translations of those be handled? + + + + + + One + + + + + + Default String + + + + TQt::Dir.homeDirPath()+".hidden_file" + + + + 10 + + + up,down + + + + + 1 + + + diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test1.kcfgc b/korundum/rubylib/rbtdeconfig_compiler/tests/test1.kcfgc new file mode 100644 index 00000000..dd086cdd --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test1.kcfgc @@ -0,0 +1,18 @@ +# Code generation options for tdeconfig_compiler +ClassName=Test1 +# +# Singleton=false +# +# Inherits=TDEConfigSkeleton +# +# IncludeFiles=libtdepim/kpimprefs.h +# +# MemberVariables=public +# +### The following line includes the file exampleprefs_base_addon.h +### It can be used to add extra functions and variables to the +### class. +# CustomAdditions=true +# +### Provide setFooBar(int) style functions +Mutators=true diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test1main.rb b/korundum/rubylib/rbtdeconfig_compiler/tests/test1main.rb new file mode 100644 index 00000000..88a151a6 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test1main.rb @@ -0,0 +1,4 @@ +require 'Korundum' +require 'test1.rb' + +t = Test1.new(nil, nil) diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test2.kcfg b/korundum/rubylib/rbtdeconfig_compiler/tests/test2.kcfg new file mode 100644 index 00000000..3b19e270 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test2.kcfg @@ -0,0 +1,78 @@ + + + + + + + + WhatsThis text for AutoSave option + false + + + 10 + + + + true + + + + + + + + + + + + + + + Argl2 Whatsthis + + + + Argl3 Whatsthis + + + standardDestination + + + + + + 10 + + + + false + + + + + + holidays,webexport + + + + + + + 100, 100, 255 + + + + 255, 255, 255 + + + + + + + + + + diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test2.kcfgc b/korundum/rubylib/rbtdeconfig_compiler/tests/test2.kcfgc new file mode 100644 index 00000000..e2904068 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test2.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for tdeconfig_compiler +File=test2.kcfg +ClassName=Test2 +Singleton=false +Mutators=true +Inherits=MyPrefs +IncludeFiles=myprefs.h +MemberVariables=public +GlobalEnums=true +ItemAccessors=true +SetUserTexts=true diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test2main.rb b/korundum/rubylib/rbtdeconfig_compiler/tests/test2main.rb new file mode 100644 index 00000000..85d18f07 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test2main.rb @@ -0,0 +1,5 @@ +require 'Korundum' +require 'myprefs.rb' +require 'test2.rb' + +t = Test2.new() diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test3.kcfg b/korundum/rubylib/rbtdeconfig_compiler/tests/test3.kcfg new file mode 100644 index 00000000..77916da4 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test3.kcfg @@ -0,0 +1,26 @@ + + + + + + + + WhatsThis text for AutoSave option + false + + + + + + 10 + + + a string + + + + + diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test3.kcfgc b/korundum/rubylib/rbtdeconfig_compiler/tests/test3.kcfgc new file mode 100644 index 00000000..d699810d --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test3.kcfgc @@ -0,0 +1,12 @@ +# Code generation options for tdeconfig_compiler +File=test3.kcfg +NameSpace=TestNameSpace +ClassName=Test3 +#Singleton=false +Mutators=true +#Inherits=MyPrefs +#IncludeFiles=myprefs.h +#MemberVariables=public +GlobalEnums=true +ItemAccessors=true +#SetUserTexts=true diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test3main.rb b/korundum/rubylib/rbtdeconfig_compiler/tests/test3main.rb new file mode 100644 index 00000000..8c19b442 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test3main.rb @@ -0,0 +1,4 @@ +require 'Korundum' +require 'test3.rb' + +t = TestNameSpace::Test3.new() diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test4.kcfg b/korundum/rubylib/rbtdeconfig_compiler/tests/test4.kcfg new file mode 100644 index 00000000..c834aa9f --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test4.kcfg @@ -0,0 +1,42 @@ + + + + + + + + + defaultColor = [ TQt::red, TQt::blue, TQt::green, TQt::black ] + defaultColor[$(Number)] + + + + + right + mid + left + + + + + + + + + + Decrypt + Encrypt + PumpNDump + + + + 35 + 8 + 88 + + + + diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test4.kcfgc b/korundum/rubylib/rbtdeconfig_compiler/tests/test4.kcfgc new file mode 100644 index 00000000..a81655b6 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test4.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for tdeconfig_compiler +File=test4.kcfg +ClassName=Test4 +Singleton=true +Mutators=true +#Inherits=MyPrefs +#IncludeFiles=myprefs.h +#MemberVariables=public +GlobalEnums=false +ItemAccessors=false +#SetUserTexts=true diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test4main.rb b/korundum/rubylib/rbtdeconfig_compiler/tests/test4main.rb new file mode 100644 index 00000000..c75f0995 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test4main.rb @@ -0,0 +1,4 @@ +require 'Korundum' +require 'test4.rb' + +t = Test4.instance() diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test5.kcfg b/korundum/rubylib/rbtdeconfig_compiler/tests/test5.kcfg new file mode 100644 index 00000000..c834aa9f --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test5.kcfg @@ -0,0 +1,42 @@ + + + + + + + + + defaultColor = [ TQt::red, TQt::blue, TQt::green, TQt::black ] + defaultColor[$(Number)] + + + + + right + mid + left + + + + + + + + + + Decrypt + Encrypt + PumpNDump + + + + 35 + 8 + 88 + + + + diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test5.kcfgc b/korundum/rubylib/rbtdeconfig_compiler/tests/test5.kcfgc new file mode 100644 index 00000000..dbc5603a --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test5.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for tdeconfig_compiler +File=test5.kcfg +ClassName=Test5 +Singleton=true +Mutators=true +#Inherits=MyPrefs +#IncludeFiles=myprefs.h +#MemberVariables=public +GlobalEnums=true +ItemAccessors=false +#SetUserTexts=true diff --git a/korundum/rubylib/rbtdeconfig_compiler/tests/test5main.rb b/korundum/rubylib/rbtdeconfig_compiler/tests/test5main.rb new file mode 100644 index 00000000..cd0fbeb7 --- /dev/null +++ b/korundum/rubylib/rbtdeconfig_compiler/tests/test5main.rb @@ -0,0 +1,4 @@ +require 'Korundum' +require 'test5.rb' + +t = Test5.instance() -- cgit v1.2.1