Annotation of embedaddon/php/Zend/zend_stream.h, revision 1.1.1.3

1.1       misho       1: /*
                      2:    +----------------------------------------------------------------------+
                      3:    | Zend Engine                                                          |
                      4:    +----------------------------------------------------------------------+
1.1.1.3 ! misho       5:    | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
1.1       misho       6:    +----------------------------------------------------------------------+
                      7:    | This source file is subject to version 2.00 of the Zend 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.zend.com/license/2_00.txt.                                |
                     11:    | If you did not receive a copy of the Zend license and are unable to  |
                     12:    | obtain it through the world-wide-web, please send a note to          |
                     13:    | license@zend.com so we can mail you a copy immediately.              |
                     14:    +----------------------------------------------------------------------+
                     15:    | Authors: Wez Furlong <wez@thebrainroom.com>                          |
                     16:    |          Scott MacVicar <scottmac@php.net>                           |
                     17:    |          Nuno Lopes <nlopess@php.net>                                |
                     18:    |          Marcus Boerger <helly@php.net>                              |
                     19:    +----------------------------------------------------------------------+
                     20: */
                     21: 
1.1.1.2   misho      22: /* $Id$ */
1.1       misho      23: 
                     24: #ifndef ZEND_STREAM_H
                     25: #define ZEND_STREAM_H
                     26: 
                     27: /* Lightweight stream implementation for the ZE scanners.
                     28:  * These functions are private to the engine.
                     29:  * */
                     30: typedef size_t (*zend_stream_fsizer_t)(void* handle TSRMLS_DC);
                     31: typedef size_t (*zend_stream_reader_t)(void* handle, char *buf, size_t len TSRMLS_DC);
                     32: typedef void   (*zend_stream_closer_t)(void* handle TSRMLS_DC);
                     33: 
                     34: #define ZEND_MMAP_AHEAD 32 
                     35: 
                     36: typedef enum {
                     37:        ZEND_HANDLE_FILENAME,
                     38:        ZEND_HANDLE_FD,
                     39:        ZEND_HANDLE_FP,
                     40:        ZEND_HANDLE_STREAM,
                     41:        ZEND_HANDLE_MAPPED
                     42: } zend_stream_type;
                     43: 
                     44: typedef struct _zend_mmap {
                     45:        size_t      len;
                     46:        size_t      pos;
                     47:        void        *map;
                     48:        char        *buf;
                     49:        void                  *old_handle;
                     50:        zend_stream_closer_t   old_closer;
                     51: } zend_mmap;
                     52: 
                     53: typedef struct _zend_stream {
                     54:        void        *handle;
                     55:        int         isatty;
                     56:        zend_mmap   mmap;
                     57:        zend_stream_reader_t   reader;
                     58:        zend_stream_fsizer_t   fsizer;
                     59:        zend_stream_closer_t   closer;
                     60: } zend_stream;
                     61: 
                     62: typedef struct _zend_file_handle {
                     63:        zend_stream_type  type;
1.1.1.2   misho      64:        const char        *filename;
1.1       misho      65:        char              *opened_path;
                     66:        union {
                     67:                int           fd;
                     68:                FILE          *fp;
                     69:                zend_stream   stream;
                     70:        } handle;
                     71:        zend_bool free_filename;
                     72: } zend_file_handle;
                     73: 
                     74: BEGIN_EXTERN_C()
                     75: ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC);
                     76: ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len TSRMLS_DC);
                     77: ZEND_API void zend_file_handle_dtor(zend_file_handle *fh TSRMLS_DC);
                     78: ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);
                     79: END_EXTERN_C()
                     80: 
                     81: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>