Issue 100953 - Basic macro functions: StrConv, LeftB, LenB, MidB, and RightB
Summary: Basic macro functions: StrConv, LeftB, LenB, MidB, and RightB
Status: CLOSED OBSOLETE
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: DEV300m41
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: ab
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-08 13:35 UTC by tora3
Modified: 2015-11-25 14:30 UTC (History)
7 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
An experimental patch to DEV300_m41, could be also applied to DEV300_m44 (38.28 KB, patch)
2009-04-08 13:46 UTC, tora3
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description tora3 2009-04-08 13:35:32 UTC
This is an experimental implementation of OpenOffice.org/StarOffice Basic macro 
functions: 
 - StrConv
 - LeftB
 - LenB
 - MidB
 - RightB

Algorithm
 To share algorithms of the existing Unicode string functions - Left, Len, Mid, 
 and Right - with corresponding byte string functions - LeftB, LenB, MidB, and 
 RightB -, this implementation employs C++ templates. That is, one algorithm is 
 used by both String and ByteString classes. 

Code conversion
 Conversion between Unicode string and byte string is implemented in the StrConv 
 function. It can take either Unicode and byte strings, convert it, and return 
 converted string.
 Todo: A type of character encoding is automatically determined with the 
  operating system's default encoding. 
  E.g. It would be 
    - CodePage 932 on Windows Japanese
    - UTF-8 on Solaris/Linux with LANG=en_US.UTF-8 
  There might be demands to allow macro programmers to explicitly specify 
  a type of character encoding. 

Calculation
 Concatenation and comparison of byte strings are also implemented.
 An attempt of concatenating or comparing a Unicode string with byte one is 
 resulted in an error.

Implicit type conversion
 Implicit type conversion from byte string to Unicode string and vice versa is 
 also implemented. The byte order is tuned for x86/x64 processors.

 Implicit type conversion from byte string to one of the basic types such as 
 integer, and versa is also preliminarily implemented. It converts a byte string 
 into Unicode string first and then utilizes a type conversion method from Unicode 
 string to the basic type. 
 Todo: All possible combinations of original type and destination type are not 
    covered yet. The rest of the combinations should be implemented, if needed.

References
 issue 85036
 http://l10n.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=2205928
 http://msdn.microsoft.com/en-us/library/aa263373(VS.60).aspx
 http://msdn.microsoft.com/en-us/library/aa286591(office.10).aspx
Comment 1 tora3 2009-04-08 13:46:25 UTC
Created attachment 61457 [details]
An experimental patch to DEV300_m41, could be also applied to DEV300_m44
Comment 2 tora3 2009-04-08 14:18:50 UTC
Some corrections

In the section "Code conversion" above,

 Conversion between Unicode string and byte string is implemented as an
 implicit type conversion. A user can use it through StrConv macro function.

In the section "Implicit type conversion" above, 

 Implicit type conversion from byte string to Unicode string and vice versa is 
 also implemented. Its byte order in this implementation is little endian 
 regardless of type of processor on which OpenOffice.org is running. 
 Little endian is used by x86/x64 processors. 
Comment 3 kay.ramme 2009-04-14 10:00:42 UTC
Andreas, here are coming some functions to be more close to some other BASICs :-)
Comment 4 ab 2009-05-18 08:06:25 UTC
Needs some evaluation, STARTED
Comment 5 kai.sommerfeld 2009-05-26 08:18:58 UTC
.
Comment 6 ab 2009-06-16 09:31:41 UTC
.
Comment 7 ab 2009-08-14 11:00:34 UTC
Found no time for evaluation so far.
Comment 8 ab 2009-11-10 12:30:12 UTC
.
Comment 9 ab 2010-01-11 11:51:30 UTC
.
Comment 10 ashisuto_moi 2011-03-08 23:32:52 UTC
Could you please take time to review this?
Comment 11 stx123 2011-03-16 13:04:06 UTC
moving to framework...
Comment 12 tora3 2011-06-14 04:21:08 UTC
LibreOffice: https://bugs.freedesktop.org/show_bug.cgi?id=35006
Comment 13 tora3 2011-06-14 04:25:07 UTC
Technical notes

If you are implementing this patch for the upcoming version of OpenOffice.org 
or its siblings, you might find that use of "ByteString aBytePic" in the 
same fashion as "String aPic" was better than current code in the patch.

basic/inc/basic/sbxvar.hxx
class SbxValue : public SbxBase
{
	SbxValues aData;	 	// Daten
	String    aPic;			// Picture-String
//	ByteString aBytePic;		// Picture-ByteString

There were restriction during development of the patch. The patch aimed 
at providing a single shared library file to our clients, not several 
shared library files. Under the circumstances where "class SbxValue" is 
used by other modules outside of "basic," adding a member variable to 
the class results in increasing the size of its instance. Consequently, 
OpenOffice.org will crash unless its relevant shared libraries are also 
replaced at the same time.

To avoid such a crash problem, I knew that addition of "ByteString 
aBytePic" to the class SbxValue was an appropriate way, I did a tricky 
implementation without use of it. No need to exactly follow the patch.
Comment 14 Rob Weir 2013-03-11 15:03:55 UTC
I'm adding this comment to all open issues with Issue Type == PATCH.  We have 220 such issues, many of them quite old.  I apologize for that.  

We need your help in prioritizing which patches should be integrated into our next release, Apache OpenOffice 4.0.

If you have submitted a patch and think it is applicable for AOO 4.0, please respond with a comment to let us know.

On the other hand, if the patch is no longer relevant, please let us know that as well.

If you have any general questions or want to discuss this further, please send a note to our dev mailing list:  dev@openoffice.apache.org

Thanks!

-Rob
Comment 15 Regina Henschel 2013-10-16 20:11:06 UTC
LeftB, LenB, MidB, and RightB are implemented in core for Calc and available in macros same way as the other Calc functions. So this part is obsolete.

I will close this issue as obsolete.

Calc has the function Unicode and Unichar, so I don't know, whether the string conversion part is still meaningful. If yes, then please open a new issue for it and adapt the patch.
Comment 16 oooforum (fr) 2015-11-25 14:30:56 UTC
(In reply to Regina Henschel from comment #15)
> LeftB, LenB, MidB, and RightB are implemented in core for Calc and available
> in macros same way as the other Calc functions. So this part is obsolete.
OK for these 4 functions.
But StrConv is not implemented in Basic.
So this enhancement will be welcome in a next build. :-)
Could we reopen this RFE?