ホーム › Globalization › u_parseMessageWithError
u_parseMessageWithError
関数可変長引数メッセージを解析し解析エラー情報も返す。
シグネチャ
// icuin.dll
#include <windows.h>
void u_parseMessageWithError(
LPCSTR locale,
const WORD* pattern,
INT patternLength,
const WORD* source,
INT sourceLength,
UParseError* parseError,
UErrorCode* status,
...
);
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| locale | LPCSTR | in |
| pattern | WORD* | in |
| patternLength | INT | in |
| source | WORD* | in |
| sourceLength | INT | in |
| parseError | UParseError* | inout |
| status | UErrorCode* | inout |
戻り値の型: void
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
void u_parseMessageWithError(
LPCSTR locale,
const WORD* pattern,
INT patternLength,
const WORD* source,
INT sourceLength,
UParseError* parseError,
UErrorCode* status,
...
);
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void u_parseMessageWithError(
[MarshalAs(UnmanagedType.LPStr)] string locale, // LPCSTR
ref ushort pattern, // WORD*
int patternLength, // INT
ref ushort source, // WORD*
int sourceLength, // INT
IntPtr parseError, // UParseError* in/out
ref int status, // UErrorCode* in/out
__arglist
);
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub u_parseMessageWithError(
<MarshalAs(UnmanagedType.LPStr)> locale As String, ' LPCSTR
ByRef pattern As UShort, ' WORD*
patternLength As Integer, ' INT
ByRef source As UShort, ' WORD*
sourceLength As Integer, ' INT
parseError As IntPtr, ' UParseError* in/out
ByRef status As Integer ' UErrorCode* in/out
)
End Sub
' ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。' locale : LPCSTR
' pattern : WORD*
' patternLength : INT
' source : WORD*
' sourceLength : INT
' parseError : UParseError* in/out
' status : UErrorCode* in/out
Declare PtrSafe Sub u_parseMessageWithError Lib "icuin" ( _
ByVal locale As String, _
ByRef pattern As Integer, _
ByVal patternLength As Long, _
ByRef source As Integer, _
ByVal sourceLength As Long, _
ByVal parseError As LongPtr, _
ByRef status As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
' ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。import ctypes
from ctypes import wintypes
u_parseMessageWithError = ctypes.cdll.icuin.u_parseMessageWithError
u_parseMessageWithError.restype = None
u_parseMessageWithError.argtypes = [
wintypes.LPCSTR, # locale : LPCSTR
ctypes.POINTER(ctypes.c_ushort), # pattern : WORD*
ctypes.c_int, # patternLength : INT
ctypes.POINTER(ctypes.c_ushort), # source : WORD*
ctypes.c_int, # sourceLength : INT
ctypes.c_void_p, # parseError : UParseError* in/out
ctypes.c_void_p, # status : UErrorCode* in/out
]
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
u_parseMessageWithError = Fiddle::Function.new(
lib['u_parseMessageWithError'],
[
Fiddle::TYPE_VOIDP, # locale : LPCSTR
Fiddle::TYPE_VOIDP, # pattern : WORD*
Fiddle::TYPE_INT, # patternLength : INT
Fiddle::TYPE_VOIDP, # source : WORD*
Fiddle::TYPE_INT, # sourceLength : INT
Fiddle::TYPE_VOIDP, # parseError : UParseError* in/out
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。#[link(name = "icuin")]
extern "C" {
fn u_parseMessageWithError(
locale: *const u8, // LPCSTR
pattern: *const u16, // WORD*
patternLength: i32, // INT
source: *const u16, // WORD*
sourceLength: i32, // INT
parseError: *mut UParseError, // UParseError* in/out
status: *mut i32, // UErrorCode* in/out
...
);
}
// crates: windows-sys provides ready-made bindings for this API.
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void u_parseMessageWithError([MarshalAs(UnmanagedType.LPStr)] string locale, ref ushort pattern, int patternLength, ref ushort source, int sourceLength, IntPtr parseError, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_u_parseMessageWithError' -Namespace Win32 -PassThru
# $api::u_parseMessageWithError(locale, pattern, patternLength, source, sourceLength, parseError, status)
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。#uselib "icuin.dll"
#func global u_parseMessageWithError "u_parseMessageWithError" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; u_parseMessageWithError locale, varptr(pattern), patternLength, varptr(source), sourceLength, varptr(parseError), status
; locale : LPCSTR -> "sptr"
; pattern : WORD* -> "sptr"
; patternLength : INT -> "sptr"
; source : WORD* -> "sptr"
; sourceLength : INT -> "sptr"
; parseError : UParseError* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。出力引数:
#uselib "icuin.dll" #func global u_parseMessageWithError "u_parseMessageWithError" str, var, int, var, int, var, int ; u_parseMessageWithError locale, pattern, patternLength, source, sourceLength, parseError, status ; locale : LPCSTR -> "str" ; pattern : WORD* -> "var" ; patternLength : INT -> "int" ; source : WORD* -> "var" ; sourceLength : INT -> "int" ; parseError : UParseError* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。#uselib "icuin.dll" #func global u_parseMessageWithError "u_parseMessageWithError" str, sptr, int, sptr, int, sptr, int ; u_parseMessageWithError locale, varptr(pattern), patternLength, varptr(source), sourceLength, varptr(parseError), status ; locale : LPCSTR -> "str" ; pattern : WORD* -> "sptr" ; patternLength : INT -> "int" ; source : WORD* -> "sptr" ; sourceLength : INT -> "int" ; parseError : UParseError* in/out -> "sptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
出力引数:
; void u_parseMessageWithError(LPCSTR locale, WORD* pattern, INT patternLength, WORD* source, INT sourceLength, UParseError* parseError, UErrorCode* status) #uselib "icuin.dll" #func global u_parseMessageWithError "u_parseMessageWithError" str, var, int, var, int, var, int ; u_parseMessageWithError locale, pattern, patternLength, source, sourceLength, parseError, status ; locale : LPCSTR -> "str" ; pattern : WORD* -> "var" ; patternLength : INT -> "int" ; source : WORD* -> "var" ; sourceLength : INT -> "int" ; parseError : UParseError* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。; void u_parseMessageWithError(LPCSTR locale, WORD* pattern, INT patternLength, WORD* source, INT sourceLength, UParseError* parseError, UErrorCode* status) #uselib "icuin.dll" #func global u_parseMessageWithError "u_parseMessageWithError" str, intptr, int, intptr, int, intptr, int ; u_parseMessageWithError locale, varptr(pattern), patternLength, varptr(source), sourceLength, varptr(parseError), status ; locale : LPCSTR -> "str" ; pattern : WORD* -> "intptr" ; patternLength : INT -> "int" ; source : WORD* -> "intptr" ; sourceLength : INT -> "int" ; parseError : UParseError* in/out -> "intptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。 ; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procu_parseMessageWithError = icuin.NewProc("u_parseMessageWithError")
)
// locale (LPCSTR), pattern (WORD*), patternLength (INT), source (WORD*), sourceLength (INT), parseError (UParseError* in/out), status (UErrorCode* in/out)
r1, _, err := procu_parseMessageWithError.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
uintptr(pattern),
uintptr(patternLength),
uintptr(source),
uintptr(sourceLength),
uintptr(parseError),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // void
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。procedure u_parseMessageWithError(
locale: PAnsiChar; // LPCSTR
pattern: Pointer; // WORD*
patternLength: Integer; // INT
source: Pointer; // WORD*
sourceLength: Integer; // INT
parseError: Pointer; // UParseError* in/out
status: Pointer // UErrorCode* in/out
); cdecl; varargs;
external 'icuin.dll' name 'u_parseMessageWithError';
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。result := DllCall("icuin\u_parseMessageWithError"
, "AStr", locale ; LPCSTR
, "Ptr", pattern ; WORD*
, "Int", patternLength ; INT
, "Ptr", source ; WORD*
, "Int", sourceLength ; INT
, "Ptr", parseError ; UParseError* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: void
; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。●u_parseMessageWithError(locale, pattern, patternLength, source, sourceLength, parseError, status) = DLL("icuin.dll", "int u_parseMessageWithError(char*, void*, int, void*, int, void*, void*)")
# 呼び出し: u_parseMessageWithError(locale, pattern, patternLength, source, sourceLength, parseError, status)
# locale : LPCSTR -> "char*"
# pattern : WORD* -> "void*"
# patternLength : INT -> "int"
# source : WORD* -> "void*"
# sourceLength : INT -> "int"
# parseError : UParseError* in/out -> "void*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
# ※可変長引数。DLL()は固定引数のみ。追加引数は EXEC_PTR で渡してください。
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。