2013-10-20 21:18:27 +03:00
|
|
|
#ifndef _library__controller_parse__hpp__included__
|
|
|
|
#define _library__controller_parse__hpp__included__
|
|
|
|
|
|
|
|
#include "controller-data.hpp"
|
2013-10-23 18:06:33 +03:00
|
|
|
#include "assembler.hpp"
|
2013-10-20 21:18:27 +03:00
|
|
|
#include "json.hpp"
|
|
|
|
|
|
|
|
struct port_controller_set* pcs_from_json(const JSON::node& root, const std::string& ptr);
|
|
|
|
std::vector<port_controller_set*> pcs_from_json_array(const JSON::node& root, const std::string& ptr);
|
|
|
|
std::string pcs_write_class(const struct port_controller_set& pset, unsigned& tmp_idx);
|
|
|
|
std::string pcs_write_trailer(const std::vector<port_controller_set*>& p);
|
|
|
|
std::string pcs_write_classes(const std::vector<port_controller_set*>& p, unsigned& tmp_idx);
|
|
|
|
|
|
|
|
struct port_type_generic : public port_type
|
|
|
|
{
|
|
|
|
port_type_generic(const JSON::node& root, const std::string& ptr) throw(std::exception);
|
2013-10-23 18:06:33 +03:00
|
|
|
~port_type_generic() throw();
|
2013-10-20 21:18:27 +03:00
|
|
|
struct ser_instruction
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
void* djumpvector;
|
|
|
|
void* ejumpvector;
|
|
|
|
size_t offset;
|
|
|
|
unsigned char mask;
|
|
|
|
char character;
|
|
|
|
};
|
|
|
|
struct idxinfo
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
size_t offset;
|
|
|
|
unsigned char mask;
|
|
|
|
unsigned char imask;
|
|
|
|
int controller;
|
|
|
|
int index;
|
|
|
|
};
|
|
|
|
private:
|
|
|
|
std::vector<size_t> indexbase;
|
|
|
|
std::vector<idxinfo> indexinfo;
|
2013-10-23 18:06:33 +03:00
|
|
|
void* dyncode_block;
|
2013-10-20 21:18:27 +03:00
|
|
|
mutable std::vector<ser_instruction> serialize_instructions;
|
|
|
|
std::string port_iname(const JSON::node& root, const std::string& ptr);
|
|
|
|
std::string port_hname(const JSON::node& root, const std::string& ptr);
|
|
|
|
size_t port_size(const JSON::node& root, const std::string& ptr);
|
|
|
|
static void _write(const port_type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x);
|
|
|
|
static short _read(const port_type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl);
|
|
|
|
static size_t _serialize(const port_type* _this, const unsigned char* buffer, char* textbuf);
|
|
|
|
static size_t _deserialize(const port_type* _this, unsigned char* buffer, const char* textbuf);
|
2013-10-23 18:06:33 +03:00
|
|
|
void make_dynamic_blocks();
|
|
|
|
void make_routines(assembler::assembler& a, std::list<assembler::label>& labels);
|
2013-10-20 21:18:27 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|