[BACK]Return to varname.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Annotation of src/usr.bin/make/varname.h, Revision 1.1

1.1     ! espie       1: #ifndef VARNAME_H
        !             2: #define VARNAME_H
        !             3: /*
        !             4:  * Copyright (c) 2001 Marc Espie.
        !             5:  *
        !             6:  * Redistribution and use in source and binary forms, with or without
        !             7:  * modification, are permitted provided that the following conditions
        !             8:  * are met:
        !             9:  * 1. Redistributions of source code must retain the above copyright
        !            10:  *    notice, this list of conditions and the following disclaimer.
        !            11:  * 2. Redistributions in binary form must reproduce the above copyright
        !            12:  *    notice, this list of conditions and the following disclaimer in the
        !            13:  *    documentation and/or other materials provided with the distribution.
        !            14:  *
        !            15:  * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
        !            16:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
        !            17:  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
        !            18:  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OPENBSD
        !            19:  * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
        !            20:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
        !            21:  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        !            22:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        !            23:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            24:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        !            25:  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            26:  */
        !            27:
        !            28: /* varname -
        !            29:  *     Handles variable names in recursive situations, e.g.,
        !            30:  *     to expand ${A${BC}}.
        !            31:  */
        !            32:
        !            33: /* Used to store temporary names, e.g., after $ expansion. */
        !            34: struct Name {
        !            35:        const char      *s;             /* Start of name. */
        !            36:        const char      *e;             /* End of name. */
        !            37:        bool            tofree;         /* Needs freeing after use ? */
        !            38: };
        !            39:
        !            40: /* endpos = VarName_Get(startpos, &name, ctxt, undef_is_bad, cont_function);
        !            41:  *     Gets a variable name from startpos, storing the result into name.
        !            42:  *     Recursive names are expanded from context ctxt. Boolean
        !            43:  *     undef_is_bad governs whether undefined variables should trigger a
        !            44:  *     parse error.  To parse its argument efficiently, VarName_Get
        !            45:  *     uses cont_function(pos), which should return the position of the
        !            46:  *     next $ in string, or the position where the variable spec ends (as
        !            47:  *     differing modules have different requirements wrt variable spec
        !            48:  *     endings). Returns the position where the variable spec finally
        !            49:  *     ends. Name result might be a copy, or not. */
        !            50: extern const char *VarName_Get(const char *, struct Name *, SymTable *,
        !            51:     bool, const char *(*)(const char *));
        !            52: /* VarName_Free(name);
        !            53:  *     Frees a variable name filled by VarName_Get(). */
        !            54: extern void VarName_Free(struct Name *);
        !            55:
        !            56: #endif