An open API service indexing awesome lists of open source software.

https://github.com/remusao/data_structs

A set of generic data structures to use in a C project
https://github.com/remusao/data_structs

Last synced: 4 months ago
JSON representation

A set of generic data structures to use in a C project

Awesome Lists containing this project

README

          

__________________________________
/ \
|---------* Data structures *-------|
\___________________________________/

_______
' `
| Brief :
`_______'

~> This project contains implementations of classical data structures in C
using X-macro to generate generic code. The idea is that you have to
"specialize" the structures by giving the type of their elements and the
name you want to give to the structure. You could then use functions
that are given.

Structures that you could use by now :

- *Linked Lists* (list)
- Array-based dynamic *Queues* (queue)
- Array-based dynamic *Stacks* (stack)

What you could use at term :

- Array-based dynamic *Vectors* (vector)
- Skip *Lists* (skipList)
- Binary-tree-based *Maps* (map)
- *Hashtables* (hash-map)
- AVL *Trees* (tree)
- *Graphs* (graph)

___________________
' `
| Quick start guide :
`___________________'

Each directory contains files to use a data structure. In each one you will
find several files :

- A .hxx file that contains macros to define the structure and functions
- A sample of code (main.c, struct.[hc]) that shows you how to use it

When you want to use a structure, create 2 files struct.h and struct.c. Put
the struct.hxx in the same directory. Here is what you should obtain for
each file :

~> struct.h

#ifndef STRUCT_H_
# define STRUCT_H_

# include "struct.hxx"

// At compile time, this will be replaced by
// the definitions of :
// - The structs
// - The headers of the functions
STRUCT_HEADER(My_type, Struct_name)

#endif /* !STRUCT_H_ */

__________

~> struct.c

#include "struct.h"

// At compile time, this will be replaced by :
// - The definition of every functions that you could use with
// this structure.
STRUCT_SOURCE(My_type, Struct_name)

Now you can just compile it along with your project and/or package it
as a Static / dynamic library.

_______________
' `
| Documentation :
`_______________'

The source code is documented with doxygen-style. If you want to generate
the documentation (html, latex and man pages) do as follow :

1) Go into the doc/ directory : `cd doc`
2) Run : `make`
3) The doc is now generated !