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

umutablecptrie_get

関数
可変コードポイントトライから指定値を取得する。
DLLicu.dll呼出規約cdecl

シグネチャ

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

DWORD umutablecptrie_get(
    const UMutableCPTrie* trie,
    INT c
);

パラメーター

名前方向説明
trieUMutableCPTrie*in値を引く可変トライへのポインタ。
cINTin値を取得する対象のコードポイント(U+0000〜U+10FFFF)。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD umutablecptrie_get(
    const UMutableCPTrie* trie,
    INT c
);
[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint umutablecptrie_get(
    ref IntPtr trie,   // UMutableCPTrie*
    int c   // INT
);
<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function umutablecptrie_get(
    ByRef trie As IntPtr,   ' UMutableCPTrie*
    c As Integer   ' INT
) As UInteger
End Function
' trie : UMutableCPTrie*
' c : INT
Declare PtrSafe Function umutablecptrie_get Lib "icu" ( _
    ByRef trie As LongPtr, _
    ByVal c As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

umutablecptrie_get = ctypes.cdll.icu.umutablecptrie_get
umutablecptrie_get.restype = wintypes.DWORD
umutablecptrie_get.argtypes = [
    ctypes.c_void_p,  # trie : UMutableCPTrie*
    ctypes.c_int,  # c : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icu.dll')
umutablecptrie_get = Fiddle::Function.new(
  lib['umutablecptrie_get'],
  [
    Fiddle::TYPE_VOIDP,  # trie : UMutableCPTrie*
    Fiddle::TYPE_INT,  # c : INT
  ],
  -Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icu")]
extern "C" {
    fn umutablecptrie_get(
        trie: *const isize,  // UMutableCPTrie*
        c: i32  // INT
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icu.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern uint umutablecptrie_get(ref IntPtr trie, int c);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_umutablecptrie_get' -Namespace Win32 -PassThru
# $api::umutablecptrie_get(trie, c)
#uselib "icu.dll"
#func global umutablecptrie_get "umutablecptrie_get" sptr, sptr
; umutablecptrie_get varptr(trie), c   ; 戻り値は stat
; trie : UMutableCPTrie* -> "sptr"
; c : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icu.dll"
#cfunc global umutablecptrie_get "umutablecptrie_get" var, int
; res = umutablecptrie_get(trie, c)
; trie : UMutableCPTrie* -> "var"
; c : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD umutablecptrie_get(UMutableCPTrie* trie, INT c)
#uselib "icu.dll"
#cfunc global umutablecptrie_get "umutablecptrie_get" var, int
; res = umutablecptrie_get(trie, c)
; trie : UMutableCPTrie* -> "var"
; c : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icu = windows.NewLazySystemDLL("icu.dll")
	procumutablecptrie_get = icu.NewProc("umutablecptrie_get")
)

// trie (UMutableCPTrie*), c (INT)
r1, _, err := procumutablecptrie_get.Call(
	uintptr(trie),
	uintptr(c),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function umutablecptrie_get(
  trie: Pointer;   // UMutableCPTrie*
  c: Integer   // INT
): DWORD; cdecl;
  external 'icu.dll' name 'umutablecptrie_get';
result := DllCall("icu\umutablecptrie_get"
    , "Ptr", trie   ; UMutableCPTrie*
    , "Int", c   ; INT
    , "Cdecl UInt")   ; return: DWORD
●umutablecptrie_get(trie, c) = DLL("icu.dll", "dword umutablecptrie_get(void*, int)")
# 呼び出し: umutablecptrie_get(trie, c)
# trie : UMutableCPTrie* -> "void*"
# c : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
const std = @import("std");

extern "icu" fn umutablecptrie_get(
    trie: [*c]isize, // UMutableCPTrie*
    c: i32 // INT
) callconv(.c) u32;
proc umutablecptrie_get(
    trie: ptr int,  # UMutableCPTrie*
    c: int32  # INT
): uint32 {.importc: "umutablecptrie_get", cdecl, dynlib: "icu.dll".}
pragma(lib, "icu");
extern(C)
uint umutablecptrie_get(
    ptrdiff_t* trie,   // UMutableCPTrie*
    int c   // INT
);
ccall((:umutablecptrie_get, "icu.dll"), UInt32,
      (Ptr{Int}, Int32),
      trie, c)
# trie : UMutableCPTrie* -> Ptr{Int}
# c : INT -> Int32
local ffi = require("ffi")
ffi.cdef[[
uint32_t umutablecptrie_get(
    intptr_t* trie,
    int32_t c);
]]
local icu = ffi.load("icu")
-- icu.umutablecptrie_get(trie, c)
-- trie : UMutableCPTrie*
-- c : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icu.dll');
const umutablecptrie_get = lib.func('__cdecl', 'umutablecptrie_get', 'uint32_t', ['intptr_t *', 'int32_t']);
// umutablecptrie_get(trie, c)
// trie : UMutableCPTrie* -> 'intptr_t *'
// c : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icu.dll", {
  umutablecptrie_get: { parameters: ["pointer", "i32"], result: "u32" },
});
// lib.symbols.umutablecptrie_get(trie, c)
// trie : UMutableCPTrie* -> "pointer"
// c : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t umutablecptrie_get(
    intptr_t* trie,
    int32_t c);
C, "icu.dll");
// $ffi->umutablecptrie_get(trie, c);
// trie : UMutableCPTrie*
// c : INT
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icu extends Library {
    Icu INSTANCE = Native.load("icu", Icu.class);
    int umutablecptrie_get(
        LongByReference trie,   // UMutableCPTrie*
        int c   // INT
    );
}
@[Link("icu")]
lib Libicu
  fun umutablecptrie_get = umutablecptrie_get(
    trie : LibC::SSizeT*,   # UMutableCPTrie*
    c : Int32   # INT
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef umutablecptrie_getNative = Uint32 Function(Pointer<IntPtr>, Int32);
typedef umutablecptrie_getDart = int Function(Pointer<IntPtr>, int);
final umutablecptrie_get = DynamicLibrary.open('icu.dll')
    .lookupFunction<umutablecptrie_getNative, umutablecptrie_getDart>('umutablecptrie_get');
// trie : UMutableCPTrie* -> Pointer<IntPtr>
// c : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function umutablecptrie_get(
  trie: Pointer;   // UMutableCPTrie*
  c: Integer   // INT
): DWORD; cdecl;
  external 'icu.dll' name 'umutablecptrie_get';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "umutablecptrie_get"
  c_umutablecptrie_get :: Ptr CIntPtr -> Int32 -> IO Word32
-- trie : UMutableCPTrie* -> Ptr CIntPtr
-- c : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let umutablecptrie_get =
  foreign "umutablecptrie_get"
    ((ptr intptr_t) @-> int32_t @-> returning uint32_t)
(* trie : UMutableCPTrie* -> (ptr intptr_t) *)
(* c : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icu (t "icu.dll"))
(cffi:use-foreign-library icu)

(cffi:defcfun ("umutablecptrie_get" umutablecptrie-get :convention :cdecl) :uint32
  (trie :pointer)   ; UMutableCPTrie*
  (c :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $umutablecptrie_get = Win32::API::More->new('icu',
    'DWORD umutablecptrie_get(LPVOID trie, int c)');
# my $ret = $umutablecptrie_get->Call($trie, $c);
# trie : UMutableCPTrie* -> LPVOID
# c : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。