From: Jeremy O'D. <jer...@gm...> - 2006-05-30 13:00:40
|
Hi list, I need to display some simple, but rather large data sets (~30MB of raw binary data) - you could imagine a Hex editor capable of working with very large files as being similar to the problem I need to solve, and as having similar display requirements (e.g. ability to display same data using different word lengths etc.) First approach was to parse the data to format as strings and append to a text control. This is *far* too slow. I believe that the best approach is probable to create a 'virtual' grid class, so that only the displayed data needs to be formatted. Obviously, I'd ideally like to do this in a reusable way (so maybe a new contrib example/module could come out of this exercise). What I'd ideally like is confirmation that I'm proposing to go about things in the right way and/or suggestions of a better way to do it (BTW, I'm very confident in C/C++, somewhat less so in Haskell). This is what I think I need to end up with: - type VirtualGridTable as a subclass of GridTableBase - Accessor function implementations (Haskell wrappers for C functions): virtualGridTable_GetNumberRows :: Int virtualGridTable_GetNumberCols :: Int virtualGridTable_IsEmptyCell :: Int -> Int -> Bool virtualGridTable_GetValue :: Int -> Int -> String Each of these should call the relevant subclassed functions from the underlying C++ subclass. In an ideal scenario, I would prefer the wrapped C functions to call back to Haskell, as this would make the implementation reasonably generic. Obviously this implies additional functions to set the accessor functions. This is what I think I need to do: 1) Subclass wxGridTableBase. I think this needs to be done in C++. 2) Wrap the 'new' derived class with C functions wich manipulate its members 3) Wrap the C exports with suitable Haskell structures. It looks as though wxdirect can do most of 2) and 3) for me, provided that 1) is done in 'wxC' style. Is this correct? It's not clear to me how to create C declarations of functions expecting Haskell closures as parameters, at least in a form which will cause wxDirect to 'do the right thing' - guidance would help here. Regards Jeremy |