Win32 API 日本語リファレンス
ホームGlobalization › u_vparseMessageWithError

u_vparseMessageWithError

関数
可変引数でメッセージ解析しエラー情報も返す。
DLLicuin.dll呼出規約cdecl

シグネチャ

// icuin.dll
#include <windows.h>

void u_vparseMessageWithError(
    LPCSTR locale,
    const WORD* pattern,
    INT patternLength,
    const WORD* source,
    INT sourceLength,
    CHAR* ap,
    UParseError* parseError,
    UErrorCode* status
);

パラメーター

名前方向
localeLPCSTRin
patternWORD*in
patternLengthINTin
sourceWORD*in
sourceLengthINTin
apCHAR*inout
parseErrorUParseError*inout
statusUErrorCode*inout

戻り値の型: void

各言語での呼び出し定義

// icuin.dll
#include <windows.h>

void u_vparseMessageWithError(
    LPCSTR locale,
    const WORD* pattern,
    INT patternLength,
    const WORD* source,
    INT sourceLength,
    CHAR* ap,
    UParseError* parseError,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void u_vparseMessageWithError(
    [MarshalAs(UnmanagedType.LPStr)] string locale,   // LPCSTR
    ref ushort pattern,   // WORD*
    int patternLength,   // INT
    ref ushort source,   // WORD*
    int sourceLength,   // INT
    IntPtr ap,   // CHAR* in/out
    IntPtr parseError,   // UParseError* in/out
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub u_vparseMessageWithError(
    <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
    ap As IntPtr,   ' CHAR* in/out
    parseError As IntPtr,   ' UParseError* in/out
    ByRef status As Integer   ' UErrorCode* in/out
)
End Sub
' locale : LPCSTR
' pattern : WORD*
' patternLength : INT
' source : WORD*
' sourceLength : INT
' ap : CHAR* in/out
' parseError : UParseError* in/out
' status : UErrorCode* in/out
Declare PtrSafe Sub u_vparseMessageWithError Lib "icuin" ( _
    ByVal locale As String, _
    ByRef pattern As Integer, _
    ByVal patternLength As Long, _
    ByRef source As Integer, _
    ByVal sourceLength As Long, _
    ByVal ap As LongPtr, _
    ByVal parseError As LongPtr, _
    ByRef status As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

u_vparseMessageWithError = ctypes.cdll.icuin.u_vparseMessageWithError
u_vparseMessageWithError.restype = None
u_vparseMessageWithError.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.POINTER(ctypes.c_byte),  # ap : CHAR* in/out
    ctypes.c_void_p,  # parseError : UParseError* in/out
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
u_vparseMessageWithError = Fiddle::Function.new(
  lib['u_vparseMessageWithError'],
  [
    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,  # ap : CHAR* in/out
    Fiddle::TYPE_VOIDP,  # parseError : UParseError* in/out
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn u_vparseMessageWithError(
        locale: *const u8,  // LPCSTR
        pattern: *const u16,  // WORD*
        patternLength: i32,  // INT
        source: *const u16,  // WORD*
        sourceLength: i32,  // INT
        ap: *mut i8,  // CHAR* in/out
        parseError: *mut UParseError,  // UParseError* in/out
        status: *mut i32  // UErrorCode* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void u_vparseMessageWithError([MarshalAs(UnmanagedType.LPStr)] string locale, ref ushort pattern, int patternLength, ref ushort source, int sourceLength, IntPtr ap, IntPtr parseError, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_u_vparseMessageWithError' -Namespace Win32 -PassThru
# $api::u_vparseMessageWithError(locale, pattern, patternLength, source, sourceLength, ap, parseError, status)
#uselib "icuin.dll"
#func global u_vparseMessageWithError "u_vparseMessageWithError" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; u_vparseMessageWithError locale, varptr(pattern), patternLength, varptr(source), sourceLength, varptr(ap), varptr(parseError), status
; locale : LPCSTR -> "sptr"
; pattern : WORD* -> "sptr"
; patternLength : INT -> "sptr"
; source : WORD* -> "sptr"
; sourceLength : INT -> "sptr"
; ap : CHAR* in/out -> "sptr"
; parseError : UParseError* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
出力引数:
#uselib "icuin.dll"
#func global u_vparseMessageWithError "u_vparseMessageWithError" str, var, int, var, int, var, var, int
; u_vparseMessageWithError locale, pattern, patternLength, source, sourceLength, ap, parseError, status
; locale : LPCSTR -> "str"
; pattern : WORD* -> "var"
; patternLength : INT -> "int"
; source : WORD* -> "var"
; sourceLength : INT -> "int"
; ap : CHAR* in/out -> "var"
; parseError : UParseError* in/out -> "var"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void u_vparseMessageWithError(LPCSTR locale, WORD* pattern, INT patternLength, WORD* source, INT sourceLength, CHAR* ap, UParseError* parseError, UErrorCode* status)
#uselib "icuin.dll"
#func global u_vparseMessageWithError "u_vparseMessageWithError" str, var, int, var, int, var, var, int
; u_vparseMessageWithError locale, pattern, patternLength, source, sourceLength, ap, parseError, status
; locale : LPCSTR -> "str"
; pattern : WORD* -> "var"
; patternLength : INT -> "int"
; source : WORD* -> "var"
; sourceLength : INT -> "int"
; ap : CHAR* in/out -> "var"
; parseError : UParseError* in/out -> "var"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procu_vparseMessageWithError = icuin.NewProc("u_vparseMessageWithError")
)

// locale (LPCSTR), pattern (WORD*), patternLength (INT), source (WORD*), sourceLength (INT), ap (CHAR* in/out), parseError (UParseError* in/out), status (UErrorCode* in/out)
r1, _, err := procu_vparseMessageWithError.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
	uintptr(pattern),
	uintptr(patternLength),
	uintptr(source),
	uintptr(sourceLength),
	uintptr(ap),
	uintptr(parseError),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure u_vparseMessageWithError(
  locale: PAnsiChar;   // LPCSTR
  pattern: Pointer;   // WORD*
  patternLength: Integer;   // INT
  source: Pointer;   // WORD*
  sourceLength: Integer;   // INT
  ap: Pointer;   // CHAR* in/out
  parseError: Pointer;   // UParseError* in/out
  status: Pointer   // UErrorCode* in/out
); cdecl;
  external 'icuin.dll' name 'u_vparseMessageWithError';
result := DllCall("icuin\u_vparseMessageWithError"
    , "AStr", locale   ; LPCSTR
    , "Ptr", pattern   ; WORD*
    , "Int", patternLength   ; INT
    , "Ptr", source   ; WORD*
    , "Int", sourceLength   ; INT
    , "Ptr", ap   ; CHAR* in/out
    , "Ptr", parseError   ; UParseError* in/out
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: void
●u_vparseMessageWithError(locale, pattern, patternLength, source, sourceLength, ap, parseError, status) = DLL("icuin.dll", "int u_vparseMessageWithError(char*, void*, int, void*, int, void*, void*, void*)")
# 呼び出し: u_vparseMessageWithError(locale, pattern, patternLength, source, sourceLength, ap, parseError, status)
# locale : LPCSTR -> "char*"
# pattern : WORD* -> "void*"
# patternLength : INT -> "int"
# source : WORD* -> "void*"
# sourceLength : INT -> "int"
# ap : CHAR* in/out -> "void*"
# 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`,…) を使用。