📄 ppport.h
字号:
newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) ); PL_hints = oldhints; PL_curcop->cop_stash = old_cop_stash; PL_curstash = old_curstash; PL_curcop->cop_line = oldline;}#endif#endif /* newCONSTSUB */#ifndef START_MY_CXT/* * Boilerplate macros for initializing and accessing interpreter-local * data from C. All statics in extensions should be reworked to use * this, if you want to make the extension thread-safe. See ext/re/re.xs * for an example of the use of these macros. * * Code that uses these macros is responsible for the following: * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" * 2. Declare a typedef named my_cxt_t that is a structure that contains * all the data that needs to be interpreter-local. * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. * 4. Use the MY_CXT_INIT macro such that it is called exactly once * (typically put in the BOOT: section). * 5. Use the members of the my_cxt_t structure everywhere as * MY_CXT.member. * 6. Use the dMY_CXT macro (a declaration) in all the functions that * access MY_CXT. */#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT)/* This must appear in all extensions that define a my_cxt_t structure, * right after the definition (i.e. at file scope). The non-threads * case below uses it to declare the data as static. */#define START_MY_CXT#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))/* Fetches the SV that keeps the per-interpreter data. */#define dMY_CXT_SV \ SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE)#else /* >= perl5.004_68 */#define dMY_CXT_SV \ SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ sizeof(MY_CXT_KEY)-1, TRUE)#endif /* < perl5.004_68 *//* This declaration should be used within all functions that use the * interpreter-local data. */#define dMY_CXT \ dMY_CXT_SV; \ my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))/* Creates and zeroes the per-interpreter data. * (We allocate my_cxtp in a Perl SV so that it will be released when * the interpreter goes away.) */#define MY_CXT_INIT \ dMY_CXT_SV; \ /* newSV() allocates one more than needed */ \ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ Zero(my_cxtp, 1, my_cxt_t); \ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))/* This macro must be used to access members of the my_cxt_t structure. * e.g. MYCXT.some_data */#define MY_CXT (*my_cxtp)/* Judicious use of these macros can reduce the number of times dMY_CXT * is used. Use is similar to pTHX, aTHX etc. */#define pMY_CXT my_cxt_t *my_cxtp#define pMY_CXT_ pMY_CXT,#define _pMY_CXT ,pMY_CXT#define aMY_CXT my_cxtp#define aMY_CXT_ aMY_CXT,#define _aMY_CXT ,aMY_CXT#else /* single interpreter */#define START_MY_CXT static my_cxt_t my_cxt;#define dMY_CXT_SV dNOOP#define dMY_CXT dNOOP#define MY_CXT_INIT NOOP#define MY_CXT my_cxt#define pMY_CXT void#define pMY_CXT_#define _pMY_CXT#define aMY_CXT#define aMY_CXT_#define _aMY_CXT#endif#endif /* START_MY_CXT */#ifndef IVdf#if IVSIZE == LONGSIZE#define IVdf "ld"#define UVuf "lu"#define UVof "lo"#define UVxf "lx"#define UVXf "lX"#else#if IVSIZE == INTSIZE#define IVdf "d"#define UVuf "u"#define UVof "o"#define UVxf "x"#define UVXf "X"#endif#endif#endif#ifndef NVef#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */#define NVef PERL_PRIeldbl#define NVff PERL_PRIfldbl#define NVgf PERL_PRIgldbl#else#define NVef "e"#define NVff "f"#define NVgf "g"#endif#endif#ifndef AvFILLp /* Older perls (<=5.003) lack AvFILLp */#define AvFILLp AvFILL#endif#ifdef SvPVbyte#if PERL_REVISION == 5 && PERL_VERSION < 7 /* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */#undef SvPVbyte#define SvPVbyte(sv, lp) \ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ ? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp))static char *my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp){ sv_utf8_downgrade(sv, 0); return SvPV(sv, *lp);}#endif#else#define SvPVbyte SvPV#endif#ifndef SvPV_nolen#define SvPV_nolen(sv) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? SvPVX(sv) : sv_2pv_nolen(sv))static char *sv_2pv_nolen(pTHX_ register SV *sv){ STRLEN n_a; return sv_2pv(sv, &n_a);}#endif#ifndef get_cv#define get_cv(name,create) perl_get_cv(name,create)#endif#ifndef get_sv#define get_sv(name,create) perl_get_sv(name,create)#endif#ifndef get_av#define get_av(name,create) perl_get_av(name,create)#endif#ifndef get_hv#define get_hv(name,create) perl_get_hv(name,create)#endif#ifndef call_argv#define call_argv perl_call_argv#endif#ifndef call_method#define call_method perl_call_method#endif#ifndef call_pv#define call_pv perl_call_pv#endif#ifndef call_sv#define call_sv perl_call_sv#endif#ifndef eval_pv#define eval_pv perl_eval_pv#endif#ifndef eval_sv#define eval_sv perl_eval_sv#endif#ifndef PERL_SCAN_GREATER_THAN_UV_MAX#define PERL_SCAN_GREATER_THAN_UV_MAX 0x02#endif#ifndef PERL_SCAN_SILENT_ILLDIGIT#define PERL_SCAN_SILENT_ILLDIGIT 0x04#endif#ifndef PERL_SCAN_ALLOW_UNDERSCORES#define PERL_SCAN_ALLOW_UNDERSCORES 0x01#endif#ifndef PERL_SCAN_DISALLOW_PREFIX#define PERL_SCAN_DISALLOW_PREFIX 0x02#endif#if (PERL_VERSION > 6) || ((PERL_VERSION == 6) && (PERL_SUBVERSION >= 1))#define I32_CAST#else#define I32_CAST (I32*)#endif#ifndef IN_LOCALE#define IN_LOCALE \ (PL_curcop == &PL_compiling ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME)#endif#ifndef IN_LOCALE_RUNTIME#define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE)#endif#ifndef IN_LOCALE_COMPILETIME#define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE)#endif#ifndef IS_NUMBER_IN_UV#define IS_NUMBER_IN_UV 0x01#define IS_NUMBER_GREATER_THAN_UV_MAX 0x02#define IS_NUMBER_NOT_INT 0x04#define IS_NUMBER_NEG 0x08#define IS_NUMBER_INFINITY 0x10#define IS_NUMBER_NAN 0x20#endif#ifndef PERL_MAGIC_sv#define PERL_MAGIC_sv '\0'#endif#ifndef PERL_MAGIC_overload#define PERL_MAGIC_overload 'A'#endif#ifndef PERL_MAGIC_overload_elem#define PERL_MAGIC_overload_elem 'a'#endif#ifndef PERL_MAGIC_overload_table#define PERL_MAGIC_overload_table 'c'#endif#ifndef PERL_MAGIC_bm#define PERL_MAGIC_bm 'B'#endif#ifndef PERL_MAGIC_regdata#define PERL_MAGIC_regdata 'D'#endif#ifndef PERL_MAGIC_regdatum#define PERL_MAGIC_regdatum 'd'#endif#ifndef PERL_MAGIC_env#define PERL_MAGIC_env 'E'#endif#ifndef PERL_MAGIC_envelem#define PERL_MAGIC_envelem 'e'#endif#ifndef PERL_MAGIC_fm#define PERL_MAGIC_fm 'f'#endif#ifndef PERL_MAGIC_regex_global#define PERL_MAGIC_regex_global 'g'#endif#ifndef PERL_MAGIC_isa#define PERL_MAGIC_isa 'I'#endif#ifndef PERL_MAGIC_isaelem#define PERL_MAGIC_isaelem 'i'#endif#ifndef PERL_MAGIC_nkeys#define PERL_MAGIC_nkeys 'k'#endif#ifndef PERL_MAGIC_dbfile#define PERL_MAGIC_dbfile 'L'#endif#ifndef PERL_MAGIC_dbline#define PERL_MAGIC_dbline 'l'#endif#ifndef PERL_MAGIC_mutex#define PERL_MAGIC_mutex 'm'#endif#ifndef PERL_MAGIC_shared#define PERL_MAGIC_shared 'N'#endif#ifndef PERL_MAGIC_shared_scalar#define PERL_MAGIC_shared_scalar 'n'#endif#ifndef PERL_MAGIC_collxfrm#define PERL_MAGIC_collxfrm 'o'#endif#ifndef PERL_MAGIC_tied#define PERL_MAGIC_tied 'P'#endif#ifndef PERL_MAGIC_tiedelem#define PERL_MAGIC_tiedelem 'p'#endif#ifndef PERL_MAGIC_tiedscalar#define PERL_MAGIC_tiedscalar 'q'#endif#ifndef PERL_MAGIC_qr#define PERL_MAGIC_qr 'r'#endif#ifndef PERL_MAGIC_sig#define PERL_MAGIC_sig 'S'#endif#ifndef PERL_MAGIC_sigelem#define PERL_MAGIC_sigelem 's'#endif#ifndef PERL_MAGIC_taint#define PERL_MAGIC_taint 't'#endif#ifndef PERL_MAGIC_uvar#define PERL_MAGIC_uvar 'U'#endif#ifndef PERL_MAGIC_uvar_elem#define PERL_MAGIC_uvar_elem 'u'#endif#ifndef PERL_MAGIC_vstring#define PERL_MAGIC_vstring 'V'#endif#ifndef PERL_MAGIC_vec#define PERL_MAGIC_vec 'v'#endif#ifndef PERL_MAGIC_utf8#define PERL_MAGIC_utf8 'w'#endif#ifndef PERL_MAGIC_substr#define PERL_MAGIC_substr 'x'#endif#ifndef PERL_MAGIC_defelem#define PERL_MAGIC_defelem 'y'#endif#ifndef PERL_MAGIC_glob#define PERL_MAGIC_glob '*'#endif#ifndef PERL_MAGIC_arylen#define PERL_MAGIC_arylen '#'#endif#ifndef PERL_MAGIC_pos#define PERL_MAGIC_pos '.'#endif#ifndef PERL_MAGIC_backref#define PERL_MAGIC_backref '<'#endif#ifndef PERL_MAGIC_ext#define PERL_MAGIC_ext '~'#endif#endif /* _P_P_PORTABILITY_H_ *//* End of File ppport.h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -