1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-14 16:46:04 -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:
Thiago Farina 2010-11-15 00:10:03 -02:00 committed by Linus Torvalds
parent 72a1af4d91
commit af19da1a99
19 changed files with 160 additions and 130 deletions

View File

@ -10,9 +10,11 @@
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
/*
* This routine, given a pointer to a struct line, and the current cursor goal

8
bind.c
View File

@ -1,17 +1,19 @@
/* BIND.C
/* bind.c
*
* This file is for functions having to do with key bindings,
* descriptions, help commands and startup file.
*
* written 11-feb-86 by Daniel Lawrence
* modified by Petri Kutvonen
* Written 11-feb-86 by Daniel Lawrence
* Modified by Petri Kutvonen
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "epath.h"
#include "line.h"
#include "util.h"
int help(int f, int n)

View File

@ -10,9 +10,11 @@
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
/*
* Attach a buffer to a window. The

View File

@ -1,20 +1,22 @@
/* display.c
*
* 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
* physical display screen the same as the virtual display screen. These
* functions use hints that are left in the windows by the commands.
* 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
* physical display screen the same as the virtual display screen. These
* functions use hints that are left in the windows by the commands.
*
* modified by Petri Kutvonen
* Modified by Petri Kutvonen
*/
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
#include "version.h"
struct video {

View File

@ -1,4 +1,4 @@
/* EBIND.H
/* ebind.h
*
* Initial default key to function bindings
*
@ -8,6 +8,8 @@
#ifndef EBIND_H_
#define EBIND_H_
#include "line.h"
/*
* Command table.
* This table is *roughly* in ASCII order, left to right across the

18
efunc.h
View File

@ -26,24 +26,6 @@ extern int justpara(int f, int n);
extern int killpara(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 */
extern int reposition(int f, int n);
extern int redraw(int f, int n);

View File

@ -500,28 +500,6 @@ struct region {
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
* "TERM" structure holds useful variables, and indirect pointers to routines

2
eval.c
View File

@ -7,10 +7,12 @@
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "evar.h"
#include "line.h"
#include "util.h"
#include "version.h"

19
exec.c
View File

@ -1,22 +1,21 @@
/* EXEC.C
/* exec.c
*
* 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
* modified by Petri Kutvonen
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
/*
* namedcmd:
* execute a named command even if it is not bound
*
* int f, n; command arguments [passed through to command executed]
* Execute a named command even if it is not bound.
*/
int namedcmd(int f, int n)
{

14
file.c
View File

@ -1,4 +1,4 @@
/* FILE.C
/* file.c
*
* The routines in this file handle the reading, writing
* and lookup of disk files. All of details about the
@ -7,11 +7,13 @@
* modified by Petri Kutvonen
*/
#include <stdio.h>
#include <unistd.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include <stdio.h>
#include <unistd.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
/*
* Read a file into the current

View File

@ -1,4 +1,4 @@
/* ISEARCH.C
/* isearch.c
*
* The functions in this file implement commands that perform incremental
* searches in the forward and backward directions. This "ISearch" command
@ -19,13 +19,15 @@
* checknext(), since there were no circumstances where
* it ever equalled FALSE.
*
* modified by Petri Kutvonen
* Modified by Petri Kutvonen
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
#if ISRCH

11
line.c
View File

@ -13,10 +13,13 @@
*
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
/*
* This routine allocates a block of memory large enough to hold a struct line

43
line.h Normal file
View 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_ */

View File

@ -1,17 +1,19 @@
/* RANDOM.C
/* random.c
*
* This file contains the command processing functions for a number of random
* commands. There is no functional grouping here, for sure.
* This file contains the command processing functions for a number of
* random commands. There is no functional grouping here, for sure.
*
* modified by Petri Kutvonen
* Modified by Petri Kutvonen
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include <stdio.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.

View File

@ -1,18 +1,18 @@
/* region.c
*
* The routines in this file
* deal with the region, that magic space
* between "." and mark. Some functions are
* commands. Some functions are just for
* internal use.
* The routines in this file deal with the region, that magic space
* between "." and mark. Some functions are commands. Some functions are
* just for internal use.
*
* modified by Petri Kutvonen
* Modified by Petri Kutvonen
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
/*
* Kill the region. Ask "getregion"

View File

@ -1,4 +1,4 @@
/* SEARCH.C
/* search.c
*
* The functions in this file implement commands that search in the forward
* 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
* appropriate new structures and variables.
*
* modified by Petri Kutvonen
* Modified by Petri Kutvonen
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
static int amatch(MC *mcptr, int direct, struct line **pcwline, int *pcwoff);
static int readpattern(char *prompt, char *apat, int srch);

18
spawn.c
View File

@ -1,14 +1,16 @@
/* SPAWN.C
* various operating system access commands
/* spaw.c
*
* modified by Petri Kutvonen
* Various operating system access commands.
*
* <odified by Petri Kutvonen
*/
#include <stdio.h>
#include <unistd.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include <stdio.h>
#include <unistd.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#if VMS
#define EFN 0 /* Event flag. */

View File

@ -1,14 +1,16 @@
/* WINDOW.C
/* window.c
*
* Window management. Some of the functions are internal, and some are
* attached to keys that the user actually types.
* Window management. Some of the functions are internal, and some are
* attached to keys that the user actually types.
*
*/
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
/*
* Reposition dot in the current window to line "n". If the argument is

25
word.c
View File

@ -1,16 +1,18 @@
/* WORD.C
/* word.c
*
* 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
* do any sentence mode commands, they are likely to be put in this file.
* 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
* 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 "estruct.h"
#include "edef.h"
#include "efunc.h"
#include <stdio.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#include "line.h"
/* 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
@ -19,9 +21,8 @@
* back to the end of the word.
* Returns TRUE on success, FALSE on errors.
*
* int f; default flag
* int n; numeric argument
*
* @f: default flag.
* @n: numeric argument.
*/
int wrapword(int f, int n)
{