More work on the NDA

This commit is contained in:
Jeremy Rand 2013-08-08 00:58:18 -04:00
parent eecefbd31a
commit 12bdfc054f
4 changed files with 39 additions and 5 deletions

View File

@ -240,6 +240,20 @@ void UpdateStack(void)
}
BOOLEAN ErrorRaised(void)
{
char *errorString = abCalcGetError();
if (errorString == NULL) {
return FALSE;
}
AlertWindow(awCString+awResource, (Pointer)&errorString, abCalcErrorAlert);
abCalcClearError();
return TRUE;
}
void PushCalcEntry(CtlRecHndl entryBox)
{
static Str255 strBuf;
@ -274,9 +288,12 @@ void ExecCalcCmd(char *cmd)
PushCalcEntry(entryBox);
if (op != NULL) {
if ((!ErrorRaised()) &&
(op != NULL)) {
op->execute();
}
ErrorRaised();
UpdateStack();
}
@ -316,7 +333,13 @@ void HandleOpClick(void)
if (op != NULL) {
CtlRecHndl entryBox = GetCtlHandleFromID(gCalcWinPtr, abCalcEntryBox);
PushCalcEntry(entryBox);
op->execute();
if (!ErrorRaised()) {
op->execute();
}
ErrorRaised();
UpdateStack();
}
@ -373,6 +396,7 @@ void HandleControl(EventRecord *event)
case abCalcBtnEnter:
PushCalcEntry(entryBox);
ErrorRaised();
UpdateStack();
break;

View File

@ -81,9 +81,11 @@
#define abCalcBtnPow 2047
#define abCalcBtnPowStr 2048
#define abCalcEntryBox 2049
#define abCalcStackList 2050
#define abCalcOpList 2051
#define abCalcEntryBox 3001
#define abCalcStackList 3002
#define abCalcOpList 3003
#define abCalcErrorAlert 4001
#define abCalcWinX 10

View File

@ -453,3 +453,10 @@ resource rControlTemplate (abCalcEntryBox) {
0 /* text Ref */
}};
};
resource rAlertString (abCalcErrorAlert) {
"23/"
"*0"
"/^#0\$00"
};

View File

@ -72,6 +72,7 @@ static int gNumOps = 0;
void abCalcOpInit(void)
{
gNumOps = 0;
memset(gOps, 0, sizeof(gOps));
abCalcOpAddInit();