]> granicus.if.org Git - php/commitdiff
wrap all PHPAPI prototypes into BEGIN_EXTERN_C/END_EXTERN_C blocks
authorHartmut Holzgraefe <hholzgra@php.net>
Fri, 20 Feb 2004 08:04:30 +0000 (08:04 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Fri, 20 Feb 2004 08:04:30 +0000 (08:04 +0000)
(else they won't be usable from C++ extensions)

main/php_memory_streams.h
main/php_network.h
main/php_open_temporary_file.h
main/php_output.h
main/php_reentrancy.h
main/php_streams.h
main/php_ticks.h
main/safe_mode.h

index 37ff932c005b425e7d817d43c6037abeff65b5a5..4af7745efe3226428a03816f0b3264ccd82a3b24 100644 (file)
 #define php_stream_temp_create_rel(mode, max_memory_usage) _php_stream_temp_create((mode), (max_memory_usage) STREAMS_REL_CC TSRMLS_CC)
 #define php_stream_temp_open(mode, max_memory_usage, buf, length) _php_stream_temp_open((mode), (max_memory_usage), (buf), (length) STREAMS_CC TSRMLS_CC)
 
-
+BEGIN_EXTERN_C()
 PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC);
 PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC TSRMLS_DC);
 PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC TSRMLS_DC);
 
 PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC);
 PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC);
+END_EXTERN_C()
 
 extern php_stream_ops php_stream_memory_ops;
 extern php_stream_ops php_stream_temp_ops;
index b165e21b32a0da0da514be9e23c8c02d0492793b..3d791e8fa73d116822306631c45877e3858d154e 100644 (file)
@@ -62,7 +62,9 @@
 /* like strerror, but caller must efree the returned string,
  * unless buf is not NULL.
  * Also works sensibly for win32 */
+BEGIN_EXTERN_C()
 PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize);
+END_EXTERN_C()
 
 #ifdef HAVE_NETINET_IN_H
 # include <netinet/in.h>
@@ -120,6 +122,7 @@ typedef struct {
 } php_sockaddr_storage;
 #endif
 
+BEGIN_EXTERN_C()
 PHPAPI php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short port,
                int socktype, int asynchronous, struct timeval *timeout, char **error_string,
                int *error_code
@@ -163,7 +166,7 @@ PHPAPI int php_network_get_peer_name(php_socket_t sock,
 
 PHPAPI void php_any_addr(int family, php_sockaddr_storage *addr, unsigned short port);
 PHPAPI int php_sockaddr_size(php_sockaddr_storage *addr);
-
+END_EXTERN_C()
 
 struct _php_netstream_data_t   {
        php_socket_t socket;
@@ -177,6 +180,7 @@ PHPAPI extern php_stream_ops php_stream_socket_ops;
 extern php_stream_ops php_stream_generic_socket_ops;
 #define PHP_STREAM_IS_SOCKET   (&php_stream_socket_ops)
 
+BEGIN_EXTERN_C()
 PHPAPI php_stream *_php_stream_sock_open_from_socket(php_socket_t socket, const char *persistent_id STREAMS_DC TSRMLS_DC );
 /* open a connection to a host using php_hostconnect and return a stream */
 PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short port,
@@ -193,6 +197,7 @@ PHPAPI void php_network_populate_name_from_sockaddr(
 
 PHPAPI int php_network_parse_network_address_with_port(const char *addr,
                long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC);
+END_EXTERN_C()
 
 #define php_stream_sock_open_from_socket(socket, persistent)   _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC TSRMLS_CC)
 #define php_stream_sock_open_host(host, port, socktype, timeout, persistent)   _php_stream_sock_open_host((host), (port), (socktype), (timeout), (persistent) STREAMS_CC TSRMLS_CC)
index 50092d0e52567eec924bde545dc0a01c00abc80f..db1c5f84935193d5adf979b2fa6676e3a18b5d98 100644 (file)
@@ -21,7 +21,9 @@
 #ifndef PHP_OPEN_TEMPORARY_FILE_H
 #define PHP_OPEN_TEMPORARY_FILE_H
 
+BEGIN_EXTERN_C()
 PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC);
 PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC);
+END_EXTERN_C()
 
 #endif /* PHP_OPEN_TEMPORARY_FILE_H */
index 04d69e26728bbf1e2c9010d33ce4e80bf8b57533..a1e6c81c1f8ef59d8655be9231d9b307cdbc34a7 100644 (file)
@@ -23,6 +23,7 @@
 
 typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC);
 
