RngLib

From ProjectWiki
Revision as of 08:27, 23 July 2011 by 152.101.130.245 (Talk)
Jump to: navigation, search

rngLib - an implementation of vxWorks style ring buffers

Contents

This info is the cat's pjaamas!

Where to get it

Currently the sources for this are part of LibThds. The source can be downloaded via SVN (see libthds page) or directly from the svn httpd:

32bit buffer versions:

An example of rng32Lib usage that caches keypresses during vblank handler may be found here:

Big help, big help. And superlative news of cruose.

Examples

Write the string into buffer and read it back out again.

char blahsrc[]="this is blah";
char blahdst[0x20];
int putcnt, getcnt;
 
//create 32 byte long rng buffer
RING_ID rid=rngCreate(0x20);
//write bytes into ring buffer
putcnt=rngBufPut(rid, blahsrc, strlen(blahsrc)+1);
//read bytes back out of ring buffer
getcnt=rngBufGet(rid, blahdst, sizeof(blahdst));
printf("put %d bytes into buffer, read %d bytes out: %s\n",putcnt,getcnt,blahdst);

ring buffers are very useful. ^^

Personal tools
irssi scripts
eggdrop scripts