ホーム › Globalization › uloc_isRightToLeft
uloc_isRightToLeft
関数指定ロケールが右から左へ書く言語かどうかを判定する。
シグネチャ
// icuuc.dll
#include <windows.h>
CHAR uloc_isRightToLeft(
LPCSTR locale
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| locale | LPCSTR | in | 右横書き(RTL)言語か判定する対象のロケールID。 |
戻り値の型: CHAR
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
CHAR uloc_isRightToLeft(
LPCSTR locale
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern sbyte uloc_isRightToLeft(
[MarshalAs(UnmanagedType.LPStr)] string locale // LPCSTR
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uloc_isRightToLeft(
<MarshalAs(UnmanagedType.LPStr)> locale As String ' LPCSTR
) As SByte
End Function' locale : LPCSTR
Declare PtrSafe Function uloc_isRightToLeft Lib "icuuc" ( _
ByVal locale As String) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uloc_isRightToLeft = ctypes.cdll.icuuc.uloc_isRightToLeft
uloc_isRightToLeft.restype = ctypes.c_byte
uloc_isRightToLeft.argtypes = [
wintypes.LPCSTR, # locale : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
uloc_isRightToLeft = Fiddle::Function.new(
lib['uloc_isRightToLeft'],
[
Fiddle::TYPE_VOIDP, # locale : LPCSTR
],
Fiddle::TYPE_CHAR, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn uloc_isRightToLeft(
locale: *const u8 // LPCSTR
) -> i8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte uloc_isRightToLeft([MarshalAs(UnmanagedType.LPStr)] string locale);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uloc_isRightToLeft' -Namespace Win32 -PassThru
# $api::uloc_isRightToLeft(locale)#uselib "icuuc.dll"
#func global uloc_isRightToLeft "uloc_isRightToLeft" sptr
; uloc_isRightToLeft locale ; 戻り値は stat
; locale : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuuc.dll"
#cfunc global uloc_isRightToLeft "uloc_isRightToLeft" str
; res = uloc_isRightToLeft(locale)
; locale : LPCSTR -> "str"; CHAR uloc_isRightToLeft(LPCSTR locale)
#uselib "icuuc.dll"
#cfunc global uloc_isRightToLeft "uloc_isRightToLeft" str
; res = uloc_isRightToLeft(locale)
; locale : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
proculoc_isRightToLeft = icuuc.NewProc("uloc_isRightToLeft")
)
// locale (LPCSTR)
r1, _, err := proculoc_isRightToLeft.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CHARfunction uloc_isRightToLeft(
locale: PAnsiChar // LPCSTR
): Shortint; cdecl;
external 'icuuc.dll' name 'uloc_isRightToLeft';result := DllCall("icuuc\uloc_isRightToLeft"
, "AStr", locale ; LPCSTR
, "Cdecl Char") ; return: CHAR●uloc_isRightToLeft(locale) = DLL("icuuc.dll", "char uloc_isRightToLeft(char*)")
# 呼び出し: uloc_isRightToLeft(locale)
# locale : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuuc" fn uloc_isRightToLeft(
locale: [*c]const u8 // LPCSTR
) callconv(.c) i8;proc uloc_isRightToLeft(
locale: cstring # LPCSTR
): int8 {.importc: "uloc_isRightToLeft", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
byte uloc_isRightToLeft(
const(char)* locale // LPCSTR
);ccall((:uloc_isRightToLeft, "icuuc.dll"), Int8,
(Cstring,),
locale)
# locale : LPCSTR -> Cstringlocal ffi = require("ffi")
ffi.cdef[[
int8_t uloc_isRightToLeft(
const char* locale);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.uloc_isRightToLeft(locale)
-- locale : LPCSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const uloc_isRightToLeft = lib.func('__cdecl', 'uloc_isRightToLeft', 'int8_t', ['str']);
// uloc_isRightToLeft(locale)
// locale : LPCSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
uloc_isRightToLeft: { parameters: ["buffer"], result: "i8" },
});
// lib.symbols.uloc_isRightToLeft(locale)
// locale : LPCSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int8_t uloc_isRightToLeft(
const char* locale);
C, "icuuc.dll");
// $ffi->uloc_isRightToLeft(locale);
// locale : LPCSTR
// 構造体/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);
byte uloc_isRightToLeft(
String locale // LPCSTR
);
}@[Link("icuuc")]
lib Libicuuc
fun uloc_isRightToLeft = uloc_isRightToLeft(
locale : UInt8* # LPCSTR
) : Int8
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef uloc_isRightToLeftNative = Int8 Function(Pointer<Utf8>);
typedef uloc_isRightToLeftDart = int Function(Pointer<Utf8>);
final uloc_isRightToLeft = DynamicLibrary.open('icuuc.dll')
.lookupFunction<uloc_isRightToLeftNative, uloc_isRightToLeftDart>('uloc_isRightToLeft');
// locale : LPCSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function uloc_isRightToLeft(
locale: PAnsiChar // LPCSTR
): Shortint; cdecl;
external 'icuuc.dll' name 'uloc_isRightToLeft';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "uloc_isRightToLeft"
c_uloc_isRightToLeft :: CString -> IO Int8
-- locale : LPCSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let uloc_isrighttoleft =
foreign "uloc_isRightToLeft"
(string @-> returning int8_t)
(* locale : LPCSTR -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)
(cffi:defcfun ("uloc_isRightToLeft" uloc-is-right-to-left :convention :cdecl) :int8
(locale :string)) ; LPCSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $uloc_isRightToLeft = Win32::API::More->new('icuuc',
'char uloc_isRightToLeft(LPCSTR locale)');
# my $ret = $uloc_isRightToLeft->Call($locale);
# locale : LPCSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。