https://github.com/themanyone/listlib
Simplified cross-platform linked list library for organizing strings
https://github.com/themanyone/listlib
Last synced: about 1 month ago
JSON representation
Simplified cross-platform linked list library for organizing strings
- Host: GitHub
- URL: https://github.com/themanyone/listlib
- Owner: themanyone
- License: gpl-3.0
- Created: 2016-03-02T23:09:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-10T08:38:47.000Z (almost 9 years ago)
- Last Synced: 2025-06-03T13:18:31.495Z (4 months ago)
- Language: C
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ListLib
ListLib is a free small C library for working with linked-lists.
[Listlib](//github.com/themanyone/listlib) is part of the [TML project](//anch.org/tml.html), the application we made to generate web pages from text wiki markup. [Listlib](//github.com/themanyone/listlib) creates a stack to store nested tag values and file names for backlinks. [programs/listlib.zip Listlib] handles multiple lists. [Listlib](//github.com/themanyone/listlib) has methods to split strings into lists and do things with them.
The ListLib library is one monolithic, polymorphic function cleverly named, "list". The main thing to remember is that POP pulls an allocated structure out of the list, with the consequence that we have to explicitly FREE it (see example below). To use [Listlib](//github.com/themanyone/listlib), put `#include "listlib.h"` at the top of the file. Use the enum values, PRINT, DESTROY, etc. to access the various methods. For help, `puts (list(NULL,HELP));`
[Listlib](//github.com/themanyone/listlib) is released under the terms of the [//www.gnu.org/copyleft/gpl.html GNU Public license].
```
#include "listlib.h"
int main (void) {
LinkedList myList;
char *tmp, s[] = "I like my cheese";
myList = list (NULL,SPLIT,s," ");
printf ("Move '%s' to the beginning:\n",
tmp = (char*)list(myList,POP,2));
myList = list (myList,PREPEND,tmp);
FREE(tmp); /* POP must be FREE'd */
list (myList,PRINT,1);
list (myList,DESTROY);
}
/* output:
Split: I like my cheese
Move 'my' to the beginning:
0. my
1. I
2. like
3. cheese
*/
```## Building Listlib
Compiling listlib is simple once dependencies have been installed.
* [TML](//anch.org/tml.html) is needed to build the HTML documentation.
* [Anchor](//github.com/themanyone/anch) is required to build the C sources.After that, just run `make`.