主题:关于文本(textbuffer)的C语言实现问题
#define TEXTBUFFER_H
typedef struct textbuffer *TB;
/* Allocate a new textbuffer whose contents is initialised with the text given
* in the array.
*/
TB newTB (char text[]);
/* 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.
*/
char *dumpTB (TB tb);
/* Return the number of lines of the given textbuffer.
*/
int linesTB (TB tb);
/* Swap the two given lines in the textbuffer.
*
* - 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 swapTB (TB tb, int pos1, int pos2);
/* 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);
/* Copy the lines between and including 'from' and 'to' of the textbuffer
* 'tb'.
*
* - The result is a new textbuffer (much as one created with newTB()).
* - The textbuffer 'tb' will remain unmodified.
* - The program is to abort() with an error message if 'from' or 'to' is out
* of range.
*/
TB copyTB (TB tb, int from, int to);
/* 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);
#endif
以上是我摘自国外网站的题目,但是看不太懂。。还请教高手来看看