home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula
/
nebula.bin
/
SourceCode
/
Tee3.0
/
Tee.m
< prev
next >
Wrap
Text File
|
1993-06-23
|
1KB
|
71 lines
// Tee.m
//
// Tee implementation file
//
// Copyright (C) 1992 Dimitri Tischenko & P.B. Schuller, Delft U. of T.
// Many thanks to Scott Hess
//
#import "Tee.h"
#include <stdio.h>
#ifdef DEBUG
static void log(STR, id, STR, SEL);
#else
#define log(a, b, c, d)
#endif
@implementation Tee
- forward:(SEL)aSelector: (marg_list)argFrame
{
if ([target1 isKindOf:[Tee class]])
{
log("target1", target1, "forward", aSelector);
[target1 forward:aSelector :argFrame];
}
else
{
if ([target1 respondsTo:aSelector]){
log("target1", target1, "performv", aSelector);
[target1 performv:aSelector :argFrame];
}
}
if ([target2 isKindOf:[Tee class]])
{
log("target2", target2, "forward", aSelector);
[target2 forward:aSelector :argFrame];
}
else
{
if ([target2 respondsTo:aSelector]){
log("target2", target2, "performv", aSelector);
[target2 performv:aSelector :argFrame];
}
}
return self;
}
- (BOOL)respondsTo:(SEL)aSelector
{
#ifdef DEBUG
printf("Tee respondsTo: %s = %s\n",
sel_getName(aSelector), aSelector ? "YES":"NO");
#endif
if (!aSelector)
return NO;
else
return YES;
}
#ifdef DEBUG
void log(STR varname, id obj, STR action, SEL aSelector)
{
printf("%s is a %s; %s %s\n", varname, [obj name], action, sel_getName(aSelector));
}
#endif
@end