From 4bba6e741741b703dc9c2c271906feca5a7ba0ad Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Sun, 19 May 2013 08:13:48 +0800 Subject: [PATCH] refactor main and basic out of efunc. --- Makefile | 10 +++++----- basic.c | 4 ++++ basic.h | 20 ++++++++++++++++++++ efunc.h | 32 ++------------------------------ main.c | 3 +++ main.h | 20 ++++++++++++++++++++ window.c | 4 +++- 7 files changed, 57 insertions(+), 36 deletions(-) create mode 100644 basic.h create mode 100644 main.h diff --git a/Makefile b/Makefile index 0f0ed63..d81523c 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,8 @@ OBJ=basic.o bind.o buffer.o crypt.o display.o eval.o exec.o \ termio.o window.o word.o names.o globals.o \ wrapper.o utf8.o -HDR=crypt.h display.h ebind.h edef.h efunc.h estruct.h fileio.h input.h \ - version.h window.h +HDR=basic.h crypt.h display.h ebind.h edef.h efunc.h estruct.h fileio.h \ + input.h line.h main.h version.h window.h wrapper.h # DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them @@ -132,7 +132,7 @@ depend: ${SRC} # DO NOT DELETE THIS LINE -- make depend uses it ansi.o: ansi.c estruct.h edef.h -basic.o: basic.c estruct.h edef.h +basic.o: basic.c basic.h estruct.h edef.h bind.o: bind.c estruct.h edef.h fileio.h buffer.o: buffer.c estruct.h edef.h crypt.o: crypt.c crypt.h display.h estruct.h edef.h input.h @@ -146,7 +146,7 @@ input.o: input.c input.h estruct.h edef.h isearch.o: isearch.c estruct.h edef.h line.o: line.c estruct.h edef.h lock.o: lock.c estruct.h edef.h -main.o: main.c estruct.h crypt.h efunc.h edef.h ebind.h version.h +main.o: main.c main.h estruct.h crypt.h efunc.h edef.h ebind.h version.h names.o: names.c estruct.h crypt.h edef.h efunc.h line.h pklock.o: pklock.c estruct.h posix.o: posix.c estruct.h utf8.h @@ -159,7 +159,7 @@ termio.o: termio.c estruct.h edef.h utf8.o: utf8.c utf8.h vmsvt.o: vmsvt.c estruct.h edef.h vt52.o: vt52.c estruct.h edef.h -window.o: window.c window.h estruct.h edef.h +window.o: window.c window.h estruct.h edef.h basic.h display.h main.h line.h wrapper.h word.o: word.c estruct.h edef.h wrapper.o: wrapper.c wrapper.h diff --git a/basic.c b/basic.c index 5071047..edfb6eb 100644 --- a/basic.c +++ b/basic.c @@ -1,3 +1,7 @@ +/* basic.c -- implements basic.h */ + +#include "basic.h" + /* basic.c * * The routines in this file move the cursor around on the screen. They diff --git a/basic.h b/basic.h new file mode 100644 index 0000000..cea1767 --- /dev/null +++ b/basic.h @@ -0,0 +1,20 @@ +#ifndef _BASIC_H_ +#define _BASIC_H_ + +int gotobol( int f, int n) ; +int backchar( int f, int n) ; +int gotoeol( int f, int n) ; +int forwchar( int f, int n) ; +int gotoline( int f, int n) ; +int gotobob( int f, int n) ; +int gotoeob( int f, int n) ; +int forwline( int f, int n) ; +int backline( int f, int n) ; +int gotobop( int f, int n) ; +int gotoeop( int f, int n) ; +int forwpage( int f, int n) ; +int backpage( int f, int n) ; +int setmark( int f, int n) ; +int swapmark( int f, int n) ; + +#endif diff --git a/efunc.h b/efunc.h index 3f9e841..a2b98d6 100644 --- a/efunc.h +++ b/efunc.h @@ -30,21 +30,7 @@ extern int wordcount(int f, int n); #include "window.h" /* basic.c */ -extern int gotobol(int f, int n); -extern int backchar(int f, int n); -extern int gotoeol(int f, int n); -extern int forwchar(int f, int n); -extern int gotoline(int f, int n); -extern int gotobob(int f, int n); -extern int gotoeob(int f, int n); -extern int forwline(int f, int n); -extern int backline(int f, int n); -extern int gotobop(int f, int n); -extern int gotoeop(int f, int n); -extern int forwpage(int f, int n); -extern int backpage(int f, int n); -extern int setmark(int f, int n); -extern int swapmark(int f, int n); +#include "basic.h" /* random.c */ extern int tabsize; /* Tab size (0: use real tabs). */ @@ -82,21 +68,7 @@ extern int istring(int f, int n); extern int ovstring(int f, int n); /* main.c */ -extern void edinit(char *bname); -extern int execute(int c, int f, int n); -extern int quickexit(int f, int n); -extern int quit(int f, int n); -extern int ctlxlp(int f, int n); -extern int ctlxrp(int f, int n); -extern int ctlxe(int f, int n); -extern int ctrlg(int f, int n); -extern int rdonly(void); -extern int resterr(void); -extern int nullproc(int f, int n); -extern int metafn(int f, int n); -extern int cex(int f, int n); -extern int unarg(int f, int n); -extern int cexit(int status); +#include "main.h" /* display.c */ #include "display.h" diff --git a/main.c b/main.c index fd3f939..776ba7e 100644 --- a/main.c +++ b/main.c @@ -1,3 +1,6 @@ +/* main.c -- implements main.h */ +#include "main.h" + /* * main.c diff --git a/main.h b/main.h new file mode 100644 index 0000000..76758e1 --- /dev/null +++ b/main.h @@ -0,0 +1,20 @@ +#ifndef _MAIN_H_ +#define _MAIN_H_ + +void edinit( char *bname) ; +int execute( int c, int f, int n) ; +int quickexit( int f, int n) ; +int quit( int f, int n) ; +int ctlxlp( int f, int n) ; +int ctlxrp( int f, int n) ; +int ctlxe( int f, int n) ; +int ctrlg( int f, int n) ; +int rdonly( void) ; +int resterr( void) ; +int nullproc( int f, int n) ; +int metafn( int f, int n) ; +int cex( int f, int n) ; +int unarg( int f, int n) ; +int cexit( int status) ; + +#endif diff --git a/window.c b/window.c index 27743e8..bd70e44 100644 --- a/window.c +++ b/window.c @@ -11,10 +11,12 @@ #include +#include "basic.h" +#include "display.h" #include "estruct.h" #include "edef.h" -#include "efunc.h" #include "line.h" +#include "main.h" #include "wrapper.h" /*