Name pointer type to struct.

This commit is contained in:
Renaud 2021-07-31 15:28:32 +08:00
parent 486d01297d
commit 27f30e48d2
2 changed files with 21 additions and 19 deletions

View File

@ -17,11 +17,11 @@ typedef char bname_t[ 16] ; /* buffer name type */
* Buffers may be "Inactive" which means the files associated with them
* have not been read in yet. These get read in at "use buffer" time.
*/
struct buffer {
typedef struct buffer {
struct buffer *b_bufp; /* Link to next struct buffer */
struct line *b_dotp; /* Link to "." struct line structure */
struct line *b_markp; /* The same as the above two, */
struct line *b_linep; /* Link to the header struct line */
line_p b_dotp ; /* Link to "." struct line structure */
line_p b_markp ; /* The same as the above two, */
line_p b_linep ; /* Link to the header struct line */
int b_doto; /* Offset of "." in above struct line */
int b_marko; /* but for the "mark" */
int b_mode; /* editor mode of this buffer */
@ -30,11 +30,11 @@ struct buffer {
char b_flag; /* Flags */
fname_t b_fname ; /* File name */
bname_t b_bname ; /* Buffer name */
};
} *buffer_p ;
extern struct buffer *curbp ; /* Current buffer */
extern struct buffer *bheadp ; /* Head of list of buffers */
extern struct buffer *blistp ; /* Buffer for C-X C-B */
extern buffer_p curbp ; /* Current buffer */
extern buffer_p bheadp ; /* Head of list of buffers */
extern buffer_p blistp ; /* Buffer for C-X C-B */
#define BFINVS 0x01 /* Internal invisable buffer */
#define BFCHG 0x02 /* Changed since last write */
@ -60,15 +60,15 @@ extern int gmode ; /* global editor mode */
int usebuffer( int f, int n) ;
int nextbuffer( int f, int n) ;
int swbuffer( struct buffer *bp) ;
int swbuffer( buffer_p bp) ;
int killbuffer( int f, int n) ;
int zotbuf( struct buffer *bp) ;
int zotbuf( buffer_p bp) ;
int namebuffer( int f, int n) ;
int listbuffers( int f, int n) ;
int anycb( void) ;
int bclear( struct buffer *bp) ;
int bclear( buffer_p bp) ;
int unmark( int f, int n) ;
/* Lookup a buffer by name. */
struct buffer *bfind( const char *bname, int cflag, int bflag) ;
buffer_p bfind( const char *bname, int cflag, int bflag) ;
#endif

16
line.h
View File

@ -6,11 +6,12 @@
/*
* 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
* 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.
* 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 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.
*/
typedef struct line {
struct line *l_fp ; /* Forward link to the next line */
@ -30,12 +31,14 @@ extern int tabwidth ; /* Map to $tab, default to 8, can be set to [1, .. */
char *getkill( void) ;
/* Bindable functions */
boolean backchar( int f, int n) ;
boolean forwchar( int f, int n) ;
int insspace( int f, int n) ;
int yank( int f, int n) ;
void lfree( line_p lp) ;
void lchange( int flag) ;
int insspace( int f, int n) ;
int linstr( char *instr) ;
int linsert( int n, unicode_t c) ;
boolean linsert_byte( int n, int c) ;
@ -47,7 +50,6 @@ int lgetchar( unicode_t *) ;
char *getctext( void) ;
void kdelete( void) ;
int kinsert( int c) ;
int yank( int f, int n) ;
line_p lalloc( int minsize) ; /* Allocate a line of at least minsize chars. */
boolean rdonly( void) ; /* Read Only error message */