implement unordered hashes and ordered lists (PNTable and PNTuple)
More...
#include <stdio.h>
#include <stdlib.h>
#include "potion.h"
#include "internal.h"
#include "khash.h"
#include "table.h"
Go to the source code of this file.
|
| #define | NEW_TUPLE(t, size) |
| |
| #define | GET(i) t->set[i] |
| |
| #define | SET(i, v) t->set[i] = v |
| |
| #define | SWAP(a, b) |
| |
|
| PN | potion_table_cast (Potion *P, PN self) |
| |
| PN | potion_table_set (Potion *P, PN self, PN key, PN value) |
| | helper function for potion_table_put:"put", accepts tuple or table More...
|
| |
| static PN | potion_table_clone (Potion *P, PN cl, PN self) |
| |
| PN | potion_tuple_empty (Potion *P) |
| |
| PN | potion_tuple_with_size (Potion *P, unsigned long size) |
| |
| PN | potion_tuple_new (Potion *P, PN value) |
| |
| PN | potion_tuple_push (Potion *P, PN tuple, PN value) |
| |
| PN_SIZE | potion_tuple_find (Potion *P, PN tuple, PN value) |
| | Return index of found value or PN_NONE. More...
|
| |
| PN_SIZE | potion_tuple_push_unless (Potion *P, PN tuple, PN value) |
| |
| static void | potion_sort_internal (Potion *P, PN cl, PN self, PN_SIZE from, PN_SIZE to, PN cmp) |
| | space-efficient but destructive and not-stable qsort More...
|
| |
| static PN | potion_tuple_cmp (Potion *P, PN cl, PN self, PN value) |
| |
| void | potion_table_init (Potion *P) |
| |
implement unordered hashes and ordered lists (PNTable and PNTuple)
Definition in file table.c.
| #define NEW_TUPLE |
( |
|
t, |
|
|
|
size |
|
) |
| |
Value:
t->alloc = t->len = size
a tuple is an array of PNs.
#define PN_ALLOC_N(V, T, C)
Definition at line 16 of file table.c.
| #define GET |
( |
|
i | ) |
t->set[i] |
| #define SET |
( |
|
i, |
|
|
|
v |
|
) |
| t->set[i] = v |
helper function for potion_table_put:"put", accepts tuple or table
- Parameters
-
- Returns
- self PNTable
Definition at line 126 of file table.c.
| PN potion_tuple_with_size |
( |
Potion * |
P, |
|
|
unsigned long |
size |
|
) |
| |
Return index of found value or PN_NONE.
- Parameters
-
- Returns
- int
Definition at line 280 of file table.c.
- Parameters
-
Definition at line 290 of file table.c.
space-efficient but destructive and not-stable qsort
- Parameters
-
| self | sort data |
| from | first index, usually 0 |
| to | last index, usually len-1 |
| cmp | cmp method for 2 values, returning -1,0,1 |
Definition at line 634 of file table.c.
| void potion_table_init |
( |
Potion * |
P | ) |
|