[[embed2:php_embed2.h]]
 

Embed2 header file

/*
   +----------------------------------------------------------------------+
   | PHP Version 4                                                        |
   +----------------------------------------------------------------------+
   | Copyright (c) 1997-2004 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 2.02 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |
   | available at through the world-wide-web at                           |
   | http://www.php.net/license/2_02.txt.                                 |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
*/
 
#ifndef __EMBED2_H
# define __EMBED2_H
 
#ifdef WIN32
# ifdef PHP_EMBED2_EXPORT
#  define PHP_EMBED2_API __declspec(dllexport)
# else
#  define PHP_EMBED2_API __declspec(dllimport)
# endif
#else
# define PHP_EMBED2_API
#endif
 
 
#define PHP_EMBED2_CLI_MODE  0 /* Force Cli ini entries */
#define PHP_EMBED2_WS_MODE  1 /* Force WebServer ini entries */
#define PHP_EMBED2_CST_MODE 2 /* Doesn't force anything */
 
/* Embed compat (but not recommended) */
#define PHP_EMBED2_START_BLOCK( argc, argv ) \
	php_embed2_global_startup(PHP_EMBED2_CLI_MODE, NULL, 0); \
	php_embed2_startup_ex( 1, 1, PHP_EMBED2_CLI_MODE, NULL, argc, argv, NULL, NULL, NULL, NULL, NULL)
 
#define PHP_EMBED2_END_BLOCK() \
	php_embed2_shutdown(); \
	php_embed2_global_shutdown();
 
 
#ifdef __cplusplus
extern "C" {
#endif
 
/* Get version	(0 => PHP, 1 => Zend, -1=> banner) */
PHP_EMBED2_API const char * php_embed2_version( int what/*=0*/ );
 
 
/* Global StartUp / ShutDown */
PHP_EMBED2_API int php_embed2_global_startup( int sapi_mode /*=PHP_EMBED2_CLI_MODE*/, 
									   const char * ini_path /*=NULL*/, int ini_ignore );
PHP_EMBED2_API void php_embed2_global_shutdown();
 
 
/* Callback */
PHP_EMBED2_API void php_embed2_global_set_write_cb( long (*write)( const char *, unsigned long, void * ) /*=NULL*/, int abort_on_fail /*=1*/ );
PHP_EMBED2_API void php_embed2_global_set_write_header_cb( void (*write_header)( const char *, int, void * ) /*=NULL*/, int direct/*=0*/ );
PHP_EMBED2_API void php_embed2_global_set_read_post_cb( long (*read_post)(char *, unsigned long, void *) /*=NULL*/ );
PHP_EMBED2_API void php_embed2_global_set_read_cookies_cb( const char * (*read_cookies)( void * ) /*=NULL*/ );
 
 
/* Setup functions - use it before any startup */
PHP_EMBED2_API void php_embed2_global_set_ini( const char * name, const char * value);     // Set a global ini entry
PHP_EMBED2_API void php_embed2_global_define( const char * define, const char * val ); // define like
 
 
/* Startup/Shutdown functions */
PHP_EMBED2_API int php_embed2_main( char * script, int argc /*=0*/, char ** argv /*=NULL*/, void * cb_data /*=NULL*/ ); /* CLi like execute */
PHP_EMBED2_API int php_embed2_handle_request(  /* Web server like execute */
					char * path_translated, // Full path to the script
					char * method,  // HTTP method (GET/POST/HEAD)
					char * request_uri,  //  /script.php
					char * query_string, // foo=bar
					char * content_type, // Content type of posted data
					void * data // Custom data
				  );
 
PHP_EMBED2_API int php_embed2_startup_ex( int no_headers, int no_chdir, int sapi_mode, char * path_translated, int argc, char ** argv, char * method, 
								   char * request_uri, char * query_string, char * content_type, void * data ); /* Custom startup */
PHP_EMBED2_API void php_embed2_shutdown();
 
 
/* Php variable access functions */
PHP_EMBED2_API void php_embed2_set_ini( const char * name, const char * value);     // Set a request ini entry
PHP_EMBED2_API void php_embed2_define_var( char * var, char * val ); // Define a $_SERVER variable
PHP_EMBED2_API char * php_embed2_get_var( char * name, long * len );
PHP_EMBED2_API long php_embed2_set_var( char * name, char * value, int value_len ); // Global variable
 
 
/* Execution functions */
PHP_EMBED2_API long php_embed2_eval( char * code, long * exit_status /*=NULL*/ ); // Execute the code given
PHP_EMBED2_API long php_embed2_exec( char * script_file, long * exit_status /*=NULL*/ ); // Execute a script
PHP_EMBED2_API long php_embed2_exec_string( const char * script, long * exit_status /*=NULL*/ ); // Execute a string script
 
 
/* Post-execution functions */
PHP_EMBED2_API int php_embed2_get_exit_status();
PHP_EMBED2_API int php_embed2_get_http_response();
 
 
/* Misc. functions */
PHP_EMBED2_API long php_embed2_syntax_check( const char * filename );
PHP_EMBED2_API long php_embed2_syntax_highlight( const char * filename );
PHP_EMBED2_API long php_embed2_syntax_strip( const char * filename );
 
 
/* embed2 write into script output */
PHP_EMBED2_API int php_embed2_write(const char * str, unsigned int str_len);
PHP_EMBED2_API int php_embed2_puts(const char * str);
PHP_EMBED2_API int php_embed2_putc(char c);
 
 
#ifdef __cplusplus
}
#endif
 
 
#endif // included
 
  embed2/php_embed2.h.txt · Last modified: 2004/11/22 23:04
 
Recent changes RSS feed Powered by PHP Driven by DokuWiki