Add Comparison category to NSObject, add README file
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
ac5ddd48a0
commit
0f46e9f10c
121
Comparison.h
Normal file
121
Comparison.h
Normal file
@ -0,0 +1,121 @@
|
||||
//
|
||||
// $Id: Comparison.h,v 1.3 2004/12/12 20:17:24 will_mason Exp $
|
||||
//
|
||||
// vi: set ft=objc:
|
||||
|
||||
/*
|
||||
* ObjectiveLib - a library of containers and algorithms for Objective-C
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* Will Mason
|
||||
*
|
||||
* Portions:
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Copyright (c) 1996,1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Copyright (c) 1997
|
||||
* Moscow Center for SPARC Technology
|
||||
*
|
||||
* Copyright (c) 1999
|
||||
* Boris Fomitchev
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
*
|
||||
* You may contact the author at will_mason@users.sourceforge.net.
|
||||
*/
|
||||
|
||||
#if defined(GNUSTEP)
|
||||
|
||||
#if !defined(__COMPARISON_OL_GUARD)
|
||||
#define __COMPARISON_OL_GUARD
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
/**
|
||||
* @category NSObject(OLComparisonMethods) Comparison.h Objectivelib/Comparison.h
|
||||
*
|
||||
* Comparison methods used in @ref Functors "function objects". These comparison
|
||||
* methods are only required to be included when GNUstep is the platform, as
|
||||
* Cocoa already defines them. Under Cocoa they are declared in the
|
||||
* intuitively-named file @c NSScriptWhoseTests.h. All of these methods send
|
||||
* the message @c compare: to the receiving object.
|
||||
*
|
||||
* @pre The receiving object must implement the method @c compare:.
|
||||
*/
|
||||
@interface NSObject (OLComparisonMethods)
|
||||
|
||||
/**
|
||||
* Return whether another object is equal to this one. This message returns YES if
|
||||
* and only if the message @c compare: returns @c NSOrderedSame.
|
||||
*
|
||||
* @param object the object to which to compare this one
|
||||
* @return YES if @a object is equal to this one, NO otherwise
|
||||
*/
|
||||
- (BOOL) isEqualTo: (id)object;
|
||||
|
||||
/**
|
||||
* Return whether this object is greater than another one. This message returns
|
||||
* YES if and only if @c compare: returns @c NSOrderedDescending.
|
||||
*
|
||||
* @param object the object to which to compare this one
|
||||
* @return YES if this object is greater than @a object, NO otherwise
|
||||
*/
|
||||
- (BOOL) isGreaterThan: (id)object;
|
||||
|
||||
/**
|
||||
* Return whether this object is greater than or equal to another one. This message returns
|
||||
* YES if and only if @c compare: does not return @c NSOrderedAscending.
|
||||
*
|
||||
* @param object the object to which to compare this one
|
||||
* @return YES if this object is greater than or equal to @a object, NO otherwise
|
||||
*/
|
||||
- (BOOL) isGreaterThanOrEqualTo: (id)object;
|
||||
|
||||
/**
|
||||
* Return whether this object is less than another one. This message returns
|
||||
* YES if and only if @c compare: returns @c NSOrderedAscending.
|
||||
*
|
||||
* @param object the object to which to compare this one
|
||||
* @return YES if this object is less than @a object, NO otherwise
|
||||
*/
|
||||
- (BOOL) isLessThan: (id)object;
|
||||
|
||||
/**
|
||||
* Return whether this object is less than or equal to another one. This message returns
|
||||
* YES if and only if @c compare: does not return @c NSOrderedDescending.
|
||||
*
|
||||
* @param object the object to which to compare this one
|
||||
* @return YES if this object is less than or equal to @a object, NO otherwise
|
||||
*/
|
||||
- (BOOL) isLessThanOrEqualTo: (id)object;
|
||||
|
||||
/**
|
||||
* Return whether another object is not equal to this one. This message returns YES if
|
||||
* and only if the message @c compare: does not return @c NSOrderedSame.
|
||||
*
|
||||
* @param object the object to which to compare this one
|
||||
* @return YES if @a object is not equal to this one, NO otherwise
|
||||
*/
|
||||
- (BOOL) isNotEqualTo: (id)object;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
88
Comparison.m
Normal file
88
Comparison.m
Normal file
@ -0,0 +1,88 @@
|
||||
//
|
||||
// $Id: Comparison.m,v 1.3 2004/11/29 23:35:50 will_mason Exp $
|
||||
//
|
||||
// vi: set ft=objc:
|
||||
|
||||
/*
|
||||
* ObjectiveLib - a library of containers and algorithms for Objective-C
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* Will Mason
|
||||
*
|
||||
* Portions:
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Copyright (c) 1996,1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Copyright (c) 1997
|
||||
* Moscow Center for SPARC Technology
|
||||
*
|
||||
* Copyright (c) 1999
|
||||
* Boris Fomitchev
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
*
|
||||
* You may contact the author at will_mason@users.sourceforge.net.
|
||||
*/
|
||||
|
||||
#if defined(GNUSTEP)
|
||||
|
||||
#include "Comparison.h"
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
@implementation NSObject (OLComparison)
|
||||
|
||||
- (BOOL) isEqualTo: (id)object
|
||||
{
|
||||
return (object != nil && [self compare: object] == NSOrderedSame) ?
|
||||
YES : NO;
|
||||
}
|
||||
|
||||
- (BOOL) isGreaterThan: (id)object
|
||||
{
|
||||
return (object != nil && [self compare: object] == NSOrderedDescending) ?
|
||||
YES : NO;
|
||||
}
|
||||
|
||||
- (BOOL) isGreaterThanOrEqualTo: (id)object
|
||||
{
|
||||
return (object != nil && [self compare: object] != NSOrderedAscending) ?
|
||||
YES : NO;
|
||||
}
|
||||
|
||||
- (BOOL) isLessThan: (id)object
|
||||
{
|
||||
return (object != nil && [self compare: object] == NSOrderedAscending) ?
|
||||
YES : NO;
|
||||
}
|
||||
|
||||
- (BOOL) isLessThanOrEqualTo: (id)object
|
||||
{
|
||||
return (object != nil && [self compare: object] != NSOrderedDescending) ?
|
||||
YES : NO;
|
||||
}
|
||||
|
||||
- (BOOL) isNotEqualTo: (id)object
|
||||
{
|
||||
return (object != nil && [self compare: object] != NSOrderedSame) ?
|
||||
YES : NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
@ -8,7 +8,7 @@ APP_NAME = oolite
|
||||
oolite_LIB_DIRS += -L/usr/X11R6/lib/
|
||||
|
||||
oolite_C_FILES = vector.c legacy_random.c
|
||||
oolite_OBJC_FILES = AI.m DustEntity.m Entity.m GameController.m GuiDisplayGen.m HeadUpDisplay.m main.m MyOpenGLView.m OpenGLSprite.m ParticleEntity.m PlanetEntity.m PlayerEntity_Additions.m PlayerEntity_contracts.m PlayerEntity.m ResourceManager.m RingEntity.m ShipEntity_AI.m ShipEntity.m SkyEntity.m StationEntity.m TextureStore.m Universe.m
|
||||
oolite_OBJC_FILES = Comparison.m AI.m DustEntity.m Entity.m GameController.m GuiDisplayGen.m HeadUpDisplay.m main.m MyOpenGLView.m OpenGLSprite.m ParticleEntity.m PlanetEntity.m PlayerEntity_Additions.m PlayerEntity_contracts.m PlayerEntity.m ResourceManager.m RingEntity.m ShipEntity_AI.m ShipEntity.m SkyEntity.m StationEntity.m TextureStore.m Universe.m
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/application.make
|
||||
include GNUmakefile.postamble
|
||||
|
@ -44,6 +44,10 @@ Your fair use and other rights are in no way affected by the above.
|
||||
#import "ResourceManager.h"
|
||||
#import "AI.h"
|
||||
|
||||
#ifdef GNUSTEP
|
||||
#import "Comparison.h"
|
||||
#endif
|
||||
|
||||
@implementation PlayerEntity (Scripting)
|
||||
|
||||
static NSString * mission_string_value;
|
||||
|
85
README.TXT
Normal file
85
README.TXT
Normal file
@ -0,0 +1,85 @@
|
||||
Oolite-Linux
|
||||
============
|
||||
|
||||
This repository contains the files required to build Oolite for Linux,
|
||||
GNUstep and OpenGL. It is possibly easily portable to FreeBSD. It
|
||||
won't yet work on Windows due to the lack of OpenGL support in the
|
||||
Windows implementation of GNUstep. However, if this is fixed, it
|
||||
will probably need very little effort to port.
|
||||
|
||||
0. Pre-requisites
|
||||
|
||||
- Objective-C. On Fedora Core, 'up2date -i gcc-objc' installs.
|
||||
|
||||
- GNUstep Development libraries. I advise you build GNUstep from source
|
||||
since some prepackaged versions don't have a new enough NSOpenGLView.
|
||||
It builds easily from source so don't panic.
|
||||
|
||||
Modifications from Stock OSX Oolite
|
||||
===================================
|
||||
|
||||
Makefiles:
|
||||
GNUmakefile and GNUmakefile.postamble.
|
||||
The former controls compilation and linking, and the latter copies
|
||||
data files (PNG images, plists, dat files) into oolite.app/Contents/Resources.
|
||||
PlayerEntity_Additions.m, PlayerEntity_contracts.m, ShipEntity_AI.m -
|
||||
These just #include "PlayerEntity (contracts).m" etc. because
|
||||
spaces and brackets really suck in the Makefile and shell.
|
||||
#ifdefs -
|
||||
All over the code you'll see #ifdef GNUSTEP ... #else .... #endif
|
||||
If you grep for these, you can see where work has to be done.
|
||||
I've usually put a TODO: comment line in these (many of them are not
|
||||
filled in). I've not #ifdef'd out any methods - I've left at least
|
||||
a stub if there's nothing to put in there (for example, speech).
|
||||
|
||||
Addition of Comparison.m/h from ObjectiveLib
|
||||
(see http://objectivelib.sourceforge.net). ObjectiveLib is an LGPL'd
|
||||
set of libraries to add functionality to GNUstep. Comparison.h/m
|
||||
implements a category of NSObject that adds isEqualTo:, isGreaterThan:,
|
||||
isGreaterThanOrEqualTo:, isLessThan:, isLessThanOrEqualTo:, isNotEqualTo:
|
||||
methods. It looked like a relatively simple category, so rather
|
||||
than creating a dependency on the whole of ObjectiveLib, I decided
|
||||
to just add these two files.
|
||||
|
||||
Major tasks left
|
||||
================
|
||||
|
||||
- Crashing: What's here crashes with depressing frequency. I tend
|
||||
to get floating point exceptions mostly.
|
||||
- Runtime error when pressing F2 when docked.
|
||||
- Load New Commander file dialogue.
|
||||
- Sound: The GNUstep sound server appears to have some inadequacies
|
||||
at present - using some other library may be necessary.
|
||||
- OpenGL....APPLE functions (optimizations) need a suitable replacement.
|
||||
- Full screen modes: not implemented at all at present, Carbon
|
||||
API calls need replacing with the equivalent GNUstep or X Window System
|
||||
xlib function calls.
|
||||
- Music. I suspect we can use Xine for music; xine provides a library
|
||||
that I think is cross-platform.
|
||||
- Speech. This is a more 'who cares?' requirement. I don't know of
|
||||
a *nix open source speech synth.
|
||||
|
||||
Building
|
||||
========
|
||||
Type:
|
||||
make.
|
||||
|
||||
Running
|
||||
=======
|
||||
Type:
|
||||
openapp oolite
|
||||
|
||||
or
|
||||
openapp oolite.debug
|
||||
if you built with 'make debug=yes'.
|
||||
|
||||
Suggestions
|
||||
===========
|
||||
I suggest you go through some of the GNUstep tutorials and make sure these
|
||||
build and run successfully to ensure your build and runtime environment
|
||||
is sane. Also, there's a little (and rather nasty) environment tester
|
||||
on ftp.alioth.net/oolite/gl-gnustep.tar.gz. If you're having problems
|
||||
I recommend you get this running first; it's relatively simple and should
|
||||
expose any problems your installation has without possible Oolite problems
|
||||
clouding your view.
|
||||
|
@ -40,6 +40,9 @@ Your fair use and other rights are in no way affected by the above.
|
||||
*/
|
||||
|
||||
#import "ResourceManager.h"
|
||||
#ifdef GNUSTEP
|
||||
#import "Comparison.h"
|
||||
#endif
|
||||
|
||||
|
||||
@implementation ResourceManager
|
||||
|
Loading…
x
Reference in New Issue
Block a user