ホーム › Globalization › ubidi_setPara
ubidi_setPara
関数段落テキストを設定し双方向解析を行う。
シグネチャ
// icuuc.dll
#include <windows.h>
void ubidi_setPara(
UBiDi* pBiDi,
const WORD* text,
INT length,
BYTE paraLevel,
BYTE* embeddingLevels,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pBiDi | UBiDi* | inout |
| text | WORD* | in |
| length | INT | in |
| paraLevel | BYTE | in |
| embeddingLevels | BYTE* | inout |
| pErrorCode | UErrorCode* | inout |
戻り値の型: void
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
void ubidi_setPara(
UBiDi* pBiDi,
const WORD* text,
INT length,
BYTE paraLevel,
BYTE* embeddingLevels,
UErrorCode* pErrorCode
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ubidi_setPara(
ref IntPtr pBiDi, // UBiDi* in/out
ref ushort text, // WORD*
int length, // INT
byte paraLevel, // BYTE
IntPtr embeddingLevels, // BYTE* in/out
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ubidi_setPara(
ByRef pBiDi As IntPtr, ' UBiDi* in/out
ByRef text As UShort, ' WORD*
length As Integer, ' INT
paraLevel As Byte, ' BYTE
embeddingLevels As IntPtr, ' BYTE* in/out
ByRef pErrorCode As Integer ' UErrorCode* in/out
)
End Sub' pBiDi : UBiDi* in/out
' text : WORD*
' length : INT
' paraLevel : BYTE
' embeddingLevels : BYTE* in/out
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Sub ubidi_setPara Lib "icuuc" ( _
ByRef pBiDi As LongPtr, _
ByRef text As Integer, _
ByVal length As Long, _
ByVal paraLevel As Byte, _
ByVal embeddingLevels As LongPtr, _
ByRef pErrorCode As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ubidi_setPara = ctypes.cdll.icuuc.ubidi_setPara
ubidi_setPara.restype = None
ubidi_setPara.argtypes = [
ctypes.c_void_p, # pBiDi : UBiDi* in/out
ctypes.POINTER(ctypes.c_ushort), # text : WORD*
ctypes.c_int, # length : INT
ctypes.c_ubyte, # paraLevel : BYTE
ctypes.POINTER(ctypes.c_ubyte), # embeddingLevels : BYTE* in/out
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ubidi_setPara = Fiddle::Function.new(
lib['ubidi_setPara'],
[
Fiddle::TYPE_VOIDP, # pBiDi : UBiDi* in/out
Fiddle::TYPE_VOIDP, # text : WORD*
Fiddle::TYPE_INT, # length : INT
-Fiddle::TYPE_CHAR, # paraLevel : BYTE
Fiddle::TYPE_VOIDP, # embeddingLevels : BYTE* in/out
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ubidi_setPara(
pBiDi: *mut isize, // UBiDi* in/out
text: *const u16, // WORD*
length: i32, // INT
paraLevel: u8, // BYTE
embeddingLevels: *mut u8, // BYTE* in/out
pErrorCode: *mut i32 // UErrorCode* in/out
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ubidi_setPara(ref IntPtr pBiDi, ref ushort text, int length, byte paraLevel, IntPtr embeddingLevels, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ubidi_setPara' -Namespace Win32 -PassThru
# $api::ubidi_setPara(pBiDi, text, length, paraLevel, embeddingLevels, pErrorCode)#uselib "icuuc.dll"
#func global ubidi_setPara "ubidi_setPara" sptr, sptr, sptr, sptr, sptr, sptr
; ubidi_setPara pBiDi, varptr(text), length, paraLevel, varptr(embeddingLevels), pErrorCode
; pBiDi : UBiDi* in/out -> "sptr"
; text : WORD* -> "sptr"
; length : INT -> "sptr"
; paraLevel : BYTE -> "sptr"
; embeddingLevels : BYTE* in/out -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"出力引数:
#uselib "icuuc.dll" #func global ubidi_setPara "ubidi_setPara" int, var, int, int, var, int ; ubidi_setPara pBiDi, text, length, paraLevel, embeddingLevels, pErrorCode ; pBiDi : UBiDi* in/out -> "int" ; text : WORD* -> "var" ; length : INT -> "int" ; paraLevel : BYTE -> "int" ; embeddingLevels : BYTE* in/out -> "var" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #func global ubidi_setPara "ubidi_setPara" int, sptr, int, int, sptr, int ; ubidi_setPara pBiDi, varptr(text), length, paraLevel, varptr(embeddingLevels), pErrorCode ; pBiDi : UBiDi* in/out -> "int" ; text : WORD* -> "sptr" ; length : INT -> "int" ; paraLevel : BYTE -> "int" ; embeddingLevels : BYTE* in/out -> "sptr" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void ubidi_setPara(UBiDi* pBiDi, WORD* text, INT length, BYTE paraLevel, BYTE* embeddingLevels, UErrorCode* pErrorCode) #uselib "icuuc.dll" #func global ubidi_setPara "ubidi_setPara" int, var, int, int, var, int ; ubidi_setPara pBiDi, text, length, paraLevel, embeddingLevels, pErrorCode ; pBiDi : UBiDi* in/out -> "int" ; text : WORD* -> "var" ; length : INT -> "int" ; paraLevel : BYTE -> "int" ; embeddingLevels : BYTE* in/out -> "var" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void ubidi_setPara(UBiDi* pBiDi, WORD* text, INT length, BYTE paraLevel, BYTE* embeddingLevels, UErrorCode* pErrorCode) #uselib "icuuc.dll" #func global ubidi_setPara "ubidi_setPara" int, intptr, int, int, intptr, int ; ubidi_setPara pBiDi, varptr(text), length, paraLevel, varptr(embeddingLevels), pErrorCode ; pBiDi : UBiDi* in/out -> "int" ; text : WORD* -> "intptr" ; length : INT -> "int" ; paraLevel : BYTE -> "int" ; embeddingLevels : BYTE* in/out -> "intptr" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procubidi_setPara = icuuc.NewProc("ubidi_setPara")
)
// pBiDi (UBiDi* in/out), text (WORD*), length (INT), paraLevel (BYTE), embeddingLevels (BYTE* in/out), pErrorCode (UErrorCode* in/out)
r1, _, err := procubidi_setPara.Call(
uintptr(pBiDi),
uintptr(text),
uintptr(length),
uintptr(paraLevel),
uintptr(embeddingLevels),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ubidi_setPara(
pBiDi: Pointer; // UBiDi* in/out
text: Pointer; // WORD*
length: Integer; // INT
paraLevel: Byte; // BYTE
embeddingLevels: Pointer; // BYTE* in/out
pErrorCode: Pointer // UErrorCode* in/out
); cdecl;
external 'icuuc.dll' name 'ubidi_setPara';result := DllCall("icuuc\ubidi_setPara"
, "Ptr", pBiDi ; UBiDi* in/out
, "Ptr", text ; WORD*
, "Int", length ; INT
, "UChar", paraLevel ; BYTE
, "Ptr", embeddingLevels ; BYTE* in/out
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: void●ubidi_setPara(pBiDi, text, length, paraLevel, embeddingLevels, pErrorCode) = DLL("icuuc.dll", "int ubidi_setPara(void*, void*, int, byte, void*, void*)")
# 呼び出し: ubidi_setPara(pBiDi, text, length, paraLevel, embeddingLevels, pErrorCode)
# pBiDi : UBiDi* in/out -> "void*"
# text : WORD* -> "void*"
# length : INT -> "int"
# paraLevel : BYTE -> "byte"
# embeddingLevels : 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`,…) を使用。