>>>>> "GL" == Greg London <[email protected]> writes:
GL> I have no idea if its been done before, but it was an intriguing
GL> exercise that piqued my interest and I decided to see if it was
GL> possible. Mostly it turned into a learning exercise for
GL> Template::Toolkit and how to look at a linked list in C in
GL> completely generic (templatable) terms.
i did something similar in pure c and cpp macros. i still have the code
and found it. it manages doubly linked lists (aka queues and the code
uses queue and q all over). there is a c include file with many macros
for declarations and some operations and also a c file with more
operations. here is the core struct and declare macro
typedef struct _q_body {
Q_LINK head ;
Q_LINK tail ;
char *name ;
int elem_size ;
int alloc_cnt ;
int total_alloc_cnt ;
int elem_cnt ;
} Q_BODY ;
/* declare a queue and init it */
#define Q_DCL( name ) \
Q_BODY name = { { (Q_LINK *) &name.tail }, \
{ NULL, (Q_LINK *) &name.head }, \
#name } ;
it was designed to manage a queue of fixed size elements (the size is
declared at init time). it also managed free lists of these elements so
you would save time in freeing/allocating new elements. the system
didn't know anything about the contents of an element but i am sure it
could be modified so that it could handle sorting and other higher level
ops.
anyhow, just an old memory for me. this code is from about 1996. it was
used as part of a full scale web crawler i wrote for northern light. 2k
parallel fetches in a single process. those were fun days! :)
uri
--
Uri Guttman ------ [email protected] -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm