-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistory.c
38 lines (33 loc) · 844 Bytes
/
history.c
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
// TODO Implement Start, end , insert pointer, read pointer
/*
int start, end, insert_offset, read_pointer;
void init(){
end = 0;
insert_offset = 0;
read_pointer = 0;
}
// end is the last element populated in the array
void* insert(int* data_headpointer, char* command) {
data_headpointer[insert_offset++] = command;
end = insert_offset;
read_pointer = end + 1;
}
//read the command then point to older command
void* read_up(data_headpointer){
if ( read_pointer = 0 ){
print(data_headpointer[read_pointer]);
}
else if ( 0 < read_pointer <= end+1){
print(data_headpointer[--read_pointer]);
}
}
//read the command then point to newer command
void* read_down(data_headpointer){
if (read_pointer+1 > end){
//CLEAR LINE
}
else if (read_pointer+1 <= end){
print(data_headpointer[++read_pointer])
}
}
*/