1433d6423SLionel Sambuc /* 2433d6423SLionel Sambuc * proto.h - function prototype definitions for cawf(1) 3433d6423SLionel Sambuc */ 4433d6423SLionel Sambuc 5433d6423SLionel Sambuc /* 6433d6423SLionel Sambuc * Copyright (c) 1991 Purdue University Research Foundation, 7433d6423SLionel Sambuc * West Lafayette, Indiana 47907. All rights reserved. 8433d6423SLionel Sambuc * 9433d6423SLionel Sambuc * Written by Victor A. Abell <abe@mace.cc.purdue.edu>, Purdue 10433d6423SLionel Sambuc * University Computing Center. Not derived from licensed software; 11433d6423SLionel Sambuc * derived from awf(1) by Henry Spencer of the University of Toronto. 12433d6423SLionel Sambuc * 13433d6423SLionel Sambuc * Permission is granted to anyone to use this software for any 14433d6423SLionel Sambuc * purpose on any computer system, and to alter it and redistribute 15433d6423SLionel Sambuc * it freely, subject to the following restrictions: 16433d6423SLionel Sambuc * 17433d6423SLionel Sambuc * 1. The author is not responsible for any consequences of use of 18433d6423SLionel Sambuc * this software, even if they arise from flaws in it. 19433d6423SLionel Sambuc * 20433d6423SLionel Sambuc * 2. The origin of this software must not be misrepresented, either 21433d6423SLionel Sambuc * by explicit claim or by omission. Credits must appear in the 22433d6423SLionel Sambuc * documentation. 23433d6423SLionel Sambuc * 24433d6423SLionel Sambuc * 3. Altered versions must be plainly marked as such, and must not 25433d6423SLionel Sambuc * be misrepresented as being the original software. Credits must 26433d6423SLionel Sambuc * appear in the documentation. 27433d6423SLionel Sambuc * 28433d6423SLionel Sambuc * 4. This notice may not be removed or altered. 29433d6423SLionel Sambuc */ 30433d6423SLionel Sambuc 31433d6423SLionel Sambuc 32433d6423SLionel Sambuc #ifdef UNIX 33433d6423SLionel Sambuc # ifdef USG 34433d6423SLionel Sambuc #include <string.h> 35433d6423SLionel Sambuc # else /* not USG */ 36433d6423SLionel Sambuc #include <strings.h> 37433d6423SLionel Sambuc # endif /* USG */ 38433d6423SLionel Sambuc #else /* not UNIX */ 39433d6423SLionel Sambuc #include <string.h> 40433d6423SLionel Sambuc #endif /* UNIX */ 41433d6423SLionel Sambuc 42433d6423SLionel Sambuc /* 43433d6423SLionel Sambuc * The following conditional rat's nest intends to: 44433d6423SLionel Sambuc * 45433d6423SLionel Sambuc * for MS-DOS #include <stdlib.h> and <malloc.h>. <stdlib.h> exists in 46433d6423SLionel Sambuc * MS-DOS so the STDLIB symbol should be defined and UNIX 47433d6423SLionel Sambuc * shouldn't be. 48433d6423SLionel Sambuc * 49433d6423SLionel Sambuc * for Unix #include <stdlib.h> if the STDLIB symbol is defined. If 50433d6423SLionel Sambuc * STDLIB isn't defined, define a prototype for getenv(). 51433d6423SLionel Sambuc * If the UNIX symbol is defined (and it should be) and if 52433d6423SLionel Sambuc * the MALLOCH symbol is defined, #include <malloc.h>; else 53433d6423SLionel Sambuc * define a prototype for malloc() if UNIX is defined and 54433d6423SLionel Sambuc * MALLOCH isn't. (The Unix <stdlib.h> usually defines the 55433d6423SLionel Sambuc * malloc() prototype.) 56433d6423SLionel Sambuc * 57433d6423SLionel Sambuc * for ??? Define a prototype for getenv() and #include <malloc.h> 58433d6423SLionel Sambuc * if neither STDLIB nor UNIX are defined. (What system is 59433d6423SLionel Sambuc * this?) 60433d6423SLionel Sambuc */ 61433d6423SLionel Sambuc 62433d6423SLionel Sambuc #ifdef STDLIB 63433d6423SLionel Sambuc #include <stdlib.h> 64433d6423SLionel Sambuc # ifndef UNIX 65433d6423SLionel Sambuc #include <malloc.h> 66433d6423SLionel Sambuc # endif /* UNIX */ 67433d6423SLionel Sambuc #else /* not STDLIB */ 68433d6423SLionel Sambuc char *getenv(char *name); 69433d6423SLionel Sambuc # ifdef UNIX 70433d6423SLionel Sambuc # ifdef MALLOCH 71433d6423SLionel Sambuc #include <malloc.h> 72433d6423SLionel Sambuc # else /* not MALLOCH */ 73433d6423SLionel Sambuc char *malloc(unsigned size); 74433d6423SLionel Sambuc # endif /* MALLOCH */ 75433d6423SLionel Sambuc # else /* not UNIX */ 76433d6423SLionel Sambuc #include <malloc.h> 77433d6423SLionel Sambuc # endif /* UNIX */ 78433d6423SLionel Sambuc #endif /* STDLIB */ 79433d6423SLionel Sambuc 80433d6423SLionel Sambuc unsigned char *Asmcode(unsigned char **s, unsigned char *c); 81433d6423SLionel Sambuc int Asmname(unsigned char *s, unsigned char *c); 82433d6423SLionel Sambuc void Charput(int c); 83*d0055759SDavid van Moolenbroek void Delmacro(int mx); 84433d6423SLionel Sambuc int Defdev(); 85433d6423SLionel Sambuc void Delstr(int sx); 86433d6423SLionel Sambuc void Error(int t, int l, char *s1, char *s2); 87433d6423SLionel Sambuc void Error3(int len, char *word, char *sarg, int narg, char *msg); 88433d6423SLionel Sambuc void Expand(unsigned char *line); 89433d6423SLionel Sambuc void Delnum(int nx); 90433d6423SLionel Sambuc unsigned char *Field(int n, unsigned char *p, int c); 91433d6423SLionel Sambuc void Endword(); 92433d6423SLionel Sambuc int Findchar(unsigned char *nm, int l, unsigned char *s, int e); 93433d6423SLionel Sambuc int Findhy(unsigned char *s, int l, int e); 94433d6423SLionel Sambuc int Findmacro(unsigned char *p, int e); 95433d6423SLionel Sambuc int Findnum(unsigned char *n, int v, int e); 96433d6423SLionel Sambuc int Findparms(unsigned char *n); 97433d6423SLionel Sambuc int Findscale(int n, double v, int e); 98433d6423SLionel Sambuc unsigned char *Findstr(unsigned char *nm, unsigned char *s, int e); 99433d6423SLionel Sambuc int LenprtHF(unsigned char *s, int p, int t); 100433d6423SLionel Sambuc int main(int argc, char *argv[]); 101433d6423SLionel Sambuc void Macro(unsigned char *inp); 102433d6423SLionel Sambuc void Nreq(unsigned char *line, int brk); 103433d6423SLionel Sambuc void Free(unsigned char **p); 104433d6423SLionel Sambuc unsigned char *Newstr(unsigned char *s); 105433d6423SLionel Sambuc void Pass2(unsigned char *line); 106433d6423SLionel Sambuc void Pass3(int len, unsigned char *word, unsigned char *sarg, int narg); 107433d6423SLionel Sambuc void regerror(char *s); 108433d6423SLionel Sambuc unsigned char *reg(int paren, int *flagp); 109433d6423SLionel Sambuc unsigned char *regatom(int *flagp); 110433d6423SLionel Sambuc unsigned char *regbranch(int *flagp); 111433d6423SLionel Sambuc regexp *regcomp(char *exp); 112433d6423SLionel Sambuc void regdump(regexp *r); 113433d6423SLionel Sambuc int regexec(regexp *prog, unsigned char *string); 114433d6423SLionel Sambuc void Stringput(unsigned char *s); 115433d6423SLionel Sambuc int Str2word(unsigned char *s, int len); 116