ホーム › Globalization › unum_parseDouble
unum_parseDouble
関数文字列を解析して倍精度浮動小数点数に変換する。
シグネチャ
// icuin.dll
#include <windows.h>
DOUBLE unum_parseDouble(
const void** fmt,
const WORD* text,
INT textLength,
INT* parsePos,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| fmt | void** | in |
| text | WORD* | in |
| textLength | INT | in |
| parsePos | INT* | inout |
| status | UErrorCode* | inout |
戻り値の型: DOUBLE
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
DOUBLE unum_parseDouble(
const void** fmt,
const WORD* text,
INT textLength,
INT* parsePos,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern double unum_parseDouble(
IntPtr fmt, // 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 unum_parseDouble(
fmt 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' fmt : void**
' text : WORD*
' textLength : INT
' parsePos : INT* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function unum_parseDouble Lib "icuin" ( _
ByVal fmt 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
unum_parseDouble = ctypes.cdll.icuin.unum_parseDouble
unum_parseDouble.restype = ctypes.c_double
unum_parseDouble.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
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
unum_parseDouble = Fiddle::Function.new(
lib['unum_parseDouble'],
[
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, # status : UErrorCode* in/out
],
Fiddle::TYPE_DOUBLE, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn unum_parseDouble(
fmt: *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 unum_parseDouble(IntPtr fmt, ref ushort text, int textLength, ref int parsePos, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_unum_parseDouble' -Namespace Win32 -PassThru
# $api::unum_parseDouble(fmt, text, textLength, parsePos, status)#uselib "icuin.dll"
#func global unum_parseDouble "unum_parseDouble" sptr, sptr, sptr, sptr, sptr
; unum_parseDouble fmt, varptr(text), textLength, varptr(parsePos), status ; 戻り値は stat
; fmt : 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 unum_parseDouble "unum_parseDouble" sptr, var, int, var, int ; res = unum_parseDouble(fmt, text, textLength, parsePos, status) ; fmt : void** -> "sptr" ; text : WORD* -> "var" ; textLength : INT -> "int" ; parsePos : INT* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global unum_parseDouble "unum_parseDouble" sptr, sptr, int, sptr, int ; res = unum_parseDouble(fmt, varptr(text), textLength, varptr(parsePos), status) ; fmt : void** -> "sptr" ; text : WORD* -> "sptr" ; textLength : INT -> "int" ; parsePos : INT* in/out -> "sptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DOUBLE unum_parseDouble(void** fmt, WORD* text, INT textLength, INT* parsePos, UErrorCode* status) #uselib "icuin.dll" #cfunc global unum_parseDouble "unum_parseDouble" intptr, var, int, var, int ; res = unum_parseDouble(fmt, text, textLength, parsePos, status) ; fmt : void** -> "intptr" ; text : WORD* -> "var" ; textLength : INT -> "int" ; parsePos : INT* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DOUBLE unum_parseDouble(void** fmt, WORD* text, INT textLength, INT* parsePos, UErrorCode* status) #uselib "icuin.dll" #cfunc global unum_parseDouble "unum_parseDouble" intptr, intptr, int, intptr, int ; res = unum_parseDouble(fmt, varptr(text), textLength, varptr(parsePos), status) ; fmt : void** -> "intptr" ; text : WORD* -> "intptr" ; textLength : INT -> "int" ; parsePos : INT* in/out -> "intptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procunum_parseDouble = icuin.NewProc("unum_parseDouble")
)
// fmt (void**), text (WORD*), textLength (INT), parsePos (INT* in/out), status (UErrorCode* in/out)
r1, _, err := procunum_parseDouble.Call(
uintptr(fmt),
uintptr(text),
uintptr(textLength),
uintptr(parsePos),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DOUBLEfunction unum_parseDouble(
fmt: Pointer; // void**
text: Pointer; // WORD*
textLength: Integer; // INT
parsePos: Pointer; // INT* in/out
status: Pointer // UErrorCode* in/out
): Double; cdecl;
external 'icuin.dll' name 'unum_parseDouble';result := DllCall("icuin\unum_parseDouble"
, "Ptr", fmt ; void**
, "Ptr", text ; WORD*
, "Int", textLength ; INT
, "Ptr", parsePos ; INT* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Double") ; return: DOUBLE●unum_parseDouble(fmt, text, textLength, parsePos, status) = DLL("icuin.dll", "double unum_parseDouble(void*, void*, int, void*, void*)")
# 呼び出し: unum_parseDouble(fmt, text, textLength, parsePos, status)
# fmt : 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`,…) を使用。