Skip to content

Commit 7fa0fae

Browse files
author
Aidan Lee
committed
Merge branch 'master' into cpp_encoding
2 parents e7d9ba4 + 596badd commit 7fa0fae

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

include/hx/Scriptable.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,19 @@ struct ScriptNamedFunction : public ScriptFunction
1919
{
2020
ScriptNamedFunction(const ScriptFunction &s) : ScriptFunction(s), name(0), isStatic(false), superExecute(0) { }
2121

22+
#if (HXCPP_API_LEVEL >= 500)
23+
ScriptNamedFunction(const char *inName=0,StackExecute inExe=0,const char *inSig=0, bool inIsStatic=false, StackExecute superExecute=0, bool inIsOverride=false)
24+
: ScriptFunction(inExe, inSig), name(inName), isStatic(inIsStatic), isOverride(inIsOverride), superExecute(superExecute) { }
25+
#else
2226
ScriptNamedFunction(const char *inName=0,StackExecute inExe=0,const char *inSig=0, bool inIsStatic=false, StackExecute superExecute=0)
2327
: ScriptFunction(inExe, inSig), name(inName), isStatic(inIsStatic), superExecute(superExecute) { }
28+
#endif
2429

2530
const char *name;
2631
bool isStatic;
32+
#if (HXCPP_API_LEVEL >= 500)
33+
bool isOverride;
34+
#endif
2735
StackExecute superExecute;
2836
};
2937

src/hx/StdLibs.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ void __hxcpp_stdlibs_boot()
283283
//_setmode(_fileno(stdin), 0x00040000); // _O_U8TEXT
284284
#endif
285285

286-
// This is necessary for UTF-8 output to work correctly.
287-
setlocale(LC_ALL, "");
288286
setlocale(LC_NUMERIC, "C");
289287

290288
// I think this does more harm than good.

src/hx/cppia/Cppia.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ struct CppiaVar
575575

576576

577577

578+
#if (HXCPP_API_LEVEL >= 500)
579+
# define NATIVE_CLASS_OVERRIDES_MARKED
580+
#endif
578581

579582
class HaxeNativeClass
580583
{
@@ -596,6 +599,10 @@ class HaxeNativeClass
596599
static HaxeNativeClass *findClass(const std::string &inName);
597600
static HaxeNativeClass *hxObject();
598601
static void link();
602+
#ifndef NATIVE_CLASS_OVERRIDES_MARKED
603+
private:
604+
void addVtableEntries( std::vector<std::string> &outVtable, hx::UnorderedSet<std::string> &outMethodsSet);
605+
#endif
599606
};
600607

601608
class HaxeNativeInterface

src/hx/cppia/HaxeNative.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,36 @@ HaxeNativeClass::HaxeNativeClass(const std::string &inName, int inDataOffset, Sc
3030
haxeSuper = 0;
3131
}
3232

33+
#ifdef NATIVE_CLASS_OVERRIDES_MARKED
3334
void HaxeNativeClass::addVtableEntries( std::vector<std::string> &outVtable)
3435
{
3536
if (haxeSuper)
3637
haxeSuper->addVtableEntries(outVtable);
3738

3839
if (functions)
3940
for(ScriptNamedFunction *func = functions; func->name; func++)
40-
if (!func->isStatic)
41+
if (!func->isStatic && !func->isOverride)
4142
outVtable.push_back( func->name );
4243
}
44+
#else
45+
void HaxeNativeClass::addVtableEntries(std::vector<std::string>& outVtable) {
46+
hx::UnorderedSet<std::string> methodsSet;
47+
addVtableEntries(outVtable, methodsSet);
48+
}
49+
50+
void HaxeNativeClass::addVtableEntries( std::vector<std::string> &outVtable, hx::UnorderedSet<std::string>& outMethodsSet)
51+
{
52+
if (haxeSuper)
53+
haxeSuper->addVtableEntries(outVtable, outMethodsSet);
54+
55+
if (functions)
56+
for (ScriptNamedFunction* func = functions; func->name; func++)
57+
if (!func->isStatic && outMethodsSet.find(func->name) == outMethodsSet.end()) {
58+
outVtable.push_back(func->name);
59+
outMethodsSet.emplace(func->name);
60+
}
61+
}
62+
#endif
4363

4464
void HaxeNativeClass::dump()
4565
{

tools/hxcpp/Setup.hx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,14 @@ class Setup
434434
else
435435
{
436436
root = defines.get("ANDROID_NDK_ROOT");
437+
438+
if (!FileSystem.exists(root)) {
439+
Log.error('ANDROID_NDK_ROOT ["$root"] directory does not exist');
440+
}
441+
if (!FileSystem.isDirectory(root)) {
442+
Log.error('ANDROID_NDK_ROOT ["$root"] is not a diretory');
443+
}
444+
437445
Log.setup("\x1b[33;1mUsing Android NDK root: " + root + "\x1b[0m");
438446
}
439447

0 commit comments

Comments
 (0)