Has anyone tried to port Berkely DB over to HLA?

I'd like to use it in a program I'm working on, but the header file is... shal we say "quite complex" (I uploaded the full header, and you can see it at this link db.h) Converting some of the structures to HHF foramt is beyond me

If someone could give me a few hints about how to "HHF-ize" the more intricate structure components, such as...

int  (*set_feedback) __P((DB *, void (*)(DB *, int, int)));


...or forward structure defs like...

struct __db;		typedef struct __db DB;

struct __db_dbt; typedef struct __db_dbt DBT;


...I'd appreciate it.
Posted on 2004-02-03 13:39:55 by The Worrier King
"struct __db;" just means "hey, we have this struct type, but I will not define it until later", which means you can refer to __db in pointer variables, but can't access fields of the structure, nor declare non-pointer variables. "typedef struct __db DB;" means you can do "DB my_db_variable;" without a prefix "struct", which would be necessary in C (but not C++) programs.

set_feedback is a pointer to a function taking a DB pointer and a void function pointer that takes a DB pointer and two ints as arguments - looks pretty horrid ;)
Posted on 2004-02-03 13:57:12 by f0dder
Originally posted by The Worrier King

int  (*set_feedback) __P((DB *, void (*)(DB *, int, int)));



Well, if you take the attitude that "everything is a dword", then the above is the same thing as a dword :)

Okay, here's a real attempt at it:


type
sfProcType : procedure( var dPtr:DB; pPtr:procedure( var dp2:DB; i:int32; j:int32));


I *think* that's the same. I always dig out my C reference manual when the prototypes get this unreadable (alas, it's not handy at this moment, so I can't verify that it's correct).


...or forward structure defs like...

struct __db;		typedef struct __db DB;

struct __db_dbt; typedef struct __db_dbt DBT;


...I'd appreciate it.


Forward references like this are almost always done because you have a pointer to one of the structs. Just use "pointer to DB" or whatever when it references one of these forward referenced structures. Or just cheat and make the fields DWORDs.
Cheers,
Randy Hyde
Posted on 2004-02-03 22:51:52 by rhyde