HSP¥Ý¡¼¥¿¥ë
¥µ¥¤¥È¥Þ¥Ã¥× ¤ªÌ䤤¹ç¤ï¤»


HSPTV!·Ç¼¨ÈÄ


̤²ò·è ²ò·è Ää»ß ºï½üÍ×ÀÁ

2014
0912
nepisat#deffunc¤ÇÀßÄꤷ¤¿Ì¾Á°¤òÊÑ¿ô¤ËÆþ¤ì¡¢¤½¤ÎÊÑ¿ô¤ò#deffunc¤ÎÌ¿Îá¤Î¤è¤¦¤ËÆ°¤«¤·¤¿¤¤¡£19̤²ò·è


nepisat

¥ê¥ó¥¯

2014/9/12(Fri) 19:22:32|NO.64858

Î㤨¤«¤é

¤Þ¤º¡¢¤³¤Î¤è¤¦¤ÊÌ¿Îá¤òÀë¸À¤·¤¿¤È¤·¤Þ¤¹¡£

#deffunc HELLO str strin mes strin+"Hello,World" return

¤½¤·¤Æ¡¢¤³¤ì¤ò


func = HELLO func ,"TEST"
¤È¤·¤¿¤¤¤Ç¤¹¡£



¤³¤Îµ­»ö¤ËÊÖ¿®¤¹¤ë


KOMARI

¥ê¥ó¥¯

2014/9/12(Fri) 19:29:53|NO.64859

´Ø¿ô¥Ý¥¤¥ó¥¿¤ß¤¿¤¤¤Ê¤â¤Î¤Ç¤·¤ç¤¦¤«¡£
¤â¤·½ÐÍè¤ë¤Î¤Ê¤éÀ§Èó¤ä¤ê¤¿¤¤¤â¤ó¤Ç¤¹¤¬¡£
»ä¤Ï½ÐÍè¤Ê¤¤¤â¤Î¤È¤·¤Æǧ¼±¤·¤Æ¤¤¤Þ¤¹¡£



Flat

¥ê¥ó¥¯

2014/9/12(Fri) 19:57:17|NO.64861

HSP¤Ë²ÄÊÑĹ°ú¿ô¤¬¼ÂÁõ¤µ¤ì¤Ê¤¤¸Â¤êÊÑ¿ô¤ËÂåÆþ¤·¤Æ»È¤¦¤³¤È¤Ï½ÐÍè¤Ê¤¤¤È»×¤¤¤Þ¤¹¡£
¤¬¡¢¤³¤ó¤Ê¼ÂÁõ¤Ç¤è¤í¤·¤±¤ì¤Ð¤É¤¦¤¾¡£Æ°ºîÊݾÚÂоݳ°¡£

// ËâË¡¤Î¥³¡¼¥É¡Ê¾Ð¡Ë // ¥¹¥¯¥ê¥×¥È¤ÎÀèƬ¤ËÆþ¤ì¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤ #define setfunc(%1,%2) dupptr a@funcloader,libptr(%1),28,2:dupptr b@funcloader,libptr(%2),28,2:memcpy a@funcloader,b@funcloader,28 if${ // ´Ø¿ô¤ò¤³¤³¤Ëʤ٤ޤ¹ #deffunc func #deffunc func2 return } #module #deffunc HELLO str strin mes strin+"Hello,World" return #deffunc HELLO2 str strin mes strin+"Hi guys!" return #global setfunc func, HELLO func "TEST" setfunc func, HELLO2 func "TEST" setfunc func2, func func2 "TEST"



Flat

¥ê¥ó¥¯

2014/9/12(Fri) 20:10:16|NO.64862

ÊÑ¿ô¤Ë¤³¤À¤ï¤ë¤Ê¤é¡Ê´Ø¿ô¥Ý¥¤¥ó¥¿Åª¤Ë»È¤¤¤¿¤¤¤Ê¤é¡Ë¤³¤Á¤é¤ò¡£

