Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions src/ESPLiveScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,17 @@ class Parser
parse();
if (Error.error)
{
pushToConsole(Error.error_message.c_str(), true);
pushToConsoleForce(string_format("%s\r\n", Error.error_message.c_str()).c_str());
return results;
}
pushToConsole("***********PARSING DONE*********");
pushToConsole("***********PARSING DONE*********\r\n");
updateMem();
buildParents(&program);
#ifdef __TEST_DEBUG
prettyPrint(&program, "");
#endif
program.visitNode();
pushToConsole("***********COMPILING DONE*********");
pushToConsole("***********COMPILING DONE*********\r\n");
updateMem();
displayStat();
main_script.clear();
Expand All @@ -283,10 +283,10 @@ class Parser
updateMem();
displayStat();

pushToConsole("***********AFTER CLEAN*********");
pushToConsole("***********AFTER CLEAN*********\r\n");

#ifndef __TEST_DEBUG
pushToConsole("***********CREATE EXECUTABLE*********");
pushToConsole("***********CREATE EXECUTABLE*********\r\n");
executable _executecmd = createExectutable(&header, &content, __parser_debug);
results.setExecutable(_executecmd);
content.clear();
Expand All @@ -299,7 +299,7 @@ class Parser
// exeExist = false;
// Serial.printf(termColor.Red);

pushToConsole(_executecmd.error.error_message.c_str(), true);
pushToConsoleForce(string_format("%s\r\n", _executecmd.error.error_message.c_str()).c_str());
}

#endif
Expand Down Expand Up @@ -2642,7 +2642,7 @@ void kill(Console *cons, vector<string> args)
}
else
{
pushToConsole("Nothing is currently running.", true);
pushToConsoleForce("Nothing is currently running.\r\n");
}
}
else
Expand Down Expand Up @@ -2699,7 +2699,7 @@ void run(Console *cons, vector<string> args)
{
if (SCExecutable.isRunning())
{
LedOS.pushToConsole("Something Already running kill it first ...");
pushToConsole("Something Already running kill it first ...\r\n");
kill(cons, args);
}
SCExecutable.executeAsTask("main", _args);
Expand All @@ -2710,7 +2710,7 @@ void run(Console *cons, vector<string> args)
/*
if (progToRun > scExecutables.size())
{
LedOS.pushToConsole("No executable ...", true);
pushToConsoleForce("No executable ...\r\n");
}
else
{
Expand Down Expand Up @@ -2752,7 +2752,7 @@ void parseasm(Console *cons, vector<string> args)
{
vector<string> d;
d.push_back("main");
LedOS.pushToConsole("***********START RUN *********");
pushToConsole("***********START RUN *********\r\n");
run(cons, d);
if (cons->cmode == keyword)
{
Expand All @@ -2762,31 +2762,31 @@ void parseasm(Console *cons, vector<string> args)
}
else
{
LedOS.pushToConsole("***********START RUN*********");
LedOS.pushToConsole("Execution asm ...", true);
pushToConsole("***********START RUN*********\r\n");
pushToConsoleForce("Execution asm ...\r\n");
executeBinary("main", executecmd);
LedOS.pushToConsole("Execution done.", true, true);
pushToConsoleForce("Execution done.\r\n");
}
}
else
{
exeExist = false;
// Serial.printf(termColor.Red);
LedOS.pushToConsole(executecmd.error.error_message.c_str());
pushToConsole(string_format("%s\r\n", executecmd.error.error_message.c_str()).c_str());
// Serial.printf(config.ESC_RESET);
}
*/
}
void compile_c(Console *cons, vector<string> args)
{
pushToConsole("Compiling ...", true);
pushToConsoleForce("Compiling ...\r\n");
Executable _scExec = p.parse_c(&cons->script);
if (_scExec.exeExist)
{

_scExec.name = cons->filename;
scriptRuntime.addExe(_scExec);
pushToConsole(string_format("Compiling done. Handle number:%d", scExecutables.size()), true);
pushToConsoleForce("Compiling done. Handle number:%d\r\n", scExecutables.size());
}
}
void free(Console *cons, vector<string> args)
Expand All @@ -2808,14 +2808,14 @@ void parse_c(Console *cons, vector<string> args)
{
if (SCExecutable.isRunning())
{
LedOS.pushToConsole("Something Already running kill it first ...");
pushToConsole("Something Already running kill it first ...\r\n");
vector<string> k;
kill(cons, k);
}
bool othercore = false;

SCExecutable.free();
LedOS.pushToConsole("Compiling ...", true);
pushToConsoleForce("Compiling ...\r\n");
if (args.size() > 0)
{
if (args[0].compare("&") != 0)
Expand All @@ -2833,7 +2833,7 @@ void parse_c(Console *cons, vector<string> args)
{
vector<string> d;
// d.push_back("main");
LedOS.pushToConsole("***********START RUN *********");
pushToConsole("***********START RUN *********\r\n");
run(cons, d);

if (cons->cmode == keyword)
Expand All @@ -2844,10 +2844,10 @@ void parse_c(Console *cons, vector<string> args)
}
else
{
LedOS.pushToConsole("Start program", true);
pushToConsoleForce("Start program\r\n");
SCExecutable.execute("main");
// executeBinary("main", executecmd);
LedOS.pushToConsole("Execution done.", true);
pushToConsoleForce("Execution done.\r\n");
}
}

Expand Down Expand Up @@ -3113,7 +3113,7 @@ void artiPrintfln(char const *format, ...)
va_end(argp);
}
void showError(int line, uint32_t size, uint32_t got) {
pushToConsole(string_format("Overflow error max size: %d got %d", size, got), true);
pushToConsoleForce("Overflow error max size: %d got %d\r\n", size, got);
}
class INIT_PARSER
{
Expand Down
20 changes: 1 addition & 19 deletions src/NodeToken.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,6 @@ using namespace std;

#include "tokenizer.h"

void pushToConsole(string str, bool force)
{
#ifdef __CONSOLE_ESP32
LedOS.pushToConsole(str, force);
#else
#ifndef __TEST_DEBUG
Serial.printf("%s\r\n", str.c_str());
#else
printf("%s\r\n", str.c_str());
#endif
#endif
}

void pushToConsole(string str)
{
pushToConsole(str, false);
}

#define _START_2 32
#define _STACK_SIZE (_START_2 + 6 * 4)
string __globalscript;
Expand Down Expand Up @@ -135,7 +117,7 @@ void updateMem()
}
void displayStat()
{
pushToConsole(string_format("max used memory: %ld maxstack:%ld started %d free mem:%ld consumed %ld time:%dms", __maxMemUsage, __MaxStackMemory, __startmem, esp_get_free_heap_size(), __startmem - esp_get_free_heap_size(), (__endtime - __starttime) / 240000));
pushToConsole("max used memory: %ld maxstack:%ld started %d free mem:%ld consumed %ld time:%dms\r\n", __maxMemUsage, __MaxStackMemory, __startmem, esp_get_free_heap_size(), __startmem - esp_get_free_heap_size(), (__endtime - __starttime) / 240000);
}
string _numToBytes(uint32_t __num)
{
Expand Down
58 changes: 10 additions & 48 deletions src/asm_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -1193,12 +1193,7 @@ error_message_struct parseASM(Text *_header, Text *_content, parsedLines *asm_pa
// printf("taille instr %d\r\n",_instr_size);

_instr_size = (_instr_size / 8) * 8 + 8;
#ifdef __CONSOLE_ESP32
string _d = string_format("Creation of an %d bytes binary and %d bytes data", _instr_size, _size);
LedOS.pushToConsole(_d);
#else
printf("Creation of an %d bytes binary and %d bytes data\r\n", _instr_size, _size);
#endif
pushToConsole("Creation of an %d bytes binary and %d bytes data\r\n", _instr_size, _size);

tmp_exec = (uint8_t *)malloc(_instr_size);
if (_size > 0)
Expand All @@ -1208,12 +1203,7 @@ error_message_struct parseASM(Text *_header, Text *_content, parsedLines *asm_pa
_data_size=(_size / 4) * 4 + 4;
}
// printf("her:\r\n");
#ifdef __CONSOLE_ESP32
string d = string_format("Parsing %d assembly lines ... ", _header->size() + _content->size());
LedOS.pushToConsole(d);
#else
printf("Parsing %d assembly lines ...\r\n ", _header->size() + _content->size());
#endif
pushToConsole("Parsing %d assembly lines ...\r\n ", _header->size() + _content->size());

int size = _header->size();
int tmp_size = size;
Expand Down Expand Up @@ -1435,12 +1425,7 @@ void printparsdAsm(uint32_t start_address, parsedLines *asm_parsed)
void flagLabel32aligned(parsedLines *asm_parsed)
{
// return;
#ifdef __CONSOLE_ESP32
LedOS.pushToConsole("Flag label(s) to align ... ");

#else
printf("Flag label(s) to align ... ");
#endif
pushToConsole("Flag label(s) to align ...\r\n");
// uint32_t add = 0;
// vector<result_parse_line>::iterator it = (*asm_parsed).begin();
for (vector<result_parse_line *>::iterator it = asm_parsed->begin(); it != asm_parsed->end(); it++)
Expand All @@ -1455,24 +1440,13 @@ void flagLabel32aligned(parsedLines *asm_parsed)
}
}
}
#ifdef __CONSOLE_ESP32
LedOS.pushToConsole("Done. ");

