ホーム › Globalization › uspoof_getAllowedLocales
uspoof_getAllowedLocales
関数許可するロケール一覧を取得する。
シグネチャ
// icuin.dll
#include <windows.h>
LPSTR uspoof_getAllowedLocales(
USpoofChecker* sc,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| sc | USpoofChecker* | inout | 対象のUSpoofCheckerへのポインター。 |
| status | UErrorCode* | inout | ICUのエラーコードを入出力するUErrorCodeへのポインター。 |
戻り値の型: LPSTR
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
LPSTR uspoof_getAllowedLocales(
USpoofChecker* sc,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr uspoof_getAllowedLocales(
ref IntPtr sc, // USpoofChecker* in/out
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uspoof_getAllowedLocales(
ByRef sc As IntPtr, ' USpoofChecker* in/out
ByRef status As Integer ' UErrorCode* in/out
) As IntPtr
End Function' sc : USpoofChecker* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function uspoof_getAllowedLocales Lib "icuin" ( _
ByRef sc As LongPtr, _
ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uspoof_getAllowedLocales = ctypes.cdll.icuin.uspoof_getAllowedLocales
uspoof_getAllowedLocales.restype = wintypes.LPSTR
uspoof_getAllowedLocales.argtypes = [
ctypes.c_void_p, # sc : USpoofChecker* in/out
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
uspoof_getAllowedLocales = Fiddle::Function.new(
lib['uspoof_getAllowedLocales'],
[
Fiddle::TYPE_VOIDP, # sc : USpoofChecker* in/out
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn uspoof_getAllowedLocales(
sc: *mut isize, // USpoofChecker* in/out
status: *mut i32 // UErrorCode* in/out
) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr uspoof_getAllowedLocales(ref IntPtr sc, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uspoof_getAllowedLocales' -Namespace Win32 -PassThru
# $api::uspoof_getAllowedLocales(sc, status)#uselib "icuin.dll"
#func global uspoof_getAllowedLocales "uspoof_getAllowedLocales" sptr, sptr
; uspoof_getAllowedLocales varptr(sc), varptr(status) ; 戻り値は stat
; sc : USpoofChecker* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global uspoof_getAllowedLocales "uspoof_getAllowedLocales" var, var ; res = uspoof_getAllowedLocales(sc, status) ; sc : USpoofChecker* in/out -> "var" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global uspoof_getAllowedLocales "uspoof_getAllowedLocales" sptr, sptr ; res = uspoof_getAllowedLocales(varptr(sc), varptr(status)) ; sc : USpoofChecker* in/out -> "sptr" ; status : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; LPSTR uspoof_getAllowedLocales(USpoofChecker* sc, UErrorCode* status) #uselib "icuin.dll" #cfunc global uspoof_getAllowedLocales "uspoof_getAllowedLocales" var, var ; res = uspoof_getAllowedLocales(sc, status) ; sc : USpoofChecker* in/out -> "var" ; status : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; LPSTR uspoof_getAllowedLocales(USpoofChecker* sc, UErrorCode* status) #uselib "icuin.dll" #cfunc global uspoof_getAllowedLocales "uspoof_getAllowedLocales" intptr, intptr ; res = uspoof_getAllowedLocales(varptr(sc), varptr(status)) ; sc : USpoofChecker* in/out -> "intptr" ; status : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procuspoof_getAllowedLocales = icuin.NewProc("uspoof_getAllowedLocales")
)
// sc (USpoofChecker* in/out), status (UErrorCode* in/out)
r1, _, err := procuspoof_getAllowedLocales.Call(
uintptr(sc),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPSTRfunction uspoof_getAllowedLocales(
sc: Pointer; // USpoofChecker* in/out
status: Pointer // UErrorCode* in/out
): PAnsiChar; cdecl;
external 'icuin.dll' name 'uspoof_getAllowedLocales';result := DllCall("icuin\uspoof_getAllowedLocales"
, "Ptr", sc ; USpoofChecker* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Ptr") ; return: LPSTR●uspoof_getAllowedLocales(sc, status) = DLL("icuin.dll", "char* uspoof_getAllowedLocales(void*, void*)")
# 呼び出し: uspoof_getAllowedLocales(sc, status)
# sc : USpoofChecker* in/out -> "void*"
# status : 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 "icuin" fn uspoof_getAllowedLocales(
sc: [*c]isize, // USpoofChecker* in/out
status: [*c]i32 // UErrorCode* in/out
) callconv(.c) [*c]const u8;proc uspoof_getAllowedLocales(
sc: ptr int, # USpoofChecker* in/out
status: ptr int32 # UErrorCode* in/out
): cstring {.importc: "uspoof_getAllowedLocales", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
const(char)* uspoof_getAllowedLocales(
ptrdiff_t* sc, // USpoofChecker* in/out
int* status // UErrorCode* in/out
);ccall((:uspoof_getAllowedLocales, "icuin.dll"), Cstring,
(Ptr{Int}, Ptr{Int32}),
sc, status)
# sc : USpoofChecker* in/out -> Ptr{Int}
# status : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
const char* uspoof_getAllowedLocales(
intptr_t* sc,
int32_t* status);
]]
local icuin = ffi.load("icuin")
-- icuin.uspoof_getAllowedLocales(sc, status)
-- sc : USpoofChecker* in/out
-- status : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const uspoof_getAllowedLocales = lib.func('__cdecl', 'uspoof_getAllowedLocales', 'void *', ['intptr_t *', 'int32_t *']);
// uspoof_getAllowedLocales(sc, status)
// sc : USpoofChecker* in/out -> 'intptr_t *'
// status : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
uspoof_getAllowedLocales: { parameters: ["pointer", "pointer"], result: "pointer" },
});
// lib.symbols.uspoof_getAllowedLocales(sc, status)
// sc : USpoofChecker* in/out -> "pointer"
// status : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
const char* uspoof_getAllowedLocales(
intptr_t* sc,
int32_t* status);
C, "icuin.dll");
// $ffi->uspoof_getAllowedLocales(sc, status);
// sc : USpoofChecker* in/out
// status : 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 Icuin extends Library {
Icuin INSTANCE = Native.load("icuin", Icuin.class);
Pointer uspoof_getAllowedLocales(
LongByReference sc, // USpoofChecker* in/out
IntByReference status // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun uspoof_getAllowedLocales = uspoof_getAllowedLocales(
sc : LibC::SSizeT*, # USpoofChecker* in/out
status : Int32* # UErrorCode* in/out
) : UInt8*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef uspoof_getAllowedLocalesNative = Pointer<Utf8> Function(Pointer<IntPtr>, Pointer<Int32>);
typedef uspoof_getAllowedLocalesDart = Pointer<Utf8> Function(Pointer<IntPtr>, Pointer<Int32>);
final uspoof_getAllowedLocales = DynamicLibrary.open('icuin.dll')
.lookupFunction<uspoof_getAllowedLocalesNative, uspoof_getAllowedLocalesDart>('uspoof_getAllowedLocales');
// sc : USpoofChecker* in/out -> Pointer<IntPtr>
// status : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function uspoof_getAllowedLocales(
sc: Pointer; // USpoofChecker* in/out
status: Pointer // UErrorCode* in/out
): PAnsiChar; cdecl;
external 'icuin.dll' name 'uspoof_getAllowedLocales';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "uspoof_getAllowedLocales"
c_uspoof_getAllowedLocales :: Ptr CIntPtr -> Ptr Int32 -> IO CString
-- sc : USpoofChecker* in/out -> Ptr CIntPtr
-- status : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let uspoof_getallowedlocales =
foreign "uspoof_getAllowedLocales"
((ptr intptr_t) @-> (ptr int32_t) @-> returning string)
(* sc : USpoofChecker* in/out -> (ptr intptr_t) *)
(* status : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)
(cffi:defcfun ("uspoof_getAllowedLocales" uspoof-get-allowed-locales :convention :cdecl) :string
(sc :pointer) ; USpoofChecker* in/out
(status :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $uspoof_getAllowedLocales = Win32::API::More->new('icuin',
'LPSTR uspoof_getAllowedLocales(LPVOID sc, LPVOID status)');
# my $ret = $uspoof_getAllowedLocales->Call($sc, $status);
# sc : USpoofChecker* in/out -> LPVOID
# status : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型