1 /* $Id: UserInterface.java 203 2010-10-11 08:59:47Z dchokshi $ */
4 import java.util.ResourceBundle;
7 * Class to store commandline arguments and flags.
9 public class UserInterface {
12 * Get a single instance of the UserInterface object.
14 private final static UserInterface _instance = new UserInterface();
17 // the platform file name
18 private String _platformFileName = null;
20 // the process network file name
21 private String _networkFileName = null;
23 // the mapping file name
24 private String _mappingFileName = null;
26 // the scheduler file name
27 private String _schedulerFileName = null;
29 // the dotty file name
30 private String _dottyFileName = "dotty.dot";
32 // the systemc directory name
33 private String _codeDirectoryName = "nonamePackage";
35 // the pipeandfilter directory name
36 private String _pipeCodeDirectoryName = "nonamePipePackage";
38 // the hds directory name
39 private String _hdsCodeDirectoryName = "nonameHdsPackage";
41 // the RTEMS directory name
42 private String _rtemsCodeDirectoryName = "nonameHdsPackage";
44 // the RTEMS board support package for which code is generated
45 private String _rtemsBSP = "pc386";
47 // the protothread directory name
48 private String _protothreadCodeDirectoryName = "nonameHdsPackage";
50 // the CBE directory name
51 private String _cbeCodeDirectoryName = "nonameCbePackage";
53 // the Yapi directory name
54 private String _yapiCodeDirectoryName = "nonameYapiPackage";
58 private String _traceName = "";
60 // the xml generation flag
61 private boolean _xmlGen = false;
64 private boolean _profiling = false;
67 private boolean _verbose = false;
70 private boolean _vsplog = false;
72 // the name of the vsp log file
73 private String _vspLogFileName = "";
75 // the workload annotation flag
76 private boolean _workload = false;
78 // the name of the workload file produces by Matlab
79 private String _workloadFileName = "";
82 private boolean _systemC = false;
84 // the PipeAndFilter flag
85 private boolean _pipeAndFilter = false;
88 private boolean _hds = false;
91 private boolean _rtems = false;
94 private boolean _cbe = false;
97 private boolean _yapi = false;
100 private boolean _protothread = false;
103 private boolean _debug = false;
106 private boolean _dotty = false;
109 private boolean _check = false;
111 // the path finder flag
112 private boolean _archiPaths = true;
115 private String _basePath = ".";
118 private String _outputFileName = "";
121 private ResourceBundle _rb;
122 private String _rbFileName = "dol";
125 public final String getMySystemCLib() {
127 return _rb.getString("DOL_path") + getDelimiter()
128 + "src" + getDelimiter() + "dol" + getDelimiter()
129 + "visitor" + getDelimiter() + "systemC" + getDelimiter()
133 return this.getClass().getResource(
134 "/dol/visitor/systemC/lib").getFile();
137 public final String getVisitorDir(){
138 return this.getClass().getResource("/dol/visitor/").getFile();
141 public final String getDOLPath() { return _rb.getString("DOL_path"); }
142 public final String getSystemCINC(){return _rb.getString("SYSTEMC_INC");}
143 public final String getSystemCLIB(){return _rb.getString("SYSTEMC_LIB");}
146 * returns the singleton instance of this class.
148 * @return The instance value
150 public final static UserInterface getInstance() {
155 * Get the name of the platform file.
157 * @return The platformFileName value
159 public final String getPlatformFileName() {
160 return _platformFileName;
164 * Set the name of the platform file.
166 * @param platformFileName
167 * The new platformFileName value
169 public final void setPlatformFileName(String platformFileName) {
170 _platformFileName = platformFileName;
174 * Get the name of the process network file.
176 * @return The networkFileName value
178 public final String getNetworkFileName() {
179 return _networkFileName;
183 * Set the name of the process network file.
185 * @param networkFileName
186 * The new networkFileName value
188 public final void setNetworkFileName(String networkFileName) {
189 _networkFileName = networkFileName;
193 * Get the name of the mapping file.
195 * @return The mappingFileName value
197 public final String getMappingFileName() {
198 return _mappingFileName;
202 * Set the name of the mapping file.
204 * @param mappingFileName
205 * The new mappingFileName value
207 public final void setMappingFileName(String mappingFileName) {
208 _mappingFileName = mappingFileName;
213 * Get the name of the scheduler file.
215 * @return The schedulerFileName value
217 public final String getSchedulerFileName() {
218 return _schedulerFileName;
222 * Set the name of the scheduler file.
224 * @param schedulerFileName
225 * The new schedulerFileName value
227 public final void setSchedulerFileName(String schedulerFileName) {
228 _schedulerFileName = schedulerFileName;
233 * Get the name of the dotty file..
235 * @return The dottyFileName value
237 public final String getDottyFileName() {
238 return _dottyFileName;
242 * Set the name of the directory where the SystemC code shall be generated.
244 * @param dottyFileName The dotty file name.
246 public final void setDottyFileName(String dottyFileName) {
247 _dottyFileName = dottyFileName;
253 * Get the name of the SystemC directory.
255 * @return The directory name of the SystemC directory
257 public final String getCodeDirectoryName() {
258 return _codeDirectoryName;
262 * Set the name of the directory where the SystemC code shall be generated.
264 * @param codeDirectoryName The code directory
266 public final void setCodeDirectoryName(String codeDirectoryName) {
267 _codeDirectoryName = codeDirectoryName;
271 * Get the name of the PipeAndFilter directory.
273 * @return The directory name of the PipeAndFilter directory
275 public final String getPipeAndFilterCodeDirectoryName() {
276 return _pipeCodeDirectoryName;
280 * Set the name of the directory where the Hds code shall be generated.
282 * @param codeDirectoryName The code directory
284 public final void setPipeAndFilterCodeDirectoryName(String codeDirectoryName) {
285 _pipeCodeDirectoryName = codeDirectoryName;
289 * Get the name of the Hds directory.
291 * @return The directory name of the Hds directory
293 public final String getHdsCodeDirectoryName() {
294 return _hdsCodeDirectoryName;
298 * Set the name of the directory where the Hds code shall be generated.
300 * @param codeDirectoryName The code directory
302 public final void setHdsCodeDirectoryName(String codeDirectoryName) {
303 _hdsCodeDirectoryName = codeDirectoryName;
307 * Get the name of the protothread directory.
309 * @return The directory name of the protohread directory
311 public final String getProtothreadCodeDirectoryName() {
312 return _protothreadCodeDirectoryName;
316 * Set the name of the directory where the protothread code shall be generated.
318 * @param codeDirectoryName The code directory
320 public final void setProtothreadCodeDirectoryName(String codeDirectoryName) {
321 _protothreadCodeDirectoryName = codeDirectoryName;
325 * Get the name of the CBE directory.
327 * @return The directory name of the CBE directory
329 public final String getCbeCodeDirectoryName() {
330 return _cbeCodeDirectoryName;
334 * Set the name of the directory where the CBE code shall be generated.
336 * @param codeDirectoryName The code directory
338 public final void setCbeCodeDirectoryName(String codeDirectoryName) {
339 _cbeCodeDirectoryName = codeDirectoryName;
343 * Get the name of the YAPI directory.
345 * @return The directory name of the CBE directory
347 public final String getYapiCodeDirectoryName() {
348 return _yapiCodeDirectoryName;
352 * Set the name of the directory where the YAPI code shall be generated.
354 * @param codeDirectoryName The code directory
356 public final void setYapiCodeDirectoryName(String codeDirectoryName) {
357 _yapiCodeDirectoryName = codeDirectoryName;
361 * Get the name of the RTEMS directory.
363 * @return The directory name of the RTEMS directory
365 public final String getRtemsCodeDirectoryName() {
366 return _rtemsCodeDirectoryName;
370 * Set the name of the directory where the RTEMS code shall be generated.
372 * @param codeDirectoryName The code directory
374 public final void setRtemsCodeDirectoryName(String codeDirectoryName) {
375 _rtemsCodeDirectoryName = codeDirectoryName;
379 * Get the name of the RTEMS board support package.
381 * @return The name of the board support package
383 public final String getRtemsBSP() {
388 * Set the name of the board support package for which RTEMS code shall
391 * @param bsp board support package for which code is generated
392 * currently supported: pc386, mparm
394 public final void setRtemsBSP(String bsp) {
399 * Get the status of the Verbose flag.
401 * @return verbose flag value
403 public final boolean getVerboseFlag() {
408 * Set the Verbose flag.
410 public final void setVerboseFlag() {
415 * Get the status of the Debug flag.
417 * @return debug flag value
419 public final boolean getDebugFlag() {
424 * Set the debug flag.
426 public final void setDebugFlag() {
431 * Get the status of the SystemC flag
433 * @return The systemC flag value
435 public final boolean getSystemCFlag() {
440 * Set the SystemC flag.
442 public final void setSystemCFlag() {
447 * Get the status of the PipeAndFilter flag.
449 * @return PipeAndFilter flag value
451 public final boolean getPipeAndFilterFlag() {
452 return _pipeAndFilter;
456 * Set the PipeAndFilter flag.
458 public final void setPipeAndFilterFlag() {
459 _pipeAndFilter = true;
463 * Get the status of the protothread flag.
465 * @return PipeAndFilter flag value
467 public final boolean getProtothreadFlag() {
472 * Set the protothread flag.
474 public final void setProtothreadFlag() {
479 * Get the status of the HdS flag.
481 * @return The HdS flag value
483 public final boolean getHdsFlag() {
490 public final void setHdsFlag() {
495 * Get the status of the RTEMS flag.
497 * @return The HdS flag value
499 public final boolean getRtemsFlag() {
504 * Set the RTEMS flag.
506 public final void setRtemsFlag() {
511 * Get the status of the CBE flag.
513 * @return The CBE flag value
515 public final boolean getCbeFlag() {
522 public final void setCbeFlag() {
529 public final void setYapiFlag() {
534 * Get the status of the YAPI flag.
536 * @return The YAPI flag value
538 public final boolean getYapiFlag() {
543 * Get the status of the dotty flag
545 * @return The dotty Flag value
547 public final boolean getDottyFlag() {
552 * Sets the dotty flag
554 public final void setDottyFlag() {
559 * Get the status of the profiling flag
561 * @return The profiling Flag value
563 public final boolean getProfilingFlag() {
568 * Sets the profiling flag
570 public final void setProfilingFlag() {
575 * Get the status of the vsp log flag.
577 * @return The vsp log value
579 public final boolean getVspLogFlag() {
584 * Sets the vsp log flag.
586 public final void setVspLogFlag() {
591 * Get the status of the workload annotation flag.
593 * @return workload flag
595 public final boolean getWorkloadFlag() {
600 * Sets the workload flag.
602 public final void setWorkloadFlag() {
607 * Get the status of the xml generation flag
609 * @return The xmlGen Flag value
611 public final boolean getXmlGenFlag() {
616 * Sets the xml generation flag
618 public final void setXmlGenFlag() {
623 * Get the status of the check flag
625 * @return The check Flag value
627 public final boolean getCheckFlag() {
632 * Sets the check flag
634 public final void setCheckFlag() {
639 * Get the status of the path finder flag
641 * @return The path finder Flag value
643 public final boolean getPathsFlag() {
648 * Sets the check flag
650 public final void setPathsFlag() {
655 * Print a message to screen if the verbose flag has been selected with an
658 * @param s description that needs to printed.
660 public void printVerbose(String s) {
661 if ( getVerboseFlag() ) {
667 * Print a message to screen if the verbose flag has been selected.
669 * @param s description that needs to printed.
671 public void printlnVerbose(String s) {
672 if( getVerboseFlag() ) {
673 System.out.println(s);
679 * get the name of the output file name.
681 * @return The outputFileName value
683 public final String getOutputFileName() {
684 return _outputFileName;
688 * set the name of the input file name.
690 * @param filename The new outputFileName value
692 public final void setOutputFileName(String filename) {
693 _outputFileName = filename;
697 * get the base path name.
699 * @return The basePath value
701 public final String getBasePath() { return _basePath; }
704 * sets the base path name.
707 * The new basePath value
709 public final void setBasePath(String name) { _basePath = name; }
712 * get the trace filename.
714 * @return The name value of trace file
716 public final String getTraceName() { return _traceName; }
719 * sets the trace Filename.
721 * @param name trace filename
723 public final void setTraceName(String name) {
729 * Get the vsp log filename.
731 * @return name of the vsp log file
733 public final String getVspLogFileName() {
734 return _vspLogFileName;
738 * Set the vsp log filename.
740 * @param name vsp log filename
742 public final void setVspLogFileName(String name) {
743 _vspLogFileName = name;
747 * Get the workload filename.
749 * @return name workload filename
751 public final String getWorkloadFileName() {
752 return _workloadFileName;
756 * Sets the workload filename.
758 * @param name workload filename
760 public final void setWorkloadFileName(String name) {
761 _workloadFileName = name;
765 * Constructor. Private since only a single version may exist.
767 private UserInterface() {
768 _rb = ResourceBundle.getBundle(_rbFileName);