mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Changes made in Rochester. See ChangeLog
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1650 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a88ace74a6
commit
52441fecef
55 changed files with 935 additions and 342 deletions
|
@ -30,7 +30,7 @@ VPATH = @srcdir@
|
|||
|
||||
CC = @CC@
|
||||
|
||||
CFLAGS = -Wall -Wno-implicit -g -O
|
||||
CFLAGS = -Wall -Wno-implicit -Wno-format -g -O
|
||||
CPPFLAGS =
|
||||
LDFLAGS =
|
||||
|
||||
|
@ -113,7 +113,7 @@ clean: mostlyclean
|
|||
distclean: clean
|
||||
rm -f Makefile config.status
|
||||
|
||||
realclean: distclean
|
||||
maintainer-clean: distclean
|
||||
rm -f TAGS
|
||||
|
||||
copy-dist: $(DIST_FILES)
|
||||
|
|
|
@ -1,49 +1,40 @@
|
|||
/* A simple demonstration of the GNU Dictionary object.
|
||||
In this example the Dictionary holds int's which are keyed by strings. */
|
||||
|
||||
#include <gnustep/base/all.h>
|
||||
#include <gnustep/base/Dictionary.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
#warning This file has not been updated for the new collection classes
|
||||
|
||||
#if 0
|
||||
int main()
|
||||
{
|
||||
id d;
|
||||
|
||||
/* Create a Dictionary object that will store int's with string keys */
|
||||
d = [[Dictionary alloc]
|
||||
initWithType:@encode(int)
|
||||
keyType:@encode(char*)];
|
||||
/* Create a Dictionary object. */
|
||||
d = [[Dictionary alloc] initWithCapacity: 32];
|
||||
|
||||
/* Load the dictionary with some items */
|
||||
[d putElement:1 atKey:"one"];
|
||||
[d putElement:2 atKey:"two"];
|
||||
[d putElement:3 atKey:"three"];
|
||||
[d putElement:4 atKey:"four"];
|
||||
[d putElement:5 atKey:"five"];
|
||||
[d putElement:6 atKey:"six"];
|
||||
[d putObject: [NSNumber numberWithInt: 1] atKey: @"one"];
|
||||
[d putObject: [NSNumber numberWithInt: 2] atKey: @"two"];
|
||||
[d putObject: [NSNumber numberWithInt: 3] atKey: @"three"];
|
||||
[d putObject: [NSNumber numberWithInt: 4] atKey: @"four"];
|
||||
[d putObject: [NSNumber numberWithInt: 5] atKey: @"five"];
|
||||
[d putObject: [NSNumber numberWithInt: 6] atKey: @"six"];
|
||||
|
||||
printf("There are %u elements stored in the dictionary\n",
|
||||
[d count]);
|
||||
|
||||
printf("Element %d is stored at \"%s\"\n",
|
||||
[d elementAtKey:"three"].int_u, "three");
|
||||
[[d objectAtKey: @"three"] intValue],
|
||||
"three");
|
||||
|
||||
printf("Removing element stored at \"three\"\n");
|
||||
[d removeElementAtKey:"three"];
|
||||
[d removeObjectAtKey: @"three"];
|
||||
|
||||
printf("Removing element 2\n");
|
||||
[d removeElement:2];
|
||||
[d removeObject: [NSNumber numberWithInt: 2]];
|
||||
|
||||
printf("Now there are %u elements stored in the dictionary\n",
|
||||
[d count]);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
#else
|
||||
int main()
|
||||
{
|
||||
exit (0);
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
|
|
@ -18,7 +18,7 @@ id announce_new_connection (id notification)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
id server;
|
||||
static id server;
|
||||
id a1;
|
||||
id remote_array;
|
||||
char namebuf[16];
|
||||
|
@ -69,7 +69,7 @@ int main(int argc, char *argv[])
|
|||
/* Cause an exception, and watch it return to us. */
|
||||
NS_DURING
|
||||
{
|
||||
id o = [remote_array objectAtIndex: 99];
|
||||
[remote_array objectAtIndex: 99];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <gnustep/base/Notification.h>
|
||||
#include <gnustep/base/Invocation.h>
|
||||
|
||||
/* This function will be called by an Invocation object that will be
|
||||
registered to fire every time an InPort accepts a new client. */
|
||||
id announce_new_port (id notification)
|
||||
{
|
||||
id in_port = [notification object];
|
||||
|
@ -17,6 +19,8 @@ id announce_new_port (id notification)
|
|||
return nil;
|
||||
}
|
||||
|
||||
/* This function will be called by an Invocation object that will be
|
||||
registered to fire every time an InPort client disconnects. */
|
||||
id announce_broken_port (id notification)
|
||||
{
|
||||
id in_port = [notification object];
|
||||
|
@ -28,6 +32,8 @@ id announce_broken_port (id notification)
|
|||
return nil;
|
||||
}
|
||||
|
||||
/* The implementation of the object that will be registered with D.O.
|
||||
as the server. */
|
||||
@implementation SecondServer
|
||||
|
||||
- init
|
||||
|
|
|
@ -77,7 +77,7 @@ int main()
|
|||
[array printForDebugger];
|
||||
[dictionary printForDebugger];
|
||||
|
||||
/* Relase the objects we read */
|
||||
/* Release the objects we read */
|
||||
[array release];
|
||||
[dictionary release];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue