stackframe.h

Go to the documentation of this file.
00001 /*
00002  *  stackframe.h - a usecode interpreter stack frame
00003  *
00004  *  Copyright (C) 2002  The Exult Team
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef _STACKFRAME_H
00022 #define _STACKFRAME_H
00023 
00024 #include "exult_types.h"
00025 #include <iosfwd>
00026 
00027 class Usecode_function;
00028 class Game_object;
00029 class Usecode_value;
00030 
00031 class Stack_frame
00032 {
00033  public:
00034   Stack_frame(Usecode_function *fun, int event,
00035         Game_object *caller, int chain, int depth);
00036   ~Stack_frame();
00037 
00038   Usecode_function *function;
00039   uint8 *ip; // current IP
00040   uint8 *data; // pointer to start of data segment
00041   uint8 *externs; // pointer to start of externs
00042   uint8 *code; // pointer to (actual) code
00043   uint8 *endp; // pointer directly past code segment
00044   int line_number; // if debugging info present
00045 
00046   // should probably add source filename?
00047 
00048   int call_chain; // unique ID for this call chain
00049   int call_depth; // zero for top level function
00050 
00051   int num_externs;
00052   int num_args;
00053   int num_vars;
00054   Usecode_value *locals;
00055 
00056   int eventid;
00057   Game_object *caller_item;
00058 
00059   Usecode_value *save_sp;
00060 
00061   static int LastCallChainID;
00062   static int getCallChainID() { return ++LastCallChainID; }
00063 };
00064 
00065 std::ostream& operator<<(std::ostream& out, Stack_frame& val);
00066 
00067 #endif

Generated on Mon Jul 9 14:42:52 2007 for ExultEngine by  doxygen 1.5.1