H/Direct: size_is for multi-dimensional arrays ignored?

1999-11-23 Thread Andy Moran


>From reading the DCE IDL definition, it seems that declarations like:

void init([in]int m, [in]int n,
  [out,size_is(m,n)]double *a[*][*]);

are valid (i.e. giving size_is more than one argument to specify the size of
multi-dimensional arrays).  ihc correctly works out the type and the
unmarshalling code, but the marshalling code (specifically, the allocation
of storage for the out parameter) ignores the second dimension of the array:

init :: Int32
 -> Int32
 -> IO [[Double]]
init m n =
  do
a <- allocBytes ((toInt sizeofAddr * toInt m))
prim_Matrix_init m n a
m <- unmarshallInt32 m
n <- unmarshallInt32 n
a <- doThenFree free (unmarshalllist sizeofAddr 0 (int32ToWord32 m)
  unmarshalllist sizeofAddr 0 (int32ToWord32 n)   
  readDouble)) a
return (a)

Any ideas?

Here's the header of the .hs:

-- Automatically generated by HaskellDirect (ihc), snapshot 171199
-- Created: 16:53 PST, Tuesday 23 November, 1999
-- Command line: --hugs -fhs-to-c -fno-qualified-names -cpp -c Matrix.idl

and I've attached the .idl and .hs files.

-- 
Andy Moran  
PacSoft x7557
Computer Science & Engineering+1 503 748 7557
Oregon Graduate Institute   http://www.cse.ogi.edu/~moran

module Matrix {

void init ([in]int m, [in]int n, [out,size_is(m,n)]double *a[*][*]);

};


-- Automatically generated by HaskellDirect (ihc), snapshot 171199
-- Created: 16:53 PST, Tuesday 23 November, 1999
-- Command line: --hugs -fhs-to-c -fno-qualified-names -cpp -c Matrix.idl

module Matrix
   ( init
   ) where
   
import Prelude
import Addr (Addr)
import HDirect (sizeofAddr, allocBytes, unmarshallInt32, 
readDouble, int32ToWord32, unmarshalllist, free, doThenFree)
import Int (Int32, toInt)

init :: Int32
 -> Int32
 -> IO [[Double]]
init m n =
  do
a <- allocBytes ((toInt sizeofAddr * toInt m))
prim_Matrix_init m n a
m <- unmarshallInt32 m
n <- unmarshallInt32 n
doThenFree free (unmarshalllist sizeofAddr 0 (int32ToWord32 m) (unmarshalllist 
sizeofAddr 0 (int32ToWord32 n) readDouble)) a

primitive prim_Matrix_init :: Int32 -> Int32 -> Addr -> IO ()
needPrims_hugs 2



RE: No instance for `CCallable Int#' ????

1999-11-23 Thread Simon Peyton-Jones



| -Original Message-
| From: George Russell [mailto:[EMAIL PROTECTED]]
| Sent: 23 November 1999 09:45
| To: [EMAIL PROTECTED]
| Subject: No instance for `CCallable Int#' 

Simon had failed to check in a change to PrelGHC.hi-boot.  Sorry

Simon



RE: After changing 'fromInt' to 'fromInteger'

1999-11-23 Thread Simon Peyton-Jones

Hmm.  I can't reproduce this error with ghc-4.04 or the current
CVS version, so it looks as if it's specific to the 4.045 build
that Sigbjorn made for Win32 platforms.  

[Sigbjorn: do we have any old Win32 distributions?  The one one
that seems to be available is 4.045.]

Try compiling without -O.

You can build a fresh compiler from source; or you can wait
for a new Win32 distribution (Xmas, perhaps).

Simon

| -Original Message-
| From: Andreas Marth [mailto:[EMAIL PROTECTED]]
| Sent: 22 November 1999 17:19
| To: [EMAIL PROTECTED]
| Subject: bug: After changing 'fromInt' to 'fromInteger'
| 
| 
| 
| I tried to recompile my projekt with ghc-4.045 for 
| win32-systems and got an
| error, that "Variable not in scope:  'fromInt' ".
| Then someone suggested that I use 'fromInteger' instead.
| But then the 'impossible' happens.
| Error.hs contains the Massage and Matrice.hs the module.
| 
| 
| Thanks foe every help,
| Andreas
| 



RE: illegal scoping Main.main

1999-11-23 Thread Simon Peyton-Jones

| What's wrong / strange with this code so ghc panics?
| 
| Contents of A.hs:
| module A where
| Main.main = putLine "HALLO"

