1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-09-30 01:05:54 -04:00

Move dependencies from display to log.

This commit is contained in:
Renaud 2013-09-18 14:25:39 +08:00
parent 245c4a0477
commit 45ea35f2a7
11 changed files with 50 additions and 46 deletions

View File

@ -148,8 +148,8 @@ exec.o: exec.c exec.h estruct.h line.h utf8.h buffer.h bind.h edef.h \
display.h eval.h file.h flook.h input.h display.h eval.h file.h flook.h input.h
execute.o: execute.c edef.h estruct.h line.h utf8.h bind.h random.h \ execute.o: execute.c edef.h estruct.h line.h utf8.h bind.h random.h \
display.h file.h display.h file.h
file.o: file.c file.h buffer.h estruct.h line.h utf8.h crypt.h display.h \ file.o: file.c file.h buffer.h estruct.h line.h utf8.h crypt.h edef.h \
edef.h execute.h fileio.h input.h lock.h window.h execute.h fileio.h input.h lock.h log.h window.h
fileio.o: fileio.c fileio.h estruct.h line.h utf8.h crypt.h fileio.o: fileio.c fileio.h estruct.h line.h utf8.h crypt.h
flook.o: flook.c flook.h estruct.h line.h utf8.h fileio.h flook.o: flook.c flook.h estruct.h line.h utf8.h fileio.h
globals.o: globals.c estruct.h line.h utf8.h edef.h globals.o: globals.c estruct.h line.h utf8.h edef.h
@ -170,12 +170,12 @@ names.o: names.c names.h basic.h bind.h edef.h estruct.h line.h utf8.h \
pklock.o: pklock.c pklock.h estruct.h line.h utf8.h edef.h pklock.o: pklock.c pklock.h estruct.h line.h utf8.h edef.h
posix.o: posix.c termio.h posix.o: posix.c termio.h
random.o: random.c random.h basic.h display.h estruct.h line.h utf8.h \ random.o: random.c random.h basic.h display.h estruct.h line.h utf8.h \
edef.h execute.h input.h search.h edef.h execute.h input.h log.h search.h
region.o: region.c region.h estruct.h line.h utf8.h display.h edef.h region.o: region.c region.h estruct.h line.h utf8.h edef.h log.h
search.o: search.c search.h estruct.h line.h utf8.h basic.h display.h \ search.o: search.c search.h estruct.h line.h utf8.h basic.h display.h \
edef.h input.h edef.h input.h log.h
spawn.o: spawn.c spawn.h buffer.h estruct.h line.h utf8.h display.h \ spawn.o: spawn.c spawn.h buffer.h estruct.h line.h utf8.h display.h \
edef.h file.h input.h window.h edef.h file.h input.h log.h window.h
tcap.o: tcap.c display.h estruct.h line.h utf8.h edef.h termio.h tcap.o: tcap.c display.h estruct.h line.h utf8.h edef.h termio.h
termio.o: termio.c termio.h estruct.h line.h utf8.h edef.h termio.o: termio.c termio.h estruct.h line.h utf8.h edef.h
utf8.o: utf8.c utf8.h utf8.o: utf8.c utf8.h
@ -183,7 +183,7 @@ vmsvt.o: vmsvt.c estruct.h line.h utf8.h edef.h
vt52.o: vt52.c estruct.h line.h utf8.h edef.h vt52.o: vt52.c estruct.h line.h utf8.h edef.h
window.o: window.c window.h estruct.h line.h utf8.h basic.h display.h \ window.o: window.c window.h estruct.h line.h utf8.h basic.h display.h \
edef.h execute.h wrapper.h edef.h execute.h wrapper.h
word.o: word.c word.h basic.h display.h estruct.h line.h utf8.h edef.h \ word.o: word.c word.h basic.h estruct.h line.h utf8.h edef.h log.h \
random.h region.h random.h region.h
wrapper.o: wrapper.c wrapper.h wrapper.o: wrapper.c wrapper.h

View File

