TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (91 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139264 times)
  2. FAT32 Library (71752 times)
  3. Network Ethernet Library (57128 times)
  4. USB Device Library (47431 times)
  5. Network WiFi Library (43092 times)
  6. FT800 Library (42408 times)
  7. GSM click (29835 times)
  8. mikroSDK (28098 times)
  9. PID Library (26886 times)
  10. microSD click (26198 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Library

Dynamic List Library

Rating:

5

Author: Richard Lowe

Last Updated: 2013-06-11

Package Version: 1.0.0.0

Category: Other Codes

Downloaded: 1200 times

Followed by: 3 users

License: MIT license  

Dynamic double linked list library that is not only fast but efficient.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Dynamic List Library" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Dynamic List Library" changes.

Do you want to report abuse regarding "Dynamic List Library".

  • Information
  • Comments (0)

Library Blog

Example:


You will need to provide 2 functions to the list.  A DESTROY and FIND function that accepts a void pointer.  The list works with any datatype.

#include "list.h"

const unsigned int HEAP_SIZE = 2048;
DList myList;

DListElmt *findElmt(void *num);
void deleteNum(void *payload);

DListElmt *findElmt(void *num){
     DListElmt *tmpElmt;
     
     if(dlist_size(&myList) == 0)
         return;
     tmpElmt = dlist_head(&myList);
     while(tmpElmt != 0 && (int*)tmpElmt->payload != num)
         tmpElmt = tmpElmt->next;

     return tmpElmt;
}

void deleteNum(void *payload){
     int* tempNum = (int*)payload;
     Free((char*)tempNum, sizeof(int));
}


void main() {

     int i = 0, *num;

     MM_Init();
     dlist_init(&myList, findElmt, deleteNum);

     
     for(i = 0; i<10; i++){
           num = (int*)Malloc(sizeof(int));
           *num = rand();
           dlist_ins_prev(&myList, dlist_head(&myList), num);
     }
     
     dlist_destroy(&myList);

}

ALSO FROM THIS AUTHOR

RTC 1307 Library

10

Makes easy addition of ds1307 RTC.

[Learn More]

STM DMA Library

15

This is the first of DMA functions that will be available for the ST line of ARM microcontrollers. The idea was born from a forum post. The idea worked so well I made it into a convenient MikroC library. So far.... memory to memory transfers is what is functional

[Learn More]

ST EEPROM Emulation

5

Adaptation of STs' EEPROM Emulator to MikroC.

[Learn More]