mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-17 23:06:25 -05:00
Revise line primitives linstr() and lover()
This commit is contained in:
parent
62e1109802
commit
a370d748c4
36
line.c
36
line.c
@ -266,8 +266,8 @@ void lchange(int flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* insert spaces forward into text
|
/* insert spaces forward into text
|
||||||
*
|
*
|
||||||
* int f, n; default flag and numeric argument
|
* int f, n; default flag and numeric argument
|
||||||
*/
|
*/
|
||||||
@ -278,23 +278,18 @@ BINDABLE( insspace) {
|
|||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* linstr -- Insert a string at the current point
|
|
||||||
*/
|
|
||||||
|
|
||||||
int linstr( char *instr) {
|
|
||||||
int status = TRUE ;
|
|
||||||
|
|
||||||
|
/* linstr -- Insert a string at the current point */
|
||||||
|
boolean linstr( char *instr) {
|
||||||
|
boolean status = TRUE ;
|
||||||
if( instr != NULL) {
|
if( instr != NULL) {
|
||||||
unicode_t tmpc ;
|
int c ;
|
||||||
|
|
||||||
while( (tmpc = *instr++ & 0xFF)) {
|
while( (c = (unsigned char) *instr++)) {
|
||||||
status = (tmpc == '\n') ? lnewline() : linsert_byte( 1, tmpc) ;
|
status = (c == '\n') ? lnewline() : linsert_byte( 1, c) ;
|
||||||
|
if( status != TRUE) { /* Insertion error? */
|
||||||
/* Insertion error? */
|
|
||||||
if( status != TRUE) {
|
|
||||||
mloutstr( "%Out of memory while inserting") ;
|
mloutstr( "%Out of memory while inserting") ;
|
||||||
return status ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -432,14 +427,13 @@ static boolean lowrite( int c) {
|
|||||||
|
|
||||||
|
|
||||||
/* lover -- Overwrite a string at the current point */
|
/* lover -- Overwrite a string at the current point */
|
||||||
int lover( char *ostr) {
|
boolean lover( char *ostr) {
|
||||||
int status = TRUE ;
|
boolean status = TRUE ;
|
||||||
|
|
||||||
if( ostr != NULL) {
|
if( ostr != NULL) {
|
||||||
char tmpc ;
|
int c ;
|
||||||
|
|
||||||
while( (tmpc = *ostr++)) {
|
while( (c = (unsigned char) *ostr++)) {
|
||||||
status = (tmpc == '\n' ? lnewline() : lowrite( tmpc)) ;
|
status = (c == '\n') ? lnewline() : lowrite( c) ;
|
||||||
if( status != TRUE) { /* Insertion error? */
|
if( status != TRUE) { /* Insertion error? */
|
||||||
mloutstr( "%Out of memory while overwriting") ;
|
mloutstr( "%Out of memory while overwriting") ;
|
||||||
break ;
|
break ;
|
||||||
|
4
line.h
4
line.h
@ -39,10 +39,10 @@ BBINDABLE( forwchar) ;
|
|||||||
|
|
||||||
void lfree( line_p lp) ;
|
void lfree( line_p lp) ;
|
||||||
void lchange( int flag) ;
|
void lchange( int flag) ;
|
||||||
int linstr( char *instr) ;
|
boolean linstr( char *instr) ;
|
||||||
boolean linsert( int n, unicode_t c) ;
|
boolean linsert( int n, unicode_t c) ;
|
||||||
boolean linsert_byte( int n, int c) ;
|
boolean linsert_byte( int n, int c) ;
|
||||||
int lover( char *ostr) ;
|
boolean lover( char *ostr) ;
|
||||||
boolean lnewline( void) ;
|
boolean lnewline( void) ;
|
||||||
boolean ldelete( long n, boolean kflag) ;
|
boolean ldelete( long n, boolean kflag) ;
|
||||||
boolean ldelchar( long n, boolean kflag) ;
|
boolean ldelchar( long n, boolean kflag) ;
|
||||||
|
2
random.c
2
random.c
@ -837,7 +837,7 @@ static int adjustmode( int kind, int global) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int iovstring( int f, int n, const char *prompt, int (*fun)( char *)) {
|
static int iovstring( int f, int n, const char *prompt, boolean (*fun)( char *)) {
|
||||||
char *tstring ; /* string to add */
|
char *tstring ; /* string to add */
|
||||||
|
|
||||||
/* ask for string to insert */
|
/* ask for string to insert */
|
||||||
|
Loading…
Reference in New Issue
Block a user