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

Function omPrintRetInfo

omalloc/omRet2Info.c:99–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99int omPrintRetInfo(omRetInfo info, int max, FILE* fd, const char* fmt)
100{
101 int i = 0;
102 if (max <= 0 || info == NULL || fmt == NULL || fd == NULL) return 0;
103 while (i < max && info[i].addr != NULL)
104 {
105 int l = 0;
106 while (fmt[l] != 0)
107 {
108 if (fmt[l] == '%')
109 {
110 l++;
111 if (fmt[l] == 'p') fprintf(fd, "%p", info[i].addr);
112 else if (fmt[l] == 'f') fprintf(fd, "%-20s", (*info[i].file != '\0' ? info[i].file : "??"));
113 else if (fmt[l] == 'F') fprintf(fd, "%-20s", (*info[i].func != '\0' ? info[i].func : "??"));
114 else if (fmt[l] == 'l') fprintf(fd, "%d", info[i].line);
115 else if (fmt[l] == 'N')
116 {
117 if (*info[i].func != '\0')
118 {
119 char* found = (char*) strchr(info[i].func, '(');
120 if (found) *found = '\0';
121 fprintf(fd, "%-20s", info[i].func);
122 if (found) *found = '(';
123 }
124 else
125 fprintf(fd, "%-20s", "??");
126 }
127 else if (fmt[l] == 'L')
128 {
129 int n = fprintf(fd, "%s:%d", (*info[i].func != '\0' ? info[i].file : "??"), info[i].line);
130 if (n < 20) fprintf(fd, "%*s", 20-n, " ");
131 }
132 else if (fmt[l] == 'i') fprintf(fd, "%d", i);
133 else
134 {
135 fputc('%', fd);
136 l--;
137 }
138 }
139 else
140 {
141 fputc(fmt[l], fd);
142 }
143 l++;
144 }
145 i++;
146 }
147 return i;
148}
149
150int omPrintBackTrace(void** bt, int max, FILE* fd)
151{

Callers 2

omPrintBackTraceFunction · 0.85
_omPrintBackTraceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected