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

udat_parse

関数
日付書式を用いて文字列を解析し日時値を取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

DOUBLE udat_parse(
    const void** format,
    const WORD* text,
    INT textLength,
    INT* parsePos,
    UErrorCode* status
);

パラメーター

名前方向
formatvoid**in
textWORD*in
textLengthINTin
parsePosINT*inout
statusUErrorCode*inout

戻り値の型: DOUBLE

各言語での呼び出し定義

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

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

udat_parse = ctypes.cdll.icuin.udat_parse
udat_parse.restype = ctypes.c_double
udat_parse.argtypes = [
    ctypes.c_void_p,  # format : void**
    ctypes.POINTER(ctypes.c_ushort),  # text : WORD*
    ctypes.c_int,  # textLength : INT
    ctypes.POINTER(ctypes.c_int),  # parsePos : INT* in/out
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
udat_parse = Fiddle::Function.new(
  lib['udat_parse'],
  [
    Fiddle::TYPE_VOIDP,  # format : void**
    Fiddle::TYPE_VOIDP,  # text : WORD*
    Fiddle::TYPE_INT,  # textLength : INT
    Fiddle::TYPE_VOIDP,  # parsePos : INT* in/out
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_DOUBLE, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn udat_parse(
        format: *const *const (),  // void**
        text: *const u16,  // WORD*
        textLength: i32,  // INT
        parsePos: *mut i32,  // INT* in/out
        status: *mut i32  // UErrorCode* in/out
    ) -> f64;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern double udat_parse(IntPtr format, ref ushort text, int textLength, ref int parsePos, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_udat_parse' -Namespace Win32 -PassThru
# $api::udat_parse(format, text, textLength, parsePos, status)
#uselib "icuin.dll"
#func global udat_parse "udat_parse" sptr, sptr, sptr, sptr, sptr
; udat_parse format, varptr(text), textLength, varptr(parsePos), status   ; 戻り値は stat
; format : void** -> "sptr"
; text : WORD* -> "sptr"
; textLength : INT -> "sptr"
; parsePos : INT* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuin.dll"
#cfunc global udat_parse "udat_parse" sptr, var, int, var, int
; res = udat_parse(format, text, textLength, parsePos, status)
; format : void** -> "sptr"
; text : WORD* -> "var"
; textLength : INT -> "int"
; parsePos : INT* in/out -> "var"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DOUBLE udat_parse(void** format, WORD* text, INT textLength, INT* parsePos, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global udat_parse "udat_parse" intptr, var, int, var, int
; res = udat_parse(format, text, textLength, parsePos, status)
; format : void** -> "intptr"
; text : WORD* -> "var"
; textLength : INT -> "int"
; parsePos : INT* in/out -> "var"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procudat_parse = icuin.NewProc("udat_parse")
)

// format (void**), text (WORD*), textLength (INT), parsePos (INT* in/out), status (UErrorCode* in/out)
r1, _, err := procudat_parse.Call(
	uintptr(format),
	uintptr(text),
	uintptr(textLength),
	uintptr(parsePos),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DOUBLE
function udat_parse(
  format: Pointer;   // void**
  text: Pointer;   // WORD*
  textLength: Integer;   // INT
  parsePos: Pointer;   // INT* in/out
  status: Pointer   // UErrorCode* in/out
): Double; cdecl;
  external 'icuin.dll' name 'udat_parse';
result := DllCall("icuin\udat_parse"
    , "Ptr", format   ; void**
    , "Ptr", text   ; WORD*
    , "Int", textLength   ; INT
    , "Ptr", parsePos   ; INT* in/out
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Double")   ; return: DOUBLE
●udat_parse(format, text, textLength, parsePos, status) = DLL("icuin.dll", "double udat_parse(void*, void*, int, void*, void*)")
# 呼び出し: udat_parse(format, text, textLength, parsePos, status)
# format : void** -> "void*"
# text : WORD* -> "void*"
# textLength : INT -> "int"
# parsePos : INT* in/out -> "void*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。