diff options
author | Thiago Farina <tfransosi@gmail.com> | 2010-11-15 00:10:03 -0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-15 08:46:20 -0800 |
commit | af19da1a99c37bc8b5e82f1d272673260f0a976f (patch) | |
tree | 598eb2ebac367659b5c0f426c78ce664846a2145 | |
parent | 72a1af4d91a36516e9c7642368ab35fba28cc25c (diff) | |
download | uemacs-af19da1a99c37bc8b5e82f1d272673260f0a976f.tar.gz |
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>
-rw-r--r-- | basic.c | 2 | ||||
-rw-r--r-- | bind.c | 8 | ||||
-rw-r--r-- | buffer.c | 8 | ||||
-rw-r--r-- | display.c | 12 | ||||
-rw-r--r-- | ebind.h | 4 | ||||
-rw-r--r-- | efunc.h | 18 | ||||
-rw-r--r-- | estruct.h | 22 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | exec.c | 19 | ||||
-rw-r--r-- | file.c | 14 | ||||
-rw-r--r-- | isearch.c | 14 | ||||
-rw-r--r-- | line.c | 11 | ||||
-rw-r--r-- | line.h | 43 | ||||
-rw-r--r-- | random.c | 20 | ||||
-rw-r--r-- | region.c | 20 | ||||
-rw-r--r-- | search.c | 14 | ||||
-rw-r--r-- | spawn.c | 18 | ||||
-rw-r--r-- | window.c | 16 | ||||
-rw-r--r-- | word.c | 25 |
19 files changed, 160 insertions, 130 deletions
@@ -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 @@ -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) @@ -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 @@ -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 { @@ -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 @@ -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); @@ -501,28 +501,6 @@ struct region { }; /* - * 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 * that do useful operations. The low level get and put routines are here too. @@ -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" @@ -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) { @@ -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 @@ -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 @@ -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 @@ -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_ */ @@ -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. @@ -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" @@ -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); @@ -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. */ @@ -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 @@ -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) { |