Sun Jul 13 12:39:22 CEST 2008
cleaning up PF type checking
I need to solve the type checking in a library. Just been writing some
PF wrapper words and it's completely insane the amount of red tape..
Basicly, convert every argument to a pointer which points to the
struct that represents the data. (don't handle int and float as values
-> this gives a proper common interface).
Hmm.. since i'm not going to save any lives anyway, maybe clean up PF
a bit to see if i can save PF for the next protyping run.
* subheader includes the header (they point to the same)
* the first pointer in the subheader points to the concrete data
Let's make a list of all the data types in the mean time:
pf_image_t (+ bitmap)
To port, remove the following constants in packet.h
// #define PF_HEADER_SIZE 4*64 ///< size of the packet header, including type specific subheader
// #define PF_SUBHEADER_OFFSET 4*16 ///< header part used by pf_header_t
// #define PF_SUBHEADER_SIZE (PF_HEADER_SIZE - PF_SUBHEADER_OFFSET)
All structures will have the appropriate malloced size, and are
subclasses of the generic packet header which includes type and memory
This requires a change in packet_alloc, now takes 2 arguments:
headersize and datasize. This seems to be enough to drive all changes.
Note that not making 'super' abstract is going to bite me in the ass
some day. I guess it's easy enough to change though..
OK: i got this to run.
Now, should the code be refactored to not use the header/subheader
stubs any more?
What code is interesting?
Stream and string. They're central, and they're packets.
Seems to work.
The rest will be a bit more effort.
The matrix code is really ugly..