JSDOC/Options.js
[gnome.introspection-doc-generator] / JSDOC / Options.js
1 //<script type="text/javascript">
2 /**
3  * Options management...
4  */
5 XObject = import.XObject.XObject;
6 File = import.File.File;
7
8 Options = {
9     
10     "src" : [],  // array of source directories..
11     "directory" : '',   // was d. ?? source directory (needed to put temporary files..)
12     "cacheDirectory" : '',
13     "conf" : '',       // was c.
14     "template": '',   // was t.
15     // "recurse": false,   // was r. - not supported..
16     "ext": '',   // was x.
17     "private": '',   // was p
18     "allfunctions": '',   // was a
19     "encoding": '',   // was e.
20     "nocode": '',  // was n
21     "out": '',   // was o.
22     "suppress": '',  // was s
23     "testmode": '',  // was t
24     "help": '',   // was h
25     "verbose": '',   // was v
26     "disablecache": '',   // was C
27     "define" : [],   // was D.
28     "handler" : [],  // was H -- not supported..
29     LOG : {
30         warn : function(str) {
31             print("Warn: " +str );
32         },
33         inform : function(str) {
34             print("Inform: " +str );
35         },
36         close : function() { },
37         flush : function() { },
38         out: false,
39         warnings : [],
40         verbose : false    
41     },
42     init : function()
43     {
44         this.LOG.verbose = this.verbose;
45         
46         
47         if (this.conf) {
48             XObject.extend(this, JSON.parse(File.read(this.conf)));;
49         }
50         // help ?? -- usage..
51         
52         if (!this.files.length) {
53             throw {
54                 name: "ArgumentError", 
55                 message: "No files specified" 
56             };
57         }
58         if (!this.template) {
59             throw {
60                 name: "ArgumentError", 
61                 message: "No template specified" 
62             };
63         }
64          
65         if (!this.directory) {
66             throw {
67                 name: "ArgumentError", 
68                 message: "No directory specified" 
69             };
70         }
71         // should cacheDirectory be a subdirectory of target??
72         // if not set..
73         if (!this.cacheDirectory) {
74             throw {
75                 name: "ArgumentError", 
76                 message: "No cacheDirectory specified" 
77             };
78         }
79         
80     }
81 }