:date: 2005-01-22 01:43:18
:tags: WZ, python

===============================================
WZ繝槭け繝ュ縺九iPython繧ウ繝シ繝峨r螳溯。後☆繧具シ�
===============================================

蜈域律菴懊▲縺� pygw [1]_ 繧呈僑蠑オ縺励※縲� Python_ 縺ョprint譁��蜉帛�繧淡Z縺ョ莉サ諢上�髢「謨ー縺ォ謗・邯壹〒縺阪k繧医≧縺ォ縺励※縺ソ縺溘€�

WZ繝槭け繝ュ縺ョ萓�::

	#include <windows.h>
	#include "pygw.h"
	
	static FARPROC PrinfRegCode; //RegCode
	
	void CALLBACK Print(char* str)
	{
		printf(str);
	}
	
	int main(TX* text)
	{
		PrinfRegCode = txpcodeRegisterCallback( Print, 1 );
		PYGW_SetStdout( PrinfRegCode );
	
		PYGW_Pygw("pywz","func1","teststrings");
		PYGW_Pygw("pywz","func2","teststrings");
		PYGW_Pygw("pywz","func3","reduce(lambda x,y:x+y,[x for x in range(0,10)])");
		PYGW_Pygw("pywz","func4","Hello");
	
		txpcodeUnregisterCallback( PrinfRegCode );
		PrinfRegCode = NULL;
		return 0;
	}

蜻シ縺ウ蜃コ縺輔l繧輝ython繧ウ繝シ繝峨�萓�::

	import stdout
	
	def func1(x):
		print "1: ", len(x)
		return len(x)
	
	def func2(x):
		print "2: ", x
		return 0
	
	def func3(x):
		print "3: ", x, " ==> ", eval(x)
		return eval(x)
	
	def func4(x):
		print "4: ", [s for s in x]
		return len(x)

螳溯。檎オ先棡::

	1:  11
	2:  teststrings
	3:  reduce(lambda x,y:x+y,[x for x in range(0,10)])  ==>  45
	4:  ['H', 'e', 'l', 'l', 'o']

螳溯。檎オ先棡縺ッ繧ゅ■繧阪sWZ縺ョSTDOUT縺ォ蜃コ蜉帙&繧後k縲ゆサ・荳九′險シ諡�逕サ蜒上□��シ医�縺、騾�縺倥c縺ェ縺�h�滂シ�

|pygw_wz1|


file: `pygw20050121.lzh`_

.. [1] `WZ Editor`_ 縺ョ繝槭け繝ュ縺九i Python_ 繧ウ繝シ繝峨r螳溯。後☆繧九◆繧√�DLL
.. _`WZ Editor`: http://www.villagecenter.co.jp/soft/wz50/
.. _Python: http://python.jp/
.. _`pygw20050121.lzh`: file/wz/pygw20050121.lzh
.. |pygw_wz1| image:: pygw_wz1



.. :extend type: text/plain
.. :extend: