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