D26202: WIP: Refactor KConfigXT

Tomaz Canabrava noreply at phabricator.kde.org
Tue Dec 24 09:48:05 GMT 2019


tcanabrava added a comment.


  In D26202#582541 <https://phabricator.kde.org/D26202#582541>, @ngraham wrote:
  
  > > This is really a wip, completely broken. It's just so people can point me to the right direction.
  >
  > Maybe could you clarify which direction you want to be pointed in? What's the goal here? What do you need help with?
  
  
  Fair Enough:
  
  The current KConfigXT compiler is in a sad state: 
  It's a massive file with loads of global variables that handle state, the generator is done within the main() function and it seems to have grown organically. There are no classes to separate logic / state / generation, what exists is code that generates code from a xml / ini pair, but it's hard to even discover what a bit of code is doing. The code istyle is C++ / Java from the nineties, which is not bad per see but it also uses quite a few things that are going to be deprecated in Qt 6 so I'm also taking the time make the code more streamlined with newer code style (no iterators, lambdas, auto usage, etc).
  
  The code that generates the files simplly pushes strings to a text stream, and it's hard to figure out when something starts or something ends: for instance, the code that generates the Constructor has more than sixty lines of code englobing some nested if - for - if - for constructs.
  
  This code tries to Separate the compiler code into many different files / classes to be more obvious what's happening, and each class also has many helper methods to minimize copypaste.
  
  - CodeGenerator: Has base code for the header and source files that can be shared
  - HeaderGenerator: Logic for generating the header file
  - SourceGenerator: Logic for generating the source file
  - KcfgParser: Logic for parsing the kcfg file and extracting the information
  - CommonStructs: a header that contains the structs that are currently used everywhere.
  - KConfigParameters: (was CfgConfig - ConfigConfig, wat) - Has information passed via the kcfgc file
  - kcfg_compiler - will be renamed to main - start the other classes and generates the files.
  
  This code here currently has the begining of this separation, with the CodeGenerator and the HeaderGenerator in a ~good~ state, but unfinished.

REPOSITORY
  R237 KConfig

REVISION DETAIL
  https://phabricator.kde.org/D26202

To: tcanabrava
Cc: ngraham, kde-frameworks-devel, LeGast00n, GB_2, michaelh, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191224/2b654f30/attachment.html>


More information about the Kde-frameworks-devel mailing list