Skip to content

Commit

Permalink
rename skeleton to my_print_ht
Browse files Browse the repository at this point in the history
  • Loading branch information
meihei3 committed Jul 8, 2023
1 parent 2b58138 commit 44429f6
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 75 deletions.
66 changes: 33 additions & 33 deletions ext/config.m4
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
dnl config.m4 for extension skeleton
dnl config.m4 for extension my_print_ht

dnl Comments in this file start with the string 'dnl'.
dnl Remove where necessary.

dnl If your extension references something external, use 'with':

dnl PHP_ARG_WITH([skeleton],
dnl [for skeleton support],
dnl [AS_HELP_STRING([--with-skeleton],
dnl [Include skeleton support])])
dnl PHP_ARG_WITH([my_print_ht],
dnl [for my_print_ht support],
dnl [AS_HELP_STRING([--with-my_print_ht],
dnl [Include my_print_ht support])])

dnl Otherwise use 'enable':

PHP_ARG_ENABLE([skeleton],
[whether to enable skeleton support],
[AS_HELP_STRING([--enable-skeleton],
[Enable skeleton support])],
PHP_ARG_ENABLE([my_print_ht],
[whether to enable my_print_ht support],
[AS_HELP_STRING([--enable-my_print_ht],
[Enable my_print_ht support])],
[no])

if test "$PHP_SKELETON" != "no"; then
if test "$PHP_MY_PRINT_HT" != "no"; then
dnl Write more examples of tests here...

dnl Remove this code block if the library does not support pkg-config.
dnl PKG_CHECK_MODULES([LIBFOO], [foo])
dnl PHP_EVAL_INCLINE($LIBFOO_CFLAGS)
dnl PHP_EVAL_LIBLINE($LIBFOO_LIBS, SKELETON_SHARED_LIBADD)
dnl PHP_EVAL_LIBLINE($LIBFOO_LIBS, MY_PRINT_HT_SHARED_LIBADD)

dnl If you need to check for a particular library version using PKG_CHECK_MODULES,
dnl you can use comparison operators. For example:
Expand All @@ -33,42 +33,42 @@ if test "$PHP_SKELETON" != "no"; then
dnl PKG_CHECK_MODULES([LIBFOO], [foo = 1.2.3])

dnl Remove this code block if the library supports pkg-config.
dnl --with-skeleton -> check with-path
dnl --with-my_print_ht -> check with-path
dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
dnl SEARCH_FOR="/include/skeleton.h" # you most likely want to change this
dnl if test -r $PHP_SKELETON/$SEARCH_FOR; then # path given as parameter
dnl SKELETON_DIR=$PHP_SKELETON
dnl SEARCH_FOR="/include/my_print_ht.h" # you most likely want to change this
dnl if test -r $PHP_MY_PRINT_HT/$SEARCH_FOR; then # path given as parameter
dnl my_print_ht_DIR=$PHP_MY_PRINT_HT
dnl else # search default path list
dnl AC_MSG_CHECKING([for skeleton files in default path])
dnl AC_MSG_CHECKING([for my_print_ht files in default path])
dnl for i in $SEARCH_PATH ; do
dnl if test -r $i/$SEARCH_FOR; then
dnl SKELETON_DIR=$i
dnl MY_PRINT_HT_DIR=$i
dnl AC_MSG_RESULT(found in $i)
dnl fi
dnl done
dnl fi
dnl
dnl if test -z "$SKELETON_DIR"; then
dnl if test -z "$MY_PRINT_HT_DIR"; then
dnl AC_MSG_RESULT([not found])
dnl AC_MSG_ERROR([Please reinstall the skeleton distribution])
dnl AC_MSG_ERROR([Please reinstall the my_print_ht distribution])
dnl fi

dnl Remove this code block if the library supports pkg-config.
dnl --with-skeleton -> add include path
dnl PHP_ADD_INCLUDE($SKELETON_DIR/include)
dnl --with-my_print_ht -> add include path
dnl PHP_ADD_INCLUDE($MY_PRINT_HT_DIR/include)

dnl Remove this code block if the library supports pkg-config.
dnl --with-skeleton -> check for lib and symbol presence
dnl LIBNAME=SKELETON # you may want to change this
dnl LIBSYMBOL=SKELETON # you most likely want to change this
dnl --with-my_print_ht -> check for lib and symbol presence
dnl LIBNAME=MY_PRINT_HT # you may want to change this
dnl LIBSYMBOL=MY_PRINT_HT # you most likely want to change this

dnl If you need to check for a particular library function (e.g. a conditional
dnl or version-dependent feature) and you are using pkg-config:
dnl PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL,
dnl [
dnl AC_DEFINE(HAVE_SKELETON_FEATURE, 1, [ ])
dnl AC_DEFINE(HAVE_MY_PRINT_HT_FEATURE, 1, [ ])
dnl ],[
dnl AC_MSG_ERROR([FEATURE not supported by your skeleton library.])
dnl AC_MSG_ERROR([FEATURE not supported by your my_print_ht library.])
dnl ], [
dnl $LIBFOO_LIBS
dnl ])
Expand All @@ -77,18 +77,18 @@ if test "$PHP_SKELETON" != "no"; then
dnl or version-dependent feature) and you are not using pkg-config:
dnl PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL,
dnl [
dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $SKELETON_DIR/$PHP_LIBDIR, SKELETON_SHARED_LIBADD)
dnl AC_DEFINE(HAVE_SKELETON_FEATURE, 1, [ ])
dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $MY_PRINT_HT_DIR/$PHP_LIBDIR, MY_PRINT_HT_SHARED_LIBADD)
dnl AC_DEFINE(HAVE_MY_PRINT_HT_FEATURE, 1, [ ])
dnl ],[
dnl AC_MSG_ERROR([FEATURE not supported by your skeleton library.])
dnl AC_MSG_ERROR([FEATURE not supported by your my_print_ht library.])
dnl ],[
dnl -L$SKELETON_DIR/$PHP_LIBDIR -lm
dnl -L$MY_PRINT_HT_DIR/$PHP_LIBDIR -lm
dnl ])
dnl
dnl PHP_SUBST(SKELETON_SHARED_LIBADD)
dnl PHP_SUBST(MY_PRINT_HT_SHARED_LIBADD)

