Re: php7

Richard Klingler <[email protected]>
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <CAD-C=v2L134S=Yy6zOaaWB+sRgQ=mFDHze0d0Cos3A2QSGGfAw@mail.gmail.com>
EHLO (o;

This fixes (at least for me) the "ibfind" crashing on Debian 9 and
php-7.0.27:
Length is now "size_t" in php-7.x

#define FUN_STRING(functionName) \
ZEND_FUNCTION(functionName)    \
{    \
  char *s;    \
  size_t s_len;    \
  int r;    \
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,     \
                "s", &s , &s_len    \
                ) == FAILURE) {    \
     RETURN_NULL();    \
  }    \
   r = functionName(s);    \
   RETURN_LONG(r);    \
}

Though still no data returned with ZVAL_STRINGL in "ibrd"...




2018-03-11 11:25 GMT+01:00 Richard Klingler <[email protected]>:

> Hello
>
> As I just moved recently to a newer machine running Debian 9 I started
> debugging the php gpib module...
>
> So far:
>
> ibfind crashes
> ibwrt times out as it always has a device number of 0
> and ibrd returns nothing, though when doing some printf statements inside
> ibrd function I can see that it successfully read something from my old
> beloved HP 3456A (o;
>
> ZEND_FUNCTION(ibrd)
> {
>     /* at the moment only the traditional form is supported
>        $r = ibrd($ud,&$string,$count)
>        (read at most $count bytes into $string)
>        but
>        $r = ibrd($ud,&$string)
>        (read unlimited number of bytes) will be. Soon. Really.
>     */
>     long n;
>     zval *z;
>     long len;
>     char *p;
>     long r;
>     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
>                   "lzl", &n, &z, &len)
>         == FAILURE) {
>         return;
>     }
>
>     p = (unsigned char *) malloc(len + 1);
>     if(p == NULL) {
>         ibsta |= ERR;
>         iberr = EABO;  // should be ENOMEM
>         RETURN_LONG(ibsta);
>     }
>     memset(p,0,len+1);
>
>     r=ibrd(n,p,len);
>     p[ibcnt]='\0';
>     ZVAL_STRINGL(z,p, ibcnt);
>
>     printf("Read %d bytes from device %d\n", ibcnt, n);
>     printf("Returned %s\n", p);
>     free(p);
>     RETURN_LONG(r);
> }
>
>
> gives me:
>
> klingler@debian:/home2/Develop/gpib$ php dmm.php
> Read 14 bytes from device 16
> Returned -02.84876E+0
>
>
> any ideas what has changed between 5.x and 7.x in php?
>
>
> thanks in advance
> richard
>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.