ホーム › Globalization › ulocdata_getDelimiter
ulocdata_getDelimiter
関数ロケールの引用符などの区切り文字を取得する。
シグネチャ
// icuin.dll
#include <windows.h>
INT ulocdata_getDelimiter(
ULocaleData* uld,
ULocaleDataDelimiterType type,
WORD* result,
INT resultLength,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| uld | ULocaleData* | inout | 区切り記号を取得する対象のロケールデータオブジェクトのハンドル。 |
| type | ULocaleDataDelimiterType | in | 取得する区切り記号の種別(引用符の開始/終了など)。 |
| result | WORD* | inout | 区切り記号を書き込むUTF-16出力バッファ(WORD配列)。 |
| resultLength | INT | in | resultバッファの容量(UChar単位)。0で必要長を取得する。 |
| status | UErrorCode* | inout | エラーコードへのポインタ。呼び出し前に初期化する必要がある。 |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT ulocdata_getDelimiter(
ULocaleData* uld,
ULocaleDataDelimiterType type,
WORD* result,
INT resultLength,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ulocdata_getDelimiter(
ref IntPtr uld, // ULocaleData* in/out
int type, // ULocaleDataDelimiterType
ref ushort result, // WORD* in/out
int resultLength, // INT
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ulocdata_getDelimiter(
ByRef uld As IntPtr, ' ULocaleData* in/out
type As Integer, ' ULocaleDataDelimiterType
ByRef result As UShort, ' WORD* in/out
resultLength As Integer, ' INT
ByRef status As Integer ' UErrorCode* in/out
) As Integer
End Function' uld : ULocaleData* in/out
' type : ULocaleDataDelimiterType
' result : WORD* in/out
' resultLength : INT
' status : UErrorCode* in/out
Declare PtrSafe Function ulocdata_getDelimiter Lib "icuin" ( _
ByRef uld As LongPtr, _
ByVal type As Long, _
ByRef result As Integer, _
ByVal resultLength As Long, _
ByRef status As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ulocdata_getDelimiter = ctypes.cdll.icuin.ulocdata_getDelimiter
ulocdata_getDelimiter.restype = ctypes.c_int
ulocdata_getDelimiter.argtypes = [
ctypes.c_void_p, # uld : ULocaleData* in/out
ctypes.c_int, # type : ULocaleDataDelimiterType
ctypes.POINTER(ctypes.c_ushort), # result : WORD* in/out
ctypes.c_int, # resultLength : INT
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ulocdata_getDelimiter = Fiddle::Function.new(
lib['ulocdata_getDelimiter'],
[
Fiddle::TYPE_VOIDP, # uld : ULocaleData* in/out
Fiddle::TYPE_INT, # type : ULocaleDataDelimiterType
Fiddle::TYPE_VOIDP, # result : WORD* in/out
Fiddle::TYPE_INT, # resultLength : INT
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ulocdata_getDelimiter(
uld: *mut isize, // ULocaleData* in/out
type: i32, // ULocaleDataDelimiterType
result: *mut u16, // WORD* in/out
resultLength: i32, // INT
status: *mut i32 // UErrorCode* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ulocdata_getDelimiter(ref IntPtr uld, int type, ref ushort result, int resultLength, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ulocdata_getDelimiter' -Namespace Win32 -PassThru
# $api::ulocdata_getDelimiter(uld, type, result, resultLength, status)#uselib "icuin.dll"
#func global ulocdata_getDelimiter "ulocdata_getDelimiter" sptr, sptr, sptr, sptr, sptr
; ulocdata_getDelimiter varptr(uld), type, varptr(result), resultLength, varptr(status) ; 戻り値は stat
; uld : ULocaleData* in/out -> "sptr"
; type : ULocaleDataDelimiterType -> "sptr"
; result : WORD* in/out -> "sptr"
; resultLength : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global ulocdata_getDelimiter "ulocdata_getDelimiter" var, int, var, int, var ; res = ulocdata_getDelimiter(uld, type, result, resultLength, status) ; uld : ULocaleData* in/out -> "var" ; type : ULocaleDataDelimiterType -> "int" ; result : WORD* in/out -> "var" ; resultLength : INT -> "int" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global ulocdata_getDelimiter "ulocdata_getDelimiter" sptr, int, sptr, int, sptr ; res = ulocdata_getDelimiter(varptr(uld), type, varptr(result), resultLength, varptr(status)) ; uld : ULocaleData* in/out -> "sptr" ; type : ULocaleDataDelimiterType -> "int" ; result : WORD* in/out -> "sptr" ; resultLength : INT -> "int" ; status : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ulocdata_getDelimiter(ULocaleData* uld, ULocaleDataDelimiterType type, WORD* result, INT resultLength, UErrorCode* status) #uselib "icuin.dll" #cfunc global ulocdata_getDelimiter "ulocdata_getDelimiter" var, int, var, int, var ; res = ulocdata_getDelimiter(uld, type, result, resultLength, status) ; uld : ULocaleData* in/out -> "var" ; type : ULocaleDataDelimiterType -> "int" ; result : WORD* in/out -> "var" ; resultLength : INT -> "int" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ulocdata_getDelimiter(ULocaleData* uld, ULocaleDataDelimiterType type, WORD* result, INT resultLength, UErrorCode* status) #uselib "icuin.dll" #cfunc global ulocdata_getDelimiter "ulocdata_getDelimiter" intptr, int, intptr, int, intptr ; res = ulocdata_getDelimiter(varptr(uld), type, varptr(result), resultLength, varptr(status)) ; uld : ULocaleData* in/out -> "intptr" ; type : ULocaleDataDelimiterType -> "int" ; result : WORD* in/out -> "intptr" ; resultLength : INT -> "int" ; status : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
proculocdata_getDelimiter = icuin.NewProc("ulocdata_getDelimiter")
)
// uld (ULocaleData* in/out), type (ULocaleDataDelimiterType), result (WORD* in/out), resultLength (INT), status (UErrorCode* in/out)
r1, _, err := proculocdata_getDelimiter.Call(
uintptr(uld),
uintptr(type),
uintptr(result),
uintptr(resultLength),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ulocdata_getDelimiter(
uld: Pointer; // ULocaleData* in/out
type: Integer; // ULocaleDataDelimiterType
result: Pointer; // WORD* in/out
resultLength: Integer; // INT
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'ulocdata_getDelimiter';result := DllCall("icuin\ulocdata_getDelimiter"
, "Ptr", uld ; ULocaleData* in/out
, "Int", type ; ULocaleDataDelimiterType
, "Ptr", result ; WORD* in/out
, "Int", resultLength ; INT
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●ulocdata_getDelimiter(uld, type, result, resultLength, status) = DLL("icuin.dll", "int ulocdata_getDelimiter(void*, int, void*, int, void*)")
# 呼び出し: ulocdata_getDelimiter(uld, type, result, resultLength, status)
# uld : ULocaleData* in/out -> "void*"
# type : ULocaleDataDelimiterType -> "int"
# result : WORD* in/out -> "void*"
# resultLength : INT -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuin" fn ulocdata_getDelimiter(
uld: [*c]isize, // ULocaleData* in/out
type: i32, // ULocaleDataDelimiterType
result: [*c]u16, // WORD* in/out
resultLength: i32, // INT
status: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;proc ulocdata_getDelimiter(
uld: ptr int, # ULocaleData* in/out
`type`: int32, # ULocaleDataDelimiterType
result: ptr uint16, # WORD* in/out
resultLength: int32, # INT
status: ptr int32 # UErrorCode* in/out
): int32 {.importc: "ulocdata_getDelimiter", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
int ulocdata_getDelimiter(
ptrdiff_t* uld, // ULocaleData* in/out
int type, // ULocaleDataDelimiterType
ushort* result, // WORD* in/out
int resultLength, // INT
int* status // UErrorCode* in/out
);ccall((:ulocdata_getDelimiter, "icuin.dll"), Int32,
(Ptr{Int}, Int32, Ptr{UInt16}, Int32, Ptr{Int32}),
uld, type, result, resultLength, status)
# uld : ULocaleData* in/out -> Ptr{Int}
# type : ULocaleDataDelimiterType -> Int32
# result : WORD* in/out -> Ptr{UInt16}
# resultLength : INT -> Int32
# status : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
int32_t ulocdata_getDelimiter(
intptr_t* uld,
int32_t type,
uint16_t* result,
int32_t resultLength,
int32_t* status);
]]
local icuin = ffi.load("icuin")
-- icuin.ulocdata_getDelimiter(uld, type, result, resultLength, status)
-- uld : ULocaleData* in/out
-- type : ULocaleDataDelimiterType
-- result : WORD* in/out
-- resultLength : INT
-- status : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const ulocdata_getDelimiter = lib.func('__cdecl', 'ulocdata_getDelimiter', 'int32_t', ['intptr_t *', 'int32_t', 'uint16_t *', 'int32_t', 'int32_t *']);
// ulocdata_getDelimiter(uld, type, result, resultLength, status)
// uld : ULocaleData* in/out -> 'intptr_t *'
// type : ULocaleDataDelimiterType -> 'int32_t'
// result : WORD* in/out -> 'uint16_t *'
// resultLength : INT -> 'int32_t'
// status : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
ulocdata_getDelimiter: { parameters: ["pointer", "i32", "pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.ulocdata_getDelimiter(uld, type, result, resultLength, status)
// uld : ULocaleData* in/out -> "pointer"
// type : ULocaleDataDelimiterType -> "i32"
// result : WORD* in/out -> "pointer"
// resultLength : INT -> "i32"
// status : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ulocdata_getDelimiter(
intptr_t* uld,
int32_t type,
uint16_t* result,
int32_t resultLength,
int32_t* status);
C, "icuin.dll");
// $ffi->ulocdata_getDelimiter(uld, type, result, resultLength, status);
// uld : ULocaleData* in/out
// type : ULocaleDataDelimiterType
// result : WORD* in/out
// resultLength : INT
// status : UErrorCode* in/out
// 構造体/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 Icuin extends Library {
Icuin INSTANCE = Native.load("icuin", Icuin.class);
int ulocdata_getDelimiter(
LongByReference uld, // ULocaleData* in/out
int type, // ULocaleDataDelimiterType
ShortByReference result, // WORD* in/out
int resultLength, // INT
IntByReference status // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun ulocdata_getDelimiter = ulocdata_getDelimiter(
uld : LibC::SSizeT*, # ULocaleData* in/out
type_ : Int32, # ULocaleDataDelimiterType
result : UInt16*, # WORD* in/out
resultLength : Int32, # INT
status : Int32* # UErrorCode* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ulocdata_getDelimiterNative = Int32 Function(Pointer<IntPtr>, Int32, Pointer<Uint16>, Int32, Pointer<Int32>);
typedef ulocdata_getDelimiterDart = int Function(Pointer<IntPtr>, int, Pointer<Uint16>, int, Pointer<Int32>);
final ulocdata_getDelimiter = DynamicLibrary.open('icuin.dll')
.lookupFunction<ulocdata_getDelimiterNative, ulocdata_getDelimiterDart>('ulocdata_getDelimiter');
// uld : ULocaleData* in/out -> Pointer<IntPtr>
// type : ULocaleDataDelimiterType -> Int32
// result : WORD* in/out -> Pointer<Uint16>
// resultLength : INT -> Int32
// status : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ulocdata_getDelimiter(
uld: Pointer; // ULocaleData* in/out
type: Integer; // ULocaleDataDelimiterType
result: Pointer; // WORD* in/out
resultLength: Integer; // INT
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'ulocdata_getDelimiter';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ulocdata_getDelimiter"
c_ulocdata_getDelimiter :: Ptr CIntPtr -> Int32 -> Ptr Word16 -> Int32 -> Ptr Int32 -> IO Int32
-- uld : ULocaleData* in/out -> Ptr CIntPtr
-- type : ULocaleDataDelimiterType -> Int32
-- result : WORD* in/out -> Ptr Word16
-- resultLength : INT -> Int32
-- status : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ulocdata_getdelimiter =
foreign "ulocdata_getDelimiter"
((ptr intptr_t) @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* uld : ULocaleData* in/out -> (ptr intptr_t) *)
(* type : ULocaleDataDelimiterType -> int32_t *)
(* result : WORD* in/out -> (ptr uint16_t) *)
(* resultLength : INT -> int32_t *)
(* status : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)
(cffi:defcfun ("ulocdata_getDelimiter" ulocdata-get-delimiter :convention :cdecl) :int32
(uld :pointer) ; ULocaleData* in/out
(type :int32) ; ULocaleDataDelimiterType
(result :pointer) ; WORD* in/out
(result-length :int32) ; INT
(status :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ulocdata_getDelimiter = Win32::API::More->new('icuin',
'int ulocdata_getDelimiter(LPVOID uld, int type, LPVOID result, int resultLength, LPVOID status)');
# my $ret = $ulocdata_getDelimiter->Call($uld, $type, $result, $resultLength, $status);
# uld : ULocaleData* in/out -> LPVOID
# type : ULocaleDataDelimiterType -> int
# result : WORD* in/out -> LPVOID
# resultLength : INT -> int
# status : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。