mirror of
https://github.com/jeremysrand/abCalc.git
synced 2024-12-26 15:29:15 +00:00
More work on the NDA
This commit is contained in:
parent
eecefbd31a
commit
12bdfc054f
28
abCalcNDA.c
28
abCalcNDA.c
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -453,3 +453,10 @@ resource rControlTemplate (abCalcEntryBox) {
|
||||
0 /* text Ref */
|
||||
}};
|
||||
};
|
||||
|
||||
resource rAlertString (abCalcErrorAlert) {
|
||||
"23/"
|
||||
"*0"
|
||||
"/^#0\$00"
|
||||
};
|
||||
|
||||
|
@ -72,6 +72,7 @@ static int gNumOps = 0;
|
||||
|
||||
void abCalcOpInit(void)
|
||||
{
|
||||
gNumOps = 0;
|
||||
memset(gOps, 0, sizeof(gOps));
|
||||
|
||||
abCalcOpAddInit();
|
||||
|
Loading…
Reference in New Issue
Block a user