-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextbuffer.c
More file actions
122 lines (100 loc) · 2.96 KB
/
textbuffer.c
File metadata and controls
122 lines (100 loc) · 2.96 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
https://powcoder.com
代写代考加微信 powcoder
Assignment Project Exam Help
Add WeChat powcoder
https://powcoder.com
代写代考加微信 powcoder
Assignment Project Exam Help
Add WeChat powcoder
#include <stdlib.h>
#include "textbuffer.h"
struct textbuffer{
};
/* Allocate a new textbuffer whose contents is initialised with the text given
* in the array.
*/
TB newTB (char text[]) {
return NULL;
}
/* Free the memory occupied by the given textbuffer. It is an error to access
* the buffer afterwards.
*/
void releaseTB (TB tb) {
}
/* Allocate and return an array containing the text in the given textbuffer.
* add a prefix corrosponding to line number iff showLineNumbers == TRUE
*/
char *dumpTB (TB tb, int showLineNumbers){
return NULL;
}
/* Return the number of lines of the given textbuffer.
*/
int linesTB (TB tb){
return -1;
}
/* Add a given prefix to all lines between pos1 and pos2
*
* - The program is to abort() with an error message if line 'pos1' or line
* 'pos2' is out of range. The first line of a textbuffer is at position 0.
*/
void addPrefixTB (TB tb, int pos1, int pos2, char* prefix){
}
/* Merge 'tb2' into 'tb1' at line 'pos'.
*
* - Afterwards line 0 of 'tb2' will be line 'pos' of 'tb1'.
* - The old line 'pos' of 'tb1' will follow after the last line of 'tb2'.
* - After this operation 'tb2' can not be used anymore (as if we had used
* releaseTB() on it).
* - The program is to abort() with an error message if 'pos' is out of range.
*/
void mergeTB (TB tb1, int pos, TB tb2){
}
/* Copy 'tb2' into 'tb1' at line 'pos'.
*
* - Afterwards line 0 of 'tb2' will be line 'pos' of 'tb1'.
* - The old line 'pos' of 'tb1' will follow after the last line of 'tb2'.
* - After this operation 'tb2' is unmodified and remains usable independent
* of 'tb1'.
* - The program is to abort() with an error message if 'pos' is out of range.
*/
void pasteTB (TB tb1, int pos, TB tb2) {
}
/* Cut the lines between and including 'from' and 'to' out of the textbuffer
* 'tb'.
*
* - The result is a new textbuffer (much as one created with newTB()).
* - The cut lines will be deleted from 'tb'.
* - The program is to abort() with an error message if 'from' or 'to' is out
* of range.
*/
TB cutTB (TB tb, int from, int to){
return NULL;
}
/* Return a linked list of Match nodes of all the matches of string search
* in tb
*
* - The textbuffer 'tb' will remain unmodified.
* - The user is responsible of freeing the returned list
*/
Match searchTB (TB tb, char* search){
return NULL;
}
/* Remove the lines between and including 'from' and 'to' from the textbuffer
* 'tb'.
*
* - The program is to abort() with an error message if 'from' or 'to' is out
* of range.
*/
void deleteTB (TB tb, int from, int to){
}
/* Search every line of tb for each occurrence of a set of specified subsitituions
* and alter them accordingly
*
* refer to spec for table.
*/
void formRichText (TB tb){
}
/* Your whitebox tests
*/
void whiteBoxTests() {
}