mirror of
https://github.com/rfivet/uemacs.git
synced 2025-02-20 06:57:11 -05:00
uemacs: Move structure line and its functions to its own header file.
Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
72a1af4d91
commit
af19da1a99
2
basic.c
2
basic.c
@ -10,9 +10,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
#include "edef.h"
|
#include "edef.h"
|
||||||
#include "efunc.h"
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This routine, given a pointer to a struct line, and the current cursor goal
|
* This routine, given a pointer to a struct line, and the current cursor goal
|
||||||
|
8
bind.c
8
bind.c
@ -1,17 +1,19 @@
|
|||||||
/* BIND.C
|
/* bind.c
|
||||||
*
|
*
|
||||||
* This file is for functions having to do with key bindings,
|
* This file is for functions having to do with key bindings,
|
||||||
* descriptions, help commands and startup file.
|
* descriptions, help commands and startup file.
|
||||||
*
|
*
|
||||||
* written 11-feb-86 by Daniel Lawrence
|
* Written 11-feb-86 by Daniel Lawrence
|
||||||
* modified by Petri Kutvonen
|
* Modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
#include "edef.h"
|
#include "edef.h"
|
||||||
#include "efunc.h"
|
#include "efunc.h"
|
||||||
#include "epath.h"
|
#include "epath.h"
|
||||||
|
#include "line.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
int help(int f, int n)
|
int help(int f, int n)
|
||||||
|
8
buffer.c
8
buffer.c
@ -10,9 +10,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include "estruct.h"
|
||||||
#include "efunc.h"
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attach a buffer to a window. The
|
* Attach a buffer to a window. The
|
||||||
|
12
display.c
12
display.c
@ -1,20 +1,22 @@
|
|||||||
/* display.c
|
/* display.c
|
||||||
*
|
*
|
||||||
* The functions in this file handle redisplay. There are two halves, the
|
* The functions in this file handle redisplay. There are two halves, the
|
||||||
* ones that update the virtual display screen, and the ones that make the
|
* ones that update the virtual display screen, and the ones that make the
|
||||||
* physical display screen the same as the virtual display screen. These
|
* physical display screen the same as the virtual display screen. These
|
||||||
* functions use hints that are left in the windows by the commands.
|
* functions use hints that are left in the windows by the commands.
|
||||||
*
|
*
|
||||||
* modified by Petri Kutvonen
|
* Modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
#include "edef.h"
|
#include "edef.h"
|
||||||
#include "efunc.h"
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
struct video {
|
struct video {
|
||||||
|
4
ebind.h
4
ebind.h
@ -1,4 +1,4 @@
|
|||||||
/* EBIND.H
|
/* ebind.h
|
||||||
*
|
*
|
||||||
* Initial default key to function bindings
|
* Initial default key to function bindings
|
||||||
*
|
*
|
||||||
@ -8,6 +8,8 @@
|
|||||||
#ifndef EBIND_H_
|
#ifndef EBIND_H_
|
||||||
#define EBIND_H_
|
#define EBIND_H_
|
||||||
|
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Command table.
|
* Command table.
|
||||||
* This table is *roughly* in ASCII order, left to right across the
|
* This table is *roughly* in ASCII order, left to right across the
|
||||||
|
18
efunc.h
18
efunc.h
@ -26,24 +26,6 @@ extern int justpara(int f, int n);
|
|||||||
extern int killpara(int f, int n);
|
extern int killpara(int f, int n);
|
||||||
extern int wordcount(int f, int n);
|
extern int wordcount(int f, int n);
|
||||||
|
|
||||||
/* line.c */
|
|
||||||
extern void lfree(struct line *lp);
|
|
||||||
extern void lchange(int flag);
|
|
||||||
extern int insspace(int f, int n);
|
|
||||||
extern int linstr(char *instr);
|
|
||||||
extern int linsert(int n, int c);
|
|
||||||
extern int lowrite(int c);
|
|
||||||
extern int lover(char *ostr);
|
|
||||||
extern int lnewline(void);
|
|
||||||
extern int ldelete(long n, int kflag);
|
|
||||||
extern char *getctext(void);
|
|
||||||
extern int putctext(char *iline);
|
|
||||||
extern int ldelnewline(void);
|
|
||||||
extern void kdelete(void);
|
|
||||||
extern int kinsert(int c);
|
|
||||||
extern int yank(int f, int n);
|
|
||||||
extern struct line *lalloc(int); /* Allocate a line. */
|
|
||||||
|
|
||||||
/* window.c */
|
/* window.c */
|
||||||
extern int reposition(int f, int n);
|
extern int reposition(int f, int n);
|
||||||
extern int redraw(int f, int n);
|
extern int redraw(int f, int n);
|
||||||
|
22
estruct.h
22
estruct.h
@ -500,28 +500,6 @@ struct region {
|
|||||||
long r_size; /* Length in characters. */
|
long r_size; /* Length in characters. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 */
|
|
||||||
short l_size; /* Allocated size */
|
|
||||||
short l_used; /* Used size */
|
|
||||||
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)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The editor communicates with the display using a high level interface. A
|
* The editor communicates with the display using a high level interface. A
|
||||||
* "TERM" structure holds useful variables, and indirect pointers to routines
|
* "TERM" structure holds useful variables, and indirect pointers to routines
|
||||||
|
2
eval.c
2
eval.c
@ -7,10 +7,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
#include "edef.h"
|
#include "edef.h"
|
||||||
#include "efunc.h"
|
#include "efunc.h"
|
||||||
#include "evar.h"
|
#include "evar.h"
|
||||||
|
#include "line.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
19
exec.c
19
exec.c
@ -1,22 +1,21 @@
|
|||||||
/* EXEC.C
|
/* exec.c
|
||||||
*
|
*
|
||||||
* This file is for functions dealing with execution of
|
* This file is for functions dealing with execution of
|
||||||
* commands, command lines, buffers, files and startup files
|
* commands, command lines, buffers, files and startup files.
|
||||||
*
|
*
|
||||||
* written 1986 by Daniel Lawrence
|
* written 1986 by Daniel Lawrence
|
||||||
* modified by Petri Kutvonen
|
* modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include "estruct.h"
|
||||||
#include "efunc.h"
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* namedcmd:
|
* Execute a named command even if it is not bound.
|
||||||
* execute a named command even if it is not bound
|
|
||||||
*
|
|
||||||
* int f, n; command arguments [passed through to command executed]
|
|
||||||
*/
|
*/
|
||||||
int namedcmd(int f, int n)
|
int namedcmd(int f, int n)
|
||||||
{
|
{
|
||||||
|
14
file.c
14
file.c
@ -1,4 +1,4 @@
|
|||||||
/* FILE.C
|
/* file.c
|
||||||
*
|
*
|
||||||
* The routines in this file handle the reading, writing
|
* The routines in this file handle the reading, writing
|
||||||
* and lookup of disk files. All of details about the
|
* and lookup of disk files. All of details about the
|
||||||
@ -7,11 +7,13 @@
|
|||||||
* modified by Petri Kutvonen
|
* modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include "estruct.h"
|
||||||
#include "efunc.h"
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read a file into the current
|
* Read a file into the current
|
||||||
|
14
isearch.c
14
isearch.c
@ -1,4 +1,4 @@
|
|||||||
/* ISEARCH.C
|
/* isearch.c
|
||||||
*
|
*
|
||||||
* The functions in this file implement commands that perform incremental
|
* The functions in this file implement commands that perform incremental
|
||||||
* searches in the forward and backward directions. This "ISearch" command
|
* searches in the forward and backward directions. This "ISearch" command
|
||||||
@ -19,13 +19,15 @@
|
|||||||
* checknext(), since there were no circumstances where
|
* checknext(), since there were no circumstances where
|
||||||
* it ever equalled FALSE.
|
* it ever equalled FALSE.
|
||||||
*
|
*
|
||||||
* modified by Petri Kutvonen
|
* Modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include "estruct.h"
|
||||||
#include "efunc.h"
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
#if ISRCH
|
#if ISRCH
|
||||||
|
|
||||||
|
11
line.c
11
line.c
@ -13,10 +13,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "line.h"
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include <stdio.h>
|
||||||
#include "efunc.h"
|
|
||||||
|
#include "estruct.h"
|
||||||
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This routine allocates a block of memory large enough to hold a struct line
|
* This routine allocates a block of memory large enough to hold a struct line
|
||||||
|
43
line.h
Normal file
43
line.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#ifndef LINE_H_
|
||||||
|
#define LINE_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 */
|
||||||
|
short l_size; /* Allocated size */
|
||||||
|
short l_used; /* Used size */
|
||||||
|
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)
|
||||||
|
|
||||||
|
extern void lfree(struct line *lp);
|
||||||
|
extern void lchange(int flag);
|
||||||
|
extern int insspace(int f, int n);
|
||||||
|
extern int linstr(char *instr);
|
||||||
|
extern int linsert(int n, int c);
|
||||||
|
extern int lowrite(int c);
|
||||||
|
extern int lover(char *ostr);
|
||||||
|
extern int lnewline(void);
|
||||||
|
extern int ldelete(long n, int kflag);
|
||||||
|
extern char *getctext(void);
|
||||||
|
extern int putctext(char *iline);
|
||||||
|
extern int ldelnewline(void);
|
||||||
|
extern void kdelete(void);
|
||||||
|
extern int kinsert(int c);
|
||||||
|
extern int yank(int f, int n);
|
||||||
|
extern struct line *lalloc(int); /* Allocate a line. */
|
||||||
|
|
||||||
|
#endif /* LINE_H_ */
|
20
random.c
20
random.c
@ -1,17 +1,19 @@
|
|||||||
/* RANDOM.C
|
/* random.c
|
||||||
*
|
*
|
||||||
* This file contains the command processing functions for a number of random
|
* This file contains the command processing functions for a number of
|
||||||
* commands. There is no functional grouping here, for sure.
|
* random commands. There is no functional grouping here, for sure.
|
||||||
*
|
*
|
||||||
* modified by Petri Kutvonen
|
* Modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
|
||||||
#include "efunc.h"
|
|
||||||
|
|
||||||
int tabsize; /* Tab size (0: use real tabs) */
|
#include "estruct.h"
|
||||||
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
|
int tabsize; /* Tab size (0: use real tabs) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set fill column to n.
|
* Set fill column to n.
|
||||||
|
20
region.c
20
region.c
@ -1,18 +1,18 @@
|
|||||||
/* region.c
|
/* region.c
|
||||||
*
|
*
|
||||||
* The routines in this file
|
* The routines in this file deal with the region, that magic space
|
||||||
* deal with the region, that magic space
|
* between "." and mark. Some functions are commands. Some functions are
|
||||||
* between "." and mark. Some functions are
|
* just for internal use.
|
||||||
* commands. Some functions are just for
|
|
||||||
* internal use.
|
|
||||||
*
|
*
|
||||||
* modified by Petri Kutvonen
|
* Modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include "estruct.h"
|
||||||
#include "efunc.h"
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Kill the region. Ask "getregion"
|
* Kill the region. Ask "getregion"
|
||||||
|
14
search.c
14
search.c
@ -1,4 +1,4 @@
|
|||||||
/* SEARCH.C
|
/* search.c
|
||||||
*
|
*
|
||||||
* The functions in this file implement commands that search in the forward
|
* The functions in this file implement commands that search in the forward
|
||||||
* and backward directions. There are no special characters in the search
|
* and backward directions. There are no special characters in the search
|
||||||
@ -54,13 +54,15 @@
|
|||||||
* whether or not to make use of the array. And, put in the
|
* whether or not to make use of the array. And, put in the
|
||||||
* appropriate new structures and variables.
|
* appropriate new structures and variables.
|
||||||
*
|
*
|
||||||
* modified by Petri Kutvonen
|
* Modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include "estruct.h"
|
||||||
#include "efunc.h"
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
static int amatch(MC *mcptr, int direct, struct line **pcwline, int *pcwoff);
|
static int amatch(MC *mcptr, int direct, struct line **pcwline, int *pcwoff);
|
||||||
static int readpattern(char *prompt, char *apat, int srch);
|
static int readpattern(char *prompt, char *apat, int srch);
|
||||||
|
18
spawn.c
18
spawn.c
@ -1,14 +1,16 @@
|
|||||||
/* SPAWN.C
|
/* spaw.c
|
||||||
* various operating system access commands
|
|
||||||
*
|
*
|
||||||
* modified by Petri Kutvonen
|
* Various operating system access commands.
|
||||||
|
*
|
||||||
|
* <odified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include "estruct.h"
|
||||||
#include "efunc.h"
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
|
||||||
#if VMS
|
#if VMS
|
||||||
#define EFN 0 /* Event flag. */
|
#define EFN 0 /* Event flag. */
|
||||||
|
16
window.c
16
window.c
@ -1,14 +1,16 @@
|
|||||||
/* WINDOW.C
|
/* window.c
|
||||||
*
|
*
|
||||||
* Window management. Some of the functions are internal, and some are
|
* Window management. Some of the functions are internal, and some are
|
||||||
* attached to keys that the user actually types.
|
* attached to keys that the user actually types.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include "estruct.h"
|
||||||
#include "efunc.h"
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reposition dot in the current window to line "n". If the argument is
|
* Reposition dot in the current window to line "n". If the argument is
|
||||||
|
25
word.c
25
word.c
@ -1,16 +1,18 @@
|
|||||||
/* WORD.C
|
/* word.c
|
||||||
*
|
*
|
||||||
* The routines in this file implement commands that work word or a
|
* The routines in this file implement commands that work word or a
|
||||||
* paragraph at a time. There are all sorts of word mode commands. If I
|
* paragraph at a time. There are all sorts of word mode commands. If I
|
||||||
* do any sentence mode commands, they are likely to be put in this file.
|
* do any sentence mode commands, they are likely to be put in this file.
|
||||||
*
|
*
|
||||||
* modified by Petri Kutvonen
|
* Modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "estruct.h"
|
|
||||||
#include "edef.h"
|
#include "estruct.h"
|
||||||
#include "efunc.h"
|
#include "edef.h"
|
||||||
|
#include "efunc.h"
|
||||||
|
#include "line.h"
|
||||||
|
|
||||||
/* Word wrap on n-spaces. Back-over whatever precedes the point on the current
|
/* Word wrap on n-spaces. Back-over whatever precedes the point on the current
|
||||||
* line and stop on the first word-break or the beginning of the line. If we
|
* line and stop on the first word-break or the beginning of the line. If we
|
||||||
@ -19,9 +21,8 @@
|
|||||||
* back to the end of the word.
|
* back to the end of the word.
|
||||||
* Returns TRUE on success, FALSE on errors.
|
* Returns TRUE on success, FALSE on errors.
|
||||||
*
|
*
|
||||||
* int f; default flag
|
* @f: default flag.
|
||||||
* int n; numeric argument
|
* @n: numeric argument.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
int wrapword(int f, int n)
|
int wrapword(int f, int n)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user