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

u_strToUpper

関数
ロケールに従い文字列を大文字に変換する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT u_strToUpper(
    WORD* dest,
    INT destCapacity,
    const WORD* src,
    INT srcLength,
    LPCSTR locale,
    UErrorCode* pErrorCode
);

パラメーター

名前方向
destWORD*inout
destCapacityINTin
srcWORD*in
srcLengthINTin
localeLPCSTRin
pErrorCodeUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

INT u_strToUpper(
    WORD* dest,
    INT destCapacity,
    const WORD* src,
    INT srcLength,
    LPCSTR locale,
    UErrorCode* pErrorCode
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int u_strToUpper(
    ref ushort dest,   // WORD* in/out
    int destCapacity,   // INT
    ref ushort src,   // WORD*
    int srcLength,   // INT
    [MarshalAs(UnmanagedType.LPStr)] string locale,   // LPCSTR
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_strToUpper(
    ByRef dest As UShort,   ' WORD* in/out
    destCapacity As Integer,   ' INT
    ByRef src As UShort,   ' WORD*
    srcLength As Integer,   ' INT
    <MarshalAs(UnmanagedType.LPStr)> locale As String,   ' LPCSTR
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As Integer
End Function
' dest : WORD* in/out
' destCapacity : INT
' src : WORD*
' srcLength : INT
' locale : LPCSTR
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function u_strToUpper Lib "icuuc" ( _
    ByRef dest As Integer, _
    ByVal destCapacity As Long, _
    ByRef src As Integer, _
    ByVal srcLength As Long, _
    ByVal locale As String, _
    ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

u_strToUpper = ctypes.cdll.icuuc.u_strToUpper
u_strToUpper.restype = ctypes.c_int
u_strToUpper.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # dest : WORD* in/out
    ctypes.c_int,  # destCapacity : INT
    ctypes.POINTER(ctypes.c_ushort),  # src : WORD*
    ctypes.c_int,  # srcLength : INT
    wintypes.LPCSTR,  # locale : LPCSTR
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
u_strToUpper = Fiddle::Function.new(
  lib['u_strToUpper'],
  [
    Fiddle::TYPE_VOIDP,  # dest : WORD* in/out
    Fiddle::TYPE_INT,  # destCapacity : INT
    Fiddle::TYPE_VOIDP,  # src : WORD*
    Fiddle::TYPE_INT,  # srcLength : INT
    Fiddle::TYPE_VOIDP,  # locale : LPCSTR
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn u_strToUpper(
        dest: *mut u16,  // WORD* in/out
        destCapacity: i32,  // INT
        src: *const u16,  // WORD*
        srcLength: i32,  // INT
        locale: *const u8,  // LPCSTR
        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 u_strToUpper(ref ushort dest, int destCapacity, ref ushort src, int srcLength, [MarshalAs(UnmanagedType.LPStr)] string locale, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_strToUpper' -Namespace Win32 -PassThru
# $api::u_strToUpper(dest, destCapacity, src, srcLength, locale, pErrorCode)
#uselib "icuuc.dll"
#func global u_strToUpper "u_strToUpper" sptr, sptr, sptr, sptr, sptr, sptr
; u_strToUpper varptr(dest), destCapacity, varptr(src), srcLength, locale, pErrorCode   ; 戻り値は stat
; dest : WORD* in/out -> "sptr"
; destCapacity : INT -> "sptr"
; src : WORD* -> "sptr"
; srcLength : INT -> "sptr"
; locale : LPCSTR -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global u_strToUpper "u_strToUpper" var, int, var, int, str, int
; res = u_strToUpper(dest, destCapacity, src, srcLength, locale, pErrorCode)
; dest : WORD* in/out -> "var"
; destCapacity : INT -> "int"
; src : WORD* -> "var"
; srcLength : INT -> "int"
; locale : LPCSTR -> "str"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT u_strToUpper(WORD* dest, INT destCapacity, WORD* src, INT srcLength, LPCSTR locale, UErrorCode* pErrorCode)
#uselib "icuuc.dll"
#cfunc global u_strToUpper "u_strToUpper" var, int, var, int, str, int
; res = u_strToUpper(dest, destCapacity, src, srcLength, locale, pErrorCode)
; dest : WORD* in/out -> "var"
; destCapacity : INT -> "int"
; src : WORD* -> "var"
; srcLength : INT -> "int"
; locale : LPCSTR -> "str"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procu_strToUpper = icuuc.NewProc("u_strToUpper")
)

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