Run loop integrated. Configure detects libFoundation.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2280 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Scott Christley 1997-04-22 18:23:58 +00:00
parent 8ca61ca6f4
commit ab62618166
27 changed files with 2770 additions and 1535 deletions

138
ChangeLog
View file

@ -1,3 +1,141 @@
Mon Apr 21 18:57:30 1997 Ovidiu Predescu <ovidiu@net-community.com>
* Implement NSCopying protocol to cell classes.
* Headers/gnustep/gui/NSCell.h: Declare class to conform to
NSCopying.
* Headers/gnustep/gui/NSActionCell.h: Likewise.
* Headers/gnustep/gui/NSButtonCell.h: Likewise.
* Source/NSCell.m: Implement copyWithZone:.
* Source/NSActionCell.m: Likewise.
* Source/NSButtonCell.m: Likewise.
* Use NSRunLoop to get the events.
* Headers/gnustep/gui/NSApplication.h: Define USE_RUN_LOOP macro if you
want NSRunLoop class to be used instead of the default busy wait. Note
that some classes will not work with the "default" loop. This macro
should be removed eventually.
(-setupRunLoopInputSourcesForMode:): New method to be implemented in
backend. In this method the backend should register to run loop the
input sources it uses.
* Source/NSApplication.m (-init): Call backend method
-setupRunLoopInputSourcesForMode: to setup the input source is several
modes used by NSApp.
(-run): Get the events from NSDefaultRunLoopMode mode instead of nil.
(-nextEventMatchingMask:untilDate:inMode:dequeue:): Check for a
matching event into the events queue in the order in which the events
occured. Temporary retain the event found before removing it from the
events queue to avoid an unneeded deallocation.
Inside the loop fire the timers then wait for inputs on the input
sources of run loop.
* Source/NSButton.m: Call the nextEventMatchingMask:... using the
NSEventTrackingRunLoopMode mode instead of nil.
* Source/NSCell.m: (-trackMouse:inRect:ofView:untilMouseUp:): Likewise.
(-trackScrollButtons:): Likewise.
* Source/NSScroller.m (-trackKnob:): Likewise.
* Source/NSWindow.m (-nextEventMatchingMask:): Likewise.
* NSMatrix class completely reworked to be compliant to the OpenStep
specification.
* Source/NSMatrix.m: The second implementation.
* Headers/gnustep/gui/NSMatrix.h: Likewise.
* Implementation of NSForm, not tested.
* Source/NSForm.m: Initial implementation.
* Headers/gnustep/gui/NSForm.h: Likewise.
* Source/NSFormCell.m: Initial implementation.
* Headers/gnustep/gui/NSFormCell.h: Likewise.
* Added support in configure and makefiles for libFoundation.
* configure.in: Configure checks now for the underlaying Foundation
library and the Objective-C runtime for whom the library was compiled
for. The code is copied with copy/paste from libFoundation sources.
* aclocal.m4: Likewise.
* Source/Makefile.in: New OBJC_RUNTIME_FLAG that gets replaced by
configure. Remove OBJC_LIB since the runtime library is added to LIBS
by configure.
* Source/NSButton.m: Comment out captureMouse: method call to make
possible debugging. Anyway it seems we don't need to capture the mouse.
* Source/NSButtonCell.m: Remove the -prefersTrackingUntilMouseUp
method.
* Source/NSCell.m: Changed the way in which a cell gets initialized.
Moved all the common things into the -_init method.
* Added support for periodic events.
* Source/NSEvent.m: (+startPeriodicEventsAfterDelay:withPeriod:,
+stopPeriodicEvents): New public methods.
(+_timerFired:, +_registerRealTimer:): New private methods.
Mon Apr 21 18:57:30 1997 Ovidiu Predescu <ovidiu@net-community.com>
* Implement NSCopying protocol to cell classes.
* Headers/gnustep/gui/NSCell.h: Declare class to conform to
NSCopying.
* Headers/gnustep/gui/NSActionCell.h: Likewise.
* Headers/gnustep/gui/NSButtonCell.h: Likewise.
* Source/NSCell.m: Implement copyWithZone:.
* Source/NSActionCell.m: Likewise.
* Source/NSButtonCell.m: Likewise.
* Use NSRunLoop to get the events.
* Headers/gnustep/gui/NSApplication.h: Define USE_RUN_LOOP macro if you
want NSRunLoop class to be used instead of the default busy wait. Note
that some classes will not work with the "default" loop. This macro
should be removed eventually.
(-setupRunLoopInputSourcesForMode:): New method to be implemented in
backend. In this method the backend should register to run loop the
input sources it uses.
* Source/NSApplication.m (-init): Call backend method
-setupRunLoopInputSourcesForMode: to setup the input source is several
modes used by NSApp.
(-run): Get the events from NSDefaultRunLoopMode mode instead of nil.
(-nextEventMatchingMask:untilDate:inMode:dequeue:): Check for a
matching event into the events queue in the order in which the events
occured. Temporary retain the event found before removing it from the
events queue to avoid an unneeded deallocation.
Inside the loop fire the timers then wait for inputs on the input
sources of run loop.
* Source/NSButton.m: Call the nextEventMatchingMask:... using the
NSEventTrackingRunLoopMode mode instead of nil.
* Source/NSCell.m: (-trackMouse:inRect:ofView:untilMouseUp:): Likewise.
(-trackScrollButtons:): Likewise.
* Source/NSScroller.m (-trackKnob:): Likewise.
* Source/NSWindow.m (-nextEventMatchingMask:): Likewise.
* NSMatrix class completely reworked to be compliant to the OpenStep
specification.
* Source/NSMatrix.m: The second implementation.
* Headers/gnustep/gui/NSMatrix.h: Likewise.
* Implementation of NSForm, not tested.
* Source/NSForm.m: Initial implementation.
* Headers/gnustep/gui/NSForm.h: Likewise.
* Source/NSFormCell.m: Initial implementation.
* Headers/gnustep/gui/NSFormCell.h: Likewise.
* Added support in configure and makefiles for libFoundation.
* configure.in: Configure checks now for the underlaying Foundation
library and the Objective-C runtime for whom the library was compiled
for. The code is copied with copy/paste from libFoundation sources.
* aclocal.m4: Likewise.
* Source/Makefile.in: New OBJC_RUNTIME_FLAG that gets replaced by
configure. Remove OBJC_LIB since the runtime library is added to LIBS
by configure.
* Source/NSButton.m: Comment out captureMouse: method call to make
possible debugging. Anyway it seems we don't need to capture the mouse.
* Source/NSButtonCell.m: Remove the -prefersTrackingUntilMouseUp
method.
* Source/NSCell.m: Changed the way in which a cell gets initialized.
Moved all the common things into the -_init method.
* Added support for periodic events.
* Source/NSEvent.m: (+startPeriodicEventsAfterDelay:withPeriod:,
+stopPeriodicEvents): New public methods.
(+_timerFired:, +_registerRealTimer:): New private methods.
Fri Apr 04 14:03:40 1997 Scott Christley <scottc@net-community.com>
* Source/NSSlider.m (MB_NSSLIDER_CLASS): Rename to follow GNU

View file

@ -3,7 +3,7 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: February 1997
This file is part of the GNUstep GUI Library.

View file

@ -31,7 +31,7 @@
#include <AppKit/NSCell.h>
@interface NSActionCell : NSCell <NSCoding>
@interface NSActionCell : NSCell <NSCopying, NSCoding>
{
// Attributes
int tag;

View file

@ -31,6 +31,8 @@
#include <AppKit/NSResponder.h>
#define USE_RUN_LOOP 1
@class NSArray;
@class NSMutableArray;
@class NSString;
@ -277,6 +279,9 @@ extern NSString *NSEventTrackingRunLoopMode;
// handle a non-translated event
- (void)handleNullEvent;
/* Set up the run loop input sources for a given mode */
- (void)setupRunLoopInputSourcesForMode:(NSString*)mode;
@end
@interface NSObject (NSServicesRequests)

View file

@ -44,7 +44,7 @@ typedef enum _NSButtonType {
NSMomentaryLight
} NSButtonType;
@interface NSButtonCell : NSActionCell <NSCoding>
@interface NSButtonCell : NSActionCell <NSCopying, NSCoding>
{
// Attributes
NSString *altContents;

View file

@ -94,7 +94,7 @@ enum {
NSChangeBackgroundCellMask = 8
};
@interface NSCell : NSObject <NSCoding>
@interface NSCell : NSObject <NSCopying, NSCoding>
{
// Attributes
NSString *contents;

View file

@ -6,7 +6,7 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: 1996, 1997
This file is part of the GNUstep GUI Library.

View file

@ -5,9 +5,9 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Date: 1996
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: March 1997
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
@ -35,15 +35,12 @@
@class NSFont;
@interface NSForm : NSMatrix <NSCoding>
{
// Attributes
}
//
// Laying Out the Form
//
- (NSFormCell *)addEntry:(NSString *)title;
- (NSFormCell *)insertEntry:(NSString *)title
- (NSFormCell*)addEntry:(NSString*)title;
- (NSFormCell*)insertEntry:(NSString*)title
atIndex:(int)index;
- (void)removeEntryAtIndex:(int)index;
- (void)setInterlineSpacing:(float)spacing;
@ -60,15 +57,9 @@
- (void)setBezeled:(BOOL)flag;
- (void)setBordered:(BOOL)flag;
- (void)setTextAlignment:(int)mode;
- (void)setTextFont:(NSFont *)fontObject;
- (void)setTextFont:(NSFont*)fontObject;
- (void)setTitleAlignment:(NSTextAlignment)mode;
- (void)setTitleFont:(NSFont *)fontObject;
//
// Setting the Cell Class
//
+ (Class)cellClass;
+ (void)setCellClass:(Class)classId;
- (void)setTitleFont:(NSFont*)fontObject;
//
// Getting a Cell
@ -90,12 +81,6 @@
//
- (void)setEntryWidth:(float)width;
//
// NSCoding protocol
//
- (void)encodeWithCoder:aCoder;
- initWithCoder:aDecoder;
@end
#endif // _GNUstep_H_NSForm

View file

@ -5,8 +5,8 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Date: 1996
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: March 1997
This file is part of the GNUstep GUI Library.
@ -31,21 +31,14 @@
#include <AppKit/NSActionCell.h>
@class NSTextFieldCell;
@interface NSFormCell : NSActionCell <NSCoding>
{
// Attributes
float titleWidth;
NSTextFieldCell* textCell;
}
//
// Initializing an NSFormCell
//
- (id)initTextCell:(NSString *)aString;
//
// Determining an NSFormCell's Size
//
- (NSSize)cellSizeForBounds:(NSRect)aRect;
//
// Determining Graphic Attributes
//
@ -54,13 +47,13 @@
//
// Modifying the Title
//
- (void)setTitle:(NSString *)aString;
- (void)setTitle:(NSString*)aString;
- (void)setTitleAlignment:(NSTextAlignment)mode;
- (void)setTitleFont:(NSFont *)fontObject;
- (void)setTitleFont:(NSFont*)fontObject;
- (void)setTitleWidth:(float)width;
- (NSString *)title;
- (NSString*)title;
- (NSTextAlignment)titleAlignment;
- (NSFont *)titleFont;
- (NSFont*)titleFont;
- (float)titleWidth;
- (float)titleWidth:(NSSize)aSize;
@ -68,7 +61,7 @@
// Displaying
//
- (void)drawInteriorWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView;
inView:(NSView*)controlView;
//
// NSCoding protocol

View file

@ -3,7 +3,7 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: February 1997
This file is part of the GNUstep GUI Library.

View file

@ -1,14 +1,12 @@
/*
NSMatrix.h
This is the Matrix class. This class corresponds to NSMatrix
of the OpenStep specification, but it also allows for rows
and columns of different sizes.
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Pascal Forget <pascal@wsc.com>
Date: 1996
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: March 1997
A completely rewritten version of the original source by Pascal Forget and
Scott Christley.
This file is part of the GNUstep GUI Library.
@ -51,26 +49,31 @@ typedef enum _NSMatrixMode {
@interface NSMatrix : NSControl <NSCoding>
{
// Attributes
NSMutableArray *rows;
NSMutableArray *col_widths;
NSMutableArray *row_heights;
int num_cols;
int num_rows;
NSCell *cell_prototype;
NSSize inter_cell;
Class cell_class;
BOOL allows_empty_selection;
BOOL selection_by_rect;
BOOL draws_background;
BOOL draws_cell_background;
NSMutableArray *selected_cells;
BOOL autoscroll;
BOOL scrollable;
BOOL autosize;
NSMatrixMode mode;
SEL double_action;
SEL error_action;
NSMutableArray* cells;
NSMatrixMode mode;
int numRows;
int numCols;
Class cellClass;
id cellPrototype;
NSSize cellSize;
NSSize intercell;
NSColor* backgroundColor;
NSColor* cellBackgroundColor;
id delegate;
id target;
SEL action;
SEL doubleAction;
SEL errorAction;
id selectedCell;
int selectedRow;
int selectedColumn;
void* selectedCells;
BOOL allowsEmptySelection;
BOOL selectionByRect;
BOOL drawsBackground;
BOOL drawsCellBackground;
BOOL autosizesCells;
BOOL autoscroll;
}
//
@ -147,6 +150,8 @@ typedef enum _NSMatrixMode {
- (void)sortUsingFunction:(int (*)(id element1, id element2, void *userData))comparator
context:(void *)context;
- (void)sortUsingSelector:(SEL)comparator;
- (int)numberOfColumns;
- (int)numberOfRows;
//
// Finding Matrix Coordinates
@ -258,8 +263,11 @@ typedef enum _NSMatrixMode {
//
//Target and Action
//
- (SEL)doubleAction;
- (void)setAction:(SEL)aSelector;
- (SEL)action;
- (void)setDoubleAction:(SEL)aSelector;
- (SEL)doubleAction;
- (void)setErrorAction:(SEL)aSelector;
- (SEL)errorAction;
- (BOOL)sendAction;
- (void)sendAction:(SEL)aSelector
@ -281,12 +289,6 @@ typedef enum _NSMatrixMode {
//
- (void)resetCursorRects;
//
// NSCoding protocol
//
- (void)encodeWithCoder:aCoder;
- initWithCoder:aDecoder;
@end
#endif // _GNUstep_H_NSMatrix

View file

@ -53,7 +53,6 @@ ALL_CFLAGS = $(ALL_CPPFLAGS) $(CFLAGS)
DEFS = -DGNUSTEP_INSTALL_LIBDIR=\"$(gnustep_libdir)\" @DEFS@
GCC_LIB =
OBJC_LIB = -lobjc
SYS_LIBS =
ADD_LIBS = @LIBS@
@ -236,14 +235,14 @@ OBJS = $(OBJS_WITHOUT_INIT)
.SUFFIXES: .m
.m$(oext):
$(CC) -c $(ALL_CFLAGS) $(DEFS) -o $@ $<
$(CC) @OBJC_RUNTIME_FLAG@ -c $(ALL_CFLAGS) $(DEFS) -o $@ $<
.c$(oext):
$(CC) -c $(ALL_CFLAGS) $(DEFS) -o $@ $<
#
# libraries
#
LIBS = $(GCC_LIB) $(OBJC_LIB) $(SYS_LIBS) $(ADD_LIBS)
LIBS = $(GCC_LIB) $(SYS_LIBS) $(ADD_LIBS)
#
# targets

View file

@ -219,6 +219,17 @@
return tag;
}
- (id)copyWithZone:(NSZone*)zone
{
NSActionCell* c = [super copyWithZone:zone];
[c setTag:tag];
[c setTarget:target];
[c setAction:action];
return c;
}
//
// NSCoding protocol
//

View file

@ -30,6 +30,7 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSRunLoop.h>
#include <DPSClient/NSDPSContext.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSPopUpButton.h>
@ -172,6 +173,12 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
//
[self setNextResponder:NULL];
/* Set up the run loop object for the current thread */
[self setupRunLoopInputSourcesForMode:NSDefaultRunLoopMode];
[self setupRunLoopInputSourcesForMode:NSConnectionReplyMode];
[self setupRunLoopInputSourcesForMode:NSModalPanelRunLoopMode];
[self setupRunLoopInputSourcesForMode:NSEventTrackingRunLoopMode];
return self;
}
@ -267,9 +274,10 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
do
{
e = [self nextEventMatchingMask:NSAnyEventMask untilDate:nil
inMode:nil dequeue:YES];
if (e != gnustep_gui_null_event)
e = [self nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantFuture]
inMode:NSDefaultRunLoopMode dequeue:YES];
if (e)
[self sendEvent: e];
else
{
@ -447,14 +455,16 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
if ([event_queue count])
{
j = [event_queue count];
for (i = j-1;i >= 0; --i)
// for (i = j-1;i >= 0; --i)
for (i = 0; i < j; i++)
{
e = [event_queue objectAtIndex: i];
if ([self event: e matchMask: mask])
{
[e retain];
[event_queue removeObjectAtIndex: i];
[self setCurrentEvent: e];
return e;
return [e autorelease];
}
}
}
@ -463,18 +473,39 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
done = NO;
while (!done)
{
e = [self getNextEvent];
#if USE_RUN_LOOP
NSRunLoop* currentLoop = [NSRunLoop currentRunLoop];
NSDate* limitDate = [currentLoop limitDateForMode:mode];
// Check mask
if ([self event: e matchMask: mask])
{
if (e)
{
[event_queue removeObject: e];
}
done = YES;
if (!expiration)
expiration = [NSDate distantFuture];
if (limitDate)
limitDate = [expiration earlierDate:limitDate];
else
limitDate = expiration;
// NSLog (@"calling runMode:beforeDate:");
[currentLoop runMode:mode beforeDate:limitDate];
// NSLog (@"return from runMode:beforeDate:");
#else
e = [self getNextEvent];
#endif
if ([event_queue count]) {
e = [[event_queue lastObject] retain];
// Check mask
if ([self event: e matchMask: mask])
{
if (e)
{
[event_queue removeObject: e];
}
done = YES;
}
}
}
}
// Unhide the cursor if necessary
// but only if its not a null event
@ -495,7 +526,7 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
}
[self setCurrentEvent: e];
return e;
return [e autorelease];
}
- (NSEvent *)peekEventMatchingMask:(unsigned int)mask
@ -1129,4 +1160,7 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
- (void)handleNullEvent
{}
- (void)setupRunLoopInputSourcesForMode:(NSString*)mode
{}
@end

View file

@ -293,7 +293,7 @@ id gnustep_gui_nsbutton_class = nil;
return;
// capture mouse
[[self window] captureMouse: self];
// [[self window] captureMouse: self];
[self lockFocus];
done = NO;
@ -311,12 +311,12 @@ id gnustep_gui_nsbutton_class = nil;
{
NSDebugLog(@"NSButton process another event\n");
e = [theApp nextEventMatchingMask:event_mask untilDate:nil
inMode:nil dequeue:YES];
inMode:NSEventTrackingRunLoopMode dequeue:YES];
}
}
// Release mouse
[[self window] releaseMouse: self];
// [[self window] releaseMouse: self];
// If the mouse went up in the button
if (mouseUp)

