diff options
author | Noel Power <noel.power@novell.com> | 2010-12-21 13:08:15 +0000 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2010-12-21 13:08:15 +0000 |
commit | 7f2458dec64aec8a2462f1e6adeabcf27120c857 (patch) | |
tree | cebfc7c26b80327f439413aee55d5083a9a7ca57 /basic/inc | |
parent | a63d610d8943aff6b1327ed7fee2f5e1478d6ba8 (diff) | |
parent | acc2b99c92d1a1e63e05b56d48db1b7df6e5c7ac (diff) |
Merge remote branch 'origin/feature/currency-64bit'
Diffstat (limited to 'basic/inc')
-rw-r--r-- | basic/inc/basic/sbx.hxx | 5 | ||||
-rw-r--r-- | basic/inc/basic/sbxdef.hxx | 402 | ||||
-rw-r--r-- | basic/inc/basic/sbxvar.hxx | 316 |
3 files changed, 294 insertions, 429 deletions
diff --git a/basic/inc/basic/sbx.hxx b/basic/inc/basic/sbx.hxx index a4fa718c8467..b3c28ada8989 100644 --- a/basic/inc/basic/sbx.hxx +++ b/basic/inc/basic/sbx.hxx @@ -33,14 +33,13 @@ #include "svl/svarray.hxx" #include "svl/smplhint.hxx" #include "svl/lstner.hxx" + #include <basic/sbxdef.hxx> #include <basic/sbxform.hxx> - #include <basic/sbxobj.hxx> #include <basic/sbxprop.hxx> #include <basic/sbxmeth.hxx> -class BigInt; class String; class UniString; class SvStream; @@ -52,8 +51,6 @@ class SbxObject; class SbxArray; class SbxDimArray; class SbxFactory; -struct SbxINT64; -struct SbxUINT64; class SfxBroadcaster; class SvDispatch; diff --git a/basic/inc/basic/sbxdef.hxx b/basic/inc/basic/sbxdef.hxx index ca707168687b..0b6ea77c70a2 100644 --- a/basic/inc/basic/sbxdef.hxx +++ b/basic/inc/basic/sbxdef.hxx @@ -54,90 +54,99 @@ enum SbxClassType { // SBX-class-IDs (order is important!) #define _SBX_DATA_TYPE enum SbxDataType { - SbxEMPTY = 0, // * Uninitialized - SbxNULL = 1, // * Contains no valid data - SbxINTEGER = 2, // * Integer (INT16) - SbxLONG = 3, // * Long integer (INT32) - SbxSINGLE = 4, // * Single-precision floating point number (float) - SbxDOUBLE = 5, // * Double-precision floating point number (double) - SbxCURRENCY = 6, // Currency (INT64) - SbxDATE = 7, // * Date (double) - SbxSTRING = 8, // * String (StarView) - SbxOBJECT = 9, // * SbxBase object pointer - SbxERROR = 10, // * Error (UINT16) - SbxBOOL = 11, // * Boolean (0 or -1) - SbxVARIANT = 12, // * Display for variant datatype - SbxDATAOBJECT = 13, // * Common data object w/o ref count - - SbxCHAR = 16, // * signed char - SbxBYTE = 17, // * unsigned char - SbxUSHORT = 18, // * unsigned short (UINT16) - SbxULONG = 19, // * unsigned long (UINT32) - SbxLONG64 = 20, // signed 64-bit int - SbxULONG64 = 21, // unsigned 64-bit int - SbxINT = 22, // * signed machine-dependent int - SbxUINT = 23, // * unsigned machine-dependent int - SbxVOID = 24, // * no value (= SbxEMPTY) - SbxHRESULT = 25, // HRESULT - SbxPOINTER = 26, // generic pointer - SbxDIMARRAY = 27, // dimensioned array - SbxCARRAY = 28, // C style array - SbxUSERDEF = 29, // user defined - SbxLPSTR = 30, // * null terminated string - SbxLPWSTR = 31, // wide null terminated string - SbxCoreSTRING = 32, // from 1997-4-10 for GetCoreString(), only for converting - SbxWSTRING = 33, // from 2000-10-4 Reimplemented for backwards compatibility (#78919) - SbxWCHAR = 34, // from 2000-10-4 Reimplemented for backwards compatibility (#78919) - SbxSALINT64 = 35, // for UNO hyper - SbxSALUINT64 = 36, // for UNO unsigned hyper - SbxDECIMAL = 37, // for UNO/automation Decimal - - SbxVECTOR = 0x1000, // simple counted array - SbxARRAY = 0x2000, // array - SbxBYREF = 0x4000, // access by reference - - SbxSV1 = 128, // first defined data type for StarView - SbxMEMORYSTREAM, // SvMemoryStream - SbxSTORAGE, // SvStorage - - SbxUSER1 = 256, // first user defined data type - SbxUSERn = 2047 // last user defined data type + SbxEMPTY = 0, // * Uninitialized + SbxNULL = 1, // * Contains no valid data + SbxINTEGER = 2, // * Integer (INT16) + SbxLONG = 3, // * Long integer (INT32) + SbxSINGLE = 4, // * Single-precision floating point number (float) + SbxDOUBLE = 5, // * Double-precision floating point number (double) + SbxCURRENCY = 6, // Currency (INT64) + SbxDATE = 7, // * Date (double) + SbxSTRING = 8, // * String (StarView) + SbxOBJECT = 9, // * SbxBase object pointer + SbxERROR = 10, // * Error (UINT16) + SbxBOOL = 11, // * Boolean (0 or -1) + + SbxVARIANT = 12, // * Display for variant datatype + SbxDATAOBJECT = 13, // * Common data object w/o ref count + + SbxCHAR = 16, // * signed char + SbxBYTE = 17, // * unsigned char + SbxUSHORT = 18, // * unsigned short (UINT16) + SbxULONG = 19, // * unsigned long (UINT32) + +//deprecated: // old 64bit types kept for backward compatibility in file I/O + SbxLONG64 = 20, // moved to SbxSALINT64 as 64bit int + SbxULONG64 = 21, // moved to SbxSALUINT64 as 64bit int + + SbxINT = 22, // * signed machine-dependent int + SbxUINT = 23, // * unsigned machine-dependent int + + SbxVOID = 24, // * no value (= SbxEMPTY) + SbxHRESULT = 25, // HRESULT + SbxPOINTER = 26, // generic pointer + SbxDIMARRAY = 27, // dimensioned array + SbxCARRAY = 28, // C style array + SbxUSERDEF = 29, // user defined + SbxLPSTR = 30, // * null terminated string + + SbxLPWSTR = 31, // wide null terminated string + SbxCoreSTRING = 32, // from 1997-4-10 for GetCoreString(), only for converting< + + SbxWSTRING = 33, // from 2000-10-4 Reimplemented for backwards compatibility (#78919) + SbxWCHAR = 34, // from 2000-10-4 Reimplemented for backwards compatibility (#78919) + SbxSALINT64 = 35, // for currency internal, signed 64-bit int and UNO hyper + SbxSALUINT64= 36, // for currency internal, unsigned 64-bit int and UNO unsigned hyper + SbxDECIMAL = 37, // for UNO/automation Decimal + + SbxVECTOR = 0x1000, // simple counted array + SbxARRAY = 0x2000, // array + SbxBYREF = 0x4000, // access by reference + + SbxSV1 = 128, // first defined data type for StarView + SbxMEMORYSTREAM, // SvMemoryStream + SbxSTORAGE, // SvStorage + + SbxUSER1 = 256, // first user defined data type + SbxUSERn = 2047 // last user defined data type }; const UINT32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000; -const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible - +const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible #endif #ifndef _SBX_OPERATOR #define _SBX_OPERATOR enum SbxOperator { - // Arithmetical: - SbxEXP, // this ^ var - SbxMUL, // this * var - SbxDIV, // this / var - SbxMOD, // this MOD var - SbxPLUS, // this + var - SbxMINUS, // this - var - SbxNEG, // -this (var is ignored) - SbxIDIV, // this / var (both operands max. INT32!) - // Boolean operators (max INT32!): - SbxAND, // this & var - SbxOR, // this | var - SbxXOR, // this ^ var - SbxEQV, // ~this ^ var - SbxIMP, // ~this | var - SbxNOT, // ~this (var is ignored) - // String-concat: - SbxCAT, // this & var - // Comparisons: - SbxEQ, // this = var - SbxNE, // this <> var - SbxLT, // this < var - SbxGT, // this > var - SbxLE, // this <= var - SbxGE // this >= var + // Arithmetical: + SbxEXP, // this ^ var + SbxMUL, // this * var + SbxDIV, // this / var + SbxMOD, // this MOD var (max INT32!) + SbxPLUS, // this + var + SbxMINUS, // this - var + SbxNEG, // -this (var is ignored) + SbxIDIV, // this / var (max INT32!) + + // Boolean operators (TODO deprecate this limit: max INT32!) + SbxAND, // this & var + SbxOR, // this | var + SbxXOR, // this ^ var + SbxEQV, // ~this ^ var + SbxIMP, // ~this | var + SbxNOT, // ~this (var is ignored) + + // String concatenation: + SbxCAT, // this & var (VBA: this + var) + + // Comparisons: + SbxEQ, // this = var + SbxNE, // this <> var + SbxLT, // this < var + SbxGT, // this > var + SbxLE, // this <= var + SbxGE // this >= var }; #endif @@ -145,131 +154,100 @@ enum SbxOperator { #ifndef _SBX_NAME_TYPE #define _SBX_NAME_TYPE -enum SbxNameType { // Type of the questioned name of a variable - SbxNAME_NONE, // plain name - SbxNAME_SHORT, // Name(A,B) - SbxNAME_SHORT_TYPES, // Name%(A%,B$) - SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer +enum SbxNameType { // Type of the questioned name of a variable + SbxNAME_NONE, // plain name + SbxNAME_SHORT, // Name(A,B) + SbxNAME_SHORT_TYPES, // Name%(A%,B$) + SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer }; #endif // from 1996/3/20: New error messages -typedef ULONG SbxError; // Preserve old type +typedef ULONG SbxError; // Preserve old type #endif -// von #ifndef __RSC // New error codes per define -#define ERRCODE_SBX_OK ERRCODE_NONE // processed -#define ERRCODE_SBX_SYNTAX (1UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_COMPILER) // Syntaxerror in parser (where else could syntax errors happen? ;-) -#define ERRCODE_SBX_NOTIMP (2UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_NOTSUPPORTED) // not possible -#define ERRCODE_SBX_OVERFLOW (3UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_SBX) // overflow -#define ERRCODE_SBX_BOUNDS (4UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_SBX) // Invalid array index -#define ERRCODE_SBX_ZERODIV (5UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_SBX) // Division by zero -#define ERRCODE_SBX_CONVERSION (6UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_SBX) // wrong data type -#define ERRCODE_SBX_BAD_PARAMETER (7UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // invalid Parameter -#define ERRCODE_SBX_PROC_UNDEFINED (8UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // BASIC-Sub or Function undefined -#define ERRCODE_SBX_ERROR (9UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_UNKNOWN) // other object-related error -#define ERRCODE_SBX_NO_OBJECT (10UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // Object variable unassigned -#define ERRCODE_SBX_CANNOT_LOAD (11UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_CREATE) // Object cannot be loaded or initialized -#define ERRCODE_SBX_BAD_INDEX (12UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_SBX) // Invalid object index -#define ERRCODE_SBX_NO_ACTIVE_OBJECT (13UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_ACCESS) // Object is not activated -#define ERRCODE_SBX_BAD_PROP_VALUE (14UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // Bad property value -#define ERRCODE_SBX_PROP_READONLY (15UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_READ) // Property is read only -#define ERRCODE_SBX_PROP_WRITEONLY (16UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_WRITE) // Property is write only -#define ERRCODE_SBX_INVALID_OBJECT (17UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_ACCESS) // Invalid object reference -#define ERRCODE_SBX_NO_METHOD (18UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // Property oder Methode unbekannt -#define ERRCODE_SBX_INVALID_USAGE_OBJECT (19UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_ACCESS) // Invalid object usage -#define ERRCODE_SBX_NO_OLE (20UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_ACCESS) // No OLE-Object -#define ERRCODE_SBX_BAD_METHOD (21UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // Method not supported -#define ERRCODE_SBX_OLE_ERROR (22UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // OLE Automation Error -#define ERRCODE_SBX_BAD_ACTION (23UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_NOTSUPPORTED) // Action not supported -#define ERRCODE_SBX_NO_NAMED_ARGS (24UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // No named arguments -#define ERRCODE_SBX_BAD_LOCALE (25UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_NOTSUPPORTED) // Locale settings not supported -#define ERRCODE_SBX_NAMED_NOT_FOUND (26UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // Unknown named argument -#define ERRCODE_SBX_NOT_OPTIONAL (27UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // Argument not optional -#define ERRCODE_SBX_WRONG_ARGS (28UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_SBX) // Invalid number of arguments -#define ERRCODE_SBX_NOT_A_COLL (29UL | ERRCODE_AREA_SBX | \ - ERRCODE_CLASS_RUNTIME) // Object contains no elements -#define LAST_SBX_ERROR_ID 29UL - - -// Less important for resources +#define ERRCODE_SBX_OK ERRCODE_NONE // processed + +#define ERRCODE_SBX_SYNTAX (1UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_COMPILER) +#define ERRCODE_SBX_NOTIMP (2UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) +#define ERRCODE_SBX_OVERFLOW (3UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // overflow +#define ERRCODE_SBX_BOUNDS (4UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid array index +#define ERRCODE_SBX_ZERODIV (5UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Division by zero +#define ERRCODE_SBX_CONVERSION (6UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // wrong data type +#define ERRCODE_SBX_BAD_PARAMETER (7UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // invalid Parameter +#define ERRCODE_SBX_PROC_UNDEFINED (8UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Sub or Func not def +#define ERRCODE_SBX_ERROR (9UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_UNKNOWN) // generic object error +#define ERRCODE_SBX_NO_OBJECT (10UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object var not object +#define ERRCODE_SBX_CANNOT_LOAD (11UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_CREATE) // Object init/load fail +#define ERRCODE_SBX_BAD_INDEX (12UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid object index +#define ERRCODE_SBX_NO_ACTIVE_OBJECT (13UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Object not active +#define ERRCODE_SBX_BAD_PROP_VALUE (14UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Bad property value +#define ERRCODE_SBX_PROP_READONLY (15UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_READ) // Property is read only +#define ERRCODE_SBX_PROP_WRITEONLY (16UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_WRITE) // Property is write only +#define ERRCODE_SBX_INVALID_OBJECT (17UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object reference +#define ERRCODE_SBX_NO_METHOD (18UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Property oder Methode unbekannt +#define ERRCODE_SBX_INVALID_USAGE_OBJECT (19UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object usage +#define ERRCODE_SBX_NO_OLE (20UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // No OLE-Object +#define ERRCODE_SBX_BAD_METHOD (21UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Method not supported +#define ERRCODE_SBX_OLE_ERROR (22UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // OLE Automation Error +#define ERRCODE_SBX_BAD_ACTION (23UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Action not supported +#define ERRCODE_SBX_NO_NAMED_ARGS (24UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // No named arguments +#define ERRCODE_SBX_BAD_LOCALE (25UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Locale not supported +#define ERRCODE_SBX_NAMED_NOT_FOUND (26UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Unknown named argument +#define ERRCODE_SBX_NOT_OPTIONAL (27UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Argument not optional +#define ERRCODE_SBX_WRONG_ARGS (28UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid number of arguments +#define ERRCODE_SBX_NOT_A_COLL (29UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object contains no elements +#define LAST_SBX_ERROR_ID 29UL + #ifndef __RSC // Map old codes to new ones -#define SbxERR_OK ERRCODE_SBX_OK -#define SbxERR_SYNTAX ERRCODE_SBX_SYNTAX -#define SbxERR_NOTIMP ERRCODE_SBX_NOTIMP -#define SbxERR_OVERFLOW ERRCODE_SBX_OVERFLOW -#define SbxERR_BOUNDS ERRCODE_SBX_BOUNDS -#define SbxERR_ZERODIV ERRCODE_SBX_ZERODIV -#define SbxERR_CONVERSION ERRCODE_SBX_CONVERSION -#define SbxERR_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER -#define SbxERR_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED -#define SbxERR_ERROR ERRCODE_SBX_ERROR -#define SbxERR_NO_OBJECT ERRCODE_SBX_NO_OBJECT -#define SbxERR_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD -#define SbxERR_BAD_INDEX ERRCODE_SBX_BAD_INDEX -#define SbxERR_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT -#define SbxERR_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE -#define SbxERR_PROP_READONLY ERRCODE_SBX_PROP_READONLY -#define SbxERR_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY -#define SbxERR_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT -#define SbxERR_NO_METHOD ERRCODE_SBX_NO_METHOD -#define SbxERR_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT -#define SbxERR_NO_OLE ERRCODE_SBX_NO_OLE -#define SbxERR_BAD_METHOD ERRCODE_SBX_BAD_METHOD -#define SbxERR_OLE_ERROR ERRCODE_SBX_OLE_ERROR -#define SbxERR_BAD_ACTION ERRCODE_SBX_BAD_ACTION -#define SbxERR_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS -#define SbxERR_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE -#define SbxERR_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND -#define SbxERR_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL -#define SbxERR_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS -#define SbxERR_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL +#define SbxERR_OK ERRCODE_SBX_OK +#define SbxERR_SYNTAX ERRCODE_SBX_SYNTAX +#define SbxERR_NOTIMP ERRCODE_SBX_NOTIMP +#define SbxERR_OVERFLOW ERRCODE_SBX_OVERFLOW +#define SbxERR_BOUNDS ERRCODE_SBX_BOUNDS +#define SbxERR_ZERODIV ERRCODE_SBX_ZERODIV +#define SbxERR_CONVERSION ERRCODE_SBX_CONVERSION +#define SbxERR_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER +#define SbxERR_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED +#define SbxERR_ERROR ERRCODE_SBX_ERROR +#define SbxERR_NO_OBJECT ERRCODE_SBX_NO_OBJECT +#define SbxERR_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD +#define SbxERR_BAD_INDEX ERRCODE_SBX_BAD_INDEX +#define SbxERR_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT +#define SbxERR_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE +#define SbxERR_PROP_READONLY ERRCODE_SBX_PROP_READONLY +#define SbxERR_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY +#define SbxERR_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT +#define SbxERR_NO_METHOD ERRCODE_SBX_NO_METHOD +#define SbxERR_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT +#define SbxERR_NO_OLE ERRCODE_SBX_NO_OLE +#define SbxERR_BAD_METHOD ERRCODE_SBX_BAD_METHOD +#define SbxERR_OLE_ERROR ERRCODE_SBX_OLE_ERROR +#define SbxERR_BAD_ACTION ERRCODE_SBX_BAD_ACTION +#define SbxERR_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS +#define SbxERR_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE +#define SbxERR_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND +#define SbxERR_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL +#define SbxERR_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS +#define SbxERR_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL // Flag-Bits: -#define SBX_READ 0x0001 // Read permission -#define SBX_WRITE 0x0002 // Write permission -#define SBX_READWRITE 0x0003 // Read/Write permission -#define SBX_DONTSTORE 0x0004 // Don't store object -#define SBX_MODIFIED 0x0008 // Object was changed -#define SBX_FIXED 0x0010 // Fixed data type (SbxVariable) -#define SBX_CONST 0x0020 // Definition of const value -#define SBX_OPTIONAL 0x0040 // Parameter is optional -#define SBX_HIDDEN 0x0080 // Element is invisible +#define SBX_READ 0x0001 // Read permission +#define SBX_WRITE 0x0002 // Write permission +#define SBX_READWRITE 0x0003 // Read/Write permission +#define SBX_DONTSTORE 0x0004 // Don't store object +#define SBX_MODIFIED 0x0008 // Object was changed +#define SBX_FIXED 0x0010 // Fixed data type (SbxVariable) +#define SBX_CONST 0x0020 // Definition of const value +#define SBX_OPTIONAL 0x0040 // Parameter is optional +#define SBX_HIDDEN 0x0080 // Element is invisible #define SBX_INVISIBLE 0x0100 // Element is not found by Find() #define SBX_EXTSEARCH 0x0200 // Object is searched completely #define SBX_EXTFOUND 0x0400 // Variable was found through extended search @@ -291,7 +269,7 @@ typedef ULONG SbxError; // Preserve old type // List of all creators for Load/Store -#define SBXCR_SBX 0x20584253 // SBX(blank) +#define SBXCR_SBX 0x20584253 // SBX(blank) // List of predefined SBX-IDs. New SBX-IDs must be precisly defined so that // they are unique within the Stream and appropriate Factory. @@ -307,42 +285,48 @@ typedef ULONG SbxError; // Preserve old type #define SBXID_PROPERTY 0x5250 // PR: SbxProperty // StarBASIC restricts the base data type to different intervals. -// These intervals are fixed due to portability and independent +// These intervals are fixed to create 'portability and independent // of the implementation. Only type double is greedy and takes // what it gets. -#define SbxMAXCHAR ((sal_Unicode)65535) -#define SbxMINCHAR (0) -#define SbxMAXBYTE ( 255) -#define SbxMAXINT ( 32767) -#define SbxMININT (-32768) -#define SbxMAXUINT ((UINT16) 65535) -#define SbxMAXLNG ( 2147483647) -#define SbxMINLNG ((INT32)(-2147483647-1)) -#define SbxMAXULNG ((UINT32) 0xffffffff) +#define SbxMAXCHAR ((sal_Unicode)65535) +#define SbxMINCHAR (0) +#define SbxMAXBYTE ( 255) +#define SbxMAXINT ( 32767) +#define SbxMININT (-32768) +#define SbxMAXUINT ((UINT16) 65535) +#define SbxMAXLNG ( 2147483647) +#define SbxMINLNG ((INT32)(-2147483647-1)) +#define SbxMAXULNG ((UINT32) 0xffffffff) +#define SbxMAXSALUINT64 SAL_MAX_UINT64 #define SbxMAXSALINT64 SAL_MAX_INT64 #define SbxMINSALINT64 SAL_MIN_INT64 -#define SbxMAXSALUINT64 SAL_MAX_UINT64 -#define SbxMAXSNG ( 3.402823e+38) -#define SbxMINSNG (-3.402823e+38) -#define SbxMAXSNG2 ( 1.175494351e-38) -#define SbxMINSNG2 (-1.175494351e-38) -#define SbxMAXCURR ( 922337203685477.5807) -#define SbxMINCURR (-922337203685477.5808) -#define CURRENCY_FACTOR 10000 -#define SbxMAXCURRLNG (SbxMAXLNG/CURRENCY_FACTOR) -#define SbxMINCURRLNG (SbxMINLNG/CURRENCY_FACTOR) + // Currency stored as SbxSALINT64 == sal_Int64 + // value range limits are ~(2^63 - 1)/10000 + // fixed precision has 4 digits right of decimal pt +#define CURRENCY_FACTOR (10000) +#define CURRENCY_FACTOR_SQUARE (100000000) + +// TODO effective MAX/MINCURR limits: +// true value ( 922337203685477.5807) is too precise for correct comparison to 64bit double +#define SbxMAXCURR ( 922337203685477.5807) +#define SbxMINCURR (-922337203685477.5808) + +#define SbxMAXSNG ( 3.402823e+38) +#define SbxMINSNG (-3.402823e+38) +#define SbxMAXSNG2 ( 1.175494351e-38) +#define SbxMINSNG2 (-1.175494351e-38) // Max valid offset index of a Sbx-Array (due to 64K limit) -#define SBX_MAXINDEX 0x3FF0 -#define SBX_MAXINDEX32 SbxMAXLNG +#define SBX_MAXINDEX 0x3FF0 +#define SBX_MAXINDEX32 SbxMAXLNG + -// The numeric values of TRUE and FALSE enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 }; -#endif // __RSC +#endif //ifndef __RSC #endif diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx index f1af839f2471..1e7840950fd7 100644 --- a/basic/inc/basic/sbxvar.hxx +++ b/basic/inc/basic/sbxvar.hxx @@ -34,169 +34,47 @@ #include <com/sun/star/bridge/oleautomation/Decimal.hpp> #include <basic/sbxcore.hxx> -#ifndef __SBX_64 -#define __SBX_64 - -struct SbxINT64 -{ - INT32 nHigh; UINT32 nLow; - -#if FALSE - SbxINT64() : nHigh( 0 ), nLow( 0 ) {} - SbxINT64( UINT8 n ) : nHigh( 0 ), nLow( n ) {} - SbxINT64( UINT16 n ) : nHigh( 0 ), nLow( n ) {} - SbxINT64( UINT32 n ) : nHigh( 0 ), nLow( n ) {} - SbxINT64( unsigned int n ) : nHigh( 0 ), nLow( n ) {} - SbxINT64( INT8 n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {} - SbxINT64( INT16 n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {} - SbxINT64( INT32 n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {} - SbxINT64( int n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {} - SbxINT64( SbxINT64 &r ) : nHigh( r.nHigh ), nLow( r.nLow ) {} - - SbxINT64( BigInt &r ); - SbxINT64( double n ); -#endif - void CHS() - { - nLow ^= (UINT32)-1; - nHigh ^= -1; - nLow++; - if( !nLow ) - nHigh++; - } - - // blc/os2i do not like operator = - void Set(double n) - { - if( n >= 0 ) - { - nHigh = (INT32)(n / (double)4294967296.0); - nLow = (UINT32)(n - ((double)nHigh * (double)4294967296.0) + 0.5); - } - else { - nHigh = (INT32)(-n / (double)4294967296.0); - nLow = (UINT32)(-n - ((double)nHigh * (double)4294967296.0) + 0.5); - CHS(); - } - } - void Set(INT32 n) { nHigh = n < 0 ? -1 : 0; nLow = n; } - - void SetMax() { nHigh = 0x7FFFFFFF; nLow = 0xFFFFFFFF; } - void SetMin() { nHigh = 0x80000000; nLow = 0x00000000; } - void SetNull() { nHigh = 0x00000000; nLow = 0x00000000; } - - int operator ! () const { return !nHigh && !nLow; } - - SbxINT64 &operator -= ( const SbxINT64 &r ); - SbxINT64 &operator += ( const SbxINT64 &r ); - SbxINT64 &operator /= ( const SbxINT64 &r ); - SbxINT64 &operator %= ( const SbxINT64 &r ); - SbxINT64 &operator *= ( const SbxINT64 &r ); - SbxINT64 &operator &= ( const SbxINT64 &r ); - SbxINT64 &operator |= ( const SbxINT64 &r ); - SbxINT64 &operator ^= ( const SbxINT64 &r ); - - friend SbxINT64 operator - ( const SbxINT64 &l, const SbxINT64 &r ); - friend SbxINT64 operator + ( const SbxINT64 &l, const SbxINT64 &r ); - friend SbxINT64 operator / ( const SbxINT64 &l, const SbxINT64 &r ); - friend SbxINT64 operator % ( const SbxINT64 &l, const SbxINT64 &r ); - friend SbxINT64 operator * ( const SbxINT64 &l, const SbxINT64 &r ); - friend SbxINT64 operator & ( const SbxINT64 &l, const SbxINT64 &r ); - friend SbxINT64 operator | ( const SbxINT64 &l, const SbxINT64 &r ); - friend SbxINT64 operator ^ ( const SbxINT64 &l, const SbxINT64 &r ); - - friend SbxINT64 operator - ( const SbxINT64 &r ); - friend SbxINT64 operator ~ ( const SbxINT64 &r ); - - static double GetMin() { return ((double)0x7FFFFFFF*(double)4294967296.0 - + (double)0xFFFFFFFF) - / CURRENCY_FACTOR; } - static double GetMax() { return ((double)0x80000000*(double)4294967296.0 - + (double)0xFFFFFFFF) - / CURRENCY_FACTOR; } -}; - -struct SbxUINT64 -{ - UINT32 nHigh; UINT32 nLow; - void Set(double n) - { - nHigh = (UINT32)(n / (double)4294967296.0); - nLow = (UINT32)(n - ((double)nHigh * (double)4294967296.0)); - } - - void Set(UINT32 n) { nHigh = 0; nLow = n; } - - void SetMax() { nHigh = 0xFFFFFFFF; nLow = 0xFFFFFFFF; } - void SetMin() { nHigh = 0x00000000; nLow = 0x00000000; } - void SetNull() { nHigh = 0x00000000; nLow = 0x00000000; } - - int operator ! () const { return !nHigh && !nLow; } - - SbxUINT64 &operator -= ( const SbxUINT64 &r ); - SbxUINT64 &operator += ( const SbxUINT64 &r ); - SbxUINT64 &operator /= ( const SbxUINT64 &r ); - SbxUINT64 &operator %= ( const SbxUINT64 &r ); - SbxUINT64 &operator *= ( const SbxUINT64 &r ); - SbxUINT64 &operator &= ( const SbxUINT64 &r ); - SbxUINT64 &operator |= ( const SbxUINT64 &r ); - SbxUINT64 &operator ^= ( const SbxUINT64 &r ); - - friend SbxUINT64 operator - ( const SbxUINT64 &l, const SbxUINT64 &r ); - friend SbxUINT64 operator + ( const SbxUINT64 &l, const SbxUINT64 &r ); - friend SbxUINT64 operator / ( const SbxUINT64 &l, const SbxUINT64 &r ); - friend SbxUINT64 operator % ( const SbxUINT64 &l, const SbxUINT64 &r ); - friend SbxUINT64 operator * ( const SbxUINT64 &l, const SbxUINT64 &r ); - friend SbxUINT64 operator & ( const SbxUINT64 &l, const SbxUINT64 &r ); - friend SbxUINT64 operator | ( const SbxUINT64 &l, const SbxUINT64 &r ); - friend SbxUINT64 operator ^ ( const SbxUINT64 &l, const SbxUINT64 &r ); - - friend SbxUINT64 operator ~ ( const SbxUINT64 &r ); -}; - -#endif - #ifndef __SBX_SBXVALUES_HXX #define __SBX_SBXVALUES_HXX -class BigInt; class SbxDecimal; struct SbxValues { union { - sal_Unicode nChar; BYTE nByte; - INT16 nInteger; - INT32 nLong; UINT16 nUShort; + sal_Unicode nChar; + INT16 nInteger; UINT32 nULong; + INT32 nLong; + unsigned int nUInt; + int nInt; + sal_uInt64 uInt64; + sal_Int64 nInt64; + float nSingle; double nDouble; - SbxINT64 nLong64; - SbxUINT64 nULong64; - sal_Int64 nInt64; - sal_uInt64 uInt64; - int nInt; - unsigned int nUInt; - ::rtl::OUString* pOUString; + + rtl::OUString* pOUString; SbxDecimal* pDecimal; SbxBase* pObj; - sal_Unicode* pChar; + BYTE* pByte; - INT16* pInteger; - INT32* pLong; UINT16* pUShort; + sal_Unicode* pChar; + INT16* pInteger; UINT32* pULong; + INT32* pLong; + unsigned int* pUInt; + int* pInt; + sal_uInt64* puInt64; + sal_Int64* pnInt64; + float* pSingle; double* pDouble; - SbxINT64* pLong64; - SbxUINT64* pULong64; - sal_Int64* pnInt64; - sal_uInt64* puInt64; - int* pInt; - unsigned int* pUInt; + void* pData; }; SbxDataType eType; @@ -209,15 +87,15 @@ struct SbxValues SbxValues( long _nLong ): nLong( _nLong ), eType(SbxLONG) {} SbxValues( USHORT _nUShort ): nUShort( _nUShort ), eType(SbxUSHORT) {} SbxValues( ULONG _nULong ): nULong( _nULong ), eType(SbxULONG) {} - SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {} - SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {} SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {} SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {} + SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {} + SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {} SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {} SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {} SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {} SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {} - SbxValues( const BigInt &rBig ); + }; #endif @@ -255,28 +133,28 @@ public: virtual void Clear(); virtual BOOL IsFixed() const; - BOOL IsInteger() const { return BOOL( GetType() == SbxINTEGER ); } - BOOL IsLong() const { return BOOL( GetType() == SbxLONG ); } - BOOL IsSingle() const { return BOOL( GetType() == SbxSINGLE ); } - BOOL IsDouble() const { return BOOL( GetType() == SbxDOUBLE ); } - BOOL IsString() const { return BOOL( GetType() == SbxSTRING ); } - BOOL IsDate() const { return BOOL( GetType() == SbxDATE ); } - BOOL IsCurrency()const { return BOOL( GetType() == SbxCURRENCY ); } - BOOL IsObject() const { return BOOL( GetType() == SbxOBJECT ); } - BOOL IsDataObject()const{return BOOL( GetType() == SbxDATAOBJECT);} - BOOL IsBool() const { return BOOL( GetType() == SbxBOOL ); } - BOOL IsErr() const { return BOOL( GetType() == SbxERROR ); } - BOOL IsEmpty() const { return BOOL( GetType() == SbxEMPTY ); } - BOOL IsNull() const { return BOOL( GetType() == SbxNULL ); } - BOOL IsChar() const { return BOOL( GetType() == SbxCHAR ); } - BOOL IsByte() const { return BOOL( GetType() == SbxBYTE ); } - BOOL IsUShort() const { return BOOL( GetType() == SbxUSHORT ); } - BOOL IsULong() const { return BOOL( GetType() == SbxULONG ); } - BOOL IsInt() const { return BOOL( GetType() == SbxINT ); } - BOOL IsUInt() const { return BOOL( GetType() == SbxUINT ); } - BOOL IspChar() const { return BOOL( GetType() == SbxLPSTR ); } - BOOL IsNumeric() const; - BOOL IsNumericRTL() const; // #41692 Interface for Basic + BOOL IsInteger() const { return BOOL( GetType() == SbxINTEGER ); } + BOOL IsLong() const { return BOOL( GetType() == SbxLONG ); } + BOOL IsSingle() const { return BOOL( GetType() == SbxSINGLE ); } + BOOL IsDouble() const { return BOOL( GetType() == SbxDOUBLE ); } + BOOL IsString() const { return BOOL( GetType() == SbxSTRING ); } + BOOL IsDate() const { return BOOL( GetType() == SbxDATE ); } + BOOL IsCurrency() const { return BOOL( GetType() == SbxCURRENCY ); } + BOOL IsObject() const { return BOOL( GetType() == SbxOBJECT ); } + BOOL IsDataObject() const { return BOOL( GetType() == SbxDATAOBJECT);} + BOOL IsBool() const { return BOOL( GetType() == SbxBOOL ); } + BOOL IsErr() const { return BOOL( GetType() == SbxERROR ); } + BOOL IsEmpty() const { return BOOL( GetType() == SbxEMPTY ); } + BOOL IsNull() const { return BOOL( GetType() == SbxNULL ); } + BOOL IsChar() const { return BOOL( GetType() == SbxCHAR ); } + BOOL IsByte() const { return BOOL( GetType() == SbxBYTE ); } + BOOL IsUShort() const { return BOOL( GetType() == SbxUSHORT ); } + BOOL IsULong() const { return BOOL( GetType() == SbxULONG ); } + BOOL IsInt() const { return BOOL( GetType() == SbxINT ); } + BOOL IsUInt() const { return BOOL( GetType() == SbxUINT ); } + BOOL IspChar() const { return BOOL( GetType() == SbxLPSTR ); } + BOOL IsNumeric() const; + BOOL IsNumericRTL() const; // #41692 Interface for Basic BOOL ImpIsNumeric( BOOL bOnlyIntntl ) const; // Implementation virtual SbxClassType GetClass() const; @@ -291,61 +169,70 @@ public: inline SbxValues * data() { return &aData; } - SbxINT64 GetCurrency() const; - SbxINT64 GetLong64() const; - SbxUINT64 GetULong64() const; - sal_Int64 GetInt64() const; - sal_uInt64 GetUInt64() const; - INT16 GetInteger() const; - INT32 GetLong() const; - float GetSingle() const; - double GetDouble() const; - double GetDate() const; - BOOL GetBool() const; - UINT16 GetErr() const; - const String& GetString() const; - const String& GetCoreString() const; - ::rtl::OUString GetOUString() const; - SbxDecimal* GetDecimal() const; - SbxBase* GetObject() const; - BOOL HasObject() const; - void* GetData() const; + UINT16 GetErr() const; + + BOOL GetBool() const; + BYTE GetByte() const; sal_Unicode GetChar() const; - BYTE GetByte() const; - UINT16 GetUShort() const; - UINT32 GetULong() const; - int GetInt() const; - - BOOL PutCurrency( const SbxINT64& ); - BOOL PutLong64( const SbxINT64& ); - BOOL PutULong64( const SbxUINT64& ); - BOOL PutInt64( sal_Int64 ); - BOOL PutUInt64( sal_uInt64 ); + UINT16 GetUShort() const; + UINT32 GetULong() const; + int GetInt() const; + INT16 GetInteger() const; + INT32 GetLong() const; + sal_Int64 GetInt64() const; + sal_uInt64 GetUInt64() const; + + sal_Int64 GetCurrency() const; + SbxDecimal* GetDecimal() const; + + float GetSingle() const; + double GetDouble() const; + double GetDate() const; + + const String& GetString() const; + const String& GetCoreString() const; + rtl::OUString GetOUString() const; + + SbxBase* GetObject() const; + BOOL HasObject() const; + void* GetData() const; + + + BOOL PutEmpty(); + BOOL PutNull(); + BOOL PutErr( USHORT ); + + BOOL PutBool( BOOL ); + BOOL PutByte( BYTE ); + BOOL PutChar( sal_Unicode ); + BOOL PutUShort( UINT16 ); + BOOL PutULong( UINT32 ); + BOOL PutInt( int ); BOOL PutInteger( INT16 ); BOOL PutLong( INT32 ); + BOOL PutInt64( sal_Int64 ); + BOOL PutUInt64( sal_uInt64 ); + BOOL PutSingle( float ); BOOL PutDouble( double ); BOOL PutDate( double ); - BOOL PutBool( BOOL ); - BOOL PutErr( USHORT ); - BOOL PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "TRUE"/"FALSE") + + // with extended analysis (International, "TRUE"/"FALSE") + BOOL PutStringExt( const ::rtl::OUString& ); BOOL PutString( const ::rtl::OUString& ); BOOL PutString( const sal_Unicode* ); // Type = SbxSTRING BOOL PutpChar( const sal_Unicode* ); // Type = SbxLPSTR - BOOL PutDecimal( SbxDecimal* pDecimal ); - BOOL PutObject( SbxBase* ); - BOOL PutData( void* ); - BOOL PutChar( sal_Unicode ); - BOOL PutByte( BYTE ); - BOOL PutUShort( UINT16 ); - BOOL PutULong( UINT32 ); - BOOL PutInt( int ); - BOOL PutEmpty(); - BOOL PutNull(); - // Special decimal methods + // Special methods BOOL PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); BOOL fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); + BOOL PutDecimal( SbxDecimal* pDecimal ); + BOOL PutCurrency( const sal_Int64& ); + // Interface for CDbl in Basic + static SbxError ScanNumIntnl( const String& rSrc, double& nVal, BOOL bSingle=FALSE ); + + BOOL PutObject( SbxBase* ); + BOOL PutData( void* ); virtual BOOL Convert( SbxDataType ); virtual BOOL Compute( SbxOperator, const SbxValue& ); @@ -353,12 +240,9 @@ public: BOOL Scan( const String&, USHORT* = NULL ); void Format( String&, const String* = NULL ) const; - // Interface for CDbl in Basic - static SbxError ScanNumIntnl( const String& rSrc, double& nVal, BOOL bSingle=FALSE ); - // The following operators are definied for easier handling. - // Error conditions (overflow, conversions) are not - // taken into consideration. + // TODO: Ensure error conditions (overflow, conversions) + // are taken into consideration in Compute and Compare inline int operator ==( const SbxValue& ) const; inline int operator !=( const SbxValue& ) const; @@ -446,7 +330,7 @@ class SbxVariable : public SbxValue friend class SbMethod; SbxVariableImpl* mpSbxVariableImpl; // Impl data - SfxBroadcaster* pCst; // Broadcaster, if needed + SfxBroadcaster* pCst; // Broadcaster, if needed String maName; // Name, if available SbxArrayRef mpPar; // Parameter-Array, if set USHORT nHash; // Hash-ID for search |