diff options
author | daniel <danieruru@gmail.com> | 2013-01-24 00:24:08 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-24 00:24:08 +0900 |
commit | 3d93dca40deb1c8484a865a85a548b8417b4559f (patch) | |
tree | c04cd93bada76a90bc27bbf1ec7cda21b254c24f | |
parent | 0aa0890888c28cff1a2f7b15e8ccda050bce08a8 (diff) |
named parameters for read()
-rw-r--r-- | libvxi11client/perlbits/Client.pm | 11 | ||||
-rw-r--r-- | libvxi11client/perlbits/Client.xs | 2 | ||||
-rw-r--r-- | libvxi11client/perlbits/VXI11-Client.t | 2 | ||||
-rw-r--r-- | libvxi11client/perlbits/testscript.pl | 2 |
4 files changed, 14 insertions, 3 deletions
diff --git a/libvxi11client/perlbits/Client.pm b/libvxi11client/perlbits/Client.pm index 204027c..cff79f5 100644 --- a/libvxi11client/perlbits/Client.pm +++ b/libvxi11client/perlbits/Client.pm @@ -54,6 +54,17 @@ sub vxi_write { return vxi_write_long($self, $args{data}, $args{len}, $args{waitlock}, $args{end}); } +sub vxi_read { + my $self = shift; + my %args = ( + bufferlen => 1024, + waitlock => 0, + termchrset => 0, + termch => 0, + @_ + ); + return vxi_read_long($self, $args{bufferlen}, $args{waitlock}, $args{termchrset},$args{termchr}); +} 1; __END__ diff --git a/libvxi11client/perlbits/Client.xs b/libvxi11client/perlbits/Client.xs index 1b8649a..5e8130f 100644 --- a/libvxi11client/perlbits/Client.xs +++ b/libvxi11client/perlbits/Client.xs @@ -123,7 +123,7 @@ vxi_open(address, device) RETVAL void -vxi_read(context, OUTLIST bytesread, OUTLIST buffer, bufferlen, waitlock, termchrset, termchr, OUTLIST reason) +vxi_read_long(context, OUTLIST bytesread, OUTLIST buffer, bufferlen, waitlock, termchrset, termchr, OUTLIST reason) VXI11::Client context char * buffer int bytesread diff --git a/libvxi11client/perlbits/VXI11-Client.t b/libvxi11client/perlbits/VXI11-Client.t index e31460e..2691ed2 100644 --- a/libvxi11client/perlbits/VXI11-Client.t +++ b/libvxi11client/perlbits/VXI11-Client.t @@ -23,7 +23,7 @@ my $instr = &VXI11::Client::vxi_open("roi", 0); is($instr->vxi_lock(0), 1, "Lock"); ok($instr->vxi_write(data => "*IDN?") > 0, "Write"); -my ($bytes, $buff, $reason) = $instr->vxi_read(256, 0, 0, 0); +my ($bytes, $buff, $reason) = $instr->vxi_read(); print "got " . $bytes . ";" . $buff . "\n"; ok($bytes > 0, "Read"); diff --git a/libvxi11client/perlbits/testscript.pl b/libvxi11client/perlbits/testscript.pl index f9653b6..9ba7053 100644 --- a/libvxi11client/perlbits/testscript.pl +++ b/libvxi11client/perlbits/testscript.pl @@ -11,7 +11,7 @@ my $instr = vxi_open("roi", 0); $instr->vxi_lock(0); $instr->vxi_write(data => "*IDN?"); -my ($bytes, $buff, $reason) = $instr->vxi_read(256, 0, 0, 0); +my ($bytes, $buff, $reason) = $instr->vxi_read(); print "got " . $bytes . ";" . $buff . " reason " . $reason ."\n"; my ($error, $statusbyte) = $instr->vxi_readstatusbyte(0); |