summaryrefslogtreecommitdiff
path: root/examples/dte/file-history.h
blob: 0a518916d6b87a92c566c92fb8294136e2ef24c7 (plain)
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
#ifndef FILE_HISTORY_H
#define FILE_HISTORY_H

#include <stdbool.h>
#include "util/hashmap.h"
#include "util/macros.h"

typedef struct FileHistoryEntry {
    struct FileHistoryEntry *next;
    struct FileHistoryEntry *prev;
    char *filename;
    unsigned long row;
    unsigned long col;
} FileHistoryEntry;

typedef struct {
    char *filename;
    HashMap entries;
    FileHistoryEntry *first;
    FileHistoryEntry *last;
} FileHistory;

void file_history_add(FileHistory *hist, unsigned long row, unsigned long col, const char *filename);
void file_history_load(FileHistory *hist, char *filename);
void file_history_save(const FileHistory *hist);
bool file_history_find(const FileHistory *hist, const char *filename, unsigned long *row, unsigned long *col) WARN_UNUSED_RESULT;
void file_history_free(FileHistory *history);

#endif