--- layout: fc_discuss_archives title: Message 110 from Frama-C-discuss on September 2013 ---
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Whether could I know in advance it would have errors before adding a file (Kernel.Files.add)?



>
> you can try to parse the file alone in an independent project and
> catch the exception that is raised by the parser in case of user
> error. e.g. something like (not tested)
> ...
> let prepare_file f = try File.init_from_c_files [File.from_filename
> f]; true with Log.AbortError s -> MyPlugin.warning "Not adding %s
> because of %s" f s; false in
> let prj = Project.create "tmp" in
> let is_ok = Project.on prj prepare_file "foo.c" in
> Project.remove prj;
> if is_ok then Kernel.Files.add "foo.c";
> ...
> Best regards,
> --
> E tutto per oggi, a la prossima volta
> Virgile


Dear Virgile,

Thank you for providing me this solution. It works fine.

Best regards,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20130917/a0ab61fc/attachment-0001.html>