Removed obsolete code

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6739 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-06-20 15:18:23 +00:00
parent 37b4bb4809
commit f1edebc42f
6 changed files with 30 additions and 162 deletions

View file

@ -8,6 +8,7 @@
* Tools/gsdoc.gsdoc: Added from GSDoc
* Tools/gnustep.gsdoc: Added from GSDoc
* GSDoc: all removed
* Examples: removed obsolete code.
2000-06-19 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -31,14 +31,10 @@ include $(GNUSTEP_MAKEFILES)/common.make
# The tools to be compiled
TEST_TOOL_NAME = \
dictionary \
stdio-stream \
textcoding
dictionary
# The Objective-C source files to be compiled
dictionary_OBJC_FILES = dictionary.m
stdio-stream_OBJC_FILES = stdio-stream.m
textcoding_OBJC_FILES = textcoding.m
SRCS = $(TEST_TOOL_NAME:=.m)
@ -47,10 +43,10 @@ HDRS =
DIST_FILES = $(SRCS) $(HDRS) GNUmakefile Makefile.postamble Makefile.preamble \
custom-zone.m
-include Makefile.preamble
include Makefile.preamble
-include GNUmakefile.local
include GNUmakefile.local
include $(GNUSTEP_MAKEFILES)/test-tool.make
-include Makefile.postamble
include Makefile.postamble

View file

@ -45,7 +45,7 @@ ADDITIONAL_OBJCFLAGS =
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS = -I../Source -I../Source/srcdir-include
ADDITIONAL_INCLUDE_DIRS = -I../Headers
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS =

View file

@ -1,40 +1,40 @@
/* A simple demonstration of the GNU Dictionary object.
In this example the Dictionary holds int's which are keyed by strings. */
/* A simple demonstration of the NSDictionary object.
In this example the NSDictionary holds int's which are keyed by strings. */
#include <base/Dictionary.h>
#include <Foundation/Foundation.h>
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSString.h>
int main()
int
main()
{
id d;
NSMutableDictionary *d;
CREATE_AUTORELEASE_POOL(pool);
/* Create a Dictionary object. */
d = [[Dictionary alloc] initWithCapacity: 32];
d = [[NSMutableDictionary alloc] initWithCapacity: 32];
/* Load the dictionary with some items */
[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"];
[d setObject: [NSNumber numberWithInt: 1] forKey: @"one"];
[d setObject: [NSNumber numberWithInt: 2] forKey: @"two"];
[d setObject: [NSNumber numberWithInt: 3] forKey: @"three"];
[d setObject: [NSNumber numberWithInt: 4] forKey: @"four"];
[d setObject: [NSNumber numberWithInt: 5] forKey: @"five"];
[d setObject: [NSNumber numberWithInt: 6] forKey: @"six"];
printf("There are %u elements stored in the dictionary\n",
[d count]);
NSLog(@"There are %u elements stored in the dictionary\n", [d count]);
printf("Element %d is stored at \"%s\"\n",
[[d objectAtKey: @"three"] intValue],
"three");
NSLog(@"Element %d is stored at \"%s\"\n",
[[d objectForKey: @"three"] intValue], "three");
printf("Removing element stored at \"three\"\n");
[d removeObjectAtKey: @"three"];
NSLog(@"Removing element stored at \"three\"\n");
[d removeObjectForKey: @"three"];
printf("Removing element 2\n");
[d removeObject: [NSNumber numberWithInt: 2]];
printf("Now there are %u elements stored in the dictionary\n",
[d count]);
NSLog(@"Now there are %u elements stored in the dictionary\n", [d count]);
DESTROY(pool);
exit(0);
}

View file

@ -1,38 +0,0 @@
/* A simple example of writing and reading to a file using the
GNU StdioStream object. */
#include <base/StdioStream.h>
#include <Foundation/NSString.h>
int main()
{
id stream;
int count = 0;
int i = 0;
float f = 0.0;
double d = 0.0;
unsigned u = 0;
unsigned char uc = 0;
unsigned ux = 0;
char *cp = NULL;
stream = [[StdioStream alloc]
initWithFilename: @"./stdio-stream.txt"
fmode:"w"];
[stream writeFormat: @"testing %d %u %f %f 0x%x \"cow\"\n",
1234, 55, 3.14159, 1.23456789, 0xfeedface];
[stream release];
stream = [[StdioStream alloc]
initWithFilename: @"./stdio-stream.txt"
fmode:"r"];
count = [stream readFormat: @"testing %d %u %f %lf 0x%x \"%a[^\"]\"\n",
&i, &u, &f, &d, &ux, &cp];
uc = (unsigned char) ux;
[stream release];
printf("Read count=%d, int=%d unsigned=%u float=%f double=%f "
"uchar=0x%x char*=%s\n",
count, i, u, f, d, (unsigned)uc, cp);
exit(0);
}

View file

@ -1,91 +0,0 @@
/* A demonstration of writing and reading GNU Objective C objects to a file,
in human-readable text format.
Look at the file "textcoding.txt" after running this program to see the
text archive format.
*/
#include <base/Archiver.h>
#include <base/TextCStream.h>
#include <base/Array.h>
#include <base/Dictionary.h>
#include <Foundation/NSString.h>
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSValue.h>
int main()
{
id array, dictionary;
id archiver;
id name;
id arp;
int i;
[NSObject enableDoubleReleaseCheck: YES];
arp = [[NSAutoreleasePool alloc] init];
/* Create an Array and Dictionary */
array = [Array new];
dictionary = [Dictionary new];
for (i = 0; i < 6; i++)
{
[array addObject: [NSNumber numberWithInt: i]];
[dictionary putObject: [NSNumber numberWithInt: i]
atKey: [NSNumber numberWithInt: i*i]];
}
[array printForDebugger];
[dictionary printForDebugger];
/* Write them to a file */
/* Create an instances of the Archiver class, specify that we
want human-readable "Text"-style, instead of "Binary"-style
coding. */
archiver = [[Archiver alloc] initForWritingToFile: @"./textcoding.txt"
withCStreamClass: [TextCStream class]];
[archiver encodeObject: array
withName: @"Test Array"];
[archiver encodeObject: dictionary
withName: @"Test Dictionary"];
/* Release the objects that were coded */
[array release];
[dictionary release];
/* Close the archiver, (and thus flush the stream); then release it.
We must separate the idea of "closing" a stream and
"deallocating" a stream because of delays in deallocation due to
-autorelease. */
[archiver close];
[archiver release];
/* Read them back in from the file */
/* First create the unarchiver */
archiver = [Unarchiver newReadingFromFile: @"./textcoding.txt"];
/* Read in the Array */
[archiver decodeObjectAt: &array withName: &name];
printf("got object named %@\n", name);
/* Read in the Dictionary */
[archiver decodeObjectAt: &dictionary withName: &name];
printf("got object named %@\n", name);
/* Display what we read, to make sure it matches what we wrote */
[array printForDebugger];
[dictionary printForDebugger];
/* Release the objects we read */
[array release];
[dictionary release];
/* Release the unarchiver. */
[archiver release];
/* Do the autorelease. */
[arp release];
exit(0);
}