Re: [Haskell-cafe] A question regarding reading CPP definitions from a C header

2013-10-07 Thread Malcolm Wallace
If you use cpphs as a library, there is an API called runCpphsReturningSymTab. Thence you can throw away the actual pre-preprocessed result text, keep only the symbol table, and lookup whatever macros you wish to find their values. I suggest you make this into a little code-generator, to

Re: [Haskell-cafe] A question regarding reading CPP definitions from a C header

2013-10-07 Thread Ömer Sinan Ağacan
Thanks for your answer, looks like this is my only option to do this. Can you provide some information about what does parameters of runCpphsReturningSymTab stands for? I made several attempts but couldn't get any useful return value. For example, I have no idea what does third parameter does.

Re: [Haskell-cafe] A question regarding reading CPP definitions from a C header

2013-10-07 Thread Carl Howells
Have you looked into using hsc2hs? If I understand your problem, it's designed exactly to solve it. -- Carl On Mon, Oct 7, 2013 at 12:20 PM, Ömer Sinan Ağacan omeraga...@gmail.comwrote: Thanks for your answer, looks like this is my only option to do this. Can you provide some information

Re: [Haskell-cafe] A question regarding reading CPP definitions from a C header

2013-10-07 Thread Ömer Sinan Ağacan
Carl, thank you very much. This is exactly what I was looking for, and it solved my problem in 5 minutes. What's awesome is that when Cabal finds a .hsc file it automatically calls this tool. Great. Thanks again. --- Ömer Sinan Ağacan http://osa1.net 2013/10/8 Carl Howells

[Haskell-cafe] A question regarding reading CPP definitions from a C header

2013-10-05 Thread Ömer Sinan Ağacan
Hi all, Let's say I want to #include a C header file in my Haskell library just to read some macro definitions. The C header file also contains some C code. Is there a way to load only macro definitions and not C code in #include declarations in Haskell? What I'm trying to do is I'm linking my