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