dol: add command line options and empty class
[jump.git] / dol / src / dol / main / UserInterface.java
1 /* $Id: UserInterface.java 203 2010-10-11 08:59:47Z dchokshi $ */
2 package dol.main;
3
4 import java.util.ResourceBundle;
5
6 /**
7  * Class to store commandline arguments and flags.
8  */
9 public class UserInterface {
10
11     /**
12      * Get a single instance of the UserInterface object.
13      */
14     private final static UserInterface _instance = new UserInterface();
15
16
17     // the platform file name
18     private String _platformFileName = null;
19
20     // the process network file name
21     private String _networkFileName = null;
22
23     // the mapping file name
24     private String _mappingFileName = null;
25
26     // the scheduler file name
27     private String _schedulerFileName = null;
28
29     // the dotty file name
30     private String _dottyFileName = "dotty.dot";
31
32     // the systemc directory name
33     private String _codeDirectoryName = "nonamePackage";
34
35     // the pipeandfilter directory name
36     private String _pipeCodeDirectoryName = "nonamePipePackage";
37
38     // the hds directory name
39     private String _hdsCodeDirectoryName = "nonameHdsPackage";
40
41     // the RTEMS directory name
42     private String _rtemsCodeDirectoryName = "nonameHdsPackage";
43
44     // the RTEMS board support package for which code is generated
45     private String _rtemsBSP = "pc386";
46
47     // the Epiphany directory name
48     private String _epiphanyCodeDirectoryName = "nonameEpiphanyPackage";
49
50     // the protothread directory name
51     private String _protothreadCodeDirectoryName = "nonameHdsPackage";
52
53     // the CBE directory name
54     private String _cbeCodeDirectoryName = "nonameCbePackage";
55
56     // the Yapi directory name
57     private String _yapiCodeDirectoryName = "nonameYapiPackage";
58
59
60     // trace filename
61     private String _traceName = "";
62
63     // the xml generation flag
64     private boolean _xmlGen = false;
65
66     // the trace flag
67     private boolean _profiling = false;
68
69     // the verbose flag
70     private boolean _verbose = false;
71
72     // the vsp log flag
73     private boolean _vsplog = false;
74
75     // the name of the vsp log file
76     private String _vspLogFileName = "";
77
78     // the workload annotation flag
79     private boolean _workload = false;
80
81     // the name of the workload file produces by Matlab
82     private String _workloadFileName = "";
83
84     // the SystemC flag
85     private boolean _systemC = false;
86
87     // the Epiphany flag
88     private boolean _epiphanyFlag = false;
89
90     // the PipeAndFilter flag
91     private boolean _pipeAndFilter = false;
92
93     // the HdS flag
94     private boolean _hds = false;
95
96     // the RTEMS flag
97     private boolean _rtems = false;
98
99     // the CBE flag
100     private boolean _cbe = false;
101
102     // the YAPI flag
103     private boolean _yapi = false;
104
105     // the RTEMS flag
106     private boolean _protothread = false;
107
108     // the debug flag
109     private boolean _debug = false;
110
111     // the dotty flag
112     private boolean _dotty = false;
113
114     // the check flag
115     private boolean _check = false;
116
117     // the path finder flag
118     private boolean _archiPaths = true;
119
120     // the basepath name
121     private String _basePath = ".";
122
123     // the filename
124     private String _outputFileName = "";
125
126     // ResourceBundle
127     private ResourceBundle _rb;
128     private String _rbFileName = "dol";
129
130
131     public final String getMySystemCLib() {
132         /*
133         return _rb.getString("DOL_path") + getDelimiter()
134                 + "src" + getDelimiter() + "dol" + getDelimiter()
135                 + "visitor" + getDelimiter() + "systemC" + getDelimiter()
136                 + "lib";
137         */
138
139         return this.getClass().getResource(
140             "/dol/visitor/systemC/lib").getFile();
141     }
142
143    public final String getVisitorDir(){
144         return this.getClass().getResource("/dol/visitor/").getFile();
145     }
146
147     public final String getDOLPath() { return _rb.getString("DOL_path"); }
148     public final String getSystemCINC(){return _rb.getString("SYSTEMC_INC");}
149     public final String getSystemCLIB(){return _rb.getString("SYSTEMC_LIB");}
150
151     /**
152      * returns the singleton instance of this class.
153      *
154      * @return The instance value
155      */
156     public final static UserInterface getInstance() {
157         return _instance;
158     }
159
160     /**
161      * Get the name of the platform file.
162      *
163      * @return The platformFileName value
164      */
165     public final String getPlatformFileName() {
166         return _platformFileName;
167     }
168
169     /**
170      * Set the name of the platform file.
171      *
172      * @param platformFileName
173      *            The new platformFileName value
174      */
175     public final void setPlatformFileName(String platformFileName) {
176         _platformFileName = platformFileName;
177     }
178
179     /**
180      * Get the name of the process network file.
181      *
182      * @return The networkFileName value
183      */
184     public final String getNetworkFileName() {
185         return _networkFileName;
186     }
187
188     /**
189      * Set the name of the process network file.
190      *
191      * @param networkFileName
192      *            The new networkFileName value
193      */
194     public final void setNetworkFileName(String networkFileName) {
195         _networkFileName = networkFileName;
196     }
197
198     /**
199      * Get the name of the mapping file.
200      *
201      * @return The mappingFileName value
202      */
203     public final String getMappingFileName() {
204         return _mappingFileName;
205     }
206
207     /**
208      * Set the name of the mapping file.
209      *
210      * @param mappingFileName
211      *            The new mappingFileName value
212      */
213     public final void setMappingFileName(String mappingFileName) {
214         _mappingFileName = mappingFileName;
215     }
216
217
218     /**
219      * Get the name of the scheduler file.
220      *
221      * @return The schedulerFileName value
222      */
223     public final String getSchedulerFileName() {
224         return _schedulerFileName;
225     }
226
227     /**
228      * Set the name of the scheduler file.
229      *
230      * @param schedulerFileName
231      *            The new schedulerFileName value
232      */
233     public final void setSchedulerFileName(String schedulerFileName) {
234         _schedulerFileName = schedulerFileName;
235     }
236
237
238     /**
239      * Get the name of the dotty file..
240      *
241      * @return The dottyFileName value
242      */
243     public final String getDottyFileName() {
244         return _dottyFileName;
245     }
246
247     /**
248      * Set the name of the directory where the SystemC code shall be generated.
249      *
250      * @param dottyFileName The dotty file name.
251      */
252     public final void setDottyFileName(String dottyFileName) {
253         _dottyFileName = dottyFileName;
254         setDottyFlag();
255     }
256
257
258     /**
259      * Get the name of the SystemC directory.
260      *
261      * @return The directory name of the SystemC directory
262      */
263     public final String getCodeDirectoryName() {
264         return _codeDirectoryName;
265     }
266
267     /**
268      * Set the name of the directory where the SystemC code shall be generated.
269      *
270      * @param codeDirectoryName The code directory
271      */
272     public final void setCodeDirectoryName(String codeDirectoryName) {
273         _codeDirectoryName = codeDirectoryName;
274     }
275
276     /**
277      * Get the name of the Epiphany directory.
278      *
279      * @return The directory name of the Epiphany directory
280      */
281     public final String getEpiphanyCodeDirectoryName() {
282         return _epiphanyCodeDirectoryName;
283     }
284
285     /**
286      * Set the name of the Epiphany directory.
287      *
288      * @param codeDirectoryName Directory to generate Epiphany code in
289      */
290     public final void setEpiphanyCodeDirectoryName(String codeDirectoryName) {
291         _epiphanyCodeDirectoryName = codeDirectoryName;
292     }
293
294     /**
295      * Get the name of the PipeAndFilter directory.
296      *
297      * @return The directory name of the PipeAndFilter directory
298      */
299     public final String getPipeAndFilterCodeDirectoryName() {
300         return _pipeCodeDirectoryName;
301     }
302
303     /**
304      * Set the name of the directory where the Hds code shall be generated.
305      *
306      * @param codeDirectoryName The code directory
307      */
308     public final void setPipeAndFilterCodeDirectoryName(String codeDirectoryName) {
309         _pipeCodeDirectoryName = codeDirectoryName;
310     }
311
312     /**
313      * Get the name of the Hds directory.
314      *
315      * @return The directory name of the Hds directory
316      */
317     public final String getHdsCodeDirectoryName() {
318         return _hdsCodeDirectoryName;
319     }
320
321     /**
322      * Set the name of the directory where the Hds code shall be generated.
323      *
324      * @param codeDirectoryName The code directory
325      */
326     public final void setHdsCodeDirectoryName(String codeDirectoryName) {
327         _hdsCodeDirectoryName = codeDirectoryName;
328     }
329
330     /**
331      * Get the name of the protothread directory.
332      *
333      * @return The directory name of the protohread directory
334      */
335     public final String getProtothreadCodeDirectoryName() {
336         return _protothreadCodeDirectoryName;
337     }
338
339     /**
340      * Set the name of the directory where the protothread code shall be generated.
341      *
342      * @param codeDirectoryName The code directory
343      */
344     public final void setProtothreadCodeDirectoryName(String codeDirectoryName) {
345         _protothreadCodeDirectoryName = codeDirectoryName;
346     }
347
348     /**
349      * Get the name of the CBE directory.
350      *
351      * @return The directory name of the CBE directory
352      */
353     public final String getCbeCodeDirectoryName() {
354         return _cbeCodeDirectoryName;
355     }
356
357     /**
358      * Set the name of the directory where the CBE code shall be generated.
359      *
360      * @param codeDirectoryName The code directory
361      */
362     public final void setCbeCodeDirectoryName(String codeDirectoryName) {
363         _cbeCodeDirectoryName = codeDirectoryName;
364     }
365
366     /**
367      * Get the name of the YAPI directory.
368      *
369      * @return The directory name of the CBE directory
370      */
371     public final String getYapiCodeDirectoryName() {
372         return _yapiCodeDirectoryName;
373     }
374
375     /**
376      * Set the name of the directory where the YAPI code shall be generated.
377      *
378      * @param codeDirectoryName The code directory
379      */
380     public final void setYapiCodeDirectoryName(String codeDirectoryName) {
381         _yapiCodeDirectoryName = codeDirectoryName;
382     }
383     
384     /**
385      * Get the name of the RTEMS directory.
386      *
387      * @return The directory name of the RTEMS directory
388      */
389     public final String getRtemsCodeDirectoryName() {
390         return _rtemsCodeDirectoryName;
391     }
392
393     /**
394      * Set the name of the directory where the RTEMS code shall be generated.
395      *
396      * @param codeDirectoryName The code directory
397      */
398     public final void setRtemsCodeDirectoryName(String codeDirectoryName) {
399         _rtemsCodeDirectoryName = codeDirectoryName;
400     }
401
402     /**
403      * Get the name of the RTEMS board support package.
404      *
405      * @return The name of the board support package
406      */
407     public final String getRtemsBSP() {
408         return _rtemsBSP;
409     }
410
411     /**
412      * Set the name of the board support package for which RTEMS code shall
413      * be generated.
414      *
415      * @param bsp board support package for which code is generated
416      *            currently supported: pc386, mparm
417      */
418     public final void setRtemsBSP(String bsp) {
419         _rtemsBSP = bsp;
420     }
421
422     /**
423      * Get the status of the Verbose flag.
424      *
425      * @return verbose flag value
426      */
427     public final boolean getVerboseFlag() {
428         return _verbose;
429     }
430
431     /**
432      * Set the Verbose flag.
433      */
434     public final void setVerboseFlag() {
435         _verbose = true;
436     }
437
438     /**
439      * Get the status of the Debug flag.
440      *
441      * @return debug flag value
442      */
443     public final boolean getDebugFlag() {
444         return _debug;
445     }
446
447     /**
448      * Set the debug flag.
449      */
450     public final void setDebugFlag() {
451         _debug = true;
452     }
453
454     /**
455      * Get the status of the SystemC flag
456      *
457      * @return The systemC flag value
458      */
459     public final boolean getSystemCFlag() {
460         return _systemC;
461     }
462
463     /**
464      * Set the SystemC flag.
465      */
466     public final void setSystemCFlag() {
467         _systemC = true;
468     }
469
470     /**
471      * Get the status of the Epiphany flag.
472      *
473      * @return Epiphany flag value
474      */
475     public final boolean getEpiphanyFlag() {
476         return _epiphanyFlag;
477     }
478
479     /*
480      * Set the Epiphany flag.
481      */
482     public final void setEpiphanyFlag() {
483         _epiphanyFlag = true;
484     }
485
486     /**
487      * Get the status of the PipeAndFilter flag.
488      *
489      * @return PipeAndFilter flag value
490      */
491     public final boolean getPipeAndFilterFlag() {
492         return _pipeAndFilter;
493     }
494
495     /**
496      * Set the PipeAndFilter flag.
497      */
498     public final void setPipeAndFilterFlag() {
499         _pipeAndFilter = true;
500     }
501
502     /**
503      * Get the status of the protothread flag.
504      *
505      * @return PipeAndFilter flag value
506      */
507     public final boolean getProtothreadFlag() {
508         return _protothread;
509     }
510
511     /**
512      * Set the protothread flag.
513      */
514     public final void setProtothreadFlag() {
515         _protothread = true;
516     }
517
518     /**
519      * Get the status of the HdS flag.
520      *
521      * @return The HdS flag value
522      */
523     public final boolean getHdsFlag() {
524         return _hds;
525     }
526
527     /**
528      * Set the HdS flag.
529      */
530     public final void setHdsFlag() {
531         _hds = true;
532     }
533
534     /**
535      * Get the status of the RTEMS flag.
536      *
537      * @return The HdS flag value
538      */
539     public final boolean getRtemsFlag() {
540         return _rtems;
541     }
542
543     /**
544      * Set the RTEMS flag.
545      */
546     public final void setRtemsFlag() {
547         _rtems = true;
548     }
549
550     /**
551      * Get the status of the CBE flag.
552      *
553      * @return The CBE flag value
554      */
555     public final boolean getCbeFlag() {
556         return _cbe;
557     }
558
559     /**
560      * Set the CBE flag.
561      */
562     public final void setCbeFlag() {
563         _cbe = true;
564     }
565
566     /**
567      * Set the YAPI flag.
568      */
569     public final void setYapiFlag() {
570         _yapi = true;
571     }
572
573     /**
574      * Get the status of the YAPI flag.
575      *
576      * @return The YAPI flag value
577      */
578     public final boolean getYapiFlag() {
579         return _yapi;
580     }
581
582     /**
583      * Get the status of the dotty flag
584      *
585      * @return The dotty Flag value
586      */
587     public final boolean getDottyFlag() {
588         return _dotty;
589     }
590
591     /**
592      * Sets the dotty flag
593      */
594     public final void setDottyFlag() {
595         _dotty = true;
596     }
597
598     /**
599      * Get the status of the profiling flag
600      *
601      * @return The profiling Flag value
602      */
603     public final boolean getProfilingFlag() {
604         return _profiling;
605     }
606
607     /**
608      * Sets the profiling flag
609      */
610     public final void setProfilingFlag() {
611         _profiling = true;
612     }
613
614     /**
615      * Get the status of the vsp log flag.
616      *
617      * @return The vsp log value
618      */
619     public final boolean getVspLogFlag() {
620         return _vsplog;
621     }
622
623     /**
624      * Sets the vsp log flag.
625      */
626     public final void setVspLogFlag() {
627         _vsplog = true;
628     }
629
630     /**
631      * Get the status of the workload annotation flag.
632      *
633      * @return workload flag
634      */
635     public final boolean getWorkloadFlag() {
636         return _workload;
637     }
638
639     /**
640      * Sets the workload flag.
641      */
642     public final void setWorkloadFlag() {
643         _workload = true;
644     }
645
646     /**
647      * Get the status of the xml generation flag
648      *
649      * @return The xmlGen Flag value
650      */
651     public final boolean getXmlGenFlag() {
652         return _xmlGen;
653     }
654
655     /**
656      * Sets the xml generation flag
657      */
658     public final void setXmlGenFlag() {
659         _xmlGen = true;
660     }
661
662     /**
663      * Get the status of the check flag
664      *
665      * @return The check Flag value
666      */
667     public final boolean getCheckFlag() {
668         return _check;
669     }
670
671     /**
672      * Sets the check flag
673      */
674     public final void setCheckFlag() {
675         _check = true;
676     }
677
678     /**
679      * Get the status of the path finder flag
680      *
681      * @return The path finder Flag value
682      */
683     public final boolean getPathsFlag() {
684         return _archiPaths;
685     }
686
687     /**
688      * Sets the check flag
689      */
690     public final void setPathsFlag() {
691         _archiPaths = true;
692     }
693
694     /**
695      * Print a message to screen if the verbose flag has been selected with an
696      * end-of-line.
697      *
698      * @param s description that needs to printed.
699      */
700     public void printVerbose(String s) {
701         if ( getVerboseFlag() ) {
702             System.out.print(s);
703         }
704     }
705
706     /**
707      * Print a message to screen if the verbose flag has been selected.
708      *
709      * @param s description that needs to printed.
710      */
711     public void printlnVerbose(String s) {
712         if( getVerboseFlag() ) {
713             System.out.println(s);
714         }
715     }
716
717
718     /**
719      * get the name of the output file name.
720      *
721      * @return The outputFileName value
722      */
723     public final String getOutputFileName() {
724         return _outputFileName;
725     }
726
727     /**
728      * set the name of the input file name.
729      *
730      * @param filename The new outputFileName value
731      */
732     public final void setOutputFileName(String filename) {
733         _outputFileName = filename;
734     }
735
736     /**
737      * get the base path name.
738      *
739      * @return The basePath value
740      */
741     public final String getBasePath() { return _basePath; }
742
743     /**
744      * sets the base path name.
745      *
746      * @param name
747      *            The new basePath value
748      */
749     public final void setBasePath(String name) { _basePath = name; }
750
751     /**
752      * get the trace filename.
753      *
754      * @return The name value of trace file
755      */
756     public final String getTraceName() { return _traceName; }
757
758     /**
759      * sets the trace Filename.
760      *
761      * @param name trace filename
762      */
763     public final void setTraceName(String name) {
764         _traceName = name;
765     }
766
767
768     /**
769      * Get the vsp log filename.
770      *
771      * @return name of the vsp log file
772      */
773     public final String getVspLogFileName() {
774         return _vspLogFileName;
775     }
776
777     /**
778      * Set the vsp log filename.
779      *
780      * @param name vsp log filename
781      */
782     public final void setVspLogFileName(String name) {
783         _vspLogFileName = name;
784     }
785
786     /**
787      * Get the workload filename.
788      *
789      * @return name workload filename
790      */
791     public final String getWorkloadFileName() {
792         return _workloadFileName;
793     }
794
795     /**
796      * Sets the workload filename.
797      *
798      * @param name workload filename
799      */
800     public final void setWorkloadFileName(String name) {
801         _workloadFileName = name;
802     }
803
804     /**
805      * Constructor. Private since only a single version may exist.
806      */
807     private UserInterface() {
808         _rb = ResourceBundle.getBundle(_rbFileName);
809     }
810 }
811