]> granicus.if.org Git - php/commitdiff
- As Sascha requested.
authorJouni Ahto <jah@php.net>
Fri, 9 Jun 2000 03:38:37 +0000 (03:38 +0000)
committerJouni Ahto <jah@php.net>
Fri, 9 Jun 2000 03:38:37 +0000 (03:38 +0000)
ext/ext_skel
ext/skeleton/create_module [deleted file]
ext/skeleton/php_skeleton.h
ext/skeleton/skeleton.c

index 60b5a224f96682555757359087620c0860b4d547..be8bbbfc4ba53338cea7b9f0d56e01b861ab2ccf 100755 (executable)
@@ -42,20 +42,28 @@ dnl \$Id\$
 dnl config.m4 for extension $extname
 dnl don't forget to call PHP_EXTENSION($extname)
 
+dnl Comments in this file start with the string 'dnl'.
+dnl Remove where necessary. This file will not work
+dnl without editing.
+
 dnl If your extension references something external, use with:
 
-PHP_ARG_WITH($extname, for $extname support,
+dnl PHP_ARG_WITH($extname, for $extname support,
 dnl Make sure that the comment is aligned:
-[  --with-$extname             Include $extname support])
+dnl [  --with-$extname             Include $extname support])
 
 dnl Otherwise use enable:
 
-PHP_ARG_ENABLE($extname, whether to enable $extname support,
+dnl PHP_ARG_ENABLE($extname, whether to enable $extname support,
 dnl Make sure that the comment is aligned:
-[  --enable-$extname           Enable $extname support])
+dnl [  --enable-$extname           Enable $extname support])
 
 if test "\$PHP_$EXTNAME" != "no"; then
-  dnl Action..
+  dnl If you will not be testing anything external, like existence of
+  dnl headers, libraries or functions in them, just uncomment the 
+  dnl following line and you are ready to go.
+  dnl AC_DEFINE(HAVE_$EXTNAME, 1, [ ])
+  dnl Write more examples of tests here...
   PHP_EXTENSION($extname, \$ext_shared)
 fi
 eof
@@ -83,6 +91,15 @@ Makefile
 libs.mk
 eof
 
+$ECHO_N " $extname.c$ECHO_C"
+cat ../skeleton/skeleton.c | sed -e "s/_extname_/$extname/g" | sed -e "s/_EXTNAME_/$EXTNAME/g" > $extname.c
+
+$ECHO_N " php_$extname.h$ECHO_C"
+cat ../skeleton/php_skeleton.h | sed -e "s/_extname_/$extname/g" | sed -e "s/_EXTNAME_/$EXTNAME/g" > php_$extname.h
+
+$ECHO_N " $extname.php$ECHO_C"
+cat ../skeleton/skeleton.php | sed -e "s/_extname_/$extname/g" | sed -e "s/_EXTNAME_/$EXTNAME/g" > $extname.php
+
 chmod 644 *
 
 echo " [done]."
@@ -92,10 +109,11 @@ cat <<eof
 To use your new extension, you will have to execute the following steps:
 
     $ cd ..
+    $ vi ext/$extname/config.m4
     $ ./buildconf
-    $ ./configure                 (your extension is automatically enabled)
-    $ vi ext/$extname/$extname.c
+    $ ./configure --[with|enable]-$extname
     $ make
+    $ vi ext/$extname/$extname.c
 
 Repeat the last two steps as often as necessary.
 
