"Fossies" - the Fresh Open Source Software Archive

Member "PerlCDF38_0/tall2.pl" (13 Apr 2020, 1963 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 "tall2.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 my $id;
   12 my $status;
   13 $status = CDF::CDFlib (&OPEN_, &CDF_, $ARGV[0], \$id,
   14                &NULL_);
   15 QuitCDF ("4.0", $status) if ($status < &CDF_OK) ;
   16 
   17 my $md5;
   18 $status = CDF::CDFgetChecksum ($id, \$md5);
   19 
   20 print "status=$status checksum = $md5\n";
   21 my %meta;
   22 
   23 print "global 1....\n";
   24 ($status, %meta) = CDF::CDFgetGlobalMetaData($id);
   25 
   26 if ($status == &CDF_OK && %meta ) {
   27   print Dumper(\%meta);
   28 } else {
   29   if ($status != 0) {
   30     QuitCDF ("8.1", $status);
   31   }
   32 }
   33 print "global 2....\n";
   34 ($status, %meta) = CDF::CDFgetGlobalMetaData($ARGV[0]);
   35 
   36 if ($status == &CDF_OK && %meta ) {
   37   print Dumper(\%meta);
   38 } else {
   39   if ($status != 0) {
   40     QuitCDF ("8.1", $status);
   41   }
   42 }
   43 
   44 if ($#ARGV == 1) {
   45 print "variable .....\n";
   46 
   47 ($status, %meta) = CDF::CDFgetVarMetaData($id, $ARGV[1]);
   48 
   49 if ($status == &CDF_OK && %meta) {
   50   print Dumper(\%meta);
   51 } else {
   52   if ($status != 0) {
   53     QuitCDF ("8.2", $status);
   54   }
   55 }
   56 }
   57 if ($#ARGV == 2) {
   58 print "variable with encoding....\n";
   59 ($status, %meta) = CDF::CDFgetVarMetaData($id, $ARGV[1], $ARGV[2]);
   60 
   61 if ($status == &CDF_OK && %meta) {
   62   print Dumper(\%meta);
   63 } else {
   64   if ($status != 0) {
   65     QuitCDF ("8.2", $status);
   66   }
   67 }
   68 }
   69 $status = CDF::CDFlib (&CLOSE_, &CDF_,
   70                &NULL_);
   71 QuitCDF ("28.2", $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