i think i am going to have to punt on eXtended. Maybe even boxed if
padding is a problem. That would be sad as i know of no other
effective way for ragged arrays.

greg
~krsnadas.org

--

from: Raul Miller <[email protected]>
to: Programming forum <[email protected]>
date: 20 June 2013 14:20
subject: Re: [Jprogramming] calling jj.dll

I do not think that you can find any examples of this.

>The underlying mechanism only makes sense when mixing structure elements which 
>have different sizes.

>Still, if you can find any examples, it would be great to hear about them.

Thanks,

--
Raul

--

from: [email protected]
to: [email protected]
date: 20 June 2013 13:59
subject: Re: [Jprogramming] calling jj.dll

GREG> 2)Is there a formula for header size depending on rank?
RAUL> So, expressed in C, it's (7+rank)*sizeof I

>There may also be some padding after the s[] shape elements and before the 
>data values following the header in order to have the data values properly 
>aligned. (Think of "doubles" requiring 8-byte alignment, and having such 
>padding always for uniformity reasons.) This is platform-dependent.

So, while Raul's

 (7+rank)*sizeof I

>indeed covers all relevant header elements, the offset for the first data atom 
>might or might not require some rounding up.

As all the London Tubers know: "Mind the gap!"

 Martin

PS (aka Padding Space):

>This padding space was occasionally an issue back when I made the J Unix 
>ports. Just very seldom, a test in the test suite would fail because two 
>arrays wouldn't match (-:) anymore -- when that padding area wasn't properly 
>initialized. Difficult to reproduce and debug, back then.

>This is also what I *DON'T* like about the use 15!:0 for base functionalities 
>such as regexes or mmapped files: it pushes APIs which are portable at the C 
>source level into the J level where the code working across many platforms 
>gets very, very messy. (Good luck, Greg!)

--

from: Raul Miller <[email protected]>
to: Programming forum <[email protected]>
date: 19 June 2013 14:15
subject: Re: [Jprogramming] calling jj.dll

On Tue, Jun 18, 2013 at 9:07 AM, greg heil <[email protected]> wrote:
> 1)Is there a citation for the meaning of x vs i?

http://www.jsoftware.com/help/user/call_procedure.htm

> 2)Is there a formula for header size depending on rank?

https://github.com/openj/core/blob/master/jtype.h#L41 says:
typedef struct {I k,flag,m,t,c,n,r,s[1];}* A;

and
 +/','='k,flag,m,t,c,n,r,s'
7

So, expressed in C, it's (7+rank)*sizeof I

>(Because counting commas ignores the s, which is the shape of the array. The 
>number of elements in the shape is the rank of the array.)

>And, of course, sizeof I is 4 on a 32 bit machine and 8 on a 64 bit machine.

FYI,
Raul







> 1)Is there a citation for the meaning of x vs i?

http://www.jsoftware.com/help/user/call_procedure.htm

> 2)Is there a formula for header size depending on rank?

https://github.com/openj/core/blob/master/jtype.h#L41 says:
typedef struct {I k,flag,m,t,c,n,r,s[1];}* A;

and
    +/','='k,flag,m,t,c,n,r,s'
7

So, expressed in C, it's (7+rank)*sizeof I

(Because counting commas ignores the s, which is the shape of the
array. The number of elements in the shape is the rank of the array.)

And, of course, sizeof I is 4 on a 32 bit machine and 8 on a 64 bit machine.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to