Re: litlits in interface files

2000-02-26 Thread Manuel M. T. Chakravarty
Sven Panne <[EMAIL PROTECTED]> wrote, > Simon Marlow wrote: > > If you can #include the header file into the Haskell source, then > > you can get away without litlits. > > Of course, in the general (and in the OpenGL/GLUT) case you can't. > > > If your header file contains extra gumph like prot

Re: litlits in interface files

2000-02-25 Thread Sven Panne
Marcin 'Qrczak' Kowalczyk wrote: > IMHO the following should be efficient, calling the function only > once, near the time of the first use (if not, should be fixed): > > foreign import aConstant :: Int > > #include > int aConstant (void) > { > return A_C

Re: litlits in interface files

2000-02-25 Thread Marcin 'Qrczak' Kowalczyk
Fri, 25 Feb 2000 13:10:24 +0100, Sven Panne <[EMAIL PROTECTED]> pisze: > It's not clear to me how exactly this should be accomplished via > foreign import. The (well, *my* :-) basic problem is: How do you > map about 1000 numerical #defines from C header files (OpenGL/GLUT) > efficiently to Hask

Re: litlits in interface files

2000-02-25 Thread Malcolm Wallace
> Depending on the OpenGL version there are #defines > or a big enum. So the only portable way without litlits would be a > small automatically generated C program that is run as part of > HOpenGL's configuration process and outputs Haskell definitions or > #defines for all needed constants. Aaaar

Re: litlits in interface files

2000-02-25 Thread Sven Panne
Simon Marlow wrote: > If you can #include the header file into the Haskell source, then > you can get away without litlits. Of course, in the general (and in the OpenGL/GLUT) case you can't. > If your header file contains extra gumph like prototypes and stuff, > you can use this little trick: [.

RE: litlits in interface files

2000-02-25 Thread Simon Marlow
> It's not clear to me how exactly this should be accomplished via > foreign import. The (well, *my* :-) basic problem is: How do you > map about 1000 numerical #defines from C header files (OpenGL/GLUT) > efficiently to Haskell? Saving some STG state, calling out to C land, > and restoring some s

Re: litlits in interface files

2000-02-25 Thread Sven Panne
Simon Marlow wrote: > I think the only answer to this is "litlits are deprecated". We'll > have to make do with foreign imports to get these kind of constants. It's not clear to me how exactly this should be accomplished via foreign import. The (well, *my* :-) basic problem is: How do you map ab

RE: litlits in interface files

2000-02-25 Thread Simon Marlow
Sven writes: > GHC-4.06 includes litlits (i.e. those thingies between ``...''') in > interface files when the corresponding module is compiled with -O > and sometimes inlines them in other modules. Efficient as it is, > this can break modules which don't use the same #includes. I think the only

litlits in interface files

2000-02-01 Thread Sven Panne
GHC-4.06 includes litlits (i.e. those thingies between ``...''') in interface files when the corresponding module is compiled with -O and sometimes inlines them in other modules. Efficient as it is, this can break modules which don't use the same #includes. Example: -- Foo.hs ---