MCPcopy Create free account
hub / github.com/Singular/Singular / charToString

Function charToString

libpolys/tests/cxxtest/ValueTraits.cpp:48–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 }
47
48 char *charToString( unsigned long c, char *s )
49 {
50 switch( c ) {
51 case '\\': return copyString( s, "\\\\" );
52 case '\"': return copyString( s, "\\\"" );
53 case '\'': return copyString( s, "\\\'" );
54 case '\0': return copyString( s, "\\0" );
55 case '\a': return copyString( s, "\\a" );
56 case '\b': return copyString( s, "\\b" );
57 case '\n': return copyString( s, "\\n" );
58 case '\r': return copyString( s, "\\r" );
59 case '\t': return copyString( s, "\\t" );
60 }
61 if ( c >= 32 && c <= 127 ) {
62 s[0] = (char)c;
63 s[1] = '\0';
64 return s + 1;
65 }
66 else {
67 s[0] = '\\';
68 s[1] = 'x';
69 if ( c < 0x10 ) {
70 s[2] = '0';
71 ++ s;
72 }
73 return numberToString( c, s + 2, 16UL );
74 }
75 }
76
77 char *charToString( char c, char *s )
78 {

Callers 2

StdValueTraits.hFile · 0.85
ValueTraits.hFile · 0.85

Calls 2

copyStringFunction · 0.85
numberToStringFunction · 0.85

Tested by

no test coverage detected