// ËâË¡¤Î¥³¡¼¥É¡Ê¾Ð¡Ë // ¥¹¥¯¥ê¥×¥È¤ÎÀèƬ¤ËÆþ¤ì¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤ #module funcloader #deffunc callback return #deffunc local _flinit dupptr a, libptr(callback), 28, 2 return #define global loadfunc(%1) dupptr b@funcloader,%1,28,2:memcpy a@funcloader,b@funcloader,28 #global _flinit@funcloader // ´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹Â¦ #module #deffunc cbtest int fnptr, int value loadfunc fnptr mes callback(value) return #global // ´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¦ #module // 3Çܤ·¤¿¿ôÃͤòÊÖ¤¹´Ø¿ô #defcfunc testfunc int val return val * 3 #global funcptr = libptr(testfunc) cbtest funcptr, 123



¤Ô¤ç¤Ô¤ç(²Ê³ØÂÀϺ)

¥ê¥ó¥¯

2014/9/12(Fri) 21:44:44|NO.64868

nepisat¤µ¤ó
KOMARI¤µ¤ó
¤¢¤ÈFlat¤µ¤ó¤Ø
> ´Ø¿ô¥Ý¥¤¥ó¥¿¤ß¤¿¤¤¤Ê¤â¤Î¤Ç¤·¤ç¤¦¤«¡£
> ¤â¤·½ÐÍè¤ë¤Î¤Ê¤éÀ§Èó¤ä¤ê¤¿¤¤¤â¤ó¤Ç¤¹¤¬¡£
> »ä¤Ï½ÐÍè¤Ê¤¤¤â¤Î¤È¤·¤Æǧ¼±¤·¤Æ¤¤¤Þ¤¹¡£
¹©É×¼¡Âè¤Ç½ÐÍè¤ë¤È»×¤¤¤Þ¤¹¡£
*Main
pfunc=*Jump3 HELLO "¤¢¤¤¤¦¤¨¤ª" stop #deffunc HELLO str strin gosub pfunc return *Jump1 HELLO1 strin return *Jump2 HELLO2 strin return *Jump3 HELLO3 strin return *Jump4 HELLO4 strin return #deffunc HELLO1 str strin mes strin+"Hello1,World" return #deffunc HELLO2 str strin mes strin+"Hello2,World" return #deffunc HELLO3 str strin mes strin+"Hello3,World" return #deffunc HELLO4 str strin mes strin+"Hello4,World" return
¢¬
¥é¥Ù¥ë¿ô¤Ï¥æ¡¼¥¶ÄêµÁÌ¿Îá¤À¤±Áý¤¨¤Þ¤¹¤¬¡¢
C/C++¤Î¤è¤¦¤Ê´Ø¿ô¥Ý¥¤¥ó¥¿¤ß¤¿¤¤¤Ë»È¤¨¤Þ¤¹¡£

pfunc ¤Ë *Jump2 ¤òÂåÆþ¤¹¤ë¤È HELLO Ì¿Îá¤Ç HELLO2 ¤¬¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
¤³¤Î pfunc ¤¬¥æ¡¼¥¶ÄêµÁÌ¿Îá¤òµ­²±¤·¤Æ¤ëÊÑ¿ô¤Ç¤¹¤Í¡£



¤Ô¤ç¤Ô¤ç(²Ê³ØÂÀϺ)

¥ê¥ó¥¯

2014/9/12(Fri) 21:57:12|NO.64871

Äɵ­¡£
*Main
pfunc=*Jump3 HELLO "¤¢¤¤¤¦¤¨¤ª" stop #deffunc HELLO str strin gosub pfunc return *Jump1:HELLO1 strin:return *Jump2:HELLO2 strin:return *Jump3:HELLO3 strin:return *Jump4:HELLO4 strin:return #deffunc HELLO1 str strin mes strin+"Hello1,World" return #deffunc HELLO2 str strin mes strin+"Hello2,World" return #deffunc HELLO3 str strin mes strin+"Hello3,World" return #deffunc HELLO4 str strin mes strin+"Hello4,World" return
¢¬
¥é¥Ù¥ë¡¢Ì¿Îá¼Â¹Ô¡¢return¤Î£³¹Ô¤ò£±¹Ô¤Ë½ÐÍè¤ë¤ß¤¿¤¤¤Ç¤¹¡£



Flat

¥ê¥ó¥¯

2014/9/12(Fri) 22:58:30|NO.64875

