/* $RCSfile: walk.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:31 $
*
- * Copyright (c) 1991, Larry Wall
+ * Copyright (c) 1991-1997, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
#include "a2p.h"
#include "util.h"
-static void tab();
-static void fixtab();
-static void addsemi();
-static void emit_split();
-static void numericize();
-
bool exitval = FALSE;
bool realexit = FALSE;
bool saw_getline = FALSE;
STR *subs;
STR *curargs = Nullstr;
-void addsemi _(( STR *str ));
-void emit_split _(( STR *str, int level ));
-void fixtab _(( STR *str, int lvl ));
-void numericize _(( int node ));
+static void addsemi _(( STR *str ));
+static void emit_split _(( STR *str, int level ));
+static void fixtab _(( STR *str, int lvl ));
+static void numericize _(( int node ));
+static void tab _(( STR *str, int lvl ));
+
int prewalk _(( int numit, int level, int node, int *numericptr ));
-void tab _(( STR *str, int lvl ));
STR * walk _(( int useval, int level, int node, int *numericptr, int minprec ));
STR *
-walk(useval,level,node,numericptr,minprec)
-int useval;
-int level;
-register int node;
-int *numericptr;
-int minprec; /* minimum precedence without parens */
+walk(int useval, int level, register int node, int *numericptr, int minprec)
+
+
+
+
+ /* minimum precedence without parens */
{
register int len;
register STR *str;
if (saw_FS && !const_FS)
do_chop = TRUE;
if (do_chop) {
- str_cat(str,"chop;\t# strip record separator\n");
+ str_cat(str,"chomp;\t# strip record separator\n");
tab(str,level);
}
if (do_split)
if (saw_FNR)
str_cat(str,"continue {\n $FNRbase = $. if eof;\n}\n");
}
- else
+ else if (old_awk)
str_cat(str,"while (<>) { } # (no line actions)\n");
if (ops[node+4].ival) {
realexit = TRUE;
i = 0;
if (do_chop) {
i++;
- str_cat(str,"chop;\t# strip record separator\n");
+ str_cat(str,"chomp;\t# strip record separator\n");
tab(str,level);
}
if (do_split && !(len & 1)) {
}
static void
-tab(str,lvl)
-register STR *str;
-register int lvl;
+tab(register STR *str, register int lvl)
{
while (lvl > 1) {
str_cat(str,"\t");
}
static void
-fixtab(str,lvl)
-register STR *str;
-register int lvl;
+fixtab(register STR *str, register int lvl)
{
register char *s;
}
static void
-addsemi(str)
-register STR *str;
+addsemi(register STR *str)
{
register char *s;
str_cat(str,";");
}
-void
-emit_split(str,level)
-register STR *str;
-int level;
+static void
+emit_split(register STR *str, int level)
{
register int i;
}
int
-prewalk(numit,level,node,numericptr)
-int numit;
-int level;
-register int node;
-int *numericptr;
+prewalk(int numit, int level, register int node, int *numericptr)
{
register int len;
register int type;
}
static void
-numericize(node)
-register int node;
+numericize(register int node)
{
register int len;
register int type;