xtralib  0.1.0
A simple header-based drop-in library
data.h
Go to the documentation of this file.
1 
10 #ifndef __XTRA_DATASTRUCTURES_H__
11 #define __XTRA_DATASTRUCTURES_H__
12 
13 #include <string.h>
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <wchar.h>
17 
18 #define MAX_DATASTRUCT_STRSIZ 100
19 
20 #define MAP_MAX 100
21 
22 typedef struct vec2 vec2;
23 struct vec2 {
24  int x;
25  int y;
26 };
27 
28 vec2 vec2_init(int x, int y);
29 
30 typedef struct Map Map;
31 struct Map {
32  size_t size;
33  char keys[MAP_MAX][MAX_DATASTRUCT_STRSIZ];
34  int values[MAP_MAX];
35 };
36 
37 Map * MapInit();
38 
39 void MapInsert(Map *m, char key[], int value);
40 
41 int MapGet(Map *m, char key[]);
42 
43 void MapPrint(Map *m);
44 
45 // TODO: Not finished
46 void MapFree(Map *m);
47 
48 
49 typedef struct wcs_dynarr_t wcs_dynarr_t;
50 struct wcs_dynarr_t {
51  wchar_t **items;
52  size_t size;
53  size_t allocated_size;
54 };
55 
56 wcs_dynarr_t * wcs_dynarr_init();
57 void wcs_dynarr_kill(wcs_dynarr_t *arr);
58 
59 void wcs_dynarr_push(wcs_dynarr_t *arr, wchar_t *item);
60 
61 #endif
New functions and types related to string and string manipulation.
Definition: data.h:31
Definition: data.h:23
Definition: data.h:50