-*- buffer-read-only: t -*-

!!!!!!! DO NOT EDIT THIS FILE !!!!!!! This file is built by autodoc.pl extracting documentation from the C source files.


NAME

perlapi - perl public API の自動生成ドキュメント


DESCRIPTION

このファイルは embed.pl で生成された perl の公式な API のドキュメントです; 特にエクステンションの作者が使うかもしれない関数、マクロ、フラグ、変数の 一覧です。 ここに挙げられていないどの関数のインターフェースも予告なしに 変更されることがあります。 この理由により、エクステンションを書くときに proto.h に挙げられている 関数を盲目的に使うことは避けるべきです。

全ての Perl API グローバル変数は PL_ というプリフィックスをつけて 参照しなければならないということに注意してください。 一部のマクロは以前のものとの互換性を確保していてはいますが、それは将来の リリースにおいては無効になるかもしれません。

リストは大文字小文字を無視したアルファベット順です。


"Gimme" Values

GIMME

G_SCALARG_ARRAY しか返さないような GIMME_V の、 過去互換性のためのものです。 無効コンテキストでは、これは G_SCALAR を返します。 非推奨です。 代わりに GIMME_V を使ってください。

        U32     GIMME
GIMME_V

XSUB 作成者のための、Perl の wantarray に透過なものです。 G_VOIDG_SCALARG_ARRAY をそれぞれ、無効コンテキスト、スカラ コンテキスト、リストコンテキストのときに返します。

        U32     GIMME_V
G_ARRAY

リストコンテキストを示すために使われます。 GIMME_VGIMMEperlcall を参照してください。

G_DISCARD

コールバックから返される引数が破棄されるべきものであることを示します。 perlcall を参照してください。

G_EVAL

コールバックを Perl の eval で囲むのを強制するために使われます。 perlcall を参照してください。

G_NOARGS

コールバックに渡す引数がないことを示します。 perlcall を参照してください。

G_SCALAR

スカラコンテキストを示すのに使われます。 GIMME_V, GIMME, perlcall を参照してください。

G_VOID

無効コンテキストを示すために使われます。 GIMME_Vperlcall を参照してください。


Array Manipulation Functions

AvFILL

av_len() と同様です。 非推奨なので、代わりに av_len() を使ってください。

        int     AvFILL(AV* av)
av_clear

配列をクリアし、空にします。 配列自身が使っているメモリの解放はしません。

        void    av_clear(AV* ar)
av_create_and_push

SV を配列の最後にプッシュします; もし必要なら配列を作ります。 一般的に複製された慣用句を削除するための小さい内部ヘルパーです。

注意: この関数は実験的で、予告なしに変更あるいは削除されるかもしれません。

        void    av_create_and_push(AV **const avp, SV *const val)
av_create_and_unshift_one

SV を配列の最初に unshift します; もし必要なら配列を作ります。 一般的に複製された慣用句を削除するための小さい内部ヘルパーです。

注意: この関数は実験的で、予告なしに変更あるいは削除されるかもしれません。

        SV**    av_create_and_unshift_one(AV **const avp, SV *const val)
av_delete

配列から、添え字が key の要素を削除します。 削除された要素を返します。 もし flagsG_DISCARD なら、要素は解放されて NULL が返されます。

        SV*     av_delete(AV* ar, I32 key, I32 flags)
av_exists

添え字が key の要素が既に初期化されているなら真を返します。

これは、初期化されていない配列要素は &PL_sv_undef が セットされているという事実に依存しています。

        bool    av_exists(AV* ar, I32 key)
av_extend

配列を事前拡張します。 key は、拡張された後の配列の添え字です。

        void    av_extend(AV* ar, I32 key)
av_fetch

配列中の指定された添え字にあるSVを返します。 key は添え字です。 lval がセットされている場合、このフェッチはストアの一部となります。 戻り値の SV* に対して参照外しをする場合にそれがナルでないかを チェックしてください。

この関数をtieされた配列に対して使う場合の説明は Understanding the Magic of Tied Hashes and Arrays in perlguts を 参照してください。

        SV**    av_fetch(AV* ar, I32 key, I32 lval)
av_fill

配列の最大の添え字を与えられた数値にセットします; Perl の $#array = $fill; と等価です。

av_fill() から返った後、配列の要素数は fill + 1 になります。 配列が以前より短くなった場合は、追加された要素は PL_sv_undef が セットされます。 配列がより長くなった場合は、超過した要素は解放されます。 av_fill(av, -1)av_clear(av) と同じです。

        void    av_fill(AV* ar, I32 fill)
av_len

配列中で最大の添え字を返します。 配列の要素数は av_len(av) + 1 です。 配列が空である場合には -1 を返します。

        I32     av_len(const AV* ar)
av_make

新しい AV を生成して、SV のリストで埋めます。 その SV は配列へとコピーされるので、av_make を呼び出した後で 解放することもできます。 新たな AV はその参照カウントとして 1 を持ちます。

        AV*     av_make(I32 size, SV** svp)
av_pop

配列の最後にある SV をポップします。 配列が空である場合には &PL_sv_undef を返します。

        SV*     av_pop(AV* ar)
av_push

配列の末尾に SV をプッシュします。 追加に対応するため、配列は自動的に拡張されます。

        void    av_push(AV* ar, SV* val)
av_shift

配列の先頭にある SV をシフトして取り出します。

        SV*     av_shift(AV* ar)
av_store

SV を配列に格納します。 配列の添え字は key で指定します。 戻り値は操作が失敗したり、(tie されている配列の場合のように)値を実際に 配列に格納する必要がないような場合には NULL になります。 そうでなければ、取得したオリジナルの SV* の参照外しを することができます。 呼び出し側は、呼び出しを行う前に val の参照カウントが インクリメントされる原因であり、関数が NULL を返したときには参照カウントの デクリメントを行うということに注意してください。

この関数を tie された配列に対して使う場合の説明は Understanding the Magic of Tied Hashes and Arrays in perlguts を 参照してください。

        SV**    av_store(AV* ar, I32 key, SV* val)
av_undef

配列を undefine します。 配列自身が使っていたメモリーを解放します。

        void    av_undef(AV* ar)
av_unshift

配列の先頭に、与えられた数だけの undef 値を unsfhit します。 追加されたものにあわせて、配列は自動的に大きくなります。 追加された新しい要素に対して値を代入するには、この後で av_store を 使わなければなりません。

        void    av_unshift(AV* ar, I32 num)
get_av

指定された Perl 配列の AV を返します。 create がセットされていて、 指定された変数が存在していなければ AV が生成されます。 create がセットされておらず、かつ、指定された変数がなかった場合には NULL が返されます。

注意: この関数の perl_ の形は非推奨です。

        AV*     get_av(const char* name, I32 create)
newAV

新たな AV を生成します。 参照カウントは 1 に設定されます。

        AV*     newAV()
sortsv

配列をソートします。 以下は例です:

    sortsv(AvARRAY(av), av_len(av)+1, Perl_sv_cmp_locale);

現在のところ、これは常にマージソートを使います。 さらに柔軟なルーチンのためには sortsv_flags を参照してください。

        void    sortsv(SV** array, size_t num_elts, SVCOMPARE_t cmp)
sortsv_flags

様々なオプション付きで配列をソートします。

        void    sortsv_flags(SV** array, size_t num_elts, SVCOMPARE_t cmp, U32 flags)


Callback Functions

call_argv

指定された Perl サブルーチンに対するコールバックを呼び出します。 perlcall を参照してください。

注意: この関数の perl_ の形は非推奨です。

        I32     call_argv(const char* sub_name, I32 flags, char** argv)
call_method

指定された Perl サブルーチンに対するコールバックを呼び出します。 bless されたオブジェクトがスタック上になければなりません。 perlcall を参照してください。

注意: この関数の perl_ の形は非推奨です。

        I32     call_method(const char* methname, I32 flags)
call_pv

指定された Perl サブルーチンに対するコールバックを呼び出します。 perlcall を参照してください。

注意: この関数の perl_ の形は非推奨です。

        I32     call_pv(const char* sub_name, I32 flags)
call_sv

SV にある名前を持った Perl サブルーチンに対するコールバックを呼び出します。 perlcall を参照してください。

注意: この関数の perl_ の形は非推奨です。

        I32     call_sv(SV* sv, I32 flags)
ENTER

コールバックにあるブラケットを開きます。 LEAVEperlcall を参照してください。

                ENTER;
eval_pv

Perl に対して、与えられた文字列を eval してその結果をSV* に返すように 指示します。

注意: この関数の perl_ の形は非推奨です。

        SV*     eval_pv(const char* p, I32 croak_on_error)
eval_sv

Perl に対し、SV にある文字列を eval するように指示します。

注意: この関数の perl_ の形は非推奨です。

        I32     eval_sv(SV* sv, I32 flags)
FREETMPS

コールバックにある一時変数のためのブラケットを閉じます。 SAVETMPSperlcall を参照してください。

                FREETMPS;
LEAVE

コールバック上のブラケットを閉じます。 ENTERperlcall を参照してください。

                LEAVE;
SAVETMPS

コールバックにある一時変数のためにブラケットを開けます。 FREETMPSperlcall を参照してください。

                SAVETMPS;


Character classes

isALNUM

char がアスキーのアルファベット文字(下線を含む)、もしくは数字で あるかどうかを表わすブール値を返します。

        bool    isALNUM(char ch)
isALPHA

char がアスキーのアルファベット文字であるかどうかを表わす ブール値を返します。

        bool    isALPHA(char ch)
isDIGIT

char がアスキーの数字であるかどうかを表わすブール値を返します。

        bool    isDIGIT(char ch)
isLOWER

char が小文字の文字であるかどうかを表わすブール値を返します。

        bool    isLOWER(char ch)
isSPACE

char が空白であるかどうかを表わすブール値を返します。

        bool    isSPACE(char ch)
isUPPER

char が大文字の文字であるかどうかを表わすブール値を返します。

        bool    isUPPER(char ch)
toLOWER

指定された文字を小文字に変換します。

        char    toLOWER(char ch)
toUPPER

指定された文字を大文字に変換します。

        char    toUPPER(char ch)


Cloning an interpreter

perl_clone

現在のものをクローン化することによって新しいインタプリタを作成し、 それを返します。

perl_clone は以下のフラグを引数として受け取ります:

CLONEf_COPY_STACKS - is used to, well, copy the stacks also, without it we only clone the data and zero the stacks, with it we copy the stacks and the new perl interpreter is ready to run at the exact same point as the previous one. The pseudo-fork code uses COPY_STACKS while the threads->create doesn't. (TBT)

CLONEf_KEEP_PTR_TABLE perl_clone keeps a ptr_table with the pointer of the old variable as a key and the new variable as a value, this allows it to check if something has been cloned and not clone it again but rather just use the value and increase the refcount. If KEEP_PTR_TABLE is not set then perl_clone will kill the ptr_table using the function ptr_table_free(PL_ptr_table); PL_ptr_table = NULL;, reason to keep it around is if you want to dup some of your own variable who are outside the graph perl scans, example of this code is in threads.xs create (TBT)

CLONEf_CLONE_HOST This is a win32 thing, it is ignored on unix, it tells perls win32host code (which is c++) to clone itself, this is needed on win32 if you want to run two threads at the same time, if you just want to do some stuff in a separate perl interpreter and then throw it away and return to the original one, you don't need to do anything. (TBT)

        PerlInterpreter*        perl_clone(PerlInterpreter* interp, UV flags)


CV Manipulation Functions

CvSTASH

CV のスタッシュを返します。

        HV*     CvSTASH(CV* cv)
get_cv

name の長さを得るために strlen を使い、それから get_cvn_flags を 呼び出します。

注意: この関数の perl_ の形は非推奨です。

        CV*     get_cv(const char* name, I32 flags)
get_cvn_flags

指定された Perl サブルーチンの CV を返します。 flagsgv_fetchpvn_flags に渡されます。 GV_ADD がセットされ、Perl サブルーチンが存在しない場合は、 これが宣言されます(これは sub name; と同じ効果です)。 GV_ADD がセットされず、Perl サブルーチンが存在しない場合は、NULL が 返されます。

注意: この関数の perl_ の形は非推奨です。

        CV*     get_cvn_flags(const char* name, STRLEN len, I32 flags)


Embedding Functions

cv_undef

CV の全ての有効な要素を片付けます。 これは明示的な undef &foo によってか、参照カウントが 0 になることによって 起こります。 前者の場合、CvOUTSIDE ポインタは維持するので、全ての無名の子は完全な レキシカルスコープチェーンに従ったままです。

        void    cv_undef(CV* cv)
load_module

Loads the module whose name is pointed to by the string part of name. Note that the actual module name, not its filename, should be given. Eg, "Foo::Bar" instead of "Foo/Bar.pm". flags can be any of PERL_LOADMOD_DENY, PERL_LOADMOD_NOIMPORT, or PERL_LOADMOD_IMPORT_OPS (or 0 for no flags). ver, if specified, provides version semantics similar to use Foo::Bar VERSION. The optional trailing SV* arguments can be used to specify arguments to the module's import() method, similar to use Foo::Bar VERSION LIST. (TBT)

        void    load_module(U32 flags, SV* name, SV* ver, ...)
nothreadhook

スレッドがないときの perl_destruct のためのスレッドフックを提供する スタブです。

        int     nothreadhook()
perl_alloc

新たなPerl インタプリタを割り付けます。 perlembed を参照してください。

        PerlInterpreter*        perl_alloc()
perl_construct

新しいPerl インタプリタの初期化を行います。 perlembed を参照してください。

        void    perl_construct(PerlInterpreter* interp)
perl_destruct

Perl インタプリタをシャットダウンします。 perlembed を参照してください。

        int     perl_destruct(PerlInterpreter* interp)
perl_free

Perl インタプリタを解放します。 perlembed を参照してください。

        void    perl_free(PerlInterpreter* interp)
perl_parse

Perl インタプリタに Perl スクリプトを解析するよう指示します。 perlembed を参照してください。

        int     perl_parse(PerlInterpreter* interp, XSINIT_t xsinit, int argc, char** argv, char** env)
perl_run

Perl インタプリタに実行するよう指示します。 perlembed を参照してください。

        int     perl_run(PerlInterpreter* interp)
require_pv

Tells Perl to require the file named by the string argument. It is analogous to the Perl code eval "require '$file'". It's even implemented that way; consider using load_module instead. (TBT)

注意: この関数の perl_ の形は非推奨です。

        void    require_pv(const char* pv)


Functions in file dump.c

pv_display
  char *pv_display(SV *dsv, const char *pv, STRLEN cur, STRLEN len,
                   STRLEN pvlim, U32 flags)

以下と似ています:

  pv_escape(dsv,pv,cur,pvlim,PERL_PV_ESCAPE_QUOTE);

except that an additional "\0" will be appended to the string when len > cur and pv[cur] is "\0". (TBT)

