Related sites: University of Antwerp | Department of Mathematics and Computer Science

# CANT Research Group

Navigation: Precompiler

# Download

File | Description | release date
--- | --- | ---
precompiler.tar.gz | Source code | 17/5/2006
precompiler-bin.tar.gz | Linux binary | 17/5/2006
precompiler-bin64.tar.gz | Linux binary for new 64 bit machines | 17/05/2006
precompiler-win32.zip | Windows binary (tested on Windows 2000 and XP) | 17/5/2006
precompiler-MacOSX.tar.gz | Binary for Mac OS X compiled with darwin ports. | 17/5/2006
test.cpp | test input file | 14/7/2005
in.cpp | input file used in examples | 1/2/2006
precompile.xml | test configuration file | 14/7/2005
mpieee.xml | configuration file used in examples | 1/2/2006
convert.schema | Schema definition for conversion configuration files | 20/9/2006
convert.dtd | DTD for conversion configuration files | 20/9/2006
skip.schema | Schema definition for conversion configuration files | 20/9/2006
skip.dtd | DTD for conversion configuration files | 20/9/2006

^ TOP

## Installation

Requirements for compiling sources:

QT 3.2.3 or greater and tools (qmake) must be installed.

Unix

Run the following commands in your favorite shell.

    tar -xzvf precompiler.tar.gz
    cd precompiler
    qmake precompile.pro
    make

Binaries for Windows/Linux

Download and extract the binary package for your platform. Copy the binary executable precompile to the correct path (in Linux /usr/bin/ or /usr/local/bin ).

^ TOP

## First Usage

To precompile the code in the file test.cpp, according to the type conversions specified in the configuration file precompile.xml, execute:

     ./precompile test.cpp test_pre.cpp -x precompile.xml

The output file test_pre.cpp generated by the precompiler should look like this:

    wschrep> cat test_pre.cpp
    #include <iostream>
    #include <iomanip>
    using namespace std;

    #include "MpIeee.hh"
    #include "ArithmosIO.hh"

    #include <stdio.h>

    MpIeee func(MpIeee & a){
      MpIeee k;
      for(int i= 1;i<5;i++)
        for(int j= 1;j<3;j++){
          char k=32;
          if(i+j>5) k='y';
          if(k=='y') {cout<<"k="<<k<<", i+j="<<i+j<<"\n";}
        }
      k=MpIeee( "2" )*a;
      return MpIeee( "3" )*a;
    }

    int main(){
      MpIeee b= MpIeee( "0.1" );MpIeee c= MpIeee( "0" );
      MpIeee d[3][3]=
        {
          MpIeee( "1.0" ), MpIeee( "2.0" ), MpIeee( "3" ),
          MpIeee( "4" ), MpIeee( "5" ), MpIeee( "6" ),
          MpIeee( "7" ), MpIeee( "8" ), MpIeee( "9" )
        };
      c=MpIeee( "3" )+MpIeee( "26" );
      b=func(c);
      {cout<<"b="<<setiosflags((ios::fixed & ios::floatfield))<<b;
    cout.precision(6);cout.fill('
    ');cout.width(0);cout.setf(ios::dec,ios::basefield);
    cout<<resetiosflags((ios::fixed & ios::floatfield))<<"\n";}
      {cout<<"d[1][2]="<<setiosflags((ios::fixed & ios::floatfield))<<d[1][2];
    cout.precision(6);cout.fill('
    ');cout.width(0);cout.setf(ios::dec,ios::basefield);
    cout<<resetiosflags((ios::fixed & ios::floatfield))<<"\n";}
      return 0;
    }