.
--- a/antsutils.pl
+++ b/antsutils.pl
@@ -2,9 +2,9 @@
#======================================================================
# A N T S U T I L S . P L
# doc: Fri Jun 19 23:25:50 1998
-# dlm: Mon Feb 13 20:13:01 2012
+# dlm: Thu May 31 09:13:03 2012
# (c) 1998 A.M. Thurnherr
-# uE-Info: 94 77 NIL 0 0 70 2 2 4 NIL ofnI
+# uE-Info: 157 9 NIL 0 0 70 10 2 4 NIL ofnI
#======================================================================
# Miscellaneous auxillary functions
@@ -92,6 +92,8 @@
# Nov 11, 2011: - added exact flag to fnrNoErr()
# Feb 13, 2012: - BUG: failure to specify exact flag resulted in ignoring antsFnrExactMatch
# - BUG: fnrNoErr disregarded exact flag for external layouts
+# May 16, 2012: - adapted to V5.0
+# May 31, 2012: - changed ismember() semantics for use in psSamp
# fnr notes:
# - matches field names starting with the string given, i.e. "sig" is
@@ -137,12 +139,22 @@
sub equal($$)
{ return (@_ >= 2) && (abs($_[0]-$_[1]) < $PRACTICALLY_ZERO); }
+#----------------------------------------------------------------------
# check whether given val is member of a set
+# - set can either be an array or a comma-separated string
+#----------------------------------------------------------------------
+
sub ismember($@)
{
my($val,@set) = @_;
+ @set = split(',',$set[0])
+ if (@set == 1 && !numberp($set[0]));
for (my($i)=0; $i<@set; $i++) {
- return 1 if ($val == $set[$i]);
+ if (numberp($val) && numberp($set[$i])) {
+ return 1 if ($val == $set[$i]);
+ } else {
+ return 1 if ($val eq $set[$i]);
+ }
}
return undef;
}
@@ -419,7 +431,8 @@
require "$pref.$name";
return $name;
} else {
- require "$ANTS/$pref.$name";
+ my($path) = ($0 =~ m{^(.*)/[^/]*$});
+ require "$path/$pref.$name";
return $name;
}
}
@@ -441,7 +454,8 @@
require "$pref.$name";
return ($name,split(',',$args));
} else {
- require "$ANTS/$pref.$name";
+ my($path) = ($0 =~ m{^(.*)/[^/]*$});
+ require "$path/$pref.$name";
return ($name,split(',',$args));
}
}
--- a/libconv.pl
+++ b/libconv.pl
@@ -1,9 +1,9 @@
#======================================================================
# L I B C O N V . P L
# doc: Sat Dec 4 13:03:49 1999
-# dlm: Tue Apr 17 10:34:41 2012
+# dlm: Tue May 22 11:34:01 2012
# (c) 1999 A.M. Thurnherr
-# uE-Info: 61 76 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 63 84 NIL 0 0 70 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -59,6 +59,8 @@
# Jul 19, 2011: - made epoch aptional in mmddyy2dec_time()
# Aug 2, 2011: - enhanced yymmdd2dec_time()
# Apr 17, 2012: - added space as another date separator in ddmmyy2dec_time
+# May 22, 2012: - BUG: illegal time spec error was also produced on missing seconds
+# - BUG: mmddyy2dec_time() did not allow for optional epoch argument
require "$ANTS/libEOS83.pl"; # &sigma()
require "$ANTS/libPOSIX.pl"; # &floor()
@@ -216,9 +218,9 @@
}
croak("$0: &frac_day_long(): illegal time spec $h:$m:$s\n")
- unless (defined($h) && $h>=0 && $h<24 &&
- defined($m) && $m>=0 && $m<60 &&
- defined($s) && $s>=0 && $s<60);
+ unless ((defined($h) && $h>=0 && $h<24) &&
+ (defined($m) && $m>=0 && $m<60) &&
+ (!defined($s) || ($s>=0 && $s<60)));
return $h/24 + $m/24/60 + $s/24/3600;
}
@@ -227,9 +229,9 @@
my($h,$m,$s) = &antsFunUsage(3,'ccf',"<hour> <min> <sec>",@_);
croak("$0: &frac_day_long(): illegal time spec $h:$m:$s\n")
- unless (defined($h) && $h>=0 && $h<24 &&
- defined($m) && $m>=0 && $m<60 &&
- defined($s) && $s>=0 && $s<60);
+ unless ((defined($h) && $h>=0 && $h<24) &&
+ (defined($m) && $m>=0 && $m<60) &&
+ (!defined($s) || ($s>=0 && $s<60)));
return $h*3600 + $m*60 + $s;
}
@@ -260,7 +262,7 @@
sub mmddyy2dec_time(@) # decimal time
{
my($ds,$ts,$epoch) =
- &antsFunUsage(2,"..","date-string (empty ok), time-string[, epoch]",@_);
+ &antsFunUsage(-2,"..","date-string (empty ok), time-string[, epoch]",@_);
my($time) = 0;
if ($ds ne "") { # date
@@ -273,10 +275,10 @@
}
my($h,$m,$s) = split(':',$ts); # time
- croak("$0: &dec_time(): illegal time spec $ts\n")
- unless (defined($h) && $h>=0 && $h<24 &&
- defined($m) && $m>=0 && $m<60 &&
- defined($s) && $s>=0 && $s<60);
+ croak("$0: &mmddyy2dec_time(): illegal time spec $ts\n")
+ unless ((defined($h) && $h>=0 && $h<24) &&
+ (defined($m) && $m>=0 && $m<60) &&
+ (!defined($s) || ($s>=0 && $s<60)));
$time += $h/24 + $m/24/60 + $s/24/3600;
return $time;
@@ -295,9 +297,9 @@
my($h,$m,$s) = split(':',$ts);
croak("$0: &dec_time(): illegal time spec $ts\n")
- unless (defined($h) && $h>=0 && $h<24 &&
- defined($m) && $m>=0 && $m<60 &&
- defined($s) && $s>=0 && $s<60);
+ unless ((defined($h) && $h>=0 && $h<24) &&
+ (defined($m) && $m>=0 && $m<60) &&
+ (!defined($s) || ($s>=0 && $s<60)));
$time += $h/24 + $m/24/60 + $s/24/3600;
return $time;
@@ -324,9 +326,9 @@
if ($ts ne '') {
my($h,$m,$s) = split(':',$ts);
croak("$0: &dec_time(): illegal time spec $ts\n")
- unless (defined($h) && $h>=0 && $h<24 &&
- defined($m) && $m>=0 && $m<60 &&
- defined($s) && $s>=0 && $s<60);
+ unless ((defined($h) && $h>=0 && $h<24) &&
+ (defined($m) && $m>=0 && $m<60) &&
+ (!defined($s) || ($s>=0 && $s<60)));
$time += $h/24 + $m/24/60 + $s/24/3600;
}