summaryrefslogtreecommitdiff
path: root/x2p
diff options
context:
space:
mode:
authorLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1988-01-27 22:18:25 +0000
committerLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1988-01-27 22:18:25 +0000
commita559c25918b1466cdb50c9f978a86f01be0bac10 (patch)
treeffbe6c7bc07144d291a61555d002e7969110f248 /x2p
parenta1cc2bdc08f9aa1504f32e5b0b782c2b3cffd124 (diff)
downloadperl-a559c25918b1466cdb50c9f978a86f01be0bac10.tar.gz
perl 1.0 patch 8: perl needed an eval operator and a symbolic debugger
I didn't add an eval operator to the original perl because I hadn't thought of any good uses for it. Recently I thought of some. Along with creating the eval operator, this patch introduces a symbolic debugger for perl scripts, which makes use of eval to interpret some debugging commands. Having eval also lets me emulate awk's FOO=bar command line behavior with a line such as the one a2p now inserts at the beginning of translated scripts.
Diffstat (limited to 'x2p')
-rw-r--r--x2p/a2py.c9
-rw-r--r--x2p/walk.c11
2 files changed, 15 insertions, 5 deletions
diff --git a/x2p/a2py.c b/x2p/a2py.c
index 8a1ad78b96..c99504046a 100644
--- a/x2p/a2py.c
+++ b/x2p/a2py.c
@@ -1,6 +1,9 @@
-/* $Header: a2py.c,v 1.0 87/12/18 17:50:33 root Exp $
+/* $Header: a2py.c,v 1.0.1.1 88/01/28 11:07:08 root Exp $
*
* $Log: a2py.c,v $
+ * Revision 1.0.1.1 88/01/28 11:07:08 root
+ * patch8: added support for FOO=bar switches using eval.
+ *
* Revision 1.0 87/12/18 17:50:33 root
* Initial revision
*
@@ -114,6 +117,10 @@ register char **env;
tmpstr = walk(0,0,root,&i);
str = str_make("#!/bin/perl\n\n");
+ str_cat(str,
+ "eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_]+=)(.*)/ && shift;\n");
+ str_cat(str,
+ " # process any FOO=bar switches\n\n");
if (do_opens && opens) {
str_scat(str,opens);
str_free(opens);
diff --git a/x2p/walk.c b/x2p/walk.c
index 04d133b9c4..e745510b1d 100644
--- a/x2p/walk.c
+++ b/x2p/walk.c
@@ -1,6 +1,9 @@
-/* $Header: walk.c,v 1.0 87/12/18 13:07:40 root Exp $
+/* $Header: walk.c,v 1.0.1.1 88/01/28 11:07:56 root Exp $
*
* $Log: walk.c,v $
+ * Revision 1.0.1.1 88/01/28 11:07:56 root
+ * patch8: changed some misleading comments.
+ *
* Revision 1.0 87/12/18 13:07:40 root
* Initial revision
*
@@ -68,13 +71,13 @@ int *numericptr;
str_cat(str,"';\t\t# field separator from -F switch\n");
}
else if (saw_FS && !const_FS) {
- str_cat(str,"$FS = '[ \\t\\n]+';\t\t# default field separator\n");
+ str_cat(str,"$FS = '[ \\t\\n]+';\t\t# set field separator\n");
}
if (saw_OFS) {
- str_cat(str,"$, = ' ';\t\t# default output field separator\n");
+ str_cat(str,"$, = ' ';\t\t# set output field separator\n");
}
if (saw_ORS) {
- str_cat(str,"$\\ = \"\\n\";\t\t# default output record separator\n");
+ str_cat(str,"$\\ = \"\\n\";\t\t# set output record separator\n");
}
if (str->str_cur > 20)
str_cat(str,"\n");