[lazarus] external codetools / copycat equality

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Mar 9 20:36:46 EST 2002

On Sun, 10 Mar 2002 21:20:15 +0100
Matjaz Mihelic <matooo at email.si> wrote:

Let's unstuck the bee and start a new thread for external codetools or whatever they will be called.

> [...] There is no limits. ;-)
> Main example of idea really was <#include somelibrary.h>. That would 
> call h2pas or any other translator and if it goes, it goes, otherwise I 
> thought it would produce compiling error, but the idea with some 
> learning converter as suggested bellow is fantastic. :-)
> [...]
> Specifiying in some dialog <#includeheader %1> = h2pas to activate that 
> preprocessor function or anything is nice. Generates something like 
> "BHhbdfhjydsgts.pas" and replaces <#includeheader> with normal uses this 
> new file.
> Having set language parameter in outer converter and specifiying 
> <#includelanguage> and have this resource strings compiled in some other 
> language. All except this IDE internal preprocessing is something what's 
> already possible to solve with Tools menu. I reffered either to piped 
> preprocessor, or direct to some file or anything. This option is 
> something what concerns IDE, and not compiler. C seemed to me like a 
> good example, but now I see it was the worst possible because of never 
> ending "pas & c battle" or "limitations" or "....". :-(
> [...]
> Idea was to have some Codetools option that would parse use external 
> software to preprocess. That part wasn't agreed. Ok. :-)
> [...]
> >>IMHO an option for h2pas in the IDE is not that usefull, it can only be 
> >>used for very simple .h files not for complex things like gtk/gnome.
> >>
> >
> >Just to avoid misunderstandings:
> >The frontend I have in mind, will be something of a dialog to easily manage the h2pas options and add some functions to the IDE, to make the boring search&replace easier, which is often needed before/after applying h2pas.
> >These options and editing steps can be saved to a file, so that the next time a newer version of the header files can be converted faster.
> >
> Please say that you mean external, not internal part, see your first 
> comment. I don't wanna be blamed by the society for giving a bad 
> example, that made pascal get <bad name "*ouch, hammer spell checker in 
> progress">. :-(

'course will h2pas stay external. Like compiler an debugger.
I'm also planning to add frontends for the other fpc tools. 

> >I think, this could help to accelerate the conversion process.
> >Of course I'm not a c to pascal conversion crack, and I don't know any such frontend, so I need some help to gather good ideas, what functions are needed for c to pascal conversion.
> >
> Yes, I've got the ideas to the solution (your learning kind of solution 
> would boost them indefenitelly :-P ), somehow it would be 2nd step of my 
> project, but with codetools easy included (and they will be *external 
> (command line without question) and CVS, maybe if approved even part of 
> lazarus since I'm writing them directly for lazarus), so it's far from 
> polished state. A month or two maybe as for my case. :-\
> >
> Carefull explanaton:
> 1. Again >>>>>>>> my question was made for IDE and not compiler, if it 
> would be ment to compiler www.freepascal.org would be the right place. 
> Question is about Codetools supporting some external model of user 
> defined preprocessing, which on the other hand could make to be included 
> with IDE if approwed. <<<<<<<< :-(
> 2. I wasn't asking for specific solution, I was asking for possibility 
> to the solutions like this :-\
> 3. Correct me if I'm wrong, but LCL units are not part or freepascal, so 
> anyway changes I suggested go to LCL ;-)
> 4. Reason why parsers will be external. I don't wan't to slow down 
> project lazarus, it's simply too good and as external they'll have much 
> more options and easyer updating. :-\

So much text, and still so many questions...

Hopefully, I understand you right this time:
1. You want to automate for example the conversion of foreign language code to pascal by command line tools.
2. This automatic tools will create part of pascal units or whole pascal units. For example the lazres tool converts binary files to pascal code.
3. These tools should be integrated into the IDE.
4. The "only" question is, how should they be integrated.

Parameters to the external codetools:
All tools need some parameters and/or piped sources to work with.
Your suggestion was a directive in the pascal code. 
Something like {$AutoCreateUnit h2pas -d -v header.h}
Where to put the other parameters? Maybe a config file, maybe into the directive.

When should the external codetools be invoked:
Only if the input changes. That means the IDE needs to recognize, if the last output is older than the input files. For example, if the output file is a unit, which is older than the input file, then the IDE would automatically invoke the tool, when the unit is needed during compilation (similar to make). In this case, auto created units are readonly.

What is produced:
- Pascal units
- messages (errors, warnings, ...)

I'm still not happy with the directive in the source, since I prefer a nice dialog, but perhaps I still misunderstood you. I like the idea of auto created units, although I'm not sure about the how.


More information about the Lazarus mailing list