User's Guide for translation C code to Java
The new version of C2J provides you with two ways of translating C code sources into Java classes: you can use command prompt as in the previous versions and the Graphic User Interface implemented in the new version to make the translation more convenient for the user.
Creating a workspace
Before working at the project you should create a workspace. The workspace can contain one project, and the project can include a required number of files. You can create, edit, save and close the workspace and then open it for the further work.
To create a workspace choose "New" item in the "File" menu, select type "workspace (*.cpf)", enter the name of the new workspace and press "Open". Then add files for compilation into the project using item "Add to the project" in the "Project" menu. Files will be added into the workspace on the upper left window. By clicking on the name of the file it will be open in the new window on the right.
To save, close and open the existing workspace select appropriate items from "File" menu.
Settings
Before translation specify paths to the appropriate files using menu "Project", item "Settings":
- "Output file"- file where final java classes will be stored.
- "Intermediate files"- files used to translate your program as well as files with internal representation.
- "Additional include directories" - additional folders for searching header files.
Starting translation
To start translation choose "Build project" item from the "Build" menu or press F7. All C-files included into the project will be converted into Java classes. After processing is finished the result called "output" will be shown in the lower window.
Editing results of translation
The output contains correct Java classes, warnings and error messages. The GUI of C2J facilitates the editing of the output. By clicking on the warning or the error message the appropriate file will be shown on the upper right window and the mouse pointer will be placed on the error line.
Editing C sources
You can correct the existing C sources direct in the C2J. To save your changes use "Save", "Save as" and "Save all" items from the "File" menu.
You are also provided with possibility to create new C sources within C2J GUI. Use "New" item from the "File" menu for that. By selecting "Open" item you can open and edit the C-file without adding it to the project. If you later decide to add the created or edited C-File to the project use "Add to project" item in the "Project" menu.
Command prompt
Use C2J compiler from the command prompt the same way as GNU C compiler.
Notes: C2J has the same architecture and the same syntax as GNU C compiler. Some GNU C options which have no meaning for translation C programs into Java (like -l option, processor architecture selection options etc.) are ignored. At the same time the C2J has two additional options in comparison with GNU C:
- "-output_path outpath"- specifies the path for final java classes output.
- "-work_directory workpath"- specifies the path to the files used to convert your program as well as to the files with internal representation.
|