Hello Lazarus-List, Monday, March 8, 2010, 12:59:53 PM, you wrote:
HPD> IMO you don't know enough about the real problems. Even a C parser must HPD> know about type names, so that proper detection and handling of all HPD> typedefs is vital, what means that the implementation of an preprocessor HPD> is inevitable. I know the real problems, that's the reason I talk about a "simple" helper, that can perform trivial tasks, but keystroke repetitive, nothing fancy which would require a lot of parsing, preprocessing and even intuition. I think it is not very complex to change: "int a;" in "a: integer;" or something like: int myf(char *a); { a[1]=\0; return strlen(a); } in function myf(a: pchar): integer; begin a[1]:=#0; Result:=strlen(a); end; Of course there are much more complex examples that this easy ones, but I was not talking about a procedure that changes the strlen in a valid pascal function, simply convert the known plain syntax without type checking or alike habilities. >> Integrating this in the IDE could help to convert function by >> function, without too many changes. HPD> This would be possible, but IMO a useful translator should be an HPD> interactive tool of its own. The source code could be analyzed and split HPD> into sections by such a tool, where some sections (declarations!) must HPD> be converted by the user, before the translator can do the stupid work HPD> of translating the code blocks inside subroutines. The user will have to HPD> spend much time in replacing the references to symbols in header files, HPD> and in writing stubs that call the RTL equivalents of the original C HPD> functions. I have some experience with full source translators and finally after some lines of well translated code something "unknown" is found, marked as such and after that or everything is marked as unknown or are completly wrong. Finally I end up making 95% of the work manually because the translator refuses to work in only a piece(s) of code :( HPD> IMO the integration of an true C++ compiler, like CBuilder, would make HPD> FPC/Lazarus much more intersting and useful in real life, removing the HPD> need to translate existing (legacy or library[1]) C/C++ code. I don't HPD> know how far a mix of Pascal and C/C++ object code is already possible, HPD> based on the unified object file formats, but a direct interface to C HPD> code by using compiler-created library units were really great. That sounds too complex to my skills :( -- Best regards, JoshyFun -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus