-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistnode.h
More file actions
39 lines (26 loc) · 1.04 KB
/
listnode.h
File metadata and controls
39 lines (26 loc) · 1.04 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
#pragma once
struct LN typedef ListNode;
// initlaizes a new ListNode list
ListNode* new_list(void);
// frees a node list
void destroy_list(ListNode* head);
// push text on to the end of the list
int push(ListNode* head, const char* text);
// pop off text at end of the list
int pop(ListNode* head);
// insert text at given line number
int add(ListNode* head, int line_index, char* text);
// remove a range of line numbers from list (inclusive start, exclusive stop)
int drop(ListNode* head, int start, int stop);
// edit text at given line number
int edit(ListNode* head, int line_index, char* text);
// return string stored at a given line number
char* get_line(ListNode* head, int line_index);
// returns a concatenated string of lines given a range
char* get_range(ListNode* head, int start, int stop);
// return the size of a list
int length(ListNode* head);
// print all lines in a list
int print(ListNode* head);
// print a range of line numbers from list (inclusive start, exclusive stop)
int print_range(ListNode* head, int start, int stop);