blob: 346e55fd907f58de2dec8fba4ac7517e52fb01d7 (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/* cklist.h - Custom list data structure for ck ------------------------*- C -*-
*
* This file is part of ck, the config keeper
*
* -----------------------------------------------------------------------------
*
* Copyright (C) 2018 Anastasis Grammenos
* GPLv3 (see LICENCE for the full notice)
*
* -----------------------------------------------------------------------------
*
* Ck needs a list of strings. Assists with finding the correct config file
* to edit when using ck edit and provides a backend to the ck list action.
*
* -------------------------------------------------------------------------- */
#ifndef CKLIST_H
#define CKLIST_H
typedef struct cklist_st cklist;
struct cklist_st {
int size;
int pos;
char **arr;
};
extern cklist* list_make_new();
extern void list_add(cklist *ckl, const char *str);
extern cklist* list_make_and_add(const char *str);
extern void list_rewind(cklist *ckl);
extern int list_next(cklist *ckl);
extern char* list_get(cklist *ckl);
extern char* list_get_at(cklist *ckl, int pos);
extern int list_size(cklist *ckl);
/* rewinds */
extern cklist* list_duplicate(cklist *ckl);
/* rewinds */
extern cklist* list_move(cklist *ckl);
/* rewinds
* copy from index (>=) to the end */
extern cklist* list_copy_from(cklist *ckl, int index);
/* rewinds
* copy from the start until (<) index*/
extern cklist* list_copy_until(cklist *ckl, int index);
/* rewinds
* copy from (>=) until (<) */
extern cklist* list_copy_part(cklist *ckl, int from, int until);
/* rewinds */
extern void list_print_lisp(cklist *ckl);
extern void list_print_python(cklist *ckl);
extern void list_print(cklist *ckl);
extern void list_print_concat(cklist *ckl);
/* Deallocate resources */
extern void list_free(cklist *ckl);
#endif /* CKLIST_H */
|