Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi Korrawit, On Tuesday, 2011-09-06 21:52:46 +0700, Korrawit Pruegsanusak wrote: And please s/interger/integer ;) Did that in the commit. Also, it seems that you haven't check the range of ishift yet, whether it is between -48 and 48 (from your description), or it isn't necessary? I don't have knowledge on this. Actually those don't have to be restricted and I implemented another algorithm to support larger values. My last nitpick, what about the strings capitalization? Also did that. Eike -- PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication. Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD signature.asc Description: Digital signature ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi Olivier, On Sunday, 2011-09-04 16:42:38 -0300, Olivier Hallot wrote: If pushed, these new functions should be advertised in the Release notes. What's the procedure for that? Eike -- PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication. Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD signature.asc Description: Digital signature ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi Regina, On Wednesday, 2011-09-07 15:04:47 +0200, Regina Henschel wrote: I see a lot of sal_uInt64 in the code. Is that supported for Windows? As far as I know at least the MSVC Express has only 4Byte long. Umm.. now that you mention.. sal/inc/sal/types.h has #if (_MSC_VER = 1000) typedef __int64 sal_Int64; typedef unsigned __int64 sal_uInt64; so what evaluates _MSC_VER to in MSVCE? Also noticing there #define SAL_CONST_UINT64(x) x##ui64 so the constant I introduced probably should use that. If MSVCE doesn't support 64bit values I might do some tricks using the double mantissa. Eike -- PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication. Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD signature.asc Description: Digital signature ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
On 09/07/2011 04:37 PM, Eike Rathke wrote: Hi Regina, On Wednesday, 2011-09-07 15:04:47 +0200, Regina Henschel wrote: I see a lot of sal_uInt64 in the code. Is that supported for Windows? As far as I know at least the MSVC Express has only 4Byte long. Umm.. now that you mention.. sal/inc/sal/types.h has #if (_MSC_VER= 1000) typedef __int64 sal_Int64; typedef unsigned __int64 sal_uInt64; so what evaluates _MSC_VER to in MSVCE? Also noticing there #define SAL_CONST_UINT64(x) x##ui64 so the constant I introduced probably should use that. If MSVCE doesn't support 64bit values I might do some tricks using the double mantissa. But we use sal_[u]Int64 all over the code base, and the default case in sal/types.h (to typedef it to a struct of smaller ints) is long gone, so I would assume _MSC_VER=1000 really means any _MSC_VER here. -Stephan ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Visual Studio has supported 64-bit int types (long long) since at least Visual Studio 2005. See here: http://msdn.microsoft.com/en-us/library/s3f49ktz(v=vs.80).aspx http://msdn.microsoft.com/en-us/library/s3f49ktz%28v=vs.80%29.aspx _MSC_VER evaluates to the version of the Visual Studio compiler. See here: http://msdn.microsoft.com/en-us/library/b0084kay(v=VS.80).aspx http://msdn.microsoft.com/en-us/library/b0084kay%28v=VS.80%29.aspx Eike Rathke wrote: Hi Regina, On Wednesday, 2011-09-07 15:04:47 +0200, Regina Henschel wrote: I see a lot of sal_uInt64 in the code. Is that supported for Windows? As far as I know at least the MSVC Express has only 4Byte long. Umm.. now that you mention.. sal/inc/sal/types.h has #if (_MSC_VER = 1000) typedef __int64 sal_Int64; typedef unsigned __int64 sal_uInt64; so what evaluates _MSC_VER to in MSVCE? Also noticing there #define SAL_CONST_UINT64(x) x##ui64 so the constant I introduced probably should use that. If MSVCE doesn't support 64bit values I might do some tricks using the double mantissa. Eike ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice Disclaimer: http://www.peralex.com/disclaimer.html ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi Eike, Eike Rathke schrieb: Hi Regina, On Wednesday, 2011-09-07 15:04:47 +0200, Regina Henschel wrote: I see a lot of sal_uInt64 in the code. Is that supported for Windows? As far as I know at least the MSVC Express has only 4Byte long. Umm.. now that you mention.. sal/inc/sal/types.h has #if (_MSC_VER= 1000) typedef __int64 sal_Int64; typedef unsigned __int64 sal_uInt64; so what evaluates _MSC_VER to in MSVCE? How can I get that information? In Env.Host.sh I get the lines: SIZEOF_SHORT=2 SIZEOF_INT=4 SIZEOF_LONG=4 SIZEOF_LONGLONG=8 SIZEOF_POINTER=4 Kind regards Regina ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hmm,MSC_VER 1600 is VC++ 2010 1500 is VC++ 2008 I don't have any older versions installed at the moment. (The enclosed program I used to find these has CRLF for newlines and probably no tabs.) - Dennis -Original Message- From: libreoffice-bounces+dennis.hamilton=acm@lists.freedesktop.org [mailto:libreoffice-bounces+dennis.hamilton=acm@lists.freedesktop.org] On Behalf Of Regina Henschel Sent: Wednesday, September 07, 2011 07:58 To: Korrawit Pruegsanusak; l...@pechlaner.at; Thorsten Behrens; libreoffice@lists.freedesktop.org Subject: Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2 Hi Eike, Eike Rathke schrieb: Hi Regina, On Wednesday, 2011-09-07 15:04:47 +0200, Regina Henschel wrote: I see a lot of sal_uInt64 in the code. Is that supported for Windows? As far as I know at least the MSVC Express has only 4Byte long. Umm.. now that you mention.. sal/inc/sal/types.h has #if (_MSC_VER= 1000) typedef __int64 sal_Int64; typedef unsigned __int64 sal_uInt64; so what evaluates _MSC_VER to in MSVCE? How can I get that information? In Env.Host.sh I get the lines: SIZEOF_SHORT=2 SIZEOF_INT=4 SIZEOF_LONG=4 SIZEOF_LONGLONG=8 SIZEOF_POINTER=4 Kind regards Regina ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice /* showdefs.c Program to report the compiler definitions that were set when *it was compiled. * *1.00 2005-09-13-16:09 This programs uses preprocessor tricks to see * what the settings of possibly pre-defined macros are. *1.01 2005-09-13-22:43 correct the number of underscores in front of * cplusplus and MSVC_RUNTIME_CHECKS *1.10 2005-09-14-07:48 Put in some conditional code around the pragma * and add information for compiling as either C, C++, and C++ * without exception handling to show the differences in the * settings that the compiler figures out from the name of the * source program. Add more documentation inspired by my * long-distance pair-programming buddy Bill Anderson's running this * against GCC. * * $Header: /MyProjects/ShowDefs/showdefs.c 1 06-03-23 9:07 Orcmid $ */ #include stdio.h /* for printf() */ #include string.h /* for strlen() */ #define TV(X) #X /* Always produce a string, even when X is empty */ #define SHOW(X, SP) printf(SP #X %s\n, \ ( tv = TV(X), \ strlen(tv) == 0 \ ? is defined \ : strcmp(tv, #X) == 0 \ ? undefined \ : TV(is defined to X) ) ) #ifdef _MSC_VER #pragma warning(disable: 4003) /* Do not warn about TV(x) when not enough parameters (i.e., x empty) */ #endif int main() {/* Report predefined macros that may be set by default in this compiler. */ char *tv; /* pointer to the token value string */ printf(\nshowdef 1.10 Check for documented pre-processor macros); printf(\n that might be predefined in this compile.\n); printf(\n Supported ANSI/ISO Macros:\n); SHOW(__DATE__, ); SHOW(__FILE__, ); SHOW(__LINE__, ); SHOW(__STDC__, ); SHOW(__TIME__, ); printf(\n Supported (VC++?) reflection support:\n); SHOW(__COUNTER__, ); SHOW(__cplusplus, ); SHOW(__FUNCTION__, ); SHOW(__FUNCDNAME__,); SHOW(__FUNCSIG__, ); SHOW(__TIMESTAMP__,); printf(\n VC++ MS-Specific Macros:\n); SHOW(_ATL_VER, ); SHOW(_CHAR_UNSIGNED, ); SHOW(_CPPLIB_VER, ); SHOW(_CPPRTTI, ); SHOW(_CPPUNWIND, ); SHOW(_DEBUG, ); SHOW(_DLL, ); SHOW(_M_ALPHA, ); SHOW(_M_IA64, ); SHOW(_M_IX86, ); SHOW(_M_MPPC, ); SHOW(_M_MRX000,); SHOW(_M_PPC, ); SHOW(_MANAGED, ); SHOW(_MFC_VER, ); SHOW(_MSC_EXTENSIONS, ); SHOW(_MSC_VER, ); SHOW(__MSVC_RUNTIME_CHECKS,); SHOW(_MT, ); SHOW(_NATIVE_WCHAR_T_DEFINED, ); SHOW(_WCHAR_T_DEFINED, ); SHOW(_WIN32, ); SHOW(_WIN64, ); printf(\n And some favorites when compiling Windows code:\n); SHOW(_INC_WINDOWS
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Um, of course, having 64 bit integers and having the bit-wise functions work on them at full width is a bit different. Easy to test though. The Visual C++ Express Editions have had the same 64-bit (long long) support as the full-up Visual Studio Professional editions, etc., since the first (Visual C++ Express Edition 2005). - Dennis -Original Message- From: libreoffice-bounces+dennis.hamilton=acm@lists.freedesktop.org [mailto:libreoffice-bounces+dennis.hamilton=acm@lists.freedesktop.org] On Behalf Of Noel Grandin Sent: Wednesday, September 07, 2011 07:49 To: Regina Henschel; Korrawit Pruegsanusak; l...@pechlaner.at; Thorsten Behrens; libreoffice@lists.freedesktop.org Subject: Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2 Visual Studio has supported 64-bit int types (long long) since at least Visual Studio 2005. See here: http://msdn.microsoft.com/en-us/library/s3f49ktz(v=vs.80).aspx http://msdn.microsoft.com/en-us/library/s3f49ktz%28v=vs.80%29.aspx _MSC_VER evaluates to the version of the Visual Studio compiler. See here: http://msdn.microsoft.com/en-us/library/b0084kay(v=VS.80).aspx http://msdn.microsoft.com/en-us/library/b0084kay%28v=VS.80%29.aspx Eike Rathke wrote: Hi Regina, On Wednesday, 2011-09-07 15:04:47 +0200, Regina Henschel wrote: I see a lot of sal_uInt64 in the code. Is that supported for Windows? As far as I know at least the MSVC Express has only 4Byte long. Umm.. now that you mention.. sal/inc/sal/types.h has #if (_MSC_VER = 1000) typedef __int64 sal_Int64; typedef unsigned __int64 sal_uInt64; so what evaluates _MSC_VER to in MSVCE? Also noticing there #define SAL_CONST_UINT64(x) x##ui64 so the constant I introduced probably should use that. If MSVCE doesn't support 64bit values I might do some tricks using the double mantissa. Eike ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice Disclaimer: http://www.peralex.com/disclaimer.html ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi Dennis, Dennis E. Hamilton schrieb: Um, of course, having 64 bit integers and having the bit-wise functions work on them at full width is a bit different. Easy to test though. The Visual C++ Express Editions have had the same 64-bit (long long) support as the full-up Visual Studio Professional editions, etc., since the first (Visual C++ Express Edition 2005). Thanks, I didn't know, that is works in Express Editions too. When my build is finished, I can try the new functions nevertheless and report, if I get an error. Kind regards Regina ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi Eike Well... no specific procedure, except to edit the wiki as I did (just to not forget it): http://wiki.documentfoundation.org/ReleaseNotes/3.5#Calc Olivier Em 07-09-2011 09:51, Eike Rathke escreveu: Hi Olivier, On Sunday, 2011-09-04 16:42:38 -0300, Olivier Hallot wrote: If pushed, these new functions should be advertised in the Release notes. What's the procedure for that? Eike -- Olivier Hallot Founder, Steering Commitee Member - The Document Foundation Voicing the enterprise needs LibreOffice translation leader for Brazilian Portuguese +55-21-8822-8812 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Visual Studio has supported 64-bit int types (long long) since at least Visual Studio 2005. Isn't __int64 (and unsigned __int64) the more traditional name for the 64-bit integer types in MSVC? long long is newer in MSVC; in other compilers it is of course the normal one. --tml ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi Olivier, On Wednesday, 2011-09-07 15:59:29 -0300, Olivier Hallot wrote: Well... no specific procedure, except to edit the wiki as I did (just to not forget it): http://wiki.documentfoundation.org/ReleaseNotes/3.5#Calc Thanks, just needed a pointer.. Eike -- PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication. Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD signature.asc Description: Digital signature ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi Regina, On Wednesday, 2011-09-07 16:58:04 +0200, Regina Henschel wrote: so what evaluates _MSC_VER to in MSVCE? How can I get that information? In Env.Host.sh I get the lines: SIZEOF_LONGLONG=8 I think if long long is supported to be 8 bytes we can safely assume that the typedef of sal_uInt64 does the right thing :) And as Stephan mentioned, we already use it all over the place. Eike -- PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication. Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD signature.asc Description: Digital signature ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi Wonderful, great stuff - I have to apologize, the many whitespace changes in the calc part of the patch are because of my substandard mentoring - cleaned-up version of the first patch attached. I was in the belief that we shall use spaces instead of tabs. Corrected patches attached. -- RN From 9536eed6be175243f9e55f5715d1fb784a6f5f4f Mon Sep 17 00:00:00 2001 From: Wolfgang Pechlaner l...@pechlaner.at Date: Sun, 4 Sep 2011 14:40:25 +0200 Subject: [PATCH] BITxxx functions for ODF 1.2 --- sc/inc/helpids.h |5 + sc/qa/unit/ucalc.cxx |5 + sc/source/core/inc/interpre.hxx |5 + sc/source/core/tool/interpr1.cxx | 101 sc/source/core/tool/interpr4.cxx |5 + sc/source/ui/src/scfuncs.src | 156 ++ sc/util/hidother.src |5 + 7 files changed, 282 insertions(+), 0 deletions(-) diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index c80dd1b..b04aa77 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -692,3 +692,8 @@ #define HID_FUNC_UNICODESC_HID_FUNC_UNICODE #define HID_FUNC_UNICHARSC_HID_FUNC_UNICHAR #define HID_FUNC_NUMBERVALUESC_HID_FUNC_NUMBERVALUE +#define HID_FUNC_BITAND SC_HID_FUNC_BITAND +#define HID_FUNC_BITOR SC_HID_FUNC_BITOR +#define HID_FUNC_BITXOR SC_HID_FUNC_BITXOR +#define HID_FUNC_BITLSHIFT SC_HID_FUNC_BITLSHIFT +#define HID_FUNC_BITRSHIFT SC_HID_FUNC_BITRSHIFT diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 7430a60..533fbe2 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1742,6 +1742,11 @@ void Test::testFunctionLists() const char* aLogical[] = { AND, +BITAND, +BITLSHIFT, +BITOR, +BITRSHIFT, +BITXOR, FALSE, IF, NOT, diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 27027d5..50881d6 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -412,6 +412,11 @@ void ScAnd(); void ScOr(); void ScNot(); void ScNeg(); +void ScBitAnd(); +void ScBitOr(); +void ScBitXor(); +void ScBitRshift(); +void ScBitLshift(); void ScPercentSign(); void ScIntersect(); void ScRangeFunc(); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index f581ac7..3921e0e 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -1391,6 +1391,107 @@ void ScInterpreter::ScNeg() } +void ScInterpreter::ScBitAnd() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitAnd ); + +if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; + + double num1, num2; + num1 = GetDouble(); + num2 = GetDouble(); + if ((num1 281474976710655) or (num1 0) or + (num2 281474976710655) or (num2 0)) { +PushIllegalArgument(); + } + + PushDouble ((sal_uInt64) num1 (sal_uInt64) num2); +} + + +void ScInterpreter::ScBitOr() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitOr ); + + if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; + +double num1, num2; +num1 = GetDouble(); +num2 = GetDouble(); +if ((num1 281474976710655) or (num1 0) or +(num2 281474976710655) or (num2 0)) { + PushIllegalArgument(); +} + +PushDouble ((sal_uInt64) num1 | (sal_uInt64) num2); +} + + +void ScInterpreter::ScBitXor() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitXor ); + +if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; + +double num1, num2; +num1 = GetDouble(); +num2 = GetDouble(); +if ((num1 281474976710655) or (num1 0) or +(num2 281474976710655) or (num2 0)) { + PushIllegalArgument(); +} + +PushDouble ((sal_uInt64) num1 ^ (sal_uInt64) num2); +} + + +void ScInterpreter::ScBitLshift() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitLshift ); + +if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; + +sal_uInt64 erg; +sal_Int32 ishift = GetDouble(); +double num = GetDouble(); +if ((num 281474976710655) or (num 0)) { +PushIllegalArgument(); +} +if (ishift 0) { + erg = (sal_uInt64) num -ishift; +} else { + erg = (sal_uInt64) num ishift; +} +PushDouble (erg); +} + +void ScInterpreter::ScBitRshift() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitRshift ); + +if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; +sal_uInt64 erg; +sal_Int32 ishift = GetDouble(); +double num = GetDouble(); +if ((num 281474976710655)
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hello all, On Tue, Sep 6, 2011 at 20:08, Niko Rönkkö niko.ron...@wippies.fi wrote: Hi Wonderful, great stuff - I have to apologize, the many whitespace changes in the calc part of the patch are because of my substandard mentoring - cleaned-up version of the first patch attached. I was in the belief that we shall use spaces instead of tabs. Corrected patches attached. And please s/interger/integer ;) Also, it seems that you haven't check the range of ishift yet, whether it is between -48 and 48 (from your description), or it isn't necessary? I don't have knowledge on this. My last nitpick, what about the strings capitalization? Best Regards, -- Korrawit Pruegsanusak ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
l...@pechlaner.at wrote: I've made the new Functions BITAND, BITOR, BITXOR BITRSHIFT and BITLSHIFT,, how declared in the ODF 1.2 specification. Can anyone have a look on this Patches. Wonderful, great stuff - I have to apologize, the many whitespace changes in the calc part of the patch are because of my substandard mentoring - cleaned-up version of the first patch attached. Cheers, -- Thorsten From 9536eed6be175243f9e55f5715d1fb784a6f5f4f Mon Sep 17 00:00:00 2001 From: Wolfgang Pechlaner l...@pechlaner.at Date: Sun, 4 Sep 2011 14:40:25 +0200 Subject: [PATCH] BITxxx functions for ODF 1.2 --- sc/inc/helpids.h |5 + sc/qa/unit/ucalc.cxx |5 + sc/source/core/inc/interpre.hxx |5 + sc/source/core/tool/interpr1.cxx | 101 sc/source/core/tool/interpr4.cxx |5 + sc/source/ui/src/scfuncs.src | 156 ++ sc/util/hidother.src |5 + 7 files changed, 282 insertions(+), 0 deletions(-) diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index c80dd1b..b04aa77 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -692,3 +692,8 @@ #define HID_FUNC_UNICODESC_HID_FUNC_UNICODE #define HID_FUNC_UNICHARSC_HID_FUNC_UNICHAR #define HID_FUNC_NUMBERVALUESC_HID_FUNC_NUMBERVALUE +#define HID_FUNC_BITAND SC_HID_FUNC_BITAND +#define HID_FUNC_BITOR SC_HID_FUNC_BITOR +#define HID_FUNC_BITXOR SC_HID_FUNC_BITXOR +#define HID_FUNC_BITLSHIFT SC_HID_FUNC_BITLSHIFT +#define HID_FUNC_BITRSHIFT SC_HID_FUNC_BITRSHIFT diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 7430a60..533fbe2 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1742,6 +1742,11 @@ void Test::testFunctionLists() const char* aLogical[] = { AND, +BITAND, +BITLSHIFT, +BITOR, +BITRSHIFT, +BITXOR, FALSE, IF, NOT, diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 27027d5..50881d6 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -412,6 +412,11 @@ void ScAnd(); void ScOr(); void ScNot(); void ScNeg(); +void ScBitAnd(); +void ScBitOr(); +void ScBitXor(); +void ScBitRshift(); +void ScBitLshift(); void ScPercentSign(); void ScIntersect(); void ScRangeFunc(); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index f581ac7..3921e0e 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -1391,6 +1391,107 @@ void ScInterpreter::ScNeg() } +void ScInterpreter::ScBitAnd() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitAnd ); + +if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; + + double num1, num2; + num1 = GetDouble(); + num2 = GetDouble(); + if ((num1 281474976710655) or (num1 0) or + (num2 281474976710655) or (num2 0)) { +PushIllegalArgument(); + } + + PushDouble ((sal_uInt64) num1 (sal_uInt64) num2); +} + + +void ScInterpreter::ScBitOr() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitOr ); + + if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; + +double num1, num2; +num1 = GetDouble(); +num2 = GetDouble(); +if ((num1 281474976710655) or (num1 0) or +(num2 281474976710655) or (num2 0)) { + PushIllegalArgument(); +} + +PushDouble ((sal_uInt64) num1 | (sal_uInt64) num2); +} + + +void ScInterpreter::ScBitXor() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitXor ); + +if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; + +double num1, num2; +num1 = GetDouble(); +num2 = GetDouble(); +if ((num1 281474976710655) or (num1 0) or +(num2 281474976710655) or (num2 0)) { + PushIllegalArgument(); +} + +PushDouble ((sal_uInt64) num1 ^ (sal_uInt64) num2); +} + + +void ScInterpreter::ScBitLshift() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitLshift ); + +if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; + +sal_uInt64 erg; +sal_Int32 ishift = GetDouble(); +double num = GetDouble(); +if ((num 281474976710655) or (num 0)) { +PushIllegalArgument(); +} +if (ishift 0) { + erg = (sal_uInt64) num -ishift; +} else { + erg = (sal_uInt64) num ishift; +} +PushDouble (erg); +} + +void ScInterpreter::ScBitRshift() +{ +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::ScBitRshift ); + +if ( !MustHaveParamCount( GetByte(), 2 ) ) + return; +sal_uInt64 erg; +sal_Int32 ishift = GetDouble(); +double num = GetDouble(); +
Re: [Libreoffice] Updated [Patch] new BITxxx functions for ODF 1.2
Hi If pushed, these new functions should be advertised in the Release notes. Olivier Em 04-09-2011 09:45, Thorsten Behrens escreveu: l...@pechlaner.at wrote: I've made the new Functions BITAND, BITOR, BITXOR BITRSHIFT and BITLSHIFT,, how declared in the ODF 1.2 specification. Can anyone have a look on this Patches. Wonderful, great stuff - I have to apologize, the many whitespace changes in the calc part of the patch are because of my substandard mentoring - cleaned-up version of the first patch attached. Cheers, -- Thorsten ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice -- Olivier Hallot Founder, Steering Commitee Member - The Document Foundation Voicing the enterprise needs LibreOffice translation leader for Brazilian Portuguese +55-21-8822-8812 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice