"Fossies" - the Fresh Open Source Software Archive

Member "PerlCDF38_0/tall.pl" (13 Apr 2020, 2102 Bytes) of package /linux/misc/PerlCDF38_0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "tall.pl" see the Fossies "Dox" file reference documentation.

    1 #!/usr/bin/perl -w
    2 
    3 use strict;
    4 use Math::BigInt;
    5 use Data::Dumper;
    6 
    7 BEGIN { unshift @INC,'/home/liu/PerlCDF38_0/blib/arch',
    8                      '/home/liu/PerlCDF38_0/blib/lib'; }
    9 use CDF;
   10 
   11 print "last index # of input: $#ARGV\n";
   12 
   13 my $id;
   14 my $status;
   15 my %info;
   16 my @values;
   17 $status = CDF::CDFlib (&OPEN_, &CDF_, $ARGV[0], \$id,
   18                &NULL_);
   19 QuitCDF ("4.0", $status) if ($status < &CDF_OK);
   20 
   21 #print "get varinfo 1...\n";
   22 #($status, %info) = CDF::CDFgetVarInfo($ARGV[0], $ARGV[1]);
   23 
   24 #if ($status == &CDF_OK) {
   25 #  print Dumper(\%info);
   26 #} else {
   27 #  QuitCDF ("28.0", $status);
   28 #}
   29 print "get varinfo 2...\n";
   30 ($status, %info) = CDF::CDFgetVarInfo($id, $ARGV[1]);
   31 
   32 if ($status == &CDF_OK) {
   33   print Dumper(\%info);
   34 } else {
   35   QuitCDF ("28.1", $status);
   36 }
   37 
   38 print "Trying vector 1...\n";
   39 ($status, @values) = CDF::CDFgetVarAllData($id, $ARGV[1]);
   40 
   41 if ($status >= &CDF_OK) {
   42   print Dumper(\@values);
   43 } else {
   44   QuitCDF ("28.2", $status);
   45 }
   46 print "Trying vector 2...\n";
   47 #($status, @values) = CDF::CDFgetVarAllData($ARGV[0], $ARGV[1]);
   48 
   49 #if ($status >= &CDF_OK) {
   50 #  print Dumper(\@values);
   51 #} else {
   52 #  QuitCDF ("28.3", $status);
   53 #}
   54 #
   55 if ($#ARGV == 2) {
   56 print "\nTrying dataEncoding...\n";
   57 my @values2 = ();
   58 ($status, @values2) = CDF::CDFgetVarAllData($id, $ARGV[1], $ARGV[2]);
   59 print Dumper(\@values2);
   60 }
   61 
   62 if ($#ARGV == 3) {
   63 print "\nTrying matrix...\n";
   64 my @values2 = ();
   65 ($status, @values2) = CDF::CDFgetVarAllData($id, $ARGV[1], $ARGV[2], $ARGV[3]);
   66 print Dumper(\@values2);
   67 }
   68 
   69 $status = CDF::CDFlib (&CLOSE_, &CDF_,
   70                &NULL_);
   71 QuitCDF ("28.4", $status) if ($status < &CDF_OK) ;
   72 
   73 exit;
   74 
   75 #############################################################################
   76 # QuitCDF.
   77 #############################################################################
   78 sub QuitCDF {
   79     my ($where, $status)=@_;
   80 
   81   print "Aborting at $where ...\n";
   82   if ($status < &CDF_OK) {
   83     my $text;
   84     CDF::CDFlib (&SELECT_, &CDF_STATUS_, $status,
   85            &GET_, &STATUS_TEXT_, \$text,
   86            &NULL_);
   87     print $text;
   88   }
   89   CDF::CDFlib (&CLOSE_, &CDF_,
   90       &NULL_);
   91   print "...test aborted.\n";
   92   exit;
   93     
   94 }#endsub QuitCDF
   95