mirror of
https://github.com/jeremysrand/abCalc.git
synced 2024-05-28 12:41:34 +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)
|
void PushCalcEntry(CtlRecHndl entryBox)
|
||||||
{
|
{
|
||||||
static Str255 strBuf;
|
static Str255 strBuf;
|
||||||
|
@ -274,9 +288,12 @@ void ExecCalcCmd(char *cmd)
|
||||||
|
|
||||||
PushCalcEntry(entryBox);
|
PushCalcEntry(entryBox);
|
||||||
|
|
||||||
if (op != NULL) {
|
if ((!ErrorRaised()) &&
|
||||||
|
(op != NULL)) {
|
||||||
op->execute();
|
op->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorRaised();
|
||||||
|
|
||||||
UpdateStack();
|
UpdateStack();
|
||||||
}
|
}
|
||||||
|
@ -316,7 +333,13 @@ void HandleOpClick(void)
|
||||||
if (op != NULL) {
|
if (op != NULL) {
|
||||||
CtlRecHndl entryBox = GetCtlHandleFromID(gCalcWinPtr, abCalcEntryBox);
|
CtlRecHndl entryBox = GetCtlHandleFromID(gCalcWinPtr, abCalcEntryBox);
|
||||||
PushCalcEntry(entryBox);
|
PushCalcEntry(entryBox);
|
||||||
op->execute();
|
|
||||||
|
if (!ErrorRaised()) {
|
||||||
|
op->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorRaised();
|
||||||
|
|
||||||
UpdateStack();
|
UpdateStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,6 +396,7 @@ void HandleControl(EventRecord *event)
|
||||||
|
|
||||||
case abCalcBtnEnter:
|
case abCalcBtnEnter:
|
||||||
PushCalcEntry(entryBox);
|
PushCalcEntry(entryBox);
|
||||||
|
ErrorRaised();
|
||||||
UpdateStack();
|
UpdateStack();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,11 @@
|
||||||
#define abCalcBtnPow 2047
|
#define abCalcBtnPow 2047
|
||||||
#define abCalcBtnPowStr 2048
|
#define abCalcBtnPowStr 2048
|
||||||
|
|
||||||
#define abCalcEntryBox 2049
|
#define abCalcEntryBox 3001
|
||||||
#define abCalcStackList 2050
|
#define abCalcStackList 3002
|
||||||
#define abCalcOpList 2051
|
#define abCalcOpList 3003
|
||||||
|
|
||||||
|
#define abCalcErrorAlert 4001
|
||||||
|
|
||||||
|
|
||||||
#define abCalcWinX 10
|
#define abCalcWinX 10
|
||||||
|
|
|
@ -453,3 +453,10 @@ resource rControlTemplate (abCalcEntryBox) {
|
||||||
0 /* text Ref */
|
0 /* text Ref */
|
||||||
}};
|
}};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
resource rAlertString (abCalcErrorAlert) {
|
||||||
|
"23/"
|
||||||
|
"*0"
|
||||||
|
"/^#0\$00"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ static int gNumOps = 0;
|
||||||
|
|
||||||
void abCalcOpInit(void)
|
void abCalcOpInit(void)
|
||||||
{
|
{
|
||||||
|
gNumOps = 0;
|
||||||
memset(gOps, 0, sizeof(gOps));
|
memset(gOps, 0, sizeof(gOps));
|
||||||
|
|
||||||
abCalcOpAddInit();
|
abCalcOpAddInit();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user