最終的な文字列は pvlim より最大 7 文字長くなる可能性があることに 注意してください。

        char*   pv_display(SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
pv_escape
               |const STRLEN count|const STRLEN max
               |STRLEN const *escaped, const U32 flags

Escapes at most the first "count" chars of pv and puts the results into dsv such that the size of the escaped string will not exceed "max" chars and will not contain any incomplete escape sequences. (TBT)

If flags contains PERL_PV_ESCAPE_QUOTE then any double quotes in the string will also be escaped. (TBT)

Normally the SV will be cleared before the escaped string is prepared, but when PERL_PV_ESCAPE_NOCLEAR is set this will not occur. (TBT)

If PERL_PV_ESCAPE_UNI is set then the input string is treated as Unicode, if PERL_PV_ESCAPE_UNI_DETECT is set then the input string is scanned using is_utf8_string() to determine if it is Unicode. (TBT)

If PERL_PV_ESCAPE_ALL is set then all input chars will be output using \x01F1 style escapes, otherwise only chars above 255 will be escaped using this style, other non printable chars will use octal or common escaped patterns like \n. If PERL_PV_ESCAPE_NOBACKSLASH then all chars below 255 will be treated as printable and will be output as literals. (TBT)

If PERL_PV_ESCAPE_FIRSTCHAR is set then only the first char of the string will be escaped, regardles of max. If the string is utf8 and the chars value is >255 then it will be returned as a plain hex sequence. Thus the output will either be a single char, an octal escape sequence, a special escape like \n or a 3 or more digit hex value. (TBT)

If PERL_PV_ESCAPE_RE is set then the escape char used will be a '%' and not a '\\'. This is because regexes very often contain backslashed sequences, whereas '%' is not a particularly common character in patterns. (TBT)

dsv によって保持されている、エスケープされたテキストへのポインタを返します。

注意: この関数の perl_ の形は非推奨です。

        char*   pv_escape(SV *dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags)
pv_pretty
           |const STRLEN count|const STRLEN max\
           |const char const *start_color| const char const *end_color\
           |const U32 flags

Converts a string into something presentable, handling escaping via pv_escape() and supporting quoting and ellipses. (TBT)

If the PERL_PV_PRETTY_QUOTE flag is set then the result will be double quoted with any double quotes in the string escaped. Otherwise if the PERL_PV_PRETTY_LTGT flag is set then the result be wrapped in angle brackets. (TBT)

If the PERL_PV_PRETTY_ELLIPSES flag is set and not all characters in string were output then an ellipsis ... will be appended to the string. Note that this happens AFTER it has been quoted. (TBT)

If start_color is non-null then it will be inserted after the opening quote (if there is one) but before the escaped text. If end_color is non-null then it will be inserted after the escaped text but before any quotes or ellipses. (TBT)

dsv によって保持されている、飾り付けられたテキストへのポインタを返します。

注意: この関数の perl_ の形は非推奨です。

        char*   pv_pretty(SV *dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags)


Functions in file mathoms.c

gv_fetchmethod

gv_fetchmethod_autoload を参照してください。

        GV*     gv_fetchmethod(HV* stash, const char* name)
pack_cat

Perl 関数 unpack() を実装しているエンジンです。 注意: 引数 next_in_list と flags は使われません。 この呼び出しは使うべきではなりません; 代わりに packlist を使ってください。

        void    pack_cat(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
sv_2pvbyte_nolen

SV のバイトエンコードされた表現へのポインタを返します。 副作用として、SV が UTF-8 から降格するかもしれません。

通常は SvPVbyte_nolen マクロ経由でアクセスします。

        char*   sv_2pvbyte_nolen(SV* sv)
sv_2pvutf8_nolen

SV の UTF-8 エンコードされた表現へのポインタを返します。 副作用として、SV が UTF-8 へ昇格するかもしれません。

通常は SvPVutf8_nolen マクロ経由でアクセスします。

        char*   sv_2pvutf8_nolen(SV* sv)
sv_2pv_nolen

Like sv_2pv(), but doesn't return the length too. You should usually use the macro wrapper SvPV_nolen(sv) instead. (TBT)

        char*   sv_2pv_nolen(SV* sv)
sv_catpvn_mg

sv_catpvn に似ていますが、'set' magic もハンドルします。

        void    sv_catpvn_mg(SV *sv, const char *ptr, STRLEN len)
sv_catsv_mg

sv_catsv に似ていますが、'set' magic もハンドルします。

        void    sv_catsv_mg(SV *dstr, SV *sstr)
sv_force_normal

Undo various types of fakery on an SV: if the PV is a shared string, make a private copy; if we're a ref, stop refing; if we're a glob, downgrade to an xpvmg. See also sv_force_normal_flags. (TBT)

        void    sv_force_normal(SV *sv)
sv_iv

複雑なマクロ式を扱えないコンパイラのための、SvIVx マクロの プライベート実装です。 代わりに、常にマクロを使ってください。

        IV      sv_iv(SV* sv)
sv_nolocking

ロックモジュールがないときに SV を「ロックする」ダミールーチンです。 NULL 関数をテストして、あるレベルでの strict での潜在的な警告を 回避するために存在します。

sv_nosharing() で「置き換え」られました。

        void    sv_nolocking(SV *sv)
sv_nounlocking

ロックモジュールがないときに SV を「アンロックする」ダミールーチンです。 NULL 関数をテストして、あるレベルでの strict での潜在的な警告を 回避するために存在します。

sv_nosharing() で「置き換え」られました。

        void    sv_nounlocking(SV *sv)
sv_nv

複雑なマクロ式を扱えないコンパイラのための、SvNVx マクロの プライベート実装です。 代わりに、常にマクロを使ってください。

        NV      sv_nv(SV* sv)
sv_pv

代わりに SvPV_nolen マクロを使ってください。

        char*   sv_pv(SV *sv)
sv_pvbyte

代わりに SvPVbyte_nolen マクロを使ってください。

        char*   sv_pvbyte(SV *sv)
sv_pvbyten

複雑なマクロ式を扱えないコンパイラのための、SvPVbyte マクロの プライベート実装です。 代わりに、常にマクロを使ってください。

        char*   sv_pvbyten(SV *sv, STRLEN *len)
sv_pvn

複雑なマクロ式を扱えないコンパイラのための、SvPV マクロの プライベート実装です。 代わりに、常にマクロを使ってください。

        char*   sv_pvn(SV *sv, STRLEN *len)
sv_pvutf8

代わりに SvPVutf8_nolen マクロを使ってください。

        char*   sv_pvutf8(SV *sv)
sv_pvutf8n

複雑なマクロ式を扱えないコンパイラのための、SvPVutf8 マクロの プライベート実装です。 代わりに、常にマクロを使ってください。

        char*   sv_pvutf8n(SV *sv, STRLEN *len)
sv_taint

SV を汚染します。 代わりに SvTAINTED_on を使ってください。

        void    sv_taint(SV* sv)
sv_unref

SV の RV ステータスをアンセットし、RV によって参照されているものの 参照カウントを減じます。 これは newSVrv の反転したものであると考えられます。 これは、flag がゼロのときの sv_unref_flags です。 SvROK_off を参照してください。

        void    sv_unref(SV* sv)
sv_usepvn

SV に対して、ptr にある文字列を探し出すように指示します。 Implemented by calling sv_usepvn_flags with flags of 0, hence does not handle 'set' magic. sv_usepvn_mg を参照してください。

        void    sv_usepvn(SV* sv, char* ptr, STRLEN len)
sv_usepvn_mg

sv_usepvn に似ていますが、'set' magic をハンドルします。

        void    sv_usepvn_mg(SV *sv, char *ptr, STRLEN len)
sv_uv

複雑なマクロ式を扱えないコンパイラのための、SvUVx マクロの プライベート実装です。 代わりに、常にマクロを使ってください。

        UV      sv_uv(SV* sv)
unpack_str

Perl 関数 unpack() を実装しているエンジンです。 注意: 引数 strbeg, new_s, ocnt は使われません。 この呼び出しは使うべきではなりません; 代わりに unpackstring を使ってください。

        I32     unpack_str(const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags)


Functions in file pp_ctl.c

find_runcv

Locate the CV corresponding to the currently executing sub or eval. If db_seqp is non_null, skip CVs that are in the DB package and populate *db_seqp with the cop sequence number at the point that the DB:: code was entered. (allows debuggers to eval in the scope of the breakpoint rather than in the scope of the debugger itself). (TBT)

        CV*     find_runcv(U32 *db_seqp)


Functions in file pp_pack.c

packlist

Perl 関数 pack() を実装しているエンジンです。

        void    packlist(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist)
unpackstring

Perl 関数 unpack() を実装しているエンジンです。 unpackstring puts the extracted list items on the stack and returns the number of elements. Issue PUTBACK before and SPAGAIN after the call to this function. (TBT)

        I32     unpackstring(const char *pat, const char *patend, const char *s, const char *strend, U32 flags)


GV Functions

GvSV

GV から SV を返します。

        SV*     GvSV(GV* gv)
gv_const_sv

If gv is a typeglob whose subroutine entry is a constant sub eligible for inlining, or gv is a placeholder reference that would be promoted to such a typeglob, then returns the value returned by the sub. Otherwise, returns NULL. (TBT)

        SV*     gv_const_sv(GV* gv)
gv_fetchmeth

与えられた name と、定義されたサブルーチンか NULL を使った glob を返します。 このglobは、与えられた stash か、 @ISA や UNIVERSAL:: を通じてアクセスできるスタッシュにあります。

引数 level は 0 か -1 であるべきです。 level==0 の場合、副作用として(サブルーチンに対するエイリアスを 含むことに成功した場合に)与えられた stash にある name に対する glob を生成し、さらにこの glob に対するキャッシュ情報のセットアップを 行います。

この関数はスタッシュ名のポストフィックスとして、 トークン "SUPER" を受け付けます。 gv_fetchmeth から返された GV は、Perl プログラムからは参照することの できないような、メソッドキャッシュのエントリーである可能性が あります。 このため、perl_call_sv を呼び出したとき、GV を直接 使うべきではありません。 その代わりに、GV に対して GvCV マクロを使って得ることのできる、 メソッドの CV を使うべきなのです。

        GV*     gv_fetchmeth(HV* stash, const char* name, STRLEN len, I32 level)
gv_fetchmethod_autoload

stash にあるメソッドを起動するために呼び出すサブルーチンを含む glob を返します。 事実、オートローディングの直前でこれは "AUTOLOAD" に対する glob となる 可能性があります。 その場合、$AUTOLOAD に対応する変数が既にセットアップされています。

gv_fetchmethod_autoload の第三引数は、与えられたメソッドが 存在していなかった場合に AUTLOAD のルックアップをするかしないかを 決定します。 ゼロでないときは AUTOLOAD の検索を行い、ゼロのときには行いません。 gv_fetchmethod の呼び出しは gv_fetchmethod_autoload に ゼロでない autoload パラメーターを渡したときと等価です。

これらの関数は、トークン "SUPER" をメソッド名のプリフィックスとして 許します。 返された glob を長い間保存しておきたいのなら、"AUTOLOAD" の存在を チェックする必要があるということに注意してください。 これは、後での呼び出しが $AUTOALOD の値が変化したことによって、異なる サブルーチンをロードしてしまうかもしれないからです。

これらの関数は、gv_fetchmethlevel==0 を渡したときと同じ 副作用を持っています。 name は、その内容に ':''\'' が含まれている場合には書き込み 可能であるべきです。 gv_fetchmeth から返された GV を call_sv に渡したことに対する警告は、 これらの関数についても同じく適用されます。

        GV*     gv_fetchmethod_autoload(HV* stash, const char* name, I32 autoload)
gv_fetchmeth_autoload

Same as gv_fetchmeth(), but looks for autoloaded subroutines too. Returns a glob for the subroutine. (TBT)

For an autoloaded subroutine without a GV, will create a GV even if level < 0. For an autoloaded subroutine without a stub, GvCV() of the result may be zero. (TBT)

        GV*     gv_fetchmeth_autoload(HV* stash, const char* name, STRLEN len, I32 level)
gv_stashpv

指定されたパッケージに対するスタッシュへのポインタを返します。 name の長さを決定するために strlen を使い、それから gv_stashpvn() を呼び出します。

        HV*     gv_stashpv(const char* name, I32 flags)
gv_stashpvn

Returns a pointer to the stash for a specified package. The namelen parameter indicates the length of the name, in bytes. flags is passed to gv_fetchpvn_flags(), so if set to GV_ADD then the package will be created if it does not already exist. If the package does not exist and flags is 0 (or any other setting that does not create packages) then NULL is returned. (TBT)

        HV*     gv_stashpvn(const char* name, U32 namelen, I32 flags)
gv_stashpvs

gv_stashpvn と同様ですが、文字列/長さの組ではなく、リテラルな文字列を 取ります。

        HV*     gv_stashpvs(const char* name, I32 create)
gv_stashsv

指定したパッケージに対するスタッシュへのポインタを返します。 gv_stashpvn を参照してください。

        HV*     gv_stashsv(SV* sv, I32 flags)


Handy Values

Nullav

AVのナルポインタ。

Nullch

文字のナルポインタ。

Nullcv

CVのナルポインタ。

Nullhv

HVのナルポインタ。

Nullsv

SVのナルポインタ。


Hash Manipulation Functions

get_hv

指定された Perl ハッシュの HV を返します。 create がセットされていて、指定された変数が存在していなければ HV が生成されます。 create がセットされておらず、かつ、指定された変数がなかった場合には NULL が返されます。

注意: この関数の perl_ の形は非推奨です。

        HV*     get_hv(const char* name, I32 create)
HEf_SVKEY

このフラグは、ハッシュエントリーのlength slotや magic structures で使われ、char* ポインタであることを期待されている SV* ポインタを 含む構造体を指定します(情報のみ -- 使われません)。

HeHASH

ハッシュエントリーに格納されている計算済みハッシュを返します。

        U32     HeHASH(HE* he)
HeKEY

ハッシュエントリーのキー スロットにあるポインタを返します。 このポインタは char*SV* のいずれかで、これは HeKLEN() の 値に依存します。 これは代入することができます。 HePV()HeSVKEY() といったマクロはキーの値を検索するために、 通常望ましいものです。

        void*   HeKEY(HE* he)
HeKLEN

これが負であり、かつ HEf_SVKEY に等しければ、エントリーが SV* キーを 保持していることを示します。 そうでなければ、これはキーの実際の長さを保持しています。 これは代入することができます。 マクロ HePV() はキーの長さを検出するのに、通常望ましいものです。

        STRLEN  HeKLEN(HE* he)
HePV

char * としてのハッシュエントリーのキースロットを返し、SV* キーで必要となるような参照外しなどを行います。 文字列の長さは len に置かれます(これはマクロなので、&len を 使ってはいけません)。 キーの長さがどうなのかを気にしないのであれば、グローバル変数 PL_na を 使うことができますが、これはローカル変数を使うよりも非効率的です。 しかし忘れないで欲しいのは、そういった perl に おけるハッシュのキーは埋め込まれているナル文字に対して 自由であり、そのため strlen() などを使ってハッシュキーの長さを 調べるのは良い方法ではないということです。 これは他の場所で説明している SvPV() マクロについても同様です。

        char*   HePV(HE* he, STRLEN len)
HeSVKEY

SV* としてのキー、もしくはハッシュエントリーに SV* キーがない場合には NULL を返します。

        SV*     HeSVKEY(HE* he)
HeSVKEY_force

SV* としてのキーを返します。 ハッシュエントリーに char* キーしかない場合には、一時的な揮発性 SV* が生成されて返されます。

        SV*     HeSVKEY_force(HE* he)
HeSVKEY_set

与えられた SV* にキーをセットし、SV* キーの存在を表わす適切な フラグを注意深くセットします。 そして、同じ SV* を返します。

        SV*     HeSVKEY_set(HE* he, SV* sv)
HeVAL

ハッシュエントリーに格納されている(型 SV* の)値スロットを返します。

        SV*     HeVAL(HE* he)
HvNAME

スタッシュのパッケージ名を返します; stash がスタッシュでない場合は NULL を返します。 SvSTASH, CvSTASH を参照してください。

        char*   HvNAME(HV* stash)
hv_assert

ハッシュが内部的に一貫した状態であるかを調べます。

        void    hv_assert(HV* tb)
hv_clear

ハッシュをクリアーし、空にします。

        void    hv_clear(HV* tb)
hv_clear_placeholders

Clears any placeholders from a hash. If a restricted hash has any of its keys marked as readonly and the key is subsequently deleted, the key is not actually deleted but is marked by assigning it a value of &PL_sv_placeholder. This tags it so it will be ignored by future operations such as iterating over the hash, but will still allow the hash to have a value reassigned to the key at some future point. This function clears any such placeholder keys from the hash. See Hash::Util::lock_keys() for an example of its use. (TBT)

        void    hv_clear_placeholders(HV* hb)
hv_delete

ハッシュにあるキー/値のペアを削除します。 値 SV はハッシュから取り除かれて、呼び出し元に返されます。 klen はキーの長さです。 flags の値は通常はゼロとなります。 これに G_DISCARD をセットした場合には NULL が返されます。

        SV*     hv_delete(HV* tb, const char* key, I32 klen, I32 flags)
hv_delete_ent

ハッシュにあるキー/値のペアを削除します。 値 SVはハッシュから取り除かれて、呼び出し元に返されます。 klen はキーの長さです。 flags の値は通常はゼロとなります。 これに G_DISCARD をセットした場合には NULL が返されます。 hash はあらかじめ計算されたハッシュ値を置きますが、 計算結果を問い合わせるには 0 とします。

        SV*     hv_delete_ent(HV* tb, SV* key, I32 flags, U32 hash)
hv_exists

指定されたハッシュキーが存在するかどうかを表わすブール値を返します。 klen はキーの長さです。

        bool    hv_exists(HV* tb, const char* key, I32 klen)
hv_exists_ent

指定されたハッシュキーが存在するかどうかを表わすブール値を返します。 hash はあらかじめ計算されたハッシュ値を置きますが、計算結果を 問い合わせるには 0 とします。

        bool    hv_exists_ent(HV* tb, SV* key, U32 hash)
hv_fetch

指定されたキーに対応する、ハッシュ中の SV を返します。 klen はキーの長さです。 lval がセットされている場合、フェッチがストアの一部分となります。 戻り値 SV* の参照外しをする前に、それがナルでないことを チェックしてください。

この関数をどのように tie されたハッシュに使うかの情報は Understanding the Magic of Tied Hashes and Arrays in perlguts を 参照してください。

        SV**    hv_fetch(HV* tb, const char* key, I32 klen, I32 lval)
hv_fetchs

hv_fetch と同様ですが、文字列/長さの組ではなく、リテラルな文字列を 取ります。

        SV**    hv_fetchs(HV* tb, const char* key, I32 lval)
hv_fetch_ent

指定されたキーに対応する、ハッシュ中のハッシュエントリーを返します。 hash は、key に対する正当な計算済みハッシュ値でなければなりません。 もしくは、この関数にハッシュ値を計算させたいのであればここに 0 を置きます。 lval がセットされていると、フェッチはストアの一部分となります。 tb が tie されているハッシュの場合の戻り値は静的な 位置 (static location)へのポインタです。 したがって、何かを格納する必要があるのなら、その構造体のコピーを 取るようにしてください。

この関数をどのようにtieされたハッシュに使うかの情報は Understanding the Magic of Tied Hashes and Arrays in perlguts を 参照してください。

        HE*     hv_fetch_ent(HV* tb, SV* key, I32 lval, U32 hash)
hv_iterinit

ハッシュテーブルをたどるための開始点を準備します。 ハッシュの中に存在しているキーの数を返します(HvKEYS(tb) と同じです)。 この戻り値は現状では tie magic なしのハッシュに対してのみ意味があります。

注意: 5.004_65 より前のバージョンでは、hv_iterinit は 使用中のハッシュバケツの数を返すのに使われていました。 もしあなたがそのような値を必要としているのなら、HvFILL(tb) という マクロを使って得ることができます。

        I32     hv_iterinit(HV* tb)
hv_iterkey

ハッシュイテレーターの現在位置からキーを返します。 hv_iterinit を参照してください。

        char*   hv_iterkey(HE* entry, I32* retlen)
hv_iterkeysv

ハッシュイテレーターの現在位置から、SV* としてキーを返します。 この戻り値は常にキーの揮発性コピーとなります。 hv_iterinit を参照してください。

        SV*     hv_iterkeysv(HE* entry)
hv_iternext

ハッシュイテレーターからエントリーを返します。 hv_iterinit を参照してください。

You may call hv_delete or hv_delete_ent on the hash entry that the iterator currently points to, without losing your place or invalidating your iterator. Note that in this case the current entry is deleted from the hash with your iterator holding the last reference to it. Your iterator is flagged to free the entry on the next call to hv_iternext, so you must not discard your iterator immediately else the entry will leak - call hv_iternext to trigger the resource deallocation. (TBT)

        HE*     hv_iternext(HV* tb)
hv_iternextsv

一つの操作で hv_iternexthv_iterkeyhv_iterval を 呼び出します。

        SV*     hv_iternextsv(HV* hv, char** key, I32* retlen)
hv_iternext_flags

Returns entries from a hash iterator. See hv_iterinit and hv_iternext. The flags value will normally be zero; if HV_ITERNEXT_WANTPLACEHOLDERS is set the placeholders keys (for restricted hashes) will be returned in addition to normal keys. By default placeholders are automatically skipped over. Currently a placeholder is implemented with a value that is &Perl_sv_placeholder. Note that the implementation of placeholders and restricted hashes may change, and the implementation currently is insufficiently abstracted for any change to be tidy. (TBT)

注意: この関数は実験的で、予告なしに変更あるいは削除されるかもしれません。

        HE*     hv_iternext_flags(HV* tb, I32 flags)
hv_iterval

ハッシュイテレーターの現在位置から値を返します。 hv_iterkey を参照してください。

        SV*     hv_iterval(HV* tb, HE* entry)
hv_magic

ハッシュに magic を付加します。 sv_magic を参照してください。

        void    hv_magic(HV* hv, GV* gv, int how)
hv_scalar

ハッシュをスカラコンテキストで評価して、結果を返します。 ハッシュが tie された場合は magic を扱います。

        SV*     hv_scalar(HV* hv)
hv_store

ハッシュに SV を格納します。 そのハッシュキーは key で指定され、klen はキーの長さです。 hash パラメーターは、あらかじめ計算したハッシュ値です。 Perlにハッシュ値を計算させるにはこれを 0 にします。 戻り値は、操作が失敗したり(tie されているハッシュのように)ハッシュに 実際に値を格納する必要のない場合には NULL になります。 Effectively a successful hv_store takes ownership of one reference to val. This is usually what you want; a newly created SV has a reference count of one, so if all your code does is create SVs then store them in a hash, hv_store will own the only reference to the new SV, and your code doesn't need to do anything further to tidy up. hv_store is not implemented as a call to hv_store_ent, and does not create a temporary SV for the key, so if your key data is not already in SV form then use hv_store in preference to hv_store_ent. (TBT)

この関数を tie されているハッシュに使うやりかたについての詳細は Understanding the Magic of Tied Hashes and Arrays in perlguts を 参照してください。

        SV**    hv_store(HV* tb, const char* key, I32 klen, SV* val, U32 hash)
hv_stores

hv_store と同様ですが、文字列/長さの組ではなく、リテラルな文字列を 取り、ハッシュパラメータを除外します。

        SV**    hv_stores(HV* tb, const char* key, NULLOK SV* val)
hv_store_ent

val をハッシュに格納します。 ハッシュキーは key で指定します。 hash パラメーターはあらかじめ計算したハッシュ値です。 Perl にこれを計算させるにはこの値を 0 にします。 戻り値は生成された新しいハッシュエントリーです。 操作が失敗したり、(tie されているハッシュのように)ハッシュに実際に値を 格納する必要のない場合には NULL になります。 そうでない場合には、戻り値の内容に He? マクロを使ってアクセスすることが 可能です。 呼び出し側は、呼び出しの前に val の参照カウントを適切に インクリメントする責任があり、また、関数が NULL を 返した場合には参照カウントをデクリメントする責任があるということに 注意してください。 Effectively a successful hv_store_ent takes ownership of one reference to val. This is usually what you want; a newly created SV has a reference count of one, so if all your code does is create SVs then store them in a hash, hv_store will own the only reference to the new SV, and your code doesn't need to do anything further to tidy up. Note that hv_store_ent only reads the key; unlike val it does not take ownership of it, so maintaining the correct reference count on key is entirely the caller's responsibility. hv_store is not implemented as a call to hv_store_ent, and does not create a temporary SV for the key, so if your key data is not already in SV form then use hv_store in preference to hv_store_ent. (TBT)

この関数を tie されているハッシュに使うやりかたについての詳細は Understanding the Magic of Tied Hashes and Arrays in perlguts を 参照してください。

        HE*     hv_store_ent(HV* tb, SV* key, SV* val, U32 hash)
hv_undef

ハッシュを undefine します。

        void    hv_undef(HV* tb)
newHV

新たな HV を生成します。 参照カウントは 1 に設定されます。

        HV*     newHV()


Magical Functions

mg_clear

SV が表わしている magical をクリアーします。 sv_magic を参照してください。

        int     mg_clear(SV* sv)
mg_copy

ある SV から別の SV へ magic をコピーします。 sv_magic を参照してください。

        int     mg_copy(SV* sv, SV* nsv, const char* key, I32 klen)
mg_find

type にマッチする SV への magic ポインタを検索します。 sv_magic を参照してください。

        MAGIC*  mg_find(const SV* sv, int type)
mg_free

SV が使用しているすべての magic storage を解放します。 sv_magic を参照してください。

        int     mg_free(SV* sv)
mg_get

SV から値を取得した後で magic を行います。 sv_magic を参照してください。

        int     mg_get(SV* sv)
mg_length

SV の長さを報告します。 sv_magic を参照してください。

        U32     mg_length(SV* sv)
mg_magical

SV の magical status をオンにします。 sv_magic を参照してください。

        void    mg_magical(SV* sv)
mg_set

SV に値を代入した後で magic を行います。 sv_magic を参照してください。

        int     mg_set(SV* sv)
SvGETMAGIC

SV が 'get' magic を有している場合には mg_get を起動します。 このマクロはその引数を二回以上評価します。

        void    SvGETMAGIC(SV* sv)
SvLOCK

Arranges for a mutual exclusion lock to be obtained on sv if a suitable module has been loaded. (TBT)

        void    SvLOCK(SV* sv)
SvSETMAGIC

SV が 'set' magic を持っている場合に、その SV に対して mg_set を 起動します。 このマクロは二回以上引数を評価します。

        void    SvSETMAGIC(SV* sv)
SvSetMagicSV

Like SvSetSV, but does any set magic required afterwards. (TBT)

        void    SvSetMagicSV(SV* dsb, SV* ssv)
SvSetMagicSV_nosteal

Like SvSetSV_nosteal, but does any set magic required afterwards. (TBT)

        void    SvSetMagicSV_nosteal(SV* dsv, SV* ssv)
SvSetSV

dsv が ssv と等しくなかったときに sv_setsv を呼び出します。 引数は二回以上評価される可能性があります。

        void    SvSetSV(SV* dsb, SV* ssv)
SvSetSV_nosteal

dsv と ssv が等しくなかったときに呼び出される、非破壊的バージョンの sv_setsv を呼び出します。 引数は二回以上評価される可能性があります。

        void    SvSetSV_nosteal(SV* dsv, SV* ssv)
SvSHARE

Arranges for sv to be shared between threads if a suitable module has been loaded. (TBT)

        void    SvSHARE(SV* sv)
SvUNLOCK

Releases a mutual exclusion lock on sv if a suitable module has been loaded. (TBT)

        void    SvUNLOCK(SV* sv)


Memory Management

Copy

C の memcpy 関数に対する XSUB 作成者のためのインターフェースです。 src は転送元、destは転送先、nitems は転送するアイテムの数、 type は転送するアイテムの型です。 領域がオーバーラップしているコピーの場合は失敗します。 Move を参照してください。

        void    Copy(void* src, void* dest, int nitems, type)
CopyD

Copy と同様ですが、dest を返します。 末尾呼び出し最適化を行うコンパイラで便利です。

        void *  CopyD(void* src, void* dest, int nitems, type)
Move

C の memmove 関数に対する XSUB 作成者のためのインターフェースです。 src は転送元で、dest が転送先、nitems がアイテムの数、type が その型です。 オーバーラップした移動も可能です。 Copy を参照してください。

        void    Move(void* src, void* dest, int nitems, type)
MoveD

Move と同様ですが、dest を返します。 末尾呼び出し最適化を行うコンパイラで便利です。

        void *  MoveD(void* src, void* dest, int nitems, type)
Newx

C の malloc 関数に対する XSUB 作成者のためのキャスト付き インターフェースです。

In 5.9.3, Newx() and friends replace the older New() API, and drops the first parameter, x, a debug aid which allowed callers to identify themselves. This aid has been superseded by a new build option, PERL_MEM_LOG (see perlhack/PERL_MEM_LOG). The older API is still there for use in XS modules supporting older perls. (TBT)

        void    Newx(void* ptr, int nitems, type)
Newxc

C の malloc 関数に対する XSUB 作成者のためのキャスト付き インターフェースです。 Newx も参照してください。

        void    Newxc(void* ptr, int nitems, type, cast)
Newxz

XSUB 作成者のための malloc 関数のインターフェースです。 割り付けられた領域は memzero によってゼロで埋められます。 Newx も参照してください。

        void    Newxz(void* ptr, int nitems, type)
Poison

解放されたメモリへのアクセスを捕捉するための PoisonWith(0xEF) です。

        void    Poison(void* dest, int nitems, type)
PoisonFree

解放されたメモリへのアクセスを捕捉するための PoisonWith(0xEF) です。

        void    PoisonFree(void* dest, int nitems, type)
PoisonNew

PoisonWith(0xAB) for catching access to allocated but uninitialized memory. (TBT)

        void    PoisonNew(void* dest, int nitems, type)
PoisonWith

Fill up memory with a byte pattern (a byte repeated over and over again) that hopefully catches attempts to access uninitialized memory. (TBT)

        void    PoisonWith(void* dest, int nitems, type, U8 byte)
Renew

C の realloc 関数に対する XSUB 作成者のためのインターフェースです。

        void    Renew(void* ptr, int nitems, type)
Renewc

キャスト付きの、C の realloc 関数に対する XSUB 作成者のための インターフェースです。

        void    Renewc(void* ptr, int nitems, type, cast)
Safefree

C の free 関数に対する XSUB 作成者のためのインターフェースです。

        void    Safefree(void* ptr)
savepv

Perl's version of strdup(). Returns a pointer to a newly allocated string which is a duplicate of pv. The size of the string is determined by strlen(). The memory allocated for the new string can be freed with the Safefree() function. (TBT)

        char*   savepv(const char* pv)
savepvn

Perl's version of what strndup() would be if it existed. Returns a pointer to a newly allocated string which is a duplicate of the first len bytes from pv, plus a trailing NUL byte. The memory allocated for the new string can be freed with the Safefree() function. (TBT)

        char*   savepvn(const char* pv, I32 len)
savepvs

savepvn と同様ですが、文字列/長さの組ではなく、リテラルな文字列を 取ります。

        char*   savepvs(const char* s)
savesharedpv

A version of savepv() which allocates the duplicate string in memory which is shared between threads. (TBT)

        char*   savesharedpv(const char* pv)
savesharedpvn

A version of savepvn() which allocates the duplicate string in memory which is shared between threads. (With the specific difference that a NULL pointer is not acceptable) (TBT)

        char*   savesharedpvn(const char *const pv, const STRLEN len)
savesvpv

A version of savepv()/savepvn() which gets the string to duplicate from the passed in SV using SvPV() (TBT)

        char*   savesvpv(SV* sv)
StructCopy

これはある構造体をもう一つにコピーするためのアーキテクチャに依存しない マクロです。

        void    StructCopy(type src, type dest, type)
Zero

C の memzero 関数に対する XSUB 作成者のためのインターフェースです。 dest は対象となる場所、nitems はアイテムの数、type は アイテムの型です。

        void    Zero(void* dest, int nitems, type)
ZeroD

Zero と同様ですが、dest を返します。 末尾呼び出し最適化を行うコンパイラで便利です。

        void *  ZeroD(void* dest, int nitems, type)


Miscellaneous Functions

fbm_compile

Boyer-Moore アルゴリズムを使った fbm_instr() による高速検索が できるようにするために文字列を解析します。

        void    fbm_compile(SV* sv, U32 flags)
fbm_instr

strstrend によって区切られる文字列中にある SV の位置を返します。 文字列が見つからなかった場合には NULL を返します。 sv は fbm_compile されている必要はありませんが、その場合にはある場合に 比べると検索速度は遅くなります。

        char*   fbm_instr(unsigned char* big, unsigned char* bigend, SV* littlesv, U32 flags)
form

Takes a sprintf-style format pattern and conventional (non-SV) arguments and returns the formatted string. (TBT)

    (char *) Perl_form(pTHX_ const char* pat, ...)

は文字列 (char *) が必要なあらゆる場所で使えます:

    char * s = Perl_form("%d.%d",major,minor);

Uses a single private buffer so if you want to format several strings you must explicitly copy the earlier strings away (and free the copies when you are done). (TBT)

        char*   form(const char* pat, ...)
getcwd_sv

sv をカレントワーキングディレクトリで埋めます

        int     getcwd_sv(SV* sv)
my_snprintf

The C library snprintf functionality, if available and standards-compliant (uses vsnprintf, actually). However, if the vsnprintf is not available, will unfortunately use the unsafe vsprintf which can overrun the buffer (there is an overrun check, but that may be too late). Consider using sv_vcatpvf instead, or getting vsnprintf. (TBT)

        int     my_snprintf(char *buffer, const Size_t len, const char *format, ...)
my_sprintf

The C library sprintf, wrapped if necessary, to ensure that it will return the length of the string written to the buffer. Only rare pre-ANSI systems need the wrapper function - usually this is a direct call to sprintf. (TBT)

        int     my_sprintf(char *buffer, const char *pat, ...)
my_vsnprintf

The C library vsnprintf if available and standards-compliant. However, if if the vsnprintf is not available, will unfortunately use the unsafe vsprintf which can overrun the buffer (there is an overrun check, but that may be too late). Consider using sv_vcatpvf instead, or getting vsnprintf. (TBT)

        int     my_vsnprintf(char *buffer, const Size_t len, const char *format, va_list ap)
new_version

SV で渡されたものを基として新しいバージョンオブジェクトを返します:

    SV *sv = new_version(SV *ver);

Does not alter the passed in ver SV. See "upg_version" if you want to upgrade the SV. (TBT)

        SV*     new_version(SV *ver)
scan_version

Returns a pointer to the next character after the parsed version string, as well as upgrading the passed in SV to an RV. (TBT)

関数は以下のように、既に存在する SV と共に呼び出されなければなりません

    sv = newSV(0);
    s = scan_version(s, SV *sv, bool qv);

Performs some preprocessing to the string to ensure that it has the correct characteristics of a version. Flags the object if it contains an underscore (which denotes this is an alpha version). The boolean qv denotes that the version should be interpreted as if it had multiple decimals, even if it doesn't. (TBT)

        const char*     scan_version(const char *vstr, SV *sv, bool qv)
strEQ

二つの文字列が等しいかどうかを検査します。 真か偽を返します。

        bool    strEQ(char* s1, char* s2)
strGE

二つの文字列を、s1s2 よりも大きい、もしくは両者が等しいかどうかの 検査をします。 真か偽かの結果を返します。

        bool    strGE(char* s1, char* s2)
strGT

二つの文字列を、s1s2 よりも大きいかどうかの検査をします。 真か偽かの結果を返します。

        bool    strGT(char* s1, char* s2)
strLE

二つの文字列を、s1s2 よりも小さい、もしくは両者が等しいか どうかの検査をします。 真か偽かの結果を返します。

        bool    strLE(char* s1, char* s2)
strLT

二つの文字列を、s1s2 よりも小さいかどうかの検査をします。 真か偽かの結果を返します。

        bool    strLT(char* s1, char* s2)
strNE

二つの文字列が異なるかどうかを検査します。 真か偽を返します。

        bool    strNE(char* s1, char* s2)
strnEQ

二つの文字列が等しいかどうかを検査します。 パラメーター len は、比較を行うバイト数を指定します。 真か偽を返します。 (strncmp へのラッパーです)

        bool    strnEQ(char* s1, char* s2, STRLEN len)
strnNE

二つの文字列が異なるものかどうかを検査します。 パラメーター len は、比較を行うバイト数を指定します。 真か偽を返します。 (strncmp へのラッパーです)

        bool    strnNE(char* s1, char* s2, STRLEN len)
sv_destroyable

Dummy routine which reports that object can be destroyed when there is no sharing module present. It ignores its single SV argument, and returns 'true'. NULL 関数をテストして、あるレベルでの strict での潜在的な警告を 回避するために存在します。 (TBT)

        bool    sv_destroyable(SV *sv)
sv_nosharing

share モジュールがないときに SV を「share する」ダミールーチンです。 あるいは「ロックします」。 あるいは「アンロックします」。 言い換えると、単一の SV 引数を無視します。 NULL 関数をテストして、あるレベルでの strict での潜在的な警告を 回避するために存在します。

        void    sv_nosharing(SV *sv)
upg_version

In-place upgrade of the supplied SV to a version object. (TBT)

    SV *sv = upg_version(SV *sv, bool qv);

Returns a pointer to the upgraded SV. Set the boolean qv if you want to force this SV to be interpreted as an "extended" version. (TBT)

        SV*     upg_version(SV *ver, bool qv)
vcmp

Version object aware cmp. Both operands must already have been converted into version objects. (TBT)

        int     vcmp(SV *lvs, SV *rvs)
vnormal

Accepts a version object and returns the normalized string representation. Call like: (TBT)

    sv = vnormal(rv);

注意: オブジェクトを直接と、RV に含まれている SV のどちらでも渡せます。

        SV*     vnormal(SV *vs)
vnumify

Accepts a version object and returns the normalized floating point representation. Call like: (TBT)

    sv = vnumify(rv);

注意: オブジェクトを直接と、RV に含まれている SV のどちらでも渡せます。

        SV*     vnumify(SV *vs)
vstringify

In order to maintain maximum compatibility with earlier versions of Perl, this function will return either the floating point notation or the multiple dotted notation, depending on whether the original version contained 1 or more dots, respectively (TBT)

        SV*     vstringify(SV *vs)
vverify

SV が正当なバージョンオブジェクトを含んでいるかを検証します。

    bool vverify(SV *vobj);

Note that it only confirms the bare minimum structure (so as not to get confused by derived classes which may contain additional hash entries): (TBT)

        bool    vverify(SV *vs)


MRO Functions

mro_get_linear_isa

Returns either mro_get_linear_isa_c3 or mro_get_linear_isa_dfs for the given stash, dependant upon which MRO is in effect for that stash. The return value is a read-only AV*. (TBT)

You are responsible for SvREFCNT_inc() on the return value if you plan to store it anywhere semi-permanently (otherwise it might be deleted out from under you the next time the cache is invalidated). (TBT)

        AV*     mro_get_linear_isa(HV* stash)
mro_method_changed_in

Invalidates method caching on any child classes of the given stash, so that they might notice the changes in this one. (TBT)

Ideally, all instances of PL_sub_generation++ in perl source outside of mro.c should be replaced by calls to this. (TBT)

Perl automatically handles most of the common ways a method might be redefined. However, there are a few ways you could change a method in a stash without the cache code noticing, in which case you need to call this method afterwards: (TBT)

1) Directly manipulating the stash HV entries from XS code. (TBT)

2) Assigning a reference to a readonly scalar constant into a stash entry in order to create a constant subroutine (like constant.pm does). (TBT)

