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

uscript_getCode

関数
スクリプト名や略称・ロケールからスクリプトコードを取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT uscript_getCode(
    LPCSTR nameOrAbbrOrLocale,
    UScriptCode* fillIn,
    INT capacity,
    UErrorCode* err
);

パラメーター

名前方向
nameOrAbbrOrLocaleLPCSTRin
fillInUScriptCode*inout
capacityINTin
errUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

uscript_getCode = ctypes.cdll.icuuc.uscript_getCode
uscript_getCode.restype = ctypes.c_int
uscript_getCode.argtypes = [
    wintypes.LPCSTR,  # nameOrAbbrOrLocale : LPCSTR
    ctypes.c_void_p,  # fillIn : UScriptCode* in/out
    ctypes.c_int,  # capacity : INT
    ctypes.c_void_p,  # err : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
uscript_getCode = Fiddle::Function.new(
  lib['uscript_getCode'],
  [
    Fiddle::TYPE_VOIDP,  # nameOrAbbrOrLocale : LPCSTR
    Fiddle::TYPE_VOIDP,  # fillIn : UScriptCode* in/out
    Fiddle::TYPE_INT,  # capacity : INT
    Fiddle::TYPE_VOIDP,  # err : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn uscript_getCode(
        nameOrAbbrOrLocale: *const u8,  // LPCSTR
        fillIn: *mut i32,  // UScriptCode* in/out
        capacity: i32,  // INT
        err: *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 uscript_getCode([MarshalAs(UnmanagedType.LPStr)] string nameOrAbbrOrLocale, ref int fillIn, int capacity, ref int err);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uscript_getCode' -Namespace Win32 -PassThru
# $api::uscript_getCode(nameOrAbbrOrLocale, fillIn, capacity, err)
#uselib "icuuc.dll"
#func global uscript_getCode "uscript_getCode" sptr, sptr, sptr, sptr
; uscript_getCode nameOrAbbrOrLocale, fillIn, capacity, err   ; 戻り値は stat
; nameOrAbbrOrLocale : LPCSTR -> "sptr"
; fillIn : UScriptCode* in/out -> "sptr"
; capacity : INT -> "sptr"
; err : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuuc.dll"
#cfunc global uscript_getCode "uscript_getCode" str, int, int, int
; res = uscript_getCode(nameOrAbbrOrLocale, fillIn, capacity, err)
; nameOrAbbrOrLocale : LPCSTR -> "str"
; fillIn : UScriptCode* in/out -> "int"
; capacity : INT -> "int"
; err : UErrorCode* in/out -> "int"
; INT uscript_getCode(LPCSTR nameOrAbbrOrLocale, UScriptCode* fillIn, INT capacity, UErrorCode* err)
#uselib "icuuc.dll"
#cfunc global uscript_getCode "uscript_getCode" str, int, int, int
; res = uscript_getCode(nameOrAbbrOrLocale, fillIn, capacity, err)
; nameOrAbbrOrLocale : LPCSTR -> "str"
; fillIn : UScriptCode* in/out -> "int"
; capacity : INT -> "int"
; err : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procuscript_getCode = icuuc.NewProc("uscript_getCode")
)

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