#modcfuncを追加するパッチ

#modfuncの関数版が欲しくてパッチを作ろうと思ったら、実はPP_Defcfuncで既に用意はされていたんですね。なので、追加するのはすごく短く済みました。

--- token.cpp.orig	Mon Jan 14 09:30:26 2008
+++ token.cpp	Wed Feb 13 13:35:58 2008
@@ -2937,6 +2937,10 @@
 		res = PP_Deffunc(3);
 		return res;
 	}
+	if (tstrcmp(word,"modcfunc")) {		// module function (2)
+		res = PP_Defcfunc(1);
+		return res;
+	}
 	if (tstrcmp(word,"struct")) {		// struct define
 		res = PP_Struct();
 		return res;
OpenHSP
Copyright (C) 1997-2008, Onion Software/onitama, all rights reserved.
This software is provided by the copyright holders and contributors "as is" and
any express or implied warranties, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose are disclaimed.

以下のように使えます。

#module hoge x
#modfunc setx str _x
	x = _x
	return
#modcfunc getx
	return x
#global

newmod a, hoge
setx a, "hello"
mes getx( a ) //=> hello