4 >Coding Guidelines</TITLE
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.60"><LINK
9 TITLE="Privoxy Developer Manual"
10 HREF="index.html"><LINK
12 TITLE="Documentation Guidelines"
13 HREF="documentation.html"><LINK
15 TITLE="Testing Guidelines"
16 HREF="testing.html"><LINK
19 HREF="../p_doc.css"></HEAD
38 >Privoxy Developer Manual</TH
46 HREF="documentation.html"
73 >4. Coding Guidelines</A
84 >This set of standards is designed to make our lives easier. It is
85 developed with the simple goal of helping us keep the "new and improved
89 >" consistent and reliable. Thus making
90 maintenance easier and increasing chances of success of the
93 >And that of course comes back to us as individuals. If we can
94 increase our development and product efficiencies then we can solve more
95 of the request for changes/improvements and in general feel good about
104 >4.2. Using Comments</A
112 >4.2.1. Comment, Comment, Comment</A
120 >Comment as much as possible without commenting the obvious.
121 For example do not comment "aVariable is equal to bVariable".
122 Instead explain why aVariable should be equal to the bVariable.
123 Just because a person can read code does not mean they will
124 understand why or what is being done. A reader may spend a lot
125 more time figuring out what is going on when a simple comment
126 or explanation would have prevented the extra research. Please
127 help your brother IJB'ers out!</P
129 >The comments will also help justify the intent of the code.
130 If the comment describes something different than what the code
131 is doing then maybe a programming error is occurring.</P
144 CLASS="PROGRAMLISTING"
145 >/* if page size greater than 1k ... */
146 if ( PageLength() > 1024 )
148 ... "block" the page up ...
151 /* if page size is small, send it in blocks */
152 if ( PageLength() > 1024 )
154 ... "block" the page up ...
157 This demonstrates 2 cases of "what not to do". The first is a
158 "syntax comment". The second is a comment that does not fit what
159 is actually being done.</PRE
170 >4.2.2. Use blocks for comments</A
178 >Comments can help or they can clutter. They help when they
179 are differentiated from the code they describe. One line
180 comments do not offer effective separation between the comment
181 and the code. Block identifiers do, by surrounding the code
182 with a clear, definable pattern.</P
195 CLASS="PROGRAMLISTING"
196 >/*********************************************************************
197 * This will stand out clearly in your code!
198 *********************************************************************/
199 if ( thisVariable == thatVariable )
201 DoSomethingVeryImportant();
205 /* unfortunately, this may not */
206 if ( thisVariable == thatVariable )
208 DoSomethingVeryImportant();
212 if ( thisVariable == thatVariable ) /* this may not either */
214 DoSomethingVeryImportant();
225 >If you are trying to add a small logic comment and do not
226 wish to "disrupt" the flow of the code, feel free to use a 1
227 line comment which is NOT on the same line as the code.</P
235 >4.2.3. Keep Comments on their own line</A
243 >It goes back to the question of readability. If the comment
244 is on the same line as the code it will be harder to read than
245 the comment that is on its own line.</P
247 >There are three exceptions to this rule, which should be
248 violated freely and often: during the definition of variables,
249 at the end of closing braces, when used to comment
263 CLASS="PROGRAMLISTING"
264 >/*********************************************************************
265 * This will stand out clearly in your code,
266 * But the second example won't.
267 *********************************************************************/
268 if ( thisVariable == thatVariable )
270 DoSomethingVeryImportant();
273 if ( thisVariable == thatVariable ) /*can you see me?*/
275 DoSomethingVeryImportant(); /*not easily*/
279 /*********************************************************************
280 * But, the encouraged exceptions:
281 *********************************************************************/
282 int urls_read = 0; /* # of urls read + rejected */
283 int urls_rejected = 0; /* # of urls rejected */
287 DoSomethingVeryImportant();
291 short DoSomethingVeryImportant(
292 short firstparam, /* represents something */
293 short nextparam /* represents something else */ )
297 } /* -END- DoSomethingVeryImportant */</PRE
308 >4.2.4. Comment each logical step</A
316 >Logical steps should be commented to help others follow the
317 intent of the written code and comments will make the code more
320 >If you have 25 lines of code without a comment, you should
321 probably go back into it to see where you forgot to put
324 >Most "for", "while", "do", etc... loops _probably_ need a
325 comment. After all, these are usually major logic
334 >4.2.5. Comment All Functions Thoroughly</A
342 >A reader of the code should be able to look at the comments
343 just prior to the beginning of a function and discern the
344 reason for its existence and the consequences of using it. The
345 reader should not have to read through the code to determine if
346 a given function is safe for a desired use. The proper
347 information thoroughly presented at the introduction of a
348 function not only saves time for subsequent maintenance or
349 debugging, it more importantly aids in code reuse by allowing a
350 user to determine the safety and applicability of any function
351 for the problem at hand. As a result of such benefits, all
352 functions should contain the information presented in the
353 addendum section of this document.</P
361 >4.2.6. Comment at the end of braces if the
362 content is more than one screen length</A
370 >Each closing brace should be followed on the same line by a
371 comment that describes the origination of the brace if the
372 original brace is off of the screen, or otherwise far away from
373 the closing brace. This will simplify the debugging,
374 maintenance, and readability of the code.</P
376 >As a suggestion , use the following flags to make the
377 comment and its brace more readable:</P
379 >use following a closing brace: } /* -END- if() or while ()
393 CLASS="PROGRAMLISTING"
396 DoSomethingVeryImportant();
397 ...some long list of commands...
398 } /* -END- if x is 1 */
404 DoSomethingVeryImportant();
405 ...some long list of commands...
406 } /* -END- if ( 1 == X ) */</PRE
418 >4.3. Naming Conventions</A
426 >4.3.1. Variable Names</A
434 >Use all lowercase, and separate words via an underscore
435 ('_'). Do not start an identifier with an underscore. (ANSI C
436 reserves these for use by the compiler and system headers.) Do
437 not use identifiers which are reserved in ANSI C++. (E.g.
438 template, class, true, false, ...). This is in case we ever
439 decide to port Privoxy to C++.</P
452 CLASS="PROGRAMLISTING"
453 >int ms_iis5_hack = 0;</PRE
470 CLASS="PROGRAMLISTING"
471 >int msiis5hack = 0; int msIis5Hack = 0;</PRE
483 >4.3.2. Function Names</A
491 >Use all lowercase, and separate words via an underscore
492 ('_'). Do not start an identifier with an underscore. (ANSI C
493 reserves these for use by the compiler and system headers.) Do
494 not use identifiers which are reserved in ANSI C++. (E.g.
495 template, class, true, false, ...). This is in case we ever
496 decide to port Privoxy to C++.</P
509 CLASS="PROGRAMLISTING"
510 >int load_some_file( struct client_state *csp )</PRE
527 CLASS="PROGRAMLISTING"
528 >int loadsomefile( struct client_state *csp )
529 int loadSomeFile( struct client_state *csp )</PRE
541 >4.3.3. Header file prototypes</A
549 >Use a descriptive parameter name in the function prototype
550 in header files. Use the same parameter name in the header file
551 that you use in the c file.</P
564 CLASS="PROGRAMLISTING"
565 >(.h) extern int load_aclfile( struct client_state *csp );
566 (.c) int load_aclfile( struct client_state *csp )</PRE
582 CLASS="PROGRAMLISTING"
583 >(.h) extern int load_aclfile( struct client_state * ); or
584 (.h) extern int load_aclfile();
585 (.c) int load_aclfile( struct client_state *csp )</PRE
597 >4.3.4. Enumerations, and #defines</A
605 >Use all capital letters, with underscores between words. Do
606 not start an identifier with an underscore. (ANSI C reserves
607 these for use by the compiler and system headers.)</P
620 CLASS="PROGRAMLISTING"
621 >(enumeration) : enum Boolean { FALSE, TRUE };
622 (#define) : #define DEFAULT_SIZE 100;</PRE
630 > We have a standard naming scheme for #defines
631 that toggle a feature in the preprocessor: FEATURE_>, where
632 > is a short (preferably 1 or 2 word) description.</P
645 CLASS="PROGRAMLISTING"
646 >#define FEATURE_FORCE 1
649 #define FORCE_PREFIX blah
650 #endif /* def FEATURE_FORCE */</PRE
669 >Spell common words out entirely (do not remove vowels).</P
671 >Use only widely-known domain acronyms and abbreviations.
672 Capitalize all letters of an acronym.</P
674 >Use underscore (_) to separate adjacent acronyms and
675 abbreviations. Never terminate a name with an underscore.</P
688 CLASS="PROGRAMLISTING"
689 >#define USE_IMAGE_LIST 1</PRE
706 CLASS="PROGRAMLISTING"
707 >#define USE_IMG_LST 1 or
708 #define _USE_IMAGE_LIST 1 or
709 #define USE_IMAGE_LIST_ 1 or
710 #define use_image_list 1 or
711 #define UseImageList 1</PRE
732 >4.4.1. Put braces on a line by themselves.</A
740 >The brace needs to be on a line all by itself, not at the
741 end of the statement. Curly braces should line up with the
742 construct that they're associated with. This practice makes it
743 easier to identify the opening and closing braces for a
757 CLASS="PROGRAMLISTING"
771 >if ( this == that ) { ... }</P
775 >if ( this == that ) { ... }</P
780 > In the special case that the if-statement is
781 inside a loop, and it is trivial, i.e. it tests for a
782 condition that is obvious from the purpose of the block,
783 one-liners as above may optically preserve the loop structure
784 and make it easier to read.</P
789 > developer-discretion.</P
793 >Example exception:</I
802 CLASS="PROGRAMLISTING"
803 >while ( more lines are read )
805 /* Please document what is/is not a comment line here */
806 if ( it's a comment ) continue;
808 do_something( line );
820 >4.4.2. ALL control statements should have a
829 >Using braces to make a block will make your code more
830 readable and less prone to error. All control statements should
831 have a block defined.</P
844 CLASS="PROGRAMLISTING"
859 >if ( this == that ) DoSomething(); DoSomethingElse();</P
863 >if ( this == that ) DoSomething();</P
868 > The first example in "Instead of" will execute
869 in a manner other than that which the developer desired (per
870 indentation). Using code braces would have prevented this
871 "feature". The "explanation" and "exception" from the point
872 above also applies.</P
880 >4.4.3. Do not belabor/blow-up boolean
895 CLASS="PROGRAMLISTING"
896 >structure->flag = ( condition );</PRE
906 >if ( condition ) { structure->flag = 1; } else {
907 structure->flag = 0; }</P
912 > The former is readable and concise. The later
913 is wordy and inefficient. Please assume that any developer new
914 to the project has at least a "good" knowledge of C/C++. (Hope
915 I do not offend by that last comment ... 8-)</P
923 >4.4.4. Use white space freely because it is
932 >Make it readable. The notable exception to using white space
933 freely is listed in the next guideline.</P
946 CLASS="PROGRAMLISTING"
949 int anotherValue = 0;
950 int thisVariable = 0;
952 if ( thisVariable == thatVariable )
954 firstValue = oldValue + ( ( someValue - anotherValue ) - whatever )</PRE
965 >4.4.5. Don't use white space around structure
974 >- structure pointer operator ( "->" ) - member operator (
975 "." ) - functions and parentheses</P
977 >It is a general coding practice to put pointers, references,
978 and function parentheses next to names. With spaces, the
979 connection between the object and variable/function name is not
993 CLASS="PROGRAMLISTING"
994 >aStruct->aMember;
1004 > aStruct -> aMember; aStruct . aMember;
1013 >4.4.6. Make the last brace of a function stand
1028 CLASS="PROGRAMLISTING"
1029 >int function1( ... )
1034 } /* -END- function1 */
1037 int function2( ... )
1039 } /* -END- function2 */</PRE
1049 >int function1( ... ) { ...code... return( retCode ); } int
1050 function2( ... ) { }</P
1055 > Use 1 blank line before the closing brace and 2
1056 lines afterward. This makes the end of function standout to
1057 the most casual viewer. Although function comments help
1058 separate functions, this is still a good coding practice. In
1059 fact, I follow these rules when using blocks in "for", "while",
1060 "do" loops, and long if {} statements too. After all whitespace
1066 > developer-discretion on the number of blank
1067 lines. Enforced is the end of function comments.</P
1075 >4.4.7. Use 3 character indentions</A
1083 >If some use 8 character TABs and some use 3 character TABs,
1084 the code can look *very* ragged. So use 3 character indentions
1085 only. If you like to use TABs, pass your code through a filter
1086 such as "expand -t3" before checking in your code.</P
1099 CLASS="PROGRAMLISTING"
1100 >static const char * const url_code_map[256] =
1106 int function1( ... )
1110 return( ALWAYS_TRUE );
1114 return( HOW_DID_YOU_GET_HERE );
1117 return( NEVER_GETS_HERE );
1131 >4.5. Initializing</A
1139 >4.5.1. Initialize all variables</A
1147 >Do not assume that the variables declared will not be used
1148 until after they have been assigned a value somewhere else in
1149 the code. Remove the chance of accidentally using an unassigned
1163 CLASS="PROGRAMLISTING"
1166 struct *ptr = NULL;</PRE
1174 > It is much easier to debug a SIGSEGV if the
1175 message says you are trying to access memory address 00000000
1176 and not 129FA012; or arrayPtr[20] causes a SIGSEV vs.
1182 > developer-discretion if and only if the
1183 variable is assigned a value "shortly after" declaration.</P
1200 >4.6.1. Name functions that return a boolean as a
1209 >Value should be phrased as a question that would logically
1210 be answered as a true or false statement</P
1223 CLASS="PROGRAMLISTING"
1224 >ShouldWeBlockThis();
1226 IsWebPageBlank();</PRE
1237 >4.6.2. Always specify a return type for a
1246 >The default return for a function is an int. To avoid
1247 ambiguity, create a return for a function when the return has a
1248 purpose, and create a void return type if the function does not
1249 need to return anything.</P
1257 >4.6.3. Minimize function calls when iterating by
1266 >It is easy to write the following code, and a clear argument
1267 can be made that the code is easy to understand:</P
1280 CLASS="PROGRAMLISTING"
1281 >for ( size_t cnt = 0; cnt < blockListLength(); cnt ++ )
1292 > Unfortunately, this makes a function call for
1293 each and every iteration. This increases the overhead in the
1294 program, because the compiler has to look up the function each
1295 time, call it, and return a value. Depending on what occurs in
1296 the blockListLength() call, it might even be creating and
1297 destroying structures with each iteration, even though in each
1298 case it is comparing "cnt" to the same value, over and over.
1299 Remember too - even a call to blockListLength() is a function
1300 call, with the same overhead.</P
1302 >Instead of using a function call during the iterations,
1303 assign the value to a variable, and evaluate using the
1317 CLASS="PROGRAMLISTING"
1318 >size_t len = blockListLength();
1320 for ( size_t cnt = 0; cnt < len; cnt ++ )
1331 > if the value of blockListLength() *may*
1332 change or could *potentially* change, then you must code the
1333 function call in the for/while loop.</P
1341 >4.6.4. Pass and Return by Const Reference</A
1349 >This allows a developer to define a const pointer and call
1350 your function. If your function does not have the const
1351 keyword, we may not be able to use your function. Consider
1352 strcmp, if it were defined as: extern int strcmp( char *s1,
1355 >I could then not use it to compare argv's in main: int main(
1356 int argc, const char *argv[] ) { strcmp( argv[0], "privoxy"
1359 >Both these pointers are *const*! If the c runtime library
1360 maintainers do it, we should too.</P
1368 >4.6.5. Pass and Return by Value</A
1376 >Most structures cannot fit onto a normal stack entry (i.e.
1377 they are not 4 bytes or less). Aka, a function declaration
1378 like: int load_aclfile( struct client_state csp )</P
1380 >would not work. So, to be consistent, we should declare all
1381 prototypes with "pass by value": int load_aclfile( struct
1382 client_state *csp )</P
1390 >4.6.6. Names of include files</A
1398 >Your include statements should contain the file name without
1399 a path. The path should be listed in the Makefile, using -I as
1400 processor directive to search the indicated paths. An exception
1401 to this would be for some proprietary software that utilizes a
1402 partial path to distinguish their header files from system or
1403 other header files.</P
1416 CLASS="PROGRAMLISTING"
1417 >#include <iostream.h> /* This is not a local include */
1418 #include "config.h" /* This IS a local include */</PRE
1435 CLASS="PROGRAMLISTING"
1436 >/* This is not a local include, but requires a path element. */
1437 #include <sys/fileName.h></PRE
1446 > Please! do not add "-I." to the Makefile
1447 without a _very_ good reason. This duplicates the #include
1448 "file.h" behavior.</P
1456 >4.6.7. Provide multiple inclusion
1465 >Prevents compiler and linker errors resulting from
1466 redefinition of items.</P
1468 >Wrap each header file with the following syntax to prevent
1469 multiple inclusions of the file. Of course, replace PROJECT_H
1470 with your file name, with "." Changed to "_", and make it
1484 CLASS="PROGRAMLISTING"
1485 >#ifndef PROJECT_H_INCLUDED
1486 #define PROJECT_H_INCLUDED
1488 #endif /* ndef PROJECT_H_INCLUDED */</PRE
1499 >4.6.8. Use `extern "C"` when appropriate</A
1507 >If our headers are included from C++, they must declare our
1508 functions as `extern "C"`. This has no cost in C, but increases
1509 the potential re-usability of our code.</P
1522 CLASS="PROGRAMLISTING"
1526 #endif /* def __cplusplus */
1528 ... function definitions here ...
1532 #endif /* def __cplusplus */</PRE
1543 >4.6.9. Where Possible, Use Forward Struct
1544 Declaration Instead of Includes</A
1552 >Useful in headers that include pointers to other struct's.
1553 Modifications to excess header files may cause needless
1567 CLASS="PROGRAMLISTING"
1568 >/*********************************************************************
1569 * We're avoiding an include statement here!
1570 *********************************************************************/
1572 extern file_list *xyz;</PRE
1580 > If you declare "file_list xyz;" (without the
1581 pointer), then including the proper header file is necessary.
1582 If you only want to prototype a pointer, however, the header
1583 file is unnecessary.</P
1588 > Use with discretion.</P
1597 >4.7. General Coding Practices</A
1605 >4.7.1. Turn on warnings</A
1613 >Compiler warnings are meant to help you find bugs. You
1614 should turn on as many as possible. With GCC, the switch is
1615 "-Wall". Try and fix as many warnings as possible.</P
1623 >4.7.2. Provide a default case for all switch
1632 >What you think is guaranteed is never really guaranteed. The
1633 value that you don't think you need to check is the one that
1634 someday will be passed. So, to protect yourself from the
1635 unknown, always have a default step in a switch statement.</P
1648 CLASS="PROGRAMLISTING"
1649 >switch( hash_string( cmd ) )
1651 case hash_actions_file :
1661 ... anomaly code goes here ...
1662 continue; / break; / exit( 1 ); / etc ...
1664 } /* end switch( hash_string( cmd ) ) */</PRE
1672 > If you already have a default condition, you
1673 are obviously exempt from this point. Of note, most of the
1674 WIN32 code calls `DefWindowProc' after the switch statement.
1675 This API call *should* be included in a default statement.</P
1680 > This is not so much a readability issue
1681 as a robust programming issue. The "anomaly code goes here" may
1682 be no more than a print to the STDERR stream (as in
1683 load_config). Or it may really be an ABEND condition.</P
1688 > Programmer discretion is advised.</P
1696 >4.7.3. Try to avoid falling through cases in a
1697 switch statement.</A
1705 >In general, you will want to have a 'break' statement within
1706 each 'case' of a switch statement. This allows for the code to
1707 be more readable and understandable, and furthermore can
1708 prevent unwanted surprises if someone else later gets creative
1709 and moves the code around.</P
1711 >The language allows you to plan the fall through from one
1712 case statement to another simply by omitting the break
1713 statement within the case statement. This feature does have
1714 benefits, but should only be used in rare cases. In general,
1715 use a break statement for each case statement.</P
1717 >If you choose to allow fall through, you should comment both
1718 the fact of the fall through and reason why you felt it was
1727 >4.7.4. Use 'long' or 'short' Instead of
1736 >On 32-bit platforms, int usually has the range of long. On
1737 16-bit platforms, int has the range of short.</P
1742 > open-to-debate. In the case of most FSF
1743 projects (including X/GNU-Emacs), there are typedefs to int4,
1744 int8, int16, (or equivalence ... I forget the exact typedefs
1745 now). Should we add these to IJB now that we have a "configure"
1754 >4.7.5. Don't mix size_t and other types</A
1762 >The type of size_t varies across platforms. Do not make
1763 assumptions about whether it is signed or unsigned, or about
1764 how long it is. Do not compare a size_t against another
1765 variable of a different type (or even against a constant)
1766 without casting one of the values. Try to avoid using size_t if
1775 >4.7.6. Declare each variable and struct on its
1784 >It can be tempting to declare a series of variables all on
1798 CLASS="PROGRAMLISTING"
1816 > - there is more room for comments on the
1817 individual variables - easier to add new variables without
1818 messing up the original ones - when searching on a variable to
1819 find its type, there is less clutter to "visually"
1825 > when you want to declare a bunch of loop
1826 variables or other trivial variables; feel free to declare them
1827 on 1 line. You should, although, provide a good comment on
1833 > developer-discretion.</P
1841 >4.7.7. Use malloc/zalloc sparingly</A
1849 >Create a local struct (on the stack) if the variable will
1850 live and die within the context of one function call.</P
1852 >Only "malloc" a struct (on the heap) if the variable's life
1853 will extend beyond the context of one function call.</P
1866 CLASS="PROGRAMLISTING"
1867 >If a function creates a struct and stores a pointer to it in a
1868 list, then it should definitely be allocated via `malloc'.</PRE
1879 >4.7.8. The Programmer Who Uses 'malloc' is
1880 Responsible for Ensuring 'free'</A
1888 >If you have to "malloc" an instance, you are responsible for
1889 insuring that the instance is `free'd, even if the deallocation
1890 event falls within some other programmer's code. You are also
1891 responsible for ensuring that deletion is timely (i.e. not too
1892 soon, not too late). This is known as "low-coupling" and is a
1893 "good thing (tm)". You may need to offer a
1894 free/unload/destructor type function to accommodate this.</P
1907 CLASS="PROGRAMLISTING"
1908 >int load_re_filterfile( struct client_state *csp ) { ... }
1909 static void unload_re_filterfile( void *f ) { ... }</PRE
1919 >The developer cannot be expected to provide `free'ing
1920 functions for C run-time library functions ... such as
1926 > developer-discretion. The "main" use of this
1927 standard is for allocating and freeing data structures (complex
1936 >4.7.9. Add loaders to the `file_list' structure
1945 >I have ordered all of the "blocker" file code to be in alpha
1946 order. It is easier to add/read new blockers when you expect a
1952 > It may appear that the alpha order is broken in
1953 places by POPUP tests coming before PCRS tests. But since
1954 POPUPs can also be referred to as KILLPOPUPs, it is clear that
1955 it should come first.</P
1963 >4.7.10. "Uncertain" new code and/or changes to
1964 existing code, use FIXME</A
1972 >If you have enough confidence in new code or confidence in
1973 your changes, but are not *quite* sure of the repercussions,
1976 >/* FIXME: this code has a logic error on platform XYZ, *
1977 attempting to fix */ #ifdef PLATFORM ...changed code here...
1982 >/* FIXME: I think the original author really meant this...
1983 */ ...changed code here...</P
1987 >/* FIXME: new code that *may* break something else... */
1988 ...new code here...</P
1993 > If you make it clear that this may or may not
1994 be a "good thing (tm)", it will be easier to identify and
1995 include in the project (or conversely exclude from the
2005 >4.8. Addendum: Template for files and function
2011 >Example for file comments:</I
2020 CLASS="PROGRAMLISTING"
2021 >const char FILENAME_rcs[] = "$Id: developer-manual.sgml,v 1.46.2.6 2002/08/10 11:40:25 oes Exp $";
2022 /*********************************************************************
2026 * Purpose : (Fill me in with a good description!)
2028 * Copyright : Written by and Copyright (C) 2001 the SourceForge
2029 * Privoxy team. http://www.privoxy.org/
2031 * Based on the Internet Junkbuster originally written
2032 * by and Copyright (C) 1997 Anonymous Coders and
2033 * Junkbusters Corporation. http://www.junkbusters.com
2035 * This program is free software; you can redistribute it
2036 * and/or modify it under the terms of the GNU General
2037 * Public License as published by the Free Software
2038 * Foundation; either version 2 of the License, or (at
2039 * your option) any later version.
2041 * This program is distributed in the hope that it will
2042 * be useful, but WITHOUT ANY WARRANTY; without even the
2043 * implied warranty of MERCHANTABILITY or FITNESS FOR A
2044 * PARTICULAR PURPOSE. See the GNU General Public
2045 * License for more details.
2047 * The GNU General Public License should be included with
2048 * this file. If not, you can view it at
2049 * http://www.gnu.org/copyleft/gpl.html
2050 * or write to the Free Software Foundation, Inc., 59
2051 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2056 *********************************************************************/
2061 ...necessary include files for us to do our work...
2063 const char FILENAME_h_rcs[] = FILENAME_H_VERSION;</PRE
2071 > This declares the rcs variables that should be
2072 added to the "show-proxy-args" page. If this is a brand new
2073 creation by you, you are free to change the "Copyright" section
2074 to represent the rights you wish to maintain.</P
2079 > The formfeed character that is present right
2080 after the comment flower box is handy for (X|GNU)Emacs users to
2081 skip the verbiage and get to the heart of the code (via
2082 `forward-page' and `backward-page'). Please include it if you
2087 >Example for file header comments:</I
2096 CLASS="PROGRAMLISTING"
2097 >#ifndef _FILENAME_H
2099 #define FILENAME_H_VERSION "$Id: developer-manual.sgml,v 1.46.2.6 2002/08/10 11:40:25 oes Exp $"
2100 /*********************************************************************
2104 * Purpose : (Fill me in with a good description!)
2106 * Copyright : Written by and Copyright (C) 2001 the SourceForge
2107 * Privoxy team. http://www.privoxy.org/
2109 * Based on the Internet Junkbuster originally written
2110 * by and Copyright (C) 1997 Anonymous Coders and
2111 * Junkbusters Corporation. http://www.junkbusters.com
2113 * This program is free software; you can redistribute it
2114 * and/or modify it under the terms of the GNU General
2115 * Public License as published by the Free Software
2116 * Foundation; either version 2 of the License, or (at
2117 * your option) any later version.
2119 * This program is distributed in the hope that it will
2120 * be useful, but WITHOUT ANY WARRANTY; without even the
2121 * implied warranty of MERCHANTABILITY or FITNESS FOR A
2122 * PARTICULAR PURPOSE. See the GNU General Public
2123 * License for more details.
2125 * The GNU General Public License should be included with
2126 * this file. If not, you can view it at
2127 * http://www.gnu.org/copyleft/gpl.html
2128 * or write to the Free Software Foundation, Inc., 59
2129 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2134 *********************************************************************/
2137 #include "project.h"
2143 ... function headers here ...
2146 /* Revision control strings from this header and associated .c file */
2147 extern const char FILENAME_rcs[];
2148 extern const char FILENAME_h_rcs[];
2155 #endif /* ndef _FILENAME_H */
2168 >Example for function comments:</I
2177 CLASS="PROGRAMLISTING"
2178 >/*********************************************************************
2180 * Function : FUNCTION_NAME
2182 * Description : (Fill me in with a good description!)
2185 * 1 : param1 = pointer to an important thing
2186 * 2 : x = pointer to something else
2188 * Returns : 0 => Ok, everything else is an error.
2190 *********************************************************************/
2191 int FUNCTION_NAME( void *param1, const char *x )
2204 > If we all follow this practice, we should be
2205 able to parse our code to create a "self-documenting" web
2224 HREF="documentation.html"
2249 >Documentation Guidelines</TD
2259 >Testing Guidelines</TD