ホーム › Globalization › ubidi_getParagraph
ubidi_getParagraph
関数指定文字位置が属する段落の範囲とレベルを取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
INT ubidi_getParagraph(
const UBiDi* pBiDi,
INT charIndex,
INT* pParaStart,
INT* pParaLimit,
BYTE* pParaLevel,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pBiDi | UBiDi* | in | 対象のUBiDiオブジェクトへのポインタ。 |
| charIndex | INT | in | 段落を特定するための文字インデックス。 |
| pParaStart | INT* | inout | 段落の開始インデックスを受け取る出力ポインタ。NULL可。 |
| pParaLimit | INT* | inout | 段落の終了(上限)インデックスを受け取る出力ポインタ。NULL可。 |
| pParaLevel | BYTE* | inout | 段落レベルを受け取る出力ポインタ。NULL可。 |
| pErrorCode | UErrorCode* | inout | ICUのエラーコードを受け渡すポインタ。呼び出し前にU_ZERO_ERRORで初期化する。 |
戻り値の型: INT
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
INT ubidi_getParagraph(
const UBiDi* pBiDi,
INT charIndex,
INT* pParaStart,
INT* pParaLimit,
BYTE* pParaLevel,
UErrorCode* pErrorCode
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ubidi_getParagraph(
ref IntPtr pBiDi, // UBiDi*
int charIndex, // INT
ref int pParaStart, // INT* in/out
ref int pParaLimit, // INT* in/out
IntPtr pParaLevel, // BYTE* in/out
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ubidi_getParagraph(
ByRef pBiDi As IntPtr, ' UBiDi*
charIndex As Integer, ' INT
ByRef pParaStart As Integer, ' INT* in/out
ByRef pParaLimit As Integer, ' INT* in/out
pParaLevel As IntPtr, ' BYTE* in/out
ByRef pErrorCode As Integer ' UErrorCode* in/out
) As Integer
End Function' pBiDi : UBiDi*
' charIndex : INT
' pParaStart : INT* in/out
' pParaLimit : INT* in/out
' pParaLevel : BYTE* in/out
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function ubidi_getParagraph Lib "icuuc" ( _
ByRef pBiDi As LongPtr, _
ByVal charIndex As Long, _
ByRef pParaStart As Long, _
ByRef pParaLimit As Long, _
ByVal pParaLevel As LongPtr, _
ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ubidi_getParagraph = ctypes.cdll.icuuc.ubidi_getParagraph
ubidi_getParagraph.restype = ctypes.c_int
ubidi_getParagraph.argtypes = [
ctypes.c_void_p, # pBiDi : UBiDi*
ctypes.c_int, # charIndex : INT
ctypes.POINTER(ctypes.c_int), # pParaStart : INT* in/out
ctypes.POINTER(ctypes.c_int), # pParaLimit : INT* in/out
ctypes.POINTER(ctypes.c_ubyte), # pParaLevel : BYTE* in/out
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ubidi_getParagraph = Fiddle::Function.new(
lib['ubidi_getParagraph'],
[
Fiddle::TYPE_VOIDP, # pBiDi : UBiDi*
Fiddle::TYPE_INT, # charIndex : INT
Fiddle::TYPE_VOIDP, # pParaStart : INT* in/out
Fiddle::TYPE_VOIDP, # pParaLimit : INT* in/out
Fiddle::TYPE_VOIDP, # pParaLevel : BYTE* in/out
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ubidi_getParagraph(
pBiDi: *const isize, // UBiDi*
charIndex: i32, // INT
pParaStart: *mut i32, // INT* in/out
pParaLimit: *mut i32, // INT* in/out
pParaLevel: *mut u8, // BYTE* in/out
pErrorCode: *mut i32 // UErrorCode* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ubidi_getParagraph(ref IntPtr pBiDi, int charIndex, ref int pParaStart, ref int pParaLimit, IntPtr pParaLevel, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ubidi_getParagraph' -Namespace Win32 -PassThru
# $api::ubidi_getParagraph(pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode)#uselib "icuuc.dll"
#func global ubidi_getParagraph "ubidi_getParagraph" sptr, sptr, sptr, sptr, sptr, sptr
; ubidi_getParagraph varptr(pBiDi), charIndex, varptr(pParaStart), varptr(pParaLimit), varptr(pParaLevel), varptr(pErrorCode) ; 戻り値は stat
; pBiDi : UBiDi* -> "sptr"
; charIndex : INT -> "sptr"
; pParaStart : INT* in/out -> "sptr"
; pParaLimit : INT* in/out -> "sptr"
; pParaLevel : BYTE* in/out -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global ubidi_getParagraph "ubidi_getParagraph" var, int, var, var, var, var ; res = ubidi_getParagraph(pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode) ; pBiDi : UBiDi* -> "var" ; charIndex : INT -> "int" ; pParaStart : INT* in/out -> "var" ; pParaLimit : INT* in/out -> "var" ; pParaLevel : BYTE* in/out -> "var" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global ubidi_getParagraph "ubidi_getParagraph" sptr, int, sptr, sptr, sptr, sptr ; res = ubidi_getParagraph(varptr(pBiDi), charIndex, varptr(pParaStart), varptr(pParaLimit), varptr(pParaLevel), varptr(pErrorCode)) ; pBiDi : UBiDi* -> "sptr" ; charIndex : INT -> "int" ; pParaStart : INT* in/out -> "sptr" ; pParaLimit : INT* in/out -> "sptr" ; pParaLevel : BYTE* in/out -> "sptr" ; pErrorCode : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ubidi_getParagraph(UBiDi* pBiDi, INT charIndex, INT* pParaStart, INT* pParaLimit, BYTE* pParaLevel, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global ubidi_getParagraph "ubidi_getParagraph" var, int, var, var, var, var ; res = ubidi_getParagraph(pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode) ; pBiDi : UBiDi* -> "var" ; charIndex : INT -> "int" ; pParaStart : INT* in/out -> "var" ; pParaLimit : INT* in/out -> "var" ; pParaLevel : BYTE* in/out -> "var" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ubidi_getParagraph(UBiDi* pBiDi, INT charIndex, INT* pParaStart, INT* pParaLimit, BYTE* pParaLevel, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global ubidi_getParagraph "ubidi_getParagraph" intptr, int, intptr, intptr, intptr, intptr ; res = ubidi_getParagraph(varptr(pBiDi), charIndex, varptr(pParaStart), varptr(pParaLimit), varptr(pParaLevel), varptr(pErrorCode)) ; pBiDi : UBiDi* -> "intptr" ; charIndex : INT -> "int" ; pParaStart : INT* in/out -> "intptr" ; pParaLimit : INT* in/out -> "intptr" ; pParaLevel : BYTE* in/out -> "intptr" ; pErrorCode : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procubidi_getParagraph = icuuc.NewProc("ubidi_getParagraph")
)
// pBiDi (UBiDi*), charIndex (INT), pParaStart (INT* in/out), pParaLimit (INT* in/out), pParaLevel (BYTE* in/out), pErrorCode (UErrorCode* in/out)
r1, _, err := procubidi_getParagraph.Call(
uintptr(pBiDi),
uintptr(charIndex),
uintptr(pParaStart),
uintptr(pParaLimit),
uintptr(pParaLevel),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ubidi_getParagraph(
pBiDi: Pointer; // UBiDi*
charIndex: Integer; // INT
pParaStart: Pointer; // INT* in/out
pParaLimit: Pointer; // INT* in/out
pParaLevel: Pointer; // BYTE* in/out
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuuc.dll' name 'ubidi_getParagraph';result := DllCall("icuuc\ubidi_getParagraph"
, "Ptr", pBiDi ; UBiDi*
, "Int", charIndex ; INT
, "Ptr", pParaStart ; INT* in/out
, "Ptr", pParaLimit ; INT* in/out
, "Ptr", pParaLevel ; BYTE* in/out
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●ubidi_getParagraph(pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode) = DLL("icuuc.dll", "int ubidi_getParagraph(void*, int, void*, void*, void*, void*)")
# 呼び出し: ubidi_getParagraph(pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode)
# pBiDi : UBiDi* -> "void*"
# charIndex : INT -> "int"
# pParaStart : INT* in/out -> "void*"
# pParaLimit : INT* in/out -> "void*"
# pParaLevel : BYTE* in/out -> "void*"
# pErrorCode : 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 "icuuc" fn ubidi_getParagraph(
pBiDi: [*c]isize, // UBiDi*
charIndex: i32, // INT
pParaStart: [*c]i32, // INT* in/out
pParaLimit: [*c]i32, // INT* in/out
pParaLevel: [*c]u8, // BYTE* in/out
pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;proc ubidi_getParagraph(
pBiDi: ptr int, # UBiDi*
charIndex: int32, # INT
pParaStart: ptr int32, # INT* in/out
pParaLimit: ptr int32, # INT* in/out
pParaLevel: ptr uint8, # BYTE* in/out
pErrorCode: ptr int32 # UErrorCode* in/out
): int32 {.importc: "ubidi_getParagraph", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
int ubidi_getParagraph(
ptrdiff_t* pBiDi, // UBiDi*
int charIndex, // INT
int* pParaStart, // INT* in/out
int* pParaLimit, // INT* in/out
ubyte* pParaLevel, // BYTE* in/out
int* pErrorCode // UErrorCode* in/out
);ccall((:ubidi_getParagraph, "icuuc.dll"), Int32,
(Ptr{Int}, Int32, Ptr{Int32}, Ptr{Int32}, Ptr{UInt8}, Ptr{Int32}),
pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode)
# pBiDi : UBiDi* -> Ptr{Int}
# charIndex : INT -> Int32
# pParaStart : INT* in/out -> Ptr{Int32}
# pParaLimit : INT* in/out -> Ptr{Int32}
# pParaLevel : BYTE* in/out -> Ptr{UInt8}
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
int32_t ubidi_getParagraph(
intptr_t* pBiDi,
int32_t charIndex,
int32_t* pParaStart,
int32_t* pParaLimit,
uint8_t* pParaLevel,
int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.ubidi_getParagraph(pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode)
-- pBiDi : UBiDi*
-- charIndex : INT
-- pParaStart : INT* in/out
-- pParaLimit : INT* in/out
-- pParaLevel : BYTE* in/out
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const ubidi_getParagraph = lib.func('__cdecl', 'ubidi_getParagraph', 'int32_t', ['intptr_t *', 'int32_t', 'int32_t *', 'int32_t *', 'uint8_t *', 'int32_t *']);
// ubidi_getParagraph(pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode)
// pBiDi : UBiDi* -> 'intptr_t *'
// charIndex : INT -> 'int32_t'
// pParaStart : INT* in/out -> 'int32_t *'
// pParaLimit : INT* in/out -> 'int32_t *'
// pParaLevel : BYTE* in/out -> 'uint8_t *'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
ubidi_getParagraph: { parameters: ["pointer", "i32", "pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.ubidi_getParagraph(pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode)
// pBiDi : UBiDi* -> "pointer"
// charIndex : INT -> "i32"
// pParaStart : INT* in/out -> "pointer"
// pParaLimit : INT* in/out -> "pointer"
// pParaLevel : BYTE* in/out -> "pointer"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ubidi_getParagraph(
intptr_t* pBiDi,
int32_t charIndex,
int32_t* pParaStart,
int32_t* pParaLimit,
uint8_t* pParaLevel,
int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->ubidi_getParagraph(pBiDi, charIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode);
// pBiDi : UBiDi*
// charIndex : INT
// pParaStart : INT* in/out
// pParaLimit : INT* in/out
// pParaLevel : BYTE* in/out
// pErrorCode : 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 Icuuc extends Library {
Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
int ubidi_getParagraph(
LongByReference pBiDi, // UBiDi*
int charIndex, // INT
IntByReference pParaStart, // INT* in/out
IntByReference pParaLimit, // INT* in/out
byte[] pParaLevel, // BYTE* in/out
IntByReference pErrorCode // UErrorCode* in/out
);
}@[Link("icuuc")]
lib Libicuuc
fun ubidi_getParagraph = ubidi_getParagraph(
pBiDi : LibC::SSizeT*, # UBiDi*
charIndex : Int32, # INT
pParaStart : Int32*, # INT* in/out
pParaLimit : Int32*, # INT* in/out
pParaLevel : UInt8*, # BYTE* in/out
pErrorCode : Int32* # UErrorCode* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ubidi_getParagraphNative = Int32 Function(Pointer<IntPtr>, Int32, Pointer<Int32>, Pointer<Int32>, Pointer<Uint8>, Pointer<Int32>);
typedef ubidi_getParagraphDart = int Function(Pointer<IntPtr>, int, Pointer<Int32>, Pointer<Int32>, Pointer<Uint8>, Pointer<Int32>);
final ubidi_getParagraph = DynamicLibrary.open('icuuc.dll')
.lookupFunction<ubidi_getParagraphNative, ubidi_getParagraphDart>('ubidi_getParagraph');
// pBiDi : UBiDi* -> Pointer<IntPtr>
// charIndex : INT -> Int32
// pParaStart : INT* in/out -> Pointer<Int32>
// pParaLimit : INT* in/out -> Pointer<Int32>
// pParaLevel : BYTE* in/out -> Pointer<Uint8>
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ubidi_getParagraph(
pBiDi: Pointer; // UBiDi*
charIndex: Integer; // INT
pParaStart: Pointer; // INT* in/out
pParaLimit: Pointer; // INT* in/out
pParaLevel: Pointer; // BYTE* in/out
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuuc.dll' name 'ubidi_getParagraph';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ubidi_getParagraph"
c_ubidi_getParagraph :: Ptr CIntPtr -> Int32 -> Ptr Int32 -> Ptr Int32 -> Ptr Word8 -> Ptr Int32 -> IO Int32
-- pBiDi : UBiDi* -> Ptr CIntPtr
-- charIndex : INT -> Int32
-- pParaStart : INT* in/out -> Ptr Int32
-- pParaLimit : INT* in/out -> Ptr Int32
-- pParaLevel : BYTE* in/out -> Ptr Word8
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ubidi_getparagraph =
foreign "ubidi_getParagraph"
((ptr intptr_t) @-> int32_t @-> (ptr int32_t) @-> (ptr int32_t) @-> (ptr uint8_t) @-> (ptr int32_t) @-> returning int32_t)
(* pBiDi : UBiDi* -> (ptr intptr_t) *)
(* charIndex : INT -> int32_t *)
(* pParaStart : INT* in/out -> (ptr int32_t) *)
(* pParaLimit : INT* in/out -> (ptr int32_t) *)
(* pParaLevel : BYTE* in/out -> (ptr uint8_t) *)
(* pErrorCode : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)
(cffi:defcfun ("ubidi_getParagraph" ubidi-get-paragraph :convention :cdecl) :int32
(p-bi-di :pointer) ; UBiDi*
(char-index :int32) ; INT
(p-para-start :pointer) ; INT* in/out
(p-para-limit :pointer) ; INT* in/out
(p-para-level :pointer) ; BYTE* in/out
(p-error-code :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ubidi_getParagraph = Win32::API::More->new('icuuc',
'int ubidi_getParagraph(LPVOID pBiDi, int charIndex, LPVOID pParaStart, LPVOID pParaLimit, LPVOID pParaLevel, LPVOID pErrorCode)');
# my $ret = $ubidi_getParagraph->Call($pBiDi, $charIndex, $pParaStart, $pParaLimit, $pParaLevel, $pErrorCode);
# pBiDi : UBiDi* -> LPVOID
# charIndex : INT -> int
# pParaStart : INT* in/out -> LPVOID
# pParaLimit : INT* in/out -> LPVOID
# pParaLevel : BYTE* in/out -> LPVOID
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型