Skip to content

Commit 456fd2c

Browse files
committed
Code modify for hsp3.7
fix for hspmac fix hspinet
1 parent 7ce8e5d commit 456fd2c

6 files changed

Lines changed: 55 additions & 28 deletions

File tree

src/hsp3/hsp3ext.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@
2525
#include "emscripten/hsp3ext_emscripten.h"
2626
#endif
2727

28+
#ifdef HSPMAC
29+
#include "linux/hsp3ext_linux.h"
30+
#endif
31+
2832

2933
#endif

src/hsp3/linux/hsp3ext_linux.cpp

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@
1010
#include <ctype.h>
1111
#include <locale.h>
1212

13+
#ifndef HSPMAC
14+
#define USE_FFILIB
15+
#endif
16+
1317
#include "../hsp3config.h"
1418
#include "../hsp3code.h"
1519
#include "../hsp3debug.h"
1620
#include "../supio.h"
1721
#include "../strbuf.h"
1822

1923
#include "hsp3ext_linux.h"
24+
#ifdef USE_FFILIB
2025
#include "hsp3extlib_ffi.h"
26+
#endif
2127

2228
static HSPCTX *hspctx = NULL; // Current Context
2329
static HSPEXINFO *exinfo = NULL; // Info for Plugins
@@ -78,31 +84,31 @@ static void InitSystemInformation(void)
7884
*/
7985
/*------------------------------------------------------------*/
8086

81-
87+
#ifdef USE_FFILIB
8288
static void *reffunc_dllcmd( int *type_res, int arg )
8389
{
84-
// reffunc : TYPE_DLLFUNC
85-
// (拡張DLL関数)
86-
//
87-
88-
// '('で始まるかを調べる
89-
//
90-
if ( *type != TYPE_MARK ) throw ( HSPERR_INVALID_FUNCPARAM );
91-
if ( *val != '(' ) throw ( HSPERR_INVALID_FUNCPARAM );
92-
93-
*type_res = HSPVAR_FLAG_INT;
94-
exec_dllcmd( arg, STRUCTDAT_OT_FUNCTION );
95-
reffunc_intfunc_ivalue = hspctx->stat;
96-
97-
// ')'で終わるかを調べる
98-
//
99-
if ( *type != TYPE_MARK ) throw ( HSPERR_INVALID_FUNCPARAM );
100-
if ( *val != ')' ) throw ( HSPERR_INVALID_FUNCPARAM );
101-
code_next();
102-
103-
return &reffunc_intfunc_ivalue;
90+
// reffunc : TYPE_DLLFUNC
91+
// (拡張DLL関数)
92+
//
93+
94+
// '('で始まるかを調べる
95+
//
96+
if ( *type != TYPE_MARK ) throw ( HSPERR_INVALID_FUNCPARAM );
97+
if ( *val != '(' ) throw ( HSPERR_INVALID_FUNCPARAM );
98+
99+
*type_res = HSPVAR_FLAG_INT;
100+
exec_dllcmd( arg, STRUCTDAT_OT_FUNCTION );
101+
reffunc_intfunc_ivalue = hspctx->stat;
102+
103+
// ')'で終わるかを調べる
104+
//
105+
if ( *type != TYPE_MARK ) throw ( HSPERR_INVALID_FUNCPARAM );
106+
if ( *val != ')' ) throw ( HSPERR_INVALID_FUNCPARAM );
107+
code_next();
108+
109+
return &reffunc_intfunc_ivalue;
104110
}
105-
111+
#endif
106112

107113
static int termfunc_dllcmd( int option )
108114
{
@@ -119,12 +125,16 @@ void hsp3typeinit_dllcmd( HSP3TYPEINFO *info )
119125
val = exinfo->npval;
120126
exflg = exinfo->npexflg;
121127

128+
#ifdef USE_FFILIB
122129
info->cmdfunc = cmdfunc_dllcmd;
123130
info->reffunc = reffunc_dllcmd;
124-
info->termfunc = termfunc_dllcmd;
131+
#endif
132+
info->termfunc = termfunc_dllcmd;
125133

126134
InitSystemInformation();
135+
#ifdef USE_FFILIB
127136
Hsp3ExtLibInit( info );
137+
#endif
128138
}
129139

130140
void hsp3typeinit_dllctrl( HSP3TYPEINFO *info )
@@ -150,7 +160,12 @@ char *hsp3ext_sysinfo(int p2, int* res, char* outbuf)
150160

151161
switch(p2) {
152162
case 0:
153-
strcpy( p1, "Linux" );
163+
#ifdef HSPLINUX
164+
strcpy( p1, "Linux" );
165+
#endif
166+
#ifdef HSPMAC
167+
strcpy( p1, "MacOS" );
168+
#endif
154169
fl=HSPVAR_FLAG_STR;
155170
break;
156171
case 1:
@@ -179,7 +194,7 @@ char* hsp3ext_getdir(int id)
179194

180195
switch( id ) {
181196
case 0: // カレント(現在の)ディレクトリ
182-
#if defined(HSPLINUX)||defined(HSPEMSCRIPTEN)
197+
#if defined(HSPLINUX)||defined(HSPEMSCRIPTEN)||defined(HSPMAC)
183198
getcwd( p, HSP_MAX_PATH );
184199
cutlast = 1;
185200
#endif
@@ -222,7 +237,7 @@ char* hsp3ext_getdir(int id)
222237

223238
void hsp3ext_execfile(char* msg, char* option, int mode)
224239
{
225-
#ifdef HSPLINUX
240+
#if defined(HSPLINUX)||defined(HSPMAC)
226241
system(msg);
227242
#endif
228243
}

src/hsp3/supio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
#include "emscripten/supio_emscripten.h"
4040
#endif
4141

42+
#ifdef HSPMAC
43+
#include "linux/supio_linux.h"
44+
#endif
45+
4246

4347
#endif
4448

src/hspcmp/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ int main( int argc, char *argv[] )
252252
strcpy( oname, "hsp3.exe" ); // デフォルトランタイム
253253
}
254254

255-
#ifdef HSPLINUX
255+
#if defined(HSPLINUX)||defined(HSPMAC)
256256
cutext( oname );
257257
if ( execobj & 8 ) {
258258
printf("Runtime[%s].\n",oname);

src/hspcmp/supio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
#include "../hsp3/emscripten/supio_emscripten.h"
3636
#endif
3737

38+
#ifdef HSPMAC
39+
#include "../hsp3/linux/supio_linux.h"
40+
#endif
41+
3842

3943
#endif
4044

src/plugins/win32/hspinet/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ EXPORT BOOL WINAPI jsongets( HSPEXINFO *hei, int p1, int p2, int p3 )
12421242
}
12431243
break;
12441244
case cJSON_True:
1245-
mystr = "Ture";
1245+
mystr = "True";
12461246
break;
12471247
case cJSON_False:
12481248
mystr = "False";

0 commit comments

Comments
 (0)