Forum Index
Structures with BoundedStrings

 
Author Message
spamiam



Joined: 13 Nov 2005

Posted: 22 September 2006, 1:32 AM    Post subject: Structures with BoundedStrings

I want to create a structure with BoundedStrings (two of them, just a few bytes long)

I want it to look like this:

Code:
Public Structure CID
   Public MID   as byte
   Public OID   as UnsignedInteger
   Public PNM   as BoundedString(6)
   Public PRev   as byte
   Public SerNum   as UnsignedLong
   Public MDT   as BoundedString(7)
End Structure


I want to allocate the structure in the main program, then fill the structure in a subroutine.

I allocate it like this:
Code:
Dim CIDInfo as CID


I want to pass it like this:

Code:
Public Sub MMCInfo(byRef CIDInfo as CID)


And when I do it, I get this error

Code:
Internal error: variable.cpp(2576), Rev 674: unsupported Based type, "MMC_API.bas" line 135


Are BoundedStrings not legal in a structure?


--------- As I test this further, it seems that I can not actually assign characters to the structures string element with the statement

Code:
CIDInfo.PNM = "test"


This is what generates the error code

-Tony
Back to top
spamiam



Joined: 13 Nov 2005

Posted: 22 September 2006, 2:26 AM    Post subject:

Upon further testing, the structure is fine.

The problem occurs when passing it to the subroutine.

How does one pass a reference to a structure to a subroutine legally?

-Tony
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Location: Portland, OR

Posted: 22 September 2006, 3:16 AM    Post subject:

spamiam wrote:
How does one pass a reference to a structure to a subroutine legally?

Just as you have done. The problem only occurs when referencing string types in a structure passed to a procedure. This is another symptom of the problem that Steve reported yesterday. It has already been fixed.


Last edited by dkinzer on 17 November 2006, 18:56 PM; edited 1 time in total
Back to top
spamiam



Joined: 13 Nov 2005

Posted: 22 September 2006, 12:29 PM    Post subject:

dkinzer wrote:
spamiam wrote:
How does one pass a reference to a structure to a subroutine legally?

Just as you have done. The problem only occurs when referencing string types in a structure passed to a procedure. This is another symptom of the problem that Steve reported yesterday. It has already been fixed.


I suspected that Steve's problem might be related to mine. I worked around it with global variables for now.

-Tony
Back to top
Display posts from previous:   
Page 1 of 1

 



ZBasic Microcontrollers Home
All content Copyright © 2005, 2006, 2007, 2008, 2009, 2010 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