Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Programmatically update macros in a header file

Using CRefactoring class isn't applicable to my situation because I will provide my own view. So I tried using the ASTRewrite class but it does not seem to support rewriting macros in a header file. I get an exception: "Rewriting preprocessor statements is not yet supported". Can anyone confirm this. Thanks.

I resulted to manually rewriting the header file with the macros enumerated. However, this method does not preserve the tab spacing for the macros and the code comments.

Regards,
Richmond
 

On Sat, Aug 5, 2017 at 12:00 AM, <cdt-dev-request@xxxxxxxxxxx> wrote:
Send cdt-dev mailing list submissions to
        cdt-dev@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        https://dev.eclipse.org/mailman/listinfo/cdt-dev
or, via email, send a message with subject or body 'help' to
        cdt-dev-request@xxxxxxxxxxx

You can reach the person managing the list at
        cdt-dev-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of cdt-dev digest..."


Today's Topics:

   1. Re: Thoughts on LSP / Clangd integration (Doug Schaefer)
   2. Programmatically update macros in a header file (Richmond Umagat)
   3. Re: Programmatically update macros in a header file
      (Doug Schaefer)


----------------------------------------------------------------------

Message: 1
Date: Thu, 3 Aug 2017 16:35:55 +0000
From: Doug Schaefer <dschaefer@xxxxxxxxxxxxxx>
To: CDT General developers list. <cdt-dev@xxxxxxxxxxx>
Subject: Re: [cdt-dev] Thoughts on LSP / Clangd integration
Message-ID: <45A7F0E987B6E94A804A9CF906DC05D33BEDDF@xxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="us-ascii"

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@eclipse.org]
> On Behalf Of Nathan Ridge
> Sent: Thursday, August 3, 2017 1:06 AM
> To: CDT General developers list. <cdt-dev@xxxxxxxxxxx>
> Subject: Re: [cdt-dev] Thoughts on LSP / Clangd integration
>
> Thanks for your thoughts Doug.
>
> > my gut tells me it may actually be less work to start a new editor
>
> Just to make sure I'm understanding correctly: do you mean a new editor to
> combine editor functions powered by LSP with editor functions powered by
> our existing parser, or a new editor for LSP functionality only?

That's a good question. I guess it should do both and we have a toggle that selects which system to use.

I just fear that the toggle will spread through a lot of code. For example, I've been looking at the refactorings we have. They'll all have to be totally redone which would mean each of the actions will have to look at the toggle to know what to do. How many other things do we have like that? Starting with a fresh new editor is a plan not to have to deal with that and just add features as they're ready.

Open to suggestions.

>
> Thanks,
> Nate
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit https://dev.eclipse.org/mailman/listinfo/cdt-dev


------------------------------

Message: 2
Date: Fri, 4 Aug 2017 16:51:37 +0800
From: Richmond Umagat <richmond.umagat@xxxxxxxxx>
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] Programmatically update macros in a header file
Message-ID:
        <CAOWybMYyA4tGj1aQYDR2bmaxOXiQYXeGYJ2ATh0x9JTaAR8E0g@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,


I need to create a view where user can READ and UPDATE the macro values in
a header file of a C application.

Is there an efficient way for Eclipse CDT to programmatically READ and
MODIFY the macro definitions in a header file of a C application? How? Or
do I have to manually read, parse and update the file?

So far I am able to read macros in a file via IIndexManager
or ITranslationUnit. However, these options do not seem to provide a way to
update the macros.

Any help will be appreciated. Thank you.


Regards,
Richmond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/cdt-dev/attachments/20170804/ea948a8c/attachment.html>

------------------------------

Message: 3
Date: Fri, 4 Aug 2017 14:27:40 +0000
From: Doug Schaefer <dschaefer@xxxxxxxxxxxxxx>
To: CDT General developers list. <cdt-dev@xxxxxxxxxxx>
Subject: Re: [cdt-dev] Programmatically update macros in a header file
Message-ID: <45A7F0E987B6E94A804A9CF906DC05D33BF5B4@xxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="utf-8"

One idea is to take a look at the Refactoring code. For example ExtractFunctionRefactoring. I?ve been using that as an example for a new editor I?m building which edits the code based on changes in the Properties View. Essentially you just need to create TextEdits and wrap them up in a Change object and the Refactoring engine takes care of the rest.

HTH,
Doug.

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@eclipse.org] On Behalf Of Richmond Umagat
Sent: Friday, August 4, 2017 4:52 AM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] Programmatically update macros in a header file

Hi,


I need to create a view where user can READ and UPDATE the macro values in a header file of a C application.

Is there an efficient way for Eclipse CDT to programmatically READ and MODIFY the macro definitions in a header file of a C application? How? Or do I have to manually read, parse and update the file?

So far I am able to read macros in a file via IIndexManager or ITranslationUnit. However, these options do not seem to provide a way to update the macros.

Any help will be appreciated. Thank you.


Regards,
Richmond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/cdt-dev/attachments/20170804/80c845ad/attachment.html>

------------------------------

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev

End of cdt-dev Digest, Vol 150, Issue 5
***************************************


Back to the top