ホーム › System.Ole › NUMPARSE
NUMPARSE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cDig | INT | 4 | +0 | +0 | 入力時は数字バッファの容量、出力時は解析した有効桁数を表す。 |
| dwInFlags | NUMPARSE_FLAGS | 4 | +4 | +4 | 解析を制御する入力フラグ(NUMPARSE_FLAGS)である。 |
| dwOutFlags | NUMPARSE_FLAGS | 4 | +8 | +8 | 解析結果を示す出力フラグ(NUMPARSE_FLAGS)である。 |
| cchUsed | INT | 4 | +12 | +12 | 入力文字列のうち消費した文字数を表す。 |
| nBaseShift | INT | 4 | +16 | +16 | 桁あたりのビットシフト量(基数の対数)を表す。 |
| nPwr10 | INT | 4 | +20 | +20 | 10のべき乗による小数点位置(指数)を表す。 |
各言語での定義
#include <windows.h>
// NUMPARSE (x64 24 / x86 24 バイト)
typedef struct NUMPARSE {
INT cDig;
NUMPARSE_FLAGS dwInFlags;
NUMPARSE_FLAGS dwOutFlags;
INT cchUsed;
INT nBaseShift;
INT nPwr10;
} NUMPARSE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NUMPARSE
{
public int cDig;
public uint dwInFlags;
public uint dwOutFlags;
public int cchUsed;
public int nBaseShift;
public int nPwr10;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NUMPARSE
Public cDig As Integer
Public dwInFlags As UInteger
Public dwOutFlags As UInteger
Public cchUsed As Integer
Public nBaseShift As Integer
Public nPwr10 As Integer
End Structureimport ctypes
from ctypes import wintypes
class NUMPARSE(ctypes.Structure):
_fields_ = [
("cDig", ctypes.c_int),
("dwInFlags", wintypes.DWORD),
("dwOutFlags", wintypes.DWORD),
("cchUsed", ctypes.c_int),
("nBaseShift", ctypes.c_int),
("nPwr10", ctypes.c_int),
]#[repr(C)]
pub struct NUMPARSE {
pub cDig: i32,
pub dwInFlags: u32,
pub dwOutFlags: u32,
pub cchUsed: i32,
pub nBaseShift: i32,
pub nPwr10: i32,
}import "golang.org/x/sys/windows"
type NUMPARSE struct {
cDig int32
dwInFlags uint32
dwOutFlags uint32
cchUsed int32
nBaseShift int32
nPwr10 int32
}type
NUMPARSE = record
cDig: Integer;
dwInFlags: DWORD;
dwOutFlags: DWORD;
cchUsed: Integer;
nBaseShift: Integer;
nPwr10: Integer;
end;const NUMPARSE = extern struct {
cDig: i32,
dwInFlags: u32,
dwOutFlags: u32,
cchUsed: i32,
nBaseShift: i32,
nPwr10: i32,
};type
NUMPARSE {.bycopy.} = object
cDig: int32
dwInFlags: uint32
dwOutFlags: uint32
cchUsed: int32
nBaseShift: int32
nPwr10: int32struct NUMPARSE
{
int cDig;
uint dwInFlags;
uint dwOutFlags;
int cchUsed;
int nBaseShift;
int nPwr10;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NUMPARSE サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; cDig : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwInFlags : NUMPARSE_FLAGS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwOutFlags : NUMPARSE_FLAGS (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cchUsed : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; nBaseShift : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; nPwr10 : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NUMPARSE
#field int cDig
#field int dwInFlags
#field int dwOutFlags
#field int cchUsed
#field int nBaseShift
#field int nPwr10
#endstruct
stdim st, NUMPARSE ; NSTRUCT 変数を確保
st->cDig = 100
mes "cDig=" + st->cDig