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 /str.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 'str.h')
-rw-r--r-- | str.h | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +/* $Header: str.h,v 1.0 87/12/18 13:06:26 root Exp $ + * + * $Log: str.h,v $ + * Revision 1.0 87/12/18 13:06:26 root + * Initial revision + * + */ + +struct string { + char * str_ptr; /* pointer to malloced string */ + double str_nval; /* numeric value, if any */ + int str_len; /* allocated size */ + int str_cur; /* length of str_ptr as a C string */ + union { + STR *str_next; /* while free, link to next free str */ + STAB *str_magic; /* while in use, ptr to magic stab, if any */ + } str_link; + char str_pok; /* state of str_ptr */ + char str_nok; /* state of str_nval */ +}; + +#define Nullstr Null(STR*) + +/* the following macro updates any magic values this str is associated with */ + +#define STABSET(x) (x->str_link.str_magic && stabset(x->str_link.str_magic,x)) + +EXT STR **tmps_list; +EXT long tmps_max INIT(-1); + +char *str_2ptr(); +double str_2num(); +STR *str_static(); +STR *str_make(); +STR *str_nmake(); |