// idbg - IJVM debugger.
// Copyright 2000 Tom Rothamel <tom-idbg@onegeek.org>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  

#ifndef IDBG_H
#define IDBG_H

#include <stdio.h>

#include <readline/readline.h>
#include <readline/history.h>
#include <ncurses.h>

#include "ijvm.h"


struct Variable {
	struct Variable *next;

	char *name;
	int num;
};

struct Method {
	struct Method *next;
	
	char *name;
	int addr;
	int len;

	struct Variable *vars;
};

struct Breakpoint {
	Breakpoint *prev;
	Breakpoint *next;
	int pc;
};

// breakpoint.cc
Breakpoint *lookup_breakpoint(int);
void add_breakpoint(int);
void drop_breakpoint(int);
void show_breakpoints();

// commands.yy
void parse_string(char *);

// commands.lex.ll
void scan_string(char *);

// curses.cc
void curses_init();
void curses_erase();
void curses_show();
void curses_hide();

// debugger.cc
void stack(int);
void disasm(int, int);
void do_prompt();
void quick_prompt();
void full_prompt();
void do_trace();
int method_name(int, int);
void do_vars();

// execute.cc
extern int got_sigint;

int execute(int);
void run();
void go();
void next();

// main.cc
extern VM *vm;
extern int pp_quick;
extern int pp_full;
extern int pp_disasm;

void reinit();
void quit(int);

// output.cc
extern int opage;

void oreset();
void oprintf(char *, ...);
void oprint(char *, ...);
void olog(FILE *);


// symbols.cc
int lookup_method_offset(char *, int);
Method *lookup_method_name(char *);
Method *lookup_method_addr(int);

Variable *lookup_variable_num(Variable *, int);
Variable *lookup_constant(int);

int read_symbols(FILE *f);


#endif
