Paul: I'd like to cook up a split function which supplies its own split algorithm, and need to know the recommended approach.
FWIW, this is to create a crude word-wrap function, so needs to start at a particular length and search backwards for eg: space. However, needs to have more heuristics, like prefering split on space, but if that's not found near the end then look for hyphen, and so on.
I see that your split functions have callbacks, but these appear more directed at doing something after your functions have decided where the split should be, rather than allowing caller to determine the split algorithm.
It looked to me like I need to duplicate bsplit functionality, inserting my own algorithm. Along the way, I'll need the memory allocation functionality from bcsb(). But bcsb() is static.
So I feel like I'm fighting the library rather than working with it -- am I taking the wrong approach here?
Graham
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(A bit later...) OK, I got around to just cutting and pasting relevant parts of bsplit() and friends, and have a basic word-wrap function returning wrapped text to a bstrList. I think I've concluded that this just wasn't an area of functionality that you expanded into, fair enough. But it has raised separate curiosity about bstrList editability... on that a separate thread.
Graham
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Paul: I'd like to cook up a split function which supplies its own split algorithm, and need to know the recommended approach.
FWIW, this is to create a crude word-wrap function, so needs to start at a particular length and search backwards for eg: space. However, needs to have more heuristics, like prefering split on space, but if that's not found near the end then look for hyphen, and so on.
I see that your split functions have callbacks, but these appear more directed at doing something after your functions have decided where the split should be, rather than allowing caller to determine the split algorithm.
It looked to me like I need to duplicate bsplit functionality, inserting my own algorithm. Along the way, I'll need the memory allocation functionality from bcsb(). But bcsb() is static.
So I feel like I'm fighting the library rather than working with it -- am I taking the wrong approach here?
Graham
(A bit later...) OK, I got around to just cutting and pasting relevant parts of bsplit() and friends, and have a basic word-wrap function returning wrapped text to a bstrList. I think I've concluded that this just wasn't an area of functionality that you expanded into, fair enough. But it has raised separate curiosity about bstrList editability... on that a separate thread.
Graham