cond.h revision 1.1
1178172Simp#ifndef COND_H 2178172Simp#define COND_H 3178172Simp/* $OpenPackages$ */ 4178172Simp/* $OpenBSD: cond.h,v 1.1 2001/05/23 12:34:41 espie Exp $ */ 5178172Simp 6178172Simp/* 7178172Simp * Copyright (c) 2001 Marc Espie. 8178172Simp * 9178172Simp * Redistribution and use in source and binary forms, with or without 10178172Simp * modification, are permitted provided that the following conditions 11178172Simp * are met: 12178172Simp * 1. Redistributions of source code must retain the above copyright 13178172Simp * notice, this list of conditions and the following disclaimer. 14178172Simp * 2. Redistributions in binary form must reproduce the above copyright 15178172Simp * notice, this list of conditions and the following disclaimer in the 16178172Simp * documentation and/or other materials provided with the distribution. 17178172Simp * 18178172Simp * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS 19178172Simp * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20178172Simp * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21178172Simp * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD 22178172Simp * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23178172Simp * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24178172Simp * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25178172Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26178172Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27178172Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28178172Simp * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29178172Simp */ 30178172Simp 31178172Simp/* cond 32178172Simp * Parse Makefile conditionals. 33178172Simp */ 34178172Simp 35178172Simp/* Values returned by Cond_Eval. */ 36178172Simp#define COND_PARSE 0 /* Parse the next lines */ 37178172Simp#define COND_SKIP 1 /* Skip the next lines */ 38178172Simp#define COND_INVALID 2 /* Not a conditional statement */ 39178172Simp 40202031Simp/* whattodo = Cond_Eval(line); 41202031Simp * Parses a conditional expression (without the leading dot), 42202031Simp * and returns a decision value. 43178172Simp * State is kept internally, since conditionals nest. */ 44178172Simpextern int Cond_Eval(const char *); 45178172Simp 46178172Simp/* Cond_End(); 47178172Simp * To call at end of parsing, checks that all conditionals were 48178172Simp * closed. */ 49178172Simpextern void Cond_End(void); 50178172Simp 51178172Simp#endif 52178172Simp