This is SRFlipFlop.m in view mode; [Download] [Up]
//
// SRFlipFlop
//
#import "SRFlipFlop.h"
@implementation SRFlipFlop
- initS:snode r:rnode out:outnode
{
[super init];
state = 0;
INITDEVTYPE("SRFlipFlop");
TESTNODE("S", snode, 1);
TESTNODE("R", rnode, 1);
TESTNODE("OUT", outnode, 1);
S = snode;
R = rnode;
OUT = outnode;
return self;
}
- cycle
{
bit *sval = [S getBits];
bit *rval = [R getBits];
if(*sval && !(*rval)) {
state = 1;
}
else if(!(*sval) && *rval) {
state = 0;
}
[OUT setBits:&state];
return self;
}
@end
//
// End of file.
//These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.