frama-c-Magnesium-20151002/ 0000755 0001750 0001750 00000000000 12645746461 014154 5 ustar mehdi mehdi frama-c-Magnesium-20151002/INSTALL 0000644 0001750 0001750 00000030004 12645746441 015200 0 ustar mehdi mehdi -------------------------
INSTALLATION INSTRUCTIONS
-------------------------
===============================================================================
SUMMARY
===============================================================================
0) Summary
1) Automatic Installation
2) Quick Start
3) Requirements
4) Configuration
5) Compilation
6) Installation
7) Custom Installation
8) Testing the Installation
9) Installation of additional plug-ins
10) API Documentation
11) Uninstallation
12) Have Fun with Frama-C!
===============================================================================
AUTOMATIC INSTALLATION
===============================================================================
----------------------------------------------------
Debian >= Squeeze 6.0 and Ubuntu >= Lucid Lynx 10.04
----------------------------------------------------
If you are using Debian >= Squeeze 6.0 or Ubuntu >= Lucid Lynx 10.04 then
a Frama-C package is provided:
sudo apt-get install frama-c
or, if you don't want the Gtk-based GUI:
sudo apt-get install frama-c-base
It might be **not** up-to-date with the latest Frama-C release.
------------
Fedora >= 13
------------
If you are using Fedora >= 13 then a Frama-C package is provided:
yum install frama-c
It might be **not** up-to-date with the latest Frama-C release.
----
Opam
----
Opam (http://opam.ocamlpro.com) is a package manager for OCaml libraries and
applications, that runs under Linux and Mac OS X. There is a package for
Frama-C, so that if you have opam installed, you just have to type
opam install frama-c
Note however that you may need to install Gtk, GtkSourceView and GnomeCanvas
separately. These are C libraries with OCaml bindings that are used by the
GUI. To get the exact list of packages that are needed, use
opam install depext
opam depext frama-c
and install the packages listed as missing.
------------------------
Opam from custom sources
------------------------
If you have a non-standard version of Frama-C available (containing proprietary
extensions, custom plugins, etc.), you can install it through
Opam using the commands:
#remove the previous version of frama-c
opam remove --force frama-c frama-c-base
# All these packages are optional. However, zarith is strongly recommended,
# and the other packages are required for the GUI
opam install depext
opam depext zarith lablgtk conf-gtksourceview conf-gnomecanvas
opam install zarith lablgtk conf-gtksourceview conf-gnomecanvas
# Install the custom version of frama-c
opam pin add frama-c-base
where is the root of the unpacked Frama-C distribution
-----------------
Wodi (Windows OS)
-----------------
Wodi (http://wodi.forge.ocamlcore.org/) is a package manager for OCaml libraries
and applications that specifically target the Windows platform. It features
a GUI, so that you just have to select the Frama-C package from there.
--------
Mac OS X
--------
OPAM works perfectly on Mac OS via Homebrew.
Recommended installation:
# General Mac-OS Tools for OCaml:
> xcode-select --install
> open http://brew.sh
> brew install git autoconf meld opam
# Graphical User Interface:
> brew install gtk+ --with-jasper
> brew install gtksourceview libgnomecanvas graphviz
> opam install lablgtk ocamlgraph
# Recommended for Frama-C:
> brew install gmp
> opam install zarith
# Necessary for Frama-C/WP:
> opam install alt-ergo
# Also recommended for Frama-C/WP:
> opam install altgr-ergo coq coqide why3
===============================================================================
The remainder of these installation instructions is for building Frama-C from
source.
QUICK START
===============================================================================
1) Install OCaml if not already installed.
1b) Optionally, for the GUI, also install Gtk, GtkSourceView, GnomeCanvas and
Lablgtk2 if not already installed. If possible, also install Zarith.
See section 'REQUIREMENTS' below for indications on the names of the
packages to install, or use 'opam depext' as explained in section 'Opam'
above.
2a) On Linux-like distribution:
./configure && make && sudo make install
See section CONFIGURATION below for options
2b) On Windows+Cygwin or Windows+MinGW+msys:
./configure --prefix C:/windows/path/with/direct/slash/no/space && make && make install
3) The binary frama-c (and frama-c-gui if you have lablgtk2) is now installed.
4) Optionally, test your installation by running:
frama-c -val tests/misc/CruiseControl*.c
frama-c-gui -val tests/misc/CruiseControl*.c (if frama-c-gui is available)
See below for more detailed and specific instructions.
===============================================================================
REQUIREMENTS
===============================================================================
- GNU make version >= 3.81
- Objective Caml 4.x (except 4.02.2, 4.02.0 and 4.00.0)
- a C compiler with standard C and POSIX headers and libraries
The Frama-C GUI also requires:
- Gtk (>= 2.4)
- GtkSourceView 2.x
- GnomeCanvas 2.x
- LablGtk >= 2.14.0 (and >= 2.18.2 if you use OCaml >= 4.02.1)
If OcamlGraph 1.8.5 or 1.8.6 [1] is already installed, then it will be used by
Frama-C. Otherwise the distributed local copy (file ocamlgraph.tar.gz) will be
used.
If Zarith [2] is installed, it will be used by Frama-C. Otherwise another
equivalent less efficient library will be use.
Plug-ins may have their own requirements.
Consult their specific documentations for details.
[1] OcamlGraph: http://ocamlgraph.lri.fr
[2] Zarith: http://forge.ocamlcore.org/projects/zarith
--------------------------
Ubuntu >= Lucid Lynx 10.04
--------------------------
If you are using Ubuntu >= Precise Pangolin 12.04 then an optimal list of
packages is installed by:
sudo apt-get install ocaml ocaml-native-compilers graphviz \
libzarith-ocaml-dev libfindlib-ocaml-dev \
liblablgtksourceview2-ocaml-dev liblablgtk2-gnome-ocaml-dev
------
Fedora
------
If you are using a recent Fedora, an optimal list of packages can be installed
through (replace dnf by yum in older version of Fedora):
sudo dnf install ocaml graphviz \
ocaml-zarith-devel ocaml-findlib ocaml \
ocaml-lablgtk-devel gtksourceview2-devel libgnomecanvas-devel
-------------------
Other Linux systems
-------------------
Some other Linux systems (e.g. Fedora) provide packages for the required tools
and libraries. Please look at your favorite one.
Anyway, on any Linux systems, you may use Godi
(http://godi.camlcity.org/godi/index.html) for installing Frama-C with all the
OCaml requirements (but you must install C libraries and tools before).
===============================================================================
CONFIGURATION
===============================================================================
Frama-C is configured by "./configure [options]"
configure is generated by autoconf, so that the standard options for setting
installation directories are available, in particular '--prefix=/path'.
A plug-in can be enabled by --enable-plugin and disabled by --disable-plugin.
By default, all distributed plug-ins are enabled. Those who defaults to 'no'
are not part of the Frama-C distribution (usually because they are too
experimental to be released as is).
See ./configure --help for the current list of plug-ins, and available options.
Under Cygwin or MinGW:
----------------------
Use "./configure --prefix C:/windows/path/with/direct/slash".
===============================================================================
COMPILATION
===============================================================================
Type "make".
Some Makefile targets of interest are:
- doc generates the API documentation
- top generates an OCaml toplevel embedding Frama-C as a library.
- ptests generates the executable that takes care of running Frama-C's tests
- oracles set up the tests oracle of Frama-C test suite for your own
configuration.
- tests performs Frama-C's own tests (use it after oracles)
===============================================================================
INSTALLATION
===============================================================================
Type "make install"
(depending on the installation directory, may require superuser privileges).
It is possible to install in a given directory by setting
the DESTDIR variable: "make install DESTDIR=/tmp" installs Frama-C in
sub-directories of /tmp.
The following files are installed.
Executables: (usually in /usr/local/bin)
------------
- frama-c
- frama-c-gui if available
- frama-c.byte bytecode version of frama-c
- frama-c-gui.byte bytecode version of frama-c-gui, if available
- ptests.opt testing tools for Frama-c
- frama-c.toplevel if 'make top' previously done
Shared files: (usually in /usr/local/share/frama-c and subdirectories)
-------------
- some .h and .c files used as preludes by Frama-C;
- some Makefiles used to compile dynamic plug-ins
- some .rc files used to configure Frama-C
- some image files used by the Frama-C GUI
Manuals: (usually in /usr/local/share/frama-c/manuals)
--------
- the Frama-C manuals as .pdf files
Documentation files: (usually in /usr/local/share/frama-c/doc)
--------------------
- files used to generate dynamic plug-in documentation
Object files: (usually in /usr/local/lib/frama-c)
-------------
- object files used to compile dynamic plug-ins
Plug-in files: (usually in /usr/local/lib/frama-c/plugins)
--------------
- object files of available dynamic plug-ins
Man files: (usually in /usr/local/man/man1)
----------
- man files for frama-c (and frama-c-gui if available)
===============================================================================
CUSTOM INSTALLATION
===============================================================================
You can manually move any installed files. However, in such a case, you have to
set specific environment variables in order that Frama-C found the appropriate
objects when required.
The environment variables are:
------------------------------
FRAMAC_SHARE: absolute path to the Frama-C share subdirectory
FRAMAC_LIB: absolute path of the Frama-C lib subdirectory
FRAMAC_PLUGIN: absolute path of the Frama-C plug-in directory.
===============================================================================
TESTING THE INSTALLATION
===============================================================================
This step is optional.
Test your installation by running:
frama-c -val tests/misc/CruiseControl*.c
frama-c-gui -val tests/misc/CruiseControl*.c (if frama-c-gui is available)
===============================================================================
INSTALLATION OF ADDITIONAL PLUG-INS
===============================================================================
Plug-ins may be released independently of Frama-C.
The standard way for installing them should be:
./configure && make && sudo make install
Plug-ins may have their own custom installation procedures.
Consult their specific documentations for details.
===============================================================================
API DOCUMENTATION
===============================================================================
For plug-in developers, the API documentation of the Frama-C kernel and
distributed plug-ins is available in the file frama-c-api.tar.gz, after running
"make doc-distrib".
===============================================================================
UNINSTALLATION
===============================================================================
Type "make uninstall" to remove Frama-C and all the installed plug-ins
(depending on the installation directory, may require superuser privileges).
That works only if you have not manually moved the installed files (see Section
"Custom Installation").
===============================================================================
HAVE FUN WITH FRAMA-C!
===============================================================================
frama-c-Magnesium-20151002/.make-clean-stamp 0000644 0001750 0001750 00000000002 12645746441 017262 0 ustar mehdi mehdi 7
frama-c-Magnesium-20151002/opam/ 0000755 0001750 0001750 00000000000 12645746457 015115 5 ustar mehdi mehdi frama-c-Magnesium-20151002/opam/opam 0000644 0001750 0001750 00000004144 12645746442 015771 0 ustar mehdi mehdi opam-version: "1.2.0"
name: "frama-c-base"
version: "20151002"
maintainer: "francois.bobot@cea.fr"
authors: [
"Patrick Baudin"
"François Bobot"
"Richard Bonichon"
"David Bühler"
"Loïc Correnson"
"Pascal Cuoq"
"Zaynah Dargaye"
"Jean-Christophe Filliâtre"
"Philippe Herrmann"
"Florent Kirchner"
"Matthieu Lemerre"
"Claude Marché"
"André Maroneze"
"Benjamin Monate"
"Yannick Moy"
"Anne Pacalet"
"Valentin Perrelle"
"Guillaume Petiot"
"Virgile Prevosto"
"Armand Puccetti"
"Muriel Roger"
"Julien Signoles"
"Boris Yakobowski"
]
homepage: "http://frama-c.com/"
license: "GNU Lesser General Public License version 2.1"
doc: ["http://frama-c.com/download/user-manual-Sodium-20150201.pdf"]
bug-reports: "https://bts.frama-c.com/"
tags: [
"deductive"
"program verification"
"formal specification"
"automated theorem prover"
"interactive theorem prover"
"C"
"plugins"
"abstract interpretation"
"slicing"
"weakest precondition"
"ACSL"
"dataflow analysis"
]
build: [
["ocaml" "run_autoconf_if_needed.ml"] #when used in pinned mode the configure *can* not yet be generated
["./configure" "--prefix" prefix]
[make]
[make "install"]
]
remove: [
["ocaml" "run_autoconf_if_needed.ml"] #when used in pinned mode the configure *can* not yet be generated
["./configure" "--prefix" prefix]
[make "uninstall"]
["rm" "-rf" frama-c:doc]
]
build-doc: [
[make "-C" "doc" "download"]
[make "-C" "doc" "FRAMAC_DOCDIR=%{frama-c:doc}%" "install"]
]
build-test: [
[make "PTESTS_OPTS=-error-code" "tests"]
]
depends: [
"ocamlgraph" { = "1.8.5" | = "1.8.6" }
"ocamlfind"
]
depopts: [
"zarith"
"lablgtk"
"conf-gtksourceview"
"conf-gnomecanvas"
"coq" { build }
]
messages: [
"Why3 can be used by the WP plugin for running additional automatic solvers" { !why3:installed }
"Coq can be used with the WP plugin for proving interactively proof obligations" { !coq:installed }
]
conflicts: [
"why3" { < "0.85" }
"lablgtk" { < "2.18.2" } #for ocaml >= 4.02.1
]
available: [ ocaml-version >= "4.00.1" & ocaml-version != "4.02.0" & ocaml-version != "4.02.2" ]
frama-c-Magnesium-20151002/opam/files/ 0000755 0001750 0001750 00000000000 12645746442 016211 5 ustar mehdi mehdi frama-c-Magnesium-20151002/opam/files/run_autoconf_if_needed.ml 0000644 0001750 0001750 00000000131 12645746442 023222 0 ustar mehdi mehdi
let () =
if not (Sys.file_exists "configure") then
exit (Sys.command "autoconf")
frama-c-Magnesium-20151002/opam/descr 0000644 0001750 0001750 00000001007 12645746442 016130 0 ustar mehdi mehdi Platform dedicated to the static analysis of source code written in C
Frama-C is a suite of tools dedicated to the analysis of the source
code of software written in C. Neon version.
Frama-C gathers several static analysis techniques in a single
collaborative framework. The collaborative approach of Frama-C allows
static analyzers to build upon the results already computed by other
analyzers in the framework. Thanks to this approach, Frama-C provides
sophisticated tools, such as a slicer and dependency analysis.
frama-c-Magnesium-20151002/doc/ 0000755 0001750 0001750 00000000000 12645746457 014726 5 ustar mehdi mehdi frama-c-Magnesium-20151002/doc/README 0000644 0001750 0001750 00000001161 12645746441 015576 0 ustar mehdi mehdi The main source of documentation for the Frama-C distribution can be downloaded
by running `make` in the directory of this README.
Then the manuals directory will contain the following manuals
* acsl is the reference manual of the specification manual
* acsl-implementation is a copy of the ACSL reference manual with
some implementation-specific remarks. In particular, it explains which
features are not currently supported by Frama-C
* user-manal describes the use of frama-c
* plugin-development-guide provides information needed to develop a Frama-C
plugin
* the other manuals document specific plug-ins
frama-c-Magnesium-20151002/doc/Makefile 0000644 0001750 0001750 00000005440 12645746441 016362 0 ustar mehdi mehdi ##########################################################################
# #
# This file is part of Frama-C. #
# #
# Copyright (C) 2007-2015 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
# you can redistribute it and/or modify it under the terms of the GNU #
# Lesser General Public License as published by the Free Software #
# Foundation, version 2.1. #
# #
# It is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU Lesser General Public License for more details. #
# #
# See the GNU Lesser General Public License version 2.1 #
# for more details (enclosed in the file licenses/LGPLv2.1). #
# #
##########################################################################
# This file just download the manuals in the released version
all:download
FRAMAC_SRC=..
MAKECONFIG_DIR=$(FRAMAC_SRC)/share
include $(FRAMAC_SRC)/share/Makefile.common
DOCDIR ?= "$(DESTDIR)${prefix}/share/doc"
FRAMAC_DOCDIR ?= $(DOCDIR)/frama-c
###################
# Frama-C Version #
###################
VERSION=$(shell $(SED) -e 's/\\(.*\\)/\\1/' $(FRAMAC_SRC)/VERSION)
ifeq ($(findstring +dev,$(VERSION)),+dev)
DEVELOPMENT=yes
else
DEVELOPMENT=no
endif
###
.PHONY: force
MANUALS=acsl
#MANUALS that depend on the frama-c version
VERSIONED_MANUALS=acsl-implementation aorai-manual rte-manual \
wp-manual metrics-manual user-manual \
plugin-development-guide value-analysis
FILES= $(addprefix manuals/, \
$(addsuffix -$(VERSION).pdf, $(VERSIONED_MANUALS)) \
$(addsuffix .pdf, $(MANUALS)) \
)
ifeq ($(DEVELOPMENT),yes)
download: force
@echo "You can't download the manuals in this way for the development version"
else
download: force
$(MKDIR) manuals
wget -nv -N -P manuals \
$(addprefix http://frama-c.com/download/,$(addsuffix -$(VERSION).pdf, $(VERSIONED_MANUALS))) \
$(addprefix http://frama-c.com/download/,$(addsuffix .pdf, $(MANUALS)))
endif
install:
$(MKDIR) $(FRAMAC_DOCDIR)
$(CP) $(FILES) $(FRAMAC_DOCDIR)
frama-c-Magnesium-20151002/doc/code/ 0000755 0001750 0001750 00000000000 12645746457 015640 5 ustar mehdi mehdi frama-c-Magnesium-20151002/doc/code/intro_pdg.txt 0000644 0001750 0001750 00000012170 12645746441 020360 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat à l'énergie atomique et aux énergies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 Overview}
The main modules are :
- {!module: PdgIndex} that can be used to store different kind of information related to a function (not only related to PDG)
- the types are defined in {!module: PdgTypes}.
- the PDG computation is done in {!module: Build}. It also use the lexical successor graph, which is computed in {!module:Lexical_successors}.
- {!module:Sets} provides functions to read a PDG.
- {!module:Print} provides functions to print a PDG either in textual form or in
a dot file (See {i "How to see a PDG"} below).
{2 What is a PDG ?}
A {b Program Dependences Graph} represent the dependences between the
statements of a function. So the nodes of the graph mainly represent the
statements (some more nodes are used to represents things like declarations,
inputs, outputs, etc.) and the edges represent the dependences.
[Y -> X] means that the computation of the statement Y depend on (the result of)
the statement X. Example :
{C {v X : x = a + b; Y : y = x + 1; v}}
There are three kinds of dependencies :
- a {b data} dependency : the simpler one, illustrated by the above example,
- a {b control} dependency :
{C Example : {v if (c) X : x = a + b; v}}
X is control dependent on (c) because the statement will be executed or not
according to the evaluation of the condition,
- an {b address} dependency : dependencies on the elements that are used to
compute the left part of an assignment, ie that decide which data will be
modified.
{C Example : {v t[i] = 3; v}}
We say that this statement have address dependencies on the declaration of [tab]
and the computation of [i].
A dependency between two nodes can have any combination of these kinds.
You can find more documentation, particularly on how this graph is built,
in this {{:../../pdg/index.html}report} (in French).
{2 Dynamic dependencies}
After having built the PDG for a function, there is a way of adding dynamically
some dependencies to it. There are not stored directly in the PDG so they can be
cleared later on.
As PDG doesn't interpret the annotations of the code,
this feature can for instance be used to add dependencies on assertions.
To see an example of how to use it, please have a look at
[tests/pdg/dyn_dpds.ml].
{2 How to see a PDG ?}
Please, use the [-help] option of the tool to get the PDG options names.
The PDG of a function can be seen either in textual form
or exported in a {b dot} file
which is the format of the {{:http://www.graphviz.org/}Graphviz}
tool set.
They can be viewed using
{{:http://zvtm.sourceforge.net/zgrviewer.html}zgrviewer}
or exported in SVG format to be seen with some browser
or {{:http://www.inkscape.org/}Inkscape}.
The graph is unfortunately generated with the output of the function at the top
and its inputs at the bottom. If you find it uncomfortable to read,
just change [TB] by [BT] in the [rankdir] property at the beginning of the
dot file before viewing it.
The color and the shape of the nodes are used to make it easier to read the
graph, but add no more meaning.
For the edges :
- the color (blue) represent the {b data} dependency,
- the shape of the arrow (circled) represent the {b control} dependency,
- and the kind of line (dotted) represent the {b address} dependency.
So a solid blue edge with a circle arrow represent a data+control dependency for
instance, while a dotted black edge with a triangle arrow represent a address
dependency.
You are invited to look at
{{:../../../tests/pdg/doc.g.svg}a simple example}
to see the different kinds of dependencies.
frama-c-Magnesium-20151002/doc/code/intro_plugin_D_and_S.txt 0000644 0001750 0001750 00000004602 12645746441 022454 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat à l'énergie atomique et aux énergies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 API Documentation}
The _PluginName_ plugin is integrated with the Frama-C kernel:
- {{:../index.html}Frama-C} complete kernel API
- {{:../html/Db._PluginName_.html}_PluginName_} available kernel API
This plugin is also dynamically registered:
- {{:../dynamic_plugins/Dynamic_plugins._PluginName_.html}_PluginName_} dynamic API
- {{:../dynamic_plugins/Dynamic_plugins.html}dynamically registered plugins} index
- {{:../html/Dynamic.html}Dynamic} kernel registery for plugins' API
{2 Internal Documentation}
- {{:modules.svg}_PluginName_} architecture (SVG format)
- Index of {{:index_modules.html}Modules}
- Index of {{:index_types.html}Types}
- Index of {{:index_values.html}Values}
- Index of {{:index_exceptions.html}Exceptions}
frama-c-Magnesium-20151002/doc/code/intro_sparecode.txt 0000644 0001750 0001750 00000005504 12645746441 021556 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat à l'énergie atomique et aux énergies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 Overview}
The Sparecode module aims at removing the unused code.
It is composed of to parts :
- one (in module {!module:Marks}) that computes some information
to say what has to be kept in the result. It uses the generic PDG
marking facility {{:../pdg/PdgMarks.html}PdgMarks}+{{:../pdg/Marks.html}Marks},
- and a second one (module {!module:Transform})
that read thoses results to produce a new application.
This part mainly use {{:../html/Filter.html}Filter}
which provides a functor that filters an application to create another one.
To select the useful statements, we start from the [main] outputs
and the reachable annotations, and mark backward all the dependencies.
When reaching a function call, the called function statements are also marked
according to the needed outputs, but the inputs are not propagated immediately
because it would make every function call visible.
The information provided by the PDG marking system is kept to be used later.
So, after the first step, we iterate on the input marks to propagate,
and propagate them only for the visible calls, ie those which have at least
one visible output. This process is repeated as long as there are some
modification.
frama-c-Magnesium-20151002/doc/code/toc_head.htm 0000644 0001750 0001750 00000003754 12645746441 020122 0 ustar mehdi mehdi
Frama-C API
frama-c-Magnesium-20151002/doc/code/docgen_ge400.ml 0000644 0001750 0001750 00000034672 12645746441 020335 0 ustar mehdi mehdi (**************************************************************************)
(* *)
(* This file is part of Frama-C. *)
(* *)
(* Copyright (C) 2007-2015 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
(* you can redistribute it and/or modify it under the terms of the GNU *)
(* Lesser General Public License as published by the Free Software *)
(* Foundation, version 2.1. *)
(* *)
(* It is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU Lesser General Public License for more details. *)
(* *)
(* See the GNU Lesser General Public License version 2.1 *)
(* for more details (enclosed in the file licenses/LGPLv2.1). *)
(* *)
(**************************************************************************)
open Odoc_module
open Odoc_info
open Odoc_html
let doc_path = ref "."
let lib_files = ref []
let add_libfiles analyse s =
let f = Odoc_global.Intf_file s in
lib_files :=
(String.capitalize (Filename.chop_extension (Filename.basename s))) ::
!lib_files;
if analyse then Odoc_global.files := f :: !Odoc_global.files
let rec root_name s =
let simple = Odoc_info.Name.simple s in
let father = Odoc_info.Name.father s in
if father = "" then simple else root_name father
let equal_module_name m s =
let n = m.m_name in
n = s && n = root_name n
let equal_module m1 m2 = equal_module_name m1 m2.m_name
type chapter = Chapter of int * string * string | Directory of string
let compare_chapter c1 c2 = match c1 , c2 with
| Chapter(a,_,_) , Chapter(b,_,_) -> a-b
| Directory a , Directory b -> compare a b
| Chapter _ , Directory _ -> (-1)
| Directory _ , Chapter _ -> 1
let merge3
(s1 : 'a -> 'a -> int)
(s2 : 'b -> 'b -> int)
(s3 : 'c -> 'c -> int)
(triplets : ('a * 'b * 'c) list)
: ('a * ('b * 'c list) list) list =
let sort3_rev s1 s2 s3 (x,y,z) (x',y',z') =
let c = s1 x' x in
if c <> 0 then c else
let c = s2 y' y in
if c <> 0 then c else
s3 z' z
in
let rec merge3_rev acc triplets =
match triplets , acc with
| [] , _ -> acc
| (a,b,c)::tail , (dir_a,all_a)::a_merged when a = dir_a ->
begin
match all_a with
| (dir_b,all_b)::b_merged when b = dir_b ->
merge3_rev ((dir_a,(dir_b,c::all_b)::b_merged)::a_merged) tail
| _ ->
merge3_rev ((dir_a,(b,[c])::all_a)::a_merged) tail
end
| (a,b,c)::tail , merged ->
merge3_rev (( a , [b,[c]] )::merged) tail
in
merge3_rev [] (List.sort (sort3_rev s1 s2 s3) triplets)
module Generator (G:Odoc_html.Html_generator) =
struct
class html = object (self)
inherit G.html as super
val mutable memo = []
method private loaded_modules =
match memo with
| [] ->
let l = List.flatten
(List.map
(fun f ->
Odoc_info.verbose (Odoc_messages.loading f);
try
let l = Odoc_analyse.load_modules f in
Odoc_info.verbose Odoc_messages.ok;
l
with Failure s ->
prerr_endline s ;
incr Odoc_global.errors ;
[]
)
!Odoc_global.load
)
in
memo <- l;
l
| (_ :: _) as l -> l
method private path s =
let name = root_name s in
if List.exists (fun m -> m = name) !lib_files then
"http://caml.inria.fr/pub/docs/manual-ocaml/libref/"
else
if List.exists (fun m -> m.m_name = name) self#loaded_modules
then !doc_path ^ "/"
else "./"
method create_fully_qualified_idents_links m_name s =
let f str_t =
let match_s = Str.matched_string str_t in
let rel = Odoc_info.Name.get_relative m_name match_s in
let s_final = Odoc_info.apply_if_equal
Odoc_info.use_hidden_modules
match_s
rel
in
if StringSet.mem match_s known_types_names then
"" ^ s_final ^ ""
else
if StringSet.mem match_s known_classes_names then
let (html_file, _) = Naming.html_files match_s in
""^s_final^""
else
s_final
in
let s2 = Str.global_substitute
(Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([a-z][a-zA-Z_'0-9]*\\)")
f
s
in
s2
(** Take a string and return the string where fully qualified module idents
have been replaced by links to the module referenced by the ident.*)
method create_fully_qualified_module_idents_links m_name s =
let f str_t =
let match_s = Str.matched_string str_t in
let rel = Odoc_info.Name.get_relative m_name match_s in
let s_final = Odoc_info.apply_if_equal
Odoc_info.use_hidden_modules
match_s
rel
in
if StringSet.mem match_s known_modules_names then
let (html_file, _) = Naming.html_files match_s in
""^s_final^""
else
s_final
in
let s2 = Str.global_substitute
(Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([A-Z][a-zA-Z_'0-9]*\\)")
f
s
in
s2
(** redefine from file odoc_html.ml *)
method html_of_Module_list b l =
let dir f = (* , *)
let chop dir f =
let n = Str.search_forward (Str.regexp dir) f 0 in
let f = String.sub f n (String.length f - n) in
let d = Filename.dirname f in
String.capitalize (Filename.basename d)
in
try
Chapter(1,"Kernel Services","src/kernel_services"),
chop "kernel_services/" f
with Not_found ->
try Chapter(2,"Libraries","src/libraries"), chop "libraries/" f
with Not_found ->
try
Chapter(3,"Kernel Internals","src/kernel_internals"),
chop "kernel_internals/" f
with Not_found ->
let d = Filename.dirname f in
Directory (Filename.basename (Filename.dirname d)) ,
String.capitalize (Filename.basename d)
in
let structured_modules (* chapter, section, module *) =
(List.map
(fun name ->
let m = List.find (fun m -> m.m_name = name) self#list_modules in
let dir,name = dir m.m_file in
dir,name,m)
l)
in
let toc_modules (* chapter/section/modules *) =
merge3 compare_chapter compare compare structured_modules
in
List.iter
(fun (chapter, subdirs) ->
let dir =
( match chapter with
| Chapter (n,a,d) ->
bp b "
Chapter %d. %s
" n a ; d
| Directory d ->
bp b "
Directory %s
" d ; d)
in
List.iter
(fun (subdir,modules) ->
bp b "
Section %s (in %s/%s)
\n"
subdir dir (String.lowercase subdir) ;
bs b " \n
\n";
List.iter
(fun m ->
bs b "
";
(try
let (html, _) = Naming.html_files m.m_name in
bp b "%s
" html m.m_name;
bs b "
";
self#html_of_info_first_sentence b m.m_info;
with Not_found ->
Odoc_global.pwarning
(Odoc_messages.cross_module_not_found m.m_name);
bp b "%s
" m.m_name);
bs b "
\n")
modules;
bs b "
\n")
subdirs)
toc_modules
(** Print html code for an included module. *)
method html_of_included_module b im =
bs b "
";
bs b ((self#keyword "include")^" ");
(
match im.im_module with
None ->
bs b im.im_name
| Some mmt ->
let (file, name) =
match mmt with
Mod m ->
let (html_file, _) = Naming.html_files m.m_name in
(html_file, m.m_name)
| Modtype mt ->
let (html_file, _) =
Naming.html_files mt.mt_name
in
(html_file, mt.mt_name)
in
bp b "%s" (self#path name) file name
);
bs b "
\n";
self#html_of_info b im.im_info
(** Generate all the html files from a module list. The main
file is [.html]. *)
method generate module_list =
(* init the style *)
self#init_style ;
(* init the lists of elements *)
list_values <- Odoc_info.Search.values module_list ;
list_exceptions <- Odoc_info.Search.exceptions module_list ;
list_types <- Odoc_info.Search.types module_list ;
list_attributes <- Odoc_info.Search.attributes module_list ;
list_methods <- Odoc_info.Search.methods module_list ;
list_classes <- Odoc_info.Search.classes module_list ;
list_class_types <- Odoc_info.Search.class_types module_list ;
list_modules <- Odoc_info.Search.modules module_list ;
list_module_types <- Odoc_info.Search.module_types module_list ;
(* prepare the page header *)
self#prepare_header module_list ;
(* Get the names of all known types. *)
let types = Odoc_info.Search.types module_list in
known_types_names <-
List.fold_left
(fun acc t -> StringSet.add t.Odoc_type.ty_name acc)
known_types_names
types ;
(* Get the names of all class and class types. *)
let classes = Odoc_info.Search.classes module_list in
let class_types = Odoc_info.Search.class_types module_list in
known_classes_names <-
List.fold_left
(fun acc c -> StringSet.add c.Odoc_class.cl_name acc)
known_classes_names
classes ;
known_classes_names <-
List.fold_left
(fun acc ct -> StringSet.add ct.Odoc_class.clt_name acc)
known_classes_names
class_types ;
(* Get the names of all known modules and module types. *)
let module_types = Odoc_info.Search.module_types module_list in
let modules = Odoc_info.Search.modules module_list in
known_modules_names <-
List.fold_left
(fun acc m -> StringSet.add m.m_name acc)
known_modules_names
modules ;
known_modules_names <-
List.fold_left
(fun acc mt -> StringSet.add mt.mt_name acc)
known_modules_names
module_types ;
(* generate html for each module *)
let keep_list =
let keep m =
not (List.exists (equal_module m) self#loaded_modules) &&
not (List.exists (equal_module_name m) !lib_files)
in
List.filter keep module_list
in
if not !Odoc_html.index_only then
self#generate_elements self#generate_for_module keep_list ;
(* reinit the lists of elements *)
list_values <- Odoc_info.Search.values keep_list ;
list_exceptions <- Odoc_info.Search.exceptions keep_list ;
list_types <- Odoc_info.Search.types keep_list ;
list_attributes <- Odoc_info.Search.attributes keep_list ;
list_methods <- Odoc_info.Search.methods keep_list ;
list_classes <- Odoc_info.Search.classes keep_list ;
list_class_types <- Odoc_info.Search.class_types keep_list ;
list_modules <- Odoc_info.Search.modules keep_list ;
list_module_types <- Odoc_info.Search.module_types keep_list ;
try
self#generate_index keep_list;
self#generate_values_index keep_list ;
self#generate_exceptions_index keep_list ;
self#generate_types_index keep_list ;
self#generate_attributes_index keep_list ;
self#generate_methods_index keep_list ;
self#generate_classes_index keep_list ;
self#generate_class_types_index keep_list ;
self#generate_modules_index keep_list ;
self#generate_module_types_index keep_list ;
with Failure s ->
prerr_endline s ;
incr Odoc_info.errors
method private html_of_plugin_developer_guide _t =
"Consult the Plugin Development Guide for additional details. \n"
method private html_of_ignore _t = ""
method private html_of_modify t = match t with
| [] ->
Odoc_info.warning "Found an empty @modify tag";
""
| Raw s :: l ->
let time, explanation =
try
let idx = String.index s ' ' in
String.sub s 0 idx,
":" ^ String.sub s idx (String.length s - idx)
with Not_found ->
s, ""
in
let text =
Bold [ Raw "Change in "; Raw time ] :: Raw explanation :: l
in
let buf = Buffer.create 7 in
self#html_of_text buf text;
Buffer.add_string buf " \n";
Buffer.contents buf
| _ :: _ ->
assert false
method private html_of_call t = match t with
| [] ->
Odoc_info.warning "Found an empty @call tag";
""
| l ->
let buf = Buffer.create 97 in
Buffer.add_string buf "Access it by";
self#html_of_text buf l;
Buffer.add_string buf "\n";
Buffer.contents buf
(* Write the subtitle (eg. "Frama-C Kernel" after the main title
instead of before, for users that use many tabs in their browser *)
method inner_title s =
match self#title with "" -> "" | t -> self#escape s ^ " - " ^ t
initializer
tag_functions <-
("modify", self#html_of_modify) ::
("ignore", self#html_of_ignore) ::
("call", self#html_of_call) ::
("plugin", self#html_of_plugin_developer_guide) :: tag_functions
end
end
let () =
Odoc_args.extend_html_generator (module Generator: Odoc_gen.Html_functor);
Odoc_args.add_option
("-docpath", Arg.Set_string doc_path, "Frama-C documentation directory");
Odoc_args.add_option
("-stdlib", Arg.String (add_libfiles true), "Standard library files");
Odoc_args.add_option
("-stdlib-path", Arg.String (add_libfiles false), "Standard library files")
frama-c-Magnesium-20151002/doc/code/docgen_lt400.ml 0000644 0001750 0001750 00000033574 12645746441 020361 0 ustar mehdi mehdi (**************************************************************************)
(* *)
(* This file is part of Frama-C. *)
(* *)
(* Copyright (C) 2007-2015 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
(* you can redistribute it and/or modify it under the terms of the GNU *)
(* Lesser General Public License as published by the Free Software *)
(* Foundation, version 2.1. *)
(* *)
(* It is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU Lesser General Public License for more details. *)
(* *)
(* See the GNU Lesser General Public License version 2.1 *)
(* for more details (enclosed in the file licenses/LGPLv2.1). *)
(* *)
(**************************************************************************)
open Odoc_module
open Odoc_info
open Odoc_html
let doc_path = ref "."
let lib_files = ref []
let add_libfiles analyse s =
let f = Odoc_args.Intf_file s in
lib_files :=
(String.capitalize (Filename.chop_extension (Filename.basename s))) ::
!lib_files;
if analyse then Odoc_args.files := f :: !Odoc_args.files
let rec root_name s =
let simple = Odoc_info.Name.simple s in
let father = Odoc_info.Name.father s in
if father = "" then simple else root_name father
let equal_module_name m s =
let n = m.m_name in
n = s && n = root_name n
let equal_module m1 m2 = equal_module_name m1 m2.m_name
type chapter = Chapter of int * string * string | Directory of string
let compare_chapter c1 c2 = match c1 , c2 with
| Chapter(a,_,_) , Chapter(b,_,_) -> a-b
| Directory a , Directory b -> compare a b
| Chapter _ , Directory _ -> (-1)
| Directory _ , Chapter _ -> 1
let merge3
(s1 : 'a -> 'a -> int)
(s2 : 'b -> 'b -> int)
(s3 : 'c -> 'c -> int)
(triplets : ('a * 'b * 'c) list)
: ('a * ('b * 'c list) list) list =
let sort3_rev s1 s2 s3 (x,y,z) (x',y',z') =
let c = s1 x' x in
if c <> 0 then c else
let c = s2 y' y in
if c <> 0 then c else
s3 z' z
in
let rec merge3_rev acc triplets =
match triplets , acc with
| [] , _ -> acc
| (a,b,c)::tail , (dir_a,all_a)::a_merged when a = dir_a ->
begin
match all_a with
| (dir_b,all_b)::b_merged when b = dir_b ->
merge3_rev ((dir_a,(dir_b,c::all_b)::b_merged)::a_merged) tail
| _ ->
merge3_rev ((dir_a,(b,[c])::all_a)::a_merged) tail
end
| (a,b,c)::tail , merged ->
merge3_rev (( a , [b,[c]] )::merged) tail
in
merge3_rev [] (List.sort (sort3_rev s1 s2 s3) triplets)
class gen = object (self)
inherit html as super
val mutable memo = []
method loaded_modules =
match memo with
| [] ->
let l = List.flatten
(List.map
(fun f ->
Odoc_info.verbose (Odoc_messages.loading f);
try
let l = Odoc_analyse.load_modules f in
Odoc_info.verbose Odoc_messages.ok;
l
with Failure s ->
prerr_endline s ;
incr Odoc_global.errors ;
[]
)
!Odoc_args.load
)
in
memo <- l;
l
| (_ :: _) as l ->
l
method path s =
let name = root_name s in
if List.exists (fun m -> m = name) !lib_files then
"http://caml.inria.fr/pub/docs/manual-ocaml/libref/"
else
if List.exists (fun m -> m.m_name = name) self#loaded_modules
then !doc_path ^ "/"
else "./"
method create_fully_qualified_idents_links m_name s =
let f str_t =
let match_s = Str.matched_string str_t in
let rel = Odoc_info.Name.get_relative m_name match_s in
let s_final = Odoc_info.apply_if_equal
Odoc_info.use_hidden_modules
match_s
rel
in
if StringSet.mem match_s known_types_names then
"" ^ s_final ^ ""
else
if StringSet.mem match_s known_classes_names then
let (html_file, _) = Naming.html_files match_s in
""^s_final^""
else
s_final
in
let s2 = Str.global_substitute
(Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([a-z][a-zA-Z_'0-9]*\\)")
f
s
in
s2
(** Take a string and return the string where fully qualified module idents
have been replaced by links to the module referenced by the ident.*)
method create_fully_qualified_module_idents_links m_name s =
let f str_t =
let match_s = Str.matched_string str_t in
let rel = Odoc_info.Name.get_relative m_name match_s in
let s_final = Odoc_info.apply_if_equal
Odoc_info.use_hidden_modules
match_s
rel
in
if StringSet.mem match_s known_modules_names then
let (html_file, _) = Naming.html_files match_s in
""^s_final^""
else
s_final
in
let s2 = Str.global_substitute
(Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([A-Z][a-zA-Z_'0-9]*\\)")
f
s
in
s2
(** redefine from file odoc_html.ml *)
method html_of_Module_list b l =
let dir f = (* , *)
let chop dir f =
let n = Str.search_forward (Str.regexp dir) f 0 in
let f = String.sub f n (String.length f - n) in
let d = Filename.dirname f in
String.capitalize (Filename.basename d)
in
try
Chapter(1,"Kernel Services","src/kernel_services"),
chop "kernel_services/" f
with Not_found ->
try Chapter(2,"Libraries","src/libraries"), chop "libraries/" f
with Not_found ->
try
Chapter(3,"Kernel Internals","src/kernel_internals"),
chop "kernel_internals/" f
with Not_found ->
let d = Filename.dirname f in
Directory (Filename.basename (Filename.dirname d)) ,
String.capitalize (Filename.basename d)
in
let structured_modules (* chapter, section, module *) =
(List.map
(fun name ->
let m = List.find (fun m -> m.m_name = name) self#list_modules in
let dir,name = dir m.m_file in
dir,name,m)
l)
in
let toc_modules (* chapter/section/modules *) =
merge3 compare_chapter compare compare structured_modules
in
List.iter
(fun (chapter, subdirs) ->
let dir =
( match chapter with
| Chapter (n,a,d) ->
bp b "
Chapter %d. %s
" n a ; d
| Directory d ->
bp b "
Directory %s
" d ; d)
in
List.iter
(fun (subdir,modules) ->
bp b "
Section %s (in %s/%s)
\n"
subdir dir (String.lowercase subdir) ;
bs b " \n
\n";
List.iter
(fun m ->
bs b "
";
(try
let (html, _) = Naming.html_files m.m_name in
bp b "%s
" html m.m_name;
bs b "
";
self#html_of_info_first_sentence b m.m_info;
with Not_found ->
Odoc_messages.pwarning
(Odoc_messages.cross_module_not_found m.m_name);
bp b "%s
" m.m_name);
bs b "
\n")
modules;
bs b "
\n")
subdirs)
toc_modules
(** Print html code for an included module. *)
method html_of_included_module b im =
bs b "
";
bs b ((self#keyword "include")^" ");
(
match im.im_module with
None ->
bs b im.im_name
| Some mmt ->
let (file, name) =
match mmt with
Mod m ->
let (html_file, _) = Naming.html_files m.m_name in
(html_file, m.m_name)
| Modtype mt ->
let (html_file, _) =
Naming.html_files mt.mt_name
in
(html_file, mt.mt_name)
in
bp b "%s" (self#path name) file name
);
bs b "
\n";
self#html_of_info b im.im_info
(** Generate all the html files from a module list. The main
file is [.html]. *)
method generate module_list =
(* init the style *)
self#init_style ;
(* init the lists of elements *)
list_values <- Odoc_info.Search.values module_list ;
list_exceptions <- Odoc_info.Search.exceptions module_list ;
list_types <- Odoc_info.Search.types module_list ;
list_attributes <- Odoc_info.Search.attributes module_list ;
list_methods <- Odoc_info.Search.methods module_list ;
list_classes <- Odoc_info.Search.classes module_list ;
list_class_types <- Odoc_info.Search.class_types module_list ;
list_modules <- Odoc_info.Search.modules module_list ;
list_module_types <- Odoc_info.Search.module_types module_list ;
(* prepare the page header *)
self#prepare_header module_list ;
(* Get the names of all known types. *)
let types = Odoc_info.Search.types module_list in
known_types_names <-
List.fold_left
(fun acc t -> StringSet.add t.Odoc_type.ty_name acc)
known_types_names
types ;
(* Get the names of all class and class types. *)
let classes = Odoc_info.Search.classes module_list in
let class_types = Odoc_info.Search.class_types module_list in
known_classes_names <-
List.fold_left
(fun acc c -> StringSet.add c.Odoc_class.cl_name acc)
known_classes_names
classes ;
known_classes_names <-
List.fold_left
(fun acc ct -> StringSet.add ct.Odoc_class.clt_name acc)
known_classes_names
class_types ;
(* Get the names of all known modules and module types. *)
let module_types = Odoc_info.Search.module_types module_list in
let modules = Odoc_info.Search.modules module_list in
known_modules_names <-
List.fold_left
(fun acc m -> StringSet.add m.m_name acc)
known_modules_names
modules ;
known_modules_names <-
List.fold_left
(fun acc mt -> StringSet.add mt.mt_name acc)
known_modules_names
module_types ;
(* generate html for each module *)
let keep_list =
let keep m =
not (List.exists (equal_module m) self#loaded_modules) &&
not (List.exists (equal_module_name m) !lib_files)
in
List.filter keep module_list
in
if not !Odoc_args.index_only then
self#generate_elements self#generate_for_module keep_list ;
(* reinit the lists of elements *)
list_values <- Odoc_info.Search.values keep_list ;
list_exceptions <- Odoc_info.Search.exceptions keep_list ;
list_types <- Odoc_info.Search.types keep_list ;
list_attributes <- Odoc_info.Search.attributes keep_list ;
list_methods <- Odoc_info.Search.methods keep_list ;
list_classes <- Odoc_info.Search.classes keep_list ;
list_class_types <- Odoc_info.Search.class_types keep_list ;
list_modules <- Odoc_info.Search.modules keep_list ;
list_module_types <- Odoc_info.Search.module_types keep_list ;
try
self#generate_index keep_list;
self#generate_values_index keep_list ;
self#generate_exceptions_index keep_list ;
self#generate_types_index keep_list ;
self#generate_attributes_index keep_list ;
self#generate_methods_index keep_list ;
self#generate_classes_index keep_list ;
self#generate_class_types_index keep_list ;
self#generate_modules_index keep_list ;
self#generate_module_types_index keep_list ;
with Failure s ->
prerr_endline s ;
incr Odoc_info.errors
method private html_of_plugin_developer_guide _t =
"Consult the Plugin Development Guide for additional details. \n"
method private html_of_ignore _t = ""
method private html_of_modify t = match t with
| [] ->
Odoc_info.warning "Found an empty @modify tag";
""
| Raw s :: l ->
let time, explanation =
try
let idx = String.index s ' ' in
String.sub s 0 idx,
":" ^ String.sub s idx (String.length s - idx)
with Not_found ->
s, ""
in
let text =
Bold [ Raw "Change in "; Raw time ] :: Raw explanation :: l
in
let buf = Buffer.create 7 in
self#html_of_text buf text;
Buffer.add_string buf " \n";
Buffer.contents buf
| _ :: _ ->
assert false
method private html_of_call t = match t with
| [] ->
Odoc_info.warning "Found an empty @call tag";
""
| l ->
let buf = Buffer.create 97 in
Buffer.add_string buf "Access it by";
self#html_of_text buf l;
Buffer.add_string buf "\n";
Buffer.contents buf
(* Write the subtitle (eg. "Frama-C Kernel" after the main title
instead of before, for users that use many tabs in their browser *)
method inner_title s =
match self#title with "" -> "" | t -> self#escape s ^ " - " ^ t
initializer
tag_functions <-
("modify", self#html_of_modify) ::
("ignore", self#html_of_ignore) ::
("call", self#html_of_call) ::
("plugin", self#html_of_plugin_developer_guide) :: tag_functions
end
let () =
Odoc_args.set_doc_generator (Some (new gen :> Odoc_args.doc_generator));
Odoc_args.add_option
("-docpath", Arg.Set_string doc_path, "Frama-C documentation directory");
Odoc_args.add_option
("-stdlib", Arg.String (add_libfiles true), "Standard library files");
Odoc_args.add_option
("-stdlib-path", Arg.String (add_libfiles false), "Standard library files")
frama-c-Magnesium-20151002/doc/code/style.css 0000644 0001750 0001750 00000012562 12645746441 017511 0 ustar mehdi mehdi /**************************************************************************/
/* */
/* This file is part of Frama-C. */
/* */
/* Copyright (C) 2007-2015 */
/* CEA (Commissariat à l'énergie atomique et aux énergies */
/* alternatives) */
/* */
/* you can redistribute it and/or modify it under the terms of the GNU */
/* Lesser General Public License as published by the Free Software */
/* Foundation, version 2.1. */
/* */
/* It is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
/* */
/* See the GNU Lesser General Public License version 2.1 */
/* for more details (enclosed in the file licenses/LGPLv2.1). */
/* */
/**************************************************************************/
* { margin: 0; padding: 0 }
body {
color: #222;
font-family: "Verdana", sans;
font-size: 11px;
width: 18cm;
margin-left: 2.5cm;
margin-top: 0.5cm;
margin-bottom: 1cm;
padding: 4mm 18mm 4mm 28mm;
background: #ffffff url(frama-c.png) no-repeat fixed 5mm 1cm ;
}
h1 {
width: 18cm;
font-family: "Optima", "Verdana", "Arial", sans;
text-align: left;
margin-top: 5mm;
margin-bottom: 2mm;
padding-left: 3mm;
border-left: 20px solid darkorange;
}
h2 {
width: 18cm;
font-family: "Optima", "Verdana", "Arial", sans;
margin-top: 5mm;
margin-bottom: 2mm;
padding-left: 3mm;
border-bottom: thin solid #404040;
}
h1.chapter {
clear: both;
text-align: left;
font-family: "Optima", "Verdana", "Arial", sans;
font-size: 2.0em;
font-weight: normal;
color: black;
margin: 0.4em 0em 0.4em 0em;
padding: 0.4em 0em 0em 0em;
border-left: none;
border-bottom: thin solid #404040;
}
h2.section {
width: 18cm;
font-family: "Optima", "Verdana", "Arial", sans;
margin-top: 5mm;
margin-bottom: 2mm;
padding-left: 3mm;
border-bottom: none;
border-left: 20px solid darkorange;
color: darkred;
}
h2.section .directory {
font-size: smaller ;
color: #707070 ;
font-familly: "Everson Mono", monospace ;
}
h3 {
width: 18cm;
font-family: "Optima", "Verdana", "Arial", sans;
color: black;
margin-top: 5mm;
margin-bottom: 3mm;
border-bottom: thin solid #404040;
}
h4,h5,h6, div.h7, div.h8, div.h9 {
margin-left: 4mm;
margin-top: 4mm;
margin-bottom: 1mm;
font-family: "Optima", "Verdana", "Arial", sans;
font-size: 10px;
font-style: italic;
font-weight: bold;
color: darkred;
}
p,ul { margin: 2mm; width: 15cm; margin-left: 0mm; }
hr { border: none ; border-top: 1px solid #404040; margin-top: 4mm; margin-bottom: 4mm }
a:visited { color: darkblue; text-decoration: none }
a:link { color: darkblue; text-decoration: none }
a:hover { background-color: lightgray; color: firebrick }
a:active { background-color: lightgray; color: darkgreen }
.navbar {
margin-left: 1cm ;
margin-bottom: 4mm ;
font-size: 9px ;
}
.navbar a:link { color: darkgreen; }
.navbar a:visited { color: darkgreen; }
.keyword { font-weight : bold; color: darkgoldenrod }
.keywordsign { color : #C04600 }
.superscript { font-size: 7px }
.subscript { font-size: 7px }
.warning { color: firebrick ; font-style: italic; margin-right:1ex }
.info {
padding: 1mm 1mm 1mm 1em;
margin-top: 0mm;
margin-bottom: 2mm;
margin-left: 1em;
margin-right: 3em;
border-left: thin dotted darkgreen;
}
table .info { border: none }
.param_info { margin-top: 4px; margin-left : 3em; margin-right : 3em }
.typetable { border-style : hidden }
.indextable {
margin-left: 3mm;
margin-top: 2mm ;
padding: 2mm 6mm 2mm 4mm ;
border-style : hidden ;
border-left: darkgreen thin solid ;
}
.paramstable { border-style : hidden ; padding: 5pt 5pt }
tr { font-size: 11px }
td { padding:0 ; margin:2px 5px 2px 10px ; vertical-align: top }
td .info { padding:0 ; margin-top:0 ; margin-bottom:0 ; border-left: none ; vertical-align: top }
td.typefieldcomment { font-family: serif; color: darkgreen }
pre { color : #263F71 ; font-size: 11px; font-family: "Everson Mono", monospace; margin-top: 1mm }
.code { color : #465F91 ; font-size: 11px; font-family: "Everson Mono", monospace }
.comment { color : darkgreen; font-family: serif }
.constructor { color : darkblue }
.type { color: #5C6585 }
.string { color: maroon }
div.sig_block {margin-left: 2em}
li { margin-left: 2em }
.copyright { margin-top: 5mm; font-size:10px; padding-top: 2mm; border-top: thin solid #404040; }
.copyright a:visited { color:darkred }
.copyright a:link { color:darkred } frama-c-Magnesium-20151002/doc/code/intro_wp.txt 0000644 0001750 0001750 00000003455 12645746441 020242 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of WP plug-in of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat a l'energie atomique et aux energies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 Overview}
The WP plugin is dedicated to compute Weakest-Preconditions using
different memory models.
It is experimental and still under development.
frama-c-Magnesium-20151002/doc/code/intro_kernel_plugin.txt 0000644 0001750 0001750 00000004145 12645746441 022447 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat à l'énergie atomique et aux énergies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 API Documentation}
The _PluginName_ plugin is integrated with the Frama-C kernel:
- {{:../index.html}Frama-C} complete kernel API
- {{:../html/Db._PluginName_.html}_PluginName_} available kernel API
{2 Internal Documentation}
- {{:modules.svg}_PluginName_} architecture (SVG format)
- Index of {{:index_modules.html}Modules}
- Index of {{:index_types.html}Types}
- Index of {{:index_values.html}Values}
- Index of {{:index_exceptions.html}Exceptions}
frama-c-Magnesium-20151002/doc/code/intro_scope.txt 0000644 0001750 0001750 00000004115 12645746441 020717 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat à l'énergie atomique et aux énergies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 Overview}
See how to use the plugin in the
{{:../../www/src/scope.html}user documentation}.
(see also {{:../../scope/scope.txt}there} for a discussion on how we arrived to
those definitions)
{2 Inside the plugin}
The code of this plugin is quite simple. It is only composed of :
- {!module:Datascope_gui} that handles the GUI part,
- and {!module:Datascope} that makes the computations.
Some explanations can be found in the code.
frama-c-Magnesium-20151002/doc/code/intro_plugin.txt 0000644 0001750 0001750 00000004401 12645746441 021102 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat à l'énergie atomique et aux énergies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 API Documentation}
The _PluginName_ API is dynamically registered:
- {{:../dynamic_plugins/Dynamic_plugins._PluginName_.html} _PluginName_} API
- {{:../dynamic_plugins/Dynamic_plugins.html} Dynamically registered plugins} index
- {{:../index.html}Frama-C} complete kernel API
- {{:../html/Dynamic.html}Dynamic} kernel registry for plugins' API
{2 Plugin Internal Documentation}
- {{:modules.svg}_PluginName_} architecture (SVG format)
- Index of {{:index_modules.html}Modules}
- Index of {{:index_types.html}Types}
- Index of {{:index_values.html}Values}
- Index of {{:index_exceptions.html}Exceptions}
frama-c-Magnesium-20151002/doc/code/intro_slicing.txt 0000644 0001750 0001750 00000010752 12645746441 021242 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat à l'énergie atomique et aux énergies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 Overview}
To have more details about what we are trying to do,
you may have a look to the
{{:../../slicing/index.html}specification} report (in French).
The internal types module ({!module:SlicingTypes.Internals})
can give a pretty good idea of the kind of objects that we deal with in this
module.
You can also find some general information below.
{3 Project}
The project was the global repository of the results obtained so far.
If is mainly composed of
a list of actions waiting to be applied,
and the already computed slices.
More precisely, see its type definition
{!type:SlicingTypes.Internals.t_project}
if you want to know what it is composed of,
and the module {!module:SlicingProject} of the functions to handle it.
{3 Program Dependence Graph}
This computation is not part of this module anymore.
See the {{:../html/Db.Pdg.html}API of Pdg module}.
It is enough to know that the PDG of a function is a graph composed
of nodes that represent the elements of a function (declarations, statements,
and so on) and of edges that represent the dependencies relations between those
elements.
{3 Sliced function}
A sliced function contains a mapping between the PDG nodes of a function
and the some marks that are computed by the application of the actions.
It also has a mapping between the function calls and the function called by the
slice that can be either some other slices, or the source function
(or nothing if the call is invisible in that slice).
There can be more than one slice for a source function.
See their type {!type:SlicingTypes.Internals.t_fct_slice},
and the associated functions in {!module:Fct_slice}.
See also {!module:SlicingMarks}
for more information about the low level marks computation.
{3 Actions}
The actions are the way of giving an order to modify the current application.
There are many kinds of actions, but only one is really used to build the
slice which is a list of nodes from the PDG of a function,
and their associated marks.
All the other actions dealing with the marks are first decomposed
before being applied.
Some other actions are can be used to manage the interprocedural part,
ie. which slice to call where.
See the top type {!type:SlicingTypes.Internals.t_criterion} or
the functions in {!module:SlicingActions}.
{3 Options}
The propagation of the marks to the function call depend on a
{!type:SlicingTypes.Internals.t_call_option}.
Chosing this level makes it possible to obtain a more or less precise result.
{3 High level commands}
The module {!module:SlicingCmds} is a bit external because it only uses
the {{:../html/Db.Pdg.html}slicing API} to define higher level function
that are only a composition of the basic functions.
{3 Producing a result }
When there are non more actions in the task list,
the project can be exported. This is done in
{!module:SlicingTransform} module
by building a new CIL application.
frama-c-Magnesium-20151002/doc/code/intro_plugin_default.txt 0000644 0001750 0001750 00000004266 12645746441 022617 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat à l'énergie atomique et aux énergies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 API Documentation}
The _PluginName_ API is dynamically registered.
- {{:../index.html}Frama-C} complete kernel API
- {{:../html/Dynamic.html}Dynamic} kernel registry for plugins' API
- {{:../dynamic_plugins/Dynamic_plugins.html} Dynamically registered plugins} API index
{2 Plugin Internal Documentation}
- {{:modules.svg}_PluginName_} architecture (SVG format)
- Index of {{:index_modules.html}Modules}
- Index of {{:index_types.html}Types}
- Index of {{:index_values.html}Values}
- Index of {{:index_exceptions.html}Exceptions}
frama-c-Magnesium-20151002/doc/code/toc_tail.htm 0000644 0001750 0001750 00000003424 12645746441 020144 0 ustar mehdi mehdi
frama-c-Magnesium-20151002/doc/code/print_api/ 0000755 0001750 0001750 00000000000 12645746457 017625 5 ustar mehdi mehdi frama-c-Magnesium-20151002/doc/code/print_api/print_interface.ml 0000644 0001750 0001750 00000032570 12645746441 023333 0 ustar mehdi mehdi (**************************************************************************)
(* *)
(* This file is part of Frama-C. *)
(* *)
(* Copyright (C) 2007-2015 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
(* you can redistribute it and/or modify it under the terms of the GNU *)
(* Lesser General Public License as published by the Free Software *)
(* Foundation, version 2.1. *)
(* *)
(* It is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU Lesser General Public License for more details. *)
(* *)
(* See the GNU Lesser General Public License version 2.1 *)
(* for more details (enclosed in the file licenses/LGPLv2.1). *)
(* *)
(**************************************************************************)
(** Register the new plugin. *)
module Self =
Plugin.Register
(struct
let name = "Print interface"
let shortname = "print_api"
let help = "This plugin creates a file containing all\
the registered signatures of the dynamic plugins"
end)
(** Register the new Frama-C option "-print_api". *)
module Enabled =
Self.String
(struct
let option_name = "-print_api"
let help = "creates a .mli file for the dynamic plugins"
let arg_name = " the absolute path for the .mli to be created"
let default = ""
end)
type function_element =
{ name: string;
type_string: string;
datatype_string: string }
(** Each object of the table is going to be composed of :
(function_name, type_string)
and its corresponding key is "plugin_name" *)
let functions_tbl = Hashtbl.create 97
(** [type_to_add] contains types not referenced in [reference] and to be added
in the interface. The list [reference] contains the names of the regular
types of OCaml and the registered types of static plugins and kernel *)
let type_to_add: (string, string * string) Hashtbl.t = Hashtbl.create 97
let clash_with_compilation_unit =
let h = Hashtbl.create 97 in
List.iter (fun s -> Hashtbl.add h s ()) Config.compilation_unit_names;
fun s -> Hashtbl.mem h s || Hashtbl.mem h (String.lowercase s)
(** Modules can depend on each other, when a value of a given module depend
on a type of another. It is then important to print them in an appropriate
order. *)
module Module_deps = Graph.Imperative.Digraph.Concrete(Datatype.String)
let module_deps = Module_deps.create ()
(** Comments are registered appart in the module Dynamic *)
module Comment: sig
val add: string -> string -> unit
val find: string -> string
end = struct
let tbl: (string, string) Hashtbl.t = Hashtbl.create 97
let add k v = if v <> "" then Hashtbl.add tbl k v
let find k = try Hashtbl.find tbl k with Not_found -> ""
end
(**returns a list of the substrings *)
let split_dot s = Str.split (Str.regexp_string ".") s
let get_name i s =
let li = split_dot s in
let rec get_name_aux i j l =
if i < j then match i, l with
| _, [] -> ""
| 0, h :: _ -> h
| _ , _ :: q -> get_name_aux (i-1) (j-1) q
else
""
in
get_name_aux i (List.length li) li
let sub_string_dot i s =
let rec sub_string_dot_aux j =
if j < i then get_name j s ^ "." ^ sub_string_dot_aux (j+1)
else get_name i s
in
sub_string_dot_aux 0
(** If s = "module1.module2 ... .fname", then [function_name s] = "fname" *)
let function_name s =
let rec function_name_aux i s =
match i , get_name (i+2) s , get_name (i+1) s with
| 0,"","" -> ""
| _,"",f -> f
| _,_,_ -> function_name_aux (i+1) s
in
function_name_aux 0 s
(** If s = "module1.module2 ... .fname",
then [long_function_name s] = "module2 ... .fname" *)
let long_function_name s =
let pt_idx = ref 0 in
try
for i = 0 to String.length s - 1 do
if s.[i] = '.' then begin
pt_idx := i;
raise Exit
end
done;
s
with Exit ->
Str.string_after s (!pt_idx + 1)
(** when considering s = "plugin_name_0.plugin_name_1.function_name",
[plugin_name s] ="plugin_name_0.plugin_name_1" *)
let plugin_name s =
let rec plugin_name_aux i s =
match i , get_name (i+2) s , get_name (i+1) s with
| 0, "", "" -> get_name 0 s
| _, "", _ -> sub_string_dot i s
| _, _, _ -> plugin_name_aux (i+1) s
in
plugin_name_aux 0 s
let sub_string_dot_compare i s1 s2 = sub_string_dot i s1 = sub_string_dot i s2
let first_divergence m1 m2 =
let rec aux i = if sub_string_dot_compare i m1 m2 then aux (i+1) else i in
sub_string_dot (aux 0) m1
(* m1 depends on m2 *)
let add_module_dep m1 m2 =
Module_deps.add_edge module_deps m2 (first_divergence m1 m2)
let find_module_deps m1 =
(* add the vertex in order to avoid OCamlGraph crashing on a non-existent
vertex. *)
Module_deps.add_vertex module_deps m1;
let deps = Module_deps.pred module_deps m1 in
let rec find_real_module m1 m =
let complete_name = m1 ^ "." ^ m in
if Hashtbl.mem type_to_add complete_name ||
Hashtbl.mem functions_tbl complete_name
then complete_name
else
let pre_m1 = plugin_name m1 in
if m1 = pre_m1 then m else find_real_module m1 m
in
List.map (find_real_module m1) deps
(** true if m2 is a sub-module of m1 *)
let is_submodule m1 m2 = let m1' = first_divergence m1 m2 in m1 = m1'
(** [analyse_type] is called each time a new value is added to [functions_tbl]
in the function [fill_tbl]. It considers what is given by
[Type.get_embedded_type_name type_string], tests if the type to analyse is
not already recorded in the [reference] list or creates the corresponding
type in the Hashtable [type_to add] where the key is the module name of this
type. *)
let analyse_type name l =
let add_type tbl name module_name typ =
let add_type_aux t s ty =
let temp = try Hashtbl.find_all t s with Not_found -> [] in
if not (List.mem ty temp) then Hashtbl.add t s ty
in
if function_name name = module_name
then add_type_aux tbl name typ
else begin
if name <> module_name then add_module_dep name module_name;
add_type_aux tbl module_name typ
end
in
let analyse_type_aux s =
if not (String.contains s '>') && (String.contains s '.') then
if not (String.contains s ' ') then begin
let s_name = get_name 0 s in
if not (clash_with_compilation_unit s_name) then
let typ_n = function_name s in
let module_name = plugin_name s in
add_type type_to_add name module_name (typ_n, s)
end else
let lexbuf = Lexing.from_string s in
let param, type_name =
let l =
Str.split (Str.regexp_string " ") (Grammar.main Lexer.token lexbuf)
in
match l with
| [ h ] -> "", h
| [h1; h2 ] -> h1, h2
| _ -> "", ""
in
let ty_name = get_name 0 type_name in
if String.contains type_name '.'
&& not (clash_with_compilation_unit ty_name)
then
let typ_n = param ^ " " ^ function_name type_name in
let module_name = plugin_name type_name in
add_type type_to_add name module_name (typ_n, type_name)
in
List.iter analyse_type_aux (List.rev l)
let is_option key = String.length key > 1 && String.rcontains_from key 1 '-'
(** It fills [function_tbl] with the content of [dynamic_values] which is a
Hashtable recorded in the module Dynamic. This Hashtable also contains
options like: "-hello-help" or "-hello-debug". The 'if' is taking away this
useless strings and the module named "Dynamic" and fills the table with the
suitable names. *)
let fill_tbl key typ _ =
if not (is_option key || get_name 0 key = "Dynamic") then
let type_list = Type.get_embedded_type_names typ in
let func_elem =
{ name = function_name key ;
type_string = Type.name typ ;
datatype_string = Type.ml_name typ }
in
Hashtbl.add functions_tbl (plugin_name key) func_elem;
analyse_type (plugin_name key) type_list
(** It replaces the sub-strings "Plugin.type" of all the string [type_string]
used in the module named "Plugin" by "type".
It also removes the option stucture (e.g. "~gid:string" is replaced by
"string"). *)
let repair_type module_name type_string =
let rec remove_param_name s =
try
let c = String.index s ':' in
let after = remove_param_name (Str.string_after s (c+1)) in
try
let n = String.index s '~' in
if n < c then
if n = 0 then after
else remove_param_name (Str.string_before s n) ^ after
else
s
with Not_found ->
if c = 0 then after
else
let sp = String.rindex (Str.string_before s c) ' ' in
remove_param_name (Str.string_before s (sp + 1)) ^ after
with Not_found ->
s
in
let remove_name_module s module_n =
Str.global_replace (Str.regexp (module_n ^ "\\.")) "" s
in
match split_dot module_name with
| [] -> type_string
| l -> List.fold_left remove_name_module (remove_param_name type_string) l
(** For each key of the table [functions_tbl], [print_plugin] takes all
the pieces of information found in the Hashtable [dynamic_values]
of the module Dynamic and stored in the 3 Hashtables
([functions_tb]l, [type_to_add], [comment_tbl]) and builds up a string
in order to write the signature of this module in the .mli file *)
let print_plugin fmt =
let modules_list: (string, unit) Hashtbl.t = Hashtbl.create 7 in
let rec space i = match i with
| 0 -> ""
| _ -> space (i-1) ^ " "
in
let rec print_types fmt sp = function
| [] -> ()
| (h, long_h) :: q ->
Format.fprintf fmt "@\n%stype %s@\n%s \
(** @@call by writing [T.ty] where [T] has previously been defined by: \
[module T = Type.Abstract(struct let name = %s end)]. Be careful to replace occurrences of %s by T.ty anywhere else in this doc. *)"
sp h sp long_h long_h;
print_types fmt sp q
in
let rec print_one_plugin fmt i key1 =
if not (get_name i key1 = "") then
let module_name = sub_string_dot i key1 in
if not (Hashtbl.mem modules_list module_name) then begin
Hashtbl.add modules_list module_name ();
(* Check whether there are some modules to be treated before us. *)
let deps = find_module_deps key1 in
let extern, sub_modules = List.partition (is_submodule key1) deps in
List.iter (print_one_plugin fmt i) extern;
let short_module_name = String.capitalize (get_name i key1) in
let space_i = space i in
Format.fprintf fmt "\n \n%smodule %s:\n%ssig "
space_i
short_module_name
space_i;
List.iter (print_one_plugin fmt (succ i)) sub_modules;
let module_types =
try Hashtbl.find_all type_to_add module_name
with Not_found -> []
in
print_types fmt (space i) module_types ;
let print_one_plugin_aux fmt key elem =
if sub_string_dot i key = module_name then
let succ_i = succ i in
if get_name succ_i key = "" then begin
let plugin_name = sub_string_dot 0 key1 in
let found_comment = Comment.find (key ^ "." ^ elem.name) in
Format.fprintf fmt
"@\n%s@[ @[val %s:@ %s@]@\n%s@[ (** %s\n\
@@call Dynamic.get ~plugin:\"%s\" \"%s\" %s *)@]@]@\n"
space_i
elem.name
(repair_type module_name elem.type_string)
space_i
found_comment
plugin_name
(long_function_name (key ^ "." ^ elem.name))
elem.datatype_string;
Hashtbl.remove functions_tbl key
end else
print_one_plugin fmt succ_i key
in
Hashtbl.iter (print_one_plugin_aux fmt) functions_tbl ;
Format.fprintf fmt "\n%send" (space i)
end
in
let print_all fmt i key _ = print_one_plugin fmt i key in
Format.fprintf fmt "@[%t@]"
(fun fmt -> Hashtbl.iter (print_all fmt 0) functions_tbl)
(** [print] is the main function of this module.
It takes one argument which is the path and opens the
file path/dynamic_plugins.mli. It fills [functions_tbl],
[comment_tbl] and [type_to_add]
using the functions [fill_tbl] and [add_comment] and then
prints the plugins in the file with [print_plugin] *)
let print path =
try
Dynamic.iter fill_tbl;
Dynamic.iter_comment Comment.add;
let channel = open_out (path ^ "/dynamic_plugins.mli") in
let fmt = Format.formatter_of_out_channel channel in
Format.fprintf fmt
"@[@[(** This@ module@ contains@ all@ the@ dynamically@ \
registered@ plugins *)@]@ %t@]"
print_plugin;
close_out channel
with Sys_error _ as e ->
Self.error "%s" (Printexc.to_string e)
(** register [print (path : string)] *)
let print =
Dynamic.register
~comment: "Create a .mli file used by 'make doc' \
to generate the html documentation of dynamic plug-ins.\
It takes the path where to create this file as an argument."
~plugin:"Print_api"
"run"
~journalize:true
(Datatype.func Datatype.string Datatype.unit)
print
let run () = if not (Enabled.is_default ()) then print (Enabled.get ())
let () = Db.Main.extend run
frama-c-Magnesium-20151002/doc/code/print_api/Makefile 0000644 0001750 0001750 00000004401 12645746441 021255 0 ustar mehdi mehdi ##########################################################################
# #
# This file is part of Frama-C. #
# #
# Copyright (C) 2007-2015 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
# you can redistribute it and/or modify it under the terms of the GNU #
# Lesser General Public License as published by the Free Software #
# Foundation, version 2.1. #
# #
# It is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU Lesser General Public License for more details. #
# #
# See the GNU Lesser General Public License version 2.1 #
# for more details (enclosed in the file licenses/LGPLv2.1). #
# #
##########################################################################
# Print_api plugin
##################
# Frama-C should be properly installed with "make install"
# befor any use of this makefile
ifndef FRAMAC_SHARE
FRAMAC_SHARE :=$(shell frama-c.byte -print-path)
endif
ifndef FRAMAC_LIBDIR
FRAMAC_LIBDIR :=$(shell frama-c.byte -print-libpath)
endif
PLUGIN_DIR ?= .
PLUGIN_NAME := Print_api
PLUGIN_CMO := grammar lexer print_interface
PLUGIN_GENERATED:= $(PLUGIN_DIR)/grammar.ml $(PLUGIN_DIR)/grammar.mli \
$(PLUGIN_DIR)/lexer.ml
include $(FRAMAC_SHARE)/Makefile.dynamic
clean::
$(RM) $(Print_api_DIR)/dynamic_plugins.mli
$(RM) $(Print_api_DIR)/grammar.output
$(RM) $(Print_api_DIR)/grammar.ml
$(RM) $(Print_api_DIR)/grammar.mli
$(RM) $(Print_api_DIR)/lexer.ml
$(RM) -r _build
frama-c-Magnesium-20151002/doc/code/print_api/lexer.mll 0000644 0001750 0001750 00000003524 12645746441 021447 0 ustar mehdi mehdi (**************************************************************************)
(* *)
(* This file is part of Frama-C. *)
(* *)
(* Copyright (C) 2007-2015 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
(* you can redistribute it and/or modify it under the terms of the GNU *)
(* Lesser General Public License as published by the Free Software *)
(* Foundation, version 2.1. *)
(* *)
(* It is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU Lesser General Public License for more details. *)
(* *)
(* See the GNU Lesser General Public License version 2.1 *)
(* for more details (enclosed in the file licenses/LGPLv2.1). *)
(* *)
(**************************************************************************)
{
}
rule token = parse
| [' ' '\t'] { token lexbuf }
| [ ^ '(' ',' ')' ' ' ]* { Grammar.WORD (Lexing.lexeme lexbuf) }
| '(' { Grammar.LPAR }
| ')' { Grammar.RPAR }
| ',' { Grammar.COMMA }
| eof {Grammar.EOF }
frama-c-Magnesium-20151002/doc/code/print_api/Print_api.mli 0000644 0001750 0001750 00000003125 12645746441 022247 0 ustar mehdi mehdi (**************************************************************************)
(* *)
(* This file is part of Frama-C. *)
(* *)
(* Copyright (C) 2007-2015 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
(* you can redistribute it and/or modify it under the terms of the GNU *)
(* Lesser General Public License as published by the Free Software *)
(* Foundation, version 2.1. *)
(* *)
(* It is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU Lesser General Public License for more details. *)
(* *)
(* See the GNU Lesser General Public License version 2.1 *)
(* for more details (enclosed in the file licenses/LGPLv2.1). *)
(* *)
(**************************************************************************)
frama-c-Magnesium-20151002/doc/code/print_api/grammar.mly 0000644 0001750 0001750 00000004614 12645746441 021774 0 ustar mehdi mehdi /**************************************************************************/
/* */
/* This file is part of Frama-C. */
/* */
/* Copyright (C) 2007-2015 */
/* CEA (Commissariat à l'énergie atomique et aux énergies */
/* alternatives) */
/* */
/* you can redistribute it and/or modify it under the terms of the GNU */
/* Lesser General Public License as published by the Free Software */
/* Foundation, version 2.1. */
/* */
/* It is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
/* */
/* See the GNU Lesser General Public License version 2.1 */
/* for more details (enclosed in the file licenses/LGPLv2.1). */
/* */
/**************************************************************************/
%{
%}
%token WORD
%token LPAR
%token RPAR
%token COMMA
%token EOF
%start main
%type main
%%
main:
type_string EOF { $1 }
word: WORD { $1 }
type_string: word { $1 }
| type_string word { "'a "^$2 }
| LPAR type_string COMMA type_string RPAR word { "('a,'b) "^$6 }
| LPAR type_string COMMA type_string COMMA type_string RPAR word { "('a,'b,'c) "^$8 }
| LPAR type_string COMMA type_string COMMA type_string COMMA type_string RPAR word { "('a,'b,'c,'d) "^$10 }
frama-c-Magnesium-20151002/doc/code/intro_occurrence.txt 0000644 0001750 0001750 00000004324 12645746441 021740 0 ustar mehdi mehdi @ignore
@ignore
@ignore This file is part of Frama-C.
@ignore
@ignore Copyright (C) 2007-2015
@ignore CEA (Commissariat à l'énergie atomique et aux énergies
@ignore alternatives)
@ignore
@ignore you can redistribute it and/or modify it under the terms of the GNU
@ignore Lesser General Public License as published by the Free Software
@ignore Foundation, version 2.1.
@ignore
@ignore It is distributed in the hope that it will be useful,
@ignore but WITHOUT ANY WARRANTY; without even the implied warranty of
@ignore MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ignore GNU Lesser General Public License for more details.
@ignore
@ignore See the GNU Lesser General Public License version 2.1
@ignore for more details (enclosed in the file licenses/LGPLv2.1).
@ignore
@ignore
{2 Overview}
The Occurrence module aims at highlighting the occurrence of any variable in
the Frama-C GUI. Details about the use of this plugin may be found in
{{:http://frama-c.cea.fr/occurrence.html}the user documentation}.
{2 Inside the plug-in}
The code of this plug-in is quite simple. It is splitted into the analysis
itself and the extension to the GUI.
The code of this plug-in is quite short but uses most advanced Frama-C
features (visitor, projects, journalisation, log, gui). So it is a good
complete not-toy example of a (kernel-integrated) Frama-C plug-in.
frama-c-Magnesium-20151002/share/ 0000755 0001750 0001750 00000000000 12645746457 015263 5 ustar mehdi mehdi frama-c-Magnesium-20151002/share/acsl.el 0000644 0001750 0001750 00000016626 12645746442 016534 0 ustar mehdi mehdi ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; This file is part of Frama-C. ;
; ;
; Copyright (C) 2008-2011 ;
; Pierre Roux ;
; ;
; Copyright (C) 2009-2015 ;
; CEA LIST ;
; ;
; you can redistribute it and/or modify it under the terms of the GNU ;
; Lesser General Public License as published by the Free Software ;
; Foundation, version 2.1. ;
; ;
; It is distributed in the hope that it will be useful, ;
; but WITHOUT ANY WARRANTY; without even the implied warranty of ;
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;
; GNU Lesser General Public License for more details. ;
; ;
; See the GNU Lesser General Public License version 2.1 ;
; for more details (enclosed in the file licenses/LGPLv2.1). ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; How to install:
;; copy the following in your .emacs file
;;
;; (setq load-path (cons "/directory/in/which/you/put/the/file/acsl.el" load-path))
;; (autoload 'acsl-mode "acsl" "Major mode for editing ACSL code" t)
;; ;; uncomment this if you want to automatically load ACSL mode with
;; ;; each C file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq auto-mode-alist
(append
'(("\\.[chi]" . acsl-mode))
auto-mode-alist))
;; you can then load the mode in emacs with M-x acsl-mode
;; TODO:
;; - font-lock for ghost code
;; code
(defun acsl-keymap-init ()
"Init keymap"
(define-key acsl-mode-map "\C-c\C-j" 'acsl-jessie-gui))
;; font-lock
(defconst acsl-keywords
'("assert"
"assigns"
"assumes"
"allocates"
"axiom"
"axiomatic"
"behavior"
"behaviors"
"breaks"
"case"
"char"
"complete"
"continues"
"decreases"
"disjoint"
"double"
"else"
"ensures"
"enum"
"exits"
"float"
"for"
"frees"
"if"
"inductive"
"int"
"integer"
"invariant"
"global"
"label"
"lemma"
"logic"
"long"
"loop"
"pragma"
"predicate"
"reads"
"real"
"requires"
"returns"
"short"
"signed"
"sizeof"
"slice"
"impact"
"struct"
"terminates"
"type"
"union"
"unsigned"
"variant"
"void"
)
"List of ACSL keywords to highlight.")
(defun acsl-in-acsl-annot ()
"If we are in a C comment beginning with @."
(and (nth 4 (syntax-ppss))
(eq (char-after (+ (nth 8 (syntax-ppss)) 2)) ?@)))
(defvar acsl-font-lock-keywords
(let ((pre-match-form (lambda ()
(goto-char (match-beginning 0))
(match-end 0)))
(find-annot (lambda (limit)
;; skip comments
(if (and (looking-at "//") (acsl-in-acsl-annot))
(re-search-forward "\n" limit 'e))
(while (and (not (acsl-in-acsl-annot)) (< (point) limit))
(re-search-forward "/[*/]" limit 'e))
(if (>= (point) limit)
nil
(let ((b (save-excursion
(re-search-backward "/[*/]" (- (point) 2) t)
(point))))
(re-search-forward "[*/]/\\|\n" limit 'e)
(re-search-backward "//" (- (point) 2) t) ; don't recolor comments
(set-match-data (list b (point) (nth 2 (match-data t))))
t)))))
(list
`(,find-annot
(0 font-lock-type-face t)
(,(concat (regexp-opt acsl-keywords 'words) "\\|=?=>?\\|&&\\|||\\|!=?\\|\\^\\^") (,pre-match-form) nil
(0 font-lock-keyword-face t))
("\\(\\?\\)[^:]*\\(:\\)" (,pre-match-form) nil
(1 font-lock-keyword-face t)
(2 font-lock-keyword-face t))
("\\(axiom\\|behavior\\|case\\|inductive\\|predicate\\|l\\(ogic\\|emma\\)\\)\\>[ \t\n@]*\\([a-zA-Z_][a-zA-Z_0-9]*\\)" (,pre-match-form) nil
(3 font-lock-function-name-face t))
("\\\\\\(at\\|e\\(mpty\\|xists\\)\\|f\\(alse\\|orall\\)\\|old\\|result\\|true\\|valid\\(_range\\|_index\\)?\\)" (,pre-match-form) nil
(0 font-lock-constant-face t)))))
"Default highlighting for ACSL mode")
(defun acsl-font-lock-init ()
"Initialize font-lock for ACSL."
(add-hook 'c-mode-hook
(lambda ()
(font-lock-add-keywords nil acsl-font-lock-keywords))))
;; custom variables
(require 'custom)
(defcustom acsl-jessie-gui-prog-name "frama-c -jessie"
"Frama-C/Jessie executable name."
:group 'acsl
:type 'string)
(defcustom acsl-jessie-int-model "exact"
"Jessie int model."
:group 'acsl
:type '(choice (const :tag "Exact" "exact")
(const :tag "Bounded" "bounded")
(const :tag "Modulo" "modulo")))
(defun acsl-jessie-gui ()
"Generate VCs and show them in a GUI"
(interactive)
(compile (concat acsl-jessie-gui-prog-name
" -jessie-int-model "
acsl-jessie-int-model
" "
(buffer-file-name))))
;; menu
(require 'easymenu)
(defun acsl-menu-init ()
(easy-menu-define
acsl-menu (list acsl-mode-map)
"ACSL Mode Menu."
'("ACSL"
["Customize ACSL mode" (customize-group 'acsl) t]
"---"
["Jessie GUI" acsl-jessie-gui t]
))
(easy-menu-add acsl-menu))
;; indent
(defun acsl-indent-command (&optional arg)
"Indent ACSL code (quite basic yet)."
(interactive "*")
(c-indent-line)
(when (and (acsl-in-acsl-annot)
(< (nth 8 (syntax-ppss)) (line-beginning-position))) ; not the first line of an annot (which don't need to be indented)
(save-excursion
(back-to-indentation)
(if (not (eq (char-after) ?@))
(insert "@")
(goto-char (+ (point) 1)))
(if (not (looking-at "*/")) ; to avoid indenting last lines of annotation of the form "@*/" (thanks Yannick)
(let ((current (save-excursion
(skip-chars-forward " \t@")))
(expected (save-excursion
(let ((cc (current-column)))
(forward-line -1)
(move-to-column cc))
(skip-chars-forward " \t@"))))
(if (save-excursion
(skip-chars-backward " \t\n@")
(memq (char-before) '(?: ?=)))
(setq expected (+ expected 2)))
(if (save-excursion
(skip-chars-forward " \t@")
(looking-at "\\<\\(axiom\\|behavior\\|predicate\\|l\\(ogic\\|emma\\)\\|inductive\\)\\>"))
(setq expected (save-excursion
(goto-char (+ (nth 8 (syntax-ppss)) 3))
(skip-chars-forward " \t@"))))
(if (< current expected)
(insert-char ? (- expected current)))
(if (> current expected)
(kill-forward-chars (- current expected))))))
(if (eq (char-after) ?@)
(skip-chars-forward " \t@"))))
(defun acsl-indent-init ()
(setq indent-line-function 'acsl-indent-command)
;; maybe not the best solution for C code but still works
(setq indent-region-function nil))
;; main function for the mode
(define-derived-mode acsl-mode c-mode
"ACSL"
"Major mode for C annoted with ACSL."
(acsl-font-lock-init)
(acsl-keymap-init)
(acsl-indent-init)
(acsl-menu-init))
(provide 'acsl-mode)
frama-c-Magnesium-20151002/share/unmark.png 0000644 0001750 0001750 00000001724 12645746442 017264 0 ustar mehdi mehdi PNG
IHDR a ;iCCPICC Profile xKhP)B%>ЊPi֑q"4sgM31HAZ*BPpBkQq"B7R&L*V/$r UScE4`λɮvxUA5R'}V>PeIƊmKbyo5.Fl[%Wɼdc(&;F'AA^
`36jr2NdhdeQnM<%iF~YƕkE/+Z_5+-Ϥ?vlSCs=0sTuTeܢea+ 79Z|Ups_. ? g"np)9]3;6vG+nhnR.Os'ܢH7c*pZ{{"焷{tD3ɍ{sO7Tw鳭8Ej"u` G<$xŃ2o?ڗ Ӟ{N2~q4#h;Fѿ^/4T<#QqefY(˚mBa^AO^Y.c_/{4C\OLMd<ٵH&|s/>z~q6\
k`Ҳ䍐.