¥ß¥¹¡£²ÄÊÑĹ°ú¿ô¤Ê¤¯¤Æ¤âͽ¤á°ú¿ô¤Î¿ô¤ò»ØÄê¤Ç¤­¤ë¤Î¤Ç¤¢¤ì¤ÐÀè¤Û¤É¤ÎÊýË¡¤Ç»È¤¨¤Þ¤¹¡£¹õËâ½Ñ½­¤¤ÊýË¡¤Ç¤¹¤¬¡£



KOMARI

¥ê¥ó¥¯

2014/9/13(Sat) 12:22:41|NO.64883

Flat¤µ¤ó¤¹¤´¤¤(¡¦¦Ø¡¦)¡¦¡¦¡¦
callback¤ÎÃæ¿È¤ò̵Íý¤ä¤ê½ñ¤­´¹¤¨¤Æ¤ë´¶¤¸¤Ê¤Î¤Ï¤ï¤«¤ê¤Þ¤·¤¿¡£
¤³¤ì¤Ï»È¤¨¤½¤¦¤«¤â¡¦¡¦¡¦



nepisat

¥ê¥ó¥¯

2014/9/13(Sat) 18:31:09|NO.64890

¼ê¸µ¤ËPC¤¬¤Ê¤¤¤Î¤Ç¤ï¤«¤é¤Ê¤¤¤Î¤Ç¤¹¤¬¡¢

1¡¢ ¾¤Î.hspÆâ¤Ç#deffunc (.hsp¤Î¸Ä¿ô¤Ï²ÄÊÑ)
2¡¢ ¥á¥¤¥ó¤Î¥¹¥¯¥ê¥×¥È¤Ç ¤¹¤Ù¤Æ¤Î#deffunc¤òÆɤ߹þ¤à
3¡¢ ¥á¥¤¥ó¥¹¥¯¥ê¥×¥È¤ÇÆɤ߹þ¤Þ¤ì¤¿#deffnc¤Î̾Á°¤ò»ØÄꤹ¤ë¤È¼«Æ°Åª¤Ë
¤½¤ì¤¬¼Â¹Ô¤µ¤ì¤ë¤è¤¦¤Ë¤¹¤ë¡£

¤³¤¦¤¤¤¦½èÍý¤¬¤Ç¤­¤ë¤Ç¤·¤ç¤¦¤«?



Flat

¥ê¥ó¥¯

2014/9/20(Sat) 14:20:41|NO.65080

¤¹¤¤¤Þ¤»¤ó¡¢¼ÁÌä¤Î°Õ¿Þ¤¬¤ï¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£
¡Ö#deffunc¤òÆɤ߹þ¤à¡×¤È¡Ö#deffnc¤Î̾Á°¤ò»ØÄꤹ¤ë¡×¤È¤Ï
¤É¤¦¤¤¤Ã¤¿¤³¤È¤ò»Ø¤¹¤Î¤Ç¤·¤ç¤¦¤«¡£

// a.hsp #module #deffunc abc mes "xyz" return #global // b.hsp #module #deffunc def mes "123" return #global // main.hsp #include "a.hsp" #include "b.hsp" abc def



¤µ¤Ã¤¯¤ó

¥ê¥ó¥¯

2014/9/20(Sat) 14:44:12|NO.65082

#deffuncÆâ¤ËÆ°ºî¤µ¤»¤ëÌ¿Îá¤òÆþ¤ì¤ì¤Ð¤¤¤¤¤ó¤¸¤ã((´Êñ¤¹¤®¤¸¤ã¤¤
¤Ç¤â°ì±þÊýË¡¤ò¡£

#deffunc Test neturl "http://sampleurl.com/sample/" mes "¤ªÂÔ¤Á¤¯¤À¤µ¤¤..." netload "1.html" mes "´°Î»" return



nepisat

¥ê¥ó¥¯

2014/9/22(Mon) 18:24:44|NO.65132

¤ï¤«¤ê¤Ë¤¯¤«¤Ã¤¿¤Ç¤¹¤Í¡£
¤ª¤½¤é¤¯HSPɸ½à¤Ë¤Ä¤¤¤Æ¤¤¤Ê¤¤¤è¤¦¤Êµ¤¤¬¤·¤Þ¤¹¡£

