Print tab as space.

This commit is contained in:
Serge Vakulenko 2018-08-27 21:31:27 -07:00
parent 0db478586e
commit 9bcf4a77ae
4 changed files with 25 additions and 34 deletions

17
md380.c
View File

@ -307,23 +307,6 @@ static void setup_zone(int zone_index, int chan_index)
*data |= 1 << (chan_index & 7);
}
//
// Print utf16 text as utf8.
//
static void print_unicode(FILE *out, const uint16_t *text, unsigned nchars, int fill_flag)
{
unsigned i;
for (i=0; i<nchars && *text; i++) {
putc_utf8(*text++, out);
}
if (fill_flag) {
for (; i<nchars; i++) {
putc_utf8(' ', out);
}
}
}
//
// Print frequency (BCD value).
//

20
util.c
View File

@ -208,3 +208,23 @@ void putc_utf8(unsigned short ch, FILE *out)
putc ((ch & 0x3f) | 0x80, out);
}
}
//
// Print utf16 text as utf8.
//
void print_unicode(FILE *out, const unsigned short *text, unsigned nchars, int fill_flag)
{
unsigned i, ch;
for (i=0; i<nchars && *text; i++) {
ch = *text++;
if (ch == '\t')
ch = ' ';
putc_utf8(ch, out);
}
if (fill_flag) {
for (; i<nchars; i++) {
putc(' ', out);
}
}
}

5
util.h
View File

@ -124,3 +124,8 @@ void print_squelch_tones(FILE *out, int normal_only);
// Write Unicode symbol to a file in UTF-8 encoding.
//
void putc_utf8(unsigned short ch, FILE *out);
//
// Print utf16 text as utf8.
//
void print_unicode(FILE *out, const unsigned short *text, unsigned nchars, int fill_flag);

17
uv380.c
View File

@ -323,23 +323,6 @@ static void setup_zone(int zone_index, int chan_index)
*data |= 1 << (chan_index & 7);
}
//
// Print utf16 text as utf8.
//
static void print_unicode(FILE *out, const uint16_t *text, unsigned nchars, int fill_flag)
{
unsigned i;
for (i=0; i<nchars && *text; i++) {
putc_utf8(*text++, out);
}
if (fill_flag) {
for (; i<nchars; i++) {
putc(' ', out);
}
}
}
//
// Print frequency (BCD value).
//