MCPcopy Create free account
hub / github.com/IoLanguage/io / dopr

Function dopr

libs/basekit/source/PortableSnprintf.c:164–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162#endif
163
164static size_t dopr(char *buffer, size_t maxlen, const char *format,
165 va_list args) {
166 char ch;
167 LLONG value;
168 LDOUBLE fvalue;
169 char *strvalue;
170 int min;
171 int max;
172 int state;
173 int flags;
174 int cflags;
175 size_t currlen;
176
177 state = DP_S_DEFAULT;
178 currlen = flags = cflags = min = 0;
179 max = -1;
180 ch = *format++;
181
182 while (state != DP_S_DONE) {
183 if (ch == '\0')
184 state = DP_S_DONE;
185
186 switch (state) {
187 case DP_S_DEFAULT:
188 if (ch == '%')
189 state = DP_S_FLAGS;
190 else
191 dopr_outch(buffer, &currlen, maxlen, ch);
192 ch = *format++;
193 break;
194 case DP_S_FLAGS:
195 switch (ch) {
196 case '-':
197 flags |= DP_F_MINUS;
198 ch = *format++;
199 break;
200 case '+':
201 flags |= DP_F_PLUS;
202 ch = *format++;
203 break;
204 case ' ':
205 flags |= DP_F_SPACE;
206 ch = *format++;
207 break;
208 case '#':
209 flags |= DP_F_NUM;
210 ch = *format++;
211 break;
212 case '0':
213 flags |= DP_F_ZERO;
214 ch = *format++;
215 break;
216 default:
217 state = DP_S_MIN;
218 break;
219 }
220 break;
221 case DP_S_MIN:

Callers 1

vsnprintfFunction · 0.85

Calls 4

dopr_outchFunction · 0.85
fmtintFunction · 0.85
fmtfpFunction · 0.85
fmtstrFunction · 0.85

Tested by

no test coverage detected