ホーム › Globalization › unum_parse
unum_parse
関数文字列を解析して整数値に変換する。
シグネチャ
// icuin.dll
#include <windows.h>
INT unum_parse(
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 |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT unum_parse(
const void** fmt,
const WORD* text,
INT textLength,
INT* parsePos,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int unum_parse(
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_parse(
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 Integer
End Function' fmt : void**
' text : WORD*
' textLength : INT
' parsePos : INT* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function unum_parse Lib "icuin" ( _
ByVal fmt As LongPtr, _
ByRef text As Integer, _
ByVal textLength As Long, _
ByRef parsePos 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_parse = ctypes.cdll.icuin.unum_parse
unum_parse.restype = ctypes.c_int
unum_parse.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_parse = Fiddle::Function.new(
lib['unum_parse'],
[
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_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn unum_parse(
fmt: *const *const (), // void**
text: *const u16, // WORD*
textLength: i32, // INT
parsePos: *mut i32, // INT* in/out
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_parse(IntPtr fmt, ref ushort text, int textLength, ref int parsePos, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_unum_parse' -Namespace Win32 -PassThru
# $api::unum_parse(fmt, text, textLength, parsePos, status)#uselib "icuin.dll"
#func global unum_parse "unum_parse" sptr, sptr, sptr, sptr, sptr
; unum_parse 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_parse "unum_parse" sptr, var, int, var, int ; res = unum_parse(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_parse "unum_parse" sptr, sptr, int, sptr, int ; res = unum_parse(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(変数))。
出力引数:
; INT unum_parse(void** fmt, WORD* text, INT textLength, INT* parsePos, UErrorCode* status) #uselib "icuin.dll" #cfunc global unum_parse "unum_parse" intptr, var, int, var, int ; res = unum_parse(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 方式にも切替可。; INT unum_parse(void** fmt, WORD* text, INT textLength, INT* parsePos, UErrorCode* status) #uselib "icuin.dll" #cfunc global unum_parse "unum_parse" intptr, intptr, int, intptr, int ; res = unum_parse(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_parse = icuin.NewProc("unum_parse")
)
// fmt (void**), text (WORD*), textLength (INT), parsePos (INT* in/out), status (UErrorCode* in/out)
r1, _, err := procunum_parse.Call(
uintptr(fmt),
uintptr(text),
uintptr(textLength),
uintptr(parsePos),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction unum_parse(
fmt: Pointer; // void**
text: Pointer; // WORD*
textLength: Integer; // INT
parsePos: Pointer; // INT* in/out
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'unum_parse';result := DllCall("icuin\unum_parse"
, "Ptr", fmt ; void**
, "Ptr", text ; WORD*
, "Int", textLength ; INT
, "Ptr", parsePos ; INT* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●unum_parse(fmt, text, textLength, parsePos, status) = DLL("icuin.dll", "int unum_parse(void*, void*, int, void*, void*)")
# 呼び出し: unum_parse(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`,…) を使用。