This same method is available from pure perl via, mro::method_changed_in(classname). (TBT)

        void    mro_method_changed_in(HV* stash)


Multicall Functions

dMULTICALL

多重呼び出しのための局所変数を宣言します。 Lightweight Callbacks in perlcall を参照してください。

                dMULTICALL;
MULTICALL

軽量コールバックを作ります。 Lightweight Callbacks in perlcall を参照してください。

                MULTICALL;
POP_MULTICALL

軽量コールバックのための大かっこを閉じます。 Lightweight Callbacks in perlcall を参照してください。

                POP_MULTICALL;
PUSH_MULTICALL

軽量コールバックのための大かっこを開きます。 Lightweight Callbacks in perlcall を参照してください。

                PUSH_MULTICALL;


Numeric functions

grok_bin

2 進数を表現した文字列を数値形式に変換します。

On entry start and *len give the string to scan, *flags gives conversion flags, and result should be NULL or a pointer to an NV. The scan stops at the end of the string, or the first invalid character. Unless PERL_SCAN_SILENT_ILLDIGIT is set in *flags, encountering an invalid character will also trigger a warning. On return *len is set to the length of the scanned string, and *flags gives output flags. (TBT)

If the value is <= UV_MAX it is returned as a UV, the output flags are clear, and nothing is written to *result. If the value is > UV_MAX grok_bin returns UV_MAX, sets PERL_SCAN_GREATER_THAN_UV_MAX in the output flags, and writes the value to *result (or the value is discarded if result is NULL). (TBT)

The binary number may optionally be prefixed with "0b" or "b" unless PERL_SCAN_DISALLOW_PREFIX is set in *flags on entry. If PERL_SCAN_ALLOW_UNDERSCORES is set in *flags then the binary number may use '_' characters to separate digits. (TBT)

        UV      grok_bin(const char* start, STRLEN* len_p, I32* flags, NV *result)
grok_hex

16 進数を表現した文字列を数値形式に変換します。

On entry start and *len give the string to scan, *flags gives conversion flags, and result should be NULL or a pointer to an NV. The scan stops at the end of the string, or the first invalid character. Unless PERL_SCAN_SILENT_ILLDIGIT is set in *flags, encountering an invalid character will also trigger a warning. On return *len is set to the length of the scanned string, and *flags gives output flags. (TBT)

If the value is <= UV_MAX it is returned as a UV, the output flags are clear, and nothing is written to *result. If the value is > UV_MAX grok_hex returns UV_MAX, sets PERL_SCAN_GREATER_THAN_UV_MAX in the output flags, and writes the value to *result (or the value is discarded if result is NULL). (TBT)

The hex number may optionally be prefixed with "0x" or "x" unless PERL_SCAN_DISALLOW_PREFIX is set in *flags on entry. If PERL_SCAN_ALLOW_UNDERSCORES is set in *flags then the hex number may use '_' characters to separate digits. (TBT)

        UV      grok_hex(const char* start, STRLEN* len_p, I32* flags, NV *result)
grok_number

Recognise (or not) a number. The type of the number is returned (0 if unrecognised), otherwise it is a bit-ORed combination of IS_NUMBER_IN_UV, IS_NUMBER_GREATER_THAN_UV_MAX, IS_NUMBER_NOT_INT, IS_NUMBER_NEG, IS_NUMBER_INFINITY, IS_NUMBER_NAN (defined in perl.h). (TBT)

If the value of the number can fit an in UV, it is returned in the *valuep IS_NUMBER_IN_UV will be set to indicate that *valuep is valid, IS_NUMBER_IN_UV will never be set unless *valuep is valid, but *valuep may have been assigned to during processing even though IS_NUMBER_IN_UV is not set on return. If valuep is NULL, IS_NUMBER_IN_UV will be set for the same cases as when valuep is non-NULL, but no actual assignment (or SEGV) will occur. (TBT)

IS_NUMBER_NOT_INT will be set with IS_NUMBER_IN_UV if trailing decimals were seen (in which case *valuep gives the true value truncated to an integer), and IS_NUMBER_NEG if the number is negative (in which case *valuep holds the absolute value). IS_NUMBER_IN_UV is not set if e notation was used or the number is larger than a UV. (TBT)

        int     grok_number(const char *pv, STRLEN len, UV *valuep)
grok_numeric_radix

小数点をスキャンして、読み飛ばします。

        bool    grok_numeric_radix(const char **sp, const char *send)
grok_oct

8 進数を表現した文字列を数値形式に変換します。

On entry start and *len give the string to scan, *flags gives conversion flags, and result should be NULL or a pointer to an NV. The scan stops at the end of the string, or the first invalid character. Unless PERL_SCAN_SILENT_ILLDIGIT is set in *flags, encountering an invalid character will also trigger a warning. On return *len is set to the length of the scanned string, and *flags gives output flags. (TBT)

If the value is <= UV_MAX it is returned as a UV, the output flags are clear, and nothing is written to *result. If the value is > UV_MAX grok_oct returns UV_MAX, sets PERL_SCAN_GREATER_THAN_UV_MAX in the output flags, and writes the value to *result (or the value is discarded if result is NULL). (TBT)

If PERL_SCAN_ALLOW_UNDERSCORES is set in *flags then the octal number may use '_' characters to separate digits. (TBT)

        UV      grok_oct(const char* start, STRLEN* len_p, I32* flags, NV *result)
Perl_signbit

もし NV の符号ビットがセットされていれば非 0 の整数を、そうでなければ 0 を返します。

If Configure detects this system has a signbit() that will work with our NVs, then we just use it via the #define in perl.h. Otherwise, fall back on this implementation. As a first pass, this gets everything right except -0.0. Alas, catching -0.0 is the main use for this function, so this is not too helpful yet. Still, at least we have the scaffolding in place to support other systems, should that prove useful. (TBT)

Configure notes: This function is called 'Perl_signbit' instead of a plain 'signbit' because it is easy to imagine a system having a signbit() function or macro that doesn't happen to work with our particular choice of NVs. We shouldn't just re-#define signbit as Perl_signbit and expect the standard system headers to be happy. Also, this is a no-context function (no pTHX_) because Perl_signbit() is usually re-#defined in perl.h as a simple macro call to the system's signbit(). Users should just always call Perl_signbit(). (TBT)

注意: この関数は実験的で、予告なしに変更あるいは削除されるかもしれません。

        int     Perl_signbit(NV f)
scan_bin

後方互換性のために、代わりに grok_bin を使ってください。

        NV      scan_bin(const char* start, STRLEN len, STRLEN* retlen)
scan_hex

後方互換性のために、代わりに grok_hex を使ってください。

        NV      scan_hex(const char* start, STRLEN len, STRLEN* retlen)
scan_oct

後方互換性のために、代わりに grok_oct を使ってください。

        NV      scan_oct(const char* start, STRLEN len, STRLEN* retlen)


Optree Manipulation Functions

cv_const_sv

If cv is a constant sub eligible for inlining. returns the constant value returned by the sub. Otherwise, returns NULL. (TBT)

Constant subs can be created with newCONSTSUB or as described in Constant Functions in perlsub. (TBT)

        SV*     cv_const_sv(CV* cv)
newCONSTSUB

