##############################################################################
##  Author:   C. Rhodes
##  Date:     12/1/93
##  Version:  revision! (not release)
##  Content:  a shell script to set up the appropriate raw data for CAYLEY
##            to create library routines.
##############################################################################
# set up the compression routine for CAYLEY

echo 'procedure padicCompress(d,n,p,cc,s);'
echo 'value = 0;'

echo 'for I=1 to length(s) do'
echo 'value = value + s[I]*p^(I-1);'
echo 'end;'

# and now set up it's data
# this is a library file so...

# now for the actual sequences!

echo "print 'SEQ('",d,"','",n,"','",p,"','",cc,"','",value,"')';"
echo "end;"

# this part of the code performs the stream editing necessary to dig out the 
# values and call CAYLEY
# the first four fields separated by tabs are d,n,p,cc
  
    awk ' {
   	 printf "padicCompress(%d,%d,%d,%d,seq(", $1, $2, $3, $4
	 printf "%s));\n",$5
    }'

# and we should have got the output lines