summaryrefslogtreecommitdiff
path: root/cmd.h
diff options
context:
space:
mode:
authorLarry Wall <larry@wall.org>1989-10-18 00:00:00 +0000
committerLarry Wall <larry@wall.org>1989-10-18 00:00:00 +0000
commita687059cbaf2c6fdccb5e0fae2aee80ec15625a8 (patch)
tree674c8533b7bd942204f23782934c72f8624dd308 /cmd.h
parent13281fa4f8547e0eb31d1986b865d9b7ec7d0dcc (diff)
downloadperl-3.000.tar.gz
perl 3.0: (no announcement message available)perl-3.000
A few of the new features: (18 Oct) * Perl can now handle binary data correctly and has functions to pack and unpack binary structures into arrays or lists. You can now do arbitrary ioctl functions. * You can now pass things to subroutines by reference. * Debugger enhancements. * An array or associative array may now appear in a local() list. * Array values may now be interpolated into strings. * Subroutine names are now distinguished by prefixing with &. You can call subroutines without using do, and without passing any argument list at all. * You can use the new -u switch to cause perl to dump core so that you can run undump and produce a binary executable image. Alternately you can use the "dump" operator after initializing any variables and such. * You can now chop lists. * Perl now uses /bin/csh to do filename globbing, if available. This means that filenames with spaces or other strangenesses work right. * New functions: mkdir and rmdir, getppid, getpgrp and setpgrp, getpriority and setpriority, chroot, ioctl and fcntl, flock, readlink, lstat, rindex, pack and unpack, read, warn, dbmopen and dbmclose, dump, reverse, defined, undef.
Diffstat (limited to 'cmd.h')
-rw-r--r--cmd.h58
1 files changed, 36 insertions, 22 deletions
diff --git a/cmd.h b/cmd.h
index e320ee2746..5e880a4986 100644
--- a/cmd.h
+++ b/cmd.h
@@ -1,16 +1,26 @@
-/* $Header: cmd.h,v 2.0 88/06/05 00:08:28 root Exp $
+/* $Header: cmd.h,v 3.0 89/10/18 15:09:15 lwall Locked $
+ *
+ * Copyright (c) 1989, 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.
*
* $Log: cmd.h,v $
- * Revision 2.0 88/06/05 00:08:28 root
- * Baseline version 2.0.
+ * Revision 3.0 89/10/18 15:09:15 lwall
+ * 3.0 baseline
*
*/
#define C_NULL 0
#define C_IF 1
-#define C_WHILE 2
-#define C_EXPR 3
+#define C_ELSE 2
+#define C_WHILE 3
#define C_BLOCK 4
+#define C_EXPR 5
+#define C_NEXT 6
+#define C_ELSIF 7 /* temporary--turns into an IF + ELSE */
+#define C_CSWITCH 8 /* created by switch optimization in block_head() */
+#define C_NSWITCH 9 /* likewise */
#ifdef DEBUGGING
#ifndef DOINIT
@@ -19,21 +29,15 @@ extern char *cmdname[];
char *cmdname[] = {
"NULL",
"IF",
+ "ELSE",
"WHILE",
- "EXPR",
"BLOCK",
- "5",
- "6",
- "7",
- "8",
- "9",
- "10",
- "11",
- "12",
- "13",
- "14",
- "15",
- "16"
+ "EXPR",
+ "NEXT",
+ "ELSIF",
+ "CSWITCH",
+ "NSWITCH",
+ "10"
};
#endif
#endif /* DEBUGGING */
@@ -48,6 +52,7 @@ char *cmdname[] = {
#define CF_INVERT 04000 /* it's an "unless" or an "until" */
#define CF_ONCE 010000 /* we've already pushed the label on the stack */
#define CF_FLIP 020000 /* on a match do flipflop */
+#define CF_TERM 040000 /* value of this cmd might be returned */
#define CFT_FALSE 0 /* c_expr is always false */
#define CFT_TRUE 1 /* c_expr is always true */
@@ -62,6 +67,7 @@ char *cmdname[] = {
#define CFT_ARRAY 10 /* this is a foreach loop */
#define CFT_INDGETS 11 /* c_expr is <$variable> */
#define CFT_NUMOP 12 /* c_expr is a numeric comparison */
+#define CFT_CCLASS 13 /* c_expr must start with one of these characters */
#ifdef DEBUGGING
#ifndef DOINIT
@@ -81,7 +87,8 @@ char *cmdopt[] = {
"ARRAY",
"INDGETS",
"NUMOP",
- "13"
+ "CCLASS",
+ "14"
};
#endif
#endif /* DEBUGGING */
@@ -93,7 +100,13 @@ struct acmd {
struct ccmd {
CMD *cc_true; /* normal code to do on if and while */
- CMD *cc_alt; /* else code or continue code */
+ CMD *cc_alt; /* else cmd ptr or continue code */
+};
+
+struct scmd {
+ CMD **sc_next; /* array of pointers to commands */
+ short sc_offset; /* first value - 1 */
+ short sc_max; /* last value + 1 */
};
struct cmd {
@@ -107,6 +120,7 @@ struct cmd {
union ucmd {
struct acmd acmd; /* normal command */
struct ccmd ccmd; /* compound command */
+ struct scmd scmd; /* switch command */
} ucmd;
short c_slen; /* len of c_short, if not null */
short c_flags; /* optimization flags--see above */
@@ -120,11 +134,11 @@ struct cmd {
EXT CMD *main_root INIT(Nullcmd);
EXT CMD *eval_root INIT(Nullcmd);
-EXT struct compcmd {
+struct compcmd {
CMD *comp_true;
CMD *comp_alt;
};
void opt_arg();
void evalstatic();
-STR *cmd_exec();
+int cmd_exec();