1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 07:16:23 -05:00

Align naming convention for output of text on the message line: mlout*. (Was a mix of log & write).

This commit is contained in:
Renaud 2015-02-13 12:31:59 +08:00
parent 6021a22b60
commit 5e5558e00b
16 changed files with 101 additions and 88 deletions

View File

@ -1,8 +1,8 @@
# Makefile for emacs, updated Wed, Feb 11, 2015 8:16:12 PM
# Makefile for emacs, updated Fri, Feb 13, 2015 12:02:52 PM
SRC=basic.c bind.c bindable.c buffer.c crypt.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c input.c isearch.c line.c lock.c log.c main.c mingw32.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c window.c word.c wrapper.c wscreen.c
OBJ=basic.o bind.o bindable.o buffer.o crypt.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o input.o isearch.o line.o lock.o log.o main.o mingw32.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o window.o word.o wrapper.o wscreen.o
HDR=basic.h bind.h bindable.h buffer.h crypt.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isearch.h line.h lock.h log.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h version.h window.h word.h wrapper.h wscreen.h
SRC=basic.c bind.c bindable.c buffer.c crypt.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c input.c isearch.c line.c lock.c main.c mingw32.c mlout.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c window.c word.c wrapper.c wscreen.c
OBJ=basic.o bind.o bindable.o buffer.o crypt.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o input.o isearch.o line.o lock.o main.o mingw32.o mlout.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o window.o word.o wrapper.o wscreen.o
HDR=basic.h bind.h bindable.h buffer.h crypt.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isearch.h line.h lock.h mlout.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h version.h window.h word.h wrapper.h wscreen.h
# DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them
@ -127,13 +127,13 @@ depend: ${SRC}
# DO NOT DELETE THIS LINE -- make depend uses it
basic.o: basic.c basic.h buffer.h crypt.h line.h retcode.h utf8.h \
estruct.h input.h bind.h log.h random.h terminal.h defines.h window.h
estruct.h input.h bind.h mlout.h random.h terminal.h defines.h window.h
bind.o: bind.c bind.h estruct.h bindable.h buffer.h crypt.h line.h \
retcode.h utf8.h display.h ebind.h exec.h file.h flook.h input.h names.h \
window.h defines.h
bindable.o: bindable.c bindable.h defines.h buffer.h crypt.h line.h \
retcode.h utf8.h display.h estruct.h file.h input.h bind.h log.h lock.h \
terminal.h
retcode.h utf8.h display.h estruct.h file.h input.h bind.h lock.h \
mlout.h terminal.h
buffer.o: buffer.c buffer.h crypt.h line.h retcode.h utf8.h defines.h \
display.h estruct.h file.h input.h bind.h window.h
crypt.o: crypt.c crypt.h
@ -150,9 +150,9 @@ exec.o: exec.c exec.h retcode.h buffer.h crypt.h line.h utf8.h bind.h \
display.h estruct.h eval.h file.h flook.h input.h random.h window.h \
defines.h
execute.o: execute.c execute.h estruct.h bind.h random.h display.h file.h \
buffer.h crypt.h line.h retcode.h utf8.h log.h window.h defines.h
buffer.h crypt.h line.h retcode.h utf8.h mlout.h window.h defines.h
file.o: file.c file.h buffer.h crypt.h line.h retcode.h utf8.h defines.h \
estruct.h execute.h fileio.h input.h bind.h lock.h log.h window.h
estruct.h execute.h fileio.h input.h bind.h lock.h mlout.h window.h
fileio.o: fileio.c fileio.h crypt.h retcode.h defines.h
flook.o: flook.c flook.h retcode.h defines.h fileio.h crypt.h
input.o: input.c input.h bind.h estruct.h bindable.h display.h exec.h \
@ -160,29 +160,30 @@ input.o: input.c input.h bind.h estruct.h bindable.h display.h exec.h \
isearch.o: isearch.c isearch.h basic.h buffer.h crypt.h line.h retcode.h \
utf8.h display.h estruct.h exec.h input.h bind.h search.h terminal.h \
defines.h window.h
line.o: line.c line.h retcode.h utf8.h buffer.h crypt.h estruct.h log.h \
line.o: line.c line.h retcode.h utf8.h buffer.h crypt.h estruct.h mlout.h \
window.h defines.h
lock.o: lock.c estruct.h lock.h
log.o: log.c log.h
main.o: main.c estruct.h basic.h bind.h bindable.h buffer.h crypt.h \
line.h retcode.h utf8.h display.h eval.h execute.h file.h input.h lock.h \
log.h random.h search.h terminal.h defines.h termio.h version.h window.h
line.h retcode.h utf8.h display.h eval.h execute.h file.h input.h \
mlout.h lock.h random.h search.h terminal.h defines.h termio.h version.h \
window.h
mingw32.o: mingw32.c
mlout.o: mlout.c mlout.h
names.o: names.c names.h basic.h bind.h bindable.h buffer.h crypt.h \
line.h retcode.h utf8.h display.h estruct.h eval.h exec.h file.h \
isearch.h region.h random.h search.h spawn.h window.h defines.h word.h
pklock.o: pklock.c estruct.h pklock.h
posix.o: posix.c
random.o: random.c random.h basic.h buffer.h crypt.h line.h retcode.h \
utf8.h display.h estruct.h execute.h input.h bind.h log.h search.h \
terminal.h defines.h window.h
utf8.h display.h estruct.h execute.h input.h bind.h search.h terminal.h \
defines.h window.h
region.o: region.c region.h line.h retcode.h utf8.h buffer.h crypt.h \
estruct.h log.h random.h window.h defines.h
estruct.h mlout.h random.h window.h defines.h
search.o: search.c search.h line.h retcode.h utf8.h basic.h buffer.h \
crypt.h display.h estruct.h input.h bind.h log.h terminal.h defines.h \
crypt.h display.h estruct.h input.h bind.h mlout.h terminal.h defines.h \
window.h
spawn.o: spawn.c spawn.h defines.h buffer.h crypt.h line.h retcode.h \
utf8.h display.h estruct.h exec.h file.h flook.h input.h bind.h log.h \
utf8.h display.h estruct.h exec.h file.h flook.h input.h bind.h \
terminal.h window.h
tcap.o: tcap.c terminal.h defines.h retcode.h display.h estruct.h \
termio.h
@ -191,7 +192,7 @@ utf8.o: utf8.c utf8.h
window.o: window.c window.h defines.h buffer.h crypt.h line.h retcode.h \
utf8.h basic.h display.h estruct.h execute.h terminal.h wrapper.h
word.o: word.c word.h basic.h buffer.h crypt.h line.h retcode.h utf8.h \
estruct.h log.h random.h region.h window.h defines.h
estruct.h mlout.h random.h region.h window.h defines.h
wrapper.o: wrapper.c wrapper.h
wscreen.o: wscreen.c

