[トップ][一覧][最近の更新]

編集履歴:差分

2015/10/01 01:25:40 JSTと2015/10/01 01:26:29 JST間のブロック構文っぽいものの変更箇所

  • + 追加された行
  • - 削除された行

編集履歴ページに戻る

  [[匿名ラベル]]に引き続き、ブロック構文っぽい構文を提供するマクロ。~%
  あくまで「っぽい」であり、レキシカルスコープなどはない。
  
  [https://github.com/vain0/abdata abdata]のIterateマクロを参考にしました。
  
  ** notesel, noteunsel
  ※noteunselの仕様上、入れ子は1つまでです。
  {{{
  #define global ctype note(%1) %tnotesel_unsel notesel %1: gosub *%i: noteunsel: if 0 : *%o
  
  sdim buf1, 256
  sdim buf2, 256
  
  note( buf1 ) {
  	noteadd "This is buf1"
  	
  	note( buf2 ) {
  		noteadd "This is buf2"
  	
  		noteadd "----buf2----"
  		
  		return
  	}
  	
  	noteadd "----buf1----"
  	
  	return
  }
  
  mes buf1
  mes buf2
  }}}
  
  ** newmod, delmod
+ ※newmodの引数は指定できないです…なにかいい方法はないものか
  {{{
  #define global ctype mod(%1,%2) %tmod newmod %1,%2 : gosub *%i : delmod %1 : if 0 : *%o
  
  #module a var1
  #modinit
  	mes "ModInit"
  	var1 = "ModFunc"
  return
  
  #modterm
  	mes "ModTerm"
  return
  
  #modfunc func
  	mes var1
  return
  #global
  
  
  mod ( test, a ) {
  	func test
  
  	return
  }
  }}}