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

ScriptString_pLogAttr

関数
解析済み文字列の論理属性配列へのポインタを取得する。
DLLUSP10.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

SCRIPT_LOGATTR* ScriptString_pLogAttr(
    void* ssa
);

パラメーター

名前方向説明
ssavoid*in文字列の SCRIPT_STRING_ANALYSIS 構造体です。

戻り値の型: SCRIPT_LOGATTR*

公式ドキュメント

解析済み文字列の論理属性バッファへのポインターを返します。

戻り値

成功した場合、論理属性を定義する SCRIPT_LOGATTR 構造体を格納したバッファへのポインターを返します。失敗した場合、この関数は NULL を返します。

解説(Remarks)

この関数が返すポインターは、アプリケーションが関連する SCRIPT_STRING_ANALYSIS 構造体を ScriptStringFree に渡すまでの間のみ有効です。

論理属性バッファには、少なくとも ScriptString_pcOutCharsssa パラメーターが示す数の整数が格納されます。

ワード区切り位置を求めて SCRIPT_LOGATTR 配列を走査する場合、アプリケーションは fWordStop メンバーと fWhiteSpace メンバーの値を後方に向かって確認する必要があります。ScriptStringAnalyse は各ラン (run) に対して ScriptBreak を呼び出すだけであり、ScriptBreak はランの先頭文字に fWordBreak を設定することはありません。これは、前のランが空白で終わっていたという情報を持たないためです。

重要 Windows 8 以降: Windows 7 上で実行できるようにするには、Uniscribe を使用するモジュールは、ライブラリ一覧で Usp10.lib を gdi32.lib より前に指定する必要があります。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

SCRIPT_LOGATTR* ScriptString_pLogAttr(
    void* ssa
);
[DllImport("USP10.dll", ExactSpelling = true)]
static extern IntPtr ScriptString_pLogAttr(
    IntPtr ssa   // void*
);
<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptString_pLogAttr(
    ssa As IntPtr   ' void*
) As IntPtr
End Function
' ssa : void*
Declare PtrSafe Function ScriptString_pLogAttr Lib "usp10" ( _
    ByVal ssa As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ScriptString_pLogAttr = ctypes.windll.usp10.ScriptString_pLogAttr
ScriptString_pLogAttr.restype = ctypes.c_void_p
ScriptString_pLogAttr.argtypes = [
    ctypes.POINTER(None),  # ssa : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USP10.dll')
ScriptString_pLogAttr = Fiddle::Function.new(
  lib['ScriptString_pLogAttr'],
  [
    Fiddle::TYPE_VOIDP,  # ssa : void*
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "usp10")]
extern "system" {
    fn ScriptString_pLogAttr(
        ssa: *mut ()  // void*
    ) -> *mut SCRIPT_LOGATTR;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("USP10.dll")]
public static extern IntPtr ScriptString_pLogAttr(IntPtr ssa);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptString_pLogAttr' -Namespace Win32 -PassThru
# $api::ScriptString_pLogAttr(ssa)
#uselib "USP10.dll"
#func global ScriptString_pLogAttr "ScriptString_pLogAttr" sptr
; ScriptString_pLogAttr ssa   ; 戻り値は stat
; ssa : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USP10.dll"
#cfunc global ScriptString_pLogAttr "ScriptString_pLogAttr" sptr
; res = ScriptString_pLogAttr(ssa)
; ssa : void* -> "sptr"
; SCRIPT_LOGATTR* ScriptString_pLogAttr(void* ssa)
#uselib "USP10.dll"
#cfunc global ScriptString_pLogAttr "ScriptString_pLogAttr" intptr
; res = ScriptString_pLogAttr(ssa)
; ssa : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	usp10 = windows.NewLazySystemDLL("USP10.dll")
	procScriptString_pLogAttr = usp10.NewProc("ScriptString_pLogAttr")
)

// ssa (void*)
r1, _, err := procScriptString_pLogAttr.Call(
	uintptr(ssa),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // SCRIPT_LOGATTR*
function ScriptString_pLogAttr(
  ssa: Pointer   // void*
): Pointer; stdcall;
  external 'USP10.dll' name 'ScriptString_pLogAttr';
result := DllCall("USP10\ScriptString_pLogAttr"
    , "Ptr", ssa   ; void*
    , "Ptr")   ; return: SCRIPT_LOGATTR*
●ScriptString_pLogAttr(ssa) = DLL("USP10.dll", "void* ScriptString_pLogAttr(void*)")
# 呼び出し: ScriptString_pLogAttr(ssa)
# ssa : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "usp10" fn ScriptString_pLogAttr(
    ssa: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) [*c]SCRIPT_LOGATTR;
proc ScriptString_pLogAttr(
    ssa: pointer  # void*
): ptr SCRIPT_LOGATTR {.importc: "ScriptString_pLogAttr", stdcall, dynlib: "USP10.dll".}
pragma(lib, "usp10");
extern(Windows)
SCRIPT_LOGATTR* ScriptString_pLogAttr(
    void* ssa   // void*
);
ccall((:ScriptString_pLogAttr, "USP10.dll"), stdcall, Ptr{SCRIPT_LOGATTR},
      (Ptr{Cvoid},),
      ssa)
# ssa : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void* ScriptString_pLogAttr(
    void* ssa);
]]
local usp10 = ffi.load("usp10")
-- usp10.ScriptString_pLogAttr(ssa)
-- ssa : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('USP10.dll');
const ScriptString_pLogAttr = lib.func('__stdcall', 'ScriptString_pLogAttr', 'void *', ['void *']);
// ScriptString_pLogAttr(ssa)
// ssa : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("USP10.dll", {
  ScriptString_pLogAttr: { parameters: ["pointer"], result: "pointer" },
});
// lib.symbols.ScriptString_pLogAttr(ssa)
// ssa : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void* ScriptString_pLogAttr(
    void* ssa);
C, "USP10.dll");
// $ffi->ScriptString_pLogAttr(ssa);
// ssa : void*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Usp10 extends StdCallLibrary {
    Usp10 INSTANCE = Native.load("usp10", Usp10.class);
    Pointer ScriptString_pLogAttr(
        Pointer ssa   // void*
    );
}
@[Link("usp10")]
lib LibUSP10
  fun ScriptString_pLogAttr = ScriptString_pLogAttr(
    ssa : Void*   # void*
  ) : SCRIPT_LOGATTR*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ScriptString_pLogAttrNative = Pointer<Void> Function(Pointer<Void>);
typedef ScriptString_pLogAttrDart = Pointer<Void> Function(Pointer<Void>);
final ScriptString_pLogAttr = DynamicLibrary.open('USP10.dll')
    .lookupFunction<ScriptString_pLogAttrNative, ScriptString_pLogAttrDart>('ScriptString_pLogAttr');
// ssa : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ScriptString_pLogAttr(
  ssa: Pointer   // void*
): Pointer; stdcall;
  external 'USP10.dll' name 'ScriptString_pLogAttr';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ScriptString_pLogAttr"
  c_ScriptString_pLogAttr :: Ptr () -> IO (Ptr ())
-- ssa : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let scriptstring_plogattr =
  foreign "ScriptString_pLogAttr"
    ((ptr void) @-> returning (ptr void))
(* ssa : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library usp10 (t "USP10.dll"))
(cffi:use-foreign-library usp10)

(cffi:defcfun ("ScriptString_pLogAttr" script-string-p-log-attr :convention :stdcall) :pointer
  (ssa :pointer))   ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ScriptString_pLogAttr = Win32::API::More->new('USP10',
    'LPVOID ScriptString_pLogAttr(LPVOID ssa)');
# my $ret = $ScriptString_pLogAttr->Call($ssa);
# ssa : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目
使用する型