mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-31 01:10:24 +02:00
(scm_lfwrite): Maintain columnd and row count in port.
Thanks to Matthias Köppe!
This commit is contained in:
parent
3cc34e16be
commit
53802ea86d
1 changed files with 14 additions and 5 deletions
|
@ -975,11 +975,8 @@ scm_puts (const char *s, SCM port)
|
||||||
|
|
||||||
/* scm_lfwrite
|
/* scm_lfwrite
|
||||||
*
|
*
|
||||||
* Currently, this function has an identical implementation to
|
* This function differs from scm_c_write; it updates port line and
|
||||||
* scm_c_write. We could have turned it into a macro expanding into a
|
* column. */
|
||||||
* call to scm_c_write. However, the implementation is small and
|
|
||||||
* might differ in the future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_lfwrite (const char *ptr, size_t size, SCM port)
|
scm_lfwrite (const char *ptr, size_t size, SCM port)
|
||||||
|
@ -992,6 +989,18 @@ scm_lfwrite (const char *ptr, size_t size, SCM port)
|
||||||
|
|
||||||
ptob->write (port, ptr, size);
|
ptob->write (port, ptr, size);
|
||||||
|
|
||||||
|
for (; size; ptr++, size--) {
|
||||||
|
if (*ptr == '\n') {
|
||||||
|
SCM_INCLINE(port);
|
||||||
|
}
|
||||||
|
else if (*ptr == '\t') {
|
||||||
|
SCM_TABCOL(port);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SCM_INCCOL(port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pt->rw_random)
|
if (pt->rw_random)
|
||||||
pt->rw_active = SCM_PORT_WRITE;
|
pt->rw_active = SCM_PORT_WRITE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue