mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
File deleted.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1406 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cbbf9d906a
commit
a6a5e9b024
110 changed files with 0 additions and 8488 deletions
|
@ -1,42 +0,0 @@
|
|||
/* Interface for GNU Objective-C Archiver object for use serializing
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: January 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Archiver_h_OBJECTS_INCLUDE
|
||||
#define __Archiver_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Coder.h>
|
||||
|
||||
/* Eventually some functionality may be moved out of Coder and
|
||||
into these objects.
|
||||
|
||||
These class should be used as concrete classes, not the Coder class. */
|
||||
|
||||
|
||||
@interface Archiver : Encoder
|
||||
@end
|
||||
|
||||
@interface Unarchiver : Decoder
|
||||
@end
|
||||
|
||||
#endif /* __Archiver_h_OBJECTS_INCLUDE */
|
|
@ -1,73 +0,0 @@
|
|||
/* Interface for Objective-C Array collection object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Array_h_INCLUDE_GNU
|
||||
#define __Array_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/IndexedCollection.h>
|
||||
#include <objects/OrderedCollecting.h>
|
||||
|
||||
@interface ConstantArray : ConstantIndexedCollection
|
||||
{
|
||||
@public
|
||||
id *_contents_array;
|
||||
unsigned int _count;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface Array : ConstantArray
|
||||
{
|
||||
@public
|
||||
unsigned int _capacity;
|
||||
int _grow_factor;
|
||||
}
|
||||
|
||||
+ (unsigned) defaultCapacity;
|
||||
+ (int) defaultGrowFactor;
|
||||
|
||||
- initWithCapacity: (unsigned) aCapacity;
|
||||
|
||||
- (void) setCapacity: (unsigned)newCapacity;
|
||||
- (int) growFactor;
|
||||
- (void) setGrowFactor: (int)aNum;
|
||||
|
||||
@end
|
||||
|
||||
/* Put this on category instead of class to avoid bogus complaint from gcc */
|
||||
@interface Array (Ordering) <OrderedCollecting>
|
||||
@end
|
||||
|
||||
#define FOR_ARRAY(ARRAY, ELEMENT_VAR) \
|
||||
{ \
|
||||
unsigned _FOR_ARRAY_i; \
|
||||
for (_FOR_ARRAY_i = 0; \
|
||||
_FOR_ARRAY_i < ((Array*)ARRAY)->_count; \
|
||||
_FOR_ARRAY_i++) \
|
||||
{ \
|
||||
ELEMENT_VAR = \
|
||||
(((Array*)ARRAY)->_contents_array[_FOR_ARRAY_i]);
|
||||
|
||||
#define END_FOR_ARRAY(ARRAY) }}
|
||||
|
||||
#endif /* __Array_h_INCLUDE_GNU */
|
|
@ -1,88 +0,0 @@
|
|||
/* Array definitions for the use of subclass implementations only
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __ArrayPrivate_h_INCLUDE_GNU
|
||||
#define __ArrayPrivate_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/IndexedCollectionPrivate.h>
|
||||
|
||||
#define DEFAULT_ARRAY_CAPACITY 2
|
||||
#define DEFAULT_ARRAY_GROW_FACTOR 2
|
||||
|
||||
|
||||
/* Routines that help with inserting and removing elements */
|
||||
|
||||
/* Assumes that _count has already been incremented to make room
|
||||
for the hole. The data at _contents_array[_count-1] is not part
|
||||
of the collection). */
|
||||
static inline void
|
||||
makeHoleAt(Array *self, unsigned index)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = (self->_count)-1; i > index; i--)
|
||||
self->_contents_array[i] = self->_contents_array[i-1];
|
||||
}
|
||||
|
||||
/* Assumes that _count has not yet been decremented. The data at
|
||||
_contents_array[_count-1] is part of the collection. */
|
||||
static inline void
|
||||
fillHoleAt(Array *self, unsigned index)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = index; i < (self->_count)-1; i++)
|
||||
self->_contents_array[i] = self->_contents_array[i+1];
|
||||
}
|
||||
|
||||
/* These are the only two routines that change the value of the instance
|
||||
variable _count, except for "-initWithType:capacity:" and "-empty" */
|
||||
|
||||
/* Should these be methods instead of functions? Doing so would make
|
||||
them slower. */
|
||||
|
||||
/* Do this before adding an element */
|
||||
static inline void
|
||||
incrementCount(Array *self)
|
||||
{
|
||||
(self->_count)++;
|
||||
if (self->_count == self->_capacity)
|
||||
{
|
||||
[self setCapacity:(self->_capacity) * ABS(self->_grow_factor)];
|
||||
}
|
||||
}
|
||||
|
||||
/* Do this after removing an element */
|
||||
static inline void
|
||||
decrementCount(Array *self)
|
||||
{
|
||||
(self->_count)--;
|
||||
if (self->_grow_factor > 0
|
||||
&& self->_count < (self->_capacity / self->_grow_factor))
|
||||
{
|
||||
[self setCapacity:(self->_capacity) / self->_grow_factor];
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __ArrayPrivate_h_INCLUDE_GNU */
|
|
@ -1,53 +0,0 @@
|
|||
/* Interface for relase pools for delayed disposal
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __AutoreleasePool_m_OBJECTS_INCLUDE
|
||||
#define __AutoreleasePool_m_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/ObjectRetaining.h>
|
||||
|
||||
@interface AutoreleasePool : Object
|
||||
{
|
||||
AutoreleasePool *parent;
|
||||
unsigned released_count;
|
||||
unsigned released_size;
|
||||
id *released;
|
||||
}
|
||||
|
||||
+ currentPool;
|
||||
+ (void) autoreleaseObject: anObj;
|
||||
- (void) autoreleaseObject: anObj;
|
||||
|
||||
- init;
|
||||
|
||||
@end
|
||||
|
||||
@interface Object (Retaining) <Retaining>
|
||||
@end
|
||||
|
||||
void objc_retain_object (id anObj);
|
||||
void objc_release_object (id anObj);
|
||||
unsigned objc_retain_count (id anObj);
|
||||
|
||||
#endif /* __AutoreleasePool_m_OBJECTS_INCLUDE */
|
|
@ -1,122 +0,0 @@
|
|||
/* Interface to release stack for delayed disposal
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __AutoreleaseStack_m_OBJECTS_INCLUDE
|
||||
#define __AutoreleaseStack_m_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/ObjectRetaining.h>
|
||||
|
||||
@interface AutoreleaseStack : Object
|
||||
{
|
||||
}
|
||||
|
||||
+ (void) autoreleaseObject: anObj;
|
||||
- (void) autoreleaseObject: anObj;
|
||||
|
||||
- init;
|
||||
|
||||
@end
|
||||
|
||||
void objc_release_stack_objects();
|
||||
|
||||
/*
|
||||
Use of this autorelease class gives -autorelease the following semantics:
|
||||
|
||||
- autorelease;
|
||||
|
||||
Use this message when the sender is done with this object, but the
|
||||
sender doesn't want the object to be deallocated immediately
|
||||
because the function that sends this message will use this object
|
||||
as its return value. The object will be queued to receive the
|
||||
actual "release" message only after the caller's caller returns.
|
||||
(Well, not "queued", "stacked" actually.)
|
||||
|
||||
Due to this delayed release, the function that receives the object
|
||||
as a return value will have the opportunity to retain the object
|
||||
before the "release" instigated by the "autorelease" actually
|
||||
takes place.
|
||||
|
||||
IMPORTANT PROGRAMMING CONVENTION: Since a autoreleased object may
|
||||
be freed in the caller's caller's frame, a function must be careful
|
||||
when returning an object that has been been autoreleased to it
|
||||
(i.e. returning the object to the autorelease caller's caller's
|
||||
caller). Since you cannot always know which objects returned to
|
||||
the current function have been autoreleased by their returners,
|
||||
you must use the following rule to insure safety for these
|
||||
situations:
|
||||
|
||||
When returning an object that has been allocated, copied or
|
||||
retained by the returner, return the object as usual. If
|
||||
returning an object that has been received in this function by
|
||||
another function, always retain and autorelease the object
|
||||
before returning it. (Unless, of course, the returner still
|
||||
needs to keep a reference to the object, in which case the final
|
||||
autorelease should be omitted.)
|
||||
|
||||
The autorelease mechanism works as follows: The implementation of
|
||||
the "autorelease" method pushes the receiver and the caller's
|
||||
caller's frame address onto an internally maintained stack. But,
|
||||
before pushing the reciever, the implementation checks the entries
|
||||
already on the stack, popping elements off the stack until the
|
||||
recorded frame address is less than the caller's caller's frame
|
||||
address. Each object popped off the stack is sent a "release"
|
||||
message. The stack capacity grows automatically if necessary.
|
||||
|
||||
This mechanism ensures that not too many autoreleased objects can
|
||||
be stacked before we check to see what objects can be released
|
||||
(i.e. no objects). It also ensures that objects which have been
|
||||
autoreleased are released as soon as we autorelease any other
|
||||
object in a lower stack frame.
|
||||
|
||||
The only way to build up an unnecessarily large collection of
|
||||
autoreleased objects is by calling functions that autorelease an
|
||||
object, and by repeatedly calling those functions from functions
|
||||
with equal or increasingly higher frame addresses.
|
||||
|
||||
Any time that you suspect that you may be creating an unnecessarily
|
||||
large number of autoreleased objects in a function, (e.g. the
|
||||
function contains a loop that creates many autoreleased objects
|
||||
that the function doesn't need), you can always release all the
|
||||
releasable autoreleased objects for this frame by calling
|
||||
objc_release_stack_objects(). Be warned that calling this function
|
||||
will release all objects that have been autoreleased to this
|
||||
function; if you still need to use some of them, you will have to
|
||||
retain them beforehand, and release or autorelease them
|
||||
afterwards.
|
||||
|
||||
If desired, you can also use objc_release_stack_objects() at the
|
||||
top of an event loop, a guaranteed "catch-all" coding practise
|
||||
similar to the creation and destruction of AutoreleasePool objects
|
||||
in the event loop.
|
||||
|
||||
As an alternative to calling objc_release_stack_objects() you can
|
||||
also use the same scheme for forcing autorelease's as used for
|
||||
AutoreleasePool's: s = [[AutoreleaseStack alloc] init], ... code
|
||||
that autoreleases a bunch of objects to the same stack level ...,
|
||||
[s release]. It has the same effect.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#endif /* __AutoreleaseStack_m_OBJECTS_INCLUDE */
|
|
@ -1,51 +0,0 @@
|
|||
/* Interface for Objective-C Bag collection object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Bag_h_INCLUDE_GNU
|
||||
#define __Bag_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Collection.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
|
||||
@interface Bag : Collection
|
||||
{
|
||||
NSMapTable *_contents_map;
|
||||
unsigned int _count; // the number of elements;
|
||||
}
|
||||
|
||||
// INITIALIZING AND FREEING;
|
||||
- initWithCapacity: (unsigned)aCapacity;
|
||||
|
||||
// ADDING;
|
||||
- (void) addObject: newObject withOccurrences: (unsigned)count;
|
||||
|
||||
// REMOVING AND REPLACING;
|
||||
- (void) removeObject: oldObject occurrences: (unsigned)count;
|
||||
|
||||
// TESTING;
|
||||
- (unsigned) uniqueCount;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Bag_h_INCLUDE_GNU */
|
|
@ -1,37 +0,0 @@
|
|||
/* Interface for GNU Objective-C binary stream object for use serializing
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Written: Jan 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BinaryCStream_h_OBJECTS_INCLUDE
|
||||
#define __BinaryCStream_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Stream.h>
|
||||
#include <objects/CStream.h>
|
||||
|
||||
@interface BinaryCStream : CStream
|
||||
|
||||
+ setDebugging: (BOOL)f;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __BinaryCStream_h_OBJECTS_INCLUDE */
|
|
@ -1,77 +0,0 @@
|
|||
/* Interface for Objective-C BinaryTree collection object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
Binary Tree.
|
||||
Base class for smarter binary trees.
|
||||
*/
|
||||
|
||||
#ifndef __BinaryTree_h_INCLUDE_GNU
|
||||
#define __BinaryTree_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/IndexedCollection.h>
|
||||
|
||||
/* The <BinaryTreeComprising> protocol defines the interface to an object
|
||||
that may be an element in a BinaryTree.
|
||||
*/
|
||||
@protocol BinaryTreeComprising <NSObject>
|
||||
- leftNode;
|
||||
- rightNode;
|
||||
- parentNode;
|
||||
- (void) setLeftNode: (id <BinaryTreeComprising>)aNode;
|
||||
- (void) setRightNode: (id <BinaryTreeComprising>)aNode;
|
||||
- (void) setParentNode: (id <BinaryTreeComprising>)aNode;
|
||||
- binaryTree;
|
||||
- (void) setBinaryTree: anObject;
|
||||
@end
|
||||
|
||||
#define NODE_IS_RIGHTCHILD(NODE) (NODE == [[NODE parentNode] rightNode])
|
||||
#define NODE_IS_LEFTCHILD(NODE) (NODE == [[NODE parentNode] leftNode])
|
||||
|
||||
@interface BinaryTree : IndexedCollection
|
||||
{
|
||||
unsigned int _count;
|
||||
id _contents_root;
|
||||
}
|
||||
|
||||
- nilNode;
|
||||
- rootNode;
|
||||
|
||||
- leftmostNodeFromNode: aNode;
|
||||
- rightmostNodeFromNode: aNode;
|
||||
|
||||
- (unsigned) depthOfNode: aNode;
|
||||
- (unsigned) heightOfNode: aNode;
|
||||
|
||||
- (unsigned) nodeCountUnderNode: aNode;
|
||||
|
||||
- leftRotateAroundNode: aNode;
|
||||
- rightRotateAroundNode: aNode;
|
||||
|
||||
- binaryTreePrintForDebugger;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#endif /* __BinaryTree_h_INCLUDE_GNU */
|
|
@ -1,36 +0,0 @@
|
|||
/* Interface for Objective-C BinaryTreeEltNode object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BinaryTreeEltNode_h_INCLUDE_GNU
|
||||
#define __BinaryTreeEltNode_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/BinaryTreeNode.h>
|
||||
#include <objects/EltNodeCollector.h>
|
||||
|
||||
@interface BinaryTreeEltNode : BinaryTreeNode
|
||||
#include <objects/EltNode-h>
|
||||
@end
|
||||
|
||||
|
||||
#endif /* __BinaryTreeEltNode_h_INCLUDE_GNU */
|
|
@ -1,41 +0,0 @@
|
|||
/* Interface for Objective-C BinaryTreeNode object
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __BinaryTreeNode_h_INCLUDE_GNU
|
||||
#define __BinaryTreeNode_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/BinaryTree.h>
|
||||
#include <objects/Coding.h>
|
||||
|
||||
@interface BinaryTreeNode : NSObject <BinaryTreeComprising>
|
||||
{
|
||||
id _left;
|
||||
id _right;
|
||||
id _parent;
|
||||
id _binary_tree;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
#endif /* __BinaryTreeNode_h_INCLUDE_GNU */
|
|
@ -1,59 +0,0 @@
|
|||
/* Interface for GNU Objective-C stream object for use in archiving
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Written: Jan 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __CStream_h_OBJECTS_INCLUDE
|
||||
#define __CStream_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Stream.h>
|
||||
#include <objects/CStreaming.h>
|
||||
|
||||
@interface CStream : Stream <CStreaming>
|
||||
{
|
||||
Stream *stream;
|
||||
int format_version;
|
||||
int indentation;
|
||||
}
|
||||
|
||||
/* These are the standard ways to create a new CStream from a Stream
|
||||
that is open for reading.
|
||||
It reads the CStream signature at the beginning of the file, and
|
||||
automatically creates the appropriate subclass of CStream with
|
||||
the correct format version. */
|
||||
+ cStreamReadingFromFile: (id <String>) filename;
|
||||
+ cStreamReadingFromStream: (id <Streaming>) stream;
|
||||
|
||||
/* These are standard ways to create a new CStream with a Stream
|
||||
that is open for writing. */
|
||||
- initForWritingToFile: (id <String>) filename;
|
||||
- initForWritingToStream: (id <Streaming>) stream;
|
||||
|
||||
- initForWritingToStream: (id <Streaming>) s
|
||||
withFormatVersion: (int)version;
|
||||
|
||||
+ cStreamWritingToStream: (id <Streaming>) stream;
|
||||
+ cStreamWritingToFile: (id <String>) filename;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __CStream_h_OBJECTS_INCLUDE */
|
|
@ -1,60 +0,0 @@
|
|||
/* Protocol for GNU Objective C byte streams that can code C types and indentn
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: April 1995
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __CStreaming_h__OBJECTS_INCLUDE
|
||||
#define __CStreaming_h__OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Streaming.h>
|
||||
|
||||
@protocol CStreaming <Streaming>
|
||||
|
||||
- (void) encodeValueOfCType: (const char*) type
|
||||
at: (const void*) d
|
||||
withName: (id <String>) name;
|
||||
- (void) decodeValueOfCType: (const char*) type
|
||||
at: (void*) d
|
||||
withName: (id <String> *) namePtr;
|
||||
|
||||
- (void) encodeWithName: (id <String>) name
|
||||
valuesOfCTypes: (const char *) types, ...;
|
||||
- (void) decodeWithName: (id <String> *)name
|
||||
valuesOfCTypes: (const char *)types, ...;
|
||||
|
||||
- (void) encodeName: (id <String>) name;
|
||||
- (void) decodeName: (id <String> *) name;
|
||||
|
||||
- (void) encodeIndent;
|
||||
- (void) decodeIndent;
|
||||
|
||||
- (void) encodeUnindent;
|
||||
- (void) decodeUnindent;
|
||||
|
||||
- (id <Streaming>) stream;
|
||||
|
||||
+ (int) defaultFormatVersion;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __CStreaming_h__OBJECTS_INCLUDE */
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/* Interface for Objective-C CircularArray collection object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __CircularArray_h_INCLUDE_GNU
|
||||
#define __CircularArray_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Array.h>
|
||||
|
||||
@interface CircularArray : Array
|
||||
{
|
||||
@public
|
||||
unsigned int _start_index;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __CircularArray_h_INCLUDE_GNU */
|
|
@ -1,75 +0,0 @@
|
|||
/* CircularArray definitions for the use of subclass implementations
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __CircularArrayPrivate_h_INCLUDE_GNU
|
||||
#define __CircularArrayPrivate_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/ArrayPrivate.h>
|
||||
|
||||
#define CIRCULAR_TO_BASIC(INDEX) \
|
||||
((INDEX + self->_start_index) % self->_capacity)
|
||||
|
||||
#define BASIC_TO_CIRCULAR(INDEX) \
|
||||
((INDEX + self->_capacity - self->_start_index) % self->_capacity)
|
||||
|
||||
#define NEXT_CIRCULAR_INDEX(INDEX) \
|
||||
((INDEX + 1) % self->_capacity)
|
||||
|
||||
#define PREV_CIRCULAR_INDEX(INDEX) \
|
||||
((INDEX + self->_capacity - 1) % self->_capacity)
|
||||
|
||||
static inline void
|
||||
circularMakeHoleAt(CircularArray *self, unsigned basicIndex)
|
||||
{
|
||||
int i;
|
||||
if (self->_start_index && basicIndex > self->_start_index)
|
||||
{
|
||||
for (i = self->_start_index; i < basicIndex; i++)
|
||||
self->_contents_array[i-1] = self->_contents_array[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = CIRCULAR_TO_BASIC(self->_count-1); i >= basicIndex; i--)
|
||||
self->_contents_array[i+1] = self->_contents_array[i];
|
||||
}
|
||||
/* This is never called with _count == 0 */
|
||||
}
|
||||
|
||||
static inline void
|
||||
circularFillHoleAt(CircularArray *self, unsigned basicIndex)
|
||||
{
|
||||
int i;
|
||||
if (basicIndex > self->_start_index)
|
||||
{
|
||||
for (i = basicIndex; i > self->_start_index; i--)
|
||||
self->_contents_array[i] = self->_contents_array[i-1];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = basicIndex; i < CIRCULAR_TO_BASIC(self->_count-1); i++)
|
||||
self->_contents_array[i] = self->_contents_array[i+1];
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __CircularArrayPrivate_h_INCLUDE_GNU */
|
|
@ -1,148 +0,0 @@
|
|||
/* Interface for GNU Objective-C coder object for use serializing
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Coder_h_OBJECTS_INCLUDE
|
||||
#define __Coder_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Coding.h>
|
||||
#include <objects/Streaming.h>
|
||||
#include <objects/String.h>
|
||||
#include <Foundation/NSHashTable.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
|
||||
@class CStream;
|
||||
|
||||
|
||||
/* The root abstract class for archiving */
|
||||
|
||||
@interface Coder : NSObject
|
||||
{
|
||||
int format_version;
|
||||
CStream *cstream;
|
||||
NSMapTable *classname_2_classname; /* for changing class names on r/w */
|
||||
int interconnect_stack_height; /* number of nested root objects */
|
||||
}
|
||||
|
||||
+ setDebugging: (BOOL)f;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/* An abstract class for writing an archive */
|
||||
|
||||
@interface Encoder : Coder
|
||||
{
|
||||
/* xxx in_progress_table should actually be an NSHashTable,
|
||||
but we are working around a bug right now. */
|
||||
NSMapTable *in_progress_table; /* objects begun writing, but !finished */
|
||||
NSMapTable *object_2_xref; /* objects already written */
|
||||
NSMapTable *object_2_fref; /* table of forward references */
|
||||
NSMapTable *const_ptr_2_xref; /* const pointers already written */
|
||||
unsigned fref_counter; /* Keep track of unused fref numbers */
|
||||
}
|
||||
|
||||
- initForWritingToFile: (id <String>) filename;
|
||||
- initForWritingToFile: (id <String>) filename
|
||||
withCStreamClass: (Class) cStreamClass;
|
||||
- initForWritingToFile: (id <String>) filename
|
||||
withFormatVersion: (int) version
|
||||
cStreamClass: (Class)scc
|
||||
cStreamFormatVersion: (int) cStreamFormatVersion;
|
||||
|
||||
- initForWritingToStream: (id <Streaming>) s;
|
||||
- initForWritingToStream: (id <Streaming>) s
|
||||
withCStreamClass: (Class) cStreamClass;
|
||||
- initForWritingToStream: (id <Streaming>) s
|
||||
withFormatVersion: (int) version
|
||||
cStreamClass: (Class) cStreamClass
|
||||
cStreamFormatVersion: (int) cStreamFormatVersion;
|
||||
|
||||
+ (BOOL) encodeRootObject: anObject
|
||||
withName: (id <String>) name
|
||||
toFile: (id <String>) filename;
|
||||
+ (BOOL) encodeRootObject: anObject
|
||||
withName: (id <String>) name
|
||||
toStream: (id <Streaming>)stream;
|
||||
|
||||
/* Defaults */
|
||||
+ (void) setDefaultStreamClass: sc;
|
||||
+ defaultStreamClass;
|
||||
+ (void) setDefaultCStreamClass: sc;
|
||||
+ defaultCStreamClass;
|
||||
+ (void) setDefaultFormatVersion: (int)fv;
|
||||
+ (int) defaultFormatVersion;
|
||||
|
||||
@end
|
||||
|
||||
@interface Encoder (Encoding) <Encoding>
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/* An abstract class for reading an archive. */
|
||||
|
||||
@interface Decoder : Coder
|
||||
{
|
||||
NSZone *zone; /* zone in which to create objects */
|
||||
id xref_2_object; /* objects already read */
|
||||
id xref_2_object_root; /* objs read since last -startDecodoingI.. */
|
||||
NSMapTable *xref_2_const_ptr; /* const pointers already written */
|
||||
NSMapTable *fref_2_object; /* table of forward references */
|
||||
NSMapTable *address_2_fref; /* table of forward references */
|
||||
}
|
||||
|
||||
/* These are class methods (and not instance methods) because the
|
||||
header of the file or stream determines which subclass of Decoder
|
||||
is created. */
|
||||
|
||||
+ newReadingFromFile: (id <String>) filename;
|
||||
+ newReadingFromStream: (id <Streaming>)stream;
|
||||
|
||||
+ decodeObjectWithName: (id <String> *) name
|
||||
fromFile: (id <String>) filename;
|
||||
+ decodeObjectWithName: (id <String> *) name
|
||||
fromStream: (id <Streaming>)stream;
|
||||
|
||||
@end
|
||||
|
||||
@interface Decoder (Decoding) <Decoding>
|
||||
@end
|
||||
|
||||
|
||||
/* Extensions to NSObject for encoding and decoding. */
|
||||
|
||||
@interface NSObject (OptionalNewWithCoder)
|
||||
+ newWithCoder: (Coder*)aDecoder;
|
||||
@end
|
||||
|
||||
@interface NSObject (CoderAdditions)
|
||||
/* <SelfCoding> not needed because of NSCoding */
|
||||
/* These methods here temporarily until ObjC runtime category bug fixed */
|
||||
- classForConnectedCoder:aRmc;
|
||||
+ (void) encodeObject: anObject withConnectedCoder: aRmc;
|
||||
@end
|
||||
|
||||
extern id CoderSignatureMalformedException;
|
||||
|
||||
#endif /* __Coder_h_OBJECTS_INCLUDE */
|
|
@ -1,67 +0,0 @@
|
|||
/* Private interface for GNU Objective-C coder object for use serializing
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: February 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __CoderPrivate_h_OBJECTS_INCLUDE
|
||||
#define __CoderPrivate_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Coder.h>
|
||||
#include <objects/CStreaming.h>
|
||||
|
||||
enum {
|
||||
CODER_OBJECT_NIL = 0,
|
||||
CODER_OBJECT,
|
||||
CODER_OBJECT_ROOT,
|
||||
CODER_OBJECT_REPEATED,
|
||||
CODER_OBJECT_FORWARD_REFERENCE,
|
||||
CODER_OBJECT_CLASS,
|
||||
CODER_CLASS_NIL,
|
||||
CODER_CLASS,
|
||||
CODER_CLASS_REPEATED,
|
||||
CODER_CONST_PTR_NULL,
|
||||
CODER_CONST_PTR,
|
||||
CODER_CONST_PTR_REPEATED
|
||||
};
|
||||
|
||||
#define DOING_ROOT_OBJECT (interconnect_stack_height != 0)
|
||||
|
||||
@interface Coder (Private)
|
||||
- _initWithCStream: (id <CStreaming>) cs formatVersion: (int) version;
|
||||
- (unsigned) _coderReferenceForObject: anObject;
|
||||
@end
|
||||
|
||||
#define SIGNATURE_FORMAT_STRING \
|
||||
@"GNU Objective C (%s %d.%d.%d) [%s %d]\n"
|
||||
|
||||
#define WRITE_SIGNATURE_FORMAT_ARGS \
|
||||
STRINGIFY(OBJECTS_PACKAGE_NAME), \
|
||||
OBJECTS_MAJOR_VERSION, \
|
||||
OBJECTS_MINOR_VERSION, \
|
||||
OBJECTS_SUBMINOR_VERSION, \
|
||||
[self defaultDecoderClassname], \
|
||||
format_version
|
||||
|
||||
|
||||
#define NO_SEL_TYPES "none"
|
||||
|
||||
#endif /* __CoderPrivate_h_OBJECTS_INCLUDE */
|
|
@ -1,163 +0,0 @@
|
|||
/* Protocol for GNU Objective-C objects that can write/read to a coder
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Coding_h_OBJECTS_INCLUDE
|
||||
#define __Coding_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
/* #include <objects/String.h>
|
||||
xxx Think about trying to get <String> back in types,
|
||||
but now there is a circular dependancy in the include files. */
|
||||
|
||||
@protocol CommonCoding
|
||||
- (BOOL) isDecoding;
|
||||
- (void) close;
|
||||
- (BOOL) isClosed;
|
||||
+ (int) defaultFormatVersion;
|
||||
- cStream;
|
||||
@end
|
||||
|
||||
@protocol Encoding <CommonCoding>
|
||||
|
||||
- (void) encodeValueOfObjCType: (const char*)type
|
||||
at: (const void*)d
|
||||
withName: (id /*<String>*/)name;
|
||||
|
||||
- (void) encodeValueOfCType: (const char*)type
|
||||
at: (const void*)d
|
||||
withName: (id /*<String>*/)name;
|
||||
|
||||
- (void) encodeWithName: (id /*<String>*/)name
|
||||
valuesOfObjCTypes: (const char *)types, ...;
|
||||
|
||||
- (void) encodeArrayOfObjCType: (const char *)type
|
||||
count: (unsigned)c
|
||||
at: (const void *)d
|
||||
withName: (id /*<String>*/)name;
|
||||
|
||||
- (void) encodeObject: anObj
|
||||
withName: (id /*<String>*/)name;
|
||||
- (void) encodeBycopyObject: anObj
|
||||
withName: (id /*<String>*/)name;
|
||||
|
||||
- (void) encodeRootObject: anObj
|
||||
withName: (id /*<String>*/)name;
|
||||
- (void) encodeObjectReference: anObj
|
||||
withName: (id /*<String>*/)name;
|
||||
- (void) startEncodingInterconnectedObjects;
|
||||
- (void) finishEncodingInterconnectedObjects;
|
||||
|
||||
- (void) encodeAtomicString: (const char*)sp
|
||||
withName: (id /*<String>*/)name;
|
||||
|
||||
- (void) encodeClass: aClass;
|
||||
|
||||
/* For inserting a name into a TextCoder stream */
|
||||
- (void) encodeName: (id /*<String>*/) n;
|
||||
|
||||
/* For classes that want to keep track of recursion */
|
||||
- (void) encodeIndent;
|
||||
- (void) encodeUnindent;
|
||||
|
||||
- (void) encodeBytes: (const void *)b
|
||||
count: (unsigned)c
|
||||
withName: (id /*<String>*/)name;
|
||||
|
||||
@end
|
||||
|
||||
@protocol Decoding <CommonCoding>
|
||||
|
||||
- (void) decodeValueOfObjCType: (const char*)type
|
||||
at: (void*)d
|
||||
withName: (id /*<String>*/ *) namePtr;
|
||||
|
||||
- (void) decodeValueOfCType: (const char*)type
|
||||
at: (void*)d
|
||||
withName: (id /*<String>*/ *) namePtr;
|
||||
|
||||
- (void) decodeWithName: (id /*<String>*/*)name
|
||||
valuesOfObjCTypes: (const char *) types, ...;
|
||||
|
||||
- (void) decodeArrayOfObjCType: (const char *)type
|
||||
count: (unsigned)c
|
||||
at: (void *)d
|
||||
withName: (id /*<String>*/*)name;
|
||||
|
||||
- (void) decodeObjectAt: (id*)anObjPtr
|
||||
withName: (id /*<String>*/*)name;
|
||||
|
||||
- (void) startDecodingInterconnectedObjects;
|
||||
- (void) finishDecodingInterconnectedObjects;
|
||||
|
||||
- (const char *) decodeAtomicStringWithName: (id /*<String>*/*) name;
|
||||
|
||||
- decodeClass;
|
||||
|
||||
/* For inserting a name into a TextCoder stream */
|
||||
- (void) decodeName: (id /*<String>*/ *)n;
|
||||
|
||||
/* For classes that want to keep track of recursion */
|
||||
- (void) decodeIndent;
|
||||
- (void) decodeUnindent;
|
||||
|
||||
- (void) decodeBytes: (void *)b
|
||||
count: (unsigned)c
|
||||
withName: (id /*<String>*/ *) name;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (SelfCoding)
|
||||
|
||||
- (void) encodeWithCoder: (id <Encoding>)anEncoder;
|
||||
- (id) initWithCoder: (id <Decoding>)aDecoder;
|
||||
+ (id) newWithCoder: (id <Decoding>)aDecoder;
|
||||
|
||||
/* NOTE:
|
||||
|
||||
If the class responds to +newWithCoder Coder will send it for
|
||||
decoding, otherwise Coder will allocate the object itself and send
|
||||
initWithCoder instead.
|
||||
|
||||
+newWithCoder is useful because many classes keep track of their
|
||||
instances and only allow one instance of each configuration. For
|
||||
example, see the designated initializers of SocketPort, Connection,
|
||||
and Proxy.
|
||||
|
||||
Using +new.. instead of -init.. prevents us from having to waste
|
||||
the effort of allocating space for an object to be decoded, then
|
||||
immediately deallocating that space because we're just returning a
|
||||
pre-existing object.
|
||||
|
||||
The newWithCoder and initWithCoder methods must return the decoded
|
||||
object.
|
||||
|
||||
This is not a Protocol, because objects are not required to
|
||||
implement newWithCoder or initWithCoder. They probably want to
|
||||
implement one of them, though.
|
||||
|
||||
-mccallum */
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Coding_h_OBJECTS_INCLUDE */
|
|
@ -1,131 +0,0 @@
|
|||
/* Protocol for Objective-C objects that hold collections of elements.
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* The <Collecting> protocol is root of the collection protocol heirarchy.
|
||||
|
||||
The <Collecting> protocol defines the most general interface to a
|
||||
collection of elements. Elements can be added, removed, and replaced.
|
||||
The contents can be tested, enumerated, and enumerated through various
|
||||
filters. Elements may be objects, or any C type included in the
|
||||
"elt" union given in elt.h, but all elements of a collection must be of
|
||||
the same C type.
|
||||
*/
|
||||
|
||||
#ifndef __Collecting_h_INCLUDE_GNU
|
||||
#define __Collecting_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Coding.h>
|
||||
#include <objects/Invoking.h>
|
||||
#include <objects/Enumerating.h>
|
||||
|
||||
@protocol ConstantCollecting <NSObject>
|
||||
|
||||
// INITIALIZING;
|
||||
- init;
|
||||
- initWithObjects: (id*)objc count: (unsigned)c;
|
||||
- initWithObjects: firstObject, ...;
|
||||
- initWithObjects: firstObject rest: (va_list)ap;
|
||||
- initWithContentsOf: (id <ConstantCollecting>)aCollection;
|
||||
|
||||
// QUERYING COUNTS;
|
||||
- (BOOL) isEmpty;
|
||||
- (unsigned) count;
|
||||
- (BOOL) containsObject: anObject;
|
||||
- (unsigned) occurrencesOfObject: anObject;
|
||||
|
||||
// COMPARISON WITH OTHER COLLECTIONS;
|
||||
- (BOOL) isSubsetOf: (id <ConstantCollecting>)aCollection;
|
||||
- (BOOL) isDisjointFrom: (id <ConstantCollecting>)aCollection;
|
||||
- (BOOL) isEqual: anObject;
|
||||
- (int) compare: anObject;
|
||||
- (BOOL) contentsEqual: (id <ConstantCollecting>)aCollection;
|
||||
|
||||
// PROPERTIES OF CONTENTS;
|
||||
- (BOOL) trueForAllObjectsByInvoking: (id <Invoking>)anInvocation;
|
||||
- (BOOL) trueForAnyObjectsByInvoking: (id <Invoking>)anInvocation;
|
||||
- detectObjectByInvoking: (id <Invoking>)anInvocation;
|
||||
- maxObject;
|
||||
- minObject;
|
||||
|
||||
// ENUMERATING
|
||||
- (id <Enumerating>) objectEnumerator;
|
||||
- (void) withObjectsInvoke: (id <Invoking>)anInvocation;
|
||||
- (void) withObjectsInvoke: (id <Invoking>)anInvocation whileTrue:(BOOL *)flag;
|
||||
- (void) makeObjectsPerform: (SEL)aSel;
|
||||
- (void) makeObjectsPerform: (SEL)aSel withObject: argObject;
|
||||
|
||||
// FILTERED ENUMERATING;
|
||||
- (void) withObjectsTrueByInvoking: (id <Invoking>)testInvocation
|
||||
invoke: (id <Invoking>)anInvocation;
|
||||
- (void) withObjectsFalseByInvoking: (id <Invoking>)testInvocation
|
||||
invoke: (id <Invoking>)anInvocation;
|
||||
- (void) withObjectsTransformedByInvoking: (id <Invoking>)transInvocation
|
||||
invoke: (id <Invoking>)anInvocation;
|
||||
|
||||
// LOW-LEVEL ENUMERATING;
|
||||
- (void*) newEnumState;
|
||||
- nextObjectWithEnumState: (void**)enumState;
|
||||
- (void) freeEnumState: (void**)enumState;
|
||||
|
||||
// COPYING;
|
||||
- allocCopy;
|
||||
- emptyCopy;
|
||||
- emptyCopyAs: (Class)aCollectionClass;
|
||||
- shallowCopy;
|
||||
- shallowCopyAs: (Class)aCollectionClass;
|
||||
- copy;
|
||||
- copyAs: (Class)aCollectionClass;
|
||||
- species;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@protocol Collecting <ConstantCollecting>
|
||||
|
||||
// ADDING;
|
||||
- (void) addObject: newObject;
|
||||
- (void) addObjectIfAbsent: newObject;
|
||||
- (void) addContentsOf: (id <ConstantCollecting>)aCollection;
|
||||
- (void) addContentsIfAbsentOf: (id <ConstantCollecting>)aCollection;
|
||||
- (void) addWithObjects: (id*)objc count: (unsigned)c;
|
||||
- (void) addObjects: firstObject, ...;
|
||||
- (void) addObjects: firstObject rest: (va_list)ap;
|
||||
|
||||
// REMOVING;
|
||||
- (void) removeObject: oldObject;
|
||||
- (void) removeAllOccurrencesOfObject: oldObject;
|
||||
- (void) removeContentsIn: (id <ConstantCollecting>)aCollection;
|
||||
- (void) removeContentsNotIn: (id <ConstantCollecting>)aCollection;
|
||||
- (void) uniqueContents;
|
||||
- (void) empty;
|
||||
|
||||
// REPLACING;
|
||||
- (void) replaceObject: oldObject withObject: newObject;
|
||||
- (void) replaceAllOccurrencesOfObject: oldObject withObject: newObject;
|
||||
|
||||
@end
|
||||
|
||||
#define NO_OBJECT nil
|
||||
|
||||
#endif /* __Collecting_h_INCLUDE_GNU */
|
|
@ -1,103 +0,0 @@
|
|||
/* Interface for Objective-C Collection object
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* This is the abstract superclass that satisfies the Collecting
|
||||
protocol, without using any instance variables.
|
||||
*/
|
||||
|
||||
#ifndef __Collection_h_INCLUDE_GNU
|
||||
#define __Collection_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <objects/Collecting.h>
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Coding.h>
|
||||
|
||||
@interface ConstantCollection : NSObject <ConstantCollecting>
|
||||
- printForDebugger; /* This method will disappear later. */
|
||||
@end
|
||||
|
||||
@interface Collection : ConstantCollection <Collecting>
|
||||
@end
|
||||
|
||||
@interface Enumerator : NSObject <Enumerating>
|
||||
{
|
||||
id collection;
|
||||
void *enum_state;
|
||||
}
|
||||
@end
|
||||
|
||||
#define FOR_COLLECTION(ACOLL, ELT) \
|
||||
{ \
|
||||
void *_es = [ACOLL newEnumState]; \
|
||||
while ((ELT = [ACOLL nextObjectWithEnumState: &_es])) \
|
||||
{
|
||||
|
||||
#define END_FOR_COLLECTION(ACOLL) \
|
||||
} \
|
||||
[ACOLL freeEnumState: &_es]; \
|
||||
}
|
||||
|
||||
#define FOR_COLLECTION_WHILE_TRUE(ACOLL, ELT, FLAG) \
|
||||
{ \
|
||||
void *_es = [ACOLL newEnumState]; \
|
||||
while (FLAG && (ELT = [ACOLL nextObjectWithEnumState: &_es])) \
|
||||
{
|
||||
|
||||
#define END_FOR_COLLECTION_WHILE_TRUE(ACOLL) \
|
||||
} \
|
||||
[ACOLL freeEnumState: &_es]; \
|
||||
}
|
||||
|
||||
/* The only subclassResponsibilities in Collection are:
|
||||
|
||||
addElement:
|
||||
removeElement:
|
||||
getNextElement:withEnumState:
|
||||
empty
|
||||
|
||||
But subclasses may need to override the following for correctness:
|
||||
|
||||
contentType
|
||||
comparisonFunction
|
||||
|
||||
but subclasses will want to override others as well in order to
|
||||
increase efficiency, especially:
|
||||
|
||||
count
|
||||
|
||||
and perhaps:
|
||||
|
||||
includesElement:
|
||||
occurrencesOfElement:
|
||||
uniqueContents
|
||||
withElementsCall:whileTrue:
|
||||
withElementsCall:
|
||||
isEmpty
|
||||
releaseObjects
|
||||
|
||||
*/
|
||||
|
||||
#endif /* __Collection_h_INCLUDE_GNU */
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/* Collection definitions for the use of subclass implementations only
|
||||
Copyright (C) 1993,1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __CollectionPrivate_h_INCLUDE_GNU
|
||||
#define __CollectionPrivate_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
@interface ConstantCollection (ArchivingHelpers)
|
||||
/* These methods should never be called except in order, and inside
|
||||
-encodeWithCoder: and -decodeWithCoder: */
|
||||
- (void) _encodeCollectionWithCoder: (id <Encoding>)aCoder;
|
||||
- _initCollectionWithCoder: (id <Decoding>)aCoder;
|
||||
- (void) _encodeContentsWithCoder: (id <Encoding>)aCoder;
|
||||
- (void) _decodeContentsWithCoder: (id <Decoding>)aCoder;
|
||||
@end
|
||||
|
||||
@interface ConstantCollection (DeallocationHelpers)
|
||||
|
||||
/* Empty the internals of a collection after the contents have
|
||||
already been released. */
|
||||
- (void) _collectionEmpty;
|
||||
|
||||
- (void) _collectionReleaseContents;
|
||||
|
||||
/* Deallocate the internals of a collection after the contents
|
||||
have already been released. */
|
||||
- (void) _collectionDealloc;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __CollectionPrivate_h_INCLUDE_GNU */
|
|
@ -1,83 +0,0 @@
|
|||
/* Interface for coder object for distributed objects
|
||||
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __ConnectedCoder_h
|
||||
#define __ConnectedCoder_h
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Coder.h>
|
||||
#include <objects/Port.h>
|
||||
|
||||
/* ConnectedCoder identifiers */
|
||||
enum {
|
||||
METHOD_REQUEST = 0,
|
||||
METHOD_REPLY,
|
||||
ROOTPROXY_REQUEST,
|
||||
ROOTPROXY_REPLY,
|
||||
CONNECTION_SHUTDOWN,
|
||||
METHODTYPE_REQUEST, /* these two only needed with NeXT runtime */
|
||||
METHODTYPE_REPLY
|
||||
};
|
||||
|
||||
@class Connection;
|
||||
|
||||
@interface ConnectedEncoder : Encoder
|
||||
{
|
||||
Connection *connection;
|
||||
unsigned sequence_number;
|
||||
int identifier;
|
||||
}
|
||||
|
||||
+ newForWritingWithConnection: (Connection*)c
|
||||
sequenceNumber: (int)n
|
||||
identifier: (int)i;
|
||||
- (void) dismiss;
|
||||
|
||||
- connection;
|
||||
- (unsigned) sequenceNumber;
|
||||
- (int) identifier;
|
||||
|
||||
@end
|
||||
|
||||
@interface ConnectedDecoder : Decoder
|
||||
{
|
||||
Connection *connection;
|
||||
unsigned sequence_number;
|
||||
int identifier;
|
||||
}
|
||||
|
||||
+ newDecodingWithPacket: (InPacket*)packet
|
||||
connection: (Connection*)c;
|
||||
+ newDecodingWithConnection: (Connection*)c
|
||||
timeout: (int) timeout;
|
||||
- (void) dismiss;
|
||||
|
||||
- connection;
|
||||
- (unsigned) sequenceNumber;
|
||||
- (int) identifier;
|
||||
|
||||
- replyPort;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __ConnectedCoder_h */
|
|
@ -1,222 +0,0 @@
|
|||
/* Interface for GNU Objective-C connection for remote object messaging
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Connection_h_OBJECTS_INCLUDE
|
||||
#define __Connection_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <objects/Lock.h>
|
||||
#include <objects/Collecting.h>
|
||||
#include <objects/Dictionary.h>
|
||||
#include <objects/NSString.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
|
||||
@class Proxy;
|
||||
@class InPort, OutPort;
|
||||
|
||||
@interface Connection : NSObject
|
||||
{
|
||||
unsigned is_valid:1;
|
||||
unsigned delay_dialog_interruptions:1;
|
||||
unsigned connection_filler:6;
|
||||
unsigned retain_count:24;
|
||||
unsigned reply_depth;
|
||||
InPort *in_port;
|
||||
OutPort *out_port;
|
||||
unsigned message_count;
|
||||
NSMapTable *local_targets;
|
||||
NSMapTable *remote_proxies;
|
||||
int in_timeout;
|
||||
int out_timeout;
|
||||
Class in_port_class;
|
||||
Class out_port_class;
|
||||
Class encoding_class;
|
||||
NSMapTable *incoming_xref_2_const_ptr;
|
||||
NSMapTable *outgoing_const_ptr_2_xref;
|
||||
id delegate;
|
||||
}
|
||||
|
||||
/* Setting and getting class configuration */
|
||||
+ (Class) defaultInPortClass;
|
||||
+ (void) setDefaultInPortClass: (Class) aPortClass;
|
||||
+ (Class) defaultOutPortClass;
|
||||
+ (void) setDefaultOutPortClass: (Class) aPortClass;
|
||||
+ (Class) defaultProxyClass;
|
||||
+ (void) setDefaultProxyClass: (Class) aClass;
|
||||
+ (int) defaultOutTimeout;
|
||||
+ (void) setDefaultOutTimeout: (int)to;
|
||||
+ (int) defaultInTimeout;
|
||||
+ (void) setDefaultInTimeout: (int)to;
|
||||
|
||||
/* Querying the state of all the connections */
|
||||
+ (int) messagesReceived;
|
||||
+ (id <Collecting>) allConnections;
|
||||
+ (unsigned) connectionsCount;
|
||||
+ (unsigned) connectionsCountWithInPort: (InPort*)aPort;
|
||||
|
||||
/* Use these when you're release'ing an object that may have been vended
|
||||
or registered for invalidation notification */
|
||||
+ (void) removeLocalObject: anObj;
|
||||
|
||||
/* Registering your server object on the network.
|
||||
These methods create a new connection object that must be "run" in order
|
||||
to start handling requests from clients.
|
||||
These method names may change when we get the capability to register
|
||||
ports with names after the ports have been created. */
|
||||
/* I want the second method name to clearly indicate that we're not
|
||||
connecting to a pre-existing registration name, we're registering a
|
||||
new name, and this method will fail if that name has already been
|
||||
registered. This is why I don't like "newWithRegisteredName:" ---
|
||||
it's unclear if we're connecting to another Connection that already
|
||||
registered with that name. */
|
||||
+ (Connection*) newWithRootObject: anObj;
|
||||
+ (Connection*) newRegisteringAtName: (id <String>)n withRootObject: anObj;
|
||||
|
||||
/* Get a proxy to a remote server object.
|
||||
A new connection is created if necessary. */
|
||||
+ (Proxy*) rootProxyAtName: (id <String>)name onHost: (id <String>)host;
|
||||
+ (Proxy*) rootProxyAtName: (id <String>)name;
|
||||
+ (Proxy*) rootProxyAtPort: (OutPort*)anOutPort;
|
||||
+ (Proxy*) rootProxyAtPort: (OutPort*)anOutPort withInPort: (InPort*)anInPort;
|
||||
|
||||
/* This is the designated initializer for the Connection class.
|
||||
You don't need to call it yourself. */
|
||||
+ (Connection*) newForInPort: (InPort*)anInPort outPort: (OutPort*)anOutPort
|
||||
ancestorConnection: (Connection*)ancestor;
|
||||
|
||||
/* Make a connection object start listening for incoming requests. After
|
||||
after DATE. */
|
||||
- (void) runConnectionUntilDate: date;
|
||||
|
||||
/* Same as above, but never time out. */
|
||||
- (void) runConnection;
|
||||
|
||||
/* When you get an invalidation notification from a connection, use
|
||||
this method in order to find out if any of the proxy objects you're
|
||||
using are going away. */
|
||||
- (id <Collecting>) proxies;
|
||||
|
||||
/* If you somehow have a connection to a server, but don't have it's
|
||||
a proxy to its root object yet, you can use this to get it. */
|
||||
- (Proxy*) rootProxy;
|
||||
|
||||
/* For getting the root object of a connection or port */
|
||||
- rootObject;
|
||||
+ rootObjectForInPort: (InPort*)aPort;
|
||||
|
||||
/* Used for setting the root object of a connection that we
|
||||
created without one, or changing the root object of a connection
|
||||
that already has one. */
|
||||
+ (void) setRootObject: anObj forInPort: (InPort*)aPort;
|
||||
- setRootObject: anObj;
|
||||
|
||||
/* Querying and setting some instance variables */
|
||||
- (int) outTimeout;
|
||||
- (int) inTimeout;
|
||||
- (void) setOutTimeout: (int)to;
|
||||
- (void) setInTimeout: (int)to;
|
||||
- (Class) inPortClass;
|
||||
- (Class) outPortClass;
|
||||
- (void) setInPortClass: (Class)aPortClass;
|
||||
- (void) setOutPortClass: (Class)aPortClass;
|
||||
- (Class) proxyClass;
|
||||
- (Class) encodingClass;
|
||||
- (Class) decodingClass;
|
||||
- outPort;
|
||||
- inPort;
|
||||
- delegate;
|
||||
- (void) setDelegate: anObj;
|
||||
|
||||
- (void) invalidate;
|
||||
- (BOOL) isValid;
|
||||
|
||||
/* Only subclassers and power-users need worry about these */
|
||||
- (Proxy*) proxyForTarget: (unsigned)target;
|
||||
- (void) addProxy: (Proxy*)aProxy;
|
||||
- (BOOL) includesProxyForTarget: (unsigned)target;
|
||||
- (void) removeProxy: (Proxy*)aProxy;
|
||||
- (id <Collecting>) localObjects;
|
||||
- (void) addLocalObject: anObj;
|
||||
- (BOOL) includesLocalObject: anObj;
|
||||
- (void) removeLocalObject: anObj;
|
||||
- (retval_t) forwardForProxy: (Proxy*)object
|
||||
selector: (SEL)sel
|
||||
argFrame: (arglist_t)frame;
|
||||
- (const char *) typeForSelector: (SEL)sel remoteTarget: (unsigned)target;
|
||||
- (unsigned) _encoderReferenceForConstPtr: (const void*)ptr;
|
||||
- (const void*) _decoderConstPtrAtReference: (unsigned)xref;
|
||||
- (unsigned) _encoderCreateReferenceForConstPtr: (const void*)ptr;
|
||||
- (unsigned) _decoderCreateReferenceForConstPtr: (const void*)ptr;
|
||||
|
||||
@end
|
||||
|
||||
extern NSString *ConnectionBecameInvalidNotification;
|
||||
|
||||
@protocol ConnectedSelfCoding
|
||||
+ (void) encodeObject: anObj withConnectedCoder: aRmc;
|
||||
@end
|
||||
|
||||
@interface Object (ConnectionDelegate)
|
||||
- (Connection*) connection: ancestorConn didConnect: newConn;
|
||||
/* If the delegate responds to this method, it will be used to ask the
|
||||
delegate's permission to establish a new connection from the old one.
|
||||
Often this is used so that the delegate can register for invalidation
|
||||
notification on new child connections.
|
||||
Normally return newConn. */
|
||||
@end
|
||||
|
||||
#if 0 /* Put in Coder.m until ObjC runtime category-loading bug is fixed */
|
||||
|
||||
@interface Object (ConnectionRequests)
|
||||
- classForConnectedCoder: aRmc;
|
||||
/* Must return the class that will be created on the remote side
|
||||
of the connection.
|
||||
Used by the remote objects system to determine how the receiver
|
||||
should be encoded across the network.
|
||||
In general, you can:
|
||||
return [Proxy class] to send a proxy of the receiver;
|
||||
return [self class] to send the receiver bycopy.
|
||||
The Object class implementation returns [Proxy class]. */
|
||||
+ (void) encodeObject: anObject withConnectedCoder: aRmc;
|
||||
/* This message is sent to the class returned by -classForConnectedCoder:
|
||||
The Proxy class implementation encodes a proxy for anObject.
|
||||
The Object class implementation encodes the receiver itself. */
|
||||
@end
|
||||
|
||||
@interface Object (Retaining) <Retaining>
|
||||
/* Make sure objects don't crash when you send them <Retaining> messages.
|
||||
These implementations, however, do nothing. */
|
||||
@end
|
||||
|
||||
#endif /* 0 Put in Coder.m */
|
||||
|
||||
#define CONNECTION_DEFAULT_TIMEOUT 15000 /* in milliseconds */
|
||||
|
||||
extern NSString *ConnectionBecameInvalidNotification;
|
||||
extern NSString *ConnectionWasCreatedNotification;
|
||||
|
||||
extern NSString *RunLoopConnectionReplyMode;
|
||||
|
||||
#endif /* __Connection_h_OBJECTS_INCLUDE */
|
|
@ -1,75 +0,0 @@
|
|||
/* Interface for Objective-C "collection of delegates" object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* Using this object, a delegator can have an arbitrary number of
|
||||
delegates. Send a message to this object and the message will get
|
||||
forwarded to the delegates on the list. */
|
||||
|
||||
#ifndef __DelegatePool_h_OBJECTS_INCLUDE
|
||||
#define __DelegatePool_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Array.h>
|
||||
|
||||
/* Available sending behaviors */
|
||||
enum DelegatePoolSendBehavior {SEND_TO_ALL = 0,
|
||||
SEND_TO_FIRST_RESPONDER,
|
||||
SEND_UNTIL_YES,
|
||||
SEND_UNTIL_NO};
|
||||
|
||||
@interface DelegatePool
|
||||
{
|
||||
struct objc_class *isa;
|
||||
@public
|
||||
unsigned char _send_behavior;
|
||||
Array *_list;
|
||||
BOOL _last_message_had_receivers;
|
||||
}
|
||||
|
||||
// CREATING AND FREEING;
|
||||
+ alloc;
|
||||
+ new;
|
||||
- init;
|
||||
- (void) dealloc;
|
||||
|
||||
// MANIPULATING COLLECTION OF DELEGATES;
|
||||
- (void) delegatePoolAddObject: anObject;
|
||||
- (void) delegatePoolAddObjectIfAbsent: anObject;
|
||||
- (void) delegatePoolRemoveObject: anObject;
|
||||
- (BOOL) delegatePoolIncludesObject: anObject;
|
||||
- delegatePoolCollection;
|
||||
- (unsigned char) delegatePoolSendBehavior;
|
||||
- (void) delegatePoolSetSendBehavior: (unsigned char)b;
|
||||
|
||||
// FOR PASSING ALL OTHER MESSAGES TO DELEGATES;
|
||||
// RETURNS 0 IF NO OBJECTS RESPOND;
|
||||
- forward:(SEL)aSel :(arglist_t)argFrame;
|
||||
|
||||
// FOR FINDING OUT IF ANY OBJECTS IN THE POOL RESPONDED TO THE LAST MSG;
|
||||
/* This method is bad because it won't be thread-safe---it may
|
||||
go away in the future. */
|
||||
- (BOOL) delegatePoolLastMessageHadReceivers;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __DelegatePool_h_OBJECTS_INCLUDE */
|
|
@ -1,41 +0,0 @@
|
|||
/* Interface for Objective-C Dictionary collection object
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Dictionary_h_INCLUDE_GNU
|
||||
#define __Dictionary_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/KeyedCollection.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
|
||||
@interface Dictionary : KeyedCollection
|
||||
{
|
||||
NSMapTable *_contents_hash;
|
||||
}
|
||||
|
||||
- initWithCapacity: (unsigned)aCapacity;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Dictionary_h_INCLUDE_GNU */
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
/* Code for interface of Objective-C EltNode objects
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@cs.rochester.edu>
|
||||
Dept. of Computer Science, U. of Rochester, Rochester, NY 14627
|
||||
|
||||
This file is part of the GNU Objective-C library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* This file gets included in all the ...EltNode.h files
|
||||
Doing this silly #include stuff is a poor substitute for multiple
|
||||
inheritance. sigh.
|
||||
|
||||
Pattern:
|
||||
|
||||
@interface FooEltNode : FooNode
|
||||
#include <objects/EltNode-h>
|
||||
@end
|
||||
*/
|
||||
|
||||
|
||||
<EltHolding>
|
||||
{
|
||||
elt _element;
|
||||
int (*_elt_comparison_function)(elt,elt);
|
||||
}
|
||||
- (int(*)(elt,elt)) comparisonFunction;
|
|
@ -1,110 +0,0 @@
|
|||
/* Code for implementation for Objective-C EltNode objects
|
||||
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@cs.rochester.edu>
|
||||
Dept. of Computer Science, U. of Rochester, Rochester, NY 14627
|
||||
|
||||
This file is part of the GNU Objective-C library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* This file gets included in all the ...EltNode.m files.
|
||||
Doing this silly #include stuff is a poor substitute for multiple
|
||||
inheritance. sigh.
|
||||
|
||||
Pattern:
|
||||
|
||||
@implementation FooEltNode : FooNode
|
||||
#include <objects/EltNode-m>
|
||||
@end
|
||||
*/
|
||||
|
||||
#include <objects/eltfuncs.h>
|
||||
#include <objects/NSString.h>
|
||||
|
||||
- initElement: (elt)anElement
|
||||
encoding: (const char *)eltEncoding
|
||||
{
|
||||
[super init];
|
||||
_element = anElement;
|
||||
_elt_comparison_function = elt_get_comparison_function(eltEncoding);
|
||||
return self;
|
||||
}
|
||||
|
||||
/* Archiving must mimic the above designated initializer */
|
||||
|
||||
- (void) encodeWithCoder: aCoder
|
||||
{
|
||||
const char *encoding;
|
||||
|
||||
[super encodeWithCoder:aCoder];
|
||||
encoding = elt_get_encoding(_elt_comparison_function);
|
||||
[aCoder encodeValueOfCType:@encode(char*) at:&encoding
|
||||
withName:@"EltNode Content Type Encoding"];
|
||||
[aCoder encodeValueOfCType:encoding
|
||||
at:elt_get_ptr_to_member(encoding, &_element)
|
||||
withName:@"EltNode Content Element"];
|
||||
}
|
||||
|
||||
- (elt*) _elementDataPtr
|
||||
{
|
||||
return &_element;
|
||||
}
|
||||
|
||||
- (int(**)(elt,elt)) _eltComparisonFunctionPtr
|
||||
{
|
||||
return &_elt_comparison_function;
|
||||
}
|
||||
|
||||
- initWithCoder: aCoder
|
||||
{
|
||||
char *encoding;
|
||||
|
||||
[super initWithCoder:aCoder];
|
||||
[aCoder decodeValueOfCType:@encode(char*)
|
||||
at:&encoding
|
||||
withName:NULL];
|
||||
*[self _eltComparisonFunctionPtr] = elt_get_comparison_function(encoding);
|
||||
[aCoder decodeValueOfCType:encoding
|
||||
at:[self _elementDataPtr]
|
||||
withName:NULL];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (int(*)(elt,elt)) comparisonFunction
|
||||
{
|
||||
return _elt_comparison_function;
|
||||
}
|
||||
|
||||
- (elt) elementData
|
||||
{
|
||||
return _element;
|
||||
}
|
||||
|
||||
- (int) compare: anotherObject
|
||||
{
|
||||
/* perhaps we should do more checking first */
|
||||
return _elt_comparison_function(_element, [anotherObject elementData]);
|
||||
}
|
||||
|
||||
- printForDebugger
|
||||
{
|
||||
elt_fprintf_elt(stdout,
|
||||
elt_get_encoding(_elt_comparison_function),
|
||||
_element);
|
||||
printf("\n");
|
||||
return self;
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
/* Interface for Objective-C EltNodeCollector collection object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* EltNodeCollector */
|
||||
|
||||
#ifndef __EltNodeCollector_h_INCLUDE_GNU
|
||||
#define __EltNodeCollector_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/IndexedCollection.h>
|
||||
|
||||
/* Protocol for a node that also holds an element */
|
||||
@protocol EltHolding
|
||||
- initElement: (elt)anElement
|
||||
encoding: (const char *)eltEncoding;
|
||||
- (elt) elementData;
|
||||
@end
|
||||
|
||||
|
||||
/* It's is a bit unfortunate that we insist that the underlying
|
||||
collector conform to IndexedCollecting. */
|
||||
|
||||
@interface EltNodeCollector : IndexedCollection
|
||||
{
|
||||
@private
|
||||
id _contents_collector;
|
||||
id _node_class;
|
||||
int (*_comparison_function)(elt,elt);
|
||||
}
|
||||
|
||||
|
||||
- initWithType: (const char *)contentEncoding
|
||||
nodeCollector: aNodeCollector
|
||||
nodeClass: aNodeClass;
|
||||
|
||||
// The class of the autocreated link objects, must conform to <EltHolding>;
|
||||
- eltNodeClass;
|
||||
|
||||
// Getting the underlying node collector that holds the contents;
|
||||
- contentsCollector;
|
||||
|
||||
// Finding the node that contains anElement;
|
||||
- (id <EltHolding>) eltNodeWithElement: (elt)anElement;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __EltNodeCollector_h_INCLUDE_GNU */
|
|
@ -1,37 +0,0 @@
|
|||
/* Protocol for GNU Objective C invocations
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: February 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Enumerating_h__OBJECTS_INCLUDE
|
||||
#define __Enumerating_h__OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
@protocol Enumerating <NSObject>
|
||||
|
||||
- initWithCollection: aCollection;
|
||||
- nextObject;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Enumerating_h__OBJECTS_INCLUDE */
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/* Interface for Objective-C GapArray collection object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Kresten Krab Thorup <krab@iesd.auc.dk>
|
||||
Dept. of Mathematics and Computer Science, Aalborg U., Denmark
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GapArray_h_INCLUDE_GNU
|
||||
#define __GapArray_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Array.h>
|
||||
|
||||
@interface GapArray : Array
|
||||
{
|
||||
@public
|
||||
unsigned _gap_start; /* start of gap */
|
||||
unsigned _gap_size; /* size of gap */
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __GapArray_h_INCLUDE_GNU */
|
|
@ -1,89 +0,0 @@
|
|||
/* GapArray definitions for the use of subclass implementations
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
Copyright (C) 1993,1994 Kresten Krab Thorup <krab@iesd.auc.dk>
|
||||
Dept. of Mathematics and Computer Science, Aalborg U., Denmark
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GapArrayPrivate_h_INCLUDE_GNU
|
||||
#define __GapArrayPrivate_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/ArrayPrivate.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define GAP_TO_BASIC(INDEX) \
|
||||
({ unsigned int __idx = (INDEX); \
|
||||
__idx >= self->_gap_start \
|
||||
? __idx+self->_gap_size : __idx; })
|
||||
|
||||
#define BASIC_TO_GAP(INDEX) \
|
||||
({ unsigned int __idx = (INDEX); \
|
||||
__idx < self->_gap_start \
|
||||
? __idx : __idx-self->_gap_size; })
|
||||
|
||||
static inline void
|
||||
gapMoveGapTo (GapArray* self, unsigned index)
|
||||
{
|
||||
int i;
|
||||
assert (index <= self->_capacity);
|
||||
if (index < self->_gap_start)
|
||||
{
|
||||
#ifndef STABLE_MEMCPY
|
||||
int b = index + self->_gap_size;
|
||||
for (i = self->_gap_start + self->_gap_size - 1; i >= b; i--)
|
||||
self->_contents_array[i] = self->_contents_array[i - self->_gap_size];
|
||||
#else
|
||||
memcpy (self->_contents_array + index + self->_gap_size,
|
||||
self->_contents_array + index,
|
||||
self->_gap_start - index)
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef STABLE_MEMCPY
|
||||
for(i = self->_gap_start; i != index; i++)
|
||||
self->_contents_array[i] = self->_contents_array[i - self->_gap_size];
|
||||
#else
|
||||
memcpy (self->_contents_array + self->_gap_start,
|
||||
self->_contents_array + self->_gap_start + self->_gap_size,
|
||||
index - self->_gap_start);
|
||||
#endif
|
||||
}
|
||||
self->_gap_start = index;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gapMakeHoleAt(GapArray *self, unsigned index)
|
||||
{
|
||||
gapMoveGapTo (self, index);
|
||||
self->_gap_start += 1;
|
||||
self->_gap_size -= 1;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gapFillHoleAt(GapArray *self, unsigned index)
|
||||
{
|
||||
gapMoveGapTo (self, index);
|
||||
self->_gap_size += 1;
|
||||
}
|
||||
|
||||
#endif /* __GapArrayPrivate_h_INCLUDE_GNU */
|
|
@ -1,37 +0,0 @@
|
|||
/* Interface for Objective-C Heap collection object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Heap_h_INCLUDE_GNU
|
||||
#define __Heap_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Array.h>
|
||||
|
||||
@interface Heap : Array
|
||||
|
||||
- (void) heapifyFromIndex: (unsigned)index;
|
||||
- (void) heapify;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Heap_h_INCLUDE_GNU */
|
|
@ -1,135 +0,0 @@
|
|||
/* Protocol for Objective-C objects that hold elements accessible by index
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* The <IndexedCollecting> protocol inherits from the
|
||||
<KeyedCollecting> protocol.
|
||||
|
||||
The <IndexedCollecting> protocol defines the interface to a
|
||||
collection of elements that are accessible by a key that is an index,
|
||||
where the indeces in a collection are a contiguous series of unsigned
|
||||
integers beginning at 0. This is the root of the protocol heirarchy
|
||||
for all collections that hold their elements in some order. Elements
|
||||
may be accessed, inserted, replaced and removed by their index.
|
||||
*/
|
||||
|
||||
#ifndef __IndexedCollecting_h_OBJECTS_INCLUDE
|
||||
#define __IndexedCollecting_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Collecting.h>
|
||||
|
||||
typedef struct _IndexRange {
|
||||
unsigned location;
|
||||
unsigned length;
|
||||
} IndexRange;
|
||||
|
||||
#define IndexRangeInside(RANGE1,RANGE2) \
|
||||
({IndexRange __a=(RANGE1), __b=(RANGE2); \
|
||||
__a.start<=__b.start && __a.end>=__b.end;})
|
||||
|
||||
|
||||
@protocol ConstantIndexedCollecting <ConstantCollecting>
|
||||
|
||||
// GETTING MEMBERS BY INDEX;
|
||||
- objectAtIndex: (unsigned)index;
|
||||
- firstObject;
|
||||
- lastObject;
|
||||
|
||||
// GETTING MEMBERS BY NEIGHBOR;
|
||||
- successorOfObject: anObject;
|
||||
- predecessorOfObject: anObject;
|
||||
|
||||
// GETTING INDICES BY MEMBER;
|
||||
- (unsigned) indexOfObject: anObject;
|
||||
- (unsigned) indexOfObject: anObject inRange: (IndexRange)aRange;
|
||||
|
||||
// TESTING;
|
||||
- (BOOL) contentsEqualInOrder: (id <ConstantIndexedCollecting>)aColl;
|
||||
- (int) compareInOrderContentsOf: (id <Collecting>)aCollection;
|
||||
- (unsigned) indexOfFirstDifference: (id <ConstantIndexedCollecting>)aColl;
|
||||
- (unsigned) indexOfFirstIn: (id <ConstantCollecting>)aColl;
|
||||
- (unsigned) indexOfFirstNotIn: (id <ConstantCollecting>)aColl;
|
||||
|
||||
// ENUMERATING;
|
||||
- (id <Enumerating>) reverseObjectEnumerator;
|
||||
- (void) withObjectsInRange: (IndexRange)aRange
|
||||
invoke: (id <Invoking>)anInvocation;
|
||||
- (void) withObjectsInReverseInvoke: (id <Invoking>)anInvocation;
|
||||
- (void) withObjectsInReverseInvoke: (id <Invoking>)anInvocation
|
||||
whileTrue:(BOOL *)flag;
|
||||
- (void) makeObjectsPerformInReverse: (SEL)aSel;
|
||||
- (void) makeObjectsPerformInReverse: (SEL)aSel withObject: argObject;
|
||||
|
||||
// LOW-LEVEL ENUMERATING;
|
||||
- prevObjectWithEnumState: (void**)enumState;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@protocol IndexedCollecting <ConstantIndexedCollecting, Collecting>
|
||||
|
||||
// REPLACING;
|
||||
- (void) replaceObjectAtIndex: (unsigned)index with: newObject;
|
||||
|
||||
// REMOVING;
|
||||
- (void) removeObjectAtIndex: (unsigned)index;
|
||||
- (void) removeFirstObject;
|
||||
- (void) removeLastObject;
|
||||
- (void) removeRange: (IndexRange)aRange;
|
||||
|
||||
// SORTING;
|
||||
- (void) sortContents;
|
||||
- (void) sortAddObject: newObject;
|
||||
|
||||
@end
|
||||
|
||||
#define NO_INDEX NSNotFound
|
||||
|
||||
/* xxx Fix this comment: */
|
||||
|
||||
/* Most methods in the KeyedCollecting protocol that mention a key are
|
||||
duplicated in the IndexedCollecting protocol, with their names
|
||||
modified to reflect that the "key" now must be an unsigned integer,
|
||||
(an "index"). The programmer should be able to use either of the
|
||||
corresponding method names to the same effect.
|
||||
|
||||
The new methods are provided in the IndexedCollecting protocol for:
|
||||
1) Better type checking for when an unsigned int is required.
|
||||
2) More intuitive method names.
|
||||
|
||||
IndexedCollecting KeyedCollecting
|
||||
----------------------------------------------------------------------
|
||||
insertObject:atIndex insertObject:atKey:
|
||||
replaceObjectAtIndex:with: replaceObjectAtKey:with:
|
||||
removeObjectAtIndex: removeObjectAtKey:
|
||||
objectAtIndex: objectAtKey:
|
||||
includesIndex: includesKey:
|
||||
|
||||
insertElement:atIndex insertElement:atKey:
|
||||
replaceElementAtIndex:with: replaceElementAtKey:with:
|
||||
removeElementAtIndex: removeElementAtKey:
|
||||
elementAtIndex: elementAtKey:
|
||||
|
||||
*/
|
||||
|
||||
#endif /* __IndexedCollecting_h_OBJECTS_INCLUDE */
|
|
@ -1,111 +0,0 @@
|
|||
/* Interface for Objective-C Sequential Collection object.
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __IndexedCollection_h_INCLUDE_GNU
|
||||
#define __IndexedCollection_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/KeyedCollection.h>
|
||||
#include <objects/IndexedCollecting.h>
|
||||
|
||||
@interface ConstantIndexedCollection : ConstantCollection
|
||||
@end
|
||||
|
||||
@interface IndexedCollection : ConstantIndexedCollection
|
||||
@end
|
||||
|
||||
@interface ReverseEnumerator : Enumerator
|
||||
@end
|
||||
|
||||
/* Put this on category instead of class to avoid bogus complaint from gcc */
|
||||
@interface ConstantIndexedCollection (Protocol) <ConstantIndexedCollecting>
|
||||
@end
|
||||
@interface IndexedCollection (Protocol) <IndexedCollecting>
|
||||
@end
|
||||
|
||||
#define FOR_INDEXED_COLLECTION(ACOLL, ELT) \
|
||||
{ \
|
||||
void *_es = [ACOLL newEnumState]; \
|
||||
while ((ELT = [ACOLL nextObjectWithEnumState: &_es])) \
|
||||
{
|
||||
|
||||
#define END_FOR_INDEXED_COLLECTION(ACOLL) \
|
||||
} \
|
||||
[ACOLL freeEnumState: &_es]; \
|
||||
}
|
||||
|
||||
#define FOR_INDEXED_COLLECTION_REVERSE(ACOLL, ELT) \
|
||||
{ \
|
||||
void *_es = [ACOLL newEnumState]; \
|
||||
while ((ELT = [ACOLL prevObjectWithEnumState: &_es])) \
|
||||
{
|
||||
|
||||
#define END_FOR_INDEXED_COLLECTION_REVERSE(ACOLL) \
|
||||
} \
|
||||
[ACOLL freeEnumState: &_es]; \
|
||||
}
|
||||
|
||||
#define FOR_INDEXED_COLLECTION_WHILE_TRUE(ACOLL, ELT, FLAG) \
|
||||
{ \
|
||||
void *_es = [ACOLL newEnumState]; \
|
||||
while (FLAG && (ELT = [ACOLL nextObjectWithEnumState: &_es])) \
|
||||
{
|
||||
|
||||
#define END_FOR_INDEXED_COLLECTION_WHILE_TRUE(ACOLL) \
|
||||
} \
|
||||
[ACOLL freeEnumState: &_es]; \
|
||||
}
|
||||
|
||||
|
||||
/* The only subclassResponsibilities in IndexedCollection are:
|
||||
|
||||
insertElement:atIndex:
|
||||
removeElementAtIndex:
|
||||
elementAtIndex:
|
||||
|
||||
but subclass will want to override others as well in order to
|
||||
increase efficiency. The following are especially important if
|
||||
the subclass's implementation of "elementAtIndex:" is not efficient:
|
||||
|
||||
replaceElementAtIndex:with:
|
||||
swapAtIndeces::
|
||||
shallowCopyReplaceFrom:to:with:
|
||||
sortAddElement:byCalling:
|
||||
removeElement:
|
||||
firstElement
|
||||
lastElement
|
||||
shallowCopyFrom:to:
|
||||
withElementsCall:whileTrue:
|
||||
withElementsInReverseCall:whileTrue:
|
||||
|
||||
and perhaps:
|
||||
|
||||
appendElement:
|
||||
prependElement:
|
||||
indexOfElement:
|
||||
withElementsInReverseCall:
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#endif /* __IndexedCollection_h_INCLUDE_GNU */
|
|
@ -1,41 +0,0 @@
|
|||
/* IndexedCollection definitions for the use of subclass implementations only
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __IndexedCollectionPrivate_h_INCLUDE_GNU
|
||||
#define __IndexedCollectionPrivate_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/CollectionPrivate.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <objects/NSString.h>
|
||||
|
||||
/* To be used inside a method for making sure that index
|
||||
is not above range.
|
||||
*/
|
||||
#define CHECK_INDEX_RANGE_ERROR(INDEX, OVER) \
|
||||
if (INDEX >= OVER) \
|
||||
[NSException raise: NSRangeException \
|
||||
format: @"in %s, index %d is out of range", \
|
||||
sel_get_name (_cmd), INDEX]
|
||||
|
||||
#endif /* __IndexedCollectionPrivate_h_INCLUDE_GNU */
|
|
@ -1,37 +0,0 @@
|
|||
/* Protocol for GNU Objective-C objects that understand an invalidation msg
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __InvalidationListening_h_OBJECTS_INCLUDE
|
||||
#define __InvalidationListening_h_OBJECTS_INCLUDE
|
||||
|
||||
/* This protocol is just temporary. It will disappear when GNU writes
|
||||
a more general notification system.
|
||||
It is not recommended that you use it in your code. */
|
||||
|
||||
@protocol InvalidationListening
|
||||
|
||||
- senderIsInvalid: sender;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __InvalidationListening_h_OBJECTS_INCLUDE */
|
|
@ -1,99 +0,0 @@
|
|||
#ifndef __Invocation_h_OBJECTS_INCLUDE
|
||||
#define __Invocation_h_OBJECTS_INCLUDE
|
||||
|
||||
/*
|
||||
Use these for notifications!
|
||||
Don't forget to make these archivable / transportable.
|
||||
WARNING: All the (char*) type arguments and return values may
|
||||
extraneous stuff after the first type.
|
||||
*/
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Collection.h>
|
||||
#include <objects/Invoking.h>
|
||||
|
||||
@interface Invocation : NSObject <Invoking>
|
||||
{
|
||||
char *return_type; /* may actually contain full argframe type */
|
||||
unsigned return_size;
|
||||
void *return_value;
|
||||
}
|
||||
- initWithReturnType: (const char *)encoding;
|
||||
- (const char *) returnType;
|
||||
- (unsigned) returnSize;
|
||||
- (void) getReturnValue: (void*) addr;
|
||||
@end
|
||||
|
||||
@interface ArgframeInvocation : Invocation
|
||||
{
|
||||
arglist_t argframe;
|
||||
BOOL args_retained;
|
||||
/* Use return_type to hold full argframe type. */
|
||||
}
|
||||
- initWithArgframe: (arglist_t)frame type: (const char *)e;
|
||||
- initWithType: (const char *)e;
|
||||
|
||||
- (void) retainArguments;
|
||||
- (BOOL) argumentsRetained;
|
||||
|
||||
- (const char *) argumentTypeAtIndex: (unsigned)i;
|
||||
- (unsigned) argumentSizeAtIndex: (unsigned)i;
|
||||
- (void) getArgument: (void*)addr atIndex: (unsigned)i;
|
||||
- (void) setArgumentAtIndex: (unsigned)i
|
||||
toValueAt: (const void*)addr;
|
||||
@end
|
||||
|
||||
@interface MethodInvocation : ArgframeInvocation
|
||||
{
|
||||
id *target_pointer;
|
||||
SEL *sel_pointer;
|
||||
}
|
||||
|
||||
- initWithArgframe: (arglist_t)frame selector: (SEL)s;
|
||||
- initWithSelector: (SEL)s;
|
||||
- initWithTarget: target selector: (SEL)s, ...;
|
||||
- (void) invokeWithTarget: t;
|
||||
- (SEL) selector;
|
||||
- (void) setSelector: (SEL)s;
|
||||
- target;
|
||||
- (void) setTarget: t;
|
||||
@end
|
||||
|
||||
/* Same as MethodInvocation, except that when sent
|
||||
[ -invokeWithObject: anObj], anObj does not become the target
|
||||
for the invocation's selector, it becomes the first object
|
||||
argument of the selector. */
|
||||
@interface ObjectMethodInvocation : MethodInvocation
|
||||
{
|
||||
id *arg_object_pointer;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface VoidFunctionInvocation : Invocation
|
||||
{
|
||||
void (*function)();
|
||||
}
|
||||
- initWithVoidFunction: (void(*)())f;
|
||||
@end
|
||||
|
||||
|
||||
@interface ObjectFunctionInvocation : Invocation
|
||||
{
|
||||
id (*function)(id);
|
||||
}
|
||||
- initWithObjectFunction: (id(*)(id))f;
|
||||
@end
|
||||
|
||||
|
||||
#if 0
|
||||
@interface FunctionInvocation : ArgframeInvocation
|
||||
{
|
||||
void (*function)();
|
||||
}
|
||||
- initWithFunction: (void(*)())f
|
||||
argframe: (arglist_t)frame type: (const char *)e;
|
||||
- initWithFunction: (void(*)())f;
|
||||
@end
|
||||
#endif
|
||||
|
||||
#endif /* __Invocation_h_OBJECTS_INCLUDE */
|
|
@ -1,42 +0,0 @@
|
|||
/* Protocol for GNU Objective C invocations
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: February 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Invoking_h__OBJECTS_INCLUDE
|
||||
#define __Invoking_h__OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
@protocol Invoking <NSObject>
|
||||
|
||||
- (void) invoke;
|
||||
- (void) invokeWithObject: anObject;
|
||||
|
||||
- objectReturnValue;
|
||||
- (int) intReturnValue;
|
||||
|
||||
- (BOOL) returnValueIsTrue;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Invoking_h__OBJECTS_INCLUDE */
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/* Protocol for Objective-C objects holding (keyElement,contentElement) pairs.
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* The <KeyedCollecting> protocol inherits from the <Collecting> protocol.
|
||||
|
||||
The <KeyedCollecting> protocol defines the interface to a
|
||||
collection of elements that are accessible by a key, where the key is
|
||||
some unique element. Pairs of (key element, content element) may be
|
||||
added, removed and replaced. The keys and contents may be tested,
|
||||
enumerated and copied.
|
||||
*/
|
||||
|
||||
#ifndef __KeyedCollecting_h_OBJECTS_INCLUDE
|
||||
#define __KeyedCollecting_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Collecting.h>
|
||||
|
||||
@protocol ConstantKeyedCollecting <ConstantCollecting>
|
||||
|
||||
// INITIALIZING;
|
||||
- initWithObjects: (id*)objects forKeys: (id*)keys count: (unsigned)c;
|
||||
|
||||
// GETTING ELEMENTS AND KEYS;
|
||||
- objectAtKey: aKey;
|
||||
- keyOfObject: aContentObject;
|
||||
|
||||
// TESTING;
|
||||
- (BOOL) containsKey: aKey;
|
||||
|
||||
// ENUMERATIONS;
|
||||
- (id <Enumerating>) keyEnumerator;
|
||||
- withKeyObjectsInvoke: (id <Invoking>)anInvocation;
|
||||
- withKeyObjectsInvoke: (id <Invoking>)anInvocation
|
||||
whileTrue: (BOOL *)flag;
|
||||
|
||||
// LOW-LEVEL ENUMERATING;
|
||||
- nextObjectAndKey: (id*)keyPtr withEnumState: (void**)enumState;
|
||||
|
||||
// COPYING;
|
||||
- shallowCopyValuesAs: (Class)aCollectingClass;
|
||||
- shallowCopyKeysAs: (Class)aCollectingClass;
|
||||
- copyValuesAs: (Class)aCollectingClass;
|
||||
- copyKeysAs: (Class)aCollectingClass;
|
||||
|
||||
@end
|
||||
|
||||
@protocol KeyedCollecting <ConstantKeyedCollecting, Collecting>
|
||||
|
||||
// ADDING;
|
||||
- (void) putObject: newContentObject atKey: aKey;
|
||||
|
||||
// REPLACING AND SWAPPING;
|
||||
- (void) replaceObjectAtKey: aKey with: newContentObject;
|
||||
- (void) swapObjectsAtKeys: key1 : key2;
|
||||
|
||||
// REMOVING;
|
||||
- (void) removeObjectAtKey: aKey;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __KeyedCollecting_h_OBJECTS_INCLUDE */
|
|
@ -1,80 +0,0 @@
|
|||
/* Interface for Objective-C KeyedCollection collection object
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __KeyedCollection_h_INCLUDE_GNU
|
||||
#define __KeyedCollection_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Collection.h>
|
||||
#include <objects/KeyedCollecting.h>
|
||||
|
||||
@interface ConstantKeyedCollection : Collection
|
||||
@end
|
||||
|
||||
@interface KeyedCollection : ConstantKeyedCollection
|
||||
@end
|
||||
|
||||
/* Put this on category instead of class to avoid bogus complaint from gcc */
|
||||
@interface ConstantKeyedCollection (Protocol) <ConstantKeyedCollecting>
|
||||
@end
|
||||
@interface KeyedCollection (Protocol) <KeyedCollecting>
|
||||
@end
|
||||
|
||||
@interface KeyEnumerator : Enumerator
|
||||
@end
|
||||
|
||||
#define FOR_KEYED_COLLECTION(ACOLL, ELT, KEY) \
|
||||
{ \
|
||||
void *_es = [ACOLL newEnumState]; \
|
||||
while ((ELT = [ACOLL nextObjectAndKey: &(KEY) withEnumState: &_es])) \
|
||||
{
|
||||
|
||||
#define END_FOR_KEYED_COLLECTION(ACOLL) \
|
||||
} \
|
||||
[ACOLL freeEnumState: &_es]; \
|
||||
}
|
||||
|
||||
#define FOR_KEYED_COLLECTION_WHILE_TRUE(ACOLL, ELT, KEY, FLAG) \
|
||||
{ \
|
||||
void *_es = [ACOLL newEnumState]; \
|
||||
while (FLAG && (ELT = [ACOLL nextObjectAndKey: &(KEY) \
|
||||
withEnumState: &_es])) \
|
||||
{
|
||||
|
||||
#define END_FOR_KEYED_COLLECTION_WHILE_TRUE(ACOLL) \
|
||||
} \
|
||||
[ACOLL freeEnumState: &_es]; \
|
||||
}
|
||||
|
||||
|
||||
/* The only subclassResponsibilities in IndexedCollection are:
|
||||
|
||||
keyDescription
|
||||
insertElement:atKey:
|
||||
removeElementAtKey:
|
||||
elementAtKey:
|
||||
includesKey:
|
||||
getNextKey:content:withEnumState:
|
||||
*/
|
||||
|
||||
#endif /* __KeyedCollection_h_INCLUDE_GNU */
|
|
@ -1,65 +0,0 @@
|
|||
/* LibobjectsMain.h for GNUStep
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Georg Tuparev, EMBL & Academia Naturalis,
|
||||
Heidelberg, Germany
|
||||
Tuparev@EMBL-Heidelberg.de
|
||||
Last update: 05-aug-1995
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __LibobjectsMain_h_OBJECTS_INCLUDE
|
||||
#define __LibobjectsMain_h_OBJECTS_INCLUDE
|
||||
|
||||
/*
|
||||
Several Foundation classes (NSBundle, NSProcessInfo, ...) need access
|
||||
to the argc, argv, and env variables of the main() function. The purpose
|
||||
of this (ugly hack) definition is to give the libobjects library the
|
||||
oportunity to implement its own main function with private access to the
|
||||
global vars. The private main() implementation then will call the user
|
||||
defined (now renamed to LibobjectsMain()) function. The libobjects main()
|
||||
functions is implemented in NSProcessInfo.m
|
||||
*/
|
||||
|
||||
/* Currently this only actually necessary if we don't have ELF.
|
||||
If we have ELF, we can do something far cleaner.
|
||||
See src/NSProcessInfo.m [__ELF__].
|
||||
Hopefully, in the future, we'll do something cleaner
|
||||
with non-ELF systems too.
|
||||
-mccallum
|
||||
*/
|
||||
|
||||
#if !defined(__ELF__) && !defined(SYS_AUTOLOAD)
|
||||
#define main LibobjectsMain
|
||||
extern int LibobjectsMain(/* int argc, char *argv[] */);
|
||||
#endif /* __ELF__ */
|
||||
|
||||
/*
|
||||
NOTE! This is very dirty and dangerous trick. I spend several hours
|
||||
on thinking and man pages browsing, but couldn't find better solution.
|
||||
I know that I will spend 666 years in the Computer Hell for writing
|
||||
this hack, and the master devil (Bully Boy) will send me to write
|
||||
Windowz software.
|
||||
BTW, for writing this hack I got personal congratulations from Dennis
|
||||
Ritchie and Bjarne Stroustrup sent me a bunch of flowers and asked me
|
||||
to participate in the standardization committee for C-- v.6.0 as
|
||||
responsible for the new Tab-Overriding-Operator and Scope-Sensitive-
|
||||
Comments ... but this makes my situation even worse ;-)
|
||||
*/
|
||||
|
||||
#endif /* __LibobjectsMain_h_OBJECTS_INCLUDE */
|
|
@ -1,51 +0,0 @@
|
|||
/* Interface for Objective-C LinkedList collection object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __LinkedList_h_INCLUDE_GNU
|
||||
#define __LinkedList_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/OrderedCollection.h>
|
||||
|
||||
/* The <LinkedListComprising> protocol defines the interface to an object
|
||||
that may be an element in a LinkedList.
|
||||
*/
|
||||
@protocol LinkedListComprising
|
||||
- nextLink;
|
||||
- prevLink;
|
||||
- (void) setNextLink: (id <LinkedListComprising>)aLink;
|
||||
- (void) setPrevLink: (id <LinkedListComprising>)aLink;
|
||||
- linkedList;
|
||||
- (void) setLinkedList: aLinkedList;
|
||||
@end
|
||||
|
||||
@interface LinkedList : OrderedCollection
|
||||
{
|
||||
id _first_link;
|
||||
id _last_link;
|
||||
unsigned int _count;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __LinkedList_h_INCLUDE_GNU */
|
|
@ -1,35 +0,0 @@
|
|||
/* Interface for Objective-C LinkedListEltNode object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __LinkedListEltNode_h_INCLUDE_GNU
|
||||
#define __LinkedListEltNode_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/LinkedListNode.h>
|
||||
#include <objects/EltNodeCollector.h>
|
||||
|
||||
@interface LinkedListEltNode : LinkedListNode
|
||||
#include <objects/EltNode-h>
|
||||
@end
|
||||
|
||||
#endif /* __LinkedListEltNode_h_INCLUDE_GNU */
|
|
@ -1,39 +0,0 @@
|
|||
/* Interface for Objective-C LinkedListNode object
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __LinkedListNode_h_INCLUDE_GNU
|
||||
#define __LinkedListNode_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/LinkedList.h>
|
||||
#include <objects/Coding.h>
|
||||
|
||||
@interface LinkedListNode : NSObject <LinkedListComprising>
|
||||
{
|
||||
id <LinkedListComprising> _next;
|
||||
id <LinkedListComprising> _prev;
|
||||
id _linked_list;
|
||||
}
|
||||
@end
|
||||
|
||||
#endif /* __LinkedListNode_h_INCLUDE_GNU */
|
|
@ -1,35 +0,0 @@
|
|||
/* Interface for GNU Objective-C mutex lock
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Lock_h_OBJECTS_INCLUDE
|
||||
#define __Lock_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Locking.h>
|
||||
|
||||
@interface Lock : NSObject <Locking>
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
#endif /* __Lock_h_OBJECTS_INCLUDE */
|
|
@ -1,35 +0,0 @@
|
|||
/* Protocol for GNU Objective-C mutex locks
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Locking_h_INCLUDE_GNU
|
||||
#define __Locking_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objc/Protocol.h>
|
||||
|
||||
@protocol Locking
|
||||
- (void) lock;
|
||||
- (void) unlock;
|
||||
@end
|
||||
|
||||
#endif /* __Locking_h_INCLUDE_GNU */
|
|
@ -1,40 +0,0 @@
|
|||
/* Interface for Mach-port based object for use with Connection
|
||||
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __MachPort_h_INCLUDE_GNU
|
||||
#define __MachPort_h_INCLUDE_GNU
|
||||
|
||||
#if __mach__
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Port.h>
|
||||
|
||||
@interface MachInPort : InPort
|
||||
@end
|
||||
|
||||
@interface MachOutPort : OutPort
|
||||
@end
|
||||
|
||||
#endif /* __mach__ */
|
||||
|
||||
#endif /* __MachPort_h_INCLUDE_GNU */
|
|
@ -1,34 +0,0 @@
|
|||
/* Interface for Objective-C Magnitude object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Magnitude_h_INCLUDE_GNU
|
||||
#define __Magnitude_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Ordering.h>
|
||||
|
||||
@interface Magnitude : NSObject <Ordering>
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Magnitude_h_INCLUDE_GNU */
|
|
@ -1,42 +0,0 @@
|
|||
/* Provides autoreleasing of malloc'ed pointers
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: January 1995
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __MallocAddress_h_OBJECTS_INCLUDE
|
||||
#define __MallocAddress_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
@interface MallocAddress : NSObject
|
||||
{
|
||||
void *address;
|
||||
}
|
||||
|
||||
+ autoreleaseMallocAddress: (void*)addr;
|
||||
+ objectForAddress: (void*)addr;
|
||||
|
||||
- initWithAddress: (void*)addr;
|
||||
- (void) dealloc;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __MallocAddress_h_OBJECTS_INCLUDE */
|
|
@ -1,41 +0,0 @@
|
|||
/* Interface for Objective-C MappedCollector collection object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __MappedCollector_h_INCLUDE_GNU
|
||||
#define __MappedCollector_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/KeyedCollection.h>
|
||||
|
||||
@interface MappedCollector : KeyedCollection
|
||||
{
|
||||
id <KeyedCollecting> _map;
|
||||
id <KeyedCollecting> _domain;
|
||||
}
|
||||
|
||||
- initWithCollection: (id <KeyedCollecting>)aDomain
|
||||
map: (id <KeyedCollecting>)aMap;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __MappedCollector_h_INCLUDE_GNU */
|
|
@ -1,72 +0,0 @@
|
|||
/* Interface for GNU Objective C memory stream
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __MemoryStream_h_OBJECTS_INCLUDE
|
||||
#define __MemoryStream_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Stream.h>
|
||||
#include <objects/Streaming.h>
|
||||
|
||||
/* This protocol is preliminary and may change.
|
||||
This also may get pulled out into a separate .h file. */
|
||||
|
||||
@protocol MemoryStreaming <Streaming>
|
||||
|
||||
- initWithCapacity: (unsigned)capacity;
|
||||
|
||||
- (void) setStreamBufferCapacity: (unsigned)s;
|
||||
|
||||
- (char*) streamBuffer;
|
||||
- (unsigned) streamBufferCapacity;
|
||||
- (unsigned) streamEofPosition;
|
||||
|
||||
@end
|
||||
|
||||
@interface MemoryStream : Stream <MemoryStreaming>
|
||||
{
|
||||
int type;
|
||||
char *buffer;
|
||||
int size;
|
||||
int eofPosition;
|
||||
int prefix;
|
||||
int position;
|
||||
}
|
||||
|
||||
- initWithCapacity: (unsigned)capacity
|
||||
prefix: (unsigned)prefix;
|
||||
|
||||
- initWithSize: (unsigned)s; /* For backwards compatibility, depricated */
|
||||
|
||||
- (unsigned) streamBufferPrefix;
|
||||
- (unsigned) streamBufferLength; /* prefix + eofPosition */
|
||||
|
||||
/* xxx This interface will change */
|
||||
- _initOnMallocBuffer: (char*)b
|
||||
size: (unsigned)s /* size of malloc'ed buffer */
|
||||
eofPosition: (unsigned)l /* length of buffer with data for reading */
|
||||
prefix: (unsigned)p /* reset for this position */
|
||||
position: (unsigned)i; /* current position for reading/writing */
|
||||
@end
|
||||
|
||||
#endif /* __MemoryStream_h_OBJECTS_INCLUDE */
|
|
@ -1,58 +0,0 @@
|
|||
/* Interface for holding and dispatching notifications
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: March 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Notification_h_OBJECTS_INCLUDE
|
||||
#define __Notification_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/NSString.h>
|
||||
#include <objects/KeyedCollecting.h>
|
||||
#include <objects/NotificationDispatcher.h>
|
||||
|
||||
@protocol Notifying
|
||||
- (id <String>) name;
|
||||
- object;
|
||||
- userInfo;
|
||||
@end
|
||||
|
||||
@protocol NotificationPosting
|
||||
- (void) postNotification: (id <Notifying>)notification;
|
||||
@end
|
||||
|
||||
@interface Notification : NSObject <Notifying>
|
||||
{
|
||||
id _name;
|
||||
id _object;
|
||||
id _info;
|
||||
}
|
||||
|
||||
+ notificationWithName: (id <String>)name
|
||||
object: object;
|
||||
|
||||
+ notificationWithName: (id <String>)name
|
||||
object: object
|
||||
userInfo: info;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Notification_h_OBJECTS_INCLUDE */
|
|
@ -1,218 +0,0 @@
|
|||
/* Interface to object for broadcasting Notification objects
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: March 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __NotificationDispatcher_h_OBJECTS_INCLUDE
|
||||
#define __NotificationDispatcher_h_OBJECTS_INCLUDE
|
||||
|
||||
/* A class for posting notifications to observer objects that request
|
||||
them.
|
||||
|
||||
This implementation has several advantages over OpenStep's
|
||||
NSNotificationCenter:
|
||||
|
||||
(1) Heavy use of hash tables and the use of LinkedList's make it
|
||||
faster. Removing from the middle of LinkedList's is much more
|
||||
efficient than removing from the middle of Array's.
|
||||
|
||||
(2) The way in which notifications are dispatched can be specified as
|
||||
invocation objects instead of just selectors. Invocation objects
|
||||
are more flexible than selectors in that they can hold more context
|
||||
and, if desired, can call C functions instead of sending a message
|
||||
to an object; (this way you may be able to avoid creating a new
|
||||
class just to handle certain notifications).
|
||||
|
||||
(3) Instead of sending +defaultCenter, you can simply send +add...,
|
||||
+remove... and +post... messages directly to the class object.
|
||||
The class uses a static variable directly, instead of taking
|
||||
the time for the extra +defaultCenter method call. It's both
|
||||
easier for the user and more time efficient.
|
||||
|
||||
(4) You can call -addObserver:... with both name and object being
|
||||
nil. This request will receive postings of *all* notifications.
|
||||
Wow.
|
||||
|
||||
Although it offers extra features, the implementation has an
|
||||
OpenStep-style interface also.
|
||||
|
||||
*/
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/LinkedList.h>
|
||||
#include <objects/Array.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
#include <objects/NSString.h>
|
||||
|
||||
@interface NotificationDispatcher : NSObject
|
||||
{
|
||||
/* `nr' stands for Notification Request Object; the interface for
|
||||
this class is defined in the .m file. One of these is created
|
||||
for each -add... call. */
|
||||
|
||||
/* For those observer requests with NAME=nil and OBJECT=nil. */
|
||||
LinkedList *_anonymous_nr_list;
|
||||
/* For those observer requests with NAME=nil and OBJECT!=nil. */
|
||||
NSMapTable *_object_2_nr_list;
|
||||
/* For those observer requests with NAME!=nil, OBJECT may or may not =nil .*/
|
||||
NSMapTable *_name_2_nr_list;
|
||||
|
||||
/* The keys are observers; the values are Array's containing all
|
||||
NotificationInvocation objects associated with the observer key. */
|
||||
NSMapTable *_observer_2_nr_array;
|
||||
}
|
||||
|
||||
|
||||
/* Adding new observers. */
|
||||
|
||||
/* Register INVOCATION to receive future notifictions that match NAME
|
||||
and OBJECT. A nil passed as either NAME or OBJECT acts as a
|
||||
wild-card. If NAME is nil, the NotificationDispatcher will send to
|
||||
the observer all notification pertaining to OBJECT. If OBJECT is
|
||||
nil, the NotificationDispatcher will send to the observer all
|
||||
notification pertaining to NAME. If both OBJECT and NAME are nil,
|
||||
send to the observer all notifications.
|
||||
|
||||
The notification will be posted by sending -invokeWithObject: to
|
||||
INVOCATION argument. The argument of -invokeWithObject: will be a
|
||||
Notification object. This use of Invocation objects is more
|
||||
flexible than using a selector, since Invocation's can be set up
|
||||
with more arguments, hold more context, and can be C functions.
|
||||
|
||||
OBJECT is not retained; this is done so these objects can tell when
|
||||
there are no outstanding non-notification references remaining. If
|
||||
an object may have added itself as an observer, it should call
|
||||
+removeObserver: in its -dealloc method.
|
||||
|
||||
INVOCATION and NAME, however, are retained. */
|
||||
|
||||
- (void) addInvocation: (id <Invoking>)invocation
|
||||
name: (id <String>)name
|
||||
object: object;
|
||||
|
||||
/* Register OBSERVER to receive future notifications that match NAME
|
||||
and OBJECT. A nil passed as either NAME or OBJECT acts as a
|
||||
wild-card. If NAME is nil, the NotificationDispatcher will send to
|
||||
the observer all notification pertaining to OBJECT. If OBJECT is
|
||||
nil, the NotificationDispatcher will send to the observer all
|
||||
notification pertaining to NAME. If both OBJECT and NAME are nil,
|
||||
send to the observer all notifications.
|
||||
|
||||
The notification will be posted by sending -perform:withObject:
|
||||
to the observer, with SEL and a Notification object as arguments.
|
||||
|
||||
Neither OBSERVER nor OBJECT are retained; this is done so these
|
||||
objects can tell when there are no outstanding non-notification
|
||||
references remaining. If an object may have added itself as an
|
||||
observer, it should call +removeObserver: in its -dealloc method.
|
||||
|
||||
INVOCATION and NAME, however, are retained. */
|
||||
|
||||
- (void) addObserver: observer
|
||||
selector: (SEL)sel
|
||||
name: (id <String>)name
|
||||
object: object;
|
||||
|
||||
/* Class versions of the above two methods that send these messages
|
||||
to the default NotificationDispatcher for the class. */
|
||||
|
||||
+ (void) addInvocation: (id <Invoking>)invocation
|
||||
name: (id <String>)name
|
||||
object: object;
|
||||
+ (void) addObserver: observer
|
||||
selector: (SEL)sel
|
||||
name: (id <String>)name
|
||||
object: object;
|
||||
|
||||
|
||||
|
||||
/* Removing observers. */
|
||||
|
||||
/* Remove all notification requests that would be sent to INVOCATION. */
|
||||
|
||||
- (void) removeInvocation: invocation;
|
||||
|
||||
/* Remove the notification requests matching NAME and OBJECT that
|
||||
would be sent to INVOCATION. As with adding an observation
|
||||
request, nil NAME or OBJECT act as wildcards. */
|
||||
|
||||
- (void) removeInvocation: invocation
|
||||
name: (id <String>)name
|
||||
object: object;
|
||||
|
||||
/* Remove all records pertaining to OBSERVER. For instance, this
|
||||
should be called before the OBSERVER is -dealloc'ed. */
|
||||
|
||||
- (void) removeObserver: observer;
|
||||
|
||||
/* Remove the notification requests for the given NAME and OBJECT
|
||||
parameters. As with adding an observation request, nil NAME or
|
||||
OBJECT act as wildcards. */
|
||||
|
||||
- (void) removeObserver: observer
|
||||
name: (id <String>)name
|
||||
object: object;
|
||||
|
||||
/* Class versions of the above four methods that send these messages
|
||||
to the default NotificationDispatcher for the class. */
|
||||
|
||||
+ (void) removeInvocation: invocation;
|
||||
+ (void) removeInvocation: invocation
|
||||
name: (id <String>)name
|
||||
object: object;
|
||||
+ (void) removeObserver: observer;
|
||||
+ (void) removeObserver: observer
|
||||
name: (id <String>)name
|
||||
object: object;
|
||||
|
||||
|
||||
|
||||
/* Post NOTIFICATION to all the observers that match its NAME and OBJECT.
|
||||
The INFO arguent does not have to be a Dictionary. If there is a single
|
||||
object that should be associated with the notification, you can simply
|
||||
pass that single object instead of a Dictionary containing the object. */
|
||||
|
||||
- (void) postNotification: notification;
|
||||
- (void) postNotificationName: (id <String>)name
|
||||
object: object;
|
||||
- (void) postNotificationName: (id <String>)name
|
||||
object: object
|
||||
userInfo: info;
|
||||
|
||||
/* Class versions of the above three methods that send these messages
|
||||
to the default NotificationDispatcher for the class. */
|
||||
|
||||
+ (void) postNotification: notification;
|
||||
+ (void) postNotificationName: (id <String>)name
|
||||
object: object;
|
||||
+ (void) postNotificationName: (id <String>)name
|
||||
object: object
|
||||
userInfo: info;
|
||||
|
||||
+ defaultInstance;
|
||||
|
||||
@end
|
||||
|
||||
@interface NotificationDispatcher (OpenStepCompat)
|
||||
+ defaultCenter;
|
||||
@end
|
||||
|
||||
#endif /* __NotificationDispatcher_h_OBJECTS_INCLUDE */
|
|
@ -1,66 +0,0 @@
|
|||
/* Protocol for Objective-C objects that hold elements, user gets to set order
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: Feb 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* The <OrderedCollecting> protocol inherits from the
|
||||
<KeyedCollecting> protocol.
|
||||
|
||||
The <OrderedCollecting> protocol defines the interface to a
|
||||
collection of elements that are accessible by a key that is an index,
|
||||
where the indeces in a collection are a contiguous series of unsigned
|
||||
integers beginning at 0. This is the root of the protocol heirarchy
|
||||
for all collections that hold their elements in some order. Elements
|
||||
may be accessed, inserted, replaced and removed by their index.
|
||||
*/
|
||||
|
||||
#ifndef __OrderedCollecting_h_OBJECTS_INCLUDE
|
||||
#define __OrderedCollecting_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/IndexedCollecting.h>
|
||||
|
||||
@protocol OrderedCollecting <IndexedCollecting>
|
||||
|
||||
// ADDING;
|
||||
- (void) insertObject: newObject atIndex: (unsigned)index;
|
||||
- (void) insertObject: newObject before: oldObject;
|
||||
- (void) insertObject: newObject after: oldObject;
|
||||
- (void) insertContentsOf: (id <ConstantCollecting>)aCollection
|
||||
atIndex: (unsigned)index;
|
||||
- (void) appendObject: newObject;
|
||||
- (void) prependObject: newObject;
|
||||
- (void) appendContentsOf: (id <ConstantCollecting>)aCollection;
|
||||
- (void) prependContentsOf: (id <ConstantCollecting>)aCollection;
|
||||
|
||||
// SWAPPING AND SORTING
|
||||
- (void) swapAtIndeces: (unsigned)index1 : (unsigned)index2;
|
||||
- (void) sortContents;
|
||||
|
||||
// REPLACING;
|
||||
- (void) replaceRange: (IndexRange)aRange
|
||||
with: (id <ConstantCollecting>)aCollection;
|
||||
- replaceRange: (IndexRange)aRange
|
||||
using: (id <ConstantCollecting>)aCollection;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __OrderedCollecting_h_OBJECTS_INCLUDE */
|
|
@ -1,39 +0,0 @@
|
|||
/* Interface for Objective-C Ordered Collection object.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: February 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __OrderedCollection_h_INCLUDE_GNU
|
||||
#define __OrderedCollection_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/IndexedCollection.h>
|
||||
#include <objects/OrderedCollecting.h>
|
||||
|
||||
@interface OrderedCollection : IndexedCollection
|
||||
@end
|
||||
|
||||
|
||||
/* Put this on category instead of class to avoid bogus complaint from gcc */
|
||||
@interface OrderedCollection (Protocol) <OrderedCollecting>
|
||||
@end
|
||||
|
||||
#endif /* __OrderedCollection_h_INCLUDE_GNU */
|
|
@ -1,47 +0,0 @@
|
|||
/* Protocol for Objective-C objects that can be ordered.
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Ordering_h_INCLUDE_GNU
|
||||
#define __Ordering_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objc/objc.h>
|
||||
|
||||
@protocol Ordering
|
||||
|
||||
- (int) compare: anObject;
|
||||
|
||||
- (BOOL) greaterThan: anObject;
|
||||
- (BOOL) greaterThanOrEqual: anObject;
|
||||
|
||||
- (BOOL) lessThan: anObject;
|
||||
- (BOOL) lessThanOrEqual: anObject;
|
||||
|
||||
- (BOOL) between: firstObject and: secondObject;
|
||||
|
||||
- maximum: anObject;
|
||||
- minimum: anObject;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Ordering_h_INCLUDE_GNU */
|
|
@ -1,125 +0,0 @@
|
|||
/* Interface for abstract superclass port for use with Connection
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Port_h_OBJECTS_INCLUDE
|
||||
#define __Port_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Coding.h>
|
||||
#include <objects/MemoryStream.h>
|
||||
#include <objects/NSString.h>
|
||||
|
||||
/* xxx Use something like this? */
|
||||
@protocol PacketSending
|
||||
@end
|
||||
|
||||
@interface Port : NSObject
|
||||
{
|
||||
unsigned is_valid:1;
|
||||
unsigned tcp_port_filler:7;
|
||||
unsigned retain_count:24;
|
||||
}
|
||||
- (void) invalidate;
|
||||
- (BOOL) isValid;
|
||||
- (void) close;
|
||||
|
||||
+ (Class) outPacketClass;
|
||||
- (Class) outPacketClass;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface InPort : Port
|
||||
{
|
||||
id _packet_invocation;
|
||||
}
|
||||
|
||||
+ newForReceiving;
|
||||
+ newForReceivingFromRegisteredName: (id <String>)name;
|
||||
|
||||
/* Register/Unregister this port for input handling through RunLoop
|
||||
RUN_LOOP in mode MODE. */
|
||||
- (void) addToRunLoop: run_loop forMode: (id <String>)mode;
|
||||
- (void) removeFromRunLoop: run_loop forMode: (id <String>)mode;
|
||||
|
||||
/* When a RunLoop is handling this InPort, and a new incoming
|
||||
packet arrives, INVOCATION will be invoked with the new packet
|
||||
as an argument. The INVOCATION is responsible for releasing
|
||||
the packet. */
|
||||
- (void) setReceivedPacketInvocation: (id <Invoking>)invocation;
|
||||
|
||||
/* An alternative to the above way for receiving packets from this port.
|
||||
Get a packet from the net and return it. If no packet is received
|
||||
within MILLISECONDS, then return nil. The caller is responsible
|
||||
for releasing the packet. */
|
||||
- receivePacketWithTimeout: (int)milliseconds;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface OutPort : Port
|
||||
|
||||
+ newForSendingToRegisteredName: (id <String>)name
|
||||
onHost: (id <String>)hostname;
|
||||
- (BOOL) sendPacket: packet;
|
||||
|
||||
@end
|
||||
|
||||
extern NSString *PortBecameInvalidNotification;
|
||||
|
||||
|
||||
|
||||
/* Objects for holding incoming/outgoing data to/from ports. */
|
||||
|
||||
@interface InPacket : MemoryStream
|
||||
{
|
||||
id _receiving_in_port;
|
||||
id _reply_out_port;
|
||||
}
|
||||
|
||||
- replyOutPort;
|
||||
- receivingInPort;
|
||||
|
||||
/* Do not call this method yourself; it is to be called by subclassers.
|
||||
InPackets are created for you by the InPort object, and are
|
||||
made available as the argument to the received packet invocation. */
|
||||
- initForReceivingWithCapacity: (unsigned)s
|
||||
receivingInPort: ip
|
||||
replyOutPort: op;
|
||||
|
||||
@end
|
||||
|
||||
@interface OutPacket : MemoryStream
|
||||
{
|
||||
id _reply_in_port;
|
||||
}
|
||||
|
||||
- initForSendingWithCapacity: (unsigned)c
|
||||
replyInPort: p;
|
||||
- replyInPort;
|
||||
|
||||
+ (unsigned) prefixSize;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Port_h_OBJECTS_INCLUDE */
|
|
@ -1,82 +0,0 @@
|
|||
/* Interface for GNU Objective-C proxy for remote objects messaging
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Proxy_h_OBJECTS_INCLUDE
|
||||
#define __Proxy_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Connection.h>
|
||||
#include <objects/Retaining.h>
|
||||
|
||||
@class ConnectedCoder;
|
||||
|
||||
@interface Proxy <Retaining>
|
||||
{
|
||||
@public
|
||||
struct objc_class *isa;
|
||||
unsigned _target;
|
||||
Connection *_connection;
|
||||
unsigned _retain_count;
|
||||
#if NeXT_runtime
|
||||
coll_cache_ptr _method_types;
|
||||
Protocol *protocol;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* xxx Change name to newForTarget:connection: */
|
||||
+ newForRemoteTarget: (unsigned)target connection: (Connection*)c;
|
||||
|
||||
- self;
|
||||
#if NeXT_runtime
|
||||
+ class;
|
||||
#else
|
||||
+ (Class) class;
|
||||
#endif
|
||||
|
||||
- (void) invalidateProxy;
|
||||
- (BOOL) isProxy;
|
||||
- (unsigned) targetForProxy;
|
||||
- connectionForProxy;
|
||||
|
||||
- forward: (SEL)aSel :(arglist_t)frame;
|
||||
|
||||
- classForConnectedCoder: aRmc;
|
||||
+ (void) encodeObject: anObject withConnectedCoder: aRmc;
|
||||
|
||||
+ newWithCoder: aCoder;
|
||||
- (void) encodeWithCoder: aCoder;
|
||||
|
||||
/* Only needed with NeXT runtime. */
|
||||
- (const char *) selectorTypeForProxy: (SEL)selector;
|
||||
|
||||
@end
|
||||
|
||||
@interface Object (IsProxy)
|
||||
- (BOOL) isProxy;
|
||||
@end
|
||||
|
||||
@interface Protocol (RemoteSelfCoding)
|
||||
- classForConnectedCoder: aRmc;
|
||||
@end
|
||||
|
||||
#endif /* __Proxy_h_OBJECTS_INCLUDE */
|
|
@ -1,37 +0,0 @@
|
|||
/* Interface for Objective-C Queue object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Queue_h_INCLUDE_GNU
|
||||
#define __Queue_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/CircularArray.h>
|
||||
|
||||
@interface Queue : CircularArray
|
||||
|
||||
- (void) enqueueObject: newObject;
|
||||
- dequeueObject;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Queue_h_INCLUDE_GNU */
|
|
@ -1,40 +0,0 @@
|
|||
/* Interface for Objective-C Red-Black Tree collection object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __RBTree_h_INCLUDE_GNU
|
||||
#define __RBTree_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/BinaryTree.h>
|
||||
|
||||
@protocol RBTreeComprising <BinaryTreeComprising>
|
||||
- (BOOL) isRed;
|
||||
- setRed;
|
||||
- setBlack;
|
||||
@end
|
||||
|
||||
@interface RBTree : BinaryTree
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __RBTree_h_INCLUDE_GNU */
|
|
@ -1,35 +0,0 @@
|
|||
/* Interface for Objective-C RBTreeEltNode object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __RBTreeEltNode_h_INCLUDE_GNU
|
||||
#define __RBTreeEltNode_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/RBTreeNode.h>
|
||||
#include <objects/EltNodeCollector.h>
|
||||
|
||||
@interface RBTreeEltNode : RBTreeNode
|
||||
#include <objects/EltNode-h>
|
||||
@end
|
||||
|
||||
#endif /* __RBTreeEltNode_h_INCLUDE_GNU */
|
|
@ -1,37 +0,0 @@
|
|||
/* Interface for Objective-C RBTreeNode object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __RBTreeNode_h_INCLUDE_GNU
|
||||
#define __RBTreeNode_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/BinaryTreeNode.h>
|
||||
#include <objects/RBTree.h>
|
||||
|
||||
@interface RBTreeNode : BinaryTreeNode <RBTreeComprising>
|
||||
{
|
||||
BOOL _red;
|
||||
}
|
||||
@end
|
||||
|
||||
#endif /* __RBTreeNode_h_INCLUDE_GNU */
|
|
@ -1,8 +0,0 @@
|
|||
This directory contains header files for the GNU Objective C Class
|
||||
Library, `libobjects'.
|
||||
|
||||
The complete list of include file directories belonging to libobjects
|
||||
is:
|
||||
../objects
|
||||
../objc
|
||||
../Foundation
|
|
@ -1,44 +0,0 @@
|
|||
/* Interface for additive congruential pseudo-random num generating
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* Additive Congruential Method,
|
||||
from Robert Sedgewick, "Algorithms" */
|
||||
|
||||
#ifndef __RNGAdditiveCongruential_h_INCLUDE_GNU
|
||||
#define __RNGAdditiveCongruential_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/RandomGenerating.h>
|
||||
|
||||
@interface RNGAdditiveCongruential : NSObject <RandomGenerating>
|
||||
{
|
||||
long *table;
|
||||
int table_size;
|
||||
int tap1;
|
||||
int tap2;
|
||||
int index;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __RNGAdditiveCongruential_h_INCLUDE_GNU */
|
|
@ -1,74 +0,0 @@
|
|||
/* Interface for Berkeley random()-compatible generation for Objective-C
|
||||
|
||||
Reworked by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __RNGBerkeley_h_INCLUDE_GNU
|
||||
#define __RNGBerkeley_h_INCLUDE_GNU
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is derived from the Berkeley source:
|
||||
* @(#)random.c 5.5 (Berkeley) 7/6/88
|
||||
* It was reworked for the GNU C Library by Roland McGrath.
|
||||
* It was reworked for the GNU Objective-C Library by R. Andrew McCallum
|
||||
*/
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/RandomGenerating.h>
|
||||
|
||||
@interface RNGBerkeley : NSObject <RandomGenerating>
|
||||
{
|
||||
int foo[2];
|
||||
long int randtbl[32]; /* Size must match DEG_3 + 1 from RNGBerkeley.m */
|
||||
long int *fptr;
|
||||
long int *rptr;
|
||||
long int *state;
|
||||
int rand_type;
|
||||
int rand_deg;
|
||||
int rand_sep;
|
||||
long int *end_ptr;
|
||||
}
|
||||
|
||||
- (void) _srandom: (unsigned int)x;
|
||||
- (void*) _initstateSeed: (unsigned int)seed
|
||||
state: (void*)arg_state
|
||||
size: (size_t)n;
|
||||
- (void*) _setstate: (void*)arg_state;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __RNGBerkeley_h_INCLUDE_GNU */
|
|
@ -1,69 +0,0 @@
|
|||
/* Interface for Objective-C object providing randoms in uniform distribution
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Random_h_INCLUDE_GNU
|
||||
#define __Random_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/RandomGenerating.h>
|
||||
|
||||
@interface Random : NSObject
|
||||
{
|
||||
id <RandomGenerating> rng;
|
||||
}
|
||||
|
||||
+ initialize;
|
||||
+ (id <RandomGenerating>) defaultRandomGeneratorClass;
|
||||
+ setDefaultRandomGeneratorClass: (id <RandomGenerating>)aRNG;
|
||||
|
||||
+ (float) chiSquareOfRandomGenerator: (id <RandomGenerating>)aRNG
|
||||
iterations: (int)n
|
||||
range: (long)r;
|
||||
+ (float) chiSquareOfRandomGenerator: (id <RandomGenerating>)aRNG;
|
||||
|
||||
- init;
|
||||
|
||||
- setRandomSeedFromClock;
|
||||
- setRandomSeed: (long)seed;
|
||||
|
||||
- (long) randomInt;
|
||||
- (long) randomIntBetween: (long)lowBound and: (long)highBound;
|
||||
- (long) randomDie: (long)numSides; /* between 0 and numSides-1 */
|
||||
|
||||
- (BOOL) randomCoin;
|
||||
- (BOOL) randomCoinWithProbability: (double)p;
|
||||
|
||||
- (float) randomFloat;
|
||||
- (float) randomFloatBetween: (float)lowBound and: (float)highBound;
|
||||
- (float) randomFloatProbability;
|
||||
|
||||
- (double) randomDouble;
|
||||
- (double) randomDoubleBetween: (double)lowBound and: (double)highBound;
|
||||
- (double) randomDoubleProbability;
|
||||
|
||||
- read: (TypedStream*)aStream;
|
||||
- write: (TypedStream*)aStream;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Random_h_INCLUDE_GNU */
|
|
@ -1,36 +0,0 @@
|
|||
/* Protocol for Objective-C objects that generate random bits
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __RandomGenerating_h_INCLUDE_GNU
|
||||
#define __RandomGenerating_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
@protocol RandomGenerating <NSObject, NSCoding>
|
||||
|
||||
- (void) setRandomSeed: (long)seed;
|
||||
- (long) nextRandom;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __RandomGenerating_h_INCLUDE_GNU */
|
|
@ -1,37 +0,0 @@
|
|||
/* Interface for GNU Objective-C raw stream object for archiving
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Written: Jan 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __RawCStream_h_OBJECTS_INCLUDE
|
||||
#define __RawCStream_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Stream.h>
|
||||
#include <objects/CStream.h>
|
||||
|
||||
@interface RawCStream : CStream
|
||||
|
||||
+ setDebugging: (BOOL)f;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __RawCStream_h_OBJECTS_INCLUDE */
|
|
@ -1,100 +0,0 @@
|
|||
/* Protocol for GNU Objective-C objects that can keep a retain count.
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Retaining_h_OBJECTS_INCLUDE
|
||||
#define __Retaining_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
@protocol Retaining
|
||||
|
||||
- retain;
|
||||
|
||||
/* Use this message when the sender did not allocate the receiving
|
||||
object, but the sender wants to keep a reference to the receiving
|
||||
object. It increments a reference count for the object. The
|
||||
object will not be deallocated until after a matching release
|
||||
message is sent to this object.
|
||||
|
||||
IMPORTANT PROGRAMMING CONVENTION: There is no need to send this
|
||||
message to objects that the sender allocated---allocating an object
|
||||
already implies that the object will not be deallocated until the
|
||||
sender releases it. Just as "retain" and "release" messages cancel
|
||||
each other, one "release" message is needed to cancel the original
|
||||
allocation. */
|
||||
|
||||
|
||||
- (oneway void) release;
|
||||
|
||||
/* Use this message when the sender is done with the receiving object.
|
||||
If the sender had the last reference to the object, the object will
|
||||
be deallocated by sending "dealloc" to it.
|
||||
|
||||
IMPORTANT PROGRAMMING CONVENTION: The sender should only send this
|
||||
to objects that it has allocated or has retain'ed. */
|
||||
|
||||
|
||||
- (void) dealloc;
|
||||
|
||||
/* This method deallocates the memory for this object. You should not
|
||||
send this message yourself; it is sent for you by the release
|
||||
method, which properly manages retain counts. Do, however,
|
||||
override this method to deallocate any memory allocated by this
|
||||
object during initialization; the overriding method should call
|
||||
[super dealloc] at the end. */
|
||||
|
||||
|
||||
- (unsigned) retainCount;
|
||||
|
||||
/* This method returns the retain count to this object. It does
|
||||
not, however, include the decrements due to stackRelease's. Note
|
||||
that the returned number is not quite a "reference count" in the
|
||||
traditional sense; it is less by one in that it is actually a count
|
||||
of the number of unreleased retain messages sent. A retainCount of
|
||||
zero implies that there is still one more release necessary to
|
||||
deallocate the receiver. For example, after an object is created,
|
||||
its retainCount is zero, but another "release" message is still
|
||||
required before the object will be deallocated. */
|
||||
|
||||
|
||||
- autorelease;
|
||||
|
||||
/* Use this message when the sender is done with this object, but the
|
||||
sender doesn't want the object to be deallocated immediately
|
||||
because the function that sends this message will use this object
|
||||
as its return value. The object will be queued to receive the
|
||||
actual "release" message later.
|
||||
|
||||
Due to this delayed release, the function that receives the object
|
||||
as a return value will have the opportunity to retain the object
|
||||
before the "release" instigated by the "autorelease" actually
|
||||
takes place.
|
||||
|
||||
For the object to be autoreleased, you must have previously created
|
||||
a AutoreleasePool or an AutoreleaseStack. If you don't, however,
|
||||
your program won't crash, the release corresponding to the
|
||||
autorelease will just never happen. */
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Retaining_h_OBJECTS_INCLUDE */
|
|
@ -1,57 +0,0 @@
|
|||
/* Interface for reference-counted invalidation notifer object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* Reference Counted object with invalidation notification
|
||||
This object is just temporary. Eventually, we should separate
|
||||
reference counting functionality from notification functionality */
|
||||
|
||||
/* xxx March 1995: Now that we have a root object that handles retaining,
|
||||
we should create a plain Notifier class. */
|
||||
|
||||
#ifndef __RetainingNotifier_h
|
||||
#define __RetainingNotifier_h
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Lock.h>
|
||||
#include <objects/InvalidationListening.h>
|
||||
#include <objects/Retaining.h>
|
||||
|
||||
@interface RetainingNotifier : NSObject <Retaining>
|
||||
{
|
||||
Lock *refGate;
|
||||
id *notificationList;
|
||||
BOOL isValid;
|
||||
int retain_count;
|
||||
}
|
||||
|
||||
- init;
|
||||
- (unsigned) retainCount;
|
||||
- registerForInvalidationNotification: (id <InvalidationListening>)anObject;
|
||||
- unregisterForInvalidationNotification: (id <InvalidationListening>)anObject;
|
||||
- (BOOL) isValid;
|
||||
- invalidate;
|
||||
- copy;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __RetainingNotifier_h */
|
|
@ -1,62 +0,0 @@
|
|||
#ifndef __RunLoop_h_OBJECTS_INCLUDE
|
||||
#define __RunLoop_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/NotificationDispatcher.h>
|
||||
#include <objects/Set.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@interface RunLoop : NSObject
|
||||
{
|
||||
id _current_mode;
|
||||
NSMapTable *_mode_2_timers;
|
||||
NSMapTable *_mode_2_in_ports;
|
||||
NSMapTable *_mode_2_fd_listeners;
|
||||
}
|
||||
|
||||
- (void) addPort: port
|
||||
forMode: (id <String>)mode;
|
||||
- (void) removePort: port
|
||||
forMode: (id <String>)mode;
|
||||
|
||||
- (void) addTimer: timer forMode: (id <String>)mode;
|
||||
|
||||
- limitDateForMode: (id <String>)mode;
|
||||
- (void) acceptInputForMode: (id <String>)mode
|
||||
beforeDate: date;
|
||||
- (id <String>) currentMode;
|
||||
|
||||
- (void) run;
|
||||
- (void) runUntilDate: limit_date;
|
||||
- (BOOL) runOnceBeforeDate: date;
|
||||
- (BOOL) runOnceBeforeDate: date forMode: (id <String>)mode;
|
||||
|
||||
+ (void) run;
|
||||
+ (void) runUntilDate: date;
|
||||
+ (void) runUntilDate: date forMode: (id <String>)mode;
|
||||
+ (BOOL) runOnceBeforeDate: date;
|
||||
+ (BOOL) runOnceBeforeDate: date forMode: (id <String>)mode;
|
||||
|
||||
+ currentInstance;
|
||||
+ (id <String>) currentMode;
|
||||
|
||||
@end
|
||||
|
||||
/* Mode strings. */
|
||||
extern id RunLoopDefaultMode;
|
||||
|
||||
/* xxx This interface will probably change. */
|
||||
@protocol FdListening
|
||||
- (void) readyForReadingOnFileDescriptor: (int)fd;
|
||||
@end
|
||||
|
||||
/* xxx This interface will probably change. */
|
||||
@interface NSObject (OptionalPortRunLoop)
|
||||
/* If a InPort object responds to this, it is sent just before we are
|
||||
about to wait listening for input.
|
||||
This interface will probably change. */
|
||||
- (void) getFds: (int*)fds count: (int*)count;
|
||||
@end
|
||||
|
||||
#endif /* __RunLoop_h_OBJECTS_INCLUDE */
|
|
@ -1,53 +0,0 @@
|
|||
/* Interface for Objective-C Set collection object
|
||||
Copyright (C) 1993,1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Set_h_OBJECTS_INCLUDE
|
||||
#define __Set_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Collection.h>
|
||||
#include <Foundation/NSHashTable.h>
|
||||
|
||||
@interface Set : Collection
|
||||
{
|
||||
NSHashTable *_contents_hash; // a hashtable to hold the contents;
|
||||
}
|
||||
|
||||
// MANAGING CAPACITY;
|
||||
+ (unsigned) defaultCapacity;
|
||||
|
||||
// INITIALIZING AND FREEING;
|
||||
- initWithCapacity: (unsigned)aCapacity;
|
||||
|
||||
// SET OPERATIONS;
|
||||
- (void) intersectWithCollection: (id <Collecting>)aCollection;
|
||||
- (void) unionWithCollection: (id <Collecting>)aCollection;
|
||||
- (void) differenceWithCollection: (id <Collecting>)aCollection;
|
||||
|
||||
- shallowCopyIntersectWithCollection: (id <Collecting>)aCollection;
|
||||
- shallowCopyUnionWithCollection: (id <Collecting>)aCollection;
|
||||
- shallowCopyDifferenceWithCollection: (id <Collecting>)aCollection;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Set_h_OBJECTS_INCLUDE */
|
|
@ -1,39 +0,0 @@
|
|||
/* Interface for Objective-C efficient small integers
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: Sep 1995
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SmallInt_h_INCLUDE_GNU
|
||||
#define __SmallInt_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
#define IS_SMALLINT(OBJ) (((void*)OBJ) & 0x1)
|
||||
#define ID2INT(OBJ) ((IS_SMALLINT(OBJ)) ? (((int)OBJ) >> 1):[OBJ intValue])
|
||||
#define INT2ID(I) ((id)((I << 1) & 0x1))
|
||||
|
||||
@interface SmallInt : NSObject
|
||||
|
||||
-
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __SmallInt_h_INCLUDE_GNU */
|
|
@ -1,60 +0,0 @@
|
|||
/* Interface for socket-based port object for use with Connection
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SocketPort_h_INCLUDE_GNU
|
||||
#define __SocketPort_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Port.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef WIN32
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
#endif /* !WIN32 */
|
||||
|
||||
typedef struct sockaddr_in sockport_t;
|
||||
|
||||
@interface SocketPort : Port
|
||||
{
|
||||
sockport_t sockPort;
|
||||
int sock; /* socket if local, 0 if remote */
|
||||
BOOL close_on_dealloc;
|
||||
}
|
||||
|
||||
|
||||
+ newForSockPort: (sockport_t)s close: (BOOL)f;
|
||||
+ newForSockPort: (sockport_t)s;
|
||||
+ newLocalWithNumber: (int)n;
|
||||
+ newLocal;
|
||||
+ newRemoteWithNumber: (int)n onHost: (id <String>)h;
|
||||
|
||||
- (sockport_t) sockPort;
|
||||
|
||||
- (int) socket;
|
||||
- (int) socketPortNumber;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __SocketPort_h_INCLUDE_GNU */
|
|
@ -1,48 +0,0 @@
|
|||
/* Interface for Objective-C SplayTree collection object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
Splay Tree.
|
||||
Sleator and Tarjan. "Self-adjusting binary search trees."
|
||||
Journal of the ACM, 32(3):652-686, 1985.
|
||||
|
||||
includesObject:, minObject, maxObject, nextObject:, sortAddObject,
|
||||
and removeObject: operations can all be done in O(lg n) amortized time.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __SplayTree_h_INCLUDE_GNU
|
||||
#define __SplayTree_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/BinaryTree.h>
|
||||
|
||||
@interface SplayTree : BinaryTree
|
||||
{
|
||||
}
|
||||
|
||||
- (void) splayNode: aNode;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __SplayTree_h_INCLUDE_GNU */
|
|
@ -1,41 +0,0 @@
|
|||
/* Interface for Objective-C Stack object
|
||||
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Stack_h_INCLUDE_GNU
|
||||
#define __Stack_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Array.h>
|
||||
|
||||
@interface Stack : Array
|
||||
|
||||
- (void) pushObject: anObject;
|
||||
- popObject;
|
||||
- topObject;
|
||||
- (void) duplicateTop;
|
||||
- (void) exchangeTop;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Stack_h_INCLUDE_GNU */
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/* Interface for GNU Objective C stdio stream
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __StdioStream_h__OBJECTS_INCLUDE
|
||||
#define __StdioStream_h__OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Stream.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@interface StdioStream : Stream
|
||||
{
|
||||
int mode;
|
||||
FILE *fp;
|
||||
}
|
||||
|
||||
+ standardIn;
|
||||
+ standardOut;
|
||||
+ standardError;
|
||||
|
||||
+ streamWithFilename: (id <String>)name fmode: (const char *)m;
|
||||
/* xxx Add the others too. */
|
||||
|
||||
- initWithFilePointer: (FILE*)afp fmode: (const char *)m;
|
||||
- initWithFilename: (id <String>)name fmode: (const char *)m;
|
||||
- initWithFileDescriptor: (int)fd fmode: (const char *)m;
|
||||
|
||||
- initWithPipeTo: (id <String>)systemCommand;
|
||||
- initWithPipeFrom: (id <String>)systemCommand;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __StdioStream_h__OBJECTS_INCLUDE */
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/* Interface for GNU Objective C byte stream
|
||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Stream_h__OBJECTS_INCLUDE
|
||||
#define __Stream_h__OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Streaming.h>
|
||||
|
||||
@interface Stream : NSObject <Streaming>
|
||||
|
||||
- init;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Stream_h__OBJECTS_INCLUDE */
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/* Protocol for GNU Objective C byte streams
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: April 1995
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __Streaming_h__OBJECTS_INCLUDE
|
||||
#define __Streaming_h__OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/NSString.h>
|
||||
|
||||
@protocol Streaming <NSObject>
|
||||
|
||||
- (int) writeByte: (unsigned char)b;
|
||||
- (int) readByte: (unsigned char*)b;
|
||||
|
||||
- (int) writeBytes: (const void*)b length: (int)l;
|
||||
- (int) readBytes: (void*)b length: (int)l;
|
||||
|
||||
- (int) writeFormat: (id <String>)format, ...;
|
||||
- (int) readFormat: (id <String>)format, ...;
|
||||
- (int) writeFormat: (id <String>)format arguments: (va_list)arg;
|
||||
- (int) readFormat: (id <String>)format arguments: (va_list)arg;
|
||||
|
||||
- (void) writeLine: (id <String>)l;
|
||||
- (id <String>) readLine;
|
||||
|
||||
- (unsigned) streamPosition;
|
||||
- (BOOL) isAtEof;
|
||||
- (void) flushStream;
|
||||
|
||||
/* We must separate the idea of "closing" a stream and "deallocating" a
|
||||
stream because of delays in deallocation due to -autorelease. */
|
||||
- (void) close;
|
||||
- (BOOL) isClosed;
|
||||
|
||||
- (BOOL) isWritable;
|
||||
|
||||
@end
|
||||
|
||||
@protocol SeekableStreaming
|
||||
|
||||
- (void) rewindStream;
|
||||
- (void) setStreamPosition: (unsigned)i;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#endif /* __Streaming_h__OBJECTS_INCLUDE */
|
||||
|
|
@ -1,182 +0,0 @@
|
|||
/* Some preliminary ideas about what a String class might look like.
|
||||
Copyright (C) 1993,1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __String_h_OBJECTS_INCLUDE
|
||||
#define __String_h_OBJECTS_INCLUDE
|
||||
|
||||
/* xxx These method names need to be fixed because we will get
|
||||
type conflicts with GNUSTEP.
|
||||
Perhaps I'll just get rid of the GNU String objects and just
|
||||
transfer this functionality into NSSTring and friends. */
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/IndexedCollection.h>
|
||||
#include <objects/ValueHolding.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef unsigned short Character;
|
||||
|
||||
@class String;
|
||||
@class ConstantString;
|
||||
@class MutableString;
|
||||
|
||||
/* Like in SmallTalk, the String class is a subclass of Collection---a
|
||||
collection of characters. So, all the collection methods are
|
||||
available. Nice. */
|
||||
|
||||
/* Think about changing these names to avoid conflicts with OpenStep? */
|
||||
|
||||
@protocol String <NSObject, ValueGetting, IndexedCollecting, NSString>
|
||||
|
||||
// INITIALIZING NEWLY ALLOCATED STRINGS. DON'T FORGET TO RELEASE THEM!;
|
||||
- init;
|
||||
- initWithString: (id <String>)aString;
|
||||
- initWithString: (id <String>)aString range: (IndexRange)aRange;
|
||||
- initWithFormat: (id <String>)aFormatString, ...;
|
||||
- initWithFormat: (id <String>)aFormatString arguments: (va_list)arg;
|
||||
- initWithCString: (const char*)aCharPtr;
|
||||
- initWithCString: (const char*)aCharPtr range: (IndexRange)aRange;
|
||||
//- initWithStream: (Stream*)aStream;
|
||||
//- initWithStream: (Stream*)aStream length: (unsigned)aLength;
|
||||
|
||||
// GETTING NEW, AUTORELEASED STRING OBJECTS, NO NEED TO RELEASE THESE;
|
||||
+ stringWithString: (id <String>)aString;
|
||||
+ stringWithString: (id <String>)aString range: (IndexRange)aRange;
|
||||
+ stringWithFormat: (id <String>)aFormatString, ...;
|
||||
+ stringWithFormat: (id <String>)aFormatString arguments: (va_list)arg;
|
||||
+ stringWithCString: (const char*)aCharPtr;
|
||||
+ stringWithCString: (const char*)aCharPtr range: (IndexRange)aRange;
|
||||
+ stringWithCStringNoCopy: (const char*)aCharPtr
|
||||
freeWhenDone: (BOOL) f;
|
||||
+ stringWithCStringNoCopy: (const char*)aCharPtr;
|
||||
|
||||
- stringByAppendingFormat: (id <String>)aString, ...;
|
||||
- stringByAppendingFormat: (id <String>)aString arguments: (va_list)arg;
|
||||
- stringByPrependingFormat: (id <String>)aString, ...;
|
||||
- stringByPrependingFormat: (id <String>)aString arguments: (va_list)arg;
|
||||
- stringByAppendingString: (id <String>)aString;
|
||||
- stringByPrependingString: (id <String>)aString;
|
||||
|
||||
//- substringWithRange: (IndexRange)aRange;
|
||||
//- substringWithLength: (unsigned)l;
|
||||
//- substringAfterIndex: (unsigned)i;
|
||||
//- (id <IndexedCollecting>) substringsSeparatedByString: (id <String>)sep;
|
||||
|
||||
//- capitalizedString;
|
||||
//- lowercaseString;
|
||||
//- uppercaseString;
|
||||
|
||||
- mutableCopy;
|
||||
- copy;
|
||||
|
||||
// QUERYING
|
||||
- (unsigned) length;
|
||||
- (IndexRange) range;
|
||||
- (BOOL) isEqual: anObject;
|
||||
- (unsigned) hash;
|
||||
- (int) compare: anObject;
|
||||
- copy;
|
||||
- (unsigned) indexOfString: (id <String>)aString;
|
||||
- (unsigned) indexOfChar: (char)aChar;
|
||||
- (unsigned) indexOfLastChar: (char)aChar;
|
||||
//- (unsigned) indexOfCharacter: (Character)aChar;
|
||||
//- (unsigned) indexOfLastCharacter: (Character)aChar;
|
||||
|
||||
// GETTING C CHARS;
|
||||
- (char) charAtIndex: (unsigned)index;
|
||||
- (const char *) cString;
|
||||
- (const char *) cStringNoCopy;
|
||||
- (unsigned) cStringLength;
|
||||
- (void) getCString: (char*)buffer;
|
||||
- (void) getCString: (char*)buffer range: (IndexRange)aRange;
|
||||
|
||||
// FOR FILE NAMES (don't use the name "path", gnu will not use it for this);
|
||||
//- (IndexRange) fileRange;
|
||||
//- (IndexRange) directoriesRange;
|
||||
//- (IndexRange) extensionRange;
|
||||
//- (IndexRange) fileWithoutExtensionRange;
|
||||
//- (BOOL) isAbsolute;
|
||||
//- (BOOL) isRelative;
|
||||
|
||||
@end
|
||||
|
||||
@protocol MutableString <ValueSetting>
|
||||
|
||||
+ stringWithCapacity: (unsigned)capacity;
|
||||
- initWithCapacity: (unsigned)capacity;
|
||||
|
||||
/* This from IndexedCollecting: - removeRange: (IndexRange)range; */
|
||||
- (void) insertString: (id <String>)string atIndex: (unsigned)index;
|
||||
|
||||
- (void) setString: (id <String>)string;
|
||||
- (void) appendString: (id <String>)string;
|
||||
- (void) replaceRange: (IndexRange)range withString: (id <String>)string;
|
||||
|
||||
@end
|
||||
|
||||
/* Abstract string classes */
|
||||
|
||||
@interface String : IndexedCollection
|
||||
@end
|
||||
|
||||
/* To prevent complaints about protocol conformance. */
|
||||
@interface String (StringProtocol) <String>
|
||||
@end
|
||||
|
||||
@interface MutableString : String
|
||||
@end
|
||||
|
||||
/* To prevent complaints about protocol conformance. */
|
||||
@interface MutableString (MutableStringProtocol) <MutableString>
|
||||
@end
|
||||
|
||||
/* Some concrete string classes */
|
||||
|
||||
@interface CString : String
|
||||
{
|
||||
char * _contents_chars;
|
||||
int _count;
|
||||
BOOL _free_contents;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface MutableCString : MutableString
|
||||
{
|
||||
char *_contents_chars;
|
||||
int _count;
|
||||
BOOL _free_contents;
|
||||
int _capacity;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface ConstantString : CString
|
||||
@end
|
||||
|
||||
#if 0 /* Moved to foundation/NSString.h */
|
||||
/* The compiler makes @""-strings into NXConstantString's */
|
||||
@interface NXConstantString : ConstantString
|
||||
@end
|
||||
#endif /* 0 */
|
||||
|
||||
#endif /* __String_h_OBJECTS_INCLUDE */
|
|
@ -1,92 +0,0 @@
|
|||
/* Interface for stream based on TCP sockets
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: February 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __TcpPort_h__OBJECTS_INCLUDE
|
||||
#define __TcpPort_h__OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Port.h>
|
||||
#include <objects/RunLoop.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
|
||||
/* A concrete implementation of a Port object implemented on top of
|
||||
SOCK_STREAM connections. */
|
||||
|
||||
@interface TcpInPort : InPort
|
||||
{
|
||||
int _socket;
|
||||
struct sockaddr_in _listening_address;
|
||||
NSMapTable *_client_sock_2_out_port;
|
||||
NSMapTable *_client_sock_2_packet;
|
||||
}
|
||||
|
||||
+ newForReceivingFromPortNumber: (unsigned short)n;
|
||||
|
||||
/* Get a packet from the net and return it. If no packet is received
|
||||
within MILLISECONDS, then return nil. The caller is responsible
|
||||
for releasing the packet. */
|
||||
- newPacketReceivedBeforeDate: date;
|
||||
|
||||
- (int) portNumber;
|
||||
- (id <Collecting>) connectedOutPorts;
|
||||
- (unsigned) numberOfConnectedOutPorts;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface TcpOutPort : OutPort
|
||||
{
|
||||
int _socket;
|
||||
/* This is actually the address of the listen()'ing socket of the remote
|
||||
TcpInPort we are connected to, not the address of the _socket ivar. */
|
||||
struct sockaddr_in _remote_in_port_address;
|
||||
/* This is the address of our remote peer socket. */
|
||||
struct sockaddr_in _peer_address;
|
||||
/* The TcpInPort that is polling our _socket with select(). */
|
||||
id _polling_in_port;
|
||||
}
|
||||
|
||||
+ newForSendingToPortNumber: (unsigned short)n
|
||||
onHost: (id <String>)hostname;
|
||||
- (int) portNumber;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/* Holders of sent and received data. */
|
||||
|
||||
@interface TcpInPacket : InPacket
|
||||
@end
|
||||
@interface TcpOutPacket : OutPacket
|
||||
@end
|
||||
|
||||
|
||||
/* Notification Strings. */
|
||||
extern NSString *InPortClientBecameInvalidNotification;
|
||||
extern NSString *InPortAcceptedClientNotification;
|
||||
|
||||
#endif /* __TcpPort_h__OBJECTS_INCLUDE */
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/* Interface for GNU Objective-C text stream object for use serializing
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Written: Jan 1996
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __TextCStream_h_OBJECTS_INCLUDE
|
||||
#define __TextCStream_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Stream.h>
|
||||
#include <objects/CStream.h>
|
||||
|
||||
@interface TextCStream : CStream
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __TextCStream_h_OBJECTS_INCLUDE */
|
|
@ -1,102 +0,0 @@
|
|||
/* Interface for Objective-C Time object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* This is a combination of Smalltalk's Time and Date objects */
|
||||
|
||||
#ifndef __Time_h_OBJECTS_INCLUDE
|
||||
#define __Time_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Magnitude.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef _SEQUENT_
|
||||
/* Include needed for getclock() in our replacement for gettimeofday() */
|
||||
#include <sys/timers.h>
|
||||
|
||||
/* Include needed for tzset() in our replacement for gettimeofday() */
|
||||
#include <time.h>
|
||||
|
||||
/* Sequent does not define struct timezone in any of it's header files */
|
||||
struct timezone {
|
||||
int tz_minuteswest;
|
||||
int tz_dsttime;
|
||||
};
|
||||
#endif /* _SEQUENT_ */
|
||||
|
||||
@interface Time : Magnitude
|
||||
{
|
||||
struct timeval tv; /* seconds and useconds */
|
||||
struct timezone tz; /* minutes from Greenwich, and correction */
|
||||
}
|
||||
|
||||
/* Change these names? */
|
||||
+ (long) secondClockValue;
|
||||
+ getClockValueSeconds: (long *)sec microseconds: (long *)usec;
|
||||
|
||||
+ (long) millisecondsToRun: (void(*)())aFunc;
|
||||
+ getSeconds: (long *)sec microseconds: (long *)usec toRun: (void(*)())aFunc;
|
||||
|
||||
+ (unsigned) indexOfDayName: (const char *)dayName;
|
||||
+ (const char *) nameOfDayIndex: (unsigned)dayIndex;
|
||||
+ (unsigned) indexOfMonthName: (const char *)monthName;
|
||||
+ (const char *) nameOfMonthIndex: (unsigned)monthIndex;
|
||||
+ (unsigned) daysInMonthIndex: (unsigned)monthIndex forYear: (unsigned)year;
|
||||
+ (unsigned) daysInYear: (unsigned)year;
|
||||
+ (BOOL) leapYear: (unsigned)year;
|
||||
|
||||
- initNow;
|
||||
- initDayIndex: (unsigned)dayIndex
|
||||
monthIndex: (unsigned)monthIndex
|
||||
year: (unsigned)year;
|
||||
- initSeconds: (long)numSeconds microseconds: (long)numMicroseconds;
|
||||
- initSeconds: (long)numSeconds;
|
||||
|
||||
- setSeconds: (long)numSeconds microseconds: (long)numMicroseconds;
|
||||
- setSeconds: (long)numSeconds;
|
||||
|
||||
- (long) days;
|
||||
- (long) hours;
|
||||
- (long) minutes;
|
||||
- (long) seconds;
|
||||
- (long) microseconds;
|
||||
|
||||
- addTime: (Time*)aTimeObj;
|
||||
- addDays: (unsigned)num;
|
||||
- addHours: (unsigned)num;
|
||||
- addMinutes: (unsigned)num;
|
||||
- addSeconds: (unsigned)num;
|
||||
|
||||
- subtractTime: (Time*)aTimeObj;
|
||||
- subtractDays: (unsigned)num;
|
||||
- subtractHours: (unsigned)num;
|
||||
- subtractMinutes: (unsigned)num;
|
||||
- subtractSeconds: (unsigned)num;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Time_h_OBJECTS_INCLUDE */
|
|
@ -1,61 +0,0 @@
|
|||
/* Interface for socket-based port object for use with Connection
|
||||
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: July 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __UdpPort_h_INCLUDE_GNU
|
||||
#define __UdpPort_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objects/Port.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef WIN32
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
#endif /* !WIN32 */
|
||||
|
||||
@interface UdpInPort : InPort
|
||||
{
|
||||
int _socket;
|
||||
struct sockaddr_in _address;
|
||||
}
|
||||
|
||||
- (int) portNumber;
|
||||
- (int) socket;
|
||||
|
||||
@end
|
||||
|
||||
@interface UdpOutPort : OutPort
|
||||
{
|
||||
struct sockaddr_in _address;
|
||||
}
|
||||
|
||||
- (int) portNumber;
|
||||
- (id <String>) hostname;
|
||||
|
||||
@end
|
||||
|
||||
@interface UdpInPacket : InPacket
|
||||
@end
|
||||
@interface UdpOutPacket : OutPacket
|
||||
@end
|
||||
|
||||
#endif /* __UdpPort_h_INCLUDE_GNU */
|
|
@ -1,50 +0,0 @@
|
|||
/* Protocol for Objective-C objects that hold numerical and/or string values.
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: May 1993
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __ValueHolding_h_INCLUDE_GNU
|
||||
#define __ValueHolding_h_INCLUDE_GNU
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
/* protocol String; */
|
||||
|
||||
@protocol ValueGetting
|
||||
- (int) intValue;
|
||||
- (float) floatValue;
|
||||
- (double) doubleValue;
|
||||
- (const char *) cStringValue;
|
||||
- /* (id <String>) */ stringValue;
|
||||
@end
|
||||
|
||||
@protocol ValueSetting
|
||||
- (void) setIntValue: (int)anInt;
|
||||
- (void) setFloatValue: (float)aFloat;
|
||||
- (void) setDoubleValue: (double)aDouble;
|
||||
- (void) setCStringValue: (const char *)aCString;
|
||||
- (void) setStringValue: /* (id <String>) */ aString;
|
||||
@end
|
||||
|
||||
@protocol ValueHolding <ValueGetting, ValueSetting>
|
||||
@end
|
||||
|
||||
#endif /* __ValueHolding_h_INCLUDE_GNU */
|
|
@ -1,248 +0,0 @@
|
|||
/* A sparse array structure.
|
||||
* Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: Thu Mar 2 02:30:02 EST 1994
|
||||
* Updated: Tue Mar 12 02:42:54 EST 1996
|
||||
* Serial: 96.03.12.13
|
||||
*
|
||||
* This file is part of the GNU Objective C Class Library.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef __array_h_OBJECTS_INCLUDE
|
||||
#define __array_h_OBJECTS_INCLUDE 1
|
||||
|
||||
/**** Included Headers *******************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <Foundation/NSZone.h>
|
||||
#include <objects/callbacks.h>
|
||||
#include <objects/hash.h>
|
||||
|
||||
/**** Type, Constant, and Macro Definitions **********************************/
|
||||
|
||||
typedef struct _objects_array objects_array_t;
|
||||
typedef struct _objects_array_bucket objects_array_bucket_t;
|
||||
typedef objects_array_bucket_t *objects_array_slot_t;
|
||||
typedef struct _objects_array_enumerator objects_array_enumerator_t;
|
||||
|
||||
struct _objects_array_bucket
|
||||
{
|
||||
/* The bucket's real (or external) index */
|
||||
size_t index;
|
||||
|
||||
/* The bucket's cargo */
|
||||
const void *element;
|
||||
};
|
||||
|
||||
struct _objects_array
|
||||
{
|
||||
/* Identifying information. */
|
||||
int magic_number;
|
||||
size_t serial_number;
|
||||
NSZone *zone;
|
||||
NSString *name;
|
||||
const void *extra;
|
||||
objects_callbacks_t extra_callbacks;
|
||||
|
||||
/* Callbacks for the items in the array. */
|
||||
objects_callbacks_t callbacks;
|
||||
|
||||
/* Internal counters */
|
||||
size_t slot_count;
|
||||
size_t element_count;
|
||||
|
||||
/* Databanks */
|
||||
objects_array_slot_t *slots;
|
||||
objects_array_slot_t *sorted_slots;
|
||||
};
|
||||
|
||||
struct _objects_array_enumerator
|
||||
{
|
||||
objects_array_t *array;
|
||||
size_t index;
|
||||
int is_sorted;
|
||||
int is_ascending;
|
||||
};
|
||||
|
||||
/**** Function Prototypes ****************************************************/
|
||||
|
||||
/** Basics **/
|
||||
|
||||
#include <objects/array-bas.h>
|
||||
#include <objects/array-cbs.h>
|
||||
|
||||
/** Creating **/
|
||||
|
||||
objects_array_t *
|
||||
objects_array_alloc(void);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_alloc_with_zone(NSZone *zone);
|
||||
|
||||
objects_array_t *
|
||||
objects_array(void);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_with_zone(NSZone *zone);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_with_zone_with_callbacks(NSZone *zone,
|
||||
objects_callbacks_t callbacks);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_with_callbacks(objects_callbacks_t callbacks);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_of_char_p(void);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_of_non_owned_void_p(void);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_of_owned_void_p(void);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_of_int(void);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_of_id(void);
|
||||
|
||||
/** Initializing **/
|
||||
|
||||
objects_array_t *
|
||||
objects_array_init(objects_array_t *array);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_init_with_callbacks(objects_array_t *array,
|
||||
objects_callbacks_t callbacks);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_init_with_array(objects_array_t *array,
|
||||
objects_array_t *other_array);
|
||||
|
||||
/** Copying **/
|
||||
|
||||
objects_array_t *
|
||||
objects_array_copy(objects_array_t *array);
|
||||
|
||||
objects_array_t *
|
||||
objects_array_copy_with_zone(objects_array_t *array, NSZone *zone);
|
||||
|
||||
/** Destroying **/
|
||||
|
||||
void
|
||||
objects_array_dealloc(objects_array_t *array);
|
||||
|
||||
/** Comparing **/
|
||||
|
||||
int
|
||||
objects_array_is_equal_to_array(objects_array_t *array,
|
||||
objects_array_t *other_array);
|
||||
|
||||
/** Adding **/
|
||||
|
||||
const void *
|
||||
objects_array_at_index_put_element(objects_array_t *array,
|
||||
size_t index,
|
||||
const void *element);
|
||||
|
||||
/** Replacing **/
|
||||
|
||||
/** Removing **/
|
||||
|
||||
void
|
||||
objects_array_remove_element_at_index(objects_array_t *array, size_t index);
|
||||
|
||||
void
|
||||
objects_array_remove_element(objects_array_t *array, const void *element);
|
||||
|
||||
void
|
||||
objects_array_remove_element_known_present(objects_array_t *array,
|
||||
const void *element);
|
||||
|
||||
/** Emptying **/
|
||||
|
||||
void
|
||||
objects_array_empty(objects_array_t *array);
|
||||
|
||||
/** Searching **/
|
||||
|
||||
int
|
||||
objects_array_contains_element(objects_array_t *array, const void *element);
|
||||
|
||||
const void *
|
||||
objects_array_element(objects_array_t *array, const void *element);
|
||||
|
||||
size_t
|
||||
objects_array_index_of_element(objects_array_t *array, const void *element);
|
||||
|
||||
const void *
|
||||
objects_array_element_at_index(objects_array_t *array, size_t index);
|
||||
|
||||
const void **
|
||||
objects_array_all_elements(objects_array_t *array);
|
||||
|
||||
const void **
|
||||
objects_array_all_elements_ascending(objects_array_t *array);
|
||||
|
||||
const void **
|
||||
objects_array_all_element_descending(objects_array_t *array);
|
||||
|
||||
/** Enumerating **/
|
||||
|
||||
objects_array_enumerator_t
|
||||
objects_array_enumerator(objects_array_t *array);
|
||||
|
||||
objects_array_enumerator_t
|
||||
objects_array_ascending_enumerator(objects_array_t *array);
|
||||
|
||||
objects_array_enumerator_t
|
||||
objects_array_descending_enumerator(objects_array_t *array);
|
||||
|
||||
int
|
||||
objects_array_enumerator_next_index_and_element(objects_array_enumerator_t *enumerator,
|
||||
size_t *index,
|
||||
const void **element);
|
||||
|
||||
int
|
||||
objects_array_enumerator_next_element(objects_array_enumerator_t *enumerator,
|
||||
const void **element);
|
||||
|
||||
int
|
||||
objects_array_enumerator_next_index(objects_array_enumerator_t *enumerator,
|
||||
size_t *element);
|
||||
|
||||
/** Statistics **/
|
||||
|
||||
int
|
||||
objects_array_is_empty(objects_array_t *array);
|
||||
|
||||
size_t
|
||||
objects_array_count(objects_array_t *array);
|
||||
|
||||
size_t
|
||||
objects_array_capacity(objects_array_t *array);
|
||||
|
||||
int
|
||||
objects_array_check(objects_array_t *array);
|
||||
|
||||
/** Miscellaneous **/
|
||||
|
||||
objects_hash_t *
|
||||
objects_hash_init_from_array(objects_hash_t *hash, objects_array_t *array);
|
||||
|
||||
#endif /* __array_h_OBJECTS_INCLUDE */
|
|
@ -1,65 +0,0 @@
|
|||
/* Interface for behaviors for Obj-C, "for Protocols with implementations".
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: March 1995
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __behavior_h_OBJECTS_INCLUDE
|
||||
#define __behavior_h_OBJECTS_INCLUDE
|
||||
|
||||
/* Call this method from CLASS's +initialize method to add a behavior
|
||||
to CLASS. A "behavior" is like a protocol with an implementation.
|
||||
|
||||
This functions adds to CLASS all the instance and factory methods
|
||||
of BEHAVIOR as well as the instance and factory methods of
|
||||
BEHAVIOR's superclasses (We stop adding super classes as soon as we
|
||||
encounter a common ancestor.) CLASS and BEHAVIOR should share the
|
||||
same instance variable layout.
|
||||
|
||||
We do not yet deal with Protocols; perhaps we should.
|
||||
|
||||
The semantics of this stuff is pretty fragile. I don't recommend
|
||||
that you use it in code you write. It might go away completely in
|
||||
future.
|
||||
|
||||
*/
|
||||
|
||||
void behavior_class_add_class (Class class,
|
||||
Class behavior);
|
||||
void behavior_class_add_category (Class class,
|
||||
struct objc_category *category);
|
||||
void behavior_class_add_methods (Class class,
|
||||
struct objc_method_list *methods);
|
||||
|
||||
/* The old deprecated interface */
|
||||
void class_add_behavior (Class class, Class behavior);
|
||||
|
||||
/* This macro may go away in future.
|
||||
Use it carefully, you can really screw yourself up by sending to
|
||||
a CLASS with a different instance variable layout than "self". */
|
||||
|
||||
#define CALL_METHOD_IN_CLASS(CLASS, METHOD, ARGS...) \
|
||||
((*(get_imp([CLASS class], @selector(METHOD)))) \
|
||||
(self, @selector(METHOD), ## ARGS))
|
||||
|
||||
/* Set to non-zero if you want debugging messages on stderr. */
|
||||
void set_behavior_debug(int i);
|
||||
|
||||
#endif /* __behavior_h_OBJECTS_INCLUDE */
|
|
@ -1,179 +0,0 @@
|
|||
/* Handling various types in a uniform manner.
|
||||
* Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: Sun Oct 9 13:18:50 EDT 1994
|
||||
* Updated: Mon Mar 11 00:31:13 EST 1996
|
||||
* Serial: 96.03.11.01
|
||||
*
|
||||
* This file is part of the GNU Objective C Class Library.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef __callbacks_h_OBJECTS_INCLUDE
|
||||
#define __callbacks_h_OBJECTS_INCLUDE 1
|
||||
|
||||
/**** Included Headers *******************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
/**** Type, Constant, and Macro Definitions **********************************/
|
||||
|
||||
typedef size_t (*objects_hash_func_t)(const void *, void *);
|
||||
typedef int (*objects_compare_func_t)(const void *, const void *, void *);
|
||||
typedef int (*objects_is_equal_func_t)(const void *, const void *, void *);
|
||||
typedef const void *(*objects_retain_func_t)(const void *, void *);
|
||||
typedef void (*objects_release_func_t)(void *, void *);
|
||||
typedef NSString *(*objects_describe_func_t)(const void *, void *);
|
||||
|
||||
typedef struct _objects_callbacks objects_callbacks_t;
|
||||
|
||||
struct _objects_callbacks
|
||||
{
|
||||
objects_hash_func_t hash;
|
||||
objects_compare_func_t compare;
|
||||
objects_is_equal_func_t is_equal;
|
||||
objects_retain_func_t retain;
|
||||
objects_release_func_t release;
|
||||
objects_describe_func_t describe;
|
||||
const void *not_an_item_marker;
|
||||
};
|
||||
|
||||
/** Callbacks for various types **/
|
||||
|
||||
extern const objects_callbacks_t objects_callbacks_for_int;
|
||||
extern const objects_callbacks_t objects_callbacks_for_char_p;
|
||||
extern const objects_callbacks_t objects_callbacks_for_non_owned_void_p;
|
||||
extern const objects_callbacks_t objects_callbacks_for_owned_void_p;
|
||||
extern const objects_callbacks_t objects_callbacks_for_int_p;
|
||||
extern const objects_callbacks_t objects_callbacks_for_id;
|
||||
|
||||
/* FIXME: I need to figure out what each of these should be. Hmmm? */
|
||||
extern const void *objects_not_an_int_marker;
|
||||
extern const void *objects_not_a_char_p_marker;
|
||||
extern const void *objects_not_a_void_p_marker;
|
||||
extern const void *objects_not_an_int_p_marker;
|
||||
extern const void *objects_not_an_id_marker;
|
||||
|
||||
/* Change this if you need different default callbacks. */
|
||||
extern objects_callbacks_t __objects_callbacks_standard;
|
||||
|
||||
/**** Function Prototypes ****************************************************/
|
||||
|
||||
/** Generic callbacks **/
|
||||
|
||||
/* Returns the programmer-alterable `__objects_callbacks_standard',
|
||||
* defined above. */
|
||||
objects_callbacks_t
|
||||
objects_callbacks_standard(void);
|
||||
|
||||
/** Standardizing callbacks **/
|
||||
|
||||
/* Makes sure that enough of CALLBACKS is defined (i.e., non-zero)
|
||||
* to be used. This is used, rather than local checks for usability,
|
||||
* to improve the efficiency of callback use. */
|
||||
objects_callbacks_t
|
||||
objects_callbacks_standardize(objects_callbacks_t callbacks);
|
||||
|
||||
/** Using callbacks **/
|
||||
|
||||
size_t
|
||||
objects_hash(objects_callbacks_t callbacks,
|
||||
const void *thing,
|
||||
void *user_data);
|
||||
|
||||
int
|
||||
objects_compare(objects_callbacks_t callbacks,
|
||||
const void *thing1,
|
||||
const void *thing2,
|
||||
void *user_data);
|
||||
|
||||
int
|
||||
objects_is_equal(objects_callbacks_t callbacks,
|
||||
const void *thing1,
|
||||
const void *thing2,
|
||||
void *user_data);
|
||||
|
||||
const void *
|
||||
objects_retain(objects_callbacks_t callbacks,
|
||||
const void *thing,
|
||||
void *user_data);
|
||||
|
||||
void
|
||||
objects_release(objects_callbacks_t callbacks,
|
||||
void *thing,
|
||||
void *user_data);
|
||||
|
||||
NSString *
|
||||
objects_describe(objects_callbacks_t callbacks,
|
||||
const void *thing,
|
||||
void *user_data);
|
||||
|
||||
const void *
|
||||
objects_not_an_item_marker(objects_callbacks_t callbacks);
|
||||
|
||||
/** Specific callback functions... **/
|
||||
|
||||
/* For non-owned `void *' */
|
||||
size_t objects_non_owned_void_p_hash(const void *ptr);
|
||||
int objects_non_owned_void_p_compare(const void *ptr, const void *qtr);
|
||||
int objects_non_owned_void_p_is_equal(const void *ptr, const void *qtr);
|
||||
const void *objects_non_owned_void_p_retain(const void *ptr);
|
||||
void objects_non_owned_void_p_release(void *ptr);
|
||||
NSString *objects_non_owned_void_p_describe(const void *ptr);
|
||||
|
||||
/* For owned `void *' */
|
||||
size_t objects_owned_void_p_hash(const void *ptr);
|
||||
int objects_owned_void_p_compare(const void *ptr, const void *qtr);
|
||||
int objects_owned_void_p_is_equal(const void *ptr, const void *qtr);
|
||||
const void *objects_owned_void_p_retain(const void *ptr);
|
||||
void objects_owned_void_p_release(void *ptr);
|
||||
NSString *objects_owned_void_p_describe(const void *ptr);
|
||||
|
||||
/* For `int' */
|
||||
size_t objects_int_hash(int i);
|
||||
int objects_int_compare(int i, int j);
|
||||
int objects_int_is_equal(int i, int j);
|
||||
const void *objects_int_retain(int i);
|
||||
void objects_int_release(int i);
|
||||
NSString *objects_int_describe(int i);
|
||||
|
||||
/* For `int *' */
|
||||
size_t objects_int_p_hash(const int *iptr);
|
||||
int objects_int_p_compare(const int *iptr, const int *jptr);
|
||||
int objects_int_p_is_equal(const int *iptr, const int *jptr);
|
||||
const void *objects_int_p_retain(const int *iptr);
|
||||
void objects_int_p_release(int *iptr);
|
||||
NSString *objects_int_p_describe(const int *iptr);
|
||||
|
||||
/* For `char *' */
|
||||
size_t objects_char_p_hash(const char *cptr);
|
||||
int objects_char_p_compare(const char *cptr, const char *dptr);
|
||||
int objects_char_p_is_equal(const char *cptr, const char *dptr);
|
||||
const void *objects_char_p_retain(const char *cptr);
|
||||
void objects_char_p_release(char *cptr);
|
||||
NSString *objects_char_p_describe(const char *cptr);
|
||||
|
||||
/* For `id' */
|
||||
size_t objects_id_hash(id obj);
|
||||
int objects_id_compare(id obj, id jbo);
|
||||
int objects_id_is_equal(id obj, id jbo);
|
||||
const void *objects_id_retain(id obj);
|
||||
void objects_id_release(id obj);
|
||||
NSString *objects_id_describe(id obj);
|
||||
|
||||
#endif /* __callbacks_h_OBJECTS_INCLUDE */
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
/* WIN32 extra config stuff */
|
||||
|
||||
//
|
||||
// WIN32
|
||||
//
|
||||
#ifdef WIN32
|
||||
# include <windows.h>
|
||||
# ifndef vm_page_size
|
||||
# define vm_page_size 4096
|
||||
# endif
|
||||
# define popen _popen
|
||||
#endif
|
|
@ -1,2 +0,0 @@
|
|||
s/@NeXT_runtime@/0/
|
||||
s/@NeXT_cc@/0/
|
|
@ -1,30 +0,0 @@
|
|||
/* Configuration information for the GNU Objective-C Library.
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: Oct 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __config_h_OBJECTS_INCLUDE
|
||||
#define __config_h_OBJECTS_INCLUDE
|
||||
|
||||
#define NeXT_runtime @NeXT_runtime@
|
||||
#define NeXT_cc @NeXT_cc@
|
||||
|
||||
#endif /* __config_h_OBJECTS_INCLUDE */
|
|
@ -1,239 +0,0 @@
|
|||
/* A modular data encapsulator for use with Libobjects.
|
||||
* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: Fri Nov 24 21:50:01 EST 1995
|
||||
* Updated: Sat Feb 10 15:40:21 EST 1996
|
||||
* Serial: 96.02.10.01
|
||||
*
|
||||
* This file is part of the GNU Objective C Class Library.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef __data_h_OBJECTS_INCLUDE
|
||||
#define __data_h_OBJECTS_INCLUDE 1
|
||||
|
||||
/**** Included Headers *******************************************************/
|
||||
|
||||
#include <objects/allocs.h>
|
||||
#include <objects/callbacks.h>
|
||||
|
||||
/**** Type, Constant, and Macro Definitions **********************************/
|
||||
|
||||
typedef enum _objects_data_encoding objects_data_encoding_t;
|
||||
|
||||
enum _objects_data_encoding
|
||||
{
|
||||
objects_data_encoding_unknown = -1,
|
||||
objects_data_encoding_binary,
|
||||
objects_data_encoding_7bit,
|
||||
objects_data_encoding_8bit,
|
||||
objects_data_encoding_base64,
|
||||
objects_data_encoding_quoted_printable,
|
||||
objects_data_encoding_x_uuencode
|
||||
};
|
||||
|
||||
typedef struct _objects_data objects_data_t;
|
||||
|
||||
struct _objects_data
|
||||
{
|
||||
int magic;
|
||||
size_t number;
|
||||
const char *name;
|
||||
const void *extra;
|
||||
objects_callbacks_t extra_callbacks;
|
||||
objects_allocs_t allocs;
|
||||
|
||||
/* Necessary information about the data. */
|
||||
void *buffer; /* Where the stuff really is. */
|
||||
size_t length; /* How much stuff there is. */
|
||||
size_t capacity; /* How much room for stuff there is. */
|
||||
};
|
||||
|
||||
/* Creating temporary data. This is *so* cool. GCC is awesome! */
|
||||
#define OBJECTS_DATA(P, L) \
|
||||
(objects_data_t *(&({OBJECTS_MAGIC_DATA, (size_t) -1, 0, \
|
||||
0, 0, __objects_callbacks_standard, 0, 0, 0, \
|
||||
__objects_allocs_standard, (P), (L), (L)})))
|
||||
|
||||
/**** Function Prototypes ****************************************************/
|
||||
|
||||
/** Basics **/
|
||||
|
||||
#include <objects/data-bas.h>
|
||||
|
||||
/** Hashing **/
|
||||
|
||||
size_t objects_data_hash (objects_data_t * data);
|
||||
|
||||
/** Creating **/
|
||||
|
||||
objects_data_t * objects_data_alloc (void);
|
||||
|
||||
objects_data_t * objects_data_alloc_with_allocs (objects_allocs_t allocs);
|
||||
|
||||
objects_data_t * objects_data_new (void);
|
||||
|
||||
objects_data_t * objects_data_new_with_allocs (objects_allocs_t allocs);
|
||||
|
||||
objects_data_t * _objects_data_with_allocs_with_contents_of_file (objects_allocs_t allocs, const char *file);
|
||||
|
||||
objects_data_t * _objects_data_with_contents_of_file (const char *file);
|
||||
|
||||
objects_data_t * objects_data_with_buffer_of_length (void *buffer, size_t length);
|
||||
|
||||
objects_data_t * objects_data_with_allocs_with_buffer_of_length (objects_allocs_t allocs, void *buffer, size_t length);
|
||||
|
||||
/** Initializing **/
|
||||
|
||||
objects_data_t * objects_data_init (objects_data_t * data);
|
||||
|
||||
objects_data_t * _objects_data_init_with_contents_of_file (objects_data_t * data, const char *file);
|
||||
|
||||
objects_data_t * objects_data_init_with_buffer_of_length (objects_data_t * data, void *buffer, size_t length);
|
||||
|
||||
/** Statistics **/
|
||||
|
||||
size_t objects_data_capacity (objects_data_t * data);
|
||||
|
||||
/* Obtain DATA's length. */
|
||||
size_t objects_data_length (objects_data_t * data);
|
||||
|
||||
/* Obtain a read-only copy of DATA's buffer. */
|
||||
const void *objects_data_buffer (objects_data_t * data);
|
||||
|
||||
/* Obtain DATA's capacity through reference. */
|
||||
size_t objects_data_get_capacity (objects_data_t * data, size_t * capacity);
|
||||
|
||||
/* Obtain DATA's length through reference. */
|
||||
size_t objects_data_get_length (objects_data_t * data, size_t * length);
|
||||
|
||||
/* Copy DATA's buffer into BUFFER. It is assumed that BUFFER is large
|
||||
* enough to contain DATA's buffer. */
|
||||
size_t objects_data_get_buffer (objects_data_t * data, void *buffer);
|
||||
|
||||
/* Copy no more that LENGTH of DATA's buffer into BUFFER. Returns the
|
||||
* amount actually copied. */
|
||||
size_t objects_data_get_buffer_of_length (objects_data_t * data, void *buffer, size_t length);
|
||||
|
||||
/* Copy a subrange of DATA's buffer into BUFFER. As always, it is
|
||||
* assumed that BUFFER is large enough to contain everything. We
|
||||
* return the size of the data actually copied into BUFFER. */
|
||||
size_t objects_data_get_buffer_of_subrange (objects_data_t * data, void *buffer, size_t location, size_t length);
|
||||
|
||||
size_t objects_data_set_capacity (objects_data_t * data, size_t capacity);
|
||||
|
||||
size_t objects_data_increase_capacity (objects_data_t * data, size_t capacity);
|
||||
|
||||
size_t objects_data_decrease_capacity (objects_data_t * data, size_t capacity);
|
||||
|
||||
size_t objects_data_set_length (objects_data_t * data, size_t length);
|
||||
|
||||
size_t objects_data_set_buffer_of_subrange (objects_data_t * data, void *buffer, size_t location, size_t length);
|
||||
|
||||
size_t objects_data_set_buffer_of_length (objects_data_t * data, void *buffer, size_t length);
|
||||
|
||||
void objects_data_get_md5_checksum (objects_data_t * data, char *buffer);
|
||||
|
||||
/** Copying **/
|
||||
|
||||
objects_data_t * objects_data_copy (objects_data_t * data);
|
||||
|
||||
objects_data_t * objects_data_copy_of_subrange (objects_data_t * data, size_t location, size_t length);
|
||||
|
||||
objects_data_t * objects_data_copy_with_allocs (objects_data_t * data, objects_allocs_t allocs);
|
||||
|
||||
objects_data_t * objects_data_copy_of_subrange_with_allocs (objects_data_t * data, size_t location, size_t length, objects_allocs_t allocs);
|
||||
|
||||
/** Replacing **/
|
||||
|
||||
/* Note that we cannot do any bounds checking on BUFFER. */
|
||||
objects_data_t * objects_data_replace_subrange_with_subrange_of_buffer (objects_data_t * data, size_t location, size_t length, size_t buf_location, size_t buf_length, void *buffer);
|
||||
|
||||
objects_data_t * objects_data_replace_subrange_with_subrange_of_data (objects_data_t * data, size_t location, size_t length, size_t other_location, size_t other_length, objects_data_t * other_data);
|
||||
|
||||
objects_data_t * objects_data_replace_subrange_with_data (objects_data_t * data, size_t location, size_t length, objects_data_t * other_data);
|
||||
|
||||
/** Appending **/
|
||||
|
||||
objects_data_t * objects_data_append_data (objects_data_t * data, objects_data_t * other_data);
|
||||
|
||||
objects_data_t * objects_data_append_subrange_of_data (objects_data_t * data, size_t location, size_t length, objects_data_t * other_data);
|
||||
|
||||
objects_data_t * objects_data_append_data_repeatedly (objects_data_t * data, objects_data_t * other_data, size_t num_times);
|
||||
|
||||
objects_data_t * objects_data_append_subrange_of_data_repeatedly (objects_data_t * data, size_t location, size_t length, objects_data_t * other_data, size_t num_times);
|
||||
|
||||
/** Prepending **/
|
||||
|
||||
objects_data_t * objects_data_prepend_data (objects_data_t * data, objects_data_t * other_data);
|
||||
|
||||
objects_data_t * objects_data_prepend_subrange_of_data (objects_data_t * data, size_t location, size_t length, objects_data_t * other_data);
|
||||
|
||||
objects_data_t * objects_data_prepend_data_repeatedly (objects_data_t * data, objects_data_t * other_data, size_t num_times);
|
||||
|
||||
objects_data_t * objects_data_prepend_subrange_of_data_repeatedly (objects_data_t * data, size_t location, size_t length, objects_data_t * other_data, size_t num_times);
|
||||
|
||||
/** Concatenating **/
|
||||
|
||||
objects_data_t * objects_data_concatenate_data (objects_data_t * data, objects_data_t * other_data);
|
||||
|
||||
objects_data_t * objects_data_concatenate_data_with_allocs (objects_data_t * data, objects_data_t * other_data, objects_allocs_t allocs);
|
||||
|
||||
objects_data_t * objects_data_concatenate_subrange_of_data (objects_data_t * data, size_t location, size_t length, objects_data_t * other_data);
|
||||
|
||||
objects_data_t * objects_data_concatenate_subrange_of_data_with_allocs (objects_data_t * data, size_t location, size_t length, objects_data_t * other_data, objects_allocs_t allocs);
|
||||
|
||||
/** Reversing **/
|
||||
|
||||
objects_data_t * objects_data_reverse_with_granularity (objects_data_t * data, size_t granularity);
|
||||
|
||||
objects_data_t * objects_data_reverse_by_int (objects_data_t * data);
|
||||
|
||||
objects_data_t * objects_data_reverse_by_char (objects_data_t * data);
|
||||
|
||||
objects_data_t * objects_data_reverse_by_void_p (objects_data_t * data);
|
||||
|
||||
/** Permuting **/
|
||||
|
||||
objects_data_t * objects_data_permute_with_granularity (objects_data_t * data, size_t granularity);
|
||||
|
||||
objects_data_t * objects_data_permute_with_no_fixed_points_with_granularity (objects_data_t * data, size_t granularity);
|
||||
|
||||
/** Writing **/
|
||||
|
||||
int _objects_data_write_to_file (objects_data_t * data, const char *file);
|
||||
|
||||
/** Encoding **/
|
||||
|
||||
objects_data_encoding_t objects_data_guess_data_encoding (objects_data_t * data);
|
||||
|
||||
objects_data_t * _objects_data_encode_with_base64 (objects_data_t * data);
|
||||
|
||||
objects_data_t * _objects_data_encode_with_quoted_printable (objects_data_t * data);
|
||||
|
||||
objects_data_t * _objects_data_encode_with_x_uuencode (objects_data_t * data);
|
||||
|
||||
objects_data_t * objects_data_encode_with_encoding (objects_data_t * data, objects_data_encoding_t enc);
|
||||
|
||||
objects_data_t * _objects_data_decode_with_base64 (objects_data_t * data);
|
||||
|
||||
objects_data_t * _objects_data_decode_with_quoted_printable (objects_data_t * data);
|
||||
|
||||
objects_data_t * _objects_data_decode_with_x_uuencode (objects_data_t * data);
|
||||
|
||||
objects_data_t * objects_data_decode_with_encoding (objects_data_t * data, objects_data_encoding_t enc);
|
||||
|
||||
#endif /* __data_h_OBJECTS_INCLUDE */
|
|
@ -1,393 +0,0 @@
|
|||
/* A hash table.
|
||||
* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: ??? ??? ?? ??:??:?? ??? 1993
|
||||
* Updated: Tue Mar 19 00:25:34 EST 1996
|
||||
* Serial: 96.03.19.05
|
||||
*
|
||||
* This file is part of the GNU Objective C Class Library.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef __hash_h_OBJECTS_INCLUDE
|
||||
#define __hash_h_OBJECTS_INCLUDE 1
|
||||
|
||||
/**** Included Headers *******************************************************/
|
||||
|
||||
#include <Foundation/NSZone.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <objects/callbacks.h>
|
||||
|
||||
/**** Type, Constant, and Macro Definitions **********************************/
|
||||
|
||||
/* Need these up here because of their interdependence. */
|
||||
typedef struct _objects_hash objects_hash_t;
|
||||
typedef struct _objects_hash_enumerator objects_hash_enumerator_t;
|
||||
typedef struct _objects_hash_node objects_hash_node_t;
|
||||
typedef struct _objects_hash_bucket objects_hash_bucket_t;
|
||||
|
||||
/* Private type for elemental holding. */
|
||||
struct _objects_hash_node
|
||||
{
|
||||
/* The hash table with which the node is associated. */
|
||||
objects_hash_t *hash;
|
||||
|
||||
/* The bucket in HASH in which the node sits. */
|
||||
objects_hash_bucket_t *bucket;
|
||||
|
||||
/* These hold the BUCKET linked list together. */
|
||||
objects_hash_node_t *next_in_bucket;
|
||||
objects_hash_node_t *prev_in_bucket;
|
||||
|
||||
/* For enumerating over the whole hash table. These make
|
||||
* enumerating much quicker. They also make it safer. */
|
||||
objects_hash_node_t *next_in_hash;
|
||||
objects_hash_node_t *prev_in_hash;
|
||||
|
||||
/* What the node is holding for us. Its raison d'etre. */
|
||||
const void *element;
|
||||
};
|
||||
|
||||
/* Private type for holding chains of nodes. */
|
||||
struct _objects_hash_bucket
|
||||
{
|
||||
/* The number of nodes in this bucket. For internal consistency checks. */
|
||||
size_t node_count;
|
||||
|
||||
/* The number of elements in this bucket. (This had *better* be
|
||||
* the same as NODE_COUNT, or something's wrong.) */
|
||||
size_t element_count;
|
||||
|
||||
/* The head of this bucket's linked list of nodes. */
|
||||
objects_hash_node_t *first_node;
|
||||
};
|
||||
|
||||
/* The hash table type. */
|
||||
struct _objects_hash
|
||||
{
|
||||
/* All structures have these...
|
||||
* And all structures have them in the same order. */
|
||||
int magic_number;
|
||||
size_t serial_number;
|
||||
NSZone *zone;
|
||||
NSString *name;
|
||||
const void *extra;
|
||||
objects_callbacks_t extra_callbacks;
|
||||
|
||||
/* Callbacks for the elements of the hash. */
|
||||
objects_callbacks_t callbacks;
|
||||
|
||||
/* Internal counters. Mainly for consistency's sake. */
|
||||
size_t bucket_count; /* How many types of items? */
|
||||
size_t node_count; /* How many items? */
|
||||
size_t element_count; /* How many elements? */
|
||||
|
||||
/* Places to start looking for elements. */
|
||||
objects_hash_bucket_t *buckets; /* Organized as a hash. */
|
||||
objects_hash_node_t *first_node; /* Organized as a linked list.
|
||||
* (For enumerating...) */
|
||||
};
|
||||
|
||||
/* Type for enumerating the elements of a hash table. */
|
||||
struct _objects_hash_enumerator
|
||||
{
|
||||
objects_hash_t *hash; /* To which hash do I belong? */
|
||||
objects_hash_node_t *node; /* Which node is next? */
|
||||
};
|
||||
|
||||
/**** Function Prototypes ****************************************************/
|
||||
|
||||
/** Basics... **/
|
||||
|
||||
/* All the structures (hashes, maps, lists, and arrays) have
|
||||
* the same basic ideas behind them. */
|
||||
|
||||
#include <objects/hash-bas.h>
|
||||
#include <objects/hash-cbs.h>
|
||||
|
||||
/** Callbacks... **/
|
||||
|
||||
/* Returns a collection of callbacks for use with hash tables. */
|
||||
objects_callbacks_t
|
||||
objects_callbacks_for_hash(void);
|
||||
|
||||
/** Creating... **/
|
||||
|
||||
/* Allocate a hash table in the default zone. */
|
||||
objects_hash_t *
|
||||
objects_hash_alloc(void);
|
||||
|
||||
/* Allocate a hash table in the memory block ZONE. */
|
||||
objects_hash_t *
|
||||
objects_hash_alloc_with_zone(NSZone *zone);
|
||||
|
||||
/* Create an empty hash table in the memory block ZONE. The returned
|
||||
* hash table has a "reasonable" default capacity, but will need to
|
||||
* be resized to suit your specific needs if more than a couple of
|
||||
* dozen elements will be placed within it. */
|
||||
objects_hash_t *
|
||||
objects_hash_with_zone_with_callbacks(NSZone *zone,
|
||||
objects_callbacks_t callbacks);
|
||||
|
||||
/* Like calling 'objects_hash_with_zone_with_callbacks(zone,
|
||||
* objects_callbacks_standard())'. */
|
||||
objects_hash_t *
|
||||
objects_hash_with_zone(NSZone *zone);
|
||||
|
||||
/* Like calling 'objects_hash_with_zone_with_callbacks(0, callbacks)'. */
|
||||
objects_hash_t *
|
||||
objects_hash_with_callbacks(objects_callbacks_t callbacks);
|
||||
|
||||
/* These are just shortcuts for ease of use. */
|
||||
objects_hash_t *objects_hash_of_char_p(void);
|
||||
objects_hash_t *objects_hash_of_non_owned_void_p(void);
|
||||
objects_hash_t *objects_hash_of_owned_void_p(void);
|
||||
objects_hash_t *objects_hash_of_int(void);
|
||||
objects_hash_t *objects_hash_of_int_p(void);
|
||||
objects_hash_t *objects_hash_of_id(void);
|
||||
|
||||
/** Initializing... **/
|
||||
|
||||
/* Initializes HASH with a "reasonable" capacity, with the
|
||||
* callbacks obtained from 'objects_callbacks_standard()'. */
|
||||
objects_hash_t *
|
||||
objects_hash_init(objects_hash_t *hash);
|
||||
|
||||
/* Initializes HASH with a "reasonable" capacity and
|
||||
* with element callbacks CALLBACKS. */
|
||||
objects_hash_t *
|
||||
objects_hash_init_with_callbacks(objects_hash_t *hash,
|
||||
objects_callbacks_t callbacks);
|
||||
|
||||
/* Initializes HASH with the capacity, callbacks, and contents
|
||||
* of OTHER_HASH. NOTE: This is (as it must be) a "shallow" copying.
|
||||
* See 'objects_hash_copy_with_zone()', below. */
|
||||
objects_hash_t *
|
||||
objects_hash_init_with_hash(objects_hash_t *hash,
|
||||
objects_hash_t *other_hash);
|
||||
|
||||
/** Copying... **/
|
||||
|
||||
/* Creates a (shallow) copy of HASH in the memory block ZONE. WARNING:
|
||||
* If the elements of HASH are pointers to mutable items, it is the
|
||||
* programmer's responsibility to deepen the copy returned by this
|
||||
* function call (using, for example, `objects_hash_map_elements()'). */
|
||||
objects_hash_t *
|
||||
objects_hash_copy_with_zone(objects_hash_t *hash, NSZone *zone);
|
||||
|
||||
/* Create a (shallow) copy of HASH in the default zone. WARNING: See the
|
||||
* above function for an important caveat about copying. */
|
||||
objects_hash_t *
|
||||
objects_hash_copy(objects_hash_t *old_hash);
|
||||
|
||||
/** Mapping... **/
|
||||
|
||||
/* WARNING: The mapping function FCN must be one-to-one on elements of
|
||||
* HASH. I.e., for reasons of efficiency, `objects_hash_map_elements()'
|
||||
* makes no provision for the possibility that FCN maps two unequal
|
||||
* elements of HASH to the same (or "equal") elements. The better way
|
||||
* to handle functions that aren't one-to-one is to create a new hash
|
||||
* and transform the elements of the first to create the elements of
|
||||
* the second (by manual enumeration). */
|
||||
objects_hash_t *
|
||||
objects_hash_map_elements(objects_hash_t *hash,
|
||||
const void *(*fcn)(const void *, const void *),
|
||||
const void *user_data);
|
||||
|
||||
/** Destroying... **/
|
||||
|
||||
/* Releases all the elements of HASH, and then frees up the space
|
||||
* HASH used. HASH is no longer a (pointer to a) valid hash
|
||||
* table structure after this call. */
|
||||
void
|
||||
objects_hash_dealloc(objects_hash_t *hash);
|
||||
|
||||
/** Comparing... **/
|
||||
|
||||
/* Returns 'true' if every element of OTHER_HASH is also
|
||||
* a member of HASH. Otherwise, returns 'false'. */
|
||||
int
|
||||
objects_hash_contains_hash(objects_hash_t *hash,
|
||||
objects_hash_t *other_hash);
|
||||
|
||||
/* Returns 'true' if some element of HASH is also
|
||||
* a member of OTHER_HASH. Otherwise, returns 'false'. */
|
||||
int
|
||||
objects_hash_intersects_hash(objects_hash_t *hash,
|
||||
objects_hash_t *other_hash);
|
||||
|
||||
/* Returns 'true' if HASH and OTHER_HASH have the same number of elements,
|
||||
* HASH contains OTHER_HASH, and OTHER_HASH contains HASH. Otheraise, returns 'false'. */
|
||||
int
|
||||
objects_hash_is_equal_to_hash(objects_hash_t *hash,
|
||||
objects_hash_t *other_hash);
|
||||
|
||||
/** Adding... **/
|
||||
|
||||
/* Adds ELEMENT to HASH. If ELEMENT is "equal" to an item already in HASH,
|
||||
* then we abort. If ELEMENT is the "not an element marker" for HASH,
|
||||
* then we abort. [NOTE: This abortive behaviour will be changed in a
|
||||
* future revision.] */
|
||||
const void *
|
||||
objects_hash_add_element_known_absent(objects_hash_t *hash,
|
||||
const void *element);
|
||||
|
||||
/* Adds ELEMENT to HASH. If ELEMENT is "equal" to an item already in HASH,
|
||||
* then that older item is released using the 'release()' callback function
|
||||
* that was specified when HASH was created. (If ELEMENT is the "not an
|
||||
* element marker" for HASH, then all bets are off, and we abort.
|
||||
* [NOTE: This abortive behaviour will be changed in a future revision.]) */
|
||||
const void *
|
||||
objects_hash_add_element(objects_hash_t *hash, const void *element);
|
||||
|
||||
/* If (any item "equal" to) ELEMENT is in HASH, then that member of HASH is
|
||||
* returned. Otherwise, the "not an element marker" for HASH is returned
|
||||
* and ELEMENT is added to HASH. If ELEMENT is the "not an element marker"
|
||||
* for HASH, then we abort. [NOTE: This abortive behaviour will be changed
|
||||
* in a future revision.] */
|
||||
const void *
|
||||
objects_hash_add_element_if_absent(objects_hash_t *hash, const void *element);
|
||||
|
||||
/** Replacing... **/
|
||||
|
||||
/* If (some item "equal" to) ELEMENT is an element of HASH, then ELEMENT is
|
||||
* substituted for it. The old element is released. (This is rather
|
||||
* like the non-existant but perfectly reasonable function
|
||||
* 'objects_hash_add_element_if_present()'.) */
|
||||
void
|
||||
objects_hash_replace_element(objects_hash_t *hash,
|
||||
const void *element);
|
||||
|
||||
/** Removing... **/
|
||||
|
||||
/* Removes the element (if any) of HASH which is "equal" to ELEMENT,
|
||||
* according to HASH's element callbacks. It is not an error to
|
||||
* remove ELEMENT from HASH, if no element of HASH is "equal" to ELEMENT. */
|
||||
void
|
||||
objects_hash_remove_element(objects_hash_t *hash, const void *element);
|
||||
|
||||
/** Emptying... **/
|
||||
|
||||
/* Empties HASH, releasing all of its elements while retaining
|
||||
* its current "capacity". */
|
||||
void
|
||||
objects_hash_empty(objects_hash_t *hash);
|
||||
|
||||
/** Searching... **/
|
||||
|
||||
/* Returns a "random" element of HASH, for your viewing enjoyment. */
|
||||
void *
|
||||
objects_hash_any_element(objects_hash_t *hash);
|
||||
|
||||
/* Returns `true' if some element of HASH is "equal" to ELEMENT,
|
||||
* according to HASH's element callbacks. */
|
||||
int
|
||||
objects_hash_contains_element(objects_hash_t *hash, const void *element);
|
||||
|
||||
/* Returns the element of HASH (or the appropriate `not an element
|
||||
* marker' if there is none) which is "equal" to ELEMENT. */
|
||||
const void *
|
||||
objects_hash_element(objects_hash_t *hash, const void *element);
|
||||
|
||||
/* Returns an array with all the elements of HASH, terminated
|
||||
* by HASH's "not an element marker". It is your responsibility
|
||||
* to free the returned array. [NOTE: this responsibility may
|
||||
* shift from your shoulders in a later revision.] */
|
||||
const void **
|
||||
objects_hash_all_elements(objects_hash_t *hash);
|
||||
|
||||
/** Enumerating... **/
|
||||
|
||||
/* Returns an enumerator for HASH's elements. WARNING: DO NOT ALTER
|
||||
* A HASH DURING AN ENUMERATION. DOING SO WILL PROBABLY LEAVE YOUR ENUMERATION
|
||||
* IN AN INDETERMINATE STATE. If you are hell-bent on ignoring the above
|
||||
* warning, please check out the source code for some more specific
|
||||
* information about when and how one can get away with it. */
|
||||
objects_hash_enumerator_t
|
||||
objects_hash_enumerator_for_hash(objects_hash_t *hash);
|
||||
|
||||
/* Returns `false' if the enumeration is complete, `true' otherwise.
|
||||
* If ELEMENT is non-zero, the next element of ENUMERATOR's hash table
|
||||
* is returned by reference. */
|
||||
int
|
||||
objects_hash_enumerator_next_element(objects_hash_enumerator_t *enumerator,
|
||||
const void **element);
|
||||
|
||||
/** Statistics... **/
|
||||
|
||||
/* Returns `true' if HASH contains no elements. */
|
||||
int
|
||||
objects_hash_is_empty(objects_hash_t *hash);
|
||||
|
||||
/* Returns the number of elements HASH is currently holding. So long as no
|
||||
* additions or removals occur, you may take this number to be accurate. */
|
||||
size_t
|
||||
objects_hash_count(objects_hash_t *hash);
|
||||
|
||||
/* Returns a number which represents (to some degree) HASH's current ability
|
||||
* to hold stuff. Do not, however, rely on this for precision. Treat as
|
||||
* a (reasonable) estimate. */
|
||||
size_t
|
||||
objects_hash_capacity(objects_hash_t *hash);
|
||||
|
||||
/* Performs an internal consistency check on HASH. Useful only
|
||||
* for debugging. */
|
||||
int
|
||||
objects_hash_check(objects_hash_t *hash);
|
||||
|
||||
/** Resizing... **/
|
||||
|
||||
/* Resizes HASH to be ready to contain (at least) NEW_CAPACITY many elements.
|
||||
* However, as far as you are concerned, it is indeterminate what exactly
|
||||
* this means. After receiving and successfully processing this call,
|
||||
* you are *not* guaranteed that HASH has actually set aside space for
|
||||
* NEW_CAPACITY elements, for example. All that you are guaranteed is that,
|
||||
* to the best of its ability, HASH will incur no loss in efficiency so long
|
||||
* as it contains no more than NEW_CAPACITY elements. */
|
||||
size_t
|
||||
objects_hash_resize(objects_hash_t *hash, size_t new_capacity);
|
||||
|
||||
/* Shrinks (or grows) HASH to be comfortable with the number of elements
|
||||
* it contains. In all likelyhood, after this call, HASH is more efficient
|
||||
* in terms of its speed of search vs. use of space balance. */
|
||||
size_t
|
||||
objects_hash_rightsize(objects_hash_t *hash);
|
||||
|
||||
/** Describing... **/
|
||||
|
||||
/* Returns a string describing (the contents of) HASH. */
|
||||
NSString *
|
||||
objects_hash_description(objects_hash_t *hash);
|
||||
|
||||
/** Set theoretic operations... **/
|
||||
|
||||
/* Removes from HASH all of its elements which are not also
|
||||
* elements of OTHER_HASH. Returns HASH as a courtesy. */
|
||||
objects_hash_t *
|
||||
objects_hash_intersect_hash(objects_hash_t *hash, objects_hash_t *other_hash);
|
||||
|
||||
/* Removes from HASH all of its elements which are also
|
||||
* elements of OTHER_HASH. Returns HASH as a courtesy. */
|
||||
objects_hash_t *
|
||||
objects_hash_minus_hash(objects_hash_t *hash, objects_hash_t *other_hash);
|
||||
|
||||
/* Adds to HASH all elements of OTHER_HASH which are not
|
||||
* already members of HASH. Returns HASH as a courtesy. */
|
||||
objects_hash_t *
|
||||
objects_hash_union_hash(objects_hash_t *hash, objects_hash_t *other_hash);
|
||||
|
||||
#endif /* __hash_h_OBJECTS_INCLUDE */
|
||||
|
|
@ -1,346 +0,0 @@
|
|||
/* A list structure.
|
||||
* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: Tue Sep 5 17:25:59 EDT 1995
|
||||
* Updated: Sun Mar 10 23:24:49 EST 1996
|
||||
* Serial: 96.03.10.02
|
||||
*
|
||||
* This file is part of the GNU Objective C Class Library.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef __list_h_OBJECTS_INCLUDE
|
||||
#define __list_h_OBJECTS_INCLUDE 1
|
||||
|
||||
/**** Included Headers *******************************************************/
|
||||
|
||||
#include <Foundation/NSZone.h>
|
||||
#include <objects/callbacks.h>
|
||||
#include <objects/hash.h>
|
||||
#include <objects/array.h>
|
||||
|
||||
/**** Type, Constant, and Macro Definitions **********************************/
|
||||
|
||||
typedef struct _objects_list objects_list_t;
|
||||
typedef struct _objects_list_node objects_list_node_t;
|
||||
typedef struct _objects_list_enumerator objects_list_enumerator_t;
|
||||
|
||||
struct _objects_list_node
|
||||
{
|
||||
objects_list_t *list;
|
||||
|
||||
objects_list_node_t *next_in_list;
|
||||
objects_list_node_t *prev_in_list;
|
||||
|
||||
const void *element;
|
||||
};
|
||||
|
||||
struct _objects_list
|
||||
{
|
||||
/* Container identifiers */
|
||||
int magic_number;
|
||||
size_t serial_number;
|
||||
NSZone *zone;
|
||||
NSString *name;
|
||||
const void *extra;
|
||||
objects_callbacks_t extra_callbacks;
|
||||
|
||||
/* Element callbacks */
|
||||
objects_callbacks_t callbacks;
|
||||
|
||||
/* Internal counters */
|
||||
size_t node_count;
|
||||
size_t element_count;
|
||||
|
||||
/* Databanks */
|
||||
objects_list_node_t *first_node;
|
||||
objects_list_node_t *last_node;
|
||||
};
|
||||
|
||||
struct _objects_list_enumerator
|
||||
{
|
||||
objects_list_t *list;
|
||||
objects_list_node_t *node;
|
||||
size_t forward;
|
||||
};
|
||||
|
||||
|
||||
/**** Function Prototypes ****************************************************/
|
||||
|
||||
/** Basics **/
|
||||
|
||||
#include <objects/list-bas.h>
|
||||
#include <objects/list-cbs.h>
|
||||
|
||||
/** Creating **/
|
||||
|
||||
objects_list_t *
|
||||
objects_list_alloc(void);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_alloc_with_zone(NSZone *zone);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_with_zone(NSZone *zone);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_with_callbacks(objects_callbacks_t callbacks);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_with_zone_with_callbacks(NSZone *zone,
|
||||
objects_callbacks_t callbacks);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_of_char_p(void);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_of_non_owned_void_p(void);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_of_owned_void_p(void);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_of_int(void);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_of_int_p(void);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_of_id(void);
|
||||
|
||||
/** Initializing **/
|
||||
|
||||
objects_list_t *
|
||||
objects_list_init(objects_list_t *list);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_init_with_callbacks(objects_list_t *list,
|
||||
objects_callbacks_t callbacks);
|
||||
|
||||
/** Copying **/
|
||||
|
||||
objects_list_t *
|
||||
objects_list_copy(objects_list_t *old_list);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_copy_with_zone(objects_list_t *old_list,
|
||||
NSZone *zone);
|
||||
|
||||
/** Destroying **/
|
||||
|
||||
void
|
||||
objects_list_dealloc(objects_list_t *list);
|
||||
|
||||
/** Comparing **/
|
||||
|
||||
int
|
||||
objects_list_is_equal_to_list(objects_list_t *list,
|
||||
objects_list_t *other_list);
|
||||
|
||||
/** Concatenating **/
|
||||
|
||||
objects_list_t *
|
||||
objects_list_append_list(objects_list_t *base_list,
|
||||
objects_list_t *suffix_list);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_prepend_list(objects_list_t *base_list,
|
||||
objects_list_t *prefix_list);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_at_index_insert_list(objects_list_t *base_list,
|
||||
long int n,
|
||||
objects_list_t *infix_list);
|
||||
|
||||
/** Permuting **/
|
||||
|
||||
objects_list_t *
|
||||
objects_list_roll_to_nth_element(objects_list_t *list, long int n);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_roll_to_element(objects_list_t *list, const void *element);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_roll_to_nth_occurrance_of_element(objects_list_t *list,
|
||||
long int n,
|
||||
const void *element);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_invert(objects_list_t *list);
|
||||
|
||||
objects_list_t *
|
||||
objects_list_swap_elements_at_indices(objects_list_t *list,
|
||||
long int m,
|
||||
long int n);
|
||||
|
||||
/** Adding **/
|
||||
|
||||
const void *
|
||||
objects_list_append_element(objects_list_t *list, const void *element);
|
||||
|
||||
const void *
|
||||
objects_list_append_element_if_absent(objects_list_t *list,
|
||||
const void *element);
|
||||
|
||||
const void *
|
||||
objects_list_prepend_element(objects_list_t *list, const void *element);
|
||||
|
||||
const void *
|
||||
objects_list_prepend_element_if_absent(objects_list_t *list,
|
||||
const void *element);
|
||||
|
||||
const void *
|
||||
objects_list_at_index_insert_element(objects_list_t *list,
|
||||
long int n,
|
||||
const void *element);
|
||||
|
||||
const void *
|
||||
objects_list_at_index_insert_element_if_absent(objects_list_t *list,
|
||||
long int n,
|
||||
const void *element);
|
||||
|
||||
const void *
|
||||
objects_list_queue_push_element(objects_list_t *list, const void *element);
|
||||
|
||||
const void *
|
||||
objects_list_stack_push_element(objects_list_t *list, const void *element);
|
||||
|
||||
/** Replacing **/
|
||||
|
||||
void
|
||||
objects_list_replace_nth_occurrance_of_element(objects_list_t *list,
|
||||
long int n,
|
||||
const void *old_element,
|
||||
const void *new_element);
|
||||
|
||||
void
|
||||
objects_list_replace_element(objects_list_t *list,
|
||||
const void *old_element,
|
||||
const void *new_element);
|
||||
|
||||
void
|
||||
objects_list_replace_nth_element(objects_list_t *list,
|
||||
long int n,
|
||||
const void *new_element);
|
||||
|
||||
void
|
||||
objects_list_replace_first_element(objects_list_t *list,
|
||||
const void *new_element);
|
||||
|
||||
void
|
||||
objects_list_replace_last_element(objects_list_t *list,
|
||||
const void *new_element);
|
||||
|
||||
/** Removing **/
|
||||
|
||||
void
|
||||
objects_list_remove_nth_occurrence_of_element(objects_list_t *list,
|
||||
long int n,
|
||||
const void *element);
|
||||
|
||||
void
|
||||
objects_list_remove_element(objects_list_t *list, const void *element);
|
||||
|
||||
void
|
||||
objects_list_remove_nth_element(objects_list_t *list, long int n);
|
||||
|
||||
void
|
||||
objects_list_remove_first_element(objects_list_t *list);
|
||||
|
||||
void
|
||||
objects_list_remove_last_element(objects_list_t *list);
|
||||
|
||||
void
|
||||
objects_list_queue_pop_element(objects_list_t *list);
|
||||
|
||||
void
|
||||
objects_list_queue_pop_nth_element(objects_list_t *list, long int n);
|
||||
|
||||
void
|
||||
objects_list_stack_pop_element(objects_list_t *list);
|
||||
|
||||
void
|
||||
objects_list_stack_pop_nth_element(objects_list_t *list, long int n);
|
||||
|
||||
/** Emptying **/
|
||||
|
||||
void
|
||||
objects_list_empty(objects_list_t *list);
|
||||
|
||||
/** Searching **/
|
||||
|
||||
int
|
||||
objects_list_contains_element(objects_list_t *list, const void *element);
|
||||
|
||||
const void *
|
||||
objects_list_element(objects_list_t *list, const void *element);
|
||||
|
||||
const void *
|
||||
objects_list_nth_element(objects_list_t *list, long int n);
|
||||
|
||||
const void *
|
||||
objects_list_first_element(objects_list_t *list);
|
||||
|
||||
const void *
|
||||
objects_list_last_element(objects_list_t *list);
|
||||
|
||||
const void **
|
||||
objects_list_all_elements(objects_list_t *list);
|
||||
|
||||
/** Enumerating **/
|
||||
|
||||
objects_list_enumerator_t
|
||||
objects_list_enumerator(objects_list_t *list);
|
||||
|
||||
objects_list_enumerator_t
|
||||
objects_list_forward_enumerator(objects_list_t *list);
|
||||
|
||||
objects_list_enumerator_t
|
||||
objects_list_reverse_enumerator(objects_list_t *list);
|
||||
|
||||
int
|
||||
objects_list_enumerator_next_element(objects_list_enumerator_t *enumerator,
|
||||
const void **element);
|
||||
|
||||
/** Mapping **/
|
||||
|
||||
/* NO WARNING: The mapping function FCN need not be one-to-one on the
|
||||
* elements of LIST. In fact, FCN may do whatever it likes. */
|
||||
objects_list_t *
|
||||
objects_list_map_elements(objects_list_t *list,
|
||||
const void *(*fcn)(const void *, void *),
|
||||
void *user_data);
|
||||
|
||||
/** Statistics **/
|
||||
|
||||
int
|
||||
objects_list_is_empty(objects_list_t *list);
|
||||
|
||||
size_t
|
||||
objects_list_count(objects_list_t *list);
|
||||
|
||||
size_t
|
||||
objects_list_capacity(objects_list_t *list);
|
||||
|
||||
int
|
||||
objects_list_check(objects_list_t *list);
|
||||
|
||||
/** Miscellaneous **/
|
||||
|
||||
objects_hash_t *
|
||||
objects_hash_init_from_list(objects_hash_t *hash, objects_list_t *list);
|
||||
|
||||
#endif /* __list_h_OBJECTS_INCLUDE */
|
|
@ -1,429 +0,0 @@
|
|||
/* A map table.
|
||||
* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: ??? ??? ?? ??:??:?? ??? 1993
|
||||
* Updated: Thu Mar 21 00:05:43 EST 1996
|
||||
* Serial: 96.03.20.04
|
||||
*
|
||||
* This file is part of the GNU Objective C Class Library.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef __map_h_OBJECTS_INCLUDE
|
||||
#define __map_h_OBJECTS_INCLUDE 1
|
||||
|
||||
/**** Included Headers *******************************************************/
|
||||
|
||||
#include <Foundation/NSZone.h>
|
||||
#include <objects/callbacks.h>
|
||||
#include <objects/hash.h>
|
||||
|
||||
/**** Type, Constant, and Macro Definitions **********************************/
|
||||
|
||||
/* Need these up here because of their interdependence. */
|
||||
typedef struct _objects_map objects_map_t;
|
||||
typedef struct _objects_map_bucket objects_map_bucket_t;
|
||||
typedef struct _objects_map_node objects_map_node_t;
|
||||
typedef struct _objects_map_enumerator objects_map_enumerator_t;
|
||||
|
||||
/* Important structures... */
|
||||
|
||||
/* Private type for elemental holding. */
|
||||
struct _objects_map_node
|
||||
{
|
||||
/* The map table with which the node is associated. */
|
||||
objects_map_t *map;
|
||||
|
||||
/* The bucket in MAP in which the node sits. */
|
||||
objects_map_bucket_t *bucket;
|
||||
|
||||
/* These hold the BUCKET linked list together. */
|
||||
objects_map_node_t *next_in_bucket;
|
||||
objects_map_node_t *prev_in_bucket;
|
||||
|
||||
/* For enumerating over the whole map table. These make
|
||||
* enumerating much quicker. They also make it safer. */
|
||||
objects_map_node_t *next_in_map;
|
||||
objects_map_node_t *prev_in_map;
|
||||
|
||||
const void *key;
|
||||
const void *value;
|
||||
};
|
||||
|
||||
/* Private type for holding chains of nodes. */
|
||||
struct _objects_map_bucket
|
||||
{
|
||||
/* The number of nodes in this bucket. For internal consistency checks. */
|
||||
size_t node_count;
|
||||
|
||||
/* The number of elements in this bucket. (This had *better* be
|
||||
* the same as NODE_COUNT, or something's wrong.) */
|
||||
size_t element_count;
|
||||
|
||||
/* The head of this bucket's linked list of nodes. */
|
||||
objects_map_node_t *first_node;
|
||||
};
|
||||
|
||||
/* The map table type. */
|
||||
struct _objects_map
|
||||
{
|
||||
/* All structures have these...
|
||||
* And all structures have them in the same order. */
|
||||
int magic_number;
|
||||
size_t serial_number;
|
||||
NSZone *zone;
|
||||
NSString *name;
|
||||
const void *extra;
|
||||
objects_callbacks_t extra_callbacks;
|
||||
|
||||
/* For keys...And Values. */
|
||||
objects_callbacks_t key_callbacks;
|
||||
objects_callbacks_t value_callbacks;
|
||||
|
||||
/* Internal counters */
|
||||
size_t bucket_count;
|
||||
size_t node_count;
|
||||
size_t element_count;
|
||||
|
||||
/* Places to start looking for elements. */
|
||||
objects_map_bucket_t *buckets; /* Organized as a hash. */
|
||||
objects_map_node_t *first_node; /* Organized as a linked list.
|
||||
* (For enumerating...) */
|
||||
};
|
||||
|
||||
/* Type for enumerating the elements of a map table. */
|
||||
struct _objects_map_enumerator
|
||||
{
|
||||
objects_map_t *map; /* To which hash do I belong? */
|
||||
objects_map_node_t *node; /* Which node is next? */
|
||||
};
|
||||
|
||||
/**** Function Prototypes ****************************************************/
|
||||
|
||||
/** Basics... **/
|
||||
|
||||
/* All the structures (hashes, maps, lists, and arrays) have
|
||||
* the same basic ideas behind them. */
|
||||
|
||||
#include <objects/map-bas.h>
|
||||
#include <objects/map-cbs.h>
|
||||
|
||||
/** Callbacks... **/
|
||||
|
||||
/* Returns a collection of callbacks for use with hash tables. */
|
||||
objects_callbacks_t
|
||||
objects_callbacks_for_map(void);
|
||||
|
||||
/** Creating... **/
|
||||
|
||||
/* Allocate a hash table in the default zone. */
|
||||
objects_map_t *
|
||||
objects_map_alloc(void);
|
||||
|
||||
/* Allocate a hash table in the memory block ZONE. */
|
||||
objects_map_t *
|
||||
objects_map_alloc_with_zone(NSZone *zone);
|
||||
|
||||
/* Create an empty map table in the memory block ZONE. The returned
|
||||
* hash table has a "reasonable" default capacity, but will need to
|
||||
* be resized to suit your specific needs if more than a couple of
|
||||
* dozen key/value pairs will be placed within it. */
|
||||
objects_map_t *
|
||||
objects_map_with_zone_with_callbacks(NSZone *zone,
|
||||
objects_callbacks_t key_callbacks,
|
||||
objects_callbacks_t value_callbacks);
|
||||
|
||||
/* Like calling 'objects_map_with_zone_with_callbacks(0, key_callbacks,
|
||||
* value_callbacks)'. */
|
||||
objects_map_t *
|
||||
objects_map_with_callbacks(objects_callbacks_t key_callbacks,
|
||||
objects_callbacks_t value_callbacks);
|
||||
|
||||
/* Like calling 'objects_map_with_zone_with_callbacks(0,
|
||||
* objects_callbacks_standard(), objects_callbacks_standard())'. */
|
||||
objects_map_t *
|
||||
objects_map_with_zone(NSZone *zone);
|
||||
|
||||
/* Shortcuts... */
|
||||
objects_map_t *objects_map_of_int(void);
|
||||
objects_map_t *objects_map_of_int_to_char_p(void);
|
||||
objects_map_t *objects_map_of_int_to_non_owned_void_p(void);
|
||||
objects_map_t *objects_map_of_int_to_id(void);
|
||||
objects_map_t *objects_map_of_char_p(void);
|
||||
objects_map_t *objects_map_of_char_p_to_int(void);
|
||||
objects_map_t *objects_map_of_char_p_to_non_owned_void_p(void);
|
||||
objects_map_t *objects_map_of_char_p_to_id(void);
|
||||
objects_map_t *objects_map_of_non_owned_void_p(void);
|
||||
objects_map_t *objects_map_of_non_owned_void_p_to_int(void);
|
||||
objects_map_t *objects_map_of_non_owned_void_p_to_char_p(void);
|
||||
objects_map_t *objects_map_of_non_owned_void_p_to_id(void);
|
||||
objects_map_t *objects_map_of_id(void);
|
||||
|
||||
/** Initializing... **/
|
||||
|
||||
objects_map_t *
|
||||
objects_map_init(objects_map_t *map);
|
||||
|
||||
objects_map_t *
|
||||
objects_map_init_with_callbacks(objects_map_t *map,
|
||||
objects_callbacks_t key_callbacks,
|
||||
objects_callbacks_t value_callbacks);
|
||||
|
||||
objects_map_t *
|
||||
object_map_init_from_map(objects_map_t *map, objects_map_t *old_map);
|
||||
|
||||
/** Destroying... **/
|
||||
|
||||
/* Releases all the keys and values of MAP, and then
|
||||
* deallocates MAP itself. */
|
||||
void
|
||||
objects_map_dealloc(objects_map_t *map);
|
||||
|
||||
/** Gathering statistics on a map... **/
|
||||
|
||||
/* Returns the number of key/value pairs in MAP. */
|
||||
size_t
|
||||
objects_map_count(objects_map_t *map);
|
||||
|
||||
/* Returns some (inexact) measure of how many key/value pairs
|
||||
* MAP can comfortably hold without resizing. */
|
||||
size_t
|
||||
objects_map_capacity(objects_map_t *map);
|
||||
|
||||
/* Performs an internal consistency check, returns 'true' if
|
||||
* everything is OK, 'false' otherwise. Really useful only
|
||||
* for debugging. */
|
||||
int
|
||||
objects_map_check(objects_map_t *map);
|
||||
|
||||
/** Finding elements in a map... **/
|
||||
|
||||
/* Returns 'true' if and only if some key in MAP is equal
|
||||
* (in the sense of the key callbacks of MAP) to KEY. */
|
||||
int
|
||||
objects_map_contains_key(objects_map_t *map, const void *key);
|
||||
|
||||
/* Returns 'true' if and only if some value in MAP is equal
|
||||
* (in the sense of the value callbacks of MAP) to VALUE. */
|
||||
/* WARNING: This is rather inefficient. Not to be used lightly. */
|
||||
int
|
||||
objects_map_contains_value(objects_map_t *map, const void *value);
|
||||
|
||||
/* If KEY is in MAP, then the following three things happen:
|
||||
* (1) 'true' is returned;
|
||||
* (2) if OLD_KEY is non-zero, then the key in MAP
|
||||
* equal to KEY is placed there;
|
||||
* (3) if VALUE is non-zero, then the value in MAP
|
||||
* mapped to by KEY is placed there.
|
||||
* If KEY is not in MAP, then the following three things happen:
|
||||
* (1) 'false' is returned;
|
||||
* (2) if OLD_KEY is non-zero, then the "not a key marker"
|
||||
* for MAP is placed there;
|
||||
* (3) if VALUE is non-zero, then the the "not a value marker"
|
||||
* for MAP is placed there. */
|
||||
int
|
||||
objects_map_key_and_value_at_key(objects_map_t *map,
|
||||
const void **old_key,
|
||||
const void **value,
|
||||
const void *key);
|
||||
|
||||
/* If KEY is in MAP, then the key of MAP which is equal to KEY
|
||||
* is returned. Otherwise, the "not a key marker" for MAP is returned. */
|
||||
const void *
|
||||
objects_map_key_at_key(objects_map_t *map, const void *key);
|
||||
|
||||
/* If KEY is in MAP, then the value of MAP which to which KEY maps
|
||||
* is returned. Otherwise, the "not a value marker" for MAP is returned. */
|
||||
const void *
|
||||
objects_map_value_at_key(objects_map_t *map, const void *key);
|
||||
|
||||
/** Enumerating the nodes and elements of a map... **/
|
||||
|
||||
objects_map_enumerator_t
|
||||
objects_map_enumerator_for_map(objects_map_t *map);
|
||||
|
||||
int
|
||||
objects_map_enumerator_next_key_and_value(objects_map_enumerator_t *enumerator,
|
||||
const void **key,
|
||||
const void **value);
|
||||
|
||||
int
|
||||
objects_map_enumerator_next_key(objects_map_enumerator_t *enumerator,
|
||||
const void **key);
|
||||
|
||||
int
|
||||
objects_map_enumerator_next_value(objects_map_enumerator_t *enumerator,
|
||||
const void **value);
|
||||
|
||||
/** Obtaining an array of the elements of a map... **/
|
||||
|
||||
const void **
|
||||
objects_map_all_keys_and_values(objects_map_t *map);
|
||||
|
||||
const void **
|
||||
objects_map_all_keys(objects_map_t *map);
|
||||
|
||||
const void **
|
||||
objects_map_all_values(objects_map_t *map);
|
||||
|
||||
/** Removing... **/
|
||||
|
||||
/* Removes the key/value pair (if any) from MAP whose key is KEY. */
|
||||
void
|
||||
objects_map_remove_key(objects_map_t *map, const void *key);
|
||||
|
||||
/* Releases all of the keys and values of MAP without
|
||||
* altering MAP's capacity. */
|
||||
void
|
||||
objects_map_empty(objects_map_t *map);
|
||||
|
||||
/** Adding... **/
|
||||
|
||||
const void *
|
||||
objects_map_at_key_put_value_known_absent(objects_map_t *map,
|
||||
const void *key,
|
||||
const void *value);
|
||||
|
||||
const void *
|
||||
objects_map_at_key_put_value(objects_map_t *map,
|
||||
const void *key,
|
||||
const void *value);
|
||||
|
||||
const void *
|
||||
objects_map_at_key_put_value_if_absent(objects_map_t *map,
|
||||
const void *key,
|
||||
const void *value);
|
||||
|
||||
/** Replacing... **/
|
||||
|
||||
void
|
||||
objects_map_replace_key(objects_map_t *map, const void *key);
|
||||
|
||||
/** Comparing... **/
|
||||
|
||||
/* Returns 'true' if every key/value pair of MAP2 is also a key/value pair
|
||||
* of MAP1. Otherwise, returns 'false'. */
|
||||
int
|
||||
objects_map_contains_map(objects_map_t *map1, objects_map_t *map2);
|
||||
|
||||
/* Returns 'true' if MAP1 and MAP2 have the same number of key/value pairs,
|
||||
* MAP1 contains MAP2, and MAP2 contains MAP1. Otherwise, returns 'false'. */
|
||||
int
|
||||
objects_map_is_equal_to_map(objects_map_t *map1, objects_map_t *map2);
|
||||
|
||||
/* Returns 'true' iff every key of MAP2 is a key of MAP1. */
|
||||
int
|
||||
objects_map_keys_contain_keys_of_map(objects_map_t *map1, objects_map_t *map2);
|
||||
|
||||
/* Returns 'true' if MAP1 and MAP2 have the same number of key/value pairs,
|
||||
* MAP1 contains every key of MAP2, and MAP2 contains every key of MAP1.
|
||||
* Otherwise, returns 'false'. */
|
||||
int
|
||||
objects_map_keys_are_equal_to_keys_of_map(objects_map_t *map1,
|
||||
objects_map_t *map2);
|
||||
|
||||
/* Returns 'true' iff some key/value pair of MAP1 if also
|
||||
* a key/value pair of MAP2. */
|
||||
int
|
||||
objects_map_intersects_map(objects_map_t *map1, objects_map_t *map2);
|
||||
|
||||
/* Returns 'true' iff some key of MAP1 if also a key of MAP2. */
|
||||
int
|
||||
objects_map_keys_intersect_keys_of_map(objects_map_t *map1,
|
||||
objects_map_t *map2);
|
||||
/** Copying... **/
|
||||
|
||||
/* Returns a copy of OLD_MAP in ZONE. Remember that, as far as what
|
||||
* (if anything) OLD_MAP's keys and values point to, this copy is
|
||||
* shallow. If, for example, OLD_MAP is a map from int to int, then
|
||||
* you've got nothing more to worry about. If, however, OLD_MAP is a
|
||||
* map from id to id, and you want the copy of OLD_MAP to be "deep",
|
||||
* you'll need to use the mapping functions below to make copies of
|
||||
* all of the returned map's elements. */
|
||||
objects_map_t *
|
||||
objects_map_copy_with_zone(objects_map_t *old_map, NSZone *zone);
|
||||
|
||||
/* Just like 'objects_map_copy_with_zone()', but returns a copy of
|
||||
* OLD_MAP in the default zone. */
|
||||
objects_map_t *
|
||||
objects_map_copy(objects_map_t *old_map);
|
||||
|
||||
/** Mapping... **/
|
||||
|
||||
/* Iterates through MAP, replacing each key with the result of
|
||||
* '(*kfcn)(key, user_data)'. Useful for deepening copied maps
|
||||
* and other uniform (and one-to-one) transformations of map keys. */
|
||||
/* WARNING: The mapping function KFCN *must* be one-to-one on the
|
||||
* (equivalence classes of) keys of MAP. I.e., for efficiency's sake,
|
||||
* `objects_map_map_keys()' makes no provision for the possibility
|
||||
* that KFCN maps two unequal keys of MAP to the same (or equal) keys. */
|
||||
objects_map_t *
|
||||
objects_map_map_keys(objects_map_t *map,
|
||||
const void *(*kfcn)(const void *, void *),
|
||||
void *user_data);
|
||||
|
||||
/* Iterates through MAP, replacing each value with the result of
|
||||
* '(*vfcn)(value, user_data)'. Useful for deepening copied maps
|
||||
* and other uniform transformations of map keys. */
|
||||
/* NO WARNING: The mapping function VFCN need not be one-to-one on
|
||||
* (the equivalence classes of) values. */
|
||||
objects_map_t *
|
||||
objects_map_map_values(objects_map_t *map,
|
||||
const void *(*vfcn)(const void *, void *),
|
||||
void *user_data);
|
||||
|
||||
/** Resizing... **/
|
||||
|
||||
/* Resizes MAP to be ready to contain (at least) NEW_CAPACITY many elements.
|
||||
* However, as far as you are concerned, it is indeterminate what exactly
|
||||
* this means. After receiving and successfully processing this call,
|
||||
* you are *not* guaranteed that MAP has actually set aside space for
|
||||
* NEW_CAPACITY elements, for example. All that you are guaranteed is that,
|
||||
* to the best of its ability, MAP will incur no loss in efficiency so long
|
||||
* as it contains no more than NEW_CAPACITY elements. */
|
||||
size_t
|
||||
objects_map_resize(objects_map_t *map, size_t new_capacity);
|
||||
|
||||
/* Shrinks (or grows) MAP to be comfortable with the number of elements
|
||||
* it contains. In all likelyhood, after this call, MAP is more efficient
|
||||
* in terms of its speed of search vs. use of space balance. */
|
||||
size_t
|
||||
objects_map_rightsize(objects_map_t *map);
|
||||
|
||||
/** Describing... **/
|
||||
|
||||
/* Returns a string describing (the contents of) MAP. */
|
||||
NSString *
|
||||
objects_map_description(objects_map_t *map);
|
||||
|
||||
/** Set theoretic operations... **/
|
||||
|
||||
objects_map_t *
|
||||
objects_map_intersect_map(objects_map_t *map, objects_map_t *other_map);
|
||||
|
||||
objects_map_t *
|
||||
objects_map_minus_map(objects_map_t *map, objects_map_t *other_map);
|
||||
|
||||
objects_map_t *
|
||||
objects_map_union_map(objects_map_t *map, objects_map_t *other_map);
|
||||
|
||||
objects_hash_t *
|
||||
objects_hash_init_from_map_keys(objects_hash_t *hash, objects_map_t *map);
|
||||
|
||||
objects_hash_t *
|
||||
objects_hash_init_from_map_values(objects_hash_t *hash, objects_map_t *map);
|
||||
|
||||
#endif /* __map_h_OBJECTS_INCLUDE */
|
|
@ -1,67 +0,0 @@
|
|||
/* Interface for functions that dissect/make method calls
|
||||
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: Oct 1994
|
||||
|
||||
This file is part of the GNU Objective C Class Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __mframe_h_OBJECTS_INCLUDE
|
||||
#define __mframe_h_OBJECTS_INCLUDE
|
||||
|
||||
#include <objects/stdobjects.h>
|
||||
|
||||
/* These functions are used to pull apart method calls, and put them
|
||||
back together again. They are useful for things like distributed
|
||||
objects, and cross-language communication glue between Objective C
|
||||
and other languages. */
|
||||
|
||||
/* xxx Currently these function only work with the GNU Objective C
|
||||
runtime, not the NeXT runtime. */
|
||||
|
||||
|
||||
/* Extract the arguments to a method call, as found in ARGFRAME,
|
||||
according to type string TYPES, and encode them by calling ENCODER.
|
||||
Return YES if and only if the method has some pass-by-reference
|
||||
arguments. */
|
||||
|
||||
BOOL
|
||||
mframe_dissect_call (arglist_t argframe, const char *types,
|
||||
void (*encoder)(int,void*,const char*,int));
|
||||
|
||||
/* Decode the arguments to a method call by calling DECODER, knowing
|
||||
what to decode by looking at type string ENCODED_TYPES. Build an
|
||||
argframe of type arglist_t, and invoke the method. Then encode the
|
||||
return value and the pass-by-reference values using ENCODER. */
|
||||
|
||||
void
|
||||
mframe_do_call (const char *encoded_types,
|
||||
void(*decoder)(int,void*,const char*),
|
||||
void(*encoder)(int,void*,const char*,int));
|
||||
|
||||
/* Decode the return value and pass-by-reference arguments using
|
||||
DECODER, knowning what to decode by looking at type string TYPES
|
||||
and OUT_PARAMETERS, and put then into ARGFRAME. Return the
|
||||
retval_t structure that can be passed to __builtin_return(). */
|
||||
|
||||
retval_t
|
||||
mframe_build_return (arglist_t argframe, const char *types,
|
||||
BOOL out_parameters,
|
||||
void(*decoder)(int,void*,const char*,int));
|
||||
|
||||
#endif /* __mframe_h_OBJECTS_INCLUDE */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue