1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#! /bin/sh
#!perl -w # --*- Perl -*--
eval 'exec perl -x $0 ${1+"$@"}'
if 0;
#------------------------------------------------------------------------------
#$Author: andrius $
#$Date: 2017-05-30 14:51:03 +0300 (An, 30 geg. 2017) $
#$Revision: 5376 $
#$URL: svn://www.crystallography.net/cod-tools/tags/v2.3/scripts/cif_parse $
#------------------------------------------------------------------------------
#*
#* Parse a CIF file.
#*
#* USAGE:
#* $0 --options input1.cif input*.cif
#**
use strict;
use warnings;
use COD::CIF::Parser qw( parse_cif );
use COD::SOptions qw( getOptions );
use COD::SUsage qw( usage options );
use COD::ShowStruct qw( showRef );
use COD::ToolsVersion;
my $use_parser = 'c';
my $fix_errors = 0;
#* OPTIONS:
#* --use-perl-parser
#* Use development CIF parser written in Perl.
#* --use-c-parser
#* Use faster C/Yacc CIF parser (default).
#* --fix-syntax-errors
#* Try to fix syntax errors in the input CIF
#* files that can be corrected unambiguously.
#* --dont-fix-syntax-errors, --no-fix-syntax-errors
#* Do not try to fix syntax errors in input
#* CIF files (default).
#* --help, --usage
#* Output a short usage message (this message) and exit.
#* --version
#* Output version information and exit.
#**
@ARGV = getOptions(
'--use-perl-parser' => sub { $use_parser = 'perl' },
'--use-c-parser' => sub { $use_parser = 'c' },
'--fix-syntax-errors' => sub { $fix_errors = 1; },
'--dont-fix-syntax-errors' => sub { $fix_errors = 0; },
'--no-fix-syntax-errors' => sub { $fix_errors = 0; },
'--options' => sub { options; exit },
'--help,--usage' => sub { usage; exit },
'--version' => sub { print 'cod-tools version ',
$COD::ToolsVersion::Version, "\n";
exit }
);
@ARGV = ('-') unless @ARGV;
binmode STDOUT, ':encoding(UTF-8)';
binmode STDERR, ':encoding(UTF-8)';
foreach my $filename ( @ARGV ) {
my ( $data ) = parse_cif( $filename, { 'parser' => $use_parser,
'fix_errors' => $fix_errors } );
for my $dataset (@$data) {
showRef( $dataset );
}
}
|