Method __handle_sprintf_format()
- Method
__handle_sprintf_format
type__handle_sprintf_format(stringattr,string|zerofmt,typearg_type,type|zerocont_type,mappingstate)- Description
Type attribute handler for
"sprintf_format".- Parameter
attr Attribute to handle, either
"sprintf_format"or"strict_sprintf_format".- Parameter
fmt Sprintf-style formatting string to generate type information from.
- Parameter
arg_type Declared type of the
fmtargument (typicallystring).- Parameter
cont_type Continuation function type after the
fmtargument. This is scanned for the type attribute"sprintf_args"to determine where the remaining arguments to sprintf() will come from.- Parameter
state State mapping.
This function is typically called from
PikeCompiler()->apply_attribute_constant()and is used to perform stricter compile-time argument checking of sprintf()-style functions.It currently implements two operating modes depending on the value of
attr:"strict_sprintf_format"The formatting string
fmtis known to always be passed to sprintf()."sprintf_format"The formatting string
fmtis passed to sprintf() only if there are"sprintf_args".- Returns
Returns
cont_typewith"sprintf_args"replaced by the arguments required by thefmtformatting string, and"sprintf_result"replaced by the resulting string type.- See also
PikeCompiler()->apply_attribute_constant(), sprintf()