77d1d187132d3517f07dffcb4877702c55f1b573
[privoxy.git] / doc / STANDARDS.txt
1 ** Introduction
2
3
4 This set of standards is designed to make our lives easier. It is
5 developed with the simple goal of helping us keep the "new and
6 improved Junkbusters" consistent and reliable.  Thus making
7 maintenance easier and increasing chances of success of the
8 project.
9
10 And that of course comes back to us as individuals. If we can
11 increase our development and product efficiencies then we can
12 solve more of the request for changes/improvements and in general 
13 feel good about ourselves.  ;->
14
15
16 ** Using Comments
17
18
19 * Comment, Comment, Comment
20
21 Explanation:
22
23 Comment as much as possible without commenting the obvious.  For
24 example do not comment "aVariable is equal to bVariable".  Instead
25 explain why aVariable should be equal to the bVariable.  Just
26 because a person can read code does not mean they will understand
27 why or what is being done.  A reader may spend a lot more time
28 figuring out what is going on when a simple comment or explanation
29 would have prevented the extra research.  Please help your brother
30 IJB'ers out!
31
32 The comments will also help justify the intent of the code.  If the
33 comment describes something different than what the code is doing
34 then maybe a programming error is occurring.
35
36 Example:
37
38 /* if page size greater than 1k ... */
39 if ( PageLength() > 1024 )
40 {
41     ... "block" the page up ...
42 }
43
44 /* if page size is small, send it in blocks */
45 if ( PageLength() > 1024 )
46 {
47     ... "block" the page up ...
48 }
49
50 This demonstrates 2 cases of "what not to do".  The first is a
51 "syntax comment".  The second is a comment that does not fit what
52 is actually being done.
53
54
55 * Use blocks for comments
56
57 Explanation:
58
59 Comments can help or they can clutter.  They help when they are
60 differentiated from the code they describe.  One line comments do
61 not offer effective separation between the comment and the code.
62 Block identifiers do, by surrounding the code with a clear,
63 definable pattern.
64
65 Example:
66
67 /*********************************************************************
68  * This will stand out clearly in your code!
69  *********************************************************************/
70 if ( thisVariable == thatVariable )
71 {
72    DoSomethingVeryImportant();
73 }
74
75
76 /* unfortunately, this may not */
77 if ( thisVariable == thatVariable )
78 {
79    DoSomethingVeryImportant();
80 }
81
82
83 if ( thisVariable == thatVariable ) /* this may not either */
84 {
85    DoSomethingVeryImportant();
86 }
87
88
89 Exception:
90
91 If you are trying to add a small logic comment and do not wish to
92 "disrubt" the flow of the code, feel free to use a 1 line comment
93 which is NOT on the same line as the code.
94
95
96 * Keep Comments on their own line
97
98 Explanation:
99
100 It goes back to the question of readability.  If the comment is on
101 the same line as the code it will be harder to read than the
102 comment that is on its own line.
103
104 There are three exceptions to this rule, which should be violated
105 freely and often: during the definition of variables, at the end
106 of closing braces, when used to comment parameters.
107
108 Example:
109
110 /*********************************************************************
111  * This will stand out clearly in your code,
112  * But the second example won't.
113  *********************************************************************/
114 if ( thisVariable == thatVariable )
115 {
116    DoSomethingVeryImportant();
117 }
118
119 if ( thisVariable == thatVariable ) /*can you see me?*/
120 {
121    DoSomethingVeryImportant(); /*not easily*/
122 }
123
124
125 /*********************************************************************
126  * But, the encouraged exceptions:
127  *********************************************************************/
128 int urls_read     = 0;     /* # of urls read + rejected */
129 int urls_rejected = 0;     /* # of urls rejected */
130
131 if ( 1 == X )
132 {
133    DoSomethingVeryImportant();
134 }
135
136
137 short DoSomethingVeryImportant(
138    short firstParam,   /* represents something */
139    short nextParam     /* represents something else */ )
140 {
141 ...code here...
142
143 }   /* -END- DoSomethingVeryImportant */
144
145
146 * Comment each logical step
147
148 Explanation:
149
150 Logical steps should be commented to help others follow the
151 intent of the written code and comments will make the code more
152 readable.
153
154 If you have 25 lines of code without a comment, you should
155 probably go back into it to see where you forgot to put one.
156
157 Most "for", "while", "do", etc... loops _probably_ need a
158 comment.  After all, these are usually major logic containers.
159
160
161 * Comment All Functions Thoroughly
162
163 Explanation:
164
165 A reader of the code should be able to look at the comments just
166 prior to the beginning of a function and discern the reason for
167 its existence and the consequences of using it.  The reader
168 should not have to read through the code to determine if a given
169 function is safe for a desired use.  The proper information
170 thoroughly presented at the introduction of a function not only
171 saves time for subsequent maintenance or debugging, it more
172 importantly aids in code reuse by allowing a user to determine
173 the safety and applicability of any function for the problem at
174 hand.  As a result of such benefits, all functions should contain
175 the information presented in the addendum section of this
176 document.
177
178
179 * Comment at the end of braces if the content is more than one screen length
180
181 Explanation:
182
183 Each closing brace should be followed on the same line by a
184 comment that describes the origination of the brace if the
185 original brace is off of the screen, or otherwise far away from
186 the closing brace.  This will simplify the debugging, maintenance,
187 and readability of the code.
188
189 As a suggestion , use the following flags to make the comment and
190 its brace more readable:
191
192 use following a closing brace:
193    } /* -END- if() or while () or etc... */
194
195 Example:
196
197 if ( 1 == X )
198 {
199    DoSomethingVeryImportant();
200    ...some long list of commands...
201 } /* -END- if x is 1 */
202
203 or:
204
205 if ( 1 == X )
206 {
207    DoSomethingVeryImportant();
208    ...some long list of commands...
209 } /* -END- if ( 1 == X ) */
210
211
212 ** Naming Conventions
213
214
215 * Variable Names
216
217 Explanation:
218
219 Capitalize the first letter of each word in a variable name
220 except the first word.
221
222 Example:
223
224 int msIis5Hack = 0;
225
226
227 Instead of:
228
229 int ms_iis5_hack = 0;
230
231 Note: This is not an "enforcable" issue since too much of IJB uses
232 the underscore (_) to seperate words.
233
234 Status: developer-descrition.  This item is at developer
235 discrection and is currently open to debate by the IJB developer
236 team.  Too much of IJB violates this proposed standard.
237
238
239 * Function Names
240
241 Explanation:
242
243 Capitalize the first letter of each word in a function name.
244
245 Example:
246
247 int loadAclFile(struct client_state *csp)
248
249 Instead of:
250
251 int load_aclfile(struct client_state *csp)
252
253 Status: developer-descrition.  This item is at developer
254 discrection and is currently open to debate by the IJB developer
255 team.  Too much of IJB violates this proposed standard.
256
257 Note: on the 2 above "standards" ... if enough of the current
258 developer team agrees, I can use XEmacs to apply a few regular
259 expressions to make the current tree comply with these 2 points.
260 Otherwise I will remove them from this document.  Afterall, there
261 is no need to add to the "multiple personallity" syndrome that IJB
262 now has.
263
264
265 * Header file prototypes
266
267 Explanation:
268
269 Use a descriptive parameter name in the function prototype in
270 header files.  Use the same parameter name in the header file
271 that you use in the c file.
272
273 Example:
274
275 (.h) extern int load_aclfile(struct client_state *csp);
276 (.c) int load_aclfile(struct client_state *csp)
277
278 Instead of:
279 (.h) extern int load_aclfile(struct client_state *);   or
280 (.h) extern int load_aclfile();
281
282
283 18.  Ennumerations, and #defines
284
285 Explanation:
286
287 Use all capital letters, with underscores between words.
288
289 Example:
290
291 (enumeration) : enum Boolean { FALSE, TRUE };
292 (#define) : #define DEFAULT_SIZE 100;
293
294 Note: We should have a standard naming scheme for Symbols that
295 toggle a feature in the precompiler, and the constants used by that
296 feature. I'd propose that the toggles should be just one word, with
297 a common prefix, and that any depandant constants should be
298 prefixed by that word.
299
300 The prefix could be WITH_, HAVE_, ENABLE_, FEATURE_ etc.
301
302 Status: I see some this in the code currently!  Anybody "figured"
303 out a standard way to do this?
304
305 Example:
306
307 #define ENABLE_FORCE 1
308
309 #ifdef ENABLE_FORCE
310 #define FORCE_PREFIX blah
311 #endif /* def ENABLE_FORCE */
312
313
314 * Constants
315
316 Explanation:
317
318 Spell common words out entirely (do not remove vowels).
319
320 Use only widely-known domain acronyms and abbreviations.
321 Capitalize all letters of an acronym.
322
323 Use underscore (_) to separate adjacent acronyms and
324 abbreviations.  Never terminate a name with an underscore.
325
326 Example:
327
328 #define USE_IMAGE_LIST 1
329
330 Instead of:
331
332 #define _USE_IMAGE_LIST 1   or
333 #define USE_IMAGE_LIST_ 1   or
334 #define use_image_list  1   or
335 #define UseImageList    1
336
337
338 ** Using Space
339
340
341 * Put braces on a line by themselves.
342
343 Explanation:
344
345 The brace needs to be on a line all by itself, not at the end of
346 the statement.  Curly braces should line up with the construct
347 that they're associated with.  This practice makes it easier to
348 identify the opening and closing braces for a block.
349
350 Example:
351
352 if ( this == that )
353 {
354    ...
355 }
356
357 Instead of:
358
359 if ( this == that ) {
360 ...
361 }
362
363 or
364
365 if ( this == that ) { ...  }
366
367 Note: In the special case that the if-statement is inside a loop,
368 and it is trivial, i.e. it tests for a condidtion that is obvious
369 from the purpose of the block, one-liners as above may optically
370 preserve the loop structure and make it easier to read.
371
372 Status: developer-descrition.
373
374 Example exception:
375
376 while (more lines are read)
377 {
378    /* Please document what is/is not a comment line here */
379    if (it's a comment) continue;
380
381    do_something(line);
382 }
383
384
385 * ALL control statements should have a block
386
387 Explanation:
388
389 Using braces to make a block will make your code more readable
390 and less prone to error.  All control statements should have a
391 block defined.
392
393 Example:
394
395 if ( this == that )
396 {
397    DoSomething();
398 }
399
400 Instead of:
401
402 if ( this == that )
403    DoSomething();
404
405 or
406
407 if ( this == that ) DoSomething();
408
409 Note: see the exception above.
410
411
412 * Do not belabor/blow-up boolean expressions
413
414 Example:
415
416 structure->flag = (condition);
417
418 Instead of:
419
420 if (condition)
421 {
422    structure->flag = 1;
423 }
424 else
425 {
426    structure->flag = 0;
427 }
428
429 Note: The former is readable and consice.  The later is wordy and
430 inefficient.  Please assume that any new developer has at least a
431 "good" knowledge of C/C++.  (Hope I do not offend by that last
432 comment ... 8-)
433
434
435 * Use white space freely because it is free
436
437 Explanation:
438
439 Make it readable.  The notable exception to using white space
440 freely is listed in the next guideline.
441
442 Example:
443
444 int firstValue   = 0;
445 int someValue    = 0;
446 int anotherValue = 0;
447 int thisVariable = 0;
448
449 if ( thisVariable == thatVariable )
450
451 firstValue = oldValue + ( ( someValue - anotherValue ) - whatever )
452
453
454 * Don't use white space around structure operators
455
456 Explanation:
457
458 - structure pointer operator ( "->" ) 
459 - member operator ( "." )
460 - functions and parentheses
461
462 It is a general coding practice to put pointers, references, and
463 function parentheses next to names.  With spaces, the connection
464 between the object and variable/function name is not as clear.
465
466 Example:
467
468 aStruct->aMember;
469 aStruct.aMember;
470 FunctionName();
471
472 Instead of:
473 aStruct -> aMember;
474 aStruct .  aMember;
475 FunctionName ();
476
477
478 * Make the last brace of a function stand out
479
480 Example:
481
482 int function1( ... )
483 {
484    ...code...
485    return( retCode );
486
487 }   /* -END- function1 */
488
489
490 int function2( ... )
491 {
492 }   /* -END- function2 */
493
494
495 Instead of:
496
497 int function1( ... )
498 {
499    ...code...
500    return( retCode );
501 }
502 int function2( ... )
503 {
504 }
505
506 NOTE: Use 1 blank line before the closing brace and 2 lines
507 afterwards.  This makes the end of function standout to the most
508 casual viewer.  Although function comments help seperate
509 functions, this is still a good coding practice.  In fact, I
510 follow these rules when using blocks in "for", "while", "do"
511 loops, and long if {} statements too.  After all whitespace is
512 free!
513
514 Status: developer-descrition on the number of blank lines.
515 Enforced is the end of function comments.
516
517
518 * Use 3 character indentions
519
520 Explanation:
521
522 If some use 8 character TABs and some use 3 character TABs, the
523 code can look *very* ragged.  So use 3 character indentions only.
524 If you like to use TABs, pass your code through a filter such as
525 "expand -t3" before checking in your code.
526
527 Example:
528
529 static const char * const url_code_map[256] =
530 {
531    NULL, ...
532 };
533
534
535 int function1( ... )
536 {
537    if ( 1 )
538    {
539       return( ALWAYS_TRUE );
540    }
541    else
542    {
543       return( HOW_DID_YOU_GET_HERE );
544    }
545
546    return( NEVER_GETS_HERE );
547
548 }
549
550
551 ** Initializing
552
553
554 * Initialize all variables
555
556 Explanation:
557
558 Do not assume that the variables declared will not be used until
559 after they have been assigned a value somewhere else in the
560 code.  Remove the chance of accidentally using an unassigned
561 variable.
562
563 Example:
564
565 short anShort = 0;
566 float aFloat  = 0;
567 struct *ptr = NULL;
568
569 NOTE: It is much easier to debug a SIGSEGV if the message says
570 you are trying to access memory address 00000000 and not
571 129FA012; or arrayPtr[20] causes a SIGSEV vs. arrayPtr[0].
572
573 Status: developer-descrition if and only if the variable is
574 assigned a value "shortly after" declaration.
575
576
577 ** Functions
578
579
580 * Name functions that return a boolean as a question.
581
582 Explanation:
583
584 Value should be phrased as a question that would logically be
585 answered as a true or false statement
586
587 Example:
588
589 ShouldWeBlockThis();
590 ContainsAnImage();
591 IsWebPageBlank();
592
593
594 * Always specify a return type for a function.
595
596 Explanation:
597
598 The default return for a function is an int.  To avoid ambiguity,
599 create a return for a function when the return has a purpose, and
600 create a void return type if the function does not need to return
601 anything.
602
603
604 * Minimize function calls when iterating by using variables
605
606 Explanation:
607
608 It is easy to write the following code, and a clear argument can
609 be made that the code is easy to understand:
610
611 Example:
612
613 for ( size_t curr = 0; curr < PageLength(); curr ++ )
614 {
615    ....
616 }
617
618 Unfortunately, this makes a function call for each and every
619 iteration.  This increases the overhead in the program, because
620 the compiler has to look up the function each time, call it, and
621 return a value.  Depending on what occurs in the PageLength()
622 call, it might even be creating and destroying structures with
623 each iteration, even though in each case it is comparing "curr"
624 to the same value, over and over.  Remember too - even a call to
625 PageLength() is a function call, with the same overhead.
626
627 Instead of using a function call during the iterations, assign
628 the value to a variable, and evaluate using the variable.
629
630 Example:
631
632 size_t len = PageLength();
633
634 for ( size_t curr = 0; curr < len; curr ++ )
635 {
636    ....
637 }
638
639 Exceptions: if the value of PageLength() *may* change or could
640 *potentially* change, then you must code the function call in the
641 for/while loop.
642
643
644 * Pass and Return by Const Reference
645
646 Explanation:
647
648 This allows a developer to define a const pointer and call your
649 function.  If your function does not have the const keyword, we
650 may not be able to use your function.  Consider strcmp, if it
651 were defined as:
652    extern int strcmp( char *s1, char *s2 );
653
654 I could then not use it to compare argv's in main:
655    int main( int argc, const char *argv[] )
656    {
657      strcmp( argv[0], "junkbusters" );
658    }
659
660 Both these pointers are *const*!  If the c runtime library
661 maintainers do it, we should too.
662
663
664 * Pass and Return by Value
665
666 Explanation:
667
668 Most structures cannot fit onto a normal stack entry (i.e. they
669 are not 4 bytes or less).  Aka, a function declaration like:
670    int load_aclfile(struct client_state csp)
671
672 would not work.  So, to be consistent, we should declare all
673 prototypes with "pass by value":
674    int load_aclfile(struct client_state *csp)
675
676
677 * Use #include <fileName> and #include "fileName" for locals
678
679 Explanation:
680
681 Your include statements should contain the file name without a
682 path.  The path should be listed in the Makefile, using -I as
683 processor directive to search the indicated paths.  An exception
684 to this would be for some proprietary software that utilizes a
685 partial path to distinguish their header files from system or
686 other header files.
687
688 Example:
689
690 #include <iostream.h>     /* This is not a local include */
691 #include "config.h"       /* This IS a local include */
692
693 Exception:
694
695 /* This is not a local include, but requires a path element. */
696 #include <sys/fileName.h>
697
698
699 * Provide multiple inclusion protection
700
701 Explanation:
702
703 Prevents compiler and linker errors resulting from redefinition of
704 items.
705
706 Wrap each header file with the following syntax to prevent multiple
707 inclusions of the file.  Of course, replace FILENAME_UPPERCASE with
708 your file name, with "." Changed to "_", and make it uppercase.
709
710 Example (from project.h):
711
712 #ifndef _PROJECT_H
713 #define _PROJECT_H
714
715 ...
716
717 #endif /* ndef _PROJECT_H */
718
719
720 * Where Possible, Use Forward Struct Declaration Instead of Includes
721
722 Explanation:
723
724 Useful in headers that include pointers to other struct's.
725 Modifications to excess header files may cause needless compiles.
726
727 Example:
728
729 /*********************************************************************
730  * We're avoiding an include statement here!
731  *********************************************************************/
732 struct file_list;
733 file_list *xyz;
734
735 NOTE: If you declare "file_list xyz;" (without the pointer), then
736 including the proper header file is necessary.  If you only want to
737 prototype a pointer, however, the header file is unneccessary.  Use
738 with discrection.
739
740
741 ** General Coding Practices
742
743
744 * Provide a default case for all switch statements
745
746 Explanation:
747
748 What you think is guaranteed is never really guaranteed.  The
749 value that you don't think you need to check is the one that
750 someday will be passed.  So, to protect yourself from the unknown,
751 always have a default step in a switch statement.
752
753 Example:
754
755 switch( hash_string( cmd ) )
756 {
757    case hash_actions_file :
758       ... code ...
759       break;
760
761    case hash_confdir :
762       ... code ...
763       break;
764
765    default :
766       log_error( ... );
767       ... more code ...
768       continue; / break; / exit(1); / etc ...
769 } /* end switch( hash_string(cmd) ) */
770
771 NOTE: If you already have a default condition, you are obviously
772 exempt from this point.  Of note, most of the WIN32 code calls
773 `DefWindowProc' after the switch statement.  This API call
774 *should* be included in a default statement.
775
776 Another NOTE: This is not so much a readability issue as a robust
777 programming issue.  The "anomly code goes here" may be no more
778 than a print to the STDERR stream (as in load_config).  Or it may 
779 really be an ABEND condition.  Programmer discretion is advised.
780
781
782 * Try to avoid falling through cases in a switch statement.
783
784 Explanation:
785
786 In general, you will want to have a 'break' statement within each
787 'case' of a switch statement.  This allows for the code to be more
788 readable and understandable, and furthermore can prevent unwanted
789 surprises if someone else later gets creative and moves the code
790 around.
791
792 The language allows you to plan the fall through from one case
793 statement to another simply by omitting the break statement within
794 the case statement.  This feature does have benefits, but should
795 only be used in rare cases.  In general, use a break statement for
796 each case statement.
797
798 If you choose to allow fall through, you should comment both the
799 fact of the fall through and reason why you felt it was
800 necessary.
801
802
803 * Use 'long' or 'short' Instead of 'int'
804
805 Explanation:
806
807 On 32-bit platforms, int usually has the range of long.  On 16-bit
808 platforms, int has the range of short.
809
810 Status: open-to-debate.  In the case of most FSF projects
811 (including X/GNU-Emacs), there are typedefs to int4, int8, int16,
812 (or equivalence ... I forget the exact typedefs now).  Should we
813 add these to IJB now that we have a "configure" script?
814
815
816 * Declare each variable and struct on its own line.
817
818 Explanation:
819
820 It can be tempting to declare a series of variables all on one
821 line.  Don't.
822
823 Example:
824
825 long a = 0;
826 long b = 0;
827 long c = 0;
828
829 Instead of:
830
831 long a, b, c;
832
833 Reasons:
834 - there is more room for comments on the individual variables
835 - easier to add new variables without messing up the original ones
836 - when searching on a variable to find its type, there is less
837   clutter to "visually" eliminate
838
839 Exceptions: when you want to declare a bunch of loop variables or
840 other trivial variables; feel free to declare them on 1 line.  You
841 should, although, provide a good comment on their functions.
842
843 Status: developer-descrition.
844
845
846 * Use malloc/zalloc sparingly
847
848 Explanation:
849
850 Create a local stuct (on the stack) if the variable will live
851 and die within the context of one function call.
852
853 Only "malloc" a struct (on the heap) if the variable's life will
854 extend beyond the context of one function call.
855
856 Example:
857
858 If a function creates a struct and stores a pointer to it in a
859 list, then it should definately be allocated via `malloc'.
860
861
862 * The Programmer Who Uses 'malloc' is Responsible for Ensuring 'free'
863
864 Explanation:
865
866 If you have to "malloc" an instance, you are responsible for
867 insuring that the instance is `free'd, even if the deallocation
868 event falls within some other programmer's code.  You are also
869 responsible for ensuring that deletion is timely (i.e. not too
870 soon, not too late).  This is known as "low-coupling" and is a
871 "good thing (tm)".  You may need to offer a free/unload/destuctor
872 type function to accomodate this.
873
874 Example:
875
876 static void unload_re_filterfile(void *f) { ... }
877 int load_re_filterfile(struct client_state *csp) { ... }
878
879 Exceptions:
880
881 The developer cannot be expected to provide `free'ing functions for 
882 C run-time library functions ... such as `strdup'.
883
884 Status: developer-descrition.  The "main" use of this standard is
885 for allocating and freeing data structures (complex or nested).
886
887
888 * Add loaders to the `file_list' structure and in order
889
890 Explanation:
891
892 I have ordered all of the "blocker" file code to be in alpha
893 order.  It is easier to add/read new blockers when you expect a
894 certain order.
895
896 NOTE: It may appear that the alpha order is broken in places by
897 POPUP tests coming before PCRS tests.  But since POPUPs can also
898 be referred to as KILLPOPUPs, it is clear that it should come
899 first.
900
901
902 * "Uncertain" new code and/or changes to exitinst code, use FIXME
903
904 Explanation:
905
906 If you have enough confidence in new code or confidence in your
907 changes, but are not *quite* sure of the reprocussions, add this:
908
909 /* FIXME: this code has a logic error on platform XYZ,
910  * attempthing to fix
911  */
912 #ifdef PLATFORM
913    ...changed code here...
914 #endif
915
916 or:
917
918 /* FIXME: I think the original author really meant this... */
919    ...changed code here...
920
921 or:
922
923 /* FIXME: new code that *may* break something else... */
924    ...new code here...
925
926 NOTE: If you make it clear that this may or may not be a "good
927 thing (tm)", it will be easier to identify and include in the
928 project (or conversly exclude from the project).
929
930
931 ** Addendum: Template for files and function comment blocks:
932
933
934 Example for file comments:
935
936 const char FILENAME_rcs[] = "$Id: $";
937 /*********************************************************************
938  *
939  * File        :  $Source: $
940  *
941  * Purpose     :  (Fill me in with a good description!)
942  *
943  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
944  *                IJBSWA team.  http://ijbswa.sourceforge.net
945  *
946  *                Based on the Internet Junkbuster originally written
947  *                by and Copyright (C) 1997 Anonymous Coders and 
948  *                Junkbusters Corporation.  http://www.junkbusters.com
949  *
950  *                This program is free software; you can redistribute it 
951  *                and/or modify it under the terms of the GNU General
952  *                Public License as published by the Free Software
953  *                Foundation; either version 2 of the License, or (at
954  *                your option) any later version.
955  *
956  *                This program is distributed in the hope that it will
957  *                be useful, but WITHOUT ANY WARRANTY; without even the
958  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
959  *                PARTICULAR PURPOSE.  See the GNU General Public
960  *                License for more details.
961  *
962  *                The GNU General Public License should be included with
963  *                this file.  If not, you can view it at
964  *                http://www.gnu.org/copyleft/gpl.html
965  *                or write to the Free Software Foundation, Inc., 59
966  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
967  *
968  * Revisions   :
969  *    $Log: $
970  *
971  *********************************************************************/
972
973
974 #include "config.h"
975
976 ...necessary include files for us to do our work...
977
978 const char FILENAME_h_rcs[] = FILENAME_H_VERSION;
979
980
981 NOTE: This declares the rcs variables that should be added to the 
982 "show-proxy-args" page.  If this is a brand new creation by you,
983 you are free to change the "Copyright" section to represent the
984 rights you wish to maintain.
985
986 NOTE: The formfeed character that is present right after the
987 comment flower box is handy for (X|GNU)Emacs users to skip the
988 verbige and get to the heart of the code (via `forward-page' and
989 `backward-page').  Please include it if you can.
990
991
992 Example for file header comments:
993
994 #ifndef _FILENAME_H
995 #define _FILENAME_H
996 #define FILENAME_H_VERSION "$Id: $"
997 /*********************************************************************
998  *
999  * File        :  $Source: $
1000  *
1001  * Purpose     :  (Fill me in with a good description!)
1002  *
1003  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1004  *                IJBSWA team.  http://ijbswa.sourceforge.net
1005  *
1006  *                Based on the Internet Junkbuster originally written
1007  *                by and Copyright (C) 1997 Anonymous Coders and 
1008  *                Junkbusters Corporation.  http://www.junkbusters.com
1009  *
1010  *                This program is free software; you can redistribute it 
1011  *                and/or modify it under the terms of the GNU General
1012  *                Public License as published by the Free Software
1013  *                Foundation; either version 2 of the License, or (at
1014  *                your option) any later version.
1015  *
1016  *                This program is distributed in the hope that it will
1017  *                be useful, but WITHOUT ANY WARRANTY; without even the
1018  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1019  *                PARTICULAR PURPOSE.  See the GNU General Public
1020  *                License for more details.
1021  *
1022  *                The GNU General Public License should be included with
1023  *                this file.  If not, you can view it at
1024  *                http://www.gnu.org/copyleft/gpl.html
1025  *                or write to the Free Software Foundation, Inc., 59
1026  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1027  *
1028  * Revisions   :
1029  *    $Log: $
1030  *
1031  *********************************************************************/
1032 \f
1033
1034 #include "project.h"
1035
1036 #ifdef __cplusplus
1037 extern "C" {
1038 #endif
1039
1040 ... function headers here ...
1041
1042
1043 /* Revision control strings from this header and associated .c file */
1044 extern const char FILENAME_rcs[];
1045 extern const char FILENAME_h_rcs[];
1046
1047
1048 #ifdef __cplusplus
1049 } /* extern "C" */
1050 #endif
1051
1052 #endif /* ndef _FILENAME_H */
1053
1054 /*
1055   Local Variables:
1056   tab-width: 3
1057   end:
1058 */
1059
1060
1061 Example for function comments:
1062
1063 /*********************************************************************
1064  *
1065  * Function    :  FUNCTION_NAME
1066  *
1067  * Description :  (Fill me in with a good description!)
1068  *
1069  * Parameters  :
1070  *          1  :  param1 = pointer to an important thing
1071  *          2  :  x      = pointer to something else
1072  *
1073  * Returns     :  0 => Ok, everything else is an error.
1074  *
1075  *********************************************************************/
1076 int FUNCTION_NAME( void *param1, const char *x )
1077 {
1078 ...
1079    return( 0 );
1080
1081 }
1082
1083
1084 NOTE: If we all follow this practice, we should be able to parse
1085 our code to create a "self-documenting" web page.
1086
1087
1088 ** Local variables for this standards file
1089
1090
1091 * Hopefully this will be in outline-mode soon.
1092
1093
1094 /*
1095   Local Variables:
1096   tab-width: 3
1097   fill-column: 67
1098   mode: auto-fill
1099   end:
1100 */