This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 1.0 patch 1: Portability bugs and one possible SIGSEGV
[perl5.git] / perl.h
CommitLineData
36ce8bec 1/* $Header: perl.h,v 1.0.1.1 88/01/21 21:29:23 root Exp $
8d063cd8
LW
2 *
3 * $Log: perl.h,v $
36ce8bec
DFDL
4 * Revision 1.0.1.1 88/01/21 21:29:23 root
5 * No longer defines STDSTDIO--gets it from config.h now.
6 *
8d063cd8
LW
7 * Revision 1.0 87/12/18 13:05:38 root
8 * Initial revision
9 *
10 */
11
12#define DEBUGGING
8d063cd8
LW
13
14#define VOIDUSED 1
15#include "config.h"
16
17#ifndef BCOPY
18# define bcopy(s1,s2,l) memcpy(s2,s1,l);
19# define bzero(s,l) memset(s,0,l);
20#endif
21
22#include <stdio.h>
23#include <ctype.h>
24#include <setjmp.h>
25#include <sys/types.h>
26#include <sys/stat.h>
27#include <time.h>
28#include <sys/times.h>
29
30typedef struct arg ARG;
31typedef struct cmd CMD;
32typedef struct formcmd FCMD;
33typedef struct scanpat SPAT;
34typedef struct stab STAB;
35typedef struct stio STIO;
36typedef struct string STR;
37typedef struct atbl ARRAY;
38typedef struct htbl HASH;
39
40#include "str.h"
41#include "form.h"
42#include "stab.h"
43#include "spat.h"
44#include "arg.h"
45#include "cmd.h"
46#include "array.h"
47#include "hash.h"
48
49/* A string is TRUE if not "" or "0". */
50#define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
51EXT char *Yes INIT("1");
52EXT char *No INIT("");
53
54#define str_true(str) (Str = (str), (Str->str_pok ? True(Str->str_ptr) : (Str->str_nok ? (Str->str_nval != 0.0) : 0 )))
55
56#define str_peek(str) (Str = (str), (Str->str_pok ? Str->str_ptr : (Str->str_nok ? (sprintf(buf,"num(%g)",Str->str_nval),buf) : "" )))
57#define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
58#define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_nval : str_2num(Str)))
59EXT STR *Str;
60
61#define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
62
63CMD *add_label();
64CMD *block_head();
65CMD *append_line();
66CMD *make_acmd();
67CMD *make_ccmd();
68CMD *invert();
69CMD *addcond();
70CMD *addloop();
71CMD *wopt();
72
73SPAT *stab_to_spat();
74
75STAB *stabent();
76
77ARG *stab_to_arg();
78ARG *op_new();
79ARG *make_op();
80ARG *make_lval();
81ARG *make_match();
82ARG *make_split();
83ARG *flipflip();
84
85STR *arg_to_str();
86STR *str_new();
87STR *stab_str();
88STR *eval();
89
90FCMD *load_format();
91
92char *scanpat();
93char *scansubst();
94char *scantrans();
95char *scanstr();
96char *scanreg();
97char *reg_get();
98char *str_append_till();
99char *str_gets();
100
101bool do_match();
102bool do_open();
103bool do_close();
104bool do_print();
105
106int do_subst();
107
108void str_free();
109void freearg();
110
111EXT int line INIT(0);
112EXT int arybase INIT(0);
113
114struct outrec {
115 int o_lines;
116 char *o_str;
117 int o_len;
118};
119
120EXT struct outrec outrec;
121EXT struct outrec toprec;
122
123EXT STAB *last_in_stab INIT(Nullstab);
124EXT STAB *defstab INIT(Nullstab);
125EXT STAB *argvstab INIT(Nullstab);
126EXT STAB *envstab INIT(Nullstab);
127EXT STAB *sigstab INIT(Nullstab);
128EXT STAB *defoutstab INIT(Nullstab);
129EXT STAB *curoutstab INIT(Nullstab);
130EXT STAB *argvoutstab INIT(Nullstab);
131
132EXT STR *freestrroot INIT(Nullstr);
133
134EXT FILE *rsfp;
135EXT char buf[1024];
136EXT char *bufptr INIT(buf);
137
138EXT STR *linestr INIT(Nullstr);
139
140EXT char record_separator INIT('\n');
141EXT char *ofs INIT(Nullch);
142EXT char *ors INIT(Nullch);
143EXT char *ofmt INIT(Nullch);
144EXT char *inplace INIT(Nullch);
145
146EXT char tokenbuf[256];
147EXT int expectterm INIT(TRUE);
148EXT int lex_newlines INIT(FALSE);
149
150FILE *popen();
151/* char *str_get(); */
152STR *interp();
153void free_arg();
154STIO *stio_new();
155
156EXT struct stat statbuf;
157EXT struct tms timesbuf;
158
159#ifdef DEBUGGING
160EXT int debug INIT(0);
161EXT int dlevel INIT(0);
162EXT char debname[40];
163EXT char debdelim[40];
164#define YYDEBUG;
165extern int yydebug;
166#endif
167
168EXT STR str_no;
169EXT STR str_yes;
170
171/* runtime control stuff */
172
173EXT struct loop {
174 char *loop_label;
175 jmp_buf loop_env;
176} loop_stack[32];
177
178EXT int loop_ptr INIT(-1);
179
180EXT jmp_buf top_env;
181
182EXT char *goto_targ INIT(Nullch); /* cmd_exec gets strange when set */
183
184double atof();
185long time();
186struct tm *gmtime(), *localtime();
187
188#ifdef CHARSPRINTF
189 char *sprintf();
190#else
191 int sprintf();
192#endif
193
194#ifdef EUNICE
195#define UNLINK(f) while (unlink(f) >= 0)
196#else
197#define UNLINK unlink
198#endif