spot/iface/nips/nips_vm/bytecode.h
Guillaume Sadegh bc5f13bb4e NIPS VM added to the SPOT distribution.
2008-05-29  Guillaume SADEGH  <sadegh@lrde.epita.fr>

	* iface/nips/nips.cc, iface/nips/nips.hh, iface/nips/common.cc,
	iface/nips/common.hh, iface/nips/Makefile.am: TGBA implementation
	with the NIPS library.
	* iface/nips/emptiness_check.cc: Emptiness check on a Promela
	interface.
	* iface/nips/dottynips.cc: Dot printer on the NIPS interface.
	* iface/nips/compile.sh: Add. Wrapper around nips compiler to
	compile Promela to NIPS bytecode.
	* iface/nips/nips_vm,iface/nips/nips_vm/bytecode.h,
	iface/nips/nips_vm/ChangeLog, iface/nips/nips_vm/COPYING,
	iface/nips/nips_vm/hashtab.c, iface/nips/nips_vm/hashtab.h,
	iface/nips/nips_vm/INSTALL, iface/nips/nips_vm/instr.c,
	iface/nips/nips_vm/instr.h, iface/nips/nips_vm/instr_step.c,
	iface/nips/nips_vm/instr_step.h,
	iface/nips/nips_vm/instr_tools.c,
	iface/nips/nips_vm/instr_tools.h,
	iface/nips/nips_vm/instr_wrap.c,
	iface/nips/nips_vm/instr_wrap.h,
	iface/nips/nips_vm/interactive.c,
	iface/nips/nips_vm/interactive.h, iface/nips/nips_vm/main.c,
	iface/nips/nips_vm/Makefile, iface/nips/nips_vm/Makefile.am,
	iface/nips/nips_vm/nips_asm_help.pl,
	iface/nips/nips_vm/nips_asm_instr.pl,
	iface/nips/nips_vm/nips_asm.pl,
	iface/nips/nips_vm/nips_disasm.pl, iface/nips/nips_vm/nipsvm.c,
	iface/nips/nips_vm/nipsvm.h, iface/nips/nips_vm/README,
	iface/nips/nips_vm/rt_err.c, iface/nips/nips_vm/rt_err.h,
	iface/nips/nips_vm/search.c, iface/nips/nips_vm/search.h,
	iface/nips/nips_vm/split.c, iface/nips/nips_vm/split.h,
	iface/nips/nips_vm/state.c, iface/nips/nips_vm/state.h,
	iface/nips/nips_vm/state_inline.h,
	iface/nips/nips_vm/state_parts.c,
	iface/nips/nips_vm/state_parts.h, iface/nips/nips_vm/timeval.h,
	iface/nips/nips_vm/tools.h: NIPS VM added to the SPOT
	distribution.
	* configure.ac, iface/Makefile.am: Build system updated for the
	NIPS front-end.
2008-05-30 13:22:00 +02:00

93 lines
2.5 KiB
C

/* NIPS VM - New Implementation of Promela Semantics Virtual Machine
* Copyright (C) 2005: Stefan Schuermans <stefan@schuermans.info>
* Michael Weber <michaelw@i2.informatik.rwth-aachen.de>
* Lehrstuhl fuer Informatik II, RWTH Aachen
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
*/
#ifndef INC_bytecode
#define INC_bytecode
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
// module flags
#define BC_MODFLAG_MONITOR 0x00000001 // if a monitor process exists in bytecode
// type for flags at some address
#define BC_FLAG_PROGRESS 0x00000001
#define BC_FLAG_ACCEPT 0x00000002
typedef struct t_bc_flag
{
uint32_t addr, flags;
} st_bc_flag;
// type for a source location (mapping of address to line and column in source)
typedef struct t_src_loc
{
uint32_t addr, line, col;
} st_src_loc;
// type for a structure inforamtion
typedef struct t_str_inf
{
uint32_t addr;
uint8_t code;
char *type, *name;
} st_str_inf;
// type for pointer to bytecode and its size
typedef struct t_bytecode
{
uint32_t modflags; // module flags
uint32_t size; // size of bytecode
uint8_t *ptr; // pointer to bytecode
uint16_t flag_cnt; // number of flag entries in table
st_bc_flag *flags; // flag table
uint16_t string_cnt; // number of strings in string table
char **strings; // string table
uint16_t src_loc_cnt; // number of source locations in table
st_src_loc *src_locs; // source location table
uint16_t str_inf_cnt; // number of structure information in table
st_str_inf *str_infs; // structure information table
} st_bytecode;
// load bytecode module from file
// if module == NULL the first module is loaded
// returns NULL on error (errno ist set in this case)
extern st_bytecode * bytecode_load_from_file( const char *filename, const char *module );
// unload bytecode
extern void bytecode_unload( st_bytecode *bytecode );
// check if a monitor process exists in bytecode
extern int bytecode_monitor_present( st_bytecode *bytecode );
// get flags at address (e.g. program counter)
extern uint32_t bytecode_flags( st_bytecode *bytecode, uint32_t addr );
// get source location from address (e.g. program counter)
extern st_src_loc bytecode_src_loc( st_bytecode *bytecode, uint32_t addr );
// get structure information from address (e.g. program counter)
extern st_str_inf *bytecode_str_inf( st_bytecode *bytecode, uint32_t addr, unsigned int *start );
#ifdef __cplusplus
} // extern "C"
#endif
#endif // #ifndef INC_bytecode