b8d762aad0626c9073fe58c4b927a8983521efcd
[privoxy.git] / doc / source / developer-manual.sgml
1 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[
2 <!entity % dummy "IGNORE"> 
3 <!entity supported SYSTEM "supported.sgml">
4 <!entity newfeatures SYSTEM "newfeatures.sgml">
5 <!entity p-intro SYSTEM "privoxy.sgml">
6 <!entity history SYSTEM "history.sgml">
7 <!entity seealso SYSTEM "seealso.sgml">
8 <!entity contacting SYSTEM "contacting.sgml">
9 <!entity copyright SYSTEM "copyright.sgml">
10 <!entity license SYSTEM "license.sgml">
11 <!entity p-version SYSTEM "doc_version.tmp">
12 <!entity p-status SYSTEM "doc_status.tmp">
13 <!entity % p-not-stable "IGNORE">
14 <!entity % p-stable "IGNORE">
15 <!entity % p-text "IGNORE">        <!-- define we are not a text only doc -->
16 <!entity % p-doc "INCLUDE">        <!-- and we are a formal doc           -->
17 <!entity  my-copy "&copy;">        <!-- kludge for docbook2man            -->
18 ]>
19 <!--
20  File        :  $Source: /cvsroot/ijbswa/current/doc/source/developer-manual.sgml,v $
21
22  Purpose     :  developer manual
23                 This file belongs into
24                 ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
25                 
26  $Id: developer-manual.sgml,v 2.1 2002/07/29 22:08:40 jongfoster Exp $
27
28  Copyright (C) 2001, 2002 Privoxy Developers <developers@privoxy.org>
29  See LICENSE.
30
31  ========================================================================
32  NOTE: Please read developer-manual/documentation.html before touching 
33  anything in this, or other Privoxy documentation. 
34  ========================================================================
35
36 -->
37
38 <article id="index">
39   <artheader>
40     <title>Privoxy Developer Manual</title>
41     <pubdate>
42      <subscript>
43     <!-- Completely the wrong markup, but very little is allowed  -->
44     <!-- in this part of an article. FIXME -->
45       <link linkend="copyright">Copyright</link> &my-copy; 2001, 2002 by 
46       <ulink url="http://www.privoxy.org">Privoxy Developers</ulink>
47      </subscript>
48     </pubdate>
49
50
51     <pubdate>$Id: developer-manual.sgml,v 1.46.2.8 2002/08/17 00:16:10 hal9 Exp $</pubdate>
52
53 <!--
54
55 Note: this should generate a separate page, and a live link to it. 
56 But it doesn't for some mysterious reason. Please leave commented
57 unless it can be fixed proper. For the time being, the copyright 
58 statement will be in copyright.smgl.
59
60 Hal.
61
62 <legalnotice id="legalnotice"> 
63  <para>
64   text goes here ........
65  </para>
66 </legalnotice>
67
68 -->
69
70     <abstract>
71
72 <![%dummy;[
73  <para>
74  <comment>
75   This is here to keep vim syntax file from breaking :/
76   If I knew enough to fix it, I would.
77   PLEASE DO NOT REMOVE! HB: hal@foobox.net
78  </comment>
79  </para>
80  ]]>
81 <para>
82  The developer manual provides guidance on coding, testing, packaging, documentation
83  and other issues of importance to those involved with
84  <application>Privoxy</application> development. It is mandatory (and helpful!) reading
85  for anyone who wants to join the team.
86 </para>
87
88 <!-- Include privoxy.sgml boilerplate text: -->
89
90 <!--  &p-intro; Someone interested enough in the project to contribute
91                 will already know at this point what Privoxy is. -->
92
93 <!-- end boilerplate -->
94
95 <para>
96  Please note that this document is constantly evolving. This copy represents
97  the state at the release of version &p-version;.
98  You can find the latest version of the this manual at <ulink
99  url="http://www.privoxy.org/developer-manual/">http://www.privoxy.org/developer-manual/</ulink>.
100  Please see <link linkend="contact">the Contact section</link> 
101  on how to contact the developers.
102 </para>
103 <!--        <para> -->
104 <!--    Feel free to send a note to the developers at <email>ijbswa-developers@lists.sourceforge.net</email>. -->
105 <!--   </para> -->
106
107     </abstract>
108   </artheader>
109
110
111 <!--   ~~~~~       New section      ~~~~~     -->
112   <sect1 id="introduction"><title>Introduction</title>
113 <!--
114
115  I don't like seeing blank space :) So added *something* here.
116
117  --> 
118     <para>
119      <application>Privoxy</application>, as an heir to
120      <application>Junkbuster</application>, is an Open Source project 
121      and licensed under the GPL. As such, <application>Privoxy</application>
122      development is potentially open to anyone who has the time, knowledge,
123      and desire to contribute in any capacity. Our goals are simply to
124      continue the mission, to improve <application>Privoxy</application>, and
125      to make it available to as wide an audience as possible. 
126     </para>
127     <para>
128      One does not have to be a programmer to contribute. Packaging, testing,
129      and porting, are all important jobs as well.
130     </para>
131
132   <!--   ~~~~~       New section      ~~~~~     -->
133   <sect2 id="quickstart"><title>Quickstart to Privoxy Development</title>
134     <para>
135       You'll need an account on <ulink
136       url="http://sourceforge.net/">Sourceforge</ulink> to support our
137       development.  Mail your ID to <ulink
138       url="mailto:developers@privoxy.org">the list</ulink> and wait until a
139       project manager has added you.
140     </para>
141     <para>
142      You will also need to have a cvs package installed, which will 
143      entail having ssh installed as well (which seems to be a requirement of
144      SourceForge), in order to access the cvs repository. Having the GNU build
145      tools is also going to be important (particularly, autoconf and gmake).
146     </para>
147     <para>
148       For the time being (read, this section is under construction), please
149       refer to the extensive comments in the source code.
150     </para>
151    </sect2>
152   </sect1>
153
154   <!--   ~~~~~       New section      ~~~~~     -->
155   <sect1 id="cvs"><title>The CVS Repository</title>
156     <para>
157       If you intend to help us with programming, documentation or packaging
158       you will need write access to our holy grail, the CVS repository.
159       Please read this chapter completely before accessing via CVS.
160     </para>
161
162     <sect2 id="cvsaccess"><title>Access to CVS</title>
163       <para>
164         The project's CVS repository is hosted on
165         <ulink url="http://sourceforge.net/">SourceForge.</ulink>
166         Please refer to the chapters 6 and 7 in
167         <ulink url="http://sourceforge.net/docman/?group_id=1">SF's site
168         documentation</ulink> for the technical access details for your
169         operating system. For historical reasons, the CVS server is
170         called <literal>cvs.ijbswa.sourceforge.net</literal>, the repository is
171         called <literal>ijbswa</literal>, and the source tree module is called
172         <literal>current</literal>.
173       </para>
174     </sect2>
175
176     <sect2 id="cvsbranches">
177     <title>Branches</title>
178      <para>
179        Within the CVS repository, there are modules and branches. As
180        mentioned, the sources are in the <literal>current</literal>
181        <quote>module</quote>. Other modules are present for platform specific
182        issues. There is a webview of the CVS hierarchy at <ulink
183        url="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ijbswa/">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ijbswa/</ulink>,
184        which might help with visualizing how these pieces fit together.
185      </para>
186      <para>
187        Branches are used to fork a sub-development path from the main trunk.
188        Within the <literal>current</literal> module where the sources are, there
189        is always at least one <quote>branch</quote> from the main trunk
190        devoted to a stable release series. The main trunk is where active
191        development takes place for the next stable series (e.g. 3.2.x).
192        So just prior to each stable series (e.g. 3.0.x), a branch is created
193        just for stable series releases (e.g. 3.0.0 -> 3.0.1 -> 3.0.2, etc).
194        Once the initial stable release of any stable branch has taken place,
195        this branch is <emphasis>only used for bugfixes</emphasis>, which have
196        had prior testing before being committed to CVS. (See <link
197        linkend="versionnumbers">Version Numbers</link> below for details on
198        versioning.)
199      </para>
200     </sect2>
201
202     <sect2 id="cvscommit"><title>CVS Commit Guidelines</title>
203       <para>
204         The source tree is the heart of every software project. Every effort must
205         be made to ensure that it is readable, compilable and consistent at all
206         times. There are differing guidelines for the stable branch and the
207         main development trunk, and we ask anyone with CVS access to strictly
208         adhere to the following guidelines:
209       </para>
210       
211       <para>
212        Basic Guidelines, for all branches:
213       </para>
214       <para>
215         <itemizedlist>
216           <listitem><para>
217             Never (read: <emphasis>never, ever</emphasis>) be tempted to commit
218             that small change without testing it thoroughly first. When we're
219             close to a public release, ask a fellow developer to review your 
220             changes.
221           </para></listitem>
222           <listitem><para>
223             Your commit message should give a concise overview of <emphasis>what you
224             changed</emphasis> (no big details) and <emphasis>why you changed it</emphasis>
225             Just check previous messages for good examples.
226           </para></listitem>
227           <listitem><para>
228             Don't use the same message on multiple files, unless it equally applies to
229             all those files.
230           </para></listitem>
231           <listitem><para>
232             If your changes span multiple files, and the code won't recompile unless
233             all changes are committed (e.g. when changing the signature of a function),
234             then commit all files one after another, without long delays in between.
235             If necessary, prepare the commit messages in advance.
236           </para></listitem>
237           <listitem><para>
238             Before changing things on CVS, make sure that your changes are in line
239             with the team's general consensus on what should be done.
240           </para></listitem>
241           <listitem>
242            <para>
243             Note that near a major public release, we get more cautious.
244             There is always the possibility to submit a patch to the <ulink
245             url="http://sourceforge.net/tracker/?atid=311118&amp;group_id=11118&amp;func=browse">patch
246             tracker</ulink> instead.
247           </para>
248          </listitem> 
249         </itemizedlist>
250       </para>
251       
252       <para>
253        Stable branches are handled with more care, especially after the 
254        initial *.*.0 release, and we are just in bugfix mode. In addition to 
255        the above, the below applies only to the stable branch (currently the 
256        v_3_0_branchpoint branch):
257       </para>
258       
259       <para>
260        <itemizedlist>
261         <listitem><para>
262           Do <emphasis>not commit anything</emphasis> into the stable branch,
263           unless immediately before a new release! There needs to be testing 
264           done before it hits CVS, and to ensure that all changes are
265           appropriate just to fix whatever the problem is.
266         </para></listitem>
267        <listitem>
268         <para>
269           Submit any proposed changes as patches first to the patch tracker on 
270           Sourceforge: <ulink url="http://sourceforge.net/tracker/?group_id=11118&#38;atid=311118">http://sourceforge.net/tracker/?group_id=11118&#38;atid=311118</ulink>.
271           Then ask for peer review.
272         </para>
273        </listitem> 
274         <listitem>
275          <para>
276            Do not commit <emphasis>anything</emphasis> unless your patches
277            been well tested first, by other members of the project, 
278            and has prior approval of the project leaders or consensus of the
279            devel list.
280          </para>
281         </listitem> 
282         <listitem>
283          <para>
284           Do not even think about anything except bugfixes. No new features!
285          </para>
286         </listitem> 
287      
288        </itemizedlist>
289       </para> 
290     </sect2>
291
292 <!--
293  This sounds vague, dated, and out of step with current development style.
294  Removing 09/03/02, HB.
295
296     <sect2 id="cvswhenask"><title>Discussing Changes First</title>
297       <para>
298         We don't have a formal policy for the development branch, just use
299         common sense. Hints: If it is.. 
300        <orderedlist numeration="arabic">
301           <listitem><para>
302             ..a bug-fix / clean-up / cosmetic thing: shoot
303           </para></listitem>
304           <listitem><para>
305             ..a new feature that can be turned off: shoot
306           </para></listitem>
307           <listitem><para>
308             ..a clear improvement w/o side effects on other parts of the code: shoot
309           </para></listitem>
310           <listitem><para>
311             ..a matter of taste: <ulink url="mailto:developers@privoxy.org">ask the list</ulink>
312           </para></listitem>
313           <listitem><para>
314             ..a major redesign of some part of the code: <ulink url="mailto:developers@privoxy.org">ask
315             the list</ulink>
316           </para></listitem>
317         </orderedlist>
318       </para>
319       <para>
320         Note that near a major public release, we get a bit more cautious - if
321         unsure, it doesn't hurt to ask first. There is always the possibility
322         to submit a patch to the <ulink
323         url="http://sourceforge.net/tracker/?atid=311118&amp;group_id=11118&amp;func=browse">patches
324         tracker</ulink> instead.
325       </para>
326     </sect2>
327    --> 
328   </sect1>
329         
330   <!--   ~~~~~       New section      ~~~~~     -->
331 <sect1 id="documentation"><title>Documentation Guidelines</title>
332   <para>
333     All formal documents are maintained in Docbook SGML and located in the
334     <computeroutput>doc/source/*</computeroutput> directory. You will need
335     <ulink url="http://www.docbook.org">Docbook</ulink>, the Docbook 
336     DTD's and the Docbook modular stylesheets (or comparable alternatives),
337     and either <application>jade</application> or
338     <application>openjade</application> (recommended) installed in order to
339     build docs from source. Currently there is <ulink
340     url="../user-manual/index.html"><citetitle>user-manual</citetitle></ulink>,
341     <ulink url="../faq/index.html"><citetitle>FAQ</citetitle></ulink>, and, of
342     course this, the <citetitle>developer-manual</citetitle> in this format.
343     The <citetitle>README</citetitle>, <citetitle>AUTHORS</citetitle>
344     <citetitle>privoxy.1</citetitle> (man page), and
345     <citetitle>config</citetitle> files are also now maintained as Docbook
346     SGML. These files, when built, in the top-level source directory are
347     generated files! Also, the <application>Privoxy</application> <filename>index.html</filename> (and a 
348     variation on this file, <filename>privoxy-index.html</filename>, 
349     meant for inclusion with doc packages), are maintained as SGML as well.
350     <emphasis>DO NOT edit these directly</emphasis>. Edit the SGML source, or
351     contact someone involved in the documentation (at present Hal).
352     </para> 
353     <para>
354      <filename>config</filename> requires some special handling. The reason it
355      is maintained this way is so that the extensive comments in the file
356      mirror those in <citetitle>user-manual</citetitle>. But the conversion 
357      process requires going from SGML to HTML to text to special formatting 
358      required for the embedded comments. Some of this does not survive so
359      well. Especially some of the examples that are longer than 80 characters.
360      The build process for this file outputs to <filename>config.new</filename>, 
361      which should be reviewed for errors and mis-formatting. Once satisfied
362      that it is correct, then it should be hand copied to
363      <filename>config</filename>.
364     </para>
365     <para>
366      Other, less formal documents (e.g. <filename>LICENSE</filename>,
367      <filename>INSTALL</filename>) are maintained as plain text files in the
368      top-level source directory. At least for the time being.
369     </para>
370     <para>
371      Packagers are encouraged to include this documentation. For those without
372      the ability to build the docs locally, text versions of each are kept in
373      CVS. HTML versions are also now being kept in CVS under 
374      <filename>doc/webserver/*</filename>.
375     </para>
376     <para>
377      Formal documents are built with the Makefile targets of
378      <computeroutput>make dok</computeroutput>, or alternately
379      <computeroutput>make redhat-dok</computeroutput>. If you have problems,
380      try both. The build process uses the document SGML sources in
381      <computeroutput>doc/source/*/*</computeroutput> to update all text files in
382      <computeroutput>doc/text/</computeroutput> and to update all HTML
383      documents in <computeroutput>doc/webserver/</computeroutput>.
384     </para>
385     <para>
386      Documentation writers should please make sure documents build
387      successfully before committing to CVS, if possible.
388     </para>
389     <para>
390      How do you update the webserver (i.e. the pages on privoxy.org)?
391      
392      <orderedlist numeration="arabic">
393       <listitem><para>
394         First, build the docs by running <computeroutput>make
395         dok</computeroutput> (or alternately <computeroutput>make
396         redhat-dok</computeroutput>). For PDF docs, do <computeroutput>make
397         dok-pdf</computeroutput>.
398       </para></listitem>
399       <listitem><para>
400         Run <computeroutput>make webserver</computeroutput> which copies all
401         files from <computeroutput>doc/webserver</computeroutput> to the
402         sourceforge webserver via scp.
403       </para></listitem>
404      </orderedlist>
405   </para>
406
407   <para>
408    Finished docs should be occasionally submitted to CVS
409    (<filename>doc/webserver/*/*.html</filename>) so that those without 
410    the ability to build them locally, have access to them if needed.
411    This is especially important just prior to a new release! Please
412    do this <emphasis>after</emphasis> the <literal>$VERSION</literal> and
413    other release specific data in <filename>configure.in</filename> has been
414    updated (this is done just prior to a new release).
415   </para>
416
417 <!--   ~~~~~       New section      ~~~~~     -->
418 <sect2 id="sgml">
419 <title>Quickstart to Docbook and SGML</title>
420 <para>
421  If you are not familiar with SGML, it is a markup language similar to HTML. 
422  Actually, not a mark up language per se, but a language used to define 
423  markup languages. In fact, HTML is an SGML application. Both will use
424  <quote>tags</quote> to format text and other content. SGML tags can be much
425  more varied, and flexible, but do much of the same kinds of things. The tags,
426  or <quote>elements</quote>, are definable in SGML. There is no set
427  <quote>standards</quote>. Since we are using
428  <application>Docbook</application>, our tags are those that are defined by 
429  <application>Docbook</application>. Much of how the finish document is
430  rendered is determined by the <quote>stylesheets</quote>.
431  The stylesheets determine how each tag gets translated to HTML, or other
432  formats.
433 </para>
434
435 <para>
436  Tags in Docbook SGML need to be always <quote>closed</quote>. If not, you
437  will likely generate errors. Example: <literal>&lt;title&gt;My
438  Title&lt;/title&gt;</literal>. They are also case-insensitive, but we
439  strongly suggest using all lower case. This keeps compatibility with
440  [Docbook] <application>XML</application>.
441 </para>
442
443 <para>
444  Our documents use <quote>sections</quote> for the most part. Sections
445  will be processed into HTML headers (e.g. <literal>h1</literal> for 
446  <literal>sect1</literal>). The <application>Docbook</application> stylesheets
447  will use these to also generate the Table of Contents for each doc. Our 
448  TOC's are set to a depth of three. Meaning <literal>sect1</literal>, 
449  <literal>sect2</literal>, and <literal>sect3</literal> will have TOC 
450  entries, but <literal>sect4</literal> will not. Each section requires 
451  a <literal>&lt;title&gt;</literal> element, and at least one 
452  <literal>&lt;para&gt;</literal>. There is a limit of five section 
453  levels in Docbook, but generally three should be sufficient for our 
454  purposes.
455 </para>
456
457 <para>
458  Some common elements that you likely will use: 
459 </para>
460
461 <para>
462   <simplelist>
463     <member>
464       <emphasis>&lt;para&gt;&lt;/para&gt;</emphasis>, paragraph delimiter. Most 
465       text needs to be within paragraph elements (there are some exceptions).
466     </member>
467     <member>
468       <emphasis>&lt;emphasis&gt;&lt;/emphasis&gt;</emphasis>, the stylesheets
469       make this italics.
470     </member>
471     <member>
472       <emphasis>&lt;filename&gt;&lt;/filename&gt;</emphasis>, files and directories.
473     </member>
474     <member>
475       <emphasis>&lt;command&gt;&lt;/command&gt;</emphasis>, command examples.
476     </member>
477     <member>
478       <emphasis>&lt;literallayout&gt;&lt;/literallayout&gt;</emphasis>, like 
479       <literal>&lt;pre&gt;</literal>, more or less.
480     </member>
481     <member>
482       <emphasis>&lt;itemizedlist&gt;&lt;/itemizedlist&gt;</emphasis>, list with bullets.
483     </member>
484     <member>
485       <emphasis>&lt;listitem&gt;&lt;/listitem&gt;</emphasis>, member of the above.
486     </member>
487     <member>
488       <emphasis>&lt;screen&gt;&lt;/screen&gt;</emphasis>, screen output, implies 
489       <literal>&lt;literallayout&gt;</literal>.
490     </member>
491     <member>
492       <emphasis>&lt;ulink url="example.com"&gt;&lt;/ulink&gt;</emphasis>, like 
493       HTML <literal>&lt;a&gt;</literal> tag.
494     </member>
495     <member>
496       <emphasis>&lt;quote&gt;&lt;/quote&gt;</emphasis>, for, doh, quoting text. 
497     </member>
498   </simplelist>
499 </para>
500
501 <para>
502  Look at any of the existing docs for examples of all these and more.
503 </para>
504
505 <para>
506  You might also find <quote><ulink
507  url="http://www.bureau-cornavin.com/opensource/crash-course/">Writing Documentation
508  Using DocBook - A Crash Course</ulink></quote> useful.
509 </para>
510 </sect2>
511
512 <!--   ~~~~~       New section      ~~~~~     -->
513   <sect2 id="docstyle">
514   <title><application>Privoxy</application> Documentation Style</title>
515    <para>
516     It will be easier if everyone follows a similar writing style. This 
517     just makes it easier to read what someone else has written if it 
518     is all done in a similar fashion.
519    </para>
520    <para>
521     Here it is:
522    </para>
523    <para>
524     <itemizedlist>
525      <listitem>
526       <para>
527        All tags should be lower case.
528       </para>
529     </listitem> 
530     <listitem>
531      <para>
532        Tags delimiting a <emphasis>block</emphasis> of text (even small
533        blocks) should be on their own line. Like:
534        <literallayout>
535  &lt;para&gt;
536   Some text goes here.
537  &lt;/para&gt;
538        </literallayout>
539        Tags marking individual words, or few words, should be in-line:
540        <literallayout>
541   Just to &lt;emphasis&gt;emphasize&lt;/emphasis&gt;, some text goes here.
542        </literallayout>
543      </para>
544    </listitem> 
545    <listitem>
546     <para>
547       Tags should be nested and step indented for block text like: (except
548       in-line tags) 
549      <literallayout>
550  &lt;para&gt;
551   &lt;itemizedlist&gt;
552    &lt;para&gt;
553     &lt;listitem&gt;
554       Some text goes here in our list example.
555      &lt;/listitem&gt;
556    &lt;/para&gt;
557   &lt;/itemizedlist&gt;
558  &lt;/para&gt;
559        </literallayout>
560       This makes it easier to find the text amongst the tags ;-)
561     </para>
562    </listitem> 
563    <listitem>
564     <para>
565      Use white space to separate logical divisions within a document, 
566      like between sections. Running everything together consistently 
567      makes it harder to read and work on.
568     </para>
569    </listitem> 
570    <listitem>
571     <para>
572      Do not hesitate to make comments. Comments can either use the 
573      &lt;comment&gt; element, or the &lt;!--  --&gt; style comment 
574      familiar from HTML. (Note in Docbook v4.x &lt;comment&gt; is 
575      replaced by &lt;remark&gt;.)
576     </para>
577   </listitem> 
578   <listitem>
579    <para>
580      We have an international audience. Refrain from slang, or English 
581      idiosyncrasies (too many to list :). Humor also does not translate 
582      well sometimes.
583    </para>
584   </listitem> 
585   <listitem>
586    <para>
587     Try to keep overall line lengths in source files to 80 characters or less
588     for obvious reasons. This is not always possible, with lengthy URLs for
589     instance.
590    </para>
591   </listitem> 
592   <listitem>
593    <para>
594     Our documents are available in differing formats. Right now, they 
595     are just plain text, TML, and PDF, but others are always a 
596     future possibility. Be careful with URLs (&lt;ulink&gt;), and avoid 
597     this mistake:
598    </para>
599    <para>
600      My favorite site is &lt;ulink url="http://example.com"&gt;here&lt;/ulink&gt;.
601    </para>
602    <para>
603      This will render as <quote>My favorite site is here</quote>, which is 
604      not real helpful in a text doc. Better like this:
605    </para>
606    <para>
607      My favorite site is &lt;ulink url="http://example.com"&gt;example.com&lt;/ulink&gt;.
608    </para>
609   </listitem>
610   <listitem>
611    <para>
612     All documents should be spell checked occasionally.
613     <application>aspell</application> can check SGML with the
614     <literal>-H</literal> option. (<application>ispell</application> I think
615     too.)
616    </para>
617   </listitem> 
618
619   </itemizedlist>
620  </para> 
621   
622   </sect2>
623
624   
625  <!--   ~~~~~       New section      ~~~~~     -->
626
627  <sect2><title>Privoxy Custom Entities</title>
628  <para>
629   <application>Privoxy</application> documentation is using 
630   a number of customized <quote>entities</quote> to facilitate 
631   documentation maintenance. 
632  </para>
633  <para>
634   We are using a set of <quote>boilerplate</quote> files with generic text,
635   that is used by multiple docs. This way we can write something once, and use
636   it repeatedly without having to re-write the same content over and over again.
637   If editing such a file, keep in mind that it should be
638   <emphasis>generic</emphasis>. That is the purpose; so it can be used in varying 
639   contexts without additional modifications.
640  </para>
641  <para>
642   We are also using what <application>Docbook</application> calls 
643   <quote>internal entities</quote>. These are like variables in 
644   programming. Well, sort of. For instance, we have the
645   <literal>p-version</literal> entity that contains the current 
646   <application>Privoxy</application> version string. You are strongly 
647   encouraged to use these where possible. Some of these obviously 
648   require re-setting with each release (done by the Makefile). A sampling of
649   custom entities are listed below. See any of the main docs for examples.
650  </para>
651
652  <para>
653   <itemizedlist>
654   <listitem>
655    <para>
656     Re- <quote>boilerplate</quote> text entities are defined like:
657    </para>
658    <para>
659     <literal>&lt;!entity supported SYSTEM "supported.sgml"&gt;</literal>
660    </para>
661    <para>
662      In this example, the contents of the file,
663      <filename>supported.sgml</filename> is available for inclusion anywhere 
664      in the doc. To make this happen, just reference the now defined 
665      entity: <literal>&#38;supported;</literal> (starts with an ampersand 
666      and ends with a semi-colon), and the contents will be dumped into 
667      the finished doc at that point.
668    </para>
669   </listitem> 
670   <listitem>
671    <para>
672     Commonly used <quote>internal entities</quote>:
673   </para>
674   <simplelist>
675    <member>
676     <emphasis>p-version</emphasis>: the <application>Privoxy</application> 
677     version string, e.g. <quote>&p-version;</quote>.
678    </member>
679    <member>
680     <emphasis>p-status</emphasis>: the project status, either 
681     <quote>alpha</quote>, <quote>beta</quote>, or <quote>stable</quote>.
682    </member>
683    <member>
684     <emphasis>p-not-stable</emphasis>: use to conditionally include 
685     text in <quote>not stable</quote> releases (e.g. <quote>beta</quote>).
686    </member>
687    <member>
688     <emphasis>p-stable</emphasis>: just the opposite.
689    </member>
690    <member>
691     <emphasis>p-text</emphasis>: this doc is only generated as text.
692    </member>
693   </simplelist>
694  </listitem> 
695  </itemizedlist>
696  </para> 
697  <para>
698   There are others in various places that are defined for a specific 
699   purpose. Read the source!
700  </para>
701  
702  </sect2>
703   
704  </sect1>
705
706 <!--     <listitem><para>be consistent with the redirect script (i.e. the <application>Privoxy</application> program -->
707 <!--       points via the redirect URL at sf to valid end-points in the document)</para></listitem> -->
708
709   <!--   ~~~~~       New section      ~~~~~     -->
710   <sect1 id="coding"><title>Coding Guidelines</title>
711
712     <sect2 id="s1"><title>Introduction</title>
713
714     <para>This set of standards is designed to make our lives easier.  It is
715     developed with the simple goal of helping us keep the "new and improved
716     <application>Privoxy</application>" consistent and reliable. Thus making
717     maintenance easier and increasing chances of success of the
718     project.</para>
719
720     <para>And that of course comes back to us as individuals. If we can
721     increase our development and product efficiencies then we can solve more
722     of the request for changes/improvements and in general feel good about
723     ourselves. ;-></para>
724
725   </sect2>
726
727     <sect2 id="s2"><title>Using Comments</title>
728  
729
730     <sect3 id="s3"><title>Comment, Comment, Comment</title>
731
732     <para><emphasis>Explanation:</emphasis></para>
733
734     <para>Comment as much as possible without commenting the obvious.
735     For example do not comment "aVariable is equal to bVariable".
736     Instead explain why aVariable should be equal to the bVariable.
737     Just because a person can read code does not mean they will
738     understand why or what is being done. A reader may spend a lot
739     more time figuring out what is going on when a simple comment
740     or explanation would have prevented the extra research. Please
741     help your brother IJB'ers out!</para>
742
743     <para>The comments will also help justify the intent of the code.
744     If the comment describes something different than what the code
745     is doing then maybe a programming error is occurring.</para>
746
747     <para><emphasis>Example:</emphasis></para>
748 <programlisting>
749 /* if page size greater than 1k ... */
750 if ( PageLength() > 1024 )
751 {
752     ... "block" the page up ...
753 }
754
755 /* if page size is small, send it in blocks */
756 if ( PageLength() > 1024 )
757 {
758     ... "block" the page up ...
759 }
760
761 This demonstrates 2 cases of "what not to do".  The first is a
762 "syntax comment".  The second is a comment that does not fit what
763 is actually being done.
764 </programlisting>
765   </sect3>
766
767     
768
769     <sect3 id="s4"><title>Use blocks for comments</title>
770
771     <para><emphasis>Explanation:</emphasis></para>
772
773     <para>Comments can help or they can clutter. They help when they
774     are differentiated from the code they describe. One line
775     comments do not offer effective separation between the comment
776     and the code. Block identifiers do, by surrounding the code
777     with a clear, definable pattern.</para>
778
779     <para><emphasis>Example:</emphasis></para>
780 <programlisting>
781 /*********************************************************************
782  * This will stand out clearly in your code!
783  *********************************************************************/
784 if ( thisVariable == thatVariable )
785 {
786    DoSomethingVeryImportant();
787 }
788
789
790 /* unfortunately, this may not */
791 if ( thisVariable == thatVariable )
792 {
793    DoSomethingVeryImportant();
794 }
795
796
797 if ( thisVariable == thatVariable ) /* this may not either */
798 {
799    DoSomethingVeryImportant();
800 }</programlisting>
801
802     <para><emphasis>Exception:</emphasis></para>
803
804     <para>If you are trying to add a small logic comment and do not
805     wish to "disrupt" the flow of the code, feel free to use a 1
806     line comment which is NOT on the same line as the code.</para>
807
808     
809   </sect3>
810     
811
812     <sect3 id="s5"><title>Keep Comments on their own line</title>
813
814     <para><emphasis>Explanation:</emphasis></para>
815
816     <para>It goes back to the question of readability. If the comment
817     is on the same line as the code it will be harder to read than
818     the comment that is on its own line.</para>
819
820     <para>There are three exceptions to this rule, which should be
821     violated freely and often: during the definition of variables,
822     at the end of closing braces, when used to comment
823     parameters.</para>
824
825     <para><emphasis>Example:</emphasis></para>
826 <programlisting>
827 /*********************************************************************
828  * This will stand out clearly in your code,
829  * But the second example won't.
830  *********************************************************************/
831 if ( thisVariable == thatVariable )
832 {
833    DoSomethingVeryImportant();
834 }
835
836 if ( thisVariable == thatVariable ) /*can you see me?*/
837 {
838    DoSomethingVeryImportant(); /*not easily*/
839 }
840
841
842 /*********************************************************************
843  * But, the encouraged exceptions:
844  *********************************************************************/
845 int urls_read     = 0;     /* # of urls read + rejected */
846 int urls_rejected = 0;     /* # of urls rejected */
847
848 if ( 1 == X )
849 {
850    DoSomethingVeryImportant();
851 }
852
853
854 short DoSomethingVeryImportant(
855    short firstparam,   /* represents something */
856    short nextparam     /* represents something else */ )
857 {
858    ...code here...
859
860 }   /* -END- DoSomethingVeryImportant */
861 </programlisting>
862   </sect3>
863     
864
865     <sect3 id="s6"><title>Comment each logical step</title>
866
867     <para><emphasis>Explanation:</emphasis></para>
868
869     <para>Logical steps should be commented to help others follow the
870     intent of the written code and comments will make the code more
871     readable.</para>
872
873     <para>If you have 25 lines of code without a comment, you should
874     probably go back into it to see where you forgot to put
875     one.</para>
876
877     <para>Most "for", "while", "do", etc... loops _probably_ need a
878     comment. After all, these are usually major logic
879     containers.</para>
880
881     
882   </sect3>
883     
884
885     <sect3 id="s7"><title>Comment All Functions Thoroughly</title>
886
887     <para><emphasis>Explanation:</emphasis></para>
888
889     <para>A reader of the code should be able to look at the comments
890     just prior to the beginning of a function and discern the
891     reason for its existence and the consequences of using it. The
892     reader should not have to read through the code to determine if
893     a given function is safe for a desired use. The proper
894     information thoroughly presented at the introduction of a
895     function not only saves time for subsequent maintenance or
896     debugging, it more importantly aids in code reuse by allowing a
897     user to determine the safety and applicability of any function
898     for the problem at hand. As a result of such benefits, all
899     functions should contain the information presented in the
900     addendum section of this document.</para>
901
902     
903   </sect3>
904     
905
906     <sect3 id="s8"><title>Comment at the end of braces if the
907     content is more than one screen length</title>
908
909     <para><emphasis>Explanation:</emphasis></para>
910
911     <para>Each closing brace should be followed on the same line by a
912     comment that describes the origination of the brace if the
913     original brace is off of the screen, or otherwise far away from
914     the closing brace. This will simplify the debugging,
915     maintenance, and readability of the code.</para>
916
917     <para>As a suggestion , use the following flags to make the
918     comment and its brace more readable:</para>
919
920     <para>use following a closing brace: } /* -END- if() or while ()
921     or etc... */</para>
922
923     <para><emphasis>Example:</emphasis></para>
924 <programlisting>
925 if ( 1 == X )
926 {
927    DoSomethingVeryImportant();
928    ...some long list of commands...
929 } /* -END- if x is 1 */
930
931 or:
932
933 if ( 1 == X )
934 {
935    DoSomethingVeryImportant();
936    ...some long list of commands...
937 } /* -END- if ( 1 == X ) */
938 </programlisting>
939   </sect3>
940     
941   </sect2>
942
943     <sect2 id="s9"><title>Naming Conventions</title>
944
945     
946
947     <sect3 id="s10"><title>Variable Names</title>
948
949     <para><emphasis>Explanation:</emphasis></para>
950
951     <para>Use all lowercase, and separate words via an underscore
952     ('_'). Do not start an identifier with an underscore. (ANSI C
953     reserves these for use by the compiler and system headers.) Do
954     not use identifiers which are reserved in ANSI C++. (E.g.
955     template, class, true, false, ...). This is in case we ever
956     decide to port Privoxy to C++.</para>
957
958     <para><emphasis>Example:</emphasis></para>
959 <programlisting>
960 int ms_iis5_hack = 0;</programlisting>
961
962     <para><emphasis>Instead of:</emphasis></para>
963
964     <para>
965 <programlisting>
966 int msiis5hack = 0; int msIis5Hack = 0;
967 </programlisting>
968 </para>
969
970     
971
972   </sect3>    
973
974     <sect3 id="s11"><title>Function Names</title>
975
976     <para><emphasis>Explanation:</emphasis></para>
977
978     <para>Use all lowercase, and separate words via an underscore
979     ('_'). Do not start an identifier with an underscore. (ANSI C
980     reserves these for use by the compiler and system headers.) Do
981     not use identifiers which are reserved in ANSI C++. (E.g.
982     template, class, true, false, ...). This is in case we ever
983     decide to port Privoxy to C++.</para>
984
985     <para><emphasis>Example:</emphasis></para>
986 <programlisting>
987 int load_some_file( struct client_state *csp )</programlisting>
988
989     <para><emphasis>Instead of:</emphasis></para>
990
991     <para>
992 <programlisting>
993 int loadsomefile( struct client_state *csp )
994 int loadSomeFile( struct client_state *csp )
995 </programlisting>
996 </para>
997
998     
999   </sect3>
1000     
1001
1002     <sect3 id="s12"><title>Header file prototypes</title>
1003
1004     <para><emphasis>Explanation:</emphasis></para>
1005
1006     <para>Use a descriptive parameter name in the function prototype
1007     in header files. Use the same parameter name in the header file
1008     that you use in the c file.</para>
1009
1010     <para><emphasis>Example:</emphasis></para>
1011 <programlisting>
1012 (.h) extern int load_aclfile( struct client_state *csp );
1013 (.c) int load_aclfile( struct client_state *csp )</programlisting>
1014
1015     <para><emphasis>Instead of:</emphasis>
1016 <programlisting>
1017 (.h) extern int load_aclfile( struct client_state * ); or 
1018 (.h) extern int load_aclfile(); 
1019 (.c) int load_aclfile( struct client_state *csp )
1020 </programlisting>
1021 </para>
1022
1023     
1024   </sect3>
1025     
1026
1027     <sect3 id="s13"><title>Enumerations, and #defines</title>
1028
1029     <para><emphasis>Explanation:</emphasis></para>
1030
1031     <para>Use all capital letters, with underscores between words. Do
1032     not start an identifier with an underscore. (ANSI C reserves
1033     these for use by the compiler and system headers.)</para>
1034
1035     <para><emphasis>Example:</emphasis></para>
1036 <programlisting>
1037 (enumeration) : enum Boolean { FALSE, TRUE };
1038 (#define) : #define DEFAULT_SIZE 100;</programlisting>
1039
1040     <para><emphasis>Note:</emphasis> We have a standard naming scheme for #defines
1041     that toggle a feature in the preprocessor: FEATURE_>, where
1042     > is a short (preferably 1 or 2 word) description.</para>
1043
1044     <para><emphasis>Example:</emphasis></para>
1045 <programlisting>
1046 #define FEATURE_FORCE 1
1047
1048 #ifdef FEATURE_FORCE
1049 #define FORCE_PREFIX blah
1050 #endif /* def FEATURE_FORCE */
1051 </programlisting>
1052   </sect3>
1053     
1054
1055     <sect3 id="s14"><title>Constants</title>
1056
1057     <para><emphasis>Explanation:</emphasis></para>
1058
1059     <para>Spell common words out entirely (do not remove vowels).</para>
1060
1061     <para>Use only widely-known domain acronyms and abbreviations.
1062     Capitalize all letters of an acronym.</para>
1063
1064     <para>Use underscore (_) to separate adjacent acronyms and
1065     abbreviations. Never terminate a name with an underscore.</para>
1066
1067     <para><emphasis>Example:</emphasis></para>
1068 <programlisting>
1069 #define USE_IMAGE_LIST 1</programlisting>
1070
1071     <para><emphasis>Instead of:</emphasis></para>
1072
1073     <para>
1074 <programlisting>
1075 #define USE_IMG_LST 1 or 
1076 #define _USE_IMAGE_LIST 1 or
1077 #define USE_IMAGE_LIST_ 1 or 
1078 #define use_image_list 1 or
1079 #define UseImageList 1
1080 </programlisting>
1081 </para>
1082
1083     
1084   </sect3>
1085
1086   </sect2>
1087     
1088
1089     <sect2 id="s15"><title>Using Space</title>
1090
1091     
1092
1093     <sect3 id="s16"><title>Put braces on a line by themselves.</title>
1094
1095     <para><emphasis>Explanation:</emphasis></para>
1096
1097     <para>The brace needs to be on a line all by itself, not at the
1098     end of the statement. Curly braces should line up with the
1099     construct that they're associated with. This practice makes it
1100     easier to identify the opening and closing braces for a
1101     block.</para>
1102
1103     <para><emphasis>Example:</emphasis></para>
1104 <programlisting>
1105 if ( this == that )
1106 {
1107    ...
1108 }</programlisting>
1109
1110     <para><emphasis>Instead of:</emphasis></para>
1111
1112     <para>if ( this == that ) { ... }</para>
1113
1114     <para>or</para>
1115
1116     <para>if ( this == that ) { ... }</para>
1117
1118     <para><emphasis>Note:</emphasis> In the special case that the if-statement is
1119     inside a loop, and it is trivial, i.e. it tests for a
1120     condition that is obvious from the purpose of the block,
1121     one-liners as above may optically preserve the loop structure
1122     and make it easier to read.</para>
1123
1124     <para><emphasis>Status:</emphasis> developer-discretion.</para>
1125
1126     <para><emphasis>Example exception:</emphasis></para>
1127 <programlisting>
1128 while ( more lines are read )
1129 {
1130    /* Please document what is/is not a comment line here */
1131    if ( it's a comment ) continue;
1132
1133    do_something( line );
1134 }
1135 </programlisting>
1136   </sect3>
1137     
1138
1139     <sect3 id="s17"><title>ALL control statements should have a
1140     block</title>
1141
1142     <para><emphasis>Explanation:</emphasis></para>
1143
1144     <para>Using braces to make a block will make your code more
1145     readable and less prone to error. All control statements should
1146     have a block defined.</para>
1147
1148     <para><emphasis>Example:</emphasis></para>
1149 <programlisting>
1150 if ( this == that )
1151 {
1152    DoSomething();
1153    DoSomethingElse();
1154 }</programlisting>
1155
1156     <para><emphasis>Instead of:</emphasis></para>
1157
1158     <para>if ( this == that ) DoSomething(); DoSomethingElse();</para>
1159
1160     <para>or</para>
1161
1162     <para>if ( this == that ) DoSomething();</para>
1163
1164     <para><emphasis>Note:</emphasis> The first example in "Instead of" will execute
1165     in a manner other than that which the developer desired (per
1166     indentation). Using code braces would have prevented this
1167     "feature". The "explanation" and "exception" from the point
1168     above also applies.</para>
1169
1170     
1171   </sect3>
1172     
1173
1174     <sect3 id="s18"><title>Do not belabor/blow-up boolean
1175     expressions</title>
1176
1177     <para><emphasis>Example:</emphasis></para>
1178 <programlisting>
1179 structure->flag = ( condition );</programlisting>
1180
1181     <para><emphasis>Instead of:</emphasis></para>
1182
1183     <para>if ( condition ) { structure->flag = 1; } else {
1184     structure->flag = 0; }</para>
1185
1186     <para><emphasis>Note:</emphasis> The former is readable and concise. The later
1187     is wordy and inefficient. Please assume that any developer new
1188     to the project has at least a "good" knowledge of C/C++. (Hope
1189     I do not offend by that last comment ... 8-)</para>
1190
1191     
1192   </sect3>
1193     
1194
1195     <sect3 id="s19"><title>Use white space freely because it is
1196     free</title>
1197
1198     <para><emphasis>Explanation:</emphasis></para>
1199
1200     <para>Make it readable. The notable exception to using white space
1201     freely is listed in the next guideline.</para>
1202
1203     <para><emphasis>Example:</emphasis></para>
1204 <programlisting>
1205 int firstValue   = 0;
1206 int someValue    = 0;
1207 int anotherValue = 0;
1208 int thisVariable = 0;
1209
1210 if ( thisVariable == thatVariable )
1211
1212 firstValue = oldValue + ( ( someValue - anotherValue ) - whatever )
1213 </programlisting>
1214   </sect3>
1215     
1216
1217     <sect3 id="s20"><title>Don't use white space around structure
1218     operators</title>
1219
1220     <para><emphasis>Explanation:</emphasis></para>
1221
1222     <para>- structure pointer operator ( "->" ) - member operator (
1223     "." ) - functions and parentheses</para>
1224
1225     <para>It is a general coding practice to put pointers, references,
1226     and function parentheses next to names. With spaces, the
1227     connection between the object and variable/function name is not
1228     as clear.</para>
1229
1230     <para><emphasis>Example:</emphasis></para>
1231 <programlisting>
1232 aStruct->aMember;
1233 aStruct.aMember;
1234 FunctionName();</programlisting>
1235
1236     <para><emphasis>Instead of:</emphasis> aStruct -> aMember; aStruct . aMember;
1237     FunctionName ();</para>
1238
1239     
1240   </sect3>
1241     
1242
1243     <sect3 id="s21"><title>Make the last brace of a function stand
1244     out</title>
1245
1246     <para><emphasis>Example:</emphasis></para>
1247 <programlisting>
1248 int function1( ... )
1249 {
1250    ...code...
1251    return( retCode );
1252
1253 }   /* -END- function1 */
1254
1255
1256 int function2( ... )
1257 {
1258 }   /* -END- function2 */
1259 </programlisting>
1260
1261     <para><emphasis>Instead of:</emphasis></para>
1262
1263     <para>int function1( ... ) { ...code... return( retCode ); } int
1264     function2( ... ) { }</para>
1265
1266     <para><emphasis>Note:</emphasis> Use 1 blank line before the closing brace and 2
1267     lines afterward. This makes the end of function standout to
1268     the most casual viewer. Although function comments help
1269     separate functions, this is still a good coding practice. In
1270     fact, I follow these rules when using blocks in "for", "while",
1271     "do" loops, and long if {} statements too. After all whitespace
1272     is free!</para>
1273
1274     <para><emphasis>Status:</emphasis> developer-discretion on the number of blank
1275     lines. Enforced is the end of function comments.</para>
1276
1277     
1278   </sect3>
1279     
1280
1281     <sect3 id="s22"><title>Use 3 character indentions</title>
1282
1283     <para><emphasis>Explanation:</emphasis></para>
1284
1285     <para>If some use 8 character TABs and some use 3 character TABs,
1286     the code can look *very* ragged. So use 3 character indentions
1287     only. If you like to use TABs, pass your code through a filter
1288     such as "expand -t3" before checking in your code.</para>
1289
1290     <para><emphasis>Example:</emphasis></para>
1291 <programlisting>
1292 static const char * const url_code_map[256] =
1293 {
1294    NULL, ...
1295 };
1296
1297
1298 int function1( ... )
1299 {
1300    if ( 1 )
1301    {
1302       return( ALWAYS_TRUE );
1303    }
1304    else
1305    {
1306       return( HOW_DID_YOU_GET_HERE );
1307    }
1308
1309    return( NEVER_GETS_HERE );
1310
1311 }
1312 </programlisting>
1313   </sect3>
1314
1315   </sect2>
1316     
1317
1318     <sect2 id="s23"><title>Initializing</title>
1319
1320     
1321
1322     <sect3 id="s24"><title>Initialize all variables</title>
1323
1324     <para><emphasis>Explanation:</emphasis></para>
1325
1326     <para>Do not assume that the variables declared will not be used
1327     until after they have been assigned a value somewhere else in
1328     the code. Remove the chance of accidentally using an unassigned
1329     variable.</para>
1330
1331     <para><emphasis>Example:</emphasis></para>
1332 <programlisting>
1333 short anShort = 0;
1334 float aFloat  = 0;
1335 struct *ptr = NULL;</programlisting>
1336
1337     <para><emphasis>Note:</emphasis> It is much easier to debug a SIGSEGV if the
1338     message says you are trying to access memory address 00000000
1339     and not 129FA012; or arrayPtr[20] causes a SIGSEV vs.
1340     arrayPtr[0].</para>
1341
1342     <para><emphasis>Status:</emphasis> developer-discretion if and only if the
1343     variable is assigned a value "shortly after" declaration.</para>
1344
1345   </sect3>
1346   </sect2>
1347     
1348
1349     <sect2 id="s25"><title>Functions</title>
1350
1351     
1352
1353     <sect3 id="s26"><title>Name functions that return a boolean as a
1354     question.</title>
1355
1356     <para><emphasis>Explanation:</emphasis></para>
1357
1358     <para>Value should be phrased as a question that would logically
1359     be answered as a true or false statement</para>
1360
1361     <para><emphasis>Example:</emphasis></para>
1362 <programlisting>
1363 ShouldWeBlockThis();
1364 ContainsAnImage();
1365 IsWebPageBlank();
1366 </programlisting>
1367   </sect3>
1368     
1369
1370     <sect3 id="s27"><title>Always specify a return type for a
1371     function.</title>
1372
1373     <para><emphasis>Explanation:</emphasis></para>
1374
1375     <para>The default return for a function is an int. To avoid
1376     ambiguity, create a return for a function when the return has a
1377     purpose, and create a void return type if the function does not
1378     need to return anything.</para>
1379
1380     
1381   </sect3>
1382     
1383
1384     <sect3 id="s28"><title>Minimize function calls when iterating by
1385     using variables</title>
1386
1387     <para><emphasis>Explanation:</emphasis></para>
1388
1389     <para>It is easy to write the following code, and a clear argument
1390     can be made that the code is easy to understand:</para>
1391
1392     <para><emphasis>Example:</emphasis></para>
1393 <programlisting>
1394 for ( size_t cnt = 0; cnt &lt; blockListLength(); cnt ++ )
1395 {
1396    ....
1397 }</programlisting>
1398
1399     <para><emphasis>Note:</emphasis> Unfortunately, this makes a function call for
1400     each and every iteration. This increases the overhead in the
1401     program, because the compiler has to look up the function each
1402     time, call it, and return a value. Depending on what occurs in
1403     the blockListLength() call, it might even be creating and
1404     destroying structures with each iteration, even though in each
1405     case it is comparing "cnt" to the same value, over and over.
1406     Remember too - even a call to blockListLength() is a function
1407     call, with the same overhead.</para>
1408
1409     <para>Instead of using a function call during the iterations,
1410     assign the value to a variable, and evaluate using the
1411     variable.</para>
1412
1413     <para><emphasis>Example:</emphasis></para>
1414 <programlisting>
1415 size_t len = blockListLength();
1416
1417 for ( size_t cnt = 0; cnt &lt; len; cnt ++ )
1418 {
1419    ....
1420 }</programlisting>
1421
1422     <para><emphasis>Exceptions:</emphasis> if the value of blockListLength() *may*
1423     change or could *potentially* change, then you must code the
1424     function call in the for/while loop.</para>
1425
1426     
1427   </sect3>
1428     
1429
1430     <sect3 id="s29"><title>Pass and Return by Const Reference</title>
1431
1432     <para><emphasis>Explanation:</emphasis></para>
1433
1434     <para>This allows a developer to define a const pointer and call
1435     your function. If your function does not have the const
1436     keyword, we may not be able to use your function. Consider
1437     strcmp, if it were defined as: extern int strcmp( char *s1,
1438     char *s2 );</para>
1439
1440     <para>I could then not use it to compare argv's in main: int main(
1441     int argc, const char *argv[] ) { strcmp( argv[0], "privoxy"
1442     ); }</para>
1443
1444     <para>Both these pointers are *const*! If the c runtime library
1445     maintainers do it, we should too.</para>
1446
1447     
1448   </sect3>
1449     
1450
1451     <sect3 id="s30"><title>Pass and Return by Value</title>
1452
1453     <para><emphasis>Explanation:</emphasis></para>
1454
1455     <para>Most structures cannot fit onto a normal stack entry (i.e.
1456     they are not 4 bytes or less). Aka, a function declaration
1457     like: int load_aclfile( struct client_state csp )</para>
1458
1459     <para>would not work. So, to be consistent, we should declare all
1460     prototypes with "pass by value": int load_aclfile( struct
1461     client_state *csp )</para>
1462
1463     
1464   </sect3>
1465     
1466
1467     <sect3 id="s31"><title>Names of include files</title>
1468
1469     <para><emphasis>Explanation:</emphasis></para>
1470
1471     <para>Your include statements should contain the file name without
1472     a path. The path should be listed in the Makefile, using -I as
1473     processor directive to search the indicated paths. An exception
1474     to this would be for some proprietary software that utilizes a
1475     partial path to distinguish their header files from system or
1476     other header files.</para>
1477
1478     <para><emphasis>Example:</emphasis></para>
1479 <programlisting>
1480 #include &lt;iostream.h&gt;     /* This is not a local include */
1481 #include "config.h"       /* This IS a local include */
1482 </programlisting>
1483
1484     <para><emphasis>Exception:</emphasis></para>
1485
1486     <para>
1487 <programlisting>
1488 /* This is not a local include, but requires a path element. */ 
1489 #include &lt;sys/fileName.h&gt;
1490 </programlisting>
1491 </para>
1492
1493     <para><emphasis>Note:</emphasis> Please! do not add "-I." to the Makefile
1494     without a _very_ good reason. This duplicates the #include
1495     "file.h" behavior.</para>
1496
1497     
1498   </sect3>
1499     
1500
1501     <sect3 id="s32"><title>Provide multiple inclusion
1502     protection</title>
1503
1504     <para><emphasis>Explanation:</emphasis></para>
1505
1506     <para>Prevents compiler and linker errors resulting from
1507     redefinition of items.</para>
1508
1509     <para>Wrap each header file with the following syntax to prevent
1510     multiple inclusions of the file. Of course, replace PROJECT_H
1511     with your file name, with "." Changed to "_", and make it
1512     uppercase.</para>
1513
1514     <para><emphasis>Example:</emphasis></para>
1515 <programlisting>
1516 #ifndef PROJECT_H_INCLUDED
1517 #define PROJECT_H_INCLUDED
1518  ...
1519 #endif /* ndef PROJECT_H_INCLUDED */
1520 </programlisting>
1521   </sect3>
1522     
1523
1524     <sect3 id="s33"><title>Use `extern "C"` when appropriate</title>
1525
1526     <para><emphasis>Explanation:</emphasis></para>
1527
1528     <para>If our headers are included from C++, they must declare our
1529     functions as `extern "C"`. This has no cost in C, but increases
1530     the potential re-usability of our code.</para>
1531
1532     <para><emphasis>Example:</emphasis></para>
1533 <programlisting>
1534 #ifdef __cplusplus
1535 extern "C"
1536 {
1537 #endif /* def __cplusplus */
1538
1539 ... function definitions here ...
1540
1541 #ifdef __cplusplus
1542 }
1543 #endif /* def __cplusplus */
1544 </programlisting>
1545   </sect3>
1546     
1547
1548     <sect3 id="s34"><title>Where Possible, Use Forward Struct
1549     Declaration Instead of Includes</title>
1550
1551     <para><emphasis>Explanation:</emphasis></para>
1552
1553     <para>Useful in headers that include pointers to other struct's.
1554     Modifications to excess header files may cause needless
1555     compiles.</para>
1556
1557     <para><emphasis>Example:</emphasis></para>
1558 <programlisting>
1559 /*********************************************************************
1560  * We're avoiding an include statement here!
1561  *********************************************************************/
1562 struct file_list;
1563 extern file_list *xyz;</programlisting>
1564
1565     <para><emphasis>Note:</emphasis> If you declare "file_list xyz;" (without the
1566     pointer), then including the proper header file is necessary.
1567     If you only want to prototype a pointer, however, the header
1568     file is unnecessary.</para>
1569
1570     <para><emphasis>Status:</emphasis> Use with discretion.</para>
1571
1572     
1573   </sect3>
1574   </sect2>
1575
1576     <sect2 id="s35"><title>General Coding Practices</title>
1577
1578     
1579
1580     <sect3 id="s36"><title>Turn on warnings</title>
1581
1582     <para><emphasis>Explanation</emphasis></para>
1583
1584     <para>Compiler warnings are meant to help you find bugs. You
1585     should turn on as many as possible. With GCC, the switch is
1586     "-Wall". Try and fix as many warnings as possible.</para>
1587
1588     
1589   </sect3>
1590     
1591
1592     <sect3 id="s37"><title>Provide a default case for all switch
1593     statements</title>
1594
1595     <para><emphasis>Explanation:</emphasis></para>
1596
1597     <para>What you think is guaranteed is never really guaranteed. The
1598     value that you don't think you need to check is the one that
1599     someday will be passed. So, to protect yourself from the
1600     unknown, always have a default step in a switch statement.</para>
1601
1602     <para><emphasis>Example:</emphasis></para>
1603 <programlisting>
1604 switch( hash_string( cmd ) )
1605 {
1606    case hash_actions_file :
1607       ... code ...
1608       break;
1609
1610    case hash_confdir :
1611       ... code ...
1612       break;
1613
1614    default :
1615       log_error( ... );
1616       ... anomaly code goes here ...
1617       continue; / break; / exit( 1 ); / etc ...
1618
1619 } /* end switch( hash_string( cmd ) ) */</programlisting>
1620
1621     <para><emphasis>Note:</emphasis> If you already have a default condition, you
1622     are obviously exempt from this point. Of note, most of the
1623     WIN32 code calls `DefWindowProc' after the switch statement.
1624     This API call *should* be included in a default statement.</para>
1625
1626     <para><emphasis>Another Note:</emphasis> This is not so much a readability issue
1627     as a robust programming issue. The "anomaly code goes here" may
1628     be no more than a print to the STDERR stream (as in
1629     load_config). Or it may really be an ABEND condition.</para>
1630
1631     <para><emphasis>Status:</emphasis> Programmer discretion is advised.</para>
1632
1633     
1634   </sect3>
1635     
1636
1637     <sect3 id="s38"><title>Try to avoid falling through cases in a
1638     switch statement.</title>
1639
1640     <para><emphasis>Explanation:</emphasis></para>
1641
1642     <para>In general, you will want to have a 'break' statement within
1643     each 'case' of a switch statement. This allows for the code to
1644     be more readable and understandable, and furthermore can
1645     prevent unwanted surprises if someone else later gets creative
1646     and moves the code around.</para>
1647
1648     <para>The language allows you to plan the fall through from one
1649     case statement to another simply by omitting the break
1650     statement within the case statement. This feature does have
1651     benefits, but should only be used in rare cases. In general,
1652     use a break statement for each case statement.</para>
1653
1654     <para>If you choose to allow fall through, you should comment both
1655     the fact of the fall through and reason why you felt it was
1656     necessary.</para>
1657
1658     
1659   </sect3>
1660     
1661
1662     <sect3 id="s39"><title>Use 'long' or 'short' Instead of
1663     'int'</title>
1664
1665     <para><emphasis>Explanation:</emphasis></para>
1666
1667     <para>On 32-bit platforms, int usually has the range of long. On
1668     16-bit platforms, int has the range of short.</para>
1669
1670     <para><emphasis>Status:</emphasis> open-to-debate. In the case of most FSF
1671     projects (including X/GNU-Emacs), there are typedefs to int4,
1672     int8, int16, (or equivalence ... I forget the exact typedefs
1673     now). Should we add these to IJB now that we have a "configure"
1674     script?</para>
1675
1676     
1677   </sect3>
1678     
1679
1680     <sect3 id="s40"><title>Don't mix size_t and other types</title>
1681
1682     <para><emphasis>Explanation:</emphasis></para>
1683
1684     <para>The type of size_t varies across platforms. Do not make
1685     assumptions about whether it is signed or unsigned, or about
1686     how long it is. Do not compare a size_t against another
1687     variable of a different type (or even against a constant)
1688     without casting one of the values. Try to avoid using size_t if
1689     you can.</para>
1690
1691     
1692   </sect3>
1693     
1694
1695     <sect3 id="s41"><title>Declare each variable and struct on its
1696     own line.</title>
1697
1698     <para><emphasis>Explanation:</emphasis></para>
1699
1700     <para>It can be tempting to declare a series of variables all on
1701     one line. Don't.</para>
1702
1703     <para><emphasis>Example:</emphasis></para>
1704 <programlisting>
1705 long a = 0;
1706 long b = 0;
1707 long c = 0;</programlisting>
1708
1709     <para><emphasis>Instead of:</emphasis></para>
1710
1711     <para>long a, b, c;</para>
1712
1713     <para><emphasis>Explanation:</emphasis> - there is more room for comments on the
1714     individual variables - easier to add new variables without
1715     messing up the original ones - when searching on a variable to
1716     find its type, there is less clutter to "visually"
1717     eliminate</para>
1718
1719     <para><emphasis>Exceptions:</emphasis> when you want to declare a bunch of loop
1720     variables or other trivial variables; feel free to declare them
1721     on 1 line. You should, although, provide a good comment on
1722     their functions.</para>
1723
1724     <para><emphasis>Status:</emphasis> developer-discretion.</para>
1725
1726     
1727   </sect3>
1728     
1729
1730     <sect3 id="s42"><title>Use malloc/zalloc sparingly</title>
1731
1732     <para><emphasis>Explanation:</emphasis></para>
1733
1734     <para>Create a local struct (on the stack) if the variable will
1735     live and die within the context of one function call.</para>
1736
1737     <para>Only "malloc" a struct (on the heap) if the variable's life
1738     will extend beyond the context of one function call.</para>
1739
1740     <para><emphasis>Example:</emphasis></para>
1741 <programlisting>
1742 If a function creates a struct and stores a pointer to it in a
1743 list, then it should definitely be allocated via `malloc'.
1744 </programlisting>
1745   </sect3>
1746     
1747
1748     <sect3 id="s43"><title>The Programmer Who Uses 'malloc' is
1749     Responsible for Ensuring 'free'</title>
1750
1751     <para><emphasis>Explanation:</emphasis></para>
1752
1753     <para>If you have to "malloc" an instance, you are responsible for
1754     insuring that the instance is `free'd, even if the deallocation
1755     event falls within some other programmer's code. You are also
1756     responsible for ensuring that deletion is timely (i.e. not too
1757     soon, not too late). This is known as "low-coupling" and is a
1758     "good thing (tm)". You may need to offer a
1759     free/unload/destructor type function to accommodate this.</para>
1760
1761     <para><emphasis>Example:</emphasis></para>
1762 <programlisting>
1763 int load_re_filterfile( struct client_state *csp ) { ... }
1764 static void unload_re_filterfile( void *f ) { ... }</programlisting>
1765
1766     <para><emphasis>Exceptions:</emphasis></para>
1767
1768     <para>The developer cannot be expected to provide `free'ing
1769     functions for C run-time library functions ... such as
1770     `strdup'.</para>
1771
1772     <para><emphasis>Status:</emphasis> developer-discretion. The "main" use of this
1773     standard is for allocating and freeing data structures (complex
1774     or nested).</para>
1775
1776     
1777   </sect3>
1778     
1779
1780     <sect3 id="s44"><title>Add loaders to the `file_list' structure
1781     and in order</title>
1782
1783     <para><emphasis>Explanation:</emphasis></para>
1784
1785     <para>I have ordered all of the "blocker" file code to be in alpha
1786     order. It is easier to add/read new blockers when you expect a
1787     certain order.</para>
1788
1789     <para><emphasis>Note:</emphasis> It may appear that the alpha order is broken in
1790     places by POPUP tests coming before PCRS tests. But since
1791     POPUPs can also be referred to as KILLPOPUPs, it is clear that
1792     it should come first.</para>
1793
1794     
1795   </sect3>
1796     
1797
1798     <sect3 id="s45"><title>"Uncertain" new code and/or changes to
1799     existing code, use FIXME</title>
1800
1801     <para><emphasis>Explanation:</emphasis></para>
1802
1803     <para>If you have enough confidence in new code or confidence in
1804     your changes, but are not *quite* sure of the repercussions,
1805     add this:</para>
1806
1807     <para>/* FIXME: this code has a logic error on platform XYZ, *
1808     attempting to fix */ #ifdef PLATFORM ...changed code here...
1809     #endif</para>
1810
1811     <para>or:</para>
1812
1813     <para>/* FIXME: I think the original author really meant this...
1814     */ ...changed code here...</para>
1815
1816     <para>or:</para>
1817
1818     <para>/* FIXME: new code that *may* break something else... */
1819     ...new code here...</para>
1820
1821     <para><emphasis>Note:</emphasis> If you make it clear that this may or may not
1822     be a "good thing (tm)", it will be easier to identify and
1823     include in the project (or conversely exclude from the
1824     project).</para>
1825
1826     
1827   </sect3>
1828
1829   </sect2>
1830
1831     <sect2 id="s46"><title>Addendum: Template for files and function
1832     comment blocks:</title>
1833
1834     <para><emphasis>Example for file comments:</emphasis></para>
1835 <programlisting>
1836 const char FILENAME_rcs[] = "$Id: developer-manual.sgml,v 1.46.2.8 2002/08/17 00:16:10 hal9 Exp $";
1837 /*********************************************************************
1838  *
1839  * File        :  $S<!-- Break CVS Substitution -->ource$
1840  *
1841  * Purpose     :  (Fill me in with a good description!)
1842  *
1843  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1844  *                Privoxy team. http://www.privoxy.org/
1845  *
1846  *                Based on the Internet Junkbuster originally written
1847  *                by and Copyright (C) 1997 Anonymous Coders and
1848  *                Junkbusters Corporation.  http://www.junkbusters.com
1849  *
1850  *                This program is free software; you can redistribute it
1851  *                and/or modify it under the terms of the GNU General
1852  *                Public License as published by the Free Software
1853  *                Foundation; either version 2 of the License, or (at
1854  *                your option) any later version.
1855  *
1856  *                This program is distributed in the hope that it will
1857  *                be useful, but WITHOUT ANY WARRANTY; without even the
1858  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1859  *                PARTICULAR PURPOSE.  See the GNU General Public
1860  *                License for more details.
1861  *
1862  *                The GNU General Public License should be included with
1863  *                this file.  If not, you can view it at
1864  *                http://www.gnu.org/copyleft/gpl.html
1865  *                or write to the Free Software Foundation, Inc., 59
1866  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1867  *
1868  * Revisions   :
1869  *    $L<!-- Break CVS Substitution -->og$
1870  *
1871  *********************************************************************/
1872
1873
1874 #include "config.h"
1875
1876    ...necessary include files for us to do our work...
1877
1878 const char FILENAME_h_rcs[] = FILENAME_H_VERSION;
1879 </programlisting>
1880
1881     <para><emphasis>Note:</emphasis> This declares the rcs variables that should be
1882     added to the "show-proxy-args" page. If this is a brand new
1883     creation by you, you are free to change the "Copyright" section
1884     to represent the rights you wish to maintain.</para>
1885
1886     <para><emphasis>Note:</emphasis> The formfeed character that is present right
1887     after the comment flower box is handy for (X|GNU)Emacs users to
1888     skip the verbiage and get to the heart of the code (via
1889     `forward-page' and `backward-page'). Please include it if you
1890     can.</para>
1891
1892     <para><emphasis>Example for file header comments:</emphasis></para>
1893 <programlisting>
1894 #ifndef _FILENAME_H
1895 #define _FILENAME_H
1896 #define FILENAME_H_VERSION "$Id: developer-manual.sgml,v 1.46.2.8 2002/08/17 00:16:10 hal9 Exp $"
1897 /*********************************************************************
1898  *
1899  * File        :  $S<!-- Break CVS Substitution -->ource$
1900  *
1901  * Purpose     :  (Fill me in with a good description!)
1902  *
1903  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1904  *                Privoxy team. http://www.privoxy.org/
1905  *
1906  *                Based on the Internet Junkbuster originally written
1907  *                by and Copyright (C) 1997 Anonymous Coders and
1908  *                Junkbusters Corporation.  http://www.junkbusters.com
1909  *
1910  *                This program is free software; you can redistribute it
1911  *                and/or modify it under the terms of the GNU General
1912  *                Public License as published by the Free Software
1913  *                Foundation; either version 2 of the License, or (at
1914  *                your option) any later version.
1915  *
1916  *                This program is distributed in the hope that it will
1917  *                be useful, but WITHOUT ANY WARRANTY; without even the
1918  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1919  *                PARTICULAR PURPOSE.  See the GNU General Public
1920  *                License for more details.
1921  *
1922  *                The GNU General Public License should be included with
1923  *                this file.  If not, you can view it at
1924  *                http://www.gnu.org/copyleft/gpl.html
1925  *                or write to the Free Software Foundation, Inc., 59
1926  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1927  *
1928  * Revisions   :
1929  *    $L<!-- Break CVS Substitution -->og$
1930  *
1931  *********************************************************************/
1932
1933
1934 #include "project.h"
1935
1936 #ifdef __cplusplus
1937 extern "C" {
1938 #endif
1939
1940    ... function headers here ...
1941
1942
1943 /* Revision control strings from this header and associated .c file */
1944 extern const char FILENAME_rcs[];
1945 extern const char FILENAME_h_rcs[];
1946
1947
1948 #ifdef __cplusplus
1949 } /* extern "C" */
1950 #endif
1951
1952 #endif /* ndef _FILENAME_H */
1953
1954 /*
1955   Local Variables:
1956   tab-width: 3
1957   end:
1958 */
1959 </programlisting>
1960
1961     <para><emphasis>Example for function comments:</emphasis></para>
1962 <programlisting>
1963 /*********************************************************************
1964  *
1965  * Function    :  FUNCTION_NAME
1966  *
1967  * Description :  (Fill me in with a good description!)
1968  *
1969  * parameters  :
1970  *          1  :  param1 = pointer to an important thing
1971  *          2  :  x      = pointer to something else
1972  *
1973  * Returns     :  0 => Ok, everything else is an error.
1974  *
1975  *********************************************************************/
1976 int FUNCTION_NAME( void *param1, const char *x )
1977 {
1978    ...
1979    return( 0 );
1980
1981 }
1982 </programlisting>
1983
1984     <para><emphasis>Note:</emphasis> If we all follow this practice, we should be
1985     able to parse our code to create a "self-documenting" web
1986     page.</para>
1987
1988   </sect2>
1989
1990   </sect1>
1991
1992   <!--   ~~~~~       New section      ~~~~~     -->
1993   <sect1 id="testing"><title>Testing Guidelines</title>
1994     <para>To be filled.
1995 </para>
1996
1997     <!--   ~~~~~       New section      ~~~~~     -->
1998     <sect2 id="testing-plan"><title>Testplan for releases</title>
1999       <para>
2000        Explain release numbers. major, minor. developer releases. etc.
2001
2002 <orderedlist numeration="arabic">
2003           <listitem><para>
2004 Remove any existing rpm with rpm -e
2005 </para></listitem>
2006           <listitem><para>
2007 Remove any file that was left over. This includes (but is not limited to)
2008       <itemizedlist>
2009                 <listitem><para>/var/log/privoxy</para></listitem>
2010                 <listitem><para>/etc/privoxy</para></listitem>
2011                 <listitem><para>/usr/sbin/privoxy</para></listitem>
2012                 <listitem><para>/etc/init.d/privoxy</para></listitem>
2013                 <listitem><para>/usr/doc/privoxy*</para></listitem>
2014               </itemizedlist>
2015 </para></listitem>
2016           <listitem><para>
2017 Install the rpm. Any error messages?
2018 </para></listitem>
2019           <listitem><para>start,stop,status <application>Privoxy</application> with the specific script
2020       (e.g. /etc/rc.d/init/privoxy stop). Reboot your machine. Does
2021       autostart work?</para></listitem>
2022           <listitem><para>Start browsing. Does <application>Privoxy</application> work? Logfile written?</para></listitem>
2023           <listitem><para>Remove the rpm. Any error messages? All files removed?</para></listitem>
2024         </orderedlist>
2025 </para>
2026     </sect2>
2027
2028     <!--   ~~~~~       New section      ~~~~~     -->
2029     <sect2 id="testing-report"><title>Test reports</title>
2030       <para>
2031 Please submit test reports only with the <ulink url="http://sourceforge.net/tracker/?func=add&amp;group_id=11118&amp;atid=395005">test form</ulink>
2032 at sourceforge. Three simple steps:
2033         <itemizedlist>
2034           
2035           <listitem><para>Select category: the distribution you test on.</para></listitem>
2036           <listitem><para>Select group: the version of <application>Privoxy</application> that we are about to release.</para></listitem>
2037           <listitem><para>Fill the Summary and Detailed Description with something
2038               intelligent (keep it short and precise).</para>
2039           </listitem>
2040         </itemizedlist>
2041         Do not mail to the mailing list (we cannot keep track on issues there).
2042       </para>
2043     </sect2>
2044     
2045   </sect1>
2046
2047   <!--   ~~~~~       New section      ~~~~~     -->
2048   <sect1 id="newrelease"><title>Releasing a New Version</title>
2049     <para>
2050         When we release versions of <application>Privoxy</application>,
2051         our work leaves our cozy secret lab and has to work in the cold
2052         RealWorld[tm]. Once it is released, there is no way to call it
2053         back, so it is very important that great care is taken to ensure
2054         that everything runs fine, and not to introduce problems in the
2055         very last minute.
2056     </para>
2057     <para>
2058         So when releasing a new version, please adhere exactly to the
2059         procedure outlined in this chapter.
2060     </para>
2061
2062     <para>
2063         The following programs are required to follow this process:
2064         <filename>ncftpput</filename> (ncftp), <filename>scp, ssh</filename> (ssh),
2065         <filename>gmake</filename> (GNU's version of make), autoconf, cvs.
2066     </para>
2067
2068     <sect2 id="versionnumbers">
2069     <title>Version numbers</title>
2070
2071     <para>
2072       First you need to determine which version number the release will have. 
2073       <application>Privoxy</application> version numbers consist of three numbers,
2074       separated by dots, like in X.Y.Z (e.g. 3.0.0), where:
2075         <itemizedlist>
2076           <listitem>
2077             <para>
2078               X, the version major, is rarely ever changed. It is increased by one if
2079               turning a development branch into stable substantially changes the functionality,
2080               user interface or configuration syntax. Majors 1 and 2 were 
2081               <application>Junkbuster</application>, and 3 will be the first stable
2082               <application>Privoxy</application> release.
2083             </para>
2084           </listitem>
2085           <listitem>
2086             <para>
2087               Y, the version minor, represents the branch within the major version.
2088               At any point in time, there are two branches being maintained:
2089               The stable branch, with an even minor, say, 2N, in which no functionality is
2090               being added and only bug-fixes are made, and 2N+1, the development branch, in
2091               which the further development of <application>Privoxy</application> takes
2092               place.
2093               This enables us to turn the code upside down and inside out, while at the same time
2094               providing and maintaining a stable version.
2095               The minor is reset to zero (and one) when the major is incremented. When a development
2096               branch has matured to the point where it can be turned into stable, the old stable branch
2097               2N is given up (i.e. no longer maintained), the former development branch 2N+1 becomes the
2098               new stable branch 2N+2, and a new development branch 2N+3 is opened.
2099             </para>
2100           </listitem>
2101           <listitem>
2102             <para>
2103               Z, the point or sub version, represents a release of the software within a branch.
2104               It is therefore incremented immediately before each code freeze. 
2105               In development branches, only the even point versions correspond to actual releases,
2106               while the odd ones denote the evolving state of the sources on CVS in between.
2107               It follows that Z is odd on CVS in development branches most of the time. There, it gets
2108               increased to an even number immediately before a code freeze, and is increased to an odd
2109               number again immediately thereafter.
2110               This ensures that builds from CVS snapshots are easily distinguished from released versions.
2111               The point version is reset to zero when the minor changes.
2112             </para>
2113           </listitem>
2114         </itemizedlist>
2115     </para>
2116     <para>
2117      In summary, the main CVS trunk is the development branch where new
2118      features are being worked on for the next stable series. This should
2119      almost always be where the most activity takes place. There is always at
2120      least one stable branch from the trunk, e.g now it is 3.0, which is only
2121      used to release stable versions. Once the initial .0 release of the
2122      stable branch has been done, then as a rule, only bugfixes that have had
2123      prior testing should be committed to the stable branch. At that point, it
2124      is mostly <quote>hands off</quote>. Once there are enough bugfixes to
2125      justify a new release, the version of this branch is again incremented 
2126      Example: 3.0.0 -> 3.0.1 -> 3.0.2, etc are all stable releases from within
2127      the stable branch. 3.1.x is currently the main trunk, and where work on
2128      3.2.x is taking place. If any questions, please post to the devel list
2129      <emphasis>before</emphasis> committing to a stable branch!
2130
2131     </para>
2132
2133     </sect2>
2134      
2135     <sect2 id="beforerelease">
2136     <title>Before the Release: Freeze</title>
2137      <para>
2138        The following <emphasis>must be done by one of the
2139        developers</emphasis> prior to each new release.
2140      </para>
2141      <para>
2142       <itemizedlist>
2143        <listitem>
2144         <para>
2145          Make sure that everybody who has worked on the code in the last
2146          couple of days has had a chance to yell <quote>no!</quote> in case
2147          they have pending changes/fixes in their pipelines. Announce the
2148          freeze so that nobody will interfere with last minute changes.
2149         </para>
2150       </listitem> 
2151       <listitem>
2152        <para>
2153          Increment the version number (point from odd to even in development
2154          branches!) in <filename>configure.in</filename>. (RPM spec files 
2155          will need to be incremented as well.)
2156        </para>
2157       </listitem> 
2158       <listitem>
2159        <para>
2160         If <filename>default.action</filename> has changed since last
2161         release (i.e. software release or standalone actions file release),
2162         bump up its version info to A.B in this line:
2163        </para>
2164        <para> 
2165         <programlisting>
2166   {+add-header{X-Actions-File-Version: A.B} -filter -no-popups}
2167 </programlisting>
2168        </para>
2169        <para> 
2170         Then change the version info in doc/webserver/actions/index.php,
2171         line: '$required_actions_file_version = "A.B";'
2172        </para>
2173       </listitem>
2174       <listitem>
2175        <para>
2176         All documentation should be rebuild after the version bump.
2177         Finished docs should be then be committed to CVS (for those 
2178         without the ability to build these). Some docs may require 
2179         rather obscure processing tools. <filename>config</filename>,
2180         the man page (and the html version of the man page), and the PDF docs
2181         fall in this category. REAMDE, the man page, AUTHORS, and config
2182         should all also be committed to CVS for other packagers. The 
2183         formal docs should be uploaded to the webserver. See the
2184         Section "Updating the webserver" in this manual for details.
2185        </para>
2186       </listitem> 
2187       <listitem>
2188        <para>
2189          The <citetitle>User Manual</citetitle> is also used for context 
2190          sensitive help for the CGI editor. This is version sensitive, so that
2191          the user will get appropriate help for his/her release. So with 
2192          each release a fresh version should be uploaded to the webserver
2193          (this is in addition to the main <citetitle>User Manual</citetitle>
2194          link from the main page since we need to keep manuals for various 
2195          versions available). The CGI pages will link to something like 
2196          <literal>http://privoxy.org/$(VERSION)/user-manual/</literal>. This
2197          will need to be updated for each new release. There is no Makefile
2198          target for this at this time!!! It needs to be done manually.
2199        </para>
2200       </listitem> 
2201       <listitem>
2202        <para>
2203         All developers should look at the <filename>ChangeLog</filename> and
2204         make sure noteworthy changes are referenced.
2205        </para>
2206      </listitem> 
2207       <listitem>
2208        <para>
2209         <emphasis>Commit all files that were changed in the above steps!</emphasis>
2210        </para>
2211       </listitem>
2212       <listitem>
2213        <para>
2214         Tag all files in CVS with the version number with
2215         <quote><command>cvs tag v_X_Y_Z</command></quote>.
2216         Don't use vX_Y_Z, ver_X_Y_Z, v_X.Y.Z (won't work) etc.
2217        </para>
2218       </listitem> 
2219      <listitem>
2220        <para>
2221         If the release was in a development branch, increase the point version
2222         from even to odd (X.Y.(Z+1)) again in <filename>configure.in</filename> and
2223         commit your change.
2224        </para>
2225       </listitem> 
2226      <listitem>
2227        <para>
2228         On the webserver, copy the user manual to a new top-level directory
2229         called <filename>X.Y.Z</filename>. This ensures that help links from the CGI
2230         pages, which have the version as a prefix, will go into the right version of the manual.
2231         If this is a development branch release, also symlink <filename>X.Y.(Z-1)</filename>
2232         to <filename>X.Y.Z</filename> and <filename>X.Y.(Z+1)</filename> to
2233         <filename>.</filename> (i.e. dot). 
2234        </para>
2235       </listitem> 
2236       </itemizedlist>
2237      </para> 
2238     </sect2>
2239     
2240     <sect2 id="therelease">
2241     <title>Building and Releasing the Packages</title>
2242      <para>
2243       Now the individual packages can be built and released. Note that for
2244       GPL reasons the first package to be released is always the source tarball.
2245      </para>
2246  
2247      <para>
2248       For <emphasis>all</emphasis> types of packages, including the source tarball,
2249       <emphasis>you must make sure that you build from clean sources by exporting
2250       the right version from CVS into an empty directory</emphasis> (just press return when
2251       asked for a password):
2252      </para>
2253       
2254      <para>
2255       <programlisting>
2256   mkdir dist # delete or choose different name if it already exists
2257   cd dist
2258   cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login
2259   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa export -r v_X_Y_Z current
2260 </programlisting>
2261     </para>
2262   
2263     <para>
2264      <emphasis>Do NOT change</emphasis> a single bit, including, but not limited to
2265      version information after export from CVS. This is to make sure that
2266      all release packages, and with them, all future bug reports, are based
2267      on exactly the same code.
2268     </para>
2269   
2270     <para>
2271      Please find additional instructions for the source tarball and the
2272      individual platform dependent binary packages below. And details 
2273      on the Sourceforge release process below that.
2274     </para>
2275
2276     <sect3 id="pack-guidelines">
2277     <title>Note on Privoxy Packaging</title>
2278      <para>
2279       Please keep these general guidelines in mind when putting together 
2280       your package. These apply to <emphasis>all</emphasis> platforms!
2281      </para>
2282      <para>
2283       <itemizedlist>
2284        <listitem>
2285         <para>
2286           <application>Privoxy</application> <emphasis>requires</emphasis>
2287           write access to: all <filename>*.action</filename> files, all 
2288           logfiles, and the <filename>trust</filename> file. You will 
2289           need to determine the best way to do this for your platform.
2290         </para>
2291        </listitem> 
2292        <listitem>
2293         <para>
2294           Please include up to date documentation. At a bare minimum:
2295         </para>
2296         <simplelist>
2297          <member>
2298           <filename>LICENSE</filename> (top-level directory)
2299          </member>
2300         </simplelist>
2301         <simplelist>
2302          <member>
2303           <filename>README</filename> (top-level directory)
2304          </member>
2305         </simplelist>
2306         <simplelist>
2307          <member>
2308           <filename>AUTHORS</filename> (top-level directory)
2309          </member>
2310         </simplelist>
2311         <simplelist>
2312          <member>
2313           <filename>man page</filename> (top-level directory, Unix-like
2314           platforms only)
2315          </member>
2316         </simplelist>
2317         <simplelist>
2318          <member>
2319           <filename>The User Manual</filename> (doc/webserver/user-manual/)
2320          </member>
2321         </simplelist>
2322         <simplelist>
2323          <member>
2324           <filename>FAQ</filename> (doc/webserver/faq/)
2325          </member>
2326         </simplelist>
2327         <para>
2328           Also suggested: <filename>Developer Manual</filename>
2329           (doc/webserver/developer-manual) and <filename>ChangeLog</filename>
2330           (top-level directory). <filename>FAQ</filename> and the manuals are
2331           HTML docs. There are also text versions in
2332           <filename>doc/text/</filename> which could conceivably also be
2333           included.
2334         </para>
2335         <para>
2336          The documentation has been designed such that the manuals are linked
2337          to each other from parallel directories, and should be packaged 
2338          that way. <filename>privoxy-index.html</filename> can also be
2339          included and can serve as a focal point for docs and other links of
2340          interest (and possibly renamed to <filename>index.html</filename>).
2341          This should be one level up from the manuals. There is a link also 
2342          on this page to an HTMLized version of the man page. To avoid 404 for
2343          this, it is in CVS as
2344          <filename>doc/webserver/man-page/privoxy-man-page.html</filename>,
2345          and should be included along with the manuals. There is also a
2346          css stylesheets that can be included for better presentation:
2347          <filename>p_doc.css</filename>. This should be in the same directory
2348          with <filename>privoxy-index.html</filename>, (i.e. one level up from
2349          the manual directories).
2350         </para>
2351       </listitem> 
2352       <listitem>
2353        <para>
2354         <filename>user.action</filename> is designed for local preferences. 
2355         Make sure this does not get overwritten!
2356        </para>
2357       </listitem> 
2358       <listitem>
2359        <para>
2360         Other configuration files should be installed as the new defaults, 
2361         but all previously installed configuration files should be preserved
2362         as backups. This is just good manners :-)
2363        </para>
2364      </listitem> 
2365      <listitem>
2366       <para>
2367        Please check platform specific notes in this doc, if you haven't 
2368        done <quote>Privoxy</quote> packaging before for other platform 
2369        specific issues. Conversely, please add any notes that you know 
2370        are important for your platform (or contact one of the doc 
2371        maintainers to do this if you can't).
2372       </para>
2373     </listitem> 
2374     <listitem>
2375      <para>
2376        Packagers should do a <quote>clean</quote> install of their 
2377        package after building it. So any previous installs should be 
2378        removed first to ensure the integrity of the newly built package. 
2379        Then run the package for a while to make sure there are no 
2380        obvious problems, before uploading.
2381      </para>
2382     </listitem> 
2383
2384       </itemizedlist>
2385      </para> 
2386     
2387     </sect3>
2388
2389     <sect3 id="newrelease-tarball"><title>Source Tarball</title>
2390         <para>
2391         First, <emphasis>make sure that you have freshly exported the right
2392         version into an empty directory</emphasis>. (See "Building and releasing
2393         packages" above). Then run:
2394         </para>
2395         <para>
2396         <programlisting>
2397   cd current
2398   autoheader && autoconf && ./configure
2399 </programlisting>
2400         </para>
2401         <para>
2402         Then do:
2403         </para>
2404         <para>
2405         <programlisting>
2406   make tarball-dist
2407 </programlisting>
2408         </para>
2409         <para>
2410         To upload the package to Sourceforge, simply issue
2411         </para>
2412         <para>
2413         <programlisting>
2414   make tarball-upload
2415 </programlisting>
2416         </para>
2417         <para>
2418         Go to the displayed URL and release the file publicly on Sourceforge.
2419         For the change log field, use the relevant section of the
2420         <filename>ChangeLog</filename> file.
2421       </para>
2422     </sect3>
2423
2424     <sect3 id="newrelease-rpm"><title>SuSE, Conectiva or Red Hat RPM</title>
2425         <para>
2426         In following text, replace <replaceable class="parameter">dist</replaceable>
2427         with either <quote>rh</quote> for Red Hat or <quote>suse</quote> for SuSE.
2428         </para>
2429         <para>
2430         First, <emphasis>make sure that you have freshly exported the right
2431         version into an empty directory</emphasis>. (See "Building and releasing
2432         packages" above). 
2433         </para>
2434         <para>
2435         As the only exception to not changing anything after export from CVS,
2436         now examine the file <filename>privoxy-</filename><replaceable class="parameter">dist</replaceable><filename>.spec</filename>
2437         and make sure that the version information and the RPM release number are
2438         correct. The RPM release numbers for each version start at one. Hence it must
2439         be reset to one if this is the first RPM for
2440         <replaceable class="parameter">dist</replaceable> which is built from version
2441         X.Y.Z. Check the
2442         <ulink url="http://sourceforge.net/project/showfiles.php?group_id=11118">file
2443         list</ulink> if unsure. Else, it must be set to the highest already available RPM
2444         release number for that version plus one.
2445         </para>
2446         <para>
2447         Then run:
2448         </para>
2449         <para>
2450         <programlisting>
2451   cd current
2452   autoheader && autoconf && ./configure
2453 </programlisting>
2454         </para>
2455         <para>
2456         Then do
2457         </para>
2458         <para>
2459         <programlisting>
2460   make <replaceable class="parameter">dist</replaceable>-dist
2461 </programlisting>
2462         </para>
2463         <para>
2464         To upload the package to Sourceforge, simply issue
2465         </para>
2466         <para>
2467         <programlisting>
2468   make <replaceable class="parameter">dist</replaceable>-upload <replaceable class="parameter">rpm_packagerev</replaceable>
2469 </programlisting>
2470         </para>
2471         <para>
2472         where <replaceable class="parameter">rpm_packagerev</replaceable> is the
2473         RPM release number as determined above.
2474         Go to the displayed URL and release the file publicly on Sourceforge.
2475         Use the release notes and change log from the source tarball package.
2476       </para>
2477     </sect3>
2478
2479     <sect3 id="newrelease-os2"><title>OS/2</title>
2480       <para>
2481         First, <emphasis>make sure that you have freshly exported the right
2482         version into an empty directory</emphasis>. (See "Building and releasing
2483         packages" above). Then get the OS/2 Setup module:
2484         </para>
2485         <para>
2486         <programlisting>
2487   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co os2setup
2488 </programlisting>
2489         </para>
2490         <para>
2491         You will need a mix of development tools.
2492         The main compilation takes place with IBM Visual Age C++.
2493         Some ancillary work takes place with GNU tools, available from
2494         various sources like hobbes.nmsu.edu.
2495         Specificially, you will need <filename>autoheader</filename>,
2496         <filename>autoconf</filename> and <filename>sh</filename> tools.
2497         The packaging takes place with WarpIN, available from various sources, including
2498         its home page: <ulink url="http://www.xworkplace.org/">xworkplace</ulink>.
2499         </para>
2500         <para>
2501         Change directory to the <filename>os2setup</filename> directory.
2502         Edit the os2build.cmd file to set the final executable filename.
2503         For example, 
2504         </para>
2505         <para>
2506         <programlisting>
2507   installExeName='privoxyos2_setup_X.Y.Z.exe'
2508 </programlisting>
2509         </para>
2510         <para>
2511         Next, edit the <filename>IJB.wis</filename> file so the release number matches
2512         in the <filename>PACKAGEID</filename> section:
2513         </para>
2514         <para>
2515         <programlisting>
2516   PACKAGEID="Privoxy Team\Privoxy\Privoxy Package\X\Y\Z"
2517 </programlisting>
2518         </para>
2519         <para>
2520         You're now ready to build.  Run:
2521         </para>
2522         <para>
2523         <programlisting>
2524   os2build
2525 </programlisting>
2526         </para>
2527         <para>
2528          You will find the  WarpIN-installable executable in the
2529         <filename>./files</filename> directory. Upload this anonymously to
2530          <filename>uploads.sourceforge.net/incoming</filename>, create a release
2531          for it, and you're done. Use the release notes and Change Log from the
2532          source tarball package.
2533         </para>
2534     </sect3>
2535
2536     <sect3 id="newrelease-solaris"><title>Solaris</title>
2537       <para>
2538         Login to Sourceforge's compilefarm via ssh:
2539         </para>
2540         <para>
2541         <programlisting>
2542   ssh cf.sourceforge.net
2543 </programlisting>
2544         </para>
2545         <para>
2546         Choose the right operating system (not the Debian one).
2547         When logged in, <emphasis>make sure that you have freshly exported the right
2548         version into an empty directory</emphasis>. (See "Building and releasing
2549         packages" above). Then run:
2550         </para>
2551         <para>
2552         <programlisting>
2553   cd current
2554   autoheader && autoconf && ./configure
2555 </programlisting>
2556         </para>
2557         <para>
2558         Then run
2559         </para>
2560         <para>
2561         <programlisting>
2562   gmake solaris-dist
2563 </programlisting>
2564         </para>
2565         <para>
2566         which creates a gzip'ed tar archive. Sadly, you cannot use <command>make
2567         solaris-upload</command> on the Sourceforge machine (no ncftpput). You now have
2568         to manually upload the archive to Sourceforge's ftp server and release
2569         the file publicly. Use the release notes and Change Log from the
2570         source tarball package.
2571         </para>
2572     </sect3>
2573
2574     <sect3 id="newrelease-windows"><title>Windows</title>
2575       <para>
2576         You should ensure you have the latest version of Cygwin (from
2577         <ulink url="http://www.cygwin.com/">http://www.cygwin.com/</ulink>).
2578         Run the following commands from within a Cygwin bash shell.
2579       </para>
2580       <para>
2581         First, <emphasis>make sure that you have freshly exported the right
2582         version into an empty directory</emphasis>. (See "Building and releasing
2583         packages" above). Then get the Windows setup module:
2584       </para>
2585       <para>
2586       <programlisting>
2587   cvs -z3  -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co winsetup
2588 </programlisting>
2589       </para>
2590       <para>
2591         Then you can build the package.  This is fully automated, and is
2592         controlled by <filename>winsetup/GNUmakefile</filename>.
2593         All you need to do is:
2594       </para>
2595       <para>
2596       <programlisting>
2597   cd winsetup
2598   make
2599 </programlisting>
2600       </para>
2601       <para>
2602         Now you can manually rename <filename>privoxy_setup.exe</filename> to
2603         <filename>privoxy_setup_X_Y_Z.exe</filename>, and upload it to
2604         SourceForge. When releasing the package on SourceForge, use the release notes
2605         and Change Log from the source tarball package.
2606       </para>
2607     </sect3>
2608
2609     <sect3 id="newrelease-debian"><title>Debian</title>
2610       <para>
2611         First, <emphasis>make sure that you have freshly exported the
2612         right version into an empty directory</emphasis>. (See
2613         "Building and releasing packages" above).  Then add a log
2614         entry to <filename>debian/changelog</filename>, if it is not
2615         already there, for example by running:
2616       </para>
2617       <para>
2618         <programlisting>
2619   debchange -v &p-version;-&p-status;-1 "New upstream version"
2620 </programlisting>
2621       </para>
2622       <para>
2623         Then, run: 
2624       </para>
2625       <para>
2626         <programlisting>
2627   dpkg-buildpackage -rfakeroot -us -uc -b
2628 </programlisting>
2629       </para>
2630       <para>
2631         This will create
2632         <filename>../privoxy_&p-version;-&p-status;-1_i386.deb</filename>
2633         which can be uploaded.  To upload the package to Sourceforge, simply
2634         issue
2635       </para>
2636       <para>
2637         <programlisting>
2638   make debian-upload
2639 </programlisting>
2640       </para>
2641     </sect3>
2642
2643     <sect3 id="newrelease-macosx"><title>Mac OSX</title>
2644       <para>
2645         First, <emphasis>make sure that you have freshly exported the right
2646         version into an empty directory</emphasis>. (See "Building and releasing
2647         packages" above). Then get the Mac OSX setup module:
2648         </para>
2649         <para>
2650         <programlisting>
2651   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co osxsetup
2652 </programlisting>
2653         </para>
2654         <para>
2655         Then run:
2656         </para>
2657         <para>
2658         <programlisting>
2659   cd osxsetup
2660   build
2661 </programlisting>
2662         </para>
2663         <para>
2664         This will run <filename>autoheader</filename>, <filename>autoconf</filename> and
2665         <filename>configure</filename> as well as <filename>make</filename>.
2666         Finally, it will copy over the necessary files to the ./osxsetup/files directory
2667         for further processing by <filename>PackageMaker</filename>.
2668         </para>
2669         <para>
2670         Bring up PackageMaker with the PrivoxyPackage.pmsp definition file, modify the package
2671         name to match the release, and hit the "Create package" button.
2672         If you specify ./Privoxy.pkg as the output package name, you can then create
2673         the distributable zip file with the command:
2674         </para>
2675         <para>
2676         <programlisting>
2677   zip -r privoxyosx_setup_x.y.z.zip Privoxy.pkg
2678 </programlisting>
2679         </para>
2680         <para>
2681         You can then upload <filename>privoxyosx_setup_x.y.z.zip</filename> anonymously to 
2682         <filename>uploads.sourceforge.net/incoming</filename>,
2683         create a release for it, and you're done. Use the release notes
2684         and Change Log from the source tarball package.
2685         </para>
2686     </sect3>
2687
2688     <sect3 id="newrelease-freebsd"><title>FreeBSD</title>
2689       <para>
2690         Login to Sourceforge's compile-farm via ssh:
2691         </para>
2692         <para>
2693         <programlisting>
2694   ssh cf.sourceforge.net
2695 </programlisting>
2696         </para>
2697         <para>
2698         Choose the right operating system.
2699         When logged in, <emphasis>make sure that you have freshly exported the right
2700         version into an empty directory</emphasis>. (See "Building and releasing
2701         packages" above). Then run:
2702         </para>
2703         <para>
2704         <programlisting>
2705   cd current
2706   autoheader && autoconf && ./configure
2707 </programlisting>
2708         </para>
2709         <para>
2710         Then run:
2711         </para>
2712         <para>
2713         <programlisting>
2714   gmake freebsd-dist
2715 </programlisting>
2716         </para>
2717         <para>
2718         which creates a gzip'ed tar archive. Sadly, you cannot use <command>make
2719         freebsd-upload</command> on the Sourceforge machine (no ncftpput). You now have
2720         to manually upload the archive to Sourceforge's ftp server and release
2721         the file publicly. Use the release notes and Change Log from the
2722         source tarball package.
2723         </para>
2724     </sect3>
2725
2726     <sect3 id="newrelease-hpux"><title>HP-UX 11</title>
2727       <para>
2728         First, <emphasis>make sure that you have freshly exported the right
2729         version into an empty directory</emphasis>. (See "Building and releasing
2730         packages" above). Then run:
2731         </para>
2732         <para>
2733         <programlisting>
2734   cd current
2735   autoheader && autoconf && ./configure
2736 </programlisting>
2737         </para>
2738         <para>
2739         Then do FIXME.
2740         </para>
2741     </sect3>
2742
2743     <sect3 id="newrelease-amiga"><title>Amiga OS</title>
2744       <para>
2745         First, <emphasis>make sure that you have freshly exported the right
2746         version into an empty directory</emphasis>. (See "Building and releasing
2747         packages" above). Then run:
2748         </para>
2749         <para>
2750         <programlisting>
2751   cd current
2752   autoheader && autoconf && ./configure
2753 </programlisting>
2754         </para>
2755         <para>
2756         Then do FIXME.
2757         </para>
2758     </sect3>
2759
2760     <sect3 id="newrelease-aix"><title>AIX</title>
2761       <para>
2762         Login to Sourceforge's compilefarm via ssh:
2763         </para>
2764         <para>
2765         <programlisting>
2766   ssh cf.sourceforge.net
2767 </programlisting>
2768         </para>
2769         <para>
2770         Choose the right operating system.
2771         When logged in, <emphasis>make sure that you have freshly exported the right
2772         version into an empty directory</emphasis>. (See "Building and releasing
2773         packages" above). Then run:
2774         </para>
2775         <para>
2776         <programlisting>
2777   cd current
2778   autoheader && autoconf && ./configure
2779 </programlisting>
2780         </para>
2781         <para>
2782         Then run:
2783         </para>
2784         <para>
2785         <programlisting>
2786   make aix-dist
2787 </programlisting>
2788         </para>
2789         <para>
2790         which creates a gzip'ed tar archive. Sadly, you cannot use <command>make
2791         aix-upload</command> on the Sourceforge machine (no ncftpput). You now have
2792         to manually upload the archive to Sourceforge's ftp server and release
2793         the file publicly. Use the release notes and Change Log from the
2794         source tarball package.
2795         </para>
2796     </sect3>
2797    </sect2>
2798
2799    <sect2 id="releasing">
2800    <title>Uploading and Releasing Your Package</title>
2801     <para>
2802       After the package is ready, it is time to upload it 
2803       to SourceForge, and go through the release steps. The upload
2804       is done via FTP:
2805     </para>
2806      <para>
2807       <itemizedlist>
2808        <listitem>
2809         <para>
2810           Upload to: <ulink url="ftp://upload.sourceforge.net/incoming">ftp://upload.sourceforge.net/incoming</ulink>
2811         </para>
2812       </listitem> 
2813       <listitem>
2814        <para>
2815          user: <literal>anonymous</literal>
2816        </para>
2817       </listitem> 
2818       <listitem>
2819        <para>
2820          password: <literal>ijbswa-developers@lists.sourceforge.net</literal>
2821        </para>
2822       </listitem> 
2823      </itemizedlist>
2824     </para> 
2825     <para>
2826      Or use the <command>make</command> targets as described above.
2827     </para>
2828     <para>
2829      Once this done go to <ulink url="http://sourceforge.net/project/admin/editpackages.php?group_id=11118">http://sourceforge.net/project/admin/editpackages.php?group_id=11118</ulink>, 
2830      making sure you are logged in. Find your target platform in the 
2831      second column, and click <literal>Add Release</literal>. You will 
2832      then need to create a new release for your package, using the format 
2833      of <literal>$VERSION ($CODE_STATUS)</literal>, e.g. <emphasis>&p-version;
2834      (beta)</emphasis>.
2835     </para>
2836     <para>
2837      Now just follow the prompts. Be sure to add any appropriate Release
2838      notes. You should see your freshly uploaded packages in 
2839      <quote>Step 2. Add Files To This Release</quote>. Check the 
2840      appropriate box(es). Remember at each step to hit the 
2841      <quote>Refresh/Submit</quote> buttons! You should now see your 
2842      file(s) listed in Step 3. Fill out the forms with the appropriate 
2843      information for your platform, being sure to hit <quote>Update</quote>
2844      for each file. If anyone is monitoring your platform, check the 
2845      <quote>email</quote> box at the very bottom to notify them of 
2846      the new package. This should do it!
2847     </para>
2848     <para>
2849      If you have made errors, or need to make changes, you can go through 
2850      essentially the same steps, but select <literal>Edit Release</literal>, 
2851      instead of <literal>Add Release</literal>.
2852     </para>
2853    </sect2>
2854
2855     <sect2 id="afterrelease">
2856     <title>After the Release</title>
2857      <para>
2858       When all (or: most of the) packages have been uploaded and made available,
2859       send an email to the <ulink url="mailto:ijbswa-announce@lists.sourceforge.net">announce
2860       mailing list</ulink>, Subject: "Version X.Y.Z available for download". Be sure to
2861       include the
2862       <ulink url="http://sourceforge.net/project/showfiles.php?group_id=11118">download
2863       location</ulink>, the release notes and the Changelog. Also, post an
2864       updated News item on the project page Sourceforge, and update the Home 
2865       page and docs linked from the Home page (see below).
2866      </para>
2867    </sect2>
2868
2869   </sect1>
2870   
2871   <!--   ~~~~~       New section      ~~~~~     -->
2872   <sect1 id="webserver-update"><title>Update the Webserver</title>
2873    <para>
2874     The webserver should be updated at least with each stable release. When
2875     updating, please follow these steps to make sure that no broken links,
2876     inconsistent contents or permission problems will occur (as it has many 
2877     times in the past!):
2878    </para>
2879    <para>
2880     If you have changed anything in the stable-branch documentation source
2881     SGML files, do:
2882    </para>
2883    <para>
2884     <programlisting>
2885   make dok dok-pdf # (or 'make redhat-dok dok-pdf' if 'make dok' doesn't work for you)
2886 </programlisting>
2887    </para>
2888    <para>
2889     That will generate <filename>doc/webserver/user-manual</filename>,
2890     <filename>doc/webserver/developer-manual</filename>,
2891     <filename>doc/webserver/faq</filename>, 
2892     <filename>doc/pdf/*.pdf</filename> and
2893     <filename>doc/webserver/index.html</filename> automatically.
2894    </para>
2895    <para>
2896     If you changed the manual page sources, generate
2897     <filename>doc/webserver/man-page/privoxy-man-page.html</filename>
2898     by running <quote><command>make man</command></quote>. (This is
2899     a separate target due to dependencies on some obscure perl scripts
2900     [now in CVS, but not well tested]. See comments in <filename>GNUmakefile</filename>.)
2901    </para>
2902    <para>
2903     If you want to add new files to the webserver, create them locally in
2904     the <filename>doc/webserver/*</filename> directory (or
2905     create new directories under <filename>doc/webserver</filename>).
2906    </para>
2907    <para>
2908     Next, commit any changes from the above steps to CVS. All set? 
2909     If these are docs in the stable branch, then do:
2910    </para>
2911    <para>
2912     <programlisting>
2913   make webserver
2914 </programlisting>
2915    </para>
2916    <para>
2917     This will do the upload to <ulink url="http://www.privoxy.org/">the
2918     webserver</ulink> (www.privoxy.org) and ensure all files and directories
2919     there are group writable.
2920    </para>
2921    <para>
2922     Please do <emphasis>NOT</emphasis> use any other means of transferring
2923     files to the webserver to avoid permission problems. Also, please do not
2924     upload docs from development branches or versions. The publicly posted
2925     docs should be in sync with the last official release.
2926    </para>
2927   </sect1>
2928
2929   <!--   ~~~~~       New section      ~~~~~     -->
2930   <sect1 id="contact"><title>Contacting the developers, Bug Reporting and Feature Requests</title>
2931 <!-- Include contacting.sgml  -->
2932  &contacting;
2933 <!-- end contacting -->
2934   </sect1>
2935   
2936
2937 <!--   ~~~~~~~~       New section Header    ~~~~~~~~~     -->
2938 <sect1 id="copyright"><title>Privoxy Copyright, License and History</title>
2939
2940 <!-- Include copyright.sgml -->
2941  &copyright;
2942 <!-- end -->
2943
2944 <!--   ~~~~~       New section      ~~~~~     -->
2945 <sect2><title>License</title>
2946 <!-- Include copyright.sgml: -->
2947  &license;
2948 <!-- end copyright -->
2949 </sect2>
2950 <!--  ~  End section  ~  -->
2951
2952 <!--   ~~~~~       New section      ~~~~~     -->
2953 <sect2><title>History</title>
2954 <!-- Include history.sgml -->
2955  &history;
2956 <!-- end -->
2957 </sect2>
2958
2959 </sect1>
2960   
2961   <!--   ~~~~~       New section      ~~~~~     -->
2962   <sect1 id="seealso"><title>See also</title>
2963 <!-- Include seealso.sgml -->
2964  &seealso;
2965 <!-- end  -->
2966
2967   </sect1>
2968
2969   <!--
2970
2971   This program is free software; you can redistribute it 
2972   and/or modify it under the terms of the GNU General
2973   Public License as published by the Free Software
2974   Foundation; either version 2 of the License, or (at
2975   your option) any later version.
2976
2977   This program is distributed in the hope that it will
2978   be useful, but WITHOUT ANY WARRANTY; without even the
2979   implied warranty of MERCHANTABILITY or FITNESS FOR A
2980   PARTICULAR PURPOSE.  See the GNU General Public
2981   License for more details.
2982
2983   The GNU General Public License should be included with
2984   this file.  If not, you can view it at
2985   http://www.gnu.org/copyleft/gpl.html
2986   or write to the Free Software Foundation, Inc., 59
2987   Temple Place - Suite 330, Boston, MA  02111-1307, USA.
2988
2989   $Log: developer-manual.sgml,v $
2990   Revision 1.46.2.8  2002/08/17 00:16:10  hal9
2991   Add note on updating webserver for User-manual/CGI editor, which is version
2992   dependent (and different from main UM link).
2993
2994   Revision 1.46.2.7  2002/08/14 17:29:25  hal9
2995   Add small notes on post-release steps, and uploading docs to webserver.
2996
2997   Revision 1.46.2.6  2002/08/10 11:40:25  oes
2998   Added disclaimer about probably being out-of-date and two small hints
2999
3000   Revision 1.46.2.5  2002/08/09 01:15:12  hal9
3001   Added some notes on pre-release steps (test builds first, update ChangeLog).
3002
3003   Revision 1.46.2.4  2002/05/29 00:30:59  mal0rd
3004   Fixed a little formatting.  Clarified debian section.
3005
3006   Revision 1.46.2.3  2002/05/28 04:32:45  hal9
3007   Change hints on bundling index.html to privoxy-index.html
3008
3009   Revision 1.46.2.2  2002/05/26 17:04:24  hal9
3010   -Spellcheck, very minor edits, and sync across branches
3011
3012   Revision 1.48  2002/05/26 12:48:31  roro
3013   Add releasing information about Debian.
3014
3015   Revision 1.47  2002/05/26 04:55:11  mal0rd
3016   Added debian-dist and debian-upload targets.  Also documented usage.
3017
3018   Revision 1.46  2002/05/22 17:15:00  oes
3019   Updated intro
3020
3021   Revision 1.45  2002/05/19 23:01:54  hal9
3022   Add small section on general packaging guidelines (e.g. actions files must
3023   be writable).
3024
3025   Revision 1.44  2002/05/15 03:55:17  hal9
3026   Fix ulink -> link, and minor modification to release process section for
3027   clarification.
3028
3029   Revision 1.43  2002/05/10 01:48:19  hal9
3030   This is mostly proposed copyright/licensing additions and changes. Docs
3031   are still GPL, but licensing and copyright are more visible. Also, copyright
3032   changed in doc header comments (eliminate references to JB except FAQ).
3033
3034   Revision 1.42  2002/05/05 20:26:02  hal9
3035   Sorting out license vs copyright in these docs.
3036
3037   Revision 1.41  2002/05/04 08:44:44  swa
3038   bumped version
3039
3040   Revision 1.40  2002/05/04 00:43:43  hal9
3041   -Remove TOC/first page kludge with proper stylesheet fix.
3042   -Combined the two very brief sections: Intro and Quickstart.
3043
3044   Revision 1.39  2002/05/02 15:08:25  oes
3045   Added explanation about version numbers and RPM package revisions
3046
3047   Revision 1.38  2002/04/29 02:20:31  hal9
3048   Add info on steps for uploading and the release process on SF.
3049
3050   Revision 1.37  2002/04/26 17:23:29  swa
3051   bookmarks cleaned, changed structure of user manual, screen and programlisting cleanups, and numerous other changes that I forgot
3052
3053   Revision 1.36  2002/04/26 05:25:23  hal9
3054   Mass commit to catch a few scattered fixes.
3055
3056   Revision 1.35  2002/04/17 15:16:15  oes
3057   Added link to docbook crash course
3058
3059   Revision 1.34  2002/04/15 23:39:32  oes
3060    - Extended & fixed the release section
3061    - Added CVS guideline sections
3062    - Separated webserver section from release section
3063    - Commented out boilerplate inclusion (If you don't know yet what it is,
3064      you shouldn't mess with its code ;-)
3065    - Nits & fixes
3066
3067   Revision 1.33  2002/04/12 03:49:53  hal9
3068   Spell checked. Clarification on where docs are kept.
3069
3070   Revision 1.32  2002/04/11 21:29:58  jongfoster
3071   Documenting Win32 release procedure
3072
3073   Revision 1.31  2002/04/11 09:32:52  oes
3074   more nits
3075
3076   Revision 1.30  2002/04/11 09:24:53  oes
3077   nits
3078
3079   Revision 1.29  2002/04/10 18:45:14  swa
3080   generated
3081
3082   Revision 1.28  2002/04/08 22:59:26  hal9
3083   Version update. Spell chkconfig correctly :)
3084
3085   Revision 1.27  2002/04/08 15:31:18  hal9
3086   Touch ups to documentation section.
3087
3088   Revision 1.26  2002/04/07 23:50:08  hal9
3089   Documentation changes to reflect HTML docs now in CVS, and new generated files
3090   list.
3091
3092   Revision 1.25  2002/04/06 05:07:28  hal9
3093   -Add privoxy-man-page.sgml, for man page.
3094   -Add authors.sgml for AUTHORS (and p-authors.sgml)
3095   -Reworked various aspects of various docs.
3096   -Added additional comments to sub-docs.
3097
3098   Revision 1.24  2002/04/04 21:33:37  hal9
3099   More on documenting the documents.
3100
3101   Revision 1.23  2002/04/04 18:46:47  swa
3102   consistent look. reuse of copyright, history et. al.
3103
3104   Revision 1.22  2002/04/04 17:27:56  swa
3105   more single file to be included at multiple points. make maintaining easier
3106
3107   Revision 1.21  2002/04/04 06:48:37  hal9
3108   Structural changes to allow for conditional inclusion/exclusion of content
3109   based on entity toggles, e.g. 'entity % p-not-stable  "INCLUDE"'. And
3110   definition of internal entities, e.g. 'entity p-version "2.9.13"' that will
3111   eventually be set by Makefile.
3112   More boilerplate text for use across multiple docs.
3113
3114   Revision 1.20  2002/04/04 03:28:27  david__schmidt
3115   Add Mac OSX section
3116
3117   Revision 1.19  2002/04/03 15:09:42  david__schmidt
3118   Add OS/2 build section
3119
3120   Revision 1.18  2002/04/03 03:51:48  hal9
3121   Touch ups.
3122
3123   Revision 1.17  2002/04/03 01:21:17  hal9
3124   Implementing Andreas's suggestions for Release sections.
3125
3126   Revision 1.16  2002/03/31 23:04:40  hal9
3127   Fleshed out the doc section, and added something for an intro so it was not
3128   blank.
3129
3130   Revision 1.15  2002/03/30 22:29:47  swa
3131   wrong make flavour
3132
3133   Revision 1.14  2002/03/30 19:04:08  swa
3134   people release differently. no good.
3135   I want to make parts of the docs only.
3136
3137   Revision 1.13  2002/03/27 01:16:41  hal9
3138   ditto
3139
3140   Revision 1.12  2002/03/27 01:02:51  hal9
3141   Touch up on name change...
3142
3143   Revision 1.11  2002/03/26 22:29:55  swa
3144   we have a new homepage!
3145
3146   Revision 1.10  2002/03/24 12:33:01  swa
3147   more additions.
3148
3149   Revision 1.9  2002/03/24 11:01:05  swa
3150   name change
3151
3152   Revision 1.8  2002/03/23 15:13:11  swa
3153   renamed every reference to the old name with foobar.
3154   fixed "application foobar application" tag, fixed
3155   "the foobar" with "foobar". left junkbustser in cvs
3156   comments and remarks to history untouched.
3157
3158   Revision 1.7  2002/03/11 13:13:27  swa
3159   correct feedback channels
3160
3161   Revision 1.6  2002/02/24 14:25:06  jongfoster
3162   Formatting changes.  Now changing the doctype to DocBook XML 4.1
3163   will work - no other changes are needed.
3164
3165   Revision 1.5  2001/10/31 18:16:51  swa
3166   documentation added: howto generate docs in text and html
3167   format, howto move stuff to the webserver.
3168
3169   Revision 1.4  2001/09/23 10:13:48  swa
3170   upload process established. run make webserver and
3171   the documentation is moved to the webserver. documents
3172   are now linked correctly.
3173
3174   Revision 1.3  2001/09/13 15:27:40  swa
3175   cosmetics
3176
3177   Revision 1.2  2001/09/13 15:20:17  swa
3178   merged standards into developer manual
3179
3180   Revision 1.1  2001/09/12 15:36:41  swa
3181   source files for junkbuster documentation
3182
3183   Revision 1.3  2001/09/10 17:43:59  swa
3184   first proposal of a structure.
3185
3186   Revision 1.2  2001/06/13 14:28:31  swa
3187   docs should have an author.
3188
3189   Revision 1.1  2001/06/13 14:20:37  swa
3190   first import of project's documentation for the webserver.
3191
3192   -->
3193
3194 </article>