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

unum_parseDecimal

関数
文字列を解析して十進数文字列に変換する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

INT unum_parseDecimal(
    const void** fmt,
    const WORD* text,
    INT textLength,
    INT* parsePos,
    LPSTR outBuf,
    INT outBufLength,
    UErrorCode* status
);

パラメーター

名前方向
fmtvoid**in
textWORD*in
textLengthINTin
parsePosINT*inout
outBufLPSTRin
outBufLengthINTin
statusUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

unum_parseDecimal = ctypes.cdll.icuin.unum_parseDecimal
unum_parseDecimal.restype = ctypes.c_int
unum_parseDecimal.argtypes = [
    ctypes.c_void_p,  # fmt : void**
    ctypes.POINTER(ctypes.c_ushort),  # text : WORD*
    ctypes.c_int,  # textLength : INT
    ctypes.POINTER(ctypes.c_int),  # parsePos : INT* in/out
    wintypes.LPCSTR,  # outBuf : LPSTR
    ctypes.c_int,  # outBufLength : INT
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procunum_parseDecimal = icuin.NewProc("unum_parseDecimal")
)

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