diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/skeleton | |
download | php2-c4dd7a1a684490673e25aaf4fabec5df138854c4.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/skeleton')
-rw-r--r-- | ext/skeleton/CREDITS | 1 | ||||
-rw-r--r-- | ext/skeleton/EXPERIMENTAL | 0 | ||||
-rwxr-xr-x | ext/skeleton/create_stubs | 289 | ||||
-rw-r--r-- | ext/skeleton/php_skeleton.h | 58 | ||||
-rw-r--r-- | ext/skeleton/skeleton.c | 166 | ||||
-rw-r--r-- | ext/skeleton/skeleton.dsp | 113 | ||||
-rw-r--r-- | ext/skeleton/skeleton.php | 21 | ||||
-rw-r--r-- | ext/skeleton/tests/001.phpt | 21 |
8 files changed, 669 insertions, 0 deletions
diff --git a/ext/skeleton/CREDITS b/ext/skeleton/CREDITS new file mode 100644 index 0000000..58fc710 --- /dev/null +++ b/ext/skeleton/CREDITS @@ -0,0 +1 @@ +extname
\ No newline at end of file diff --git a/ext/skeleton/EXPERIMENTAL b/ext/skeleton/EXPERIMENTAL new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ext/skeleton/EXPERIMENTAL diff --git a/ext/skeleton/create_stubs b/ext/skeleton/create_stubs new file mode 100755 index 0000000..4cfdeb1 --- /dev/null +++ b/ext/skeleton/create_stubs @@ -0,0 +1,289 @@ +#!/usr/bin/awk -f + +function gobble(s, x) +{ + sub(/^ /, "", line) + match(line, "^" "(" s ")") + x = substr(line, 1, RLENGTH) + line = substr(line, RLENGTH+1) + return x +} + +function convert(i, j, t) +{ + type = argtypes[i,j] + name = argnames[i,j] + opt = optionals[i,j] + tabs = x = "" + + for (i = 0; i < t; i++) { tabs = tabs "\t" } + + if (type == "int" || type == "long") { + longs = longs "\tlong " name ";\n" + } else if (type == "bool" || type == "boolean") { + bools = bools "\tzend_bool " name ";\n" + } else if (type == "double" || type == "float") { + doubles = doubles "\tdouble " name ";\n" + } else if (type == "string") { + strings = strings "\tchar *" name " = NULL;\n" + ints = ints "\tint " name "_len;\n" + } else if (type == "array" || type == "object" || type == "mixed") { + zvals = zvals "\tzval *" name " = NULL;\n" + } else if (type == "resource" || type == "handle") { + zvals = zvals "\tzval *" name " = NULL;\n" + resources = resources "\tif (" name ") {\n" \ + "\t\tZEND_FETCH_RESOURCE(???, ???, " name ", " name "_id, \"???\", ???_rsrc_id);\n\t}\n" + ints = ints "\tint " name "_id = -1;\n" + } +} + +function comment(s) +{ + if (i_know_what_to_do_shut_up_i_dont_need_your_help_mode) { + return + } else { + return s + } +} + +BEGIN { + name = "[_A-Za-z][_A-Za-z0-9]*" + type = "int|long|double|float|string|bool|boolean|array|object|resource|handle|mixed|void" + spec = "l|l|d|d|s|b|b|a|o|r|r|z|" + num_funcs = 0 + +# create a map from type name to the spec + split(type, type_array, "\|") + split(spec, spec_array, "\|") + for (i in type_array) { + spec_map[type_array[i]] = spec_array[i] + } + + if (xml && xml != "yes") { + xmldoc = xml + } else { + xmldoc = extname "/" extname ".xml" + } + + + xmlhead = "<?xml version='1.0' encoding='iso-8859-1'?>\n" \ + "<!-- $Id: f9f39b1795f7e18e4c822bb840ea42295f646938 $ -->\n" \ + " <reference id=\"ref." extname "\">\n" \ + " <title> functions</title>\n" \ + " <titleabbrev></titleabbrev>\n\n" \ + " <partintro>\n" \ + " &warn.experimental;\n" \ + " <para>\n" \ + " </para>\n" \ + " </partintro>\n\n"; + + xmlfoot = " </reference>\n\n" \ + "<!-- Keep this comment at the end of the file\n" \ + "Local variables:\n" \ + "mode: sgml\n" \ + "sgml-omittag:t\n" \ + "sgml-shorttag:t\n" \ + "sgml-minimize-attributes:nil\n" \ + "sgml-always-quote-attributes:t\n" \ + "sgml-indent-step:1\n" \ + "sgml-indent-data:t\n" \ + "indent-tabs-mode:nil\n" \ + "sgml-parent-document:nil\n" \ + "sgml-default-dtd-file:\"../../manual.ced\"\n" \ + "sgml-exposed-tags:nil\n" \ + "sgml-local-catalogs:nil\n" \ + "sgml-local-ecat-files:nil\n" \ + "End:\n" \ + "vim600: syn=xml fen fdm=syntax fdl=2 si\n" \ + "vim: et tw=78 syn=sgml\n" \ + "vi: ts=1 sw=1\n" \ + "-->\n" +} + +{ + args_max = args_min = optional = i = spec_opt = 0 + line = $0 + spec_str = "\"" + +## php extension must use lower case function names. +## this will translate any capitalized letter to lowercase +## and warn the user + if (match(func_name,"[A-Z]") != 0) { + printf("NOTICE: lower casing function name '%s'\n",func_name) + func_name = tolower(func_name) + } + func_type = gobble(type); + func_name = gobble(name); + + if (gobble("\\(")) { + if (gobble("\\[")) optional = 1 + while (arg_type = gobble(type)) { + arg_name = gobble(name) + if(arg_type == "void") { + args_max = 0; + args_min = 0; + break; + } else { + argtypes[num_funcs,args_max] = arg_type + argnames[num_funcs,args_max] = arg_name + + args_max++ + if (optional) { + if (!spec_opt) { + spec_str = spec_str "|" + spec_opt = 1 + } + optionals[num_funcs,i] = optional + } else { + args_min++ + } + spec_str = spec_str spec_map[arg_type] + + if (x = gobble("\\[")) { + optional++ + } + + y = gobble(",") + if (!x && y && optional) { + grouped_optional_param[num_funcs,i] = 1 + } + i++ + } + } + } + +# if (x = gobble("\\)")) { + gobble("\\]* *\\)") + sub(/^[ \t]+/, "", line) + fcomments[num_funcs] = line +# } + + spec_str = spec_str "\"" + + funcs[num_funcs] = func_name + types[num_funcs] = func_type + maxargs[num_funcs] = args_max + minargs[num_funcs] = args_min + specs[num_funcs] = spec_str + spec_opts[num_funcs] = spec_opt + + num_funcs++ +} + +END { + if (xml) print xmlhead > xmldoc + for (i = 0; i < num_funcs; i++) { + compareargc = maxargs[i] - minargs[i] + closefetch = fetchargs = zvals = xmlparams = funcvals = resources = handleargs = closeopts = "" + ints = longs = doubles = strings = bools = zvals = "" + + proto = "/* {{{ proto " types[i] " " funcs[i] "(" + + refid = funcs[i] + gsub(/_/, "-", refid) + xmlstr = " <refentry id=\"function." refid "\">\n" \ + " <refnamediv>\n" \ + " <refname>" funcs[i] "</refname>\n" \ + " <refpurpose>" fcomments[i] "</refpurpose>\n" \ + " </refnamediv>\n" \ + " <refsect1>\n" \ + " <title>Description</title>\n" \ + " <funcsynopsis>\n" \ + " <funcprototype>\n" \ + " <funcdef>" types[i] " <function>" funcs[i] "</function></funcdef>\n" + + if (maxargs[i]>0) { + fetchargs = "\tif (zend_parse_parameters(" + ints = ints "\tint argc = ZEND_NUM_ARGS();\n" + fetchargs = fetchargs "argc TSRMLS_CC, " specs[i] + } else { + fetchargs = fetchargs "\tif (zend_parse_parameters_none() == FAILURE) {\n\t\treturn;\n\t}" + xmlparams = xmlparams " <void/>\n" + } + + for (j = 0; j < maxargs[i]; j++) { + + fetchargs = fetchargs ", " + + fetchargs = fetchargs "&" argnames[i,j] + if (argtypes[i,j] == "string") { + fetchargs = fetchargs ", &" argnames[i,j] "_len" + } + + xmlparams = xmlparams " <paramdef>" argtypes[i,j] + if (j > minargs[i]-1) { + if (!grouped_optional_param[i,j-1]) { + if (j > 0) proto = proto " " + proto = proto "[" + closeopts = closeopts "]" + } + xmlparams = xmlparams "\n <parameter><optional>" \ + argnames[i,j] \ + "</optional></parameter>\n </paramdef>\n" + } else { + xmlparams = xmlparams \ + " <parameter>" \ + argnames[i,j] \ + "</parameter></paramdef>\n" + } + + if (j > 0) proto = proto ", " + proto = proto argtypes[i,j] " " argnames[i,j] + + convert(i, j, 1) + } + + proto = proto closeopts ")\n " fcomments[i] " */\nPHP_FUNCTION(" funcs[i] ")\n{" + if (maxargs[i]>0) { + fetchargs = fetchargs ") == FAILURE)" closefetch " \n\t\treturn;\n" + } + funcvals = strings ints longs doubles bools zvals + xmlstr = xmlstr xmlparams \ + " </funcprototype>\n" \ + " </funcsynopsis>\n" \ + " &warn.experimental.func;\n" \ + " <para>\n" \ + " &warn.undocumented.func;\n" \ + " </para>\n" \ + " </refsect1>\n" \ + " </refentry>\n" + + print proto > stubfile + if (funcvals) print funcvals > stubfile + if (fetchargs) print fetchargs > stubfile + if (resources) { + print resources > stubfile + if (!stubs) print "" > extname "/function_warning" + } + if (!i_know_what_to_do_shut_up_i_dont_need_your_help_mode) { + print "\tphp_error(E_WARNING, \"" funcs[i] ": not yet implemented\");" > stubfile + } + print "}\n/* }}} */\n" > stubfile + + if (stubs) { + h_stubs = h_stubs "PHP_FUNCTION(" funcs[i] ");\n" + c_stubs = c_stubs "\tPHP_FE(" funcs[i] ",\tNULL)\n" + } else { + print "PHP_FUNCTION(" funcs[i] ");" > extname "/function_declarations" + print "\tPHP_FE(" funcs[i] ",\tNULL)" > extname "/function_entries" + } + + if (xml) print xmlstr > xmldoc + } + + if (stubs) { + print "\n/* ----------------------------------------------------------- */\n" > stubfile + print c_stubs > stubfile + print "\n/* ----------------------------------------------------------- */\n" > stubfile + print h_stubs > stubfile + } + + if (xml) print xmlfoot > xmldoc +} + +# +# Local variables: +# tab-width: 2 +# c-basic-offset: 2 +# End: + diff --git a/ext/skeleton/php_skeleton.h b/ext/skeleton/php_skeleton.h new file mode 100644 index 0000000..495907b --- /dev/null +++ b/ext/skeleton/php_skeleton.h @@ -0,0 +1,58 @@ +/* __header_here__ */ + +#ifndef PHP_EXTNAME_H +#define PHP_EXTNAME_H + +extern zend_module_entry extname_module_entry; +#define phpext_extname_ptr &extname_module_entry + +#ifdef PHP_WIN32 +# define PHP_EXTNAME_API __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_EXTNAME_API __attribute__ ((visibility("default"))) +#else +# define PHP_EXTNAME_API +#endif + +#ifdef ZTS +#include "TSRM.h" +#endif + +PHP_MINIT_FUNCTION(extname); +PHP_MSHUTDOWN_FUNCTION(extname); +PHP_RINIT_FUNCTION(extname); +PHP_RSHUTDOWN_FUNCTION(extname); +PHP_MINFO_FUNCTION(extname); + +PHP_FUNCTION(confirm_extname_compiled); /* For testing, remove later. */ +/* __function_declarations_here__ */ + +/* + Declare any global variables you may need between the BEGIN + and END macros here: + +ZEND_BEGIN_MODULE_GLOBALS(extname) + long global_value; + char *global_string; +ZEND_END_MODULE_GLOBALS(extname) +*/ + +/* In every utility function you add that needs to use variables + in php_extname_globals, call TSRMLS_FETCH(); after declaring other + variables used by that function, or better yet, pass in TSRMLS_CC + after the last function argument and declare your utility function + with TSRMLS_DC after the last declared argument. Always refer to + the globals in your function as EXTNAME_G(variable). You are + encouraged to rename these macros something shorter, see + examples in any other php module directory. +*/ + +#ifdef ZTS +#define EXTNAME_G(v) TSRMG(extname_globals_id, zend_extname_globals *, v) +#else +#define EXTNAME_G(v) (extname_globals.v) +#endif + +#endif /* PHP_EXTNAME_H */ + +/* __footer_here__ */ diff --git a/ext/skeleton/skeleton.c b/ext/skeleton/skeleton.c new file mode 100644 index 0000000..920354a --- /dev/null +++ b/ext/skeleton/skeleton.c @@ -0,0 +1,166 @@ +/* __header_here__ */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "php_ini.h" +#include "ext/standard/info.h" +#include "php_extname.h" + +/* If you declare any globals in php_extname.h uncomment this: +ZEND_DECLARE_MODULE_GLOBALS(extname) +*/ + +/* True global resources - no need for thread safety here */ +static int le_extname; + +/* {{{ extname_functions[] + * + * Every user visible function must have an entry in extname_functions[]. + */ +const zend_function_entry extname_functions[] = { + PHP_FE(confirm_extname_compiled, NULL) /* For testing, remove later. */ + /* __function_entries_here__ */ + PHP_FE_END /* Must be the last line in extname_functions[] */ +}; +/* }}} */ + +/* {{{ extname_module_entry + */ +zend_module_entry extname_module_entry = { +#if ZEND_MODULE_API_NO >= 20010901 + STANDARD_MODULE_HEADER, +#endif + "extname", + extname_functions, + PHP_MINIT(extname), + PHP_MSHUTDOWN(extname), + PHP_RINIT(extname), /* Replace with NULL if there's nothing to do at request start */ + PHP_RSHUTDOWN(extname), /* Replace with NULL if there's nothing to do at request end */ + PHP_MINFO(extname), +#if ZEND_MODULE_API_NO >= 20010901 + "0.1", /* Replace with version number for your extension */ +#endif + STANDARD_MODULE_PROPERTIES +}; +/* }}} */ + +#ifdef COMPILE_DL_EXTNAME +ZEND_GET_MODULE(extname) +#endif + +/* {{{ PHP_INI + */ +/* Remove comments and fill if you need to have entries in php.ini +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("extname.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_extname_globals, extname_globals) + STD_PHP_INI_ENTRY("extname.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_extname_globals, extname_globals) +PHP_INI_END() +*/ +/* }}} */ + +/* {{{ php_extname_init_globals + */ +/* Uncomment this function if you have INI entries +static void php_extname_init_globals(zend_extname_globals *extname_globals) +{ + extname_globals->global_value = 0; + extname_globals->global_string = NULL; +} +*/ +/* }}} */ + +/* {{{ PHP_MINIT_FUNCTION + */ +PHP_MINIT_FUNCTION(extname) +{ + /* If you have INI entries, uncomment these lines + REGISTER_INI_ENTRIES(); + */ + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_MSHUTDOWN_FUNCTION + */ +PHP_MSHUTDOWN_FUNCTION(extname) +{ + /* uncomment this line if you have INI entries + UNREGISTER_INI_ENTRIES(); + */ + return SUCCESS; +} +/* }}} */ + +/* Remove if there's nothing to do at request start */ +/* {{{ PHP_RINIT_FUNCTION + */ +PHP_RINIT_FUNCTION(extname) +{ + return SUCCESS; +} +/* }}} */ + +/* Remove if there's nothing to do at request end */ +/* {{{ PHP_RSHUTDOWN_FUNCTION + */ +PHP_RSHUTDOWN_FUNCTION(extname) +{ + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_MINFO_FUNCTION + */ +PHP_MINFO_FUNCTION(extname) +{ + php_info_print_table_start(); + php_info_print_table_header(2, "extname support", "enabled"); + php_info_print_table_end(); + + /* Remove comments if you have entries in php.ini + DISPLAY_INI_ENTRIES(); + */ +} +/* }}} */ + + +/* Remove the following function when you have succesfully modified config.m4 + so that your module can be compiled into PHP, it exists only for testing + purposes. */ + +/* Every user-visible function in PHP should document itself in the source */ +/* {{{ proto string confirm_extname_compiled(string arg) + Return a string to confirm that the module is compiled in */ +PHP_FUNCTION(confirm_extname_compiled) +{ + char *arg = NULL; + int arg_len, len; + char *strg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { + return; + } + + len = spprintf(&strg, 0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg); + RETURN_STRINGL(strg, len, 0); +} +/* }}} */ +/* The previous line is meant for vim and emacs, so it can correctly fold and + unfold functions in source code. See the corresponding marks just before + function definition, where the functions purpose is also documented. Please + follow this convention for the convenience of others editing your code. +*/ + +/* __function_stubs_here__ */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/skeleton/skeleton.dsp b/ext/skeleton/skeleton.dsp new file mode 100644 index 0000000..c3c67c7 --- /dev/null +++ b/ext/skeleton/skeleton.dsp @@ -0,0 +1,113 @@ +# Microsoft Developer Studio Project File - Name="extname" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=extname - Win32 Release_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "extname.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "extname.mak" CFG="extname - Win32 Release_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "extname - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "extname - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "extname - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "Release_TS"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_TS"
+# PROP Intermediate_Dir "Release_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXTNAME_EXPORTS" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXTNAME=1 /D "LIBZEND_EXPORTS" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x406 /d "NDEBUG"
+# ADD RSC /l 0x406 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_extname.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
+
+!ELSEIF "$(CFG)" == "extname - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Debug_TS"
+# PROP Intermediate_Dir "Debug_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXTNAME_EXPORTS" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXTNAME=1 /D "LIBZEND_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x406 /d "NDEBUG"
+# ADD RSC /l 0x406 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_extname.dll" /libpath:"..\..\Debug_TS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "extname - Win32 Release_TS"
+# Name "extname - Win32 Debug_TS"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\extname.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\php_extname.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/ext/skeleton/skeleton.php b/ext/skeleton/skeleton.php new file mode 100644 index 0000000..91db9d5 --- /dev/null +++ b/ext/skeleton/skeleton.php @@ -0,0 +1,21 @@ +<?php +$br = (php_sapi_name() == "cli")? "":"<br>"; + +if(!extension_loaded('extname')) { + dl('extname.' . PHP_SHLIB_SUFFIX); +} +$module = 'extname'; +$functions = get_extension_funcs($module); +echo "Functions available in the test extension:$br\n"; +foreach($functions as $func) { + echo $func."$br\n"; +} +echo "$br\n"; +$function = 'confirm_' . $module . '_compiled'; +if (extension_loaded($module)) { + $str = $function($module); +} else { + $str = "Module $module is not compiled into PHP"; +} +echo "$str\n"; +?> diff --git a/ext/skeleton/tests/001.phpt b/ext/skeleton/tests/001.phpt new file mode 100644 index 0000000..a375577 --- /dev/null +++ b/ext/skeleton/tests/001.phpt @@ -0,0 +1,21 @@ +--TEST-- +Check for extname presence +--SKIPIF-- +<?php if (!extension_loaded("extname")) print "skip"; ?> +--FILE-- +<?php +echo "extname extension is available"; +/* + you can add regression tests for your extension here + + the output of your test code has to be equal to the + text in the --EXPECT-- section below for the tests + to pass, differences between the output and the + expected text are interpreted as failure + + see php5/README.TESTING for further information on + writing regression tests +*/ +?> +--EXPECT-- +extname extension is available |