Announcement

Collapse
No announcement yet.

Unknown UDT elements

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unknown UDT elements

    Colin got me thinking on UDT's and if you do not know how many elements you may or may not have over to "Passing UDT values to DLLs"
    and maybe crossing over to my "Get that DataType"

    So it got me to thinking if there may be some "Mad-Scientist" idea of possibly having a UDT, or some set of functions to fill in a UDT of unknown size and values until runtime??????

    One idea I had included what I have been told is not only unsupported, but also not advised, but see it in the "Win32Api.inc" is using an array within a UDT (Yes I know...tons of research to do, but its just an idea and even I would not support it till tested, but just grasping at straws that just MIGHT might pan out...if not then nothing lost)
    Just for the sake of trying....is it worth trying? or will the 99.9% of you say what I usually do and have ideas why it should not / can not be done?
    (Or is it just crazy enough that it might just work????)
    :coffee4:
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

  • #2
    Code:
    GLOBAL MEM ALLOC size TO hMem
    Pass 'hMem AS LONG'

    Make contents self-describing.

    Done.

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Originally posted by Cliff Nichols View Post

      So it got me to thinking if there may be some "Mad-Scientist" idea of possibly having a UDT, or some set of functions to fill in a UDT of unknown size and values until runtime??????
      I'm having a hard time understanding what you mean. Could you describe the situation a little more explicitly?

      How would you have a UDT that was unknown in size and values? How would they be unknown "until runtime"?


      Are you looking for a "meta-data" UDT that would describe another UDT?

      Code:
      TYPE UDT_DESCRIPTOR_TYPE
       membername as string * %somelen
       membertype as string * %somelen
       memberlength as long
      END TYPE
      
      local MyUDT() as UDT_DESCRIPTOR_TYPE
      dim MyUDT(1 to 3) 
      MyUDT(1).membername = "StudentFirstName"
      MyUDT(1).membertype = "string"
      MyUDT(1).memberlength = 15
      
      MyUDT(2).membername = "StudentLastName"
      MyUDT(2).membertype = "string"
      MyUDT(2).memberlength = 25
      
      MyUDT(3).membername = "StudentID"
      MyUDT(3).membertype = "string"
      MyUDT(3).memberlength = 8
      
      ...
      trying to figure out how you'd use something like that???


      Code:
      TYPE DYNAMIC_UDT_TYPE
       MyUDT(1).membername AS MyUDT(1).membertype * MyUDT(1).memberlength 
       MyUDT(2).membername AS MyUDT(2).membertype * MyUDT(2).memberlength 
       MyUDT(3).membername AS MyUDT(3).membertype * MyUDT(3).memberlength 
      END TYPE
      But I don't think we don't have dynamic TYPE defintions; they have to be defined before compiling...???


      Is this more appropriate to a macro????


      As I said, I'm a bit unclear on what you're looking for. Any detail you could add would help...

      -John

      Comment


      • #4
        Originally posted by Cliff Nichols View Post
        So it got me to thinking if there may be some "Mad-Scientist" idea of possibly having a UDT, or some set of functions to fill in a UDT of unknown size and values until runtime??????
        Isn't that what XML is for?
        Jeff Blakeney

        Comment

        Working...
        X