Win32 API 日本語リファレンス
ホームGlobalization › utext_char32At

utext_char32At

関数
指定ネイティブ位置のコードポイントを取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

// icuuc.dll
#include <windows.h>

INT utext_char32At(
    UText* ut,
    LONGLONG nativeIndex
);

パラメーター

名前方向
utUText*inout
nativeIndexLONGLONGin

戻り値の型: INT

各言語での呼び出し定義

// icuuc.dll
#include <windows.h>

INT utext_char32At(
    UText* ut,
    LONGLONG nativeIndex
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int utext_char32At(
    IntPtr ut,   // UText* in/out
    long nativeIndex   // LONGLONG
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function utext_char32At(
    ut As IntPtr,   ' UText* in/out
    nativeIndex As Long   ' LONGLONG
) As Integer
End Function
' ut : UText* in/out
' nativeIndex : LONGLONG
Declare PtrSafe Function utext_char32At Lib "icuuc" ( _
    ByVal ut As LongPtr, _
    ByVal nativeIndex As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

utext_char32At = ctypes.cdll.icuuc.utext_char32At
utext_char32At.restype = ctypes.c_int
utext_char32At.argtypes = [
    ctypes.c_void_p,  # ut : UText* in/out
    ctypes.c_longlong,  # nativeIndex : LONGLONG
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
utext_char32At = Fiddle::Function.new(
  lib['utext_char32At'],
  [
    Fiddle::TYPE_VOIDP,  # ut : UText* in/out
    Fiddle::TYPE_LONG_LONG,  # nativeIndex : LONGLONG
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn utext_char32At(
        ut: *mut UText,  // UText* in/out
        nativeIndex: i64  // LONGLONG
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int utext_char32At(IntPtr ut, long nativeIndex);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_utext_char32At' -Namespace Win32 -PassThru
# $api::utext_char32At(ut, nativeIndex)
#uselib "icuuc.dll"
#func global utext_char32At "utext_char32At" sptr, sptr
; utext_char32At varptr(ut), nativeIndex   ; 戻り値は stat
; ut : UText* in/out -> "sptr"
; nativeIndex : LONGLONG -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global utext_char32At "utext_char32At" var, int64
; res = utext_char32At(ut, nativeIndex)
; ut : UText* in/out -> "var"
; nativeIndex : LONGLONG -> "int64"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; INT utext_char32At(UText* ut, LONGLONG nativeIndex)
#uselib "icuuc.dll"
#cfunc global utext_char32At "utext_char32At" var, int64
; res = utext_char32At(ut, nativeIndex)
; ut : UText* in/out -> "var"
; nativeIndex : LONGLONG -> "int64"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procutext_char32At = icuuc.NewProc("utext_char32At")
)

// ut (UText* in/out), nativeIndex (LONGLONG)
r1, _, err := procutext_char32At.Call(
	uintptr(ut),
	uintptr(nativeIndex),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function utext_char32At(
  ut: Pointer;   // UText* in/out
  nativeIndex: Int64   // LONGLONG
): Integer; cdecl;
  external 'icuuc.dll' name 'utext_char32At';
result := DllCall("icuuc\utext_char32At"
    , "Ptr", ut   ; UText* in/out
    , "Int64", nativeIndex   ; LONGLONG
    , "Cdecl Int")   ; return: INT
●utext_char32At(ut, nativeIndex) = DLL("icuuc.dll", "int utext_char32At(void*, int64)")
# 呼び出し: utext_char32At(ut, nativeIndex)
# ut : UText* in/out -> "void*"
# nativeIndex : LONGLONG -> "int64"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。