Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
right() wiht fmt() possible bug

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
stevech



Joined: 23 Feb 2006
Posts: 657

Posted: 29 September 2006, 4:09 AM    Post subject: right() wiht fmt() possible bug Reply with quote

Don- do you see a VM code generation problem with the code where right() is called? When I use right() in this manner with fmt(), the VM hangs. Using a constant like 1.234 instead of a var like "sec" yields the same error.

If I put the resultant string from fmt() into a local var, then use that var with right(), no hangup.

Compiler: 1.3 Target: ZX24a

Code:
'            '''''''''''''''''''''''''''''''''''''''''''''''''
            private function formatTime() as string
fff8 -8    ret:formatTime (4)
0a5b 0e0a        ADDSP_B        0x0a (10)
0a5d f30600      INITR_AN_STR   bp+6
               dim h as byte, m as byte
0000 +0    var:h (1)
0001 +1    var:m (1)
               dim   sec as single
0002 +2    var:sec (4)
               dim s as string
0006 +6    var:s (4)
           
               call gettime(h, m, sec) ' get VM's time since reset
0a60 0d0000      PSHR_A         bp+0
0a63 0d0100      PSHR_A         bp+1
0a66 0d0200      PSHR_A         bp+2
0a69 fe51        SCALL          TIME
               ' make string like 00:00:00.0  time
               s = byteToAscii2(h) & ":" & byteToAscii2(m) & ":" _
                   & byteToAscii2(cbyte(fix(sec))) & right(fmt(fraction(sec),3),4)
0a6b 1c00e00000  PSHI_D         0x0000e000 (57344)
0a70 230000      PSHR_B         bp+0
0a73 05c30a      CALL           0ac3
0a76 fc          STK_STR
0a77 09013a      PSHI_S         ":"
0a7a 1c00e00000  PSHI_D         0x0000e000 (57344)
0a7f 230100      PSHR_B         bp+1
0a82 05c30a      CALL           0ac3
0a85 fc          STK_STR
0a86 fe16        SCALL          STRCAT
0a88 fe16        SCALL          STRCAT
0a8a 09013a      PSHI_S         ":"
0a8d 1c00e00000  PSHI_D         0x0000e000 (57344)
0a92 250200      PSHR_D         bp+2
0a95 78          FIX_F
0a96 fe03        SCALL          CBYTE_F
0a98 05c30a      CALL           0ac3
0a9b fc          STK_STR
0a9c fe16        SCALL          STRCAT
0a9e fe16        SCALL          STRCAT
0aa0 1c00e00000  PSHI_D         0x0000e000 (57344)
0aa5 250200      PSHR_D         bp+2
0aa8 77          FRAC_F
0aa9 1a03        PSHI_B         0x03 (3)
0aab fe25        SCALL          CVTS_F
0aad 1b0400      PSHI_W         0x0004 (4)
0ab0 05df0a      CALL           0adf
0ab3 fc          STK_STR
0ab4 fe16        SCALL          STRCAT
0ab6 f90600      POPR_S         bp+6
               formatTime = s
0ab9 0d0600      PSHR_A         bp+6
0abc f9f8ff      POPR_S         bp-8
            end function
0abf f70600      FREER_STR      bp+6
0ac2 06          RET
           
           
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 29 September 2006, 16:00 PM    Post subject: Re: right() wiht fmt() possible bug Reply with quote

stevech wrote:
do you see a VM code generation problem with the code where right() is called? When I use right() in this manner with fmt(), the VM hangs. Using a constant like 1.234 instead of a var like "sec" yields the same error.

If I put the resultant string from fmt() into a local var, then use that var with right(), no hangup.

I see the problem. You have correctly identified the workaround - using a temporary variable to hold the value returned from the function instead of passing it directly.

A solution has been derived. Although we are approaching the cutoff for a new release, we'll probably be able to get the change through testing before that time.

Thanks.
Back to top
stevech



Joined: 23 Feb 2006
Posts: 657

Posted: 29 September 2006, 17:24 PM    Post subject: Reply with quote

looking forward to new release!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group