#else
printf("Done.");
#endif
// printf("Done.\r\n");
pushToConsole("Done.\r\n");
}

error_message_struct calculateJump(parsedLines *asm_parsed)
{

#ifdef __CONSOLE_ESP32
LedOS.pushToConsole("alculating jumps ...");

#else
//printf("Calculating jumps ... ");
#endif
pushToConsole("Calculating jumps ...\r\n");

error_message_struct error;
error.error = 0;
Expand Down Expand Up @@ -1510,12 +1484,7 @@ error_message_struct calculateJump(parsedLines *asm_parsed)
error_message_struct calculateJump(uint8_t *exec, parsedLines *asm_parsed)
{

#ifdef __CONSOLE_ESP32
LedOS.pushToConsole("alculating jumps 2...");

#else
// printf("Calculating jumps2 ... ");
#endif
pushToConsole("Calculating jumps2...\r\n");

error_message_struct error;
error.error = 0;
Expand Down Expand Up @@ -1709,22 +1678,15 @@ executable createExectutable(Text *_header, Text *_content, bool display)

void executeBinaryAsm(uint32_t *j, uint32_t *c)
{
#ifdef __CONSOLE_ESP32
string s = string_format("Executing asm code @%x", j);
LedOS.pushToConsole(s, false);
#else
// printf("Executing asm code ...\r\n");
#endif
pushToConsole("Executing asm code ...\r\n");

asm volatile("l32i a10,%1,0\n\t"
"l32i a15,%0,0\n\t"
"callx8 a15"
: : "r"(j), "r"(c)
:);
#ifdef __CONSOLE_ESP32
// LedOS.pushToConsole("Execution Done.",true);
#else
// printf("Execution Done.\n");
#endif

// pushToConsoleForce("Execution Done.\r\n");
// free(exec);
}

Expand Down
Loading