help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[1]: Refactoring with CEDET


From: Eric M. Ludlam
Subject: Re[1]: Refactoring with CEDET
Date: Sat, 3 May 2008 08:02:05 -0400

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]