@ -1552,11 +1552,3 @@ static int newscreensize(int h, int w)
} }
#endif #endif
int resterr(void)
{
TTbeep();
mlwrite("(That command is RESTRICTED)");
return FALSE;
}

View File

@ -20,7 +20,4 @@ void mlputs( char *s) ;
void getscreensize( int *widthp, int *heightp) ; void getscreensize( int *widthp, int *heightp) ;
void sizesignal( int signr) ; void sizesignal( int signr) ;
int rdonly( void) ;
int resterr( void) ;
#endif #endif

38
file.c
View File

@ -16,7 +16,6 @@
#include "buffer.h" #include "buffer.h"
#include "crypt.h" #include "crypt.h"
#include "display.h"
#include "estruct.h" #include "estruct.h"
#include "edef.h" #include "edef.h"
#include "execute.h" #include "execute.h"
@ -24,6 +23,7 @@
#include "input.h" #include "input.h"
#include "line.h" #include "line.h"
#include "lock.h" #include "lock.h"
#include "log.h"
#include "window.h" #include "window.h"
#if PKCODE #if PKCODE
@ -166,7 +166,7 @@ int set_encryption_key(int f, int n)
strcpy(curbp->b_key, key); strcpy(curbp->b_key, key);
cryptbufferkey( curbp) ; cryptbufferkey( curbp) ;
mlwrite(" "); /* clear it off the bottom line */ logwrite(" "); /* clear it off the bottom line */
return TRUE; return TRUE;
} }
@ -228,7 +228,7 @@ int getfile(char *fname, int lockfl)
curwp->w_linep = lp; curwp->w_linep = lp;
curwp->w_flag |= WFMODE | WFHARD; curwp->w_flag |= WFMODE | WFHARD;
cknewwindow(); cknewwindow();
mlwrite("(Old buffer)"); logwrite("(Old buffer)");
return TRUE; return TRUE;
} }
} }
@ -244,7 +244,7 @@ int getfile(char *fname, int lockfl)
} }
} }
if (bp == NULL && (bp = bfind(bname, TRUE, 0)) == NULL) { if (bp == NULL && (bp = bfind(bname, TRUE, 0)) == NULL) {
mlwrite("Cannot create buffer"); logwrite("Cannot create buffer");
return FALSE; return FALSE;
} }
if (--curbp->b_nwnd == 0) { /* Undisplay. */ if (--curbp->b_nwnd == 0) { /* Undisplay. */
@ -315,12 +315,12 @@ int readin(char *fname, int lockfl)
goto out; goto out;
if (s == FIOFNF) { /* File not found. */ if (s == FIOFNF) { /* File not found. */
mlwrite("(New file)"); logwrite("(New file)");
goto out; goto out;
} }
/* read the file in */ /* read the file in */
mlwrite("(Reading file)"); logwrite("(Reading file)");
nline = 0; nline = 0;
while ((s = ffgetline()) == FIOSUC) { while ((s = ffgetline()) == FIOSUC) {
nbytes = fpayload ; nbytes = fpayload ;
@ -344,7 +344,7 @@ int readin(char *fname, int lockfl)
} }
if( s == FIOERR) if( s == FIOERR)
mlwrite( "File read error") ; logwrite( "File read error") ;
switch( ftype) { switch( ftype) {
case FTYPE_DOS: case FTYPE_DOS:
@ -383,7 +383,7 @@ int readin(char *fname, int lockfl)
strcat( mesg, ", eol = ") ; strcat( mesg, ", eol = ") ;
strcat( mesg, eolname[ found_eol]) ; strcat( mesg, eolname[ found_eol]) ;
strcat(mesg, ")"); strcat(mesg, ")");
mlwrite(mesg); logwrite(mesg);
out: out:
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
@ -515,14 +515,14 @@ int filesave(int f, int n)
if ((curbp->b_flag & BFCHG) == 0) /* Return, no changes. */ if ((curbp->b_flag & BFCHG) == 0) /* Return, no changes. */
return TRUE; return TRUE;
if (curbp->b_fname[0] == 0) { /* Must have a name. */ if (curbp->b_fname[0] == 0) { /* Must have a name. */
mlwrite("No file name"); logwrite("No file name");
return FALSE; return FALSE;
} }
/* complain about truncated files */ /* complain about truncated files */
if ((curbp->b_flag & BFTRUNC) != 0) { if ((curbp->b_flag & BFTRUNC) != 0) {
if (mlyesno("Truncated file ... write it out") == FALSE) { if (mlyesno("Truncated file ... write it out") == FALSE) {
mlwrite("(Aborted)"); logwrite("(Aborted)");
return FALSE; return FALSE;
} }
} }
@ -560,16 +560,16 @@ int writeout(char *fn)
#endif #endif
if ((s = ffwopen(fn)) != FIOSUC) { /* Open writes message. */ if ((s = ffwopen(fn)) != FIOSUC) { /* Open writes message. */
mlwrite( "Cannot open file for writing") ; logwrite( "Cannot open file for writing") ;
return FALSE; return FALSE;
} }
mlwrite("(Writing...)"); /* tell us were writing */ logwrite("(Writing...)"); /* tell us were writing */
lp = lforw(curbp->b_linep); /* First line. */ lp = lforw(curbp->b_linep); /* First line. */
nline = 0; /* Number of lines. */ nline = 0; /* Number of lines. */
while (lp != curbp->b_linep) { while (lp != curbp->b_linep) {
s = ffputline( &lp->l_text[0], llength(lp), curbp->b_mode & MDDOS) ; s = ffputline( &lp->l_text[0], llength(lp), curbp->b_mode & MDDOS) ;
if( s != FIOSUC) { if( s != FIOSUC) {
mlwrite( "Write I/O error") ; logwrite( "Write I/O error") ;
break; break;
} }
@ -580,11 +580,11 @@ int writeout(char *fn)
s = ffclose(); s = ffclose();
if (s == FIOSUC) { /* No close error. */ if (s == FIOSUC) { /* No close error. */
if (nline == 1) if (nline == 1)
mlwrite("(Wrote 1 line)"); logwrite("(Wrote 1 line)");
else else
mlwrite("(Wrote %d lines)", nline); logwrite("(Wrote %d lines)", nline);
} else } else
mlwrite( "Error closing file") ; logwrite( "Error closing file") ;
} else /* Ignore close error */ } else /* Ignore close error */
ffclose(); /* if a write error. */ ffclose(); /* if a write error. */
if (s != FIOSUC) /* Some sort of error. */ if (s != FIOSUC) /* Some sort of error. */
@ -647,10 +647,10 @@ int ifile(char *fname)
if ((s = ffropen(fname)) == FIOERR) /* Hard file open. */ if ((s = ffropen(fname)) == FIOERR) /* Hard file open. */
goto out; goto out;
if (s == FIOFNF) { /* File not found. */ if (s == FIOFNF) { /* File not found. */
mlwrite("(No such file)"); logwrite("(No such file)");
return FALSE; return FALSE;
} }
mlwrite("(Inserting file)"); logwrite("(Inserting file)");
#if CRYPT #if CRYPT
s = resetkey(); s = resetkey();
@ -699,7 +699,7 @@ int ifile(char *fname)
if (nline > 1) if (nline > 1)
strcat(mesg, "s"); strcat(mesg, "s");
strcat(mesg, ")"); strcat(mesg, ")");
mlwrite(mesg); logwrite(mesg);
out: out:
/* advance to the next line and mark the window for changes */ /* advance to the next line and mark the window for changes */

11
log.c
View File

@ -28,3 +28,14 @@ int rdonly(void)
} }
int resterr(void)
{
/* TTbeep();
mlwrite("(That command is RESTRICTED)");
return FALSE;
*/
return logger( FALSE, TRUE, "(That command is RESTRICTED)");
}

1
log.h
View File

@ -1,4 +1,5 @@
int rdonly( void) ; int rdonly( void) ;
int resterr( void) ;
extern void (*logwrite)( const char *, ...) ; extern void (*logwrite)( const char *, ...) ;
extern int (*logger)( int, int, const char *, ...) ; extern int (*logger)( int, int, const char *, ...) ;

View File

@ -18,6 +18,7 @@
#include "execute.h" #include "execute.h"
#include "input.h" #include "input.h"
#include "line.h" #include "line.h"
#include "log.h"
#include "search.h" #include "search.h"
int tabsize; /* Tab size (0: use real tabs) */ int tabsize; /* Tab size (0: use real tabs) */

View File

@ -12,10 +12,10 @@
#include <stdio.h> #include <stdio.h>
#include "display.h"
#include "estruct.h" #include "estruct.h"
#include "edef.h" #include "edef.h"
#include "line.h" #include "line.h"
#include "log.h"
/* /*
* Kill the region. Ask "getregion" * Kill the region. Ask "getregion"
@ -72,7 +72,7 @@ int copyregion(int f, int n)
++loffs; ++loffs;
} }
} }
mlwrite("(region copied)"); logwrite("(region copied)");
return TRUE; return TRUE;
} }
@ -169,7 +169,7 @@ int getregion(struct region *rp)
long bsize; long bsize;
if (curwp->w_markp == NULL) { if (curwp->w_markp == NULL) {
mlwrite("No mark set in this window"); logwrite("No mark set in this window");
return FALSE; return FALSE;
} }
if (curwp->w_dotp == curwp->w_markp) { if (curwp->w_dotp == curwp->w_markp) {
@ -211,6 +211,6 @@ int getregion(struct region *rp)
} }
} }
} }
mlwrite("Bug: lost mark"); logwrite("Bug: lost mark");
return FALSE; return FALSE;
} }

View File

@ -68,6 +68,7 @@
#include "edef.h" #include "edef.h"
#include "input.h" #include "input.h"
#include "line.h" #include "line.h"
#include "log.h"
#if defined(MAGIC) #if defined(MAGIC)
/* /*

View File

@ -17,6 +17,7 @@
#include "edef.h" #include "edef.h"
#include "file.h" #include "file.h"
#include "input.h" #include "input.h"
#include "log.h"
#include "window.h" #include "window.h"
#if VMS #if VMS

10
word.c
View File

@ -13,10 +13,10 @@
#include <stdio.h> #include <stdio.h>
#include "basic.h" #include "basic.h"
#include "display.h"
#include "estruct.h" #include "estruct.h"
#include "edef.h" #include "edef.h"
#include "line.h" #include "line.h"
#include "log.h"
#include "random.h" #include "random.h"
#include "region.h" #include "region.h"
@ -419,7 +419,7 @@ int fillpara(int f, int n)
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ return rdonly(); /* we are in read only mode */
if (fillcol == 0) { /* no fill column set */ if (fillcol == 0) { /* no fill column set */
mlwrite("No fill column set"); logwrite("No fill column set");
return FALSE; return FALSE;
} }
#if PKCODE #if PKCODE
@ -518,14 +518,14 @@ int justpara(int f, int n)
if (curbp->b_mode & MDVIEW) /* don't allow this command if */ if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */ return rdonly(); /* we are in read only mode */
if (fillcol == 0) { /* no fill column set */ if (fillcol == 0) { /* no fill column set */
mlwrite("No fill column set"); logwrite("No fill column set");
return FALSE; return FALSE;
} }
justflag = TRUE; justflag = TRUE;
leftmarg = curwp->w_doto; leftmarg = curwp->w_doto;
if (leftmarg + 10 > fillcol) { if (leftmarg + 10 > fillcol) {
leftmarg = 0; leftmarg = 0;
mlwrite("Column too narrow"); logwrite("Column too narrow");
return FALSE; return FALSE;
} }
@ -710,7 +710,7 @@ int wordcount(int f, int n)
else else
avgch = 0; avgch = 0;
mlwrite("Words %D Chars %D Lines %d Avg chars/word %f", logwrite("Words %D Chars %D Lines %d Avg chars/word %f",
nwords, nchars, nlines + 1, avgch); nwords, nchars, nlines + 1, avgch);
return TRUE; return TRUE;
} }