mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 07:16:23 -05:00
Offer va_list version of mlwrite.
This commit is contained in:
parent
405d8683dc
commit
26f0f2eb8b
14
display.c
14
display.c
@ -1339,10 +1339,8 @@ static void mlputc( char c) {
|
||||
* char *fmt; format string for output
|
||||
* char *arg; pointer to first argument to print
|
||||
*/
|
||||
void mlwrite(const char *fmt, ...)
|
||||
{
|
||||
void vmlwrite( const char *fmt, va_list ap) {
|
||||
int c; /* current char in format string */
|
||||
va_list ap;
|
||||
|
||||
/* if we are not currently echoing on the command line, abort this */
|
||||
if (discmd == FALSE) {
|
||||
@ -1362,7 +1360,6 @@ void mlwrite(const char *fmt, ...)
|
||||
movecursor( term.t_nrow, 0) ;
|
||||
|
||||
mpresf = *fmt ? TRUE : FALSE ; /* flag if line has content or not */
|
||||
va_start(ap, fmt);
|
||||
while ((c = *fmt++) != 0) {
|
||||
if (c != '%')
|
||||
mlputc( c) ;
|
||||
@ -1402,7 +1399,6 @@ void mlwrite(const char *fmt, ...)
|
||||
}
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
/* if we can, erase to the end of screen */
|
||||
if( eolexist == TRUE && ttcol < term.t_ncol)
|
||||
@ -1411,6 +1407,14 @@ void mlwrite(const char *fmt, ...)
|
||||
TTflush();
|
||||
}
|
||||
|
||||
void mlwrite( const char *fmt, ...) {
|
||||
va_list ap ;
|
||||
|
||||
va_start( ap, fmt) ;
|
||||
vmlwrite( fmt, ap) ;
|
||||
va_end( ap) ;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef _DISPLAY_H_
|
||||
#define _DISPLAY_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "estruct.h"
|
||||
|
||||
extern int mpresf ; /* Stuff in message line */
|
||||
@ -22,6 +24,7 @@ int updupd( int force) ;
|
||||
void upmode( void) ;
|
||||
void movecursor( int row, int col) ;
|
||||
void mlerase( void) ;
|
||||
void vmlwrite( const char *fmt, va_list ap) ;
|
||||
void mlwrite( const char *fmt, ...) ;
|
||||
void getscreensize( int *widthp, int *heightp) ;
|
||||
|
||||
|
10
eval.c
10
eval.c
@ -259,6 +259,7 @@ struct variable_description {
|
||||
|
||||
static void findvar( char *var, struct variable_description *vd, int size) ;
|
||||
static int svar( struct variable_description *var, char *value) ;
|
||||
static char *i_to_a( int i) ;
|
||||
|
||||
/*
|
||||
* putctext:
|
||||
@ -817,15 +818,18 @@ int setvar(int f, int n)
|
||||
static void mlforce( char *s) ;
|
||||
|
||||
#if DEBUGM
|
||||
int mdbugout( char *fmt, char *s1, char *s2, char *s3) {
|
||||
int mdbugout( char *fmt, ...) {
|
||||
int c ; /* input from kbd, output to terminal */
|
||||
int savediscmd ;
|
||||
va_list ap ;
|
||||
|
||||
/* assignment status ; variable name ; value we tried to assign */
|
||||
/* write out the debug line */
|
||||
savediscmd = discmd ;
|
||||
discmd = TRUE ;
|
||||
mlwrite( fmt, s1, s2, s3) ;
|
||||
va_start( ap, fmt) ;
|
||||
vmlwrite( fmt, ap) ;
|
||||
va_end( ap) ;
|
||||
discmd = savediscmd ;
|
||||
update( TRUE) ;
|
||||
|
||||
@ -1076,7 +1080,7 @@ static int svar(struct variable_description *var, char *value)
|
||||
*
|
||||
* int i; integer to translate to a string
|
||||
*/
|
||||
char *i_to_a( int i) {
|
||||
static char *i_to_a( int i) {
|
||||
unsigned u ;
|
||||
int sign ; /* sign of resulting number */
|
||||
/* returns result string: sign digits null */
|
||||
|
3
eval.h
3
eval.h
@ -5,7 +5,7 @@
|
||||
#define DEBUGM 1 /* $debug triggers macro debugging */
|
||||
|
||||
#if DEBUGM
|
||||
int mdbugout( char *fmt, char *s1, char *s2, char *s3) ;
|
||||
int mdbugout( char *fmt, ...) ;
|
||||
#endif
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@ int is_it_cmd( char *token) ;
|
||||
|
||||
void varinit( void) ;
|
||||
int setvar( int f, int n) ;
|
||||
char *i_to_a( int i) ;
|
||||
char *getval( char *token) ;
|
||||
int stol( char *val) ;
|
||||
char *mklower( char *str) ;
|
||||
|
3
exec.c
3
exec.c
@ -647,8 +647,7 @@ static int dobuf(struct buffer *bp)
|
||||
int c ;
|
||||
|
||||
/* debug macro name, if levels and lastly the line */
|
||||
c = mdbugout( "<<<%s:%s:%s>>>", bp->b_bname, i_to_a( execlevel),
|
||||
eline) ;
|
||||
c = mdbugout( "<<<%s:%d:%s>>>", bp->b_bname, execlevel, eline) ;
|
||||
if( c == abortc) {
|
||||
freewhile( whlist) ;
|
||||
return FALSE ;
|
||||
|
Loading…
Reference in New Issue
Block a user