News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

lifofifo

Started by czerny, February 06, 2013, 06:32:25 PM

Previous topic - Next topic

czerny

I am a little bit in hurry!

I wrote code for a stack and a double linked list which I need for a actual project. It would be nice if anyone could test it. I don't have the time now to test it as I should.

czerny

::: old bugs removed, new bugs created :-)
::: more of them


czerny

I see that there are 0 downloads. Was the last release sooo bad?

frankie

I have already downloaded it time ago.
I had no time to test it, but formally they seems ok.
If you have uploaded a new version the download counter resets, and if you don't add a new post the update is not signaled as new post.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

czerny

Quote from: frankie on May 16, 2013, 10:18:53 AM
If you have uploaded a new version the download counter resets, and if you don't add a new post the update is not signaled as new post.
Ahhh! I didn't know that.

czerny

#4
This is a new version with a circular buffer for strings (CRing). ;D
A wide char version (WRing) will follow.

czerny

I would like to have some more challanging test examples.
Any ideas?

jj2007

A simple test case would be nice...

What is the difference between the Ring and the circular buffer?

You use CircBufWrite (but no CircBufRead), RingWrite and RingRead, each of them with a memcpy. In my implementation, there is something like CircBufferGetPointer, but the user has to decide how to write into the buffer. For example, GetCurrentDirectory(260, CircBufferGetPointer()). IMHO it avoids unnecessary copies...

czerny

Quote from: jj2007 on May 24, 2013, 12:35:52 AM
A simple test case would be nice...
Search for circbuf-tst.c
Quote from: jj2007 on May 24, 2013, 12:35:52 AM
In my implementation, there is something like CircBufferGetPointer, but the user has to decide how to write into the buffer. For example, GetCurrentDirectory(260, CircBufferGetPointer()). IMHO it avoids unnecessary copies...
GetCurrentDirectory(260, CircBufWrite(Buffer, NULL, 260))

jj2007

Quote from: czerny on May 24, 2013, 12:48:45 AM
GetCurrentDirectory(260, CircBufWrite(Buffer, NULL, 260))

   void *p = &R->buffer[R->pos];
   if (data)
      memcpy(p, data, len);
   else
      memset(p, 0, len);


OK, I see.

czerny

#9
Quote from: jj2007 on May 24, 2013, 12:35:52 AM
What is the difference between the Ring and the circular buffer?
Ring is a data structure which holds equal sized objects. They are written by a producer and read by a consumer who remove the objects. It is possible to detect, if the ring is full or empty. CircBuf is more a all purpose temporary memory, as discussed.

czerny

#10
It would be interesting for me to discuss such a ring in a multithreaded environment with different threads, producing/consuming objects.
Per example: What is the overhead of using  the C11 _Atomic qualifier.