Win32 API 日本語リファレンス
ホームMedia.Speech › SPSEMANTICERRORINFO

SPSEMANTICERRORINFO

構造体
サイズx64: 40 バイト / x86: 20 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ulLineNumberDWORD4+0+0意味解釈スクリプトでエラーが発生した行番号。
pszScriptLineLPWSTR8/4+8+4エラーが発生したスクリプト行の内容(Unicode文字列)。
pszSourceLPWSTR8/4+16+8エラー発生元(ソース)を示す文字列。
pszDescriptionLPWSTR8/4+24+12エラー内容の説明文字列。
hrResultCodeHRESULT4+32+16エラーを示すHRESULT結果コード。

各言語での定義

#include <windows.h>

// SPSEMANTICERRORINFO  (x64 40 / x86 20 バイト)
typedef struct SPSEMANTICERRORINFO {
    DWORD ulLineNumber;
    LPWSTR pszScriptLine;
    LPWSTR pszSource;
    LPWSTR pszDescription;
    HRESULT hrResultCode;
} SPSEMANTICERRORINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SPSEMANTICERRORINFO
{
    public uint ulLineNumber;
    public IntPtr pszScriptLine;
    public IntPtr pszSource;
    public IntPtr pszDescription;
    public int hrResultCode;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SPSEMANTICERRORINFO
    Public ulLineNumber As UInteger
    Public pszScriptLine As IntPtr
    Public pszSource As IntPtr
    Public pszDescription As IntPtr
    Public hrResultCode As Integer
End Structure
import ctypes
from ctypes import wintypes

class SPSEMANTICERRORINFO(ctypes.Structure):
    _fields_ = [
        ("ulLineNumber", wintypes.DWORD),
        ("pszScriptLine", ctypes.c_void_p),
        ("pszSource", ctypes.c_void_p),
        ("pszDescription", ctypes.c_void_p),
        ("hrResultCode", ctypes.c_int),
    ]
#[repr(C)]
pub struct SPSEMANTICERRORINFO {
    pub ulLineNumber: u32,
    pub pszScriptLine: *mut core::ffi::c_void,
    pub pszSource: *mut core::ffi::c_void,
    pub pszDescription: *mut core::ffi::c_void,
    pub hrResultCode: i32,
}
import "golang.org/x/sys/windows"

type SPSEMANTICERRORINFO struct {
	ulLineNumber uint32
	pszScriptLine uintptr
	pszSource uintptr
	pszDescription uintptr
	hrResultCode int32
}
type
  SPSEMANTICERRORINFO = record
    ulLineNumber: DWORD;
    pszScriptLine: Pointer;
    pszSource: Pointer;
    pszDescription: Pointer;
    hrResultCode: Integer;
  end;
const SPSEMANTICERRORINFO = extern struct {
    ulLineNumber: u32,
    pszScriptLine: ?*anyopaque,
    pszSource: ?*anyopaque,
    pszDescription: ?*anyopaque,
    hrResultCode: i32,
};
type
  SPSEMANTICERRORINFO {.bycopy.} = object
    ulLineNumber: uint32
    pszScriptLine: pointer
    pszSource: pointer
    pszDescription: pointer
    hrResultCode: int32
struct SPSEMANTICERRORINFO
{
    uint ulLineNumber;
    void* pszScriptLine;
    void* pszSource;
    void* pszDescription;
    int hrResultCode;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SPSEMANTICERRORINFO サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; ulLineNumber : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pszScriptLine : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; pszSource : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pszDescription : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; hrResultCode : HRESULT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SPSEMANTICERRORINFO サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; ulLineNumber : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pszScriptLine : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pszSource : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pszDescription : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; hrResultCode : HRESULT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SPSEMANTICERRORINFO
    #field int ulLineNumber
    #field intptr pszScriptLine
    #field intptr pszSource
    #field intptr pszDescription
    #field int hrResultCode
#endstruct

stdim st, SPSEMANTICERRORINFO        ; NSTRUCT 変数を確保
st->ulLineNumber = 100
mes "ulLineNumber=" + st->ulLineNumber