// // EXPStackMachine.h // StackMachine // // Created by Ashley on 23/04/2007. // Copyright 2007 __MyCompanyName__. All rights reserved. // #import #import "EXPAssemblerConstants.h" #include #include #import "history_protocol.h" #define NUMINDEXREGS 16 typedef union { unsigned int i; float x; } intfloat; struct table_s { gsl_interp_accel *acc; gsl_spline *spline; double xmin; double xmax; double ymin; double ymax; }; typedef struct table_s tableStructure; @interface EXPStackMachine : NSObject { unsigned short int *memory; unsigned int memorySize; // double *store; // unsigned int storeSize; int nConstants; int nAuxiliaries; int nVariables; tableStructure **tables; int nTables; BOOL echo; // 'DMA' pointer int ptr; // Registers. unsigned int pc; // Programme counter unsigned int sp; // Data stack ointer unsigned int lp; // Local variable base pointer unsigned int gp; // Global variable base pointer unsigned int rp; // Return stack pointer // unsigned int index[NUMINDEXREGS]; // Index registers intfloat acc; // Acumulator id _history; double _startTime; double _stopTime; double _time; } - (id) initWithMemory:(unsigned int)newMemorySize; //store:(unsigned int)newStoreSize - (unsigned short int *) memory; //- (double *) store; - (int) nConstants; - (void) setNConstants:(int) newNConstants; - (int) nAuxiliaries; - (void) setNAuxiliaries:(int) newNAuxiliaries; - (int) nVariables; - (void) setNVariables:(int) newNVariables; - (void) setTables:(tableStructure **)newTables; - (tableStructure **)tables; - (void) setNTables:(int) newNTables; - (int) nTables; - (void) setHistory:(id )history; - (id) history; - (void) setTime:(double)time; - (void) setStartTime:(double)startTime; - (double) startTime; - (void) setStopTime:(double)stopTime; - (double) stopTime; - (BOOL) echo; - (void) setEcho:(BOOL)newEcho; - (void) putOpcode:(unsigned short int)opcode mode:(unsigned short int)mode; - (void) putUInt:(unsigned int)val; - (void) putUShInt:(unsigned short int)val; - (void) putUInt:(unsigned int)val at:(unsigned int)location; - (void) putDouble:(double)val; - (void) runFromPc; - (unsigned int)ptr; - (void) setPtr:(unsigned int)newPtr; - (unsigned int)pc; - (void) setPc:(unsigned int)newPc; - (unsigned int)sp; - (void) setSp:(unsigned int)newSp; - (unsigned int)gp; - (void) setGp:(unsigned int)newGp; - (double)acc_fp; - (void) setAccFP:(double)newAcc; - (void) dump:(unsigned int)start to:(unsigned int)stop; @end