process -> code.

This commit is contained in:
Kelvin Sherlock 2016-12-25 12:38:12 -05:00
parent fbd4fad488
commit a2bc0d353c
4 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@ CC=c++ -std=c++11 -g
CXX=c++ -std=c++11 -g CXX=c++ -std=c++11 -g
OBJS = dumpobj.o disasm.o OBJS = dumpobj.o disasm.o
dumpobj : dumpobj.o disasm.o disassembler.o dumpobj : dumpobj.o disassembler.o
disassembler.o : disassembler.cpp disassembler.h disassembler.o : disassembler.cpp disassembler.h
dumpobj.o : dumpobj.cpp disassembler.h dumpobj.o : dumpobj.cpp disassembler.h

View File

@ -364,7 +364,7 @@ void disassembler::dump(const std::string &expr, unsigned size) {
reset(); reset();
} }
void disassembler::process(const std::string &expr, unsigned size) { void disassembler::code(const std::string &expr, unsigned size) {
if (_st != 1 || size != _size) { if (_st != 1 || size != _size) {
dump(expr, size); dump(expr, size);
return; return;
@ -377,7 +377,7 @@ void disassembler::flush() {
if (_st) dump(); if (_st) dump();
} }
void disassembler::process(uint8_t byte) { void disassembler::code(uint8_t byte) {
_bytes[_st++] = byte; _bytes[_st++] = byte;
if (_st == 1) { if (_st == 1) {
_op = byte; _op = byte;

View File

@ -9,14 +9,14 @@ class disassembler {
public: public:
disassembler() = default; disassembler() = default;
void process(uint8_t byte); void code(uint8_t byte);
void process(const std::string &expr, unsigned size); void code(const std::string &expr, unsigned size);
template<class Iter> template<class Iter>
void process(Iter begin, Iter end) { while (begin != end) process(*begin++); } void code(Iter begin, Iter end) { while (begin != end) code(*begin++); }
template<class T> template<class T>
void process(const T &t) { process(std::begin(t), std::end(t)); } void code(const T &t) { code(std::begin(t), std::end(t)); }
bool m() const { return _flags & 0x20; } bool m() const { return _flags & 0x20; }
bool x() const { return _flags & 0x10; } bool x() const { return _flags & 0x10; }

View File

@ -278,7 +278,7 @@ void dump_obj(const char *name, int fd)
if (op < 0xf0) { if (op < 0xf0) {
auto end = iter + op; auto end = iter + op;
while (iter != end) { while (iter != end) {
d.process(*iter++); d.code(*iter++);
place_labels(labels, d.pc()); place_labels(labels, d.pc());
} }
continue; continue;
@ -357,7 +357,7 @@ void dump_obj(const char *name, int fd)
} }
} }
if (stack.size() != 1) errx(EX_DATAERR, "%s stack overflow error.", name); if (stack.size() != 1) errx(EX_DATAERR, "%s stack overflow error.", name);
d.process(stack.front(), bytes); d.code(stack.front(), bytes);
} }
break; break;