Results 1 to 3 of 3

Thread: please develop this properties

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,528
    Rep Power
    170

    please develop this properties

    as it says. i Aam ith our udt right now. First short clarification and do not skp the step if you are not satsfied with objects that are not able to appear in an array and are actualy no own kind of a typ but abused appearances of dynamic strings forced to swallow each other...

    This
    type foo
    x as byte
    Function _Create(L1 as Log, L2 As Long bt as Byte..) 
    ' wil noot fire up for an array
    End function
     end type
    
    Dim aaa() as foo
    
    is correct not to go into _create()

    because it does not create anything. if only defines aaa to be a dynamic array.
    were the parameters 2 long variables and a byte = 9 byte and we pass 45 bytes it rould knoe where to to put it (only to _create
    -not any other right now and if - it is what only udt -functions are capable of doig in type-functons. Not if unexpected the array member appears ( the function can not see its a group) but if 2 opening paretheses- mmediately - nothing inbetween those parendtheses but empty space
    and three is a comma encountered within the inner paranthesis - elminates the chamce that it were a calculation using the parentheses to override the otder
    you rermember variadic parameters -

    As this

    Dim aaa()
    creates nothing yet i is not to consider.


    Dim BBB(20) <
    watch it's not redim but a stastic sized array (defined and allocated in one go)
    and this will notfire zmr evento into create because of incorrect count of parameters that are passed

    Dim ccc(5) As foo((1,2,3,4,5),( 2,2,2,2,3),(9,8,7,6,5))

    it should accept the creation of 5 at once
    condition all parameters correct and complete in count. Arrays cam be static or dynamic but must be fixed in size for each element.

    But

    ReDim abc(10)
    is not possibe to lsunch _Create since thcreate happenned on Dim already where this array dpd not qualify becaue the reservation of a namde alone does not count as creation
    Om;yx in case thr array y"forces" the creation of variable space andtries to drop conzrnt into a sroragw
    dim A() as foo
    is noz goimhg domrthig
    fsi, B() as Foo(((1,2,3).(2,3,4),(0,0,0))
    makes it 3, dynamic

    tthe function must loook ahaead but it ould count for th E Euall AMOUNT OF PASSED PARAMETERS and shoulyf redim ( its the _create -function of that type ehdIt could do such thing for its members
    And perhaps its not that complicated if is member of an arrax is except om DIMnot necessary
    i dont know if it were easy to deteck if ftom the view of Me possible to detedtig data of me amd my array/s iblingd is a dpa (dynaimic pointer array} where
    [code]
    setat(Me, GetAt(me)+Sizeof(Me))
    ,mmakes ME to be the next in for each from to

    thimkl a bit bout it. Sorry my eyesight is getting incredbly worse
    Last edited by ReneMiner; 29-10-2021 at 18:56.
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,528
    Rep Power
    170
    the above is at least the attempt to do something to maintain arrays - i was of opinion that you were not satisfied with the models that were avilalble as a major push to run your own

    i Exception... commercial software developers are not following the path of logic but they target numbers at the market and save to develop minor intermediate steps or stop researches as soon they seem to have found the needed information. the results are obvious you stumble across it when you try to create an array or a grid of controls. Based on iObject there are no arrays,
    if you happen to get the above to work think about assignment or initialization ( as already present for data from a .rc-file ) through data from another source that could be used on arrays of udts as well as a built-in way to store a type completely. including type-information - i.e. the code how to build this udt from

    Type <typename> #Extends_To_Include "<type to extend>.tbasicType"
    ...until...
    End type

    or how it can be achieved to let udts have their own variables scope that is valid within type functions as well without the need of keyword ME. imagine in front of every type function is
    With Me
    and End Function means also End With. i.e. if usually the function finds a local variable that matches it will check global scope. In a type-function there were type-scope to check before global scope and to raise the global scope above an "invalid scope level" would make thinBasic to become a language at a higher level because then you are able to enforce rules that on presence of a TBMain-function it were not possible to execute any other functions, that declarations or definitions must happen within the borders of dedicated Regions whee daclaration and definition is allowed and initial assignment through module- or core-functions is ok possible but limited to that and the app_entrypoint has to be passed first.
    The fired functions _Create that could be used for initial preparation but its in the programmers responsibility and he must be aware that only through _create the scope-level
    of the udt can be entered before the app_entrypoint was passed. So it should be possible to call on other funtions within the udts scope and to use module- or core-functions then. Thinkeable also the use of declared functions from external libraries but requires the declaration of the external library functions within a dedicated declarations-section
    of the project.
    For the meantime i will use #Region with some fixed set of names like #Region "#Declarations"....
    I think there are missing some Forum-sections as beta-testing and support

  3. #3
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,528
    Rep Power
    170

    Thumbs up

    Now before i forget it/ and what was the intention (to have properties) for these to have them at an udt the way leads along that road. The array-problem has to be solved before
    Now what i imagine properties are is an udt that binds where is nothing to node it. its like appending new subelements to an udt while the code is executed. i know there is something that allows to attach properties to module classes during runtime but i intend to use udts in thinBasic without the need of an external library.

    Alias Type As Property
    Alias _Create As _Attach
    
    Begin Const 
      $NONE = ""
       %NONE_definedAt = VarPtr($NONE)
    End Const
    
    ' $NONE  in case NOTHING  to pass as parameter byref for ANYTYPE  to detach 
    ' easy to check if varptr(param) = %NONE_defined_at 
    
    
    Property pProtoTypeOfProperties
       Static allKnownProperties As Dword  ' this maybe a String or Heap
       Static sizesOfPAllroperties AS Dword    ' this parallel to the above
    
      static owners As Dword       '  another array / not associated to the above- holding all varptrs of anything
                                              ' that got a property attached 
    
      static  proplistByOwner     ' this array in same order as owners is containing pointers to long arrays
                                         ' the long-arrays (1 per ownerr) hold the indexes of all properties that were 
                                       ' attached to this owner 
    
       lDistance As Long
    
      Function _Attach(ByRef AtWhom As AnyType)
    
      String WhatAmI = TypeOf(Me) 
       If WhatAmI = "UDT.PPROTOTYPEOFPROPERTIES" Then
           MSGBox("ERROR - The prototype of properties itself is no property that were attachable anywhere", %MB_ICONERROR,"INVALID ASSIGNMENT")
          STOP
     Endif
    ' now its sure this is an extends'ion 
     
      
    if Me.AllKnownProperties = 0 then 
    
        ' this one is the first to attach 
        ' now store the type, take the pointer as first element of the array that is pointed in Me.AllKnownProperties
       ' what ever is typeOf(ME) has been stored as first of properties known to the prototype
      
        Me.AllKnownProperties = Heap_AllocByStr(MKDWD$(Heap_AllocByStr(WhatAmI))
    
    ' the same do wit the size
      Me.SizeOfAllProperties= Heap_AllocByStr(MKL$(SizeOf(Me))) 
    
    
    
    Else 
      Local pAll(Heap_Size(Me.AllKnownProperties)\4) As Dword At me.AllKnownProperties
    if (Array Scan pAll Ptr, = WhatIAm )= 0 then 
        ' what i am is not listed yet, append it
         Me.AllKnownProperties=Heap_Reallocbystr(  Me.AllKnownProperties, Heap_Get(  Me.AllKnownProperties) & MKDWD$(Heap_AllocByStr(WhatIAm)) )
        Me.SizeOfAllProperties=Heap_Reallocbystr(    Me.SizeOfAllProperties, Heap_Get(  Me.SizeOfAllProperties) & MKL$(SizeOf(Me)) )
    endif 
    '...
    
    Now this property is known and also the size of it in the second array with same index as the name in the first array.
    - It allows to use indexes for known properties
    - we know what is a property and what is still a regular udt.
    And we know its size that's at least 4 bytes . these 4 bytes (in lDistance) will hold the distance (equal to udt_element_offset) of the property to its owner
    Means if VariableXY gerts a property attached the distance of the propery to the variable is SizeOf(VariableXY)
    If the new proeprty has a size of 10 bytes and variableXY gets another property attached, the second property will be at a distance= SizeOf(VariableXY) + 10

    The distance is virtual and means actually if the structure of variableXY were to print out then the 2 new properties are exactly defined where they have to appear

    the distance (is a long wth 4 bytes) also makes sure that a distance can never be 0 because a property consists of these 4 bytes at least.

    Only the prototype structure of the properties is able to tell what kind of properties are to find attached to what variables but it has no records where the property is stored
    nor what it contains. the variables that get properties attched are mandatory udts that are not attached as property themselves anywhere when properies get attached.

    every property that is attached to something is represented by a property-handle that has the size of a quad and is composed from the index of the propertyname and the
    pointer to the property-data.

    any udt that wants to be able to have properties needs 2 specific subelements : one subelement named "Properties" that must be either of type string or dword and according to that type the properties-handles are stored to a quad-array directly into the properties-string or the array is stored to heap thats pointer wil be placed into the Dword-properties. the second element an udt requires is to save a long variable to hold its owner-index so there is no need to scan. To obtain property information has alway to happen byref. So even the variable is know under its varptr it passes the index - the prototype willl compare if the record of owner(index) equals the varptr of who ever
    called the function. the second index to the properties by owner is equal to the order the udt has stored the handles.

    We might add a flag to the properties listed in the proplistbyOwner and if the owner declared it is private then the prototype will exit function without result.
    It looks quite confussng and as if there would be a lot of array-scanning but no: through the index you know exactly where to obtain name or size of property,


    I only have no idea how - if there's something else between private and public
    I think there are missing some Forum-sections as beta-testing and support

Similar Threads

  1. drag'n'drop question plus properties
    By Lionheart008 in forum TBGL General
    Replies: 11
    Last Post: 03-11-2013, 17:59
  2. Properties
    By efgee in forum O2h Compiler
    Replies: 7
    Last Post: 03-09-2010, 23:09
  3. Need to develop in Linux, need virtual stuff
    By Michael Hartlef in forum Shout Box Area
    Replies: 6
    Last Post: 12-03-2008, 00:47
  4. Celtx, a tool to develop our storyline
    By Michael Hartlef in forum Game story and Character Development
    Replies: 4
    Last Post: 14-03-2007, 22:13

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •