discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gomoku.app ported to Mac OS X


From: Lars Sonchocky-Helldorf
Subject: Gomoku.app ported to Mac OS X
Date: Mon, 21 Jan 2002 21:57:01 +0100

Hi,
I want to inform you that I have ported Gomoku.app to Mac Os X 10.1.2 ( == 
current version). While some minor tasks remain (creating an apllication 
icon, internationalizing MainMenu.nib, creating a better about panel), 
Gomoku.app now runs flawless on Mac OS X. Since I find it inappropriate to 
post a tarball on the list, I'll just publish the diffs with comments 
here. Anyone (Nicola Pero?) interested in all the files (including 
Gomoku.pbproj and MaiMenu.nib) please mail me directly.

Only in Gomoku-1.2.5/: .DS_Store
        silly Mac OS X Finder file, not needed, don't care
diff -r Gomoku-1.2.5.original/Board.m Gomoku-1.2.5/Board.m
27a28
> #include "GNUstep.h"
        that header file contains macros used in GNUstep apps. I am not 
shure about the name, maybe it's better to rename it into GNUstep2Cocoa.h. 
What do you think?
diff -r Gomoku-1.2.5.original/Controller.h Gomoku-1.2.5/Controller.h
31a32,41
>   // Outlets
>   IBOutlet NSMenu *menu;
> 
>   IBOutlet NSMenuItem *game;
>   IBOutlet NSMenuItem *window;
>   IBOutlet NSMenuItem *help;
>   IBOutlet NSMenuItem *aboutPanelMenuItem;
>   IBOutlet NSMenuItem *preferencesMenuItem;
>   IBOutlet NSMenuItem *newGameMenuItem;
> 
39,40c49,50
< - (void) runDifficultyLevelPanel: (id)sender;
< - (void) newGame: (id)sender;
---
> - (IBAction) runDifficultyLevelPanel: (id)sender;
> - (IBAction) newGame: (id)sender;
        those changes were needed to establish connetions in Interface 
Builder. They should also work in GNUstep I asume (at least there were no 
special measures taken in Affiche on that case)
diff -r Gomoku-1.2.5.original/Controller.m Gomoku-1.2.5/Controller.m
25a26
> #include "GNUstep.h"
140a142,148
> - (void) awakeFromNib
> {
>     [self init: 8];
>     [self center];
>     [self orderFront: self];
> }
> 
206c214
< - (void) runDifficultyLevelPanel: (id) sender
---
> - (IBAction) runDifficultyLevelPanel: (id) sender
216c224
< - (void) newGame: (id) sender
---
> - (IBAction) newGame: (id) sender
        Outlets and Actions again, that awakeFromNib is needed to 
initialize controller propoerly. see the comment on main.m
Binary files Gomoku-1.2.5.original/English.lproj/Localizable.strings and 
Gomoku-1.2.5/English.lproj/Localizable.strings differ
        Here I changed those files to unicode since I had some problems 
with german umlauts (actually in German.lproj/Localizable.strings, but I 
changed all of them)
Only in Gomoku-1.2.5/English.lproj: MainMenu.nib
        Our nib file. Contains the menu and a proxy instance of 
controller.
Binary files Gomoku-1.2.5.original/French.lproj/Localizable.strings and 
Gomoku-1.2.5/French.lproj/Localizable.strings differ
Only in Gomoku-1.2.5/: GNUstep.h
        the header that helps porting. I'll include it at the end of that 
mail.
Binary files Gomoku-1.2.5.original/German.lproj/Localizable.strings and 
Gomoku-1.2.5/German.lproj/Localizable.strings differ
Only in Gomoku-1.2.5/: Gomoku.pbproj
        the Project Builder file
Binary files Gomoku-1.2.5.original/Italian.lproj/Localizable.strings and 
Gomoku-1.2.5/Italian.lproj/Localizable.strings differ
Binary files Gomoku-1.2.5.original/Spanish.lproj/Localizable.strings and 
Gomoku-1.2.5/Spanish.lproj/Localizable.strings differ
Binary files Gomoku-1.2.5.original/Swedish.lproj/Localizable.strings and 
Gomoku-1.2.5/Swedish.lproj/Localizable.strings differ
Only in Gomoku-1.2.5/: build
        build directory created by Project Builder
diff -r Gomoku-1.2.5.original/main.m Gomoku-1.2.5/main.m
24a25
> #include "GNUstep.h"
29a31
> #ifdef GNUSTEP
32a35
> #endif
39a43
> #ifdef GNUSTEP
104a109
> #endif
109a115,118
> #ifndef GNUSTEP
>    NSApplicationMain(argc, argv);
> #endif
> #ifdef GNUSTEP
112a122
> #endif
        menu creation code ifdef-ed out, application starting code 
changed. Why?:

   controller = [Controller new: cnt];
   [app setDelegate: controller];
   [app run];

caused the app to start without loading the nib, that means menuless.

   controller = [Controller new: cnt];
   [app setDelegate: controller];
   NSApplicationMain(argc, argv);

menus did load but I got an "EXC_BAD_ACCESS". So there is no other way 
than to call NSApplicationMain(argc, argv); before creating/initializing 
controller. controller has to be created from a nib. Since the nib of 
controller is just an instance of NSWindow with a custom class in IB I 
have to catch that awakeFromNib to initialize controller. Sadly I don't 
know how to pass that cnt over to that method. That's why I have just 
inserted "8" instead of cnt in awakeFromNib.

And finally: GNUstep.h (which I think should possibly renamed into 
GNUstep2Cocoa.h and should become official part (cvs wise) of GNUstep (for 
porting purposes)):

/* GNUstep.h - macros to make easier to port gnustep apps to macos-x
   Copyright (C) 2001 Free Software Foundation, Inc.

   Written by: Nicola Pero <n.pero@mi.flashnet.it>
   Date: March, October 2001
 
   This file is part of GNUstep.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
 
   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.
 
   You should have received a copy of the GNU Library General Public
   License along with this library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
02111-1307, USA.
*/ 

#ifndef __GNUSTEP_GNUSTEP_H_INCLUDED_
#define __GNUSTEP_GNUSTEP_H_INCLUDED_

#ifndef GNUSTEP

#define AUTORELEASE(object)      [object autorelease]
#define TEST_AUTORELEASE(object) ({ if (object) [object autorelease]; })

#define RELEASE(object)          [object release]
#define TEST_RELEASE(object)     ({ if (object) [object release]; })

#define RETAIN(object)           [object retain]
#define TEST_RETAIN(object)      ({ if (object) [object retain]; })

#define ASSIGN(object,value)     ({\
     id __value = (id)(value); \
     id __object = (id)(object); \
     if (__value != __object) \
       { \
         if (__value != nil) \
           { \
             [__value retain]; \
           } \
         object = __value; \
         if (__object != nil) \
           { \
             [__object release]; \
           } \
       } \
   })

#define ASSIGNCOPY(object,value) ASSIGN(object, [[value copy] 
autorelease]);

#define DESTROY(object)          ({ \
     if (object) \
       { \
         id __o = object; \
         object = nil; \
         [__o release]; \
       } \
   })

#define CREATE_AUTORELEASE_POOL(X) \
NSAutoreleasePool *(X) = [NSAutoreleasePool new]

#define NSLocalizedString(key, comment) \
  [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]

#define _(X) NSLocalizedString (X, nil)
#define __(X) X

#define NSLocalizedStaticString(X, Y) X

#endif /* GNUSTEP */

#endif /* __GNUSTEP_GNUSTEP_H_INCLUDED_ */

Greetings, Lars




reply via email to

[Prev in Thread] Current Thread [Next in Thread]