View file

@ -319,11 +319,6 @@
control_view = controlView;
}
+ (BOOL)prefersTrackingUntilMouseUp
{
return YES;
}
//
// Simulating a Click
//
@ -331,6 +326,22 @@
{
}
- (id)copyWithZone:(NSZone*)zone
{
NSButtonCell* c = [super copyWithZone:zone];
[c setAlternateTitle:altContents];
[c setAlternateImage:altImage];
[c setKeyEquivalent:keyEquivalent];
[c setKeyEquivalentFont:keyEquivalentFont];
[c setKeyEquivalentModifierMask:keyEquivalentModifierMask];
[c setTransparent:transparent];
c->highlightsByMask = highlightsByMask;
c->showAltStateMask = showAltStateMask;
return c;
}
//
// NSCoding protocol
//

View file

@ -64,9 +64,8 @@
//
// Initializing an NSCell
//
- init
- _init
{
[super init];
cell_type = NSNullCellType;
cell_image = nil;
cell_font = nil;
@ -86,9 +85,16 @@
return self;
}
- init
{
self = [super init];
[self _init];
return self;
}
- (id)initImageCell:(NSImage *)anImage
{
[super init];
[self _init];
// Not an image class --then forget it
if (![anImage isKindOfClass:[NSImage class]])
@ -98,24 +104,12 @@
cell_image = [anImage retain];
image_position = NSImageOnly;
cell_font = [[NSFont userFontOfSize:16] retain];
cell_state = NO;
cell_highlighted = NO;
cell_enabled = YES;
cell_editable = NO;
cell_bordered = NO;
cell_bezeled = NO;
cell_scrollable = NO;
cell_selectable = NO;
cell_continuous = NO;
cell_float_autorange = NO;
cell_float_left = 0;
cell_float_right = 0;
return self;
}
- (id)initTextCell:(NSString *)aString
{
[super init];
[self _init];
// Not a string class --then forget it
//if (![aString isKindOfClass:[NSString class]])
@ -127,15 +121,6 @@
text_align = NSCenterTextAlignment;
cell_image = nil;
image_position = NSNoImage;
cell_state = NO;
cell_highlighted = NO;
cell_enabled = YES;
cell_editable = NO;
cell_bordered = NO;
cell_bezeled = NO;
cell_scrollable = NO;
cell_selectable = NO;
cell_continuous = NO;
cell_float_autorange = YES;
cell_float_left = 0;
cell_float_right = 6;
@ -649,7 +634,7 @@
{
last_point = point;
e = [theApp nextEventMatchingMask:event_mask untilDate:nil
inMode:nil dequeue:YES];
inMode:NSEventTrackingRunLoopMode dequeue:YES];
location = [e locationInWindow];
point = [controlView convertPoint: location fromView: nil];
NSDebugLog(@"NSCell location %f %f\n", location.x, location.y);
@ -751,6 +736,36 @@
- (void)setRepresentedObject:(id)anObject
{}
- (id)copyWithZone:(NSZone*)zone
{
NSCell* c = NSAllocateObject (isa, 0, zone);
[c setStringValue:contents];
[c setImage:cell_image];
[c setFont:cell_font];
[c setState:cell_state];
c->cell_highlighted = cell_highlighted;
[c setEnabled:cell_enabled];
[c setEditable:cell_editable];
[c setBordered:cell_bordered];
[c setBezeled:cell_bezeled];
[c setScrollable:cell_scrollable];
[c setSelectable:cell_selectable];
[c setContinuous:cell_continuous];
[c setFloatingPointFormat:cell_float_autorange
left:cell_float_left
right:cell_float_right];
c->image_position = image_position;
[c setType:cell_type];
[c setAlignment:text_align];
[c setEntryType:entry_type];
c->control_view = control_view;
c->cell_size = cell_size;
c->represented_object = [represented_object retain];
return c;
}
//
// NSCoding protocol
//

View file

@ -6,6 +6,7 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: 1996
This file is part of the GNUstep GUI Library.
@ -26,11 +27,23 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <Foundation/NSDictionary.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSTimer.h>
#include <Foundation/NSRunLoop.h>
#include <Foundation/NSThread.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSException.h>
#include <AppKit/NSEvent.h>
#include <AppKit/NSApplication.h>
@implementation NSEvent
// Class variables
static NSMutableDictionary* timers = nil;
static NSRecursiveLock* timersLock = nil;
//
// Private methods
//
@ -142,6 +155,8 @@
// Initial version
[self setVersion:1];
timers = [NSMutableDictionary new];
timersLock = [NSRecursiveLock new];
}
}
@ -287,10 +302,95 @@
//
+ (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySeconds
withPeriod:(NSTimeInterval)periodSeconds
{}
{
NSTimer* timer;
NSThread* currentThread = [NSThread currentThread];
[timersLock lock];
NSDebugLog (@"startPeriodicEventsAfterDelay:withPeriod:");
/* Check for any pending timer for this thread */
if ([timers objectForKey:currentThread])
[NSException raise:NSInternalInconsistencyException
format:@"Periodic events are already being generated for "
@"this thread %x", currentThread];
/* If the delay time is 0 then register a timer right now. Otherwise register
a timer with no repeat that when fired registers the real timer */
if (!delaySeconds)
timer = [NSTimer timerWithTimeInterval:periodSeconds
target:self
selector:@selector(_timerFired:)
userInfo:nil
repeats:YES];
else
timer = [NSTimer timerWithTimeInterval:delaySeconds
target:self
selector:@selector(_registerRealTimer:)
userInfo:[NSNumber numberWithDouble:periodSeconds]
repeats:NO];
[[NSRunLoop currentRunLoop]
addTimer:timer forMode:NSEventTrackingRunLoopMode];
[timers setObject:timer forKey:currentThread];
[timersLock unlock];
}
+ (void)_timerFired:(NSTimer*)timer
{
NSEvent* periodicEvent
= [self otherEventWithType:NSPeriodic
location:NSZeroPoint
modifierFlags:0
timestamp:[[NSDate date] timeIntervalSinceReferenceDate]
windowNumber:0
context:[NSApp context]
subtype:0
data1:0
data2:0];
NSDebugLog (@"_timerFired:");
[NSApp postEvent:periodicEvent atStart:NO];
}
+ (void)_registerRealTimer:(NSTimer*)timer
{
NSTimeInterval periodSeconds = [[timer userInfo] doubleValue];
NSTimer* realTimer = [NSTimer timerWithTimeInterval:periodSeconds
target:self
selector:@selector(_timerFired:)
userInfo:nil
repeats:YES];
NSThread* currentThread = [NSThread currentThread];
NSDebugLog (@"_registerRealTimer:");
[timersLock lock];
/* Add the real timer into the timers dictionary and to the run loop */
[timers setObject:realTimer forKey:currentThread];
[[NSRunLoop currentRunLoop]
addTimer:realTimer forMode:NSEventTrackingRunLoopMode];
[timersLock unlock];
}
+ (void)stopPeriodicEvents
{}
{
NSTimer* timer;
NSThread* currentThread;
NSDebugLog (@"stopPeriodicEvents");
[timersLock lock];
currentThread = [NSThread currentThread];
/* Remove any existing timer for this thread */
timer = [timers objectForKey:currentThread];
[timer invalidate];
[timers removeObjectForKey:currentThread];
[timersLock unlock];
}
//
// Instance methods

View file

@ -5,7 +5,7 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: February 1997
A completely rewritten version of the original source by Scott Christley.

View file

@ -1,12 +1,12 @@
/*
/*
NSForm.m
Form class, a text field with a label
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Date: 1996
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: March 1997
This file is part of the GNUstep GUI Library.
@ -27,103 +27,145 @@
*/
#include <AppKit/NSForm.h>
#include <AppKit/NSFormCell.h>
@implementation NSForm
//
// Laying Out the Form
//
- (NSFormCell *)addEntry:(NSString *)title
- (NSFormCell*)addEntry:(NSString*)title
{
return nil;
return [self insertEntry:title atIndex:[self numberOfRows]];
}
- (NSFormCell *)insertEntry:(NSString *)title
- (NSFormCell*)insertEntry:(NSString*)title
atIndex:(int)index
{
return nil;
[self insertRow:index];
return [self cellAtRow:index column:0];
}
- (void)removeEntryAtIndex:(int)index
{}
{
[self removeRow:index];
}
- (void)setBezeled:(BOOL)flag
{
int i, count = [self numberOfRows];
/* Set the bezeled attribute to the cell prototype */
[[self prototype] setBezeled:flag];
for (i = 0; i < count; i++)
[[self cellAtRow:i column:0] setBezeled:flag];
}
- (void)setBordered:(BOOL)flag
{
int i, count = [self numberOfRows];
/* Set the bordered attribute to the cell prototype */
[[self prototype] setBordered:flag];
for (i = 0; i < count; i++)
[[self cellAtRow:i column:0] setBordered:flag];
}
- (void)setEntryWidth:(float)width
{
NSSize size = [self cellSize];
size.width = width;
[self setCellSize:size];
}
- (void)setInterlineSpacing:(float)spacing
{}
{
[self setIntercellSpacing:NSMakeSize(0, spacing)];
}
/* For the title attributes we use the corresponding attributes from the cell.
For the text attributes we use instead the attributes inherited from the
NSCell class. */
- (void)setTitleAlignment:(NSTextAlignment)aMode
{
int i, count = [self numberOfRows];
/* Set the title alignment attribute to the cell prototype */
[[self prototype] setTitleAlignment:aMode];
for (i = 0; i < count; i++)
[[self cellAtRow:i column:0] setTitleAlignment:aMode];
}
- (void)setTextAlignment:(int)aMode
{
int i, count = [self numberOfRows];
/* Set the text alignment attribute to the cell prototype */
[[self prototype] setAlignment:aMode];
for (i = 0; i < count; i++)
[[self cellAtRow:i column:0] setAlignment:aMode];
}
- (void)setTitleFont:(NSFont*)fontObject
{
int i, count = [self numberOfRows];
/* Set the title font attribute to the cell prototype */
[[self prototype] setTitleFont:fontObject];
for (i = 0; i < count; i++)
[[self cellAtRow:i column:0] setTitleFont:fontObject];
}
- (void)setTextFont:(NSFont*)fontObject
{
int i, count = [self numberOfRows];
/* Set the text font attribute to the cell prototype */
[[self prototype] setFont:fontObject];
for (i = 0; i < count; i++)
[[self cellAtRow:i column:0] setFont:fontObject];
}
//
// Finding Indices
//
- (int)indexOfCellWithTag:(int)aTag
{
return 0;
int i, count = [self numberOfRows];
for (i = 0; i < count; i++)
if ([[self cellAtRow:i column:0] tag] == aTag)
return i;
return -1;
}
- (int)indexOfSelectedItem
{
return 0;
return [self selectedRow];
}
//
// Modifying Graphic Attributes
//
- (void)setBezeled:(BOOL)flag
{}
- (void)setBordered:(BOOL)flag
{}
- (void)setTextAlignment:(int)mode
{}
- (void)setTextFont:(NSFont *)fontObject
{}
- (void)setTitleAlignment:(NSTextAlignment)mode
{}
- (void)setTitleFont:(NSFont *)fontObject
{}
//
// Setting the Cell Class
//
+ (Class)cellClass
{
return nil;
}
+ (void)setCellClass:(Class)classId
{}
//
// Getting a Cell
//
- (id)cellAtIndex:(int)index
{
return nil;
return [self cellAtRow:index column:0];
}
//
// Displaying a Cell
//
- (void)drawCellAtIndex:(int)index
{}
{
id theCell = [self cellAtIndex:index];
[theCell drawWithFrame:[self cellFrameAtRow:index column:0]
inView:self];
}
- (void)drawCellAtRow:(int)row column:(int)column
{
[self drawCellAtIndex:row];
}
//
// Editing Text
//
- (void)selectTextAtIndex:(int)index
{}
//
// Resizing the Form
//
- (void)setEntryWidth:(float)width
{}
//
// NSCoding protocol
//
- (void)encodeWithCoder:aCoder
{
[super encodeWithCoder:aCoder];

View file

@ -5,8 +5,8 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Date: 1996
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: March 1997
This file is part of the GNUstep GUI Library.
@ -27,83 +27,101 @@
*/
#include <AppKit/NSFormCell.h>
#include <AppKit/NSFont.h>
#include <AppKit/NSTextFieldCell.h>
@implementation NSFormCell
//
// Initializing an NSFormCell
//
- (id)initTextCell:(NSString *)aString
/* The title attributes are those inherited from the NSActionCell class. */
- init
{
return nil;
self = [super init];
[self setBordered:NO];
[self setBezeled:NO];
titleWidth = -1;
textCell = [NSTextFieldCell new];
[textCell setBordered:YES];
[textCell setBezeled:YES];
return self;
}
//
// Determining an NSFormCell's Size
//
- (NSSize)cellSizeForBounds:(NSRect)aRect
- (void)dealloc
{
return NSZeroSize;
[textCell release];
[super dealloc];
}
//
// Determining Graphic Attributes
//
- (BOOL)isOpaque
{
return NO;
return [super isOpaque] && [textCell isOpaque];
}
//
// Modifying the Title
//
- (void)setTitle:(NSString *)aString
{}
- (void)setTitle:(NSString*)aString
{
[self setStringValue:aString];
}
- (void)setTitleAlignment:(NSTextAlignment)mode
{}
{
[self setAlignment:mode];
}
- (void)setTitleFont:(NSFont *)fontObject
{}
- (void)setTitleFont:(NSFont*)fontObject
{
[self setFont:fontObject];
}
- (void)setTitleWidth:(float)width
{}
- (NSString *)title
{
return nil;
titleWidth = width;
}
- (NSString*)title
{
return [self stringValue];
}
- (NSTextAlignment)titleAlignment
{
return 0;
return [self alignment];
}
- (NSFont *)titleFont
- (NSFont*)titleFont
{
return nil;
return [self font];
}
- (float)titleWidth
{
return 0;
if (titleWidth < 0)
return [[self font] widthOfString:[self title]];
else
return titleWidth;
}
- (float)titleWidth:(NSSize)aSize
- (float)titleWidth:(NSSize)size
{
// TODO
return 0;
}
//
// Displaying
//
- (void)drawInteriorWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView
{}
inView:(NSView*)controlView
{
NSRect titleRect = cellFrame;
NSRect textRect;
titleRect.size.width = [self titleWidth] + 4;
[super drawInteriorWithFrame:titleRect inView:controlView];
textRect.origin.x = cellFrame.origin.x + titleRect.size.width;
textRect.origin.y = cellFrame.origin.y;
textRect.size.width = cellFrame.size.width - titleRect.size.width;
textRect.size.height = cellFrame.size.height;
[textCell drawInteriorWithFrame:textRect inView:controlView];
}
//
// NSCoding protocol
//
- (void)encodeWithCoder:aCoder
{
[super encodeWithCoder:aCoder];

File diff suppressed because it is too large Load diff

View file

@ -288,7 +288,7 @@ id gnustep_gui_nsscroller_class = nil;
{
last_point = point;
e = [theApp nextEventMatchingMask:event_mask untilDate:nil
inMode:nil dequeue:YES];
inMode:NSEventTrackingRunLoopMode dequeue:YES];
point = [self convertPoint: [e locationInWindow] fromView: nil];
if (is_horizontal)
@ -383,7 +383,7 @@ id gnustep_gui_nsscroller_class = nil;
{
last_point = point;
e = [theApp nextEventMatchingMask:event_mask untilDate:nil
inMode:nil dequeue:YES];
inMode:NSEventTrackingRunLoopMode dequeue:YES];
point = [self convertPoint: [e locationInWindow] fromView: nil];

View file

@ -936,7 +936,7 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
{
NSApplication *theApp = [NSApplication sharedApplication];
return [theApp nextEventMatchingMask: mask untilDate: nil
inMode: @"" dequeue: YES];
inMode:NSEventTrackingRunLoopMode dequeue: YES];
}
- (NSEvent *)nextEventMatchingMask:(unsigned int)mask

138
aclocal.m4 vendored
View file

@ -2,7 +2,8 @@
#
# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
#
# Written by: Adam Fedor <fedor@boulder.colorado.edu>
# Author: Adam Fedor <fedor@boulder.colorado.edu>
# Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
#
# This file is part of the GNU Objective-C library.
#
@ -145,3 +146,138 @@ AC_SUBST(DYNAMIC_BUNDLER_LINKER)dnl
AC_SUBST(DYNAMIC_LDFLAGS)dnl
AC_SUBST(DYNAMIC_CFLAGS)dnl
])
AC_DEFUN(AC_LANG_OBJECTIVE_C,
[AC_REQUIRE([AC_PROG_CC])dnl
define([AC_LANG], [AC_LANG_OBJECTIVE_C])dnl
ac_ext=m
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $OBJC_RUNTIME_FLAG'
ac_compile='${CC-cc} -c $OBJC_RUNTIME_FLAG $CFLAGS conftest.$ac_ext 1>&AC_FD_CC 2>&AC_FD_CC'
ac_link='${CC-cc} -o conftest $OBJC_RUNTIME_FLAG $CFLAGS $LDFLAGS conftest.$ac_ext $LIBS $OBJC_LIBS 1>&AC_FD_CC 2>&AC_FD_CC'
])dnl
AC_DEFUN(AC_FIND_FOUNDATION,
[dnl
AC_SUBST(FOUNDATION_LIBRARY)dnl
dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_C_CROSS])dnl
AC_MSG_CHECKING(for the Foundation library)
AC_CACHE_VAL(ac_cv_foundation_library,
[AC_LANG_SAVE[]dnl
AC_LANG_OBJECTIVE_C[]
AC_TRY_COMPILE(
#include <Foundation/preface.h>
,
, ac_cv_foundation_library="$ac_cv_foundation_library gnustep-base")
AC_TRY_COMPILE(
#include <Foundation/exceptions/FoundationException.h>
,
, ac_cv_foundation_library="$ac_cv_foundation_library libFoundation")
AC_TRY_COMPILE(
#include <objects/stdobjects.h>
,
, ac_cv_foundation_library="$ac_cv_foundation_library libobjects")
AC_LANG_RESTORE[]dnl
if test "$FOUNDATION" = ""; then
AC_TRY_CPP(
#include <foundation/NSObject.h>
, ac_cv_foundation_library=foundation)
else
ac_cv_foundation_library=$FOUNDATION
fi
])dnl
libs_found=`echo ${ac_cv_foundation_library} | awk '{print NF}' -`
if test $libs_found -gt 1; then
echo "" 1>&2
AC_MSG_ERROR([More than one Foundation library installed on your system. In the FOUNDATION variable you must specify exactly one of the following libraries: ${ac_cv_foundation_library}])
fi
FOUNDATION_LIBRARY=`echo ${ac_cv_foundation_library} | awk '{print $1}'`
case "$FOUNDATION_LIBRARY" in
foundation)
OBJC_RUNTIME=next
# save the prefix
old_prefix=$prefix
prefix=$ac_default_prefix
CFLAGS="-I`eval \"echo $includedir\"`/next $CFLAGS"
# restore the value of prefix
prefix=$old_prefix
LIBS="$LIBS -lFoundation_s";
AC_DEFINE(NeXT_foundation_LIBRARY);;
libobjects)
LIBS="$LIBS -lobjects"
AC_DEFINE(GNUSTEP_BASE_LIBRARY);;
gnustep-base)
LIBS="$LIBS -lgnustep-base"
AC_DEFINE(GNUSTEP_BASE_LIBRARY);;
libFoundation)
if test "$FOUNDATION_LIB" = ""; then
FOUNDATION_LIB=Foundation
fi
LIBS="-l${FOUNDATION_LIB} $LIBS"
AC_DEFINE(LIB_FOUNDATION_LIBRARY);;
*)
AC_MSG_ERROR(Unknown $FOUNDATION_LIBRARY library!);;
esac
AC_MSG_RESULT(${ac_cv_foundation_library})
AC_DETERMINE_FOUNDATION_RUNTIME
])dnl
AC_DEFUN(AC_DETERMINE_FOUNDATION_RUNTIME,
[dnl
AC_SUBST(OBJC_RUNTIME)dnl
AC_SUBST(OBJC_RUNTIME_FLAG)dnl
dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_C_CROSS])dnl
AC_MSG_CHECKING(for the Objective-C runtime)
AC_CACHE_VAL(ac_cv_objc_runtime,
[if test "$OBJC_RUNTIME" = ""; then
AC_LANG_SAVE[]dnl
AC_LANG_OBJECTIVE_C[]
AC_TRY_LINK([#include <Foundation/NSString.h>],
[extern id objc_lookUpClass(char*);
id class = objc_lookUpClass("NSObject");
id obj = [class alloc];
puts([[obj description] cString]);
], ac_cv_objc_runtime=NeXT, ac_cv_objc_runtime=unknown)
if test $ac_cv_objc_runtime = unknown; then
OBJC_RUNTIME_FLAG=-fgnu-runtime
LIBS="$LIBS -lobjc"
AC_TRY_LINK([#include <Foundation/NSString.h>
#include <objc/objc-api.h>],
[id class = objc_lookup_class("NSObject");
id obj = [class alloc];
puts([[obj description] cString]);
], ac_cv_objc_runtime=GNU, ac_cv_objc_runtime=unknown)
fi
AC_LANG_RESTORE[]
fi
])dnl
OBJC_RUNTIME=$ac_cv_objc_runtime
if test "`echo ${OBJC_RUNTIME} | tr a-z A-Z`" = "GNU"; then
OBJC_RUNTIME=GNU
OBJC_RUNTIME_FLAG=-fgnu-runtime
ac_cv_objc_runtime=GNU
LIBS="$LIBS -lobjc"
AC_DEFINE(GNU_RUNTIME)
elif test "`echo ${OBJC_RUNTIME} | tr a-z A-Z`" = "NEXT"; then
OBJC_RUNTIME=NeXT
OBJC_RUNTIME_FLAG=-fnext-runtime
ac_cv_objc_runtime=NeXT
AC_DEFINE(NeXT_RUNTIME)
else
OBJC_RUNTIME=unknown
fi
if test ${OBJC_RUNTIME} = unknown; then
echo
rm -f conftest* confdefs* core core.* *.core
AC_MSG_ERROR([Cannot determine the Objective-C runtime! Probably you have
to specify some additional libraries needed to link an ObjC program, so please
take a look in the config.log file to see the reason and try again.])
fi
AC_MSG_RESULT(${ac_cv_objc_runtime})
])dnl

