Array Descriptor (split from Wiki Improvements)

Forum for discussion about the documentation project.
Juergen Kuehlwein
Posts: 215
Joined: Mar 07, 2018 13:59
Location: Germany

Re: Array Descriptor (split from Wiki Improvements)

Postby Juergen Kuehlwein » Sep 05, 2019 16:01

@Jeff

i need a name for my include file, a logical name would be "array.bi". But then there already is "array.bi" in \fbc-int. Two files with the same name in different directories - not a very good idea i think, this is bound to lead to confusion.

So either your "array.bi" or my "array.bi" needs a different name. Following the purpose and the naming convention started with "fbc-int" (for FreeBASIC internals), you could name your "array.bi" (and maybe future files in this folder) "array-int.bi". Or i would have to make it "array-ext.bi" or something like that.

What do you think?


JK
MrSwiss
Posts: 3263
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Array Descriptor (split from Wiki Improvements)

Postby MrSwiss » Sep 05, 2019 16:24

JK wrote:Or i would have to make it "array-ext.bi" or something like that.
Why not simply calling it: arrayex.bi (ex = as in "extended") just a idea.

I've just made: "arrayinfo.bi" containing a Macro and a overloaded Sub().
(along the lines of ScreenInfo(), byref returns of the four most important
parts of the new header (As ULong))

arrayinfo.bi:

Code: Select all

' arrayinfo.bi -- (c) 2019-09-05, MrSwiss

#Pragma Once

#Macro SetTypeArrayInfo(DataType)       ' define datatype for overloaded Sub
Sub ArrayInfo OverLoad( _               ' check for dynamic array
    a() As DataType, _                  ' _in_ mandatory: array as defined by macro
    ByRef t_mem As ULong = 0, _         ' _out_ opt. total memory (in Bytes)
    ByRef e_len As ULong = 0, _         ' _out_ opt. element size (dito)
    ByRef _dims As ULong = 0, _         ' _out_ opt. number of dimensions
    ByRef _flag As ULong = 0 _          ' _out_ opt. flags (all as one)
    )
    Dim As FBC.FBARRAY Ptr pa = _
        FBC.ArrayDescriptorPtr(a())     ' get array descriptor ptr (pa)

    t_mem = CULng(pa->size)             ' original is UInteger, needs type cast
    e_len = CULng(pa->element_len)     
    _dims = CULng(pa->dimensions)
    _flag = CULng(pa->flags)            ' assure 32 bit's max. (as in FBC 32)
End Sub
#EndMacro
' ----- EOF -----

Return to “Documentation”

Who is online

Users browsing this forum: No registered users and 22 guests