24 lines
836 B
C
24 lines
836 B
C
|
|
#ifndef RAVA_REPL_HISTORY_H
|
||
|
|
#define RAVA_REPL_HISTORY_H
|
||
|
|
|
||
|
|
#include "repl_types.h"
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
char **entries;
|
||
|
|
size_t count;
|
||
|
|
size_t capacity;
|
||
|
|
size_t position;
|
||
|
|
} RavaREPLHistory_t;
|
||
|
|
|
||
|
|
RavaREPLHistory_t* rava_repl_history_create(size_t max_size);
|
||
|
|
void rava_repl_history_destroy(RavaREPLHistory_t *history);
|
||
|
|
void rava_repl_history_add(RavaREPLHistory_t *history, const char *entry);
|
||
|
|
const char* rava_repl_history_get(RavaREPLHistory_t *history, size_t index);
|
||
|
|
const char* rava_repl_history_prev(RavaREPLHistory_t *history);
|
||
|
|
const char* rava_repl_history_next(RavaREPLHistory_t *history);
|
||
|
|
void rava_repl_history_reset_position(RavaREPLHistory_t *history);
|
||
|
|
bool rava_repl_history_save(RavaREPLHistory_t *history, const char *filename);
|
||
|
|
bool rava_repl_history_load(RavaREPLHistory_t *history, const char *filename);
|
||
|
|
|
||
|
|
#endif
|