Perl での sub FOO () { 123 } と等価な定数サブルーチンを生成します。

        CV*     newCONSTSUB(HV* stash, const char* name, SV* sv)
newXS

Perl サブルーチンのように XSUB をフックするために xsubpp が使います。 filename は静的なストレージである必要があります; なぜならこれはコピーされることなく直接 CvFILE() で使われるからです。


Pad Data Structures

pad_sv

Get the value at offset po in the current pad. Use macro PAD_SV instead of calling this function directly. (TBT)

        SV*     pad_sv(PADOFFSET po)


Per-Interpreter Variables

PL_modglobal

PL_modglobal は、汎用の、インタプリタグローバルのHVで、 インタプリタ毎の情報を保持するような エクステンションによって使われるものです。 場合によっては、データの共有をおこなうために エクステンションのシンボルテーブルとして使うことも可能です。 エクステンションのパッケージ名を、エクステンション固有のデータの 名前のプリフィックスとして使うのは良い考えです。

        HV*     PL_modglobal
PL_na

文字列の長さについて考慮しないような場合の SvPV と共に使われるような 変数です。 通常はローカル変数を宣言してそれを使うか、 SvPV_nolen マクロを使った方が効率が良いです。

        STRLEN  PL_na
PL_sv_no

これは false の SV です。 PL_sv_yes を参照してください。 常に &PL_sv_no として参照してください。

        SV      PL_sv_no
PL_sv_undef

これは undef SV です。 常に &PL_sv_undef として参照してください。

        SV      PL_sv_undef
PL_sv_yes

これは true SV です。 PL_sv_no を参照してくさい。 これは常に &PL_sv_yes として参照してください。

        SV      PL_sv_yes


REGEXP Functions

SvRX

Convenience macro to get the REGEXP from a SV. This is approximately equivalent to the following snippet: (TBT)

    if (SvMAGICAL(sv))
        mg_get(sv);
    if (SvROK(sv) &&
        (tmpsv = (SV*)SvRV(sv)) &&
        SvTYPE(tmpsv) == SVt_PVMG &&
        (tmpmg = mg_find(tmpsv, PERL_MAGIC_qr)))
    {
        return (REGEXP *)tmpmg->mg_obj;
    }

もし REGEXP* が見つからなければ NULL を返します。

        REGEXP *        SvRX(SV *sv)
SvRXOK

Returns a boolean indicating whether the SV contains qr magic (PERL_MAGIC_qr). (TBT)

If you want to do something with the REGEXP* later use SvRX instead and check for NULL. (TBT)

        bool    SvRXOK(SV* sv)


Simple Exception Handling Macros

dXCPT

Set up necessary local variables for exception handling. See Exception Handling in perlguts. (TBT)

                dXCPT;
XCPT_CATCH

catch ブロックを導入します。 Exception Handling in perlguts を参照してください。

XCPT_RETHROW

以前に捕捉した例外を再 throw します。 Exception Handling in perlguts を参照してください。

                XCPT_RETHROW;
XCPT_TRY_END

try ブロックを終了します。 Exception Handling in perlguts を参照してください。

XCPT_TRY_START

try ブロックを開始します。 Exception Handling in perlguts を参照してください。


Stack Manipulation Macros

dMARK

スタックマーカー変数 mark を XSUB のために宣言します。 MARKdORIGMARK を参照してください。

                dMARK;
dORIGMARK

XSUB のためのオリジナルのスタックマークを保存します。 ORIGMARK を参照してください。

                dORIGMARK;
dSP

XSUB のためのスタックポインタのローカルなコピーを宣言します。 このコピーにはマクロ SP を使ってアクセス可能です。 SP を参照してください。

                dSP;
EXTEND

XSUB の戻り値のために引数スタックを拡張するのに使われます。 Once used, guarantees that there is room for at least nitems to be pushed onto the stack. (TBT)

        void    EXTEND(SP, int nitems)
MARK

XSUB に対するスタックマーカーの変数です。 dMARK を参照してください。

mPUSHi

Push an integer onto the stack. The stack must have room for this element. 'set' magic をハンドルします。 Does not use TARG. See also PUSHi, mXPUSHi and XPUSHi. (TBT)

        void    mPUSHi(IV iv)
mPUSHn

Push a double onto the stack. The stack must have room for this element. 'set' magic をハンドルします。 Does not use TARG. See also PUSHn, mXPUSHn and XPUSHn. (TBT)

        void    mPUSHn(NV nv)
mPUSHp

Push a string onto the stack. The stack must have room for this element. The len indicates the length of the string. 'set' magic をハンドルします。 Does not use TARG. See also PUSHp, mXPUSHp and XPUSHp. (TBT)

        void    mPUSHp(char* str, STRLEN len)
mPUSHu

Push an unsigned integer onto the stack. The stack must have room for this element. 'set' magic をハンドルします。 Does not use TARG. See also PUSHu, mXPUSHu and XPUSHu. (TBT)

        void    mPUSHu(UV uv)
mXPUSHi

Push an integer onto the stack, extending the stack if necessary. Handles 'set' magic. Does not use TARG. See also XPUSHi, mPUSHi and PUSHi. (TBT)

        void    mXPUSHi(IV iv)
mXPUSHn

Push a double onto the stack, extending the stack if necessary. Handles 'set' magic. Does not use TARG. See also XPUSHn, mPUSHn and PUSHn. (TBT)

        void    mXPUSHn(NV nv)
mXPUSHp

Push a string onto the stack, extending the stack if necessary. The len indicates the length of the string. 'set' magic をハンドルします。 Does not use TARG. See also XPUSHp, mPUSHp and PUSHp. (TBT)

        void    mXPUSHp(char* str, STRLEN len)
mXPUSHu

Push an unsigned integer onto the stack, extending the stack if necessary. 'set' magic をハンドルします。 Does not use TARG. See also XPUSHu, mPUSHu and PUSHu. (TBT)

        void    mXPUSHu(UV uv)
ORIGMARK

XSUB のためのオリジナルスタックマークです。 dORIGMARK を参照してください。

POPi

スタックから整数をポップします。

        IV      POPi
POPl

スタックから long をポップします。

        long    POPl
POPn

スタックから倍精度実数をポップします。

        NV      POPn
POPp

スタックから文字列をポップします。 非推奨です。 新しいコードは POPpx を使うべきです。

        char*   POPp
POPpbytex

バイト列で構成されていなければならない(つまり文字 < 256 な)文字列を スタックからポップします。

        char*   POPpbytex
POPpx

スタックから文字列をポップします。

        char*   POPpx
POPs

スタックから SV をポップします。

        SV*     POPs
PUSHi

整数をスタックへプッシュします。 スタックは、プッシュする要素を収めるのに十分な大きさを 持っていなければなりません。 'set' magic をハンドルします。 Uses TARG, so dTARGET or dXSTARG should be called to declare it. Do not call multiple TARG-oriented macros to return lists from XSUB's - see mPUSHi instead. XPUSHimXPUSHi も参照してください。 (TBT)

        void    PUSHi(IV iv)
PUSHMARK

コールバックにある引数のためのブラケットを開きます。 PUTBACKperlcall を参照してください。

        void    PUSHMARK(SP)
PUSHmortal

新しい mortal SV をスタックへプッシュします。 The stack must have room for this element. Does not handle 'set' magic. Does not use TARG. See also PUSHs, XPUSHmortal and XPUSHs. (TBT)

        void    PUSHmortal()
PUSHn

倍精度実数をスタックへプッシュします。 スタックは、プッシュする要素を収めるのに十分な大きさを 持っていなければなりません。 'set' magic をハンドルします。 Uses TARG, so dTARGET or dXSTARG should be called to declare it. Do not call multiple TARG-oriented macros to return lists from XSUB's - see mPUSHn instead. XPUSHnmXPUSHn も参照してください。

        void    PUSHn(NV nv)
PUSHp

文字列をスタックへとプッシュします。 スタックは、プッシュする要素を収めるのに十分な大きさを 持っていなければなりません。 len は文字列の長さを表わします。 'set' magicをハンドルします。 Uses TARG, so dTARGET or dXSTARG should be called to declare it. Do not call multiple TARG-oriented macros to return lists from XSUB's - see mPUSHp instead. XPUSHpmXPUSHp も参照してください。

        void    PUSHp(char* str, STRLEN len)
PUSHs

SV をスタックへプッシュします。 スタックは、プッシュする要素を収めるのに十分な大きさを 持っていなければなりません。 'set' magic をハンドルしません。 TARG を使いません。 PUSHmortal, XPUSHs, XPUSHmortal も参照してください。

        void    PUSHs(SV* sv)
PUSHu

スタックに符号なし整数をプッシュします。 スタックにはこの要素を収めるだけの空きがなければなりません。 'set' magic をハンドルします。 Uses TARG, so dTARGET or dXSTARG should be called to declare it. Do not call multiple TARG-oriented macros to return lists from XSUB's - see mPUSHu instead. See also XPUSHu and mXPUSHu. (TBT)

        void    PUSHu(UV uv)
PUTBACK

XSUB 引数のためのブラケットを閉じます。 これは通常、xsubpp によって扱われます。 他の使い方については PUSHMARKperlcall を参照してください。

                PUTBACK;
SP

スタックポインタです。 これは通常、xsubpp によって扱われます。 dSPSPAGAIN を参照してください。

SPAGAIN

スタックポインタの再フェッチします。 コールバックの後で使われます。 perlcall を参照してください。

                SPAGAIN;
XPUSHi

整数値をスタックにプッシュし、必要があればスタックの拡張を 行います。 PUSHi を参照。 'set' magic をハンドルします。 Uses TARG, so dTARGET or dXSTARG should be called to declare it. Do not call multiple TARG-oriented macros to return lists from XSUB's - see mXPUSHi instead. See also PUSHi and mPUSHi. (TBT)

        void    XPUSHi(IV iv)
XPUSHmortal

Push a new mortal SV onto the stack, extending the stack if necessary. Does not handle 'set' magic. Does not use TARG. See also XPUSHs, PUSHmortal and PUSHs. (TBT)

        void    XPUSHmortal()
XPUSHn

倍精度数値をスタックにプッシュし、必要があればスタックの拡張を 行います。 'set' magic をハンドルします。 Uses TARG, so dTARGET or dXSTARG should be called to declare it. Do not call multiple TARG-oriented macros to return lists from XSUB's - see mXPUSHn instead. See also PUSHn and mPUSHn. (TBT)

        void    XPUSHn(NV nv)
XPUSHp

文字列をスタックにプッシュし、必要があればスタックの拡張を行います。 len はプッシュする文字列の長さを示します。 'set' magic をハンドルします。 Uses TARG, so dTARGET or dXSTARG should be called to declare it. Do not call multiple TARG-oriented macros to return lists from XSUB's - see mXPUSHp instead. See also PUSHp and mPUSHp. (TBT)

        void    XPUSHp(char* str, STRLEN len)
XPUSHs

SV をスタックにプッシュし、必要があればスタックを拡張します。 'set' magic をハンドルしません。 Does not use TARG. See also XPUSHmortal, PUSHs and PUSHmortal. (TBT)

        void    XPUSHs(SV* sv)
XPUSHu

スタックに符号なし整数をプッシュします。 必要があればスタックを拡張します。 'set' magic をハンドルします。 Uses TARG, so dTARGET or dXSTARG should be called to declare it. Do not call multiple TARG-oriented macros to return lists from XSUB's - see mXPUSHu instead. See also PUSHu and mPUSHu. (TBT)

        void    XPUSHu(UV uv)
XSRETURN

XSUB から戻され、スタックにあるアイテムの数を示します。 これは通常 xsubpp によって扱われます。

        void    XSRETURN(int nitems)
XSRETURN_EMPTY

XSUB から即座に空リストを返します。

                XSRETURN_EMPTY;
XSRETURN_IV

XSUB から即座に整数値を返します。 XST_mIV を使います。

        void    XSRETURN_IV(IV iv)
XSRETURN_NO

XSUB から即座に &PL_sv_no を返します。 XST_mNO を使います。

                XSRETURN_NO;
XSRETURN_NV

XSUB から即座に倍精度数値を返します。 XST_mNV を使います。

        void    XSRETURN_NV(NV nv)
XSRETURN_PV

XSUB から即座に文字列のコピーを返します。 XST_mPV を使います。

        void    XSRETURN_PV(char* str)
XSRETURN_UNDEF

XSUB から即座に &PL_sv_undef を返します。 XST_mUNDEF を使います。

                XSRETURN_UNDEF;
XSRETURN_UV

XSUB から即座に整数を返します。 XST_mUV を使います。

        void    XSRETURN_UV(IV uv)
XSRETURN_YES

XSUB から即座に &PL_sv_yes を返します。 XST_mYES を使います。

                XSRETURN_YES;
XST_mIV

整数値をスタックの pos で指定される場所に置きます。 その値は新しい揮発性 SV (mortal SV) に格納されます。

        void    XST_mIV(int pos, IV iv)
XST_mNO

&PL_sv_no をスタックの pos で指定される場所に置きます。

        void    XST_mNO(int pos)
XST_mNV

倍精度数値をスタックの pos で指定される場所に置きます。 その値は新しい揮発性 SV (mortal SV) に格納されます。

        void    XST_mNV(int pos, NV nv)
XST_mPV

文字列のコピーをスタックの pos で指定される場所に置きます。 その値は新しい揮発性 SV (mortal SV) に格納されます。

        void    XST_mPV(int pos, char* str)
XST_mUNDEF

&PL_sv_undef をスタックの pos で指定される場所に置きます。

        void    XST_mUNDEF(int pos)
XST_mYES

&PL_sv_yes をスタックの pos で指定される場所に置きます。

        void    XST_mYES(int pos)


SV Flags

svtype

Perl の型のためのフラグの列挙で、sv.h というファイル中の svtype という列挙にあります。 これらのフラグは、SvTYPE というマクロを使って検査を行います。

SVt_IV

スカラに対する整数型。 svtype を参照のこと。

SVt_NV

スカラに対する倍精度の型フラグ。 svtype を参照のこと。

SVt_PV

スカラに対するポインタ型。 svtype を参照のこと。

SVt_PVAV

配列に対する型フラグ。 svtype を参照のこと。

SVt_PVCV

コードリファレンスのための型フラグ。 svtype を参照のこと。

SVt_PVHV

ハッシュに対する型フラグ。 svtype を参照のこと。

SVt_PVMG

blessされたスカラに対する型フラグ。 svtype を参照のこと。


SV Manipulation Functions

get_sv

指定された Perl スカラの SV を返します。 create がセットされていて、指定された変数が存在していなければ SV が生成されます。 create がセットされておらず、かつ、指定された変数がなかった場合には NULL が返されます。

注意: この関数の perl_ の形は非推奨です。

        SV*     get_sv(const char* name, I32 create)
newRV_inc

SV に対する RV ラッパーを生成します。 元の SV の参照カウントはインクリメントされます。

        SV*     newRV_inc(SV* sv)
SvCUR

SV にある文字列の長さを返します。 SvLEN を参照してください。

        STRLEN  SvCUR(SV* sv)
SvCUR_set

SV にある文字列の現在の長さを設定します。 SvCUR を参照してください。

        void    SvCUR_set(SV* sv, STRLEN len)
SvEND

SV にある文字列の終端のキャラクタへのポインタを返します。 SvCUR を参照してください。 文字へは *(SvEND(sv)) としてアクセスします。

        char*   SvEND(SV* sv)
SvGAMAGIC

Returns true if the SV has get magic or overloading. If either is true then the scalar is active data, and has the potential to return a new value every time it is accessed. Hence you must be careful to only read it once per user logical operation and work with that returned value. If neither is true then the scalar's value cannot change unless written to. (TBT)

        char*   SvGAMAGIC(SV* sv)
