MCPcopy Create free account
hub / github.com/HelenOS/helenos / print_wchar

Function print_wchar

kernel/generic/src/printf/printf_core.c:242–269  ·  view source on GitHub ↗

Print one formatted wide character. * * @param ch Character to print. * @param width Width modifier. * @param flags Flags that change the way the character is printed. * * @return Number of characters printed, negative value on failure. * */

Source from the content-addressed store, hash-verified

240 *
241 */
242static int print_wchar(const char32_t ch, int width, uint32_t flags, printf_spec_t *ps)
243{
244 size_t counter = 0;
245 if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
246 while (--width > 0) {
247 /*
248 * One space is consumed by the character itself, hence
249 * the predecrement.
250 */
251 if (printf_putchar(' ', ps) > 0)
252 counter++;
253 }
254 }
255
256 if (printf_putuchar(ch, ps) > 0)
257 counter++;
258
259 while (--width > 0) {
260 /*
261 * One space is consumed by the character itself, hence
262 * the predecrement.
263 */
264 if (printf_putchar(' ', ps) > 0)
265 counter++;
266 }
267
268 return (int) (counter);
269}
270
271/** Print string.
272 *

Callers 1

printf_coreFunction · 0.70

Calls 2

printf_putcharFunction · 0.70
printf_putucharFunction · 0.70

Tested by

no test coverage detected