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