🧑‍🎓
Training Resources for Atelier B
  • Introduction
  • Guides and Tutorials
    • Installation
    • Training Videos
    • Training Slides
    • Applying the B Method
      • Project Creation
      • Code Generation
      • Mathematical Proof
        • 🔥Writing Mathematical Rules
          • Introduction
          • Introduction to the Theory Language
          • How to write mathematical rules
          • Using Automatic Prover Mechanisms
          • Guards in a nutshell
          • Normalisation of Expressions
          • Common pitfall
          • All guards in the theory language
    • Extending Atelier B
      • Syntax
      • Examples
    • Programming the CLEARSY Safety Platform
  • Examples and Case-studies
    • Fuel Level
    • Switch
    • Security Policy
    • Verified Software Competitions
  • Additional Resources
    • Glossary
    • References
    • Frequently Asked Questions
Powered by GitBook
On this page

Was this helpful?

  1. Guides and Tutorials
  2. Extending Atelier B

Examples

A simple example

Here is a simple example of tool for windows, that open the project database file (bdp) in an explorer window. The text should be saved in a file “openbdp.etool” located in the “extensions” subdirectory of the Atelier B installation directory (this directory may have to be created).

<externalTool name="openbdp"
       category="project"
       label="Open bdp"
       shortcut="Ctrl+Y"
       tooltip="Opens the project database directory in an explorer window"
       icon="openbdp.png"
       >
       <command>c:windowsexplorer.exe</command>
       <param>${projectBdp}</param>
</externalTool>

The file starts with the externalTool tag, which contains the required information as attributes (name, menu label, icon, etc…). Within the external tool, the following tags are used to describe the command:

  • command: the path to the executable file that will be started (here c:windowsexplorer.exe)

  • param: describes one parameter of the command. Here the command takes only one parameter, but for more complex commands with multiple parameters, there should be as many <param> as parameters.

The variable elements of the command (here the path to the bdp directory) are expressed using the ${variableName} notation. Here ${projectBdp} is replaced by the path to the bdp directory of the project.

A more complex example

The previous example had one major shortcoming: the path to the “explorer” executable is hardcoded. A better solution would be to allow the user to configure the path to the “explorer” executable. This can be done by using the toolParameter tag, that allows defining a new variable for using within the command. In that case, the corresponding etool file would be the following:

<externalTool name="openbdp"
      category="project"
      label="Open bdp"
      shortcut="Ctrl+Y"
      tooltip="Opens the project database directory in an explorer window"
      icon="openbdp.png"
      >
      <toolParameter name="explorer" type="exefile" default="c:windowsexplorer.exe" />

      <command>${explorer}</command>
      <param>${projectBdp}</param>
</externalTool>

Here, the toolParameter tag define a new variable that can be set by the user: a new tab is created in the “Preferences” dialog, that allows setting the path to the “explorer” executable (linux users could also provide a more suitable file manager).

Integration of ProB model-checker

A sample file is provided below:

<externalTool category="component"   name="ProBTclTk" label="&Animate with ProB (Tcl/Tk)">
   <toolParameter name="editor" type="tool" configure="yes"
   default="c:/program files/prob/ProBWin.exe" />
   <command>${editor}</command>
   <param>${componentPath}</param>
   </externalTool>
PreviousSyntaxNextProgramming the CLEARSY Safety Platform

Last updated 1 year ago

Was this helpful?

is now self generating the etool file for Atelier B (see ).

ProB model-checker
Detailed procedure