diff --git a/ext/skeleton/create_module b/ext/skeleton/create_module
deleted file mode 100755 (executable)
index b5b18c6..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/sh
-
-extname="$1"
-EXTNAME=`echo $1|tr a-z A-Z`
-
-cd ..
-
-givup() {
-       echo $*
-       exit 1
-}
-
-if test "$extname" = ""; then
-       givup "usage: $0 extension-name"
-fi
-
-if test -d "$extname" ; then
-       givup "Directory $extname already exists."
-fi
-
-test -f ext_skel || givup "ext_skel must be in the current directory"
-
-if echo '\c' | grep -s c >/dev/null 2>&1
-then
-    ECHO_N="echo -n"
-    ECHO_C=""
-else
-    ECHO_N="echo"
-    ECHO_C='\c'
-fi
-
-echo "Creating directory"
-
-mkdir $extname || givup "Cannot create directory $extname"
-
-cd $extname
-chmod 755 .
-
-$ECHO_N "Creating basic files:$ECHO_C"
-
-$ECHO_N " config.m4$ECHO_C"
-cat >config.m4 <<eof
-dnl \$Id\$
-dnl config.m4 for extension $extname
-dnl don't forget to call PHP_EXTENSION($extname)
-
-dnl Comments in this file start with the string 'dnl'.
-dnl Remove where necessary. This file will not work
-dnl without editing.
-
-dnl If your extension references something external, use with:
-
-dnl PHP_ARG_WITH($extname, for $extname support,
-dnl Make sure that the comment is aligned:
-dnl [  --with-$extname             Include $extname support])
-
-dnl Otherwise use enable:
-
-dnl PHP_ARG_ENABLE($extname, whether to enable $extname support,
-dnl Make sure that the comment is aligned:
-dnl [  --enable-$extname           Enable $extname support])
-
-if test "\$PHP_$EXTNAME" != "no"; then
-  dnl If you will not be testing anything external, like existence of
-  dnl headers, libraries or functions in them, just uncomment the 
-  dnl following line and you are ready to go.
-  dnl AC_DEFINE(HAVE_$EXTNAME, 1, [ ])
-  dnl Write more examples of tests here...
-  PHP_EXTENSION($extname, \$ext_shared)
-fi
-eof
-
-$ECHO_N " Makefile.in$ECHO_C"
-cat >Makefile.in <<eof
-# \$Id\$
-
-LTLIBRARY_NAME        = lib$extname.la
-LTLIBRARY_SOURCES     = $extname.c
-LTLIBRARY_SHARED_NAME = $extname.la
-
-include \$(top_srcdir)/build/dynlib.mk
-eof
-
-
-$ECHO_N " .cvsignore$ECHO_C"
-cat >.cvsignore <<eof
-.deps
-Makefile
-*.o
-*.lo
-*.la
-.libs
-libs.mk
-eof
-
-$ECHO_N " $extname.c$ECHO_C"
-cat ../skeleton/skeleton.c | sed -e "s/_extname_/$extname/g" | sed -e "s/_EXTNAME_/$EXTNAME/g" > $extname.c
-
-$ECHO_N " php_$extname.h$ECHO_C"
-cat ../skeleton/php_skeleton.h | sed -e "s/_extname_/$extname/g" | sed -e "s/_EXTNAME_/$EXTNAME/g" > php_$extname.h
-
-$ECHO_N " $extname.php$ECHO_C"
-cat ../skeleton/skeleton.php | sed -e "s/_extname_/$extname/g" | sed -e "s/_EXTNAME_/$EXTNAME/g" > $extname.php
-
-chmod 644 *
-
-echo " [done]."
-
-cat <<eof
-
-To use your new extension, you will have to execute the following steps:
-
-    $ cd ../..
-    $ vi ext/$extname/config.m4
-    $ ./buildconf
-    $ ./configure --[with|enable]-$extname
-    $ make
-    $ vi ext/$extname/$extname.c
-
-Repeat the last two steps as often as necessary.
-
-eof
index 70456f5e3ec84ff334a68ba180609bec7ea3a428..fb4b3739e2886eb172d4833ce95f79c8d613568d 100644 (file)
@@ -32,7 +32,7 @@
 #if HAVE__EXTNAME_
 
 extern zend_module_entry _extname__module_entry;
-#define _extname__module_ptr &_extname__module_entry
+#define phpext__extname__ptr &_extname__module_entry
 
 #ifdef PHP_WIN32
 #define PHP__EXTNAME__API __declspec(dllexport)
@@ -52,6 +52,12 @@ typedef struct {
        /* Fill in this structure and use entries in it
           for thread safety instead of using true globals.
        */
+       /* You can use the next one as type if your module registers any
+          resources. Oh, you can of course rename it to something more
+          suitable, add list entry types or remove it if it not needed.
+          It's just an example.
+       */
+       int le__extname_;
 } php__extname__globals;
 
 /* In every function that needs to use variables in php__extname__globals,
@@ -71,12 +77,10 @@ typedef struct {
 
 #else
 
-#define _extname__module_ptr NULL
+#define php__extname__ptr NULL
 
 #endif
 
-#define phpext__extname__ptr _extname__module_ptr
-
 #endif /* _PHP__EXTNAME__H */
 
 /*
index 3c261bd2deafb35c111b161667a4f0d4b8ee529c..c24dc52b6c81630150ca41e66d4a7795f7e27510 100644 (file)
 /* You should tweak config.m4 so this symbol (or some else suitable)
    gets defined.
 */
-#if HAVE__EXTNAME_
-
-/* Use this for type if your module registers any resources. You can of course
-   rename it and add more if needed. These can be true globals, they don't need
-   thread safety. Remove if not needed.
-*/
-static int le_extname_;
+#ifdef HAVE__EXTNAME_
 
 #ifdef ZTS
 int _extname__globals_id;
@@ -131,7 +125,8 @@ PHP_FUNCTION(_extname__test)
 /* }}} */
 /* The previous line is meant for 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.
+   definition, where the functions purpose is also documented. Please follow
+   this convention for the convenience of others editing your code.
 */
 
 #endif /* HAVE__EXTNAME_ */