summaryrefslogtreecommitdiff
path: root/libvxi11client/perlbits
diff options
context:
space:
mode:
authordaniel <danieruru@gmail.com>2013-01-23 22:25:41 +0900
committerdaniel <danieruru@gmail.com>2013-01-23 22:25:41 +0900
commit609cb1e17a9ab8edf1ccab42574b44bc1439aeb7 (patch)
treec4c41ab2ad0e922966e0af8d33a90bffd50ab224 /libvxi11client/perlbits
parent5d66712261026f3f2da0958d98d60fb2142feedd (diff)
fix the handling of int getting passed back.. returning the address of the int is not what we want.
Diffstat (limited to 'libvxi11client/perlbits')
-rw-r--r--libvxi11client/perlbits/Client.xs26
-rw-r--r--libvxi11client/perlbits/VXI11-Client.t5
-rw-r--r--libvxi11client/perlbits/testscript.pl4
-rw-r--r--libvxi11client/perlbits/typemap5
4 files changed, 18 insertions, 22 deletions
diff --git a/libvxi11client/perlbits/Client.xs b/libvxi11client/perlbits/Client.xs
index b09ee0a..e26190b 100644
--- a/libvxi11client/perlbits/Client.xs
+++ b/libvxi11client/perlbits/Client.xs
@@ -131,27 +131,25 @@ vxi_read(context, OUTLIST bytesread, OUTLIST buffer, bufferlen, waitlock, termch
bool waitlock
bool termchrset
char termchr
- unsigned int* reason
+ unsigned int reason
CODE:
- buffer = malloc(bufferlen + 1);
- bytesread = vxi11_read(context, buffer, bufferlen, waitlock, termchrset, termchr, reason);
+ buffer = calloc(bufferlen + 1, 1);
+ bytesread = vxi11_read(context, buffer, bufferlen, waitlock, termchrset, termchr, &reason);
void
-vxi_readstatusbyte(context, waitforlock, OUTLIST error, OUTLIST statusbyte)
+vxi_readstatusbyte(context, OUTLIST error, OUTLIST statusbyte, waitforlock)
VXI11::Client context
+ int error
+ int statusbyte
bool waitforlock
- int* error
- int* statusbyte
CODE:
+ error = 0;
+ statusbyte = 0;
int ret = vxi11_readstatusbyte(context, waitforlock);
- if(ret > 0){
- *statusbyte = ret & 0xff;
- *error = 0;
- }
- else {
- *statusbyte = 0;
- *error = ret;
- }
+ if(ret > 0)
+ statusbyte = ret & 0xff;
+ else
+ error = ret;
int
vxi_remote(context, waitforlock)
diff --git a/libvxi11client/perlbits/VXI11-Client.t b/libvxi11client/perlbits/VXI11-Client.t
index 7054d39..c4ffcac 100644
--- a/libvxi11client/perlbits/VXI11-Client.t
+++ b/libvxi11client/perlbits/VXI11-Client.t
@@ -18,7 +18,7 @@ BEGIN { use_ok('VXI11::Client') };
&VXI11::Client::vxi_startinterruptserver();
-my $instr = &VXI11::Client::vxi_open("192.168.0.62", 0);
+my $instr = &VXI11::Client::vxi_open("roi", 0);
is($instr->vxi_lock(0), 1, "Lock");
ok($instr->vxi_write("*IDN?", -1, 0, 0) > 0, "Write");
@@ -27,9 +27,8 @@ my ($bytes, $buff, $reason) = $instr->vxi_read(256, 0, 0, 0);
print "got " . $bytes . ";" . $buff . "\n";
ok($bytes > 0, "Read");
-
my ($error, $statusbyte) = $instr->vxi_readstatusbyte(0);
-ok($error == 0 , "Read status byte");
+is($error,0, "Read status byte");
is($instr->vxi_create_intr_chan(), 1, "Create intr channel");
is($instr->vxi_enable_srq(1, "myhandle"), 1, "Enable interrupts");
diff --git a/libvxi11client/perlbits/testscript.pl b/libvxi11client/perlbits/testscript.pl
index 45a3d01..5af15d3 100644
--- a/libvxi11client/perlbits/testscript.pl
+++ b/libvxi11client/perlbits/testscript.pl
@@ -7,12 +7,12 @@ use VXI11::Client;
vxi_startinterruptserver();
-my $instr = vxi_open("192.168.0.62", 0);
+my $instr = vxi_open("roi", 0);
$instr->vxi_lock(0);
$instr->vxi_write("*IDN?", -1, 0, 0);
my ($bytes, $buff, $reason) = $instr->vxi_read(256, 0, 0, 0);
-print "got " . $bytes . ";" . $buff . "\n";
+print "got " . $bytes . ";" . $buff . " reason " . $reason ."\n";
my ($error, $statusbyte) = $instr->vxi_readstatusbyte(0);
printf "status byte is " . $statusbyte . "\n";
diff --git a/libvxi11client/perlbits/typemap b/libvxi11client/perlbits/typemap
index 3817e78..d978c9a 100644
--- a/libvxi11client/perlbits/typemap
+++ b/libvxi11client/perlbits/typemap
@@ -1,5 +1,4 @@
VXI11Context * T_PTROBJ
VXI11::Client T_PTROBJ
-unsigned int * T_IV
-int * T_IV
-
+unsigned int T_UV
+int T_IV