| parrotcode: Miscellaneous functions | |
| Contents | C |

src/misc.c - Miscellaneous functions

Miscellaneous functions,
mainly the Parrot_sprintf family.
Uses a generalized formatting algorithm (src/spf_render.c) with a specialized vtable (src/spf_vtable.c) to handle argument extraction.

The naming convention used is:
Parrot_v?n?sprintfParrot_v?sprintf_cParrot_v?sprintf_s_ means "returns Parrot string" and the other letter indicates the type for the format.STRING *Parrot_vsprintf_s(Interp *interpreter, STRING *pat, va_list args)Parrot_psprintf() for the exception).
It in turn calls Parrot_sprintf_format() (see src/spf_render.c).STRING *Parrot_vsprintf_c(Interp *interpreter, const char *pat, va_list args)Parrot_vsprintf_s().void Parrot_vsnprintf(Interp *interpreter, char *targ, size_t len, const char *pat, va_list args)Parrot_vsprintf() but with an option to specify the length (len) of the returned C string.STRING *Parrot_sprintf_s(Interp *interpreter, STRING *pat, ...)Parrot_vsprintf_s() with the va_list obtained from ....STRING *Parrot_sprintf_c(Interp *interpreter, const char *pat, ...)Parrot_sprintf_s().void Parrot_snprintf(Interp *interpreter, char *targ, size_t len, const char *pat, ...)Parrot_sprintf() but with an option to specify the length (len) of the returned C string.STRING *Parrot_psprintf(Interp *interpreter, STRING *pat, PMC *ary)Parrot_sprintf_format() with the insertion arguments in an Array PMC.
src/misc.h, src/spf_vtable.c, src/spf_render.c.

This was once a simple, vararg-based implementation that existed completely within this file. When the file grew to be nearly 1,000 lines long, I split it into three. --BD
|
|
|