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

umsg_vparse

関数
可変引数リストでメッセージを解析する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

void umsg_vparse(
    const void** fmt,
    const WORD* source,
    INT sourceLength,
    INT* count,
    CHAR* ap,
    UErrorCode* status
);

パラメーター

名前方向説明
fmtvoid**in解析に用いるUMessageFormatハンドル。
sourceWORD*in解析対象の入力文字列。UTF-16のWORD配列で指定する。
sourceLengthINTin入力文字列の長さ(UTF-16単位)。-1でNUL終端として扱う。
countINT*inout解析で取り出された引数の個数を受け取る出力先。
apCHAR*inout解析結果の格納先を指す可変個引数リスト(va_list)。
statusUErrorCode*inoutICUのエラーコード。呼び出し前に成功値で初期化する。

戻り値の型: void

各言語での呼び出し定義

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

void umsg_vparse(
    const void** fmt,
    const WORD* source,
    INT sourceLength,
    INT* count,
    CHAR* ap,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void umsg_vparse(
    IntPtr fmt,   // void**
    ref ushort source,   // WORD*
    int sourceLength,   // INT
    ref int count,   // INT* in/out
    IntPtr ap,   // CHAR* in/out
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub umsg_vparse(
    fmt As IntPtr,   ' void**
    ByRef source As UShort,   ' WORD*
    sourceLength As Integer,   ' INT
    ByRef count As Integer,   ' INT* in/out
    ap As IntPtr,   ' CHAR* in/out
    ByRef status As Integer   ' UErrorCode* in/out
)
End Sub
' fmt : void**
' source : WORD*
' sourceLength : INT
' count : INT* in/out
' ap : CHAR* in/out
' status : UErrorCode* in/out
Declare PtrSafe Sub umsg_vparse Lib "icuin" ( _
    ByVal fmt As LongPtr, _
    ByRef source As Integer, _
    ByVal sourceLength As Long, _
    ByRef count As Long, _
    ByVal ap As LongPtr, _
    ByRef status As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

umsg_vparse = ctypes.cdll.icuin.umsg_vparse
umsg_vparse.restype = None
umsg_vparse.argtypes = [
    ctypes.c_void_p,  # fmt : void**
    ctypes.POINTER(ctypes.c_ushort),  # source : WORD*
    ctypes.c_int,  # sourceLength : INT
    ctypes.POINTER(ctypes.c_int),  # count : INT* in/out
    ctypes.POINTER(ctypes.c_byte),  # ap : CHAR* in/out
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
umsg_vparse = Fiddle::Function.new(
  lib['umsg_vparse'],
  [
    Fiddle::TYPE_VOIDP,  # fmt : void**
    Fiddle::TYPE_VOIDP,  # source : WORD*
    Fiddle::TYPE_INT,  # sourceLength : INT
    Fiddle::TYPE_VOIDP,  # count : INT* in/out
    Fiddle::TYPE_VOIDP,  # ap : CHAR* in/out
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn umsg_vparse(
        fmt: *const *const (),  // void**
        source: *const u16,  // WORD*
        sourceLength: i32,  // INT
        count: *mut i32,  // INT* in/out
        ap: *mut i8,  // CHAR* 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 umsg_vparse(IntPtr fmt, ref ushort source, int sourceLength, ref int count, IntPtr ap, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_umsg_vparse' -Namespace Win32 -PassThru
# $api::umsg_vparse(fmt, source, sourceLength, count, ap, status)
#uselib "icuin.dll"
#func global umsg_vparse "umsg_vparse" sptr, sptr, sptr, sptr, sptr, sptr
; umsg_vparse fmt, varptr(source), sourceLength, varptr(count), varptr(ap), varptr(status)
; fmt : void** -> "sptr"
; source : WORD* -> "sptr"
; sourceLength : INT -> "sptr"
; count : INT* in/out -> "sptr"
; ap : CHAR* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
出力引数:
#uselib "icuin.dll"
#func global umsg_vparse "umsg_vparse" sptr, var, int, var, var, var
; umsg_vparse fmt, source, sourceLength, count, ap, status
; fmt : void** -> "sptr"
; source : WORD* -> "var"
; sourceLength : INT -> "int"
; count : INT* in/out -> "var"
; ap : CHAR* in/out -> "var"
; status : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void umsg_vparse(void** fmt, WORD* source, INT sourceLength, INT* count, CHAR* ap, UErrorCode* status)
#uselib "icuin.dll"
#func global umsg_vparse "umsg_vparse" intptr, var, int, var, var, var
; umsg_vparse fmt, source, sourceLength, count, ap, status
; fmt : void** -> "intptr"
; source : WORD* -> "var"
; sourceLength : INT -> "int"
; count : INT* in/out -> "var"
; ap : CHAR* in/out -> "var"
; status : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procumsg_vparse = icuin.NewProc("umsg_vparse")
)

// fmt (void**), source (WORD*), sourceLength (INT), count (INT* in/out), ap (CHAR* in/out), status (UErrorCode* in/out)
r1, _, err := procumsg_vparse.Call(
	uintptr(fmt),
	uintptr(source),
	uintptr(sourceLength),
	uintptr(count),
	uintptr(ap),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure umsg_vparse(
  fmt: Pointer;   // void**
  source: Pointer;   // WORD*
  sourceLength: Integer;   // INT
  count: Pointer;   // INT* in/out
  ap: Pointer;   // CHAR* in/out
  status: Pointer   // UErrorCode* in/out
); cdecl;
  external 'icuin.dll' name 'umsg_vparse';
result := DllCall("icuin\umsg_vparse"
    , "Ptr", fmt   ; void**
    , "Ptr", source   ; WORD*
    , "Int", sourceLength   ; INT
    , "Ptr", count   ; INT* in/out
    , "Ptr", ap   ; CHAR* in/out
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: void
●umsg_vparse(fmt, source, sourceLength, count, ap, status) = DLL("icuin.dll", "int umsg_vparse(void*, void*, int, void*, void*, void*)")
# 呼び出し: umsg_vparse(fmt, source, sourceLength, count, ap, status)
# fmt : void** -> "void*"
# source : WORD* -> "void*"
# sourceLength : INT -> "int"
# count : INT* in/out -> "void*"
# ap : CHAR* in/out -> "void*"
# status : 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 "icuin" fn umsg_vparse(
    fmt: ?*anyopaque, // void**
    source: [*c]u16, // WORD*
    sourceLength: i32, // INT
    count: [*c]i32, // INT* in/out
    ap: [*c]i8, // CHAR* in/out
    status: [*c]i32 // UErrorCode* in/out
) callconv(.c) void;
proc umsg_vparse(
    fmt: pointer,  # void**
    source: ptr uint16,  # WORD*
    sourceLength: int32,  # INT
    count: ptr int32,  # INT* in/out
    ap: ptr int8,  # CHAR* in/out
    status: ptr int32  # UErrorCode* in/out
) {.importc: "umsg_vparse", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
void umsg_vparse(
    void** fmt,   // void**
    ushort* source,   // WORD*
    int sourceLength,   // INT
    int* count,   // INT* in/out
    byte* ap,   // CHAR* in/out
    int* status   // UErrorCode* in/out
);
ccall((:umsg_vparse, "icuin.dll"), Cvoid,
      (Ptr{Cvoid}, Ptr{UInt16}, Int32, Ptr{Int32}, Ptr{Int8}, Ptr{Int32}),
      fmt, source, sourceLength, count, ap, status)
# fmt : void** -> Ptr{Cvoid}
# source : WORD* -> Ptr{UInt16}
# sourceLength : INT -> Int32
# count : INT* in/out -> Ptr{Int32}
# ap : CHAR* in/out -> Ptr{Int8}
# status : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
void umsg_vparse(
    void** fmt,
    uint16_t* source,
    int32_t sourceLength,
    int32_t* count,
    int8_t* ap,
    int32_t* status);
]]
local icuin = ffi.load("icuin")
-- icuin.umsg_vparse(fmt, source, sourceLength, count, ap, status)
-- fmt : void**
-- source : WORD*
-- sourceLength : INT
-- count : INT* in/out
-- ap : CHAR* in/out
-- status : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const umsg_vparse = lib.func('__cdecl', 'umsg_vparse', 'void', ['void *', 'uint16_t *', 'int32_t', 'int32_t *', 'int8_t *', 'int32_t *']);
// umsg_vparse(fmt, source, sourceLength, count, ap, status)
// fmt : void** -> 'void *'
// source : WORD* -> 'uint16_t *'
// sourceLength : INT -> 'int32_t'
// count : INT* in/out -> 'int32_t *'
// ap : CHAR* in/out -> 'int8_t *'
// status : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  umsg_vparse: { parameters: ["pointer", "pointer", "i32", "pointer", "pointer", "pointer"], result: "void" },
});
// lib.symbols.umsg_vparse(fmt, source, sourceLength, count, ap, status)
// fmt : void** -> "pointer"
// source : WORD* -> "pointer"
// sourceLength : INT -> "i32"
// count : INT* in/out -> "pointer"
// ap : CHAR* in/out -> "pointer"
// status : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void umsg_vparse(
    void** fmt,
    uint16_t* source,
    int32_t sourceLength,
    int32_t* count,
    int8_t* ap,
    int32_t* status);
C, "icuin.dll");
// $ffi->umsg_vparse(fmt, source, sourceLength, count, ap, status);
// fmt : void**
// source : WORD*
// sourceLength : INT
// count : INT* in/out
// ap : CHAR* in/out
// status : 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 Icuin extends Library {
    Icuin INSTANCE = Native.load("icuin", Icuin.class);
    void umsg_vparse(
        Pointer fmt,   // void**
        ShortByReference source,   // WORD*
        int sourceLength,   // INT
        IntByReference count,   // INT* in/out
        byte[] ap,   // CHAR* in/out
        IntByReference status   // UErrorCode* in/out
    );
}
@[Link("icuin")]
lib Libicuin
  fun umsg_vparse = umsg_vparse(
    fmt : Void**,   # void**
    source : UInt16*,   # WORD*
    sourceLength : Int32,   # INT
    count : Int32*,   # INT* in/out
    ap : Int8*,   # CHAR* in/out
    status : Int32*   # UErrorCode* in/out
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef umsg_vparseNative = Void Function(Pointer<Void>, Pointer<Uint16>, Int32, Pointer<Int32>, Pointer<Int8>, Pointer<Int32>);
typedef umsg_vparseDart = void Function(Pointer<Void>, Pointer<Uint16>, int, Pointer<Int32>, Pointer<Int8>, Pointer<Int32>);
final umsg_vparse = DynamicLibrary.open('icuin.dll')
    .lookupFunction<umsg_vparseNative, umsg_vparseDart>('umsg_vparse');
// fmt : void** -> Pointer<Void>
// source : WORD* -> Pointer<Uint16>
// sourceLength : INT -> Int32
// count : INT* in/out -> Pointer<Int32>
// ap : CHAR* in/out -> Pointer<Int8>
// status : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure umsg_vparse(
  fmt: Pointer;   // void**
  source: Pointer;   // WORD*
  sourceLength: Integer;   // INT
  count: Pointer;   // INT* in/out
  ap: Pointer;   // CHAR* in/out
  status: Pointer   // UErrorCode* in/out
); cdecl;
  external 'icuin.dll' name 'umsg_vparse';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "umsg_vparse"
  c_umsg_vparse :: Ptr () -> Ptr Word16 -> Int32 -> Ptr Int32 -> Ptr Int8 -> Ptr Int32 -> IO ()
-- fmt : void** -> Ptr ()
-- source : WORD* -> Ptr Word16
-- sourceLength : INT -> Int32
-- count : INT* in/out -> Ptr Int32
-- ap : CHAR* in/out -> Ptr Int8
-- status : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let umsg_vparse =
  foreign "umsg_vparse"
    ((ptr void) @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> (ptr int8_t) @-> (ptr int32_t) @-> returning void)
(* fmt : void** -> (ptr void) *)
(* source : WORD* -> (ptr uint16_t) *)
(* sourceLength : INT -> int32_t *)
(* count : INT* in/out -> (ptr int32_t) *)
(* ap : CHAR* in/out -> (ptr int8_t) *)
(* status : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)

(cffi:defcfun ("umsg_vparse" umsg-vparse :convention :cdecl) :void
  (fmt :pointer)   ; void**
  (source :pointer)   ; WORD*
  (source-length :int32)   ; INT
  (count :pointer)   ; INT* in/out
  (ap :pointer)   ; CHAR* in/out
  (status :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $umsg_vparse = Win32::API::More->new('icuin',
    'void umsg_vparse(LPVOID fmt, LPVOID source, int sourceLength, LPVOID count, LPVOID ap, LPVOID status)');
# my $ret = $umsg_vparse->Call($fmt, $source, $sourceLength, $count, $ap, $status);
# fmt : void** -> LPVOID
# source : WORD* -> LPVOID
# sourceLength : INT -> int
# count : INT* in/out -> LPVOID
# ap : CHAR* in/out -> LPVOID
# status : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型