ホーム › Globalization › ubidi_setContext
ubidi_setContext
関数双方向処理の前後コンテキスト文字列を設定する。
シグネチャ
// icuuc.dll
#include <windows.h>
void ubidi_setContext(
UBiDi* pBiDi,
const WORD* prologue,
INT proLength,
const WORD* epilogue,
INT epiLength,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pBiDi | UBiDi* | inout |
| prologue | WORD* | in |
| proLength | INT | in |
| epilogue | WORD* | in |
| epiLength | INT | in |
| pErrorCode | UErrorCode* | inout |
戻り値の型: void
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
void ubidi_setContext(
UBiDi* pBiDi,
const WORD* prologue,
INT proLength,
const WORD* epilogue,
INT epiLength,
UErrorCode* pErrorCode
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ubidi_setContext(
ref IntPtr pBiDi, // UBiDi* in/out
ref ushort prologue, // WORD*
int proLength, // INT
ref ushort epilogue, // WORD*
int epiLength, // INT
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ubidi_setContext(
ByRef pBiDi As IntPtr, ' UBiDi* in/out
ByRef prologue As UShort, ' WORD*
proLength As Integer, ' INT
ByRef epilogue As UShort, ' WORD*
epiLength As Integer, ' INT
ByRef pErrorCode As Integer ' UErrorCode* in/out
)
End Sub' pBiDi : UBiDi* in/out
' prologue : WORD*
' proLength : INT
' epilogue : WORD*
' epiLength : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Sub ubidi_setContext Lib "icuuc" ( _
ByRef pBiDi As LongPtr, _
ByRef prologue As Integer, _
ByVal proLength As Long, _
ByRef epilogue As Integer, _
ByVal epiLength As Long, _
ByRef pErrorCode As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ubidi_setContext = ctypes.cdll.icuuc.ubidi_setContext
ubidi_setContext.restype = None
ubidi_setContext.argtypes = [
ctypes.c_void_p, # pBiDi : UBiDi* in/out
ctypes.POINTER(ctypes.c_ushort), # prologue : WORD*
ctypes.c_int, # proLength : INT
ctypes.POINTER(ctypes.c_ushort), # epilogue : WORD*
ctypes.c_int, # epiLength : INT
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ubidi_setContext = Fiddle::Function.new(
lib['ubidi_setContext'],
[
Fiddle::TYPE_VOIDP, # pBiDi : UBiDi* in/out
Fiddle::TYPE_VOIDP, # prologue : WORD*
Fiddle::TYPE_INT, # proLength : INT
Fiddle::TYPE_VOIDP, # epilogue : WORD*
Fiddle::TYPE_INT, # epiLength : INT
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ubidi_setContext(
pBiDi: *mut isize, // UBiDi* in/out
prologue: *const u16, // WORD*
proLength: i32, // INT
epilogue: *const u16, // WORD*
epiLength: i32, // INT
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_setContext(ref IntPtr pBiDi, ref ushort prologue, int proLength, ref ushort epilogue, int epiLength, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ubidi_setContext' -Namespace Win32 -PassThru
# $api::ubidi_setContext(pBiDi, prologue, proLength, epilogue, epiLength, pErrorCode)#uselib "icuuc.dll"
#func global ubidi_setContext "ubidi_setContext" sptr, sptr, sptr, sptr, sptr, sptr
; ubidi_setContext pBiDi, varptr(prologue), proLength, varptr(epilogue), epiLength, pErrorCode
; pBiDi : UBiDi* in/out -> "sptr"
; prologue : WORD* -> "sptr"
; proLength : INT -> "sptr"
; epilogue : WORD* -> "sptr"
; epiLength : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"出力引数:
#uselib "icuuc.dll" #func global ubidi_setContext "ubidi_setContext" int, var, int, var, int, int ; ubidi_setContext pBiDi, prologue, proLength, epilogue, epiLength, pErrorCode ; pBiDi : UBiDi* in/out -> "int" ; prologue : WORD* -> "var" ; proLength : INT -> "int" ; epilogue : WORD* -> "var" ; epiLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #func global ubidi_setContext "ubidi_setContext" int, sptr, int, sptr, int, int ; ubidi_setContext pBiDi, varptr(prologue), proLength, varptr(epilogue), epiLength, pErrorCode ; pBiDi : UBiDi* in/out -> "int" ; prologue : WORD* -> "sptr" ; proLength : INT -> "int" ; epilogue : WORD* -> "sptr" ; epiLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void ubidi_setContext(UBiDi* pBiDi, WORD* prologue, INT proLength, WORD* epilogue, INT epiLength, UErrorCode* pErrorCode) #uselib "icuuc.dll" #func global ubidi_setContext "ubidi_setContext" int, var, int, var, int, int ; ubidi_setContext pBiDi, prologue, proLength, epilogue, epiLength, pErrorCode ; pBiDi : UBiDi* in/out -> "int" ; prologue : WORD* -> "var" ; proLength : INT -> "int" ; epilogue : WORD* -> "var" ; epiLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void ubidi_setContext(UBiDi* pBiDi, WORD* prologue, INT proLength, WORD* epilogue, INT epiLength, UErrorCode* pErrorCode) #uselib "icuuc.dll" #func global ubidi_setContext "ubidi_setContext" int, intptr, int, intptr, int, int ; ubidi_setContext pBiDi, varptr(prologue), proLength, varptr(epilogue), epiLength, pErrorCode ; pBiDi : UBiDi* in/out -> "int" ; prologue : WORD* -> "intptr" ; proLength : INT -> "int" ; epilogue : WORD* -> "intptr" ; epiLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procubidi_setContext = icuuc.NewProc("ubidi_setContext")
)
// pBiDi (UBiDi* in/out), prologue (WORD*), proLength (INT), epilogue (WORD*), epiLength (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := procubidi_setContext.Call(
uintptr(pBiDi),
uintptr(prologue),
uintptr(proLength),
uintptr(epilogue),
uintptr(epiLength),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ubidi_setContext(
pBiDi: Pointer; // UBiDi* in/out
prologue: Pointer; // WORD*
proLength: Integer; // INT
epilogue: Pointer; // WORD*
epiLength: Integer; // INT
pErrorCode: Pointer // UErrorCode* in/out
); cdecl;
external 'icuuc.dll' name 'ubidi_setContext';result := DllCall("icuuc\ubidi_setContext"
, "Ptr", pBiDi ; UBiDi* in/out
, "Ptr", prologue ; WORD*
, "Int", proLength ; INT
, "Ptr", epilogue ; WORD*
, "Int", epiLength ; INT
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: void●ubidi_setContext(pBiDi, prologue, proLength, epilogue, epiLength, pErrorCode) = DLL("icuuc.dll", "int ubidi_setContext(void*, void*, int, void*, int, void*)")
# 呼び出し: ubidi_setContext(pBiDi, prologue, proLength, epilogue, epiLength, pErrorCode)
# pBiDi : UBiDi* in/out -> "void*"
# prologue : WORD* -> "void*"
# proLength : INT -> "int"
# epilogue : WORD* -> "void*"
# epiLength : INT -> "int"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。