Perl interpreter has an interesting mechanism to checks if function arguments have correct values. Below is its example from util.c:
char *
Perl_delimcpy(register char *to,
register const char *toend,
register const char *from,
register const char *fromend,
register int delim, I32 *retlen)
{
register I32 tolen;
PERL_ARGS_ASSERT_DELIMCPY;
/* ... */
}
Body of PERL_ARGS_ASSERT_DELIMCPY is in proto.h:
#define PERL_ARGS_ASSERT_DELIMCPY \
assert(to); assert(toend); assert(from); assert(fromend); assert(retlen)
What makes those macros interesting, is that they are automatically generated by a perl script (regen.pl). They are created from a data stored in embed.fnc, a sample entry of this file is presented below:
: Used in util.cp op |void |example_function |NN const char *name|STRLEN len|
The script needs to be executed after any change in embed.fnc.
Interesting and weird.
Looks like a PHP engine :P
ReplyDeleteYes, it's a bit creepy :)
Delete