+BEGIN_EXTERN_C()
 PHPAPI void php_output_startup(void);
 PHPAPI void php_output_activate(TSRMLS_D);
 PHPAPI void php_output_set_status(zend_bool status TSRMLS_DC);
@@ -44,6 +45,7 @@ PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC);
 PHPAPI int php_ob_init_conflict(char *handler_new, char *handler_set TSRMLS_DC);
 PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC);
 PHPAPI int php_ob_get_length(zval *p TSRMLS_DC);
+END_EXTERN_C()
 
 PHP_FUNCTION(ob_start);
 PHP_FUNCTION(ob_flush);
index bbbe0343ab081f007edb453d0e2e615b6ee24cb1..8a329f14f55653d89e62a047c08aa971476e9612 100644 (file)
@@ -49,6 +49,8 @@
 #undef HAVE_GMTIME_R
 #endif
 
+BEGIN_EXTERN_C()
+
 #if defined(HAVE_POSIX_READDIR_R)
 #define php_readdir_r readdir_r
 #else
@@ -114,6 +116,8 @@ PHPAPI int php_rand_r(unsigned int *seed);
 #define php_rand_r rand_r
 #endif
 
+END_EXTERN_C()
+
 #if !defined(ZTS)
 #undef PHP_NEED_REENTRANCY
 #endif
index 47ed1181e35b3675a07424957dbd621ca6a90fba..586148f3c6e86a4234846c1cd842f2c8188aca29 100755 (executable)
 #include <sys/types.h>
 #include <sys/stat.h>
 
+BEGIN_EXTERN_C()
 PHPAPI int php_file_le_stream(void);
 PHPAPI int php_file_le_pstream(void);
+END_EXTERN_C()
 
 /* {{{ Streams memory debugging stuff */
 
@@ -226,8 +228,10 @@ struct _php_stream  {
 #define PHP_STREAM_FCLOSE_FOPENCOOKIE 2
 
 /* allocate a new stream for a particular ops */
+BEGIN_EXTERN_C()
 PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract,
                const char *persistent_id, const char *mode STREAMS_DC TSRMLS_DC);
+END_EXTERN_C()
 #define php_stream_alloc(ops, thisptr, persistent_id, mode)    _php_stream_alloc((ops), (thisptr), (persistent_id), (mode) STREAMS_CC TSRMLS_CC)
 
 
@@ -247,6 +251,7 @@ PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract,
 #define php_stream_from_zval(xstr, ppzval)     ZEND_FETCH_RESOURCE2((xstr), php_stream *, (ppzval), -1, "stream", php_file_le_stream(), php_file_le_pstream())
 #define php_stream_from_zval_no_verify(xstr, ppzval)   (xstr) = (php_stream*)zend_fetch_resource((ppzval) TSRMLS_CC, -1, "stream", NULL, 2, php_file_le_stream(), php_file_le_pstream())
 
+BEGIN_EXTERN_C()
 PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream TSRMLS_DC);
 #define PHP_STREAM_PERSISTENT_SUCCESS  0 /* id exists */
 #define PHP_STREAM_PERSISTENT_FAILURE  1 /* id exists but is not a stream! */
@@ -260,6 +265,7 @@ PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream *
 #define PHP_STREAM_FREE_CLOSE                          (PHP_STREAM_FREE_CALL_DTOR | PHP_STREAM_FREE_RELEASE_STREAM)
 #define PHP_STREAM_FREE_CLOSE_CASTED           (PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_PRESERVE_HANDLE)
 #define PHP_STREAM_FREE_CLOSE_PERSISTENT       (PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_PERSISTENT)
+
 PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC);
 #define php_stream_free(stream, close_options) _php_stream_free((stream), (close_options) TSRMLS_CC)
 #define php_stream_close(stream)       _php_stream_free((stream), PHP_STREAM_FREE_CLOSE TSRMLS_CC)
@@ -337,6 +343,9 @@ PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, voi
 
 #define php_stream_set_chunk_size(stream, size) _php_stream_set_option((stream), PHP_STREAM_OPTION_SET_CHUNK_SIZE, (size), NULL TSRMLS_CC)
 
+END_EXTERN_C()
+
+
 /* Flags for mkdir method in wrapper ops */
 #define PHP_STREAM_MKDIR_RECURSIVE     1
 /* define REPORT ERRORS 8 (below) */
@@ -384,8 +393,10 @@ PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, voi
 
 #define php_stream_truncate_supported(stream)  (_php_stream_set_option((stream), PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SUPPORTED, NULL TSRMLS_CC) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0)
 
