]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - packages/ti/sdo/ipc/family/procNamesDocGen.xs
Added linux-side executable, libraries and object files to the .gitignore list
[ipc/ipcdev.git] / packages / ti / sdo / ipc / family / procNamesDocGen.xs
1 /*
2  * Copyright (c) 2012-2013, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*
33  *  ======== delegateDocGen.xs ========
34  *
35  */
37 outFileName = "doc-files/procNames.html";
39 var blacklist = [
40     'TMS320CTCI6497',
41     'TMS320CTCI6498',
42     'TMS320DM8168',
43     'TMS320DM8148',
44     'TMS320CDM740',
45     'Arctic',
46     'Sonata',
47     'T16v200',
48 ];
50 /*
51  *  ======== getFamilyIndex ========
52  *  Returns a list of families corresponding to each target
53  */
54 function getProcNames()
55 {
56     var settings = xdc.loadCapsule("Settings.xs");
58     return (settings.procNames);
59 }
61 /*
62  * ======== getHTML ========
63  */
64 function getHTML(procNames)
65 {
66     var html = "";
68     html += getFileContents("doc-files/procNamesHead.inc");
70     procNamesArr = [];
71     for (var deviceName in procNames) {
72         procNamesArr.push(deviceName);
73     }
74     procNamesArr.sort();
75     for (var i = 0; i < procNamesArr.length; i++) {
76         deviceName = procNamesArr[i];
77         if (blacklist.indexOf(deviceName) != -1) {
78             /* Device is blacklisted. Skip it */
79             continue;
80         }
81         html += "<TR><TD>" + deviceName + "</TD><TD>";
82         for each (var procName in procNames[deviceName]) {
83             html += procName + " ";
84         }
85         html += "</TD></TR>\n";
86     }
88     html += "</TABLE>\n";
90     var d = new Date();
91     html += "<DIV class=\"xdocDate\">generated on "
92                + d.toUTCString() + "</DIV>\n";
94     html += "</BODY></HTML>\n";
96     return (html);
97 }
99 /*
100  *  ======== writeFile ========
101  *  Given a string and a filename, writeFile() writes the string to a new file
102  *  located at 'out'
103  */
104 function writeFile(filename, out)
106     try {
107         var outputFile = java.io.File(filename);
108         if (outputFile.exists()) {
109             outputFile["delete"]();
110         }
111         var fos = java.io.FileWriter(outputFile);
112         fos.write(out);
113         fos.close();
114     }
115     catch (e) {
116         throw("Error writing file '" + filename + "'");
117     }
120 /*
121  *  ======== getFileContents ========
122  *  Returns a string containing the contents of file at 'filename'
123  */
124 function getFileContents(filename)
126     try {
127         var input = "";
128         var inputFile = java.io.File(filename);
129         var fos = java.io.FileReader(inputFile);
130         var reader = new java.io.BufferedReader(fos);
131         var line;
132         while ((line = reader.readLine()) != null)
133             input += line + '\n';
134         reader.close();
136         return (input);
137     }
138     catch (e) {
139         throw("Error reading file '" + filename + "'");
140     }
143 /* Execution starts here */
144 var procNames = getProcNames();
145 writeFile(outFileName, getHTML(procNames));