View File

@ -22,7 +22,7 @@
#include "estruct.h"
#include "input.h"
#include "line.h"
#include "log.h"
#include "mlout.h"
#include "random.h"
#include "terminal.h"
#include "utf8.h"
@ -101,7 +101,7 @@ int gotoline(int f, int n)
if( f == FALSE) {
status = mlreply( "Line to GOTO: ", arg, sizeof arg) ;
if( status != TRUE) {
writestr( "(Aborted)") ;
mloutstr( "(Aborted)") ;
return status ;
}
@ -315,7 +315,7 @@ int setmark(int f, int n)
{
curwp->w_markp = curwp->w_dotp;
curwp->w_marko = curwp->w_doto;
writestr( "(Mark set)") ;
mloutstr( "(Mark set)") ;
return TRUE ;
}
@ -331,7 +331,7 @@ int swapmark(int f, int n)
int odoto;
if( curwp->w_markp == NULL) {
writestr( "No mark in this window") ;
mloutstr( "No mark in this window") ;
return FALSE ;
}

View File

@ -10,8 +10,8 @@
#include "estruct.h"
#include "file.h"
#include "input.h"
#include "log.h"
#include "lock.h"
#include "mlout.h"
#include "terminal.h"
/*
@ -141,7 +141,7 @@ int ctlxe(int f, int n)
*/
int ctrlg( int f, int n) {
kbdmode = STOP ;
writefmt( "%B(Aborted)") ;
mloutfmt( "%B(Aborted)") ;
return ABORT ;
}

View File

@ -8,7 +8,7 @@
#include "random.h"
#include "display.h"
#include "file.h"
#include "log.h"
#include "mlout.h"
#include "window.h"
int gasave = 256 ; /* global ASAVE size */
@ -102,7 +102,7 @@ int execute(int c, int f, int n)
}
lastflag = 0 ; /* Fake last flags. */
writefmt( "%B(Key not bound)") ; /* Complain */
mloutfmt( "%B(Key not bound)") ; /* Complain */
return FALSE ;
}

40
file.c
View File

