Javaでよくあるラッパークラス的に

; ラッパーモジュール ; Variant.as #ifndef Variant #ifndef Varian […]

; ラッパーモジュール ; Variant.as #ifndef Variant #ifndef Varian […]

  • タグ:
  • タグはありません
;
; Variant.as
#ifndef Variant
#ifndef VariantAliasOff
#define global vDim dim@Variant
#define global vAdd add@Variant
#define global vSet set@Variant
#define global vReSet reSet@Variant
#define global vItem item@Variant
#define global vRefItem refItem@Variant
#define global vRemove remove@Variant
#endif
#module Variant thisItem
#define global dim@Variant(%1) dimtype %1,5
#define add(%1,%2)%t %i=%2:newmod %1,Variant,%o
#modinit var _item
thisItem=_item: return
#define set(%1,%2)%t %i=%2:__set@Variant %1,%o
#modfunc local __set var _item
thisItem=_item: return
#define reSet(%1,%2,%3) set@Variant %1,item@Variant(%1)%2%3
#modcfunc local item
return thisItem
#modfunc local refItem var _item
_item=thisItem: return
#define remove delmod
return
#global
#endif
;--------------------------------------
; testVariant.hsp
#runtime "hsp3cl"
#include "Variant.as"
#module Program
#deffunc main
vDim list1
vAdd list1,""
vAdd list1,50
vAdd list1,1.586
mes "list1"
foreach list1
mes vItem(list1(cnt))
loop
mes "Index 1 changed"
vSet list1(1),256
vReSet list1(2),*,2
foreach list1
mes vItem(list1(cnt))
loop
mes "list2"
vDim list1
vAdd list2,""
vAdd list2,51
vAdd list2,1.1024
vAdd list2,*jumping
dim item
foreach list2
vRefItem list2(cnt),item
if vartype(item)=vartype("label") {
gosub item
}
else {
mes item
}
loop
mes "Removed list2"
vRemove list2(1)
vRemove list2(3)
dim item
foreach list2
vRefItem list2(cnt),item
if vartype(item)=vartype("label") {
gosub item
}
else {
mes item
}
loop
return
*jumping
mes "!": return
#global
main
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX