aboutsummaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:40:49 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:40:49 +0300
commit85c0d5edb781c9f31b79e48452b1ca68643f41de (patch)
tree14efbc59b30cdd626a208d6391f3ed226387054e /profile.c
parent6cc7d587a710606d3fe52222707739c7cc1b8651 (diff)
downloadegawk-85c0d5edb781c9f31b79e48452b1ca68643f41de.tar.gz
egawk-85c0d5edb781c9f31b79e48452b1ca68643f41de.tar.bz2
egawk-85c0d5edb781c9f31b79e48452b1ca68643f41de.zip
Move to gawk-3.1.4.
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c49
1 files changed, 44 insertions, 5 deletions
diff --git a/profile.c b/profile.c
index 0a5b332f..956f971f 100644
--- a/profile.c
+++ b/profile.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1999-2003 the Free Software Foundation, Inc.
+ * Copyright (C) 1999-2004 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -427,6 +427,24 @@ pprint(register NODE *volatile tree)
}
}
+/* varname --- print a variable name, handling vars done with -v */
+
+/*
+ * When `-v x=x' is given, the varname field ends up including the
+ * entire text. This gets printed in the profiled output if we're
+ * not careful. Oops.
+ *
+ * XXX: This is a band-aid; we really should fix the -v code.
+ */
+
+static void
+varname(const char *name)
+{
+ for (; *name != '\0' && *name != '='; name++)
+ putc(*name, prof_fp);
+ return;
+}
+
/* tree_eval --- evaluate a subtree */
static void
@@ -444,7 +462,7 @@ tree_eval(register NODE *tree)
case Node_var:
case Node_var_array:
if (tree->vname != NULL)
- fprintf(prof_fp, "%s", tree->vname);
+ varname(tree->vname);
else
fatal(_("internal error: %s with null vname"),
nodetype2str(tree->type));
@@ -570,6 +588,10 @@ tree_eval(register NODE *tree)
fprintf(prof_fp, "BINMODE");
return;
+ case Node_SUBSEP:
+ fprintf(prof_fp, "SUBSEP");
+ return;
+
case Node_TEXTDOMAIN:
fprintf(prof_fp, "TEXTDOMAIN");
return;
@@ -612,6 +634,14 @@ tree_eval(register NODE *tree)
tree_eval(tree->rnode);
return;
+ case Node_assign_concat:
+ tree_eval(tree->lnode);
+ fprintf(prof_fp, " = ");
+ tree_eval(tree->lnode);
+ fprintf(prof_fp, " ");
+ tree_eval(tree->rnode);
+ return;
+
case Node_concat:
fprintf(prof_fp, "(");
tree_eval(tree->lnode);
@@ -864,6 +894,10 @@ pp_lhs(register NODE *ptr)
fprintf(prof_fp, "OFS");
break;
+ case Node_SUBSEP:
+ fprintf(prof_fp, "SUBSEP");
+ break;
+
case Node_TEXTDOMAIN:
fprintf(prof_fp, "TEXTDOMAIN");
break;
@@ -1125,10 +1159,12 @@ pp_builtin(register NODE *tree)
{
const char *func = getfname(tree->builtin);
- fprintf(prof_fp, "%s(", func ? func : "extension_function");
- if (func)
+ if (func != NULL) {
+ fprintf(prof_fp, "%s(", func);
pp_list(tree->subnode);
- fprintf(prof_fp, ")");
+ fprintf(prof_fp, ")");
+ } else
+ fprintf(prof_fp, _("# this is a dynamically loaded extension function"));
}
/* pp_func_call --- print a function call */
@@ -1306,6 +1342,7 @@ is_scalar(NODETYPE type)
case Node_OFS:
case Node_ORS:
case Node_RS:
+ case Node_SUBSEP:
case Node_TEXTDOMAIN:
case Node_subscript:
return TRUE;
@@ -1342,6 +1379,7 @@ prec_level(NODETYPE type)
case Node_OFS:
case Node_ORS:
case Node_RS:
+ case Node_SUBSEP:
case Node_TEXTDOMAIN:
return 15;
@@ -1407,6 +1445,7 @@ prec_level(NODETYPE type)
case Node_assign_plus:
case Node_assign_minus:
case Node_assign_exp:
+ case Node_assign_concat:
return 1;
default: