ftp.nice.ch/pub/next/tools/hack/MachOViewer.NIHS.bs.tar.gz#/MachOViewer/Source/MachOView.h

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

#import <appkit/appkit.h>
#import <MachOFile.h>
#import <MappedFile.h>
#import <Queue.h>
#import <MachOViewwraps.h>

/* $Id: MachOView.h,v 1.13 94/05/29 14:59:23 ediger Exp Locker: ediger $ */
/* $Log:	MachOView.h,v $
 * Revision 1.13  94/05/29  14:59:23  ediger
 * added support for drawing in section names
 * 
 * Revision 1.12  94/05/23  20:32:37  ediger
 * stuff to support address bracket zoom-in
 * 
 * Revision 1.11  94/05/17  23:08:53  ediger
 * support for stacking of zoomed address ranges, changed types of
 * some instance vars from id to pointer to that kind of object.
 * 
 * Revision 1.10  94/05/10  22:41:28  ediger
 * support for showing a "zooming box" by mouse-down dragging
 * 
 * Revision 1.9  94/05/04  11:20:40  ediger
 * support for drawing thread's program counter(s)
 * 
 * Revision 1.8  94/05/01  17:33:12  ediger
 * efficiency improvements
 * 
 * Revision 1.7  94/02/07  21:21:39  ediger
 * added instance var to hold a memory-mapped file.
 * added methods and change struct addressMapping so that segment names
 * can be displayed.
 * 
 * Revision 1.6  94/01/30  21:29:39  ediger
 * ditched doFont pswrap function, added theFont Font object instance
 * to get the benefits of using a Font.
 * 
 * Revision 1.5  94/01/30  16:29:04  ediger
 * some magic numbers relating to address label printing
 * 
 * Revision 1.4  94/01/01  23:02:51  ediger
 * broke address label spacing calcs into separate method.
 * 
 * Revision 1.3  93/12/30  19:01:09  ediger
 * support for showing upper and lower addresses of memor
 * mapped segments
 * 
 * Revision 1.2  93/12/19  14:31:21  ediger
 * corrected scaling and inclusion of mapped segments of library files
 * 
 * Revision 1.1  93/12/19  12:59:49  ediger
 * Initial revision
 * 
*/

struct addressMapping {
	float         yCoordBaseLabel;
	float         yCoordTopLabel;

	float         nameXcoord;
	float         nameYcoord;

	unsigned long baseAddress;
	unsigned long endAddress;
	char         *segmentName;

	float         yCoordBase;
	float         yCoordTop;

	struct sectionNameMapping *sectionMap;
};

struct sectionNameMapping {
	float nameYcoord;

	unsigned long sectionAddress;
	char *sectionName;
};

struct zoomAddress {
	unsigned long hiAddr;
	unsigned long loAddr;
	unsigned long sumAddr;
};

/* some magic numbers relating to drawing */
#define LABEL_HT      12.0
#define LABEL_LEADING  1.0
#define LABEL_MARGIN   2.0
#define LINE_WDTH      5.0
#define LINE_STAGGER   7.0
#define SEGMENT_GAP    2.0
#define VERT_MARGIN    5.0

@interface MachOView:View
{
	// ids to store "connections" built by Interface Builder
    id	theWindow;
    id	theFont;
	id  cpuType;
	id  cpuSubtype;
	id  maxAddress;
	id  minAddress;
	id  zoomButton;
	id  unzoomButton;
	id  showSectionsButton;

	// ids to store objects used by MachOView to do stuff
    MachOFile  *theFile;     // represents Mach-O object file.
    MappedFile *mappedFile;  // manages memory mapping/unmapping, Mach style.
	Queue      *zoomStack;   // stack of addresses that have been zoomed to.

	unsigned long hiAddr, hiAddrZoom;
	unsigned long loAddr, loAddrZoom;
	unsigned long sumAddr;

	char *currentFileName;

	float                      scaleSlope, scaleYintercept;
	float                      smashedSlope, smashedYintercept;
	struct addressMapping     *addressMap;
	struct sectionNameMapping *sectionNames;

	// display options boolean state variables
	BOOL toScale;
	BOOL showLibraries;
	BOOL showAddresses;
	BOOL showNames;
	BOOL showThreads;
	BOOL showSectionNames;

	// drag out a rectangle for address zooming
	NXPoint  sMouseDown, sFirstMouseDown;
	BOOL yLooping;
}

- free;
- freeInternals;
- findSizes;
- rescale;
- openFileNamed:(char *)fileName;
- windowWillClose:sender;
- initFrame:(const NXRect *)frameRect;
- drawSelf:(NXRect *)rects :(int)rectCount;
- mouseDown:(NXEvent *)theEvent;
- drawThreads;
- drawAddresses;
- drawSegmentNames;
- drawSectionNames;
- show:sender;

- (char *)fileType;

- toggleScaling:sender;
- toggleLibraries:sender;
- toggleAddresses:sender;
- toggleNames:sender;
- toggleThreads:sender;
- toggleSections:sender;

- zoom:sender;
- unzoom:sender;

- spaceLabels;
- spaceNames;
- spaceSectionNames;

@end

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