campo-sirio/ba/ba8304.h
guy 2b0291afdb Patch level : 2.1 nopatch
Files correlati     : ba0 ba8
Ricompilazione Demo : [ ]
Commento            :

ba0 aggiunto meccanismo di chiusura automatica in caso di installazione modulo sys
ba8 aggiunto converitore di form primordiale


git-svn-id: svn://10.65.10.50/trunk@12048 c028cbd2-c16b-5b4b-a496-9718f37d4682
2004-05-04 08:25:23 +00:00

72 lines
1.5 KiB
C++
Executable File

#ifndef __ALEX_H
#define __ALEX_H
#ifndef __RECORDSET_H
#include "ba8201.h"
#endif
class TVariant_stack : public TObject
{
TArray _var;
int _sp;
public:
int items() const { return _sp; }
bool drop();
TVariant& pop();
TVariant& peek(int depth = 0);
void roll(int depth);
bool push(const TVariant& var);
bool push(long n);
bool push(const real& n);
bool push(const TString& str);
void reset();
TVariant_stack() : _sp(0) { }
};
// Generic bytecode for any language
class TBytecode : public TArray
{
TString _name;
public:
void set_name(const char* name) { _name = name; }
const TString& name() const { return _name; }
};
// ALEX = Another Language EXtension
class TAVM;
class TAlex_virtual_machine : public TObject
{
TAVM* _avm; // Chesire's cat class
protected:
TAVM& avm();
public:
virtual size_t get_usr_words(TString_array& names) const;
virtual bool execute_usr_word(unsigned int opcode, TVariant_stack& stack);
virtual bool get_usr_val(const TString& name, TVariant& var) const;
virtual bool set_usr_val(const TString& name, const TVariant& var);
const TString& get_last_error() const;
bool compile(istream& instr, TBytecode& bc);
bool compile(const char* cmd, TBytecode& bc);
bool execute(const TBytecode& bc, ostream& outstr);
bool execute(const TBytecode& bc, TString& outstr);
bool fload(const char* fname);
void warm_restart();
void cold_restart();
TAlex_virtual_machine();
virtual ~TAlex_virtual_machine();
};
#endif