Trying to build a forth runtime in C
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
forth/include/fh_print.h

24 lines
788 B

/**
* Forth printing
*
* Created on 2021/11/13.
*/
#ifndef FORTH_FH_PRINT_H
#define FORTH_FH_PRINT_H
/* for printing */
#include <stdlib.h>
#include <stdio.h>
#include "fh_globals.h"
/* logging */
#define LOG(format, ...) do { if(fh_globals.verbose) { fprintf(stderr, format "\n", ##__VA_ARGS__); } } while (0)
#define LOGI(format, ...) fprintf(stderr, "\x1b[32m" format "\x1b[m\n", ##__VA_ARGS__)
#define LOGE(format, ...) fprintf(stderr, "\x1b[31;1m" format "\x1b[m\n", ##__VA_ARGS__)
/* Forth standard output. XXX should be stdout, but then colors get mangled if logging is used */
#define FHPRINT(format, ...) fprintf(stderr, "\x1b[33;1m" format "\x1b[m", ##__VA_ARGS__)
#define FHPRINT_SVC(format, ...) fprintf(stderr, "" format "", ##__VA_ARGS__)
#endif //FORTH_FH_PRINT_H