ホーム › Globalization › ScriptBreak
ScriptBreak
関数文字列の論理的な改行・分割属性を取得する。
シグネチャ
// USP10.dll
#include <windows.h>
HRESULT ScriptBreak(
LPCWSTR pwcChars,
INT cChars,
const SCRIPT_ANALYSIS* psa,
SCRIPT_LOGATTR* psla
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pwcChars | LPCWSTR | in |
| cChars | INT | in |
| psa | SCRIPT_ANALYSIS* | in |
| psla | SCRIPT_LOGATTR* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// USP10.dll
#include <windows.h>
HRESULT ScriptBreak(
LPCWSTR pwcChars,
INT cChars,
const SCRIPT_ANALYSIS* psa,
SCRIPT_LOGATTR* psla
);[DllImport("USP10.dll", ExactSpelling = true)]
static extern int ScriptBreak(
[MarshalAs(UnmanagedType.LPWStr)] string pwcChars, // LPCWSTR
int cChars, // INT
IntPtr psa, // SCRIPT_ANALYSIS*
IntPtr psla // SCRIPT_LOGATTR* out
);<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptBreak(
<MarshalAs(UnmanagedType.LPWStr)> pwcChars As String, ' LPCWSTR
cChars As Integer, ' INT
psa As IntPtr, ' SCRIPT_ANALYSIS*
psla As IntPtr ' SCRIPT_LOGATTR* out
) As Integer
End Function' pwcChars : LPCWSTR
' cChars : INT
' psa : SCRIPT_ANALYSIS*
' psla : SCRIPT_LOGATTR* out
Declare PtrSafe Function ScriptBreak Lib "usp10" ( _
ByVal pwcChars As LongPtr, _
ByVal cChars As Long, _
ByVal psa As LongPtr, _
ByVal psla As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ScriptBreak = ctypes.windll.usp10.ScriptBreak
ScriptBreak.restype = ctypes.c_int
ScriptBreak.argtypes = [
wintypes.LPCWSTR, # pwcChars : LPCWSTR
ctypes.c_int, # cChars : INT
ctypes.c_void_p, # psa : SCRIPT_ANALYSIS*
ctypes.c_void_p, # psla : SCRIPT_LOGATTR* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USP10.dll')
ScriptBreak = Fiddle::Function.new(
lib['ScriptBreak'],
[
Fiddle::TYPE_VOIDP, # pwcChars : LPCWSTR
Fiddle::TYPE_INT, # cChars : INT
Fiddle::TYPE_VOIDP, # psa : SCRIPT_ANALYSIS*
Fiddle::TYPE_VOIDP, # psla : SCRIPT_LOGATTR* out
],
Fiddle::TYPE_INT)#[link(name = "usp10")]
extern "system" {
fn ScriptBreak(
pwcChars: *const u16, // LPCWSTR
cChars: i32, // INT
psa: *const SCRIPT_ANALYSIS, // SCRIPT_ANALYSIS*
psla: *mut SCRIPT_LOGATTR // SCRIPT_LOGATTR* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USP10.dll")]
public static extern int ScriptBreak([MarshalAs(UnmanagedType.LPWStr)] string pwcChars, int cChars, IntPtr psa, IntPtr psla);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptBreak' -Namespace Win32 -PassThru
# $api::ScriptBreak(pwcChars, cChars, psa, psla)#uselib "USP10.dll"
#func global ScriptBreak "ScriptBreak" sptr, sptr, sptr, sptr
; ScriptBreak pwcChars, cChars, varptr(psa), varptr(psla) ; 戻り値は stat
; pwcChars : LPCWSTR -> "sptr"
; cChars : INT -> "sptr"
; psa : SCRIPT_ANALYSIS* -> "sptr"
; psla : SCRIPT_LOGATTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USP10.dll" #cfunc global ScriptBreak "ScriptBreak" wstr, int, var, var ; res = ScriptBreak(pwcChars, cChars, psa, psla) ; pwcChars : LPCWSTR -> "wstr" ; cChars : INT -> "int" ; psa : SCRIPT_ANALYSIS* -> "var" ; psla : SCRIPT_LOGATTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USP10.dll" #cfunc global ScriptBreak "ScriptBreak" wstr, int, sptr, sptr ; res = ScriptBreak(pwcChars, cChars, varptr(psa), varptr(psla)) ; pwcChars : LPCWSTR -> "wstr" ; cChars : INT -> "int" ; psa : SCRIPT_ANALYSIS* -> "sptr" ; psla : SCRIPT_LOGATTR* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT ScriptBreak(LPCWSTR pwcChars, INT cChars, SCRIPT_ANALYSIS* psa, SCRIPT_LOGATTR* psla) #uselib "USP10.dll" #cfunc global ScriptBreak "ScriptBreak" wstr, int, var, var ; res = ScriptBreak(pwcChars, cChars, psa, psla) ; pwcChars : LPCWSTR -> "wstr" ; cChars : INT -> "int" ; psa : SCRIPT_ANALYSIS* -> "var" ; psla : SCRIPT_LOGATTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT ScriptBreak(LPCWSTR pwcChars, INT cChars, SCRIPT_ANALYSIS* psa, SCRIPT_LOGATTR* psla) #uselib "USP10.dll" #cfunc global ScriptBreak "ScriptBreak" wstr, int, intptr, intptr ; res = ScriptBreak(pwcChars, cChars, varptr(psa), varptr(psla)) ; pwcChars : LPCWSTR -> "wstr" ; cChars : INT -> "int" ; psa : SCRIPT_ANALYSIS* -> "intptr" ; psla : SCRIPT_LOGATTR* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
usp10 = windows.NewLazySystemDLL("USP10.dll")
procScriptBreak = usp10.NewProc("ScriptBreak")
)
// pwcChars (LPCWSTR), cChars (INT), psa (SCRIPT_ANALYSIS*), psla (SCRIPT_LOGATTR* out)
r1, _, err := procScriptBreak.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwcChars))),
uintptr(cChars),
uintptr(psa),
uintptr(psla),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction ScriptBreak(
pwcChars: PWideChar; // LPCWSTR
cChars: Integer; // INT
psa: Pointer; // SCRIPT_ANALYSIS*
psla: Pointer // SCRIPT_LOGATTR* out
): Integer; stdcall;
external 'USP10.dll' name 'ScriptBreak';result := DllCall("USP10\ScriptBreak"
, "WStr", pwcChars ; LPCWSTR
, "Int", cChars ; INT
, "Ptr", psa ; SCRIPT_ANALYSIS*
, "Ptr", psla ; SCRIPT_LOGATTR* out
, "Int") ; return: HRESULT●ScriptBreak(pwcChars, cChars, psa, psla) = DLL("USP10.dll", "int ScriptBreak(char*, int, void*, void*)")
# 呼び出し: ScriptBreak(pwcChars, cChars, psa, psla)
# pwcChars : LPCWSTR -> "char*"
# cChars : INT -> "int"
# psa : SCRIPT_ANALYSIS* -> "void*"
# psla : SCRIPT_LOGATTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。