Commit 948a1f21 authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

Implemented system() changes from fiji_todo.txt, updated Makefile, clarified warnings

from resource calculation
parent 07bb94a7
......@@ -36,7 +36,12 @@ use Log::Log4perl qw(:easy);
use if $^O eq "MSWin32", "Win32::TieRegistry";
use constant FIJI_DIR => realpath(File::Spec->rel2abs("..", $FindBin::Bin));
use constant FIJI_DOCUMENTATION_PATH =>
realpath(File::Spec->rel2abs(File::Spec->catfile("..",
"docs",
"userguide",
"fiji_user_guide.pdf"),
$FindBin::Bin));
my @optimization_settings = qw(ALLOW OPTIMIZATION_OFF FIX_PLACEMENT);
use constant OPTIMIZATION_SETTINGS => \@optimization_settings;
......@@ -1034,7 +1039,7 @@ sub ini2constkey {
use base 'Exporter';
our @EXPORT = (keys(%designmap), keys(%fiumap), keys(%testpatmap), keys(%testconstmap), keys(%fiuenum), keys(%displaygroups), keys(%testguimodes));
our @EXPORT_OK = ('FIJI_DIR', keys(%designmap), 'DESIGNMAP', keys(%fiumap), 'FIUMAP', keys(%testpatmap), 'TESTPATMAP', keys(%testconstmap), 'TESTCONSTMAP', keys(%fiuenum), 'FIUENUM', 'REVERSE_FIU_ENUM', 'DISPLAYGROUPS', keys(%displaygroups), 'TESTGUIMODES', keys(%testguimodes), 'HOST_TO_FIJI_LATENCY', 'DEFAULT_TIMER_VALUE', 'OPTIMIZATIONS');
our @EXPORT_OK = ('FIJI_DOCUMENTATION_PATH', 'FIJI_DIR', keys(%designmap), 'DESIGNMAP', keys(%fiumap), 'FIUMAP', keys(%testpatmap), 'TESTPATMAP', keys(%testconstmap), 'TESTCONSTMAP', keys(%fiuenum), 'FIUENUM', 'REVERSE_FIU_ENUM', 'DISPLAYGROUPS', keys(%displaygroups), 'TESTGUIMODES', keys(%testguimodes), 'HOST_TO_FIJI_LATENCY', 'DEFAULT_TIMER_VALUE', 'OPTIMIZATIONS');
## @var @EXPORT_TAGS Export Tags
#
......@@ -1044,7 +1049,7 @@ our @EXPORT_OK = ('FIJI_DIR', keys(%designmap), 'DESIGNMAP', keys(%fiumap), 'FIU
our %EXPORT_TAGS = (
all => \@EXPORT_OK,
default => \@EXPORT,
%EXPORT_TAGS = (fiji_dir => ['FIJI_DIR'])
%EXPORT_TAGS = (fiji_dir => ['FIJI_DIR'], fiji_documentation_path => ['FIJI_DOCUMENTATION_PATH'])
# log => [ grep /^LOG_/, @EXPORT_OK ], # all constants beginning with "LOG_"
);
......
......@@ -685,12 +685,12 @@ sub _est_resources {
my $registers;
my $lut6;
$logger->debug("FREQUENCY $FREQUENCY out of range (1000000 - 500000000)") if ($FREQUENCY < 1000000 || $FREQUENCY > 500000000);
$logger->debug("BAUD $BAUD out of range (9600 - 3000000)") if ($BAUD < 9600 || $BAUD > 3000000);
$logger->debug("TIMER_WIDTH $TIMER_WIDTH out of range (1 - 8)") if ($TIMER_WIDTH < 1 || $TIMER_WIDTH > 8);
$logger->debug("RESET_CYCLES $RESET_CYCLES out of range (1 - 16)") if ($RESET_CYCLES < 1 || $RESET_CYCLES > 16);
$logger->debug("LFSR_WIDTH $LFSR_WIDTH out of range (16 - 64)") if ($LFSR_WIDTH < 16 || $LFSR_WIDTH > 64);
$logger->debug("FIU_NUM $FIU_NUM out of range (1 - 64)") if ($FIU_NUM < 1 || $FIU_NUM > 64);
$logger->debug("FREQUENCY $FREQUENCY out of range for correct resource estimation (1000000 - 500000000)") if ($FREQUENCY < 1000000 || $FREQUENCY > 500000000);
$logger->debug("BAUD $BAUD out of range for correct resource estimation (9600 - 3000000)") if ($BAUD < 9600 || $BAUD > 3000000);
$logger->debug("TIMER_WIDTH $TIMER_WIDTH out of range for correct resource estimation (1 - 8)") if ($TIMER_WIDTH < 1 || $TIMER_WIDTH > 8);
$logger->debug("RESET_CYCLES $RESET_CYCLES out of range for correct resource estimation (1 - 16)") if ($RESET_CYCLES < 1 || $RESET_CYCLES > 16);
$logger->debug("LFSR_WIDTH $LFSR_WIDTH out of range for correct resource estimation (16 - 64)") if ($LFSR_WIDTH < 16 || $LFSR_WIDTH > 64);
$logger->debug("FIU_NUM $FIU_NUM out of range for correct resource estimation (1 - 64)") if ($FIU_NUM < 1 || $FIU_NUM > 64);
$registers = 8769408455.04;
$registers += (3.16525787254e-08)*($FREQUENCY) + (-8063276676.79)*(2**(-1.60957863771e-17 * $FREQUENCY));
......
......@@ -30,6 +30,7 @@ use utf8;
use Log::Log4perl qw(get_logger);
use Scalar::Util 'blessed';
use FIJI::Utils;
use Tk;
use Tk::widgets qw(LabFrame Balloon Label Entry Pane Button Dialog DialogBox Checkbutton CompleteEntry NoteBook StatusBar FIJISettingsCanvas);
use Tk::DynaMouseWheelBind;
......@@ -79,7 +80,6 @@ sub Populate {
my $settings = delete $args->{'-settings'};
$self->{'change_indicator_ref'} = delete $args->{'-change_indicator_ref'};
$self->{'change_indicator_values'} = delete $args->{'-change_indicator_values'};
$self->{'documentation_path'} = delete $args->{'-documentation_path'};
my $icon_path = delete $args->{'-icon_path'};
if (!defined($settings) || !blessed($settings) || !$settings->isa("FIJI::Settings")) {
......@@ -416,21 +416,28 @@ sub _populate_widget {
$bb->pack(-side => "right");
# Button to open the documentation
if (defined $self->{'documentation_path'}) {
if (defined FIJI_DOCUMENTATION_PATH) {
$bf->Button(
-text => "Open Documentation",
-command => sub {
my $ret;
if ($^O eq "MSWin32") {
system(1, "start " . $self->{'documentation_path'});
$ret = FIJI::Utils::system(1, "start " . FIJI_DOCUMENTATION_PATH);
} elsif ($^O eq "linux") {
system("xdg-open " . $self->{'documentation_path'});
$ret = FIJI::Utils::system("xdg-open " . FIJI_DOCUMENTATION_PATH);
} else {
my $d = $self->DialogBox(-title=>"Open Documentation",-buttons => ["OK"]);
$d->add('Label',-text=>"No default PDF viewer for OS \"" . $^O . "\"...",-justify=>'left')->pack(-side=>'right');
$d->add('Label',-image=>$error_image)->pack(-side=>'left');
$d->Show();
my $d = $self->DialogBox(-title=>"Open Documentation",-buttons => ["OK"]);
$d->add('Label',-text=>"No default PDF viewer for OS \"" . $^O . "\"...",-justify=>'left')->pack(-side=>'right');
$d->add('Label',-image=>$error_image)->pack(-side=>'left');
$d->Show();
return;
}
if (defined($ret)) {
my $d = $self->DialogBox(-title=>"Open Documentation failed",-buttons => ["OK"]);
$d->add('Label',-text=>"$ret",-justify=>'left')->pack(-side=>'right');
$d->add('Label',-image=>$error_image)->pack(-side=>'left');
$d->Show();
}
}
)->pack(-side => "right");
}
......
......@@ -36,6 +36,7 @@ use Tk::widgets qw(LabFrame Label Entry Button DialogBox FBox Checkbutton);
use Tk::PNG;
use Clone qw(clone);
use File::Spec;
use FIJI::Utils;
use threads;
use threads::shared;
use Thread::Queue;
......@@ -50,7 +51,7 @@ use IO::Handle;
use constant USE_MENU => undef;
use FIJI qw(:default :fiji_dir);
use FIJI qw(:default :fiji_dir :fiji_documentation_path);
use FIJI::Tests;
use FIJI::Downloader;
use Tk::FIJITestsViewer;
......@@ -467,17 +468,24 @@ sub _ctrl_frame {
sub _show_documentation {
my $self = shift;
my $mw = $self->{'mw'};
my $ret;
if ($^O eq "MSWin32") {
system(1, "start " . $self->{'documentation_path'});
$ret = FIJI::Utils::system(1, "start " . FIJI_DOCUMENTATION_PATH);
} elsif ($^O eq "linux") {
system("xdg-open " . $self->{'documentation_path'});
$ret = FIJI::Utils::system("xdg-open " . FIJI_DOCUMENTATION_PATH);
} else {
my $d = $mw->DialogBox(-title=>"Open Documentation",-buttons => ["OK"]);
my $d = $mw->DialogBox(-title=>"Open Documentation failed",-buttons => ["OK"]);
$d->add('Label',-text=>"No default PDF viewer for OS \"" . $^O . "\"...",-justify=>'left')->pack(-side=>'right');
$d->add('Label',-image=>$error_image)->pack(-side=>'left');
$d->Show();
return
}
if (defined($ret)) {
my $d = $mw->DialogBox(-title=>"Open Documentation failed",-buttons => ["OK"]);
$d->add('Label',-text=>"$ret",-justify=>'left')->pack(-side=>'right');
$d->add('Label',-image=>$error_image)->pack(-side=>'left');
$d->Show();
}
}
sub _open_tests_file {
......
......@@ -41,7 +41,7 @@ use FIJI::Settings;
use FIJI::Utils;
use Tk::FIJISettingsViewer;
use Tk::FIJIUtils;
use FIJI qw(:fiji_dir);
use FIJI qw(:fiji_dir :fiji_documentation_path);
## @var USE_MENU defines control style of fiji_settings:
......@@ -135,10 +135,8 @@ sub main {
$mw->toplevel()->bind("<F1>" => sub { $self->_show_documentation; });
$mw->toplevel()->bind("<Control-q>" => sub { $self->_onexit($mw); });
$self->{'documentation_path'} = File::Spec->catfile($ugdir, 'fiji_user_guide.pdf');
$self->{'FIJISettingsViewer'} = $mw->FIJISettingsViewer(
-settings => $self->{'settings'},
-documentation_path => $self->{'documentation_path'},
-icon_path => $libdir,
-change_indicator_ref => \$change_indicator,
-change_indicator_values => {'changed' => CHANGED_VALUE, 'unchanged' => UNCHANGED_VALUE}
......@@ -385,9 +383,9 @@ sub _show_documentation {
my $ret;
if ($^O eq "MSWin32") {
$ret = FIJI::Utils::system(1, "start " . $self->{'documentation_path'});
$ret = FIJI::Utils::system(1, "start " . FIJI_DOCUMENTATION_PATH);
} elsif ($^O eq "linux") {
$ret = FIJI::Utils::system("xdg-open " . $self->{'documentation_path'});
$ret = FIJI::Utils::system("xdg-open " . FIJI_DOCUMENTATION_PATH);
} else {
my $d = $mw->DialogBox(-title=>"Open Documentation failed",-buttons => ["OK"]);
$d->add('Label',-text=>"No default PDF viewer for OS \"" . $^O . "\"...",-justify=>'left')->pack(-side=>'right');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment