/*     
      BYTE CODE INTERPRETER . Magma 1.0 . 1996 . Sylvain HUET

         definitions
*/
// Modification history:
//
//$ FA(05/04/2001): Add new bytecodes for variable and field access
//$ FA(06/04/2001): Mark OPLOCAL, OPGLOBAL, OPFETCH, OPSTORE and OPSTORE2 as deprecated
//$ FA(06/04/2001): Modify offsets to frame entries, relative to 'bp'
//$ FA(12/04/2001): Add opcodes that appear in readmagm.c
//$ FA(12/04/2001): Reorganise bytecodes so that they all have consecutive codes in the switch
//$ FA(17/04/2001): Add family of bytecodes OPGETLOCALi, OPSETLOCALi, etc.
//$ FA(19/04/2001): Move the opcode #definitions to interp.h
//$ FA(26/04/2001): Add #define for OFFHFUN
//$ FA(22/06/2001): Debugger integration. Add extra OFFPxxx fields
//$ FA(08/08/2001): Debugger integration. Add extra OFFHPOS and OFFHLOC fields
//$ FA(12/11/2001): Replace SCOL_DEBUGGER_AWARE by RELEASE_DEVELOPER
//                  Declare printCallStack() utility function
//

#include "debug.h"
#include "mmemory.h"

/* definitions du header d'interpretation d'une routine bytecode
   ce header est place dans la pile */
#if defined(RELEASE_DEVELOPER)
# define FRAMESIZE  8
# define OFFHPOS    7
# define OFFHLOC    6
#else
# define FRAMESIZE  6
#endif
#define OFFHFUN     5
#define OFFHCODE    4
#define OFFHGLOBAL  3
#define OFFHFP      2
#define OFFHBP      1
#define OFFHPC      0


/* structure  bloc programme */
#if defined(RELEASE_DEVELOPER)
#  define SIZEPROG   8
#else
#  define SIZEPROG   5
#endif
#define OFFPARG    0
#define OFFPLOC    1
#define OFFPBCD    2
#define OFFPREF    3
#define OFFPOPT    4
#if defined(RELEASE_DEVELOPER)
//$ FA(07/11/2000)
#define OFFPVAR    5  // reference to variable
//$ FA(18/11/2000)
#define OFFPDBG    6  // trace flag
//$ FA(23/11/2000)
#define OFFPBPT    7  // breakpoint position table
#endif
//

/* definitions des masques de message console */
#define MSKFOO     1
#define MSKRUNTIME 2
#define MSKWARNING 4
#define MSKTRACE   8
#define MSKDEBUG   16

extern int MaskEcho;


/* interpreteur de bytecode
   ( on suppose que les arguments sont empiles, ainsi que le programme
     a executer )
*/
int Minterpreter(mmachine m);
int Minterpreter2(mmachine m,int bcinit);


/* affichage du code d'erreur */
int Mprinterror(int i);

//$ FA(12/11/2001): Declare call stack print function
void printCallStack(void);
//