Skip to content

Commit

Permalink
MacOS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
theyamo committed Apr 3, 2020
1 parent 6b433c5 commit 68d6518
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 30 deletions.
5 changes: 2 additions & 3 deletions src/com/util.d
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ ubyte[] table2Array(string table) {
static ubyte[4096] arr;
int idx;
foreach(strvalue; std.array.split(table)) {
munch(strvalue, "\r\n\t");

arr[idx] = cast(ubyte)str2Value(strvalue);
string s = strvalue.replace("\r\n\t", "");
arr[idx] = cast(ubyte)str2Value(s);
idx++;
}
return arr[0..idx];
Expand Down
4 changes: 2 additions & 2 deletions src/derelict/sdl/macinit/NSApplication.d
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class NSApplication : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSApplication init ()
override NSApplication init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand Down Expand Up @@ -119,4 +119,4 @@ class NSApplication : NSObject
{
objc_msgSend(this.id_, sel_stop, sender ? sender.id_ : null);
}
}
}
4 changes: 2 additions & 2 deletions src/derelict/sdl/macinit/NSArray.d
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class NSArray : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSArray init ()
override NSArray init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand All @@ -75,4 +75,4 @@ class NSArray : NSObject
id result = objc_msgSend(this.id_, sel_objectEnumerator);
return result ? new NSEnumerator(result) : null;
}
}
}
4 changes: 2 additions & 2 deletions src/derelict/sdl/macinit/NSAutoreleasePool.d
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ class NSAutoreleasePool : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSAutoreleasePool init ()
override NSAutoreleasePool init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
}

void release ()
override void release ()
{
objc_msgSend(this.id_, sel_release);
}
Expand Down
4 changes: 2 additions & 2 deletions src/derelict/sdl/macinit/NSDictionary.d
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class NSDictionary : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSDictionary init ()
override NSDictionary init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand All @@ -74,4 +74,4 @@ class NSDictionary : NSObject
id result = objc_msgSend(this.id_, sel_objectForKey, key ? key.id_ : null);
return result ? new ID(result) : null;
}
}
}
4 changes: 2 additions & 2 deletions src/derelict/sdl/macinit/NSEnumerator.d
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class NSEnumerator : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSEnumerator init ()
override NSEnumerator init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand All @@ -74,4 +74,4 @@ class NSEnumerator : NSObject
id result = objc_msgSend(this.id_, sel_nextObject);
return result ? new ID(result) : null;
}
}
}
4 changes: 2 additions & 2 deletions src/derelict/sdl/macinit/NSMenu.d
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class NSMenu : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSMenu init ()
override NSMenu init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand Down Expand Up @@ -110,4 +110,4 @@ class NSMenu : NSObject
{
objc_msgSend(this.id_, sel_addItem, newItem ? newItem.id_ : null);
}
}
}
4 changes: 2 additions & 2 deletions src/derelict/sdl/macinit/NSMenuItem.d
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class NSMenuItem : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSMenuItem init ()
override NSMenuItem init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand Down Expand Up @@ -115,4 +115,4 @@ class NSMenuItem : NSObject
{
objc_msgSend(this.id_, sel_setSubmenu, submenu ? submenu.id_ : null);
}
}
}
4 changes: 2 additions & 2 deletions src/derelict/sdl/macinit/NSNotification.d
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class NSNotification : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSNotification init ()
override NSNotification init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
}
}
}
2 changes: 1 addition & 1 deletion src/derelict/sdl/macinit/NSProcessInfo.d
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class NSProcessInfo : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSProcessInfo init ()
override NSProcessInfo init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand Down
4 changes: 2 additions & 2 deletions src/derelict/sdl/macinit/NSString.d
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class NSString : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

NSString init ()
override NSString init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand Down Expand Up @@ -162,4 +162,4 @@ class NSString : NSObject

return result;
}
}
}
11 changes: 5 additions & 6 deletions src/derelict/sdl/macinit/SDLMain.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Feel free to customize this file to suit your needs
*/
module derelict.sdl.macinit.SDLMain;
import main;
//import main;

version(DigitalMars) version(OSX) version = darwin;

Expand All @@ -25,7 +25,6 @@ private

else
{
import std.c.linux.linux;
import core.stdc.stdlib;
import core.stdc.string;
import core.sys.posix.unistd;
Expand Down Expand Up @@ -103,7 +102,7 @@ private
static this ()
{
version (SDL_USE_CPS)
load(&DerelictSDLMac.bindFunc);
load(&DerelictSDLMac.bindFunc);

registerSubclasses();
CustomApplicationMain();
Expand Down Expand Up @@ -300,7 +299,7 @@ class SDLApplication : NSApplication
objc_msgSend(class_SDLApplication, sel_poseAsClass, aClass);
}

SDLApplication init ()
override SDLApplication init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand Down Expand Up @@ -348,7 +347,7 @@ class SDLMain : NSObject
return cast(Class) objc_getClass!(this.stringof);
}

SDLMain init ()
override SDLMain init ()
{
id result = objc_msgSend(this.id_, sel_init);
return result ? this : null;
Expand Down Expand Up @@ -395,7 +394,7 @@ extern (C)
id application (id sender, SEL selector, id arg0, id arg1)
{
if (arg1) {
main.openFile((new NSString(arg1)).UTF8String());
// main.openFile((new NSString(arg1)).UTF8String());
}

return cast(id) true;
Expand Down
4 changes: 2 additions & 2 deletions src/derelict/util/loader.d
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected:
return _lib;
}

void bindFunc(void** ptr, string funcName, bool doThrow = true)
public void bindFunc(void** ptr, string funcName, bool doThrow = true)
{
void* func = lib.loadSymbol(funcName, doThrow);
*ptr = func;
Expand Down Expand Up @@ -149,4 +149,4 @@ template bindFunc(T) {
res.fptr = cast(void**)&a;
return res;
}
}
}

0 comments on commit 68d6518

Please sign in to comment.