¥Õ¥¡¥¤¥ë¤ÏMain.hsp¤ÈInclude¥Õ¥©¥ë¥À¤Ëa.hsp b.hsp ....¤È¤¢¤Ã¤¿¤È¤·¤Þ¤¹¡£
¤Þ¤º¡¢Include¥Õ¥©¥ë¥ÀÆâ¤Ï²ÄÊÑŪ¤Ë¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¥Õ¥¡¥¤¥ë¤¬Áý¤¨¤¿¤ê¸º¤Ã¤¿¤ê¤·¤Þ¤¹¡£
¤µ¤é¤Ë¡¢include¥Õ¥©¥ë¥ÀÆâ¤Î.hsp¤Ï¤¹¤Ù¤Æ#deffunc¤Ç¤¹¡£

¤¿¤È¤¨¤Ð¡¢
HELLO.hsp¤È¤¤¥Õ¥¡¥¤¥ëÆâ¤Ï

#deffunc HELLO mes "HELLO" return;
CLS.hspÆâ¤Ï

#deffunc CLS; cls return;

¤ß¤¿¤¤¤Ê´¶¤¸¤Ç¤¹¡£

¤¢¤È¤Ï
Main.hsp¤Çinclude¥Õ¥©¥ë¥ÀÆ⤹¤Ù¤ÆÆɤ߹þ¤ß¤·¤Æ
¤Ä¤¤¤Ç¤Ë¥Õ¥¡¥¤¥ë̾¤âÊÑ¿ô¤ËÂåÆþ¡¢.hsp³ÈÄ¥»Ò¤òÀÚ¤ê¼Î¤Æ¤Þ¤¹¡£ (¤³¤¦¤¹¤ë¤È#deffunc¤Î̾Á°¤Ë)
¤³¤³¤«¤é¤¬¤ï¤«¤é¤Ê¤¤¤Î¤Ç¤¹¤¬¡¢

ÊÑ¿ô¤ËÆþ¤ì¤¿´Ø¿ô̾¤ò¤½¤Î¤Þ¤Þ¸Æ¤Ó½Ð¤»¤Þ¤¹¤«¡©

²¾¥³¡¼¥ÉŪ¤Ê¤â¤Î

//¥í¡¼¥É¤·¤¿¥Õ¥¡¥¤¥ëÊÑ¿ô¤Ïdefinc //¤³¤³¤Ç¥Õ¥¡¥¤¥ë¥í¡¼¥É(ά¤·¤Þ¤¹) filenam = definc //noteÌ¿Îá¤Çdefinc¤ò°ì¹Ô¤´¤È¤Ëʬ³ä(ά //¤¿¤È¤¨¤Ð¥Õ¥¡¥¤¥ë̾&deffnc¤¬HELLO¤Î¾ì¹ç if (cin(a) == definc.1){ //cin¤È¤ÏÆþÎϤ·¤Æa¤ËÂåÆþ definc.1¤Ïdefinc¤Î°ì¹ÔÌÜ(HELLO) filenam.1 (HELLO) }

¤³¤ó¤Ê´¶¤¸¤Ç¤¹¡£
¤ï¤«¤ê¤Ë¤¯¤¤¤«¤â¡©



cats

¥ê¥ó¥¯

2014/9/22(Mon) 18:56:06|NO.65134

¥³¥ó¥Ñ¥¤¥ë¸å¤Ë¼Â¹Ô¥Õ¥¡¥¤¥ë¤«¤é¤Ç¤â¥¹¥¯¥ê¥×¥È¤¬»²¾È¤Ç¤­¤Æ
.hsp¤ò¼Â¹Ô¤·¤¿¤¤¤Î¤Ê¤é¤³¤Î¤è¤¦¤Ê¤â¤Î¤¬¡£
http://www.onionsoft.net/hsp/v33/doclib/hspcmp.txt
http://dev.onionsoft.net/seed/info.ax?id=765
Á°¼Ô¤Ï¥³¥ó¥Ñ¥¤¥ë¤·¤ÆÊÌ¥×¥í¥»¥¹¤È¤·¤Æ¼Â¹Ô¤Ç¤­¤Þ¤¹¡£
¸å¼Ô¤ÏÆâÉô¤Ç¹½Ê¸²òÀϤ·¤ÆÆâÉô¤Ç¼Â¹Ô¤Ç¤­¤Þ¤¹¡£



m

¥ê¥ó¥¯

2014/9/22(Mon) 20:10:04|NO.65135

hspcmp¤ÏÆɤ߹þ¤ó¤À¥¹¥¯¥ê¥×¥ÈÆâ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ëÌ¿Îá¤òľÀܸƤ٤º¡¢
GS¤Ï#deffunc¤Î¤è¤¦¤ÊÌ¿ÎáÄêµÁ¤ËÂбþ¤·¤Æ¤¤¤Þ¤»¤ó¡£
¤Ê¤Î¤Ç¸½¾õ¤Ç¤Ïmist¤ò»ÈÍѤ¹¤ë¤Î¤¬ÂÅÅö¤«¤È»×¤¤¤Þ¤¹¡£
http://dev.onionsoft.net/seed/info.ax?id=754

³°Éô¥¹¥¯¥ê¥×¥È¤òmstcompile¤ÇÆɤ߹þ¤ß¡¢
¸Æ¤Ó½Ð¤¹¤È¤­¤Ï´Ø¿ô̾¤òʸ»úÎó¤Ç»ØÄꤹ¤ë´¶¤¸¤Ë¤Ê¤ê¤Þ¤¹¡£


#include "mist.hsp" mstinit mstopenhsplib sdim loadbuf ;bload "HELLO.hsp",loadbuf loadbuf ={" #deffunc HELLO mes "HELLO" return "} mstcompile loadbuf mstcall "hello" // ¾®Ê¸»ú¤Ç¤Ê¤¤¤È¸Æ¤Ó½Ð¤·¤Ë¼ºÇÔ¤¹¤ë¤é¤·¤¤ stop



¤Ê¤Ê¤·

¥ê¥ó¥¯

2014/9/22(Mon) 23:28:16|NO.65139

¤³¤ó¤Ð¤ó¤Ï¡£
¹õËâ½Ñ¡©Àµ¼°¤ÊÊýË¡¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¤¬¡¢#deffunc¤ÎÌ¿Îá¤òʸ»úÎó¤Ç¸Æ¤Ó½Ð¤»¤ë
¥â¥¸¥å¡¼¥ë¤òºî¤Ã¤Æ¤ß¤Þ¤·¤¿¡£

¢§ StrCmd.hsp

// HSP ver 3.32b ¤Ë¤Æ³Îǧ¡£ // ʸ»úÎ󤫤é#deffunc¥â¥¸¥å¡¼¥ë(²¾) : ºÇ½é¤Ë¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ¤¯¤À¤µ¤¤¡£ #ifndef StrCmd #module StrCmd #define global registerCommand(%1) registerCommandImpl libptr(%1) /* Ì¿Îá¤ò¡ÖÅÐÏ¿¡×¤¹¤ë */ #deffunc registerCommandImpl int pStructDat //-- ʸ»úÎó¤ò¼èÆÀ¤¹¤ë dupptr structDat, pStructDat, 28 nameidx = lpeek(structDat, 12) dupptr funcNameBuf, mem_mds + nameidx, 64 //¾¯¤·Â¿¤á¤Ë funcName = "" repeat char = peek(funcNameBuf, cnt) if (char == 0) : break funcName += strf("%c", char) loop //-- ÅÐÏ¿ cmdFuncPtr(cmdCount) = pStructDat cmdString(cmdCount) = funcName cmdCount++ return /* ¥×¥ì¡¼¥¹¥Û¥ë¥À */ #deffunc dummyCommand /* ʸ»úÎó¤ò°ú¿ô¤Ë¤·¤ÆÌ¿Îá¤ò¸Æ¤Ó½Ð¤¹ */ #deffunc callCommand str _cmd cmd = _cmd cmd = toLowerCase(strtrim(cmd, 0, ' ')) i = 0 repeat cmdCount if (cmd == cmdString(i)) { // Ì¿Îá¤ò¥³¡¼¥ë dupptr f_from, cmdFuncPtr(i), 28 dupptr f_to, libptr(DummyCommand), 28 memcpy f_to, f_from, 28 dummyCommand break } i++ loop if (i == cmdCount) { // ¥³¥Þ¥ó¥É¤¬¸«¤Ä¤«¤é¤Ê¤¤(ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤)¤È¤­¤Î·Ù¹ð // ¤È¤ê¤¢¤¨¤º dialog ¤òɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿¤¬¡¢Å¬µ¹ÊѤ¨¤Æ¤¯¤À¤µ¤¤¡£ dialog "¥³¥Þ¥ó¥É '" + _cmd + "' ¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó" } return /* Ⱦ³Ñ¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¤ò¾®Ê¸»ú¤Ë¤¹¤ë */ #defcfunc toLowerCase str _string string = _string count = 0 repeat char = peek(string, count) if (char == 0 || count >= strlen(string)) : break if (0 < char && char < 128) { if ('A' <= char && char <= 'Z') { poke string, count, (char + ('a' - 'A')) } count++ } else { count += 2 } loop return string /* ½é´ü²½ */ #deffunc local init cmdCount = 0 cmdFuncPtr = 0 cmdString = "" mref hspctx, 68 mem_mds = lpeek(hspctx, 12) return #global init@StrCmd #endif


¤³¤Î¥â¥¸¥å¡¼¥ë¤ò»È¤¦¤Ë¤Ï¡¢#deffunc¤ÎÌ¿Îá¤òÄêµÁ¤¹¤ë.hsp¥Õ¥¡¥¤¥ëÆâ¤Ë¤ª¤¤¤Æ¡¢
¤½¤ÎÌ¿Îá¤òregisterCommand¤Ç¡ÖÅÐÏ¿¡×¤¹¤ëɬÍפ¬¤¢¤ë¤Î¤Ç¡¢¤½¤ÎÉôʬ¤ò½ñ¤­²Ã¤¨¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
¶ñÂÎŪ¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë½ñ¤­¤Þ¤¹¡£¡Ê#module¤ÎÆâÉô¤Ë¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤ÈÆ°¤­¤Þ¤»¤ó)¡£

¢§ test1.hsp

goto *@f #deffunc Test1 mes "Test1¤¬¸Æ¤Ó½Ð¤µ¤ì¤Þ¤·¤¿" return *@ // Ì¿Îá¤òÅÐÏ¿¤¹¤ë registerCommand Test1
¢§ test2.hsp

goto *@f #deffunc Test2 mes "Test2¤¬¸Æ¤Ó½Ð¤µ¤ì¤Þ¤·¤¿" return *@ // Ì¿Îá¤òÅÐÏ¿¤¹¤ë registerCommand Test2

¤Ç¡¢¼ÂºÝ¤Ë»È¤¦¤Ë¤Ï¡¢ºÇ½é¤ËStrCmd.hsp¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ¤«¤é¡¢
²ÄÊÑŪ¤Ë¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë.hsp¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ¤¯¤À¤µ¤¤¡£
callCommand "p1"
¤Ç¡¢p1¤Ç»ØÄꤷ¤¿Ê¸»úÎó¤ËÂбþ¤¹¤ë#deffuncÌ¿Îá¤ò¸Æ¤Ó¤À¤½¤¦¤È¤·¤Þ¤¹¡£

¢§Î㡧main.hsp

// ¤Þ¤º StrCmd.hsp ¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Þ¤¹¡£ #include "StrCmd.hsp" // ¤³¤³¤Ç²ÄÊÑŪ¤Ë¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤â¤Î¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Þ¤¹¡£ #include "test1.hsp" #include "test2.hsp" // ʸ»úÎ󤫤颬¤ÇÆɤ߹þ¤ó¤ÀÌ¿Îá¤ò¸Æ¤Ó½Ð¤·¤Æ¤ß¤ë callCommand "test1" callCommand " TEST2 " // ÅÐÏ¿¤·¤Æ¤¤¤Ê¤¤Ì¿Îá¤ò¸Æ¤Ó½Ð¤·¤Æ¤ß¤ë¡Ê·Ù¹ð¡Ë callCommand "test100"

¤È¤ê¤¢¤¨¤º¤³¤³¤Þ¤Ç¤Ç¤¹¤¬¡¢¤³¤ó¤Ê¤â¤Î¤ÇÎɤ±¤ì¤Ð¼«¸ÊÀÕǤ¤Ë¤Æ¤ª»È¤¤¤¯¤À¤µ¤¤¡°¡°¡£



Flat

¥ê¥ó¥¯

2014/9/23(Tue) 09:10:55|NO.65146

>>nepisat¤µ¤ó
¤â¤·¤«¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¸å¤Ë¤âinclude¥Õ¥¡¥¤¥ë¤¬ÊѤï¤ë¤è¤¦¤Ê»ÅÍͤˤ·¤¿¤¤¤Î¤Ç¤¹¤«¡©



fortunehill

¥ê¥ó¥¯

2014/9/23(Tue) 14:16:57|NO.65157

/*¼Ø­¡Ê¤Ê¤Ê¤·¤µ¤ó¤Î¥¹¥¯¥ê¥×¥È¤òÀ°Íý¤·¤Æ¸«¤¿¡Ë*/

#module StrCmd #define global registerCommand(%1) registerCommandImpl libptr(%1) #deffunc registerCommandImpl int pStructDat dupptr structDat ,pStructDat ,28 nameidx = lpeek(structDat, 12) dupptr funcNameBuf,lpeek(hspctx,12)+nameidx,64 getstr funcName,funcNameBuf ;­¡ ʸ»úÎó¤Î¼èÆÀ cmdFuncPtr(cmdCount) = pStructDat cmdString(cmdCount) = funcName cmdCount++ return #deffunc callCommand str _cmd cmd = _cmd cmd = getpath((strtrim(cmd,0,' ')),16) ;­¢ ¾®Ê¸»ú²½ repeat cmdCount if (cmd == cmdString(cnt)) {i = 0 dupptr f_from,cmdFuncPtr(cnt) ,28 dupptr f_to ,cmdDummyPtr ,28 memcpy f_to ,f_from ,28 dummyCommand break} :i = 1 loop if (i) {mes _cmd + "¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó"} return #deffunc dummyCommand return #deffunc local init cmdCount = 0 cmdFuncPtr = 0 cmdString = "" cmdDummyPtr = libptr(DummyCommand) ;­£ ¥À¥ß¡¼´Ø¿ô¥Ý¥¤¥ó¥¿ mref hspctx, 68 return #global init@StrCmd registerCommand Test1 ;­¤ ¥í¡¼¥«¥ë¥¸¥ã¥ó¥× registerCommand Test2 callCommand "test1" callCommand " TEST2 " callCommand "Test3" stop #deffunc Test1 mes "Test1¤¬¸Æ¤Ó½Ð¤µ¤ì¤Þ¤·¤¿" return #deffunc Test2 mes "Test2¤¬¸Æ¤Ó½Ð¤µ¤ì¤Þ¤·¤¿" return



nepisat

¥ê¥ó¥¯

2014/9/23(Tue) 14:49:53|NO.65159

.
http://hsp.tv/play/pforum.php?mode=all&num=64814
¤³¤¤¤Ä¤Ç¡¡ÄêµÁ¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ß¡¢
ÄêµÁ¥Õ¥¡¥¤¥ë¤Î³ÈÄ¥»ÒÈ´¤­¥Õ¥¡¥¤¥ë̾¤òÆɤ߹þ¤à¡£

string@mod0 = "" exstring@mod0 = "" draw onkey *jump stop #module mod0 #deffunc draw redraw 0 color : boxf // ¹õ¤ÇÅɤê¤Ä¤Ö¤· pos 0, 0 color 255,255,255 mes string redraw 1 return #deffunc keyInput int wp, int ip switch wp case 13 // Enter string += "\n" //ʸ»úÎó¤ò¼Â¹Ô¤¹¤ë excuteString exstring exstring = "" swbreak case 8 // BackSpace if (strmid(string, -1, 2) != "\n") { string = strmid(string, 0, strlen(string)-1) exstring = strmid(exstring, 0, strlen(exstring)-1) } swbreak default // ¤½¤Î¾ string = string + strf("%c", ip) // ¢­¼Â¹Ô¤¹¤ëʸ»úÎó¤ò³Ð¤¨¤Æ¤ª¤¯ exstring = exstring + strf("%c",ip) swbreak swend // ºÆÉÁ²è¤¹¤ë draw return // ʸ»ú¤Ë¹ç¤ï¤»¤Æ¼Â¹Ô #deffunc excuteString str cmd // ¤¿¤È¤¨¤Ð... switch cmd case "Æɤ߹þ¤ó¤ÀÄêµÁ¥Õ¥¡¥¤¥ë̾1" Æɤ߹þ¤ó¤À¥Õ¥¡¥¤¥ë̾¤ÈƱ¤¸´Ø¿ô¼Â¹Ô swbreak case "ÄêµÁ¥Õ¥¡¥¤¥ë̾2" // ¤¢¤¤¤µ¤Ä Æɤ߹þ¤ó¤À¥Õ¥¡¥¤¥ë̾¤ÈƱ¤¸´Ø¿ô¼Â¹Ô swbreak case "¥Õ¥¡¥¤¥ë̾3" // ½ªÎ»¤¹¤ë Æɤ߹þ¤ó¤À¥Õ¥¡¥¤¥ë̾¤ÈƱ¤¸´Ø¿ô¼Â¹Ô swbreak swend draw return #global *jump keyInput wparam, iparam stop


¢¬¤Ç¡¢Æɤ߹þ¤ó¤À¥Õ¥¡¥¤¥ë̾¤¬HELLO¤Ç
HELLO.hspÆâ¤Ë
#deffnc
string += "HELLO"
¤È½ñ¤«¤ì¤Æ¤¤¤ì¤Ð¡¢
¥³¥Þ¥ó¥É²èÌ̤ÇHELLO¤ÈÆþÎϤ¹¤ë¤È
HELLO¤È½Ð¤ë¤ß¤¿¤¤¤Ê¤³¤È¤¬¤·¤¿¤¤¡£



Flat

¥ê¥ó¥¯

2014/9/23(Tue) 15:56:29|NO.65161


#module str_libptr #deffunc local _initslibptr \ local hspctx, local hsphed mref hspctx, 68 dupptr hsphed, hspctx(0), 96 dssize = hsphed(7) dsptr = hspctx(3) fiptr = hspctx(210) finum = hsphed(15) / 28 return #deffunc local getdsstr int offset, \ local statv, local data mref statv, 64 if offset<0 || offset>=dssize { statv = -1 return "" } dupptr data, dsptr+offset, dssize-offset, 2 statv = strlen(data) return data #defcfunc libptr_s str funcname, \ local finfo, local ptr, local found ptr = fiptr found = 0 repeat finum dupptr finfo, ptr, 28 getdsstr@str_libptr finfo(3) if stat >= 0 { if getpath(refstr, 16) == getpath(funcname, 16) { found = 1 break } } ptr += 28 loop if found == 0 : return -1 return ptr #global _initslibptr@str_libptr

libptr_s("´Ø¿ô̾")¤Ç´Ø¿ô¥Ý¥¤¥ó¥¿¤¬ÆÀ¤é¤ì¤ë¤Î¤Ç¡¢¤³¤Î¥â¥¸¥å¡¼¥ë¤È
http://hsp.tv/play/pforum.php?mode=all&num=64862
¤òÁȤ߹ç¤ï¤»¤ì¤Ð¤Ç¤­¤ë¤«¤â¡£



Flat

¥ê¥ó¥¯

2014/9/23(Tue) 16:34:34|NO.65162

˺¤ì¤Æ¤Þ¤·¤¿¤¬libptr_s¤ÏÁ´¤Æ¤Î´Ø¿ô¤ËÂФ·¤ÆÆ°ºî¤·¤Þ¤¹¡£
¥æ¡¼¥¶¡¼¤¬´Ø¿ô̾¤ò»ØÄꤹ¤ë¾ì¹ç¤Ï¥µ¥Ë¥¿¥¤¥º¤ò˺¤ì¤Ê¤¤¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£



ONION software Copyright 1997-2023(c) All rights reserved.