Code generation for GTK+ apps

Seems like there is a lot of interest in generating code that uses GTK+
as a standard GUI lib. This is a good sign that things are maturing, and
GLADE certainly is an excellent peice of work so far. No doubt in future
there will be things that layer on top of that until we have some truly
decent CASE tools. While I appreciate that this is a GTK+ mailing list
and not a CASE tools mailing list, I hope that you will bear with me
because this is becoming an important direction that GTK+ is moving

On the subject of code generation from higher level tools, the problem
always arises where you want to be able to add tweaks to the generated
code, but not have them clobbered when the higher level tool regenerates
the code. Some high level tools try to solve this by allowing the tweaks
to be defined up at the IDE layer, but the end result is usually a
restricted development environment and a bloated binary (vis Visual
Basic, 4GL's, etc). There is simply no substitute for loading up raw
source code in vi or emacs and doing what has to be done.

Another approach discussed here previously involves having the generator
embedding tags in the code, and then relying on the developer to tread
carefully when changing the generated code. This works pretty well for
95% of cases, but there are still some cases where you need to make
serious hacks to the generated code and there is no simple way of
telling the generator not to override your hacks. This scenario will be
familiar to developers who have used VC++ and it's embedded wizards. 

A third option that I am considering using for my own generator will
work something like this -
(I have not tried this yet, and I have no idea if it will work, so
please give me some feedback)

- The code generator spits out a .gen file, which is pure untouched C
- The code generator then copies the .gen to the .c if it does not exist
- The developer then hops out of the IDE and into the shell where some
serious hacking of the .c file occurs. This may involve some new code
being added along side the generated code, as well as some of the
generated code being subtly modified.
- Days later, back in the IDE, some high-level changes to the
application are made
- New version of the code is generated, firstly the IDE creates
something like a diff patch file that compares the old .gen to the
current .c files. Then new .gen files are generated, and the patches are
then applied to the new .gen's to arrive at the new .c files. (a copy of
the old hacked .c being copied to .c.bak)

Those files that are radically patched will probably have to be viewed
by the coder before being compiled. 

I am wondering if it is remotely feasible to do this. Is there some sort
of threshold of change at which point a patch file becomes becomes
useless ?  If the standard patch method is not up to the job, then
writing a custom one just for this task would be non-trivial, but doable
none the less.

If it is possible, then we can deliver a world class high level
development environment that makes a mockery of other commercial tools.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]