MCPcopy Create free account
hub / github.com/DFHack/dfhack / PrintString

Function PrintString

depends/lua/src/luac.c:226–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224#define VOID(p) ((const void*)(p))
225
226static void PrintString(const TString* ts)
227{
228 const char* s=getstr(ts);
229 size_t i,n=tsslen(ts);
230 printf("%c",'"');
231 for (i=0; i<n; i++)
232 {
233 int c=(int)(unsigned char)s[i];
234 switch (c)
235 {
236 case '"': printf("\\\""); break;
237 case '\\': printf("\\\\"); break;
238 case '\a': printf("\\a"); break;
239 case '\b': printf("\\b"); break;
240 case '\f': printf("\\f"); break;
241 case '\n': printf("\\n"); break;
242 case '\r': printf("\\r"); break;
243 case '\t': printf("\\t"); break;
244 case '\v': printf("\\v"); break;
245 default: if (isprint(c))
246 printf("%c",c);
247 else
248 printf("\\%03d",c);
249 }
250 }
251 printf("%c",'"');
252}
253
254static void PrintConstant(const Proto* f, int i)
255{

Callers 1

PrintConstantFunction · 0.85

Calls 1

isprintFunction · 0.85

Tested by

no test coverage detected