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