mirror of
https://github.com/rfivet/uemacs.git
synced 2024-06-26 19:55:26 +00:00
Remove dependencies from line to display: Move rdonly from display to loc and create instantiable function logger( retcode, beep, string).
This commit is contained in:
parent
451b12319a
commit
245c4a0477
4
Makefile
4
Makefile
|
@ -158,9 +158,9 @@ input.o: input.c input.h edef.h estruct.h line.h utf8.h bind.h bindable.h \
|
||||||
display.h exec.h names.h wrapper.h
|
display.h exec.h names.h wrapper.h
|
||||||
isearch.o: isearch.c isearch.h basic.h display.h estruct.h line.h utf8.h \
|
isearch.o: isearch.c isearch.h basic.h display.h estruct.h line.h utf8.h \
|
||||||
edef.h input.h search.h
|
edef.h input.h search.h
|
||||||
line.o: line.c line.h utf8.h display.h estruct.h edef.h log.h
|
line.o: line.c line.h utf8.h estruct.h edef.h log.h
|
||||||
lock.o: lock.c lock.h estruct.h line.h utf8.h display.h edef.h input.h
|
lock.o: lock.c lock.h estruct.h line.h utf8.h display.h edef.h input.h
|
||||||
log.o: log.c log.h
|
log.o: log.c log.h estruct.h line.h utf8.h
|
||||||
main.o: main.c basic.h bind.h edef.h estruct.h line.h utf8.h bindable.h \
|
main.o: main.c basic.h bind.h edef.h estruct.h line.h utf8.h bindable.h \
|
||||||
buffer.h display.h eval.h execute.h file.h input.h lock.h log.h random.h \
|
buffer.h display.h eval.h execute.h file.h input.h lock.h log.h random.h \
|
||||||
search.h termio.h version.h
|
search.h termio.h version.h
|
||||||
|
|
11
display.c
11
display.c
|
@ -1553,17 +1553,6 @@ static int newscreensize(int h, int w)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* tell the user that this command is illegal while we are in
|
|
||||||
* VIEW (read-only) mode
|
|
||||||
*/
|
|
||||||
int rdonly(void)
|
|
||||||
{
|
|
||||||
TTbeep();
|
|
||||||
mlwrite("(Key illegal in VIEW mode)");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int resterr(void)
|
int resterr(void)
|
||||||
{
|
{
|
||||||
TTbeep();
|
TTbeep();
|
||||||
|
|
49
line.c
49
line.c
|
@ -18,7 +18,6 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "display.h"
|
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
#include "edef.h"
|
#include "edef.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
@ -199,24 +198,23 @@ int insspace(int f, int n)
|
||||||
* linstr -- Insert a string at the current point
|
* linstr -- Insert a string at the current point
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int linstr(char *instr)
|
int linstr( char *instr) {
|
||||||
{
|
int status = TRUE ;
|
||||||
int status = TRUE;
|
|
||||||
char tmpc;
|
|
||||||
|
|
||||||
if (instr != NULL)
|
if( instr != NULL) {
|
||||||
while ((tmpc = *instr) && status == TRUE) {
|
char tmpc ;
|
||||||
|
|
||||||
|
while( (tmpc = *instr++)) {
|
||||||
status =
|
status =
|
||||||
(tmpc == '\n' ? lnewline() : linsert(1, tmpc));
|
(tmpc == '\n' ? lnewline() : linsert( 1, tmpc)) ;
|
||||||
|
|
||||||
/* Insertion error? */
|
/* Insertion error? */
|
||||||
if (status != TRUE) {
|
if( status != TRUE)
|
||||||
logwrite( "%%Out of memory while inserting") ;
|
return logger( status, FALSE, "%%Out of memory while inserting") ;
|
||||||
break;
|
|
||||||
}
|
|
||||||
instr++;
|
|
||||||
}
|
}
|
||||||
return status;
|
}
|
||||||
|
|
||||||
|
return status ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -350,24 +348,23 @@ static int lowrite(int c)
|
||||||
/*
|
/*
|
||||||
* lover -- Overwrite a string at the current point
|
* lover -- Overwrite a string at the current point
|
||||||
*/
|
*/
|
||||||
int lover(char *ostr)
|
int lover( char *ostr) {
|
||||||
{
|
int status = TRUE ;
|
||||||
int status = TRUE;
|
|
||||||
char tmpc;
|
|
||||||
|
|
||||||
if (ostr != NULL)
|
if (ostr != NULL) {
|
||||||
while ((tmpc = *ostr) && status == TRUE) {
|
char tmpc ;
|
||||||
|
|
||||||
|
while( (tmpc = *ostr++)) {
|
||||||
status =
|
status =
|
||||||
(tmpc == '\n' ? lnewline() : lowrite(tmpc));
|
(tmpc == '\n' ? lnewline() : lowrite(tmpc));
|
||||||
|
|
||||||
/* Insertion error? */
|
/* Insertion error? */
|
||||||
if (status != TRUE) {
|
if( status != TRUE)
|
||||||
logwrite( "%%Out of memory while overwriting") ;
|
return logger( status, FALSE, "%%Out of memory while overwriting") ;
|
||||||
break;
|
|
||||||
}
|
|
||||||
ostr++;
|
|
||||||
}
|
}
|
||||||
return status;
|
}
|
||||||
|
|
||||||
|
return status ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
26
log.c
26
log.c
|
@ -1,6 +1,30 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
void logdump( const char *buf, ...) {
|
#include "estruct.h"
|
||||||
|
|
||||||
|
|
||||||
|
static void logdump( const char *buf, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*logwrite)( const char *, ...) = logdump ;
|
void (*logwrite)( const char *, ...) = logdump ;
|
||||||
|
|
||||||
|
static int logit( int retcode, int beep_f, const char *buf, ...) {
|
||||||
|
return retcode ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int (*logger)( int, int, const char *, ...) = logit ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* tell the user that this command is illegal while we are in
|
||||||
|
* VIEW (read-only) mode
|
||||||
|
*/
|
||||||
|
int rdonly(void)
|
||||||
|
{
|
||||||
|
/* TTbeep();
|
||||||
|
mlwrite("(Key illegal in VIEW mode)");
|
||||||
|
return FALSE;
|
||||||
|
*/
|
||||||
|
return logger( FALSE, TRUE, "(Key illegal in VIEW mode)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
5
log.h
5
log.h
|
@ -1,2 +1,5 @@
|
||||||
extern void (*logwrite)( const char *, ...) ;
|
int rdonly( void) ;
|
||||||
|
|
||||||
|
extern void (*logwrite)( const char *, ...) ;
|
||||||
|
extern int (*logger)( int, int, const char *, ...) ;
|
||||||
|
|
||||||
|
|
9
main.c
9
main.c
|
@ -124,6 +124,14 @@ static void usage( void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int mllog( int retcode, int beep_f, const char *buf, ...) {
|
||||||
|
if( beep_f)
|
||||||
|
TTbeep() ;
|
||||||
|
|
||||||
|
mlwrite( buf) ;
|
||||||
|
return retcode ;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int c = -1; /* command character */
|
int c = -1; /* command character */
|
||||||
|
@ -177,6 +185,7 @@ int main(int argc, char **argv)
|
||||||
/* Initialize the editor. */
|
/* Initialize the editor. */
|
||||||
vtinit(); /* Display */
|
vtinit(); /* Display */
|
||||||
logwrite = mlwrite ;
|
logwrite = mlwrite ;
|
||||||
|
logger = mllog ;
|
||||||
edinit("main"); /* Buffers, windows */
|
edinit("main"); /* Buffers, windows */
|
||||||
varinit(); /* user variables */
|
varinit(); /* user variables */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user