FAQ  •  Register  •  Login

Another string related problem (*solved*)

<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Sat May 10, 2014 1:00 am

Another string related problem (*solved*)

Let me demonstrate this nasty bug...

  Code:
sub printerPutString(x as ubyte,y as ubyte,attribute as ubyte,char$ as string)
   print at y,x;char$
end sub

sub Frame(x1 as ubyte,y1 as ubyte,width as ubyte,height as ubyte)
printerPutString(x1,y1,6,chr(35))
printerPutString(x1,y1+height,6,chr(35))
printerPutString(x1+width,y1,6,chr(35))
printerPutString(x1+width,y1+height,6,chr(35))
strg$=""
   for old=1 to width-1
      strg$=strg$+chr(33)
   next old
   printerPutString(x1+1,y1,7,strg$)
   printerPutString(x1+1,y1+height,7,strg$)
   for old=y1+1 to y1+height-1
      printerPutString(x1,old,7,chr(34))
      printerPutString(x1+width,old,7,chr(34))
   next old
end sub

Frame(15,0,16,5)


This does not work correctly, but it *should* work.
print len strg$ is 15, but in procedure the char$ length is calculated with 0 lchars.
It works if I change the code to this:

  Code:
sub printerPutString(x as ubyte,y as ubyte,attribute as ubyte,char$ as string)
   print at y,x;char$
end sub

sub Frame(x1 as ubyte,y1 as ubyte,width as ubyte,height as ubyte)
   printerPutString(x1,y1,6,chr(35))
   printerPutString(x1,y1+height,6,chr(35))
   printerPutString(x1+width,y1,6,chr(35))
   printerPutString(x1+width,y1+height,6,chr(35))

    for old=x1+1 to x1+width-1
       printerPutString(old,y1,7,chr(33))
       printerPutString(old,y1+height,7,chr(33))
   next old
   for old=y1+1 to y1+height-1
      printerPutString(x1,old,7,chr(34))
      printerPutString(x1+width,old,7,chr(34))
   next old
end sub

Frame(15,0,16,5)

------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Mon May 19, 2014 11:23 pm

Re: Another string related problem

It looks like it is a problem with strings and SUB...
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Tue May 20, 2014 8:03 am

Re: Another string related problem

LCD wrote:It looks like it is a problem with strings and SUB...

I see. Probably local / parameter string var$. Will check it. Thanks :)
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Tue May 20, 2014 6:53 pm

Re: Another string related problem

boriel wrote:
LCD wrote:It looks like it is a problem with strings and SUB...

I see. Probably local / parameter string var$. Will check it. Thanks :)

No problem. Thank you for looking into it.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Sun Jun 08, 2014 12:15 am

Re: Another string related problem

LCD wrote:
boriel wrote:
LCD wrote:It looks like it is a problem with strings and SUB...

I see. Probably local / parameter string var$. Will check it. Thanks :)

No problem. Thank you for looking into it.

I think It's fixed. Please, download Version 1.4.0-s1876, and tell me if it works.
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Sun Jun 08, 2014 11:04 pm

Re: Another string related problem

boriel wrote:I think It's fixed. Please, download Version 1.4.0-s1876, and tell me if it works.

I'm telling you that it works. Thank you!
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!

Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO