This is MiscStringDebugging.m in view mode; [Download] [Up]
//
// MiscStringDebugging.m
// Written by Don Yacktman (c) 1993 by Don Yacktman.
// Version 1.95 All rights reserved.
// This notice may not be removed from this source code.
//
// This object is included in the MiscKit by permission from the author
// and its use is governed by the MiscKit license, found in the file
// "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
// for a list of all applicable permissions and restrictions.
//
#import <misckit/MiscString.h>
@implementation MiscString(Debugging)
// This category is composed of methods which are useful when debugging apps.
// The next three methods are based on methods in Mike Ferri's MOString and
// are used with his permission.
- buildInstanceImageIn:(char *)buf
// Build a nice representation of all our instance vars in buf.
{
sprintf(buf, "\tstr = '%s' (%#x)\n\tlen = %d\tAllocated len = %d\n",
buffer, (unsigned int)buffer, length, _length);
return self;
}
- printForDebugger:(NXStream *)stream
// Overriden to use our nice instance printer as well as what it used to do.
{
char buf[200 + length]; // should be plenty big enough
[super printForDebugger:stream];
[self buildInstanceImageIn:buf];
NXWrite(stream, buf, strlen(buf));
return self;
}
- printToStdErr:(const char *)label
// Prints a nice representation of our string to the stderr labeled with
// the given label.
{
char buf[200 + length]; // should be plenty big enough
fprintf(stderr, "%s <%s:%#x>\n", label, [[self class] name],
(unsigned int)self);
[self buildInstanceImageIn:buf];
fprintf(stderr, "%s", buf);
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.