SvGROW

指定されたバイト数だけの空間があるように SVにある文字バッファを拡張します (予約分の空間は NUL 文字で埋められることを思い出してください)。 必要であれば、拡張のために sv_grow を呼び出します。 文字バッファへのポインタを返します。

        char *  SvGROW(SV* sv, STRLEN len)
SvIOK

SV が整数を含んでいるかどうかを表わす U32 値を返します。

        U32     SvIOK(SV* sv)
SvIOKp

SV が整数を含んでいるかどうかを表わす U32 値を返します。 SvIOK を使い、private な設定を検査します。

        U32     SvIOKp(SV* sv)
SvIOK_notUV

SV が符号付き整数を含んでいるかどうかを示す真偽値を返します。

        bool    SvIOK_notUV(SV* sv)
SvIOK_off

SV の IV ステータスをアンセットします。

        void    SvIOK_off(SV* sv)
SvIOK_on

SV に対し、その SV が整数であるように指示します。

        void    SvIOK_on(SV* sv)
SvIOK_only

SV に対し、その SV が整数であり、他の OK ビットをすべてディセーブルに するように指示します。

        void    SvIOK_only(SV* sv)
SvIOK_only_UV

Tells and SV that it is an unsigned integer and disables all other OK bits. (TBT)

        void    SvIOK_only_UV(SV* sv)
SvIOK_UV

SV が符号なし整数を含んでいるかどうかを示す真偽値を返します。

        bool    SvIOK_UV(SV* sv)
SvIsCOW

Returns a boolean indicating whether the SV is Copy-On-Write. (either shared hash key scalars, or full Copy On Write scalars if 5.9.0 is configured for COW) (TBT)

        bool    SvIsCOW(SV* sv)
SvIsCOW_shared_hash

SV が Copy-On-Write 共有ハッシュキースカラかどうかを示す真偽値を返します。

        bool    SvIsCOW_shared_hash(SV* sv)
SvIV

与えられた SV を強制的に整数に変換し、それを返します。 See SvIVx for a version which guarantees to evaluate sv only once. (TBT)

        IV      SvIV(SV* sv)
SvIVX
        IV      SvIVX(SV* sv)
SvIVx

Coerces the given SV to an integer and returns it. Guarantees to evaluate sv only once. Only use this if sv is an expression with side effects, otherwise use the more efficient SvIV. (TBT)

        IV      SvIVx(SV* sv)
SvIV_nomg

SvIV と同様ですが、magic を処理しません。

        IV      SvIV_nomg(SV* sv)
SvIV_set

Set the value of the IV pointer in sv to val. It is possible to perform the same function of this macro with an lvalue assignment to SvIVX. With future Perls, however, it will be more efficient to use SvIV_set instead of the lvalue assignment to SvIVX. (TBT)

        void    SvIV_set(SV* sv, IV val)
SvLEN

SV にある文字列バッファのサイズ(not including any part attributable to SvOOK) を返します。 SvCUR を参照してください。 (TBT)

        STRLEN  SvLEN(SV* sv)
SvLEN_set

Set the actual length of the string which is in the SV. See SvIV_set. (TBT)

        void    SvLEN_set(SV* sv, STRLEN len)
SvMAGIC_set

sv の MAGIC ポインタの値を val にセットします。 SvIV_set を参照してください。

        void    SvMAGIC_set(SV* sv, MAGIC* val)
SvNIOK

SV が数値、つまり整数値か倍精度実数値を含んでいるかどうかを表わす U32 値を返します。

        U32     SvNIOK(SV* sv)
SvNIOKp

SV が倍精度実数値を含んでいるかどうかを示す U32 値を返します。 SvNIOK を使い、private な設定を検査します。

        U32     SvNIOKp(SV* sv)
SvNIOK_off

SV の NT/IV ステータスをアンセットします。

        void    SvNIOK_off(SV* sv)
SvNOK

SV が倍精度実数値を含んでいるかどうかを示す U32 値を返します。

        U32     SvNOK(SV* sv)
SvNOKp

SV が倍精度実数値を含んでいるかどうかを示す U32 値を返します。 SvNOK を使い、private な設定を検査します。

        U32     SvNOKp(SV* sv)
SvNOK_off

SV にある NT ステータスをアンセットします。

        void    SvNOK_off(SV* sv)
SvNOK_on

SV に対して、自分が倍精度実数であることを指示します。

        void    SvNOK_on(SV* sv)
SvNOK_only

SV に対して、自分が倍精度実数でありその他の OK フラグを ディセーブルにするよう指示します。

        void    SvNOK_only(SV* sv)
SvNV

SV を強制的に倍精度数値に変換し、それを返します。 See SvNVx for a version which guarantees to evaluate sv only once. (TBT)

        NV      SvNV(SV* sv)
SvNVX

Returns the raw value in the SV's NV slot, without checks or conversions. Only use when you are sure SvNOK is true. See also SvNV(). (TBT)

        NV      SvNVX(SV* sv)
SvNVx

Coerces the given SV to a double and returns it. Guarantees to evaluate sv only once. Only use this if sv is an expression with side effects, otherwise use the more efficient SvNV. (TBT)

        NV      SvNVx(SV* sv)
SvNV_set

sv の NV ポインタの値を val にセットします。 SvIV_set を参照してください。

        void    SvNV_set(SV* sv, NV val)
SvOK

値が SV であるかどうかを示す U32 値を返します。 これはまた、値が定義されているかどうかも知らせます。

        U32     SvOK(SV* sv)
SvOOK

SvIVX が SvPVX に対する正しいオフセット値であるかどうかを示す U32 値を返します。 この hack は SvPV の先頭から文字を 取り除くスピードを向上するために内部的に使われます。 SvOOK が真であるとき、割り当てられた文字列バッファの開始点は (SvPVX - SvIVX)となります。

        U32     SvOOK(SV* sv)
SvPOK

SV が文字文字列を保持しているかどうかの U32 値を返します。

        U32     SvPOK(SV* sv)
SvPOKp

SV が文字文字列を保持しているかどうかの U32 値を返します。 private セッティングをチェックし、SvPOK を使います。

        U32     SvPOKp(SV* sv)
SvPOK_off

SV の PV ステータスをアンセットします。

        void    SvPOK_off(SV* sv)
SvPOK_on

SV に対して、自分が文字列であることを指示します。

        void    SvPOK_on(SV* sv)
SvPOK_only

SV に対して、自分が文字列であるということを指示し、 他の OK ビットをすべてディセーブルにするように指示します。

        void    SvPOK_only(SV* sv)
SvPOK_only_UTF8

Tells an SV that it is a string and disables all other OK bits, and leaves the UTF-8 status as it was. (TBT)

        void    SvPOK_only_UTF8(SV* sv)
SvPV

SV にある文字列へのポインタか、SVが文字列を保持していない場合には SV の stringfield form を返します。 The SV may cache the stringified version becoming SvPOK. “get”magic をハンドルします。 See also SvPVx for a version which guarantees to evaluate sv only once. (TBT)

        char*   SvPV(SV* sv, STRLEN len)
SvPVbyte

SvPV と同様ですが、もし必要ならまず sv をバイト表現に変換します。

        char*   SvPVbyte(SV* sv, STRLEN len)
SvPVbytex

SvPV と同様ですが、もし必要ならまず sv をバイト表現に変換します。 sv を 1 度だけ評価することを保証します; さもなければより効率のよい SvPVbyte を使ってください。

        char*   SvPVbytex(SV* sv, STRLEN len)
SvPVbytex_force

SvPV_force と同様ですが、もし必要ならまず sv をバイト表現に変換します。 sv を 1 度だけ評価することを保証します; さもなければより効率のよい SvPVbyte_force を使ってください。

        char*   SvPVbytex_force(SV* sv, STRLEN len)
SvPVbyte_force

SvPV_force と同様ですが、もし必要ならまず sv をバイト表現に変換します。

        char*   SvPVbyte_force(SV* sv, STRLEN len)
SvPVbyte_nolen

SvPV_nolen と同様ですが、もし必要ならまず sv をバイト表現に変換します。

        char*   SvPVbyte_nolen(SV* sv)
SvPVutf8

SvPV と同様ですが、もし必要ならまず sv を utf8 に変換します。

        char*   SvPVutf8(SV* sv, STRLEN len)
SvPVutf8x

SvPV と同様ですが、もし必要ならまず sv を utf8 に変換します。 sv を 1 度だけ評価することを保証します; さもなければより効率のよい SvPVutf8 を使ってください。

        char*   SvPVutf8x(SV* sv, STRLEN len)
SvPVutf8x_force

SvPV_force と同様ですが、もし必要ならまず sv を utf8 に変換します。 sv を 1 度だけ評価することを保証します; さもなければより効率のよい SvPVutf8_force を使ってください。

        char*   SvPVutf8x_force(SV* sv, STRLEN len)
SvPVutf8_force

SvPV_force と同様ですが、もし必要ならまず sv を utf8 に変換します。

        char*   SvPVutf8_force(SV* sv, STRLEN len)
SvPVutf8_nolen

SvPV_nolen と同様ですが、もし必要ならまず sv を utf8 に変換します。

        char*   SvPVutf8_nolen(SV* sv)
SvPVX

SV にある物理文字列へのポインタを返します。 SV は文字列を保持していなければなりません。

        char*   SvPVX(SV* sv)
SvPVx

A version of SvPV which guarantees to evaluate sv only once. Only use this if sv is an expression with side effects, otherwise use the more efficient SvPVX. (TBT)

        char*   SvPVx(SV* sv, STRLEN len)
SvPV_force

SvPV と同様ですが、SV を強制的に文字列(SvPOK_only)を含みます。 SvPVX を直接更新したい場合にはあなたは強制することを望むでしょう。

        char*   SvPV_force(SV* sv, STRLEN len)
SvPV_force_nomg

Like SvPV but will force the SV into containing just a string (SvPOK_only). You want force if you are going to update the SvPVX directly. Doesn't process magic. (TBT)

        char*   SvPV_force_nomg(SV* sv, STRLEN len)
SvPV_nolen

Returns a pointer to the string in the SV, or a stringified form of the SV if the SV does not contain a string. The SV may cache the stringified form becoming SvPOK. Handles 'get' magic. (TBT)

        char*   SvPV_nolen(SV* sv)
SvPV_nomg

SvPV と同様ですが、magic を処理しません。

        char*   SvPV_nomg(SV* sv, STRLEN len)
SvPV_set

sv の PV ポインタの値を val にセットします。 SvIV_set を参照してください。

        void    SvPV_set(SV* sv, char* val)
SvREFCNT

オブジェクトの参照カウントの値を返します。

        U32     SvREFCNT(SV* sv)
SvREFCNT_dec

SV で与えられたものの参照カウントを減じます。

        void    SvREFCNT_dec(SV* sv)
SvREFCNT_inc

SV で与えられたものの参照カウントを増やします。

All of the following SvREFCNT_inc* macros are optimized versions of SvREFCNT_inc, and can be replaced with SvREFCNT_inc. (TBT)

        SV*     SvREFCNT_inc(SV* sv)
SvREFCNT_inc_NN

SvREFCNT_inc と同じですが、 sv が NULL ではないと分かっている場合にのみ使えます。 NULL かどうかをチェックする必要がないので、より速くより小さいです。

        SV*     SvREFCNT_inc_NN(SV* sv)
SvREFCNT_inc_simple

SvREFCNT_inc と同じですが、式に副作用がない場合にのみ使えます。 一時的な値を保管する必要がないので、より速いです。

        SV*     SvREFCNT_inc_simple(SV* sv)
SvREFCNT_inc_simple_NN

SvREFCNT_inc_simple と同じですが、 sv が NULL ではないと分かっている場合にのみ使えます。 NULL かどうかをチェックする必要がないので、より速くより小さいです。

        SV*     SvREFCNT_inc_simple_NN(SV* sv)
SvREFCNT_inc_simple_void

SvREFCNT_inc_simple と同じですが、返り値が不要な場合にのみ使えます。 このマクロは意味のある値を返す必要はありません。

        void    SvREFCNT_inc_simple_void(SV* sv)
SvREFCNT_inc_simple_void_NN

SvREFCNT_inc と同じですが、返り値が不要で、sv が NULL ではないと 分かっている場合にのみ使えます。 このマクロは意味のある値を返す必要が無く、NULL をチェックする必要もないので、 より速くより小さいです。

        void    SvREFCNT_inc_simple_void_NN(SV* sv)
SvREFCNT_inc_void

SvREFCNT_inc と同じですが、返り値が不要な場合にのみ使えます。 このマクロは意味のある値を返す必要はありません。

        void    SvREFCNT_inc_void(SV* sv)
SvREFCNT_inc_void_NN

SvREFCNT_inc と同じですが、返り値が不要で、sv が NULL ではないと 分かっている場合にのみ使えます。 このマクロは意味のある値を返す必要が無く、NULL をチェックする必要もないので、 より速くより小さいです。

        void    SvREFCNT_inc_void_NN(SV* sv)
SvROK

SV が RV であるかを検査します。

        U32     SvROK(SV* sv)
SvROK_off

SV の RV ステータスをリセットします。

        void    SvROK_off(SV* sv)
SvROK_on

SV に、自分が RV であると指示します。

        void    SvROK_on(SV* sv)
SvRV

SV を返すために RV を参照はずしします。

        SV*     SvRV(SV* sv)
SvRV_set

sv の RV ポインタの値を val にセットします。 SvIV_set を参照してください。

        void    SvRV_set(SV* sv, SV* val)
SvSTASH

SV のスタッシュを返します。

        HV*     SvSTASH(SV* sv)
SvSTASH_set

sv の STASH ポインタの値を val にセットします。 SvIV_set を参照してください。

        void    SvSTASH_set(SV* sv, HV* val)
SvTAINT

汚染検査が有効なときに SV を汚染検査します。

        void    SvTAINT(SV* sv)
SvTAINTED

SV が汚染されているかどうかをチェックします。 汚染されていれば TRUE を、そうでなければ FALSE を返します。

        bool    SvTAINTED(SV* sv)
SvTAINTED_off

SV を汚染除去します。 Perl の基本的セキュリティ機構と同様 このルーチンを使うときは特に注意してください。 XS モジュールの作者は、汚染除去について良く理解しない限りは この関数を使うべきではありません。 perl 標準のやり方では直接変数の汚染除去するのではなく、 注意深く構築された正規表現を使って汚染除去が行われます。

        void    SvTAINTED_off(SV* sv)
SvTAINTED_on

汚染チェックが有効な場合、汚染されているという印を SV につけます。

        void    SvTAINTED_on(SV* sv)
SvTRUE

Perl が SV を真と評価するか偽と評価するか、define されているか undefine なのかを表わすブール値を返します。 'set' magicをハンドルしません。

        bool    SvTRUE(SV* sv)
SvTYPE

SV の型を返します。 svtype を参照してください。

        svtype  SvTYPE(SV* sv)
SvUOK

SV が符号なし整数を含んでいるかどうかを示す真偽値を返します。

        bool    SvUOK(SV* sv)
SvUPGRADE

SV をより複雑なフォームにするために使われます。 必要であればアップグレードのために sv_upgrade を使用します。 svtype を参照してください。

        void    SvUPGRADE(SV* sv, svtype type)
SvUTF8

SV が UTF-8 エンコードされたデータを含んでいるかどうかを示す U32 値を 返します。 Call this after SvPV() in case any call to string overloading updates the internal flag. (TBT)

        U32     SvUTF8(SV* sv)
SvUTF8_off

SV の UTF-8 状態をリセットします。

        void    SvUTF8_off(SV *sv)
SvUTF8_on

SV の UTF-8 状態をオンにします (データは変更されません; フラグだけです)。 軽率に使わないでください。

        void    SvUTF8_on(SV *sv)
SvUV

SV を強制的に無符号整数に変換し、それを返します。 sv が 1 度だけ評価されることを保証しているバージョンについては SvUVx を参照してください。

        UV      SvUV(SV* sv)
SvUVX

SV の UV スロットの生の値を、チェックや変換なしに返します。 SvIOK が真であることを確認した後にのみ使えます。 SvUV() も参照してください。

        UV      SvUVX(SV* sv)
SvUVx

Coerces the given SV to an unsigned integer and returns it. Guarantees to sv only once. Only use this if sv is an expression with side effects, otherwise use the more efficient SvUV. (TBT)

        UV      SvUVx(SV* sv)
SvUV_nomg

SvUV と同様ですが、magic を処理しません。

        UV      SvUV_nomg(SV* sv)
SvUV_set

sv の UV ポインタの値を val にセットします。 SvIV_set を参照してください。

        void    SvUV_set(SV* sv, UV val)
SvVOK

SV がv-文字列を含んでいるかどうかを示す真偽値を返します。

        bool    SvVOK(SV* sv)
sv_catpvn_nomg

sv_catpvn と同様ですが、magic を処理しません。

        void    sv_catpvn_nomg(SV* sv, const char* ptr, STRLEN len)
sv_catsv_nomg

sv_catsv と同様ですが、magic を処理しません。

        void    sv_catsv_nomg(SV* dsv, SV* ssv)
sv_derived_from

C のレベルで SV が指定したクラスから派生したものであるかどうかを示す ブール値を返します。 To check derivation at the Perl level, call isa() as a normal Perl method. (TBT)

        bool    sv_derived_from(SV* sv, const char* name)
sv_does

Returns a boolean indicating whether the SV performs a specific, named role. The SV can be a Perl object or the name of a Perl class. (TBT)

        bool    sv_does(SV* sv, const char* name)
sv_report_used

開放されていない全ての SV の内容をダンプします。 (デバッグの助けとなります)。

        void    sv_report_used()
sv_setsv_nomg

sv_setsv と同様ですが、magic を処理しません。

        void    sv_setsv_nomg(SV* dsv, SV* ssv)


SV-Body Allocation

looks_like_number

SV の内容が数値のようにみなせるか(あるいは数値であるか)を検査します。 Inf and Infinity are treated as numbers (so will not issue a non-numeric warning), even if your atof() doesn't grok them. (TBT)

        I32     looks_like_number(SV* sv)
newRV_noinc

SV に対する RV ラッパーを生成します。 元の SV の参照カウントはインクリメント されません

        SV*     newRV_noinc(SV* sv)
newSV

新たな SV を生成します。 非ゼロの len パラメーターは SV が持つべき割り当てずみ文字列空間の大きさを示します。 余分な空間には NUL が埋められ、予約されます (SvPOK は文字列が割り当てられていたとしても SV をセットしません)。 新しい SV の参照カウントは 1 にセットされます。

In 5.9.3, newSV() replaces the older NEWSV() API, and drops the first parameter, x, a debug aid which allowed callers to identify themselves. This aid has been superseded by a new build option, PERL_MEM_LOG (see perlhack/PERL_MEM_LOG). The older API is still there for use in XS modules supporting older perls. (TBT)

        SV*     newSV(STRLEN len)
newSVhek

Creates a new SV from the hash key structure. It will generate scalars that point to the shared string table where possible. Returns a new (undefined) SV if the hek is NULL. (TBT)

        SV*     newSVhek(const HEK *hek)
newSViv

新たな SV を生成し、整数値をそこにコピーします。 SV の参照カウントは 1 にセットされます。

        SV*     newSViv(IV i)
newSVnv

新たな SV を生成し、不動小数点数値をそこにコピーします。 SV の参照カウントは 1 にセットされます。

        SV*     newSVnv(NV n)
newSVpv

新たな SV を生成し、文字列をそこにコピーします。 SV の参照カウントは 1 にセットされます。 len がゼロの場合、Perl が strlen() を使って長さを計算します。 効率のために、代わりに newSVpvn を使うことを考慮してください。

        SV*     newSVpv(const char* s, STRLEN len)
newSVpvf

新たな SV を生成し、sprintf のような文字列書式によって初期化します。

        SV*     newSVpvf(const char* pat, ...)
newSVpvn

新たな SV を生成し、文字列をそこにコピーします。 SV の参照カウントは 1 に設定されます。 len がゼロであった場合には長さゼロの文字列が生成されることに 注意してください。 You are responsible for ensuring that the source string is at least len bytes long. If the s argument is NULL the new SV will be undefined. (TBT)

        SV*     newSVpvn(const char* s, STRLEN len)
newSVpvn_share

Creates a new SV with its SvPVX_const pointing to a shared string in the string table. If the string does not already exist in the table, it is created first. Turns on READONLY and FAKE. If the hash parameter is non-zero, that value is used; otherwise the hash is computed. The string's hash can be later be retrieved from the SV with the SvSHARED_HASH() macro. The idea here is that as the string table is used for shared hash keys these strings will have SvPVX_const == HeKEY and hash lookup will avoid string compare. (TBT)

        SV*     newSVpvn_share(const char* s, I32 len, U32 hash)
newSVpvs

newSVpvn と同様ですが、文字列/長さの組ではなく、リテラルな文字列を 取ります。

        SV*     newSVpvs(const char* s)
newSVpvs_share

newSVpvn_share と同様ですが、文字列/長さの組ではなく、リテラルな文字列を 取り、ハッシュパラメータを除外します。

        SV*     newSVpvs_share(const char* s)
newSVrv

SV を指し示す RV の rv に対する新たな SV を生成します。 rv が RV でない場合には、それは RV に昇格します。 classname がナルでない場合には、生成された SV は指定されたパッケージに bless されます。 参照カウントが 1 に設定された SV が返されます。

        SV*     newSVrv(SV* rv, const char* classname)
newSVsv

元の SV を正確に複製した SV を生成します。 (sv_setsv を使います)。

        SV*     newSVsv(SV* old)
newSVuv

Creates a new SV and copies an unsigned integer into it. The reference count for the SV is set to 1. (TBT)

        SV*     newSVuv(UV u)
newSV_type

Creates a new SV, of the type specified. The reference count for the new SV is set to 1. (TBT)

        SV*     newSV_type(svtype type)
sv_2bool

This function is only called on magical items, and is only used by sv_true() or its macro equivalent. (TBT)

        bool    sv_2bool(SV* sv)
sv_2cv

Using various gambits, try to get a CV from an SV; in addition, try if possible to set *st and *gvp to the stash and GV associated with it. The flags in lref are passed to sv_fetchsv. (TBT)

        CV*     sv_2cv(SV* sv, HV** st, GV** gvp, I32 lref)
sv_2io

Using various gambits, try to get an IO from an SV: the IO slot if its a GV; or the recursive result if we're an RV; or the IO slot of the symbol named after the PV if we're a string. (TBT)

        IO*     sv_2io(SV* sv)
sv_2iv_flags

Return the integer value of an SV, doing any necessary string conversion. If flags includes SV_GMAGIC, does an mg_get() first. Normally used via the SvIV(sv) and SvIVx(sv) macros. (TBT)

        IV      sv_2iv_flags(SV* sv, I32 flags)
sv_2mortal

SV を揮発性にします。 The SV will be destroyed "soon", either by an explicit call to FREETMPS, or by an implicit call at places such as statement boundaries. SvTEMP() is turned on which means that the SV's string buffer can be "stolen" if this SV is copied. See also sv_newmortal and sv_mortalcopy. (TBT)

        SV*     sv_2mortal(SV* sv)
sv_2nv

Return the num value of an SV, doing any necessary string or integer conversion, magic etc. Normally used via the SvNV(sv) and SvNVx(sv) macros. (TBT)

        NV      sv_2nv(SV* sv)
sv_2pvbyte

SV のバイトエンコードされた表現へのポインタを返し、その長さを *lp に セットします。 副作用として、SV が UTF-8 から降格するかもしれません。

普通は SvPVbyte マクロ経由でアクセスされます。

        char*   sv_2pvbyte(SV* sv, STRLEN* lp)
sv_2pvutf8

SV の UTF-8 エンコードされた表現へのポインタを返し、その長さを *lp に セットします。 副作用として、SV が UTF-8 へ昇格するかもしれません。

普通は SvPVutf8 マクロ経由でアクセスされます。

        char*   sv_2pvutf8(SV* sv, STRLEN* lp)
sv_2pv_flags

Returns a pointer to the string value of an SV, and sets *lp to its length. If flags includes SV_GMAGIC, does an mg_get() first. Coerces sv to a string if necessary. Normally invoked via the SvPV_flags macro. sv_2pv() and sv_2pv_nomg usually end up here too. (TBT)

        char*   sv_2pv_flags(SV* sv, STRLEN* lp, I32 flags)
sv_2uv_flags

Return the unsigned integer value of an SV, doing any necessary string conversion. If flags includes SV_GMAGIC, does an mg_get() first. Normally used via the SvUV(sv) and SvUVx(sv) macros. (TBT)

        UV      sv_2uv_flags(SV* sv, I32 flags)
sv_backoff

Remove any string offset. You should normally use the SvOOK_off macro wrapper instead. (TBT)

        int     sv_backoff(SV* sv)
sv_bless

SV を指定したパッケージに bless します。 SV は RV でなければなりません。 パッケージは、そのスタッシュ(gv_stashpv() 参照)によって 指示されていなければなりません。 SV の参照カウントは影響を受けません。

        SV*     sv_bless(SV* sv, HV* stash)
sv_catpv

文字列を、SV にある文字列の終端に連結します。 If the SV has the UTF-8 status set, then the bytes appended should be valid UTF-8. 'get' magic をハンドルしますが、'set' magic はハンドルしません。 sv_catpv_mg を参照してください。 (TBT)

        void    sv_catpv(SV* sv, const char* ptr)
sv_catpvf

引数を sprintf のように処理し、SV にその結果を追加します。 If the appended data contains "wide" characters (including, but not limited to, SVs with a UTF-8 PV formatted with %s, and characters >255 formatted with %c), the original SV might get upgraded to UTF-8. 'get' magic をハンドルしますが、'set' magic はハンドルしません。 See sv_catpvf_mg. If the original SV was UTF-8, the pattern should be valid UTF-8; if the original SV was bytes, the pattern should be too. (TBT)

        void    sv_catpvf(SV* sv, const char* pat, ...)
sv_catpvf_mg

sv_catpvf と同様ですが、'set' magic もハンドルします。

        void    sv_catpvf_mg(SV *sv, const char* pat, ...)
sv_catpvn

文字列を、SV にある文字列の終端に連結します。 lenはコピーするバイト数を指示します。 If the SV has the UTF-8 status set, then the bytes appended should be valid UTF-8. 'get' magic をハンドルしますが、'set' magic はハンドルしません。 sv_catpvn_mg を参照してください。 (TBT)

        void    sv_catpvn(SV* sv, const char* ptr, STRLEN len)
sv_catpvn_flags

Concatenates the string onto the end of the string which is in the SV. The len indicates number of bytes to copy. If the SV has the UTF-8 status set, then the bytes appended should be valid UTF-8. If flags has SV_GMAGIC bit set, will mg_get on dsv if appropriate, else not. sv_catpvn and sv_catpvn_nomg are implemented in terms of this function. (TBT)

        void    sv_catpvn_flags(SV* sv, const char* ptr, STRLEN len, I32 flags)
sv_catpvs

sv_catpvn と同様ですが、文字列/長さの組ではなく、リテラルな文字列を 取ります。

        void    sv_catpvs(SV* sv, const char* s)
sv_catpv_mg

sv_catpv と同様ですが、'set' magic もハンドルします。

        void    sv_catpv_mg(SV *sv, const char *ptr)
sv_catsv

SV ssv にある文字列を、SV dsv にある文字列の終端へ連結します。 Modifies dsv but not ssv. 'get' magic をハンドルしますが、'set' magic はハンドルしません。 sv_catsv_mg を参照してください。 (TBT)

        void    sv_catsv(SV* dsv, SV* ssv)
sv_catsv_flags

Concatenates the string from SV ssv onto the end of the string in SV dsv. Modifies dsv but not ssv. If flags has SV_GMAGIC bit set, will mg_get on the SVs if appropriate, else not. sv_catsv and sv_catsv_nomg are implemented in terms of this function. (TBT)

        void    sv_catsv_flags(SV* dsv, SV* ssv, I32 flags)
sv_chop

文字列バッファの先頭から文字を効率的に削除します。 SvPOK(sv) が真でなければならず、ptr は文字列バッファの 内側のどこかを指し示すポインタでなければなりません。 ptr は調整後の文字列の先頭となります。 Uses the "OOK hack". Beware: after this function returns, ptr and SvPVX_const(sv) may no longer refer to the same chunk of data. (TBT)

        void    sv_chop(SV* sv, const char* ptr)
sv_clear

Clear an SV: call any destructors, free up any memory used by the body, and free the body itself. The SV's head is not freed, although its type is set to all 1's so that it won't inadvertently be assumed to be live during global destruction etc. This function should only be called when REFCNT is zero. Most of the time you'll want to call sv_free() (or its macro wrapper SvREFCNT_dec) instead. (TBT)

        void    sv_clear(SV* sv)
sv_cmp

二つの SV にある文字列を比較します。 sv1sv2 より小さいときには -1 を、両者が等しいときには 0 を、 sv1sv2 より大きいときには 1 を返します。 Is UTF-8 and 'use bytes' aware, handles get magic, and will coerce its args to strings if necessary. See also sv_cmp_locale. (TBT)

        I32     sv_cmp(SV* sv1, SV* sv2)
sv_cmp_locale

Compares the strings in two SVs in a locale-aware manner. Is UTF-8 and 'use bytes' aware, handles get magic, and will coerce its args to strings if necessary. See also sv_cmp_locale. See also sv_cmp. (TBT)

        I32     sv_cmp_locale(SV* sv1, SV* sv2)
sv_collxfrm

Add Collate Transform magic to an SV if it doesn't already have it. (TBT)

Any scalar variable may carry PERL_MAGIC_collxfrm magic that contains the scalar data of the variable, but transformed to such a format that a normal memory comparison can be used to compare the data according to the locale settings. (TBT)

        char*   sv_collxfrm(SV* sv, STRLEN* nxp)
sv_copypv

Copies a stringified representation of the source SV into the destination SV. Automatically performs any necessary mg_get and coercion of numeric values into strings. Guaranteed to preserve UTF8 flag even from overloaded objects. Similar in nature to sv_2pv[_flags] but operates directly on an SV instead of just the string. Mostly uses sv_2pv_flags to do its work, except when that would lose the UTF-8'ness of the PV. (TBT)

        void    sv_copypv(SV* dsv, SV* ssv)
sv_dec

SV にある値の自動デクリメントを行います; doing string to numeric conversion if necessary. Handles 'get' magic. (TBT)

        void    sv_dec(SV* sv)
sv_eq

二つの SV にある文字列が同一のものであるかどうかをあらわすブール値を 返します。 Is UTF-8 and 'use bytes' aware, handles get magic, and will coerce its args to strings if necessary. (TBT)

        I32     sv_eq(SV* sv1, SV* sv2)
sv_force_normal_flags

Undo various types of fakery on an SV: if the PV is a shared string, make a private copy; if we're a ref, stop refing; if we're a glob, downgrade to an xpvmg; if we're a copy-on-write scalar, this is the on-write time when we do the copy, and is also used locally. If SV_COW_DROP_PV is set then a copy-on-write scalar drops its PV buffer (if any) and becomes SvPOK_off rather than making a copy. (Used where this scalar is about to be set to some other value.) In addition, the flags parameter gets passed to sv_unref_flags() when unrefing. sv_force_normal calls this function with flags set to 0. (TBT)

        void    sv_force_normal_flags(SV *sv, U32 flags)
sv_free

Decrement an SV's reference count, and if it drops to zero, call sv_clear to invoke destructors and free up any memory used by the body; finally, deallocate the SV's head itself. Normally called via a wrapper macro SvREFCNT_dec. (TBT)

        void    sv_free(SV* sv)
sv_gets

Get a line from the filehandle and store it into the SV, optionally appending to the currently-stored string. (TBT)

        char*   sv_gets(SV* sv, PerlIO* fp, I32 append)
sv_grow

SV にある文字バッファを拡張します。 もし必要なら、sv_unref を使用して、SV を SVt_PV へ昇格します。 文字バッファへのポインタを返します。 代わりに SvGROW ラッパーを使用してください。

        char*   sv_grow(SV* sv, STRLEN newlen)
sv_inc

SV にある値の自動インクリメントを行います; もし必要なら、文字列から数値への変換を行います。 'get' magic を扱います。

        void    sv_inc(SV* sv)
sv_insert

文字列を、SV 中の指定されたオフセット/長さの位置に挿入します。 Perl の substr() 関数と同様のものです。

        void    sv_insert(SV* bigsv, STRLEN offset, STRLEN len, const char* little, STRLEN littlelen)
sv_isa

SV が指定したクラスに bless されているかどうかを表わすブール値を 返します。 これは、subtype をどのようにチェックするかを知らないので、 継承関係に確認するのに sv_derived_from を使います。

        int     sv_isa(SV* sv, const char* name)
sv_isobject

SV が、bless されているオブジェクトを指す RV であるかどうかを表わす ブール値を返します。 SV が RV でない場合、もしくはオブジェクトが bless されていない場合にはこれは false を返します。

        int     sv_isobject(SV* sv)
sv_len

SV にある文字列の長さを返します。 SvCUR を使ってください。 Handles magic and type coercion. See also SvCUR, which gives raw access to the xpv_cur slot. (TBT)

        STRLEN  sv_len(SV* sv)
sv_len_utf8

Returns the number of characters in the string in an SV, counting wide UTF-8 bytes as a single character. Handles magic and type coercion. (TBT)

        STRLEN  sv_len_utf8(SV* sv)
sv_magic

SV に magic を付加します。 First upgrades sv to type SVt_PVMG if necessary, then adds a new magic item of type how to the head of the magic list. (TBT)

See sv_magicext (which sv_magic now calls) for a description of the handling of the name and namlen arguments. (TBT)

You need to use sv_magicext to add magic to SvREADONLY SVs and also to add more than one instance of the same 'how'. (TBT)

        void    sv_magic(SV* sv, SV* obj, int how, const char* name, I32 namlen)
sv_magicext

Adds magic to an SV, upgrading it if necessary. Applies the supplied vtable and returns a pointer to the magic added. (TBT)

Note that sv_magicext will allow things that sv_magic will not. In particular, you can add magic to SvREADONLY SVs, and add more than one instance of the same 'how'. (TBT)

If namlen is greater than zero then a savepvn copy of name is stored, if namlen is zero then name is stored as-is and - as another special case - if (name && namlen == HEf_SVKEY) then name is assumed to contain an SV* and is stored as-is with its REFCNT incremented. (TBT)

(これは今では sv_magic によってサブルーチンとして使われます。)

        MAGIC * sv_magicext(SV* sv, SV* obj, int how, const MGVTBL *vtbl, const char* name, I32 namlen)

l=for hackers Found in file sv.c

sv_mortalcopy

(sv_setsv を使って)元の SV のコピーである、新しい SV を生成します。 生成された SV は揮発性である目印が付けられます。 It will be destroyed "soon", either by an explicit call to FREETMPS, or by an implicit call at places such as statement boundaries. See also sv_newmortal and sv_2mortal. (TBT)

        SV*     sv_mortalcopy(SV* oldsv)
sv_newmortal

揮発性である新たな null SV を生成します。 新たに作られた SV の参照カウントは 1 にセットされます。 It will be destroyed "soon", either by an explicit call to FREETMPS, or by an implicit call at places such as statement boundaries. See also sv_mortalcopy and sv_2mortal. (TBT)

        SV*     sv_newmortal()
sv_newref

SV の参照カウントをインクリメントします。 代わりに SvREFCNT_inc() ラッパーを使ってください。

        SV*     sv_newref(SV* sv)
sv_pos_b2u

Converts the value pointed to by offsetp from a count of bytes from the start of the string, to a count of the equivalent number of UTF-8 chars. Handles magic and type coercion. (TBT)

        void    sv_pos_b2u(SV* sv, I32* offsetp)
sv_pos_u2b

Converts the value pointed to by offsetp from a count of UTF-8 chars from the start of the string, to a count of the equivalent number of bytes; if lenp is non-zero, it does the same to lenp, but this time starting from the offset, rather than from the start of the string. Handles magic and type coercion. (TBT)

        void    sv_pos_u2b(SV* sv, I32* offsetp, I32* lenp)
sv_pvbyten_force

SvPVbytex_force マクロのバックエンドです。 代わりに、常にマクロを使ってください。

        char*   sv_pvbyten_force(SV* sv, STRLEN* lp)
sv_pvn_force

Get a sensible string out of the SV somehow. 複雑なマクロ式を扱えないコンパイラのための、SvPV_force マクロの プライベート実装です。 代わりに、常にマクロを使ってください。 (TBT)

        char*   sv_pvn_force(SV* sv, STRLEN* lp)
sv_pvn_force_flags

Get a sensible string out of the SV somehow. If flags has SV_GMAGIC bit set, will mg_get on sv if appropriate, else not. sv_pvn_force and sv_pvn_force_nomg are implemented in terms of this function. You normally want to use the various wrapper macros instead: see SvPV_force and SvPV_force_nomg (TBT)

        char*   sv_pvn_force_flags(SV* sv, STRLEN* lp, I32 flags)
sv_pvutf8n_force

SvPVutf8x_force マクロのバックエンドです。 代わりに、常にマクロを使ってください。

        char*   sv_pvutf8n_force(SV* sv, STRLEN* lp)
sv_reftype

Returns a string describing what the SV is a reference to. (TBT)

        const char*     sv_reftype(const SV* sv, int ob)
sv_replace

Make the first argument a copy of the second, then delete the original. The target SV physically takes over ownership of the body of the source SV and inherits its flags; however, the target keeps any magic it owns, and any magic in the source is discarded. Note that this is a rather specialist SV copying operation; most of the time you'll want to use sv_setsv or one of its many macro front-ends. (TBT)

        void    sv_replace(SV* sv, SV* nsv)
sv_reset

Underlying implementation for the reset Perl function. Note that the perl-level function is vaguely deprecated. (TBT)

        void    sv_reset(const char* s, HV* stash)
sv_rvweaken

Weaken a reference: set the SvWEAKREF flag on this RV; give the referred-to SV PERL_MAGIC_backref magic if it hasn't already; and push a back-reference to this RV onto the array of backreferences associated with that magic. If the RV is magical, set magic will be called after the RV is cleared. (TBT)

        SV*     sv_rvweaken(SV *sv)
sv_setiv

整数を与えられた SV へコピーします; 必要なら最初に昇格します。 'set' magic をハンドルしません。 sv_setiv_mg も参照してください。

        void    sv_setiv(SV* sv, IV num)
sv_setiv_mg

sv_setiv と同様ですが、'set' magic をハンドルします。

        void    sv_setiv_mg(SV *sv, IV i)
sv_setnv

倍精度浮動小数点数を与えられた SV へコピーします; 必要なら最初に昇格します。 'set' magicをハンドルしません。 sv_setnv_mg も参照してください。

        void    sv_setnv(SV* sv, NV num)
sv_setnv_mg

sv_setnv と同様ですが、'set' magic をハンドルします。

        void    sv_setnv_mg(SV *sv, NV num)
sv_setpv

文字列を SV へコピーします。 文字列は null で終端されていなければなりません。 これは 'set' magic をハンドルしません。 sv_setpv_mg を参照してください。

        void    sv_setpv(SV* sv, const char* ptr)
sv_setpvf

Works like sv_catpvf but copies the text into the SV instead of appending it. 'set' magic をハンドルしません。 sv_setpvf_mg を参照してください。 (TBT)

        void    sv_setpvf(SV* sv, const char* pat, ...)
sv_setpvf_mg

sv_setpvf と同様ですが、'set' magic をハンドルします。

        void    sv_setpvf_mg(SV *sv, const char* pat, ...)
sv_setpviv

整数値を与えられた SV をコピーし、同様にその文字列値を更新します。 'set' magic をハンドルしません。 sv_setpviv_mg を参照してください。

        void    sv_setpviv(SV* sv, IV num)
sv_setpviv_mg

sv_setpviv と同様ですが、'set' magic をハンドルします。

        void    sv_setpviv_mg(SV *sv, IV iv)
sv_setpvn

文字列を SV へコピーします。 パラメーター len はコピーされるバイト数を指示します。 If the ptr argument is NULL the SV will become undefined. 'set' magic をハンドルしません。 sv_setpvn_mg を参照してください。 (TBT)

        void    sv_setpvn(SV* sv, const char* ptr, STRLEN len)
sv_setpvn_mg

sv_setpvn と同様ですが、'set' magic をハンドルします。

        void    sv_setpvn_mg(SV *sv, const char *ptr, STRLEN len)
sv_setpvs

sv_setpvn と同様ですが、文字列/長さの組ではなく、リテラルな文字列を 取ります。

        void    sv_setpvs(SV* sv, const char* s)
sv_setpv_mg

sv_setpv と同様ですが、'set' magic をハンドルします。

        void    sv_setpv_mg(SV *sv, const char *ptr)
sv_setref_iv

整数値を、bless することもできる新たな SV へコピーします。 引数 rv は RV へと昇格し、このRVは新たな SV を指し示すように 変更されます。 引数 classname は bless するパッケージを指示するものです。 bless をしないためには、classnameNULL をセットします。 新しい SV の参照カウントは 1 となり、RV が返されます。

        SV*     sv_setref_iv(SV* rv, const char* classname, IV iv)
sv_setref_nv

倍精度実数値を、bless することもできる新たな SV へコピーします。 引数 rv は RV へと昇格し、新たな SV を指し示すように変更されます。 引数 classname は bless するパッケージを指示するものです。 bless をしないためには、classnameNULL をセットします。 新しい SV の参照カウントは 1 となり、RV が返されます。

        SV*     sv_setref_nv(SV* rv, const char* classname, NV nv)
sv_setref_pv

ポインタを、bless することもできる新たな SV へコピーします。 引数 rv は RV へと昇格し、新たなSVを指し示すように変更されます。 引数 pv が NULL であれば、PL_sv_undef が新たな SV に格納されます。 引数 classname は bless するパッケージを指示するものです。 bless をしないためには、classnameNULL をセットします。 新しい SV の参照カウントは 1 となり、RV が返されます。

HV, AV, SV, CV のような Perl の他の type を使わないようにしてください。 これは、そういったオブジェクトにポインタのコピー処理を 行うことでおかしくなってしまうからです。

sv_setref_pvn は、このポインタのコピーではなく文字列を コピーしているということに注意してください。

        SV*     sv_setref_pv(SV* rv, const char* classname, void* pv)
sv_setref_pvn

文字列を、bless することもできる新たな SV へコピーします。 文字列の長さを n で指定しなければなりません。 引数 rv は RV へと昇格し、新たな SV を指し示すように変更されます。 引数 classname は bless するパッケージを指示するものです。 bless をしないためには、classnameNULL をセットします。 新しい SV の参照カウントは 1 となり、RV が返されます。

sv_setref_pv は、文字列をコピーするのではなくポインタを コピーするということに注意してください。

        SV*     sv_setref_pvn(SV* rv, const char* classname, const char* pv, STRLEN n)
sv_setref_uv

Copies an unsigned integer into a new SV, optionally blessing the SV. The rv argument will be upgraded to an RV. That RV will be modified to point to the new SV. The classname argument indicates the package for the blessing. Set classname to NULL to avoid the blessing. The new SV will have a reference count of 1, and the RV will be returned. (TBT)

        SV*     sv_setref_uv(SV* rv, const char* classname, UV uv)
sv_setsv

送り元の SV ssv の内容を、送り先の SV dsv にコピーします。 送り元の SV は、それが揮発性であった場合には破棄されるかもしれません; so don't use this function if the source SV needs to be reused. 'set' magic をハンドルしません。 Loosely speaking, it performs a copy-by-value, obliterating any previous content of the destination. (TBT)

You probably want to use one of the assortment of wrappers, such as SvSetSV, SvSetSV_nosteal, SvSetMagicSV and SvSetMagicSV_nosteal. (TBT)

        void    sv_setsv(SV* dsv, SV* ssv)
sv_setsv_flags

Copies the contents of the source SV ssv into the destination SV dsv. The source SV may be destroyed if it is mortal, so don't use this function if the source SV needs to be reused. Does not handle 'set' magic. Loosely speaking, it performs a copy-by-value, obliterating any previous content of the destination. If the flags parameter has the SV_GMAGIC bit set, will mg_get on ssv if appropriate, else not. If the flags parameter has the NOSTEAL bit set then the buffers of temps will not be stolen. <sv_setsv> and sv_setsv_nomg are implemented in terms of this function. (TBT)

You probably want to use one of the assortment of wrappers, such as SvSetSV, SvSetSV_nosteal, SvSetMagicSV and SvSetMagicSV_nosteal. (TBT)

This is the primary function for copying scalars, and most other copy-ish functions and macros use this underneath. (TBT)

        void    sv_setsv_flags(SV* dsv, SV* ssv, I32 flags)
sv_setsv_mg

sv_setsv と同様ですが、'set' magic をハンドルします。

        void    sv_setsv_mg(SV *dstr, SV *sstr)
sv_setuv

符号なし整数を与えられた SV へコピーします; upgrading first if necessary. 'set' magic をハンドルしません。 sv_setuv_mg も参照してください。 (TBT)

        void    sv_setuv(SV* sv, UV num)
sv_setuv_mg

sv_setsv と同様ですが、'set' magic をハンドルします。

        void    sv_setuv_mg(SV *sv, UV u)
sv_tainted

SV の汚染を調べます。 代わりに SvTAINTED を使ってください。

        bool    sv_tainted(SV* sv)
sv_true

Returns true if the SV has a true value by Perl's rules. Use the SvTRUE macro instead, which may call sv_true() or may instead use an in-line version. (TBT)

        I32     sv_true(SV *sv)
sv_unmagic

SV から type 型の全ての magic を取り除きます。

        int     sv_unmagic(SV* sv, int type)
sv_unref_flags

Unsets the RV status of the SV, and decrements the reference count of whatever was being referenced by the RV. This can almost be thought of as a reversal of newSVrv. The cflags argument can contain SV_IMMEDIATE_UNREF to force the reference count to be decremented (otherwise the decrementing is conditional on the reference count being different from one or the reference being a readonly SV). See SvROK_off. (TBT)

        void    sv_unref_flags(SV* sv, U32 flags)
sv_untaint