Empty 2D arrays - how to determine type

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Empty 2D arrays - how to determine type

4D Tech mailing list
I need to determine the type of a 2D array, which maybe empty (i.e.
size 0 x 0), which is at the end of a pointer....
In the method where the 2D array is declared Type(My_Array{0}) returns
18 (Array text)
BUT when the 2D array is passed via pointer (to a component)
Type($ptr->{0}) returns undefined in an interpreted database.

Any ideas??
Example (note all typed in email):
Array text(My_Array;0;0)

$type:=Type(My_Array{0})  //$Type = 18 -- Array text
My_method(->My_array)

//My_Method
c_pointer($1;$Array)
c_longint($Type)

$Array:=$1
$Type:=Type($Array->)  //$Type = 13 -- Array 2D

if ($Type= 13)
  $Type:=Type($Array->{0})  //$Type = 5 (interpreted) -- Is Undefined
  // WTF! ! ! !
end if


Thanks
Chip

---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Empty 2D arrays - how to determine type

4D Tech mailing list
F.Y.I.

Type() returns 18 in the subroutine as well, in v16.

it seems like you are pushing the limits of v13 in terms of generic coding.

> 2017/06/02 6:14、Chip Scheide via 4D_Tech <[hidden email]> のメール:
>
> if ($Type= 13)
>  $Type:=Type($Array->{0})  //$Type = 5 (interpreted) -- Is Undefined
>  // WTF! ! ! !
> end if




**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Empty 2D arrays - how to determine type

4D Tech mailing list
In reply to this post by 4D Tech mailing list
This is what I used before Type worked correctly:

C_LONGINT($0)
C_POINTER($1)

C_BLOB($blob)

VARIABLE TO BLOB($1->{0}{0};$blob) //puts 5 bytes: BLVR+type

$0:=$blob{4}

John DeSoi, Ph.D.


> On Jun 1, 2017, at 4:14 PM, Chip Scheide via 4D_Tech <[hidden email]> wrote:
>
> I need to determine the type of a 2D array, which maybe empty (i.e.
> size 0 x 0), which is at the end of a pointer....
> In the method where the 2D array is declared Type(My_Array{0}) returns
> 18 (Array text)
> BUT when the 2D array is passed via pointer (to a component)
> Type($ptr->{0}) returns undefined in an interpreted database.

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Empty 2D arrays - how to determine type

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Chip,
I believe you can use the Type function on the zero array. Given ARRAY
LONGINT($aArray;0;0) you could call:

Type($array{0})

​and it will return Array longint. ​


On Thu, Jun 1, 2017 at 3:14 PM, Chip Scheide via 4D_Tech <
[hidden email]> wrote:

> I need to determine the type of a 2D array, which maybe empty (i.e.
> size 0 x 0), which is at the end of a pointer....
> In the method where the 2D array is declared Type(My_Array{0}) returns
> 18 (Array text)
> BUT when the 2D array is passed via pointer (to a component)
> Type($ptr->{0}) returns undefined in an interpreted database.
>
> Any ideas??
> Example (note all typed in email):
> Array text(My_Array;0;0)
>
> $type:=Type(My_Array{0})  //$Type = 18 -- Array text
> My_method(->My_array)
>
> //My_Method
> c_pointer($1;$Array)
> c_longint($Type)
>
> $Array:=$1
> $Type:=Type($Array->)  //$Type = 13 -- Array 2D
>
> if ($Type= 13)
>   $Type:=Type($Array->{0})  //$Type = 5 (interpreted) -- Is Undefined
>   // WTF! ! ! !
> end if
>
>
> Thanks
> Chip
>
> ---------------
> Gas is for washing parts
> Alcohol is for drinkin'
> Nitromethane is for racing
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************




--
Kirk Brooks
San Francisco, CA
=======================

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************