From: Stefan S. <sse...@ar...> - 2004-11-01 18:02:25
|
> From: Iwan Birrer [mailto:ib...@co...] > Sent: November 1, 2004 12:06 > Is it possible to transform C/C++ source code in a way that > the layout of > the original source code is preserved? Or is it possble to parse and > anylize code while the layout information is available is the AST. The layout of the original code is preserved. All changes you apply to the parse tree are local and don't affect the code outside the scope of the modified nodes. However, preprocessing is a separate stage that is delegated from 'occ' down to an external tool. I don't think comments are currently preserved when the preprocessor is invoked that way. If you need this you may want to preprocess the file yourself (using 'gcc -E -C' for example) and then invoke 'occ' on the result. But I could be wrong. Grzegorz ? Regards, Stefan |
From: Stefan S. <sse...@ar...> - 2004-11-13 21:44:08
|
Hi Iwan, From: Iwan Birrer >I do not only want the comments to be preserved, but also: macros, >file/directory structure, includes etc. Actally everything, so the >transformed code would be equal to the base code if only a dummy >transformation is being made. What exactly are you trying to do ? What you are asking for is generally impossible, as preprocessing is a separate process. In the context of the synopsis project I'v managed to retain most of the information you require, but not to regenerate the original code, but to be able to treat macros as first-class citizens in the structure I use to generate code documentation and to hyperlink the original code to the docs. You may have a look into this work at http://synopsis.fresco.org, though, I reiterate, regenerating the un-preprocessed code is impossible as of now and there are no plans to work on anything towards such a feature. If you are going to compile the newly generated code you only need equivalent code, and for that the requirements are much less stringent as far as code generation is concerned. Regards, Stefan |
From: Grzegorz J. <ja...@ac...> - 2004-11-14 15:08:22
|
Stefan Seefeld wrote: [...] >You may have a look into this work at http://synopsis.fresco.org, >though, I reiterate, regenerating the un-preprocessed code is >impossible as of now and there are no plans to work on anything >towards such a feature. > > This applies to Synopsis, not OpenC++. Understanding unpreprocessed input is among goals of OpenC++Core library. BR Grzegorz |
From: Grzegorz J. <ja...@ac...> - 2004-11-02 11:25:55
|
Stefan Seefeld wrote: >>From: Iwan Birrer [mailto:ib...@co...] >>Sent: November 1, 2004 12:06 > > >>Is it possible to transform C/C++ source code in a way that >>the layout of >>the original source code is preserved? Or is it possble to parse and >>anylize code while the layout information is available is the AST. > > > The layout of the original code is preserved. All changes you apply to > the parse tree are local and don't affect the code outside the scope > of the modified nodes. > > However, preprocessing is a separate stage that is delegated > from 'occ' occ2 > down to an external tool. I don't think comments are currently > preserved when the preprocessor is invoked that way. If you need this > you may want to preprocess the file yourself (using 'gcc -E -C' for > example) and then invoke 'occ' on the result. > But I could be wrong. Grzegorz ? Right modulo 'occ2'. BR Grzegorz |
From: Iwan B. <ib...@co...> - 2004-11-13 13:08:28
|
I do not only want the comments to be preserved, but also: macros, =20 file/directory structure, includes etc. Actally everything, so the =20 transformed code would be equal to the base code if only a dummy =20 transformation is being made. Regards, Iwan On Tue, 02 Nov 2004 19:20:19 +0800, Grzegorz Jakacki <ja...@ac...> =20 wrote: > > > Stefan Seefeld wrote: >>> From: Iwan Birrer [mailto:ib...@co...] >>> Sent: November 1, 2004 12:06 >> >>> Is it possible to transform C/C++ source code in a way that the layou= t =20 >>> of >>> the original source code is preserved? Or is it possble to parse and >>> anylize code while the layout information is available is the AST. >> The layout of the original code is preserved. All changes you apply = to >> the parse tree are local and don't affect the code outside the scope >> of the modified nodes. >> However, preprocessing is a separate stage that is delegated >> from 'occ' > > occ2 > > > down to an external tool. I don't think comments are currently >> preserved when the preprocessor is invoked that way. If you need this >> you may want to preprocess the file yourself (using 'gcc -E -C' for >> example) and then invoke 'occ' on the result. >> But I could be wrong. Grzegorz ? > > Right modulo 'occ2'. > > BR > Grzegorz > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=3D5588&alloc_id=3D12065&op=3Dclick > _______________________________________________ > Opencxx-users mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opencxx-users On Tue, 02 Nov 2004 19:20:19 +0800, Grzegorz Jakacki <ja...@ac...> =20 wrote: > > > Stefan Seefeld wrote: >>> From: Iwan Birrer [mailto:ib...@co...] >>> Sent: November 1, 2004 12:06 >> >>> Is it possible to transform C/C++ source code in a way that the layou= t =20 >>> of >>> the original source code is preserved? Or is it possble to parse and >>> anylize code while the layout information is available is the AST. >> The layout of the original code is preserved. All changes you apply = to >> the parse tree are local and don't affect the code outside the scope >> of the modified nodes. >> However, preprocessing is a separate stage that is delegated >> from 'occ' > > occ2 > > > down to an external tool. I don't think comments are currently >> preserved when the preprocessor is invoked that way. If you need this >> you may want to preprocess the file yourself (using 'gcc -E -C' for >> example) and then invoke 'occ' on the result. >> But I could be wrong. Grzegorz ? > > Right modulo 'occ2'. > > BR > Grzegorz > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=3D5588&alloc_id=3D12065&op=3Dclick > _______________________________________________ > Opencxx-users mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opencxx-users |