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

ucasemap_setLocale

関数
大文字小文字変換マップにロケールを設定する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

void ucasemap_setLocale(
    UCaseMap* csm,
    LPCSTR locale,
    UErrorCode* pErrorCode
);

パラメーター

名前方向説明
csmUCaseMap*inoutロケールを設定する対象のUCaseMapを指す。
localeLPCSTRin新たに設定するロケールID。NULLで既定ロケール。
pErrorCodeUErrorCode*inoutICUエラーコードを入出力するポインタ。呼出前に成功値で初期化する。

戻り値の型: void

各言語での呼び出し定義

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

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

ucasemap_setLocale = ctypes.cdll.icuuc.ucasemap_setLocale
ucasemap_setLocale.restype = None
ucasemap_setLocale.argtypes = [
    ctypes.c_void_p,  # csm : UCaseMap* in/out
    wintypes.LPCSTR,  # locale : LPCSTR
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ucasemap_setLocale = Fiddle::Function.new(
  lib['ucasemap_setLocale'],
  [
    Fiddle::TYPE_VOIDP,  # csm : UCaseMap* in/out
    Fiddle::TYPE_VOIDP,  # locale : LPCSTR
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ucasemap_setLocale(
        csm: *mut isize,  // UCaseMap* in/out
        locale: *const u8,  // LPCSTR
        pErrorCode: *mut i32  // UErrorCode* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ucasemap_setLocale(ref IntPtr csm, [MarshalAs(UnmanagedType.LPStr)] string locale, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucasemap_setLocale' -Namespace Win32 -PassThru
# $api::ucasemap_setLocale(csm, locale, pErrorCode)
#uselib "icuuc.dll"
#func global ucasemap_setLocale "ucasemap_setLocale" sptr, sptr, sptr
; ucasemap_setLocale varptr(csm), locale, varptr(pErrorCode)
; csm : UCaseMap* in/out -> "sptr"
; locale : LPCSTR -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
出力引数:
#uselib "icuuc.dll"
#func global ucasemap_setLocale "ucasemap_setLocale" var, str, var
; ucasemap_setLocale csm, locale, pErrorCode
; csm : UCaseMap* in/out -> "var"
; locale : LPCSTR -> "str"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void ucasemap_setLocale(UCaseMap* csm, LPCSTR locale, UErrorCode* pErrorCode)
#uselib "icuuc.dll"
#func global ucasemap_setLocale "ucasemap_setLocale" var, str, var
; ucasemap_setLocale csm, locale, pErrorCode
; csm : UCaseMap* in/out -> "var"
; locale : LPCSTR -> "str"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucasemap_setLocale = icuuc.NewProc("ucasemap_setLocale")
)

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

extern "icuuc" fn ucasemap_setLocale(
    csm: [*c]isize, // UCaseMap* in/out
    locale: [*c]const u8, // LPCSTR
    pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) void;
proc ucasemap_setLocale(
    csm: ptr int,  # UCaseMap* in/out
    locale: cstring,  # LPCSTR
    pErrorCode: ptr int32  # UErrorCode* in/out
) {.importc: "ucasemap_setLocale", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
void ucasemap_setLocale(
    ptrdiff_t* csm,   // UCaseMap* in/out
    const(char)* locale,   // LPCSTR
    int* pErrorCode   // UErrorCode* in/out
);
ccall((:ucasemap_setLocale, "icuuc.dll"), Cvoid,
      (Ptr{Int}, Cstring, Ptr{Int32}),
      csm, locale, pErrorCode)
# csm : UCaseMap* in/out -> Ptr{Int}
# locale : LPCSTR -> Cstring
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
void ucasemap_setLocale(
    intptr_t* csm,
    const char* locale,
    int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.ucasemap_setLocale(csm, locale, pErrorCode)
-- csm : UCaseMap* in/out
-- locale : LPCSTR
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const ucasemap_setLocale = lib.func('__cdecl', 'ucasemap_setLocale', 'void', ['intptr_t *', 'str', 'int32_t *']);
// ucasemap_setLocale(csm, locale, pErrorCode)
// csm : UCaseMap* in/out -> 'intptr_t *'
// locale : LPCSTR -> 'str'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  ucasemap_setLocale: { parameters: ["pointer", "buffer", "pointer"], result: "void" },
});
// lib.symbols.ucasemap_setLocale(csm, locale, pErrorCode)
// csm : UCaseMap* in/out -> "pointer"
// locale : LPCSTR -> "buffer"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void ucasemap_setLocale(
    intptr_t* csm,
    const char* locale,
    int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->ucasemap_setLocale(csm, locale, pErrorCode);
// csm : UCaseMap* in/out
// locale : LPCSTR
// pErrorCode : UErrorCode* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icuuc extends Library {
    Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
    void ucasemap_setLocale(
        LongByReference csm,   // UCaseMap* in/out
        String locale,   // LPCSTR
        IntByReference pErrorCode   // UErrorCode* in/out
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun ucasemap_setLocale = ucasemap_setLocale(
    csm : LibC::SSizeT*,   # UCaseMap* in/out
    locale : UInt8*,   # LPCSTR
    pErrorCode : Int32*   # UErrorCode* in/out
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ucasemap_setLocaleNative = Void Function(Pointer<IntPtr>, Pointer<Utf8>, Pointer<Int32>);
typedef ucasemap_setLocaleDart = void Function(Pointer<IntPtr>, Pointer<Utf8>, Pointer<Int32>);
final ucasemap_setLocale = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<ucasemap_setLocaleNative, ucasemap_setLocaleDart>('ucasemap_setLocale');
// csm : UCaseMap* in/out -> Pointer<IntPtr>
// locale : LPCSTR -> Pointer<Utf8>
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure ucasemap_setLocale(
  csm: Pointer;   // UCaseMap* in/out
  locale: PAnsiChar;   // LPCSTR
  pErrorCode: Pointer   // UErrorCode* in/out
); cdecl;
  external 'icuuc.dll' name 'ucasemap_setLocale';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ucasemap_setLocale"
  c_ucasemap_setLocale :: Ptr CIntPtr -> CString -> Ptr Int32 -> IO ()
-- csm : UCaseMap* in/out -> Ptr CIntPtr
-- locale : LPCSTR -> CString
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ucasemap_setlocale =
  foreign "ucasemap_setLocale"
    ((ptr intptr_t) @-> string @-> (ptr int32_t) @-> returning void)
(* csm : UCaseMap* in/out -> (ptr intptr_t) *)
(* locale : LPCSTR -> string *)
(* pErrorCode : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)

(cffi:defcfun ("ucasemap_setLocale" ucasemap-set-locale :convention :cdecl) :void
  (csm :pointer)   ; UCaseMap* in/out
  (locale :string)   ; LPCSTR
  (p-error-code :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ucasemap_setLocale = Win32::API::More->new('icuuc',
    'void ucasemap_setLocale(LPVOID csm, LPCSTR locale, LPVOID pErrorCode)');
# my $ret = $ucasemap_setLocale->Call($csm, $locale, $pErrorCode);
# csm : UCaseMap* in/out -> LPVOID
# locale : LPCSTR -> LPCSTR
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型