Fixed minor stuff
This commit is contained in:
parent
195fb4476a
commit
75b39b99a3
@ -28,7 +28,6 @@ Some of the supported features are:
|
||||
- Basic arithmetical operations(`+`, `-`, `*`, `/`, `^`, `%`);
|
||||
- Scientific notation support(`5e3` -> `5000`);
|
||||
- Trigonometrical functions(`sin`, `cos`, `tan`);
|
||||
- Base conversion(printBin `pb`, printOctal `po`, printHex `px`);
|
||||
- Factorial and constants(`!`, `pi`, `e`);
|
||||
- Stack operations:
|
||||
- Print top element(`p`, `P`);
|
||||
@ -60,7 +59,7 @@ A new binary called `dc` will be created in your local folder.
|
||||
|
||||
To generate a man page from the `man.md` document, use the following command(note: needs pandoc):
|
||||
```sh
|
||||
$> pandoc man.md -s -t man > dc.1
|
||||
$> pandoc man.md -s -t man > dc.1
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
class Evaluate {
|
||||
public:
|
||||
Evaluate(std::vector<std::string> expr, std::unordered_map<char, Register> ®s, stack_t &stack)
|
||||
: expr(expr), regs(regs), stack(stack) {}
|
||||
Evaluate(const std::vector<std::string> expr, std::unordered_map<char, Register> ®s, stack_t &stack)
|
||||
: expr(std::move(expr)), regs(regs), stack(stack) {}
|
||||
Evaluate(std::unordered_map<char, Register> ®s, stack_t &stack)
|
||||
: regs(regs), stack(stack) {}
|
||||
std::optional<std::string> eval();
|
||||
|
@ -8,10 +8,10 @@ enum class Operator {
|
||||
|
||||
class Macro : public IOperation {
|
||||
public:
|
||||
Macro(OPType op_type, Operator op, char dc_register, std::unordered_map<char, Register> ®s)
|
||||
: op_type(op_type), op(op), dc_register(dc_register), regs(regs) {}
|
||||
Macro(OPType op_type, std::unordered_map<char, Register> ®s)
|
||||
: op_type(op_type), regs(regs) {}
|
||||
Macro(const OPType op_type, const Operator op, const char dc_register, std::unordered_map<char, Register> ®s)
|
||||
: op_type(std::move(op_type)), op(std::move(op)), dc_register(std::move(dc_register)), regs(regs) {}
|
||||
Macro(const OPType op_type, std::unordered_map<char, Register> ®s)
|
||||
: op_type(std::move(op_type)), regs(regs) {}
|
||||
std::optional<std::string> exec(stack_t &stack) override;
|
||||
static std::vector<std::string> split(std::string str);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
class Math : public IOperation {
|
||||
public:
|
||||
Math(OPType op_type) : op_type(op_type) {}
|
||||
Math(const OPType op_type) : op_type(std::move(op_type)) {}
|
||||
std::optional<std::string> exec(stack_t &stack) override;
|
||||
|
||||
private:
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
class Stack : public IOperation {
|
||||
public:
|
||||
Stack(OPType op_type) : op_type(op_type) {}
|
||||
Stack(const OPType op_type) : op_type(std::move(op_type)) {}
|
||||
std::optional<std::string> exec(stack_t &stack) override;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user