def __init__(me, name, headline = False, omitp = None, allowp = None):
me.name = name
me.headline = headline
- me._omitp = None
- me._allowp = None
+ me._omitp = omitp
+ me._allowp = allowp
def set(me, st, value):
if me._allowp and not me._allowp(st, value):
raise Exception, "slot `%s' not allowed here" % me.name
class MPSlot (BaseSlot):
def setup(me, st):
+ super(MPSlot, me).setup(st)
v = st.d.get(me)
if v not in st.mpmap:
write_limbs('v%d' % st.nextmp, v)
data_t = 'ecdata'
entry_t = 'ecentry'
tabname = 'ectab'
- slots = [EnumSlot('type', 'FTAG',
- ['prime', 'niceprime', 'binpoly', 'binnorm'],
- headline = True),
+ _typeslot = EnumSlot('type', 'FTAG',
+ ['prime', 'niceprime', 'binpoly', 'binnorm'],
+ headline = True)
+ slots = [_typeslot,
MPSlot('p'),
MPSlot('beta',
- allowp = lambda st, _: st.d['type'] == 'binnorm',
- omitp = lambda st: st.d['type'] != 'binnorm'),
+ allowp = lambda st, _:
+ st.d[EllipticCurveTable._typeslot] == 'binnorm',
+ omitp = lambda st:
+ st.d[EllipticCurveTable._typeslot] != 'binnorm'),
MPSlot('a'), MPSlot('b'), MPSlot('r'), MPSlot('h'),
MPSlot('gx'), MPSlot('gy')]