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

ucasemap_open

関数
ロケールとオプションを指定して大文字小文字変換マップを開く。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

UCaseMap* ucasemap_open(
    LPCSTR locale,
    DWORD options,
    UErrorCode* pErrorCode
);

パラメーター

名前方向説明
localeLPCSTRinケース変換に用いるロケールID。NULLで既定ロケール。
optionsDWORDinケースマッピング動作の指定ビット。U_FOLD_CASE_DEFAULT等。
pErrorCodeUErrorCode*inoutICUエラーコードを入出力するポインタ。呼出前に成功値で初期化する。

戻り値の型: UCaseMap*

各言語での呼び出し定義

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

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

ucasemap_open = ctypes.cdll.icuuc.ucasemap_open
ucasemap_open.restype = ctypes.c_void_p
ucasemap_open.argtypes = [
    wintypes.LPCSTR,  # locale : LPCSTR
    wintypes.DWORD,  # options : DWORD
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ucasemap_open = Fiddle::Function.new(
  lib['ucasemap_open'],
  [
    Fiddle::TYPE_VOIDP,  # locale : LPCSTR
    -Fiddle::TYPE_INT,  # options : DWORD
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ucasemap_open(
        locale: *const u8,  // LPCSTR
        options: u32,  // DWORD
        pErrorCode: *mut i32  // UErrorCode* in/out
    ) -> *mut isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ucasemap_open([MarshalAs(UnmanagedType.LPStr)] string locale, uint options, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucasemap_open' -Namespace Win32 -PassThru
# $api::ucasemap_open(locale, options, pErrorCode)
#uselib "icuuc.dll"
#func global ucasemap_open "ucasemap_open" sptr, sptr, sptr
; ucasemap_open locale, options, varptr(pErrorCode)   ; 戻り値は stat
; locale : LPCSTR -> "sptr"
; options : DWORD -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global ucasemap_open "ucasemap_open" str, int, var
; res = ucasemap_open(locale, options, pErrorCode)
; locale : LPCSTR -> "str"
; options : DWORD -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; UCaseMap* ucasemap_open(LPCSTR locale, DWORD options, UErrorCode* pErrorCode)
#uselib "icuuc.dll"
#cfunc global ucasemap_open "ucasemap_open" str, int, var
; res = ucasemap_open(locale, options, pErrorCode)
; locale : LPCSTR -> "str"
; options : DWORD -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucasemap_open = icuuc.NewProc("ucasemap_open")
)

// locale (LPCSTR), options (DWORD), pErrorCode (UErrorCode* in/out)
r1, _, err := procucasemap_open.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
	uintptr(options),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UCaseMap*
function ucasemap_open(
  locale: PAnsiChar;   // LPCSTR
  options: DWORD;   // DWORD
  pErrorCode: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icuuc.dll' name 'ucasemap_open';
result := DllCall("icuuc\ucasemap_open"
    , "AStr", locale   ; LPCSTR
    , "UInt", options   ; DWORD
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: UCaseMap*
●ucasemap_open(locale, options, pErrorCode) = DLL("icuuc.dll", "void* ucasemap_open(char*, dword, void*)")
# 呼び出し: ucasemap_open(locale, options, pErrorCode)
# locale : LPCSTR -> "char*"
# options : DWORD -> "dword"
# 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_open(
    locale: [*c]const u8, // LPCSTR
    options: u32, // DWORD
    pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) [*c]isize;
proc ucasemap_open(
    locale: cstring,  # LPCSTR
    options: uint32,  # DWORD
    pErrorCode: ptr int32  # UErrorCode* in/out
): ptr int {.importc: "ucasemap_open", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
ptrdiff_t* ucasemap_open(
    const(char)* locale,   // LPCSTR
    uint options,   // DWORD
    int* pErrorCode   // UErrorCode* in/out
);
ccall((:ucasemap_open, "icuuc.dll"), Ptr{Int},
      (Cstring, UInt32, Ptr{Int32}),
      locale, options, pErrorCode)
# locale : LPCSTR -> Cstring
# options : DWORD -> UInt32
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
intptr_t* ucasemap_open(
    const char* locale,
    uint32_t options,
    int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.ucasemap_open(locale, options, pErrorCode)
-- locale : LPCSTR
-- options : DWORD
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const ucasemap_open = lib.func('__cdecl', 'ucasemap_open', 'intptr_t *', ['str', 'uint32_t', 'int32_t *']);
// ucasemap_open(locale, options, pErrorCode)
// locale : LPCSTR -> 'str'
// options : DWORD -> 'uint32_t'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  ucasemap_open: { parameters: ["buffer", "u32", "pointer"], result: "pointer" },
});
// lib.symbols.ucasemap_open(locale, options, pErrorCode)
// locale : LPCSTR -> "buffer"
// options : DWORD -> "u32"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
intptr_t* ucasemap_open(
    const char* locale,
    uint32_t options,
    int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->ucasemap_open(locale, options, pErrorCode);
// locale : LPCSTR
// options : DWORD
// 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);
    Pointer ucasemap_open(
        String locale,   // LPCSTR
        int options,   // DWORD
        IntByReference pErrorCode   // UErrorCode* in/out
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun ucasemap_open = ucasemap_open(
    locale : UInt8*,   # LPCSTR
    options : UInt32,   # DWORD
    pErrorCode : Int32*   # UErrorCode* in/out
  ) : LibC::SSizeT*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ucasemap_openNative = Pointer<IntPtr> Function(Pointer<Utf8>, Uint32, Pointer<Int32>);
typedef ucasemap_openDart = Pointer<IntPtr> Function(Pointer<Utf8>, int, Pointer<Int32>);
final ucasemap_open = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<ucasemap_openNative, ucasemap_openDart>('ucasemap_open');
// locale : LPCSTR -> Pointer<Utf8>
// options : DWORD -> Uint32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ucasemap_open(
  locale: PAnsiChar;   // LPCSTR
  options: DWORD;   // DWORD
  pErrorCode: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icuuc.dll' name 'ucasemap_open';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

let ucasemap_open =
  foreign "ucasemap_open"
    (string @-> uint32_t @-> (ptr int32_t) @-> returning (ptr intptr_t))
(* locale : LPCSTR -> string *)
(* options : DWORD -> uint32_t *)
(* 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_open" ucasemap-open :convention :cdecl) :pointer
  (locale :string)   ; LPCSTR
  (options :uint32)   ; DWORD
  (p-error-code :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ucasemap_open = Win32::API::More->new('icuuc',
    'LPVOID ucasemap_open(LPCSTR locale, DWORD options, LPVOID pErrorCode)');
# my $ret = $ucasemap_open->Call($locale, $options, $pErrorCode);
# locale : LPCSTR -> LPCSTR
# options : DWORD -> DWORD
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型