#!/usr/bin/env python
# Copyright (c) 1996, 1997, The Regents of the University of California.
# All rights reserved.  See Legal.htm for full text and disclaimer.

from PR import PR

def show(s):
	print s, '='
	print eval(s)

f = PR('test.pdb')
print 'Contents of test.pdb:'
f.print_names()

show("f.inquire_ls('d*')")
show("f.inquire_ls('','complex')")

print 'Variables:'
show('f.x')
show('f.x.a')
show('f.x.b')
show('f.x.c')

show('f.y')
show('f.y.tt')
show('f.y.tt.a')
show('f.y.tt.b')
show('f.y.tt.c')
show('f.y.ii')

show('f.a')
show('f.ax')
show('f.axx')

show('f.d')
show('f.dx')
show('f.dxx')

show('f.k')
show('f.kx')
show('f.kxx')

show('f.c')
show('f.cx')
show('f.cxx')

print 'Partial read example:'
show("f.inquire_shape('dxx')")
show("f.inquire_low('dxx')")
show("f.inquire_high('dxx')")
show("f.read_part('dxx',(1,2,1,2,3,1))")

print 'Exception handling example:'
try:
	xx=f.not_here
except KeyError, xxx:
	print "Name %s not registered in file %s." % (xxx,f.inquire_filename())

f.close()


