As you wish...made with "diff -u gpib.c.orig gpib.c > gpib-php.patch"
--- gpib.c.orig 2016-06-23 10:06:53.789146336 +0200
+++ gpib.c 2016-06-22 15:27:33.329798187 +0200
@@ -11,6 +11,9 @@
the Minerva "Emerge" project, in February 2003
(C) Michel Billaud, 2003
+php5 modifications by
+ Richard Klingler, richard@klingler.net
+
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
@@ -29,6 +32,7 @@
the linux-gpib-3.1.92 files. http://linux-gpib.sourceforge.net
MODIFICATIONS
+ * 2016/06/22 : modifications to make it work with php5
* 2003/02/25 : in ibrd, string terminated after ibcnt chars
* 2003/03/14 : more comments
@@ -37,11 +41,11 @@
- integrate more constants (for ibconf)
NOTES :
- * installation under Debian/Woody requires the php4-dev package
+ * installation under Debian/Woody requires the php5-dev package
* for convenience, install the gpib.so where dynamic extensions live
and add the line
- extension=gpib.so
- to the /etc/php/{apache,cgi}/php.ini files
+ extension=gpib_php.so
+ to the /etc/php5/{apache2,cli}/conf.d/20-gpib.ini files
BIBLIOGRAPHY:
@@ -49,13 +53,7 @@
Till Gerken, Campus Press, pp. 327-...
file://localhost/opt/doc.php.nexen.html/zend.structure.exporting-functions.html */
-#ifdef USE_LINUX_GPIB
#include "gpib/ib.h"
-#endif
-
-#ifdef USE_NI_GPIB
-#include <ugpib.h>
-#endif
#include "php.h"
#include "ext/standard/info.h"
@@ -175,10 +173,6 @@
== FAILURE) { \
return; \
} \
- if (!PZVAL_IS_REF(z)) { \
- zend_error(E_WARNING, "Not a reference"); \
- RETURN_NULL(); \
- } \
r=functionName(n,&result); \
ZVAL_LONG(z,result); \
RETURN_LONG(r); \
@@ -195,10 +189,6 @@
== FAILURE) { \
return; \
} \
- if (!PZVAL_IS_REF(z)) { \
- zend_error(E_WARNING, "Not a reference"); \
- RETURN_NULL(); \
- } \
r=functionName(n,&result); \
ZVAL_LONG(z,result); \
RETURN_LONG(r); \
@@ -215,10 +205,6 @@
== FAILURE) { \
return; \
} \
- if (!PZVAL_IS_REF(z)) { \
- zend_error(E_WARNING, "Not a reference"); \
- RETURN_NULL(); \
- } \
r=functionName(n,nn,&result); \
ZVAL_LONG(z,result); \
RETURN_LONG(r); \
@@ -256,9 +242,7 @@
ZEND_FUNCTION(ibwait);
ZEND_FUNCTION(ibwrtf);
-#ifdef USE_LINUX_GPIB
ZEND_FUNCTION(gpib_error_string);
-#endif
ZEND_FUNCTION(ibsta);
ZEND_FUNCTION(ibcnt);
@@ -306,11 +290,9 @@
ZEND_FE(ibwait, NULL)
ZEND_FE(ibwrtf, NULL)
-#ifdef USE_LINUX_GPIB
ZEND_FE(gpib_error_string, NULL)
-#endif
- ZEND_FE(ibsta, NULL)
+ ZEND_FE(ibsta, NULL)
ZEND_FE(ibcnt, NULL)
ZEND_FE(iberr, NULL)
@@ -349,16 +331,11 @@
php_info_print_table_start();
php_info_print_table_row(2,"GPIB Support","Enabled");
-#ifdef USE_LINUX_GPIB
php_info_print_table_row(2,"Supported library",
"Linux GPIB "
"(http://linux-gpib/sourceforge.net)");
-#endif
-#ifdef USE_NI_GPIB
- php_info_print_table_row(2,"Supported library",
- "National Instruments");
-#endif
+ php_info_print_table_row(2,"PHP5 modifications by","Richard Klingler, richard@klingler.net");
php_info_print_table_end();
}
@@ -486,7 +463,6 @@
*/
-#ifdef USE_LINUX_GPIB
ZEND_FUNCTION(gpib_error_string)
{
long n;
@@ -497,7 +473,6 @@
}
RETURN_STRING((char*)gpib_error_string(n), 1);
}
-#endif
ZEND_FUNCTION(ibwrt)
{
@@ -542,10 +517,6 @@
== FAILURE) {
return;
}
- if (!PZVAL_IS_REF(z)) {
- zend_error(E_WARNING, "Not a reference");
- RETURN_NULL();
- }
p = (char *) malloc(len + 1);
memset(p,0,len+1);
r=ibrd(n,p,len);