ftp.nice.ch/pub/next/developer/resources/classes/CompSim.s.tar.gz#/CompSim/Node.h

This is Node.h in view mode; [Download] [Up]

//
// Node
//
// An Objective-C class for nodes for connecting signals in a computer simulation.
//
// Nodes are just place-holders. For instance, if we are designing a new device that
// uses two other devices like:
//
//             +------------+       +------------+
//   IN------->|  Device 1  |------>|  Device 2  |------->OUT
//             +------------+       +------------+
//
// Then, IN and OUT would be Nodes, becuase we get and put data from and into them,
// and we would make an intermediate node dev1_out and place it thusly:
//
//             +------------+                       +------------+
//   IN------->|  Device 1  |------>dev1_out------->|  Device 2  |------->OUT
//             +------------+                       +------------+
//
// Devices only read from and write to Nodes.
//


#import <objc/Object.h>
#import <stdio.h>


typedef unsigned char Bool;
typedef unsigned char bit;


//
// For testing nodes for proper size.
//

extern	char	NODE_TESTDEVTYPE[255];

#define INITDEVTYPE(str1)	strcpy(NODE_TESTDEVTYPE, str1)

void TESTNODE(char *name, id nd, int num);


//
// Node interface declaration
//

@interface Node : Object


{
    bit	*data;						// Pointer to bit array.
    int	numbits;					// Number of bits in array.
}


- initNumBits:(int)nbits;				// Generic initialization (init to 0).
- initNumBits:(int)nbits contents:(bit *)cont;		// Used for arbitrary constants.
- initNumBits:(int)nbits fill:(bit)cont;		// Used for 00...00 and 11...11.
- free;							// Free the node and all associated data.

- (int)numbits;						// Return size in bits.

- setBits:(bit *)someData;
- (bit *)getBits;

- dumpBinaryToFile:(FILE *)aFile;
- dumpHexToFile:(FILE *)aFile;
- dumpWithName:(char *)aName toFile:(FILE *)aFile;


@end


//
// End of file.
//

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.