On Nov 24, 2011, at 10:49 AM, Gabriel Kerneis wrote:

> On Thu, Nov 24, 2011 at 10:38:34AM +0100, Dimiter Milushev wrote:
>
>> I imagine one way is to possibly use CIL on a file that is not  
>> preprocessed?
>> The reason I am asking is that I need a transformation that will keep
>> some structured comments and be based on them.
>> Thus I am not interested in dropping all comments, but rather
>> analyzing them and keeping some of them.
>> Is this feasible in CIL?
>
> No, unfortunately there is no way to keep comments in CIL.

Frama-C's front-end (http://frama-c.com/ )
is a modified version of CIL. Some of the changes
incorporate the possibility to look at comments.

It is up to you to decide whether you can live with the
other differences between Frama-C and CIL. The list
of differences has over the years grown
to "too numerous to list", but if you are not too far yet
in your project, you may consider switching.

Pascal

 From src/kernel/globals.mli:
(*  
************************************************************************* *)
(** {2 Comments} *)
(*  
************************************************************************* *)

val get_comments_global: global -> string list
(** Gets a list of comments associated to the given global. This  
function
     is useful only when -keep-comments is on.

     A comment is associated to a global if it occurs after
     the declaration/definition of the preceding one in the file,  
before the end
     of the current declaration/definition and does not occur in the
     definition of a function. Note that this function is experimental  
and
     may fail to associate comments properly. Use directly
     {! Cabshelper.Comments.get} to retrieve comments in a given region.
     (see {!Globals.get_comments_stmt} for retrieving comments  
associated to
     a statement).

     @since Nitrogen-20111001
*)

val get_comments_stmt: stmt -> string list
(** Gets a list of comments associated to the given global. This  
function
     is useful only when -keep-comments is on.

     A comment is associated to a global if it occurs after
     the preceding statement and before the current statement ends  
(except for
     the last statement in a block, to which statements occuring  
before the end
     of the block are associated). Note that this function is  
experimental and
     may fail to associate comments properly. Use directly
     {! Cabshelper.Comments.get} to retrieve comments in a given region.

     @since Nitrogen-20111001
*)


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to