def hint_GFV(self, **kwArgs): """ GFV: Get freedom vector, opcode 0x0D >>> logger = utilities.makeDoctestLogger("GFV_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState() >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["GFV"])) >>> hint_GFV(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep_tag_smart( ... h.state.pushHistory, ... (lambda x: False)) 0: Result of opcode GFV at index 0 in test 1: Result of opcode GFV at index 0 in test >>> h.state.statistics.maxima.stack 2 >>> h.state.stack[-1] 0 >>> h.state.stack[-2] 1 """ state = self.state logger = self._getLogger(**kwArgs) gsd = state.graphicsState.__dict__ which = gsd[kwArgs.get('which', 'freedomVector')] n = which[0].changedBasis(1) n2 = n.toNumber() if n2 is not None: n = n2 state.append('stack', n) n = which[1].changedBasis(1) n2 = n.toNumber() if n2 is not None: n = n2 state.append('stack', n) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[])) state.append('pushHistory', state.pushHistory[-1]) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePush() fatObj.notePush() state.statistics.stackCheck(state.stack) state.assign('pc', state.pc + 1)
def hint_NEG(self, **kwArgs): """ NEG: Negate, opcode 0x65 >>> logger = utilities.makeDoctestLogger("NEG_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState( ... Collection([Triple(1, 11, 2), Triple(-20, -10, 5)]), -5) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["NEG"])) >>> hint_NEG(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Result of opcode NEG at index 0 in test, with inputs: Extra index 1 in PUSH opcode index 0 in test >>> _popSync(h.state) 5 >>> h.state.assign('pc', 0) >>> hint_NEG(h, logger=logger) >>> _popSync(h.state) Singles: [15, 20], Ranges: [(-9, 1, 2)] >>> hint_NEG(h, logger=logger) NEG_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) n = self._popRemove(state, 'stack') if n is None: state.assign('pc', doNotProceedPC) return h = self._popRemove(state, 'pushHistory') if h is None: state.assign('pc', doNotProceedPC) return state.append('stack', -n) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex = fatObj.notePop(None, 'NEG') fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_DEPTH(self, **kwArgs): """ DEPTH: Depth of the stack, opcode 0x24 >>> logger = utilities.makeDoctestLogger("DEPTH_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(100, 101) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["DEPTH"])) >>> h.state.statistics.maxima.stack 2 >>> hint_DEPTH(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack [100, 101, 2] >>> h.state.statistics.maxima.stack 3 >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test Result of opcode DEPTH at index 0 in test """ state = self.state logger = self._getLogger(**kwArgs) state.append('stack', len(state.stack)) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePush() state.statistics.stackCheck(state.stack) state.assign('pc', state.pc + 1)
def hint_MPPEM(self, **kwArgs): """ MPPEM: Measure pixels-per-em, opcode 0x4B >>> logger = utilities.makeDoctestLogger("MPPEM_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState() >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["MPPEM"])) >>> hint_MPPEM(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.statistics.maxima.stack 1 >>> h.state.stack[-1] Ranges: [(5, *, 1)] >>> pp.PP().sequence_deep(h.state.pushHistory) Result of opcode MPPEM at index 0 in test """ state = self.state state.append('stack', Collection([Triple(5, None, 1)])) state.statistics.stackCheck(state.stack) state.append( 'pushHistory', op.HistoryEntry_op( hintsObj = (id(self.ultParent), self.ultParent), hintsPC = state.pc + self.ultDelta, opcode = self[state.pc].opcode, historyIterable = [])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePush() state.assign('pc', state.pc + 1)
def hint_ABS(self, **kwArgs): """ ABS: Absolute value, opcode 0x64 >>> logger = utilities.makeDoctestLogger("ABS_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(Collection([Triple(-9, 1, 2)]), -5) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["ABS"])) >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test >>> hint_ABS(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Result of opcode ABS at index 0 in test, with inputs: Extra index 1 in PUSH opcode index 0 in test >>> _popSync(h.state) 5 >>> h.state.assign('pc', 0) >>> hint_ABS(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> _popSync(h.state) Ranges: [(1, 11, 2)] >>> h.state.stack[:] = [] >>> h.state.changed('stack') >>> hint_ABS(h, logger=logger) ABS_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state stack = state.stack logger = self._getLogger(**kwArgs) n = self._popRemove(state, 'stack') if n is None: state.assign('pc', doNotProceedPC) return history = self._popRemove(state, 'pushHistory') if history is None: state.assign('pc', doNotProceedPC) return state.append('stack', abs(n)) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[history])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex = fatObj.notePop(None, 'ABS') fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_NROUND(self, **kwArgs): """ NROUND: No round (engine only), opcodes 0x6C-0x6F >>> logger = utilities.makeDoctestLogger("NROUND_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(65) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["NROUND[gray]"])) >>> h.state.colorDistances.gray = Collection([Triple(2, 3, 1)], 64) >>> h.state.changed('colorDistances') >>> hint_NROUND(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep(h.state.pushHistory) Result of opcode NROUND[gray] at index 0 in test, with inputs: Extra index 0 in PUSH opcode index 0 in test >>> _popSync(h.state) 67 >>> hint_NROUND(h, logger=logger) NROUND_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) distance = self._popRemove(state, 'stack', coerceToCollection=True) if distance is None: state.assign('pc', doNotProceedPC) return distance = distance.changedBasis(1) h = self._popRemove(state, 'pushHistory') if h is None: state.assign('pc', doNotProceedPC) return if (None not in distance) and any(n < -16384 or n >= 16384 for n in distance): logger.error( ('E6019', (self.ultParent.infoString, state.pc + self.ultDelta), "NROUND opcode in %s (PC %d) has out-of-range FUnit distance.")) state._validationFailed = True state.append('stack', 0) else: colorDist = getattr(state.colorDistances, kwArgs.get('color', 'gray')) cNeg, cPos = distance.changedBasis(64).signedParts() result = (cNeg - colorDist).addToCollection(cPos + colorDist) result = result.changedBasis(1) r2 = result.toNumber() if r2 is not None: result = r2 state.append('stack', result) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex = fatObj.notePop(None, 'NROUND') fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_MIN(self, **kwArgs): """ MIN: Minimum, opcode 0x8C >>> logger = utilities.makeDoctestLogger("MIN_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(toCollection([-20, 20]), 8, -12, 3) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["MIN"])) >>> hint_MIN(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack[-1] -12 >>> h.state.assign('pc', 0) >>> hint_MIN(h, logger=logger) >>> h.state.stack[-1] -12 >>> h.state.assign('pc', 0) >>> hint_MIN(h, logger=logger) >>> h.state.stack[-1] Singles: [-20, -12] >>> pp.PP().sequence_deep(h.state.pushHistory) Result of opcode MIN at index 0 in test, with inputs: Extra index 0 in PUSH opcode index 0 in test Result of opcode MIN at index 0 in test, with inputs: Extra index 1 in PUSH opcode index 0 in test Result of opcode MIN at index 0 in test, with inputs: Extra index 2 in PUSH opcode index 0 in test Extra index 3 in PUSH opcode index 0 in test >>> hint_MIN(h, logger=logger) MIN_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) t = self._popRemove(state, 'stack', 2, coerceToCollection=True) if t is None: state.assign('pc', doNotProceedPC) return e1, e2 = t t = self._popRemove(state, 'pushHistory', 2) if t is None: state.assign('pc', doNotProceedPC) return h1, h2 = t n = e1.collectionMin(e2) n2 = n.toNumber() if n2 is not None: n = n2 state.append('stack', n) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h1, h2])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex1 = fatObj.notePop(None, 'MIN') argIndex2 = fatObj.notePop(None, 'MIN') if (argIndex1 is not None) and (argIndex2 is not None): if not isinstance(argIndex1, tuple): argIndex1 = (argIndex1, ) if not isinstance(argIndex2, tuple): argIndex2 = (argIndex2, ) argIndex = frozenset(argIndex1 + argIndex2) if len(argIndex) == 1: argIndex = next(iter(argIndex)) elif argIndex1 is not None: argIndex = argIndex1 elif argIndex2 is not None: argIndex = argIndex2 else: argIndex = None fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_AND(self, **kwArgs): """ AND: Logical AND, opcode 0x5A >>> logger = utilities.makeDoctestLogger("AND_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(1, 2) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["AND"])) >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test >>> hint_AND(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep(h.state.pushHistory) Result of opcode AND at index 0 in test, with inputs: Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test >>> h = _testingState(0, toCollection([0, 4]), 4, 5) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["AND"])) >>> hint_AND(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack[-1] 1 >>> h.state.assign('pc', 0) >>> hint_AND(h, logger=logger) >>> h.state.stack[-1] Singles: [0, 1] >>> h.state.assign('pc', 0) >>> hint_AND(h, logger=logger) >>> h.state.stack[-1] 0 >>> h.state.stack[:] = [] >>> h.state.changed('stack') >>> hint_AND(h, logger=logger) AND_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) t = self._popRemove(state, 'stack', 2, coerceToCollection=True) if t is None: state.assign('pc', doNotProceedPC) return e1, e2 = [obj.encompassedBooleans() for obj in t] vh = self._popRemove(state, 'pushHistory', 2) if vh is None: state.assign('pc', doNotProceedPC) return t = (0 in e1, 1 in e1, 0 in e2, 1 in e2) state.append('stack', AND_table[t]()) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=vh)) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePop(None, 'AND') fatObj.notePop(None, 'AND') fatObj.notePush() state.assign('pc', state.pc + 1)
def hint_MD(self, **kwArgs): """ MD: Measure distance, opcodes 0x49-0x4A >>> logger = utilities.makeDoctestLogger("MD_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(6, 10) >>> h.append( ... opcode_tt.Opcode_nonpush(nameToOpcodeMap["MD[gridfitted]"])) >>> hint_MD(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.statistics.maxima.point 10 >>> h.state.statistics.pprint(keys=('point',)) History for outline points (glyph zone): 6: Extra index 0 in PUSH opcode index 0 in test 10: Extra index 1 in PUSH opcode index 0 in test >>> pp.PP().sequence_deep(h.state.pushHistory) Result of opcode MD[gridfitted] at index 0 in test, with inputs: Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test >>> hint_MD(h, logger=logger) MD_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state gs = state.graphicsState logger = self._getLogger(**kwArgs) points = self._popRemove(state, 'stack', 2, coerceToCollection=True) if points is None: state.assign('pc', doNotProceedPC) return histories = self._popRemove(state, 'pushHistory', 2) if histories is None: state.assign('pc', doNotProceedPC) return if self._zoneCheck("MD", (0, 1), logger): v = [(gs.zonePointer0, points[0], False), (gs.zonePointer1, points[1], False)] if self._pointCheck("MD", v, logger, kwArgs.get('extraInfo', {})): for i, t in enumerate(v): state.statistics.addHistory('point', t, histories[i]) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=histories)) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePop('pointIndex', 'MD') fatObj.notePop('pointIndex', 'MD') fatObj.notePush() state.append('stack', Collection([Triple(None, None, 1)])) state.assign('pc', state.pc + 1)
def hint_FLOOR(self, **kwArgs): """ FLOOR: Numerical floor, opcode 0x66 >>> logger = utilities.makeDoctestLogger("FLOOR_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(Collection([Triple(32, 512, 16)]), -1, 127, 129) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["FLOOR"])) >>> hint_FLOOR(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test Extra index 2 in PUSH opcode index 0 in test Result of opcode FLOOR at index 0 in test, with inputs: Extra index 3 in PUSH opcode index 0 in test >>> _popSync(h.state) 128 >>> h.state.assign('pc', 0) >>> hint_FLOOR(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> _popSync(h.state) 64 >>> h.state.assign('pc', 0) >>> hint_FLOOR(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> _popSync(h.state) -64 >>> h.state.assign('pc', 0) >>> hint_FLOOR(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> _popSync(h.state) Ranges: [(0, 512, 64)] >>> hint_FLOOR(h, logger=logger) FLOOR_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) n = self._popRemove(state, 'stack', coerceToCollection=True) if n is None: state.assign('pc', doNotProceedPC) return h = self._popRemove(state, 'pushHistory') if h is None: state.assign('pc', doNotProceedPC) return n = n.changedBasis(64).floor() n2 = n.toNumber() if n2 is not None: n = n2 state.append('stack', n << 6) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex = fatObj.notePop(None, 'FLOOR') fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_ODD(self, **kwArgs): """ ODD: Determine even/odd state, opcode 0x56 >>> logger = utilities.makeDoctestLogger("ODD_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(96, 94) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["ODD"])) >>> hint_ODD(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Result of opcode ODD at index 0 in test, with inputs: Extra index 1 in PUSH opcode index 0 in test >>> _popSync(h.state) 1 >>> h.state.assign('pc', 0) >>> hint_ODD(h, logger=logger) >>> _popSync(h.state) 0 >>> hint_ODD(h, logger=logger) ODD_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) n = self._popRemove(state, 'stack', coerceToCollection=True) if n is None: state.assign('pc', doNotProceedPC) return n = n.changedBasis(64) h = self._popRemove(state, 'pushHistory') if h is None: state.assign('pc', doNotProceedPC) return rounded = self._round(n, coerceToNumber=False) r = (rounded.changedBasis(1) & 0x40) >> 6 r2 = r.toNumber() if r2 is not None: r = r2 state.append('stack', r) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePop(None, 'ODD') fatObj.notePush() state.assign('pc', state.pc + 1)
def hint_SUB(self, **kwArgs): """ SUB: Subtract, opcode 0x61 >>> logger = utilities.makeDoctestLogger("SUB_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(-3000000000, Collection([Triple(1, 11, 2)]), 6, 9) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["SUB"])) >>> hint_SUB(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack[-1] -3 >>> h.state.assign('pc', 0) >>> hint_SUB(h, logger=logger) >>> h.state.stack[-1] Ranges: [(4, 14, 2)] >>> h.state.assign('pc', 0) >>> hint_SUB(h, logger=logger) SUB_test - ERROR - SUB opcode in test (PC 0) resulted in a number that cannot be represented in 26.6 notation. >>> hint_SUB(h, logger=logger) SUB_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) t = self._popRemove(state, 'stack', 2, coerceToCollection=True) if t is None: state.assign('pc', doNotProceedPC) return e1, e2 = t t = self._popRemove(state, 'pushHistory', 2) if t is None: state.assign('pc', doNotProceedPC) return h1, h2 = t n = e1 - e2 rMin = n.min() rMax = n.max() if ((rMin is not None) and (rMax is not None) and (rMin < -33554432.0 or rMax > 33554431.984375)): logger.error( ('E6036', (self.ultParent.infoString, state.pc + self.ultDelta), "SUB opcode in %s (PC %d) resulted in a number that cannot " "be represented in 26.6 notation.")) state._validationFailed = True n = 0 else: n2 = n.toNumber() if n2 is not None: n = n2 state.append('stack', n) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h1, h2])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex1 = fatObj.notePop(None, 'SUB') argIndex2 = fatObj.notePop(None, 'SUB') if (argIndex1 is not None) and (argIndex2 is not None): if not isinstance(argIndex1, tuple): argIndex1 = (argIndex1, ) if not isinstance(argIndex2, tuple): argIndex2 = (argIndex2, ) argIndex = frozenset(argIndex1 + argIndex2) if len(argIndex) == 1: argIndex = next(iter(argIndex)) elif argIndex1 is not None: argIndex = argIndex1 elif argIndex2 is not None: argIndex = argIndex2 else: argIndex = None fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_ADD(self, **kwArgs): """ ADD: Add, opcode 0x60 >>> logger = utilities.makeDoctestLogger("ADD_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(40000000, toCollection([3, 5, 11]), 4, -12) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["ADD"])) >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test Extra index 2 in PUSH opcode index 0 in test Extra index 3 in PUSH opcode index 0 in test >>> hint_ADD(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test Result of opcode ADD at index 0 in test, with inputs: Extra index 2 in PUSH opcode index 0 in test Extra index 3 in PUSH opcode index 0 in test >>> h.state.stack[-1] -8 >>> h.state.assign('pc', 0) >>> hint_ADD(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack[-1] Singles: [-5, -3, 3] >>> h.state.assign('pc', 0) >>> hint_ADD(h, logger=logger) ADD_test - ERROR - ADD opcode in test (PC 0) resulted in a number that cannot be represented in 26.6 notation. >>> hint_ADD(h, logger=logger) ADD_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) t = self._popRemove(state, 'stack', 2, coerceToCollection=True) if t is None: state.assign('pc', doNotProceedPC) return e1, e2 = t vh = self._popRemove(state, 'pushHistory', 2) if vh is None: state.assign('pc', doNotProceedPC) return r = e1 + e2 rMin = r.min() rMax = r.max() if ( (rMin is not None) and (rMax is not None) and (rMin < -33554432.0 or rMax > 33554431.984375)): logger.error(( 'E6036', (self.ultParent.infoString, state.pc + self.ultDelta), "ADD opcode in %s (PC %d) resulted in a number that cannot " "be represented in 26.6 notation.")) state._validationFailed = True r = 0 else: r2 = r.toNumber() if r2 is not None: r = r2 state.append('stack', r) state.append( 'pushHistory', op.HistoryEntry_op( hintsObj = (id(self.ultParent), self.ultParent), hintsPC = state.pc + self.ultDelta, opcode = self[state.pc].opcode, historyIterable = vh)) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex1 = fatObj.notePop(None, 'ADD') argIndex2 = fatObj.notePop(None, 'ADD') if (argIndex1 is not None) and (argIndex2 is not None): if not isinstance(argIndex1, tuple): argIndex1 = (argIndex1,) if not isinstance(argIndex2, tuple): argIndex2 = (argIndex2,) argIndex = frozenset(argIndex1 + argIndex2) if len(argIndex) == 1: argIndex = next(iter(argIndex)) elif argIndex1 is not None: argIndex = argIndex1 elif argIndex2 is not None: argIndex = argIndex2 else: argIndex = None fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_GC(self, **kwArgs): """ GC: Get coordinate, opcodes 0x46-0x47 >>> logger = utilities.makeDoctestLogger("GC_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(7) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["GC[current]"])) >>> hint_GC(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.statistics.maxima.point 7 >>> h.state.statistics.pprint(keys=('point',)) History for outline points (glyph zone): 7: Extra index 0 in PUSH opcode index 0 in test >>> _popSync(h.state) Ranges: [(*, *, 1, phase=0)] >>> hint_GC(h, logger=logger) GC_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) point = self._popRemove(state, 'stack', coerceToCollection=True) if point is None: state.assign('pc', doNotProceedPC) return history = self._popRemove(state, 'pushHistory') if history is None: state.assign('pc', doNotProceedPC) return if self._zoneCheck("GC", (2,), logger): zp2 = state.graphicsState.zonePointer2 if self._pointCheck( "GC", [(zp2, point, False)], logger, kwArgs.get('extraInfo', {})): state.statistics.addHistory('point', (zp2, point), history) state.append('stack', Collection([Triple(None, None, 1)])) state.append( 'pushHistory', op.HistoryEntry_op( hintsObj = (id(self.ultParent), self.ultParent), hintsPC = state.pc + self.ultDelta, opcode = self[state.pc].opcode, historyIterable = [history])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePop('pointIndex', 'GC') fatObj.notePush() state.assign('pc', state.pc + 1)
def hint_RCVT(self, **kwArgs): """ RCVT: Read CVT value, opcode 0x45 >>> logger = utilities.makeDoctestLogger("RCVT_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(toCollection([12, 15]), 12) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["RCVT"])) >>> h.state.cvt[12] = toCollection(1.5, newBasis=64) >>> h.state.cvt[15] = toCollection([-0.75, -0.25, 0], newBasis=64) >>> h.state.changed('cvt') >>> pp.PP().mapping(h.state.cvt) 0: Singles: [4.375] 1: Singles: [4.4375] 2: Singles: [4.53125] 3: Singles: [4.65625] 4: Singles: [4.8125] 5: Singles: [5.0] 6: Singles: [5.21875] 7: Singles: [5.46875] 8: Singles: [5.75] 9: Singles: [6.0625] 10: Singles: [6.40625] 11: Singles: [6.78125] 12: Singles: [1.5] 13: Singles: [7.625] 14: Singles: [8.09375] 15: Singles: [-0.75, -0.25, 0.0] 16: Singles: [9.125] 17: Singles: [9.6875] 18: Singles: [10.28125] 19: Singles: [10.90625] >>> hint_RCVT(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.statistics.maxima.cvt 12 >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Result of opcode RCVT at index 0 in test, with inputs: Extra index 1 in PUSH opcode index 0 in test >>> _popSync(h.state) 96 >>> h.state.assign('pc', 0) >>> hint_RCVT(h, logger=logger) >>> h.state.statistics.maxima.cvt 15 >>> h.state.stack[-1] Singles: [-48, -16, 0, 96] >>> h.state.statistics.pprint(keys=('cvt',)) History for CVT values: 12: Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test 15: Extra index 0 in PUSH opcode index 0 in test >>> hint_RCVT(h, logger=logger) RCVT_test - ERROR - For RCVT opcode in test (PC 1), CVTs not present in CVT table: [-48, -16, 96] >>> hint_RCVT(h, logger=logger) RCVT_test - CRITICAL - Stack underflow in test (PC 2). """ state = self.state stats = state.statistics logger = self._getLogger(**kwArgs) cvtIndex = self._popRemove(state, 'stack', coerceToCollection=True) if cvtIndex is None: state.assign('pc', doNotProceedPC) return history = self._popRemove(state, 'pushHistory') if history is None: state.assign('pc', doNotProceedPC) return missing = sorted(n for n in cvtIndex if n not in state.cvt) if missing: logger.error( ('E6005', (self.ultParent.infoString, state.pc + self.ultDelta, missing), "For RCVT opcode in %s (PC %d), " "CVTs not present in CVT table: %s")) state._validationFailed = True else: it = iter(cvtIndex) result = Collection(basis=64) for i in it: result = result.addToCollection(state.cvt[i]) result = result.changedBasis(1) r2 = result.toNumber() if r2 is not None: result = r2 state.append('stack', result) stats.addHistory('cvt', cvtIndex, history) stats.noteEffect('cvt', cvtIndex, self.ultParent.infoString, state.pc + self.ultDelta, -1) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[history])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePop('cvtIndex', 'RCVT') fatObj.notePush() state.assign('pc', state.pc + 1)
def hint_DIV(self, **kwArgs): """ DIV: Divide, opcode 0x62 >>> logger = utilities.makeDoctestLogger("DIV_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState( ... toCollection([32, 64]), ... toCollection([32, 64]), ... 128) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["DIV"])) >>> hint_DIV(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack[-1] Singles: [0.25, 0.5] >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Result of opcode DIV at index 0 in test, with inputs: Extra index 1 in PUSH opcode index 0 in test Extra index 2 in PUSH opcode index 0 in test >>> h.state.assign('pc', 0) >>> hint_DIV(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack[-1] Singles: [1.0, 2.0, 4.0] >>> h = _testingState(64, 0, 3 * 64, 2 * 64) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["DIV"])) >>> hint_DIV(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack[-1] 96 >>> h.state.assign('pc', 0) >>> hint_DIV(h, logger=logger) >>> h.state.stack[-1] 0 >>> h.state.assign('pc', 0) >>> hint_DIV(h, logger=logger) DIV_test - ERROR - Division by zero in DIV opcode in test (PC 0). >>> h = _testingState(20000000 * 64, 2) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["DIV"])) >>> hint_DIV(h, logger=logger) DIV_test - ERROR - DIV opcode in test (PC 0) resulted in a number that cannot be represented in 26.6 notation. >>> hint_DIV(h, logger=logger) DIV_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) t = self._popRemove(state, 'stack', 2, coerceToCollection=True) if t is None: state.assign('pc', doNotProceedPC) return numer, denom = t t = self._popRemove(state, 'pushHistory', 2) if t is None: state.assign('pc', doNotProceedPC) return h1, h2 = t if 0 in denom: logger.error( ('E6006', (self.ultParent.infoString, state.pc + self.ultDelta), "Division by zero in DIV opcode in %s (PC %d).")) state._validationFailed = True state.append('stack', 0) else: result = numer.changedBasis(64) / denom.changedBasis(64) rMin = result.min() rMax = result.max() if ((rMin is not None) and (rMax is not None) and (rMin < -33554432.0 or rMax > 33554431.984375)): logger.error( ('E6036', (self.ultParent.infoString, state.pc + self.ultDelta), "DIV opcode in %s (PC %d) resulted in a number that cannot " "be represented in 26.6 notation.")) state._validationFailed = True result = 0 else: r2 = result.changedBasis(1).toNumber() if r2 is not None: result = r2 state.append('stack', result) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h1, h2])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex1 = fatObj.notePop(None, 'DIV') argIndex2 = fatObj.notePop(None, 'DIV') if (argIndex1 is not None) and (argIndex2 is not None): if not isinstance(argIndex1, tuple): argIndex1 = (argIndex1, ) if not isinstance(argIndex2, tuple): argIndex2 = (argIndex2, ) argIndex = frozenset(argIndex1 + argIndex2) if len(argIndex) == 1: argIndex = next(iter(argIndex)) elif argIndex1 is not None: argIndex = argIndex1 elif argIndex2 is not None: argIndex = argIndex2 else: argIndex = None fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_ROUND(self, **kwArgs): """ ROUND: Round using current mode, opcodes 0x68-0x6B >>> logger = utilities.makeDoctestLogger("ROUND_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(65) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["ROUND[gray]"])) >>> hint_ROUND(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> _popSync(h.state) 64 >>> hint_ROUND(h, logger=logger) ROUND_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) distance = self._popRemove(state, 'stack', coerceToCollection=True) if distance is None: state.assign('pc', doNotProceedPC) return distance = distance.changedBasis(1) h = self._popRemove(state, 'pushHistory') if h is None: state.assign('pc', doNotProceedPC) return if (None not in distance) and any(n < -16384 or n >= 16384 for n in distance): logger.error( ('E6019', (self.ultParent.infoString, state.pc + self.ultDelta), "ROUND opcode in %s (PC %d) has out-of-range FUnit distance.")) state._validationFailed = True state.append('stack', 0) else: result = self._round(distance.changedBasis(64), color=kwArgs.get('color', 'gray'), coerceToNumber=False) result = result.changedBasis(1) r2 = result.toNumber() if r2 is not None: result = r2 state.append('stack', result) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex = fatObj.notePop(None, 'ROUND') fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_GTEQ(self, **kwArgs): """ GTEQ: Test for greater or equal, opcode 0x52 >>> logger = utilities.makeDoctestLogger("GTEQ_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(Collection([Triple(-1, 2, 1)]), -1, 3, 3) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["GTEQ"])) >>> hint_GTEQ(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack[-1] 1 >>> h.state.assign('pc', 0) >>> hint_GTEQ(h, logger=logger) >>> h.state.stack[-1] 0 >>> h.state.assign('pc', 0) >>> hint_GTEQ(h, logger=logger) >>> h.state.stack[-1] Singles: [0, 1] >>> pp.PP().sequence_deep(h.state.pushHistory) Result of opcode GTEQ at index 0 in test, with inputs: Extra index 0 in PUSH opcode index 0 in test Result of opcode GTEQ at index 0 in test, with inputs: Extra index 1 in PUSH opcode index 0 in test Result of opcode GTEQ at index 0 in test, with inputs: Extra index 2 in PUSH opcode index 0 in test Extra index 3 in PUSH opcode index 0 in test >>> hint_GTEQ(h, logger=logger) GTEQ_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) t = self._popRemove(state, 'stack', 2, coerceToCollection=True) if t is None: state.assign('pc', doNotProceedPC) return e1, e2 = t t = self._popRemove(state, 'pushHistory', 2) if t is None: state.assign('pc', doNotProceedPC) return h1, h2 = t n = e1.less(e2).logicalNOT() n2 = n.toNumber() if n2 is not None: n = n2 state.append('stack', n) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h1, h2])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePop(None, 'GTEQ') fatObj.notePop(None, 'GTEQ') fatObj.notePush() state.assign('pc', state.pc + 1)
def hint_MUL(self, **kwArgs): """ MUL: Multiply, opcode 0x63 >>> logger = utilities.makeDoctestLogger("MUL_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState( ... 3000000000, ... Collection([Triple(32, 128, 32)]), ... 96, ... 128) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["MUL"])) >>> hint_MUL(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> h.state.stack[-1] 192 >>> h.state.assign('pc', 0) >>> hint_MUL(h, logger=logger) >>> h.state.stack[-1] Ranges: [(96, 384, 96)] >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Result of opcode MUL at index 0 in test, with inputs: Extra index 1 in PUSH opcode index 0 in test Result of opcode MUL at index 0 in test, with inputs: Extra index 2 in PUSH opcode index 0 in test Extra index 3 in PUSH opcode index 0 in test >>> h.state.assign('pc', 0) >>> hint_MUL(h, logger=logger) MUL_test - ERROR - MUL opcode in test (PC 0) resulted in a number that cannot be represented in 26.6 notation. >>> hint_MUL(h, logger=logger) MUL_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) t = self._popRemove(state, 'stack', 2, coerceToCollection=True) if t is None: state.assign('pc', doNotProceedPC) return e1, e2 = t t = self._popRemove(state, 'pushHistory', 2) if t is None: state.assign('pc', doNotProceedPC) return h1, h2 = t result = (e1.changedBasis(64) * e2.changedBasis(64)) rMin = result.min() rMax = result.max() if ((rMin is not None) and (rMax is not None) and (rMin < -33554432.0 or rMax > 33554431.984375)): logger.error( ('E6036', (self.ultParent.infoString, state.pc + self.ultDelta), "MUL opcode in %s (PC %d) resulted in a number that cannot " "be represented in 26.6 notation.")) state._validationFailed = True result = 0 else: result = result.changedBasis(1) r2 = result.toNumber() if r2 is not None: result = r2 state.append('stack', result) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h1, h2])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex1 = fatObj.notePop(None, 'MUL') argIndex2 = fatObj.notePop(None, 'MUL') if (argIndex1 is not None) and (argIndex2 is not None): if not isinstance(argIndex1, tuple): argIndex1 = (argIndex1, ) if not isinstance(argIndex2, tuple): argIndex2 = (argIndex2, ) argIndex = frozenset(argIndex1 + argIndex2) if len(argIndex) == 1: argIndex = next(iter(argIndex)) elif argIndex1 is not None: argIndex = argIndex1 elif argIndex2 is not None: argIndex = argIndex2 else: argIndex = None fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)
def hint_NOT(self, **kwArgs): """ NOT: Logical NOT, opcode 0x5C >>> logger = utilities.makeDoctestLogger("NOT_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(Collection([Triple(0, 8, 4)]), 0, 5) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["NOT"])) >>> hint_NOT(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test Result of opcode NOT at index 0 in test, with inputs: Extra index 2 in PUSH opcode index 0 in test >>> _popSync(h.state) 0 >>> h.state.assign('pc', 0) >>> hint_NOT(h, logger=logger) >>> _popSync(h.state) 1 >>> h.state.assign('pc', 0) >>> hint_NOT(h, logger=logger) >>> _popSync(h.state) Singles: [0, 1] >>> hint_NOT(h, logger=logger) NOT_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) n = self._popRemove(state, 'stack', coerceToCollection=True) if n is None: state.assign('pc', doNotProceedPC) return h = self._popRemove(state, 'pushHistory') if h is None: state.assign('pc', doNotProceedPC) return v = list(n.encompassedBooleans()) if len(v) == 1: v = [1 - v[0]] state.append('stack', (v[0] if len(v) == 1 else toCollection(v))) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: fatObj.notePop(None, 'NOT') fatObj.notePush() state.assign('pc', state.pc + 1)
def hint_CEILING(self, **kwArgs): """ CEILING: Mathematical ceiling of 26.6 value, opcode 0x67 >>> logger = utilities.makeDoctestLogger("CEILING_test") >>> _popSync, _testingState = _testFuncs() >>> h = _testingState(Collection([Triple(32, 512, 16)]), 65, -63) >>> h.append(opcode_tt.Opcode_nonpush(nameToOpcodeMap["CEILING"])) >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test Extra index 2 in PUSH opcode index 0 in test >>> hint_CEILING(h, logger=logger) >>> len(h.state.stack) == len(h.state.pushHistory) True >>> pp.PP().sequence_deep(h.state.pushHistory) Extra index 0 in PUSH opcode index 0 in test Extra index 1 in PUSH opcode index 0 in test Result of opcode CEILING at index 0 in test, with inputs: Extra index 2 in PUSH opcode index 0 in test >>> _popSync(h.state) 0 >>> h.state.assign('pc', 0) >>> hint_CEILING(h, logger=logger) >>> _popSync(h.state) 128 >>> h.state.assign('pc', 0) >>> hint_CEILING(h, logger=logger) >>> _popSync(h.state) Ranges: [(64, 576, 64)] >>> hint_CEILING(h, logger=logger) CEILING_test - CRITICAL - Stack underflow in test (PC 1). """ state = self.state logger = self._getLogger(**kwArgs) n = self._popRemove(state, 'stack', coerceToCollection=True) if n is None: state.assign('pc', doNotProceedPC) return h = self._popRemove(state, 'pushHistory') if h is None: state.assign('pc', doNotProceedPC) return n = n.changedBasis(64).ceiling() nTry = n.toNumber() if nTry is not None: n = nTry state.append('stack', n << 6) state.append( 'pushHistory', op.HistoryEntry_op(hintsObj=(id(self.ultParent), self.ultParent), hintsPC=state.pc + self.ultDelta, opcode=self[state.pc].opcode, historyIterable=[h])) fatObj = kwArgs.get('fdefArgTracer', None) if fatObj is not None: argIndex = fatObj.notePop(None, 'CEILING') fatObj.notePush(argIndex=argIndex) state.assign('pc', state.pc + 1)