OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Basic compiler bugged in 2.0.1 ?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1145
Location: France

PostPosted: Sat Dec 24, 2005 4:30 am    Post subject: Basic compiler bugged in 2.0.1 ? Reply with quote

Hi all,
I have recently downloaded the official OpenOffice.org 2.0.1 (build 8990).
I installed it on my Win XP Home computer (complete install, after deleting old 1.9 and without data from 1.1).

Then I re-installed Xray and Multipages add-ons. Problem : there is a syntax error in both add-ons Evil or Very Mad

After investigation, I found two problems related with the continuation character in Basic (underscore character). In the following lines the _ character must be the last character of the line.
Code:
Sub Main
' comment ending with _
End Sub

This code displays syntax error : Statement block still open: End Sub missing.
If you suppress the trailing _ the error disappears.
Obviously the comment part of the line was interpreted. Mad

Code:
Sub Main
const a = "1234567890" & _
    "1234567890" & _
    "1234567890" & _
    "1234567890" & _
    "1234567890" & _
    "1234567890" & _
    "1234567890" & _
    "1234567890"
End Sub

Here again there is a syntax error. If you suppress one character in any one of the strings, the error disappears.
The compiler does not like strings of 80 characters or more, if they are defined with continuation lines. Mad

Do you also get these errors? If so, this 2.0.1 is nearly unusable for Basic macros.
_________________
Bernard

OpenOffice.org 1.1.5 fr / OpenOffice.org 3.1.1 en + langpacks
MS-Windows XP Home SP3
Back to top
View user's profile Send private message Visit poster's website
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 7664
Location: Kentucky, USA

PostPosted: Sat Dec 24, 2005 8:57 am    Post subject: Reply with quote

This does throw an error as does the larger piece of code you posted:
Code:
Sub Main
' comment ending with _
End Sub

These do not, however, in the last one Xray reports "a" as being Empty. Xray reports "a" correctly in 1.1.5.
Code:
Sub Main
' comment ending with_
End Sub


Code:
Sub Main
' comment ending with _
a = 1
End Sub


Code:
Sub Main
' comment ending with _
a = 1
Xray a
End Sub


OOo 2.0.1 - Windows 2000 Pro - Xray 5.1


Last edited by JohnV on Sat Dec 24, 2005 4:31 pm; edited 1 time in total
Back to top
View user's profile Send private message
DrewJensen
Super User
Super User


Joined: 06 Jul 2005
Posts: 2599
Location: Cumberland, MD

PostPosted: Sat Dec 24, 2005 9:27 am    Post subject: Reply with quote

Quote:

The compiler does not like strings of 80 characters or more, if they are defined with continuation lines.


Haven't tried all the test yet, but this seems a little different.

It appears that the problem is with constants of 80 characters. The continuation doesn't matter.

no error
Code:

sub strLength
dim a as string
 a = "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890"   
 print a
end sub


error
Code:

sub strLength
const a = "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890"   
 print a
end sub


Using the continuatoin character in either scenario gives the same results.

EDIT:
OK, all the tests you showed for the continuation character and comments are working just the same for me..But I am also on WinXP..so hopefully a Linux person will check in also.
_________________
Blog - http://baseanswers.spaces.live.com/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
james_h
Super User
Super User


Joined: 05 Nov 2005
Posts: 873

PostPosted: Sat Dec 24, 2005 8:07 pm    Post subject: OOo 2.0.1 (Linux) - Constant string length limit confirmed Reply with quote

OpenOffice.org 2.0.1 (Linux) - Constant string length limit confirmed
Quote:
OK, all the tests you showed for the continuation character and comments are working just the same for me..But I am also on WinXP..so hopefully a Linux person will check in also.

I checked the code using OpenOffice.org 2.0.1 (Linux). My results are the same as Drew Jensen's. Constants show an error when the string length limit is exceeded.
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1145
Location: France

PostPosted: Sun Dec 25, 2005 1:03 am    Post subject: Reply with quote

OK, the constant bug is related only to the concatenation character ( & or + )
Simplest example, adding a null string
Code:
Sub Main
const a = "12345678901234567890123456789012345678901234567890123456789012345678901234567890" & ""   
 print a
End Sub

If you suppress one character the syntax error disappears.
If you suppress the & "" the syntax error disappears.
If you construct the string with concatenation of substrings on several lines you get a syntax error for more than 79 characters in total.

So now we have two different bugs:
- comment lines ending with the continuation character
- long string constants created with concatenation

any more bugs around ?
Back to top
View user's profile Send private message Visit poster's website
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1145
Location: France

PostPosted: Sun Dec 25, 2005 1:23 am    Post subject: Reply with quote

The bug "continuation character in comment" produces an error with Xray 5.1 when you are trying to display the API documentation.
There is a compilation error in module Mod4, line 82.
Code:
if alpha = -1 then alpha = 27 ' name begins with _

To suppress the error, suppress the comment or change it like this
Code:
if alpha = -1 then alpha = 27 ' name begins with _ character

In fact at runtime the error appears in the module _main because the mod4 module was not correctly compiled.
This is a typical example of a correct macro which cannot run on OOo 2.0.1.
Back to top
View user's profile Send private message Visit poster's website
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3152
Location: Columbus, Ohio, USA

PostPosted: Sun Dec 25, 2005 8:10 am    Post subject: Reply with quote

Have you filed a bug report on this?
_________________
--
Andrew Pitonyak
My Document: http://www.pitonyak.org/AndrewMacro.odt
Free Info: http://www.pitonyak.org/oo.php
Most hated bug: http://www.openoffice.org/issues/show_bug.cgi?id=84159
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1145
Location: France

PostPosted: Mon Dec 26, 2005 1:14 am    Post subject: Reply with quote

pitonyak wrote:
Have you filed a bug report on this?

Just created:

syntax error with line continuation character IZ 59790

constants constructs are limited to 79 character length IZ 59791
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group