MCPcopy Create free account
hub / github.com/WheretIB/nullc / GetErrorString

Method GetErrorString

NULLC/Compiler.h:23–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 unsigned int IsEmpty(){ return !!empty; }
22
23 const char* GetErrorString() const
24 {
25 if(!lineNum)
26 return errLocal;
27 char *curr = errGlobal;
28 if(lineNum != 0)
29 curr += SafeSprintf(curr, NULLC_ERROR_BUFFER_SIZE - int(curr - errGlobal), "line %d - ", lineNum);
30 curr += SafeSprintf(curr, NULLC_ERROR_BUFFER_SIZE - int(curr - errGlobal), "%s", errLocal);
31 if(line[0] != 0)
32 {
33 curr += SafeSprintf(curr, NULLC_ERROR_BUFFER_SIZE - int(curr - errGlobal), "\r\n at \"%s\"", line);
34 curr += SafeSprintf(curr, NULLC_ERROR_BUFFER_SIZE - int(curr - errGlobal), "\r\n ");
35 if((unsigned)(NULLC_ERROR_BUFFER_SIZE - int(curr - errGlobal)) > shift)
36 {
37 for(unsigned int i = 0; i < shift; i++)
38 *(curr++) = ' ';
39 }
40 curr += SafeSprintf(curr, NULLC_ERROR_BUFFER_SIZE - int(curr - errGlobal), "^");
41 }
42 curr += SafeSprintf(curr, NULLC_ERROR_BUFFER_SIZE - int(curr - errGlobal), "\r\n");
43 return errGlobal;
44 }
45 static const char *codeStart, *codeEnd;
46private:
47 friend class Compiler;

Callers 3

TypeInstanceGenericFunction · 0.80
GetErrorMethod · 0.80

Calls 1

SafeSprintfFunction · 0.70

Tested by

no test coverage detected