+BEGIN_EXTERN_C()
 PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize TSRMLS_DC);
 #define php_stream_truncate_set_size(stream, size)     _php_stream_truncate_set_size((stream), (size) TSRMLS_CC)
+END_EXTERN_C()
 
 #define PHP_STREAM_OPTION_META_DATA_API                11 /* ptrparam is a zval* to which to add meta data information */
 #define php_stream_populate_meta_data(stream, zv)      (_php_stream_set_option((stream), PHP_STREAM_OPTION_META_DATA_API, 0, zv TSRMLS_CC) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0)
@@ -401,6 +412,7 @@ PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize TSRM
 /* copy up to maxlen bytes from src to dest.  If maxlen is PHP_STREAM_COPY_ALL, copy until eof(src).
  * Uses mmap if the src is a plain file and at offset 0 */
 #define PHP_STREAM_COPY_ALL            -1
+BEGIN_EXTERN_C()
 PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC);
 #define php_stream_copy_to_stream(src, dest, maxlen)   _php_stream_copy_to_stream((src), (dest), (maxlen) STREAMS_CC TSRMLS_CC)
 
@@ -414,6 +426,7 @@ PHPAPI size_t _php_stream_copy_to_mem(php_stream *src, char **buf, size_t maxlen
 /* output all data from a stream */
 PHPAPI size_t _php_stream_passthru(php_stream * src STREAMS_DC TSRMLS_DC);
 #define php_stream_passthru(stream)    _php_stream_passthru((stream) STREAMS_CC TSRMLS_CC)
+END_EXTERN_C()
 
 #include "streams/php_stream_transport.h"
 #include "streams/php_stream_plain_wrapper.h"
@@ -435,7 +448,9 @@ PHPAPI size_t _php_stream_passthru(php_stream * src STREAMS_DC TSRMLS_DC);
 #define PHP_STREAM_CAST_RELEASE                0x40000000      /* stream becomes invalid on success */
 #define PHP_STREAM_CAST_INTERNAL       0x20000000      /* stream cast for internal use */
 #define PHP_STREAM_CAST_MASK           (PHP_STREAM_CAST_TRY_HARD | PHP_STREAM_CAST_RELEASE | PHP_STREAM_CAST_INTERNAL)
+BEGIN_EXTERN_C()
 PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show_err TSRMLS_DC);
+END_EXTERN_C()
 /* use this to check if a stream can be cast into another form */
 #define php_stream_can_cast(stream, as)        _php_stream_cast((stream), (as), NULL, 0 TSRMLS_CC)
 #define php_stream_cast(stream, as, ret, show_err)     _php_stream_cast((stream), (as), (ret), (show_err) TSRMLS_CC)
@@ -491,6 +506,7 @@ int php_init_stream_wrappers(int module_number TSRMLS_DC);
 int php_shutdown_stream_wrappers(int module_number TSRMLS_DC);
 PHP_RSHUTDOWN_FUNCTION(streams);
 
+BEGIN_EXTERN_C()
 PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC);
 PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC);
 PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
@@ -524,6 +540,7 @@ PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstr
 /* Give other modules access to the url_stream_wrappers_hash and stream_filters_hash */
 PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash();
 PHPAPI HashTable *php_get_stream_filters_hash();
+END_EXTERN_C()
 #endif
 
 /*
index e6550d3d7972b60de9c76c4bcfa4d56e1518c2ab..600f11b0f9b2ff29df32f3d25e36d87cf22c1bfe 100644 (file)
 int php_startup_ticks(TSRMLS_D);
 void php_shutdown_ticks(TSRMLS_D);
 void php_run_ticks(int count);
+
+BEGIN_EXTERN_C()
 PHPAPI void php_add_tick_function(void (*func)(int));
 PHPAPI void php_remove_tick_function(void (*func)(int));
+END_EXTERN_C()
 
 #endif
 
index d03eabf2928ede9afc4486f2e719b2e0ae71f464..40f69cf93c76c206baa63d9014a2f67a642dbb5e 100644 (file)
 /* flags for php_checkuid_ex() */
 #define CHECKUID_NO_ERRORS     0x01
 
-extern PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode);
-extern PHPAPI int php_checkuid_ex(const char *filename, char *fopen_mode, int mode, int flags);
-extern PHPAPI char *php_get_current_user(void);
+BEGIN_EXTERN_C()
+PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode);
+PHPAPI int php_checkuid_ex(const char *filename, char *fopen_mode, int mode, int flags);
+PHPAPI char *php_get_current_user(void);
+END_EXTERN_C()
 
 #endif