summaryrefslogtreecommitdiff
path: root/Zend/zend_stream.h
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2008-03-16 21:06:55 +0000
committerMarcus Boerger <helly@php.net>2008-03-16 21:06:55 +0000
commitaf316021e8f69896cd0d246114962e48b973972f (patch)
tree7bf0e294155631040c03c6b76ab3b96dce967b94 /Zend/zend_stream.h
parenteb8f83a98e7fbfa206601fa5016cc211eb78e024 (diff)
downloadphp-git-af316021e8f69896cd0d246114962e48b973972f.tar.gz
- Rewrite scanner to be based on re2c instead of flex
The full patch is available as: http://php.net/~helly/php-re2c-5.3-20080316.diff.txt This is against php-re2c repository version 98 An older patch against version 97 is available under: http://php.net/~helly/php-re2c-97-20080316.diff.txt
Diffstat (limited to 'Zend/zend_stream.h')
-rw-r--r--Zend/zend_stream.h63
1 files changed, 40 insertions, 23 deletions
diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h
index 3b65b15175..fa84dec90b 100644
--- a/Zend/zend_stream.h
+++ b/Zend/zend_stream.h
@@ -5,7 +5,7 @@
| Copyright (c) 1998-2008 Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
+ | that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
@@ -13,6 +13,9 @@
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+ | Scott MacVicar <scottmac@php.net> |
+ | Nuno Lopes <nlopess@php.net> |
+ | Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
@@ -24,41 +27,55 @@
/* Lightweight stream implementation for the ZE scanners.
* These functions are private to the engine.
* */
+typedef size_t (*zend_stream_fsizer_t)(void* handle TSRMLS_DC);
+typedef size_t (*zend_stream_reader_t)(void* handle, char *buf, size_t len TSRMLS_DC);
+typedef void (*zend_stream_closer_t)(void* handle TSRMLS_DC);
-typedef size_t (*zend_stream_reader_t)(void *handle, char *buf, size_t len TSRMLS_DC);
-typedef void (*zend_stream_closer_t)(void *handle TSRMLS_DC);
-typedef long (*zend_stream_fteller_t)(void *handle TSRMLS_DC);
+#define ZEND_MMAP_AHEAD 32
+
+typedef enum {
+ ZEND_HANDLE_FILENAME,
+ ZEND_HANDLE_FD,
+ ZEND_HANDLE_FP,
+ ZEND_HANDLE_STREAM,
+ ZEND_HANDLE_MAPPED,
+} zend_stream_type;
+
+typedef struct _zend_mmap {
+ size_t len;
+ size_t pos;
+ void *map;
+ char *buf;
+ void *old_handle;
+ zend_stream_closer_t old_closer;
+} zend_mmap;
typedef struct _zend_stream {
- void *handle;
- zend_stream_reader_t reader;
- zend_stream_closer_t closer;
- zend_stream_fteller_t fteller;
- int interactive;
+ void *handle;
+ int isatty;
+ zend_mmap mmap;
+ zend_stream_reader_t reader;
+ zend_stream_fsizer_t fsizer;
+ zend_stream_closer_t closer;
} zend_stream;
typedef struct _zend_file_handle {
- zend_uchar type;
- char *filename;
- char *opened_path;
+ zend_stream_type type;
+ char *filename;
+ char *opened_path;
union {
- int fd;
- FILE *fp;
- zend_stream stream;
+ int fd;
+ FILE *fp;
+ zend_stream stream;
} handle;
zend_bool free_filename;
} zend_file_handle;
BEGIN_EXTERN_C()
ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC);
-ZEND_API int zend_stream_ferror(zend_file_handle *file_handle TSRMLS_DC);
-ZEND_API int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC);
-ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC);
-ZEND_API long zend_stream_ftell(zend_file_handle *file_handle TSRMLS_DC);
-ZEND_API int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC);
+ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len TSRMLS_DC);
+ZEND_API void zend_file_handle_dtor(zend_file_handle *fh TSRMLS_DC);
+ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);
END_EXTERN_C()
-#define zend_stream_close(handle) zend_file_handle_dtor((handle))
-
#endif
-