ホーム › Media.Speech › SPSTATEINFO
SPSTATEINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cAllocatedEntries | DWORD | 4 | +0 | +0 | pTransitionsに確保されたエントリ数。 |
| pTransitions | SPTRANSITIONENTRY* | 8/4 | +8 | +4 | この状態からの遷移エントリ配列へのポインタ。 |
| cEpsilons | DWORD | 4 | +16 | +8 | エプシロン(空)遷移の数。 |
| cRules | DWORD | 4 | +20 | +12 | ルール参照遷移の数。 |
| cWords | DWORD | 4 | +24 | +16 | 単語遷移の数。 |
| cSpecialTransitions | DWORD | 4 | +28 | +20 | 特殊遷移(ワイルドカード・ディクテーション等)の数。 |
各言語での定義
#include <windows.h>
// SPSTATEINFO (x64 32 / x86 24 バイト)
typedef struct SPSTATEINFO {
DWORD cAllocatedEntries;
SPTRANSITIONENTRY* pTransitions;
DWORD cEpsilons;
DWORD cRules;
DWORD cWords;
DWORD cSpecialTransitions;
} SPSTATEINFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SPSTATEINFO
{
public uint cAllocatedEntries;
public IntPtr pTransitions;
public uint cEpsilons;
public uint cRules;
public uint cWords;
public uint cSpecialTransitions;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SPSTATEINFO
Public cAllocatedEntries As UInteger
Public pTransitions As IntPtr
Public cEpsilons As UInteger
Public cRules As UInteger
Public cWords As UInteger
Public cSpecialTransitions As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SPSTATEINFO(ctypes.Structure):
_fields_ = [
("cAllocatedEntries", wintypes.DWORD),
("pTransitions", ctypes.c_void_p),
("cEpsilons", wintypes.DWORD),
("cRules", wintypes.DWORD),
("cWords", wintypes.DWORD),
("cSpecialTransitions", wintypes.DWORD),
]#[repr(C)]
pub struct SPSTATEINFO {
pub cAllocatedEntries: u32,
pub pTransitions: *mut core::ffi::c_void,
pub cEpsilons: u32,
pub cRules: u32,
pub cWords: u32,
pub cSpecialTransitions: u32,
}import "golang.org/x/sys/windows"
type SPSTATEINFO struct {
cAllocatedEntries uint32
pTransitions uintptr
cEpsilons uint32
cRules uint32
cWords uint32
cSpecialTransitions uint32
}type
SPSTATEINFO = record
cAllocatedEntries: DWORD;
pTransitions: Pointer;
cEpsilons: DWORD;
cRules: DWORD;
cWords: DWORD;
cSpecialTransitions: DWORD;
end;const SPSTATEINFO = extern struct {
cAllocatedEntries: u32,
pTransitions: ?*anyopaque,
cEpsilons: u32,
cRules: u32,
cWords: u32,
cSpecialTransitions: u32,
};type
SPSTATEINFO {.bycopy.} = object
cAllocatedEntries: uint32
pTransitions: pointer
cEpsilons: uint32
cRules: uint32
cWords: uint32
cSpecialTransitions: uint32struct SPSTATEINFO
{
uint cAllocatedEntries;
void* pTransitions;
uint cEpsilons;
uint cRules;
uint cWords;
uint cSpecialTransitions;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SPSTATEINFO サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; cAllocatedEntries : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pTransitions : SPTRANSITIONENTRY* (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; cEpsilons : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cRules : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; cWords : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cSpecialTransitions : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SPSTATEINFO サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; cAllocatedEntries : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pTransitions : SPTRANSITIONENTRY* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; cEpsilons : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cRules : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; cWords : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; cSpecialTransitions : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SPSTATEINFO
#field int cAllocatedEntries
#field intptr pTransitions
#field int cEpsilons
#field int cRules
#field int cWords
#field int cSpecialTransitions
#endstruct
stdim st, SPSTATEINFO ; NSTRUCT 変数を確保
st->cAllocatedEntries = 100
mes "cAllocatedEntries=" + st->cAllocatedEntries