NCBI C Toolkit Cross Reference

C/asn/dumpidl.unx


  1 #!/bin/sh
  2 #
  3 # Script to generate IDL from all of the relevant NCBI ASN.1 specifications.
  4 #
  5 # J. Epstein, NCBI, 8/28/1996
  6 #
  7 # Requirements for building the IDL:
  8 #   a) a compiled copy of 'snacc'.  The source code is available, e.g. at
  9 #      ftp://www.fokus.gmd.de/pub/freeware/snacc/snacc-1.2rj.9.tar.gz
 10 #   b) an unpacked copy of the NCBI toolkit
 11 #   c) the 'asntool' utility built from the NCBI toolkit
 12 #
 13 # Preferably this script should be run in a directory which is either empty
 14 # or only contains the script itself.
 15 #
 16 #
 17 # The following variables should be modified to match the directory structure
 18 # at your site
 19 #
 20 snacchome=$HOME/snacc/snacc-1.2rj.9
 21 snacc=$snacchome/compiler/snacc
 22 ncbihome=$HOME/ncbi
 23 asntool=$ncbihome/build/asntool
 24 useful=asn-useful.asn1
 25 #
 26 rm -f *.asn $useful xx?? *.idl
 27 rm -rf scratch
 28 cp $snacchome/asn1specs/$useful .
 29 #
 30 # Process the $useful file to include the NCBI "StringStore" type
 31 #
 32 patch $useful <<EOF >/dev/null 2>&1
 33 *** /home/epstein/snacc/snacc-1.2rj.9/compiler/../asn1specs/asn-useful.asn1     Mon Jul 24 11:12:35 1995
 34 --- ./asn-useful.asn1   Wed Aug 28 12:04:48 1996
 35 ***************
 36 *** 65,70 ****
 37 --- 65,73 ----
 38   GeneralizedTime  ::= --snacc isPdu:"TRUE" --
 39                        [UNIVERSAL 24] IMPLICIT OCTET STRING
 40   
 41 + StringStore ::= --snacc isPdu:"TRUE" --
 42 +                      [UNIVERSAL 90] IMPLICIT OCTET STRING
 43 + 
 44   
 45   EXTERNAL         ::= --snacc isPdu:"TRUE" -- [UNIVERSAL 8] IMPLICIT SEQUENCE
 46   {
 47 EOF
 48 cp $ncbihome/asn/*.asn .
 49 cp $ncbihome/biostruc/*.asn .
 50 #
 51 # Split files which contain multiple ASN.1 specs into multiple files, to
 52 # satisfy snacc
 53 #
 54 mkdir scratch
 55 files=`grep -c "DEFINITIONS.*::=" *.asn | sed '/:1$/d'`
 56 for filewithval in $files
 57 do
 58         file=`echo $filewithval | sed "s/:[0-9]*//"`
 59         val=`echo $filewithval | sed "s/^.*://"`
 60         valmin1=`expr $val - 1`
 61         mv $file scratch
 62         csplit -s scratch/$file '/^END *$/+1' "{$valmin1}"
 63         find xx?? \( -size 0 -o -size 1c \) -print | xargs rm -f
 64         for f in xx??
 65         do
 66                 num=`echo $f | sed "s/^xx//"`
 67                 mv $f ASN1P$num$file
 68         done
 69 done
 70 #
 71 # Process each ASN.1 spec using 'asntool' to add the tags which 'snacc'
 72 # insists upon
 73 #
 74 for file in *.asn
 75 do
 76         $asntool -m $file -f /tmp/foo.$$
 77         rm -f $file
 78         mv /tmp/foo.$$ $file
 79 done
 80 $snacc -idl -u $useful *.asn

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.