@ -24,7 +24,7 @@
#include "input.h"
#include "line.h"
#include "lock.h"
#include "log.h"
#include "mlout.h"
#include "window.h"
#if PKCODE
@ -51,7 +51,7 @@ static const char *eolname[] = {
boolean restflag = FALSE ; /* restricted use? */
boolean resterr( void) {
writefmt( "%B(That command is RESTRICTED)") ;
mloutfmt( "%B(That command is RESTRICTED)") ;
return FALSE ;
}
@ -174,7 +174,7 @@ int set_encryption_key(int f, int n)
strcpy(curbp->b_key, key);
cryptbufferkey( curbp) ;
writestr( " ") ; /* clear it off the bottom line */
mloutstr( " ") ; /* clear it off the bottom line */
return TRUE;
}
@ -236,7 +236,7 @@ int getfile( const char *fname, boolean lockfl)
curwp->w_linep = lp;
curwp->w_flag |= WFMODE | WFHARD;
cknewwindow();
writestr( "(Old buffer)") ;
mloutstr( "(Old buffer)") ;
return TRUE;
}
}
@ -252,7 +252,7 @@ int getfile( const char *fname, boolean lockfl)
}
}
if (bp == NULL && (bp = bfind(bname, TRUE, 0)) == NULL) {
writestr( "Cannot create buffer") ;
mloutstr( "Cannot create buffer") ;
return FALSE;
}
if (--curbp->b_nwnd == 0) { /* Undisplay. */
@ -323,12 +323,12 @@ int readin(const char *fname, boolean lockfl)
goto out;
if (s == FIOFNF) { /* File not found. */
writestr( "(New file)") ;
mloutstr( "(New file)") ;
goto out;
}
/* read the file in */
writestr( "(Reading file)") ;
mloutstr( "(Reading file)") ;
nline = 0;
while ((s = ffgetline()) == FIOSUC) {
nbytes = fpayload ;
@ -352,7 +352,7 @@ int readin(const char *fname, boolean lockfl)
}
if( s == FIOERR)
writestr( "File read error") ;
mloutstr( "File read error") ;
switch( ftype) {
case FTYPE_DOS:
@ -391,7 +391,7 @@ int readin(const char *fname, boolean lockfl)
strcat( mesg, ", eol = ") ;
strcat( mesg, eolname[ found_eol]) ;
strcat(mesg, ")");
writestr( mesg) ;
mloutstr( mesg) ;
out:
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
@ -523,14 +523,14 @@ int filesave(int f, int n)
if ((curbp->b_flag & BFCHG) == 0) /* Return, no changes. */
return TRUE;
if (curbp->b_fname[0] == 0) { /* Must have a name. */
writestr( "No file name") ;
mloutstr( "No file name") ;
return FALSE;
}
/* complain about truncated files */
if ((curbp->b_flag & BFTRUNC) != 0) {
if (mlyesno("Truncated file ... write it out") == FALSE) {
writestr( "(Aborted)") ;
mloutstr( "(Aborted)") ;
return FALSE;
}
}
@ -568,16 +568,16 @@ int writeout( const char *fn)
#endif
if ((s = ffwopen(fn)) != FIOSUC) { /* Open writes message. */
writestr( "Cannot open file for writing") ;
mloutstr( "Cannot open file for writing") ;
return FALSE;
}
writestr( "(Writing...)") ; /* tell us were writing */
mloutstr( "(Writing...)") ; /* tell us were writing */
lp = lforw(curbp->b_linep); /* First line. */
nline = 0; /* Number of lines. */
while (lp != curbp->b_linep) {
s = ffputline( &lp->l_text[0], llength(lp), curbp->b_mode & MDDOS) ;
if( s != FIOSUC) {
writestr( "Write I/O error") ;
mloutstr( "Write I/O error") ;
break;
}
@ -588,11 +588,11 @@ int writeout( const char *fn)
s = ffclose();
if (s == FIOSUC) { /* No close error. */
if (nline == 1)
writestr( "(Wrote 1 line)") ;
mloutstr( "(Wrote 1 line)") ;
else
writefmt( "(Wrote %d lines)", nline) ;
mloutfmt( "(Wrote %d lines)", nline) ;
} else
writestr( "Error closing file") ;
mloutstr( "Error closing file") ;
} else /* Ignore close error */
ffclose(); /* if a write error. */
if (s != FIOSUC) /* Some sort of error. */
@ -655,10 +655,10 @@ int ifile( const char *fname)
if ((s = ffropen(fname)) == FIOERR) /* Hard file open. */
goto out;
if (s == FIOFNF) { /* File not found. */
writestr( "(No such file)") ;
mloutstr( "(No such file)") ;
return FALSE;
}
writestr( "(Inserting file)") ;
mloutstr( "(Inserting file)") ;
#if CRYPT
s = resetkey();
@ -707,7 +707,7 @@ int ifile( const char *fname)
if (nline > 1)
strcat(mesg, "s");
strcat(mesg, ")");
writestr( mesg);
mloutstr( mesg);
out:
/* advance to the next line and mark the window for changes */

12
line.c
View File

@ -22,7 +22,7 @@
#include "buffer.h"
#include "estruct.h"
#include "log.h"
#include "mlout.h"
#include "window.h"
@ -184,7 +184,7 @@ struct line *lalloc(int used)
if (size == 0) /* Assume that is an empty. */
size = BLOCK_SIZE; /* Line is for type-in. */
if ((lp = (struct line *)malloc(sizeof(struct line) + size)) == NULL) {
writestr( "(OUT OF MEMORY)") ;
mloutstr( "(OUT OF MEMORY)") ;
return NULL;
}
lp->l_size = size;
@ -291,7 +291,7 @@ int linstr( char *instr) {
/* Insertion error? */
if( status != TRUE) {
writestr( "%Out of memory while inserting") ;
mloutstr( "%Out of memory while inserting") ;
return status ;
}
}
@ -330,7 +330,7 @@ static int linsert_byte(int n, int c)
lp1 = curwp->w_dotp; /* Current line */
if (lp1 == curbp->b_linep) { /* At the end: special */
if (curwp->w_doto != 0) {
writestr( "bug: linsert") ;
mloutstr( "bug: linsert") ;
return FALSE;
}
if ((lp2 = lalloc(n)) == NULL) /* Allocate new line */
@ -442,7 +442,7 @@ int lover( char *ostr) {
/* Insertion error? */
if( status != TRUE) {
writestr( "%Out of memory while overwriting") ;
mloutstr( "%Out of memory while overwriting") ;
return status ;
}
}
@ -838,6 +838,6 @@ int yank(int f, int n)
* VIEW (read-only) mode
*/
boolean rdonly( void) {
writefmt( "%B(Key illegal in VIEW mode)") ;
mloutfmt( "%B(Key illegal in VIEW mode)") ;
return FALSE ;
}

10
log.c
View File

@ -1,10 +0,0 @@
#include "log.h"
static void logdump( const char *buf, ...) {
}
void (*writefmt)( const char *, ...) = logdump ;
void writestr( const char *str) {
writefmt( "%s", str) ;
}

3
log.h
View File

@ -1,3 +0,0 @@
extern void (*writefmt)( const char *, ...) ;
void writestr( const char *str) ;

18
main.c
View File

@ -86,7 +86,7 @@
#include "file.h"
#include "input.h"
#include "lock.h"
#include "log.h"
#include "mlout.h"
#include "random.h"
#include "search.h"
#include "terminal.h"
@ -190,7 +190,7 @@ int main(int argc, char **argv)
/* Initialize the editor. */
vtinit(); /* Display */
writefmt = mlwrite ;
mloutfmt = mlwrite ;
edinit("main"); /* Buffers, windows */
varinit(); /* user variables */
@ -330,13 +330,13 @@ int main(int argc, char **argv)
/* Deal with startup gotos and searches */
if( gotoflag && searchflag)
writestr( "(Can not search and goto at the same time!)") ;
mloutstr( "(Can not search and goto at the same time!)") ;
else if( gotoflag) {
if( gotoline( TRUE, gline) == FALSE)
writestr( "(Bogus goto argument)") ;
mloutstr( "(Bogus goto argument)") ;
} else if( searchflag)
if( forwhunt( FALSE, 0))
writefmt( "Found on line %d", getcline()) ;
mloutfmt( "Found on line %d", getcline()) ;
/* Setup to process commands. */
lastflag = 0; /* Fake last flags. */
@ -403,9 +403,9 @@ int main(int argc, char **argv)
n = n * 10 + (c - '0');
}
if ((n == 0) && (mflag == -1)) /* lonely - */
writestr( "Arg:") ;
mloutstr( "Arg:") ;
else
writefmt( "Arg: %d", n * mflag) ;
mloutfmt( "Arg: %d", n * mflag) ;
c = getcmd(); /* get the next key */
}
@ -418,7 +418,7 @@ int main(int argc, char **argv)
f = TRUE;
n = 4; /* with argument of 4 */
mflag = 0; /* that can be discarded. */
writestr( "Arg: 4") ;
mloutstr( "Arg: 4") ;
while (((c = getcmd()) >= '0' && c <= '9') || c == reptc
|| c == '-') {
if (c == reptc)
@ -447,7 +447,7 @@ int main(int argc, char **argv)
}
n = 10 * n + c - '0';
}
writefmt( "Arg: %d", (mflag >= 0) ? n : (n ? -n : -1)) ;
mloutfmt( "Arg: %d", (mflag >= 0) ? n : (n ? -n : -1)) ;
}
/*
* Make arguments preceded by a minus sign negative and change

15
mlout.c Normal file
View File

@ -0,0 +1,15 @@
/* mlout.c -- implements mlout.h */
#include "mlout.h"
/* by default just use a stub */
static void mloutdump( const char *buf, ...) {
}
void (*mloutfmt)( const char *, ...) = mloutdump ;
void mloutstr( const char *str) {
mloutfmt( "%s", str) ;
}
/* end of mlout.c */

