ç¶ã»XSã®looks_like_number()
前回ã®ç¶ãã
ListUtil.xs
#if (PERL_VERSION < 8) || (PERL_VERSION == 8 && PERL_SUBVERSION <5) if (SvPOK(sv) || SvPOKp(sv)) { RETVAL = looks_like_number(sv); } else { RETVAL = SvFLAGS(sv) & (SVf_NOK|SVp_NOK|SVf_IOK|SVp_IOK); } #else RETVAL = looks_like_number(sv); #endif OUTPUT: RETVAL
Cè¨èªã®ããªããã»ããµã£ã¦ã©ããªãã ã£ããâ¦ï¼ãã¨ããã¬ãã«ã®åã§ãã
åèãµã¤ãï¼
ãC言語 プリプロセッサã
ãYahoo!¥¸¥ª¥·¥Æ¥£¡¼¥ºã
ãããã¨ããããã¾ãã
#if (PERL_VERSION < 8) || (PERL_VERSION == 8 && PERL_SUBVERSION <5)
#if ã®ä¸ã¯ã³ã³ãã¤ã«åãªã®ã§å®æ°ãã使ããªãã¨ãããã¨ãªã®ã§ããã®å®æ°ãæ¢ãã¦ã¿ãã
ã¾ãé°å²æ°ãããã¦Perlã®ã¡ã¸ã£ã¼ãã¼ã¸ã§ã³ããã¤ããã¼ã¸ã§ã³ã表ãã¦ããã®ã ããã
ListUtil.xs
å é ã®æ¹ã«ããã¾ããã
#ifndef PERL_VERSION # include <patchlevel.h> # if !(defined(PERL_VERSION) || (SUBVERSION > 0 && defined(PATCHLEVEL))) # include <could_not_find_Perl_patchlevel.h> # endif # define PERL_REVISION 5 # define PERL_VERSION PATCHLEVEL # define PERL_SUBVERSION SUBVERSION #endif
ãªãã¸ã§ã³ããã¼ã¸ã§ã³ããµããã¼ã¸ã§ã³ãã
ããããã¯èª¿ã¹ãªãã
ãã¾5.11.4ãããã¦ãããã
- PERL_REVISION -> 5
- PERL_VERSION -> 11
- PERL_SUBVERSION -> 4
ã«ãªãã¯ããã¶ãã
ã§ã#ifã®ä¸ãéãã®ãéããªãã®ãã¨ããã°ã
#if (PERL_VERSION < 8) || (PERL_VERSION == 8 && PERL_SUBVERSION <5)
ã¯Perl5.8æªæºããããã¯ãPerl5.8.5æªæºã®ã¨ãã«çãªã®ã§ãéããªãã
ã¨ãããã¨ã¯ã
#else RETVAL = looks_like_number(sv); #endif
ãéãããã§ã£ã¦ããï¼ï¼
å帰ãããã§ããï¼ï¼
ãã¼ããã¤ã¾ãã°ãããããªãã¡ã¬ã³ã¹ããã®éæ¥çãªå¤æ°ã®å¤ãå帰çã«æ»ãã¦ãããã¿ãããªæããã¼ï¼
ã§RETVALãOUTPUTããããã¨ã
ãããçµå±ã©ãã§æ°å¤ãå¤å®ãã¦ããã®ãã©ããããããªãã£ãã
ã©ããã®ãã¯ããªãã ããã¨ã¯æãããã©â¦ã
ã©ãããããæåºãã®ãæ©ãã£ãã®ããªã¼ãææ³ãã»ãã¨ããããããããã§çµãã£ã¦ãã¾ãããã ã
ã¾ãPerlã®å
é¨æ§é ãã¡ãã£ã¨ã§ãåãã£ãã®ã§ããã¨ãããèªåã®ä¸ã§ã¯ä»¥ä¸ã