dnl In case of no dependencies
AC_DEFINE(HAVE_SKELETON, 1, [ Have skeleton support ])
AC_DEFINE(HAVE_MY_PRINT_HT, 1, [ Have my_print_ht support ])

PHP_NEW_EXTENSION(skeleton, skeleton.c, $ext_shared)
PHP_NEW_EXTENSION(my_print_ht, my_print_ht.c, $ext_shared)
fi
8 changes: 4 additions & 4 deletions ext/config.w32
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG_ENABLE('skeleton', 'skeleton support', 'no');
ARG_ENABLE('my_print_ht', 'my_print_ht support', 'no');

if (PHP_SKELETON != 'no') {
AC_DEFINE('HAVE_SKELETON', 1, 'skeleton support enabled');
if (PHP_MY_PRINT_HT != 'no') {
AC_DEFINE('HAVE_MY_PRINT_HT', 1, 'my_print_ht support enabled');

EXTENSION('skeleton', 'skeleton.c', null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
EXTENSION('my_print_ht', 'my_print_ht.c', null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
}
32 changes: 16 additions & 16 deletions ext/skeleton.c → ext/my_print_ht.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* skeleton extension for PHP */
/* my_print_ht extension for PHP */

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "php.h"
#include "ext/standard/info.h"
#include "php_skeleton.h"
#include "skeleton_arginfo.h"
#include "php_my_print_ht.h"
#include "my_print_ht_arginfo.h"

/* For compatibility with older PHP versions */
#ifndef ZEND_PARSE_PARAMETERS_NONE
Expand All @@ -21,7 +21,7 @@ PHP_FUNCTION(test1)
{
ZEND_PARSE_PARAMETERS_NONE();

php_printf("The extension %s is loaded and working!\r\n", "skeleton");
php_printf("The extension %s is loaded and working!\r\n", "my_print_ht");
}
/* }}} */

Expand All @@ -44,9 +44,9 @@ PHP_FUNCTION(test2)
/* }}}*/

/* {{{ PHP_RINIT_FUNCTION */
PHP_RINIT_FUNCTION(skeleton)
PHP_RINIT_FUNCTION(my_print_ht)
{
#if defined(ZTS) && defined(COMPILE_DL_SKELETON)
#if defined(ZTS) && defined(COMPILE_DL_MY_PRINT_HT)
ZEND_TSRMLS_CACHE_UPDATE();
#endif

Expand All @@ -55,32 +55,32 @@ PHP_RINIT_FUNCTION(skeleton)
/* }}} */

/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(skeleton)
PHP_MINFO_FUNCTION(my_print_ht)
{
php_info_print_table_start();
php_info_print_table_header(2, "skeleton support", "enabled");
php_info_print_table_header(2, "my_print_ht support", "enabled");
php_info_print_table_end();
}
/* }}} */

/* {{{ skeleton_module_entry */
zend_module_entry skeleton_module_entry = {
/* {{{ my_print_ht_module_entry */
zend_module_entry my_print_ht_module_entry = {
STANDARD_MODULE_HEADER,
"skeleton", /* Extension name */
"my_print_ht", /* Extension name */
ext_functions, /* zend_function_entry */
NULL, /* PHP_MINIT - Module initialization */
NULL, /* PHP_MSHUTDOWN - Module shutdown */
PHP_RINIT(skeleton), /* PHP_RINIT - Request initialization */
PHP_RINIT(my_print_ht), /* PHP_RINIT - Request initialization */
NULL, /* PHP_RSHUTDOWN - Request shutdown */
PHP_MINFO(skeleton), /* PHP_MINFO - Module info */
PHP_SKELETON_VERSION, /* Version */
PHP_MINFO(my_print_ht), /* PHP_MINFO - Module info */
PHP_MY_PRINT_HT_VERSION, /* Version */
STANDARD_MODULE_PROPERTIES
};
/* }}} */

#ifdef COMPILE_DL_SKELETON
#ifdef COMPILE_DL_MY_PRINT_HT
# ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
# endif
ZEND_GET_MODULE(skeleton)
ZEND_GET_MODULE(my_print_ht)
#endif
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions ext/php_my_print_ht.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* my_print_ht extension for PHP */

#ifndef PHP_MY_PRINT_HT_H
# define PHP_MY_PRINT_HT_H

extern zend_module_entry my_print_ht_module_entry;
# define phpext_my_print_ht_ptr &my_print_ht_module_entry

# define PHP_MY_PRINT_HT_VERSION "0.1.0"

# if defined(ZTS) && defined(COMPILE_DL_MY_PRINT_HT)
ZEND_TSRMLS_CACHE_EXTERN()
# endif

#endif /* PHP_MY_PRINT_HT_H */
15 changes: 0 additions & 15 deletions ext/php_skeleton.h

This file was deleted.

8 changes: 4 additions & 4 deletions ext/tests/001.phpt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
--TEST--
Check if skeleton is loaded
Check if my_print_ht is loaded
--EXTENSIONS--
skeleton
my_print_ht
--FILE--
<?php
echo 'The extension "skeleton" is available';
echo 'The extension "my_print_ht" is available';
?>
--EXPECT--
The extension "skeleton" is available
The extension "my_print_ht" is available
4 changes: 2 additions & 2 deletions ext/tests/002.phpt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
--TEST--
test1() Basic test
--EXTENSIONS--
skeleton
my_print_ht
--FILE--
<?php
$ret = test1();

var_dump($ret);
?>
--EXPECT--
The extension skeleton is loaded and working!
The extension my_print_ht is loaded and working!
NULL
2 changes: 1 addition & 1 deletion ext/tests/003.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--TEST--
test2() Basic test
--EXTENSIONS--
skeleton
my_print_ht
--FILE--
<?php
var_dump(test2());
Expand Down

0 comments on commit 44429f6

Please sign in to comment.