aboutsummaryrefslogtreecommitdiff
path: root/src/hotload.h
blob: 1d3921bea79674a38e1b726c69c5ef1cf06a63a8 (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
#ifndef SKHD_HOTLOAD_H
#define SKHD_HOTLOAD_H

#ifndef __cplusplus
#include <stdbool.h>
#endif

#include <Carbon/Carbon.h>

#define HOTLOADER_CALLBACK(name) void name(char *absolutepath, char *directory, char *filename)
typedef HOTLOADER_CALLBACK(hotloader_callback);

struct watched_entry;
struct hotloader
{
    FSEventStreamEventFlags flags;
    FSEventStreamRef stream;
    CFArrayRef path;
    bool enabled;

    hotloader_callback *callback;
    struct watched_entry *watch_list;
    unsigned watch_capacity;
    unsigned watch_count;
};

bool hotloader_begin(struct hotloader *hotloader, hotloader_callback *callback);
void hotloader_end(struct hotloader *hotloader);
bool hotloader_add_catalog(struct hotloader *hotloader, const char *directory, const char *extension);
bool hotloader_add_file(struct hotloader *hotloader, const char *file);

#endif