controller library Null safety
The Operations are split out into a separate library, so that they are prevented from accessing private parts of the controller. Similarly, the concrete ControllerState types are put in a separate Dart library. Operations and states are fairly complex, reflecting the sophisticated design of the original HP-16C. Keeping them encapsulated from the controller's internals helps make the code easier to follow.
- A BranchingOperation that takes an argument, namely B? (bit test)
- A program branching operation. These operations only function when running a program. They represent a condition. If that condition is true, the next instruction executes normally; otherwise, it is skipped.
- The main controller for the application. This abstract class is implemented by a RealController for normal calculator, and by by RunningController, which manages a running calculator program.
- The description of an argument for the float mode key. It's special because stack lift is enabled when going from int mode to float mode, but it's stack neutral if staying in float mode.
- The description of an argument for GSB, which requires a special state for inputting the argument to preview the instruction that's about to be executed.
- Operations that do something when the key is pressed, even when the calculator is in program entry state. They're called "limited," because the set of handleXXX() calls is limited to those supported by ProgramEntry. [...]
- A NormalOperation that takes an argument. For example, the RCL and STO operations take an argument, giving the register to store to or recall from.
- A "normal" calculator operation. Generally, they perform some kind of calculation, or otherwise manipulate the model.
- One of the number keys, from 0 to f.
- An operation, triggered by a key on the calculator keyboard, or executed as part of a program.
- A description of the argument for a NormalArgOperation or a BranchingArgOperation. This includes the calculation that is to be performed when the argument value is available.
- A controller for normal calculator operation. When a program is running, the real controller continues to exist, for when the program stops.
- A controller for when a program is running.
- A declarative description of an Operation's effect on stack lift, when its calculation has been performed. This covers the most common effects that operations can have on stack lift. See Page 99, "Operations Affecting Stack Lift" in Appendix B of the 16C's manual.
A type that can be used by states to access the library-private
_stackLiftEnabledflag. This provides enhanced encapsulation, by explicitly marking states that do this.