Various fixes, Frith-MacDonald, others.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2805 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 1998-05-29 15:25:41 +00:00
parent 1996a609cc
commit 88cbc598e5
26 changed files with 536 additions and 154 deletions

View file

@ -37,7 +37,6 @@ OrderedCollection.m
Port.m Port.m
Proxy.m Proxy.m
Queue.m Queue.m
Random.m
RawCStream.m RawCStream.m
RBTree.m RBTree.m
RBTreeNode.m RBTreeNode.m
@ -198,6 +197,7 @@ NSPipe.m
NSPort.m NSPort.m
NSProxy.m NSProxy.m
NSTask.m NSTask.m
NSUndoManager.m
Stevo Crvenkovski: Stevo Crvenkovski:

View file

@ -1,8 +1,45 @@
Fri May 29 10:16:09 1998 Adam Fedor <fedor@ultra.doc.com>
* doc/news.tmpl.texi: Fixed typo.
* doc/readme.tmpl.texi: Likewise. (patch from doko@cs.tu-berlin.de
(Matthias Klose)).
* src/ostream.m (ostream_save_buffer): Retain stream.
* src/include/MemoryStream.h: Remove outdated methods.
* src/include/NSException.h (NS_VALUERETURN): New macro.
Thu May 28 10:45:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Tools/gdomap.c: Added code to cope with systems where we can't
determine what network interfaces are active.
* checks/heap.m: Portability fix for svr4 systems.
* configure.in: Improved portability to svr4 systems.
* src/NSMethodSignature.m: Changed order of includes to fix
compilation on svr4 systems.
* src/NSPage.m: Altered to use 'sysconf(_SC_PAGESIZE)' to get page
size on svr4 systems.
* src/NSTask.m: Altered to use 'kill()' rather than 'killpg()' on
svr4
* src/NSThread.m: Altered to use 'sleep()' rather than 'usleep()'
on svr4
* src/include/config.h.in: Added a couple of configuration
constants for portability - HAVE_KILLPG and HAVE_USLEEP
Thu May 21 09:38:14 1998 Adam Fedor <fedor@doc.com> Thu May 21 09:38:14 1998 Adam Fedor <fedor@doc.com>
* src/NSUser.m (NSUserName): Use getpwuid for BSD machines (patch * src/NSUser.m (NSUserName): Use getpwuid for BSD machines (patch
provided by Stefanos Kiakas <stefanos@ringworld.uniscape.com>). provided by Stefanos Kiakas <stefanos@ringworld.uniscape.com>).
* src/GetDefEncoding.c (GetDefEncoding): Change binary AND to
logical AND. (GetEncoding): Likewise (patch provided by
David Fritzsche <david@dementia.wupper.de>).
Wed May 20 15:26:50 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk> Wed May 20 15:26:50 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* src/GNUmakefile: Added NSUndoManager.[hm] * src/GNUmakefile: Added NSUndoManager.[hm]

View file

@ -52,10 +52,10 @@ into another language, under the above conditions for modified versions.
@finalout @finalout
@titlepage @titlepage
@title The GNUstep BASE Library @title The GNUstep BASE Library
@subtitle DRAFT Edition for GNUstep BASE Library @value{GNUSTEP-BASE-VERSION} @c @subtitle DRAFT Edition for GNUstep BASE Library @value{GNUSTEP-BASE-VERSION}
@subtitle Last revision Jan 1998 @c @subtitle Last revision Jan 1998
@c @subtitle For GCC Version @value{GNUSTEP-BASE-GCC} @c @subtitle For GCC Version @value{GNUSTEP-BASE-GCC}
@author Andrew McCallum @c @author Andrew McCallum
@page @page
@vskip 0pt plus 1filll @vskip 0pt plus 1filll

View file

@ -14,7 +14,7 @@ The currently released version of the library is
@item Additional runtime functions for interaction with Guile and @item Additional runtime functions for interaction with Guile and
ObjC-Guile library. ObjC-Guile library.
#end itemize @end itemize
@section Noteworthy changes in version @samp{0.5.0} @section Noteworthy changes in version @samp{0.5.0}

View file

@ -100,6 +100,8 @@ separately.
This version of the distributed objects only works with sockets. A Mach This version of the distributed objects only works with sockets. A Mach
port back-end should be on the way. port back-end should be on the way.
@end itemize
@section Test Programs @section Test Programs
Some of the programs I've used to test the library are in Some of the programs I've used to test the library are in

View file

@ -4,16 +4,22 @@
@chapter Todo @chapter Todo
This TODO list is out of date.
@section Projects Looking for Volunteers @section Projects Looking for Volunteers
If you think you can do one of these projects, please let me know. Your If you think you can do one of these projects, please let me know. Your
help is greatly appreciated. Send email to help is greatly appreciated. Send email to
@samp{mccallum@@gnu.org}. @samp{fedor@@gnu.org}.
@itemize @bullet @itemize @bullet
@item Fix NSLog so it conforms to specs. Need to check that write to
stderr went ok, and if not write to syslog. Also need to serealize
output (with threads).
@item Simplify NSException and NSAssertionHandler and make sure they
don't cause race conditions (if an exception is raised while processing
an exception.
@item Fix all the places marked FIXME or xxx. @item Fix all the places marked FIXME or xxx.
@item Need to improve the testsuite and actually run it on gstep-base. @item Need to improve the testsuite and actually run it on gstep-base.
@ -86,13 +92,6 @@ RunLoop properly.
@item Make the NSTimer's work and interoperate with the RunLoop @item Make the NSTimer's work and interoperate with the RunLoop
properly. properly.
@item Fix many memory allocation inconsistencies. Methods that return
malloc'ed buffers should autorelease those buffers, (like readFormat:).
(I think all these are fixed now.)
@item Many code fixes and cleanups, indicated with @samp{xxx} in the
source.
@item Add Coding methods to all the collection classes. @item Add Coding methods to all the collection classes.
@item Finish Collection heirarchy clean ups. We need non-mutable @item Finish Collection heirarchy clean ups. We need non-mutable
@ -101,12 +100,6 @@ version for many of the classes.
@item Possibly change implementation of @code{-(int)compare:anObject} @item Possibly change implementation of @code{-(int)compare:anObject}
for Collection. How should non-Indexed collections be ordered? for Collection. How should non-Indexed collections be ordered?
@item
Fix all the subclassResponsibility comments in objects/*.h
@item
I will finish gnustep-base documentation.
@end itemize @end itemize
@c ================================================================== @c ==================================================================
@ -134,11 +127,6 @@ must be initialized to some consistent state. -allocCopy would never
even get called. <<ObjC insiders: This is a less well-expressed even get called. <<ObjC insiders: This is a less well-expressed
version of what we've just been discussing in email.>> version of what we've just been discussing in email.>>
@item
If you don't like the organization of the documentation and you have
suggestions for changes, please say so now, not after it's all been
written.
@item @item
Does anyone really need the ability to set the collection element Does anyone really need the ability to set the collection element
comparison function independent of the -compare: method? comparison function independent of the -compare: method?
@ -153,17 +141,6 @@ Something like this needed?
- elementDidChange: (elt*)elementPtr; - elementDidChange: (elt*)elementPtr;
Currently you have to remove, change, add, for some classes. Currently you have to remove, change, add, for some classes.
@c -------------------------------------------------------------------
@c @section Questions leftover from last release
@item
I've been told that GNU filenames should be 14 chars or less. I
don't want to abbreviate my classnames, but I think using .h
@@interface files with names different than the class name is even
worse. ** I want to keep my unabbreviated filenames!! ** What to do,
what to do... I can't believe that *all* GNU classnames will be
limited to 12 characters forever and ever---disgusting.
@end itemize @end itemize

View file

@ -30,19 +30,20 @@
#include <Foundation/NSArchiver.h> #include <Foundation/NSArchiver.h>
#include <Foundation/NSArray.h> #include <Foundation/NSArray.h>
#include <Foundation/NSAutoreleasePool.h> #include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSException.h>
#include <Foundation/NSBundle.h> #include <Foundation/NSBundle.h>
#include <Foundation/NSCharacterSet.h>
#include <Foundation/NSCoder.h>
#include <Foundation/NSDate.h> #include <Foundation/NSDate.h>
#include <Foundation/NSData.h> #include <Foundation/NSData.h>
#include <Foundation/NSDictionary.h> #include <Foundation/NSDictionary.h>
#include <Foundation/NSCharacterSet.h> #include <Foundation/NSException.h>
#include <Foundation/NSCoder.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSFileManager.h> #include <Foundation/NSFileManager.h>
#include <Foundation/NSValue.h> #include <Foundation/NSLock.h>
#include <Foundation/NSNotification.h> #include <Foundation/NSNotification.h>
#include <Foundation/NSPortCoder.h> #include <Foundation/NSPortCoder.h>
#include <Foundation/NSProcessInfo.h> #include <Foundation/NSProcessInfo.h>
#include <Foundation/NSSet.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSUserDefaults.h> #include <Foundation/NSUserDefaults.h>
#endif /* __Foundation_h_GNUSTEP_BASE_INCLUDE */ #endif /* __Foundation_h_GNUSTEP_BASE_INCLUDE */

View file

@ -65,7 +65,9 @@
prefix: (unsigned)prefix; prefix: (unsigned)prefix;
- initWithData: (id)anObject; - initWithData: (id)anObject;
#if 0
- initWithSize: (unsigned)s; /* For backwards compatibility, depricated */ - initWithSize: (unsigned)s; /* For backwards compatibility, depricated */
#endif
- (id) data; - (id) data;
- (id) mutableData; - (id) mutableData;

View file

@ -117,6 +117,7 @@ extern void _NSRemoveHandler( NSHandler *handler );
#define NS_VALRETURN(val) do { typeof(val) temp = (val); \ #define NS_VALRETURN(val) do { typeof(val) temp = (val); \
_NSRemoveHandler(&NSLocalHandler); \ _NSRemoveHandler(&NSLocalHandler); \
return(temp); } while (0) return(temp); } while (0)
#define NS_VALUERETURN NS_VALRETURN
#define NS_VOIDRETURN do { _NSRemoveHandler(&NSLocalHandler); \ #define NS_VOIDRETURN do { _NSRemoveHandler(&NSLocalHandler); \
return; } while (0) return; } while (0)

View file

@ -30,6 +30,9 @@
/* Define if you have the inet_aton function. */ /* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON #undef HAVE_INET_ATON
/* Define if you have the killpg function. */
#undef HAVE_KILLPG
/* Define if you have the mmap function. */ /* Define if you have the mmap function. */
#undef HAVE_MMAP #undef HAVE_MMAP
@ -48,6 +51,9 @@
/* Define if you have the times function. */ /* Define if you have the times function. */
#undef HAVE_TIMES #undef HAVE_TIMES
/* Define if you have the usleep function. */
#undef HAVE_USLEEP
/* Define if you have the valloc function. */ /* Define if you have the valloc function. */
#undef HAVE_VALLOC #undef HAVE_VALLOC

6
NEWS
View file

@ -3,6 +3,12 @@ News
The currently released version of the library is `0.5.0'. The currently released version of the library is `0.5.0'.
Noteworthy changes in version `0.5.1'
=====================================
* Additional runtime functions for interaction with Guile and
ObjC-Guile library.
Noteworthy changes in version `0.5.0' Noteworthy changes in version `0.5.0'
===================================== =====================================

28
README
View file

@ -107,7 +107,7 @@ protocols by their name: they all end with "ing".
Test Programs Test Programs
============= =============
Some of the programs I've used to test the library are in Some of the programs I've used to test the library are in
`./checks'. Many of them are pretty messy, (desperately trying to `./checks'. Many of them are pretty messy, (desperately trying to
tickle that late night bug), but at least they show some code that works tickle that late night bug), but at least they show some code that works
when the library compiles correctly. I'm looking for a volunteer to when the library compiles correctly. I'm looking for a volunteer to
@ -116,20 +116,20 @@ write some nicely organized test cases using `dejagnu'. Any takers?
How can you help? How can you help?
================= =================
* Read the projects and questions in the `TODO' file. If you * Read the projects and questions in the `TODO' file. If you can
can volunteer for any of the projects, or if you have any volunteer for any of the projects, or if you have any useful
useful comments send me email! comments send me email!
* Give me feedback! Tell me what you like; tell me what you * Give me feedback! Tell me what you like; tell me what you think
think could be better. Send me bug reports. could be better. Send me bug reports.
* Donate classes. If you write classes that fit in the * Donate classes. If you write classes that fit in the
libgnustep-base framework, I'd be happy to include them. libgnustep-base framework, I'd be happy to include them.
Happy hacking! Happy hacking!
Andrew McCallum Andrew McCallum
mccallum@gnu.org mccallum@gnu.org
Adam Fedor Adam Fedor
fedor@gnu.org fedor@gnu.org

10
STATUS
View file

@ -36,6 +36,7 @@ Classes
*NSArray:: [9]* *NSArray:: [9]*
*NSAssertionHandler:: [9]* *NSAssertionHandler:: [9]*
*NSAttributedString:: [8]*
*NSAutoreleasePool:: [9]* *NSAutoreleasePool:: [9]*
But not exception- safe But not exception- safe
@ -71,12 +72,18 @@ Classes
*NSDeserializer:: [7]* *NSDeserializer:: [7]*
*NSDictionary:: [8]* *NSDictionary:: [8]*
*NSDistantObject:: [7]* *NSDistantObject:: [7]*
*NSDistributedLock:: [7]*
*NSEnumerator:: [9]* *NSEnumerator:: [9]*
*NSException:: [9]* *NSException:: [9]*
But this needs integration with new, better But this needs integration with new, better
*NSFileHandle:: [9]*
*NSFileManager:: [9]*
*NSHashTable:: [8]*
*NSHost:: [8]*
*NSInvocation:: [3]* *NSInvocation:: [3]*
*NSLock:: [8]* *NSLock:: [8]*
*NSMapTable:: [8]*
*NSMethodSignature:: [4]* *NSMethodSignature:: [4]*
*NSMutableArray:: [8]* *NSMutableArray:: [8]*
*NSMutableCharacterSet:: [7]* *NSMutableCharacterSet:: [7]*
@ -104,6 +111,7 @@ Classes
Careful, relationship with GNU String is tricky; this could also Careful, relationship with GNU String is tricky; this could also
use fixing. use fixing.
*NSTask:: [8]*
*NSThread:: [8]* *NSThread:: [8]*
*NSTimeZone:: [8]* *NSTimeZone:: [8]*
*NSTimeZoneDetail:: [8]* *NSTimeZoneDetail:: [8]*

View file

@ -65,7 +65,7 @@ NSStringEncoding GetDefEncoding()
if (encoding) if (encoding)
{ {
count = 0; count = 0;
while ((count < str_encoding_table_size) & while ((count < str_encoding_table_size) &&
strcmp(str_encoding_table[count].ename,encoding)) strcmp(str_encoding_table[count].ename,encoding))
{ {
count++; count++;
@ -125,7 +125,7 @@ GetEncodingName(NSStringEncoding encoding)
{ {
char* ret; char* ret;
unsigned int count=0; unsigned int count=0;
while ((count < str_encoding_table_size) & while ((count < str_encoding_table_size) &&
!(str_encoding_table[count].enc == encoding)) !(str_encoding_table[count].enc == encoding))
{ {
count++; count++;

View file

@ -125,6 +125,7 @@ static BOOL debug_memory_stream = NO;
} }
/* xxx This method will disappear. */ /* xxx This method will disappear. */
#if 0
- initWithSize: (unsigned)s - initWithSize: (unsigned)s
prefix: (unsigned)p prefix: (unsigned)p
position: (unsigned)i position: (unsigned)i
@ -136,18 +137,27 @@ static BOOL debug_memory_stream = NO;
prefix: p prefix: p
position: i]; position: i];
} }
#endif
- initWithCapacity: (unsigned)capacity - initWithCapacity: (unsigned)capacity
prefix: (unsigned)p prefix: (unsigned)p
{ {
return [self initWithSize: capacity return [self _initOnMallocBuffer: 0
freeWhenDone: YES
size: capacity
eofPosition: 0
prefix: p prefix: p
position: 0]; position: i];
} }
- initWithCapacity: (unsigned)capacity - initWithCapacity: (unsigned)capacity
{ {
return [self initWithSize:capacity prefix:0 position:0]; return [self _initOnMallocBuffer: 0
freeWhenDone: YES
size: capacity
eofPosition: 0
prefix: 0
position: i];
} }
- initWithData: (id)anObject - initWithData: (id)anObject
@ -173,10 +183,12 @@ static BOOL debug_memory_stream = NO;
return self; return self;
} }
#if 0
- initWithSize: (unsigned)s - initWithSize: (unsigned)s
{ {
return [self initWithCapacity:s]; return [self initWithCapacity:s];
} }
#endif
- init - init
{ {

View file

@ -21,6 +21,9 @@
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h>
#include <gnustep/base/preface.h>
/* Deal with memchr: */ /* Deal with memchr: */
#if STDC_HEADERS || HAVE_STRING_H #if STDC_HEADERS || HAVE_STRING_H
#include <string.h> #include <string.h>
@ -37,8 +40,6 @@
/* memory.h and strings.h conflict on some systems. */ /* memory.h and strings.h conflict on some systems. */
#endif /* not STDC_HEADERS and not HAVE_STRING_H */ #endif /* not STDC_HEADERS and not HAVE_STRING_H */
#include <config.h>
#include <gnustep/base/preface.h>
#include <Foundation/NSMethodSignature.h> #include <Foundation/NSMethodSignature.h>
#include <Foundation/NSException.h> #include <Foundation/NSException.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>

View file

@ -45,6 +45,10 @@
#define getpagesize() sysconf(_SC_PAGESIZE) #define getpagesize() sysconf(_SC_PAGESIZE)
#endif #endif
#ifdef __svr4__
#define getpagesize() sysconf(_SC_PAGESIZE)
#endif
#if __mach__ #if __mach__
#define getpagesize vm_page_size #define getpagesize vm_page_size
#endif #endif

View file

@ -325,8 +325,13 @@ int main(int argc, char *argv[], char *env[])
+ (NSProcessInfo *)processInfo + (NSProcessInfo *)processInfo
{ {
// Check if the main() function was successfully called // Check if the main() function was successfully called
NSAssert(_gnu_processName && _gnu_arguments && _gnu_environment, // We can't use NSAssert, which calls NSLog, which calls NSProcessInfo...
_GNU_MISSING_MAIN_FUNCTION_CALL); if (!(_gnu_processName && _gnu_arguments && _gnu_environment))
{
_NSLog_printf_handler(_GNU_MISSING_MAIN_FUNCTION_CALL);
[NSException raise: NSInternalInconsistencyException
format: _GNU_MISSING_MAIN_FUNCTION_CALL];
}
if (!_gnu_sharedProcessInfoObject) if (!_gnu_sharedProcessInfoObject)
_gnu_sharedProcessInfoObject = [[_NSConcreteProcessInfo alloc] init]; _gnu_sharedProcessInfoObject = [[_NSConcreteProcessInfo alloc] init];

View file

@ -335,7 +335,11 @@ NSString *NSTaskDidTerminateNotification = @"NSTaskDidTerminateNotification";
} }
hasTerminated = YES; hasTerminated = YES;
#ifdef HAVE_KILLPG
killpg(taskId, SIGTERM); killpg(taskId, SIGTERM);
#else
kill(-taskId, SIGTERM);
#endif
if (hasNotified == NO) { if (hasNotified == NO) {
[self _sendNotification]; [self _sendNotification];

View file

@ -45,6 +45,20 @@ static o_map_t thread_id_2_nsthread;
/* Flag indicating whether the objc runtime ever went multi-threaded. */ /* Flag indicating whether the objc runtime ever went multi-threaded. */
static BOOL entered_multi_threaded_state; static BOOL entered_multi_threaded_state;
void gnustep_base_thread_callback()
{
/* Post a notification if this is the first new thread to be created.
Won't work properly if threads are not all created by this class.
*/
if (!entered_multi_threaded_state)
{
entered_multi_threaded_state = YES;
[NotificationDispatcher
postNotificationName: NSBecomingMultiThreaded
object: nil];
}
}
@implementation NSThread @implementation NSThread
@ -59,6 +73,7 @@ static BOOL entered_multi_threaded_state;
autorelease]; autorelease];
#endif #endif
entered_multi_threaded_state = NO; entered_multi_threaded_state = NO;
objc_set_thread_callback(gnustep_base_thread_callback());
} }
} }
@ -123,20 +138,12 @@ static BOOL entered_multi_threaded_state;
toTarget:(id)aTarget toTarget:(id)aTarget
withObject:(id)anArgument withObject:(id)anArgument
{ {
/* Post a notification if this is the first new thread to be created.
Won't work properly if threads are not all created by this class.
xxx Should the notification be done before the new thread starts,
or after? */
if (!entered_multi_threaded_state)
{
entered_multi_threaded_state = YES;
[NotificationDispatcher
postNotificationName: NSBecomingMultiThreaded
object: nil];
}
// Have the runtime detach the thread // Have the runtime detach the thread
objc_thread_detach (aSelector, aTarget, anArgument); if (objc_thread_detach (aSelector, aTarget, anArgument) == NULL)
{
/* This should probably be an exception */
NSLog(@"Unable to detach thread (unknown error)");
}
/* NOTE we can't create the new NSThread object for this thread here /* NOTE we can't create the new NSThread object for this thread here
because there would be a race condition. The newly created because there would be a race condition. The newly created
@ -177,14 +184,22 @@ static BOOL entered_multi_threaded_state;
while (delay > 30.0*60.0) while (delay > 30.0*60.0)
{ {
// sleep 30 minutes // sleep 30 minutes
#ifdef HAVE_USLEEP
usleep (30*60*1000000); usleep (30*60*1000000);
#else
sleep (30*60);
#endif
delay = [date timeIntervalSinceNow]; delay = [date timeIntervalSinceNow];
} }
// usleep may return early because of signals // usleep may return early because of signals
while (delay > 0) while (delay > 0)
{ {
usleep (delay*1000000.0); #ifdef HAVE_USLEEP
usleep (delay*1000000);
#else
sleep (delay);
#endif
delay = [date timeIntervalSinceNow]; delay = [date timeIntervalSinceNow];
} }
} }

View file

@ -346,8 +346,9 @@ ostream_close_memory (ostream *s, int option)
{ {
if (s->flags & OSTREAM_ISBUFFER) if (s->flags & OSTREAM_ISBUFFER)
{ {
/* Dumb way to save buffer, but what else? */
if (option == OSTREAM_SAVEBUFFER) if (option == OSTREAM_SAVEBUFFER)
[(MemoryStream*)s->stream_obj setFreeWhenDone: NO]; [(MemoryStream*)s->stream_obj retain];
} }
ostream_close(s); ostream_close(s);
} }

37
TODO
View file

@ -1,13 +1,21 @@
Todo Todo
**** ****
This TODO list is out of date.
Projects Looking for Volunteers Projects Looking for Volunteers
=============================== ===============================
If you think you can do one of these projects, please let me know. If you think you can do one of these projects, please let me know. Your
Your help is greatly appreciated. Send email to `mccallum@gnu.org'. help is greatly appreciated. Send email to `fedor@gnu.org'.
* Fix NSLog so it conforms to specs. Need to check that write to
stderr went ok, and if not write to syslog. Also need to serealize
output (with threads).
* Simplify NSException and NSAssertionHandler and make sure they
don't cause race conditions (if an exception is raised while
processing an exception.
* Fix all the places marked FIXME or xxx.
* Need to improve the testsuite and actually run it on gstep-base. * Need to improve the testsuite and actually run it on gstep-base.
@ -62,12 +70,6 @@ McCallum's To Do's
* Make the NSTimer's work and interoperate with the RunLoop properly. * Make the NSTimer's work and interoperate with the RunLoop properly.
* Fix many memory allocation inconsistencies. Methods that return
malloc'ed buffers should autorelease those buffers, (like
readFormat:). (I think all these are fixed now.)
* Many code fixes and cleanups, indicated with `xxx' in the source.
* Add Coding methods to all the collection classes. * Add Coding methods to all the collection classes.
* Finish Collection heirarchy clean ups. We need non-mutable * Finish Collection heirarchy clean ups. We need non-mutable
@ -76,10 +78,6 @@ McCallum's To Do's
* Possibly change implementation of `-(int)compare:anObject' for * Possibly change implementation of `-(int)compare:anObject' for
Collection. How should non-Indexed collections be ordered? Collection. How should non-Indexed collections be ordered?
* Fix all the subclassResponsibility comments in objects/*.h
* I will finish gnustep-base documentation.
Questions Questions
========= =========
@ -102,10 +100,6 @@ Please email your thoughts to mccallum@gnu.ai.mit.edu.
a less well-expressed version of what we've just been discussing a less well-expressed version of what we've just been discussing
in email.>> in email.>>
* If you don't like the organization of the documentation and you
have suggestions for changes, please say so now, not after it's
all been written.
* Does anyone really need the ability to set the collection element * Does anyone really need the ability to set the collection element
comparison function independent of the -compare: method? comparison function independent of the -compare: method?
@ -116,13 +110,6 @@ Please email your thoughts to mccallum@gnu.ai.mit.edu.
* Something like this needed? - elementDidChange: (elt*)elementPtr; * Something like this needed? - elementDidChange: (elt*)elementPtr;
Currently you have to remove, change, add, for some classes. Currently you have to remove, change, add, for some classes.
* I've been told that GNU filenames should be 14 chars or less. I
don't want to abbreviate my classnames, but I think using .h
@interface files with names different than the class name is even
worse. ** I want to keep my unabbreviated filenames!! ** What to
do, what to do... I can't believe that *all* GNU classnames will be
limited to 12 characters forever and ever--disgusting.
Albin's To Do List Albin's To Do List

View file

@ -6,7 +6,7 @@
#define N 20 #define N 20
#if (sun && __svr4__) || defined(__hpux) || defined(_SEQUENT_) #if defined(__svr4__) || defined(__hpux) || defined(_SEQUENT_)
long lrand48(); long lrand48();
#define random lrand48 #define random lrand48
#else #else

View file

@ -59,6 +59,9 @@
#endif #endif
#endif #endif
#if defined(__svr4__)
#include <sys/stropts.h>
#endif
#endif /* !__WIN32__ */ #endif /* !__WIN32__ */
#include "gdomap.h" #include "gdomap.h"
@ -123,6 +126,7 @@ static void handle_request(int);
static void handle_send(); static void handle_send();
static void handle_write(int); static void handle_write(int);
static void init_iface(); static void init_iface();
static void load_iface(const char* from);
static void init_ports(); static void init_ports();
static void init_probe(); static void init_probe();
static void queue_msg(struct sockaddr_in* a, unsigned char* d, int l); static void queue_msg(struct sockaddr_in* a, unsigned char* d, int l);
@ -602,71 +606,65 @@ dump_stats()
/* /*
* Name - init_iface() * Name - init_iface()
* Purpose - Establish our well-known port (my_port) and build up * Purpose - Build up an array of the IP addresses supported on
* an array of the IP addresses supported on the network * the network interfaces of this machine.
* interfaces of this machine.
* The first non-loopback interface is presumed to be
* our primary interface and it's address is stored in
* the global variable 'my_addr'.
*/ */
static void static void
init_iface() init_iface()
{ {
struct servent *sp; #ifdef SIOCGIFCONF
struct ifconf ifc; struct ifconf ifc;
struct ifreq ifreq; struct ifreq ifreq;
struct ifreq *ifr; struct ifreq *ifr;
struct ifreq *final; struct ifreq *final;
char buf[MAX_IFACE * sizeof(struct ifreq)]; char buf[MAX_IFACE * sizeof(struct ifreq)];
int set_my_addr = 0;
int desc; int desc;
int num_iface; int num_iface;
/*
* First we determine the port for the 'gdomap' service - ideally
* this should be the default port, since we should have registered
* this with the appropriate authority and have it reserved for us.
*/
#ifdef GDOMAP_PORT_OVERRIDE
my_port = htons(GDOMAP_PORT_OVERRIDE);
#else
my_port = htons(GDOMAP_PORT);
if ((sp = getservbyname("gdomap", "tcp")) == 0) {
fprintf(stderr, "Warning - unable to find service 'gdomap'\n");
}
else {
unsigned short tcp_port = sp->s_port;
if ((sp = getservbyname("gdomap", "udp")) == 0) {
fprintf(stderr, "Warning - unable to find service 'gdomap'\n");
}
else if (sp->s_port != tcp_port) {
fprintf(stderr, "Warning - UDP and TCP service entries differ\n");
fprintf(stderr, "Warning - I will use the TCP entry for both!\n");
}
if (tcp_port != my_port) {
fprintf(stderr, "Warning - gdomap not running on normal port\n");
}
my_port = tcp_port;
}
#endif
if ((desc = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { if ((desc = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("socketf for init_iface"); perror("socket for init_iface");
exit(1); exit(1);
} }
#if defined(__svr4__)
{
struct strioctl ioc;
ioc.ic_cmd = SIOCGIFCONF;
ioc.ic_timout = 0;
ioc.ic_len = sizeof(buf);
ioc.ic_dp = buf;
if (ioctl(desc, I_STR, (char*)&ioc) < 0) {
ioc.ic_len = 0;
}
ifc.ifc_len = ioc.ic_len;
ifc.ifc_buf = ioc.ic_dp;
}
#else
ifc.ifc_len = sizeof(buf); ifc.ifc_len = sizeof(buf);
ifc.ifc_buf = buf; ifc.ifc_buf = buf;
if (ioctl(desc, SIOCGIFCONF, (char*)&ifc) < 0) { if (ioctl(desc, SIOCGIFCONF, (char*)&ifc) < 0) {
perror("SIOCGIFCONF for init_iface"); ifc.ifc_len = 0;
close(desc);
exit(1);
} }
#endif
/* /*
* Find the IP address of each active network interface. * Find the IP address of each active network interface.
*/ */
num_iface = ifc.ifc_len / sizeof(struct ifreq); num_iface = ifc.ifc_len / sizeof(struct ifreq);
if (num_iface == 0) {
int res = errno;
perror("SIOCGIFCONF for init_iface found no active interfaces");
if (res == EINVAL) {
fprintf(stderr,
"Either you have too many network interfaces on your machine (in which case\n"
"you need to change the 'MAX_IFACE' constant in gdomap.c and rebuild it), or\n"
"your system is buggy, and you need to use the '-a' command line flag for\n"
"gdomap to manually set the interface addresses and masks to be used.\n");
}
close(desc);
exit(1);
}
addr = (struct in_addr*)malloc(num_iface*IASIZE); addr = (struct in_addr*)malloc(num_iface*IASIZE);
mask = (struct in_addr*)malloc(num_iface*IASIZE); mask = (struct in_addr*)malloc(num_iface*IASIZE);
@ -708,6 +706,172 @@ init_iface()
} }
} }
close(desc); close(desc);
#else
fprintf(stderr, "I can't find the SIOCGIFCONF ioctl on this platform -\r\nuse the '-a' flag to load interface details from a file instead.\r\n");
exit(1);
#endif
}
/*
* Name - load_iface()
* Purpose - Read addresses and netmasks for interfaces on this
* machine from a file.
*/
static void
load_iface(const char* from)
{
FILE *fptr = fopen(from, "r");
char buf[128];
int num_iface = 0;
if (fptr == 0) {
fprintf(stderr, "Unable to open address config - '%s'\n", from);
exit(1);
}
while (fgets(buf, sizeof(buf), fptr) != 0) {
char *ptr = buf;
/*
* Strip leading white space.
*/
while (isspace(*ptr)) {
ptr++;
}
if (ptr != buf) {
strcpy(buf, ptr);
}
/*
* Strip comments.
*/
ptr = strchr(buf, '#');
if (ptr) {
*ptr = '\0';
}
/*
* Strip trailing white space.
*/
ptr = buf;
while (*ptr) {
ptr++;
}
while (ptr > buf && isspace(ptr[-1])) {
ptr--;
}
*ptr = '\0';
/*
* Ignore blank lines.
*/
if (*buf == '\0') {
continue;
}
num_iface++;
}
fseek(fptr, 0, 0);
if (num_iface == 0) {
fprintf(stderr, "No address mask pairs found in file.\n");
exit(1);
}
addr = (struct in_addr*)malloc(num_iface*IASIZE);
mask = (struct in_addr*)malloc(num_iface*IASIZE);
while (fgets(buf, sizeof(buf), fptr) != 0) {
char *ptr = buf;
/*
* Strip leading white space.
*/
while (isspace(*ptr)) {
ptr++;
}
if (ptr != buf) {
strcpy(buf, ptr);
}
/*
* Strip comments.
*/
ptr = strchr(buf, '#');
if (ptr) {
*ptr = '\0';
}
/*
* Strip trailing white space.
*/
ptr = buf;
while (*ptr) {
ptr++;
}
while (ptr > buf && isspace(ptr[-1])) {
ptr--;
}
*ptr = '\0';
/*
* Ignore blank lines.
*/
if (*buf == '\0') {
continue;
}
ptr = buf;
while (*ptr && (isdigit(*ptr) || (*ptr == '.'))) {
ptr++;
}
while (isspace(*ptr)) {
*ptr++ = '\0';
}
addr[interfaces].s_addr = inet_addr(buf);
mask[interfaces].s_addr = inet_addr(ptr);
if (addr[interfaces].s_addr == -1) {
fprintf(stderr, "'%s' is not as valid address\n", buf);
}
else if (mask[interfaces].s_addr == -1) {
fprintf(stderr, "'%s' is not as valid netmask\n", ptr);
}
else {
interfaces++;
}
}
fclose(fptr);
}
/*
* Name - init_my_port()
* Purpose - Establish our well-known port (my_port).
*/
static void
init_my_port()
{
struct servent *sp;
/*
* First we determine the port for the 'gdomap' service - ideally
* this should be the default port, since we should have registered
* this with the appropriate authority and have it reserved for us.
*/
#ifdef GDOMAP_PORT_OVERRIDE
my_port = htons(GDOMAP_PORT_OVERRIDE);
#else
my_port = htons(GDOMAP_PORT);
if ((sp = getservbyname("gdomap", "tcp")) == 0) {
fprintf(stderr, "Warning - unable to find service 'gdomap'\n");
}
else {
unsigned short tcp_port = sp->s_port;
if ((sp = getservbyname("gdomap", "udp")) == 0) {
fprintf(stderr, "Warning - unable to find service 'gdomap'\n");
}
else if (sp->s_port != tcp_port) {
fprintf(stderr, "Warning - UDP and TCP service entries differ\n");
fprintf(stderr, "Warning - I will use the TCP entry for both!\n");
}
if (tcp_port != my_port) {
fprintf(stderr, "Warning - gdomap not running on normal port\n");
}
my_port = tcp_port;
}
#endif
} }
/* /*
@ -1767,7 +1931,7 @@ int
main(int argc, char** argv) main(int argc, char** argv)
{ {
extern char *optarg; extern char *optarg;
char *options = "CHc:dfi:p"; char *options = "CHa:c:dfi:p";
int c; int c;
/* /*
@ -1788,6 +1952,7 @@ main(int argc, char** argv)
printf("GNU Distributed Objects name server\n"); printf("GNU Distributed Objects name server\n");
printf("-C help about configuration\n"); printf("-C help about configuration\n");
printf("-H general help\n"); printf("-H general help\n");
printf("-a file use config file for interface list.\n");
printf("-c file use config file for probe.\n"); printf("-c file use config file for probe.\n");
printf("-d extra debug logging.\n"); printf("-d extra debug logging.\n");
printf("-f avoid fork() to make debugging easy\n"); printf("-f avoid fork() to make debugging easy\n");
@ -1823,9 +1988,26 @@ main(int argc, char** argv)
"Empty lines are permitted in the configuration file.\n" "Empty lines are permitted in the configuration file.\n"
"Anything on a line after a hash ('#') is ignored.\n" "Anything on a line after a hash ('#') is ignored.\n"
"You tell gdomap about the config file with the '-c' command line option.\n"); "You tell gdomap about the config file with the '-c' command line option.\n");
printf("\n");
printf("\n");
printf(
"gdomap uses the SIOCGIFCONF ioctl to build a list of IP addresses and\n"
"netmasks for the network interface cards on your machine. On some operating\n"
"systems, this facility is not available (or is broken), so you must tell\n"
"gdomap the addresses and masks of the interfaces using the '-a' command line\n"
"option. The file named with '-a' should contain a series of lines with\n"
"space separated pairs of addresses and masks in 'dot' notation.\n"
"You must NOT include loopback interfaces in this list.\n"
"If your operating system has some other method of giving you a list of\n"
"network interfaces and masks, please send me example code so that I can\n"
"implement it in gdomap.\n");
printf("\n"); printf("\n");
exit(0); exit(0);
case 'a':
load_iface(optarg);
break;
case 'c': case 'c':
{ {
FILE *fptr = fopen(optarg, "r"); FILE *fptr = fopen(optarg, "r");
@ -1979,7 +2161,10 @@ main(int argc, char** argv)
(void)open("/dev/null", O_WRONLY); /* Stdout. */ (void)open("/dev/null", O_WRONLY); /* Stdout. */
(void)open("/dev/tty", O_WRONLY); /* Stderr. */ (void)open("/dev/tty", O_WRONLY); /* Stderr. */
init_iface(); /* Build up list of network interfaces. */ init_my_port(); /* Determine port to listen on. */
if (interfaces == 0) {
init_iface(); /* Build up list of network interfaces. */
}
init_ports(); /* Create ports to handle requests. */ init_ports(); /* Create ports to handle requests. */
init_probe(); /* Probe other name servers on net. */ init_probe(); /* Probe other name servers on net. */

