xref: /openbsd-src/usr.bin/make/for.h (revision bb4544df9ace63bacb4f113c781faab96bfc1dec)
1f7923656Sespie #ifndef FOR_H
2f7923656Sespie #define FOR_H
3*bb4544dfSespie /* $OpenBSD: for.h,v 1.5 2010/07/19 19:46:44 espie Exp $ */
4f7923656Sespie /*
5f7923656Sespie  * Copyright (c) 2001 Marc Espie.
6f7923656Sespie  *
7f7923656Sespie  * Redistribution and use in source and binary forms, with or without
8f7923656Sespie  * modification, are permitted provided that the following conditions
9f7923656Sespie  * are met:
10f7923656Sespie  * 1. Redistributions of source code must retain the above copyright
11f7923656Sespie  *    notice, this list of conditions and the following disclaimer.
12f7923656Sespie  * 2. Redistributions in binary form must reproduce the above copyright
13f7923656Sespie  *    notice, this list of conditions and the following disclaimer in the
14f7923656Sespie  *    documentation and/or other materials provided with the distribution.
15f7923656Sespie  *
16f7923656Sespie  * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
17f7923656Sespie  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18f7923656Sespie  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19f7923656Sespie  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OPENBSD
20f7923656Sespie  * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21f7923656Sespie  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22f7923656Sespie  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23f7923656Sespie  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24f7923656Sespie  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25f7923656Sespie  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26f7923656Sespie  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27f7923656Sespie  */
28f7923656Sespie 
29f7923656Sespie 
30f7923656Sespie /*
31f7923656Sespie  * for
32f7923656Sespie  *	Functions to handle loops in a makefile.
33f7923656Sespie  */
34f7923656Sespie 
35f7923656Sespie struct For_;
36f7923656Sespie typedef struct For_ For;
37f7923656Sespie /* handle = For_Eval(line);
38f7923656Sespie  *	Evaluate for loop in line, and returns an opaque handle.
39f7923656Sespie  *	Loop lines are parsed as
40c3d4a025Sespie  *	 <variable1> ... in <values>
41c3d4a025Sespie  *	assuming .for has been parsed by previous modules.
42c3d4a025Sespie  *	Returns NULL if this does not parse as a for loop after all.  */
43f7923656Sespie extern For *For_Eval(const char *);
44f7923656Sespie 
45f7923656Sespie /* finished = For_Accumulate(handle, line);
46f7923656Sespie  *	Accumulate lines in a loop, until we find the matching .endfor. */
47f7923656Sespie extern bool For_Accumulate(For *, const char *);
48f7923656Sespie 
49f7923656Sespie /* For_Run(handle);
50f7923656Sespie  *	Runs the complete for loop, pushing back expanded lines to reparse
51f7923656Sespie  *	using Parse_FromString. */
52f7923656Sespie extern void For_Run(For *);
53f7923656Sespie 
54f7923656Sespie #endif
55