1141104Sharti/*-
2141104Sharti * Copyright (c) 1988, 1989, 1990, 1993
3141104Sharti *	The Regents of the University of California.  All rights reserved.
4141104Sharti * Copyright (c) 1989 by Berkeley Softworks
5141104Sharti * All rights reserved.
6141104Sharti *
7141104Sharti * This code is derived from software contributed to Berkeley by
8141104Sharti * Adam de Boor.
9141104Sharti *
10141104Sharti * Redistribution and use in source and binary forms, with or without
11141104Sharti * modification, are permitted provided that the following conditions
12141104Sharti * are met:
13141104Sharti * 1. Redistributions of source code must retain the above copyright
14141104Sharti *    notice, this list of conditions and the following disclaimer.
15141104Sharti * 2. Redistributions in binary form must reproduce the above copyright
16141104Sharti *    notice, this list of conditions and the following disclaimer in the
17141104Sharti *    documentation and/or other materials provided with the distribution.
18141104Sharti * 3. All advertising materials mentioning features or use of this software
19141104Sharti *    must display the following acknowledgement:
20141104Sharti *	This product includes software developed by the University of
21141104Sharti *	California, Berkeley and its contributors.
22141104Sharti * 4. Neither the name of the University nor the names of its contributors
23141104Sharti *    may be used to endorse or promote products derived from this software
24141104Sharti *    without specific prior written permission.
25141104Sharti *
26141104Sharti * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27141104Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28141104Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29141104Sharti * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30141104Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31141104Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32141104Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33141104Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34141104Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35141104Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36141104Sharti * SUCH DAMAGE.
37141104Sharti *
38141104Sharti * $FreeBSD$
39141104Sharti */
40141104Sharti
41141104Sharti#ifndef parse_h_470eeb9a
42141104Sharti#define	parse_h_470eeb9a
43141104Sharti
44141104Sharti#include <stdio.h>
45141104Sharti
46146177Sharti#include "util.h"
47141104Sharti
48141104Shartistruct GNode;
49141104Shartistruct Lst;
50141104Sharti
51146059Sharti/*
52146059Sharti * Error levels for parsing. PARSE_FATAL means the process cannot continue
53146059Sharti * once the makefile has been parsed. PARSE_WARNING means it can. Passed
54146059Sharti * as the first argument to Parse_Error.
55146059Sharti */
56146059Sharti#define	PARSE_WARNING	2
57146059Sharti#define	PARSE_FATAL	1
58146059Sharti
59146066Sharti/*
60146066Sharti * Definitions for the "local" variables. Used only for clarity.
61146066Sharti */
62146066Sharti#define	TARGET		"@"	/* Target of dependency */
63146066Sharti#define	OODATE		"?"	/* All out-of-date sources */
64146066Sharti#define	ALLSRC		">"	/* All sources */
65146066Sharti#define	IMPSRC		"<"	/* Source implied by transformation */
66146066Sharti#define	PREFIX		"*"	/* Common prefix */
67146066Sharti#define	ARCHIVE		"!"	/* Archive in "archive(member)" syntax */
68146066Sharti#define	MEMBER		"%"	/* Member in "archive(member)" syntax */
69146066Sharti
70146066Sharti#define	FTARGET		"@F"	/* file part of TARGET */
71146066Sharti#define	DTARGET		"@D"	/* directory part of TARGET */
72146066Sharti#define	FIMPSRC		"<F"	/* file part of IMPSRC */
73146066Sharti#define	DIMPSRC		"<D"	/* directory part of IMPSRC */
74146066Sharti#define	FPREFIX		"*F"	/* file part of PREFIX */
75146066Sharti#define	DPREFIX		"*D"	/* directory part of PREFIX */
76146066Sharti
77141104Shartivoid Parse_Error(int, const char *, ...);
78141104ShartiBoolean Parse_AnyExport(void);
79141104ShartiBoolean Parse_IsVar(char *);
80141104Shartivoid Parse_DoVar(char *, struct GNode *);
81141104Shartivoid Parse_AddIncludeDir(char *);
82144341Shartivoid Parse_File(const char *, FILE *);
83141104Shartivoid Parse_FromString(char *, int);
84141104Shartivoid Parse_MainName(struct Lst *);
85141104Sharti
86141104Sharti#endif /* parse_h_470eeb9a */
87