home *** CD-ROM | disk | FTP | other *** search
- DeskLib help comments
- =====================
-
- Tim Browse is currently finishing off a utility program which will scan
- DeskLib sources and headers for comments in a specific format, from which
- it will compile a help database in StrongHelp or HyperView (CC WordWorks)
- format. This will give a proper hyperlinked help database for DeskLib,
- saving you from having to read through header files to try to figure stuff
- out.
-
- The various blank comment blocks are given in the Docs.HelpCommnt, but here
- is a brief description of how they work:
-
- The comment block is made up of 3 sections: A header which identifies the
- block as a help-comment, and indicates the type of object the help is on;
- A definition of the object (variable, typedef, class, function prototype);
- and a description. These are described below:
-
- 1) The header is a single line similar to this:
-
- /*C**************************************************************
-
- The capital letter identifies the type of item, in this case, a 'C'
- for "class". Other letters include "F"unction, "V"ariable, etc.
-
- (Note that this first line may be the start of one large comment block,
- or you can place the two halves of the comment around a piece of actual
- code when declaring functions or typedefs etc in headers)
-
- 2) The object itself.
- This is either a chunk of code defining a thing, or a copy of that code
- You MUST use a copy if .c files, but in headers you may just place the
- real definition here (but be very careful to make the comments on either
- side individual comments - it is recommended that you use syntax-
- colouring editors such as Zap when doing this.
-
- If it is a comment, this is sometimes preceeded by a greater-than symbol,
- e.g:
-
- > void MyFunction(int blobby);
-
-
- 3) The help
- This may be preceeded by a comment line of dashes.
- This is made up of a set of fields which are described below. These
- fields may be multi-line.
- Fields that are not relevant may be omitted, or filled in with a "-"
-
- MACRO:
- Used to give a function prototype for a #define'd macro, so that it
- is clear how the macro is intended to be used. (See examples, below)
-
- Purpose:
- This field describes what the thing does
-
- Inputs:
- Lists the parameters to a function, and what they are for
-
- Outputs:
- Lists the values returned by a function through parameters
-
- Returns:
- Describes the return value of a function
-
- Errors:
- Describes what errors/assertions the function can generate, when, and why
-
- Base:
- The base class, or class derivation hierarchy
-
- Fields:
- Describes fields of a structure type or class. Each field should be
- listed by its name (NOT type), with a brief description
-
- SeeAlso:
- This field has semicolon-separated names of other things on which help
- can be found - these make up the hyper-links to other help fields, so
- please use these liberally to provide useful cross-references
-
-
-
- EXAMPLE 1:
- Here is an example of a small header and related .c file.
-
-
- --- Bob.h ---
-
- /*T*************************************************************************/
-
- typedef struct
- {
- int a, b;
- char c;
- } BobStruct;
-
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Purpose: For Bob; To contain two ints and a char
- Fields: a - An int which is not used for anything
- b - An int which is used to pad the space between a and c
- c - A char just to prove that I don't discriminate against types
- SeeAlso: Bob_GetAnInteger
-
- ****************************************************************************/
-
-
- /*F*************************************************************************/
-
- extern int Bob_GetAnInteger(int whichone, int ignored);
-
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Purpose: Returns the integer passed to it
- Inputs: whichone - The integer you want returned
- ignored - Another integer which is ignored completely
- Outputs: -
- Returns: The integer which was passed in in 'whichone'
- Errors: -
- SeeAlso: Bob_GetAnIntegerPlusOne; BobStruct
-
- ****************************************************************************/
-
-
- --- Bob.c ---
-
- extern int Bob_GetAnInteger(int whichone)
- {
- return(whichone);
- }
-
-
-
-
- EXAMPLE 2: Macros and keywords:
-
- /*M*************************************************************************/
-
- #define Coord_RectsIntersect(r1, r2) (Coord_RectsOverlap(r1, r2) && \
- !Coord_RectContained(r1, r2) && \
- !Coord_RectContained(r2, r1))
-
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- MACRO: BOOL Coord_RectsIntersect(wimp_rect *rect1, wimp_rect *rect2)
-
- Inputs: rect1, rect2 - the rectangles to check for intersection
- Returns: TRUE if rectangles intersect but do not contain each other;
- FALSE otherwise.
- Purpose: Tests if two rectangles intersect each other, but wil return
- failure if either rectangle wholly contains the other one.
- This is different to the behaviour of Coord_RectsOverlap.
- SeeAlso: Coord_RectsOverlap
-
- ****************************************************************************/
-
- /*K**************************************************************************
-
- > Coordinate conversion.
-
- Screen <---> Work Area conversion routines.
- NOTE:
- "Screen Coordinates" refers to OS coordinates, with the bottom
- left corner of the screen being placed at the screen origin, (0,0)
- "Work Area Coordinates" refers to Coordinates within the Window's
- work area, where the (0,0) origin is at the TOP left of the work area
-
- Some of these routines have been defined as macros because they are
- very elementary, and are common, so efficiency will be improved by
- removing the function call overhead.
-
- To keep compatibility with the syntax of Acorn's coords_ calls, these
- macros still accept a pointer to a convert_block.
-
- ****************************************************************************/
-