NAME ^

src/spf_render.c - Parrot sprintf

DESCRIPTION ^

Implements the main function that drives the Parrot_sprintf family and its utility functions.

Utility Functions ^

static STRING *uint_to_str(Interp *interp, char *tc, UHUGEINTVAL num, char base, int minus)

Returns num converted to a Parrot STRING.

Note that base must be defined, a default of 10 is not assumed. The caller has to verify that base >= 2 && base <= 36 The buffer tc must be at least sizeof(UHUGEINTVAL)*8 + 1 chars big.

If minus is true then - is prepended to the string representation.

STRING *int_to_str(Interp *interp, char *tc, HUGEINTVAL num, char base)

Returns num converted to a Parrot STRING.

Note that base must be defined, a default of 10 is not assumed.

If num < 0 then - is prepended to the string representation.

static STRING *handle_flags(Interp *interp, SpfInfo info, STRING *str, INTVAL is_int_type, const char *prefix)

Handles +, -, 0, #, space, width, and prec.

static void gen_sprintf_call(Interp *interp, char *out, SpfInfo info, int thingy)

Turn the info structure back into an sprintf format. Far from being pointless, this is used to call snprintf() when we're confronted with a float.

STRING *Parrot_sprintf_format(Interp *interp, STRING *pat, SPRINTF_OBJ *obj)

This is the engine that does all the formatting.

SEE ALSO ^

src/misc.h, src/misc.c, src/spf_vtable.c.


parrot