New PHP5 APC - version 3.0.19, using PHP5 5.2.0-8+etch11,
[php5-apc.git] / apc.h
1 /*
2   +----------------------------------------------------------------------+
3   | APC                                                                  |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 2008 The PHP Group                                     |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 3.01 of the PHP license,      |
8   | that is bundled with this package in the file LICENSE, and is        |
9   | available through the world-wide-web at the following url:           |
10   | http://www.php.net/license/3_01.txt                                  |
11   | If you did not receive a copy of the PHP license and are unable to   |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@php.net so we can mail you a copy immediately.               |
14   +----------------------------------------------------------------------+
15   | Authors: Daniel Cowgill <dcowgill@communityconnect.com>              |
16   |          George Schlossnagle <george@omniti.com>                     |
17   |          Rasmus Lerdorf <rasmus@php.net>                             |
18   |          Arun C. Murthy <arunc@yahoo-inc.com>                        |
19   |          Gopal Vijayaraghavan <gopalv@yahoo-inc.com>                 |
20   +----------------------------------------------------------------------+
21
22    This software was contributed to PHP by Community Connect Inc. in 2002
23    and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1.
24    Future revisions and derivatives of this source code must acknowledge
25    Community Connect Inc. as the original contributor of this module by
26    leaving this note intact in the source code.
27
28    All other licensing and usage conditions are those of the PHP Group.
29
30  */
31
32 /* $Id: apc.h,v 3.14.2.2 2008/05/11 18:57:00 rasmus Exp $ */
33
34 #ifndef APC_H
35 #define APC_H
36
37 /*
38  * This module defines utilities and helper functions used elsewhere in APC.
39  */
40
41 /* Commonly needed C library headers. */
42 #include <assert.h>
43 #include <errno.h>
44 #include <stdarg.h>
45 #include <stdio.h>
46 #include <stdlib.h>
47 #include <string.h>
48 #include <time.h>
49
50 /* UNIX headers (needed for struct stat) */
51 #include <sys/types.h>
52 #include <sys/stat.h>
53 #ifndef PHP_WIN32
54 #include <unistd.h>
55 #endif
56
57 #ifdef HAVE_CONFIG_H
58 #include <config.h>
59 #endif
60
61 #include "php.h"
62 #include "main/php_streams.h"
63
64 /* log levels constants (see apc_log) */
65 enum { APC_DBG, APC_NOTICE, APC_WARNING, APC_ERROR };
66
67 /* typedefs for extensible memory allocators */
68 typedef void* (*apc_malloc_t)(size_t);
69 typedef void  (*apc_free_t)  (void*);
70
71 /* wrappers for memory allocation routines */
72 extern void* apc_emalloc(size_t n);
73 extern void* apc_erealloc(void* p, size_t n);
74 extern void apc_efree(void* p);
75 extern char* apc_estrdup(const char* s);
76 extern void* apc_xstrdup(const char* s, apc_malloc_t f);
77 extern void* apc_xmemcpy(const void* p, size_t n, apc_malloc_t f);
78
79 /* console display functions */
80 extern void apc_log(int level, const char* fmt, ...);
81 extern void apc_eprint(const char* fmt, ...);
82 extern void apc_wprint(const char* fmt, ...);
83 extern void apc_dprint(const char* fmt, ...);
84 extern void apc_nprint(const char* fmt, ...);
85
86 /* string and text manipulation */
87 extern char* apc_append(const char* s, const char* t);
88 extern char* apc_substr(const char* s, int start, int length);
89 extern char** apc_tokenize(const char* s, char delim);
90
91 /* filesystem functions */
92
93 typedef struct apc_fileinfo_t 
94 {
95     char fullpath[MAXPATHLEN+1];
96     php_stream_statbuf st_buf;
97 } apc_fileinfo_t;
98
99 extern int apc_search_paths(const char* filename, const char* path, apc_fileinfo_t* fileinfo);
100
101 /* regular expression wrapper functions */
102 extern void* apc_regex_compile_array(char* patterns[]);
103 extern void apc_regex_destroy_array(void* p);
104 extern int apc_regex_match_array(void* p, const char* input);
105
106 /* apc_crc32: returns the CRC-32 checksum of the first len bytes in buf */
107 extern unsigned int apc_crc32(const char* buf, int len);
108
109 #define APC_NEGATIVE_MATCH 1
110 #define APC_POSITIVE_MATCH 2
111
112 #endif
113
114 /*
115  * Local variables:
116  * tab-width: 4
117  * c-basic-offset: 4
118  * End:
119  * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker
120  * vim<600: expandtab sw=4 ts=4 sts=4
121  */