370
configure vendored
View file

@ -1098,6 +1098,373 @@ fi
config_include=''
# Checking for some additional libraries we might need
echo $ac_n "checking for -ldl""... $ac_c" 1>&6
ac_lib_var=`echo dl'_'dlopen | tr './+\055' '__p_'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1111 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char dlopen();
int main() { return 0; }
int t() {
dlopen()
; return 0; }
EOF
if { (eval echo configure:1123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo dl | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
LIBS="-ldl $LIBS"
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for -lpthread""... $ac_c" 1>&6
ac_lib_var=`echo pthread'_'pthread_create | tr './+\055' '__p_'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1155 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char pthread_create();
int main() { return 0; }
int t() {
pthread_create()
; return 0; }
EOF
if { (eval echo configure:1167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo pthread | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
LIBS="-lpthread $LIBS"
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for -lm""... $ac_c" 1>&6
ac_lib_var=`echo m'_'sqrt | tr './+\055' '__p_'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1199 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char sqrt();
int main() { return 0; }
int t() {
sqrt()
; return 0; }
EOF
if { (eval echo configure:1211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo m | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
LIBS="-lm $LIBS"
else
echo "$ac_t""no" 1>&6
fi
# Determine the Foundation library
echo $ac_n "checking for the Foundation library""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_foundation_library'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_ext=m
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $OBJC_RUNTIME_FLAG'
ac_compile='${CC-cc} -c $OBJC_RUNTIME_FLAG $CFLAGS conftest.$ac_ext 1>&5 2>&5'
ac_link='${CC-cc} -o conftest $OBJC_RUNTIME_FLAG $CFLAGS $LDFLAGS conftest.$ac_ext $LIBS $OBJC_LIBS 1>&5 2>&5'
cat > conftest.$ac_ext <<EOF
#line 1248 "configure"
#include "confdefs.h"
#include <Foundation/preface.h>
int main() { return 0; }
int t() {
; return 0; }
EOF
if { (eval echo configure:1257: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_foundation_library="$ac_cv_foundation_library gnustep-base"
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
#line 1264 "configure"
#include "confdefs.h"
#include <Foundation/exceptions/FoundationException.h>
int main() { return 0; }
int t() {
; return 0; }
EOF
if { (eval echo configure:1273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_foundation_library="$ac_cv_foundation_library libFoundation"
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
#line 1280 "configure"
#include "confdefs.h"
#include <objects/stdobjects.h>
int main() { return 0; }
int t() {
; return 0; }
EOF
if { (eval echo configure:1289: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_foundation_library="$ac_cv_foundation_library libobjects"
fi
rm -f conftest*
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
if test "$FOUNDATION" = ""; then
cat > conftest.$ac_ext <<EOF
#line 1302 "configure"
#include "confdefs.h"
#include <foundation/NSObject.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
ac_cv_foundation_library=foundation
else
echo "$ac_err" >&5
fi
rm -f conftest*
else
ac_cv_foundation_library=$FOUNDATION
fi
fi
libs_found=`echo ${ac_cv_foundation_library} | awk '{print NF}' -`
if test $libs_found -gt 1; then
echo "" 1>&2
{ echo "configure: error: More than one Foundation library installed on your system. In the FOUNDATION variable you must specify exactly one of the following libraries: ${ac_cv_foundation_library}" 1>&2; exit 1; }
fi
FOUNDATION_LIBRARY=`echo ${ac_cv_foundation_library} | awk '{print }'`
case "$FOUNDATION_LIBRARY" in
foundation)
OBJC_RUNTIME=next
# save the prefix
old_prefix=$prefix
prefix=$ac_default_prefix
CFLAGS="-I`eval \"echo $includedir\"`/next $CFLAGS"
# restore the value of prefix
prefix=$old_prefix
LIBS="$LIBS -lFoundation_s";
cat >> confdefs.h <<\EOF
#define NeXT_foundation_LIBRARY 1
EOF
;;
libobjects)
LIBS="$LIBS -lobjects"
cat >> confdefs.h <<\EOF
#define GNUSTEP_BASE_LIBRARY 1
EOF
;;
gnustep-base)
LIBS="$LIBS -lgnustep-base"
cat >> confdefs.h <<\EOF
#define GNUSTEP_BASE_LIBRARY 1
EOF
;;
libFoundation)
if test "$FOUNDATION_LIB" = ""; then
FOUNDATION_LIB=Foundation
fi
LIBS="-l${FOUNDATION_LIB} $LIBS"
cat >> confdefs.h <<\EOF
#define LIB_FOUNDATION_LIBRARY 1
EOF
;;
*)
{ echo "configure: error: Unknown $FOUNDATION_LIBRARY library!" 1>&2; exit 1; };;
esac
echo "$ac_t""${ac_cv_foundation_library}" 1>&6
echo $ac_n "checking for the Objective-C runtime""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_objc_runtime'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$OBJC_RUNTIME" = ""; then
ac_ext=m
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $OBJC_RUNTIME_FLAG'
ac_compile='${CC-cc} -c $OBJC_RUNTIME_FLAG $CFLAGS conftest.$ac_ext 1>&5 2>&5'
ac_link='${CC-cc} -o conftest $OBJC_RUNTIME_FLAG $CFLAGS $LDFLAGS conftest.$ac_ext $LIBS $OBJC_LIBS 1>&5 2>&5'
cat > conftest.$ac_ext <<EOF
#line 1381 "configure"
#include "confdefs.h"
#include <Foundation/NSString.h>
int main() { return 0; }
int t() {
extern id objc_lookUpClass(char*);
id class = objc_lookUpClass("NSObject");
id obj = [class alloc];
puts([[obj description] cString]);
; return 0; }
EOF
if { (eval echo configure:1393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
ac_cv_objc_runtime=NeXT
else
rm -rf conftest*
ac_cv_objc_runtime=unknown
fi
rm -f conftest*
if test $ac_cv_objc_runtime = unknown; then
OBJC_RUNTIME_FLAG=-fgnu-runtime
LIBS="$LIBS -lobjc"
cat > conftest.$ac_ext <<EOF
#line 1406 "configure"
#include "confdefs.h"
#include <Foundation/NSString.h>
#include <objc/objc-api.h>
int main() { return 0; }
int t() {
id class = objc_lookup_class("NSObject");
id obj = [class alloc];
puts([[obj description] cString]);
; return 0; }
EOF
if { (eval echo configure:1418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
ac_cv_objc_runtime=GNU
else
rm -rf conftest*
ac_cv_objc_runtime=unknown
fi
rm -f conftest*
fi
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
fi
fi
OBJC_RUNTIME=$ac_cv_objc_runtime
if test "`echo ${OBJC_RUNTIME} | tr a-z A-Z`" = "GNU"; then
OBJC_RUNTIME=GNU
OBJC_RUNTIME_FLAG=-fgnu-runtime
ac_cv_objc_runtime=GNU
LIBS="$LIBS -lobjc"
cat >> confdefs.h <<\EOF
#define GNU_RUNTIME 1
EOF
elif test "`echo ${OBJC_RUNTIME} | tr a-z A-Z`" = "NEXT"; then
OBJC_RUNTIME=NeXT
OBJC_RUNTIME_FLAG=-fnext-runtime
ac_cv_objc_runtime=NeXT
cat >> confdefs.h <<\EOF
#define NeXT_RUNTIME 1
EOF
else
OBJC_RUNTIME=unknown
fi
if test ${OBJC_RUNTIME} = unknown; then
echo
rm -f conftest* confdefs* core core.* *.core
{ echo "configure: error: Cannot determine the Objective-C runtime! Probably you have
to specify some additional libraries needed to link an ObjC program, so please
take a look in the config.log file to see the reason and try again." 1>&2; exit 1; }
fi
echo "$ac_t""${ac_cv_objc_runtime}" 1>&6
#--------------------------------------------------------------------
# Write the Makefiles and configuration files
#--------------------------------------------------------------------
@ -1225,6 +1592,9 @@ s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@RANLIB@%$RANLIB%g
s%@LN_S@%$LN_S%g
s%@config_include@%$config_include%g
s%@FOUNDATION_LIBRARY@%$FOUNDATION_LIBRARY%g
s%@OBJC_RUNTIME@%$OBJC_RUNTIME%g
s%@OBJC_RUNTIME_FLAG@%$OBJC_RUNTIME_FLAG%g
CEOF
EOF

View file

@ -91,6 +91,14 @@ fi
config_include=''
AC_SUBST(config_include)
# Checking for some additional libraries we might need
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(m, sqrt)
# Determine the Foundation library
AC_FIND_FOUNDATION
#--------------------------------------------------------------------
# Write the Makefiles and configuration files
#--------------------------------------------------------------------