ホーム › Globalization › ucptrie_getValueWidth
ucptrie_getValueWidth
関数コードポイントトライの値ビット幅を取得する。
シグネチャ
// icu.dll
#include <windows.h>
UCPTrieValueWidth ucptrie_getValueWidth(
const UCPTrie* trie
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| trie | UCPTrie* | in | 値の幅を問い合わせる不変トライへのポインタ。 |
戻り値の型: UCPTrieValueWidth
各言語での呼び出し定義
// icu.dll
#include <windows.h>
UCPTrieValueWidth ucptrie_getValueWidth(
const UCPTrie* trie
);[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucptrie_getValueWidth(
IntPtr trie // UCPTrie*
);<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucptrie_getValueWidth(
trie As IntPtr ' UCPTrie*
) As Integer
End Function' trie : UCPTrie*
Declare PtrSafe Function ucptrie_getValueWidth Lib "icu" ( _
ByVal trie As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucptrie_getValueWidth = ctypes.cdll.icu.ucptrie_getValueWidth
ucptrie_getValueWidth.restype = ctypes.c_int
ucptrie_getValueWidth.argtypes = [
ctypes.c_void_p, # trie : UCPTrie*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icu.dll')
ucptrie_getValueWidth = Fiddle::Function.new(
lib['ucptrie_getValueWidth'],
[
Fiddle::TYPE_VOIDP, # trie : UCPTrie*
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icu")]
extern "C" {
fn ucptrie_getValueWidth(
trie: *const UCPTrie // UCPTrie*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icu.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ucptrie_getValueWidth(IntPtr trie);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_ucptrie_getValueWidth' -Namespace Win32 -PassThru
# $api::ucptrie_getValueWidth(trie)#uselib "icu.dll"
#func global ucptrie_getValueWidth "ucptrie_getValueWidth" sptr
; ucptrie_getValueWidth varptr(trie) ; 戻り値は stat
; trie : UCPTrie* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icu.dll" #cfunc global ucptrie_getValueWidth "ucptrie_getValueWidth" var ; res = ucptrie_getValueWidth(trie) ; trie : UCPTrie* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icu.dll" #cfunc global ucptrie_getValueWidth "ucptrie_getValueWidth" sptr ; res = ucptrie_getValueWidth(varptr(trie)) ; trie : UCPTrie* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; UCPTrieValueWidth ucptrie_getValueWidth(UCPTrie* trie) #uselib "icu.dll" #cfunc global ucptrie_getValueWidth "ucptrie_getValueWidth" var ; res = ucptrie_getValueWidth(trie) ; trie : UCPTrie* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; UCPTrieValueWidth ucptrie_getValueWidth(UCPTrie* trie) #uselib "icu.dll" #cfunc global ucptrie_getValueWidth "ucptrie_getValueWidth" intptr ; res = ucptrie_getValueWidth(varptr(trie)) ; trie : UCPTrie* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icu = windows.NewLazySystemDLL("icu.dll")
procucptrie_getValueWidth = icu.NewProc("ucptrie_getValueWidth")
)
// trie (UCPTrie*)
r1, _, err := procucptrie_getValueWidth.Call(
uintptr(trie),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UCPTrieValueWidthfunction ucptrie_getValueWidth(
trie: Pointer // UCPTrie*
): Integer; cdecl;
external 'icu.dll' name 'ucptrie_getValueWidth';result := DllCall("icu\ucptrie_getValueWidth"
, "Ptr", trie ; UCPTrie*
, "Cdecl Int") ; return: UCPTrieValueWidth●ucptrie_getValueWidth(trie) = DLL("icu.dll", "int ucptrie_getValueWidth(void*)")
# 呼び出し: ucptrie_getValueWidth(trie)
# trie : UCPTrie* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icu" fn ucptrie_getValueWidth(
trie: [*c]UCPTrie // UCPTrie*
) callconv(.c) i32;proc ucptrie_getValueWidth(
trie: ptr UCPTrie # UCPTrie*
): int32 {.importc: "ucptrie_getValueWidth", cdecl, dynlib: "icu.dll".}pragma(lib, "icu");
extern(C)
int ucptrie_getValueWidth(
UCPTrie* trie // UCPTrie*
);ccall((:ucptrie_getValueWidth, "icu.dll"), Int32,
(Ptr{UCPTrie},),
trie)
# trie : UCPTrie* -> Ptr{UCPTrie}local ffi = require("ffi")
ffi.cdef[[
int32_t ucptrie_getValueWidth(
void* trie);
]]
local icu = ffi.load("icu")
-- icu.ucptrie_getValueWidth(trie)
-- trie : UCPTrie*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icu.dll');
const ucptrie_getValueWidth = lib.func('__cdecl', 'ucptrie_getValueWidth', 'int32_t', ['void *']);
// ucptrie_getValueWidth(trie)
// trie : UCPTrie* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icu.dll", {
ucptrie_getValueWidth: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.ucptrie_getValueWidth(trie)
// trie : UCPTrie* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ucptrie_getValueWidth(
void* trie);
C, "icu.dll");
// $ffi->ucptrie_getValueWidth(trie);
// trie : UCPTrie*
// 構造体/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_getValueWidth(
Pointer trie // UCPTrie*
);
}@[Link("icu")]
lib Libicu
fun ucptrie_getValueWidth = ucptrie_getValueWidth(
trie : UCPTrie* # UCPTrie*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ucptrie_getValueWidthNative = Int32 Function(Pointer<Void>);
typedef ucptrie_getValueWidthDart = int Function(Pointer<Void>);
final ucptrie_getValueWidth = DynamicLibrary.open('icu.dll')
.lookupFunction<ucptrie_getValueWidthNative, ucptrie_getValueWidthDart>('ucptrie_getValueWidth');
// trie : UCPTrie* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ucptrie_getValueWidth(
trie: Pointer // UCPTrie*
): Integer; cdecl;
external 'icu.dll' name 'ucptrie_getValueWidth';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucptrie_getValueWidth"
c_ucptrie_getValueWidth :: Ptr () -> IO Int32
-- trie : UCPTrie* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ucptrie_getvaluewidth =
foreign "ucptrie_getValueWidth"
((ptr void) @-> returning int32_t)
(* trie : UCPTrie* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icu (t "icu.dll"))
(cffi:use-foreign-library icu)
(cffi:defcfun ("ucptrie_getValueWidth" ucptrie-get-value-width :convention :cdecl) :int32
(trie :pointer)) ; UCPTrie*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ucptrie_getValueWidth = Win32::API::More->new('icu',
'int ucptrie_getValueWidth(LPVOID trie)');
# my $ret = $ucptrie_getValueWidth->Call($trie);
# trie : UCPTrie* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。