step: increase/decrease verbosity from within the program
This commit is contained in:
parent
b43f74cdc6
commit
aafc697a59
17
src/mumble.c
17
src/mumble.c
|
@ -5,11 +5,11 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "mpc/mpc.h"
|
#include "mpc/mpc.h"
|
||||||
#define VERBOSE 2
|
|
||||||
#define LISPVAL_ASSERT(cond, err) \
|
#define LISPVAL_ASSERT(cond, err) \
|
||||||
if (!(cond)) { \
|
if (!(cond)) { \
|
||||||
return lispval_err(err); \
|
return lispval_err(err); \
|
||||||
}
|
}
|
||||||
|
int VERBOSE = 0;
|
||||||
#define printfln(...) do { \
|
#define printfln(...) do { \
|
||||||
if(VERBOSE == 2) { \
|
if(VERBOSE == 2) { \
|
||||||
printf ("\n@ %s (%d): ", __FILE__, __LINE__); \
|
printf ("\n@ %s (%d): ", __FILE__, __LINE__); \
|
||||||
|
@ -790,6 +790,20 @@ lispval* evaluate_lispval(lispval* l, lispenv* env)
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
// Increase or decrease verbosity level manually
|
||||||
|
void modify_verbosity(char* command){
|
||||||
|
if(strcmp("VERBOSE=0", command) == 0){
|
||||||
|
VERBOSE=0;
|
||||||
|
}
|
||||||
|
if(strcmp("VERBOSE=1", command) == 0){
|
||||||
|
VERBOSE=1;
|
||||||
|
printfln("VERBOSE=1");
|
||||||
|
}
|
||||||
|
if(strcmp("VERBOSE=2", command) == 0){
|
||||||
|
VERBOSE=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Main
|
// Main
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
@ -831,6 +845,7 @@ int main(int argc, char** argv)
|
||||||
int loop = 1;
|
int loop = 1;
|
||||||
while (loop) {
|
while (loop) {
|
||||||
char* input = readline("mumble> ");
|
char* input = readline("mumble> ");
|
||||||
|
modify_verbosity(input);
|
||||||
if (input == NULL) {
|
if (input == NULL) {
|
||||||
// ^ catches Ctrl+D
|
// ^ catches Ctrl+D
|
||||||
loop = 0;
|
loop = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user