1f7923656Sespie #ifndef COND_H 2f7923656Sespie #define COND_H 3*bb4544dfSespie /* $OpenBSD: cond.h,v 1.5 2010/07/19 19:46:44 espie Exp $ */ 4f7923656Sespie 5f7923656Sespie /* 6f7923656Sespie * Copyright (c) 2001 Marc Espie. 7f7923656Sespie * 8f7923656Sespie * Redistribution and use in source and binary forms, with or without 9f7923656Sespie * modification, are permitted provided that the following conditions 10f7923656Sespie * are met: 11f7923656Sespie * 1. Redistributions of source code must retain the above copyright 12f7923656Sespie * notice, this list of conditions and the following disclaimer. 13f7923656Sespie * 2. Redistributions in binary form must reproduce the above copyright 14f7923656Sespie * notice, this list of conditions and the following disclaimer in the 15f7923656Sespie * documentation and/or other materials provided with the distribution. 16f7923656Sespie * 17f7923656Sespie * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS 18f7923656Sespie * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19f7923656Sespie * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20f7923656Sespie * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD 21f7923656Sespie * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22f7923656Sespie * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23f7923656Sespie * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24f7923656Sespie * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25f7923656Sespie * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26f7923656Sespie * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27f7923656Sespie * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28f7923656Sespie */ 29f7923656Sespie 30f7923656Sespie /* cond 31f7923656Sespie * Parse Makefile conditionals. 32f7923656Sespie */ 33f7923656Sespie 34f7923656Sespie /* Values returned by Cond_Eval. */ 35f7923656Sespie #define COND_PARSE 0 /* Parse the next lines */ 36f7923656Sespie #define COND_SKIP 1 /* Skip the next lines */ 37f7923656Sespie #define COND_INVALID 2 /* Not a conditional statement */ 38c887eb2eSespie #define COND_ISFOR 3 39c887eb2eSespie #define COND_ISUNDEF 4 40c887eb2eSespie #define COND_ISINCLUDE 5 41d88ab755Sespie #define COND_ISPOISON 6 42f7923656Sespie 43f7923656Sespie /* whattodo = Cond_Eval(line); 44f7923656Sespie * Parses a conditional expression (without the leading dot), 45f7923656Sespie * and returns a decision value. 46f7923656Sespie * State is kept internally, since conditionals nest. */ 47f7923656Sespie extern int Cond_Eval(const char *); 48f7923656Sespie 49f7923656Sespie /* Cond_End(); 50f7923656Sespie * To call at end of parsing, checks that all conditionals were 51f7923656Sespie * closed. */ 52f7923656Sespie extern void Cond_End(void); 53f7923656Sespie 54f7923656Sespie #endif 55