Quiet mode for C.
This commit is contained in:
parent
9a74b91d04
commit
51b32bbc0a
|
|
@ -218,7 +218,7 @@ init_defs(void)
|
|||
def_popopdd_body = text_to_expression("[popop] dipd");
|
||||
def_product_body = text_to_expression("1 swap [*] step");
|
||||
def_quoted_body = text_to_expression("[unit] dip");
|
||||
def_range_body = text_to_expression("[0 <=] [1 - dup] anamorphism");
|
||||
def_range_body = text_to_expression("[0 <=] [-- dup] anamorphism");
|
||||
def_range_to_zero_body = text_to_expression("unit [down_to_zero] infra");
|
||||
def_reco_body = text_to_expression("rest cons");
|
||||
def_reverse_body = text_to_expression("<{} shunt");
|
||||
|
|
|
|||
|
|
@ -841,8 +841,17 @@ joy(JoyListPtr stack, JoyListPtr expression)
|
|||
}
|
||||
|
||||
|
||||
/* Set quiet mode by "-q as only command line option. "*/
|
||||
int quiet = 0;
|
||||
|
||||
#define SHH(message) \
|
||||
if (!quiet) { \
|
||||
printf(message); \
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *line;
|
||||
char *status;
|
||||
|
|
@ -858,10 +867,12 @@ main(void)
|
|||
|
||||
init_defs();
|
||||
|
||||
quiet = ((2 == argc) && (!strcmp("-q", argv[1])));
|
||||
|
||||
line = (char *)GC_malloc(1025);
|
||||
|
||||
while (1) {
|
||||
printf("\njoy? ");
|
||||
SHH("\njoy? ")
|
||||
status = gets_s(line, 1025);
|
||||
if (NULL == status) {
|
||||
/*
|
||||
|
|
@ -878,7 +889,7 @@ main(void)
|
|||
TODO: "use feof(3) and ferror(3)"...
|
||||
|
||||
*/
|
||||
printf("bye\n");
|
||||
SHH("bye\n")
|
||||
break;
|
||||
}
|
||||
s = stack;
|
||||
|
|
|
|||
Loading…
Reference in New Issue