1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
5 >Coding Guidelines</TITLE
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
10 TITLE="Privoxy Developer Manual"
11 HREF="index.html"><LINK
13 TITLE="Documentation Guidelines"
14 HREF="documentation.html"><LINK
16 TITLE="Testing Guidelines"
17 HREF="testing.html"><LINK
20 HREF="../p_doc.css"><META
21 HTTP-EQUIV="Content-Type"
23 charset=ISO-8859-1"></HEAD
34 SUMMARY="Header navigation table"
43 >Privoxy Developer Manual</TH
51 HREF="documentation.html"
80 >4. Coding Guidelines</A
91 >This set of standards is designed to make our lives easier. It is
92 developed with the simple goal of helping us keep the "new and improved
96 >" consistent and reliable. Thus making
97 maintenance easier and increasing chances of success of the
100 >And that of course comes back to us as individuals. If we can
101 increase our development and product efficiencies then we can solve more
102 of the request for changes/improvements and in general feel good about
103 ourselves. ;-></P
111 >4.2. Using Comments</A
119 >4.2.1. Comment, Comment, Comment</A
130 >Comment as much as possible without commenting the obvious.
131 For example do not comment "variable_a is equal to variable_b".
132 Instead explain why variable_a should be equal to the variable_b.
133 Just because a person can read code does not mean they will
134 understand why or what is being done. A reader may spend a lot
135 more time figuring out what is going on when a simple comment
136 or explanation would have prevented the extra research. Please
137 help your fellow Privoxy developers out!</P
139 >The comments will also help justify the intent of the code.
140 If the comment describes something different than what the code
141 is doing then maybe a programming error is occurring.</P
157 CLASS="PROGRAMLISTING"
158 >/* if page size greater than 1k ... */
159 if (page_length() > 1024)
161 ... "block" the page up ...
164 /* if page size is small, send it in blocks */
165 if (page_length() > 1024)
167 ... "block" the page up ...
170 This demonstrates 2 cases of "what not to do". The first is a
171 "syntax comment". The second is a comment that does not fit what
172 is actually being done.</PRE
183 >4.2.2. Use blocks for comments</A
194 >Comments can help or they can clutter. They help when they
195 are differentiated from the code they describe. One line
196 comments do not offer effective separation between the comment
197 and the code. Block identifiers do, by surrounding the code
198 with a clear, definable pattern.</P
214 CLASS="PROGRAMLISTING"
215 >/*********************************************************************
216 * This will stand out clearly in your code!
217 *********************************************************************/
218 if (this_variable == that_variable)
220 do_something_very_important();
224 /* unfortunately, this may not */
225 if (this_variable == that_variable)
227 do_something_very_important();
231 if (this_variable == that_variable) /* this may not either */
233 do_something_very_important();
247 >If you are trying to add a small logic comment and do not
248 wish to "disrupt" the flow of the code, feel free to use a 1
249 line comment which is NOT on the same line as the code.</P
257 >4.2.3. Keep Comments on their own line</A
268 >It goes back to the question of readability. If the comment
269 is on the same line as the code it will be harder to read than
270 the comment that is on its own line.</P
272 >There are three exceptions to this rule, which should be
273 violated freely and often: during the definition of variables,
274 at the end of closing braces, when used to comment
291 CLASS="PROGRAMLISTING"
292 >/*********************************************************************
293 * This will stand out clearly in your code,
294 * But the second example won't.
295 *********************************************************************/
296 if (this_variable == this_variable)
298 do_something_very_important();
301 if (this_variable == this_variable) /*can you see me?*/
303 do_something_very_important(); /*not easily*/
307 /*********************************************************************
308 * But, the encouraged exceptions:
309 *********************************************************************/
310 int urls_read = 0; /* # of urls read + rejected */
311 int urls_rejected = 0; /* # of urls rejected */
315 do_something_very_important();
319 short do_something_very_important(
320 short firstparam, /* represents something */
321 short nextparam /* represents something else */ )
325 } /* -END- do_something_very_important */</PRE
336 >4.2.4. Comment each logical step</A
347 >Logical steps should be commented to help others follow the
348 intent of the written code and comments will make the code more
351 >If you have 25 lines of code without a comment, you should
352 probably go back into it to see where you forgot to put
355 >Most "for", "while", "do", etc... loops _probably_ need a
356 comment. After all, these are usually major logic
365 >4.2.5. Comment All Functions Thoroughly</A
376 >A reader of the code should be able to look at the comments
377 just prior to the beginning of a function and discern the
378 reason for its existence and the consequences of using it. The
379 reader should not have to read through the code to determine if
380 a given function is safe for a desired use. The proper
381 information thoroughly presented at the introduction of a
382 function not only saves time for subsequent maintenance or
383 debugging, it more importantly aids in code reuse by allowing a
384 user to determine the safety and applicability of any function
385 for the problem at hand. As a result of such benefits, all
386 functions should contain the information presented in the
387 addendum section of this document.</P
395 >4.2.6. Comment at the end of braces if the
396 content is more than one screen length</A
407 >Each closing brace should be followed on the same line by a
408 comment that describes the origination of the brace if the
409 original brace is off of the screen, or otherwise far away from
410 the closing brace. This will simplify the debugging,
411 maintenance, and readability of the code.</P
413 >As a suggestion , use the following flags to make the
414 comment and its brace more readable:</P
416 >use following a closing brace: } /* -END- if() or while ()
433 CLASS="PROGRAMLISTING"
436 do_something_very_important();
437 ...some long list of commands...
438 } /* -END- if x is 1 */
444 do_something_very_important();
445 ...some long list of commands...
446 } /* -END- if (1 == X) */</PRE
458 >4.3. Naming Conventions</A
466 >4.3.1. Variable Names</A
477 >Use all lowercase, and separate words via an underscore
478 ('_'). Do not start an identifier with an underscore. (ANSI C
479 reserves these for use by the compiler and system headers.) Do
480 not use identifiers which are reserved in ANSI C++. (E.g.
481 template, class, true, false, ...). This is in case we ever
482 decide to port Privoxy to C++.</P
498 CLASS="PROGRAMLISTING"
499 >int ms_iis5_hack = 0;</PRE
518 CLASS="PROGRAMLISTING"
519 >int msiis5hack = 0; int msIis5Hack = 0;</PRE
530 >4.3.2. Function Names</A
541 >Use all lowercase, and separate words via an underscore
542 ('_'). Do not start an identifier with an underscore. (ANSI C
543 reserves these for use by the compiler and system headers.) Do
544 not use identifiers which are reserved in ANSI C++. (E.g.
545 template, class, true, false, ...). This is in case we ever
546 decide to port Privoxy to C++.</P
562 CLASS="PROGRAMLISTING"
563 >int load_some_file(struct client_state *csp)</PRE
582 CLASS="PROGRAMLISTING"
583 >int loadsomefile(struct client_state *csp)
584 int loadSomeFile(struct client_state *csp)</PRE
595 >4.3.3. Header file prototypes</A
606 >Use a descriptive parameter name in the function prototype
607 in header files. Use the same parameter name in the header file
608 that you use in the c file.</P
624 CLASS="PROGRAMLISTING"
625 >(.h) extern int load_aclfile(struct client_state *csp);
626 (.c) int load_aclfile(struct client_state *csp)</PRE
645 CLASS="PROGRAMLISTING"
646 >(.h) extern int load_aclfile(struct client_state *); or
647 (.h) extern int load_aclfile();
648 (.c) int load_aclfile(struct client_state *csp)</PRE
659 >4.3.4. Enumerations, and #defines</A
670 >Use all capital letters, with underscores between words. Do
671 not start an identifier with an underscore. (ANSI C reserves
672 these for use by the compiler and system headers.)</P
688 CLASS="PROGRAMLISTING"
689 >(enumeration) : enum Boolean {FALSE, TRUE};
690 (#define) : #define DEFAULT_SIZE 100;</PRE
701 > We have a standard naming scheme for #defines
702 that toggle a feature in the preprocessor: FEATURE_>, where
703 > is a short (preferably 1 or 2 word) description.</P
719 CLASS="PROGRAMLISTING"
720 >#define FEATURE_FORCE 1
723 #define FORCE_PREFIX blah
724 #endif /* def FEATURE_FORCE */</PRE
746 >Spell common words out entirely (do not remove vowels).</P
748 >Use only widely-known domain acronyms and abbreviations.
749 Capitalize all letters of an acronym.</P
751 >Use underscore (_) to separate adjacent acronyms and
752 abbreviations. Never terminate a name with an underscore.</P
768 CLASS="PROGRAMLISTING"
769 >#define USE_IMAGE_LIST 1</PRE
788 CLASS="PROGRAMLISTING"
789 >#define USE_IMG_LST 1 or
790 #define _USE_IMAGE_LIST 1 or
791 #define USE_IMAGE_LIST_ 1 or
792 #define use_image_list 1 or
793 #define UseImageList 1</PRE
813 >4.4.1. Put braces on a line by themselves.</A
824 >The brace needs to be on a line all by itself, not at the
825 end of the statement. Curly braces should line up with the
826 construct that they're associated with. This practice makes it
827 easier to identify the opening and closing braces for a
844 CLASS="PROGRAMLISTING"
861 >if (this == that) { ... }</P
865 >if (this == that) { ... }</P
873 > In the special case that the if-statement is
874 inside a loop, and it is trivial, i.e. it tests for a
875 condition that is obvious from the purpose of the block,
876 one-liners as above may optically preserve the loop structure
877 and make it easier to read.</P
885 > developer-discretion.</P
891 >Example exception:</I
901 CLASS="PROGRAMLISTING"
902 >while (more lines are read)
904 /* Please document what is/is not a comment line here */
905 if (it's a comment) continue;
919 >4.4.2. ALL control statements should have a
931 >Using braces to make a block will make your code more
932 readable and less prone to error. All control statements should
933 have a block defined.</P
949 CLASS="PROGRAMLISTING"
967 >if (this == that) do_something(); do_something_else();</P
971 >if (this == that) do_something();</P
979 > The first example in "Instead of" will execute
980 in a manner other than that which the developer desired (per
981 indentation). Using code braces would have prevented this
982 "feature". The "explanation" and "exception" from the point
983 above also applies.</P
991 >4.4.3. Do not belabor/blow-up boolean
1009 CLASS="PROGRAMLISTING"
1010 >structure->flag = (condition);</PRE
1023 >if (condition) { structure->flag = 1; } else {
1024 structure->flag = 0; }</P
1032 > The former is readable and concise. The later
1033 is wordy and inefficient. Please assume that any developer new
1034 to the project has at least a "good" knowledge of C/C++. (Hope
1035 I do not offend by that last comment ... 8-)</P
1043 >4.4.4. Use white space freely because it is
1055 >Make it readable. The notable exception to using white space
1056 freely is listed in the next guideline.</P
1072 CLASS="PROGRAMLISTING"
1073 >int first_value = 0;
1075 int another_value = 0;
1076 int this_variable = 0;</PRE
1087 >4.4.5. Don't use white space around structure
1099 >- structure pointer operator ( "->" ) - member operator (
1100 "." ) - functions and parentheses</P
1102 >It is a general coding practice to put pointers, references,
1103 and function parentheses next to names. With spaces, the
1104 connection between the object and variable/function name is not
1121 CLASS="PROGRAMLISTING"
1122 >a_struct->a_member;
1124 function_name();</PRE
1135 > a_struct -> a_member; a_struct . a_member;
1136 function_name ();</P
1144 >4.4.6. Make the last brace of a function stand
1162 CLASS="PROGRAMLISTING"
1163 >int function1( ... )
1168 } /* -END- function1 */
1171 int function2( ... )
1173 } /* -END- function2 */</PRE
1186 >int function1( ... ) { ...code... return(ret_code); } int
1187 function2( ... ) { }</P
1195 > Use 1 blank line before the closing brace and 2
1196 lines afterward. This makes the end of function standout to
1197 the most casual viewer. Although function comments help
1198 separate functions, this is still a good coding practice. In
1199 fact, I follow these rules when using blocks in "for", "while",
1200 "do" loops, and long if {} statements too. After all whitespace
1209 > developer-discretion on the number of blank
1210 lines. Enforced is the end of function comments.</P
1218 >4.4.7. Use 3 character indentions</A
1229 >If some use 8 character TABs and some use 3 character TABs,
1230 the code can look *very* ragged. So use 3 character indentions
1231 only. If you like to use TABs, pass your code through a filter
1232 such as "expand -t3" before checking in your code.</P
1248 CLASS="PROGRAMLISTING"
1249 >static const char * const url_code_map[256] =
1255 int function1( ... )
1263 return HOW_DID_YOU_GET_HERE;
1266 return NEVER_GETS_HERE;
1280 >4.5. Initializing</A
1288 >4.5.1. Initialize all variables</A
1299 >Do not assume that the variables declared will not be used
1300 until after they have been assigned a value somewhere else in
1301 the code. Remove the chance of accidentally using an unassigned
1318 CLASS="PROGRAMLISTING"
1321 struct *ptr = NULL;</PRE
1332 > It is much easier to debug a SIGSEGV if the
1333 message says you are trying to access memory address 00000000
1334 and not 129FA012; or array_ptr[20] causes a SIGSEV vs.
1343 > developer-discretion if and only if the
1344 variable is assigned a value "shortly after" declaration.</P
1361 >4.6.1. Name functions that return a boolean as a
1373 >Value should be phrased as a question that would logically
1374 be answered as a true or false statement</P
1390 CLASS="PROGRAMLISTING"
1391 >should_we_block_this();
1392 contains_an_image();
1393 is_web_page_blank();</PRE
1404 >4.6.2. Always specify a return type for a
1416 >The default return for a function is an int. To avoid
1417 ambiguity, create a return for a function when the return has a
1418 purpose, and create a void return type if the function does not
1419 need to return anything.</P
1427 >4.6.3. Minimize function calls when iterating by
1439 >It is easy to write the following code, and a clear argument
1440 can be made that the code is easy to understand:</P
1456 CLASS="PROGRAMLISTING"
1457 >for (size_t cnt = 0; cnt < block_list_length(); cnt++)
1471 > Unfortunately, this makes a function call for
1472 each and every iteration. This increases the overhead in the
1473 program, because the compiler has to look up the function each
1474 time, call it, and return a value. Depending on what occurs in
1475 the block_list_length() call, it might even be creating and
1476 destroying structures with each iteration, even though in each
1477 case it is comparing "cnt" to the same value, over and over.
1478 Remember too - even a call to block_list_length() is a function
1479 call, with the same overhead.</P
1481 >Instead of using a function call during the iterations,
1482 assign the value to a variable, and evaluate using the
1499 CLASS="PROGRAMLISTING"
1500 >size_t len = block_list_length();
1502 for (size_t cnt = 0; cnt < len; cnt++)
1516 > if the value of block_list_length()
1517 *may* change or could *potentially* change, then you must code the
1518 function call in the for/while loop.</P
1526 >4.6.4. Pass and Return by Const Reference</A
1537 >This allows a developer to define a const pointer and call
1538 your function. If your function does not have the const
1539 keyword, we may not be able to use your function. Consider
1540 strcmp, if it were defined as: extern int strcmp(char *s1,
1543 >I could then not use it to compare argv's in main: int
1544 main(int argc, const char *argv[]) { strcmp(argv[0], "privoxy");
1547 >Both these pointers are *const*! If the c runtime library
1548 maintainers do it, we should too.</P
1556 >4.6.5. Pass and Return by Value</A
1567 >Most structures cannot fit onto a normal stack entry (i.e.
1568 they are not 4 bytes or less). Aka, a function declaration
1569 like: int load_aclfile(struct client_state csp)</P
1571 >would not work. So, to be consistent, we should declare all
1572 prototypes with "pass by value": int load_aclfile(struct
1573 client_state *csp)</P
1581 >4.6.6. Names of include files</A
1592 >Your include statements should contain the file name without
1593 a path. The path should be listed in the Makefile, using -I as
1594 processor directive to search the indicated paths. An exception
1595 to this would be for some proprietary software that utilizes a
1596 partial path to distinguish their header files from system or
1597 other header files.</P
1613 CLASS="PROGRAMLISTING"
1614 >#include <iostream.h> /* This is not a local include */
1615 #include "config.h" /* This IS a local include */</PRE
1634 CLASS="PROGRAMLISTING"
1635 >/* This is not a local include, but requires a path element. */
1636 #include <sys/fileName.h></PRE
1647 > Please! do not add "-I." to the Makefile
1648 without a _very_ good reason. This duplicates the #include
1649 "file.h" behavior.</P
1657 >4.6.7. Provide multiple inclusion
1669 >Prevents compiler and linker errors resulting from
1670 redefinition of items.</P
1672 >Wrap each header file with the following syntax to prevent
1673 multiple inclusions of the file. Of course, replace PROJECT_H
1674 with your file name, with "." Changed to "_", and make it
1691 CLASS="PROGRAMLISTING"
1692 >#ifndef PROJECT_H_INCLUDED
1693 #define PROJECT_H_INCLUDED
1695 #endif /* ndef PROJECT_H_INCLUDED */</PRE
1706 >4.6.8. Use `extern "C"` when appropriate</A
1717 >If our headers are included from C++, they must declare our
1718 functions as `extern "C"`. This has no cost in C, but increases
1719 the potential re-usability of our code.</P
1735 CLASS="PROGRAMLISTING"
1739 #endif /* def __cplusplus */
1741 ... function definitions here ...
1745 #endif /* def __cplusplus */</PRE
1756 >4.6.9. Where Possible, Use Forward Struct
1757 Declaration Instead of Includes</A
1768 >Useful in headers that include pointers to other struct's.
1769 Modifications to excess header files may cause needless
1786 CLASS="PROGRAMLISTING"
1787 >/*********************************************************************
1788 * We're avoiding an include statement here!
1789 *********************************************************************/
1791 extern file_list *xyz;</PRE
1802 > If you declare "file_list xyz;" (without the
1803 pointer), then including the proper header file is necessary.
1804 If you only want to prototype a pointer, however, the header
1805 file is unnecessary.</P
1813 > Use with discretion.</P
1822 >4.7. General Coding Practices</A
1830 >4.7.1. Turn on warnings</A
1841 >Compiler warnings are meant to help you find bugs. You
1842 should turn on as many as possible. With GCC, the switch is
1843 "-Wall". Try and fix as many warnings as possible.</P
1851 >4.7.2. Provide a default case for all switch
1863 >What you think is guaranteed is never really guaranteed. The
1864 value that you don't think you need to check is the one that
1865 someday will be passed. So, to protect yourself from the
1866 unknown, always have a default step in a switch statement.</P
1882 CLASS="PROGRAMLISTING"
1883 >switch (hash_string(cmd))
1885 case hash_actions_file:
1895 ... anomaly code goes here ...
1896 continue; / break; / exit( 1 ); / etc ...
1898 } /* end switch (hash_string(cmd)) */</PRE
1909 > If you already have a default condition, you
1910 are obviously exempt from this point. Of note, most of the
1911 WIN32 code calls `DefWindowProc' after the switch statement.
1912 This API call *should* be included in a default statement.</P
1920 > This is not so much a readability issue
1921 as a robust programming issue. The "anomaly code goes here" may
1922 be no more than a print to the STDERR stream (as in
1923 load_config). Or it may really be an abort condition.</P
1931 > Programmer discretion is advised.</P
1939 >4.7.3. Try to avoid falling through cases in a
1940 switch statement.</A
1951 >In general, you will want to have a 'break' statement within
1952 each 'case' of a switch statement. This allows for the code to
1953 be more readable and understandable, and furthermore can
1954 prevent unwanted surprises if someone else later gets creative
1955 and moves the code around.</P
1957 >The language allows you to plan the fall through from one
1958 case statement to another simply by omitting the break
1959 statement within the case statement. This feature does have
1960 benefits, but should only be used in rare cases. In general,
1961 use a break statement for each case statement.</P
1963 >If you choose to allow fall through, you should comment both
1964 the fact of the fall through and reason why you felt it was
1973 >4.7.4. Don't mix size_t and other types</A
1984 >The type of size_t varies across platforms. Do not make
1985 assumptions about whether it is signed or unsigned, or about
1986 how long it is. Do not compare a size_t against another
1987 variable of a different type (or even against a constant)
1988 without casting one of the values.</P
1996 >4.7.5. Declare each variable and struct on its
2008 >It can be tempting to declare a series of variables all on
2025 CLASS="PROGRAMLISTING"
2049 > - there is more room for comments on the
2050 individual variables - easier to add new variables without
2051 messing up the original ones - when searching on a variable to
2052 find its type, there is less clutter to "visually"
2061 > when you want to declare a bunch of loop
2062 variables or other trivial variables; feel free to declare them
2063 on one line. You should, although, provide a good comment on
2072 > developer-discretion.</P
2080 >4.7.6. Use malloc/zalloc sparingly</A
2091 >Create a local struct (on the stack) if the variable will
2092 live and die within the context of one function call.</P
2094 >Only "malloc" a struct (on the heap) if the variable's life
2095 will extend beyond the context of one function call.</P
2111 CLASS="PROGRAMLISTING"
2112 >If a function creates a struct and stores a pointer to it in a
2113 list, then it should definitely be allocated via `malloc'.</PRE
2124 >4.7.7. The Programmer Who Uses 'malloc' is
2125 Responsible for Ensuring 'free'</A
2136 >If you have to "malloc" an instance, you are responsible for
2137 insuring that the instance is `free'd, even if the deallocation
2138 event falls within some other programmer's code. You are also
2139 responsible for ensuring that deletion is timely (i.e. not too
2140 soon, not too late). This is known as "low-coupling" and is a
2141 "good thing (tm)". You may need to offer a
2142 free/unload/destructor type function to accommodate this.</P
2158 CLASS="PROGRAMLISTING"
2159 >int load_re_filterfile(struct client_state *csp) { ... }
2160 static void unload_re_filterfile(void *f) { ... }</PRE
2173 >The developer cannot be expected to provide `free'ing
2174 functions for C run-time library functions ... such as
2183 > developer-discretion. The "main" use of this
2184 standard is for allocating and freeing data structures (complex
2193 >4.7.8. Add loaders to the `file_list' structure
2205 >I have ordered all of the "blocker" file code to be in alpha
2206 order. It is easier to add/read new blockers when you expect a
2215 > It may appear that the alpha order is broken in
2216 places by POPUP tests coming before PCRS tests. But since
2217 POPUPs can also be referred to as KILLPOPUPs, it is clear that
2218 it should come first.</P
2226 >4.7.9. "Uncertain" new code and/or changes to
2227 existing code, use XXX</A
2238 >If you have enough confidence in new code or confidence in
2239 your changes, but are not *quite* sure of the repercussions,
2242 >/* XXX: this code has a logic error on platform XYZ, *
2243 attempting to fix */ #ifdef PLATFORM ...changed code here...
2248 >/* XXX: I think the original author really meant this...
2249 */ ...changed code here...</P
2253 >/* XXX: new code that *may* break something else... */
2254 ...new code here...</P
2262 > If you make it clear that this may or may not
2263 be a "good thing (tm)", it will be easier to identify and
2264 include in the project (or conversely exclude from the
2274 >4.8. Addendum: Template for files and function
2282 >Example for file comments:</I
2292 CLASS="PROGRAMLISTING"
2293 >const char FILENAME_rcs[] = "$I<!-- Break CVS Substitution -->d$";
2294 /*********************************************************************
2296 * File : $S<!-- Break CVS Substitution -->ource$
2298 * Purpose : (Fill me in with a good description!)
2300 * Copyright : Written by and Copyright (C) 2001-2009
2301 * the Privoxy team. https://www.privoxy.org/
2303 * This program is free software; you can redistribute it
2304 * and/or modify it under the terms of the GNU General
2305 * Public License as published by the Free Software
2306 * Foundation; either version 2 of the License, or (at
2307 * your option) any later version.
2309 * This program is distributed in the hope that it will
2310 * be useful, but WITHOUT ANY WARRANTY; without even the
2311 * implied warranty of MERCHANTABILITY or FITNESS FOR A
2312 * PARTICULAR PURPOSE. See the GNU General Public
2313 * License for more details.
2315 * The GNU General Public License should be included with
2316 * this file. If not, you can view it at
2317 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2318 * or write to the Free Software Foundation, Inc.,
2319 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ,
2322 *********************************************************************/
2327 ...necessary include files for us to do our work...
2329 const char FILENAME_h_rcs[] = FILENAME_H_VERSION;</PRE
2340 > This declares the rcs variables that should be
2341 added to the "show-version" page. If this is a brand new
2342 creation by you, you are free to change the "Copyright" section
2343 to represent the rights you wish to maintain.</P
2351 > The formfeed character that is present right
2352 after the comment flower box is handy for (X|GNU)Emacs users to
2353 skip the verbiage and get to the heart of the code (via
2354 `forward-page' and `backward-page'). Please include it if you
2361 >Example for file header comments:</I
2371 CLASS="PROGRAMLISTING"
2372 >#ifndef _FILENAME_H
2374 #define FILENAME_H_VERSION "$I<!-- Break CVS Substitution -->d$"
2375 /*********************************************************************
2377 * File : $S<!-- Break CVS Substitution -->ource$
2379 * Purpose : (Fill me in with a good description!)
2381 * Copyright : Written by and Copyright (C) 2001-2009
2382 * the Privoxy team. https://www.privoxy.org/
2384 * This program is free software; you can redistribute it
2385 * and/or modify it under the terms of the GNU General
2386 * Public License as published by the Free Software
2387 * Foundation; either version 2 of the License, or (at
2388 * your option) any later version.
2390 * This program is distributed in the hope that it will
2391 * be useful, but WITHOUT ANY WARRANTY; without even the
2392 * implied warranty of MERCHANTABILITY or FITNESS FOR A
2393 * PARTICULAR PURPOSE. See the GNU General Public
2394 * License for more details.
2396 * The GNU General Public License should be included with
2397 * this file. If not, you can view it at
2398 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2399 * or write to the Free Software Foundation, Inc.,
2400 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ,
2403 *********************************************************************/
2406 #include "project.h"
2412 ... function headers here ...
2415 /* Revision control strings from this header and associated .c file */
2416 extern const char FILENAME_rcs[];
2417 extern const char FILENAME_h_rcs[];
2424 #endif /* ndef _FILENAME_H */
2439 >Example for function comments:</I
2449 CLASS="PROGRAMLISTING"
2450 >/*********************************************************************
2452 * Function : FUNCTION_NAME
2454 * Description : (Fill me in with a good description!)
2457 * 1 : param1 = pointer to an important thing
2458 * 2 : x = pointer to something else
2460 * Returns : 0 => Ok, everything else is an error.
2462 *********************************************************************/
2463 int FUNCTION_NAME(void *param1, const char *x)
2479 > If we all follow this practice, we should be
2480 able to parse our code to create a "self-documenting" web
2489 SUMMARY="Footer navigation table"
2500 HREF="documentation.html"
2528 >Documentation Guidelines</TD
2538 >Testing Guidelines</TD