* Refactoring with CEDET
@ 2008-05-03 10:17 grischka
2008-05-03 12:02 ` Eric M. Ludlam
[not found] ` <mailman.11141.1209818894.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 3+ messages in thread
From: grischka @ 2008-05-03 10:17 UTC (permalink / raw)
To: eric; +Cc: help-gnu-emacs
Hi,
I have some code where I want to convert a bunch of (~100) global
variables into members of a structure. That means:
- find all functions that use these variables
- patch their declarations to take the struct* as additional parameter
int func(int x) ==> int func(State *s, int x)
- insert the struct* as one more argument into calls to these functions
func(n); ==> func(s, n);
- prefix all occurrences of the variables with the struct pointer
var ==> s->var
Is it possible to do this (semi-?) automatically with CEDET?
Thanks,
--- grischka
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Refactoring with CEDET
2008-05-03 10:17 Refactoring with CEDET grischka
@ 2008-05-03 12:02 ` Eric M. Ludlam
[not found] ` <mailman.11141.1209818894.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: Eric M. Ludlam @ 2008-05-03 12:02 UTC (permalink / raw)
To: grischka; +Cc: help-gnu-emacs, cedet-devel
Hi,
The CEDET infrastructure does not currently support everything you
are looking to do. Details below:
>>> "grischka" <grishka@gmx.de> seems to think that:
>Hi,
>
>I have some code where I want to convert a bunch of (~100) global
>variables into members of a structure. That means:
>
>- find all functions that use these variables
CEDET/Semantic does not parse the contents of functions. This is for
two reasons. 1) Speed up parsing. 2) Speed up writing parsers.
>- patch their declarations to take the struct* as additional parameter
> int func(int x) ==> int func(State *s, int x)
The ability to perform this permutation is in CEDET/Srecode (CVS
version only), but there is no user-facing routine built for this
situation. Also, the way routines like this are built is still in a
testing stage. If anyone wants to try this, I'll help you out.
>- insert the struct* as one more argument into calls to these functions
> func(n); ==> func(s, n);
There is some very basic infrastructure in this area for identifying
function argument locations, but nothing concrete.
>- prefix all occurrences of the variables with the struct pointer
> var ==> s->var
Again, an issue with finding the users.
>Is it possible to do this (semi-?) automatically with CEDET?
The CEDET infrastructure has focused on declarative tools, and would
form a fine baseline for tools like this, but it does not support it
now. The most glaring issue is that function bodies are not parsed.
Databases of how things are assembled seems best suited to compilers
or, failing that, perhaps grep or a textual indexer. For languages
that use include like syntax, CEDET could tell you all files that
reference the include which could be used in a grep call. CEDET could
then tell you if a grep hit were an actual use or not and help move
your cursor. The template system would let you craft templates for
insertion.
Refactoring operations have been on my todo list for a long time but
have been blocked by the building of the infrastructure.
Eric
--
Eric Ludlam: eric@siege-engine.com
Siege: www.siege-engine.com Emacs: http://cedet.sourceforge.net
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Refactoring with CEDET
[not found] ` <mailman.11141.1209818894.18990.help-gnu-emacs@gnu.org>
@ 2008-05-06 2:45 ` rustom
0 siblings, 0 replies; 3+ messages in thread
From: rustom @ 2008-05-06 2:45 UTC (permalink / raw)
To: help-gnu-emacs
Can you point me to some language parsers that use semantic/cedet?
Just curious what can be done with these tools...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-06 2:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-03 10:17 Refactoring with CEDET grischka
2008-05-03 12:02 ` Eric M. Ludlam
[not found] ` <mailman.11141.1209818894.18990.help-gnu-emacs@gnu.org>
2008-05-06 2:45 ` rustom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).