aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Farina <tfransosi@gmail.com>2010-11-15 00:10:03 -0200
committerLinus Torvalds <torvalds@linux-foundation.org>2010-11-15 08:46:20 -0800
commitaf19da1a99c37bc8b5e82f1d272673260f0a976f (patch)
tree598eb2ebac367659b5c0f426c78ce664846a2145
parent72a1af4d91a36516e9c7642368ab35fba28cc25c (diff)
downloaduemacs-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.c2
-rw-r--r--bind.c8
-rw-r--r--buffer.c8
-rw-r--r--display.c12
-rw-r--r--ebind.h4
-rw-r--r--efunc.h18
-rw-r--r--estruct.h22
-rw-r--r--eval.c2
-rw-r--r--exec.c19
-rw-r--r--file.c14
-rw-r--r--isearch.c14
-rw-r--r--line.c11
-rw-r--r--line.h43
-rw-r--r--random.c20
-rw-r--r--region.c20
-rw-r--r--search.c14
-rw-r--r--spawn.c18
-rw-r--r--window.c16
-rw-r--r--word.c25
19 files changed, 160 insertions, 130 deletions
diff --git a/basic.c b/basic.c
index d651805..3bf0227 100644
--- a/basic.c
+++ b/basic.c
@@ -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
diff --git a/bind.c b/bind.c
index cc20f7d..eb28c1f 100644
--- a/bind.c
+++ b/bind.c
@@ -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)
diff --git a/buffer.c b/buffer.c
index 15ff057..2555898 100644
--- a/buffer.c
+++ b/buffer.c
@@ -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
diff --git a/display.c b/display.c
index a122be5..08c9884 100644
--- a/display.c
+++ b/display.c
@@ -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 {
diff --git a/ebind.h b/ebind.h
index 2138946..f245246 100644
--- a/ebind.h
+++ b/ebind.h
@@ -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
diff --git a/efunc.h b/efunc.h
index 0077e71..af032d9 100644
--- a/efunc.h
+++ b/efunc.h
@@ -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);
diff --git a/estruct.h b/estruct.h
index 75acb4a..21ed08e 100644
--- a/estruct.h
+++ b/estruct.h
@@ -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.
diff --git a/eval.c b/eval.c
index c56be78..44e8a9b 100644
--- a/eval.c
+++ b/eval.c
@@ -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"
diff --git a/exec.c b/exec.c
index fcbb313..2937966 100644
--- a/exec.c
+++ b/exec.c
@@ -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)
{
diff --git a/file.c b/file.c
index 0a52cb0..29529c3 100644
--- a/file.c
+++ b/file.c
@@ -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
diff --git a/isearch.c b/isearch.c
index cefd70f..dcc408b 100644
--- a/isearch.c
+++ b/isearch.c
@@ -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
diff --git a/line.c b/line.c
index e7f1279..f96b259 100644
--- a/line.c
+++ b/line.c
@@ -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
diff --git a/line.h b/line.h
new file mode 100644
index 0000000..3900dbe
--- /dev/null
+++ b/line.h
@@ -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_ */
diff --git a/random.c b/random.c
index da95b1d..52acd45 100644
--- a/random.c
+++ b/random.c
@@ -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.
diff --git a/region.c b/region.c
index 80b28e7..5190f86 100644
--- a/region.c
+++ b/region.c
@@ -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"
diff --git a/search.c b/search.c
index af11af7..d86e5f4 100644
--- a/search.c
+++ b/search.c
@@ -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);
diff --git a/spawn.c b/spawn.c
index 1286ba3..5ad1366 100644
--- a/spawn.c
+++ b/spawn.c
@@ -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. */
diff --git a/window.c b/window.c
index deb7b0c..6a78b81 100644
--- a/window.c
+++ b/window.c
@@ -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
diff --git a/word.c b/word.c
index 1f318b0..4b6fead 100644
--- a/word.c
+++ b/word.c
@@ -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)
{