static void SetRXStatus( gui_window *gui ) { int i; for( i = CTL_FIRST_RX; i <= CTL_LAST_RX; ++i ) { GUISetChecked( gui, i, strchr( SrchMagicChars, MetaChar(i) ) != NULL ); } }
std::string MetaString(const std::string &in) { std::string result; for(const auto &ch : in) MetaChar(result, ch, true); return result; }
static void GetRXStatus( gui_window *gui ) { char *magic; int i; magic = SrchMagicChars; for( i = CTL_FIRST_RX; i <= CTL_LAST_RX; ++i ) { if( GUIIsChecked( gui, i ) ) { *magic++ = MetaChar(i); } } *magic = '\0'; }
static std::string MetaChar(char c) { std::string result; MetaChar(result, c, false); return result; }
void MetaString(std::string &out, const std::string &in) { for(unsigned i=0; i<in.size(); i++) MetaChar(out, in[i], true); }
/* * Convert non-printable character to two or more printable characters in * "buf[]". "buf" needs to be able to hold five bytes. * Does NOT work for multi-byte characters, c must be <= 255. */ void transchar_nonprint(char_u *buf, int c) { if (c == NL) c = NUL; /* we use newline in place of a NUL */ else if (c == CAR && get_fileformat(curbuf) == EOL_MAC) c = NL; /* we use CR in place of NL in this case */ if (dy_flags & DY_UHEX) /* 'display' has "uhex" */ transchar_hex(buf, c); #ifdef EBCDIC /* For EBCDIC only the characters 0-63 and 255 are not printable */ else if (CtrlChar(c) != 0 || c == DEL) #else else if (c <= 0x7f) /* 0x00 - 0x1f and 0x7f */ #endif { buf[0] = '^'; #ifdef EBCDIC if (c == DEL) buf[1] = '?'; /* DEL displayed as ^? */ else buf[1] = CtrlChar(c); #else buf[1] = c ^ 0x40; /* DEL displayed as ^? */ #endif buf[2] = NUL; } #ifdef FEAT_MBYTE else if (enc_utf8 && c >= 0x80) { transchar_hex(buf, c); } #endif #ifndef EBCDIC else if (c >= ' ' + 0x80 && c <= '~' + 0x80) /* 0xa0 - 0xfe */ { buf[0] = '|'; buf[1] = c - 0x80; buf[2] = NUL; } #else else if (c < 64) { buf[0] = '~'; buf[1] = MetaChar(c); buf[2] = NUL; } #endif else /* 0x80 - 0x9f and 0xff */ { /* * TODO: EBCDIC I don't know what to do with this chars, so I display * them as '~?' for now */ buf[0] = '~'; #ifdef EBCDIC buf[1] = '?'; /* 0xff displayed as ~? */ #else buf[1] = (c - 0x80) ^ 0x40; /* 0xff displayed as ~? */ #endif buf[2] = NUL; } }