File: cache.h

package info (click to toggle)
xmhtml 1.1.7-18
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 6,576 kB
  • sloc: ansic: 68,174; makefile: 438; sh: 158; perl: 36
file content (122 lines) | stat: -rw-r--r-- 4,168 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*****
* cache.h : HTML document & image caching routines
*
* This file Version	$Revision: 1.2 $
*
* Creation date:		Fri May 23 14:43:04 GMT+0100 1997
* Last modification: 	$Date: 1997/08/30 01:47:55 $
* By:					$Author: newt $
* Current State:		$State: Exp $
*
* Author:				newt
*
* Copyright (C) 1994-1997 by Ripley Software Development 
* All Rights Reserved
*
* This file is part of the XmHTML Widget Library
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****/
/*****
* $Source: /usr/local/rcs/Newt/XmHTML/RCS/cache.h,v $
*****/
/*****
* ChangeLog 
* $Log: cache.h,v $
* Revision 1.2  1997/08/30 01:47:55  newt
* getObjectFromCache proto changed. Added pruneObjectCache.
*
* Revision 1.1  1997/05/28 02:01:31  newt
* Initial Revision
*
*****/ 

#ifndef _cache_h_
#define _cache_h_

/* get an object from the cache, given it's url */
extern XtPointer getURLObjectFromCache(String url);

/* get the first object that (partially) matches the given url */
extern XtPointer getFuzzyURLObjectFromCache(String url);

/* get an object from the cache, given it's location or reference */
extern XtPointer getObjectFromCache(String file, String url);

/* insert a new entry in the cache */
extern void storeObjectInCache(XtPointer object, String file, String url);

/* replace the given object in the cache with the newly given object */
extern void replaceObjectInCache(XtPointer old_object, XtPointer new_object);

/* decrement reference counter for the given url */
extern void removeURLObjectFromCache(String url);

/* decrement reference counter for the given file */
extern void removeObjectFromCache(String file);

/* clean the cache: remove all objects which are no longer used */
extern void cleanObjectCache(void);

/* prune ObjectCache: remove all objects for which no mappings are present */
extern void pruneObjectCache(void);

/* completely destroy the cache */
extern void destroyObjectCache(void);

/* get the current size and number of objects stored in the cache */
extern void getCacheInfo(int *size, int *nobjects);

/*****
* prune the image cache to the requested size. When small_first is True,
* pruning is started with the smallest objects, otherwise it starts with
* the largest objects. Cache pruning removes cached objects with low
* reference counts.
*****/
#if 0
extern void pruneCache(int size, int small_first);
#endif

/*****
* Proto for the clean_proc in the initCache proto below. This function
* is called when cleanObjectCache want's to destroy a stored object. This
* function is called with the following arguments:
*
* clean_proc(object, client_data)
*	XtPointer object:	object to be destroyed;
*	client_data:		additional data provided by the argument with the same
*						name in initCache. This object is unused internally.
*****/
typedef void (*cleanObjectProc)(XtPointer, XtPointer);

/*****
* Proto for the size_proc in the initCache proto below. This function is
* called whenever a new object is stored in the cache and should return the
* size of the given object. The arguments are the same as above.
*****/
typedef int (*sizeObjectProc)(XtPointer, XtPointer);

/*****
* function to initialize object cache. Arguments: 
* size: maximum cache size (UNUSED)
* clean_proc: function to call when a stored object is to be destroyed 
* clean_data: client_data for the clean_proc.
*****/
extern void initCache(int size, cleanObjectProc clean_proc,
	sizeObjectProc size_proc, XtPointer client_data);

/* Don't add anything after this endif! */
#endif /* _cache_h_ */