From: Mapi B. <ma...@us...> - 2009-07-05 20:52:54
|
Update of /cvsroot/easycalc/PPCport/compat In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17289 Modified Files: DataManager.h FloatManager.h PalmOS.h Log Message: MathLib compatibility Index: FloatManager.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/compat/FloatManager.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FloatManager.h 24 Jun 2009 21:44:45 -0000 1.1 --- FloatManager.h 5 Jul 2009 20:52:48 -0000 1.2 *************** *** 6,38 **** #include "PalmOS.h" ! class FlpDoubleBits { ! public: UInt32 sign : 1; Int32 exp : 11; UInt32 manH : 20; UInt32 manL; ! FlpDoubleBits(void); ! ~FlpDoubleBits(void); ! }; ! class FlpCompDouble { ! public: double d; ! // FlpDouble fd; ! // Defined in Palm OS FloatMgr.h as: ! // typedef _sfpe_64_bits FlpDouble; ! // typedef struct { ! // SDWord high; ! // SDWord low; ! // } _sfpe_64_bits; ! // and SDWord is obviously a typedef from Int32. ! // Lets ignore that, it does not seem to be used anyway in EasyCalc core code. UInt32 ul[2]; FlpDoubleBits fdb; ! FlpCompDouble(void); ! ~FlpCompDouble(void); ! }; #endif \ No newline at end of file --- 6,50 ---- #include "PalmOS.h" ! typedef struct { UInt32 sign : 1; Int32 exp : 11; UInt32 manH : 20; UInt32 manL; + } FlpDoubleBits; ! // Inferring from definitions in Palm OS FloatMgr.h as, and the fact that Windows CE ! // supports only little endian, even on ARM platforms which are bi-endian. ! typedef unsigned int SDWord; ! typedef struct { ! SDWord low; ! SDWord high; ! } _sfpe_64_bits; ! typedef _sfpe_64_bits FlpDouble; ! typedef union { double d; ! FlpDouble fd; UInt32 ul[2]; FlpDoubleBits fdb; + } FlpCompDouble; ! // Inferring those ... ! #define __HI32(x) (x)->fd.high ! #define __LO32(x) (x)->fd.low ! #define __HIX 1 ! ! // Defined in Palm OS FloatMgr.h as: ! #define FlpIsZero(x) (((__HI32((FlpCompDouble *)&x) & 0x7fffffff) | (__LO32((FlpCompDouble *)&x))) == 0) ! #define FlpIsZero1(x) ((_fpclass(x) & (_FPCLASS_NZ | _FPCLASS_PZ)) != 0) ! #define FlpGetSign(x) ((__HI32((FlpCompDouble *)&x) & 0x80000000) != 0) ! #define FlpGetSign1(x) ((_fpclass(x) & (_FPCLASS_NINF | _FPCLASS_NN | _FPCLASS_ND | _FPCLASS_NZ)) != 0) ! #define FlpGetExponent(x) (((__HI32((FlpCompDouble *)&x) & 0x7ff00000) >> 20) - 1023) ! // Can be replaced by a function using frexp() ! #define FlpNegate(x) (((FlpCompDouble *)&x)->ul[__HIX] ^= 0x80000000) ! #define FlpNegate1(x) (x = _chgsign(x)) ! #define FlpSetNegative(x) (((FlpCompDouble *)&x)->ul[__HIX] |= 0x80000000) ! #define FlpSetNegative1(x) (x = -fabs(x)) ! #define FlpSetPositive(x) (((FlpCompDouble *)&x)->ul[__HIX] &= ~0x80000000) ! #define FlpSetPositive1(x) (x = fabs(x)) #endif \ No newline at end of file Index: PalmOS.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/compat/PalmOS.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PalmOS.h 24 Jun 2009 21:39:34 -0000 1.2 --- PalmOS.h 5 Jul 2009 20:52:48 -0000 1.3 *************** *** 35,44 **** #define IndexedColorType int ! #define StrCopy _tcscpy ! #define StrLen _tcslen ! #define StrNCompare _tcsncmp ! #define StrCompare _tcscmp ! #define StrCat _tcscat ! #define StrPrintF _stprintf #define MemPtrNew malloc --- 35,45 ---- #define IndexedColorType int ! #define StrCopy _tcscpy ! #define StrLen _tcslen ! #define StrNCompare _tcsncmp ! #define StrCompare _tcscmp ! #define StrCat _tcscat ! #define StrPrintF _stprintf ! #define StrIToA(s,i) _itot(i,s,10) #define MemPtrNew malloc *************** *** 64,67 **** --- 65,80 ---- #include "DataManager.h" + #include "FloatManager.h" + #include "Preferences.h" + + #include <stdlib.h> + #define SysRandom(x) (srand(x), rand()) + #define sysRandomMax RAND_MAX + unsigned long nan[2]={0xffffffff, 0x7fffffff}; + #define NaN (*((double *) nan)) + + #include <time.h> + #define TimGetSeconds() ((UInt32) time(NULL)) + #define ErrFatalDisplayIf(a,b) Index: DataManager.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/compat/DataManager.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DataManager.h 22 Jun 2009 21:57:16 -0000 1.1 --- DataManager.h 5 Jul 2009 20:52:48 -0000 1.2 *************** *** 36,39 **** --- 36,47 ---- }; + typedef struct { + UInt8 attributes; + UInt8 uniqueID[3]; + } SortRecordInfoType; + + typedef SortRecordInfoType *SortRecordInfoPtr; + + typedef DataManager *DmOpenRef; typedef void *LocalID; *************** *** 42,93 **** LocalID DmFindDatabase (UINT16 cardNo, const TCHAR *nameP); ! Err DmDatabaseInfo ( ! UInt16 cardNo, ! LocalID dbID, ! Char *nameP, ! UInt16 *attributesP, ! UInt16 *versionP, ! UInt32 *crDateP, ! UInt32 *modDateP, ! UInt32 *bckUpDateP, ! UInt32 *modNumP, ! LocalID appInfoIDP, ! LocalID sortInfoIDP, ! UInt32 *typeP, ! UInt32 *creatorP ! ); ! Err DmSetDatabaseInfo ( ! UInt16 cardNo, ! LocalID dbID, ! const Char *nameP, ! UInt16 *attributesP, ! UInt16 *versionP, ! UInt32 *crDateP, ! UInt32 *modDateP, ! UInt32 *bckUpDateP, ! UInt32 *modNumP, ! LocalID appInfoIDP, ! LocalID sortInfoIDP, ! UInt32 *typeP, ! UInt32 *creatorP ! ); DmOpenRef DmOpenDatabase (UInt16 cardNo, LocalID dbID, UInt16 mode); Err DmGetLastErr (void); ! Err DmCreateDatabase ( ! UInt16 cardNo, ! const Char *nameP, ! UInt32 creator, ! UInt32 type, ! Boolean resDB); Err DmCloseDatabase (DmOpenRef dbP); Err DmDeleteDatabase (UInt16 cardNo, LocalID dbID); UInt16 DmNumRecords (DmOpenRef dbP); MemHandle DmNewRecord (DmOpenRef dbP, UInt16 *atP, UInt32 size); ! Err DmWrite ( ! void *recordP, ! UInt32 offset, ! const void *srcP, ! UInt32 bytes ! ); Err DmRemoveRecord (DmOpenRef dbP, UInt16 index); MemHandle DmQueryRecord (DmOpenRef dbP, UInt16 index); --- 50,70 ---- LocalID DmFindDatabase (UINT16 cardNo, const TCHAR *nameP); ! Err DmDatabaseInfo (UInt16 cardNo, LocalID dbID, Char *nameP, UInt16 *attributesP, ! UInt16 *versionP, UInt32 *crDateP, UInt32 *modDateP, UInt32 *bckUpDateP, ! UInt32 *modNumP, LocalID appInfoIDP, LocalID sortInfoIDP, ! UInt32 *typeP, UInt32 *creatorP); ! Err DmSetDatabaseInfo (UInt16 cardNo, LocalID dbID, const Char *nameP, ! UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, ! UInt32 *modDateP, UInt32 *bckUpDateP, UInt32 *modNumP, ! LocalID appInfoIDP, LocalID sortInfoIDP, UInt32 *typeP, ! UInt32 *creatorP); DmOpenRef DmOpenDatabase (UInt16 cardNo, LocalID dbID, UInt16 mode); Err DmGetLastErr (void); ! Err DmCreateDatabase (UInt16 cardNo, const Char *nameP, UInt32 creator, UInt32 type, Boolean resDB); Err DmCloseDatabase (DmOpenRef dbP); Err DmDeleteDatabase (UInt16 cardNo, LocalID dbID); UInt16 DmNumRecords (DmOpenRef dbP); MemHandle DmNewRecord (DmOpenRef dbP, UInt16 *atP, UInt32 size); ! Err DmWrite (void *recordP, UInt32 offset, const void *srcP, UInt32 bytes); Err DmRemoveRecord (DmOpenRef dbP, UInt16 index); MemHandle DmQueryRecord (DmOpenRef dbP, UInt16 index); |