ホーム › Globalization › umsg_autoQuoteApostrophe
umsg_autoQuoteApostrophe
関数パターン中のアポストロフィを自動的に引用化する。
シグネチャ
// icuin.dll
#include <windows.h>
INT umsg_autoQuoteApostrophe(
const WORD* pattern,
INT patternLength,
WORD* dest,
INT destCapacity,
UErrorCode* ec
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pattern | WORD* | in | アポストロフィを自動引用符化する対象のパターン文字列。UTF-16配列。 |
| patternLength | INT | in | パターンの長さ(UTF-16単位)。-1でNUL終端として扱う。 |
| dest | WORD* | inout | 変換後のパターンを受け取る出力バッファ。UTF-16のWORD配列。 |
| destCapacity | INT | in | 出力バッファの容量(UTF-16単位)。0で必要長の照会も可能。 |
| ec | UErrorCode* | inout | ICUのエラーコード。呼び出し前に成功値で初期化する。 |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT umsg_autoQuoteApostrophe(
const WORD* pattern,
INT patternLength,
WORD* dest,
INT destCapacity,
UErrorCode* ec
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int umsg_autoQuoteApostrophe(
ref ushort pattern, // WORD*
int patternLength, // INT
ref ushort dest, // WORD* in/out
int destCapacity, // INT
ref int ec // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function umsg_autoQuoteApostrophe(
ByRef pattern As UShort, ' WORD*
patternLength As Integer, ' INT
ByRef dest As UShort, ' WORD* in/out
destCapacity As Integer, ' INT
ByRef ec As Integer ' UErrorCode* in/out
) As Integer
End Function' pattern : WORD*
' patternLength : INT
' dest : WORD* in/out
' destCapacity : INT
' ec : UErrorCode* in/out
Declare PtrSafe Function umsg_autoQuoteApostrophe Lib "icuin" ( _
ByRef pattern As Integer, _
ByVal patternLength As Long, _
ByRef dest As Integer, _
ByVal destCapacity As Long, _
ByRef ec As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
umsg_autoQuoteApostrophe = ctypes.cdll.icuin.umsg_autoQuoteApostrophe
umsg_autoQuoteApostrophe.restype = ctypes.c_int
umsg_autoQuoteApostrophe.argtypes = [
ctypes.POINTER(ctypes.c_ushort), # pattern : WORD*
ctypes.c_int, # patternLength : INT
ctypes.POINTER(ctypes.c_ushort), # dest : WORD* in/out
ctypes.c_int, # destCapacity : INT
ctypes.c_void_p, # ec : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
umsg_autoQuoteApostrophe = Fiddle::Function.new(
lib['umsg_autoQuoteApostrophe'],
[
Fiddle::TYPE_VOIDP, # pattern : WORD*
Fiddle::TYPE_INT, # patternLength : INT
Fiddle::TYPE_VOIDP, # dest : WORD* in/out
Fiddle::TYPE_INT, # destCapacity : INT
Fiddle::TYPE_VOIDP, # ec : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn umsg_autoQuoteApostrophe(
pattern: *const u16, // WORD*
patternLength: i32, // INT
dest: *mut u16, // WORD* in/out
destCapacity: i32, // INT
ec: *mut i32 // UErrorCode* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int umsg_autoQuoteApostrophe(ref ushort pattern, int patternLength, ref ushort dest, int destCapacity, ref int ec);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_umsg_autoQuoteApostrophe' -Namespace Win32 -PassThru
# $api::umsg_autoQuoteApostrophe(pattern, patternLength, dest, destCapacity, ec)#uselib "icuin.dll"
#func global umsg_autoQuoteApostrophe "umsg_autoQuoteApostrophe" sptr, sptr, sptr, sptr, sptr
; umsg_autoQuoteApostrophe varptr(pattern), patternLength, varptr(dest), destCapacity, varptr(ec) ; 戻り値は stat
; pattern : WORD* -> "sptr"
; patternLength : INT -> "sptr"
; dest : WORD* in/out -> "sptr"
; destCapacity : INT -> "sptr"
; ec : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global umsg_autoQuoteApostrophe "umsg_autoQuoteApostrophe" var, int, var, int, var ; res = umsg_autoQuoteApostrophe(pattern, patternLength, dest, destCapacity, ec) ; pattern : WORD* -> "var" ; patternLength : INT -> "int" ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; ec : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global umsg_autoQuoteApostrophe "umsg_autoQuoteApostrophe" sptr, int, sptr, int, sptr ; res = umsg_autoQuoteApostrophe(varptr(pattern), patternLength, varptr(dest), destCapacity, varptr(ec)) ; pattern : WORD* -> "sptr" ; patternLength : INT -> "int" ; dest : WORD* in/out -> "sptr" ; destCapacity : INT -> "int" ; ec : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT umsg_autoQuoteApostrophe(WORD* pattern, INT patternLength, WORD* dest, INT destCapacity, UErrorCode* ec) #uselib "icuin.dll" #cfunc global umsg_autoQuoteApostrophe "umsg_autoQuoteApostrophe" var, int, var, int, var ; res = umsg_autoQuoteApostrophe(pattern, patternLength, dest, destCapacity, ec) ; pattern : WORD* -> "var" ; patternLength : INT -> "int" ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; ec : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT umsg_autoQuoteApostrophe(WORD* pattern, INT patternLength, WORD* dest, INT destCapacity, UErrorCode* ec) #uselib "icuin.dll" #cfunc global umsg_autoQuoteApostrophe "umsg_autoQuoteApostrophe" intptr, int, intptr, int, intptr ; res = umsg_autoQuoteApostrophe(varptr(pattern), patternLength, varptr(dest), destCapacity, varptr(ec)) ; pattern : WORD* -> "intptr" ; patternLength : INT -> "int" ; dest : WORD* in/out -> "intptr" ; destCapacity : INT -> "int" ; ec : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procumsg_autoQuoteApostrophe = icuin.NewProc("umsg_autoQuoteApostrophe")
)
// pattern (WORD*), patternLength (INT), dest (WORD* in/out), destCapacity (INT), ec (UErrorCode* in/out)
r1, _, err := procumsg_autoQuoteApostrophe.Call(
uintptr(pattern),
uintptr(patternLength),
uintptr(dest),
uintptr(destCapacity),
uintptr(ec),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction umsg_autoQuoteApostrophe(
pattern: Pointer; // WORD*
patternLength: Integer; // INT
dest: Pointer; // WORD* in/out
destCapacity: Integer; // INT
ec: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'umsg_autoQuoteApostrophe';result := DllCall("icuin\umsg_autoQuoteApostrophe"
, "Ptr", pattern ; WORD*
, "Int", patternLength ; INT
, "Ptr", dest ; WORD* in/out
, "Int", destCapacity ; INT
, "Ptr", ec ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●umsg_autoQuoteApostrophe(pattern, patternLength, dest, destCapacity, ec) = DLL("icuin.dll", "int umsg_autoQuoteApostrophe(void*, int, void*, int, void*)")
# 呼び出し: umsg_autoQuoteApostrophe(pattern, patternLength, dest, destCapacity, ec)
# pattern : WORD* -> "void*"
# patternLength : INT -> "int"
# dest : WORD* in/out -> "void*"
# destCapacity : INT -> "int"
# ec : 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 umsg_autoQuoteApostrophe(
pattern: [*c]u16, // WORD*
patternLength: i32, // INT
dest: [*c]u16, // WORD* in/out
destCapacity: i32, // INT
ec: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;proc umsg_autoQuoteApostrophe(
pattern: ptr uint16, # WORD*
patternLength: int32, # INT
dest: ptr uint16, # WORD* in/out
destCapacity: int32, # INT
ec: ptr int32 # UErrorCode* in/out
): int32 {.importc: "umsg_autoQuoteApostrophe", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
int umsg_autoQuoteApostrophe(
ushort* pattern, // WORD*
int patternLength, // INT
ushort* dest, // WORD* in/out
int destCapacity, // INT
int* ec // UErrorCode* in/out
);ccall((:umsg_autoQuoteApostrophe, "icuin.dll"), Int32,
(Ptr{UInt16}, Int32, Ptr{UInt16}, Int32, Ptr{Int32}),
pattern, patternLength, dest, destCapacity, ec)
# pattern : WORD* -> Ptr{UInt16}
# patternLength : INT -> Int32
# dest : WORD* in/out -> Ptr{UInt16}
# destCapacity : INT -> Int32
# ec : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
int32_t umsg_autoQuoteApostrophe(
uint16_t* pattern,
int32_t patternLength,
uint16_t* dest,
int32_t destCapacity,
int32_t* ec);
]]
local icuin = ffi.load("icuin")
-- icuin.umsg_autoQuoteApostrophe(pattern, patternLength, dest, destCapacity, ec)
-- pattern : WORD*
-- patternLength : INT
-- dest : WORD* in/out
-- destCapacity : INT
-- ec : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const umsg_autoQuoteApostrophe = lib.func('__cdecl', 'umsg_autoQuoteApostrophe', 'int32_t', ['uint16_t *', 'int32_t', 'uint16_t *', 'int32_t', 'int32_t *']);
// umsg_autoQuoteApostrophe(pattern, patternLength, dest, destCapacity, ec)
// pattern : WORD* -> 'uint16_t *'
// patternLength : INT -> 'int32_t'
// dest : WORD* in/out -> 'uint16_t *'
// destCapacity : INT -> 'int32_t'
// ec : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
umsg_autoQuoteApostrophe: { parameters: ["pointer", "i32", "pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.umsg_autoQuoteApostrophe(pattern, patternLength, dest, destCapacity, ec)
// pattern : WORD* -> "pointer"
// patternLength : INT -> "i32"
// dest : WORD* in/out -> "pointer"
// destCapacity : INT -> "i32"
// ec : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t umsg_autoQuoteApostrophe(
uint16_t* pattern,
int32_t patternLength,
uint16_t* dest,
int32_t destCapacity,
int32_t* ec);
C, "icuin.dll");
// $ffi->umsg_autoQuoteApostrophe(pattern, patternLength, dest, destCapacity, ec);
// pattern : WORD*
// patternLength : INT
// dest : WORD* in/out
// destCapacity : INT
// ec : 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);
int umsg_autoQuoteApostrophe(
ShortByReference pattern, // WORD*
int patternLength, // INT
ShortByReference dest, // WORD* in/out
int destCapacity, // INT
IntByReference ec // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun umsg_autoQuoteApostrophe = umsg_autoQuoteApostrophe(
pattern : UInt16*, # WORD*
patternLength : Int32, # INT
dest : UInt16*, # WORD* in/out
destCapacity : Int32, # INT
ec : Int32* # UErrorCode* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef umsg_autoQuoteApostropheNative = Int32 Function(Pointer<Uint16>, Int32, Pointer<Uint16>, Int32, Pointer<Int32>);
typedef umsg_autoQuoteApostropheDart = int Function(Pointer<Uint16>, int, Pointer<Uint16>, int, Pointer<Int32>);
final umsg_autoQuoteApostrophe = DynamicLibrary.open('icuin.dll')
.lookupFunction<umsg_autoQuoteApostropheNative, umsg_autoQuoteApostropheDart>('umsg_autoQuoteApostrophe');
// pattern : WORD* -> Pointer<Uint16>
// patternLength : INT -> Int32
// dest : WORD* in/out -> Pointer<Uint16>
// destCapacity : INT -> Int32
// ec : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function umsg_autoQuoteApostrophe(
pattern: Pointer; // WORD*
patternLength: Integer; // INT
dest: Pointer; // WORD* in/out
destCapacity: Integer; // INT
ec: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'umsg_autoQuoteApostrophe';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "umsg_autoQuoteApostrophe"
c_umsg_autoQuoteApostrophe :: Ptr Word16 -> Int32 -> Ptr Word16 -> Int32 -> Ptr Int32 -> IO Int32
-- pattern : WORD* -> Ptr Word16
-- patternLength : INT -> Int32
-- dest : WORD* in/out -> Ptr Word16
-- destCapacity : INT -> Int32
-- ec : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let umsg_autoquoteapostrophe =
foreign "umsg_autoQuoteApostrophe"
((ptr uint16_t) @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* pattern : WORD* -> (ptr uint16_t) *)
(* patternLength : INT -> int32_t *)
(* dest : WORD* in/out -> (ptr uint16_t) *)
(* destCapacity : INT -> int32_t *)
(* ec : 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 ("umsg_autoQuoteApostrophe" umsg-auto-quote-apostrophe :convention :cdecl) :int32
(pattern :pointer) ; WORD*
(pattern-length :int32) ; INT
(dest :pointer) ; WORD* in/out
(dest-capacity :int32) ; INT
(ec :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $umsg_autoQuoteApostrophe = Win32::API::More->new('icuin',
'int umsg_autoQuoteApostrophe(LPVOID pattern, int patternLength, LPVOID dest, int destCapacity, LPVOID ec)');
# my $ret = $umsg_autoQuoteApostrophe->Call($pattern, $patternLength, $dest, $destCapacity, $ec);
# pattern : WORD* -> LPVOID
# patternLength : INT -> int
# dest : WORD* in/out -> LPVOID
# destCapacity : INT -> int
# ec : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型