Skip to content

Commit

Permalink
Removed rishka_perror(), improved rishka_panic() GH-1
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Mar 5, 2024
1 parent 6a92ab6 commit dbc4ab8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
17 changes: 1 addition & 16 deletions src/rishka_errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,8 @@

#include <rishka_errors.h>

void rishka_perror(const char* msg, uintptr_t len, bool flush) {
if(len > 0 && msg)
for(int i = 0; i < len; i++)
Serial.write(msg[i]);

if(flush) {
Serial.println();
Serial.flush();
}
}

void rishka_panic(const char* message, rishka_virtual_machine* vm) {
size_t len = strlen(message);

if(len > 0)
rishka_perror(message, len, true);

vm->stream->write(message);
vm->running = false;
vm->exitcode = -1;
}
11 changes: 0 additions & 11 deletions src/rishka_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@
#include <rishka_commons.h>
#include <rishka_vm.h>

/**
* @brief Print an error message to the output stream.
*
* This function prints the specified error message to the output stream.
*
* @param msg The error message to print.
* @param len The length of the error message.
* @param flush Whether to flush the standard error stream after printing the message.
*/
void rishka_perror(const char* msg, uintptr_t len, bool flush);

/**
* @brief Handle a panic situation in the virtual machine.
*
Expand Down

0 comments on commit dbc4ab8

Please sign in to comment.