Urgle.  I've fixed GHC's panic so it now gives a reasonable
error message.  I've also added documentation to the 
separate compilation section of the manual to say that
you can have a module Main in a file A.hs.

Thanks for reporting this

Simon



RE: cvs ghc crashes when compiling

1999-11-23 Thread Simon Marlow


> Hi,
> I tried compiling a cvs copy of ghc from Monday 22 November.
> This was on Windows NT. The compiler was compiled using the binary
> ghc-4.045 binary release. It crashed when compiling PrelBase.

I've seen this too.  Compiling the hsc binary with -static fixed it for me,
but I don't know the real cause.  Sigbjorn, come back... all is forgiven :)

Simon



cvs ghc crashes when compiling

1999-11-23 Thread Meurig Sage

Hi,
I tried compiling a cvs copy of ghc from Monday 22 November.
This was on Windows NT. The compiler was compiled using the binary
ghc-4.045 binary release. It crashed when compiling PrelBase.


==fptools== make all --unix --no-print-directory -r;
 in /meurig/cvs/fptools/ghc/lib


===fptools== Recursively making `all' in std exts concurrent posix misc ...
PWD = /meurig/cvs/fptools/ghc/lib


==fptools== make all --unix --no-print-directory -r;
 in /meurig/cvs/fptools/ghc/lib/std

rm -f PrelBase.o ; if [ ! -d PrelBase ]; then mkdir PrelBase; else find
PrelBase -name '*.o' -print | xargs rm -f __rm_food ; fi ;
../../driver/ghc-inplace -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing -O
 -split-objs -odir PrelBase -fcompiling-prelude -static  -H12m  -v -c
PrelBase.lhs -o PrelBase.o -osuf o
The Glorious Glasgow Haskell Compilation System, version 4.05

literate pre-processor:
 echo '#line 1 "PrelBase.lhs"' > /tmp/ghc17024.lpp &&
/meurig/cvs/fptools/ghc/driver/../utils/unlit/unlit  PrelBase.lhs -  >>
/tmp/ghc17024.lpp

real 0m0.010s
user 0m0.010s
sys 0m0.000s
Found OPTIONS -fno-implicit-prelude in /tmp/ghc17024.lpp

Effective command
line: -fno-implicit-prelude -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing
 -O -split-objs -odir PrelBase -fcompiling-prelude -static -H12m -v -c -o
PrelBase.o -osuf o

Haskellised C pre-processor:
 echo '{-# LINE 1 "PrelBase.lhs" -}' > /tmp/ghc17024.cpp &&
/meurig/cvs/fptools/ghc/driver/../utils/hscpp/hscpp -v  -D__HASKELL__=98 -D_
_HASKELL1__=5 -D__GLASGOW_HASKELL__=405 -D__HASKELL98__ -D__CONCURRENT_HASKE
LL__ -I. -I/meurig/cvs/fptools/ghc/driver/../includes /tmp/ghc17024.lpp >>
/tmp/ghc17024.cpp

real 0m0.000s
user 0m0.000s
sys 0m0.000s
hscpp:CPP invoked:
gcc -E -undef -traditional -D__HASKELL__=98 -D__HASKELL1__=5 -D__GLASGOW_HAS
KELL__=405 -D__HASKELL98__ -D__CONCURRENT_HASKELL__ -I. -I/meurig/cvs/fptool
s/ghc/driver/../includes - 


No instance for `CCallable Int#' ????

1999-11-23 Thread George Russell

Problems building GHC again.  (Latest versions of everything)

==fptools== gmake all --no-print-directory -r;
 in /usr/local/pub-bkb/ghc/fptools/ghc/lib/posix

rm -f PosixProcEnv.o ; if [ ! -d PosixProcEnv ]; then mkdir PosixProcEnv; else find 
PosixProcEnv -name '*.o' -print | xargs rm -f __rm_food ; fi ;
../../driver/ghc-inplace -i../misc -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing -O 
-split-objs -odir PosixProcEnv -H20m  '-#include"cbits/libposix.h"'  -H30m -c 
PosixProcEnv.lhs -o PosixProcEnv.o -osuf o
ghc-inplace: ignoring heap-size-setting option (-H20m)...not the largest seen

PosixProcEnv.lhs:743:
No instance for `CCallable Int#'
arising from an argument in the _ccall_ to `isatty', namely `fd' at 
PosixProcEnv.lhs:743
In a do statement: rc <- _ccall_ isatty fd

Compilation had errors