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

uspoof_setAllowedLocales

関数
許可するロケール一覧を設定する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

void uspoof_setAllowedLocales(
    USpoofChecker* sc,
    LPCSTR localesList,
    UErrorCode* status
);

パラメーター

名前方向説明
scUSpoofChecker*inout対象のUSpoofCheckerへのポインター。
localesListLPCSTRin許可するロケールをカンマ区切りで列挙したUTF-8文字列へのポインター。
statusUErrorCode*inoutICUのエラーコードを入出力するUErrorCodeへのポインター。

戻り値の型: void

各言語での呼び出し定義

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

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

uspoof_setAllowedLocales = ctypes.cdll.icuin.uspoof_setAllowedLocales
uspoof_setAllowedLocales.restype = None
uspoof_setAllowedLocales.argtypes = [
    ctypes.c_void_p,  # sc : USpoofChecker* in/out
    wintypes.LPCSTR,  # localesList : LPCSTR
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
uspoof_setAllowedLocales = Fiddle::Function.new(
  lib['uspoof_setAllowedLocales'],
  [
    Fiddle::TYPE_VOIDP,  # sc : USpoofChecker* in/out
    Fiddle::TYPE_VOIDP,  # localesList : LPCSTR
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn uspoof_setAllowedLocales(
        sc: *mut isize,  // USpoofChecker* in/out
        localesList: *const u8,  // LPCSTR
        status: *mut i32  // UErrorCode* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void uspoof_setAllowedLocales(ref IntPtr sc, [MarshalAs(UnmanagedType.LPStr)] string localesList, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uspoof_setAllowedLocales' -Namespace Win32 -PassThru
# $api::uspoof_setAllowedLocales(sc, localesList, status)
#uselib "icuin.dll"
#func global uspoof_setAllowedLocales "uspoof_setAllowedLocales" sptr, sptr, sptr
; uspoof_setAllowedLocales sc, localesList, status
; sc : USpoofChecker* in/out -> "sptr"
; localesList : LPCSTR -> "sptr"
; status : UErrorCode* in/out -> "sptr"
#uselib "icuin.dll"
#func global uspoof_setAllowedLocales "uspoof_setAllowedLocales" int, str, int
; uspoof_setAllowedLocales sc, localesList, status
; sc : USpoofChecker* in/out -> "int"
; localesList : LPCSTR -> "str"
; status : UErrorCode* in/out -> "int"
; void uspoof_setAllowedLocales(USpoofChecker* sc, LPCSTR localesList, UErrorCode* status)
#uselib "icuin.dll"
#func global uspoof_setAllowedLocales "uspoof_setAllowedLocales" int, str, int
; uspoof_setAllowedLocales sc, localesList, status
; sc : USpoofChecker* in/out -> "int"
; localesList : LPCSTR -> "str"
; status : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procuspoof_setAllowedLocales = icuin.NewProc("uspoof_setAllowedLocales")
)

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