OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [perl_gui/] [lib/] [perl/] [temp.pl] - Diff between revs 48 and 54

Show entire file | Details | Blame | View Log

Rev 48 Rev 54
Line 1... Line 1...
#!/usr/bin/perl -w
#!/usr/bin/perl -w
 
 
# a perl getopts example
 
# alvin alexander, http://www.devdaily.com
 
 
 
use strict;
use strict;
use Getopt::Std;
use warnings;
 
use IO::CaptureOutput qw(capture qxx qxy);
 
use Gtk3;
 
 
 
 
 
 
# declare the perl command line flags/options we want to allow
my ($screen_x,$screen_y);
my %options=();
 
getopts("hj:ln:s:", \%options);
sub get_default_screen_size{
 
        return  ($screen_x,$screen_y) if (defined $screen_x && defined $screen_y);
# test for the existence of the options on the command line.
        my $fh= 'xrandr --current | awk \'$2~/\*/{print $1}\'' ;
# in a normal program you'd do more than just print these.
        my ($stdout, $stderr, $success) = qxx( ($fh) );
print "-h $options{h}\n" if defined $options{h};
        my @a = split ("\n",$stdout);
print "-j $options{j}\n" if defined $options{j};
        my ($screen_x,$screen_y) = split ("x",$a[0]);
print "-l $options{l}\n" if defined $options{l};
        $screen_x = 600 if(!defined $screen_x);
print "-n $options{n}\n" if defined $options{n};
        $screen_y = 800 if(!defined $screen_y);
print "-s $options{s}\n" if defined $options{s};
        return  ($screen_x,$screen_y);
 
 
# other things found on the command line
 
print "Other things found on the command line:\n" if $ARGV[0];
 
foreach (@ARGV)
 
{
 
  print "$_\n";
 
}
}
 
 
 No newline at end of file
 No newline at end of file
 
 
 
 
 
my ($x,$y)  =get_default_screen_size();
 
print "$x,$y\n";
 
 
 
 
 
 
 
sub get_screen_size{
 
    my $screen = Gtk3::Gdk::Screen::get_default;
 
        my $hight = $screen->get_height();
 
        my $width = $screen->get_width();
 
        return ($width,$hight);
 
}
 
 
 
($x,$y)  =get_screen_size();
 
print "$x,$y\n";
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.