frama-c-Phosphorus-20170501/ 0000755 0001750 0001750 00000000000 13113745012 014364 5 ustar mehdi mehdi frama-c-Phosphorus-20170501/INSTALL.md 0000644 0001750 0001750 00000026111 13113744733 016026 0 ustar mehdi mehdi # Installing Frama-C
## Table of Contents
- [Recommended mode: OPAM](#recommended-mode-opam)
- [Frama-C Requirements](#frama-c-requirements)
- [Installing OPAM](#installing-opam)
- [Installing Frama-C from OPAM](#installing-frama-c-from-opam)
- [Installing Custom Versions of Frama-C via OPAM](#installing-custom-versions-of-frama-c-via-opam)
- [Installing Frama-C on Windows (via Cygwin + OPAM)](#installing-frama-c-on-windows-via-cygwin--opam)
- [Installing Frama-C on Mac OS X](#installing-frama-c-on-mac-os-x)
- [Installing Frama-C via your Linux distribution (Debian/Ubuntu/Fedora)](#installing-frama-c-via-your-linux-distribution-debianubuntufedora)
- [Debian/Ubuntu](#debianubuntu)
- [Fedora](#fedora)
- [Compiling from source](#compiling-from-source)
- [Quick Start](#quick-start)
- [Full Compilation Guide](#full-compilation-guide)
- [Available resources](#available-resources)
- [Installing Additional Plugins](#installing-additional-plugins)
## Recommended mode: OPAM
The preferred method of installation for Frama-C is using
[OPAM](http://opam.ocaml.org/) (v1.2 or newer).
First you need to install OPAM, then you may install Frama-C using OPAM:
opam install frama-c
**Note:** make sure your OPAM version is >= 1.2.
Also, it is highly recommended that you install an external solver
for OPAM, such as `aspcud`, otherwise unexpected dependency errors
may occur during installation.
### Installing OPAM
Several Linux distributions already include an `opam` package.
OSX has OPAM through Homebrew.
A Windows OPAM is currently being developed, but it is not yet stable.
**Note**: Some distributions include an old version of OPAM (<= 1.1).
It cannot be used to reliably install Frama-C due to conflicts
between dependencies.
If your system does not have an OPAM package, you can compile it from source,
or use the provided OPAM binaries available at:
http://opam.ocaml.org/doc/Install.html
### Installing Frama-C from OPAM
There are two Frama-C packages in OPAM:
- `frama-c-base`: minimal Frama-C installation, without GUI; few dependencies
- `frama-c`: includes all GUI-related dependencies, plus other recommended
packages.
The `frama-c` package recommends the installation of optional packages, e.g.
external provers for WP, such as `why3` and `coq`.
To install `frama-c`, you may need to install Gtk, GtkSourceView and
GnomeCanvas separately.
These are C libraries with OCaml bindings used by the GUI.
On many systems, OPAM can take care of these external dependencies through
its `depext` plug-in: issuing the two commands
opam install depext
opam depext frama-c
will install the appropriate system packages (this of course requires
to have administrator rights on the system).
### Installing Custom Versions of Frama-C via OPAM
If you have a **non-standard** version of Frama-C available
(with proprietary extensions, custom plugins, etc.),
you can use OPAM to install Frama-C's dependencies and compile your
own sources directly:
# optional: remove the standard frama-c package if it was installed
opam remove --force frama-c frama-c-base
# install Frama-C's dependencies
opam install depext
opam depext frama-c
opam install --deps-only frama-c
# install custom version of frama-c
opam pin add frama-c-base
where `` is the root of your unpacked Frama-C archive.
If your extensions require other libraries than the ones already used
by Frama-C, they must of course be installed as well.
### Installing Frama-C on Windows (via Cygwin + OPAM)
Windows is not officially supported by the Frama-C team
(as in, we may not have the time to fix all issues),
but Frama-C has been succesfully compiled in Windows with the following tools:
- Cygwin (for shell and installation support only;
the compiled binaries do not depend on Cygwin)
- OPAM for Windows (currently experimental)
- OCaml MinGW-based compiler
Installation instructions are described (and updated continuously) on the
Frama-C wiki:
https://bts.frama-c.com/dokuwiki/doku.php?id=mantis:frama-c:compiling_from_source
Frama-C Windows releases are periodically made available on the non-official
OPAM MinGW repository:
https://github.com/fdopen/opam-repository-mingw
### Installing Frama-C on 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 gmp
Graphical User Interface:
brew install gtk+ --with-jasper
brew install gtksourceview libgnomecanvas graphviz
opam install lablgtk ocamlgraph
Required for Frama-C:
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
## Installing Frama-C via your Linux distribution (Debian/Ubuntu/Fedora)
**NOTE**: Distribution packages are not as up-to-date as OPAM packages.
We recommend using OPAM if possible.
### Debian/Ubuntu
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
### Fedora
If you are using Fedora >= 13 then a Frama-C package is provided:
yum install frama-c
## Compiling from source
**Note**: These instructions are no longer required in the vast majority
of cases. They are kept here mostly for historical reference.
### Quick Start
1. Install OCaml, OCamlfind, OCamlGraph and Zarith if not already installed.
Note that OCaml >= 4.02.3 is needed in order to compile Frama-C.
2. (Optional) For the GUI, also install Gtk, GtkSourceView, GnomeCanvas and
Lablgtk2 if not already installed.
See section 'REQUIREMENTS' below for indications on the names of the
packages to install, or use 'opam depext' as explained in section 'Opam'
above.
3. On Linux-like distributions:
./configure && make && sudo make install
See section *Configuration* below for options.
4. On Windows+Cygwin or Windows+MinGW+msys:
./configure --prefix C:/windows/path/with/direct/slash/no/space && make && make install
5. The binary `frama-c` (and `frama-c-gui` if you have lablgtk2) is now installed.
6. 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
### Full Compilation Guide
#### Requirements
- GNU make version >= 3.81
- OCaml >= 4.02.3
- a C compiler with standard C and POSIX headers and libraries
- [OCamlGraph][OCamlGraph] >= 1.8.5
- [findlib][findlib] >= 1.6.1
- [Zarith][Zarith]
The Frama-C GUI also requires:
- Gtk (>= 2.4)
- GtkSourceView 2.x
- GnomeCanvas 2.x
- LablGtk >= 2.18.2
Plugins may have their own requirements.
Consult their specific documentations for details.
[OCamlGraph]: http://ocamlgraph.lri.fr
[findlib]: http://projects.camlcity.org/projects/findlib.html
[Zarith]: http://forge.ocamlcore.org/projects/zarith
##### Ubuntu
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 versions 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 provide packages for the required tools and libraries.
Please send us patches to update this section for your favorite distro.
#### 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 plugin can be enabled by `--enable-plugin` and disabled by `--disable-plugin`.
By default, all distributed plugins 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 plugins, 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.
- `oracles` sets up the Frama-C test suite oracles for your own configuration.
- `tests` performs Frama-C's own tests
##### Under Cygwin or MinGW
Use: `make FRAMAC_ROOT_SRCDIR="$(cygpath -a -m $PWD)"`
#### Installation
Type `make install`
(depending on the installation directory, this may require superuser
privileges. The installation directory is chosen through `--prefix`).
#### 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)
#### API Documentation
For plugin developers, the API documentation of the Frama-C kernel and
distributed plugins 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 plugins.
(Depending on the installation directory, this may require superuser
privileges.)
## Available resources
Once Frama-C is installed, the following resources should be installed and
available:
### Executables: (in `/INSTALL_DIR/bin`)
- `frama-c`
- `frama-c-gui` if available
- `frama-c-config` displays Frama-C configuration paths
- `frama-c.byte` bytecode version of frama-c
- `frama-c-gui.byte` bytecode version of frama-c-gui, if available
- `ptests.opt` testing tool for Frama-c
- `frama-c.toplevel` if 'make top' previously done
### Shared files: (in `/INSTALL_DIR/share/frama-c` and subdirectories)
- some `.h` and `.c` files used as preludes by Frama-C
- some `Makefiles` used to compile dynamic plugins
- some `.rc` files used to configure Frama-C
- some image files used by the Frama-C GUI
### Documentation files: (in `/INSTALL_DIR/share/frama-c/doc`)
- files used to generate dynamic plugin documentation
### Object files: (in `/INSTALL_DIR/lib/frama-c`)
- object files used to compile dynamic plugins
### Plugin files: (in `/INSTALL_DIR/lib/frama-c/plugins`)
- object files of available dynamic plugins
### Man files: (in `/INSTALL_DIR/man/man1`)
- `man` files for `frama-c` (and `frama-c-gui` if available)
## Installing Additional Plugins
Plugins may be released independently of Frama-C.
The standard way for installing them should be:
./configure && make && sudo make install
Plugins may have their own custom installation procedures.
Consult their specific documentations for details.
## HAVE FUN WITH FRAMA-C!
frama-c-Phosphorus-20170501/README.md 0000644 0001750 0001750 00000010325 13113744733 015655 0 ustar mehdi mehdi 
[Frama-C](http://frama-c.com) is a platform dedicated to the analysis of
source code written in C.
## A Collaborative Platform
Frama-C gathers several analysis techniques in a single collaborative
platform, consisting of a **kernel** providing a core set of features
(e.g., a normalized AST for C programs) plus a set of analyzers,
called **plug-ins**. Plug-ins can build upon results computed by other
plug-ins in the platform.
Thanks to this approach, Frama-C provides sophisticated tools, including:
- an analyzer based on abstract interpretation, aimed at verifying
the absence of run-time errors (**EVA**);
- a program proof framework based on weakest precondition calculus (**WP**);
- a program slicer (**Slicing**);
- a tool for verification of temporal (LTL) properties (**Aoraï**);
- several tools for code base exploration and dependency analysis
(**From**, **Impact**, **Metrics**, **Occurrence**, **Scope**, etc.).
These plug-ins share a common language and can exchange information via
**[ACSL](http://frama-c.com/acsl.html)** (*ANSI/ISO C Specification Language*)
properties. Plug-ins can also collaborate via their APIs.
## Installation
For more detailed information about installing OPAM/Frama-C,
see [INSTALL.md](INSTALL.md).
Frama-C is available through [OPAM](http://opam.ocaml.org/), the
OCaml Package Manager. This is the preferred installation method. Be sure
to install opam v1.2 or higher. Then the following sequence of commands
should install frama-c and its gui:
opam init
opam install depext
opam depext frama-c
opam install frama-c
Frama-C is developed mainly in Linux, often tested in Mac OSX
(via Homebrew), and occasionally tested on Windows
(with Cygwin + MinGW).
## Usage
Frama-C can be run from the command-line, or via its graphical interface.
#### Simple usage
The recommended usage for simple files is one of the following lines:
frama-c file.c - [options]
frama-c-gui file.c
Where `-` is one of the several Frama-C plug-ins,
e.g. `-val`, or `-wp`, or `-metrics`, etc.
Plug-ins can also be run directly from the GUI.
To list all plug-ins, run:
frama-c -plugins
Each plug-in has a help command
(`--help` or `--h`) that describes its several
options.
Finally, the list of options governing the behavior of Frama-C's kernel itself
is available through
frama-c -kernel-help
#### Complex scenarios
For more complex usage scenarios (lots of files and directories,
with several preprocessing directives), we recommend splitting Frama-C's usage
in two parts:
1. Parsing the input files and saving the result to a file;
2. Loading the parsing results and then running the analyses or the GUI.
Parsing typically involves giving extra arguments to the C preprocessor,
so the `-cpp-extra-args` option is often useful, as in the example below:
frama-c *.c *.h -cpp-extra-args="-D -I" -save parsed.sav
The results are then loaded into Frama-C for further analyses or for inspection
via the GUI:
frama-c -load parsed.sav - [options]
frama-c-gui -load parsed.sav - [options]
## Further reference
- Links to user and developer manuals, Frama-C archives,
and plug-in manuals are available at http://frama-c.com/download.html
- [StackOverflow](http://stackoverflow.com/questions/tagged/frama-c) has several
questions with the `frama-c` tag, which is monitored by several members of the
Frama-C community.
- The [Frama-c-discuss mailing list](http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/frama-c-discuss)
is used for announcements and general discussions.
- The [official bug tracking system](http://bts.frama-c.com/) can be used for
bug reports.
- The [Frama-C wiki](https://bts.frama-c.com/dokuwiki/doku.php?id=mantis:frama-c:start)
has some useful information, although it is not entirely up-to-date.
- The [Frama-C blog](http://blog.frama-c.com/) has several posts about
new developments of Frama-C, as well as general discussions about the C
language, undefined behavior, floating-point computations, etc.
- The [Github snapshot repository](https://github.com/Frama-C/Frama-C-snapshot)
contains the .tar.gz archives of stable Frama-C releases, ready to be cloned.
frama-c-Phosphorus-20170501/.make-clean-stamp 0000644 0001750 0001750 00000000002 13113744733 017505 0 ustar mehdi mehdi 7
frama-c-Phosphorus-20170501/opam/ 0000755 0001750 0001750 00000000000 13113744777 015341 5 ustar mehdi mehdi frama-c-Phosphorus-20170501/opam/opam 0000644 0001750 0001750 00000005535 13113744734 016221 0 ustar mehdi mehdi opam-version: "1.2"
name: "frama-c-base"
version: "20170501"
maintainer: "francois.bobot@cea.fr"
authors: [
"Michele Alberti"
"Gergö Barany"
"Patrick Baudin"
"François Bobot"
"Richard Bonichon"
"David Bühler"
"Loïc Correnson"
"Julien Crétin"
"Pascal Cuoq"
"Zaynah Dargaye"
"Jean-Christophe Filliâtre"
"Philippe Herrmann"
"Florent Kirchner"
"Tristan Le Gall"
"Jean-Christophe Léchenet"
"Matthieu Lemerre"
"David Maison"
"Claude Marché"
"André Maroneze"
"Benjamin Monate"
"Yannick Moy"
"Anne Pacalet"
"Valentin Perrelle"
"Guillaume Petiot"
"Virgile Prevosto"
"Armand Puccetti"
"Muriel Roger"
"Julien Signoles"
"Kostyantyn Vorobyov"
"Boris Yakobowski"
]
homepage: "http://frama-c.com/"
license: "GNU Lesser General Public License version 2.1"
dev-repo: "https://github.com/Frama-C/Frama-C-snapshot.git"
doc: ["http://frama-c.com/download/user-manual-Phosphorus-20170501.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: [
["sh" "-eux" "./run_autoconf_if_needed.sh"] # when used in pinned mode,
# the configure *cannot* yet be
# generated
["./configure" "--prefix" prefix
"--disable-gui" { !conf-gtksourceview:installed |
!conf-gnomecanvas:installed }
]
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
remove: [
["sh" "-eux" "./run_autoconf_if_needed.sh"] # when used in pinned mode,
# the configure *cannot* yet be
# generated
["./configure" "--prefix" prefix
"--disable-gui" { !conf-gtksourceview:installed |
!conf-gnomecanvas:installed }
]
[make "uninstall"]
["rm" "-rf" frama-c-base:doc]
]
build-doc: [
[make "-C" "doc" "download"]
[make "-C" "doc" "FRAMAC_DOCDIR=%{frama-c-base:doc}%" "install"]
]
build-test: [
[make "-j%{jobs}%" "PTESTS_OPTS=-error-code" "tests"]
]
depends: [
"ocamlgraph" { >= "1.8.5" & < "1.9~" }
"ocamlfind"
"zarith"
]
depopts: [
"lablgtk"
"conf-gtksourceview"
"conf-gnomecanvas"
"coq" { build }
"why3" { build }
]
messages: [
"Why3 can be used by the WP plug-in for running additional automatic solvers" { !why3:installed }
"Coq can be used with the WP plug-in for proving interactively proof obligations" { !coq:installed }
]
conflicts: [
"why3-base" { < "0.86" } #for WP plug-in
"coq" { < "8.4.6" } #for WP plug-in
"lablgtk" { < "2.18.2" } #for ocaml >= 4.02.1
]
available: [ ocaml-version >= "4.02.3" ]
frama-c-Phosphorus-20170501/opam/frama-c/ 0000755 0001750 0001750 00000000000 13113744777 016647 5 ustar mehdi mehdi frama-c-Phosphorus-20170501/opam/frama-c/opam 0000644 0001750 0001750 00000003034 13113744734 017517 0 ustar mehdi mehdi opam-version: "1.2"
name: "frama-c"
version: "20170501"
maintainer: "francois.bobot@cea.fr"
authors: [
"Michele Alberti"
"Gergö Barany"
"Patrick Baudin"
"François Bobot"
"Richard Bonichon"
"David Bühler"
"Loïc Correnson"
"Julien Crétin"
"Pascal Cuoq"
"Zaynah Dargaye"
"Jean-Christophe Filliâtre"
"Philippe Herrmann"
"Florent Kirchner"
"Tristan Le Gall"
"Jean-Christophe Léchenet"
"Matthieu Lemerre"
"David Maison"
"Claude Marché"
"André Maroneze"
"Benjamin Monate"
"Yannick Moy"
"Anne Pacalet"
"Valentin Perrelle"
"Guillaume Petiot"
"Virgile Prevosto"
"Armand Puccetti"
"Muriel Roger"
"Julien Signoles"
"Kostyantyn Vorobyov"
"Boris Yakobowski"
]
homepage: "http://frama-c.com/"
license: "GNU Lesser General Public License version 2.1"
dev-repo: "https://github.com/Frama-C/Frama-C-snapshot.git"
doc: ["http://frama-c.com/download/user-manual-Phosphorus-20170501.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"
]
depends: [
"frama-c-base" { = "20170501" }
"lablgtk" { >= "2.18.2" } #for ocaml >= 4.02.1
"conf-gtksourceview"
"conf-gnomecanvas"
"alt-ergo"
]
depopts: [
"altgr-ergo" { build }
]
messages: [
"Alt-Ergo Graphical Interface can be used by the WP plug-in" { !altgr-ergo:installed }
]
available: [ ocaml-version >= "4.02.3" ]
frama-c-Phosphorus-20170501/opam/frama-c/descr 0000644 0001750 0001750 00000001624 13113744734 017666 0 ustar mehdi mehdi Platform dedicated to the analysis of source code written in C.
Frama-C gathers several analysis techniques in a single collaborative
framework, based on analyzers (called "plug-ins") that can build upon the
results computed by other analyzers in the framework.
Thanks to this approach, Frama-C provides sophisticated tools, including:
- an analyzer based on abstract interpretation (EVA plug-in);
- a program proof framework based on weakest precondition calculus (WP plug-in);
- a program slicer (Slicing plug-in);
- a tool for verification of temporal (LTL) properties (Aoraï plug-in);
- several tools for code base exploration and dependency analysis
(plug-ins From, Impact, Metrics, Occurrence, Scope, etc.).
These plug-ins communicate between each other via the Frama-C API
and via ACSL (ANSI/ISO C Specification Language) properties.
This virtual package forces the installation of frama-C with its IDE.
frama-c-Phosphorus-20170501/opam/files/ 0000755 0001750 0001750 00000000000 13113744777 016443 5 ustar mehdi mehdi frama-c-Phosphorus-20170501/opam/files/run_autoconf_if_needed.sh 0000644 0001750 0001750 00000000074 13113744734 023455 0 ustar mehdi mehdi #!/bin/sh -eux
if [ ! -f "configure" ]; then
autoconf
fi
frama-c-Phosphorus-20170501/opam/descr 0000644 0001750 0001750 00000001515 13113744734 016357 0 ustar mehdi mehdi Platform dedicated to the analysis of source code written in C.
Frama-C gathers several analysis techniques in a single collaborative
framework, based on analyzers (called "plug-ins") that can build upon the
results computed by other analyzers in the framework.
Thanks to this approach, Frama-C provides sophisticated tools, including:
- an analyzer based on abstract interpretation (EVA plug-in);
- a program proof framework based on weakest precondition calculus (WP plug-in);
- a program slicer (Slicing plug-in);
- a tool for verification of temporal (LTL) properties (Aoraï plug-in);
- several tools for code base exploration and dependency analysis
(plug-ins From, Impact, Metrics, Occurrence, Scope, etc.).
These plug-ins communicate between each other via the Frama-C API
and via ACSL (ANSI/ISO C Specification Language) properties.
frama-c-Phosphorus-20170501/doc/ 0000755 0001750 0001750 00000000000 13113745006 015134 5 ustar mehdi mehdi frama-c-Phosphorus-20170501/doc/README 0000644 0001750 0001750 00000001161 13113744733 016021 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-Phosphorus-20170501/doc/Makefile 0000644 0001750 0001750 00000005440 13113745006 016577 0 ustar mehdi mehdi ##########################################################################
# #
# This file is part of Frama-C. #
# #
# Copyright (C) 2007-2017 #
# 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-Phosphorus-20170501/doc/code/ 0000755 0001750 0001750 00000000000 13113745012 016043 5 ustar mehdi mehdi frama-c-Phosphorus-20170501/doc/code/intro_pdg.txt 0000644 0001750 0001750 00000012044 13113745010 020570 0 ustar mehdi mehdi #*************************************************************************#
#* #
#* This file is part of Frama-C. #
#* #
#* Copyright (C) 2007-2017 #
#* 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). #
#* #
#*************************************************************************#
{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-Phosphorus-20170501/doc/code/intro_plugin_D_and_S.txt 0000644 0001750 0001750 00000004455 13113745006 022677 0 ustar mehdi mehdi #*************************************************************************#
#* #
#* This file is part of Frama-C. #
#* #
#* Copyright (C) 2007-2017 #
#* 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). #
#* #
#*************************************************************************#
{2 Dynamic Entry Points}
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 Structure}
- {{: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-Phosphorus-20170501/doc/code/intro_sparecode.txt 0000644 0001750 0001750 00000005357 13113745012 021776 0 ustar mehdi mehdi #*************************************************************************#
#* #
#* This file is part of Frama-C. #
#* #
#* Copyright (C) 2007-2017 #
#* 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). #
#* #
#*************************************************************************#
{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-Phosphorus-20170501/doc/code/toc_head.htm 0000644 0001750 0001750 00000003754 13113745003 020334 0 ustar mehdi mehdi
Frama-C API
frama-c-Phosphorus-20170501/doc/code/style.css 0000644 0001750 0001750 00000012562 13113745007 017727 0 ustar mehdi mehdi /**************************************************************************/
/* */
/* This file is part of Frama-C. */
/* */
/* Copyright (C) 2007-2017 */
/* 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-Phosphorus-20170501/doc/code/intro_kernel_plugin.txt 0000644 0001750 0001750 00000004021 13113745006 022655 0 ustar mehdi mehdi #*************************************************************************#
#* #
#* This file is part of Frama-C. #
#* #
#* Copyright (C) 2007-2017 #
#* 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). #
#* #
#*************************************************************************#
{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-Phosphorus-20170501/doc/code/intro_scope.txt 0000644 0001750 0001750 00000003770 13113745003 021137 0 ustar mehdi mehdi #*************************************************************************#
#* #
#* This file is part of Frama-C. #
#* #
#* Copyright (C) 2007-2017 #
#* 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). #
#* #
#*************************************************************************#
{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-Phosphorus-20170501/doc/code/intro_plugin.txt 0000644 0001750 0001750 00000004255 13113745005 021325 0 ustar mehdi mehdi #*************************************************************************#
#* #
#* This file is part of Frama-C. #
#* #
#* Copyright (C) 2007-2017 #
#* 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). #
#* #
#*************************************************************************#
{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-Phosphorus-20170501/doc/code/intro_slicing.txt 0000644 0001750 0001750 00000010625 13113745006 021456 0 ustar mehdi mehdi #*************************************************************************#
#* #
#* This file is part of Frama-C. #
#* #
#* Copyright (C) 2007-2017 #
#* 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). #
#* #
#*************************************************************************#
{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-Phosphorus-20170501/doc/code/intro_plugin_default.txt 0000644 0001750 0001750 00000004142 13113745011 023021 0 ustar mehdi mehdi #*************************************************************************#
#* #
#* This file is part of Frama-C. #
#* #
#* Copyright (C) 2007-2017 #
#* 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). #
#* #
#*************************************************************************#
{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-Phosphorus-20170501/doc/code/toc_tail.htm 0000644 0001750 0001750 00000003424 13113745004 020357 0 ustar mehdi mehdi
frama-c-Phosphorus-20170501/doc/code/docgen.ml 0000644 0001750 0001750 00000034672 13113745001 017646 0 ustar mehdi mehdi (**************************************************************************)
(* *)
(* This file is part of Frama-C. *)
(* *)
(* Copyright (C) 2007-2017 *)
(* 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-Phosphorus-20170501/doc/code/intro_occurrence.txt 0000644 0001750 0001750 00000004200 13113745007 022147 0 ustar mehdi mehdi #*************************************************************************#
#* #
#* This file is part of Frama-C. #
#* #
#* Copyright (C) 2007-2017 #
#* 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). #
#* #
#*************************************************************************#
{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-Phosphorus-20170501/share/ 0000755 0001750 0001750 00000000000 13113745012 015466 5 ustar mehdi mehdi frama-c-Phosphorus-20170501/share/unmark.png 0000644 0001750 0001750 00000001724 13113744734 017507 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`Ҳ䍐.