126
configure vendored
View file

@ -2940,9 +2940,9 @@ done
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# This function needed by NSDebug.m # This function needed by NSTask.m
#-------------------------------------------------------------------- #--------------------------------------------------------------------
for ac_func in strerror for ac_func in killpg
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2949: checking for $ac_func" >&5 echo "configure:2949: checking for $ac_func" >&5
@ -2999,9 +2999,9 @@ done
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# This function needed by NSString for handling of %@ printf directive. # This function needed by NSThread.m
#-------------------------------------------------------------------- #--------------------------------------------------------------------
for ac_func in register_printf_function for ac_func in usleep
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:3008: checking for $ac_func" >&5 echo "configure:3008: checking for $ac_func" >&5
@ -3057,6 +3057,124 @@ fi
done done
#--------------------------------------------------------------------
# This function needed by NSDebug.m
#--------------------------------------------------------------------
for ac_func in strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:3067: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3072 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.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 $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:3095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
#--------------------------------------------------------------------
# This function needed by NSString for handling of %@ printf directive.
#--------------------------------------------------------------------
for ac_func in register_printf_function
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:3126: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3131 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.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 $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:3154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Tools for making a DLL. # Tools for making a DLL.
#-------------------------------------------------------------------- #--------------------------------------------------------------------

View file

@ -281,6 +281,16 @@ AC_CHECK_FUNCS(mmap)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
AC_CHECK_FUNCS(inet_aton) AC_CHECK_FUNCS(inet_aton)
#--------------------------------------------------------------------
# This function needed by NSTask.m
#--------------------------------------------------------------------
AC_CHECK_FUNCS(killpg)
#--------------------------------------------------------------------
# This function needed by NSThread.m
#--------------------------------------------------------------------
AC_CHECK_FUNCS(usleep)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# This function needed by NSDebug.m # This function needed by NSDebug.m
#-------------------------------------------------------------------- #--------------------------------------------------------------------