> Message: 1 > Date: Tue, 10 Mar 2009 15:36:01 +0000 > From: Tom Wright <tom.wri...@resolversystems.com> > Subject: [CIL users] sal.h annotations confuse the preprocessor > To: cil-users@lists.sourceforge.net > Message-ID: <49b688e1.8020...@resolversystems.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > I'm having some trouble parsing code produced by the visual studio 2008 > preprocessor using CIL as a library. This appears to be happening > because sal.h includes decorations like c# annotations: > ... > This is not a problem in visual studio 2005. So I'm working round this > by falling back to visual studio 2005. But thought you might like to > know this.
Hi Tom, I run this function after cpp, and before I call Frontc.parse, to remove these annotations: (** VS2008 fix: remove SAL annotations before running FrontC. *) let remove_sal infile outfile = let in_ch = open_in infile in let out_ch = open_out outfile in try let e = "" in while true; do let l = input_line in_ch in let l = Str.global_replace (Str.regexp "\\[.*source_annotation_attribute[^]]*\\]") e l in (* Bizarre ocaml syntax where you don't have to escape a special char-----^----- *) (* as long as it's the first one in the char set. *) let l = Str.global_replace (Str.regexp "\\[.*returnvalue[^]]*\\]") e l in let l = Str.global_replace (Str.regexp "\\[.*SA_Pre[^]]*\\]") e l in let l = Str.global_replace (Str.regexp "\\[.*SA_Post[^]]*\\]") e l in let l = Str.global_replace (Str.regexp "\\[.*SA_FormatString[^]]*\\]") e l in Printf.fprintf out_ch "%s\n" l done; with End_of_file -> close_in in_ch; close_out out_ch It might be useful to you too! Samin ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ CIL-users mailing list CIL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cil-users