{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

VDM++ to C++ - VDMTools CSK SYSTEMS CORPORATION The VDM to...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CSK SYSTEMS CORPORATION VDMTools The VDM++ to C++ Code Generator ver.1.0
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
How to contact CSK SYSTEMS CORPORATION: http://www.csk.com/systems Web @ [email protected] General information The VDM++ to C++ Code Generator 1.0 — Revised for VDMTools v8.2 c COPYRIGHT 2009 by CSK SYSTEMS CORPORATION The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. This document is subject to change without notice
Background image of page 2
The VDM++ to C++ Code Generator Contents 1 Introduction 1 2 Invoking the Code Generator 1 2.1 Requirements for Generating Code . . . . . . . . . . . . . . . . . 2 2.2 Using the Graphical Interface . . . . . . . . . . . . . . . . . . . . 2 2.3 Using the Command Line Interface . . . . . . . . . . . . . . . . . 5 2.4 Generated C++ Files . . . . . . . . . . . . . . . . . . . . . . . . . 6 3 Interfacing the Generated Code 7 3.1 Code Generating VDM++ Types - The Basics . . . . . . . . . . . 7 3.2 Files to be Implemented by the User . . . . . . . . . . . . . . . . 11 3.2.1 Definition of Offsets for Record Tags . . . . . . . . . . . . 12 3.2.2 Implementing Implicit Functions/Operations and Specifi- cation Statements . . . . . . . . . . . . . . . . . . . . . . . 13 3.2.3 Implementing the Main Program . . . . . . . . . . . . . . 14 3.2.4 Substituting Parts of the Generated C++ code . . . . . . 17 3.3 Compiling, Linking and Running the C++ code . . . . . . . . . . 18 4 Unsupported Constructs 20 5 Code Generating VDM Specifications - The Details 21 5.1 Code Generating Classes . . . . . . . . . . . . . . . . . . . . . . . 22 5.1.1 Object References in the VDM C++ Library . . . . . . . . 22 5.1.2 The Inheritance Structure of the Generated Code of Classes 23 5.1.3 The Structure of a Generated Class . . . . . . . . . . . . . 27 5.2 Code Generating Types . . . . . . . . . . . . . . . . . . . . . . . 28 5.2.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 5.2.2 Mapping VDM++ Types to C++ . . . . . . . . . . . . . . 30 5.2.3 Code Generating VDM++ Type Names . . . . . . . . . . 36 5.2.4 Invariants . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5.3 Code Generating Function and Operation Definitions . . . . . . . 39 5.4 Code Generating Instance Variables . . . . . . . . . . . . . . . . . 42 5.5 Code Generating Value Definitions . . . . . . . . . . . . . . . . . 44 5.6 Code Generating Expressions and Statements . . . . . . . . . . . 45 5.7 Name Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 46 5.8 Standard Library . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 A The libCG.a Library 47 A.1 cg.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 A.2 cg aux.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 i
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The VDM++ to C++ Code Generator B Handcoded C++ Files 50 B.1 DoSort userdef.h . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 B.2 ExplSort userdef.h . . . . . . . . . . . . . . . . . . . . . . . . . . 50 B.3 ImplSort userdef.h . . . . . . . . . . . . . . . . . . . . . . . . . . 50 B.4 MergeSort userdef.h . . . . . . . . . . . . . . . . . . . . . . . . . . 50 B.5 SortMachine userdef.h . . . . . . . . . . . . . . . . . . . . . . . . 50 B.6 Sorter userdef.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 B.7 ImplSort userimpl.cc . . . . . . . . . . . . . . . . . . . . . . . . . 51 B.8 sort pp.cc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 C Makefiles 55 C.1 Makefile for Unix Platform . . . . . . . . . . . . . . . . . . . . . . 55 C.2 Makefile for Windows Platform . . . . . . . . . . . . . . . . . . . 58 ii
Background image of page 4
The VDM++ to C++ Code Generator 1 Introduction The VDM++ to C++ Code Generator supports automatic generation of C++ code from VDM++ specifications. This way, the Code Generator provides you with a fast way of implementing applications based on VDM++ specifications. The Code Generator is an add-on feature to the VDM++ Toolbox. Its installation is described in the document [ SYSb ]. The following text is an extension to the VDMTools User Manual (VDM++) [ SYSe ] and it gives you an introduction to the VDM++ to C++ Code Generator. The Code Generator supports approximately 95% of all the VDM++ constructs. As a supplement, the user is given the possibility of substituting parts of the generated code with handwritten code.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}