From b1ece5d8d22c15988c97f02edda07bfaafb398e5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 11 Mar 2014 17:46:14 -0500 Subject: [PATCH] cap5: Added CA->version function Documented. --- documentation/RELEASE_NOTES.html | 5 +++++ src/cap5/CA.pm | 7 ++++++- src/cap5/Cap5.xs | 11 +++++++++++ src/cap5/caget.pl | 7 ++++--- src/cap5/cainfo.pl | 5 +++-- src/cap5/camonitor.pl | 7 ++++--- src/cap5/capr.pl | 33 ++++++++++++++++---------------- src/cap5/caput.pl | 7 ++++--- 8 files changed, 53 insertions(+), 29 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index c16a3fd91..f5fe169db 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,11 @@ +

Added CA->version function to CA Perl Bindings

+ +

This new function returns the version string from Base. The ca*.pl tools have +been updated to display this in their help output.

+

epicsString.h comparison functions fixed

The case-independent string comparison functions epicsStrCaseCmp() and diff --git a/src/cap5/CA.pm b/src/cap5/CA.pm index ac6542e01..31f09f9fb 100644 --- a/src/cap5/CA.pm +++ b/src/cap5/CA.pm @@ -4,7 +4,7 @@ use strict; use warnings; -my $version = '0.4'; +my $version = '0.5'; package CA; @@ -507,6 +507,11 @@ class method syntax, e.g. C<< CA->pend_io(10) >>. =over 4 +=item version + +Returns the EPICS_VERSION_STRING from the version of EPICS Base this software +was built using. + =item flush_io Flush outstanding IO requests to the server. This routine is useful for users diff --git a/src/cap5/Cap5.xs b/src/cap5/Cap5.xs index c3e4d0e50..785041229 100644 --- a/src/cap5/Cap5.xs +++ b/src/cap5/Cap5.xs @@ -10,6 +10,7 @@ #include "cadef.h" #include "db_access.h" +#include "epicsVersion.h" #include "alarm.h" #include "alarmString.h" @@ -1010,6 +1011,12 @@ void CA_flush_io(const char *class) { } +/* CA::version($class) */ + +const char * CA_version(const char *class) { + return EPICS_VERSION_STRING; +} + /* CA::add_exception_event($class, \&sub) */ static @@ -1385,6 +1392,10 @@ void CA_flush_io (class) const char * class +const char * +CA_version (class) + const char * class + void CA_add_exception_event (class, sub) const char * class diff --git a/src/cap5/caget.pl b/src/cap5/caget.pl index df8cb6d25..a3fcbfe85 100644 --- a/src/cap5/caget.pl +++ b/src/cap5/caget.pl @@ -148,11 +148,11 @@ sub display { } sub HELP_MESSAGE { - print STDERR "\nUsage: caget [options] ...\n", + print STDERR "\nUsage: caget.pl [options] ...\n", "\n", " -h: Help: Print this message\n", "Channel Access options:\n", - " -w : Wait time, specifies longer CA timeout, default is $opt_w second\n", + " -w : Wait time, specifies CA timeout, default is $opt_w second\n", "Format options:\n", " -t: Terse mode - print only value, without name\n", " -a: Wide mode \"name timestamp value stat sevr\" (read PVs as DBR_TIME_xxx)\n", @@ -182,6 +182,7 @@ sub HELP_MESSAGE { " -0b: Print as binary number\n", "Set output field separator:\n", " -F : Use to separate fields on output\n", - "\n"; + "\n", + "Base version: ", CA->version, "\n"; exit 1; } diff --git a/src/cap5/cainfo.pl b/src/cap5/cainfo.pl index 2196655b1..2c08bcfe6 100644 --- a/src/cap5/cainfo.pl +++ b/src/cap5/cainfo.pl @@ -52,13 +52,14 @@ sub display { } sub HELP_MESSAGE { - print STDERR "\nUsage: cainfo [options] ...\n", + print STDERR "\nUsage: cainfo.pl [options] ...\n", "\n", " -h: Help: Print this message\n", "Channel Access options:\n", " -w : Wait time, specifies CA timeout, default is $opt_w second\n", "\n", "Example: cainfo my_channel another_channel\n", - "\n"; + "\n", + "Base version: ", CA->version, "\n"; exit 1; } diff --git a/src/cap5/camonitor.pl b/src/cap5/camonitor.pl index 4d19272b2..2a933abbe 100644 --- a/src/cap5/camonitor.pl +++ b/src/cap5/camonitor.pl @@ -109,11 +109,11 @@ sub display { } sub HELP_MESSAGE { - print STDERR "\nUsage: camonitor [options] ...\n", + print STDERR "\nUsage: camonitor.pl [options] ...\n", "\n", " -h: Help: Print this message\n", "Channel Access options:\n", - " -w : Wait time, specifies longer CA timeout, default is $opt_w second\n", + " -w : Wait time, specifies CA timeout, default is $opt_w second\n", " -m : Specify CA event mask to use, with being any combination of\n", " 'v' (value), 'a' (alarm), 'l' (log/archive), 'p' (property)", " Default: '$opt_m'\n", @@ -144,6 +144,7 @@ sub HELP_MESSAGE { "\n", "Example: camonitor -f8 my_channel another_channel\n", " (doubles are printed as %f with 8 decimal digits)\n", - "\n"; + "\n", + "Base version: ", CA->version, "\n"; exit 1; } diff --git a/src/cap5/capr.pl b/src/cap5/capr.pl index 04f1caa97..cf0c4d397 100644 --- a/src/cap5/capr.pl +++ b/src/cap5/capr.pl @@ -401,23 +401,22 @@ sub printRecordList { sub HELP_MESSAGE { print STDERR "\n", "Usage: capr.pl -h\n", - " capr.pl [-d file.dbd] [-w seconds] -r\n", - " capr.pl [-d file.dbd] [-w seconds] -f record_type\n", - " capr.pl [-d file.dbd] [-w seconds] record_name [interest]\n", - "Description:\n", - " Attempts to perform a \"dbpr\" record print via channel access for \n", - " record_name at an interest level which defaults to level 0.\n\n", - " The -r or -f options cause it to print record type or field lists.\n", + " capr.pl [options] -r\n", + " capr.pl [options] -f \n", + " capr.pl [options] []\n", "\n", - "Options:\n", - " -h Prints this help message.\n", - " -r Lists all record types in the dbd file.\n", - " -f record_type: Lists all fields plus their interest level, data type\n", - " and number base for the given record_type.\n", - " -d file.dbd: The dbd file containing record type definitions.\n", - " This can be set using the EPICS_CAPR_DBD_FILE environment variable.\n", - " Currently ", AbsPath($opt_d), "\n", - " -w seconds: CA connection timeout, currently $opt_w\n", - "\n"; + " -h Print this help message.\n", + "Channel Access options:\n", + " -w : Wait time, specifies CA timeout, default is $opt_w second\n", + "Database Definitions:\n", + " -d : The file containing record type definitions.\n", + " This can be set using the EPICS_CAPR_DBD_FILE environment variable.\n", + " Default: ", AbsPath($opt_d), "\n", + "Output Options:\n", + " -r Lists all record types in the selected dbd file.\n", + " -f : Lists all fields with their interest level, data type\n", + " and number base for the given record_type.\n", + "\n", + "Base version: ", CA->version, "\n"; exit 1; } diff --git a/src/cap5/caput.pl b/src/cap5/caput.pl index 8d2e6b4b3..69cd4b638 100644 --- a/src/cap5/caput.pl +++ b/src/cap5/caput.pl @@ -151,11 +151,11 @@ sub display { } sub HELP_MESSAGE { - print STDERR "\nUsage: caput [options] ...\n", + print STDERR "\nUsage: caput.pl [options] ...\n", "\n", " -h: Help: Print this message\n", "Channel Access options:\n", - " -w : Wait time, specifies longer CA timeout, default is $opt_w second\n", + " -w : Wait time, specifies CA timeout, default is $opt_w second\n", " -c: Use put_callback to wait for completion\n", "Format options:\n", " -t: Terse mode - print only sucessfully written value, without name\n", @@ -180,7 +180,8 @@ sub HELP_MESSAGE { "Examples:\n", " caput my_channel 1.2\n", " caput my_waveform 1.2 2.4 3.6 4.8 6.0\n", - "\n"; + "\n", + "Base version: ", CA->version, "\n"; exit 1; }