12
mlout.h Normal file
View File

@ -0,0 +1,12 @@
/* mlout.h -- message line output interface */
#ifndef __MLOUT_H__
#define __MLOUT_H__
extern void (*mloutfmt)( const char *, ...) ;
void mloutstr( const char *str) ;
#endif /* __MLOUT_H__ */
/* end of mlout.h */

View File

@ -21,7 +21,6 @@
#include "execute.h"
#include "input.h"
#include "line.h"
#include "log.h"
#include "search.h"
#include "terminal.h"
#include "window.h"

View File

@ -15,7 +15,7 @@
#include "buffer.h"
#include "estruct.h"
#include "line.h"
#include "log.h"
#include "mlout.h"
#include "random.h"
#include "window.h"
@ -74,7 +74,7 @@ int copyregion(int f, int n)
++loffs;
}
}
writestr( "(region copied)") ;
mloutstr( "(region copied)") ;
return TRUE;
}
@ -171,7 +171,7 @@ int getregion(struct region *rp)
long bsize;
if (curwp->w_markp == NULL) {
writestr( "No mark set in this window") ;
mloutstr( "No mark set in this window") ;
return FALSE;
}
if (curwp->w_dotp == curwp->w_markp) {
@ -213,6 +213,6 @@ int getregion(struct region *rp)
}
}
}
writestr( "Bug: lost mark") ;
mloutstr( "Bug: lost mark") ;
return FALSE;
}

