diff options
author | daniel <danieruru@gmail.com> | 2013-01-24 00:15:16 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-24 00:15:16 +0900 |
commit | d31d69b338c7fef5583ec705c1e748c2a2aeaba6 (patch) | |
tree | eeaf75d97ac96b8b3d49027cd930068864500d86 | |
parent | 609cb1e17a9ab8edf1ccab42574b44bc1439aeb7 (diff) |
named
-rw-r--r-- | libvxi11client/perlbits/Client.pm | 20 | ||||
-rw-r--r-- | libvxi11client/perlbits/Client.xs | 6 | ||||
-rw-r--r-- | libvxi11client/perlbits/VXI11-Client.t | 10 | ||||
-rw-r--r-- | libvxi11client/perlbits/testscript.pl | 4 |
4 files changed, 30 insertions, 10 deletions
diff --git a/libvxi11client/perlbits/Client.pm b/libvxi11client/perlbits/Client.pm index 9b8fdb2..204027c 100644 --- a/libvxi11client/perlbits/Client.pm +++ b/libvxi11client/perlbits/Client.pm @@ -35,6 +35,26 @@ XSLoader::load('VXI11::Client', $VERSION); # Preloaded methods go here. +sub vxi_enable_srq { + return vxi_enable_srq_long($_[0], 1, $_[1]); +} + +sub vxi_disable_srq { + return vxi_enable_srq_long($_[0], 0 , ""); +} + +sub vxi_write { + my $self = shift; + my %args = ( + len => -1, + waitlock => 0, + end => 1, + @_ + ); + return vxi_write_long($self, $args{data}, $args{len}, $args{waitlock}, $args{end}); +} + + 1; __END__ # Below is stub documentation for your module. You'd better edit it! diff --git a/libvxi11client/perlbits/Client.xs b/libvxi11client/perlbits/Client.xs index e26190b..1b8649a 100644 --- a/libvxi11client/perlbits/Client.xs +++ b/libvxi11client/perlbits/Client.xs @@ -78,7 +78,7 @@ vxi_docmd(context, cmd, waitforlock) RETVAL int -vxi_enable_srq(context, enable, handle) +vxi_enable_srq_long(context, enable, handle) VXI11::Client context bool enable char* handle @@ -135,7 +135,7 @@ vxi_read(context, OUTLIST bytesread, OUTLIST buffer, bufferlen, waitlock, termch CODE: buffer = calloc(bufferlen + 1, 1); bytesread = vxi11_read(context, buffer, bufferlen, waitlock, termchrset, termchr, &reason); - + void vxi_readstatusbyte(context, OUTLIST error, OUTLIST statusbyte, waitforlock) VXI11::Client context @@ -178,7 +178,7 @@ vxi_unlock(context) RETVAL int -vxi_write(context,data, len, waitlock, end) +vxi_write_long(context,data, len, waitlock, end) VXI11::Client context char * data int len diff --git a/libvxi11client/perlbits/VXI11-Client.t b/libvxi11client/perlbits/VXI11-Client.t index c4ffcac..e31460e 100644 --- a/libvxi11client/perlbits/VXI11-Client.t +++ b/libvxi11client/perlbits/VXI11-Client.t @@ -8,7 +8,7 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 16; BEGIN { use_ok('VXI11::Client') }; ######################### @@ -21,7 +21,7 @@ BEGIN { use_ok('VXI11::Client') }; 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"); +ok($instr->vxi_write(data => "*IDN?") > 0, "Write"); my ($bytes, $buff, $reason) = $instr->vxi_read(256, 0, 0, 0); print "got " . $bytes . ";" . $buff . "\n"; @@ -31,9 +31,9 @@ my ($error, $statusbyte) = $instr->vxi_readstatusbyte(0); 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"); -is(&VXI11::Client::vxi_wait_for_interrupt, "myhandle", "Wait for interrupt"); -is($instr->vxi_enable_srq(0, ""), 1, "Disable interrupts"); +is($instr->vxi_enable_srq("myhandle"), 1, "Enable interrupts"); +#is(&VXI11::Client::vxi_wait_for_interrupt, "myhandle", "Wait for interrupt"); +is($instr->vxi_disable_srq(), 1, "Disable interrupts"); is($instr->vxi_destroy_intr_chan(), 1, "Destroy intr channel"); is($instr->vxi_abort(), 1, "Abort"); is($instr->vxi_clear(0), 1, "Clear"); diff --git a/libvxi11client/perlbits/testscript.pl b/libvxi11client/perlbits/testscript.pl index 5af15d3..7bcfda6 100644 --- a/libvxi11client/perlbits/testscript.pl +++ b/libvxi11client/perlbits/testscript.pl @@ -18,9 +18,9 @@ my ($error, $statusbyte) = $instr->vxi_readstatusbyte(0); printf "status byte is " . $statusbyte . "\n"; $instr->vxi_create_intr_chan(); -$instr->vxi_enable_srq(1, "myhandle"); +$instr->vxi_enable_srq("myhandle"); vxi_wait_for_interrupt(); -$instr->vxi_enable_srq(0, ""); +$instr->vxi_disable_srq(); $instr->vxi_destroy_intr_chan(); $instr->vxi_abort(); $instr->vxi_clear(0); |