org.vishia.java2C
Class Java2C_Main.CmdlineArgs

java.lang.Object
  extended by org.vishia.java2C.Java2C_Main.CmdlineArgs
Enclosing class:
Java2C_Main

public static class Java2C_Main.CmdlineArgs
extends java.lang.Object

The gotten arguments from the command line are hold in this extra static class. It is created before the instance of the main class will be created. Firstly, the arguments are separated in an easily comprehensible class. Secondly, it is possible to give the arguments with another way than calling as command line. Thirdly, the instance of Java2C_Main can be created with known arguments. Thereby, the constructor can access the parameters and some fields can be initialized, so they can be final.


Field Summary
private  java.lang.String sConfigFile
          Path to file given with command line argument -if:INPFILE.
private  java.lang.String sPathOut
          Path to the *.c, *.h and *.stc output files, given with cmd line argument -o:OUTPUT.
private  java.lang.String sSyntaxPath
          Path to the syntax-zbnf files, given with cmd line argument -syntax:SYNTAXDIR.
 
Constructor Summary
Java2C_Main.CmdlineArgs()
           
 
Method Summary
 void setConfigFile(java.lang.String s)
          Sets the file given with cmd line argument -if:CFGFILE.
 void setPathOut(java.lang.String path)
           
 void setSyntaxPath(java.lang.String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sConfigFile

private java.lang.String sConfigFile
Path to file given with command line argument -if:INPFILE.


sSyntaxPath

private java.lang.String sSyntaxPath
Path to the syntax-zbnf files, given with cmd line argument -syntax:SYNTAXDIR.


sPathOut

private java.lang.String sPathOut
Path to the *.c, *.h and *.stc output files, given with cmd line argument -o:OUTPUT.

Constructor Detail

Java2C_Main.CmdlineArgs

public Java2C_Main.CmdlineArgs()
Method Detail

setConfigFile

public void setConfigFile(java.lang.String s)
Sets the file given with cmd line argument -if:CFGFILE. The syntax of the config file is described in ZBNF with:
           "input::={ " 
         + "   stcPath :  ;" 
         + " | srcPath :  ; " 
         + " | replace :  ; " 
         + " | translate : <\*\s;?srcToTranslate> ;" 
         + "} \\e. "
         + "packageReplacement::=<* ;=?inputpath> =: <* ;*(?cfile_prefix> [*<* ;?cfile_suffix>] "
         + " [ ( <* ;*)?cname_prefix>[*<* ;)?cname_suffix>])]."
         + "stcPath::={ <\"\"?stcPath>| <\*\s:,;?stcPath> ? : | , }."  //write path with spaces or : or ; in quotion.
         + "srcPath::={ <\"\"?srcPath>| <\*\s:,;?srcPath> ? : | ,  }."  
 
The elements are:
stcPath Path where stc-files are located. A path may be absolute or relative from the current directory. A stc-File may located in the addressed directory, and than in that sub-dir, where the package replacement of the appropriate java file is located. If a stc-file is searched, it may be contained in any of this paths. The first location in the order of paths in the configFile are used, independent of the content of other concurrently existent stc-files.

This entry can be written in the config file more as one time. Any entry can contain more as one path like represented in the syntax.
srcPath Path where Java source-files are located. A path may be absolute or relative from the current directory. A Java-File may located in the addressed directory, and than in the package sub-dir, If a Java-file is searched, it may be contained in any of this paths.The first location in the order of paths in the configFile are used, independent of the content of other concurrently existent java-files.

This entry can be written in the config file more as one time. Any entry can contain more as one path like represented in the syntax.
packageReplacement Rule how a package structure is mapped to a C-, Header- and stc-file-structure and the names in C.
packageReplacement .inputpath java package/file-path written adequate like import-statement. Either with .* on end or .javaFile on end, than without extension .java. In opposite to the import-statement it is possible too to use / or \ as separator between directories of the path and the /javaFile.
packageReplacement .cfile_prefix directory and/or prefix for file names at C-side, written with / as separators. at example c_dir/pre if the file should stored in the output sub-dir c_dir and all filenames should start with pre.
packageReplacement .cfile_suffix suffix for file names at C-side. If the option isn't use, it means no * is written, than the packageReplacement.cfile_prefix is the whole file name. Normally the C-filename is built with prefix, the Java-file-name and the suffix.
packageReplacement .cname_prefix prefix for class identifier at C-side. If this option isn't use, the file-prefix is used as name-prefix.
packageReplacement .cname_suffix suffix for names at C-side. If the option isn't use, it means no * is written, than the packageReplacement.cname_prefix is the whole name of the class at C-side. Normally the class-name is built with prefix, the Java-class-name and the suffix. The class-name is the name of the struct containing the data and the suffix of all C-routines and other identifier associated to the Java-class.

If the whole option (prefix*suffix) isn't use, the file-prefix and suffix are used instead. That should be the standard usage, because the files and classes should built normally with the same pre- and suffixes, see examples.
srcToTranslate The sources to translate have to be named in its package tree, not with the full path. The here named sources will be translated, if the Java-files are newer against the c-, header and stc-files. Java-files, which are not named here, won't be translated. If their type-informations are necessary, the appropriate stc-file is red, independent of the timestamp of the Java file in comparision with the C-file. This is, because a translated version of the Java-file may be contained in a used C-library, the stc-file is matching to the library more closed as to the Java-File.
Example: It is the content of the example to test Java2C.
      stcPath: ../../CRuntimeJavalike, "../../CRuntimeJavalike/J1c" , "../../CRuntimeJavalike/stc"; 

      srcPath: ../../srcJava,../../srcJava.zbnf,../positionControl/srcJava;

      replace: java.lang.Exception =: Fwc/fw_Exception;
      replace: java.lang.* =: Jc/*Jc;
      replace: java.util.* =: Jc/*Jc;
      replace: org.vishia/bridgeC.*  =: Jc/*Jc; 
      replace: org/vishia/byteData/* =: Jc/*Jc; 
      replace: org/vishia/mainCmd/*  =: Jc/*Jc; 
      replace: org.vishia.util/*     =: J1c/*Jc;
      replace: org/vishia/java2C/test/* =: *_Test;
      replace: org/vishia/java2C/test/ImplIfc =: Java2cTest/ImplTest (Test_IfcImpl);

      replace: org/vishia/exampleJava2C/emulationEnv/* =: PositionCtrl/test/*_PosCtrl; 
      replace: org/vishia/exampleJava2C/java4c/* =: PositionCtrl/*_PosCtrl; 

      #import: iRequireMainController =: testenv; 

      translate: org/vishia/java2C/test/*.java;
      translate: org/vishia/util/StringPart.java

 


setPathOut

public void setPathOut(java.lang.String path)

setSyntaxPath

public void setSyntaxPath(java.lang.String path)