2010-11-14 21:10:03 -05:00
|
|
|
#ifndef LINE_H_
|
|
|
|
#define LINE_H_
|
|
|
|
|
2015-02-12 22:54:17 -05:00
|
|
|
#include "retcode.h"
|
2012-07-11 13:43:16 -04:00
|
|
|
#include "utf8.h"
|
|
|
|
|
2013-10-10 23:20:06 -04:00
|
|
|
#define NLINE 256 /* # of bytes, input line */
|
|
|
|
|
2010-11-14 21:10:03 -05:00
|
|
|
/*
|
|
|
|
* All text is kept in circularly linked lists of "struct line" structures. These
|
|
|
|
* begin at the header line (which is the blank line beyond the end of the
|
|
|
|
* buffer). This line is pointed to by the "struct buffer". Each line contains a the
|
|
|
|
* number of bytes in the line (the "used" size), the size of the text array,
|
|
|
|
* and the text. The end of line is not stored as a byte; it's implied. Future
|
|
|
|
* additions will include update hints, and a list of marks into the line.
|
|
|
|
*/
|
|
|
|
struct line {
|
|
|
|
struct line *l_fp; /* Link to the next line */
|
|
|
|
struct line *l_bp; /* Link to the previous line */
|
2013-02-22 17:32:16 -05:00
|
|
|
int l_size; /* Allocated size */
|
|
|
|
int l_used; /* Used size */
|
2010-11-14 21:10:03 -05:00
|
|
|
char l_text[1]; /* A bunch of characters. */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define lforw(lp) ((lp)->l_fp)
|
|
|
|
#define lback(lp) ((lp)->l_bp)
|
|
|
|
#define lgetc(lp, n) ((lp)->l_text[(n)]&0xFF)
|
|
|
|
#define lputc(lp, n, c) ((lp)->l_text[(n)]=(c))
|
|
|
|
#define llength(lp) ((lp)->l_used)
|
|
|
|
|
2016-02-24 00:22:54 -05:00
|
|
|
extern int tabwidth ;
|
2013-10-09 23:42:33 -04:00
|
|
|
|
2013-09-25 01:23:52 -04:00
|
|
|
char *getkill( void) ;
|
|
|
|
|
2013-06-13 23:53:59 -04:00
|
|
|
int backchar( int f, int n) ;
|
|
|
|
int forwchar( int f, int n) ;
|
|
|
|
|
2013-05-18 20:43:30 -04:00
|
|
|
void lfree( struct line *lp) ;
|
|
|
|
void lchange( int flag) ;
|
|
|
|
int insspace( int f, int n) ;
|
|
|
|
int linstr( char *instr) ;
|
2015-02-02 06:44:35 -05:00
|
|
|
int linsert( int n, unicode_t c) ;
|
2013-05-18 20:43:30 -04:00
|
|
|
int lover( char *ostr) ;
|
|
|
|
int lnewline( void) ;
|
|
|
|
int ldelete( long n, int kflag) ;
|
|
|
|
int ldelchar( long n, int kflag) ;
|
|
|
|
int lgetchar( unicode_t *) ;
|
|
|
|
char *getctext( void) ;
|
|
|
|
void kdelete( void) ;
|
|
|
|
int kinsert( int c) ;
|
|
|
|
int yank( int f, int n) ;
|
|
|
|
struct line *lalloc( int) ; /* Allocate a line. */
|
2010-11-14 21:10:03 -05:00
|
|
|
|
2015-02-12 22:54:17 -05:00
|
|
|
boolean rdonly( void) ; /* Read Only error message */
|
|
|
|
|
2010-11-14 21:10:03 -05:00
|
|
|
#endif /* LINE_H_ */
|