Re-factored 'chat()' to become understandable and maintainable as
[privoxy.git] / contrib.sh
1 #!/bin/bash
2
3 echo "This script will create the gen_list contrib files in the current"
4 echo "directory.  Do you wish to continue? [y/n]"
5
6 typeset ans="n"
7 read ans
8
9 if [[ ${ans} != [Yy]* ]]; then
10         echo "Goodbye."
11         exit 1
12 fi
13
14
15 typeset fileList="Makefile README addr_clean.pl gen_list.c gen_list.h isa.c
16 isa.h main.c malloc_police.c malloc_police.h rec_char.c rec_char.h
17 rec_charptr.c rec_charptr.h rec_double.c rec_double.h rec_long.c
18 rec_long.h rec_malloc_police.c rec_malloc_police.h"
19
20
21 for i in ${fileList}; do
22
23         echo "creating ${i}"
24
25         ####################################
26         ##  sed explained:
27         ##
28         ##              -e "s/^\(#${i}:\)\(.*\)/\2/"
29         ##                      Find lines belonging to
30         ##                      this file and remove the
31         ##                      filename prefix.
32         ##
33         ##              -e "t print"
34         ##                      Jump to label print if the
35         ##                      above s command matched
36         ##
37         ##              -e "d"
38         ##                      This command is skipped
39         ##                      when the s command fails.
40         ##                      This will remove any
41         ##                      non-matching data.
42         ##
43         ##              -e ":print"
44         ##                      The last thing sed does
45         ##                      is print the data.  So,
46         ##                      by now, we only print
47         ##                      lines belonging to the file.
48         ##
49         ####################################
50
51         sed     -e "s/^\(#${i}:\)\(.*\)/\2/" \
52                         -e "t print" \
53                         -e "d" \
54                         -e ":print" \
55                         ${0} > ${i}
56
57 done
58
59 echo "done."
60
61 exit 0
62
63 #Makefile:PROGRAM       = test_list
64 #Makefile:CFLAGS        = -g
65 #Makefile:SRC           = main.c isa.c gen_list.c rec_char.c rec_charptr.c rec_double.c rec_long.c rec_malloc_police.c malloc_police.c
66 #Makefile:OBJS          = main.o isa.o gen_list.o rec_char.o rec_charptr.o rec_double.o rec_long.o rec_malloc_police.o malloc_police.o
67 #Makefile:
68 #Makefile:all : $(PROGRAM)
69 #Makefile:
70 #Makefile:$(PROGRAM) : $(OBJS)
71 #Makefile:      gcc $(CFLAGS) -o $(PROGRAM) $(OBJS)
72 #Makefile:
73 #Makefile:clean:
74 #Makefile:      rm -f $(OBJS)
75 #Makefile:
76 #Makefile:clobber: clean
77 #Makefile:      rm -f $(PROGRAM)
78
79
80 #README:This list supports:
81 #README:        copy construction,
82 #README:        "virtual" destruction,
83 #README:        streaming,
84 #README:        comparison (equal comparison currently supported).
85 #README:
86 #README:With the "object oriented" nature of the list, nodes, and records; it is
87 #README:easily concievable that sorted lists and hash tables could be implemented
88 #README:with little extra effort.
89 #README:
90 #README:
91 #README:Philosophical point:
92 #README:
93 #README:I am sure there is room for improvement with this design.  I am
94 #README:submitting this as a generic doubly linked list recomendation for IJB.
95 #README:Whatever the "collective" decides is fine with me.
96 #README:
97 #README:This implementation uses the "naming space" of gen_list, derived_rec,
98 #README:construct, copy construct, stream, destruct, etc...  These are open to
99 #README:argument.  I just used what was familiar to me and others in the "OO"
100 #README:community.  If these need changed to be adopted ... "so be it".
101 #README:
102 #README:
103 #README:Implementation point:
104 #README:
105 #README:I assume this is too late for a "3.0" release.  As I work for an
106 #README:airline, the whole past summer has been hectic (not to mention the
107 #README:last 4 months); but things have begun to settle down and I am
108 #README:following the IJB lists a bit more closely.  And I would like to say
109 #README:"HOLY CRAP!" .. you guys have accompolished a lot!  Way to go.
110 #README:
111 #README:But, the adoption of a better linked list package should at least be
112 #README:high on the next release list (if not the current one).  If you choose
113 #README:this submission or not, so be it.  But as a "data structure" man, I
114 #README:think IJB's linked lists need addressing.
115 #README:
116 #README:
117 #README:List/Enlist note:
118 #README:
119 #README:I have noticed the list.c file.  If this generic list is adopted, I
120 #README:think all existing functionallity could be duplicated with the
121 #README:"copy_contruct", "equal", and "destruct" `virtuals'.  This would also
122 #README:eliminate and/or enhance the other manually maintained lists in IJB.
123 #README:
124 #README:
125 #README:Debug note:
126 #README:
127 #README:Since the generic list defined a "stream" virtual, it could be programmed
128 #README:that the list could print itself whenever a FATAL error occurs.  A user (or
129 #README:programmer) could read the list and hopefully determine the cause of the
130 #README:abend.
131 #README:
132 #README:
133 #README:Potential note:
134 #README:
135 #README:Think of the possibilites of a linked list, sorted list, and/or a hash
136 #README:list.  Think of a request to a web site that has been referenced
137 #README:before.  If a hash list keep track of all block requests and regexp
138 #README:change commands, then a site could be blocked and/or modified without
139 #README:ever consulting the actions lists again.  What a speed up!
140 #README:
141 #README:What if some of the current lists were kept in sorted lists?  Then a
142 #README:search for a particular record could be a binary search instead of a
143 #README:linear search.
144 #README:
145 #README:The actions file(s) and regexp files(s) could be inserted into the
146 #README:list from front to back order (or visa versa) and the processing would
147 #README:take place in actual file order (which is more natural); rather than
148 #README:in reverse order (as it is today).
149 #README:
150 #README:
151 #README:Thank you for you time and attention to this contribution.  If it is
152 #README:"blessed" by the group, I am available to give time to integrating
153 #README:this into IJB.
154 #README:
155 #README:Let me know what y'all think about this package.
156 #README:
157 #README:-- 
158 #README:Rodney
159
160
161 #addr_clean.pl:#!/usr/bin/perl
162 #addr_clean.pl:
163 #addr_clean.pl:##       *********************************************************************
164 #addr_clean.pl:##       *
165 #addr_clean.pl:##       * File                  :       $Source: /cvsroot/ijbswa/current/contrib.sh,v $
166 #addr_clean.pl:##       *
167 #addr_clean.pl:##       * Purpose               :       Cleans addresses out of ./test_list and replaces
168 #addr_clean.pl:##       *                                               them with "english" replacements.
169 #addr_clean.pl:##       *
170 #addr_clean.pl:##       * Usage                 :       ./test_list | ./addr_clean.pl
171 #addr_clean.pl:##       *
172 #addr_clean.pl:##       * Copyright             :       This program is free software; you can redistribute it 
173 #addr_clean.pl:##       *                                               and/or modify it under the terms of the GNU General
174 #addr_clean.pl:##       *                                               Public License as published by the Free Software
175 #addr_clean.pl:##       *                                               Foundation; either version 2 of the License, or (at
176 #addr_clean.pl:##       *                                               your option) any later version.
177 #addr_clean.pl:##       *
178 #addr_clean.pl:##       *                                               This program is distributed in the hope that it will
179 #addr_clean.pl:##       *                                               be useful, but WITHOUT ANY WARRANTY; without even the
180 #addr_clean.pl:##       *                                               implied warranty of MERCHANTABILITY or FITNESS FOR A
181 #addr_clean.pl:##       *                                               PARTICULAR PURPOSE.     See the GNU General Public
182 #addr_clean.pl:##       *                                               License for more details.
183 #addr_clean.pl:##       *
184 #addr_clean.pl:##       *                                               The GNU General Public License should be included with
185 #addr_clean.pl:##       *                                               this file.      If not, you can view it at
186 #addr_clean.pl:##       *                                               http://www.gnu.org/copyleft/gpl.html
187 #addr_clean.pl:##       *                                               or write to the Free Software Foundation, Inc., 59
188 #addr_clean.pl:##       *                                               Temple Place - Suite 330, Boston, MA  02111-1307, USA.
189 #addr_clean.pl:##       *
190 #addr_clean.pl:##       **********************************************************************/
191 #addr_clean.pl:
192 #addr_clean.pl:use strict;
193 #addr_clean.pl:
194 #addr_clean.pl:
195 #addr_clean.pl:my $nMaxList = 0;
196 #addr_clean.pl:my $nMaxNode = 0;
197 #addr_clean.pl:my $nMaxRec = 0;
198 #addr_clean.pl:my %aaTranslation;
199 #addr_clean.pl:my $strLine;
200 #addr_clean.pl:
201 #addr_clean.pl:while ( $strLine = <STDIN> )
202 #addr_clean.pl:{
203 #addr_clean.pl: if ( $strLine =~ m!(list.*=\s*)(0x[0-9a-f]+)! )
204 #addr_clean.pl: {
205 #addr_clean.pl:         my $str1 = $1;
206 #addr_clean.pl:         my $str2 = $2;
207 #addr_clean.pl:
208 #addr_clean.pl:         if ( ! defined $aaTranslation{$str2} )
209 #addr_clean.pl:         {
210 #addr_clean.pl:                 $aaTranslation{$str2} = "list" . ++ $nMaxList;
211 #addr_clean.pl:         }
212 #addr_clean.pl:         $strLine =~ s!(list.*=\s*)(0x[0-9a-f]+)!$str1($aaTranslation{$str2})!;
213 #addr_clean.pl: }
214 #addr_clean.pl:
215 #addr_clean.pl:
216 #addr_clean.pl: if ( $strLine =~ m!(node.*=\s*)(0x[0-9a-f]+)! )
217 #addr_clean.pl: {
218 #addr_clean.pl:         my $str1 = $1;
219 #addr_clean.pl:         my $str2 = $2;
220 #addr_clean.pl:
221 #addr_clean.pl:         if ( ! defined $aaTranslation{$str2} )
222 #addr_clean.pl:         {
223 #addr_clean.pl:                 $aaTranslation{$str2} = "node" . ++ $nMaxNode;
224 #addr_clean.pl:         }
225 #addr_clean.pl:         $strLine =~ s!(node.*=\s*)(0x[0-9a-f]+)!$str1($aaTranslation{$str2})!;
226 #addr_clean.pl: }
227 #addr_clean.pl:
228 #addr_clean.pl:
229 #addr_clean.pl: if ( $strLine =~ m!(rec.*=\s*(iter_. \.\.\. )?)(0x[0-9a-f]+)! )
230 #addr_clean.pl: {
231 #addr_clean.pl:         my $str1 = $1;
232 #addr_clean.pl:         my $str2 = $3;
233 #addr_clean.pl:
234 #addr_clean.pl:         if ( ! defined $aaTranslation{$str2} )
235 #addr_clean.pl:         {
236 #addr_clean.pl:                 $aaTranslation{$str2} = "rec" . ++ $nMaxRec;
237 #addr_clean.pl:         }
238 #addr_clean.pl:         $strLine =~ s!(rec.*=\s*(iter_. \.\.\. )?)(0x[0-9a-f]+)!$str1($aaTranslation{$str2})!;
239 #addr_clean.pl: }
240 #addr_clean.pl:
241 #addr_clean.pl:
242 #addr_clean.pl: ## Catch the copy constuct syntax
243 #addr_clean.pl:
244 #addr_clean.pl: if ( $strLine =~ m!(list.*=>\s*)(0x[0-9a-f]+)! )
245 #addr_clean.pl: {
246 #addr_clean.pl:         my $str1 = $1;
247 #addr_clean.pl:         my $str2 = $2;
248 #addr_clean.pl:
249 #addr_clean.pl:         if ( ! defined $aaTranslation{$str2} )
250 #addr_clean.pl:         {
251 #addr_clean.pl:                 $aaTranslation{$str2} = "list" . ++ $nMaxList;
252 #addr_clean.pl:         }
253 #addr_clean.pl:         $strLine =~ s!(list.*=>\s*)(0x[0-9a-f]+)!$str1($aaTranslation{$str2})!;
254 #addr_clean.pl: }
255 #addr_clean.pl:
256 #addr_clean.pl:
257 #addr_clean.pl: if ( $strLine =~ m!(node.*=>\s*)(0x[0-9a-f]+)! )
258 #addr_clean.pl: {
259 #addr_clean.pl:         my $str1 = $1;
260 #addr_clean.pl:         my $str2 = $2;
261 #addr_clean.pl:
262 #addr_clean.pl:         if ( ! defined $aaTranslation{$str2} )
263 #addr_clean.pl:         {
264 #addr_clean.pl:                 $aaTranslation{$str2} = "node" . ++ $nMaxNode;
265 #addr_clean.pl:         }
266 #addr_clean.pl:         $strLine =~ s!(node.*=>\s*)(0x[0-9a-f]+)!$str1($aaTranslation{$str2})!;
267 #addr_clean.pl: }
268 #addr_clean.pl:
269 #addr_clean.pl:
270 #addr_clean.pl: if ( $strLine =~ m!(rec.*=>\s*)(0x[0-9a-f]+)! )
271 #addr_clean.pl: {
272 #addr_clean.pl:         my $str1 = $1;
273 #addr_clean.pl:         my $str2 = $2;
274 #addr_clean.pl:
275 #addr_clean.pl:         if ( ! defined $aaTranslation{$str2} )
276 #addr_clean.pl:         {
277 #addr_clean.pl:                 $aaTranslation{$str2} = "rec" . ++ $nMaxRec;
278 #addr_clean.pl:         }
279 #addr_clean.pl:         $strLine =~ s!(rec.*=>\s*)(0x[0-9a-f]+)!$str1($aaTranslation{$str2})!;
280 #addr_clean.pl: }
281 #addr_clean.pl:
282 #addr_clean.pl: print( $strLine );
283 #addr_clean.pl:
284 #addr_clean.pl:}
285
286
287 #gen_list.c:const char gen_list_rcs[] = "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $";
288 #gen_list.c:/*********************************************************************
289 #gen_list.c: *
290 #gen_list.c: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
291 #gen_list.c: *
292 #gen_list.c: * Purpose     :  To create some functions to do generic doubly linked
293 #gen_list.c: *                                          list management.
294 #gen_list.c: *
295 #gen_list.c: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
296 #gen_list.c: *                Privoxy team. http://www.privoxy.org/
297 #gen_list.c: *
298 #gen_list.c: *                This program is free software; you can redistribute it
299 #gen_list.c: *                and/or modify it under the terms of the GNU General
300 #gen_list.c: *                Public License as published by the Free Software
301 #gen_list.c: *                Foundation; either version 2 of the License, or (at
302 #gen_list.c: *                your option) any later version.
303 #gen_list.c: *
304 #gen_list.c: *                This program is distributed in the hope that it will
305 #gen_list.c: *                be useful, but WITHOUT ANY WARRANTY; without even the
306 #gen_list.c: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
307 #gen_list.c: *                PARTICULAR PURPOSE.  See the GNU General Public
308 #gen_list.c: *                License for more details.
309 #gen_list.c: *
310 #gen_list.c: *                The GNU General Public License should be included with
311 #gen_list.c: *                this file.  If not, you can view it at
312 #gen_list.c: *                http://www.gnu.org/copyleft/gpl.html
313 #gen_list.c: *                or write to the Free Software Foundation, Inc., 59
314 #gen_list.c: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
315 #gen_list.c: *
316 #gen_list.c: * VI users         :       Please "set tabstop=3 shiftwidth=3" to view this file,
317 #gen_list.c: *                                          and edit IJB, correctly.
318 #gen_list.c: *
319 #gen_list.c: * Revisions   :
320 #gen_list.c: *    $Log: contrib.sh,v $
321 #gen_list.c: *    Revision 1.2  2002/03/24 13:25:43  swa
322 #gen_list.c: *    name change related issues
323 #gen_list.c: *
324 #gen_list.c: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
325 #gen_list.c: *    A contribution/recomendation to the IJBSWA group for a generic doubly
326 #gen_list.c: *    linked list.  This file is a home brew "bash tar" (I cannot create a
327 #gen_list.c: *    contrib directory and I cannot upload a tarball ... it gets
328 #gen_list.c: *    corrupted).  This script will expand all files needed to create the
329 #gen_list.c: *    linked list modules and an example program.  Please see the README.
330 #gen_list.c: *    Feed back is welcomed.  Enjoy.
331 #gen_list.c: *
332 #gen_list.c: *
333 #gen_list.c: *********************************************************************/
334 #gen_list.c:\f
335 #gen_list.c:
336 #gen_list.c:#include <malloc.h>
337 #gen_list.c:#include <stdio.h>
338 #gen_list.c:#include <stdlib.h>
339 #gen_list.c:#include <string.h>
340 #gen_list.c:
341 #gen_list.c:#include "gen_list.h"
342 #gen_list.c:#include "malloc_police.h"
343 #gen_list.c:
344 #gen_list.c:const char gen_list_h_rcs[] = GEN_LIST_H_VERSION;
345 #gen_list.c:
346 #gen_list.c:
347 #gen_list.c:/* This is used (for the moment) to cut out all the */
348 #gen_list.c:/* extra verbige of the malloc_police module.  After        */
349 #gen_list.c:/* all, we do not want to see construct/destruct of a       */
350 #gen_list.c:/* class that is supposed to be "in the background".        */
351 #gen_list.c:
352 #gen_list.c:/* But it could lead to broader usage.                                              */
353 #gen_list.c:
354 #gen_list.c:int list_is_quiet = 0;
355 #gen_list.c:
356 #gen_list.c:
357 #gen_list.c:#define CALL_VT_REC_COPY_CONSTRUCT(rec)     (((rec_copy_construct)(rec)->vtable[ VT_REC_COPY_CONSTRUCT ])( rec ))
358 #gen_list.c:#define CALL_VT_REC_DESTRUCT(rec)                   (((rec_destruct)(rec)->vtable[ VT_REC_DESTRUCT ])( rec ))
359 #gen_list.c:#define CALL_VT_REC_STREAM(rec)                             (((rec_stream)(rec)->vtable[ VT_REC_STREAM ])( rec ))
360 #gen_list.c:#define CALL_VT_REC_EQUAL(rec,eq_rec)               (((rec_equal)((rec)->vtable[ VT_REC_EQUAL ]))( rec, eq_rec ))
361 #gen_list.c:
362 #gen_list.c:
363 #gen_list.c:/*********************************************************************
364 #gen_list.c: *
365 #gen_list.c: * Function    :  gen_list_rec_construct
366 #gen_list.c: *
367 #gen_list.c: * Description :  Called from a derived list record class ONLY.
368 #gen_list.c: *                                          This function "construct" a classs: malloc_ed,
369 #gen_list.c: *                                          vtable, isa, and sizeof_rec "attributes".
370 #gen_list.c: *
371 #gen_list.c: * Parameters  :
372 #gen_list.c: *          1  :  The record.  If NULL, malloc is called.
373 #gen_list.c: *                          2       :       isa (prounced "is a") ... type of the record.
374 #gen_list.c: *                          3       :       Memory image size of this record.
375 #gen_list.c: *                   ...    :       The "virtuals" for this record.  NOTE: this list
376 #gen_list.c: *                                          may increase if more "virtuals" are added.
377 #gen_list.c: *
378 #gen_list.c: * Returns     :  A pointer to the record (either the orig record
379 #gen_list.c: *                                          or the malloc_ed copy.
380 #gen_list.c: *
381 #gen_list.c: *********************************************************************/
382 #gen_list.c:struct gen_list_rec *gen_list_rec_construct( enum GEN_LIST_ISA isa, int sizeof_rec, const t_vtable _vtable )
383 #gen_list.c:{
384 #gen_list.c:    struct gen_list_rec *this_rec = (struct gen_list_rec *)MALLOC( sizeof_rec );
385 #gen_list.c:    this_rec->vtable                = _vtable;
386 #gen_list.c:    this_rec->isa                   = isa;
387 #gen_list.c:    this_rec->sizeof_rec    = sizeof_rec;
388 #gen_list.c:
389 #gen_list.c:    return( this_rec );
390 #gen_list.c:
391 #gen_list.c:}
392 #gen_list.c:
393 #gen_list.c:
394 #gen_list.c:/*********************************************************************
395 #gen_list.c: *
396 #gen_list.c: * Function    :  gen_list_rec_copy_construct
397 #gen_list.c: *
398 #gen_list.c: * Description :  Makes a copy of the current existing record.  All
399 #gen_list.c: *                                          inherited properties (isa, vtable, malloc_ed, ...)
400 #gen_list.c: *                                          are kept in tact after the copy.
401 #gen_list.c: *
402 #gen_list.c: * Parameters  :
403 #gen_list.c: *          1  :  Existing record.
404 #gen_list.c: *                          2       :  New record.
405 #gen_list.c: *
406 #gen_list.c: * Returns     :  The newly constructed copy record.
407 #gen_list.c: *
408 #gen_list.c: *********************************************************************/
409 #gen_list.c:struct gen_list_rec *gen_list_rec_copy_construct( const struct gen_list_rec *this_rec )
410 #gen_list.c:{
411 #gen_list.c:    struct gen_list_rec *copy_rec = (struct gen_list_rec *)MALLOC( this_rec->sizeof_rec );
412 #gen_list.c:    copy_rec->vtable                = this_rec->vtable;
413 #gen_list.c:    copy_rec->isa                   = this_rec->isa;
414 #gen_list.c:    copy_rec->sizeof_rec    = this_rec->sizeof_rec;
415 #gen_list.c:
416 #gen_list.c:    return( copy_rec );
417 #gen_list.c:
418 #gen_list.c:}
419 #gen_list.c:
420 #gen_list.c:
421 #gen_list.c:/*********************************************************************
422 #gen_list.c: *
423 #gen_list.c: * Function    :  gen_list_rec_destruct
424 #gen_list.c: *
425 #gen_list.c: * Description :  Destruct the record.  Including free_ing the memory
426 #gen_list.c: *                                          if applicable.
427 #gen_list.c: *
428 #gen_list.c: * Parameters  :
429 #gen_list.c: *          1  :  The record.
430 #gen_list.c: *
431 #gen_list.c: * Returns     :  NULL
432 #gen_list.c: *
433 #gen_list.c: *********************************************************************/
434 #gen_list.c:struct gen_list_rec *gen_list_rec_destruct( struct gen_list_rec *this_rec )
435 #gen_list.c:{
436 #gen_list.c:    FREE( this_rec );
437 #gen_list.c:    return( NULL );
438 #gen_list.c:
439 #gen_list.c:}
440 #gen_list.c:
441 #gen_list.c:
442 #gen_list.c:/*********************************************************************
443 #gen_list.c: *
444 #gen_list.c: * Function    :  gen_list_rec_stream
445 #gen_list.c: *
446 #gen_list.c: * Description :  Displays all attributes on the STDOUT stream.
447 #gen_list.c: *
448 #gen_list.c: * Parameters  :
449 #gen_list.c: *          1  :  The record.
450 #gen_list.c: *
451 #gen_list.c: * Returns     :  The record.
452 #gen_list.c: *
453 #gen_list.c: *********************************************************************/
454 #gen_list.c:const struct gen_list_rec *gen_list_rec_stream( const struct gen_list_rec *this_rec )
455 #gen_list.c:{
456 #gen_list.c:    LIST_SHOW( printf( "\t\tstream rec isa = %s\n", isa_ra[ this_rec->isa ] ) );
457 #gen_list.c:    return( this_rec );
458 #gen_list.c:
459 #gen_list.c:}
460 #gen_list.c:
461 #gen_list.c:
462 #gen_list.c:/*********************************************************************
463 #gen_list.c: *
464 #gen_list.c: * Function    :  gen_list_rec_equal
465 #gen_list.c: *
466 #gen_list.c: * Description :  Compares two records to see if they are equal.
467 #gen_list.c: *
468 #gen_list.c: * Parameters  :
469 #gen_list.c: *          1  :  A record.
470 #gen_list.c: *          2  :  Another record.
471 #gen_list.c: *
472 #gen_list.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
473 #gen_list.c: *
474 #gen_list.c: *********************************************************************/
475 #gen_list.c:int gen_list_rec_equal( const struct gen_list_rec *this_rec, const struct gen_list_rec *eq_rec )
476 #gen_list.c:{
477 #gen_list.c:    if ( NULL == this_rec && NULL == eq_rec )
478 #gen_list.c:    {
479 #gen_list.c:            return( 1 );
480 #gen_list.c:    }
481 #gen_list.c:
482 #gen_list.c:    if (    ( NULL == this_rec && NULL != eq_rec )  ||
483 #gen_list.c:                    ( NULL != this_rec && NULL == eq_rec ) )
484 #gen_list.c:    {
485 #gen_list.c:            return( 0 );
486 #gen_list.c:    }
487 #gen_list.c:
488 #gen_list.c:    if (    ( this_rec->isa != eq_rec->isa ) ||
489 #gen_list.c:                    ( this_rec->sizeof_rec != eq_rec->sizeof_rec ) )
490 #gen_list.c:    {
491 #gen_list.c:            LIST_SHOW( printf( "INFORMATION: sorry, but comparing different rec types is unsupported at this time.\n" ) );
492 #gen_list.c:            return( 0 );
493 #gen_list.c:    }
494 #gen_list.c:
495 #gen_list.c:    return( 1 );
496 #gen_list.c:
497 #gen_list.c:}
498 #gen_list.c:
499 #gen_list.c:
500 #gen_list.c:/*\f*********************************************************************/
501 #gen_list.c:
502 #gen_list.c:
503 #gen_list.c:struct gen_list_node
504 #gen_list.c:{
505 #gen_list.c:    /* private: */
506 #gen_list.c:    struct gen_list_node    *next;
507 #gen_list.c:    struct gen_list_node    *prev;
508 #gen_list.c:
509 #gen_list.c:    struct gen_list_rec     *rec;
510 #gen_list.c:};
511 #gen_list.c:/* public: */
512 #gen_list.c:extern struct gen_list_node *                       gen_list_node_construct( struct gen_list_rec *_rec );
513 #gen_list.c:extern struct gen_list_node *                       gen_list_node_copy_construct( const struct gen_list_node *this_node );
514 #gen_list.c:extern struct gen_list_node *                       gen_list_node_destruct( struct gen_list_node *this_node );
515 #gen_list.c:extern struct gen_list_node *                       gen_list_node_remove( struct gen_list_node *this_node );
516 #gen_list.c:
517 #gen_list.c:extern struct gen_list_node *                       gen_list_node_set_next( struct gen_list_node *this_node, struct gen_list_node *_next );
518 #gen_list.c:extern struct gen_list_node *                       gen_list_node_set_prev( struct gen_list_node *this_node, struct gen_list_node *_prev );
519 #gen_list.c:
520 #gen_list.c:extern struct gen_list_node *                       gen_list_node_get_next( const struct gen_list_node *this_node );
521 #gen_list.c:extern struct gen_list_node *                       gen_list_node_get_prev( const struct gen_list_node *this_node );
522 #gen_list.c:
523 #gen_list.c:extern const struct gen_list_rec    *       gen_list_node_stream( const struct gen_list_node *this_node );
524 #gen_list.c:extern int                                                                  gen_list_node_equal( const struct gen_list_node *this_node, const struct gen_list_node *eq_node );
525 #gen_list.c:
526 #gen_list.c:/* struct/class COMPLETE */
527 #gen_list.c:
528 #gen_list.c:
529 #gen_list.c:/*********************************************************************
530 #gen_list.c: *
531 #gen_list.c: * Function    :  gen_list_node_construct
532 #gen_list.c: *
533 #gen_list.c: * Description :  Constructs a generic list node and sets its record.
534 #gen_list.c: *
535 #gen_list.c: * Parameters  :
536 #gen_list.c: *          1  :  The node.  If NULL, malloc is called.
537 #gen_list.c: *          2  :  The nodes record contents.
538 #gen_list.c: *
539 #gen_list.c: * Returns     :  A pointer to the node (either the orig node
540 #gen_list.c: *                                          or the malloc_ed copy.
541 #gen_list.c: *
542 #gen_list.c: *********************************************************************/
543 #gen_list.c:struct gen_list_node *gen_list_node_construct( struct gen_list_rec *_rec )
544 #gen_list.c:{
545 #gen_list.c:    struct gen_list_node *this_node = (struct gen_list_node *)MALLOC( sizeof( struct gen_list_node ) );
546 #gen_list.c:
547 #gen_list.c:    LIST_SHOW( printf( "\
548 #gen_list.c:\tconstruct new node\t\t= %p
549 #gen_list.c:\tconstruct new node->rec\t= %p\n\n", (const void *)this_node, (const void *)_rec ) );
550 #gen_list.c:
551 #gen_list.c:    this_node->rec          = _rec;
552 #gen_list.c:    this_node->next = NULL;
553 #gen_list.c:    this_node->prev = NULL;
554 #gen_list.c:
555 #gen_list.c:    return( this_node );
556 #gen_list.c:
557 #gen_list.c:}
558 #gen_list.c:
559 #gen_list.c:
560 #gen_list.c:/*********************************************************************
561 #gen_list.c: *
562 #gen_list.c: * Function    :  gen_list_node_copy_construct
563 #gen_list.c: *
564 #gen_list.c: * Description :  Makes a copy of the current node.
565 #gen_list.c: *
566 #gen_list.c: * Parameters  :
567 #gen_list.c: *          1  :  Existing node.
568 #gen_list.c: *                          2       :  New node.
569 #gen_list.c: *
570 #gen_list.c: * Returns     :  The newly constructed copy node.
571 #gen_list.c: *
572 #gen_list.c: *********************************************************************/
573 #gen_list.c:struct gen_list_node *gen_list_node_copy_construct( const struct gen_list_node *this_node )
574 #gen_list.c:{
575 #gen_list.c:    struct gen_list_node *copy_node = (struct gen_list_node *)MALLOC( sizeof( struct gen_list_node ) );
576 #gen_list.c:
577 #gen_list.c:    LIST_SHOW( printf( "\tcopy construct new node = %p => %p\n\n", (const void *)this_node, (const void *)copy_node ) );
578 #gen_list.c:
579 #gen_list.c:    copy_node->rec          = CALL_VT_REC_COPY_CONSTRUCT( this_node->rec );
580 #gen_list.c:    copy_node->next = NULL;
581 #gen_list.c:    copy_node->prev = NULL;
582 #gen_list.c:
583 #gen_list.c:    return( copy_node );
584 #gen_list.c:
585 #gen_list.c:}
586 #gen_list.c:
587 #gen_list.c:
588 #gen_list.c:/*********************************************************************
589 #gen_list.c: *
590 #gen_list.c: * Function    :  gen_list_node_destruct
591 #gen_list.c: *
592 #gen_list.c: * Description :  Destruct the node.  Including free_ing the memory
593 #gen_list.c: *                                          if applicable.
594 #gen_list.c: *
595 #gen_list.c: * Parameters  :
596 #gen_list.c: *          1  :  The node.
597 #gen_list.c: *
598 #gen_list.c: * Returns     :  NULL
599 #gen_list.c: *
600 #gen_list.c: *********************************************************************/
601 #gen_list.c:struct gen_list_node *gen_list_node_destruct( struct gen_list_node *this_node )
602 #gen_list.c:{
603 #gen_list.c:    LIST_SHOW( printf( "\
604 #gen_list.c:\tdestruct this_node\t\t\t= %p
605 #gen_list.c:\tdestruct this_node->rec\t\t= %p
606 #gen_list.c:\tdestruct this_node->next\t= %p
607 #gen_list.c:\tdestruct this_node->prev\t= %p\n\n", (const void *)this_node, (const void *)this_node->rec, (const void *)this_node->next, (const void *)this_node->prev ) );
608 #gen_list.c:
609 #gen_list.c:    if ( NULL != this_node->rec )
610 #gen_list.c:    {
611 #gen_list.c:            CALL_VT_REC_DESTRUCT( this_node->rec );
612 #gen_list.c:    }
613 #gen_list.c:
614 #gen_list.c:    FREE( this_node );
615 #gen_list.c:    return( NULL );
616 #gen_list.c:
617 #gen_list.c:}
618 #gen_list.c:
619 #gen_list.c:
620 #gen_list.c:/*********************************************************************
621 #gen_list.c: *
622 #gen_list.c: * Function    :  gen_list_node_remove
623 #gen_list.c: *
624 #gen_list.c: * Description :  Destruct the node.  Including free_ing the memory
625 #gen_list.c: *                                          if applicable.
626 #gen_list.c: *
627 #gen_list.c: * Parameters  :
628 #gen_list.c: *          1  :  The node.
629 #gen_list.c: *
630 #gen_list.c: * Returns     :  NULL
631 #gen_list.c: *
632 #gen_list.c: *********************************************************************/
633 #gen_list.c:struct gen_list_node *gen_list_node_remove( struct gen_list_node *this_node )
634 #gen_list.c:{
635 #gen_list.c:    LIST_SHOW( printf( "\
636 #gen_list.c:\tremove this_node\t\t\t= %p
637 #gen_list.c:\tremove this_node->rec\t= %p
638 #gen_list.c:\tremove this_node->next\t= %p
639 #gen_list.c:\tremove this_node->prev\t= %p\n\n", (const void *)this_node, (const void *)this_node->rec, (const void *)this_node->next, (const void *)this_node->prev ) );
640 #gen_list.c:
641 #gen_list.c:    FREE( this_node );
642 #gen_list.c:    return( NULL );
643 #gen_list.c:
644 #gen_list.c:}
645 #gen_list.c:
646 #gen_list.c:
647 #gen_list.c:/*********************************************************************
648 #gen_list.c: *
649 #gen_list.c: * Function    :  gen_list_node_set_next
650 #gen_list.c: *
651 #gen_list.c: * Description :  Sets the next node in the list series.  Used mainly
652 #gen_list.c: *                                          when constructing and adding/removing nodes.
653 #gen_list.c: *
654 #gen_list.c: * Parameters  :
655 #gen_list.c: *          1  :  The node.
656 #gen_list.c: *          2  :  The next node.
657 #gen_list.c: *
658 #gen_list.c: * Returns     :  The node.
659 #gen_list.c: *
660 #gen_list.c: *********************************************************************/
661 #gen_list.c:struct gen_list_node *gen_list_node_set_next( struct gen_list_node *this_node, struct gen_list_node *_next )
662 #gen_list.c:{
663 #gen_list.c:    this_node->next = _next;
664 #gen_list.c:    return( this_node );
665 #gen_list.c:
666 #gen_list.c:}
667 #gen_list.c:
668 #gen_list.c:
669 #gen_list.c:/*********************************************************************
670 #gen_list.c: *
671 #gen_list.c: * Function    :  gen_list_node_set_prev
672 #gen_list.c: *
673 #gen_list.c: * Description :  Sets the previous node in the list series.  Used mainly
674 #gen_list.c: *                                          when constructing and adding/removing nodes.
675 #gen_list.c: *
676 #gen_list.c: * Parameters  :
677 #gen_list.c: *          1  :  The node.
678 #gen_list.c: *          2  :  The previous node.
679 #gen_list.c: *
680 #gen_list.c: * Returns     :  The node.
681 #gen_list.c: *
682 #gen_list.c: *********************************************************************/
683 #gen_list.c:struct gen_list_node *gen_list_node_set_prev( struct gen_list_node *this_node, struct gen_list_node *_prev )
684 #gen_list.c:{
685 #gen_list.c:    this_node->prev = _prev;
686 #gen_list.c:    return( this_node );
687 #gen_list.c:
688 #gen_list.c:}
689 #gen_list.c:
690 #gen_list.c:
691 #gen_list.c:/*********************************************************************
692 #gen_list.c: *
693 #gen_list.c: * Function    :  gen_list_node_get_next
694 #gen_list.c: *
695 #gen_list.c: * Description :  Gets the next node in the list series.  Used mainly
696 #gen_list.c: *                                          for traversing a list.
697 #gen_list.c: *
698 #gen_list.c: * Parameters  :
699 #gen_list.c: *          1  :  The node.
700 #gen_list.c: *
701 #gen_list.c: * Returns     :  The next node.
702 #gen_list.c: *
703 #gen_list.c: *********************************************************************/
704 #gen_list.c:struct gen_list_node *gen_list_node_get_next( const struct gen_list_node *this_node )
705 #gen_list.c:{
706 #gen_list.c:    return( this_node->next );
707 #gen_list.c:
708 #gen_list.c:}
709 #gen_list.c:
710 #gen_list.c:
711 #gen_list.c:/*********************************************************************
712 #gen_list.c: *
713 #gen_list.c: * Function    :  gen_list_node_get_prev
714 #gen_list.c: *
715 #gen_list.c: * Description :  Gets the previous node in the list series.  Used mainly
716 #gen_list.c: *                                          for traversing a list.
717 #gen_list.c: *
718 #gen_list.c: * Parameters  :
719 #gen_list.c: *          1  :  The node.
720 #gen_list.c: *
721 #gen_list.c: * Returns     :  The previous node.
722 #gen_list.c: *
723 #gen_list.c: *********************************************************************/
724 #gen_list.c:struct gen_list_node *gen_list_node_get_prev( const struct gen_list_node *this_node )
725 #gen_list.c:{
726 #gen_list.c:    return( this_node->prev );
727 #gen_list.c:
728 #gen_list.c:}
729 #gen_list.c:
730 #gen_list.c:
731 #gen_list.c:/*********************************************************************
732 #gen_list.c: *
733 #gen_list.c: * Function    :  gen_list_node_stream
734 #gen_list.c: *
735 #gen_list.c: * Description :  Displays all attributes on the STDOUT stream,
736 #gen_list.c: *                                          including the contents of the nodes record.
737 #gen_list.c: *
738 #gen_list.c: * Parameters  :
739 #gen_list.c: *          1  :  The record.
740 #gen_list.c: *
741 #gen_list.c: * Returns     :  The result of streaming the nodes record.
742 #gen_list.c: *
743 #gen_list.c: *********************************************************************/
744 #gen_list.c:const struct gen_list_rec *gen_list_node_stream( const struct gen_list_node *this_node )
745 #gen_list.c:{
746 #gen_list.c:    LIST_SHOW( printf( "\
747 #gen_list.c:\tstream this_node\t\t\t= %p
748 #gen_list.c:\tstream this_node->rec\t= %p
749 #gen_list.c:\tstream this_node->next\t= %p
750 #gen_list.c:\tstream this_node->prev\t= %p\n\n", (const void *)this_node, (const void *)this_node->rec, (const void *)this_node->next, (const void *)this_node->prev ) );
751 #gen_list.c:
752 #gen_list.c:    return( CALL_VT_REC_STREAM( this_node->rec ) );
753 #gen_list.c:
754 #gen_list.c:}
755 #gen_list.c:
756 #gen_list.c:
757 #gen_list.c:/*********************************************************************
758 #gen_list.c: *
759 #gen_list.c: * Function    :  gen_list_node_equal
760 #gen_list.c: *
761 #gen_list.c: * Description :  Compares two nodes (and their records) to see if they are equal.
762 #gen_list.c: *
763 #gen_list.c: * Parameters  :
764 #gen_list.c: *          1  :  A node.
765 #gen_list.c: *          2  :  Another node.
766 #gen_list.c: *
767 #gen_list.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
768 #gen_list.c: *
769 #gen_list.c: *********************************************************************/
770 #gen_list.c:int gen_list_node_equal( const struct gen_list_node *this_node, const struct gen_list_node *eq_node )
771 #gen_list.c:{
772 #gen_list.c:    if ( NULL == this_node && NULL == eq_node )
773 #gen_list.c:    {
774 #gen_list.c:            return( 1 );
775 #gen_list.c:    }
776 #gen_list.c:
777 #gen_list.c:    if (    ( NULL == this_node && NULL != eq_node ) ||
778 #gen_list.c:                    ( NULL != this_node && NULL == eq_node ) )
779 #gen_list.c:    {
780 #gen_list.c:            return( 0 );
781 #gen_list.c:    }
782 #gen_list.c:
783 #gen_list.c:    return( gen_list_rec_equal( this_node->rec, eq_node->rec ) );
784 #gen_list.c:
785 #gen_list.c:}
786 #gen_list.c:
787 #gen_list.c:
788 #gen_list.c:/*\f*********************************************************************/
789 #gen_list.c:
790 #gen_list.c:
791 #gen_list.c:/* private: */
792 #gen_list.c:/*********************************************************************
793 #gen_list.c: *
794 #gen_list.c: * Function    :  gen_list_insert_node
795 #gen_list.c: *
796 #gen_list.c: * Description :  Inserts a node (not a record!) into a list.  This
797 #gen_list.c: *                                          is (currently) only used in copy construction.
798 #gen_list.c: *
799 #gen_list.c: * Parameters  :
800 #gen_list.c: *          1  :  The list.
801 #gen_list.c: *          2  :  A new node to insert into the list.
802 #gen_list.c: *
803 #gen_list.c: * Returns     :  The node.
804 #gen_list.c: *
805 #gen_list.c: *********************************************************************/
806 #gen_list.c:const struct gen_list_node *gen_list_insert_node( struct gen_list *this_list, struct gen_list_node *node )
807 #gen_list.c:{
808 #gen_list.c:    gen_list_node_set_next( node, NULL );
809 #gen_list.c:
810 #gen_list.c:    if ( NULL == this_list->first )
811 #gen_list.c:    {
812 #gen_list.c:            this_list->first = node;
813 #gen_list.c:    }
814 #gen_list.c:
815 #gen_list.c:    if ( NULL == this_list->last )
816 #gen_list.c:    {
817 #gen_list.c:            this_list->last = node;
818 #gen_list.c:    }
819 #gen_list.c:    else
820 #gen_list.c:    {
821 #gen_list.c:            gen_list_node_set_next( this_list->last, node );
822 #gen_list.c:            gen_list_node_set_prev( node, this_list->last );
823 #gen_list.c:            this_list->last = node;
824 #gen_list.c:    }
825 #gen_list.c:
826 #gen_list.c:    this_list->last = node;
827 #gen_list.c:
828 #gen_list.c:    return( node );
829 #gen_list.c:
830 #gen_list.c:}
831 #gen_list.c:
832 #gen_list.c:
833 #gen_list.c:/*********************************************************************
834 #gen_list.c: *
835 #gen_list.c: * Function    :  gen_list_construct
836 #gen_list.c: *
837 #gen_list.c: * Description :  Constructs a generic list.
838 #gen_list.c: *
839 #gen_list.c: * Parameters  :    None
840 #gen_list.c: *
841 #gen_list.c: * Returns     :  A pointer to the list (either the orig list
842 #gen_list.c: *                                          or the malloc_ed copy.
843 #gen_list.c: *
844 #gen_list.c: *********************************************************************/
845 #gen_list.c:struct gen_list *gen_list_construct()
846 #gen_list.c:{
847 #gen_list.c:    struct gen_list *this_list = (struct gen_list *)MALLOC( sizeof( struct gen_list ) );
848 #gen_list.c:    LIST_SHOW( printf( "construct new list = %p\n\n", (const void *)this_list ) );
849 #gen_list.c:
850 #gen_list.c:    this_list->first        = NULL;
851 #gen_list.c:    this_list->last = NULL;
852 #gen_list.c:
853 #gen_list.c:    return( this_list );
854 #gen_list.c:
855 #gen_list.c:}
856 #gen_list.c:
857 #gen_list.c:
858 #gen_list.c:/*********************************************************************
859 #gen_list.c: *
860 #gen_list.c: * Function    :  gen_list_copy_construct
861 #gen_list.c: *
862 #gen_list.c: * Description :  Makes a copy of the current list.
863 #gen_list.c: *
864 #gen_list.c: * Parameters  :
865 #gen_list.c: *          1  :  Existing list.
866 #gen_list.c: *                          2       :  New list.
867 #gen_list.c: *
868 #gen_list.c: * Returns     :  The newly constructed copy list.
869 #gen_list.c: *
870 #gen_list.c: *********************************************************************/
871 #gen_list.c:struct gen_list *gen_list_copy_construct( const struct gen_list *this_list )
872 #gen_list.c:{
873 #gen_list.c:    struct gen_list_node *curr = this_list->first;
874 #gen_list.c:    struct gen_list *copy_list = (struct gen_list *)MALLOC( sizeof( struct gen_list ) );
875 #gen_list.c:
876 #gen_list.c:    LIST_SHOW( printf( "copy construct new list = %p => %p\n\n", (const void *)this_list, (const void *)copy_list ) );
877 #gen_list.c:
878 #gen_list.c:    copy_list->first        = NULL;
879 #gen_list.c:    copy_list->last = NULL;
880 #gen_list.c:
881 #gen_list.c:
882 #gen_list.c:    while ( NULL != curr )
883 #gen_list.c:    {
884 #gen_list.c:            struct gen_list_node *copy_node = gen_list_node_copy_construct( curr );
885 #gen_list.c:            gen_list_insert_node( copy_list, copy_node );
886 #gen_list.c:            curr = gen_list_node_get_next( curr );
887 #gen_list.c:    }
888 #gen_list.c:
889 #gen_list.c:    return( copy_list );
890 #gen_list.c:
891 #gen_list.c:}
892 #gen_list.c:
893 #gen_list.c:
894 #gen_list.c:/*********************************************************************
895 #gen_list.c: *
896 #gen_list.c: * Function    :  gen_list_destruct
897 #gen_list.c: *
898 #gen_list.c: * Description :  Destruct the list.  Including free_ing the memory
899 #gen_list.c: *                                          if applicable.
900 #gen_list.c: *
901 #gen_list.c: * Parameters  :
902 #gen_list.c: *          1  :  The list.
903 #gen_list.c: *
904 #gen_list.c: * Returns     :  NULL
905 #gen_list.c: *
906 #gen_list.c: *********************************************************************/
907 #gen_list.c:struct gen_list *gen_list_destruct( struct gen_list *this_list )
908 #gen_list.c:{
909 #gen_list.c:    struct gen_list_node *curr = this_list->first;
910 #gen_list.c:
911 #gen_list.c:    LIST_SHOW( printf( "\
912 #gen_list.c:destruct this_list\t\t\t= %p
913 #gen_list.c:destruct this_list->first\t= %p
914 #gen_list.c:destruct this_list->last\t= %p\n\n", (const void *)this_list, (const void *)this_list->first, (const void *)this_list->last ) );
915 #gen_list.c:
916 #gen_list.c:    while ( NULL != curr )
917 #gen_list.c:    {
918 #gen_list.c:            struct gen_list_node *next = gen_list_node_get_next( curr );
919 #gen_list.c:            gen_list_node_destruct( curr );
920 #gen_list.c:            curr = next;
921 #gen_list.c:    }
922 #gen_list.c:
923 #gen_list.c:    FREE( this_list );
924 #gen_list.c:    return( NULL );
925 #gen_list.c:
926 #gen_list.c:}
927 #gen_list.c:
928 #gen_list.c:
929 #gen_list.c:/*********************************************************************
930 #gen_list.c: *
931 #gen_list.c: * Function    :  gen_list_remove_all
932 #gen_list.c: *
933 #gen_list.c: * Description :  Destruct the list.  Including free_ing the memory
934 #gen_list.c: *                                          if applicable.
935 #gen_list.c: *
936 #gen_list.c: * Parameters  :
937 #gen_list.c: *          1  :  The list.
938 #gen_list.c: *
939 #gen_list.c: * Returns     :  NULL
940 #gen_list.c: *
941 #gen_list.c: *********************************************************************/
942 #gen_list.c:struct gen_list *gen_list_remove_all( struct gen_list *this_list )
943 #gen_list.c:{
944 #gen_list.c:    struct gen_list_node *curr = this_list->first;
945 #gen_list.c:
946 #gen_list.c:    LIST_SHOW( printf( "\
947 #gen_list.c:remove_all this_list\t\t\t\t= %p
948 #gen_list.c:remove_all this_list->first\t= %p
949 #gen_list.c:remove_all this_list->last\t\t= %p\n\n", (const void *)this_list, (const void *)this_list->first, (const void *)this_list->last ) );
950 #gen_list.c:
951 #gen_list.c:    while ( NULL != curr )
952 #gen_list.c:    {
953 #gen_list.c:            struct gen_list_node *next = gen_list_node_get_next( curr );
954 #gen_list.c:            gen_list_node_remove( curr );
955 #gen_list.c:            curr = next;
956 #gen_list.c:    }
957 #gen_list.c:
958 #gen_list.c:    this_list->first = this_list->last = NULL;
959 #gen_list.c:    return( this_list );
960 #gen_list.c:
961 #gen_list.c:}
962 #gen_list.c:
963 #gen_list.c:
964 #gen_list.c:/*********************************************************************
965 #gen_list.c: *
966 #gen_list.c: * Function    :  gen_list_remove
967 #gen_list.c: *
968 #gen_list.c: * Description :  A record from the list and return it if found.  This
969 #gen_list.c: *                                          will allow a futher call to rec_destruct.
970 #gen_list.c: *
971 #gen_list.c: * Parameters  :
972 #gen_list.c: *          1  :  The list.
973 #gen_list.c: *          2  :  The record to be removed.
974 #gen_list.c: *
975 #gen_list.c: * Returns     :  rec if found and removed, NULL otherwise.
976 #gen_list.c: *
977 #gen_list.c: *********************************************************************/
978 #gen_list.c:struct gen_list_rec *gen_list_remove( struct gen_list *this_list, struct gen_list_rec *rec )
979 #gen_list.c:{
980 #gen_list.c:    struct gen_list_node    *curr = this_list->first;
981 #gen_list.c:
982 #gen_list.c:    LIST_SHOW( printf( "\
983 #gen_list.c:remove this_list\t\t\t= %p
984 #gen_list.c:remove this_list->first\t= %p
985 #gen_list.c:remove this_list->last\t= %p
986 #gen_list.c:remove rec\t\t\t\t\t= %p\n\n", (const void *)this_list, (const void *)this_list->first, (const void *)this_list->last, rec ) );
987 #gen_list.c:
988 #gen_list.c:    while ( NULL != curr )
989 #gen_list.c:    {
990 #gen_list.c:            /* Grab these values before the are destroyed. */
991 #gen_list.c:            struct gen_list_node    *prev = gen_list_node_get_prev( curr );
992 #gen_list.c:            struct gen_list_node    *next = gen_list_node_get_next( curr );
993 #gen_list.c:
994 #gen_list.c:            /* Access to rec, next, prev of gen_list_node is allowed since it is private to gen_list */
995 #gen_list.c:            if ( curr->rec == rec )
996 #gen_list.c:            {
997 #gen_list.c:                    /* Destruct the node, but not the record. */
998 #gen_list.c:                    gen_list_node_remove( curr );
999 #gen_list.c:
1000 #gen_list.c:                    if ( NULL == prev )
1001 #gen_list.c:                    {
1002 #gen_list.c:                            /************************************************/
1003 #gen_list.c:                            /* This is the first node in the list.                          */
1004 #gen_list.c:                            /*      Picture:                                                                                                */
1005 #gen_list.c:                            /* [first] ---------------------> [next]                        */
1006 #gen_list.c:                            /* [NULL] <---------------------- [next->prev]  */
1007 #gen_list.c:                            /************************************************/
1008 #gen_list.c:                            this_list->first = next;
1009 #gen_list.c:
1010 #gen_list.c:                            if ( NULL == next )
1011 #gen_list.c:                            {
1012 #gen_list.c:                                    /* Since next is NULL, then this is an empty list. */
1013 #gen_list.c:                                    this_list->last = NULL;
1014 #gen_list.c:                            }
1015 #gen_list.c:                            else
1016 #gen_list.c:                            {
1017 #gen_list.c:                                    /* Since next is not NULL, then there is another node to make first. */
1018 #gen_list.c:                                    gen_list_node_set_prev( next, NULL );
1019 #gen_list.c:                            }
1020 #gen_list.c:                    }
1021 #gen_list.c:                    else if ( NULL == next )
1022 #gen_list.c:                    {
1023 #gen_list.c:                            /************************************************/
1024 #gen_list.c:                            /* This is the last node in the list.                           */
1025 #gen_list.c:                            /*      Picture:                                                                                                */
1026 #gen_list.c:                            /* [last] ----------------------> [prev]                        */
1027 #gen_list.c:                            /* [prev->next] ----------------> [NULL]                        */
1028 #gen_list.c:                            /************************************************/
1029 #gen_list.c:                            this_list->last = prev;
1030 #gen_list.c:
1031 #gen_list.c:                            if ( NULL == prev )
1032 #gen_list.c:                            {
1033 #gen_list.c:                                    /* Since prev is NULL, then this is an empty list. */
1034 #gen_list.c:                                    this_list->first = NULL;
1035 #gen_list.c:                            }
1036 #gen_list.c:                            else
1037 #gen_list.c:                            {
1038 #gen_list.c:                                    /* Since prev is NULL, then there is another node to make last. */
1039 #gen_list.c:                                    gen_list_node_set_next( prev, NULL );
1040 #gen_list.c:                            }
1041 #gen_list.c:                    }
1042 #gen_list.c:                    else
1043 #gen_list.c:                    {
1044 #gen_list.c:                            /************************************************/
1045 #gen_list.c:                            /* This is a middle node in the list.                           */
1046 #gen_list.c:                            /*      Picture:                                                                                                */
1047 #gen_list.c:                            /* [prev->next] ----------------> [next]                        */
1048 #gen_list.c:                            /*                                      [removing middle]                                               */
1049 #gen_list.c:                            /* [prev] <---------------------- [next->prev]  */
1050 #gen_list.c:                            /************************************************/
1051 #gen_list.c:                            gen_list_node_set_next( prev, next );
1052 #gen_list.c:                            gen_list_node_set_prev( next, prev );
1053 #gen_list.c:                    }
1054 #gen_list.c:
1055 #gen_list.c:                    return( rec );
1056 #gen_list.c:            }
1057 #gen_list.c:            curr = next;
1058 #gen_list.c:    }
1059 #gen_list.c:
1060 #gen_list.c:    return( NULL );
1061 #gen_list.c:
1062 #gen_list.c:}
1063 #gen_list.c:
1064 #gen_list.c:
1065 #gen_list.c:/*********************************************************************
1066 #gen_list.c: *
1067 #gen_list.c: * Function    :  gen_list_get_first
1068 #gen_list.c: *
1069 #gen_list.c: * Description :  Gets the first record in the list.
1070 #gen_list.c: *
1071 #gen_list.c: * Parameters  :
1072 #gen_list.c: *          1  :  The list.
1073 #gen_list.c: *
1074 #gen_list.c: * Returns     :  The first node.
1075 #gen_list.c: *
1076 #gen_list.c: *********************************************************************/
1077 #gen_list.c:struct gen_list_rec *gen_list_get_first( const struct gen_list *this_list )
1078 #gen_list.c:{
1079 #gen_list.c:    if ( NULL == this_list->first )
1080 #gen_list.c:    {
1081 #gen_list.c:            return( NULL );
1082 #gen_list.c:    }
1083 #gen_list.c:
1084 #gen_list.c:    /* Access to rec of gen_list_node is allowed since it is private to gen_list */
1085 #gen_list.c:    return( this_list->first->rec );
1086 #gen_list.c:
1087 #gen_list.c:}
1088 #gen_list.c:
1089 #gen_list.c:
1090 #gen_list.c:/*********************************************************************
1091 #gen_list.c: *
1092 #gen_list.c: * Function    :  gen_list_get_last
1093 #gen_list.c: *
1094 #gen_list.c: * Description :  Gets the last record in the list.
1095 #gen_list.c: *
1096 #gen_list.c: * Parameters  :
1097 #gen_list.c: *          1  :  The list.
1098 #gen_list.c: *
1099 #gen_list.c: * Returns     :  The last node.
1100 #gen_list.c: *
1101 #gen_list.c: *********************************************************************/
1102 #gen_list.c:struct gen_list_rec *gen_list_get_last( const struct gen_list *this_list )
1103 #gen_list.c:{
1104 #gen_list.c:    if ( NULL == this_list->last )
1105 #gen_list.c:    {
1106 #gen_list.c:            return( NULL );
1107 #gen_list.c:    }
1108 #gen_list.c:
1109 #gen_list.c:    /* Access to rec of gen_list_node is allowed since it is private to gen_list */
1110 #gen_list.c:    return( this_list->last->rec );
1111 #gen_list.c:
1112 #gen_list.c:}
1113 #gen_list.c:
1114 #gen_list.c:
1115 #gen_list.c:/*********************************************************************
1116 #gen_list.c: *
1117 #gen_list.c: * Function    :  gen_list_insert
1118 #gen_list.c: *
1119 #gen_list.c: * Description :  Inserts a record into the list.  This is the
1120 #gen_list.c: *                                          primary API interface for inserting a record.
1121 #gen_list.c: *
1122 #gen_list.c: * Parameters  :
1123 #gen_list.c: *          1  :  The list.
1124 #gen_list.c: *          2  :  A new record to insert into the list.
1125 #gen_list.c: *
1126 #gen_list.c: * Returns     :  The node.
1127 #gen_list.c: *
1128 #gen_list.c: *********************************************************************/
1129 #gen_list.c:const struct gen_list_node *gen_list_insert( struct gen_list *this_list, struct gen_list_rec *_rec )
1130 #gen_list.c:{
1131 #gen_list.c:    return( gen_list_insert_node( this_list, gen_list_node_construct( _rec ) ) );
1132 #gen_list.c:
1133 #gen_list.c:}
1134 #gen_list.c:
1135 #gen_list.c:
1136 #gen_list.c:/*********************************************************************
1137 #gen_list.c: *
1138 #gen_list.c: * Function    :  gen_list_stream
1139 #gen_list.c: *
1140 #gen_list.c: * Description :  Displays all attributes on the STDOUT stream,
1141 #gen_list.c: *                                          including the contents of the nodes.
1142 #gen_list.c: *
1143 #gen_list.c: * Parameters  :
1144 #gen_list.c: *          1  :  The list.
1145 #gen_list.c: *
1146 #gen_list.c: * Returns     :  The list.
1147 #gen_list.c: *
1148 #gen_list.c: *********************************************************************/
1149 #gen_list.c:const struct gen_list *gen_list_stream( const struct gen_list *this_list )
1150 #gen_list.c:{
1151 #gen_list.c:    const struct gen_list_node *curr = this_list->first;
1152 #gen_list.c:
1153 #gen_list.c:    LIST_SHOW( printf( "\
1154 #gen_list.c:stream this_list\t\t\t= %p
1155 #gen_list.c:stream this_list->first\t= %p
1156 #gen_list.c:stream this_list->last\t= %p\n\n", (const void *)this_list, (const void *)this_list->first, (const void *)this_list->last ) );
1157 #gen_list.c:
1158 #gen_list.c:    while ( NULL != curr )
1159 #gen_list.c:    {
1160 #gen_list.c:            struct gen_list_node    *next = gen_list_node_get_next( curr );
1161 #gen_list.c:            gen_list_node_stream( curr );
1162 #gen_list.c:            curr = next;
1163 #gen_list.c:    }
1164 #gen_list.c:
1165 #gen_list.c:    return( this_list );
1166 #gen_list.c:
1167 #gen_list.c:}
1168 #gen_list.c:
1169 #gen_list.c:
1170 #gen_list.c:/*********************************************************************
1171 #gen_list.c: *
1172 #gen_list.c: * Function    :  gen_list_equal
1173 #gen_list.c: *
1174 #gen_list.c: * Description :  Compares two lists (and their nodes) to see if they are equal.
1175 #gen_list.c: *
1176 #gen_list.c: * Parameters  :
1177 #gen_list.c: *          1  :  A list.
1178 #gen_list.c: *          2  :  Another list.
1179 #gen_list.c: *
1180 #gen_list.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
1181 #gen_list.c: *
1182 #gen_list.c: *********************************************************************/
1183 #gen_list.c:int gen_list_equal( const struct gen_list *this_list, const struct gen_list *eq_list )
1184 #gen_list.c:{
1185 #gen_list.c:    struct gen_list_node *c1 = this_list->first;
1186 #gen_list.c:    struct gen_list_node *c2 = eq_list->first;
1187 #gen_list.c:    int eq = 1;
1188 #gen_list.c:
1189 #gen_list.c:    if ( ( NULL == c1 && NULL != c2 ) || ( NULL != c1 && NULL == c2 ) )
1190 #gen_list.c:    {
1191 #gen_list.c:            return( 0 );
1192 #gen_list.c:    }
1193 #gen_list.c:
1194 #gen_list.c:    while ( ( eq ) && ( NULL != c1 ) && ( NULL != c2 ) )
1195 #gen_list.c:    {
1196 #gen_list.c:            /* Access to rec of gen_list_node is allowed since it is private to gen_list */
1197 #gen_list.c:            eq = CALL_VT_REC_EQUAL( c1->rec, c2->rec );
1198 #gen_list.c:            if ( NULL != c1 )
1199 #gen_list.c:            {
1200 #gen_list.c:                    c1 = gen_list_node_get_next( c1 );
1201 #gen_list.c:            }
1202 #gen_list.c:
1203 #gen_list.c:            if ( NULL != c2 )
1204 #gen_list.c:            {
1205 #gen_list.c:                    c2 = gen_list_node_get_next( c2 );
1206 #gen_list.c:            }
1207 #gen_list.c:
1208 #gen_list.c:    }
1209 #gen_list.c:
1210 #gen_list.c:    if ( NULL == c1 && NULL == c2 )
1211 #gen_list.c:    {
1212 #gen_list.c:            return( 1 );
1213 #gen_list.c:    }
1214 #gen_list.c:
1215 #gen_list.c:    return( eq );
1216 #gen_list.c:
1217 #gen_list.c:}
1218 #gen_list.c:
1219 #gen_list.c:
1220 #gen_list.c:/*********************************************************************
1221 #gen_list.c: *
1222 #gen_list.c: * Function    :  gen_list_find
1223 #gen_list.c: *
1224 #gen_list.c: * Description :  Find a record that matches the one passed to this
1225 #gen_list.c: *                                          function.
1226 #gen_list.c: *                                          NOTE: this function receives a RECORD and not a NODE.
1227 #gen_list.c: *                                          Some implementation issues might be easier addressed
1228 #gen_list.c: *                                          if a node was passed ... but for the time being, I
1229 #gen_list.c: *                                          would like to keep the use/programmer isolated from
1230 #gen_list.c: *                                          the node structure/class.
1231 #gen_list.c: *
1232 #gen_list.c: * Parameters  :
1233 #gen_list.c: *          1  :  The list.
1234 #gen_list.c: *          2  :  The record to find.
1235 #gen_list.c: *
1236 #gen_list.c: * Returns     :  NULL => none found, anything else is a pointer to the record.
1237 #gen_list.c: *
1238 #gen_list.c: *********************************************************************/
1239 #gen_list.c:struct gen_list_rec *gen_list_find( const struct gen_list *this_list, struct gen_list_rec *rec )
1240 #gen_list.c:{
1241 #gen_list.c:    const struct gen_list_node *curr = this_list->first;
1242 #gen_list.c:    int eq = 0;
1243 #gen_list.c:
1244 #gen_list.c:    if ( NULL == curr && NULL == rec )
1245 #gen_list.c:    {
1246 #gen_list.c:            return( (struct gen_list_rec *)1 );
1247 #gen_list.c:    }
1248 #gen_list.c:
1249 #gen_list.c:    if (    ( NULL == curr && NULL != rec ) ||
1250 #gen_list.c:                    ( NULL != curr && NULL == rec ) )
1251 #gen_list.c:    {
1252 #gen_list.c:            return( 0 );
1253 #gen_list.c:    }
1254 #gen_list.c:
1255 #gen_list.c:    /* Access to rec of gen_list_node is allowed since it is private to gen_list */
1256 #gen_list.c:    if ( curr->rec->isa != rec->isa )
1257 #gen_list.c:    {
1258 #gen_list.c:            LIST_SHOW( printf( "INFORMATION: sorry, but comparing different list types is unsupported at this time.\n" ) );
1259 #gen_list.c:            return( 0 );
1260 #gen_list.c:    }
1261 #gen_list.c:
1262 #gen_list.c:    if ( NULL == curr )
1263 #gen_list.c:    {
1264 #gen_list.c:            return( NULL );
1265 #gen_list.c:    }
1266 #gen_list.c:
1267 #gen_list.c:
1268 #gen_list.c:    while ( ( !eq ) && ( NULL != curr ) )
1269 #gen_list.c:    {
1270 #gen_list.c:            struct gen_list_node    *next = gen_list_node_get_next( curr );
1271 #gen_list.c:
1272 #gen_list.c:            eq = CALL_VT_REC_EQUAL( curr->rec, rec );
1273 #gen_list.c:
1274 #gen_list.c:            if ( eq )
1275 #gen_list.c:            {
1276 #gen_list.c:                    return( curr->rec );
1277 #gen_list.c:            }
1278 #gen_list.c:
1279 #gen_list.c:            curr = next;
1280 #gen_list.c:
1281 #gen_list.c:    }
1282 #gen_list.c:
1283 #gen_list.c:    return( NULL );
1284 #gen_list.c:
1285 #gen_list.c:}
1286 #gen_list.c:
1287 #gen_list.c:
1288 #gen_list.c:/*********************************************************************
1289 #gen_list.c: *
1290 #gen_list.c: * Function    :  gen_list_iterate
1291 #gen_list.c: *
1292 #gen_list.c: * Description :  Pass over the list, calling "iter" for every record.
1293 #gen_list.c: *                                          If the "iter" function returns a non-NULL value,
1294 #gen_list.c: *                                          return it and stop iterating.
1295 #gen_list.c: *
1296 #gen_list.c: * Parameters  :
1297 #gen_list.c: *          1  :  The list.
1298 #gen_list.c: *          2  :  The iterator function.
1299 #gen_list.c: *
1300 #gen_list.c: * Returns     :  Whatever the iterator does, or NULL if the entire
1301 #gen_list.c: *                                          list was processed.
1302 #gen_list.c: *
1303 #gen_list.c: *********************************************************************/
1304 #gen_list.c:struct gen_list_rec *gen_list_iterate( struct gen_list *this_list, rec_iterate iter )
1305 #gen_list.c:{
1306 #gen_list.c:    struct gen_list_node *curr = this_list->first;
1307 #gen_list.c:
1308 #gen_list.c:    if ( NULL == curr )
1309 #gen_list.c:    {
1310 #gen_list.c:            return( NULL );
1311 #gen_list.c:    }
1312 #gen_list.c:
1313 #gen_list.c:    while ( NULL != curr )
1314 #gen_list.c:    {
1315 #gen_list.c:            /* Access to rec of gen_list_node is allowed since it is private to gen_list */
1316 #gen_list.c:            struct gen_list_node    *next = gen_list_node_get_next( curr );
1317 #gen_list.c:            struct gen_list_rec *r = iter( curr->rec );
1318 #gen_list.c:
1319 #gen_list.c:            if ( NULL != r )
1320 #gen_list.c:            {
1321 #gen_list.c:                    return( r );
1322 #gen_list.c:            }
1323 #gen_list.c:
1324 #gen_list.c:            curr = next;
1325 #gen_list.c:
1326 #gen_list.c:    }
1327 #gen_list.c:
1328 #gen_list.c:    return( NULL );
1329 #gen_list.c:
1330 #gen_list.c:}
1331 #gen_list.c:
1332 #gen_list.c:
1333 #gen_list.c:/*********************************************************************
1334 #gen_list.c: *
1335 #gen_list.c: * Function    :  gen_list_iterate
1336 #gen_list.c: *
1337 #gen_list.c: * Description :  Pass over the list (in reverse order), calling "iter"
1338 #gen_list.c: *                                          for every record.  If the "iter" function returns
1339 #gen_list.c: *                                          a non-NULL value, return it and stop iterating.
1340 #gen_list.c: *
1341 #gen_list.c: * Parameters  :
1342 #gen_list.c: *          1  :  The list.
1343 #gen_list.c: *          2  :  The iterator function.
1344 #gen_list.c: *
1345 #gen_list.c: * Returns     :  Whatever the iterator does, or NULL if the entire
1346 #gen_list.c: *                                          list was processed.
1347 #gen_list.c: *
1348 #gen_list.c: *********************************************************************/
1349 #gen_list.c:struct gen_list_rec *gen_list_iterate_reverse( struct gen_list *this_list, rec_iterate iter )
1350 #gen_list.c:{
1351 #gen_list.c:    struct gen_list_node *curr = this_list->last;
1352 #gen_list.c:
1353 #gen_list.c:    if ( NULL == curr )
1354 #gen_list.c:    {
1355 #gen_list.c:            return( NULL );
1356 #gen_list.c:    }
1357 #gen_list.c:
1358 #gen_list.c:    while ( NULL != curr )
1359 #gen_list.c:    {
1360 #gen_list.c:            /* Access to rec of gen_list_node is allowed since it is private to gen_list */
1361 #gen_list.c:            struct gen_list_node    *prev = gen_list_node_get_prev( curr );
1362 #gen_list.c:            struct gen_list_rec *r = iter( curr->rec );
1363 #gen_list.c:
1364 #gen_list.c:            if ( NULL != r )
1365 #gen_list.c:            {
1366 #gen_list.c:                    return( r );
1367 #gen_list.c:            }
1368 #gen_list.c:
1369 #gen_list.c:            curr = prev;
1370 #gen_list.c:
1371 #gen_list.c:    }
1372 #gen_list.c:
1373 #gen_list.c:    return( NULL );
1374 #gen_list.c:
1375 #gen_list.c:}
1376
1377
1378 #gen_list.h:#ifndef GEN_LIST_H_INCLUDED
1379 #gen_list.h:#define GEN_LIST_H_INCLUDED
1380 #gen_list.h:#define GEN_LIST_H_VERSION "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $"
1381 #gen_list.h:/*********************************************************************
1382 #gen_list.h: *
1383 #gen_list.h: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
1384 #gen_list.h: *
1385 #gen_list.h: * Purpose     :  To create some functions to do generic doubly linked
1386 #gen_list.h: *                                          list management.
1387 #gen_list.h: *
1388 #gen_list.h: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1389 #gen_list.h: *                Privoxy team. http://www.privoxy.org/
1390 #gen_list.h: *
1391 #gen_list.h: *                This program is free software; you can redistribute it
1392 #gen_list.h: *                and/or modify it under the terms of the GNU General
1393 #gen_list.h: *                Public License as published by the Free Software
1394 #gen_list.h: *                Foundation; either version 2 of the License, or (at
1395 #gen_list.h: *                your option) any later version.
1396 #gen_list.h: *
1397 #gen_list.h: *                This program is distributed in the hope that it will
1398 #gen_list.h: *                be useful, but WITHOUT ANY WARRANTY; without even the
1399 #gen_list.h: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1400 #gen_list.h: *                PARTICULAR PURPOSE.  See the GNU General Public
1401 #gen_list.h: *                License for more details.
1402 #gen_list.h: *
1403 #gen_list.h: *                The GNU General Public License should be included with
1404 #gen_list.h: *                this file.  If not, you can view it at
1405 #gen_list.h: *                http://www.gnu.org/copyleft/gpl.html
1406 #gen_list.h: *                or write to the Free Software Foundation, Inc., 59
1407 #gen_list.h: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1408 #gen_list.h: *
1409 #gen_list.h: * VI users         :       Please "set tabstop=3 shiftwidth=3" to view this file,
1410 #gen_list.h: *                                          and edit IJB, correctly.
1411 #gen_list.h: *
1412 #gen_list.h: * Revisions   :
1413 #gen_list.h: *    $Log: contrib.sh,v $
1414 #gen_list.h: *    Revision 1.2  2002/03/24 13:25:43  swa
1415 #gen_list.h: *    name change related issues
1416 #gen_list.h: *
1417 #gen_list.h: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
1418 #gen_list.h: *    A contribution/recomendation to the IJBSWA group for a generic doubly
1419 #gen_list.h: *    linked list.  This file is a home brew "bash tar" (I cannot create a
1420 #gen_list.h: *    contrib directory and I cannot upload a tarball ... it gets
1421 #gen_list.h: *    corrupted).  This script will expand all files needed to create the
1422 #gen_list.h: *    linked list modules and an example program.  Please see the README.
1423 #gen_list.h: *    Feed back is welcomed.  Enjoy.
1424 #gen_list.h: *
1425 #gen_list.h: *
1426 #gen_list.h: *********************************************************************/
1427 #gen_list.h:\f
1428 #gen_list.h:
1429 #gen_list.h:#ifdef __cplusplus
1430 #gen_list.h:extern "C" {
1431 #gen_list.h:#endif
1432 #gen_list.h:
1433 #gen_list.h:#include "isa.h"
1434 #gen_list.h:
1435 #gen_list.h:
1436 #gen_list.h:extern int list_is_quiet;
1437 #gen_list.h:
1438 #gen_list.h:#define LIST_SHOW(stmt)  if ( ! list_is_quiet ) { stmt; }
1439 #gen_list.h:
1440 #gen_list.h:
1441 #gen_list.h:struct gen_list_rec;
1442 #gen_list.h:typedef struct gen_list_rec *                       (*rec_copy_construct)( struct gen_list_rec *copy_rec );
1443 #gen_list.h:typedef struct gen_list_rec *                       (*rec_destruct)( struct gen_list_rec *this_rec );
1444 #gen_list.h:typedef const struct gen_list_rec * (*rec_stream)( const struct gen_list_rec *this_rec );
1445 #gen_list.h:typedef int                                                                 (*rec_equal)( const struct gen_list_rec *this_rec, const struct gen_list_rec *eq_rec );
1446 #gen_list.h:typedef struct gen_list_rec *                       (*rec_iterate)( struct gen_list_rec *this_rec );
1447 #gen_list.h:
1448 #gen_list.h:typedef void * (*rec_method)( void *this_rec, ... );
1449 #gen_list.h:
1450 #gen_list.h:
1451 #gen_list.h:enum VT_ENTRIES
1452 #gen_list.h:{
1453 #gen_list.h:    VT_REC_COPY_CONSTRUCT,
1454 #gen_list.h:    VT_REC_DESTRUCT,
1455 #gen_list.h:    VT_REC_STREAM,
1456 #gen_list.h:    VT_REC_EQUAL,
1457 #gen_list.h:    VT_REC_MAX
1458 #gen_list.h:};
1459 #gen_list.h:
1460 #gen_list.h:
1461 #gen_list.h:typedef const rec_method *t_vtable;
1462 #gen_list.h:
1463 #gen_list.h:
1464 #gen_list.h:struct gen_list_rec
1465 #gen_list.h:{
1466 #gen_list.h:    /* private: */
1467 #gen_list.h:    t_vtable vtable;
1468 #gen_list.h:    enum GEN_LIST_ISA isa;
1469 #gen_list.h:    int sizeof_rec;
1470 #gen_list.h:    /* contents HERE */
1471 #gen_list.h:};
1472 #gen_list.h:/* public: */
1473 #gen_list.h:extern struct gen_list_rec *                        gen_list_rec_construct( enum GEN_LIST_ISA isa, int sizeof_rec, const t_vtable _vtable );
1474 #gen_list.h:extern struct gen_list_rec *                        gen_list_rec_copy_construct( const struct gen_list_rec *this_rec );
1475 #gen_list.h:extern struct gen_list_rec *                        gen_list_rec_destruct( struct gen_list_rec *this_rec );
1476 #gen_list.h:extern const struct gen_list_rec *  gen_list_rec_stream( const struct gen_list_rec *this_rec );
1477 #gen_list.h:extern int                                                                  gen_list_rec_equal( const struct gen_list_rec *this_rec, const struct gen_list_rec *eq_rec );
1478 #gen_list.h:
1479 #gen_list.h:/* struct/class COMPLETE */
1480 #gen_list.h:
1481 #gen_list.h:
1482 #gen_list.h:/*\f*********************************************************************/
1483 #gen_list.h:
1484 #gen_list.h:/* private: to gen_list */
1485 #gen_list.h:struct gen_list_node;
1486 #gen_list.h:
1487 #gen_list.h:
1488 #gen_list.h:struct gen_list
1489 #gen_list.h:{
1490 #gen_list.h:    /* private: */
1491 #gen_list.h:    struct gen_list_node *first;
1492 #gen_list.h:    struct gen_list_node *last;
1493 #gen_list.h:};
1494 #gen_list.h:/* gen_list_insert_node */
1495 #gen_list.h:
1496 #gen_list.h:/* public: */
1497 #gen_list.h:extern struct gen_list *                            gen_list_construct();
1498 #gen_list.h:extern struct gen_list *                            gen_list_copy_construct( const struct gen_list *this_list );
1499 #gen_list.h:extern struct gen_list *                            gen_list_destruct( struct gen_list *this_list );
1500 #gen_list.h:extern struct gen_list *                            gen_list_remove_all( struct gen_list *this_list );
1501 #gen_list.h:extern struct gen_list_rec *                        gen_list_remove( struct gen_list *this_list, struct gen_list_rec *_rec );
1502 #gen_list.h:extern struct gen_list_rec *                        gen_list_get_first( const struct gen_list *this_list );
1503 #gen_list.h:extern struct gen_list_rec *                        gen_list_get_last( const struct gen_list *this_list );
1504 #gen_list.h:extern const struct gen_list_node * gen_list_insert( struct gen_list *this_list, struct gen_list_rec *_rec );
1505 #gen_list.h:extern const struct gen_list *              gen_list_stream( const struct gen_list *this_list );
1506 #gen_list.h:extern int                                                                  gen_list_equal( const struct gen_list *this_list, const struct gen_list *eq_list );
1507 #gen_list.h:extern struct gen_list_rec *                        gen_list_find( const struct gen_list *this_list, struct gen_list_rec *rec );
1508 #gen_list.h:extern struct gen_list_rec *                        gen_list_iterate( struct gen_list *this_list, rec_iterate iter );
1509 #gen_list.h:/* struct/class COMPLETE */
1510 #gen_list.h:
1511 #gen_list.h:
1512 #gen_list.h:#ifdef __cplusplus
1513 #gen_list.h:} /* extern "C" */
1514 #gen_list.h:#endif
1515 #gen_list.h:
1516 #gen_list.h:#endif /* ndef GEN_LIST_H_INCLUDED */
1517 #gen_list.h:
1518 #gen_list.h:/*
1519 #gen_list.h:  Local Variables:
1520 #gen_list.h:  tab-width: 3
1521 #gen_list.h:  end:
1522 #gen_list.h:*/
1523
1524
1525 #isa.c:const char isa_rcs[] = "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $";
1526 #isa.c:/*********************************************************************
1527 #isa.c: *
1528 #isa.c: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
1529 #isa.c: *
1530 #isa.c: * Purpose     :  Pronounced "is a".  To create "english" translations
1531 #isa.c: *                                               for all linked "classes".
1532 #isa.c: *
1533 #isa.c: *                                               NOTE:   this header file must appear once and only once
1534 #isa.c: *                                                               per project.
1535 #isa.c: *
1536 #isa.c: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1537 #isa.c: *                Privoxy team. http://www.privoxy.org/
1538 #isa.c: *
1539 #isa.c: *                This program is free software; you can redistribute it
1540 #isa.c: *                and/or modify it under the terms of the GNU General
1541 #isa.c: *                Public License as published by the Free Software
1542 #isa.c: *                Foundation; either version 2 of the License, or (at
1543 #isa.c: *                your option) any later version.
1544 #isa.c: *
1545 #isa.c: *                This program is distributed in the hope that it will
1546 #isa.c: *                be useful, but WITHOUT ANY WARRANTY; without even the
1547 #isa.c: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1548 #isa.c: *                PARTICULAR PURPOSE.  See the GNU General Public
1549 #isa.c: *                License for more details.
1550 #isa.c: *
1551 #isa.c: *                The GNU General Public License should be included with
1552 #isa.c: *                this file.  If not, you can view it at
1553 #isa.c: *                http://www.gnu.org/copyleft/gpl.html
1554 #isa.c: *                or write to the Free Software Foundation, Inc., 59
1555 #isa.c: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1556 #isa.c: *
1557 #isa.c: * VI users              :       Please "set tabstop=3 shiftwidth=3" to view this file,
1558 #isa.c: *                                               and edit IJB, correctly.
1559 #isa.c: *
1560 #isa.c: * Revisions   :
1561 #isa.c: *    $Log: contrib.sh,v $
1562 #isa.c: *    Revision 1.2  2002/03/24 13:25:43  swa
1563 #isa.c: *    name change related issues
1564 #isa.c: *
1565 #isa.c: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
1566 #isa.c: *    A contribution/recomendation to the IJBSWA group for a generic doubly
1567 #isa.c: *    linked list.  This file is a home brew "bash tar" (I cannot create a
1568 #isa.c: *    contrib directory and I cannot upload a tarball ... it gets
1569 #isa.c: *    corrupted).  This script will expand all files needed to create the
1570 #isa.c: *    linked list modules and an example program.  Please see the README.
1571 #isa.c: *    Feed back is welcomed.  Enjoy.
1572 #isa.c: *
1573 #isa.c: *    Revision 1.1  2001/11/30 21:55:51  rodney
1574 #isa.c: *    Initial revision
1575 #isa.c: *
1576 #isa.c: *
1577 #isa.c: *********************************************************************/
1578 #isa.c:\f
1579 #isa.c:
1580 #isa.c:#include <malloc.h>
1581 #isa.c:#include <stdio.h>
1582 #isa.c:#include <stdlib.h>
1583 #isa.c:#include <string.h>
1584 #isa.c:
1585 #isa.c:#include "gen_list.h"
1586 #isa.c:#include "isa.h"
1587 #isa.c:
1588 #isa.c:const char isa_h_rcs[] = ISA_H_VERSION;
1589 #isa.c:
1590 #isa.c:
1591 #isa.c:/* Pronounce "ra" phonectically and you get "array", which this variable is. */
1592 #isa.c:char *isa_ra[] =
1593 #isa.c:{
1594 #isa.c: "GEN_LIST_REC",
1595 #isa.c: "REC_MALLOC_POLICE",
1596 #isa.c: "REC_CHAR",
1597 #isa.c: "REC_CHARPTR",
1598 #isa.c: "REC_DOUBLE",
1599 #isa.c: "REC_LONG",
1600 #isa.c: NULL
1601 #isa.c:};
1602
1603
1604 #isa.h:#ifndef ISA_H_INCLUDED
1605 #isa.h:#define ISA_H_INCLUDED
1606 #isa.h:#define ISA_H_VERSION "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $"
1607 #isa.h:/*********************************************************************
1608 #isa.h: *
1609 #isa.h: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
1610 #isa.h: *
1611 #isa.h: * Purpose     :  Pronounced "is a".  To create "english" translations
1612 #isa.h: *                                               for all linked "classes".
1613 #isa.h: *
1614 #isa.h: *                                               NOTE:   this header file must appear once and only once
1615 #isa.h: *                                                               per project.
1616 #isa.h: *
1617 #isa.h: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1618 #isa.h: *                Privoxy team. http://www.privoxy.org/
1619 #isa.h: *
1620 #isa.h: *                This program is free software; you can redistribute it
1621 #isa.h: *                and/or modify it under the terms of the GNU General
1622 #isa.h: *                Public License as published by the Free Software
1623 #isa.h: *                Foundation; either version 2 of the License, or (at
1624 #isa.h: *                your option) any later version.
1625 #isa.h: *
1626 #isa.h: *                This program is distributed in the hope that it will
1627 #isa.h: *                be useful, but WITHOUT ANY WARRANTY; without even the
1628 #isa.h: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1629 #isa.h: *                PARTICULAR PURPOSE.  See the GNU General Public
1630 #isa.h: *                License for more details.
1631 #isa.h: *
1632 #isa.h: *                The GNU General Public License should be included with
1633 #isa.h: *                this file.  If not, you can view it at
1634 #isa.h: *                http://www.gnu.org/copyleft/gpl.html
1635 #isa.h: *                or write to the Free Software Foundation, Inc., 59
1636 #isa.h: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1637 #isa.h: *
1638 #isa.h: * VI users              :       Please "set tabstop=3 shiftwidth=3" to view this file,
1639 #isa.h: *                                               and edit IJB, correctly.
1640 #isa.h: *
1641 #isa.h: * Revisions   :
1642 #isa.h: *    $Log: contrib.sh,v $
1643 #isa.h: *    Revision 1.2  2002/03/24 13:25:43  swa
1644 #isa.h: *    name change related issues
1645 #isa.h: *
1646 #isa.h: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
1647 #isa.h: *    A contribution/recomendation to the IJBSWA group for a generic doubly
1648 #isa.h: *    linked list.  This file is a home brew "bash tar" (I cannot create a
1649 #isa.h: *    contrib directory and I cannot upload a tarball ... it gets
1650 #isa.h: *    corrupted).  This script will expand all files needed to create the
1651 #isa.h: *    linked list modules and an example program.  Please see the README.
1652 #isa.h: *    Feed back is welcomed.  Enjoy.
1653 #isa.h: *
1654 #isa.h: *
1655 #isa.h: *********************************************************************/
1656 #isa.h:\f
1657 #isa.h:
1658 #isa.h:#ifdef __cplusplus
1659 #isa.h:extern "C" {
1660 #isa.h:#endif
1661 #isa.h:
1662 #isa.h:
1663 #isa.h:enum GEN_LIST_ISA
1664 #isa.h:{
1665 #isa.h: ISA_GEN_LIST_REC,
1666 #isa.h: ISA_MALLOC_POLICE,
1667 #isa.h: ISA_CHAR,
1668 #isa.h: ISA_CHARPTR,
1669 #isa.h: ISA_DOUBLE,
1670 #isa.h: ISA_LONG,
1671 #isa.h: ISA_MAX
1672 #isa.h:};
1673 #isa.h:
1674 #isa.h:
1675 #isa.h:/* Pronounce "ra" phonectically and you get "array", which this variable is. */
1676 #isa.h:extern char *isa_ra[];
1677 #isa.h:
1678 #isa.h:
1679 #isa.h:#ifdef __cplusplus
1680 #isa.h:} /* extern "C" */
1681 #isa.h:#endif
1682 #isa.h:
1683 #isa.h:#endif /* ndef ISA_H_INCLUDED */
1684 #isa.h:
1685 #isa.h:/*
1686 #isa.h:  Local Variables:
1687 #isa.h:  tab-width: 3
1688 #isa.h:  end:
1689 #isa.h:*/
1690
1691
1692 #main.c:const char main_rcs[] = "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $";
1693 #main.c:/*********************************************************************
1694 #main.c: *
1695 #main.c: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
1696 #main.c: *
1697 #main.c: * Purpose     :  To test "generic list" creation and manipulation.
1698 #main.c: *
1699 #main.c: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1700 #main.c: *                Privoxy team. http://www.privoxy.org/
1701 #main.c: *
1702 #main.c: *                This program is free software; you can redistribute it
1703 #main.c: *                and/or modify it under the terms of the GNU General
1704 #main.c: *                Public License as published by the Free Software
1705 #main.c: *                Foundation; either version 2 of the License, or (at
1706 #main.c: *                your option) any later version.
1707 #main.c: *
1708 #main.c: *                This program is distributed in the hope that it will
1709 #main.c: *                be useful, but WITHOUT ANY WARRANTY; without even the
1710 #main.c: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1711 #main.c: *                PARTICULAR PURPOSE.  See the GNU General Public
1712 #main.c: *                License for more details.
1713 #main.c: *
1714 #main.c: *                The GNU General Public License should be included with
1715 #main.c: *                this file.  If not, you can view it at
1716 #main.c: *                http://www.gnu.org/copyleft/gpl.html
1717 #main.c: *                or write to the Free Software Foundation, Inc., 59
1718 #main.c: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1719 #main.c: *
1720 #main.c: * VI users             :       Please "set tabstop=3 shiftwidth=3" to view this file,
1721 #main.c: *                                              and edit IJB, correctly.
1722 #main.c: *
1723 #main.c: * Note                 :       This output assumes (per IJB standards) that tabs are
1724 #main.c: *                                              set to 3 characters.  If you run this in a terminal,
1725 #main.c: *                                              you may want to run this as so:
1726 #main.c: *                                                      >./test_list 2>&1 | expand -t3 | ./addr_clean.pl
1727 #main.c: *                                              This will expand the tab to 3 columns and then replace
1728 #main.c: *                                              "0x" style addresses with more human readable ones.
1729 #main.c: *
1730 #main.c: * Revisions   :
1731 #main.c: *    $Log: contrib.sh,v $
1732 #main.c: *    Revision 1.2  2002/03/24 13:25:43  swa
1733 #main.c: *    name change related issues
1734 #main.c: *
1735 #main.c: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
1736 #main.c: *    A contribution/recomendation to the IJBSWA group for a generic doubly
1737 #main.c: *    linked list.  This file is a home brew "bash tar" (I cannot create a
1738 #main.c: *    contrib directory and I cannot upload a tarball ... it gets
1739 #main.c: *    corrupted).  This script will expand all files needed to create the
1740 #main.c: *    linked list modules and an example program.  Please see the README.
1741 #main.c: *    Feed back is welcomed.  Enjoy.
1742 #main.c: *
1743 #main.c: *
1744 #main.c: *********************************************************************/
1745 #main.c:\f
1746 #main.c:
1747 #main.c:#include <malloc.h>
1748 #main.c:#include <stdio.h>
1749 #main.c:#include <stdlib.h>
1750 #main.c:#include <string.h>
1751 #main.c:
1752 #main.c:#include "gen_list.h"
1753 #main.c:#include "rec_char.h"
1754 #main.c:#include "rec_charptr.h"
1755 #main.c:#include "rec_double.h"
1756 #main.c:#include "rec_long.h"
1757 #main.c:#include "malloc_police.h"
1758 #main.c:
1759 #main.c:
1760 #main.c:extern const char isa_rcs[];
1761 #main.c:extern const char isa_h_rcs[];
1762 #main.c:extern const char gen_list_rcs[];
1763 #main.c:extern const char gen_list_h_rcs[];
1764 #main.c:extern const char malloc_police_rcs[];
1765 #main.c:extern const char malloc_police_h_rcs[];
1766 #main.c:extern const char rec_charptr_rcs[];
1767 #main.c:extern const char rec_charptr_h_rcs[];
1768 #main.c:extern const char rec_long_rcs[];
1769 #main.c:extern const char rec_long_h_rcs[];
1770 #main.c:extern const char rec_double_rcs[];
1771 #main.c:extern const char rec_double_h_rcs[];
1772 #main.c:extern const char rec_char_rcs[];
1773 #main.c:extern const char rec_char_h_rcs[];
1774 #main.c:extern const char rec_malloc_police_rcs[];
1775 #main.c:extern const char rec_malloc_police_h_rcs[];
1776 #main.c:extern const char main_rcs[];
1777 #main.c:
1778 #main.c:
1779 #main.c:/*********************************************************************
1780 #main.c: *
1781 #main.c: * Function    :  my_custom_charptr_iterator_1
1782 #main.c: *
1783 #main.c: * Description :  This funtion is called once for every record in a
1784 #main.c: *                                              list.  Or at least until we return non-NULL.  BTW,
1785 #main.c: *                                              this function always returns NULL, thus it will
1786 #main.c: *                                              iterate over the entire list.
1787 #main.c: *
1788 #main.c: * Parameters  :
1789 #main.c: *          1  :  The record.
1790 #main.c: *
1791 #main.c: * Returns     :  NULL
1792 #main.c: *
1793 #main.c: *********************************************************************/
1794 #main.c:struct derived_rec_charptr *my_custom_charptr_iterator_1( struct derived_rec_charptr *this_rec )
1795 #main.c:{
1796 #main.c:        printf( "\
1797 #main.c:\t\tcharptr iterator_1 this_rec\t\t\t\t= iter_1 ... %p
1798 #main.c:\t\tcharptr iterator_1 this_rec->contents\t= iter_1 ... %s\n\n", (const void *)this_rec, this_rec->contents );
1799 #main.c:        return( NULL );
1800 #main.c:
1801 #main.c:}
1802 #main.c:
1803 #main.c:
1804 #main.c:/*********************************************************************
1805 #main.c: *
1806 #main.c: * Function    :  my_custom_charptr_iterator_2
1807 #main.c: *
1808 #main.c: * Description :  This funtion is called once for every record in a
1809 #main.c: *                                              list.  Or at least until we return non-NULL.  BTW,
1810 #main.c: *                                              this function always returns non-NULL, thus it will
1811 #main.c: *                                              iterate over only 1 record.
1812 #main.c: *
1813 #main.c: * Parameters  :
1814 #main.c: *          1  :  The record.
1815 #main.c: *
1816 #main.c: * Returns     :  The record.
1817 #main.c: *
1818 #main.c: *********************************************************************/
1819 #main.c:struct derived_rec_charptr *my_custom_charptr_iterator_2( struct derived_rec_charptr *this_rec )
1820 #main.c:{
1821 #main.c:        printf( "\
1822 #main.c:\t\tcharptr iterator_1 this_rec\t\t\t\t= iter_2 ... %p
1823 #main.c:\t\tcharptr iterator_1 this_rec->contents\t= iter_2 ... %s\n\n", (const void *)this_rec, this_rec->contents );
1824 #main.c:        return( this_rec );
1825 #main.c:
1826 #main.c:}
1827 #main.c:
1828 #main.c:
1829 #main.c:/*********************************************************************
1830 #main.c: *
1831 #main.c: * Function    :  main
1832 #main.c: *
1833 #main.c: * Description :  Test the doubly linked list as it is so far.
1834 #main.c: *
1835 #main.c: * Parameters  :  None
1836 #main.c: *
1837 #main.c: * Returns     :  N/A
1838 #main.c: *
1839 #main.c: *********************************************************************/
1840 #main.c:int main( int argc, const char **argv )
1841 #main.c:{
1842 #main.c:        struct gen_list *lcharptr;
1843 #main.c:        struct gen_list *llong;
1844 #main.c:        struct gen_list *ldouble;
1845 #main.c:        struct gen_list *lchar;
1846 #main.c:
1847 #main.c:        struct gen_list *lcharptr_c;
1848 #main.c:        struct gen_list *llong_c;
1849 #main.c:        struct gen_list *ldouble_c;
1850 #main.c:        struct gen_list *lchar_c;
1851 #main.c:
1852 #main.c:        struct gen_list_rec *f_rec;
1853 #main.c:
1854 #main.c:        struct gen_list *no_own_list;
1855 #main.c:        struct gen_list_rec *no_own_rec1;
1856 #main.c:        struct gen_list_rec *no_own_rec2;
1857 #main.c:        struct gen_list_rec *no_own_rec3;
1858 #main.c:
1859 #main.c:        printf( "\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n",
1860 #main.c:                          gen_list_rcs,
1861 #main.c:                          gen_list_h_rcs,
1862 #main.c:                          isa_rcs,
1863 #main.c:                          isa_h_rcs,
1864 #main.c:                          malloc_police_rcs,
1865 #main.c:                          malloc_police_h_rcs,
1866 #main.c:                          rec_char_rcs,
1867 #main.c:                          rec_char_h_rcs,
1868 #main.c:                          rec_charptr_rcs,
1869 #main.c:                          rec_charptr_h_rcs,
1870 #main.c:                          rec_long_rcs,
1871 #main.c:                          rec_long_h_rcs,
1872 #main.c:                          rec_double_rcs,
1873 #main.c:                          rec_double_h_rcs,
1874 #main.c:                          rec_malloc_police_rcs,
1875 #main.c:                          rec_malloc_police_h_rcs,
1876 #main.c:                          main_rcs );
1877 #main.c:
1878 #main.c:
1879 #main.c:        /* Force a memory leak to test the strdup/malloc/free police. */
1880 #main.c:        /* NOTE: this should trigger the alphanum check of allocated memory. */
1881 #main.c:        strcpy( MALLOC( 60 ), "Force a memory leak to test the strdup/malloc/free police." );
1882 #main.c:
1883 #main.c:
1884 #main.c:        printf( "** -- Calling gen_list_construct to constuct a charptr list -- **\n" );
1885 #main.c:        lcharptr = gen_list_construct();
1886 #main.c:
1887 #main.c:        gen_list_insert( lcharptr, (struct gen_list_rec *)derived_rec_charptr_construct( "Rodney Stromlund" ) );
1888 #main.c:        gen_list_insert( lcharptr, f_rec = (struct gen_list_rec *)derived_rec_charptr_construct( "RJS" ) );
1889 #main.c:        gen_list_insert( lcharptr, (struct gen_list_rec *)derived_rec_charptr_construct( "jammin!" ) );
1890 #main.c:
1891 #main.c:        printf( "** -- Calling gen_list_stream to test streaming a charptr list -- **\n" );
1892 #main.c:        gen_list_stream( lcharptr );
1893 #main.c:
1894 #main.c:        printf( "** -- Calling gen_list_find to find the 2nd charptr record -- **\n" );
1895 #main.c:        f_rec = gen_list_find( lcharptr, f_rec );
1896 #main.c:        printf( "Found rec = %p\n", f_rec );
1897 #main.c:        derived_rec_charptr_stream( (const struct derived_rec_charptr *)f_rec );
1898 #main.c:
1899 #main.c:
1900 #main.c:        printf( "** -- Calling gen_list_copy_construct to test copy construct the charptr list -- **\n" );
1901 #main.c:        lcharptr_c = gen_list_copy_construct( lcharptr );
1902 #main.c:
1903 #main.c:        printf( "** -- Calling gen_list_equal to see if the copied list is the same as the orig -- **
1904 #main.c:** -- NOTE: they will NOT be because the charptr copy constructor changes the string contents -- **\n" );
1905 #main.c:        printf( "Are these 2 equal? => %d\n\n", gen_list_equal( lcharptr, lcharptr_c ) );
1906 #main.c:
1907 #main.c:        printf( "** -- Calling gen_list_stream to stream a copied charptr list -- **\n" );
1908 #main.c:        gen_list_stream( lcharptr_c );
1909 #main.c:
1910 #main.c:
1911 #main.c:        printf( "** -- Calling gen_list_construct to constuct a long list -- **\n" );
1912 #main.c:        llong = gen_list_construct();
1913 #main.c:
1914 #main.c:
1915 #main.c:        gen_list_insert( llong, no_own_rec1 = (struct gen_list_rec *)derived_rec_long_construct( 1 ) );
1916 #main.c:        gen_list_insert( llong, no_own_rec2 = (struct gen_list_rec *)derived_rec_long_construct( 100 ) );
1917 #main.c:        gen_list_insert( llong, no_own_rec3 = (struct gen_list_rec *)derived_rec_long_construct( 200 ) );
1918 #main.c:
1919 #main.c:        printf( "** -- Calling gen_list_stream to test streaming a long list -- **\n" );
1920 #main.c:        gen_list_stream( llong );
1921 #main.c:
1922 #main.c:
1923 #main.c:        printf( "** -- Calling gen_list_copy_construct to test copy construct the long list -- **\n" );
1924 #main.c:        llong_c = gen_list_copy_construct( llong );
1925 #main.c:
1926 #main.c:        printf( "** -- Calling gen_list_stream to stream a copied long list -- **\n" );
1927 #main.c:        gen_list_stream( llong_c );
1928 #main.c:
1929 #main.c:        printf( "** -- Calling gen_list_construct to test a no-owner long list -- **\n" );
1930 #main.c:        no_own_list = gen_list_construct();
1931 #main.c:        gen_list_insert( no_own_list, no_own_rec1 );
1932 #main.c:        gen_list_insert( no_own_list, no_own_rec2 );
1933 #main.c:        gen_list_insert( no_own_list, no_own_rec3 );
1934 #main.c:
1935 #main.c:        printf( "** -- Calling gen_list_stream to stream a no-owner list -- **\n" );
1936 #main.c:        gen_list_stream( no_own_list );
1937 #main.c:
1938 #main.c:        printf( "** -- Calling gen_list_equal to see if list and no-owner list are equal  NOTE: they should be. -- **\n" );
1939 #main.c:        printf( "Are these 2 equal? => %d\n\n", gen_list_equal( llong, no_own_list ) );
1940 #main.c:
1941 #main.c:
1942 #main.c:        printf( "** -- Calling gen_list_construct to constuct a double list -- **\n" );
1943 #main.c:        ldouble = gen_list_construct();
1944 #main.c:
1945 #main.c:        gen_list_insert( ldouble, (struct gen_list_rec *)derived_rec_double_construct( 3.0 ) );
1946 #main.c:        gen_list_insert( ldouble, (struct gen_list_rec *)derived_rec_double_construct( 3.1 ) );
1947 #main.c:        gen_list_insert( ldouble, (struct gen_list_rec *)derived_rec_double_construct( 3.14 ) );
1948 #main.c:
1949 #main.c:        printf( "** -- Calling gen_list_stream to test streaming a double list -- **\n" );
1950 #main.c:        gen_list_stream( ldouble );
1951 #main.c:
1952 #main.c:
1953 #main.c:        printf( "** -- Calling gen_list_copy_construct to test copy construct the double list -- **\n" );
1954 #main.c:        ldouble_c = gen_list_copy_construct( ldouble );
1955 #main.c:
1956 #main.c:        printf( "** -- Calling gen_list_stream to stream a copied double list -- **\n" );
1957 #main.c:        gen_list_stream( ldouble_c );
1958 #main.c:
1959 #main.c:
1960 #main.c:        printf( "** -- Calling gen_list_construct to constuct a char list -- **\n" );
1961 #main.c:        lchar = gen_list_construct();
1962 #main.c:
1963 #main.c:        gen_list_insert( lchar, (struct gen_list_rec *)derived_rec_char_construct( '1' ) );
1964 #main.c:        gen_list_insert( lchar, (struct gen_list_rec *)derived_rec_char_construct( 'A' ) );
1965 #main.c:        gen_list_insert( lchar, (struct gen_list_rec *)derived_rec_char_construct( 'a' ) );
1966 #main.c:
1967 #main.c:        printf( "** -- Calling gen_list_stream to test streaming a char list -- **\n" );
1968 #main.c:        gen_list_stream( lchar );
1969 #main.c:
1970 #main.c:
1971 #main.c:        printf( "** -- Calling gen_list_copy_construct to test copy construct the char list -- **\n" );
1972 #main.c:        lchar_c = gen_list_copy_construct( lchar );
1973 #main.c:
1974 #main.c:        printf( "** -- Calling gen_list_equal to see if the copied list is the same as the orig  NOTE: they should be. -- **\n" );
1975 #main.c:        printf( "Are these 2 equal? => %d\n\n", gen_list_equal( lchar, lchar_c ) );
1976 #main.c:
1977 #main.c:        printf( "** -- Calling gen_list_stream to stream a copied char list -- **\n" );
1978 #main.c:        gen_list_stream( lchar_c );
1979 #main.c:
1980 #main.c:
1981 #main.c:        printf( "** -- Calling gen_list_iterate to iterate a charptr list -- **
1982 #main.c:** -- NOTE: this iterator (my_custom_charptr_iterator_1) will iterate the whole list. -- **\n" );
1983 #main.c:        gen_list_iterate( lcharptr,     (rec_iterate)my_custom_charptr_iterator_1 );
1984 #main.c:
1985 #main.c:        printf( "** -- Calling gen_list_iterate to iterate a copied charptr list -- **
1986 #main.c:** -- NOTE: this iterator (my_custom_charptr_iterator_2) will return after the first iteration. -- **\n" );
1987 #main.c:        gen_list_iterate( lcharptr_c,   (rec_iterate)my_custom_charptr_iterator_2 );
1988 #main.c:
1989 #main.c:
1990 #main.c:        printf( "** -- Calling gen_list_iterate_reverse to iterate a charptr list -- **
1991 #main.c:** -- NOTE: this iterator (my_custom_charptr_iterator_1) will iterate the whole list. -- **\n" );
1992 #main.c:        gen_list_iterate_reverse( lcharptr,     (rec_iterate)my_custom_charptr_iterator_1 );
1993 #main.c:
1994 #main.c:        printf( "** -- Calling gen_list_iterate_reverse to iterate a copied charptr list -- **
1995 #main.c:** -- NOTE: this iterator (my_custom_charptr_iterator_2) will return after the first iteration. -- **\n" );
1996 #main.c:        gen_list_iterate_reverse( lcharptr_c,   (rec_iterate)my_custom_charptr_iterator_2 );
1997 #main.c:
1998 #main.c:
1999 #main.c:        printf( "** -- Calling gen_list_equal to see if 2 different typed lists are equal  NOTE: they should not be. -- **\n" );
2000 #main.c:        printf( "Are these 2 equal? => %d\n\n", gen_list_equal( lcharptr, llong ) );
2001 #main.c:
2002 #main.c:
2003 #main.c:        printf( "** -- Calling gen_list_remove_all to erase a no-owner list -- **\n" );
2004 #main.c:        no_own_list = gen_list_remove_all( no_own_list );
2005 #main.c:
2006 #main.c:        printf( "** -- Calling gen_list_destruct to destruct a no-owner list -- **\n" );
2007 #main.c:        no_own_list = gen_list_destruct( no_own_list );
2008 #main.c:
2009 #main.c:
2010 #main.c:        printf( "** -- Calling gen_list_remove to remove the first record of a copied charptr list -- **\n" );
2011 #main.c:        derived_rec_charptr_destruct( (struct derived_rec_charptr *)gen_list_remove( lcharptr_c, gen_list_get_first( lcharptr_c ) ) );
2012 #main.c:
2013 #main.c:        printf( "** -- Calling gen_list_remove to remove the last record of a copied long list -- **\n" );
2014 #main.c:        derived_rec_long_destruct( (struct derived_rec_long *)gen_list_remove( llong_c, gen_list_get_last( llong_c ) ) );
2015 #main.c:
2016 #main.c:        printf( "** -- Calling gen_list_remove to remove the middle record of an original charptr list -- **\n" );
2017 #main.c:        derived_rec_charptr_destruct( (struct derived_rec_charptr *)gen_list_remove( lcharptr, f_rec ) );
2018 #main.c:
2019 #main.c:        printf( "** -- Calling gen_list_remove to remove the all 3 records of a copied char list (first to last) -- **\n" );
2020 #main.c:        derived_rec_char_destruct( (struct derived_rec_char *)gen_list_remove( lchar_c, gen_list_get_first( lchar_c ) ) );
2021 #main.c:        derived_rec_char_destruct( (struct derived_rec_char *)gen_list_remove( lchar_c, gen_list_get_first( lchar_c ) ) );
2022 #main.c:        derived_rec_char_destruct( (struct derived_rec_char *)gen_list_remove( lchar_c, gen_list_get_first( lchar_c ) ) );
2023 #main.c:
2024 #main.c:        printf( "** -- Calling gen_list_remove to remove the all 3 records of the original char list (last to first) -- **\n" );
2025 #main.c:        derived_rec_char_destruct( (struct derived_rec_char *)gen_list_remove( lchar, gen_list_get_last( lchar ) ) );
2026 #main.c:        derived_rec_char_destruct( (struct derived_rec_char *)gen_list_remove( lchar, gen_list_get_last( lchar ) ) );
2027 #main.c:        derived_rec_char_destruct( (struct derived_rec_char *)gen_list_remove( lchar, gen_list_get_last( lchar ) ) );
2028 #main.c:
2029 #main.c:
2030 #main.c:        printf( "** -- Calling gen_list_destruct to destruct the original charptr list (less the middle record) -- **\n" );
2031 #main.c:        lcharptr = gen_list_destruct( lcharptr );
2032 #main.c:        printf( "** -- Calling gen_list_destruct to destruct the copied charptr list (less the first record) -- **\n" );
2033 #main.c:        lcharptr_c = gen_list_destruct( lcharptr_c );
2034 #main.c:
2035 #main.c:        printf( "** -- Calling gen_list_destruct to destruct the original long list -- **\n" );
2036 #main.c:        llong = gen_list_destruct( llong );
2037 #main.c:        printf( "** -- Calling gen_list_destruct to destruct the copied long list (less the last record) -- **\n" );
2038 #main.c:        llong_c = gen_list_destruct( llong_c );
2039 #main.c:
2040 #main.c:        printf( "** -- Calling gen_list_destruct to destruct the original double list -- **\n" );
2041 #main.c:        ldouble = gen_list_destruct( ldouble );
2042 #main.c:        printf( "** -- Calling gen_list_destruct to destruct the copied double list -- **\n" );
2043 #main.c:        ldouble_c = gen_list_destruct( ldouble_c );
2044 #main.c:
2045 #main.c:        printf( "** -- Calling gen_list_destruct to destruct the original char list (less all records last to first) -- **\n" );
2046 #main.c:        lchar = gen_list_destruct( lchar );
2047 #main.c:        printf( "** -- Calling gen_list_destruct to destruct the copied char list (less all records first to last) -- **\n" );
2048 #main.c:        lchar_c = gen_list_destruct( lchar_c );
2049 #main.c:
2050 #main.c:
2051 #main.c:        /* Force another memory leak to test the strdup/malloc/free police. */
2052 #main.c:        /* NOTE: this should trigger the alphanum check of allocated memory. */
2053 #main.c:        STRDUP( "Force another memory leak to test the strdup/malloc/free police." );
2054 #main.c:
2055 #main.c:        /* Force a memory leak in a list and also in 2 nodes. */
2056 #main.c:        /* NOTE: this should NOT trigger the alphanum check of allocated memory. */
2057 #main.c:        gen_list_construct();
2058 #main.c:
2059 #main.c:        /* NOTE: this should trigger 1 NON check (for the node) */
2060 #main.c:        /* followed by 1 alphanum check for the charptr string. */
2061 #main.c:        derived_rec_charptr_construct( "Leaky charptr node." );
2062 #main.c:
2063 #main.c:        /* NOTE: this should NOT trigger the alphanum check of allocated memory. */
2064 #main.c:        derived_rec_char_construct( 'Z' );
2065 #main.c:
2066 #main.c:
2067 #main.c:        printf( "\ndone" );
2068 #main.c:        return( 0 );
2069 #main.c:
2070 #main.c:}
2071 #main.c:
2072 #main.c:
2073 #main.c:/*
2074 #main.c:  Local Variables:
2075 #main.c:  tab-width: 3
2076 #main.c:  end:
2077 #main.c:*/
2078
2079
2080 #malloc_police.c:const char malloc_police_rcs[] = "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $";
2081 #malloc_police.c:/*********************************************************************
2082 #malloc_police.c: *
2083 #malloc_police.c: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
2084 #malloc_police.c: *
2085 #malloc_police.c: * Purpose     :  This module uses the rec_malloc_police to build a
2086 #malloc_police.c: *                                             list of allocated and freed memory.  When the
2087 #malloc_police.c: *                                             program exits, we will print a list of all memory
2088 #malloc_police.c: *                                             that was allocated, but never freed.  This could
2089 #malloc_police.c: *                                             be most helpful to developers and debugers.
2090 #malloc_police.c: *
2091 #malloc_police.c: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
2092 #malloc_police.c: *                Privoxy team. http://www.privoxy.org/
2093 #malloc_police.c: *
2094 #malloc_police.c: *                This program is free software; you can redistribute it
2095 #malloc_police.c: *                and/or modify it under the terms of the GNU General
2096 #malloc_police.c: *                Public License as published by the Free Software
2097 #malloc_police.c: *                Foundation; either version 2 of the License, or (at
2098 #malloc_police.c: *                your option) any later version.
2099 #malloc_police.c: *
2100 #malloc_police.c: *                This program is distributed in the hope that it will
2101 #malloc_police.c: *                be useful, but WITHOUT ANY WARRANTY; without even the
2102 #malloc_police.c: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
2103 #malloc_police.c: *                PARTICULAR PURPOSE.  See the GNU General Public
2104 #malloc_police.c: *                License for more details.
2105 #malloc_police.c: *
2106 #malloc_police.c: *                The GNU General Public License should be included with
2107 #malloc_police.c: *                this file.  If not, you can view it at
2108 #malloc_police.c: *                http://www.gnu.org/copyleft/gpl.html
2109 #malloc_police.c: *                or write to the Free Software Foundation, Inc., 59
2110 #malloc_police.c: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
2111 #malloc_police.c: *
2112 #malloc_police.c: * VI users            :       Please "set tabstop=3 shiftwidth=3" to view this file,
2113 #malloc_police.c: *                                             and edit IJB, correctly.
2114 #malloc_police.c: *
2115 #malloc_police.c: * Revisions   :
2116 #malloc_police.c: *    $Log: contrib.sh,v $
2117 #malloc_police.c: *    Revision 1.2  2002/03/24 13:25:43  swa
2118 #malloc_police.c: *    name change related issues
2119 #malloc_police.c: *
2120 #malloc_police.c: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
2121 #malloc_police.c: *    A contribution/recomendation to the IJBSWA group for a generic doubly
2122 #malloc_police.c: *    linked list.  This file is a home brew "bash tar" (I cannot create a
2123 #malloc_police.c: *    contrib directory and I cannot upload a tarball ... it gets
2124 #malloc_police.c: *    corrupted).  This script will expand all files needed to create the
2125 #malloc_police.c: *    linked list modules and an example program.  Please see the README.
2126 #malloc_police.c: *    Feed back is welcomed.  Enjoy.
2127 #malloc_police.c: *
2128 #malloc_police.c: *
2129 #malloc_police.c: *********************************************************************/
2130 #malloc_police.c:\f
2131 #malloc_police.c:
2132 #malloc_police.c:#include <ctype.h>
2133 #malloc_police.c:#include <malloc.h>
2134 #malloc_police.c:#include <stdio.h>
2135 #malloc_police.c:#include <stdlib.h>
2136 #malloc_police.c:#include <string.h>
2137 #malloc_police.c:
2138 #malloc_police.c:#include "gen_list.h"
2139 #malloc_police.c:#include "malloc_police.h"
2140 #malloc_police.c:#include "rec_malloc_police.h"
2141 #malloc_police.c:
2142 #malloc_police.c:const char malloc_police_h_rcs[] = MALLOC_POLICE_H_VERSION;
2143 #malloc_police.c:
2144 #malloc_police.c:
2145 #malloc_police.c:/* When we need to allocate malloc_police records, we */
2146 #malloc_police.c:/* will do recursion infinately.  This variable will */
2147 #malloc_police.c:/* stop the STRDUP, MALLOC, and FREE replacements from */
2148 #malloc_police.c:/* trying to log these allocations. */
2149 #malloc_police.c:
2150 #malloc_police.c:char recursion_protect = 0;
2151 #malloc_police.c:
2152 #malloc_police.c:struct gen_list *get_police_list();
2153 #malloc_police.c:static char called_once = 0;
2154 #malloc_police.c:static const char *leak_report_header = "%s****************************** MEMORY LEAK REPORT %s ******************************%s";
2155 #malloc_police.c:
2156 #malloc_police.c:
2157 #malloc_police.c:/*********************************************************************
2158 #malloc_police.c: *
2159 #malloc_police.c: * Function    :  police_list_release_iterator
2160 #malloc_police.c: *
2161 #malloc_police.c: * Description :  Iterator for the police list.  We will report
2162 #malloc_police.c: *                                             "leaked" memory for the developer to correct.
2163 #malloc_police.c: *
2164 #malloc_police.c: * Parameters  :
2165 #malloc_police.c: *          1  :  The record.
2166 #malloc_police.c: *
2167 #malloc_police.c: * Returns     :  NULL
2168 #malloc_police.c: *
2169 #malloc_police.c: *********************************************************************/
2170 #malloc_police.c:struct derived_rec_malloc_police *police_list_release_iterator( struct derived_rec_malloc_police *this_rec )
2171 #malloc_police.c:{
2172 #malloc_police.c:       if ( ! called_once )
2173 #malloc_police.c:       {
2174 #malloc_police.c:               called_once = 1;
2175 #malloc_police.c:               fprintf( stderr, leak_report_header, "\n\n", "BEGIN", "\n\n" );
2176 #malloc_police.c:       }
2177 #malloc_police.c:
2178 #malloc_police.c:       fprintf( stderr, "\
2179 #malloc_police.c:\t\tmalloc_police leaked memory iterator this_rec\t\t\t\t\t= %p
2180 #malloc_police.c:\t\tmalloc_police leaked memory iterator this_rec->alloced_addr\t= %p
2181 #malloc_police.c:\t\tmalloc_police leaked memory iterator this_rec->source_where\t= %s
2182 #malloc_police.c:\t\tmalloc_police leaked memory iterator this_rec->sz\t\t\t\t= %ld\n",
2183 #malloc_police.c:                               (const void *)this_rec,
2184 #malloc_police.c:                               this_rec->alloced_addr,
2185 #malloc_police.c:                               this_rec->source_where,
2186 #malloc_police.c:                               this_rec->sz
2187 #malloc_police.c:       );
2188 #malloc_police.c:
2189 #malloc_police.c:       if (
2190 #malloc_police.c:               this_rec->sz >= 3 &&
2191 #malloc_police.c:               isalnum( ((const char *)this_rec->alloced_addr)[ 0 ] ) &&
2192 #malloc_police.c:               isalnum( ((const char *)this_rec->alloced_addr)[ 1 ] ) &&
2193 #malloc_police.c:               isalnum( ((const char *)this_rec->alloced_addr)[ 2 ] ) )
2194 #malloc_police.c:       {
2195 #malloc_police.c:               /* If the memory starts with 3 alpha-numerics,
2196 #malloc_police.c:                * assume a string was allocated.  This might be
2197 #malloc_police.c:                * a little dangerous for production code, but I
2198 #malloc_police.c:                * will take the risk for development payoff
2199 #malloc_police.c:                * (at least for now ...) */
2200 #malloc_police.c:                       
2201 #malloc_police.c:               fprintf( stderr, "\
2202 #malloc_police.c:\t\tAlpha numeric found, assuming a string was allocated\t\t\t= %s\n",
2203 #malloc_police.c:                                       this_rec->alloced_addr
2204 #malloc_police.c:               );
2205 #malloc_police.c:       }
2206 #malloc_police.c:
2207 #malloc_police.c:       fprintf( stderr, "\n" );
2208 #malloc_police.c:
2209 #malloc_police.c:       return( NULL );
2210 #malloc_police.c:
2211 #malloc_police.c:}
2212 #malloc_police.c:
2213 #malloc_police.c:
2214 #malloc_police.c:/*********************************************************************
2215 #malloc_police.c: *
2216 #malloc_police.c: * Function    :  release_police_list
2217 #malloc_police.c: *
2218 #malloc_police.c: * Description :  Iterates the police_list and reports "leaked" memory.
2219 #malloc_police.c: *                                             It will then free the list itself.
2220 #malloc_police.c: *
2221 #malloc_police.c: * Parameters  :       None
2222 #malloc_police.c: *
2223 #malloc_police.c: * Returns     :  None.
2224 #malloc_police.c: *
2225 #malloc_police.c: *********************************************************************/
2226 #malloc_police.c:void release_police_list()
2227 #malloc_police.c:{
2228 #malloc_police.c:       struct gen_list *police_list = get_police_list();
2229 #malloc_police.c:       fflush( stdout );
2230 #malloc_police.c:       gen_list_iterate( police_list, (rec_iterate)police_list_release_iterator );
2231 #malloc_police.c:
2232 #malloc_police.c:       if ( called_once )
2233 #malloc_police.c:       {
2234 #malloc_police.c:               called_once = 0;
2235 #malloc_police.c:               fprintf( stderr, leak_report_header, "", "END", "\n" );
2236 #malloc_police.c:       }
2237 #malloc_police.c:
2238 #malloc_police.c:}
2239 #malloc_police.c:
2240 #malloc_police.c:
2241 #malloc_police.c:/*********************************************************************
2242 #malloc_police.c: *
2243 #malloc_police.c: * Function    :  get_police_list
2244 #malloc_police.c: *
2245 #malloc_police.c: * Description :  Get the police malloc/strdup/free list.  Generate
2246 #malloc_police.c: *                                             a new one if it does not yet exist.
2247 #malloc_police.c: *
2248 #malloc_police.c: * Parameters  :       None
2249 #malloc_police.c: *
2250 #malloc_police.c: * Returns     :  The police list.
2251 #malloc_police.c: *
2252 #malloc_police.c: *********************************************************************/
2253 #malloc_police.c:struct gen_list *get_police_list()
2254 #malloc_police.c:{
2255 #malloc_police.c:       static struct gen_list *police_list = NULL;
2256 #malloc_police.c:
2257 #malloc_police.c:       if ( NULL == police_list )
2258 #malloc_police.c:       {
2259 #malloc_police.c:               recursion_protect ++;
2260 #malloc_police.c:               list_is_quiet ++;
2261 #malloc_police.c:
2262 #malloc_police.c:               police_list = gen_list_construct();
2263 #malloc_police.c:               atexit( release_police_list );
2264 #malloc_police.c:
2265 #malloc_police.c:               recursion_protect --;
2266 #malloc_police.c:               list_is_quiet --;
2267 #malloc_police.c:       }
2268 #malloc_police.c:
2269 #malloc_police.c:       return( police_list );
2270 #malloc_police.c:
2271 #malloc_police.c:}
2272 #malloc_police.c:
2273 #malloc_police.c:
2274 #malloc_police.c:/*********************************************************************
2275 #malloc_police.c: *
2276 #malloc_police.c: * Function    :  police_strdup
2277 #malloc_police.c: *
2278 #malloc_police.c: * Description :  Save the results of the strdup into our linked list.
2279 #malloc_police.c: *                                             This will be checked against latter free(s).
2280 #malloc_police.c: *
2281 #malloc_police.c: * Parameters  :
2282 #malloc_police.c: *          1  :  The string to be duplicated.
2283 #malloc_police.c: *          2  :  Filename where the strdup occured.
2284 #malloc_police.c: *          3  :  Line# of where the strdup occured.
2285 #malloc_police.c: *
2286 #malloc_police.c: * Returns     :  Pointer to newly allocated memory.
2287 #malloc_police.c: *
2288 #malloc_police.c: * NOTE                        :       This could replace the custom strdup for __MINGW32__
2289 #malloc_police.c: *                                             systems.  We only need to copy the conditionally
2290 #malloc_police.c: *                                             compiled code here and eliminate the strdup copy.
2291 #malloc_police.c: *
2292 #malloc_police.c: *********************************************************************/
2293 #malloc_police.c:char *police_strdup( const char *s, const char *filename, long lineno )
2294 #malloc_police.c:{
2295 #malloc_police.c:       char *ret = strdup( s );
2296 #malloc_police.c:
2297 #malloc_police.c:       if ( 0 == recursion_protect )
2298 #malloc_police.c:       {
2299 #malloc_police.c:               char buffer[ 255 ];
2300 #malloc_police.c:               sprintf( buffer, "strdup : %s @ %ld for %ld (%s)", filename, lineno, strlen( s ) + 1, s );
2301 #malloc_police.c:
2302 #malloc_police.c:               recursion_protect ++;
2303 #malloc_police.c:               list_is_quiet ++;
2304 #malloc_police.c:
2305 #malloc_police.c:               gen_list_insert(
2306 #malloc_police.c:                       get_police_list(),
2307 #malloc_police.c:                       (struct gen_list_rec *)derived_rec_malloc_police_construct( ret, buffer, strlen( s ) + 1 )
2308 #malloc_police.c:               );
2309 #malloc_police.c:
2310 #malloc_police.c:               recursion_protect --;
2311 #malloc_police.c:               list_is_quiet --;
2312 #malloc_police.c:       }
2313 #malloc_police.c:
2314 #malloc_police.c:       return( ret );
2315 #malloc_police.c:
2316 #malloc_police.c:}
2317 #malloc_police.c:
2318 #malloc_police.c:
2319 #malloc_police.c:/*********************************************************************
2320 #malloc_police.c: *
2321 #malloc_police.c: * Function    :  police_malloc
2322 #malloc_police.c: *
2323 #malloc_police.c: * Description :  Save the results of the malloc into our linked list.
2324 #malloc_police.c: *                                             This will be checked against latter free(s).
2325 #malloc_police.c: *
2326 #malloc_police.c: * Parameters  :
2327 #malloc_police.c: *          1  :  The size of the memory to be malloc(ed).
2328 #malloc_police.c: *          2  :  Filename where the malloc occured.
2329 #malloc_police.c: *          3  :  Line# of where the malloc occured.
2330 #malloc_police.c: *
2331 #malloc_police.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
2332 #malloc_police.c: *
2333 #malloc_police.c: *********************************************************************/
2334 #malloc_police.c:void *police_malloc( size_t sz, const char *filename, long lineno )
2335 #malloc_police.c:{
2336 #malloc_police.c:       void *ret = malloc( sz );
2337 #malloc_police.c:
2338 #malloc_police.c:       if ( 0 == recursion_protect )
2339 #malloc_police.c:       {
2340 #malloc_police.c:               char buffer[ 255 ];
2341 #malloc_police.c:               sprintf( buffer, "malloc : %s @ %ld for %ld", filename, lineno, sz );
2342 #malloc_police.c:
2343 #malloc_police.c:               recursion_protect ++;
2344 #malloc_police.c:               list_is_quiet ++;
2345 #malloc_police.c:
2346 #malloc_police.c:               gen_list_insert(
2347 #malloc_police.c:                       get_police_list(),
2348 #malloc_police.c:                       (struct gen_list_rec *)derived_rec_malloc_police_construct( ret, buffer, sz )
2349 #malloc_police.c:               );
2350 #malloc_police.c:
2351 #malloc_police.c:               recursion_protect --;
2352 #malloc_police.c:               list_is_quiet --;
2353 #malloc_police.c:       }
2354 #malloc_police.c:
2355 #malloc_police.c:       return( ret );
2356 #malloc_police.c:
2357 #malloc_police.c:}
2358 #malloc_police.c:
2359 #malloc_police.c:
2360 #malloc_police.c:/*********************************************************************
2361 #malloc_police.c: *
2362 #malloc_police.c: * Function    :  police_free
2363 #malloc_police.c: *
2364 #malloc_police.c: * Description :  Frees the memory allocation and removes the address
2365 #malloc_police.c: *                                             from the linked list.  Anything left in this list
2366 #malloc_police.c: *                                             is "leaked" memory.
2367 #malloc_police.c: *
2368 #malloc_police.c: * Parameters  :
2369 #malloc_police.c: *          1  :  Pointer to the memory to be freed.
2370 #malloc_police.c: *          2  :  Filename where the free occured.
2371 #malloc_police.c: *          3  :  Line# of where the free occured.
2372 #malloc_police.c: *
2373 #malloc_police.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
2374 #malloc_police.c: *
2375 #malloc_police.c: *********************************************************************/
2376 #malloc_police.c:void police_free( void *ptr, const char *filename, long lineno )
2377 #malloc_police.c:{
2378 #malloc_police.c:       if ( 0 == recursion_protect )
2379 #malloc_police.c:       {
2380 #malloc_police.c:               struct derived_rec_malloc_police *rec;
2381 #malloc_police.c:               struct gen_list_rec *fRec;
2382 #malloc_police.c:               struct gen_list *l = get_police_list();
2383 #malloc_police.c:
2384 #malloc_police.c:               recursion_protect ++;
2385 #malloc_police.c:               list_is_quiet ++;
2386 #malloc_police.c:
2387 #malloc_police.c:               rec = derived_rec_malloc_police_construct( ptr, "FREEING POLICE RECORD.", 23 );
2388 #malloc_police.c:               fRec = gen_list_find( l, (struct gen_list_rec *)rec );
2389 #malloc_police.c:               derived_rec_malloc_police_destruct( rec );
2390 #malloc_police.c:
2391 #malloc_police.c:               if ( NULL == fRec )
2392 #malloc_police.c:               {
2393 #malloc_police.c:                       fprintf( stderr, "\nERROR: free failed to find corresponding strdup/malloc : %s @ %ld\n", filename, lineno );
2394 #malloc_police.c:               }
2395 #malloc_police.c:               else
2396 #malloc_police.c:               {
2397 #malloc_police.c:                       derived_rec_malloc_police_destruct( (struct derived_rec_malloc_police *)gen_list_remove( l, fRec ) );
2398 #malloc_police.c:               }
2399 #malloc_police.c:
2400 #malloc_police.c:               recursion_protect --;
2401 #malloc_police.c:               list_is_quiet --;
2402 #malloc_police.c:       }
2403 #malloc_police.c:
2404 #malloc_police.c:       free( ptr );
2405 #malloc_police.c:
2406 #malloc_police.c:}
2407
2408
2409 #malloc_police.h:#ifndef MALLOC_POLICE_H_INCLUDED
2410 #malloc_police.h:#define MALLOC_POLICE_H_INCLUDED
2411 #malloc_police.h:#define MALLOC_POLICE_H_VERSION "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $"
2412 #malloc_police.h:/*********************************************************************
2413 #malloc_police.h: *
2414 #malloc_police.h: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
2415 #malloc_police.h: *
2416 #malloc_police.h: * Purpose     :  This module uses the rec_malloc_police to build a
2417 #malloc_police.h: *                                             list of allocated and freed memory.  When the
2418 #malloc_police.h: *                                             program exits, we will print a list of all memory
2419 #malloc_police.h: *                                             that was allocated, but never freed.  This could
2420 #malloc_police.h: *                                             be most helpful to developers and debugers.
2421 #malloc_police.h: *
2422 #malloc_police.h: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
2423 #malloc_police.h: *                Privoxy team. http://www.privoxy.org/
2424 #malloc_police.h: *
2425 #malloc_police.h: *                This program is free software; you can redistribute it
2426 #malloc_police.h: *                and/or modify it under the terms of the GNU General
2427 #malloc_police.h: *                Public License as published by the Free Software
2428 #malloc_police.h: *                Foundation; either version 2 of the License, or (at
2429 #malloc_police.h: *                your option) any later version.
2430 #malloc_police.h: *
2431 #malloc_police.h: *                This program is distributed in the hope that it will
2432 #malloc_police.h: *                be useful, but WITHOUT ANY WARRANTY; without even the
2433 #malloc_police.h: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
2434 #malloc_police.h: *                PARTICULAR PURPOSE.  See the GNU General Public
2435 #malloc_police.h: *                License for more details.
2436 #malloc_police.h: *
2437 #malloc_police.h: *                The GNU General Public License should be included with
2438 #malloc_police.h: *                this file.  If not, you can view it at
2439 #malloc_police.h: *                http://www.gnu.org/copyleft/gpl.html
2440 #malloc_police.h: *                or write to the Free Software Foundation, Inc., 59
2441 #malloc_police.h: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
2442 #malloc_police.h: *
2443 #malloc_police.h: * VI users            :       Please "set tabstop=3 shiftwidth=3" to view this file,
2444 #malloc_police.h: *                                             and edit IJB, correctly.
2445 #malloc_police.h: *
2446 #malloc_police.h: * Revisions   :
2447 #malloc_police.h: *    $Log: contrib.sh,v $
2448 #malloc_police.h: *    Revision 1.2  2002/03/24 13:25:43  swa
2449 #malloc_police.h: *    name change related issues
2450 #malloc_police.h: *
2451 #malloc_police.h: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
2452 #malloc_police.h: *    A contribution/recomendation to the IJBSWA group for a generic doubly
2453 #malloc_police.h: *    linked list.  This file is a home brew "bash tar" (I cannot create a
2454 #malloc_police.h: *    contrib directory and I cannot upload a tarball ... it gets
2455 #malloc_police.h: *    corrupted).  This script will expand all files needed to create the
2456 #malloc_police.h: *    linked list modules and an example program.  Please see the README.
2457 #malloc_police.h: *    Feed back is welcomed.  Enjoy.
2458 #malloc_police.h: *
2459 #malloc_police.h: *
2460 #malloc_police.h: *********************************************************************/
2461 #malloc_police.h:\f
2462 #malloc_police.h:
2463 #malloc_police.h:#ifdef __cplusplus
2464 #malloc_police.h:extern "C" {
2465 #malloc_police.h:#endif
2466 #malloc_police.h:
2467 #malloc_police.h:
2468 #malloc_police.h:char *police_strdup( const char *s, const char *filename, long lineno );
2469 #malloc_police.h:void *police_malloc( size_t sz, const char *filename, long lineno );
2470 #malloc_police.h:void police_free( void *ptr, const char *filename, long lineno );
2471 #malloc_police.h:
2472 #malloc_police.h:#define STRDUP(s)                      police_strdup( s, __FILE__, __LINE__ )
2473 #malloc_police.h:#define MALLOC(sz)             police_malloc( sz, __FILE__, __LINE__ )
2474 #malloc_police.h:#define FREE(ptr)                      police_free( ptr, __FILE__, __LINE__ )
2475 #malloc_police.h:
2476 #malloc_police.h:
2477 #malloc_police.h:#ifdef __cplusplus
2478 #malloc_police.h:} /* extern "C" */
2479 #malloc_police.h:#endif
2480 #malloc_police.h:
2481 #malloc_police.h:#endif /* ndef MALLOC_POLICE_H_INCLUDED */
2482 #malloc_police.h:
2483 #malloc_police.h:/*
2484 #malloc_police.h:  Local Variables:
2485 #malloc_police.h:  tab-width: 3
2486 #malloc_police.h:  end:
2487 #malloc_police.h:*/
2488
2489
2490 #rec_char.c:const char rec_char_rcs[] = "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $";
2491 #rec_char.c:/*********************************************************************
2492 #rec_char.c: *
2493 #rec_char.c: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
2494 #rec_char.c: *
2495 #rec_char.c: * Purpose     :  A "derived class" of gen_list_rec.
2496 #rec_char.c: *
2497 #rec_char.c: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
2498 #rec_char.c: *                Privoxy team. http://www.privoxy.org/
2499 #rec_char.c: *
2500 #rec_char.c: *                This program is free software; you can redistribute it
2501 #rec_char.c: *                and/or modify it under the terms of the GNU General
2502 #rec_char.c: *                Public License as published by the Free Software
2503 #rec_char.c: *                Foundation; either version 2 of the License, or (at
2504 #rec_char.c: *                your option) any later version.
2505 #rec_char.c: *
2506 #rec_char.c: *                This program is distributed in the hope that it will
2507 #rec_char.c: *                be useful, but WITHOUT ANY WARRANTY; without even the
2508 #rec_char.c: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
2509 #rec_char.c: *                PARTICULAR PURPOSE.  See the GNU General Public
2510 #rec_char.c: *                License for more details.
2511 #rec_char.c: *
2512 #rec_char.c: *                The GNU General Public License should be included with
2513 #rec_char.c: *                this file.  If not, you can view it at
2514 #rec_char.c: *                http://www.gnu.org/copyleft/gpl.html
2515 #rec_char.c: *                or write to the Free Software Foundation, Inc., 59
2516 #rec_char.c: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
2517 #rec_char.c: *
2518 #rec_char.c: * VI users         :       Please "set tabstop=3 shiftwidth=3" to view this file,
2519 #rec_char.c: *                                          and edit IJB, correctly.
2520 #rec_char.c: *
2521 #rec_char.c: * Revisions   :
2522 #rec_char.c: *    $Log: contrib.sh,v $
2523 #rec_char.c: *    Revision 1.2  2002/03/24 13:25:43  swa
2524 #rec_char.c: *    name change related issues
2525 #rec_char.c: *
2526 #rec_char.c: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
2527 #rec_char.c: *    A contribution/recomendation to the IJBSWA group for a generic doubly
2528 #rec_char.c: *    linked list.  This file is a home brew "bash tar" (I cannot create a
2529 #rec_char.c: *    contrib directory and I cannot upload a tarball ... it gets
2530 #rec_char.c: *    corrupted).  This script will expand all files needed to create the
2531 #rec_char.c: *    linked list modules and an example program.  Please see the README.
2532 #rec_char.c: *    Feed back is welcomed.  Enjoy.
2533 #rec_char.c: *
2534 #rec_char.c: *
2535 #rec_char.c: *********************************************************************/
2536 #rec_char.c:\f
2537 #rec_char.c:
2538 #rec_char.c:#include <malloc.h>
2539 #rec_char.c:#include <stdio.h>
2540 #rec_char.c:#include <stdlib.h>
2541 #rec_char.c:#include <string.h>
2542 #rec_char.c:
2543 #rec_char.c:#include "gen_list.h"
2544 #rec_char.c:#include "rec_char.h"
2545 #rec_char.c:
2546 #rec_char.c:const char rec_char_h_rcs[] = REC_CHAR_H_VERSION;
2547 #rec_char.c:
2548 #rec_char.c:
2549 #rec_char.c:static const rec_method rec_char_vtable[] =
2550 #rec_char.c:{
2551 #rec_char.c:    (rec_method)derived_rec_char_copy_construct,
2552 #rec_char.c:    (rec_method)derived_rec_char_destruct,
2553 #rec_char.c:    (rec_method)derived_rec_char_stream,
2554 #rec_char.c:    (rec_method)derived_rec_char_equal
2555 #rec_char.c:};
2556 #rec_char.c:
2557 #rec_char.c:
2558 #rec_char.c:/*********************************************************************
2559 #rec_char.c: *
2560 #rec_char.c: * Function    :  derived_rec_char_construct
2561 #rec_char.c: *
2562 #rec_char.c: * Description :  A simple derived record class that contains 1 string.
2563 #rec_char.c: *
2564 #rec_char.c: * Parameters  :
2565 #rec_char.c: *          1  :  The record
2566 #rec_char.c: *          2  :  The string to contain.
2567 #rec_char.c: *
2568 #rec_char.c: * Returns     :  A pointer to the constructed record.
2569 #rec_char.c: *
2570 #rec_char.c: *********************************************************************/
2571 #rec_char.c:struct derived_rec_char *derived_rec_char_construct( const char _contents )
2572 #rec_char.c:{
2573 #rec_char.c:    struct derived_rec_char *this_rec = (struct derived_rec_char *)gen_list_rec_construct(
2574 #rec_char.c:            ISA_CHAR,
2575 #rec_char.c:            sizeof( struct derived_rec_char ),
2576 #rec_char.c:            rec_char_vtable
2577 #rec_char.c:    );
2578 #rec_char.c:
2579 #rec_char.c:    this_rec->contents = _contents;
2580 #rec_char.c:
2581 #rec_char.c:    LIST_SHOW( printf( "\
2582 #rec_char.c:\t\tchar construct new rec\t\t\t\t= %p
2583 #rec_char.c:\t\tchar construct new rec contents\t= %c\n\n", (const void *)this_rec, this_rec->contents ) );
2584 #rec_char.c:
2585 #rec_char.c:    return( this_rec );
2586 #rec_char.c:
2587 #rec_char.c:}
2588 #rec_char.c:
2589 #rec_char.c:
2590 #rec_char.c:/*********************************************************************
2591 #rec_char.c: *
2592 #rec_char.c: * Function    :  derived_rec_char_copy_construct
2593 #rec_char.c: *
2594 #rec_char.c: * Description :  Copies one char record to another.
2595 #rec_char.c: *
2596 #rec_char.c: * Parameters  :
2597 #rec_char.c: *          1  :  Existing record.
2598 #rec_char.c: *                          2       :  Copy record.
2599 #rec_char.c: *
2600 #rec_char.c: * Returns     :  The newly constructed copy record.
2601 #rec_char.c: *
2602 #rec_char.c: *********************************************************************/
2603 #rec_char.c:struct derived_rec_char *derived_rec_char_copy_construct( const struct derived_rec_char *this_rec )
2604 #rec_char.c:{
2605 #rec_char.c:    struct derived_rec_char *copy_rec = (struct derived_rec_char *)gen_list_rec_copy_construct( (struct gen_list_rec *)this_rec );
2606 #rec_char.c:    copy_rec->contents = this_rec->contents;
2607 #rec_char.c:
2608 #rec_char.c:    LIST_SHOW( printf( "\
2609 #rec_char.c:\t\tchar copy construct new gen rec\t\t\t\t= %p => %p
2610 #rec_char.c:\t\tchar copy construct new gen rec contents\t= %c\n\n", (const void *)this_rec, (const void *)copy_rec, copy_rec->contents ) );
2611 #rec_char.c:
2612 #rec_char.c:    return( copy_rec );
2613 #rec_char.c:
2614 #rec_char.c:}
2615 #rec_char.c:
2616 #rec_char.c:
2617 #rec_char.c:/*********************************************************************
2618 #rec_char.c: *
2619 #rec_char.c: * Function    :  derived_rec_char_destruct 
2620 #rec_char.c: *
2621 #rec_char.c: * Description :  Destruct the char record.
2622 #rec_char.c: *
2623 #rec_char.c: * Parameters  :
2624 #rec_char.c: *          1  :  The record.
2625 #rec_char.c: *
2626 #rec_char.c: * Returns     :  NULL
2627 #rec_char.c: *
2628 #rec_char.c: *********************************************************************/
2629 #rec_char.c:struct derived_rec_char *derived_rec_char_destruct( struct derived_rec_char *this_rec )
2630 #rec_char.c:{
2631 #rec_char.c:    LIST_SHOW( printf( "\
2632 #rec_char.c:\t\tchar destruct this_rec\t\t\t\t= %p
2633 #rec_char.c:\t\tchar destruct this_rec->contents\t= %c\n\n", (const void *)this_rec, this_rec->contents ) );
2634 #rec_char.c:
2635 #rec_char.c:    this_rec->contents = '!';
2636 #rec_char.c:    return( (struct derived_rec_char *)gen_list_rec_destruct( (struct gen_list_rec *)this_rec ) );
2637 #rec_char.c:
2638 #rec_char.c:}
2639 #rec_char.c:
2640 #rec_char.c:
2641 #rec_char.c:/*********************************************************************
2642 #rec_char.c: *
2643 #rec_char.c: * Function    :  derived_rec_char_stream
2644 #rec_char.c: *
2645 #rec_char.c: * Description :  Displays all char attributes on the STDOUT stream.
2646 #rec_char.c: *
2647 #rec_char.c: * Parameters  :
2648 #rec_char.c: *          1  :  The record.
2649 #rec_char.c: *
2650 #rec_char.c: * Returns     :  The record.
2651 #rec_char.c: *
2652 #rec_char.c: *********************************************************************/
2653 #rec_char.c:const struct derived_rec_char *derived_rec_char_stream( const struct derived_rec_char *this_rec )
2654 #rec_char.c:{
2655 #rec_char.c:    this_rec = (struct derived_rec_char *)gen_list_rec_stream(
2656 #rec_char.c:            (struct gen_list_rec *)this_rec
2657 #rec_char.c:    );
2658 #rec_char.c:    LIST_SHOW( printf( "\
2659 #rec_char.c:\t\tchar stream this_rec\t\t\t\t\t= %p
2660 #rec_char.c:\t\tchar stream this_rec->contents\t= %c\n\n", (const void *)this_rec, this_rec->contents ) );
2661 #rec_char.c:
2662 #rec_char.c:    return( this_rec );
2663 #rec_char.c:
2664 #rec_char.c:}
2665 #rec_char.c:
2666 #rec_char.c:
2667 #rec_char.c:/*********************************************************************
2668 #rec_char.c: *
2669 #rec_char.c: * Function    :  derived_rec_char_equal
2670 #rec_char.c: *
2671 #rec_char.c: * Description :  Compares two char records to see if they are equal.
2672 #rec_char.c: *
2673 #rec_char.c: * Parameters  :
2674 #rec_char.c: *          1  :  A record.
2675 #rec_char.c: *          2  :  Another record.
2676 #rec_char.c: *
2677 #rec_char.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
2678 #rec_char.c: *
2679 #rec_char.c: *********************************************************************/
2680 #rec_char.c:int derived_rec_char_equal( const struct derived_rec_char *this_rec, const struct derived_rec_char *eq_rec )
2681 #rec_char.c:{
2682 #rec_char.c:    if ( ! gen_list_rec_equal( (const struct gen_list_rec *)this_rec, (struct gen_list_rec *)eq_rec ) )
2683 #rec_char.c:    {
2684 #rec_char.c:            return( 0 );
2685 #rec_char.c:    }
2686 #rec_char.c:    return( this_rec->contents == eq_rec->contents );
2687 #rec_char.c:
2688 #rec_char.c:}
2689
2690
2691 #rec_char.h:#ifndef REC_CHAR_H_INCLUDED
2692 #rec_char.h:#define REC_CHAR_H_INCLUDED
2693 #rec_char.h:#define REC_CHAR_H_VERSION "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $"
2694 #rec_char.h:/*********************************************************************
2695 #rec_char.h: *
2696 #rec_char.h: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
2697 #rec_char.h: *
2698 #rec_char.h: * Purpose     :  A "derived class" of gen_list_rec.
2699 #rec_char.h: *
2700 #rec_char.h: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
2701 #rec_char.h: *                Privoxy team. http://www.privoxy.org/
2702 #rec_char.h: *
2703 #rec_char.h: *                This program is free software; you can redistribute it
2704 #rec_char.h: *                and/or modify it under the terms of the GNU General
2705 #rec_char.h: *                Public License as published by the Free Software
2706 #rec_char.h: *                Foundation; either version 2 of the License, or (at
2707 #rec_char.h: *                your option) any later version.
2708 #rec_char.h: *
2709 #rec_char.h: *                This program is distributed in the hope that it will
2710 #rec_char.h: *                be useful, but WITHOUT ANY WARRANTY; without even the
2711 #rec_char.h: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
2712 #rec_char.h: *                PARTICULAR PURPOSE.  See the GNU General Public
2713 #rec_char.h: *                License for more details.
2714 #rec_char.h: *
2715 #rec_char.h: *                The GNU General Public License should be included with
2716 #rec_char.h: *                this file.  If not, you can view it at
2717 #rec_char.h: *                http://www.gnu.org/copyleft/gpl.html
2718 #rec_char.h: *                or write to the Free Software Foundation, Inc., 59
2719 #rec_char.h: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
2720 #rec_char.h: *
2721 #rec_char.h: * VI users         :       Please "set tabstop=3 shiftwidth=3" to view this file,
2722 #rec_char.h: *                                          and edit IJB, correctly.
2723 #rec_char.h: *
2724 #rec_char.h: * Revisions   :
2725 #rec_char.h: *    $Log: contrib.sh,v $
2726 #rec_char.h: *    Revision 1.2  2002/03/24 13:25:43  swa
2727 #rec_char.h: *    name change related issues
2728 #rec_char.h: *
2729 #rec_char.h: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
2730 #rec_char.h: *    A contribution/recomendation to the IJBSWA group for a generic doubly
2731 #rec_char.h: *    linked list.  This file is a home brew "bash tar" (I cannot create a
2732 #rec_char.h: *    contrib directory and I cannot upload a tarball ... it gets
2733 #rec_char.h: *    corrupted).  This script will expand all files needed to create the
2734 #rec_char.h: *    linked list modules and an example program.  Please see the README.
2735 #rec_char.h: *    Feed back is welcomed.  Enjoy.
2736 #rec_char.h: *
2737 #rec_char.h: *
2738 #rec_char.h: *********************************************************************/
2739 #rec_char.h:\f
2740 #rec_char.h:
2741 #rec_char.h:#ifdef __cplusplus
2742 #rec_char.h:extern "C" {
2743 #rec_char.h:#endif
2744 #rec_char.h:
2745 #rec_char.h:
2746 #rec_char.h:struct derived_rec_char
2747 #rec_char.h:{
2748 #rec_char.h:    /* private: */
2749 #rec_char.h:    struct gen_list_rec parent_rec;
2750 #rec_char.h:    char contents;
2751 #rec_char.h:};
2752 #rec_char.h:
2753 #rec_char.h:/* public: */
2754 #rec_char.h:extern struct derived_rec_char *    derived_rec_char_construct( const char _contents );
2755 #rec_char.h:extern struct derived_rec_char *    derived_rec_char_copy_construct( const struct derived_rec_char *this_rec );
2756 #rec_char.h:extern struct derived_rec_char *    derived_rec_char_destruct( struct derived_rec_char *this_rec );
2757 #rec_char.h:extern const struct derived_rec_char *derived_rec_char_stream( const struct derived_rec_char *this_rec );
2758 #rec_char.h:extern int                                                          derived_rec_char_equal( const struct derived_rec_char *this_rec, const struct derived_rec_char *eq_rec );
2759 #rec_char.h:
2760 #rec_char.h:/* struct/class COMPLETE */
2761 #rec_char.h:
2762 #rec_char.h:
2763 #rec_char.h:#ifdef __cplusplus
2764 #rec_char.h:} /* extern "C" */
2765 #rec_char.h:#endif
2766 #rec_char.h:
2767 #rec_char.h:#endif /* ndef REC_CHAR_H_INCLUDED */
2768 #rec_char.h:
2769 #rec_char.h:/*
2770 #rec_char.h:  Local Variables:
2771 #rec_char.h:  tab-width: 3
2772 #rec_char.h:  end:
2773 #rec_char.h:*/
2774
2775
2776 #rec_charptr.c:const char rec_charptr_rcs[] = "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $";
2777 #rec_charptr.c:/*********************************************************************
2778 #rec_charptr.c: *
2779 #rec_charptr.c: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
2780 #rec_charptr.c: *
2781 #rec_charptr.c: * Purpose     :  A "derived class" of gen_list_rec.
2782 #rec_charptr.c: *
2783 #rec_charptr.c: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
2784 #rec_charptr.c: *                Privoxy team. http://www.privoxy.org/
2785 #rec_charptr.c: *
2786 #rec_charptr.c: *                This program is free software; you can redistribute it
2787 #rec_charptr.c: *                and/or modify it under the terms of the GNU General
2788 #rec_charptr.c: *                Public License as published by the Free Software
2789 #rec_charptr.c: *                Foundation; either version 2 of the License, or (at
2790 #rec_charptr.c: *                your option) any later version.
2791 #rec_charptr.c: *
2792 #rec_charptr.c: *                This program is distributed in the hope that it will
2793 #rec_charptr.c: *                be useful, but WITHOUT ANY WARRANTY; without even the
2794 #rec_charptr.c: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
2795 #rec_charptr.c: *                PARTICULAR PURPOSE.  See the GNU General Public
2796 #rec_charptr.c: *                License for more details.
2797 #rec_charptr.c: *
2798 #rec_charptr.c: *                The GNU General Public License should be included with
2799 #rec_charptr.c: *                this file.  If not, you can view it at
2800 #rec_charptr.c: *                http://www.gnu.org/copyleft/gpl.html
2801 #rec_charptr.c: *                or write to the Free Software Foundation, Inc., 59
2802 #rec_charptr.c: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
2803 #rec_charptr.c: *
2804 #rec_charptr.c: * VI users              :       Please "set tabstop=3 shiftwidth=3" to view this file,
2805 #rec_charptr.c: *                                               and edit IJB, correctly.
2806 #rec_charptr.c: *
2807 #rec_charptr.c: * Revisions   :
2808 #rec_charptr.c: *    $Log: contrib.sh,v $
2809 #rec_charptr.c: *    Revision 1.2  2002/03/24 13:25:43  swa
2810 #rec_charptr.c: *    name change related issues
2811 #rec_charptr.c: *
2812 #rec_charptr.c: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
2813 #rec_charptr.c: *    A contribution/recomendation to the IJBSWA group for a generic doubly
2814 #rec_charptr.c: *    linked list.  This file is a home brew "bash tar" (I cannot create a
2815 #rec_charptr.c: *    contrib directory and I cannot upload a tarball ... it gets
2816 #rec_charptr.c: *    corrupted).  This script will expand all files needed to create the
2817 #rec_charptr.c: *    linked list modules and an example program.  Please see the README.
2818 #rec_charptr.c: *    Feed back is welcomed.  Enjoy.
2819 #rec_charptr.c: *
2820 #rec_charptr.c: *
2821 #rec_charptr.c: *********************************************************************/
2822 #rec_charptr.c:\f
2823 #rec_charptr.c:
2824 #rec_charptr.c:#include <malloc.h>
2825 #rec_charptr.c:#include <stdio.h>
2826 #rec_charptr.c:#include <stdlib.h>
2827 #rec_charptr.c:#include <string.h>
2828 #rec_charptr.c:
2829 #rec_charptr.c:#include "gen_list.h"
2830 #rec_charptr.c:#include "rec_charptr.h"
2831 #rec_charptr.c:#include "malloc_police.h"
2832 #rec_charptr.c:
2833 #rec_charptr.c:const char rec_charptr_h_rcs[] = REC_CHARPTR_H_VERSION;
2834 #rec_charptr.c:
2835 #rec_charptr.c:
2836 #rec_charptr.c:static const rec_method rec_charptr_vtable[] =
2837 #rec_charptr.c:{
2838 #rec_charptr.c: (rec_method)derived_rec_charptr_copy_construct,
2839 #rec_charptr.c: (rec_method)derived_rec_charptr_destruct,
2840 #rec_charptr.c: (rec_method)derived_rec_charptr_stream,
2841 #rec_charptr.c: (rec_method)derived_rec_charptr_equal
2842 #rec_charptr.c:};
2843 #rec_charptr.c:
2844 #rec_charptr.c:
2845 #rec_charptr.c:/*********************************************************************
2846 #rec_charptr.c: *
2847 #rec_charptr.c: * Function    :  derived_rec_charptr_construct
2848 #rec_charptr.c: *
2849 #rec_charptr.c: * Description :  A simple derived record class that contains 1 string.
2850 #rec_charptr.c: *
2851 #rec_charptr.c: * Parameters  :
2852 #rec_charptr.c: *          1  :  The record
2853 #rec_charptr.c: *          2  :  The string to contain.
2854 #rec_charptr.c: *
2855 #rec_charptr.c: * Returns     :  A pointer to the constructed record.
2856 #rec_charptr.c: *
2857 #rec_charptr.c: *********************************************************************/
2858 #rec_charptr.c:struct derived_rec_charptr *derived_rec_charptr_construct( const char *_contents )
2859 #rec_charptr.c:{
2860 #rec_charptr.c: struct derived_rec_charptr *this_rec = (struct derived_rec_charptr *)gen_list_rec_construct(
2861 #rec_charptr.c:         ISA_CHARPTR,
2862 #rec_charptr.c:         sizeof( struct derived_rec_charptr ),
2863 #rec_charptr.c:         rec_charptr_vtable
2864 #rec_charptr.c: );
2865 #rec_charptr.c:
2866 #rec_charptr.c: this_rec->contents = STRDUP( _contents );
2867 #rec_charptr.c:
2868 #rec_charptr.c: LIST_SHOW( printf( "\
2869 #rec_charptr.c:\t\tcharptr construct new rec\t\t\t\t= %p
2870 #rec_charptr.c:\t\tcharptr construct new rec contents\t= %s\n\n", (const void *)this_rec, this_rec->contents ) );
2871 #rec_charptr.c:
2872 #rec_charptr.c: return( this_rec );
2873 #rec_charptr.c:
2874 #rec_charptr.c:}
2875 #rec_charptr.c:
2876 #rec_charptr.c:
2877 #rec_charptr.c:/*********************************************************************
2878 #rec_charptr.c: *
2879 #rec_charptr.c: * Function    :  derived_rec_charptr_copy_construct
2880 #rec_charptr.c: *
2881 #rec_charptr.c: * Description :  Copies one charptr record to another.
2882 #rec_charptr.c: *
2883 #rec_charptr.c: * Parameters  :
2884 #rec_charptr.c: *          1  :  Existing record.
2885 #rec_charptr.c: *                               2       :  Copy record.
2886 #rec_charptr.c: *
2887 #rec_charptr.c: * Returns     :  The newly constructed copy record.
2888 #rec_charptr.c: *
2889 #rec_charptr.c: *********************************************************************/
2890 #rec_charptr.c:struct derived_rec_charptr *derived_rec_charptr_copy_construct( const struct derived_rec_charptr *this_rec )
2891 #rec_charptr.c:{
2892 #rec_charptr.c: int len;
2893 #rec_charptr.c: char *new_contents;
2894 #rec_charptr.c:
2895 #rec_charptr.c: struct derived_rec_charptr *copy_rec = (struct derived_rec_charptr *)gen_list_rec_copy_construct( (struct gen_list_rec *)this_rec );
2896 #rec_charptr.c:
2897 #rec_charptr.c: len = strlen( this_rec->contents );
2898 #rec_charptr.c: len += sizeof( "COPY " );
2899 #rec_charptr.c:
2900 #rec_charptr.c: copy_rec->contents = (char *)MALLOC( len );
2901 #rec_charptr.c: strcpy( copy_rec->contents, "COPY " );
2902 #rec_charptr.c: strcat( copy_rec->contents, this_rec->contents );
2903 #rec_charptr.c:
2904 #rec_charptr.c: LIST_SHOW( printf( "\
2905 #rec_charptr.c:\t\tcharptr copy construct new gen rec\t\t\t\t= %p => %p
2906 #rec_charptr.c:\t\tcharptr copy construct new gen rec contents\t= %s\n\n", (const void *)this_rec, (const void *)copy_rec, copy_rec->contents ) );
2907 #rec_charptr.c:
2908 #rec_charptr.c:
2909 #rec_charptr.c: return( copy_rec );
2910 #rec_charptr.c:
2911 #rec_charptr.c:}
2912 #rec_charptr.c:
2913 #rec_charptr.c:
2914 #rec_charptr.c:/*********************************************************************
2915 #rec_charptr.c: *
2916 #rec_charptr.c: * Function    :  derived_rec_charptr_destruct   
2917 #rec_charptr.c: *
2918 #rec_charptr.c: * Description :  Destruct the charptr record.
2919 #rec_charptr.c: *
2920 #rec_charptr.c: * Parameters  :
2921 #rec_charptr.c: *          1  :  The record.
2922 #rec_charptr.c: *
2923 #rec_charptr.c: * Returns     :  NULL
2924 #rec_charptr.c: *
2925 #rec_charptr.c: *********************************************************************/
2926 #rec_charptr.c:struct derived_rec_charptr *derived_rec_charptr_destruct( struct derived_rec_charptr *this_rec )
2927 #rec_charptr.c:{
2928 #rec_charptr.c: LIST_SHOW( printf( "\
2929 #rec_charptr.c:\t\tcharptr destruct this_rec\t\t\t\t= %p
2930 #rec_charptr.c:\t\tcharptr destruct this_rec->contents\t= %s\n\n", (const void *)this_rec, (const void *)this_rec->contents ) );
2931 #rec_charptr.c:
2932 #rec_charptr.c: memset( this_rec->contents, '!', strlen( this_rec->contents ) );
2933 #rec_charptr.c: FREE( this_rec->contents );
2934 #rec_charptr.c: return( (struct derived_rec_charptr *)gen_list_rec_destruct( (struct gen_list_rec *)this_rec ) );
2935 #rec_charptr.c:
2936 #rec_charptr.c:}
2937 #rec_charptr.c:
2938 #rec_charptr.c:
2939 #rec_charptr.c:/*********************************************************************
2940 #rec_charptr.c: *
2941 #rec_charptr.c: * Function    :  derived_rec_charptr_stream
2942 #rec_charptr.c: *
2943 #rec_charptr.c: * Description :  Displays all charptr attributes on the STDOUT stream.
2944 #rec_charptr.c: *
2945 #rec_charptr.c: * Parameters  :
2946 #rec_charptr.c: *          1  :  The record.
2947 #rec_charptr.c: *
2948 #rec_charptr.c: * Returns     :  The record.
2949 #rec_charptr.c: *
2950 #rec_charptr.c: *********************************************************************/
2951 #rec_charptr.c:const struct derived_rec_charptr *derived_rec_charptr_stream( const struct derived_rec_charptr *this_rec )
2952 #rec_charptr.c:{
2953 #rec_charptr.c: this_rec = (struct derived_rec_charptr *)gen_list_rec_stream(
2954 #rec_charptr.c:         (struct gen_list_rec *)this_rec
2955 #rec_charptr.c: );
2956 #rec_charptr.c: LIST_SHOW( printf( "\
2957 #rec_charptr.c:\t\tcharptr stream this_rec\t\t\t\t\t= %p
2958 #rec_charptr.c:\t\tcharptr stream this_rec->contents\t= %s\n\n", (const void *)this_rec, this_rec->contents ) );
2959 #rec_charptr.c:
2960 #rec_charptr.c: return( this_rec );
2961 #rec_charptr.c:
2962 #rec_charptr.c:}
2963 #rec_charptr.c:
2964 #rec_charptr.c:
2965 #rec_charptr.c:/*********************************************************************
2966 #rec_charptr.c: *
2967 #rec_charptr.c: * Function    :  derived_rec_charptr_equal
2968 #rec_charptr.c: *
2969 #rec_charptr.c: * Description :  Compares two charptr records to see if they are equal.
2970 #rec_charptr.c: *
2971 #rec_charptr.c: * Parameters  :
2972 #rec_charptr.c: *          1  :  A record.
2973 #rec_charptr.c: *          2  :  Another record.
2974 #rec_charptr.c: *
2975 #rec_charptr.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
2976 #rec_charptr.c: *
2977 #rec_charptr.c: *********************************************************************/
2978 #rec_charptr.c:int derived_rec_charptr_equal( const struct derived_rec_charptr *this_rec, const struct derived_rec_charptr *eq_rec )
2979 #rec_charptr.c:{
2980 #rec_charptr.c: if ( ! gen_list_rec_equal( (const struct gen_list_rec *)this_rec, (struct gen_list_rec *)eq_rec ) )
2981 #rec_charptr.c: {
2982 #rec_charptr.c:         return( 0 );
2983 #rec_charptr.c: }
2984 #rec_charptr.c: return( 0 == strcmp( this_rec->contents, eq_rec->contents ) );
2985 #rec_charptr.c:
2986 #rec_charptr.c:}
2987
2988
2989 #rec_charptr.h:#ifndef REC_CHARPTR_H_INCLUDED
2990 #rec_charptr.h:#define REC_CHARPTR_H_INCLUDED
2991 #rec_charptr.h:#define REC_CHARPTR_H_VERSION "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $"
2992 #rec_charptr.h:/*********************************************************************
2993 #rec_charptr.h: *
2994 #rec_charptr.h: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
2995 #rec_charptr.h: *
2996 #rec_charptr.h: * Purpose     :  A "derived class" of gen_list_rec.
2997 #rec_charptr.h: *
2998 #rec_charptr.h: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
2999 #rec_charptr.h: *                Privoxy team. http://www.privoxy.org/
3000 #rec_charptr.h: *
3001 #rec_charptr.h: *                This program is free software; you can redistribute it
3002 #rec_charptr.h: *                and/or modify it under the terms of the GNU General
3003 #rec_charptr.h: *                Public License as published by the Free Software
3004 #rec_charptr.h: *                Foundation; either version 2 of the License, or (at
3005 #rec_charptr.h: *                your option) any later version.
3006 #rec_charptr.h: *
3007 #rec_charptr.h: *                This program is distributed in the hope that it will
3008 #rec_charptr.h: *                be useful, but WITHOUT ANY WARRANTY; without even the
3009 #rec_charptr.h: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
3010 #rec_charptr.h: *                PARTICULAR PURPOSE.  See the GNU General Public
3011 #rec_charptr.h: *                License for more details.
3012 #rec_charptr.h: *
3013 #rec_charptr.h: *                The GNU General Public License should be included with
3014 #rec_charptr.h: *                this file.  If not, you can view it at
3015 #rec_charptr.h: *                http://www.gnu.org/copyleft/gpl.html
3016 #rec_charptr.h: *                or write to the Free Software Foundation, Inc., 59
3017 #rec_charptr.h: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3018 #rec_charptr.h: *
3019 #rec_charptr.h: * VI users              :       Please "set tabstop=3 shiftwidth=3" to view this file,
3020 #rec_charptr.h: *                                               and edit IJB, correctly.
3021 #rec_charptr.h: *
3022 #rec_charptr.h: * Revisions   :
3023 #rec_charptr.h: *    $Log: contrib.sh,v $
3024 #rec_charptr.h: *    Revision 1.2  2002/03/24 13:25:43  swa
3025 #rec_charptr.h: *    name change related issues
3026 #rec_charptr.h: *
3027 #rec_charptr.h: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
3028 #rec_charptr.h: *    A contribution/recomendation to the IJBSWA group for a generic doubly
3029 #rec_charptr.h: *    linked list.  This file is a home brew "bash tar" (I cannot create a
3030 #rec_charptr.h: *    contrib directory and I cannot upload a tarball ... it gets
3031 #rec_charptr.h: *    corrupted).  This script will expand all files needed to create the
3032 #rec_charptr.h: *    linked list modules and an example program.  Please see the README.
3033 #rec_charptr.h: *    Feed back is welcomed.  Enjoy.
3034 #rec_charptr.h: *
3035 #rec_charptr.h: *
3036 #rec_charptr.h: *********************************************************************/
3037 #rec_charptr.h:\f
3038 #rec_charptr.h:
3039 #rec_charptr.h:#ifdef __cplusplus
3040 #rec_charptr.h:extern "C" {
3041 #rec_charptr.h:#endif
3042 #rec_charptr.h:
3043 #rec_charptr.h:
3044 #rec_charptr.h:struct derived_rec_charptr
3045 #rec_charptr.h:{
3046 #rec_charptr.h: /* private: */
3047 #rec_charptr.h: struct gen_list_rec parent_rec;
3048 #rec_charptr.h: char *contents;
3049 #rec_charptr.h:};
3050 #rec_charptr.h:
3051 #rec_charptr.h:/* public: */
3052 #rec_charptr.h:extern struct derived_rec_charptr *      derived_rec_charptr_construct( const char *_contents );
3053 #rec_charptr.h:extern struct derived_rec_charptr *      derived_rec_charptr_copy_construct( const struct derived_rec_charptr *this_rec );
3054 #rec_charptr.h:extern struct derived_rec_charptr *      derived_rec_charptr_destruct( struct derived_rec_charptr *this_rec );
3055 #rec_charptr.h:extern const struct derived_rec_charptr *derived_rec_charptr_stream( const struct derived_rec_charptr *this_rec );
3056 #rec_charptr.h:extern int                                                                       derived_rec_charptr_equal( const struct derived_rec_charptr *this_rec, const struct derived_rec_charptr *eq_rec );
3057 #rec_charptr.h:
3058 #rec_charptr.h:/* struct/class COMPLETE */
3059 #rec_charptr.h:
3060 #rec_charptr.h:
3061 #rec_charptr.h:#ifdef __cplusplus
3062 #rec_charptr.h:} /* extern "C" */
3063 #rec_charptr.h:#endif
3064 #rec_charptr.h:
3065 #rec_charptr.h:#endif /* ndef REC_CHARPTR_H_INCLUDED */
3066 #rec_charptr.h:
3067 #rec_charptr.h:/*
3068 #rec_charptr.h:  Local Variables:
3069 #rec_charptr.h:  tab-width: 3
3070 #rec_charptr.h:  end:
3071 #rec_charptr.h:*/
3072
3073
3074 #rec_double.c:const char rec_double_rcs[] = "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $";
3075 #rec_double.c:/*********************************************************************
3076 #rec_double.c: *
3077 #rec_double.c: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
3078 #rec_double.c: *
3079 #rec_double.c: * Purpose     :  A "derived class" of gen_list_rec.
3080 #rec_double.c: *
3081 #rec_double.c: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
3082 #rec_double.c: *                Privoxy team. http://www.privoxy.org/
3083 #rec_double.c: *
3084 #rec_double.c: *                This program is free software; you can redistribute it
3085 #rec_double.c: *                and/or modify it under the terms of the GNU General
3086 #rec_double.c: *                Public License as published by the Free Software
3087 #rec_double.c: *                Foundation; either version 2 of the License, or (at
3088 #rec_double.c: *                your option) any later version.
3089 #rec_double.c: *
3090 #rec_double.c: *                This program is distributed in the hope that it will
3091 #rec_double.c: *                be useful, but WITHOUT ANY WARRANTY; without even the
3092 #rec_double.c: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
3093 #rec_double.c: *                PARTICULAR PURPOSE.  See the GNU General Public
3094 #rec_double.c: *                License for more details.
3095 #rec_double.c: *
3096 #rec_double.c: *                The GNU General Public License should be included with
3097 #rec_double.c: *                this file.  If not, you can view it at
3098 #rec_double.c: *                http://www.gnu.org/copyleft/gpl.html
3099 #rec_double.c: *                or write to the Free Software Foundation, Inc., 59
3100 #rec_double.c: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3101 #rec_double.c: *
3102 #rec_double.c: * VI users               :       Please "set tabstop=3 shiftwidth=3" to view this file,
3103 #rec_double.c: *                                                and edit IJB, correctly.
3104 #rec_double.c: *
3105 #rec_double.c: * Revisions   :
3106 #rec_double.c: *    $Log: contrib.sh,v $
3107 #rec_double.c: *    Revision 1.2  2002/03/24 13:25:43  swa
3108 #rec_double.c: *    name change related issues
3109 #rec_double.c: *
3110 #rec_double.c: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
3111 #rec_double.c: *    A contribution/recomendation to the IJBSWA group for a generic doubly
3112 #rec_double.c: *    linked list.  This file is a home brew "bash tar" (I cannot create a
3113 #rec_double.c: *    contrib directory and I cannot upload a tarball ... it gets
3114 #rec_double.c: *    corrupted).  This script will expand all files needed to create the
3115 #rec_double.c: *    linked list modules and an example program.  Please see the README.
3116 #rec_double.c: *    Feed back is welcomed.  Enjoy.
3117 #rec_double.c: *
3118 #rec_double.c: *
3119 #rec_double.c: *********************************************************************/
3120 #rec_double.c:\f
3121 #rec_double.c:
3122 #rec_double.c:#include <malloc.h>
3123 #rec_double.c:#include <stdio.h>
3124 #rec_double.c:#include <stdlib.h>
3125 #rec_double.c:#include <string.h>
3126 #rec_double.c:
3127 #rec_double.c:#include "gen_list.h"
3128 #rec_double.c:#include "rec_double.h"
3129 #rec_double.c:
3130 #rec_double.c:const char rec_double_h_rcs[] = REC_DOUBLE_H_VERSION;
3131 #rec_double.c:
3132 #rec_double.c:
3133 #rec_double.c:static const rec_method rec_double_vtable[] =
3134 #rec_double.c:{
3135 #rec_double.c:  (rec_method)derived_rec_double_copy_construct,
3136 #rec_double.c:  (rec_method)derived_rec_double_destruct,
3137 #rec_double.c:  (rec_method)derived_rec_double_stream,
3138 #rec_double.c:  (rec_method)derived_rec_double_equal
3139 #rec_double.c:};
3140 #rec_double.c:
3141 #rec_double.c:
3142 #rec_double.c:/*********************************************************************
3143 #rec_double.c: *
3144 #rec_double.c: * Function    :  derived_rec_double_construct
3145 #rec_double.c: *
3146 #rec_double.c: * Description :  A simple derived record class that contains 1 string.
3147 #rec_double.c: *
3148 #rec_double.c: * Parameters  :
3149 #rec_double.c: *          1  :  The record
3150 #rec_double.c: *          2  :  The string to contain.
3151 #rec_double.c: *
3152 #rec_double.c: * Returns     :  A pointer to the constructed record.
3153 #rec_double.c: *
3154 #rec_double.c: *********************************************************************/
3155 #rec_double.c:struct derived_rec_double *derived_rec_double_construct( const double _contents )
3156 #rec_double.c:{
3157 #rec_double.c:  struct derived_rec_double *this_rec = (struct derived_rec_double *)gen_list_rec_construct(
3158 #rec_double.c:          ISA_DOUBLE,
3159 #rec_double.c:          sizeof( struct derived_rec_double ),
3160 #rec_double.c:          rec_double_vtable
3161 #rec_double.c:  );
3162 #rec_double.c:
3163 #rec_double.c:  this_rec->contents = _contents;
3164 #rec_double.c:
3165 #rec_double.c:  LIST_SHOW( printf( "\
3166 #rec_double.c:\t\tdouble construct new rec\t\t\t\t= %p
3167 #rec_double.c:\t\tdouble construct new rec contents\t= %8.2lf\n\n", (const void *)this_rec, this_rec->contents ) );
3168 #rec_double.c:
3169 #rec_double.c:  return( this_rec );
3170 #rec_double.c:
3171 #rec_double.c:}
3172 #rec_double.c:
3173 #rec_double.c:
3174 #rec_double.c:/*********************************************************************
3175 #rec_double.c: *
3176 #rec_double.c: * Function    :  derived_rec_double_copy_construct
3177 #rec_double.c: *
3178 #rec_double.c: * Description :  Copies one double record to another.
3179 #rec_double.c: *
3180 #rec_double.c: * Parameters  :
3181 #rec_double.c: *          1  :  Existing record.
3182 #rec_double.c: *                                2       :  Copy record.
3183 #rec_double.c: *
3184 #rec_double.c: * Returns     :  The newly constructed copy record.
3185 #rec_double.c: *
3186 #rec_double.c: *********************************************************************/
3187 #rec_double.c:struct derived_rec_double *derived_rec_double_copy_construct( const struct derived_rec_double *this_rec )
3188 #rec_double.c:{
3189 #rec_double.c:  struct derived_rec_double *copy_rec = (struct derived_rec_double *)gen_list_rec_copy_construct( (struct gen_list_rec *)this_rec );
3190 #rec_double.c:  copy_rec->contents = - this_rec->contents;
3191 #rec_double.c:
3192 #rec_double.c:  LIST_SHOW( printf( "\
3193 #rec_double.c:\t\tdouble copy construct new gen rec\t\t\t\t= %p => %p
3194 #rec_double.c:\t\tdouble copy construct new gen rec contents\t= %8.2lf\n\n", (const void *)this_rec, (const void *)copy_rec, copy_rec->contents ) );
3195 #rec_double.c:
3196 #rec_double.c:  return( copy_rec );
3197 #rec_double.c:
3198 #rec_double.c:}
3199 #rec_double.c:
3200 #rec_double.c:
3201 #rec_double.c:/*********************************************************************
3202 #rec_double.c: *
3203 #rec_double.c: * Function    :  derived_rec_double_destruct     
3204 #rec_double.c: *
3205 #rec_double.c: * Description :  Destruct the double record.
3206 #rec_double.c: *
3207 #rec_double.c: * Parameters  :
3208 #rec_double.c: *          1  :  The record.
3209 #rec_double.c: *
3210 #rec_double.c: * Returns     :  NULL
3211 #rec_double.c: *
3212 #rec_double.c: *********************************************************************/
3213 #rec_double.c:struct derived_rec_double *derived_rec_double_destruct( struct derived_rec_double *this_rec )
3214 #rec_double.c:{
3215 #rec_double.c:  LIST_SHOW( printf( "\
3216 #rec_double.c:\t\tdouble destruct this_rec\t\t\t\t= %p
3217 #rec_double.c:\t\tdouble destruct this_rec->contents\t= %8.2lf\n\n", (const void *)this_rec, this_rec->contents ) );
3218 #rec_double.c:
3219 #rec_double.c:  this_rec->contents = -1.1111;
3220 #rec_double.c:  return( (struct derived_rec_double *)gen_list_rec_destruct( (struct gen_list_rec *)this_rec ) );
3221 #rec_double.c:
3222 #rec_double.c:}
3223 #rec_double.c:
3224 #rec_double.c:
3225 #rec_double.c:/*********************************************************************
3226 #rec_double.c: *
3227 #rec_double.c: * Function    :  derived_rec_double_stream
3228 #rec_double.c: *
3229 #rec_double.c: * Description :  Displays all double attributes on the STDOUT stream.
3230 #rec_double.c: *
3231 #rec_double.c: * Parameters  :
3232 #rec_double.c: *          1  :  The record.
3233 #rec_double.c: *
3234 #rec_double.c: * Returns     :  The record.
3235 #rec_double.c: *
3236 #rec_double.c: *********************************************************************/
3237 #rec_double.c:const struct derived_rec_double *derived_rec_double_stream( const struct derived_rec_double *this_rec )
3238 #rec_double.c:{
3239 #rec_double.c:  this_rec = (struct derived_rec_double *)gen_list_rec_stream(
3240 #rec_double.c:          (struct gen_list_rec *)this_rec
3241 #rec_double.c:  );
3242 #rec_double.c:  LIST_SHOW( printf( "\
3243 #rec_double.c:\t\tdouble stream this_rec\t\t\t\t= %p
3244 #rec_double.c:\t\tdouble stream this_rec->contents\t= %8.2lf\n\n", (const void *)this_rec, this_rec->contents ) );
3245 #rec_double.c:
3246 #rec_double.c:  return( this_rec );
3247 #rec_double.c:
3248 #rec_double.c:}
3249 #rec_double.c:
3250 #rec_double.c:
3251 #rec_double.c:/*********************************************************************
3252 #rec_double.c: *
3253 #rec_double.c: * Function    :  derived_rec_double_equal
3254 #rec_double.c: *
3255 #rec_double.c: * Description :  Compares two double records to see if they are equal.
3256 #rec_double.c: *
3257 #rec_double.c: * Parameters  :
3258 #rec_double.c: *          1  :  A record.
3259 #rec_double.c: *          2  :  Another record.
3260 #rec_double.c: *
3261 #rec_double.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
3262 #rec_double.c: *
3263 #rec_double.c: *********************************************************************/
3264 #rec_double.c:int derived_rec_double_equal( const struct derived_rec_double *this_rec, const struct derived_rec_double *eq_rec )
3265 #rec_double.c:{
3266 #rec_double.c:  if ( ! gen_list_rec_equal( (const struct gen_list_rec *)this_rec, (struct gen_list_rec *)eq_rec ) )
3267 #rec_double.c:  {
3268 #rec_double.c:          return( 0 );
3269 #rec_double.c:  }
3270 #rec_double.c:  return( this_rec->contents == eq_rec->contents );
3271 #rec_double.c:
3272 #rec_double.c:}
3273
3274
3275 #rec_double.h:#ifndef REC_DOUBLE_H_INCLUDED
3276 #rec_double.h:#define REC_DOUBLE_H_INCLUDED
3277 #rec_double.h:#define REC_DOUBLE_H_VERSION "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $"
3278 #rec_double.h:/*********************************************************************
3279 #rec_double.h: *
3280 #rec_double.h: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
3281 #rec_double.h: *
3282 #rec_double.h: * Purpose     :  gen_A "derived class" of gen_list_rec.
3283 #rec_double.h: *
3284 #rec_double.h: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
3285 #rec_double.h: *                Privoxy team. http://www.privoxy.org/
3286 #rec_double.h: *
3287 #rec_double.h: *                This program is free software; you can redistribute it
3288 #rec_double.h: *                and/or modify it under the terms of the GNU General
3289 #rec_double.h: *                Public License as published by the Free Software
3290 #rec_double.h: *                Foundation; either version 2 of the License, or (at
3291 #rec_double.h: *                your option) any later version.
3292 #rec_double.h: *
3293 #rec_double.h: *                This program is distributed in the hope that it will
3294 #rec_double.h: *                be useful, but WITHOUT ANY WARRANTY; without even the
3295 #rec_double.h: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
3296 #rec_double.h: *                PARTICULAR PURPOSE.  See the GNU General Public
3297 #rec_double.h: *                License for more details.
3298 #rec_double.h: *
3299 #rec_double.h: *                The GNU General Public License should be included with
3300 #rec_double.h: *                this file.  If not, you can view it at
3301 #rec_double.h: *                http://www.gnu.org/copyleft/gpl.html
3302 #rec_double.h: *                or write to the Free Software Foundation, Inc., 59
3303 #rec_double.h: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3304 #rec_double.h: *
3305 #rec_double.h: * VI users               :       Please "set tabstop=3 shiftwidth=3" to view this file,
3306 #rec_double.h: *                                                and edit IJB, correctly.
3307 #rec_double.h: *
3308 #rec_double.h: * Revisions   :
3309 #rec_double.h: *    $Log: contrib.sh,v $
3310 #rec_double.h: *    Revision 1.2  2002/03/24 13:25:43  swa
3311 #rec_double.h: *    name change related issues
3312 #rec_double.h: *
3313 #rec_double.h: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
3314 #rec_double.h: *    A contribution/recomendation to the IJBSWA group for a generic doubly
3315 #rec_double.h: *    linked list.  This file is a home brew "bash tar" (I cannot create a
3316 #rec_double.h: *    contrib directory and I cannot upload a tarball ... it gets
3317 #rec_double.h: *    corrupted).  This script will expand all files needed to create the
3318 #rec_double.h: *    linked list modules and an example program.  Please see the README.
3319 #rec_double.h: *    Feed back is welcomed.  Enjoy.
3320 #rec_double.h: *
3321 #rec_double.h: *
3322 #rec_double.h: *********************************************************************/
3323 #rec_double.h:\f
3324 #rec_double.h:
3325 #rec_double.h:#ifdef __cplusplus
3326 #rec_double.h:extern "C" {
3327 #rec_double.h:#endif
3328 #rec_double.h:
3329 #rec_double.h:
3330 #rec_double.h:struct derived_rec_double
3331 #rec_double.h:{
3332 #rec_double.h:  /* private: */
3333 #rec_double.h:  struct gen_list_rec parent_rec;
3334 #rec_double.h:  double contents;
3335 #rec_double.h:};
3336 #rec_double.h:
3337 #rec_double.h:/* public: */
3338 #rec_double.h:extern struct derived_rec_double *        derived_rec_double_construct( const double _contents );
3339 #rec_double.h:extern struct derived_rec_double *        derived_rec_double_copy_construct( const struct derived_rec_double *this_rec );
3340 #rec_double.h:extern struct derived_rec_double *        derived_rec_double_destruct( struct derived_rec_double *this_rec );
3341 #rec_double.h:extern const struct derived_rec_double *derived_rec_double_stream( const struct derived_rec_double *this_rec );
3342 #rec_double.h:extern int                                                                derived_rec_double_equal( const struct derived_rec_double *this_rec, const struct derived_rec_double *eq_rec );
3343 #rec_double.h:
3344 #rec_double.h:/* struct/class COMPLETE */
3345 #rec_double.h:
3346 #rec_double.h:
3347 #rec_double.h:#ifdef __cplusplus
3348 #rec_double.h:} /* extern "C" */
3349 #rec_double.h:#endif
3350 #rec_double.h:
3351 #rec_double.h:#endif /* ndef REC_DOUBLE_H_INCLUDED */
3352 #rec_double.h:
3353 #rec_double.h:/*
3354 #rec_double.h:  Local Variables:
3355 #rec_double.h:  tab-width: 3
3356 #rec_double.h:  end:
3357 #rec_double.h:*/
3358
3359
3360 #rec_long.c:const char rec_long_rcs[] = "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $";
3361 #rec_long.c:/*********************************************************************
3362 #rec_long.c: *
3363 #rec_long.c: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
3364 #rec_long.c: *
3365 #rec_long.c: * Purpose     :  A "derived class" of gen_list_rec.
3366 #rec_long.c: *
3367 #rec_long.c: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
3368 #rec_long.c: *                Privoxy team. http://www.privoxy.org/
3369 #rec_long.c: *
3370 #rec_long.c: *                This program is free software; you can redistribute it
3371 #rec_long.c: *                and/or modify it under the terms of the GNU General
3372 #rec_long.c: *                Public License as published by the Free Software
3373 #rec_long.c: *                Foundation; either version 2 of the License, or (at
3374 #rec_long.c: *                your option) any later version.
3375 #rec_long.c: *
3376 #rec_long.c: *                This program is distributed in the hope that it will
3377 #rec_long.c: *                be useful, but WITHOUT ANY WARRANTY; without even the
3378 #rec_long.c: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
3379 #rec_long.c: *                PARTICULAR PURPOSE.  See the GNU General Public
3380 #rec_long.c: *                License for more details.
3381 #rec_long.c: *
3382 #rec_long.c: *                The GNU General Public License should be included with
3383 #rec_long.c: *                this file.  If not, you can view it at
3384 #rec_long.c: *                http://www.gnu.org/copyleft/gpl.html
3385 #rec_long.c: *                or write to the Free Software Foundation, Inc., 59
3386 #rec_long.c: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3387 #rec_long.c: *
3388 #rec_long.c: * VI users         :       Please "set tabstop=3 shiftwidth=3" to view this file,
3389 #rec_long.c: *                                          and edit IJB, correctly.
3390 #rec_long.c: *
3391 #rec_long.c: * Revisions   :
3392 #rec_long.c: *    $Log: contrib.sh,v $
3393 #rec_long.c: *    Revision 1.2  2002/03/24 13:25:43  swa
3394 #rec_long.c: *    name change related issues
3395 #rec_long.c: *
3396 #rec_long.c: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
3397 #rec_long.c: *    A contribution/recomendation to the IJBSWA group for a generic doubly
3398 #rec_long.c: *    linked list.  This file is a home brew "bash tar" (I cannot create a
3399 #rec_long.c: *    contrib directory and I cannot upload a tarball ... it gets
3400 #rec_long.c: *    corrupted).  This script will expand all files needed to create the
3401 #rec_long.c: *    linked list modules and an example program.  Please see the README.
3402 #rec_long.c: *    Feed back is welcomed.  Enjoy.
3403 #rec_long.c: *
3404 #rec_long.c: *
3405 #rec_long.c: *********************************************************************/
3406 #rec_long.c:\f
3407 #rec_long.c:
3408 #rec_long.c:#include <malloc.h>
3409 #rec_long.c:#include <stdio.h>
3410 #rec_long.c:#include <stdlib.h>
3411 #rec_long.c:#include <string.h>
3412 #rec_long.c:
3413 #rec_long.c:#include "gen_list.h"
3414 #rec_long.c:#include "rec_long.h"
3415 #rec_long.c:
3416 #rec_long.c:const char rec_long_h_rcs[] = REC_LONG_H_VERSION;
3417 #rec_long.c:
3418 #rec_long.c:
3419 #rec_long.c:static const rec_method rec_long_vtable[] =
3420 #rec_long.c:{
3421 #rec_long.c:    (rec_method)derived_rec_long_copy_construct,
3422 #rec_long.c:    (rec_method)derived_rec_long_destruct,
3423 #rec_long.c:    (rec_method)derived_rec_long_stream,
3424 #rec_long.c:    (rec_method)derived_rec_long_equal
3425 #rec_long.c:};
3426 #rec_long.c:
3427 #rec_long.c:
3428 #rec_long.c:/*********************************************************************
3429 #rec_long.c: *
3430 #rec_long.c: * Function    :  derived_rec_long_construct
3431 #rec_long.c: *
3432 #rec_long.c: * Description :  A simple derived record class that contains 1 string.
3433 #rec_long.c: *
3434 #rec_long.c: * Parameters  :
3435 #rec_long.c: *          1  :  The record
3436 #rec_long.c: *          2  :  The string to contain.
3437 #rec_long.c: *
3438 #rec_long.c: * Returns     :  A pointer to the constructed record.
3439 #rec_long.c: *
3440 #rec_long.c: *********************************************************************/
3441 #rec_long.c:struct derived_rec_long *derived_rec_long_construct( const long _contents )
3442 #rec_long.c:{
3443 #rec_long.c:    struct derived_rec_long *this_rec = (struct derived_rec_long *)gen_list_rec_construct(
3444 #rec_long.c:            ISA_LONG,
3445 #rec_long.c:            sizeof( struct derived_rec_long ),
3446 #rec_long.c:            rec_long_vtable
3447 #rec_long.c:    );
3448 #rec_long.c:
3449 #rec_long.c:    this_rec->contents = _contents;
3450 #rec_long.c:
3451 #rec_long.c:    LIST_SHOW( printf( "\
3452 #rec_long.c:\t\tlong construct new rec\t\t\t\t= %p
3453 #rec_long.c:\t\tlong construct new rec contents\t= %d\n\n", (const void *)this_rec, this_rec->contents ) );
3454 #rec_long.c:
3455 #rec_long.c:    return( this_rec );
3456 #rec_long.c:
3457 #rec_long.c:}
3458 #rec_long.c:
3459 #rec_long.c:
3460 #rec_long.c:/*********************************************************************
3461 #rec_long.c: *
3462 #rec_long.c: * Function    :  derived_rec_long_copy_construct
3463 #rec_long.c: *
3464 #rec_long.c: * Description :  Copies one long record to another.
3465 #rec_long.c: *
3466 #rec_long.c: * Parameters  :
3467 #rec_long.c: *          1  :  Existing record.
3468 #rec_long.c: *                          2       :  Copy record.
3469 #rec_long.c: *
3470 #rec_long.c: * Returns     :  The newly constructed copy record.
3471 #rec_long.c: *
3472 #rec_long.c: *********************************************************************/
3473 #rec_long.c:struct derived_rec_long *derived_rec_long_copy_construct( const struct derived_rec_long *this_rec )
3474 #rec_long.c:{
3475 #rec_long.c:    struct derived_rec_long *copy_rec = (struct derived_rec_long *)gen_list_rec_copy_construct( (struct gen_list_rec *)this_rec );
3476 #rec_long.c:    copy_rec->contents = - this_rec->contents;
3477 #rec_long.c:
3478 #rec_long.c:    LIST_SHOW( printf( "\
3479 #rec_long.c:\t\tlong copy construct new gen rec\t\t\t\t= %p => %p
3480 #rec_long.c:\t\tlong copy construct new gen rec contents\t= %d\n\n", (const void *)this_rec, (const void *)copy_rec, copy_rec->contents ) );
3481 #rec_long.c:
3482 #rec_long.c:    return( copy_rec );
3483 #rec_long.c:
3484 #rec_long.c:}
3485 #rec_long.c:
3486 #rec_long.c:
3487 #rec_long.c:/*********************************************************************
3488 #rec_long.c: *
3489 #rec_long.c: * Function    :  derived_rec_long_destruct 
3490 #rec_long.c: *
3491 #rec_long.c: * Description :  Destruct the long record.
3492 #rec_long.c: *
3493 #rec_long.c: * Parameters  :
3494 #rec_long.c: *          1  :  The record.
3495 #rec_long.c: *
3496 #rec_long.c: * Returns     :  NULL
3497 #rec_long.c: *
3498 #rec_long.c: *********************************************************************/
3499 #rec_long.c:struct derived_rec_long *derived_rec_long_destruct( struct derived_rec_long *this_rec )
3500 #rec_long.c:{
3501 #rec_long.c:    LIST_SHOW( printf( "\
3502 #rec_long.c:\t\tlong destruct this_rec\t\t\t\t= %p
3503 #rec_long.c:\t\tlong destruct this_rec->contents\t= %d\n\n", (const void *)this_rec, this_rec->contents ) );
3504 #rec_long.c:
3505 #rec_long.c:    this_rec->contents = -1;
3506 #rec_long.c:    return( (struct derived_rec_long *)gen_list_rec_destruct( (struct gen_list_rec *)this_rec ) );
3507 #rec_long.c:
3508 #rec_long.c:}
3509 #rec_long.c:
3510 #rec_long.c:
3511 #rec_long.c:/*********************************************************************
3512 #rec_long.c: *
3513 #rec_long.c: * Function    :  derived_rec_long_stream
3514 #rec_long.c: *
3515 #rec_long.c: * Description :  Displays all long attributes on the STDOUT stream.
3516 #rec_long.c: *
3517 #rec_long.c: * Parameters  :
3518 #rec_long.c: *          1  :  The record.
3519 #rec_long.c: *
3520 #rec_long.c: * Returns     :  The record.
3521 #rec_long.c: *
3522 #rec_long.c: *********************************************************************/
3523 #rec_long.c:const struct derived_rec_long *derived_rec_long_stream( const struct derived_rec_long *this_rec )
3524 #rec_long.c:{
3525 #rec_long.c:    this_rec = (struct derived_rec_long *)gen_list_rec_stream(
3526 #rec_long.c:            (struct gen_list_rec *)this_rec
3527 #rec_long.c:    );
3528 #rec_long.c:    LIST_SHOW( printf( "\
3529 #rec_long.c:\t\tlong stream this_rec\t\t\t\t\t= %p
3530 #rec_long.c:\t\tlong stream this_rec->contents\t= %d\n\n", (const void *)this_rec, this_rec->contents ) );
3531 #rec_long.c:
3532 #rec_long.c:    return( this_rec );
3533 #rec_long.c:
3534 #rec_long.c:}
3535 #rec_long.c:
3536 #rec_long.c:
3537 #rec_long.c:/*********************************************************************
3538 #rec_long.c: *
3539 #rec_long.c: * Function    :  derived_rec_long_equal
3540 #rec_long.c: *
3541 #rec_long.c: * Description :  Compares two long records to see if they are equal.
3542 #rec_long.c: *
3543 #rec_long.c: * Parameters  :
3544 #rec_long.c: *          1  :  A record.
3545 #rec_long.c: *          2  :  Another record.
3546 #rec_long.c: *
3547 #rec_long.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
3548 #rec_long.c: *
3549 #rec_long.c: *********************************************************************/
3550 #rec_long.c:int derived_rec_long_equal( const struct derived_rec_long *this_rec, const struct derived_rec_long *eq_rec )
3551 #rec_long.c:{
3552 #rec_long.c:    if ( ! gen_list_rec_equal( (const struct gen_list_rec *)this_rec, (struct gen_list_rec *)eq_rec ) )
3553 #rec_long.c:    {
3554 #rec_long.c:            return( 0 );
3555 #rec_long.c:    }
3556 #rec_long.c:    return( this_rec->contents == eq_rec->contents );
3557 #rec_long.c:
3558 #rec_long.c:}
3559
3560
3561 #rec_long.h:#ifndef REC_LONG_H_INCLUDED
3562 #rec_long.h:#define REC_LONG_H_INCLUDED
3563 #rec_long.h:#define REC_LONG_H_VERSION "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $"
3564 #rec_long.h:/*********************************************************************
3565 #rec_long.h: *
3566 #rec_long.h: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
3567 #rec_long.h: *
3568 #rec_long.h: * Purpose     :  A "derived class" of gen_list_rec.
3569 #rec_long.h: *
3570 #rec_long.h: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
3571 #rec_long.h: *                Privoxy team. http://www.privoxy.org/
3572 #rec_long.h: *
3573 #rec_long.h: *                This program is free software; you can redistribute it
3574 #rec_long.h: *                and/or modify it under the terms of the GNU General
3575 #rec_long.h: *                Public License as published by the Free Software
3576 #rec_long.h: *                Foundation; either version 2 of the License, or (at
3577 #rec_long.h: *                your option) any later version.
3578 #rec_long.h: *
3579 #rec_long.h: *                This program is distributed in the hope that it will
3580 #rec_long.h: *                be useful, but WITHOUT ANY WARRANTY; without even the
3581 #rec_long.h: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
3582 #rec_long.h: *                PARTICULAR PURPOSE.  See the GNU General Public
3583 #rec_long.h: *                License for more details.
3584 #rec_long.h: *
3585 #rec_long.h: *                The GNU General Public License should be included with
3586 #rec_long.h: *                this file.  If not, you can view it at
3587 #rec_long.h: *                http://www.gnu.org/copyleft/gpl.html
3588 #rec_long.h: *                or write to the Free Software Foundation, Inc., 59
3589 #rec_long.h: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3590 #rec_long.h: *
3591 #rec_long.h: * VI users         :       Please "set tabstop=3 shiftwidth=3" to view this file,
3592 #rec_long.h: *                                          and edit IJB, correctly.
3593 #rec_long.h: *
3594 #rec_long.h: * Revisions   :
3595 #rec_long.h: *    $Log: contrib.sh,v $
3596 #rec_long.h: *    Revision 1.2  2002/03/24 13:25:43  swa
3597 #rec_long.h: *    name change related issues
3598 #rec_long.h: *
3599 #rec_long.h: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
3600 #rec_long.h: *    A contribution/recomendation to the IJBSWA group for a generic doubly
3601 #rec_long.h: *    linked list.  This file is a home brew "bash tar" (I cannot create a
3602 #rec_long.h: *    contrib directory and I cannot upload a tarball ... it gets
3603 #rec_long.h: *    corrupted).  This script will expand all files needed to create the
3604 #rec_long.h: *    linked list modules and an example program.  Please see the README.
3605 #rec_long.h: *    Feed back is welcomed.  Enjoy.
3606 #rec_long.h: *
3607 #rec_long.h: *
3608 #rec_long.h: *********************************************************************/
3609 #rec_long.h:\f
3610 #rec_long.h:
3611 #rec_long.h:#ifdef __cplusplus
3612 #rec_long.h:extern "C" {
3613 #rec_long.h:#endif
3614 #rec_long.h:
3615 #rec_long.h:
3616 #rec_long.h:struct derived_rec_long
3617 #rec_long.h:{
3618 #rec_long.h:    /* private: */
3619 #rec_long.h:    struct gen_list_rec parent_rec;
3620 #rec_long.h:    long contents;
3621 #rec_long.h:};
3622 #rec_long.h:
3623 #rec_long.h:/* public: */
3624 #rec_long.h:extern struct derived_rec_long *    derived_rec_long_construct( const long _contents );
3625 #rec_long.h:extern struct derived_rec_long *    derived_rec_long_copy_construct( const struct derived_rec_long *this_rec );
3626 #rec_long.h:extern struct derived_rec_long *    derived_rec_long_destruct( struct derived_rec_long *this_rec );
3627 #rec_long.h:extern const struct derived_rec_long *derived_rec_long_stream( const struct derived_rec_long *this_rec );
3628 #rec_long.h:extern int                                                          derived_rec_long_equal( const struct derived_rec_long *this_rec, const struct derived_rec_long *eq_rec );
3629 #rec_long.h:
3630 #rec_long.h:/* struct/class COMPLETE */
3631 #rec_long.h:
3632 #rec_long.h:
3633 #rec_long.h:#ifdef __cplusplus
3634 #rec_long.h:} /* extern "C" */
3635 #rec_long.h:#endif
3636 #rec_long.h:
3637 #rec_long.h:#endif /* ndef REC_LONG_H_INCLUDED */
3638 #rec_long.h:
3639 #rec_long.h:/*
3640 #rec_long.h:  Local Variables:
3641 #rec_long.h:  tab-width: 3
3642 #rec_long.h:  end:
3643 #rec_long.h:*/
3644
3645
3646 #rec_malloc_police.c:const char rec_malloc_police_rcs[] = "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $";
3647 #rec_malloc_police.c:/*********************************************************************
3648 #rec_malloc_police.c: *
3649 #rec_malloc_police.c: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
3650 #rec_malloc_police.c: *
3651 #rec_malloc_police.c: * Purpose     :  A "derived class" of gen_list_rec.
3652 #rec_malloc_police.c: *                                         This class helps to build a list of allocated and
3653 #rec_malloc_police.c: *                                         freed memory.  When the program exits, we will print
3654 #rec_malloc_police.c: *                                         a list of all memory that was allocated, but never
3655 #rec_malloc_police.c: *                                         freed.  This could be most helpful to developers
3656 #rec_malloc_police.c: *                                         and debugers.
3657 #rec_malloc_police.c: *
3658 #rec_malloc_police.c: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
3659 #rec_malloc_police.c: *                Privoxy team. http://www.privoxy.org/
3660 #rec_malloc_police.c: *
3661 #rec_malloc_police.c: *                This program is free software; you can redistribute it
3662 #rec_malloc_police.c: *                and/or modify it under the terms of the GNU General
3663 #rec_malloc_police.c: *                Public License as published by the Free Software
3664 #rec_malloc_police.c: *                Foundation; either version 2 of the License, or (at
3665 #rec_malloc_police.c: *                your option) any later version.
3666 #rec_malloc_police.c: *
3667 #rec_malloc_police.c: *                This program is distributed in the hope that it will
3668 #rec_malloc_police.c: *                be useful, but WITHOUT ANY WARRANTY; without even the
3669 #rec_malloc_police.c: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
3670 #rec_malloc_police.c: *                PARTICULAR PURPOSE.  See the GNU General Public
3671 #rec_malloc_police.c: *                License for more details.
3672 #rec_malloc_police.c: *
3673 #rec_malloc_police.c: *                The GNU General Public License should be included with
3674 #rec_malloc_police.c: *                this file.  If not, you can view it at
3675 #rec_malloc_police.c: *                http://www.gnu.org/copyleft/gpl.html
3676 #rec_malloc_police.c: *                or write to the Free Software Foundation, Inc., 59
3677 #rec_malloc_police.c: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3678 #rec_malloc_police.c: *
3679 #rec_malloc_police.c: * VI users                :       Please "set tabstop=3 shiftwidth=3" to view this file,
3680 #rec_malloc_police.c: *                                         and edit IJB, correctly.
3681 #rec_malloc_police.c: *
3682 #rec_malloc_police.c: * Revisions   :
3683 #rec_malloc_police.c: *    $Log: contrib.sh,v $
3684 #rec_malloc_police.c: *    Revision 1.2  2002/03/24 13:25:43  swa
3685 #rec_malloc_police.c: *    name change related issues
3686 #rec_malloc_police.c: *
3687 #rec_malloc_police.c: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
3688 #rec_malloc_police.c: *    A contribution/recomendation to the IJBSWA group for a generic doubly
3689 #rec_malloc_police.c: *    linked list.  This file is a home brew "bash tar" (I cannot create a
3690 #rec_malloc_police.c: *    contrib directory and I cannot upload a tarball ... it gets
3691 #rec_malloc_police.c: *    corrupted).  This script will expand all files needed to create the
3692 #rec_malloc_police.c: *    linked list modules and an example program.  Please see the README.
3693 #rec_malloc_police.c: *    Feed back is welcomed.  Enjoy.
3694 #rec_malloc_police.c: *
3695 #rec_malloc_police.c: *
3696 #rec_malloc_police.c: *********************************************************************/
3697 #rec_malloc_police.c:\f
3698 #rec_malloc_police.c:
3699 #rec_malloc_police.c:#include <stdio.h>
3700 #rec_malloc_police.c:
3701 #rec_malloc_police.c:#include "gen_list.h"
3702 #rec_malloc_police.c:#include "malloc_police.h"
3703 #rec_malloc_police.c:#include "rec_malloc_police.h"
3704 #rec_malloc_police.c:
3705 #rec_malloc_police.c:const char rec_malloc_police_h_rcs[] = REC_MALLOC_POLICE_H_VERSION;
3706 #rec_malloc_police.c:
3707 #rec_malloc_police.c:
3708 #rec_malloc_police.c:static const rec_method rec_malloc_police_vtable[] =
3709 #rec_malloc_police.c:{
3710 #rec_malloc_police.c:   (rec_method)derived_rec_malloc_police_copy_construct,
3711 #rec_malloc_police.c:   (rec_method)derived_rec_malloc_police_destruct,
3712 #rec_malloc_police.c:   (rec_method)derived_rec_malloc_police_stream,
3713 #rec_malloc_police.c:   (rec_method)derived_rec_malloc_police_equal
3714 #rec_malloc_police.c:};
3715 #rec_malloc_police.c:
3716 #rec_malloc_police.c:
3717 #rec_malloc_police.c:/*********************************************************************
3718 #rec_malloc_police.c: *
3719 #rec_malloc_police.c: * Function    :  derived_rec_malloc_police_construct
3720 #rec_malloc_police.c: *
3721 #rec_malloc_police.c: * Description :  A simple derived record class that contains 1 string.
3722 #rec_malloc_police.c: *
3723 #rec_malloc_police.c: * Parameters  :
3724 #rec_malloc_police.c: *          1  :  The record
3725 #rec_malloc_police.c: *          2  :  The string to contain.
3726 #rec_malloc_police.c: *
3727 #rec_malloc_police.c: * Returns     :  A pointer to the constructed record.
3728 #rec_malloc_police.c: *
3729 #rec_malloc_police.c: *********************************************************************/
3730 #rec_malloc_police.c:struct derived_rec_malloc_police *derived_rec_malloc_police_construct( void *_alloced_addr, char *_source_where, size_t _sz )
3731 #rec_malloc_police.c:{
3732 #rec_malloc_police.c:   struct derived_rec_malloc_police *this_rec;
3733 #rec_malloc_police.c:   list_is_quiet ++;
3734 #rec_malloc_police.c:
3735 #rec_malloc_police.c:   this_rec = (struct derived_rec_malloc_police *)gen_list_rec_construct(
3736 #rec_malloc_police.c:           ISA_MALLOC_POLICE,
3737 #rec_malloc_police.c:           sizeof( struct derived_rec_malloc_police ),
3738 #rec_malloc_police.c:           rec_malloc_police_vtable
3739 #rec_malloc_police.c:   );
3740 #rec_malloc_police.c:
3741 #rec_malloc_police.c:   this_rec->alloced_addr  = _alloced_addr;
3742 #rec_malloc_police.c:   this_rec->source_where  = STRDUP( _source_where );
3743 #rec_malloc_police.c:   this_rec->sz                            = _sz;
3744 #rec_malloc_police.c:
3745 #rec_malloc_police.c:/*         LIST_SHOW( printf( "\ */
3746 #rec_malloc_police.c:/* \t\tmalloc_police construct new rec\t\t\t\t\t= %p */
3747 #rec_malloc_police.c:/* \t\tmalloc_police construct new rec alloced_addr = %p */
3748 #rec_malloc_police.c:/* \t\tmalloc_police construct new rec source_where = %s */
3749 #rec_malloc_police.c:/* \t\tmalloc_police construct new rec sz\t\t\t\t\t= %ld\n\n", */
3750 #rec_malloc_police.c:/*                           (const void *)this_rec, */
3751 #rec_malloc_police.c:/*                           this_rec->alloced_addr, */
3752 #rec_malloc_police.c:/*                           this_rec->source_where, */
3753 #rec_malloc_police.c:/*                           this_rec->sz */
3754 #rec_malloc_police.c:/*         ) ); */
3755 #rec_malloc_police.c:
3756 #rec_malloc_police.c:   list_is_quiet --;
3757 #rec_malloc_police.c:
3758 #rec_malloc_police.c:   return( this_rec );
3759 #rec_malloc_police.c:
3760 #rec_malloc_police.c:}
3761 #rec_malloc_police.c:
3762 #rec_malloc_police.c:
3763 #rec_malloc_police.c:/*********************************************************************
3764 #rec_malloc_police.c: *
3765 #rec_malloc_police.c: * Function    :  derived_rec_malloc_police_copy_construct
3766 #rec_malloc_police.c: *
3767 #rec_malloc_police.c: * Description :  Copies one malloc_police record to another.
3768 #rec_malloc_police.c: *
3769 #rec_malloc_police.c: * Parameters  :
3770 #rec_malloc_police.c: *          1  :  Existing record.
3771 #rec_malloc_police.c: *                         2       :  Copy record.
3772 #rec_malloc_police.c: *
3773 #rec_malloc_police.c: * Returns     :  The newly constructed copy record.
3774 #rec_malloc_police.c: *
3775 #rec_malloc_police.c: *********************************************************************/
3776 #rec_malloc_police.c:struct derived_rec_malloc_police *derived_rec_malloc_police_copy_construct( const struct derived_rec_malloc_police *this_rec )
3777 #rec_malloc_police.c:{
3778 #rec_malloc_police.c:   int len;
3779 #rec_malloc_police.c:   char *new_contents;
3780 #rec_malloc_police.c:   struct derived_rec_malloc_police *copy_rec;
3781 #rec_malloc_police.c:
3782 #rec_malloc_police.c:   list_is_quiet ++;
3783 #rec_malloc_police.c:
3784 #rec_malloc_police.c:   copy_rec = (struct derived_rec_malloc_police *)gen_list_rec_copy_construct( (struct gen_list_rec *)this_rec );
3785 #rec_malloc_police.c:
3786 #rec_malloc_police.c:   copy_rec->alloced_addr  = this_rec->alloced_addr;
3787 #rec_malloc_police.c:   copy_rec->source_where  = STRDUP( this_rec->source_where );
3788 #rec_malloc_police.c:   copy_rec->sz                            = this_rec->sz;
3789 #rec_malloc_police.c:
3790 #rec_malloc_police.c:/*         LIST_SHOW( printf( "\ */
3791 #rec_malloc_police.c:/* \t\tmalloc_police copy construct new gen rec = %p => %p */
3792 #rec_malloc_police.c:/* \t\tmalloc_police copy construct new gen rec alloced_addr = %p */
3793 #rec_malloc_police.c:/* \t\tmalloc_police copy construct new gen rec source_where = %s */
3794 #rec_malloc_police.c:/* \t\tmalloc_police copy construct new gen rec sz\t\t\t\t\t= %ld\n\n", */
3795 #rec_malloc_police.c:/*                           (const void *)this_rec, (const void *)copy_rec, */
3796 #rec_malloc_police.c:/*                           copy_rec->alloced_addr, */
3797 #rec_malloc_police.c:/*                           copy_rec->source_where, */
3798 #rec_malloc_police.c:/*                           copy_rec->sz */
3799 #rec_malloc_police.c:/*         ) ); */
3800 #rec_malloc_police.c:
3801 #rec_malloc_police.c:   list_is_quiet --;
3802 #rec_malloc_police.c:
3803 #rec_malloc_police.c:   return( copy_rec );
3804 #rec_malloc_police.c:
3805 #rec_malloc_police.c:}
3806 #rec_malloc_police.c:
3807 #rec_malloc_police.c:
3808 #rec_malloc_police.c:/*********************************************************************
3809 #rec_malloc_police.c: *
3810 #rec_malloc_police.c: * Function    :  derived_rec_malloc_police_destruct       
3811 #rec_malloc_police.c: *
3812 #rec_malloc_police.c: * Description :  Destruct the malloc_police record.
3813 #rec_malloc_police.c: *
3814 #rec_malloc_police.c: * Parameters  :
3815 #rec_malloc_police.c: *          1  :  The record.
3816 #rec_malloc_police.c: *
3817 #rec_malloc_police.c: * Returns     :  NULL
3818 #rec_malloc_police.c: *
3819 #rec_malloc_police.c: *********************************************************************/
3820 #rec_malloc_police.c:struct derived_rec_malloc_police *derived_rec_malloc_police_destruct( struct derived_rec_malloc_police *this_rec )
3821 #rec_malloc_police.c:{
3822 #rec_malloc_police.c:   struct derived_rec_malloc_police *d;
3823 #rec_malloc_police.c:   list_is_quiet ++;
3824 #rec_malloc_police.c:
3825 #rec_malloc_police.c:/*         LIST_SHOW( printf( "\ */
3826 #rec_malloc_police.c:/* \t\tmalloc_police destruct this_rec\t\t\t\t\t\t= %p */
3827 #rec_malloc_police.c:/* \t\tmalloc_police destruct this_rec->alloced_addr\t= %p */
3828 #rec_malloc_police.c:/* \t\tmalloc_police destruct this_rec->source_where\t= %s, */
3829 #rec_malloc_police.c:/* \t\tmalloc_police destruct this_rec->sz\t\t\t\t\t= %ld\n\n", */
3830 #rec_malloc_police.c:/*                           (const void *)this_rec, */
3831 #rec_malloc_police.c:/*                           this_rec->alloced_addr, */
3832 #rec_malloc_police.c:/*                           this_rec->source_where, */
3833 #rec_malloc_police.c:/*                           this_rec->sz */
3834 #rec_malloc_police.c:/*         ) ); */
3835 #rec_malloc_police.c:
3836 #rec_malloc_police.c:   memset( this_rec->source_where, '!', strlen( this_rec->source_where ) );
3837 #rec_malloc_police.c:   FREE( this_rec->source_where );
3838 #rec_malloc_police.c:
3839 #rec_malloc_police.c:   d = (struct derived_rec_malloc_police *)gen_list_rec_destruct( (struct gen_list_rec *)this_rec );
3840 #rec_malloc_police.c:   list_is_quiet --;
3841 #rec_malloc_police.c:
3842 #rec_malloc_police.c:   return( d );
3843 #rec_malloc_police.c:
3844 #rec_malloc_police.c:}
3845 #rec_malloc_police.c:
3846 #rec_malloc_police.c:
3847 #rec_malloc_police.c:/*********************************************************************
3848 #rec_malloc_police.c: *
3849 #rec_malloc_police.c: * Function    :  derived_rec_malloc_police_stream
3850 #rec_malloc_police.c: *
3851 #rec_malloc_police.c: * Description :  Displays all malloc_police attributes on the STDOUT stream.
3852 #rec_malloc_police.c: *
3853 #rec_malloc_police.c: * Parameters  :
3854 #rec_malloc_police.c: *          1  :  The record.
3855 #rec_malloc_police.c: *
3856 #rec_malloc_police.c: * Returns     :  The record.
3857 #rec_malloc_police.c: *
3858 #rec_malloc_police.c: *********************************************************************/
3859 #rec_malloc_police.c:const struct derived_rec_malloc_police *derived_rec_malloc_police_stream( const struct derived_rec_malloc_police *this_rec )
3860 #rec_malloc_police.c:{
3861 #rec_malloc_police.c:   list_is_quiet ++;
3862 #rec_malloc_police.c:
3863 #rec_malloc_police.c:   this_rec = (struct derived_rec_malloc_police *)gen_list_rec_stream(
3864 #rec_malloc_police.c:           (struct gen_list_rec *)this_rec
3865 #rec_malloc_police.c:   );
3866 #rec_malloc_police.c:   LIST_SHOW( printf( "\
3867 #rec_malloc_police.c:\t\tmalloc_police stream this_rec\t\t\t\t\t= %p
3868 #rec_malloc_police.c:\t\tmalloc_police stream this_rec->alloced_addr\t= %p
3869 #rec_malloc_police.c:\t\tmalloc_police stream this_rec->source_where\t= %s
3870 #rec_malloc_police.c:\t\tmalloc_police stream this_rec->sz\t\t\t\t= %ld\n\n",
3871 #rec_malloc_police.c:                                                    (const void *)this_rec,
3872 #rec_malloc_police.c:                                                    this_rec->alloced_addr,
3873 #rec_malloc_police.c:                                                    this_rec->source_where,
3874 #rec_malloc_police.c:                                                    this_rec->sz
3875 #rec_malloc_police.c:   ) );
3876 #rec_malloc_police.c:
3877 #rec_malloc_police.c:   list_is_quiet --;
3878 #rec_malloc_police.c:   return( this_rec );
3879 #rec_malloc_police.c:
3880 #rec_malloc_police.c:}
3881 #rec_malloc_police.c:
3882 #rec_malloc_police.c:
3883 #rec_malloc_police.c:/*********************************************************************
3884 #rec_malloc_police.c: *
3885 #rec_malloc_police.c: * Function    :  derived_rec_malloc_police_equal
3886 #rec_malloc_police.c: *
3887 #rec_malloc_police.c: * Description :  Compares two malloc_police records to see if they are equal.
3888 #rec_malloc_police.c: *
3889 #rec_malloc_police.c: * Parameters  :
3890 #rec_malloc_police.c: *          1  :  A record.
3891 #rec_malloc_police.c: *          2  :  Another record.
3892 #rec_malloc_police.c: *
3893 #rec_malloc_police.c: * Returns     :  0 => NOT EQUAL, anything else is EQUAL.
3894 #rec_malloc_police.c: *
3895 #rec_malloc_police.c: *********************************************************************/
3896 #rec_malloc_police.c:int derived_rec_malloc_police_equal( const struct derived_rec_malloc_police *this_rec, const struct derived_rec_malloc_police *eq_rec )
3897 #rec_malloc_police.c:{
3898 #rec_malloc_police.c:   list_is_quiet ++;
3899 #rec_malloc_police.c:
3900 #rec_malloc_police.c:   if ( ! gen_list_rec_equal( (const struct gen_list_rec *)this_rec, (struct gen_list_rec *)eq_rec ) )
3901 #rec_malloc_police.c:   {
3902 #rec_malloc_police.c:           return( 0 );
3903 #rec_malloc_police.c:   }
3904 #rec_malloc_police.c:
3905 #rec_malloc_police.c:   list_is_quiet --;
3906 #rec_malloc_police.c:   return( this_rec->alloced_addr == eq_rec->alloced_addr );
3907 #rec_malloc_police.c:
3908 #rec_malloc_police.c:}
3909
3910
3911 #rec_malloc_police.h:#ifndef REC_MALLOC_POLICE_H_INCLUDED
3912 #rec_malloc_police.h:#define REC_MALLOC_POLICE_H_INCLUDED
3913 #rec_malloc_police.h:#define REC_MALLOC_POLICE_H_VERSION "$Id: contrib.sh,v 1.2 2002/03/24 13:25:43 swa Exp $"
3914 #rec_malloc_police.h:/*********************************************************************
3915 #rec_malloc_police.h: *
3916 #rec_malloc_police.h: * File        :  $Source: /cvsroot/ijbswa/current/contrib.sh,v $
3917 #rec_malloc_police.h: *
3918 #rec_malloc_police.h: * Purpose     :  A "derived class" of gen_list_rec.
3919 #rec_malloc_police.h: *                                         This class helps to build a list of allocated and
3920 #rec_malloc_police.h: *                                         freed memory.  When the program exits, we will print
3921 #rec_malloc_police.h: *                                         a list of all memory that was allocated, but never
3922 #rec_malloc_police.h: *                                         freed.  This could be most helpful to developers
3923 #rec_malloc_police.h: *                                         and debugers.
3924 #rec_malloc_police.h: *
3925 #rec_malloc_police.h: * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
3926 #rec_malloc_police.h: *                Privoxy team. http://www.privoxy.org/
3927 #rec_malloc_police.h: *
3928 #rec_malloc_police.h: *                This program is free software; you can redistribute it
3929 #rec_malloc_police.h: *                and/or modify it under the terms of the GNU General
3930 #rec_malloc_police.h: *                Public License as published by the Free Software
3931 #rec_malloc_police.h: *                Foundation; either version 2 of the License, or (at
3932 #rec_malloc_police.h: *                your option) any later version.
3933 #rec_malloc_police.h: *
3934 #rec_malloc_police.h: *                This program is distributed in the hope that it will
3935 #rec_malloc_police.h: *                be useful, but WITHOUT ANY WARRANTY; without even the
3936 #rec_malloc_police.h: *                implied warranty of MERCHANTABILITY or FITNESS FOR A
3937 #rec_malloc_police.h: *                PARTICULAR PURPOSE.  See the GNU General Public
3938 #rec_malloc_police.h: *                License for more details.
3939 #rec_malloc_police.h: *
3940 #rec_malloc_police.h: *                The GNU General Public License should be included with
3941 #rec_malloc_police.h: *                this file.  If not, you can view it at
3942 #rec_malloc_police.h: *                http://www.gnu.org/copyleft/gpl.html
3943 #rec_malloc_police.h: *                or write to the Free Software Foundation, Inc., 59
3944 #rec_malloc_police.h: *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3945 #rec_malloc_police.h: *
3946 #rec_malloc_police.h: * VI users                :       Please "set tabstop=3 shiftwidth=3" to view this file,
3947 #rec_malloc_police.h: *                                         and edit IJB, correctly.
3948 #rec_malloc_police.h: *
3949 #rec_malloc_police.h: * Revisions   :
3950 #rec_malloc_police.h: *    $Log: contrib.sh,v $
3951 #rec_malloc_police.h: *    Revision 1.2  2002/03/24 13:25:43  swa
3952 #rec_malloc_police.h: *    name change related issues
3953 #rec_malloc_police.h: *
3954 #rec_malloc_police.h: *    Revision 1.1  2001/12/07 01:54:50  iwanttokeepanon
3955 #rec_malloc_police.h: *    A contribution/recomendation to the IJBSWA group for a generic doubly
3956 #rec_malloc_police.h: *    linked list.  This file is a home brew "bash tar" (I cannot create a
3957 #rec_malloc_police.h: *    contrib directory and I cannot upload a tarball ... it gets
3958 #rec_malloc_police.h: *    corrupted).  This script will expand all files needed to create the
3959 #rec_malloc_police.h: *    linked list modules and an example program.  Please see the README.
3960 #rec_malloc_police.h: *    Feed back is welcomed.  Enjoy.
3961 #rec_malloc_police.h: *
3962 #rec_malloc_police.h: *
3963 #rec_malloc_police.h: *********************************************************************/
3964 #rec_malloc_police.h:\f
3965 #rec_malloc_police.h:
3966 #rec_malloc_police.h:#ifdef __cplusplus
3967 #rec_malloc_police.h:extern "C" {
3968 #rec_malloc_police.h:#endif
3969 #rec_malloc_police.h:
3970 #rec_malloc_police.h:
3971 #rec_malloc_police.h:struct derived_rec_malloc_police
3972 #rec_malloc_police.h:{
3973 #rec_malloc_police.h:   /* private: */
3974 #rec_malloc_police.h:   struct  gen_list_rec parent_rec;
3975 #rec_malloc_police.h:   void            *alloced_addr;
3976 #rec_malloc_police.h:   char            *source_where;
3977 #rec_malloc_police.h:   size_t  sz;
3978 #rec_malloc_police.h:};
3979 #rec_malloc_police.h:
3980 #rec_malloc_police.h:/* public: */
3981 #rec_malloc_police.h:extern struct derived_rec_malloc_police *  derived_rec_malloc_police_construct( void *_alloced_addr, char *_source_where, size_t _sz );
3982 #rec_malloc_police.h:extern struct derived_rec_malloc_police *  derived_rec_malloc_police_copy_construct( const struct derived_rec_malloc_police *this_rec );
3983 #rec_malloc_police.h:extern struct derived_rec_malloc_police *  derived_rec_malloc_police_destruct( struct derived_rec_malloc_police *this_rec );
3984 #rec_malloc_police.h:extern const struct derived_rec_malloc_police *derived_rec_malloc_police_stream( const struct derived_rec_malloc_police *this_rec );
3985 #rec_malloc_police.h:extern int                                                                                 derived_rec_malloc_police_equal( const struct derived_rec_malloc_police *this_rec, const struct derived_rec_malloc_police *eq_rec );
3986 #rec_malloc_police.h:
3987 #rec_malloc_police.h:/* struct/class COMPLETE */
3988 #rec_malloc_police.h:
3989 #rec_malloc_police.h:
3990 #rec_malloc_police.h:#ifdef __cplusplus
3991 #rec_malloc_police.h:} /* extern "C" */
3992 #rec_malloc_police.h:#endif
3993 #rec_malloc_police.h:
3994 #rec_malloc_police.h:
3995 #rec_malloc_police.h:#endif /* ndef REC_MALLOC_POLICE_H_INCLUDED */
3996 #rec_malloc_police.h:
3997 #rec_malloc_police.h:/*
3998 #rec_malloc_police.h:  Local Variables:
3999 #rec_malloc_police.h:  tab-width: 3
4000 #rec_malloc_police.h:  end:
4001 #rec_malloc_police.h:*/
4002
4003
4004 ###########################################################################
4005 ##  Description:                        makeInsertableFile
4006 ##              Use this function to make a file suitable for insertion into this
4007 ##              script.  This file (x), will contain all of the files listed.
4008 ##
4009 ##  Inputs :
4010 ##              None
4011 ##
4012 ##  Outputs :
4013 ##              Return status:  (0) - Everything is Okay, anything else is an error
4014 ###########################################################################
4015
4016 function makeInsertableFile {
4017
4018         rm -f x
4019
4020         for i in ${fileList}; do
4021                 sed -e "s/^/#${i}:/" ${i} >> x
4022                 echo "" >> x
4023                 echo "" >> x
4024         done
4025
4026         return 0
4027
4028 }
4029
4030
4031 #
4032 #Local Variables:
4033 #tab-width: 3
4034 #end:
4035 #