Logo Search packages:      
Sourcecode: dahdi-tools version File versions  Download package

menuselect.h

Go to the documentation of this file.
/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright (C) 2005-2006, Russell Bryant
 *
 * Russell Bryant <russell@digium.com>
 *
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */

/*!
 * \file
 *
 * \brief public data structures and defaults for menuselect
 *
 */

#ifndef MENUSELECT_H
#define MENUSELECT_H

#include "linkedlists.h"

#define OUTPUT_MAKEOPTS_DEFAULT "menuselect.makeopts"
#define OUTPUT_MAKEDEPS_DEFAULT "menuselect.makedeps"
#define MENUSELECT_DEPS         "build_tools/menuselect-deps"

struct member;

00037 struct depend {
      /*! the name of the dependency */
00039       const char *name;
      /*! the display name of the dependency */
00041       const char *displayname;
      /*! if this dependency is a member, not an external object */
00043       struct member *member;
      /*! for linking */
      AST_LIST_ENTRY(depend) list;
};

00048 struct conflict {
      /*! the name of the conflict */
00050       const char *name;
      /*! the display name of the conflict */
00052       const char *displayname;
      /*! if this conflict is a member, not an external object */
00054       const struct member *member;
      /*! for linking */
      AST_LIST_ENTRY(conflict) list;
};

00059 struct use {
      /*! the name of the used package */
00061       const char *name;
      /*! the display name of the used package */
00063       const char *displayname;
      /*! if this used package is a member, not an external object */
00065       struct member *member;
      /*! if this used package was found */
00067       unsigned char met;
      /*! for linking */
      AST_LIST_ENTRY(use) list;
};

enum failure_types {
      NO_FAILURE = 0,
      SOFT_FAILURE = 1,
      HARD_FAILURE = 2,
};

00078 struct member {
      /*! What will be sent to the makeopts file */
00080       const char *name;
      /*! Display name if known */
00082       const char *displayname;
      /*! Default setting */
00084       const char *defaultenabled;
      /*! Delete these file(s) if this member changes */
00086       const char *remove_on_change;
      /*! Touch these file(s) if this member changes */
00088       const char *touch_on_change;
      /*! This module is currently selected */
00090       unsigned int enabled:1;
      /*! This module was enabled when the config was loaded */
00092       unsigned int was_enabled:1;
      /*! This module has failed dependencies */
00094       unsigned int depsfailed:2;
      /*! This module has failed conflicts */
00096       unsigned int conflictsfailed:2;
      /*! This module's 'enabled' flag was changed by a default only */
00098       unsigned int was_defaulted:1;
      /*! This module is a dependency, and if it is selected then
        we have included it in the MENUSELECT_BUILD_DEPS line
        in the output file */
00102       unsigned int build_deps_output:1;
      /*! This module should never be enabled automatically, but only
       * when explicitly set. */
00105       unsigned int explicitly_enabled_only:1;
      /*! dependencies of this module */
      AST_LIST_HEAD_NOLOCK(, depend) deps;
      /*! conflicts of this module */
      AST_LIST_HEAD_NOLOCK(, conflict) conflicts;
      /*! optional packages used by this module */
      AST_LIST_HEAD_NOLOCK(, use) uses;
      /*! for making a list of modules */
      AST_LIST_ENTRY(member) list;
};

00116 struct category {
      /*! the Makefile variable */
00118       const char *name;
      /*! the name displayed in the menu */
00120       const char *displayname;
      /*! Delete these file(s) if anything in this category changes */
00122       const char *remove_on_change;
      /*! Touch these file(s) if anything in this category changes */
00124       const char *touch_on_change;
      /*! Output what is selected, as opposed to not selected */
00126       unsigned int positive_output:1;
      /*! All choices in this category are mutually exclusive */
00128       unsigned int exclusive:1;
      /*! the list of possible values to be set in this variable */
      AST_LIST_HEAD_NOLOCK(, member) members;
      /*! for linking */
      AST_LIST_ENTRY(category) list;
};

extern AST_LIST_HEAD_NOLOCK(categories, category) categories;

extern const char *menu_name;

/*! This is implemented by the frontend */
int run_menu(void);

int count_categories(void);

int count_members(struct category *cat);

/*! \brief Toggle a member of a category at the specified index to enabled/disabled */
void toggle_enabled_index(struct category *cat, int index);

void toggle_enabled(struct member *mem);

/*! \brief Set a member of a category at the specified index to enabled */
void set_enabled(struct category *cat, int index);
/*! \brief Set a member of a category at the specified index to not enabled */
void clear_enabled(struct category *cat, int index);

/*! \brief Enable/Disable all members of a category as long as dependencies have been met and no conflicts are found */
void set_all(struct category *cat, int val);

/*! \brief returns non-zero if the string is not defined, or has zero length */
00160 static inline int strlen_zero(const char *s)
{
      return (!s || (*s == '\0'));
}

#endif /* MENUSELECT_H */

Generated by  Doxygen 1.6.0   Back to index