summaryrefslogtreecommitdiff
path: root/x2p
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1991-06-06 23:28:30 +0000
committerLarry Wall <lwall@netlabs.com>1991-06-06 23:28:30 +0000
commitd48672a2009b4897fb5bf74d6723c050cdd015e0 (patch)
tree8b55c5c62bca864358bc6bcb107144d864062543 /x2p
parent9ef589d8078fdf16316dec772c00e81b3c38fd22 (diff)
downloadperl-d48672a2009b4897fb5bf74d6723c050cdd015e0.tar.gz
perl 4.0 patch 9: patch #4, continued
See patch #4.
Diffstat (limited to 'x2p')
-rw-r--r--x2p/Makefile.SH26
-rw-r--r--x2p/str.c11
-rw-r--r--x2p/str.h11
-rw-r--r--x2p/util.c11
-rw-r--r--x2p/util.h11
-rw-r--r--x2p/walk.c66
6 files changed, 81 insertions, 55 deletions
diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH
index 82b14239ad..f4a1c665a4 100644
--- a/x2p/Makefile.SH
+++ b/x2p/Makefile.SH
@@ -19,9 +19,12 @@ case "$mallocsrc" in
esac
echo "Extracting x2p/Makefile (with variable substitutions)"
cat >Makefile <<!GROK!THIS!
-# $Header: Makefile.SH,v 4.0 91/03/20 01:57:03 lwall Locked $
+# $RCSfile: Makefile.SH,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:12:14 $
#
# $Log: Makefile.SH,v $
+# Revision 4.0.1.1 91/06/07 12:12:14 lwall
+# patch4: cflags now emits entire cc command except for the filename
+#
# Revision 4.0 91/03/20 01:57:03 lwall
# 4.0 baseline.
#
@@ -33,7 +36,6 @@ bin = $bin
lib = $lib
mansrc = $mansrc
manext = $manext
-CFLAGS = $ccflags $optimize
LDFLAGS = $ldflags
SMALL = $small
LARGE = $large $split
@@ -45,6 +47,8 @@ libs = $libs
cat >>Makefile <<'!NO!SUBS!'
+CCCMD = `sh cflags $@`
+
public = a2p s2p find2perl
private =
@@ -69,13 +73,13 @@ addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
SHELL = /bin/sh
.c.o:
- $(CC) -c $(CFLAGS) $(LARGE) $*.c
+ $(CCCMD) $*.c
all: $(public) $(private) $(util)
touch all
a2p: $(obj) a2p.o
- $(CC) $(LARGE) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p
+ $(CC) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p
a2p.c: a2p.y
@ echo Expect 226 shift/reduce conflicts...
@@ -83,7 +87,7 @@ a2p.c: a2p.y
mv y.tab.c a2p.c
a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h
- $(CC) -c $(CFLAGS) $(LARGE) a2p.c
+ $(CCCMD) $(LARGE) a2p.c
install: a2p s2p
# won't work with csh
@@ -95,16 +99,6 @@ install: a2p s2p
for pub in $(public); do \
chmod +x `basename $$pub`; \
done
-# chmod +x makedir
-# - ./makedir `filexp $(lib)`
-# - \
-#if test `pwd` != `filexp $(lib)`; then \
-#cp $(private) `filexp $(lib)`; \
-#fi
-# cd `filexp $(lib)`; \
-#for priv in $(private); do \
-#chmod +x `basename $$priv`; \
-#done
- if test `pwd` != $(mansrc); then \
for page in $(manpages); do \
cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
@@ -115,7 +109,7 @@ clean:
rm -f a2p *.o
realclean: clean
- rm -f *.orig */*.orig core $(addedbyconf) a2p.c s2p all
+ rm -f *.orig */*.orig core $(addedbyconf) a2p.c s2p find2perl all cflags
# The following lint has practically everything turned on. Unfortunately,
# you have to wade through a lot of mumbo jumbo that can't be suppressed.
diff --git a/x2p/str.c b/x2p/str.c
index f928b77931..5c250509e6 100644
--- a/x2p/str.c
+++ b/x2p/str.c
@@ -1,11 +1,14 @@
-/* $Header: str.c,v 4.0 91/03/20 01:58:15 lwall Locked $
+/* $RCSfile: str.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:20:08 $
*
- * Copyright (c) 1989, Larry Wall
+ * Copyright (c) 1991, Larry Wall
*
- * You may distribute under the terms of the GNU General Public License
- * as specified in the README file that comes with the perl 3.0 kit.
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file.
*
* $Log: str.c,v $
+ * Revision 4.0.1.1 91/06/07 12:20:08 lwall
+ * patch4: new copyright notice
+ *
* Revision 4.0 91/03/20 01:58:15 lwall
* 4.0 baseline.
*
diff --git a/x2p/str.h b/x2p/str.h
index 62c44a0863..96d164d249 100644
--- a/x2p/str.h
+++ b/x2p/str.h
@@ -1,11 +1,14 @@
-/* $Header: str.h,v 4.0 91/03/20 01:58:21 lwall Locked $
+/* $RCSfile: str.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:20:22 $
*
- * Copyright (c) 1989, Larry Wall
+ * Copyright (c) 1991, Larry Wall
*
- * You may distribute under the terms of the GNU General Public License
- * as specified in the README file that comes with the perl 3.0 kit.
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file.
*
* $Log: str.h,v $
+ * Revision 4.0.1.1 91/06/07 12:20:22 lwall
+ * patch4: new copyright notice
+ *
* Revision 4.0 91/03/20 01:58:21 lwall
* 4.0 baseline.
*
diff --git a/x2p/util.c b/x2p/util.c
index d1ba317677..7c2485aab1 100644
--- a/x2p/util.c
+++ b/x2p/util.c
@@ -1,11 +1,14 @@
-/* $Header: util.c,v 4.0 91/03/20 01:58:25 lwall Locked $
+/* $RCSfile: util.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:20:35 $
*
- * Copyright (c) 1989, Larry Wall
+ * Copyright (c) 1991, Larry Wall
*
- * You may distribute under the terms of the GNU General Public License
- * as specified in the README file that comes with the perl 3.0 kit.
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file.
*
* $Log: util.c,v $
+ * Revision 4.0.1.1 91/06/07 12:20:35 lwall
+ * patch4: new copyright notice
+ *
* Revision 4.0 91/03/20 01:58:25 lwall
* 4.0 baseline.
*
diff --git a/x2p/util.h b/x2p/util.h
index d682ee1d4b..f8a686bd7f 100644
--- a/x2p/util.h
+++ b/x2p/util.h
@@ -1,11 +1,14 @@
-/* $Header: util.h,v 4.0 91/03/20 01:58:29 lwall Locked $
+/* $RCSfile: util.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:20:43 $
*
- * Copyright (c) 1989, Larry Wall
+ * Copyright (c) 1991, Larry Wall
*
- * You may distribute under the terms of the GNU General Public License
- * as specified in the README file that comes with the perl 3.0 kit.
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file.
*
* $Log: util.h,v $
+ * Revision 4.0.1.1 91/06/07 12:20:43 lwall
+ * patch4: new copyright notice
+ *
* Revision 4.0 91/03/20 01:58:29 lwall
* 4.0 baseline.
*
diff --git a/x2p/walk.c b/x2p/walk.c
index 3dd4a1a266..f38968b0d5 100644
--- a/x2p/walk.c
+++ b/x2p/walk.c
@@ -1,11 +1,15 @@
-/* $Header: walk.c,v 4.0 91/03/20 01:58:36 lwall Locked $
+/* $RCSfile: walk.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:22:04 $
*
- * Copyright (c) 1989, Larry Wall
+ * Copyright (c) 1991, Larry Wall
*
- * You may distribute under the terms of the GNU General Public License
- * as specified in the README file that comes with the perl 3.0 kit.
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file.
*
* $Log: walk.c,v $
+ * Revision 4.0.1.1 91/06/07 12:22:04 lwall
+ * patch4: new copyright notice
+ * patch4: a2p didn't correctly implement -n switch
+ *
* Revision 4.0 91/03/20 01:58:36 lwall
* 4.0 baseline.
*
@@ -22,6 +26,7 @@ bool saw_getline = FALSE;
bool subretnum = FALSE;
bool saw_FNR = FALSE;
bool saw_argv0 = FALSE;
+bool saw_fh = FALSE;
int maxtmp = 0;
char *lparen;
char *rparen;
@@ -60,6 +65,20 @@ int minprec; /* minimum precedence without parens */
type &= 255;
switch (type) {
case OPROG:
+ arymax = 0;
+ if (namelist) {
+ while (isalpha(*namelist)) {
+ for (d = tokenbuf,s=namelist;
+ isalpha(*s) || isdigit(*s) || *s == '_';
+ *d++ = *s++) ;
+ *d = '\0';
+ while (*s && !isalpha(*s)) s++;
+ namelist = s;
+ nameary[++arymax] = savestr(tokenbuf);
+ }
+ }
+ if (maxfld < arymax)
+ maxfld = arymax;
opens = str_new(0);
subs = str_new(0);
str = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
@@ -115,20 +134,6 @@ int minprec; /* minimum precedence without parens */
str_cat(str,"chop;\t# strip record separator\n");
tab(str,level);
}
- arymax = 0;
- if (namelist) {
- while (isalpha(*namelist)) {
- for (d = tokenbuf,s=namelist;
- isalpha(*s) || isdigit(*s) || *s == '_';
- *d++ = *s++) ;
- *d = '\0';
- while (*s && !isalpha(*s)) s++;
- namelist = s;
- nameary[++arymax] = savestr(tokenbuf);
- }
- }
- if (maxfld < arymax)
- maxfld = arymax;
if (do_split)
emit_split(str,level);
str_scat(str,fstr);
@@ -584,11 +589,13 @@ sub Pick {\n\
s = savestr(tokenbuf);
for (t = tokenbuf; *t; t++) {
*t &= 127;
+ if (islower(*t))
+ *t = toupper(*t);
if (!isalpha(*t) && !isdigit(*t))
*t = '_';
}
if (!index(tokenbuf,'_'))
- strcpy(t,"_fh");
+ strcpy(t,"_FH");
tmp3str = hfetch(symtab,tokenbuf);
if (!tmp3str) {
do_opens = TRUE;
@@ -1110,11 +1117,13 @@ sub Pick {\n\
s = savestr(tokenbuf);
for (t = tokenbuf; *t; t++) {
*t &= 127;
+ if (islower(*t))
+ *t = toupper(*t);
if (!isalpha(*t) && !isdigit(*t))
*t = '_';
}
if (!index(tokenbuf,'_'))
- strcpy(t,"_fh");
+ strcpy(t,"_FH");
str_free(tmpstr);
safefree(s);
str_set(str,"close ");
@@ -1145,11 +1154,13 @@ sub Pick {\n\
s = savestr(tokenbuf);
for (t = tokenbuf; *t; t++) {
*t &= 127;
+ if (islower(*t))
+ *t = toupper(*t);
if (!isalpha(*t) && !isdigit(*t))
*t = '_';
}
if (!index(tokenbuf,'_'))
- strcpy(t,"_fh");
+ strcpy(t,"_FH");
tmp3str = hfetch(symtab,tokenbuf);
if (!tmp3str) {
str_cat(opens,"open(");
@@ -1195,9 +1206,12 @@ sub Pick {\n\
str_cat(str,"printf");
else
str_cat(str,"print");
+ saw_fh = 0;
if (len == 3 || do_fancy_opens) {
- if (*tokenbuf)
+ if (*tokenbuf) {
str_cat(str," ");
+ saw_fh = 1;
+ }
str_cat(str,tokenbuf);
}
tmpstr = walk(1+(type==OPRINT),level,ops[node+1].ival,&numarg,P_MIN);
@@ -1224,7 +1238,13 @@ sub Pick {\n\
}
if (*tmpstr->str_ptr) {
str_cat(str," ");
- str_scat(str,tmpstr);
+ if (!saw_fh && *tmpstr->str_ptr == '(') {
+ str_cat(str,"(");
+ str_scat(str,tmpstr);
+ str_cat(str,")");
+ }
+ else
+ str_scat(str,tmpstr);
}
else {
str_cat(str," $_");