Login | Register
My pages Projects Community openCollabNet

Ephedra Quickstart

The following guide shows you how to get started with Ephedra on an IBM RS/6000 AIX system. Text you have to enter is shown in blue, terminal output in black, comments in gray.
  1. Check out a copy of Ephedra from the Ovid CVS:
    guest@rs6000:~$ cvs -d :pserver:guest@cvs.tigris.org:/cvs login
    Logging in to :pserver:guest@cvs.tigris.org:2401/cvs
    CVS password: guest
    guest@rs6000:~$ cvs -d :pserver:guest@cvs.tigris.org:/cvs checkout ovid/Ephedra
    cvs server: Updating ovid/Ephedra/C2Java
    U ovid/Ephedra/C2Java/C2Java.cc
    U ovid/Ephedra/C2Java/Documentation.tex
    U ovid/Ephedra/C2Java/c2java.icc
    U ovid/Ephedra/C2Java/c2java_pc.icc
    cvs server: Updating ovid/Ephedra/C2Java/C
    U ovid/Ephedra/C2Java/C/CodeStoreHelpers.cc
    U ovid/Ephedra/C2Java/C/ConstructorFinder.cc
    U ovid/Ephedra/C2Java/C/ExpressionMatcher.cc
    U ovid/Ephedra/C2Java/C/debug.h
    ... and more similar lines
  2. You can update your copy of Ephedra from the CVS at any time:
    guest@rs6000:~$ cd ~/ovid/Ephedra/C2Java/
    guest@rs6000:~/ovid/Ephedra/C2Java$ cvs update -d
    cvs server: Updating .
    cvs server: Updating C
    cvs server: Updating C2Java
    ... and more similar lines
  3. Build the Ephedra executable using the VisualAge C++ command line compiler:
    guest@rs6000:~$ cd ~/ovid/Ephedra/C2Java/
    guest@rs6000:~/ovid/Ephedra/C2Java$ vacbld c2java.icc 

    If there is no output from vacbld then the build was successful.

  4. Build the Ephedra Java Runtime:
    guest@rs6000:~$ cd ~/ovid/Ephedra/C2Java/Runtime/Java/
    guest@rs6000:~/ovid/Ephedra/C2Java/Runtime/Java$ make
    mkdir -p /home/guest/java/classes
    javac -d /home/guest/java/classes -g ephedra/c2java/DummyPointer.java
    javac -d /home/guest/java/classes -g ephedra/c2java/Ellipsis.java
    cd ephedra/c2java; ./makeWrapper.sh Function
    javac -d /home/guest/java/classes -g ephedra/c2java/Function.java
    cd ephedra/c2java; ./makeWrapper.sh pBoolean
    ... and more similar lines
  5. Translate a simple C hello world program to Java using Ephedra:
    guest@rs6000:~$ cd ~/ovid/Ephedra/C2Java/test/
    guest@rs6000:~/ovid/Ephedra/C2Java/test$ ../c2java hello.cc > hello.mak
    ---> compiling C/C++ code ...
    ---> transforming C/C++ to Java ...
    ---> converting selected primitives to wrappers ...
    ---> generating output files ...
    ---> done.

    Note: c2java generates not only the Java sources for you but also prints a makefile to standard output. The above command sends standard output to hello.mak so the generated makefile can then be used to compile and run the generated Java code.

  6. Compile and run the generated Java program:
    guest@rs6000:~$ cd ~/ovid/Ephedra/C2Java/test/
    guest@rs6000:~/ovid/Ephedra/C2Java/test$ make -f hello.mak
    mkdir -p /home/guest/java/classes/generated
    javac -deprecation -g -d /home/guest/java/classes/generated hello_package/hello.java
    guest@rs6000:~/ovid/Ephedra/C2Java/test$ make -f hello.mak hello_package.hello.run
    java hello_package.hello
    Hello, world!