[Top][All Lists]

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

Re: GWorkspace porting troubles

From: LHelldorf
Subject: Re: GWorkspace porting troubles
Date: Mon, 29 Oct 2001 23:00:04 +0100

At first I want to thank you all for your help. I also think it is the 
right idea to put the vast majority of the changes in a compatibility header, 
whether it will be called MacOSXCompat.h or GNUstep.h.

My way to go was to create a file called GNUstep.h from your input (I've 
choosen to take the best of both efforts) and to 
include this headerfile in every source file (.m) I found. Here is my 
version of GNUstep.h:

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

   Written by: Nicola Pero <address@hidden>
   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
   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 

# 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] 
#  define DESTROY(object)          ({ \
     if (object) \
       { \
         id __o = object; \
         object = nil; \
         [__o release]; \
       } \
     NSAutoreleasePool *(X) = [NSAutoreleasePool new]
#  define _(X) NSLocalizedString (X, nil)
#  define __(X) X
#  define NSLocalizedStaticString(X, Y) X
# endif /* GNUSTEP */

What about putting it into a repository at GNUstep?

When trying to compile the so modified source all the RETAIN, RELEASE and 
so on errors went away. Anyway, GNUstep.h is not complete yet. There are 
some extensions to NSObject in GNUstep which are not in Cocoa, for 
instance the next showstopper:

GWorkspace.m: In function `+[GWorkspace gworkspace]':
GWorkspace.m:92: `gnustep_global_lock' undeclared (first use in this 
GWorkspace.m:92: (Each undeclared identifier is reported only once

gnustep_global_lock is defined in NSObject.h (line 178: GS_EXPORT 
NSRecursiveLock *gnustep_global_lock;) and initialized in NSObject.m (line 
603: gnustep_global_lock = [[NSRecursiveLock alloc] init];). Then 
GS_EXPORT also doesn't exist in Cocoa.
How do I come out of this situation? How do I "bolt" those GNUstep 
extensions onto Cocoa's NSObject?

What do you think about creating a GNUstepExtension.Framework for Mac OS X 
to make the porting GNUstep -> Cocoa easier and to standardize any porting 

Greetings, Lars

reply via email to

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