From 3d93dca40deb1c8484a865a85a548b8417b4559f Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 24 Jan 2013 00:24:08 +0900 Subject: named parameters for read() --- libvxi11client/perlbits/Client.pm | 11 +++++++++++ libvxi11client/perlbits/Client.xs | 2 +- libvxi11client/perlbits/VXI11-Client.t | 2 +- 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); -- cgit