Merged changes from 3.14 branch

Includes everything up to revno 12352 on 2012-07-31
This commit is contained in:
Andrew Johnson
2012-07-31 14:04:38 -05:00
18 changed files with 168 additions and 148 deletions

View File

@@ -907,43 +907,52 @@ static void dbBreakBody(void)
pgphentry->userPvt = pnewbrkTable;
}
static void dbRecordHead(char *recordType,char *name, int visible)
static void dbRecordHead(char *recordType, char *name, int visible)
{
DBENTRY *pdbentry;
long status;
char *badch;
DBENTRY *pdbentry;
long status;
badch = strpbrk(name, " \"'.$");
if (badch) {
epicsPrintf("Bad character '%c' in record name \"%s\"\n",
*badch, name);
}
pdbentry = dbAllocEntry(pdbbase);
if(ellCount(&tempList))
yyerrorAbort("dbRecordHead: tempList not empty");
if (ellCount(&tempList))
yyerrorAbort("dbRecordHead: tempList not empty");
allocTemp(pdbentry);
status = dbFindRecordType(pdbentry,recordType);
if(status) {
epicsPrintf("Record \"%s\" is of unknown type \"%s\" - ",
status = dbFindRecordType(pdbentry, recordType);
if (status) {
epicsPrintf("Record \"%s\" is of unknown type \"%s\" - ",
name, recordType);
yyerrorAbort(NULL);
return;
yyerrorAbort(NULL);
return;
}
/*Duplicate records ok if the same type */
status = dbCreateRecord(pdbentry,name);
if(status==S_dbLib_recExists) {
if(strcmp(recordType,dbGetRecordTypeName(pdbentry))!=0) {
epicsPrintf("Record %s already defined with different type %s\n",
name, dbGetRecordTypeName(pdbentry));
if (status==S_dbLib_recExists) {
if (strcmp(recordType, dbGetRecordTypeName(pdbentry))!=0) {
epicsPrintf("Record \"%s\" already defined with different type "
"\"%s\"\n", name, dbGetRecordTypeName(pdbentry));
yyerror(NULL);
duplicate = TRUE;
return;
} else if (dbRecordsOnceOnly) {
epicsPrintf("Record \"%s\" already defined (dbRecordsOnceOnly is set)\n",
name);
yyerror(NULL);
duplicate = TRUE;
}
} else if(status) {
epicsPrintf("Can't create record \"%s\" of type \"%s\"\n",
name, recordType);
yyerrorAbort(NULL);
duplicate = TRUE;
return;
}
else if (dbRecordsOnceOnly) {
epicsPrintf("Record \"%s\" already defined (dbRecordsOnceOnly is "
"set)\n", name);
yyerror(NULL);
duplicate = TRUE;
}
}
if(visible) dbVisibleRecord(pdbentry);
else if (status) {
epicsPrintf("Can't create record \"%s\" of type \"%s\"\n",
name, recordType);
yyerrorAbort(NULL);
}
if (visible)
dbVisibleRecord(pdbentry);
}
static void dbRecordField(char *name,char *value)

View File

@@ -25,6 +25,7 @@
#include <stdio.h>
#include <assert.h>
#include <syslog.h>
#include <limits.h>
#include <rtems.h>
#include <rtems/error.h>
@@ -369,16 +370,15 @@ epicsThreadSleep (double seconds)
{
rtems_status_code sc;
rtems_interval delay;
extern double rtemsTicksPerTwoSeconds_double;
if (seconds <= 0.0) {
delay = 0;
extern double rtemsTicksPerSecond_double;
if (seconds > 0.0) {
seconds *= rtemsTicksPerSecond_double;
seconds += 0.99999999; /* 8 9s here is optimal */
delay = (seconds >= INT_MAX) ? INT_MAX : (int) seconds;
}
else {
delay = seconds * rtemsTicksPerTwoSeconds_double;
delay = (delay + 1) / 2;
if (delay == 0)
delay++;
else { /* seconds <= 0 or NAN */
delay = 0;
}
sc = rtems_task_wake_after (delay);
if(sc != RTEMS_SUCCESSFUL)

View File

@@ -781,18 +781,15 @@ epicsShareFunc void epicsShareAPI epicsThreadSleep ( double seconds )
static const unsigned mSecPerSec = 1000;
DWORD milliSecDelay;
if ( seconds <= 0.0 ) {
if ( seconds > 0.0 ) {
seconds *= mSecPerSec;
seconds += 0.99999999; /* 8 9s here is optimal */
milliSecDelay = ( seconds >= INFINITE ) ?
INFINITE - 1 : ( DWORD ) seconds;
}
else { /* seconds <= 0 or NAN */
milliSecDelay = 0u;
}
else if ( seconds >= INFINITE / mSecPerSec ) {
milliSecDelay = INFINITE - 1;
}
else {
milliSecDelay = ( DWORD ) ( ( seconds * mSecPerSec ) + 0.5 );
if ( milliSecDelay == 0 ) {
milliSecDelay = 1;
}
}
Sleep ( milliSecDelay );
}

View File

@@ -675,9 +675,15 @@ epicsShareFunc void epicsShareAPI epicsThreadSleep(double seconds)
struct timespec remainingTime;
double nanoseconds;
delayTime.tv_sec = (time_t)seconds;
nanoseconds = (seconds - (double)delayTime.tv_sec) *1e9;
delayTime.tv_nsec = (long)nanoseconds;
if (seconds > 0) {
delayTime.tv_sec = seconds;
nanoseconds = (seconds - delayTime.tv_sec) *1e9;
delayTime.tv_nsec = nanoseconds;
}
else {
delayTime.tv_sec = 0;
delayTime.tv_nsec = 0;
}
while (nanosleep(&delayTime, &remainingTime) == -1 &&
errno == EINTR)
delayTime = remainingTime;

View File

@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <limits.h>
#include <vxWorks.h>
#include <taskLib.h>
@@ -300,11 +301,13 @@ void epicsThreadSleep(double seconds)
STATUS status;
int ticks;
if(seconds<=0.0) {
if (seconds > 0.0) {
seconds *= sysClkRateGet();
seconds += 0.99999999; /* 8 9s here is optimal */
ticks = (seconds >= INT_MAX) ? INT_MAX : (int) seconds;
}
else { /* seconds <= 0 or NAN */
ticks = 0;
} else {
ticks = seconds*sysClkRateGet() + 0.5;
if(ticks<=0) ticks = 1;
}
status = taskDelay(ticks);
if(status) errlogPrintf("epicsThreadSleep\n");

View File

@@ -21,10 +21,10 @@ $app_top = cwd();
$bad_ident_chars = '[^0-9A-Za-z_]';
&GetUser; # Ensure we know who's in charge
&readReleaseFiles("configure/RELEASE", \%release, \@apps);
&expandRelease(\%release);
&get_commandline_opts; # Check command-line options
&GetUser; # Ensure we know who's in charge
#
# Declare two default callback routines for file copy plus two
@@ -164,7 +164,7 @@ exit 0; # END OF SCRIPT
# Get commandline options and check for validity
#
sub get_commandline_opts { #no args
getopts("a:b:dhilp:T:t:") or Cleanup(1);
getopts("a:b:dhilp:T:t:u:") or Cleanup(1);
# Options help
Cleanup(0) if $opt_h;
@@ -395,7 +395,7 @@ EOF
-d Enable debug messages
-i Specifies that ioc boot directories will be generated
-l List valid application types for this installation
If this is specified the other options are not used
If this is specified the other options are not used
-p app Set the application name for use with -i
If not specified, you will be prompted
-T top Set the template top directory (where the application templates are)
@@ -405,6 +405,7 @@ EOF
-t type Set the application type (-l for a list of valid types)
If not specified, type is taken from environment
If not found in environment, \"default\" is used
-u user Set username; overrides OS defaults
Environment:
EPICS_MBA_DEF_APP_TYPE Application type you want to use as default
@@ -419,10 +420,7 @@ EOF
}
sub GetUser {
# add to this list if new possibilities arise,
# currently it's UNIX and WIN32:
$user = $ENV{USER} || $ENV{USERNAME} || Win32::LoginName();
$user =~ s/\s+//g; # Bl**dy Windows stupidity...
$user = $opt_u || $ENV{USER} || $ENV{USERNAME} || Win32::LoginName();
unless ($user) {
print "Strange, I cannot figure out your user name!\n";
@@ -430,5 +428,6 @@ sub GetUser {
$user = <STDIN>;
chomp $user;
}
$user =~ tr/-a-zA-Z0-9_:;[]<>//cd; # Sanitize; these are the legal chars
die "No user name" unless $user;
}

View File

@@ -1,24 +0,0 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # makeDbDepends.pl
# Called from within RULES.Db in the Db directories.
# Searches .substitutions and .template files (from the command line) for
# file ["']xxx["'] {
# and
# include "xxx"
# entries to include in the DEPENDS file
use strict;
my $target = shift @ARGV;
my %depends;
while (my $line = <>) {
$depends{$2}++ if $line =~ m/^ \s* file \s* (["']?) (\S*) \1 /x;
$depends{$1}++ if $line =~ m/^ \s* include \s* "(.*)" /x;
}
if (%depends) {
my @depends = keys %depends;
print "$target: @depends\n";
}

View File

@@ -25,39 +25,39 @@
#
#-----------------------------------------------------------------------
use Getopt::Std;
use strict;
use FindBin;
use lib "$FindBin::Bin/../../lib/perl";
use EPICS::Getopts;
my $version = 'mkmf.pl,v 1.5 2002/03/25 21:33:24 jba Exp $ ';
my $endline = $/;
my %output;
my @includes;
use vars qw( $opt_d $opt_m );
getopts( 'dm:' ) || die "\aSyntax: $0 [-d] [-m dependsFile] includeDirs objFile srcFile\n";
our ( $opt_d, $opt_m, @opt_I);
getopts( 'dm:I@' ) || die "\aSyntax: $0 [-d] [-m dependsFile] [-I incdir [-I incdir]...] objFile srcFile [srcfile]... \n";
my $debug = $opt_d;
my $depFile = $opt_m;
print "$0 $version\n" if $debug;
# directory list
my @dirs;
my $i;
foreach $i (0 .. $#ARGV-2) {
push @dirs, $ARGV[$i];
}
my $objFile = $ARGV[$#ARGV-1];
my $srcFile = $ARGV[$#ARGV];
my @incdirs = @opt_I;
my $objFile = shift or die "No target file argument";
my @srcFiles=@ARGV;
if( $debug ) {
print "DEBUG: dirs= @dirs\n";
print "DEBUG: source= $srcFile\n";
print "DEBUG: object= $objFile\n";
print "$0 $version\n";
print "DEBUG: incdirs= @incdirs\n";
print "DEBUG: objFile= $objFile\n";
print "DEBUG: srcFiles= @srcFiles\n";
}
print "Generating dependencies for $objFile\n" if $debug;
scanFile($srcFile);
scanIncludesList();
foreach my $srcFile (@srcFiles) {
scanFile($srcFile);
scanIncludesList();
}
$depFile = 'depends' unless $depFile;
@@ -118,7 +118,7 @@ sub scanIncludesList {
}
#-----------------------------------------
# find filename on #include line
# find filename on #include and file lines
sub findNextIncName {
my $line = shift;
my $is_subst = shift;
@@ -130,6 +130,7 @@ sub findNextIncName {
if ($is_subst) {
return 0 if not $line =~ /^\s*file\s*([^\s{]*)/;
$incname = $1;
$incname = substr $incname, 1, length($incname)-2 if $incname =~ /^".+?"$/;
} else {
return 0 if not $line =~ /^#?\s*include\s*('.*?'|<.*?>|".*?")/;
$incname = substr $1, 1, length($1)-2;
@@ -139,7 +140,7 @@ sub findNextIncName {
return $incname if -f $incname;
return 0 if ( $incname =~ /^\// || $incname =~ /^\\/ );
foreach $dir ( @dirs ) {
foreach $dir ( @incdirs ) {
chomp($dir);
$incfile = "$dir/$incname";
print "DEBUG: checking for $incname in $dir\n" if $debug;