gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, comment, updated. gawk-4.1.0-738-gd7c8df


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, comment, updated. gawk-4.1.0-738-gd7c8dfd
Date: Wed, 10 Sep 2014 05:15:05 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, comment has been updated
       via  d7c8dfd41bd5671ddfa6c81b2ef1779cab06e56b (commit)
      from  f7cd8393105d286074d6e1a918b4fd6228f00245 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=d7c8dfd41bd5671ddfa6c81b2ef1779cab06e56b

commit d7c8dfd41bd5671ddfa6c81b2ef1779cab06e56b
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Sep 10 08:14:35 2014 +0300

    Fix some minor indentation nits in profiling.

diff --git a/profile.c b/profile.c
index e23a17a..e2211e1 100644
--- a/profile.c
+++ b/profile.c
@@ -101,7 +101,7 @@ indent(long count)
 {
        int i;
 
-       if ( do_profile)
+       if (do_profile)
                if (count == 0)
                        fprintf(prof_fp, "\t");
                else
@@ -193,22 +193,28 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool 
in_for_header)
 
                        if (rule != Rule) {
                                ip = (pc + 1)->firsti;
-                               if (ip->opcode == Op_comment){
-       /* print pre-begin/end comments */
+
+                               /* print pre-begin/end comments */
+                               if (ip->opcode == Op_comment) {
                                        print_comment(ip, 0);
                                        ip = ip->nexti;
                                }
-                               if (do_profile && ! rule_count[rule]++)
-                                       fprintf(prof_fp, _("\t# %s 
block(s)\n\n"), ruletab[rule]);
+
+                               if (do_profile) {
+                                       if (! rule_count[rule]++)
+                                               fprintf(prof_fp, _("\t# %s 
block(s)\n\n"), ruletab[rule]);
+                                       indent(0);
+                               }
                                fprintf(prof_fp, "%s {\n", ruletab[rule]);
                        } else {
                                if (do_profile && ! rule_count[rule]++)
                                        fprintf(prof_fp, _("\t# Rule(s)\n\n"));
                                ip = pc->nexti;
                                lind = ip->exec_count;
-       /*print pre-block comments */
-                               if(ip->opcode == Op_exec_count && 
ip->nexti->opcode == Op_comment)ip = ip->nexti;
-                               if(ip->opcode == Op_comment){
+                               /* print pre-block comments */
+                               if (ip->opcode == Op_exec_count && 
ip->nexti->opcode == Op_comment)
+                                       ip = ip->nexti;
+                               if (ip->opcode == Op_comment) {
                                        print_comment(ip, lind);
                                        if (ip->nexti->nexti == (pc + 
1)->firsti)
                                                ip = ip->nexti->nexti;
@@ -234,6 +240,8 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool 
in_for_header)
                        indent_in();
                        pprint(ip, (pc + 1)->lasti, false);
                        indent_out();
+                       if (do_profile)
+                               indent(0);
                        fprintf(prof_fp, "}\n\n");
                        pc = (pc + 1)->lasti;
                        break;
@@ -979,24 +987,25 @@ print_lib_list(FILE *prof_fp)
 
 /* print comment text with proper indentation */
 static void
-print_comment(INSTRUCTION* pc, long in){
-                       char *text;
-                       size_t count;
-                       bool after_newline = false;
-
-                       count = pc->memory->stlen;
-                       text = pc->memory->stptr;
-
-                       indent(in);   /* is this correct? Where should comments 
go?  */
-                       for (; count > 0; count--, text++) {
-                               if (after_newline) {
-                                       indent(in);
-                                       after_newline = false;
-                               }
-                               putc(*text, prof_fp);
-                               if (*text == '\n')
-                                       after_newline = true;
-                       }
+print_comment(INSTRUCTION* pc, long in)
+{
+       char *text;
+       size_t count;
+       bool after_newline = false;
+
+       count = pc->memory->stlen;
+       text = pc->memory->stptr;
+
+       indent(in);   /* is this correct? Where should comments go?  */
+       for (; count > 0; count--, text++) {
+               if (after_newline) {
+                       indent(in);
+                       after_newline = false;
+               }
+               putc(*text, prof_fp);
+               if (*text == '\n')
+                       after_newline = true;
+       }
 }
 
 /* dump_prog --- dump the program */
@@ -1525,13 +1534,13 @@ pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED)
        fp = pc->nexti->nexti;
        func = pc->func_body;
        fprintf(prof_fp, "\n");
-/* print any function comment */
-       if (fp->opcode == Op_comment && fp->source_line == 0){
+
+       /* print any function comment */
+       if (fp->opcode == Op_comment && fp->source_line == 0) {
                print_comment(fp, 0);
                fp = fp->nexti;
        }
-       if (do_profile)
-               fprintf(prof_fp, "\t");
+
        indent(pc->nexti->exec_count);
        fprintf(prof_fp, "%s %s(", op2str(Op_K_function), func->vname);
        pcount = func->param_cnt;
@@ -1541,10 +1550,15 @@ pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED)
                if (j < pcount - 1)
                        fprintf(prof_fp, ", ");
        }
-       fprintf(prof_fp, ")\n{\n");
+       fprintf(prof_fp, ")\n");
+       if (do_profile)
+               indent(0);
+       fprintf(prof_fp, "{\n");
        indent_in();
        pprint(fp, NULL, false);        /* function body */
        indent_out();
+       if (do_profile)
+               indent(0);
        fprintf(prof_fp, "}\n");
        return 0;
 }

-----------------------------------------------------------------------

Summary of changes:
 profile.c |   76 ++++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 45 insertions(+), 31 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]