source: trunk/tools/database/www/Odin32DB.phtml@ 3896

Last change on this file since 3896 was 3883, checked in by bird, 25 years ago

More coding....

File size: 10.4 KB
Line 
1<?php
2$Title ="The Odin32 API Database";
3
4require "stilovi.php3";
5require "Odin32DBHelpers.php3";
6
7/*
8 * Connect to database
9 */
10$db = mysql_connect("127.0.0.1", "root", "");
11$rc = mysql_select_db("odin32", $db);
12
13
14/*
15 * Global Variables
16 */
17$iRefcode = -1; /* Reference number. (< 0 is all members in the category) */
18$sCategory = "dll"; /* Category name for internal use (equal to table name). */
19$sCategoryName = "Dll"; /* Category name for presentation. */
20$fNoData = 0; /* Flag which is set if refcode don't give matches in the DB. */
21
22
23/*
24 * What are we up to? We'll parse the input parameter (if any) to find out.
25 */
26if (isset($dllrefcode))
27{ /* DLLs by refcode */
28 $sCategory = "dll";
29 $sCategoryName = "Dll";
30 if ($dllrefcode != "")
31 $iRefcode = (int)$dllrefcode;
32}
33else if (isset($filerefcode))
34{ /* Files by refcode */
35 $sCategory = "file";
36 $sCategoryName = "File";
37 if ($filerefcode != "")
38 $iRefcode = (int)$filerefcode;
39}
40else if (isset($functionrefcode))
41{ /* Functions by refcode */
42 $sCategory = "function";
43 $sCategoryName = "Function";
44 if ($functionrefcode != "")
45 $iRefcode = (int)$functionrefcode;
46}
47else if (isset($apigrouprefcode))
48{ /* Api Group by refcode */
49 $sCategory = "apigroup";
50 $sCategoryName = "API Group";
51 if ($apigrouprefcode != "")
52 $iRefcode = (int)$apigrouprefcode;
53}
54else if (isset($authorrefcode))
55{ /* Author by refcode */
56 $sCategory = "author";
57 $sCategoryName = "Author";
58 if ($authorrefcode != "")
59 $iRefcode = (int)$authorrefcode;
60} /* else: defaults are set above (All dlls) */
61
62
63/*
64 * Get name of the item we're to display data on.
65 */
66if ($iRefcode < 0)
67 $sName = "All";
68else
69{
70 $sql = sprintf("SELECT name FROM %s WHERE refcode = %d",
71 $sCategory, $iRefcode);
72 $result = mysql_query($sql, $db);
73 if (@mysql_num_rows($result) > 0 &&
74 ($aName = @mysql_fetch_row($result))
75 )
76 {
77 $sName = $aName[0];
78 }
79 else
80 {
81 $fNoData = 1;
82 $sName = "!Invalid Refcode!";
83 }
84 @mysql_free_result($result);
85}
86
87require "01-PreTitle.php3";
88echo $Title." - ".$sCategoryName.": ".$sName;
89require "02-PostTitle.php3";
90
91require "03-MainTableBeg.php3";
92require "04-ColumnOne.php3";
93
94require "05-ColumnTwoHeader.php3";
95echo $Title."<br>".$sCategoryName.": ".$sName;
96require "06-ColumnTwoHeader2.php3";
97
98TekstBeg();
99if (!$fNoData)
100{
101 switch ($sCategory)
102 {
103 case "dll":
104 {
105 echo $sCategoryName;
106 break;
107 }
108
109
110 case "file":
111 {
112 echo $sCategoryName;
113 break;
114 }
115
116 case "function":
117 {
118 $sql = sprintf("
119 SELECT
120 f.name AS name,
121 f.intname AS intname,
122 f.ordinal AS ordinal,
123 f.return AS return,
124 f.type AS type,
125 f.description AS description,
126 f.remark AS remark,
127 f.returndesc AS returndesc,
128 f.sketch AS sketch,
129 f.equiv AS equiv,
130 f.time AS time,
131 g.name AS apigroupname,
132 g.refcode AS apigrouprefcode,
133 a.name AS aliasname,
134 a.refcode AS aliasrefcode,
135 ad.name AS aliasdllname,
136 ad.refcode AS aliasdllrefcode,
137 d.name AS dllname,
138 d.refcode AS dllrefcode,
139 i.name AS filename,
140 i.refcode AS filerefcode,
141 s.name AS state
142 FROM
143 function f
144 LEFT OUTER JOIN function a ON f.aliasfn = a.refcode
145 LEFT OUTER JOIN dll ad ON a.dll = ad.refcode
146 LEFT OUTER JOIN apigroup g ON f.apigroup = g.refcode
147 LEFT JOIN dll d ON f.dll = d.refcode
148 LEFT JOIN state s ON f.state = s.refcode
149 LEFT OUTER JOIN file i ON f.file = i.refcode
150 WHERE
151 f.refcode = %d",
152 $iRefcode);
153 $result = mysql_query($sql, $db);
154 if (@mysql_num_rows($result) > 0 &&
155 ($array = mysql_fetch_array($result))
156 )
157 {
158 Naslov("General", "General");
159 echo "\n<table width=100% border=3 cellpadding=0>\n";
160 Odin32DBInfoRow1("Name", $array, "name","","","","");
161 if (isset($array["intname"]))
162 Odin32DBInfoRow1("Internal Name", $array, "intname","","","","");
163 else
164 Odin32DBInfoRow1("Internal Name", $array, "name","","","","");
165 Odin32DBInfoRow1("Dll", $array, "dllname", "dllrefcode", "dllrefcode","","");
166 Odin32DBInfoRow1("Ordinal", $array, "ordinal","","","not available","");
167 if (isset($array["aliasrefcode"]))
168 Odin32DBInfoRow2("Forwards", $array, "aliasdllname", "aliasdllrefcode", "dllrefcode","",".",
169 "aliasname", "aliasrefcode", "functionrefcode");
170 if (isset($array["apigroup"]))
171 Odin32DBInfoRow1("API Group", $array, "apigroupname", "apigrouprefcode", "apigrouprefcode","","");
172 Odin32DBInfoRow1("File", $array, "filename", "filerefcode", "filerefcode","not available","");
173
174 echo "\n</table>\n";
175
176
177 Naslov("Declaration", "declaration");
178 echo "<pre>\n";
179 if (isset($array["return"]))
180 echo $array["return"]." ";
181 echo $array["name"]."(";
182 $sql = sprintf("
183 SELECT
184 name AS name,
185 type AS type,
186 description AS description
187 FROM
188 parameter
189 WHERE
190 function = %d
191 ORDER BY sequencenbr",
192 $iRefcode);
193 $result2 = mysql_query($sql, $db);
194 if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
195 {
196 while ($param = mysql_fetch_array($result2))
197 {
198 if (--$cParams == 0)
199 printf("\n %-20s %s", $param["type"], $param["name"]);
200 else
201 printf("\n %-20s %s,", $param["type"], $param["name"]);
202 }
203 }
204 else
205 echo "void";
206
207 echo ");\n";
208 echo "</pre>\n";
209
210 Naslov("Documentation", "docs");
211 Odin32DBDocRow1("Description", $array, "description");
212 PodNaslov("Parameters");
213 if ($result2 &&
214 mysql_num_rows($result2) > 0 &&
215 mysql_data_seek($result2, 0)
216 )
217 {
218 while ($param = mysql_fetch_array($result2))
219 {
220 /*echo " <tr><td width=100%>".$param["name"]."</td></tr>\n";*/
221 echo " <br><b>".$param["name"].":</b>\n";
222 if (isset($param["description"]))
223 {
224 echo "\n <table width=100% border=0 cellpadding=0>\n";
225 echo " <tr><td width=10%>&nbsp;</td>\n";
226 $sDescription = str_replace("<BR>", "", str_replace("<BR><BR>\n","<br>",$param["description"]));
227 echo " <td width=90%><font size=-1>".$sDescription."</font></td></tr>\n";
228 echo "\n</table>\n";
229 }
230 /*else
231 echo " </tr>";*/
232 }
233 }
234 else
235 echo "void";
236
237
238 Odin32DBDocRow1("Returns", $array, "returndesc");
239 Odin32DBDocRow1("Sketch/Algorithm", $array, "sketch");
240 Odin32DBDocRow1("Remark", $array, "remark");
241
242 }
243 else
244 {
245 echo "<p> No data!</p>";
246 Odin32DBDumpSql($sql);
247 }
248 if (@mysql_num_rows($result) > 0 &&
249 ($aName = @mysql_fetch_row($result))
250 )
251 break;
252 }
253
254 case "apigroup":
255 {
256 echo $sCategoryName;
257 break;
258 }
259
260 case "author":
261 {
262 echo $sCategoryName;
263 break;
264 }
265
266 default:
267 echo "!IPE!";
268 }
269}
270else
271 echo "Sorry, but there is not data available!";
272
273TekstEnd();
274
275require "07-ColumnTwoFooter.php3";
276require "08-News.php3";
277// require "09-ContentsTitle.php3";
278
279TocBeg();
280
281TocEnd();
282
283require "10-EndOfContent.php3";
284require "11-NetlabsContact.php3";
285
286$Kada=date ("j M Y", filemtime(__file__));
287require "12-OdinBanner.php3";
288
289require "13-Closing.php3";
290?>
Note: See TracBrowser for help on using the repository browser.