summaryrefslogtreecommitdiffstats
path: root/base_parse.h
blob: d7b1dfdf48a716e471e9993bef429dd5648aaaf5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef BASE_PARSE_H
#define BASE_PARSE_H

#define COMPARE_STRING(c1, c2) compare_string((char *)c1, (char *)c2)

typedef struct proc_entry proc_entry;
typedef struct proc_file  proc_file;

struct proc_file
{
    i32         count;
    proc_entry *entries;
};

struct proc_entry
{
    char value[16];
    char key[16];
};

typedef struct
{
    i8 *start;
    i8 *end;
    umm len;
} Line;

internal b8
compare_string(char *c1, char *c2);

internal proc_file *
parse_proc_files(char *path, mem_arena *arena);

internal u64
parse_u64(char *buf, umm len);

internal b8
is_numeric(char *s);

#endif