View File

@ -70,7 +70,7 @@
#include "estruct.h"
#include "input.h"
#include "line.h"
#include "log.h"
#include "mlout.h"
#include "terminal.h"
#include "window.h"
@ -984,7 +984,7 @@ static int replaces(int kind, int f, int n)
curwp->w_flag |= WFMOVE;
case BELL: /* abort! and stay */
writestr( "Aborted!") ;
mloutstr( "Aborted!") ;
return FALSE ;
default: /* bitch and beep */

View File

@ -22,7 +22,6 @@
#include "file.h"
#include "flook.h"
#include "input.h"
#include "log.h"
#include "terminal.h"
#include "window.h"

10
word.c
View File

@ -16,7 +16,7 @@
#include "buffer.h"
#include "estruct.h"
#include "line.h"
#include "log.h"
#include "mlout.h"
#include "random.h"
#include "region.h"
#include "window.h"
@ -428,7 +428,7 @@ int fillpara(int f, int n)
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */
if (fillcol == 0) { /* no fill column set */
writestr( "No fill column set") ;
mloutstr( "No fill column set") ;
return FALSE;
}
#if PKCODE
@ -527,14 +527,14 @@ int justpara(int f, int n)
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */
if (fillcol == 0) { /* no fill column set */
writestr( "No fill column set") ;
mloutstr( "No fill column set") ;
return FALSE;
}
justflag = TRUE;
leftmarg = curwp->w_doto;
if (leftmarg + 10 > fillcol) {
leftmarg = 0;
writestr( "Column too narrow") ;
mloutstr( "Column too narrow") ;
return FALSE;
}
@ -719,7 +719,7 @@ int wordcount(int f, int n)
else
avgch = 0;
writefmt( "Words %D Chars %D Lines %d Avg chars/word %f",
mloutfmt( "Words %D Chars %D Lines %d Avg chars/word %f",
nwords, nchars, nlines + 1, avgch) ;
return TRUE;
}