diff options
author | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1987-12-18 00:00:00 +0000 |
---|---|---|
committer | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1987-12-18 00:00:00 +0000 |
commit | 8d063cd8450e59ea1c611a2f4f5a21059a2804f1 (patch) | |
tree | 9bba34a99f94e47746e40ffe1419151779d8a4fc /stab.h | |
download | perl-8d063cd8450e59ea1c611a2f4f5a21059a2804f1.tar.gz |
a "replacement" for awk and sedperl-1.0
[ Perl is kind of designed to make awk and sed semi-obsolete. This posting
will include the first 10 patches after the main source. The following
description is lifted from Larry's manpage. --r$ ]
Perl is a interpreted language optimized for scanning arbitrary text
files, extracting information from those text files, and printing
reports based on that information. It's also a good language for many
system management tasks. The language is intended to be practical
(easy to use, efficient, complete) rather than beautiful (tiny,
elegant, minimal). It combines (in the author's opinion, anyway) some
of the best features of C, sed, awk, and sh, so people familiar with
those languages should have little difficulty with it. (Language
historians will also note some vestiges of csh, Pascal, and even
BASIC-PLUS.) Expression syntax corresponds quite closely to C
expression syntax. If you have a problem that would ordinarily use sed
or awk or sh, but it exceeds their capabilities or must run a little
faster, and you don't want to write the silly thing in C, then perl may
be for you. There are also translators to turn your sed and awk
scripts into perl scripts.
Diffstat (limited to 'stab.h')
-rw-r--r-- | stab.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/stab.h b/stab.h new file mode 100644 index 0000000000..cd38d6d990 --- /dev/null +++ b/stab.h @@ -0,0 +1,58 @@ +/* $Header: stab.h,v 1.0 87/12/18 13:06:18 root Exp $ + * + * $Log: stab.h,v $ + * Revision 1.0 87/12/18 13:06:18 root + * Initial revision + * + */ + +struct stab { + struct stab *stab_next; + char *stab_name; + STR *stab_val; + struct stio *stab_io; + FCMD *stab_form; + ARRAY *stab_array; + HASH *stab_hash; + CMD *stab_sub; + char stab_flags; +}; + +#define SF_VMAGIC 1 /* call routine to dereference STR val */ + +struct stio { + FILE *fp; + long lines; + long page; + long page_len; + long lines_left; + char *top_name; + STAB *top_stab; + char *fmt_name; + STAB *fmt_stab; + char type; + char flags; +}; + +#define IOF_ARGV 1 /* this fp iterates over ARGV */ +#define IOF_START 2 /* check for null ARGV and substitute '-' */ +#define IOF_FLUSH 4 /* this fp wants a flush after write op */ + +#define Nullstab Null(STAB*) + +#define STAB_STR(s) (tmpstab = (s), tmpstab->stab_flags & SF_VMAGIC ? stab_str(tmpstab) : tmpstab->stab_val) +#define STAB_GET(s) (tmpstab = (s), str_get(tmpstab->stab_flags & SF_VMAGIC ? stab_str(tmpstab) : tmpstab->stab_val)) +#define STAB_GNUM(s) (tmpstab = (s), str_gnum(tmpstab->stab_flags & SF_VMAGIC ? stab_str(tmpstab) : tmpstab->stab_val)) + +EXT STAB *tmpstab; + +EXT STAB *stab_index[128]; + +EXT char *envname; /* place for ENV name being assigned--gross cheat */ +EXT char *signame; /* place for SIG name being assigned--gross cheat */ + +EXT int statusvalue; +EXT int subsvalue; + +STAB *aadd(); +STAB *hadd(); |