ホーム › Globalization › unumrf_resultGetFirstDecimalNumber
unumrf_resultGetFirstDecimalNumber
関数範囲書式結果の始端を十進数文字列で取得する。
シグネチャ
// icu.dll
#include <windows.h>
INT unumrf_resultGetFirstDecimalNumber(
const UFormattedNumberRange* uresult,
LPSTR dest,
INT destCapacity,
UErrorCode* ec
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| uresult | UFormattedNumberRange* | in |
| dest | LPSTR | in |
| destCapacity | INT | in |
| ec | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icu.dll
#include <windows.h>
INT unumrf_resultGetFirstDecimalNumber(
const UFormattedNumberRange* uresult,
LPSTR dest,
INT destCapacity,
UErrorCode* ec
);[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int unumrf_resultGetFirstDecimalNumber(
ref IntPtr uresult, // UFormattedNumberRange*
[MarshalAs(UnmanagedType.LPStr)] string dest, // LPSTR
int destCapacity, // INT
ref int ec // UErrorCode* in/out
);<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function unumrf_resultGetFirstDecimalNumber(
ByRef uresult As IntPtr, ' UFormattedNumberRange*
<MarshalAs(UnmanagedType.LPStr)> dest As String, ' LPSTR
destCapacity As Integer, ' INT
ByRef ec As Integer ' UErrorCode* in/out
) As Integer
End Function' uresult : UFormattedNumberRange*
' dest : LPSTR
' destCapacity : INT
' ec : UErrorCode* in/out
Declare PtrSafe Function unumrf_resultGetFirstDecimalNumber Lib "icu" ( _
ByRef uresult As LongPtr, _
ByVal dest As String, _
ByVal destCapacity As Long, _
ByRef ec As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
unumrf_resultGetFirstDecimalNumber = ctypes.cdll.icu.unumrf_resultGetFirstDecimalNumber
unumrf_resultGetFirstDecimalNumber.restype = ctypes.c_int
unumrf_resultGetFirstDecimalNumber.argtypes = [
ctypes.c_void_p, # uresult : UFormattedNumberRange*
wintypes.LPCSTR, # dest : LPSTR
ctypes.c_int, # destCapacity : INT
ctypes.c_void_p, # ec : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icu.dll')
unumrf_resultGetFirstDecimalNumber = Fiddle::Function.new(
lib['unumrf_resultGetFirstDecimalNumber'],
[
Fiddle::TYPE_VOIDP, # uresult : UFormattedNumberRange*
Fiddle::TYPE_VOIDP, # dest : LPSTR
Fiddle::TYPE_INT, # destCapacity : INT
Fiddle::TYPE_VOIDP, # ec : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icu")]
extern "C" {
fn unumrf_resultGetFirstDecimalNumber(
uresult: *const isize, // UFormattedNumberRange*
dest: *mut u8, // LPSTR
destCapacity: i32, // INT
ec: *mut i32 // UErrorCode* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icu.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int unumrf_resultGetFirstDecimalNumber(ref IntPtr uresult, [MarshalAs(UnmanagedType.LPStr)] string dest, int destCapacity, ref int ec);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_unumrf_resultGetFirstDecimalNumber' -Namespace Win32 -PassThru
# $api::unumrf_resultGetFirstDecimalNumber(uresult, dest, destCapacity, ec)#uselib "icu.dll"
#func global unumrf_resultGetFirstDecimalNumber "unumrf_resultGetFirstDecimalNumber" sptr, sptr, sptr, sptr
; unumrf_resultGetFirstDecimalNumber uresult, dest, destCapacity, ec ; 戻り値は stat
; uresult : UFormattedNumberRange* -> "sptr"
; dest : LPSTR -> "sptr"
; destCapacity : INT -> "sptr"
; ec : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icu.dll"
#cfunc global unumrf_resultGetFirstDecimalNumber "unumrf_resultGetFirstDecimalNumber" int, str, int, int
; res = unumrf_resultGetFirstDecimalNumber(uresult, dest, destCapacity, ec)
; uresult : UFormattedNumberRange* -> "int"
; dest : LPSTR -> "str"
; destCapacity : INT -> "int"
; ec : UErrorCode* in/out -> "int"; INT unumrf_resultGetFirstDecimalNumber(UFormattedNumberRange* uresult, LPSTR dest, INT destCapacity, UErrorCode* ec)
#uselib "icu.dll"
#cfunc global unumrf_resultGetFirstDecimalNumber "unumrf_resultGetFirstDecimalNumber" int, str, int, int
; res = unumrf_resultGetFirstDecimalNumber(uresult, dest, destCapacity, ec)
; uresult : UFormattedNumberRange* -> "int"
; dest : LPSTR -> "str"
; destCapacity : INT -> "int"
; ec : UErrorCode* in/out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icu = windows.NewLazySystemDLL("icu.dll")
procunumrf_resultGetFirstDecimalNumber = icu.NewProc("unumrf_resultGetFirstDecimalNumber")
)
// uresult (UFormattedNumberRange*), dest (LPSTR), destCapacity (INT), ec (UErrorCode* in/out)
r1, _, err := procunumrf_resultGetFirstDecimalNumber.Call(
uintptr(uresult),
uintptr(unsafe.Pointer(windows.BytePtrFromString(dest))),
uintptr(destCapacity),
uintptr(ec),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction unumrf_resultGetFirstDecimalNumber(
uresult: Pointer; // UFormattedNumberRange*
dest: PAnsiChar; // LPSTR
destCapacity: Integer; // INT
ec: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icu.dll' name 'unumrf_resultGetFirstDecimalNumber';result := DllCall("icu\unumrf_resultGetFirstDecimalNumber"
, "Ptr", uresult ; UFormattedNumberRange*
, "AStr", dest ; LPSTR
, "Int", destCapacity ; INT
, "Ptr", ec ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●unumrf_resultGetFirstDecimalNumber(uresult, dest, destCapacity, ec) = DLL("icu.dll", "int unumrf_resultGetFirstDecimalNumber(void*, char*, int, void*)")
# 呼び出し: unumrf_resultGetFirstDecimalNumber(uresult, dest, destCapacity, ec)
# uresult : UFormattedNumberRange* -> "void*"
# dest : LPSTR -> "char*"
# destCapacity : INT -> "int"
# ec : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。