summaryrefslogtreecommitdiff
path: root/profile.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-05-11 15:05:35 +0300
committerArnold D. Robbins <arnold@skeeve.com>2012-05-11 15:05:35 +0300
commite5353c0f447a8628985722296f57fc02dd2e0063 (patch)
treee41c41ba69b3c707cad6f6dbd3f1f9374e1eeafd /profile.c
parent4f8aff5908706e6f526b61337d10a412f4f66360 (diff)
downloadgawk-e5353c0f447a8628985722296f57fc02dd2e0063.tar.gz
Move to use of bool type, true, false, everywhere.
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/profile.c b/profile.c
index 181395d9..15c9879b 100644
--- a/profile.c
+++ b/profile.c
@@ -25,7 +25,7 @@
#include "awk.h"
-static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, int in_for_header);
+static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header);
static void pp_parenthesize(NODE *n);
static void parenthesize(int type, NODE *left, NODE *right);
static char *pp_list(int nargs, const char *paren, const char *delim);
@@ -161,7 +161,7 @@ pp_free(NODE *n)
*/
static void
-pprint(INSTRUCTION *startp, INSTRUCTION *endp, int in_for_header)
+pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header)
{
INSTRUCTION *pc;
NODE *t1;
@@ -193,7 +193,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int in_for_header)
ip = pc->nexti;
indent(ip->exec_count);
if (ip != (pc + 1)->firsti) { /* non-empty pattern */
- pprint(ip->nexti, (pc + 1)->firsti, FALSE);
+ pprint(ip->nexti, (pc + 1)->firsti, false);
t1 = pp_pop();
fprintf(prof_fp, "%s {", t1->pp_str);
pp_free(t1);
@@ -210,7 +210,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int in_for_header)
ip = ip->nexti;
}
indent_in();
- pprint(ip, (pc + 1)->lasti, FALSE);
+ pprint(ip, (pc + 1)->lasti, false);
indent_out();
fprintf(prof_fp, "\t}\n\n");
pc = (pc + 1)->lasti;
@@ -676,8 +676,8 @@ cleanup:
case Op_line_range:
ip = pc + 1;
- pprint(pc->nexti, ip->condpair_left, FALSE);
- pprint(ip->condpair_left->nexti, ip->condpair_right, FALSE);
+ pprint(pc->nexti, ip->condpair_left, false);
+ pprint(ip->condpair_left->nexti, ip->condpair_right, false);
t2 = pp_pop();
t1 = pp_pop();
str = pp_concat(t1->pp_str, ", ", t2->pp_str);
@@ -691,12 +691,12 @@ cleanup:
ip = pc + 1;
indent(ip->while_body->exec_count);
fprintf(prof_fp, "%s (", op2str(pc->opcode));
- pprint(pc->nexti, ip->while_body, FALSE);
+ pprint(pc->nexti, ip->while_body, false);
t1 = pp_pop();
fprintf(prof_fp, "%s) {\n", t1->pp_str);
pp_free(t1);
indent_in();
- pprint(ip->while_body->nexti, pc->target_break, FALSE);
+ pprint(ip->while_body->nexti, pc->target_break, false);
indent_out();
indent(SPACEOVER);
fprintf(prof_fp, "}\n");
@@ -708,9 +708,9 @@ cleanup:
indent(pc->nexti->exec_count);
fprintf(prof_fp, "%s {\n", op2str(pc->opcode));
indent_in();
- pprint(pc->nexti->nexti, ip->doloop_cond, FALSE);
+ pprint(pc->nexti->nexti, ip->doloop_cond, false);
indent_out();
- pprint(ip->doloop_cond, pc->target_break, FALSE);
+ pprint(ip->doloop_cond, pc->target_break, false);
indent(SPACEOVER);
t1 = pp_pop();
fprintf(prof_fp, "} %s (%s)\n", op2str(Op_K_while), t1->pp_str);
@@ -722,23 +722,23 @@ cleanup:
ip = pc + 1;
indent(ip->forloop_body->exec_count);
fprintf(prof_fp, "%s (", op2str(pc->opcode));
- pprint(pc->nexti, ip->forloop_cond, TRUE);
+ pprint(pc->nexti, ip->forloop_cond, true);
fprintf(prof_fp, "; ");
if (ip->forloop_cond->opcode == Op_no_op &&
ip->forloop_cond->nexti == ip->forloop_body)
fprintf(prof_fp, "; ");
else {
- pprint(ip->forloop_cond, ip->forloop_body, TRUE);
+ pprint(ip->forloop_cond, ip->forloop_body, true);
t1 = pp_pop();
fprintf(prof_fp, "%s; ", t1->pp_str);
pp_free(t1);
}
- pprint(pc->target_continue, pc->target_break, TRUE);
+ pprint(pc->target_continue, pc->target_break, true);
fprintf(prof_fp, ") {\n");
indent_in();
- pprint(ip->forloop_body->nexti, pc->target_continue, FALSE);
+ pprint(ip->forloop_body->nexti, pc->target_continue, false);
indent_out();
indent(SPACEOVER);
fprintf(prof_fp, "}\n");
@@ -763,7 +763,7 @@ cleanup:
item, op2str(Op_in_array), array);
indent_in();
pp_free(t1);
- pprint(ip->forloop_body->nexti, pc->target_break, FALSE);
+ pprint(ip->forloop_body->nexti, pc->target_break, false);
indent_out();
indent(SPACEOVER);
fprintf(prof_fp, "}\n");
@@ -774,11 +774,11 @@ cleanup:
case Op_K_switch:
ip = pc + 1;
fprintf(prof_fp, "%s (", op2str(pc->opcode));
- pprint(pc->nexti, ip->switch_start, FALSE);
+ pprint(pc->nexti, ip->switch_start, false);
t1 = pp_pop();
fprintf(prof_fp, "%s) {\n", t1->pp_str);
pp_free(t1);
- pprint(ip->switch_start, ip->switch_end, FALSE);
+ pprint(ip->switch_start, ip->switch_end, false);
indent(SPACEOVER);
fprintf(prof_fp, "}\n");
pc = pc->target_break;
@@ -794,13 +794,13 @@ cleanup:
} else
fprintf(prof_fp, "%s:\n", op2str(pc->opcode));
indent_in();
- pprint(pc->stmt_start->nexti, pc->stmt_end->nexti, FALSE);
+ pprint(pc->stmt_start->nexti, pc->stmt_end->nexti, false);
indent_out();
break;
case Op_K_if:
fprintf(prof_fp, "%s (", op2str(pc->opcode));
- pprint(pc->nexti, pc->branch_if, FALSE);
+ pprint(pc->nexti, pc->branch_if, false);
t1 = pp_pop();
fprintf(prof_fp, "%s) {", t1->pp_str);
pp_free(t1);
@@ -810,7 +810,7 @@ cleanup:
fprintf(prof_fp, " # %ld", ip->exec_count);
fprintf(prof_fp, "\n");
indent_in();
- pprint(ip->nexti, pc->branch_else, FALSE);
+ pprint(ip->nexti, pc->branch_else, false);
indent_out();
pc = pc->branch_else;
if (pc->nexti->opcode == Op_no_op) {
@@ -822,7 +822,7 @@ cleanup:
case Op_K_else:
fprintf(prof_fp, "} %s {\n", op2str(pc->opcode));
indent_in();
- pprint(pc->nexti, pc->branch_end, FALSE);
+ pprint(pc->nexti, pc->branch_end, false);
indent_out();
indent(SPACEOVER);
fprintf(prof_fp, "}\n");
@@ -834,14 +834,14 @@ cleanup:
NODE *f, *t, *cond;
size_t len;
- pprint(pc->nexti, pc->branch_if, FALSE);
+ pprint(pc->nexti, pc->branch_if, false);
ip = pc->branch_if;
- pprint(ip->nexti, pc->branch_else, FALSE);
+ pprint(ip->nexti, pc->branch_else, false);
ip = pc->branch_else->nexti;
pc = ip->nexti;
assert(pc->opcode == Op_cond_exp);
- pprint(pc->nexti, pc->branch_end, FALSE);
+ pprint(pc->nexti, pc->branch_end, false);
f = pp_pop();
t = pp_pop();
@@ -882,7 +882,7 @@ cleanup:
void
pp_string_fp(Func_print print_func, FILE *fp, const char *in_str,
- size_t len, int delim, int breaklines)
+ size_t len, int delim, bool breaklines)
{
char *s = pp_string(in_str, len, delim);
int count;
@@ -941,7 +941,7 @@ dump_prog(INSTRUCTION *code)
(void) time(& now);
/* \n on purpose, with \n in ctime() output */
fprintf(prof_fp, _("\t# gawk profile, created %s\n"), ctime(& now));
- pprint(code, NULL, FALSE);
+ pprint(code, NULL, false);
}
/* prec_level --- return the precedence of an operator, for paren tests */
@@ -1081,10 +1081,10 @@ is_binary(int type)
case Op_in_array:
case Op_K_getline_redir: /* sometimes */
case Op_K_getline:
- return TRUE;
+ return true;
default:
- return FALSE;
+ return false;
}
}
@@ -1319,12 +1319,12 @@ int
pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED)
{
int j;
- static int first = TRUE;
+ static bool first = true;
NODE *func;
int pcount;
if (first) {
- first = FALSE;
+ first = false;
fprintf(prof_fp, _("\n\t# Functions, listed alphabetically\n"));
}
@@ -1341,7 +1341,7 @@ pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED)
}
fprintf(prof_fp, ")\n\t{\n");
indent_in();
- pprint(pc->nexti->nexti, NULL, FALSE); /* function body */
+ pprint(pc->nexti->nexti, NULL, false); /* function body */
indent_out();
fprintf(prof_fp, "\t}\n");
return 0;