add term module from corelib
This commit is contained in:
65
term-test/printing.c
Normal file
65
term-test/printing.c
Normal file
@@ -0,0 +1,65 @@
|
||||
#include <blue/term.h>
|
||||
|
||||
#define F_GREEN "\033[92m"
|
||||
#define F_YELLOW "\033[93m"
|
||||
#define F_RESET "\033[0m"
|
||||
|
||||
static const char *text = F_YELLOW
|
||||
"But I must " F_GREEN "explain " F_YELLOW "to you " F_GREEN
|
||||
"how all this " F_YELLOW "mistaken idea of" F_RESET
|
||||
" denouncing pleasure " F_GREEN "and praising pain was born " F_YELLOW
|
||||
"and I will give you " F_RESET "a complete account of " F_YELLOW
|
||||
"the system, and " F_RESET
|
||||
"expound the actual teachings of the great explorer of the truth, the "
|
||||
"master-builder of human happiness.\n"
|
||||
"No one rejects, dislikes, or avoids pleasure itself, because it is "
|
||||
"pleasure, but because those who do not know how to pursue pleasure "
|
||||
"rationally encounter consequences that are extremely painful. Nor "
|
||||
"again is there anyone who loves or pursues or desires to obtain pain "
|
||||
"of itself, because it is pain, but because occasionally circumstances "
|
||||
"occur in which toil and pain can procure him some great pleasure.\n"
|
||||
"To take a trivial example, which of us ever undertakes laborious "
|
||||
"physical exercise, except to obtain some advantage from it? But who "
|
||||
"has any right to find fault with a man who chooses to enjoy a "
|
||||
"pleasure that has no annoying consequences, or one who avoids a pain "
|
||||
"that produces no resultant pleasure? On the other hand, we denounce "
|
||||
"with righteous indignation and dislike men who are so beguiled and "
|
||||
"demoralized by the charms of pleasure of the moment, so blinded by "
|
||||
"desire, that they cannot foresee.";
|
||||
|
||||
static const char *text2
|
||||
= "But I must explain to you how all this mistaken idea of denouncing "
|
||||
"pleasure and praising pain was born and I will give you a complete "
|
||||
"account of the system, and expound the actual teachings of the "
|
||||
"great explorer of the truth, the master-builder of human "
|
||||
"happiness.\n"
|
||||
"No one rejects, dislikes, or avoids pleasure itself, because it is "
|
||||
"pleasure, but because those who do not know how to pursue pleasure "
|
||||
"rationally encounter consequences that are extremely painful. Nor "
|
||||
"again is there anyone who loves or pursues or desires to obtain "
|
||||
"pain of itself, because it is pain, but because occasionally "
|
||||
"circumstances occur in which toil and pain can procure him some "
|
||||
"great pleasure.\n"
|
||||
"To take a trivial example, which of us ever undertakes laborious "
|
||||
"physical exercise, except to obtain some advantage from it? But who "
|
||||
"has any right to find fault with a man who chooses to enjoy a "
|
||||
"pleasure that has no annoying consequences, or one who avoids a "
|
||||
"pain that produces no resultant pleasure? On the other hand, we "
|
||||
"denounce with righteous indignation and dislike men who are so "
|
||||
"beguiled and demoralized by the charms of pleasure of the moment, "
|
||||
"so blinded by desire, that they cannot foresee.";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
b_paragraph_format format = {};
|
||||
format.p_left_margin = 5;
|
||||
format.p_right_margin = 5;
|
||||
format.p_flags = B_PARAGRAPH_DOUBLE_LINE_BREAK;
|
||||
|
||||
b_print_paragraph(text, stdout, &format);
|
||||
|
||||
b_i("An informational message\n\nWith multiple lines");
|
||||
b_warn("A warning message\nWith multiple lines");
|
||||
b_err("An error message\nWith multiple lines");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user