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

ucptrie_get

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

シグネチャ

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

DWORD ucptrie_get(
    const UCPTrie* trie,
    INT c
);

パラメーター

名前方向説明
trieUCPTrie*in値を引く不変トライへのポインタ。
cINTin値を取得する対象のコードポイント(U+0000〜U+10FFFF)。範囲外は誤り値を返す。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ucptrie_get(
    const UCPTrie* trie,
    INT c
);
[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint ucptrie_get(
    IntPtr trie,   // UCPTrie*
    int c   // INT
);
<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucptrie_get(
    trie As IntPtr,   ' UCPTrie*
    c As Integer   ' INT
) As UInteger
End Function
' trie : UCPTrie*
' c : INT
Declare PtrSafe Function ucptrie_get Lib "icu" ( _
    ByVal 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

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

lib = Fiddle.dlopen('icu.dll')
ucptrie_get = Fiddle::Function.new(
  lib['ucptrie_get'],
  [
    Fiddle::TYPE_VOIDP,  # trie : UCPTrie*
    Fiddle::TYPE_INT,  # c : INT
  ],
  -Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icu")]
extern "C" {
    fn ucptrie_get(
        trie: *const UCPTrie,  // UCPTrie*
        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 ucptrie_get(IntPtr trie, int c);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_ucptrie_get' -Namespace Win32 -PassThru
# $api::ucptrie_get(trie, c)
#uselib "icu.dll"
#func global ucptrie_get "ucptrie_get" sptr, sptr
; ucptrie_get varptr(trie), c   ; 戻り値は stat
; trie : UCPTrie* -> "sptr"
; c : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icu.dll"
#cfunc global ucptrie_get "ucptrie_get" var, int
; res = ucptrie_get(trie, c)
; trie : UCPTrie* -> "var"
; c : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD ucptrie_get(UCPTrie* trie, INT c)
#uselib "icu.dll"
#cfunc global ucptrie_get "ucptrie_get" var, int
; res = ucptrie_get(trie, c)
; trie : UCPTrie* -> "var"
; c : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icu = windows.NewLazySystemDLL("icu.dll")
	procucptrie_get = icu.NewProc("ucptrie_get")
)

// trie (UCPTrie*), c (INT)
r1, _, err := procucptrie_get.Call(
	uintptr(trie),
	uintptr(c),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ucptrie_get(
  trie: Pointer;   // UCPTrie*
  c: Integer   // INT
): DWORD; cdecl;
  external 'icu.dll' name 'ucptrie_get';
result := DllCall("icu\ucptrie_get"
    , "Ptr", trie   ; UCPTrie*
    , "Int", c   ; INT
    , "Cdecl UInt")   ; return: DWORD
●ucptrie_get(trie, c) = DLL("icu.dll", "dword ucptrie_get(void*, int)")
# 呼び出し: ucptrie_get(trie, c)
# trie : UCPTrie* -> "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 ucptrie_get(
    trie: [*c]UCPTrie, // UCPTrie*
    c: i32 // INT
) callconv(.c) u32;
proc ucptrie_get(
    trie: ptr UCPTrie,  # UCPTrie*
    c: int32  # INT
): uint32 {.importc: "ucptrie_get", cdecl, dynlib: "icu.dll".}
pragma(lib, "icu");
extern(C)
uint ucptrie_get(
    UCPTrie* trie,   // UCPTrie*
    int c   // INT
);
ccall((:ucptrie_get, "icu.dll"), UInt32,
      (Ptr{UCPTrie}, Int32),
      trie, c)
# trie : UCPTrie* -> Ptr{UCPTrie}
# c : INT -> Int32
local ffi = require("ffi")
ffi.cdef[[
uint32_t ucptrie_get(
    void* trie,
    int32_t c);
]]
local icu = ffi.load("icu")
-- icu.ucptrie_get(trie, c)
-- trie : UCPTrie*
-- c : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icu.dll');
const ucptrie_get = lib.func('__cdecl', 'ucptrie_get', 'uint32_t', ['void *', 'int32_t']);
// ucptrie_get(trie, c)
// trie : UCPTrie* -> 'void *'
// c : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icu.dll", {
  ucptrie_get: { parameters: ["pointer", "i32"], result: "u32" },
});
// lib.symbols.ucptrie_get(trie, c)
// trie : UCPTrie* -> "pointer"
// c : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ucptrie_get(
    void* trie,
    int32_t c);
C, "icu.dll");
// $ffi->ucptrie_get(trie, c);
// trie : UCPTrie*
// 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 ucptrie_get(
        Pointer trie,   // UCPTrie*
        int c   // INT
    );
}
@[Link("icu")]
lib Libicu
  fun ucptrie_get = ucptrie_get(
    trie : UCPTrie*,   # UCPTrie*
    c : Int32   # INT
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

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

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

let ucptrie_get =
  foreign "ucptrie_get"
    ((ptr void) @-> int32_t @-> returning uint32_t)
(* trie : UCPTrie* -> (ptr void) *)
(* 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 ("ucptrie_get" ucptrie-get :convention :cdecl) :uint32
  (trie :pointer)   ; UCPTrie*
  (c :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ucptrie_get = Win32::API::More->new('icu',
    'DWORD ucptrie_get(LPVOID trie, int c)');
# my $ret = $ucptrie_get->Call($trie, $c);
# trie : UCPTrie* -> LPVOID
# c : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型