mirror of
https://github.com/hazemKrimi/jack-vm-translator.git
synced 2026-05-01 18:00:27 +00:00
chore: include filename for static variables
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
#include "types.hpp"
|
||||
|
||||
int translateCommand(std::string&, Command);
|
||||
int translateCommand(std::string&, const std::string, Command);
|
||||
|
||||
+3
-3
@@ -10,8 +10,8 @@
|
||||
|
||||
int process(std::string source) {
|
||||
std::ifstream ifs(source);
|
||||
std::string out = source.substr(0, source.find_last_of('.')) + ".asm";
|
||||
std::ofstream ofs(out);
|
||||
std::string filename = source.substr(0, source.find_last_of('.'));
|
||||
std::ofstream ofs(filename + ".asm", std::ofstream::trunc);
|
||||
std::string line;
|
||||
std::string output;
|
||||
|
||||
@@ -31,7 +31,7 @@ int process(std::string source) {
|
||||
for (const Command &cmd : commands) {
|
||||
int translateResult;
|
||||
|
||||
if ((translateResult = translateCommand(output, cmd)) != 0) {
|
||||
if ((translateResult = translateCommand(output, filename, cmd)) != 0) {
|
||||
return translateResult;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user