home *** CD-ROM | disk | FTP | other *** search
- #ifndef POCKETCALC_H
- #define POCKETCALC_H
-
- /*
- ** $Filename: PocketCalc.h $
- ** $Release: 1 $
- ** $Revision: 37.1 $
- ** $Date: 17/02/95 $
- **
- ** (C) Copyright 1995 Alex Taylor
- ** All Rights Reserved
- */
-
- /*----------------------------------------------------------------------------*/
- /* Includes & Defines */
- /*----------------------------------------------------------------------------*/
-
- #include <math.h> /* standard C includes */
- #include <stdio.h>
- #include <string.h>
-
- #include <exec/types.h> /* Amiga includes */
- #include <libraries/mui.h>
- #include <utility/hooks.h>
-
- #include <clib/alib_protos.h> /* C prototypes */
- #include <proto/exec.h> /* Amiga prototypes */
- #include <proto/muimaster.h>
-
- #define MaxChars 11 /* maximum number of characters in buffer */
- #define BufferSize 30 /* the buffer is actually somewhat bigger */
- /* in order to catch any overflow from sprintf() */
-
- #define MAKEID(a,b,c,d) ((ULONG)(a)<<24|(ULONG)(b)<<16|(ULONG)(c)<<8|(ULONG)(d))
- #define ASM __saveds __asm
- #define REG(x) register __ ## x
-
- #define EQUALS 0L
- #define PLUS 1L /* constants for use in 'switch' statements */
- #define MINUS 2L /* and so on */
- #define MULTIPLY 3L
- #define DIVIDE 4L
- #define SQRT 5L
- #define SQUARE 6L
- #define NEGATE 7L
- #define ID_PI 8L
- #define ID_RECALL 9L
- #define ID_MEMPLUS 10L
- #define ID_MEMMINUS 11L
- #define ID_CLEAR 12L
- #define ID_ALLCLEAR 13L
-
- /*----------------------------------------------------------------------------*/
- /* Protos */
- /*----------------------------------------------------------------------------*/
-
- void main(void);
- static BOOL MakeMUIApp(void);
- static APTR MakeButton(UBYTE *, UBYTE);
- static ASM void ProcessDigit(REG(a2) APTR, REG(a1) UBYTE *);
- static ASM void DoOperation(REG(a2) APTR, REG(a1) ULONG *);
- static void ClearBuffer(void);
- static void DoError(void);
- static void UpdateDisplay(long double);
-
- /*----------------------------------------------------------------------------*/
- /* Misc - global variables */
- /*----------------------------------------------------------------------------*/
-
- APTR App, Win, Display;
- UBYTE DigitBuffer[BufferSize];
- ULONG Cursor = 0L, NextOperation = 0L;
- BOOL Decimal = FALSE, Error = FALSE;
- long double Operand1, Operand2, CurrentOperand, Memory;
- /* long doubles for accuracy - 96-bit floats! */
-
- struct Library *MUIMasterBase; /* pointer to the base of the library */
-
- #endif /* POCKETCALC_H */
-