-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.h
More file actions
49 lines (33 loc) · 1.46 KB
/
list.h
File metadata and controls
49 lines (33 loc) · 1.46 KB
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
#ifndef LIST_H
#define LIST_H
typedef struct TokenList {
char **tokens;
int count;
int capacity;
} TokenList;
/* ===== Базовые операции со списком ===== */
/* Создать новый пустой список */
TokenList* token_list_create(void);
/* Освободить память списка */
void token_list_free(TokenList *list);
/* Очистить список (удалить все элементы, но оставить структуру) */
void token_list_clear(TokenList *list);
/* Добавить лексему в список */
int token_list_append(TokenList *list, const char *token);
/* Получить количество лексем */
int token_list_count(const TokenList *list);
/* Получить массив лексем (для обратной совместимости) */
char** token_list_array(const TokenList *list);
/* Функции для shell */
/* Построить список лексем из строки */
TokenList* tokenize_to_list(const char *line);
/* Подстановка переменных окружения ($HOME, $USER.) */
void substitute_env_vars_in_list(TokenList *list);
/* Отладочная печать списка */
void token_list_print(const TokenList *list);
void list_init(void);
void list_clear(void);
TokenList tokenize(const char *line);
void substitute_env_vars(TokenList tokens);
void free_tokens(TokenList tokens);
#endif