source: trunk/tools/database/www/Odin32GuidelineDocumentation.phtml@ 10366

Last change on this file since 10366 was 6658, checked in by bird, 24 years ago

Made main includes moveable - bug fixing..

File size: 15.7 KB
Line 
1<?php
2$Naziv="Project Odin Sourcecode Documentation Guidelines";
3
4$sMainDir = "../";
5
6require $sMainDir."stilovi.php3";
7require "Odin32DBHelpers.php3";
8
9/* Profiling */
10$sPageTimer = Odin32DBTimerStart("page timer");
11/* Profiling */
12
13
14require $sMainDir."01-PreTitle.php3";
15echo $Naziv;
16require $sMainDir."02-PostTitle.php3";
17
18require $sMainDir."03-MainTableBeg.php3";
19require $sMainDir."04-ColumnOne.php3";
20
21require $sMainDir."05-ColumnTwoHeader.php3";
22echo $Naziv;
23require $sMainDir."06-ColumnTwoHeader2.php3";
24
25/* I would like to number the sections and subsections */
26ODin32DBNumberSections();
27
28/*
29 *
30 */
31TekstBeg();
32echo "
33 This page describes the sourcecode documentation guildelines
34 used in Project Odin.
35 ";
36TekstEnd();
37
38
39/*
40 *
41 */
42Odin32DBNaslov("Introduction","intro");
43TekstBeg();
44echo " The documentation guidelines will keep reminding us that documentation
45 is necessary; and we may benefit from it when monitoring progress.
46 (Odin32 API Database) The status for each API function is essential.
47 <p>
48 The documentation style is based on Javadoc and
49 ";
50UrlLink("sds.sourceforge.net/", "SDS (Software Development Foundation)");
51echo " . We have made our own additions in form of new keywords.
52 <p>
53 It is of course recommended that everyone follows all of these
54 guidelines, but to some are more important than others. These
55 are marked <i>(required)</i>.
56 ";
57TekstEnd();
58
59
60/*
61 *
62 */
63Odin32DBNaslov("File Header <i>(required)</i>","fileheader");
64TekstBeg();
65echo " Each and every source file should start with a header like this:
66 ";
67TekstEnd();
68CodeBeg();
69echo "
70/* \$Id: Odin32GuidelineDocumentation.phtml,v 1.5 2001-09-05 21:40:46 bird Exp $
71 *
72 * <i>&lt;insert file description here&gt;</i>
73 *
74 * Copyright (c) <i>&lt;YYYY&gt;[-YYYY] &lt;author 1&gt;</i>
75[* Copyright (c) <i>&lt;YYYY&gt;[-YYYY] &lt;author 2&gt;</i>]
76 *
77 * Project Odin Software License can be found in LICENSE.TXT
78 */";
79CodeEnd();
80TekstBeg();
81echo "
82 The file header starts with CVS keyword, \$Id\$. When commiting
83 the file CVS expandes this keyword. Following is a blank line and
84 a description of the file contents. Then a blank line and
85 copyright info for all authors. As the final statement is the
86 license information.<p>
87
88 <b>Note:</b> If someone like to include CVS keywords (\$Log\$, \$Header\$, \$...)
89 other that \$Id\$, we will have to discuss this in the WAI and MAD
90 teams. As long as a keyword is not decided used (by the MAD or/and the WAI
91 teams), it should not be used!
92 ";
93TekstEnd();
94
95
96/*
97 *
98 */
99Odin32DBNaslov("Function Header <i>(required)</i>", "functonheader");
100TekstBeg();
101echo "
102 A function header is required for all API functions and recommended
103 for all other functions. Using and maintaining the described function
104 header will allow us to monitor the progress of the project and
105 generate documentation.<p>
106
107 <b>Note:</b> The function header which is described here is not the
108 only one found in the sources. You are discouraged from using other
109 function header(s) than the one described here.
110 ";
111TekstEnd();
112
113/*
114 *
115 */
116Odin32DBPodNaslov("SDS Function Header", "sdsfunctionheader");
117TekstBeg();
118echo "
119 <i>(SDS is a Javadoc styled documentation system for many languages.
120 We will use some of the standard SDS tags, and add three Odin specific
121 ones; <tt>@status</tt>, <tt>@group</tt> and <tt>@author</tt>.)</i><p>
122
123 First have a look at an example function header:
124 ";
125TekstEnd();
126CodeBeg();
127echo "
128/**
129 * The OpenFileMappingA function opens a named file-mapping object.
130 * @returns HANDLE to map object.
131 * @param dwDesiredAccess access mode
132 * @param bInheritHandle inherit flag
133 * @param lpName address of name of file-mapping object
134 * @status STUB
135 * @group Filemapping
136 * @author Patrick Haller [Mon, 1998/06/15 08:00]
137 */
138HANDLE WIN32API OS2OpenFileMappingA(DWORD dwDesiredAccess,";
139CodeEnd();
140
141TekstBeg();
142echo "
143 As you see, the the different parts of the header is identified by a
144 tag (also called keyword). A tag starts with the <tt>'@'</tt>
145 character. Note that the <tt>@param</tt> tag is kind of special as it
146 has a parameter (parametername) and may occur more than once (with
147 different parameternames).<p>
148
149 Function headers (methods) have the following tags (keywords):<p>
150
151<table border=3>
152<tr><td><b>Tag</b></td>
153 <td><b>Description</b></td>
154</tr>
155<tr><td><tt>@desc</tt></font></td>
156 <td><font size=-1>General description. (default)</td>
157</tr>
158<tr><td><tt>@return</tt></td>
159 <td><font size=-1>What the function returns (Alias: @returns)</font></td>
160</tr>
161<tr><td><tt>@param <paramname></tt></td>
162 <td><font size=-1>Parameters to the function.</font></td>
163</tr>
164<tr><td><tt>@status</tt></td>
165 <td><font size=-1>
166 Function status. See ";
167AnchNaslov("Function State.", "functionstate", "");
168echo "
169 </font></td>
170</tr>
171<tr><td><tt>@group</tt></td>
172 <td><font size=-1>
173 Name of the API Group the function belongs into.
174 This have to be a valid API Group name.<br>
175 See ";
176LocLink("Odin32DB.phtml?apigroups=1", "here");
177echo " for current API groups.
178 </font></td>
179</tr>
180<tr><td><tt>@time</tt></td>
181 <td><font size=-1>Time complexity or estimated time use.</font></td>
182</tr>
183<tr><td><tt>@sketch</tt></td>
184 <td><font size=-1>A sketch of the method, usually for design.</font></td>
185</tr>
186<tr><td><tt>@author</tt></td>
187 <td><font size=-1>
188 This is a list of authors. Authors are separated by ',' or
189 by new-line. Make sure to use exactly the same name/signature
190 each time.
191 </font></td>
192</tr>
193<tr><td><tt>@remark</tt></td>
194 <td><font size=-1>Any remarks.</font></td>
195</tr>
196</table>
197<p>";
198
199TekstBeg();
200echo "Since <tt>@desc</tt> is default, this form:";
201TekstEnd();
202
203CodeBeg();
204echo "
205/** this is a method-description */
206int foo();";
207CodeEnd();
208
209TekstBeg();
210echo "is equivalent with:";
211TekstEnd();
212
213CodeBeg();
214echo "
215/** @desc this is a method-description */
216int foo();";
217CodeEnd();
218
219TekstBeg();
220echo "
221 <b>Note:</b> that you should only include those tags that you use or
222 intend to use. If you don't use the <tt>@time</tt> tag don't waste a
223 line on it.
224 ";
225TekstEnd();
226
227/*
228 * Function State
229 */
230Odin32DBPodNaslov("Function State","functionstate");
231TekstBeg();
232echo "
233 For API functions we will try monitor the implementation progress. To
234 aid us we will assign a state to the API function which tells us how
235 far the implementation has come. The <tt>@status</tt> tag is intended
236 to hold this information. The <tt>@status</tt> tag is used when
237 automagically updating the Odin32 API Database. So while working on an
238 API function, you'll have to update this field so it reflects the
239 current implementation state of the function. (If you don't update it,
240 the whole point is gone...)<p>
241
242 The status is a set of keywords which describes the function state.
243 (Additional words in the status field is ignored.)<p>
244 ";
245TekstEnd();
246
247echo "
248 <table border=3>
249 <tr>
250 <td width=5% align=right><font size=-1><b>%</b></font></td>
251 <td><font size=-1><b>Keyword</b></font></td>
252 <td width=70%><font size=-1><b>Description</b></font></td>
253 </tr>
254 ";
255
256require "Odin32DBConnect.php3";
257$sql = "SELECT\n".
258 " name,\n".
259 " description,\n".
260 " weight,\n".
261 " color\n".
262 "FROM\n".
263 " state\n".
264 "ORDER BY refcode";
265$result = mysql_query($sql, $db);
266if ($result)
267{
268 while ($aState = mysql_fetch_array($result))
269 {
270 echo "
271 <tr>
272 <td align=right valign=top><font size=-1>".$aState["weight"]."%</font></td>
273 <td valign=top><font size=-1 color=".$aState["color"].">".$aState["name"]."</font></td>
274 <td valign=top><font size=-1>".$aState["description"]."</font></td>
275 </tr>";
276 }
277}
278else
279 Odin32DBSqlError($sql);
280
281echo "
282 </table><p>\n";
283
284TekstBeg();
285echo "
286 <b>Note:</b> The Open32 keyword should be used when the implementation
287 of the API calls an Open32 function. Even if you''ve written 1000 lines
288 of code fixing Open32 bugs, as long as it depends on Open32 directly in
289 the implementation.<p>
290
291 <b>Note2:</b> The <b>%</b> column in the table is the compleatage
292 percent of a function in the given state.
293 ";
294TekstEnd();
295
296
297/*
298 * Design notes.
299 */
300Odin32DBNaslov("Design Notes","design");
301TekstBeg();
302echo "
303 <i>Experimental - expect addition/changes </i><p>
304
305 From time to other someone will feel the urge to write a few (or many)
306 lines about the design of a module, subsystem, tool or whatever, which
307 isn't related to a specific function. For that purpose there is a
308 tag, <tt>@design</tt>, which you can place whereever you whan't in the
309 sourcecode, and write about how things work. The design notes are
310 intented to be at a level higher than function or maybe even file
311 level of documentation.<p>
312
313 The <tt>@design</tt>-tag have a couple of options, which are used to
314 order them and to give a title to the design note.<p>
315
316 Syntax: <tt>@design &lt;module sequence nbr&gt; &lt;design note title&gt;</tt><p>
317
318 The <tt>module sequence nbr</tt> is a sequence number used to order
319 the notes this for the module (ie. dll) when the designnotes are
320 put together for an entire module.<p>
321
322 The <tt>design note title</tt> is the title of the design note. This
323 also used when the notes are collected for an entire module.<p>
324
325
326 ";
327TekstEnd();
328
329
330/*
331 * Class Documentation
332 */
333Odin32DBNaslov("Classes and Methods (SDS)","classesandmethods");
334TekstBeg();
335echo "
336 We need a way of describing and document classes and methods (class
337 functions) in the Odin32 API. Though classes and methods are not exported
338 directly in the API, they are used to implemented very much of it. For
339 example the DDRAW and DSOUND DLL exports classes through function tables.<p>
340
341 The following sub-sections is an excerpt from the SDS documentation adapted
342 for use in Project Odin.
343 ";
344TekstEnd();
345
346/*
347 *
348 */
349Odin32DBPodNaslov("Briefly About SDS", "aboutsds");
350TekstBeg();
351echo "
352 SDS (Software Development Foundation) is designed (by Stig
353 E. Sand&oslash;e) to be similar to JavaDoc but operate on C++, C, Java,
354 Lisp, and other languages. It consists of a documentation style
355 and a set of utilities which parses the source- and header-files and
356 generates a set of HTML pages and class diagrams. We don't use the SDS
357 tools yet, rather or homegrown stuff, the documentation style is very
358 useful to attach some describing words to classes and their methods in
359 a structured and uniform way.<p>
360
361 The SDS documentation style is used by the win32k sources.
362 For more on SDS look ";
363UrlLink("sds.sourceforge.net/", "here");
364echo ".\n";
365TekstEnd();
366
367/*
368 * The Class-description Tags
369 */
370Odin32DBPodNaslov("The Class-Description Tags", "sdsclasstags");
371TekstBeg();
372echo "
373 An Example:
374 ";
375TekstBeg();
376
377CodeBeg();
378echo "
379/**
380 * @prop Here is the short description of class Foo
381 * @desc Here is the description of class Foo
382 * @purpose I describe the purpose of class Foo here.
383 * @author Stig E. Sandoe.
384 */
385class Foo
386{
387 ...
388};";
389CodeEnd();
390
391/* A More Thorough Description */
392PodPodNaslov("A More Thorough Description");
393TekstBeg();
394echo "
395 Classes has the following keywords:
396 ";
397TekstEnd();
398echo "
399<table border=3>
400<tr>
401 <td><b>Tag</b></td>
402 <td><b>Description</b></td>
403</tr>
404<tr>
405 <td><tt>@desc</tt></td>
406 <td><font size=-1>
407 Starts the general description-field for a class. (default)
408 </font></td>
409<tr>
410 <td><tt>@shortdesc</tt></td>
411 <td><font size=-1>
412 Short description (Alias: <tt>@memo</tt>)
413 </font></td>
414<tr>
415 <td><tt>@dstruct</tt></td>
416 <td><font size=-1>
417 Starts the field describing the data-structure of the class,
418 and where it fits into the pig picture.
419 </font></td>
420<tr>
421 <td><tt>@version</tt></td>
422 <td><font size=-1>
423 Specifies the versionname/number of the class.
424 (Alias: <tt>@vername</tt>)
425 </font></td>
426<tr>
427 <td><tt>@verdesc</tt></td>
428 <td><font size=-1>
429 Description of diffs in \"this\" version.
430 </font></td>
431<tr>
432 <td><tt>@author</tt></td>
433 <td><font size=-1>
434 Specifies the author of the class.
435 </font></td>
436<tr>
437 <td><tt>@approval</tt></td>
438 <td><font size=-1>
439 Specifies who have given final approval of the
440 documentation/implementation of a class.
441 </font></td>
442</table>
443 ";
444
445/*
446 * How to divide into categories
447 */
448Odin32DBPodNaslov("How to divide into categories", "sdscat");
449
450TekstBeg();
451echo "
452 The <tt>@cat</tt>-tag is really best illustrated with a short example:
453 ";
454TekstEnd();
455CodeBeg();
456echo "
457class Foo
458{
459 /** @cat Datamembers */
460 int bar;
461 int xyzzy;
462
463 /** @cat Methods */
464 int fubar() const;
465 void IRS(long money=ALLMONEY) const;
466};";
467CodeEnd();
468
469
470/*
471 * How To Document a Method
472 */
473Odin32DBPodNaslov("How To Document a Method", "sdsmethod");
474
475TekstBeg();
476echo "
477 <i>(This is similar to the SDS Function Header.)</i>
478 ";
479TekstEnd();
480
481/* */
482PodPodNaslov("An Example");
483TekstBeg();
484echo "
485 There are basically four places where you can put documentation for
486 methods. New documentation found for a method is added/appended to
487 the existing documentation so it is quite possible to describe
488 different aspects fo a method in different places. Please note that
489 documentation is added as it is read.<p>
490 ";
491TekstEnd();
492CodeBeg();
493echo "
494class Foo
495{
496 /** Documentation before the method */
497 doFrob();
498
499 int length() { /** Doc. inside the method */ ... }
500};
501
502/** More doc. before the mothod */
503Foo::doFrob()
504{
505 /** Doc. inside the implementation */
506}";
507CodeEnd();
508
509/* A More Thorough Description */
510PodPodNaslov("A More Thorough Description");
511TekstBeg();
512echo "
513 Methods have the following keywords:<p>
514 ";
515TekstEnd();
516echo "
517<table border=3>
518<tr><td><b>Tag</b></td>
519 <td><b>Description</b></td>
520</tr>
521<tr><td><tt>@desc</tt></font></td>
522 <td><font size=-1>General description. (default)</td>
523</tr>
524<tr><td><tt>@return</tt></td>
525 <td><font size=-1>What the function returns (Alias: @returns)</font></td>
526</tr>
527<tr><td><tt>@param <paramname></tt></td>
528 <td><font size=-1>Parameters to the function.</font></td>
529</tr>
530<tr><td><tt>@status</tt></td>
531 <td><font size=-1>
532 Function status. See ";
533AnchNaslov("Function State.", "functionstate", "");
534echo "
535 </font></td>
536</tr>
537<tr><td><tt>@time</tt></td>
538 <td><font size=-1>Time complexity or estimated time use.</font></td>
539</tr>
540<tr><td><tt>@sketch</tt></td>
541 <td><font size=-1>A sketch of the method, usually for design.</font></td>
542</tr>
543<tr><td><tt>@author</tt></td>
544 <td><font size=-1>
545 This is a list of authors. Authors are separated by ',' or
546 by new-line. Make sure to use exactly the same name/signature
547 each time.
548 </font></td>
549</tr>
550<tr><td><tt>@remark</tt></td>
551 <td><font size=-1>Any remarks.</font></td>
552</tr>
553</table>
554 ";
555
556require $sMainDir."07-ColumnTwoFooter.php3";
557require $sMainDir."08-News.php3";
558require $sMainDir."09-ContentsTitle.php3";
559
560Odin32DBWriteContents();
561
562require $sMainDir."10-EndOfContent.php3";
563require $sMainDir."11-NetlabsContact.php3";
564
565$Kada=date ("j M Y", filemtime(__file__));
566require $sMainDir."12-OdinBanner.php3";
567
568require $sMainDir."13-Closing.php3";
569
570/* Profiling */
571Odin32DBTimerStop($sPageTimer);
572/* Profiling */
573
574?>
Note: See TracBrowser for help on using the repository browser.