git-svn-id: svn://db.shs.com.ru/pip@648 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2018-10-17 08:13:47 +00:00
parent 1548cba46e
commit 74a0743045
3 changed files with 38 additions and 40 deletions

View File

@@ -52,29 +52,29 @@ namespace PIEvaluatorTypes {
struct PIP_EXPORT Instruction {
Instruction() {out = -1; function = -1; operation = oNone;}
Instruction(Operation oper, PIVector<int> opers, int out_ind, int func = -1) {
Instruction(Operation oper, PIVector<short> opers, short out_ind, short func = -1) {
operation = oper; operators = opers; out = out_ind; function = func;}
Operation operation;
PIVector<int> operators;
int out;
int function;
short out;
short function;
PIVector<short> operators;
};
struct PIP_EXPORT Element {
Element() {num = 0; var_num = -1; type = etNumber;}
Element(eType new_type, int new_num, int new_var_num = -1) {set(new_type, new_num, new_var_num);}
void set(eType new_type, int new_num, int new_var_num = -1) {type = new_type; num = new_num; var_num = new_var_num;}
Element(eType new_type, short new_num, short new_var_num = -1) {set(new_type, new_num, new_var_num);}
void set(eType new_type, short new_num, short new_var_num = -1) {type = new_type; num = new_num; var_num = new_var_num;}
eType type;
int num;
int var_num;
short num;
short var_num;
};
struct PIP_EXPORT Function {
Function() {arguments = 0; type = bfUnknown; handler = 0;}
Function(const PIString & name, int args, BaseFunctions ftype) {identifier = name; arguments = args; type = ftype; handler = 0;}
Function(const PIString & name, int args, FuncFunc h) {identifier = name; arguments = args; type = bfCustom; handler = h;}
Function(const PIString & name, short args, BaseFunctions ftype) {identifier = name; arguments = args; type = ftype; handler = 0;}
Function(const PIString & name, short args, FuncFunc h) {identifier = name; arguments = args; type = bfCustom; handler = h;}
PIString identifier;
BaseFunctions type;
FuncFunc handler;
int arguments;
short arguments;
};
struct PIP_EXPORT Variable {
Variable() {value = 0.;}
@@ -235,23 +235,19 @@ inline bool operator ==(PIEvaluatorTypes::Element e1, PIEvaluatorTypes::Element
inline bool operator !=(PIEvaluatorTypes::Element e1, PIEvaluatorTypes::Element e2) {return (e1.type != e2.type || e1.num != e2.num);}
inline PIByteArray & operator <<(PIByteArray & s, const PIEvaluatorTypes::Instruction & v) {
s << ((int)v.operation) << v.operators << v.out << v.function;
s << PIByteArray::RawData(&v, sizeof(v) - sizeof(v.operators)) << v.operators;
return s;
}
inline PIByteArray & operator >>(PIByteArray & s, PIEvaluatorTypes::Instruction & v) {
int i(0);
s >> i >> v.operators >> v.out >> v.function;
v.operation = (PIEvaluatorTypes::Operation)i;
s >> PIByteArray::RawData(&v, sizeof(v) - sizeof(v.operators)) >> v.operators;
return s;
}
inline PIByteArray & operator <<(PIByteArray & s, const PIEvaluatorTypes::Element & v) {
s << ((int)v.type) << v.num << v.var_num;
s << PIByteArray::RawData(&v, sizeof(v));
return s;
}
inline PIByteArray & operator >>(PIByteArray & s, PIEvaluatorTypes::Element & v) {
int i(0);
s >> i >> v.num >> v.var_num;
v.type = (PIEvaluatorTypes::eType)i;
s >> PIByteArray::RawData(&v, sizeof(v));
return s;
}
inline PIByteArray & operator <<(PIByteArray & s, const PIEvaluatorTypes::Variable & v) {