Skip to content

Commit

Permalink
Fix README sections
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwvj committed Oct 12, 2016
1 parent 2f48146 commit e1d51fc
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions readme.md
Expand Up @@ -9,7 +9,7 @@ The following contributes to this overhead:
* the nature of the VDM language requires runtime type information similar to RTTI for C++
* ...

# Installation
## Installation

VDM2C can be installed as a plugin for the [Overture](http://overturetool.org/) tool. Stable releases are available via the p2 update site:

Expand All @@ -19,13 +19,13 @@ For those who want to try out the newest VDM2C features it is possible to obtain

* http://overture.au.dk/vdm2c/development/repository/

# Development environment prerequisites
## Development environment prerequisites

* `cmake` is needed in order to run the tests

## Compiler tool dependencies
### Compiler tool dependencies

### Install glib
#### Install glib

* ubuntu

Expand All @@ -39,7 +39,7 @@ sudo apt-get install libglib2.0
brew install glib
```

### Install gettext
#### Install gettext

`gettext` is not present on OSX so install it with

Expand All @@ -48,20 +48,20 @@ brew install gettext
brew link --force gettext
```

## Using Eclipse
### Using Eclipse

Please install: CDT + *C/C++ Unit Testing Support*


## Other packages
### Other packages

* ubuntu

```bash
sudo apt-get install cmake make gcc g++
```

# Compiling
## Compiling

The generated code is tested using googletest, which is available via a git submodule. This submodule must be initialised after a successful checkout:

Expand All @@ -74,7 +74,7 @@ The generated code is tested using googletest, which is available via a git subm
cmake -DCMAKE_BUILD_TYPE=Debug .
```

# Development
## Development

The translation is developed in two parts:

Expand All @@ -83,7 +83,7 @@ The translation is developed in two parts:
* Library support providing a number of macros to ease class encoding
2. A translation of VDM into C using this library

## Import the entire runtime in Eclipse
### Import the entire runtime in Eclipse

1. execute cmake in the root (and make sure you have initialised the googletest submodule)
2. Create a new C++-project in Eclipse based on a standard makefile project using your avaliable tool chain.
Expand All @@ -92,56 +92,56 @@ The translation is developed in two parts:
3. Build the project to see if Eclipse picks up the imports
* If it do not pickup the includes then use the fix below

## Update *CDT GCC Build Output Parser* to work with *CMake* on OSX
### Update *CDT GCC Build Output Parser* to work with *CMake* on OSX

1. Goto `Project Properties -> C/C++ General -> Preprocessor Include Paths, Macros etc.`
2. Enable `CDT GCC Build Output Parser`
3. Change the *Compiler Command Pattern* to `(.*gcc)|(.*[gc]\+\+)|(.*cc)|(clang)`

Source: https://developer.mozilla.org/en-US/docs/Eclipse_CDT

### Running tests
#### Running tests

* To run the tests one must pass the location of the VDM library as a property `-DVDM_LIB_PATH="/path/to/vdm2c-exploration/c-examples/lib"`
* Pass the `-DTEST_OUTPUT` property to get the googletest output

### Test the runtime library
#### Test the runtime library

All the code used to test the runtime library is stored in `<root>/c/vdmclib/src/tests` and written using the googletest framework. The tests are run automatically as part of the Maven build, but may also be executed manually using the steps below:

```bash
# Go into runtime library folder
## Go into runtime library folder
cd <root>/c
# Generate the make file
## Generate the make file
cmake .
# Build the google test binary
## Build the google test binary
make -j<no-of-cpu-cores-plus-one
# Go to the folder that contains the tests
## Go to the folder that contains the tests
cd vdmclib/
# Run the generated google tests
## Run the generated google tests
make test
```
The test report is available in `report.xml`

# Notes
## Notes

## Using googletest
### Using googletest

https://bjornarnelid.wordpress.com/2014/03/10/how-to-get-started-with-google-test-in-eclipse-cdt-on-linux/


## Name mangling
### Name mangling

https://en.wikipedia.org/wiki/Name_mangling
http://www.avabodh.com/cxxin/namemangling.html

## Eclipse editor for velocity
### Eclipse editor for velocity

* Remember to install `Eclipse 2.0 Style Plugin Support` before trying to install the editor *

https://marketplace.eclipse.org/content/veloeclipse

## Translation Notes
### Translation Notes

If one wants to use the C code from C++ it can be included as shown below:

Expand All @@ -157,18 +157,18 @@ extern "C"
Therefore:
* never use any C++ keywords in C. It leads to trouble later...

## Transformation Rules
### Transformation Rules

All nodes that is shared between VDM and C must have a C plain C template. This means it **cannot** use the VDM library for code generation.

## Implementing classes
### Implementing classes

* http://www.pvv.ntnu.no/~hakonhal/main.cgi/c/classes/
* http://www.eventhelix.com/RealtimeMantra/basics/ComparingCPPAndCPerformance2.htm#.VmbPCuODFBc
* http://www.go4expert.com/articles/virtual-table-vptr-multiple-inheritance-t16616/
* http://www.go4expert.com/articles/virtual-table-vptr-t16544/

## C/C++ language related stuff
### C/C++ language related stuff

* http://stackoverflow.com/questions/3523145/pointer-arithmetic-for-void-pointer-in-c
* https://www.cs.uaf.edu/2010/fall/cs301/lecture/10_15_struct_and_class.html
Expand All @@ -180,12 +180,12 @@ All nodes that is shared between VDM and C must have a C plain C template. This
* http://www.drdobbs.com/cpp/single-inheritance-classes-in-c/184406396?pgno=1
* http://www.pvv.ntnu.no/~hakonhal/main.cgi/c/classes

## C Macro
### C Macro

* Compare arguments (`#a==#b`) http://stackoverflow.com/questions/33491170/whats-the-difference-in-the-and-in-the-following-c-code
* Statements inline eval http://stackoverflow.com/questions/4712720/typechecking-macro-arguments-in-c

## Compiler -- platform dependent stuff
### Compiler -- platform dependent stuff

Remember that:

Expand All @@ -194,9 +194,9 @@ Remember that:

This is important since `free` only frees the memory if `ptr != NULL`

## Other debugging related stuff
### Other debugging related stuff

### Core dump in terminal only
#### Core dump in terminal only

Enable the core to be dumped by:

Expand Down

0 comments on commit e1d51fc

Please sign in to comment.