While I running test suite, I noticed that the api for osx
needs a condition branch because offset is 64-bit even on 
32-bit platforms os that it has to push another 4 bytes of zero
to stack. But it does not look quite right to me.

NB. ---------------------- beware of line wrap
if. UNAME -: 'Darwin' do.
  c_mmap=: }:@:('mmap * * i i i i i i' api)@:(}: , (<0)"_ , {:)
  if. ({.a.)={. 1&(3!:4) 1 do. NB. endian - powerpc vs intel
    c_lseek=: (0 1 3 4&{)@:('lseek i i i i i' api)@:(0&{ , (<0)"_ , 1&{ , 2&{)
  end.
end.
NB. ----------------------

this branch is not protected by IF64 so the first question if it
will work for 64-bit

c_mmap is not inside the endian test branch, so the second
question is will it work on intel.

what I guess is that it should be

NB. ----------------------
if. (UNAME -: 'Darwin') > IF64 do.   NB. apply only to 32-bit
  if. ({.a.)={. 1&(3!:4) 1 do. NB. endian - powerpc vs intel
    c_mmap=: }:@:('mmap * * i i i i i i' api)@:(}: , (<0)"_ , {:)
    c_lseek=: (0 1 3 4&{)@:('lseek i i i i i' api)@:(0&{ , (<0)"_ , 1&{ , 2&{)
  else.
    c_mmap=: }:@:('mmap * * i i i i i i' api)@:(}: , (<0)"_ ,~ {:)
    c_lseek=: (0 1 3 4&{)@:('lseek i i i i i' api)@:(0&{ , (<0)"_ ,~ 1&{ , 2&{)
  end.
end.
NB. ----------------------

Did anyone test how jmf work on OSX (ppc vs intel, 32 vs 64)?

for example using the test script gmbx.ijs

NB. mapped boxed arrays ----------

load 'jmf'
18!:4 <'base'

1 [ unmap_jmf_ 'q'
f=: <'q.jmf'
1 [ createjmf_jmf_ f,<4e6      NB. 4e6 bytes for data
map_jmf_ (<'q'),f,'';0         NB. map q to jmf file
'' -: q

1 [ unmap_jmf_ 'r'
f1=: <'r.jmf'
1 [ createjmf_jmf_ f1,<7e5
map_jmf_ (<'r'),f1,'';0
'' -: r

g   =: 6 7 4 5 2 3 0 1&{"1 @: (5&}.) @: (3!:3) @: ({."1)
mean=: +/ % #

NB. ----------------------

Thanks.


-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to