4 >Coding Guidelines</TITLE
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64
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"></HEAD
39 >Privoxy Developer Manual</TH
47 HREF="documentation.html"
74 >6. Coding Guidelines</A
85 >This set of standards is designed to make our lives easier. It is
86 developed with the simple goal of helping us keep the "new and improved
90 >" consistent and reliable. Thus making
91 maintenance easier and increasing chances of success of the
94 >And that of course comes back to us as individuals. If we can
95 increase our development and product efficiencies then we can solve more
96 of the request for changes/improvements and in general feel good about
105 >6.2. Using Comments</A
113 >6.2.1. Comment, Comment, Comment</A
121 >Comment as much as possible without commenting the obvious.
122 For example do not comment "aVariable is equal to bVariable".
123 Instead explain why aVariable should be equal to the bVariable.
124 Just because a person can read code does not mean they will
125 understand why or what is being done. A reader may spend a lot
126 more time figuring out what is going on when a simple comment
127 or explanation would have prevented the extra research. Please
128 help your brother IJB'ers out!</P
130 >The comments will also help justify the intent of the code.
131 If the comment describes something different than what the code
132 is doing then maybe a programming error is occurring.</P
145 CLASS="PROGRAMLISTING"
146 >/* if page size greater than 1k ... */
147 if ( PageLength() > 1024 )
149 ... "block" the page up ...
152 /* if page size is small, send it in blocks */
153 if ( PageLength() > 1024 )
155 ... "block" the page up ...
158 This demonstrates 2 cases of "what not to do". The first is a
159 "syntax comment". The second is a comment that does not fit what
160 is actually being done.</PRE
171 >6.2.2. Use blocks for comments</A
179 >Comments can help or they can clutter. They help when they
180 are differentiated from the code they describe. One line
181 comments do not offer effective separation between the comment
182 and the code. Block identifiers do, by surrounding the code
183 with a clear, definable pattern.</P
196 CLASS="PROGRAMLISTING"
197 >/*********************************************************************
198 * This will stand out clearly in your code!
199 *********************************************************************/
200 if ( thisVariable == thatVariable )
202 DoSomethingVeryImportant();
206 /* unfortunately, this may not */
207 if ( thisVariable == thatVariable )
209 DoSomethingVeryImportant();
213 if ( thisVariable == thatVariable ) /* this may not either */
215 DoSomethingVeryImportant();
226 >If you are trying to add a small logic comment and do not
227 wish to "disrupt" the flow of the code, feel free to use a 1
228 line comment which is NOT on the same line as the code.</P
236 >6.2.3. Keep Comments on their own line</A
244 >It goes back to the question of readability. If the comment
245 is on the same line as the code it will be harder to read than
246 the comment that is on its own line.</P
248 >There are three exceptions to this rule, which should be
249 violated freely and often: during the definition of variables,
250 at the end of closing braces, when used to comment
264 CLASS="PROGRAMLISTING"
265 >/*********************************************************************
266 * This will stand out clearly in your code,
267 * But the second example won't.
268 *********************************************************************/
269 if ( thisVariable == thatVariable )
271 DoSomethingVeryImportant();
274 if ( thisVariable == thatVariable ) /*can you see me?*/
276 DoSomethingVeryImportant(); /*not easily*/
280 /*********************************************************************
281 * But, the encouraged exceptions:
282 *********************************************************************/
283 int urls_read = 0; /* # of urls read + rejected */
284 int urls_rejected = 0; /* # of urls rejected */
288 DoSomethingVeryImportant();
292 short DoSomethingVeryImportant(
293 short firstparam, /* represents something */
294 short nextparam /* represents something else */ )
298 } /* -END- DoSomethingVeryImportant */</PRE
309 >6.2.4. Comment each logical step</A
317 >Logical steps should be commented to help others follow the
318 intent of the written code and comments will make the code more
321 >If you have 25 lines of code without a comment, you should
322 probably go back into it to see where you forgot to put
325 >Most "for", "while", "do", etc... loops _probably_ need a
326 comment. After all, these are usually major logic
335 >6.2.5. Comment All Functions Thoroughly</A
343 >A reader of the code should be able to look at the comments
344 just prior to the beginning of a function and discern the
345 reason for its existence and the consequences of using it. The
346 reader should not have to read through the code to determine if
347 a given function is safe for a desired use. The proper
348 information thoroughly presented at the introduction of a
349 function not only saves time for subsequent maintenance or
350 debugging, it more importantly aids in code reuse by allowing a
351 user to determine the safety and applicability of any function
352 for the problem at hand. As a result of such benefits, all
353 functions should contain the information presented in the
354 addendum section of this document.</P
362 >6.2.6. Comment at the end of braces if the
363 content is more than one screen length</A
371 >Each closing brace should be followed on the same line by a
372 comment that describes the origination of the brace if the
373 original brace is off of the screen, or otherwise far away from
374 the closing brace. This will simplify the debugging,
375 maintenance, and readability of the code.</P
377 >As a suggestion , use the following flags to make the
378 comment and its brace more readable:</P
380 >use following a closing brace: } /* -END- if() or while ()
394 CLASS="PROGRAMLISTING"
397 DoSomethingVeryImportant();
398 ...some long list of commands...
399 } /* -END- if x is 1 */
405 DoSomethingVeryImportant();
406 ...some long list of commands...
407 } /* -END- if ( 1 == X ) */</PRE
419 >6.3. Naming Conventions</A
427 >6.3.1. Variable Names</A
435 >Use all lowercase, and separate words via an underscore
436 ('_'). Do not start an identifier with an underscore. (ANSI C
437 reserves these for use by the compiler and system headers.) Do
438 not use identifiers which are reserved in ANSI C++. (E.g.
439 template, class, true, false, ...). This is in case we ever
440 decide to port Privoxy to C++.</P
453 CLASS="PROGRAMLISTING"
454 >int ms_iis5_hack = 0;</PRE
471 CLASS="PROGRAMLISTING"
472 >int msiis5hack = 0; int msIis5Hack = 0;</PRE
484 >6.3.2. Function Names</A
492 >Use all lowercase, and separate words via an underscore
493 ('_'). Do not start an identifier with an underscore. (ANSI C
494 reserves these for use by the compiler and system headers.) Do
495 not use identifiers which are reserved in ANSI C++. (E.g.
496 template, class, true, false, ...). This is in case we ever
497 decide to port Privoxy to C++.</P
510 CLASS="PROGRAMLISTING"
511 >int load_some_file( struct client_state *csp )</PRE
528 CLASS="PROGRAMLISTING"
529 >int loadsomefile( struct client_state *csp )
530 int loadSomeFile( struct client_state *csp )</PRE
542 >6.3.3. Header file prototypes</A
550 >Use a descriptive parameter name in the function prototype
551 in header files. Use the same parameter name in the header file
552 that you use in the c file.</P
565 CLASS="PROGRAMLISTING"
566 >(.h) extern int load_aclfile( struct client_state *csp );
567 (.c) int load_aclfile( struct client_state *csp )</PRE
583 CLASS="PROGRAMLISTING"
584 >(.h) extern int load_aclfile( struct client_state * ); or
585 (.h) extern int load_aclfile();
586 (.c) int load_aclfile( struct client_state *csp )</PRE
598 >6.3.4. Enumerations, and #defines</A
606 >Use all capital letters, with underscores between words. Do
607 not start an identifier with an underscore. (ANSI C reserves
608 these for use by the compiler and system headers.)</P
621 CLASS="PROGRAMLISTING"
622 >(enumeration) : enum Boolean { FALSE, TRUE };
623 (#define) : #define DEFAULT_SIZE 100;</PRE
631 > We have a standard naming scheme for #defines
632 that toggle a feature in the preprocessor: FEATURE_>, where
633 > is a short (preferably 1 or 2 word) description.</P
646 CLASS="PROGRAMLISTING"
647 >#define FEATURE_FORCE 1
650 #define FORCE_PREFIX blah
651 #endif /* def FEATURE_FORCE */</PRE
670 >Spell common words out entirely (do not remove vowels).</P
672 >Use only widely-known domain acronyms and abbreviations.
673 Capitalize all letters of an acronym.</P
675 >Use underscore (_) to separate adjacent acronyms and
676 abbreviations. Never terminate a name with an underscore.</P
689 CLASS="PROGRAMLISTING"
690 >#define USE_IMAGE_LIST 1</PRE
707 CLASS="PROGRAMLISTING"
708 >#define USE_IMG_LST 1 or
709 #define _USE_IMAGE_LIST 1 or
710 #define USE_IMAGE_LIST_ 1 or
711 #define use_image_list 1 or
712 #define UseImageList 1</PRE
733 >6.4.1. Put braces on a line by themselves.</A
741 >The brace needs to be on a line all by itself, not at the
742 end of the statement. Curly braces should line up with the
743 construct that they're associated with. This practice makes it
744 easier to identify the opening and closing braces for a
758 CLASS="PROGRAMLISTING"
772 >if ( this == that ) { ... }</P
776 >if ( this == that ) { ... }</P
781 > In the special case that the if-statement is
782 inside a loop, and it is trivial, i.e. it tests for a
783 condition that is obvious from the purpose of the block,
784 one-liners as above may optically preserve the loop structure
785 and make it easier to read.</P
790 > developer-discretion.</P
794 >Example exception:</I
803 CLASS="PROGRAMLISTING"
804 >while ( more lines are read )
806 /* Please document what is/is not a comment line here */
807 if ( it's a comment ) continue;
809 do_something( line );
821 >6.4.2. ALL control statements should have a
830 >Using braces to make a block will make your code more
831 readable and less prone to error. All control statements should
832 have a block defined.</P
845 CLASS="PROGRAMLISTING"
860 >if ( this == that ) DoSomething(); DoSomethingElse();</P
864 >if ( this == that ) DoSomething();</P
869 > The first example in "Instead of" will execute
870 in a manner other than that which the developer desired (per
871 indentation). Using code braces would have prevented this
872 "feature". The "explanation" and "exception" from the point
873 above also applies.</P
881 >6.4.3. Do not belabor/blow-up boolean
896 CLASS="PROGRAMLISTING"
897 >structure->flag = ( condition );</PRE
907 >if ( condition ) { structure->flag = 1; } else {
908 structure->flag = 0; }</P
913 > The former is readable and concise. The later
914 is wordy and inefficient. Please assume that any developer new
915 to the project has at least a "good" knowledge of C/C++. (Hope
916 I do not offend by that last comment ... 8-)</P
924 >6.4.4. Use white space freely because it is
933 >Make it readable. The notable exception to using white space
934 freely is listed in the next guideline.</P
947 CLASS="PROGRAMLISTING"
950 int anotherValue = 0;
951 int thisVariable = 0;
953 if ( thisVariable == thatVariable )
955 firstValue = oldValue + ( ( someValue - anotherValue ) - whatever )</PRE
966 >6.4.5. Don't use white space around structure
975 >- structure pointer operator ( "->" ) - member operator (
976 "." ) - functions and parentheses</P
978 >It is a general coding practice to put pointers, references,
979 and function parentheses next to names. With spaces, the
980 connection between the object and variable/function name is not
994 CLASS="PROGRAMLISTING"
995 >aStruct->aMember;
1005 > aStruct -> aMember; aStruct . aMember;
1014 >6.4.6. Make the last brace of a function stand
1029 CLASS="PROGRAMLISTING"
1030 >int function1( ... )
1035 } /* -END- function1 */
1038 int function2( ... )
1040 } /* -END- function2 */</PRE
1050 >int function1( ... ) { ...code... return( retCode ); } int
1051 function2( ... ) { }</P
1056 > Use 1 blank line before the closing brace and 2
1057 lines afterward. This makes the end of function standout to
1058 the most casual viewer. Although function comments help
1059 separate functions, this is still a good coding practice. In
1060 fact, I follow these rules when using blocks in "for", "while",
1061 "do" loops, and long if {} statements too. After all whitespace
1067 > developer-discretion on the number of blank
1068 lines. Enforced is the end of function comments.</P
1076 >6.4.7. Use 3 character indentions</A
1084 >If some use 8 character TABs and some use 3 character TABs,
1085 the code can look *very* ragged. So use 3 character indentions
1086 only. If you like to use TABs, pass your code through a filter
1087 such as "expand -t3" before checking in your code.</P
1100 CLASS="PROGRAMLISTING"
1101 >static const char * const url_code_map[256] =
1107 int function1( ... )
1111 return( ALWAYS_TRUE );
1115 return( HOW_DID_YOU_GET_HERE );
1118 return( NEVER_GETS_HERE );
1132 >6.5. Initializing</A
1140 >6.5.1. Initialize all variables</A
1148 >Do not assume that the variables declared will not be used
1149 until after they have been assigned a value somewhere else in
1150 the code. Remove the chance of accidentally using an unassigned
1164 CLASS="PROGRAMLISTING"
1167 struct *ptr = NULL;</PRE
1175 > It is much easier to debug a SIGSEGV if the
1176 message says you are trying to access memory address 00000000
1177 and not 129FA012; or arrayPtr[20] causes a SIGSEV vs.
1183 > developer-discretion if and only if the
1184 variable is assigned a value "shortly after" declaration.</P
1201 >6.6.1. Name functions that return a boolean as a
1210 >Value should be phrased as a question that would logically
1211 be answered as a true or false statement</P
1224 CLASS="PROGRAMLISTING"
1225 >ShouldWeBlockThis();
1227 IsWebPageBlank();</PRE
1238 >6.6.2. Always specify a return type for a
1247 >The default return for a function is an int. To avoid
1248 ambiguity, create a return for a function when the return has a
1249 purpose, and create a void return type if the function does not
1250 need to return anything.</P
1258 >6.6.3. Minimize function calls when iterating by
1267 >It is easy to write the following code, and a clear argument
1268 can be made that the code is easy to understand:</P
1281 CLASS="PROGRAMLISTING"
1282 >for ( size_t cnt = 0; cnt < blockListLength(); cnt ++ )
1293 > Unfortunately, this makes a function call for
1294 each and every iteration. This increases the overhead in the
1295 program, because the compiler has to look up the function each
1296 time, call it, and return a value. Depending on what occurs in
1297 the blockListLength() call, it might even be creating and
1298 destroying structures with each iteration, even though in each
1299 case it is comparing "cnt" to the same value, over and over.
1300 Remember too - even a call to blockListLength() is a function
1301 call, with the same overhead.</P
1303 >Instead of using a function call during the iterations,
1304 assign the value to a variable, and evaluate using the
1318 CLASS="PROGRAMLISTING"
1319 >size_t len = blockListLength();
1321 for ( size_t cnt = 0; cnt < len; cnt ++ )
1332 > if the value of blockListLength() *may*
1333 change or could *potentially* change, then you must code the
1334 function call in the for/while loop.</P
1342 >6.6.4. Pass and Return by Const Reference</A
1350 >This allows a developer to define a const pointer and call
1351 your function. If your function does not have the const
1352 keyword, we may not be able to use your function. Consider
1353 strcmp, if it were defined as: extern int strcmp( char *s1,
1356 >I could then not use it to compare argv's in main: int main(
1357 int argc, const char *argv[] ) { strcmp( argv[0], "privoxy"
1360 >Both these pointers are *const*! If the c runtime library
1361 maintainers do it, we should too.</P
1369 >6.6.5. Pass and Return by Value</A
1377 >Most structures cannot fit onto a normal stack entry (i.e.
1378 they are not 4 bytes or less). Aka, a function declaration
1379 like: int load_aclfile( struct client_state csp )</P
1381 >would not work. So, to be consistent, we should declare all
1382 prototypes with "pass by value": int load_aclfile( struct
1383 client_state *csp )</P
1391 >6.6.6. Names of include files</A
1399 >Your include statements should contain the file name without
1400 a path. The path should be listed in the Makefile, using -I as
1401 processor directive to search the indicated paths. An exception
1402 to this would be for some proprietary software that utilizes a
1403 partial path to distinguish their header files from system or
1404 other header files.</P
1417 CLASS="PROGRAMLISTING"
1418 >#include <iostream.h> /* This is not a local include */
1419 #include "config.h" /* This IS a local include */</PRE
1436 CLASS="PROGRAMLISTING"
1437 >/* This is not a local include, but requires a path element. */
1438 #include <sys/fileName.h></PRE
1447 > Please! do not add "-I." to the Makefile
1448 without a _very_ good reason. This duplicates the #include
1449 "file.h" behavior.</P
1457 >6.6.7. Provide multiple inclusion
1466 >Prevents compiler and linker errors resulting from
1467 redefinition of items.</P
1469 >Wrap each header file with the following syntax to prevent
1470 multiple inclusions of the file. Of course, replace PROJECT_H
1471 with your file name, with "." Changed to "_", and make it
1485 CLASS="PROGRAMLISTING"
1486 >#ifndef PROJECT_H_INCLUDED
1487 #define PROJECT_H_INCLUDED
1489 #endif /* ndef PROJECT_H_INCLUDED */</PRE
1500 >6.6.8. Use `extern "C"` when appropriate</A
1508 >If our headers are included from C++, they must declare our
1509 functions as `extern "C"`. This has no cost in C, but increases
1510 the potential re-usability of our code.</P
1523 CLASS="PROGRAMLISTING"
1527 #endif /* def __cplusplus */
1529 ... function definitions here ...
1533 #endif /* def __cplusplus */</PRE
1544 >6.6.9. Where Possible, Use Forward Struct
1545 Declaration Instead of Includes</A
1553 >Useful in headers that include pointers to other struct's.
1554 Modifications to excess header files may cause needless
1568 CLASS="PROGRAMLISTING"
1569 >/*********************************************************************
1570 * We're avoiding an include statement here!
1571 *********************************************************************/
1573 extern file_list *xyz;</PRE
1581 > If you declare "file_list xyz;" (without the
1582 pointer), then including the proper header file is necessary.
1583 If you only want to prototype a pointer, however, the header
1584 file is unnecessary.</P
1589 > Use with discretion.</P
1598 >6.7. General Coding Practices</A
1606 >6.7.1. Turn on warnings</A
1614 >Compiler warnings are meant to help you find bugs. You
1615 should turn on as many as possible. With GCC, the switch is
1616 "-Wall". Try and fix as many warnings as possible.</P
1624 >6.7.2. Provide a default case for all switch
1633 >What you think is guaranteed is never really guaranteed. The
1634 value that you don't think you need to check is the one that
1635 someday will be passed. So, to protect yourself from the
1636 unknown, always have a default step in a switch statement.</P
1649 CLASS="PROGRAMLISTING"
1650 >switch( hash_string( cmd ) )
1652 case hash_actions_file :
1662 ... anomaly code goes here ...
1663 continue; / break; / exit( 1 ); / etc ...
1665 } /* end switch( hash_string( cmd ) ) */</PRE
1673 > If you already have a default condition, you
1674 are obviously exempt from this point. Of note, most of the
1675 WIN32 code calls `DefWindowProc' after the switch statement.
1676 This API call *should* be included in a default statement.</P
1681 > This is not so much a readability issue
1682 as a robust programming issue. The "anomaly code goes here" may
1683 be no more than a print to the STDERR stream (as in
1684 load_config). Or it may really be an ABEND condition.</P
1689 > Programmer discretion is advised.</P
1697 >6.7.3. Try to avoid falling through cases in a
1698 switch statement.</A
1706 >In general, you will want to have a 'break' statement within
1707 each 'case' of a switch statement. This allows for the code to
1708 be more readable and understandable, and furthermore can
1709 prevent unwanted surprises if someone else later gets creative
1710 and moves the code around.</P
1712 >The language allows you to plan the fall through from one
1713 case statement to another simply by omitting the break
1714 statement within the case statement. This feature does have
1715 benefits, but should only be used in rare cases. In general,
1716 use a break statement for each case statement.</P
1718 >If you choose to allow fall through, you should comment both
1719 the fact of the fall through and reason why you felt it was
1728 >6.7.4. Use 'long' or 'short' Instead of
1737 >On 32-bit platforms, int usually has the range of long. On
1738 16-bit platforms, int has the range of short.</P
1743 > open-to-debate. In the case of most FSF
1744 projects (including X/GNU-Emacs), there are typedefs to int4,
1745 int8, int16, (or equivalence ... I forget the exact typedefs
1746 now). Should we add these to IJB now that we have a "configure"
1755 >6.7.5. Don't mix size_t and other types</A
1763 >The type of size_t varies across platforms. Do not make
1764 assumptions about whether it is signed or unsigned, or about
1765 how long it is. Do not compare a size_t against another
1766 variable of a different type (or even against a constant)
1767 without casting one of the values. Try to avoid using size_t if
1776 >6.7.6. Declare each variable and struct on its
1785 >It can be tempting to declare a series of variables all on
1799 CLASS="PROGRAMLISTING"
1817 > - there is more room for comments on the
1818 individual variables - easier to add new variables without
1819 messing up the original ones - when searching on a variable to
1820 find its type, there is less clutter to "visually"
1826 > when you want to declare a bunch of loop
1827 variables or other trivial variables; feel free to declare them
1828 on 1 line. You should, although, provide a good comment on
1834 > developer-discretion.</P
1842 >6.7.7. Use malloc/zalloc sparingly</A
1850 >Create a local struct (on the stack) if the variable will
1851 live and die within the context of one function call.</P
1853 >Only "malloc" a struct (on the heap) if the variable's life
1854 will extend beyond the context of one function call.</P
1867 CLASS="PROGRAMLISTING"
1868 >If a function creates a struct and stores a pointer to it in a
1869 list, then it should definitely be allocated via `malloc'.</PRE
1880 >6.7.8. The Programmer Who Uses 'malloc' is
1881 Responsible for Ensuring 'free'</A
1889 >If you have to "malloc" an instance, you are responsible for
1890 insuring that the instance is `free'd, even if the deallocation
1891 event falls within some other programmer's code. You are also
1892 responsible for ensuring that deletion is timely (i.e. not too
1893 soon, not too late). This is known as "low-coupling" and is a
1894 "good thing (tm)". You may need to offer a
1895 free/unload/destuctor type function to accommodate this.</P
1908 CLASS="PROGRAMLISTING"
1909 >int load_re_filterfile( struct client_state *csp ) { ... }
1910 static void unload_re_filterfile( void *f ) { ... }</PRE
1920 >The developer cannot be expected to provide `free'ing
1921 functions for C run-time library functions ... such as
1927 > developer-discretion. The "main" use of this
1928 standard is for allocating and freeing data structures (complex
1937 >6.7.9. Add loaders to the `file_list' structure
1946 >I have ordered all of the "blocker" file code to be in alpha
1947 order. It is easier to add/read new blockers when you expect a
1953 > It may appear that the alpha order is broken in
1954 places by POPUP tests coming before PCRS tests. But since
1955 POPUPs can also be referred to as KILLPOPUPs, it is clear that
1956 it should come first.</P
1964 >6.7.10. "Uncertain" new code and/or changes to
1965 existing code, use FIXME</A
1973 >If you have enough confidence in new code or confidence in
1974 your changes, but are not *quite* sure of the repercussions,
1977 >/* FIXME: this code has a logic error on platform XYZ, *
1978 attempting to fix */ #ifdef PLATFORM ...changed code here...
1983 >/* FIXME: I think the original author really meant this...
1984 */ ...changed code here...</P
1988 >/* FIXME: new code that *may* break something else... */
1989 ...new code here...</P
1994 > If you make it clear that this may or may not
1995 be a "good thing (tm)", it will be easier to identify and
1996 include in the project (or conversely exclude from the
2006 >6.8. Addendum: Template for files and function
2012 >Example for file comments:</I
2021 CLASS="PROGRAMLISTING"
2022 >const char FILENAME_rcs[] = "$Id: developer-manual.sgml,v 1.37 2002/04/26 17:23:29 swa Exp $";
2023 /*********************************************************************
2027 * Purpose : (Fill me in with a good description!)
2029 * Copyright : Written by and Copyright (C) 2001 the SourceForge
2030 * Privoxy team. http://www.privoxy.org/
2032 * Based on the Internet Junkbuster originally written
2033 * by and Copyright (C) 1997 Anonymous Coders and
2034 * Junkbusters Corporation. http://www.junkbusters.com
2036 * This program is free software; you can redistribute it
2037 * and/or modify it under the terms of the GNU General
2038 * Public License as published by the Free Software
2039 * Foundation; either version 2 of the License, or (at
2040 * your option) any later version.
2042 * This program is distributed in the hope that it will
2043 * be useful, but WITHOUT ANY WARRANTY; without even the
2044 * implied warranty of MERCHANTABILITY or FITNESS FOR A
2045 * PARTICULAR PURPOSE. See the GNU General Public
2046 * License for more details.
2048 * The GNU General Public License should be included with
2049 * this file. If not, you can view it at
2050 * http://www.gnu.org/copyleft/gpl.html
2051 * or write to the Free Software Foundation, Inc., 59
2052 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2057 *********************************************************************/
2062 ...necessary include files for us to do our work...
2064 const char FILENAME_h_rcs[] = FILENAME_H_VERSION;</PRE
2072 > This declares the rcs variables that should be
2073 added to the "show-proxy-args" page. If this is a brand new
2074 creation by you, you are free to change the "Copyright" section
2075 to represent the rights you wish to maintain.</P
2080 > The formfeed character that is present right
2081 after the comment flower box is handy for (X|GNU)Emacs users to
2082 skip the verbiage and get to the heart of the code (via
2083 `forward-page' and `backward-page'). Please include it if you
2088 >Example for file header comments:</I
2097 CLASS="PROGRAMLISTING"
2098 >#ifndef _FILENAME_H
2100 #define FILENAME_H_VERSION "$Id: developer-manual.sgml,v 1.37 2002/04/26 17:23:29 swa Exp $"
2101 /*********************************************************************
2105 * Purpose : (Fill me in with a good description!)
2107 * Copyright : Written by and Copyright (C) 2001 the SourceForge
2108 * Privoxy team. http://www.privoxy.org/
2110 * Based on the Internet Junkbuster originally written
2111 * by and Copyright (C) 1997 Anonymous Coders and
2112 * Junkbusters Corporation. http://www.junkbusters.com
2114 * This program is free software; you can redistribute it
2115 * and/or modify it under the terms of the GNU General
2116 * Public License as published by the Free Software
2117 * Foundation; either version 2 of the License, or (at
2118 * your option) any later version.
2120 * This program is distributed in the hope that it will
2121 * be useful, but WITHOUT ANY WARRANTY; without even the
2122 * implied warranty of MERCHANTABILITY or FITNESS FOR A
2123 * PARTICULAR PURPOSE. See the GNU General Public
2124 * License for more details.
2126 * The GNU General Public License should be included with
2127 * this file. If not, you can view it at
2128 * http://www.gnu.org/copyleft/gpl.html
2129 * or write to the Free Software Foundation, Inc., 59
2130 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2135 *********************************************************************/
2138 #include "project.h"
2144 ... function headers here ...
2147 /* Revision control strings from this header and associated .c file */
2148 extern const char FILENAME_rcs[];
2149 extern const char FILENAME_h_rcs[];
2156 #endif /* ndef _FILENAME_H */
2169 >Example for function comments:</I
2178 CLASS="PROGRAMLISTING"
2179 >/*********************************************************************
2181 * Function : FUNCTION_NAME
2183 * Description : (Fill me in with a good description!)
2186 * 1 : param1 = pointer to an important thing
2187 * 2 : x = pointer to something else
2189 * Returns : 0 => Ok, everything else is an error.
2191 *********************************************************************/
2192 int FUNCTION_NAME( void *param1, const char *x )
2205 > If we all follow this practice, we should be
2206 able to parse our code to create a "self-documenting" web
2225 HREF="documentation.html"
2250 >Documentation Guidelines</TD
2260 >Testing Guidelines</TD