1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-12 23:56:51 -05:00

Limit the scope of mlforce to eval.

This commit is contained in:
Renaud 2015-02-13 17:46:42 +08:00
parent 2953531913
commit bb44fc57ad
6 changed files with 53 additions and 49 deletions

View File

@ -1420,22 +1420,6 @@ void mlwrite(const char *fmt, ...)
TTflush();
}
/*
* Force a string out to the message line regardless of the
* current $discmd setting. This is needed when $debug is TRUE
* and for the write-message and clear-message-line commands
*
* char *s; string to force out
*/
void mlforce( char *s) {
int oldcmd; /* original command display flag */
oldcmd = discmd; /* save the discmd value */
discmd = TRUE; /* and turn display on */
mlwrite( (*s) ? "%s" : "", s) ; /* write the string out or erase line */
discmd = oldcmd; /* and restore the original setting */
}
/*
* Write out a string. Update the physical cursor position. This assumes that
* the characters in the string all have width "1"; if this is not the case

View File

@ -23,7 +23,6 @@ void upmode( void) ;
void movecursor( int row, int col) ;
void mlerase( void) ;
void mlwrite( const char *fmt, ...) ;
void mlforce( char *s) ;
void getscreensize( int *widthp, int *heightp) ;
#if UNIX

50
eval.c
View File

@ -808,6 +808,8 @@ int setvar(int f, int n)
return status;
}
static void mlforce( char *s) ;
#if DEBUGM
int mdbugout( char *fmt, char *s1, char *s2, char *s3) {
char outline[ NSTRING] ; /* global string to hold debug line text */
@ -1393,3 +1395,51 @@ static char *xlat( char *source, char *lookup, char *trans) {
*rp = 0;
return result;
}
/*
* Force a string out to the message line regardless of the
* current $discmd setting. This is needed when $debug is TRUE
* and for the write-message and clear-message-line commands
*
* char *s; string to force out
*/
static void mlforce( char *s) {
int oldcmd; /* original command display flag */
oldcmd = discmd; /* save the discmd value */
discmd = TRUE; /* and turn display on */
mlwrite( (*s) ? "%s" : "", s) ; /* write the string out or erase line */
discmd = oldcmd; /* and restore the original setting */
}
/*
* This function simply clears the message line,
* mainly for macro usage
*
* int f, n; arguments ignored
*/
int clrmes( int f, int n) {
mlforce( "") ;
return TRUE ;
}
/*
* This function writes a string on the message line
* mainly for macro usage
*
* int f, n; arguments ignored
*/
int writemsg( int f, int n) {
int status;
char buf[ NSTRING] ; /* buffer to recieve message into */
status = mlreply( "Message to write: ", buf, sizeof buf - 1) ;
if( status != TRUE)
return status ;
/* write the message out */
mlforce( buf) ;
return TRUE ;
}

3
eval.h
View File

@ -26,4 +26,7 @@ int stol( char *val) ;
char *mklower( char *str) ;
int abs( int x) ;
int clrmes( int f, int n) ;
int writemsg( int f, int n) ;
#endif

View File

@ -1014,36 +1014,6 @@ int adjustmode(int kind, int global)
return FALSE;
}
/*
* This function simply clears the message line,
* mainly for macro usage
*
* int f, n; arguments ignored
*/
int clrmes( int f, int n) {
mlforce( "") ;
return TRUE ;
}
/*
* This function writes a string on the message line
* mainly for macro usage
*
* int f, n; arguments ignored
*/
int writemsg( int f, int n) {
int status;
char buf[ NSTRING] ; /* buffer to recieve message into */
status = mlreply( "Message to write: ", buf, sizeof buf - 1) ;
if( status != TRUE)
return status ;
/* write the message out */
mlforce( buf) ;
return TRUE ;
}
#if CFENCE
/*
* the cursor is moved to a matching fence

View File

@ -42,8 +42,6 @@ int delmode( int f, int n) ;
int setgmode( int f, int n) ;
int delgmode( int f, int n) ;
int adjustmode( int kind, int global) ;
int clrmes( int f, int n) ;
int writemsg( int f, int n) ;
int getfence( int f, int n) ;
int fmatch( int ch) ;
int istring( int f, int n) ;