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

Last change on this file since 6502 was 3918, checked in by bird, 25 years ago

Fixes. Changed database to Odin32.

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