Skip to content

Commit

Permalink
Rename RegisterClass to _hx_RegisterClass to avoid issues with microsoft
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsando committed Apr 25, 2016
1 parent a06286b commit a66838a
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 21 deletions.
37 changes: 35 additions & 2 deletions include/hx/Class.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ void __hxcpp_boot_std_classes();
namespace hx
{


HXCPP_EXTERN_CLASS_ATTRIBUTES
hx::Class RegisterClass(const String &inClassName, CanCastFunc inCanCast,
hx::Class _hx_RegisterClass(const String &inClassName, CanCastFunc inCanCast,
String inStatics[], String inMembers[],
ConstructEmptyFunc inConstructEmpty, ConstructArgsFunc inConstructArgs,
hx::Class *inSuperClass, ConstructEnumFunc inConst=0, MarkFunc inMarkFunc=0
Expand All @@ -216,8 +217,40 @@ hx::Class RegisterClass(const String &inClassName, CanCastFunc inCanCast,
#endif
);

// For older versions
inline hx::Class RegisterClass(
const String &inClassName, CanCastFunc inCanCast,
String inStatics[], String inMembers[],
ConstructEmptyFunc inConstructEmpty, ConstructArgsFunc inConstructArgs,
hx::Class *inSuperClass, ConstructEnumFunc inConst=0, MarkFunc inMarkFunc=0
#ifdef HXCPP_VISIT_ALLOCS
, VisitFunc inVisitFunc=0
#endif
#ifdef HXCPP_SCRIPTABLE
,const hx::StorageInfo *inStorageInfo=0
,const hx::StaticInfo *inStaticInfo=0
#endif
)
{
return _hx_RegisterClass(inClassName, inCanCast, inStatics, inMembers,
inConstructEmpty, inConstructArgs, inSuperClass, inConst, inMarkFunc
#ifdef HXCPP_VISIT_ALLOCS
, inVisitFunc
#endif
#ifdef HXCPP_SCRIPTABLE
,inStorageInfo ,inStaticInfo
#endif
);
}


HXCPP_EXTERN_CLASS_ATTRIBUTES
void RegisterClass(const String &inClassName, hx::Class inClass);
void _hx_RegisterClass(const String &inClassName, hx::Class inClass);

inline void RegisterClass(const String &inClassName, hx::Class inClass)
{
_hx_RegisterClass(inClassName, inClass);
}

template<typename T>
inline bool TCanCast(hx::Object *inPtr)
Expand Down
2 changes: 1 addition & 1 deletion src/Array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ static bool ArrayCanCast(hx::Object *inInstance)

void ArrayBase::__boot()
{
Static(__mClass) = hx::RegisterClass(HX_CSTRING("Array"),ArrayCanCast,sNone,sArrayFields,
Static(__mClass) = hx::_hx_RegisterClass(HX_CSTRING("Array"),ArrayCanCast,sNone,sArrayFields,
ArrayCreateEmpty,ArrayCreateArgs,0,0);
}

Expand Down
14 changes: 7 additions & 7 deletions src/Dynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,21 +569,21 @@ static void sVisitStatics(HX_VISIT_PARAMS) {

void Dynamic::__boot()
{
Static(__VoidClass) = hx::RegisterClass(HX_CSTRING("Void"),NoCast,sNone,sNone,0,0,0, 0, sMarkStatics
Static(__VoidClass) = hx::_hx_RegisterClass(HX_CSTRING("Void"),NoCast,sNone,sNone,0,0,0, 0, sMarkStatics
#ifdef HXCPP_VISIT_ALLOCS
,sVisitStatics
#endif
);
Static(__BoolClass) = hx::RegisterClass(HX_CSTRING("Bool"),TCanCast<BoolData>,sNone,sNone, 0,0, 0);
Static(__IntClass) = hx::RegisterClass(HX_CSTRING("Int"),IsInt,sNone,sNone,0,0, 0 );
Static(__FloatClass) = hx::RegisterClass(HX_CSTRING("Float"),IsFloat,sNone,sNone, 0,0,&__IntClass );
Static(__Int64Class) = hx::RegisterClass(HX_CSTRING("cpp::Int64"),IsInt64,sNone,sNone, 0,0,&__IntClass );
Static(__PointerClass) = hx::RegisterClass(HX_CSTRING("cpp::Pointer"),IsPointer,sNone,sNone, 0,0,&__PointerClass );
Static(__BoolClass) = hx::_hx_RegisterClass(HX_CSTRING("Bool"),TCanCast<BoolData>,sNone,sNone, 0,0, 0);
Static(__IntClass) = hx::_hx_RegisterClass(HX_CSTRING("Int"),IsInt,sNone,sNone,0,0, 0 );
Static(__FloatClass) = hx::_hx_RegisterClass(HX_CSTRING("Float"),IsFloat,sNone,sNone, 0,0,&__IntClass );
Static(__Int64Class) = hx::_hx_RegisterClass(HX_CSTRING("cpp::Int64"),IsInt64,sNone,sNone, 0,0,&__IntClass );
Static(__PointerClass) = hx::_hx_RegisterClass(HX_CSTRING("cpp::Pointer"),IsPointer,sNone,sNone, 0,0,&__PointerClass );
DynTrue = Dynamic( new (hx::NewObjConst) hx::BoolData(true) );
DynFalse = Dynamic( new (hx::NewObjConst) hx::BoolData(false) );
DynEmptyString = Dynamic(HX_CSTRING("").__ToObject());
#ifdef HXCPP_OBJC
Static(__ObjcClass) = hx::RegisterClass(HX_CSTRING("objc::BoxedType"),IsPointer,sNone,sNone, 0,0,&__ObjcClass );
Static(__ObjcClass) = hx::_hx_RegisterClass(HX_CSTRING("objc::BoxedType"),IsPointer,sNone,sNone, 0,0,&__ObjcClass );
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/Enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ hx::Class &EnumBase_obj::__SGetClass() { return hxEnumBase_obj__mClass; }

void EnumBase_obj::__boot()
{
Static(hxEnumBase_obj__mClass) = hx::RegisterClass(HX_CSTRING("__EnumBase") ,TCanCast<EnumBase_obj>,
Static(hxEnumBase_obj__mClass) = hx::_hx_RegisterClass(HX_CSTRING("__EnumBase") ,TCanCast<EnumBase_obj>,
sNone,sNone,
&__CreateEmpty, &__Create, 0 );
}
Expand Down
2 changes: 1 addition & 1 deletion src/Math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static hx::StaticInfo Math_obj_sStaticStorageInfo[] = {

void Math_obj::__boot()
{
Static(Math_obj::__mClass) = hx::RegisterClass(HX_CSTRING("Math"),TCanCast<Math_obj>,sMathFields,sNone, &__CreateEmpty,0 , 0 );
Static(Math_obj::__mClass) = hx::_hx_RegisterClass(HX_CSTRING("Math"),TCanCast<Math_obj>,sMathFields,sNone, &__CreateEmpty,0 , 0 );

#ifdef HXCPP_SCRIPTABLE
Math_obj::__mClass->mStaticStorageInfo = Math_obj_sStaticStorageInfo;
Expand Down
2 changes: 1 addition & 1 deletion src/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ hx::Object *String::__ToObject() const

void String::__boot()
{
Static(__StringClass) = hx::RegisterClass(HX_CSTRING("String"),TCanCast<StringData>,sStringStatics, sStringFields,
Static(__StringClass) = hx::_hx_RegisterClass(HX_CSTRING("String"),TCanCast<StringData>,sStringStatics, sStringFields,
&CreateEmptyString, &CreateString, 0, 0, 0
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hx/Anon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ hx::Class Anon_obj::__mClass;

void Anon_obj::__boot()
{
Static(__mClass) = hx::RegisterClass(HX_CSTRING("__Anon"),TCanCast<Anon_obj>,sNone,sNone,0,0,0,0);
Static(__mClass) = hx::_hx_RegisterClass(HX_CSTRING("__Anon"),TCanCast<Anon_obj>,sNone,sNone,0,0,0,0);
}


Expand Down
6 changes: 3 additions & 3 deletions src/hx/Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace hx
typedef std::map<String,Class> ClassMap;
static ClassMap *sClassMap = 0;

Class RegisterClass(const String &inClassName, CanCastFunc inCanCast,
Class _hx_RegisterClass(const String &inClassName, CanCastFunc inCanCast,
String inStatics[], String inMembers[],
ConstructEmptyFunc inConstructEmpty, ConstructArgsFunc inConstructArgs,
Class *inSuperClass, ConstructEnumFunc inConstructEnum,
Expand Down Expand Up @@ -45,7 +45,7 @@ Class RegisterClass(const String &inClassName, CanCastFunc inCanCast,
return c;
}

void RegisterClass(const String &inClassName, Class inClass)
void _hx_RegisterClass(const String &inClassName, Class inClass)
{
if (sClassMap==0)
sClassMap = new ClassMap;
Expand Down Expand Up @@ -152,7 +152,7 @@ Class &Class_obj::__SGetClass() { return Class_obj__mClass; }

void Class_obj::__boot()
{
Static(Class_obj__mClass) = hx::RegisterClass(HX_CSTRING("Class"),TCanCast<Class_obj>,sNone,sNone, 0,0 , 0, 0 );
Static(Class_obj__mClass) = hx::_hx_RegisterClass(HX_CSTRING("Class"),TCanCast<Class_obj>,sNone,sNone, 0,0 , 0, 0 );
}


Expand Down
2 changes: 1 addition & 1 deletion src/hx/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static hx::ScriptNamedFunction __scriptableFunctions[] = {

void Object::__boot()
{
Static(Object__mClass) = hx::RegisterClass(HX_CSTRING("Dynamic"),AlwaysCast,sNone,sNone,0,0, 0, 0 );
Static(Object__mClass) = hx::_hx_RegisterClass(HX_CSTRING("Dynamic"),AlwaysCast,sNone,sNone,0,0, 0, 0 );

#ifdef HXCPP_SCRIPTABLE
hx::ScriptableRegisterClass( HX_CSTRING("hx.Object"), (int)sizeof(hx::Object__scriptable), __scriptableFunctions, Object__scriptable::__script_create, Object::__script_construct );
Expand Down
6 changes: 3 additions & 3 deletions src/hx/Scriptable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ class ScriptHandler : public hx::Class_obj

DBGLOG("Class %s, base %p\n", (mName + HX_CSTRING("::") + superName).__s, mScriptBase );

RegisterClass(RemapFlash(mName), (hx::Class_obj *)this);
_hx_RegisterClass(RemapFlash(mName), (hx::Class_obj *)this);

mScript = mScriptBase;
(*sScriptRegistered)[mName.__s] = mScript;
Expand Down Expand Up @@ -1338,7 +1338,7 @@ void InitABC()
String *__scriptableFunctionNames = &allFunctions;


RegisterClass(HX_CSTRING("Object"), new ScriptHandler());
_hx_RegisterClass(HX_CSTRING("Object"), new ScriptHandler());
HX_SCRIPTABLE_REGISTER_CLASS("Object",Object_obj);
sObject = (*sScriptRegistered)["Object"];

Expand Down Expand Up @@ -1497,7 +1497,7 @@ void LoadABC(const unsigned char *inBytes, int inLen)
if (cls==null())
{
ABCClass cls = new ABCClass_obj(abc, inst, abc.mClassInfo[i]);
RegisterClass(className,cls);
_hx_RegisterClass(className,cls);
}
else
{
Expand Down

0 comments on commit a66838a

Please sign in to comment.