[asterisk-commits] branch russell/menuselect_buildoptions r34346 -
/team/russell/menuselect_buil...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Jun 15 16:37:44 MST 2006
Author: russell
Date: Thu Jun 15 18:37:43 2006
New Revision: 34346
URL: http://svn.digium.com/view/asterisk?rev=34346&view=rev
Log:
remove build option changes that were a dirty hack ...
Modified:
team/russell/menuselect_buildoptions/build_tools/menuselect.c
team/russell/menuselect_buildoptions/build_tools/menuselect.h
team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c
Modified: team/russell/menuselect_buildoptions/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/russell/menuselect_buildoptions/build_tools/menuselect.c?rev=34346&r1=34345&r2=34346&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/build_tools/menuselect.c (original)
+++ team/russell/menuselect_buildoptions/build_tools/menuselect.c Thu Jun 15 18:37:43 2006
@@ -408,19 +408,10 @@
void toggle_enabled(struct category *cat, int index)
{
struct member *mem;
- struct buildopt *bop;
int i = 0;
AST_LIST_TRAVERSE(&cat->members, mem, list) {
if (i++ == index)
- break;
- AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
- if (i++ == index) {
- mem = NULL;
- break;
- }
- }
- if (bop)
break;
}
@@ -428,9 +419,6 @@
mem->enabled = !mem->enabled;
if (cat->force_clean_on_change)
force_clean = 1;
- } else if (bop) {
- bop->enabled = !bop->enabled;
- force_clean = 1;
}
}
@@ -471,38 +459,6 @@
fprintf(stderr, "Unable to find '%s' in category '%s'\n", mem_name, cat_name);
}
-static void process_buildopt(const char *mem_name, char *buf)
-{
- const char *bop_name;
- struct category *cat;
- struct member *mem;
- struct buildopt *bop;
-
- while ((bop_name = strsep(&buf, " \n"))) {
- if (!bop_name || strlen_zero(bop_name))
- return;
-
- AST_LIST_TRAVERSE(&categories, cat, list) {
- AST_LIST_TRAVERSE(&cat->members, mem, list) {
- if (strcasecmp(mem->name, mem_name))
- continue;
- AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
- if (strcasecmp(bop->name, bop_name))
- continue;
- bop->enabled = 1;
- break;
- }
- break;
- }
- if (bop)
- break;
- }
-
- if (!bop || !mem)
- fprintf(stderr, "Unable to find '%s' for member '%s'\n", bop_name, mem_name);
- }
-}
-
/*! \brief Parse an existing output makeopts file and enable members previously selected */
static int parse_existing_config(const char *infile)
{
@@ -547,12 +503,7 @@
process_prev_failed_deps(parse);
continue;
}
-
- if (!strncasecmp(category, "MENUSELECT_BUILDOPT_", 20)) {
- process_buildopt(category + 20, parse);
- continue;
- }
-
+
while ((member = strsep(&parse, " \n"))) {
member = skip_blanks(member);
if (strlen_zero(member))
@@ -572,7 +523,6 @@
FILE *f;
struct category *cat;
struct member *mem;
- struct buildopt *bop;
if (!(f = fopen(output_makeopts, "w"))) {
fprintf(stderr, "Unable to open build configuration file (%s) for writing!\n", output_makeopts);
@@ -593,21 +543,8 @@
/* Output which members were disabled because of failed dependencies or conflicts */
AST_LIST_TRAVERSE(&categories, cat, list) {
AST_LIST_TRAVERSE(&cat->members, mem, list) {
- char have_bops = 0;
-
if (mem->depsfailed || mem->conflictsfailed)
fprintf(f, "MENUSELECT_DEPSFAILED=%s=%s\n", cat->name, mem->name);
- AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
- if (bop->enabled) {
- if (!have_bops) {
- fprintf(f, "MENUSELECT_BUILDOPT_%s=", mem->name);
- have_bops = 1;
- }
- fprintf(f, "%s ", bop->name);
- }
- }
- if (have_bops)
- fprintf(f, "\n");
}
}
@@ -639,7 +576,7 @@
if (!AST_LIST_EMPTY(&mem->conflicts))
fprintf(stderr, " --> Conflicts Found: %s\n", mem->conflictsfailed ? "Yes" : "No");
AST_LIST_TRAVERSE(&mem->buildopts, bop, list)
- fprintf(stderr, " --> Build Option: %s (%s)\n", bop->name, bop->enabled ? "Enabled" : "Disabled");
+ fprintf(stderr, " --> Build Option: %s\n", bop->name);
}
}
}
@@ -670,14 +607,10 @@
int count_members(struct category *cat)
{
struct member *mem;
- struct buildopt *bop;
int count = 0;
- AST_LIST_TRAVERSE(&cat->members, mem, list) {
+ AST_LIST_TRAVERSE(&cat->members, mem, list)
count++;
- AST_LIST_TRAVERSE(&mem->buildopts, bop, list)
- count++;
- }
return count;
}
Modified: team/russell/menuselect_buildoptions/build_tools/menuselect.h
URL: http://svn.digium.com/view/asterisk/team/russell/menuselect_buildoptions/build_tools/menuselect.h?rev=34346&r1=34345&r2=34346&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/build_tools/menuselect.h (original)
+++ team/russell/menuselect_buildoptions/build_tools/menuselect.h Thu Jun 15 18:37:43 2006
@@ -49,7 +49,7 @@
/*! the name of the build option */
const char *name;
/*! whether this build option is currently enabled */
- unsigned int enabled:1;
+ int enabled:1;
/*! for linking */
AST_LIST_ENTRY(buildopt) list;
};
Modified: team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c
URL: http://svn.digium.com/view/asterisk/team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c?rev=34346&r1=34345&r2=34346&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c (original)
+++ team/russell/menuselect_buildoptions/build_tools/menuselect_curses.c Thu Jun 15 18:37:43 2006
@@ -64,8 +64,16 @@
"XXX means dependencies have not been met"
};
+void winch_handler(int sig);
+void show_help(WINDOW *win);
+void draw_main_menu(WINDOW *menu, int curopt);
+void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed);
+int run_category_menu(WINDOW *menu, int cat_num);
+int run_category_menu(WINDOW *menu, int cat_num);
+void draw_title_window(WINDOW *title);
+
/*! \brief Handle a window resize in xterm */
-static void winch_handler(int sig)
+void winch_handler(int sig)
{
getmaxyx(stdscr, max_y, max_x);
@@ -77,7 +85,7 @@
}
/*! \brief Display help information */
-static void show_help(WINDOW *win)
+void show_help(WINDOW *win)
{
int i;
@@ -90,7 +98,7 @@
getch(); /* display the help until the user hits a key */
}
-static void draw_main_menu(WINDOW *menu, int curopt)
+void draw_main_menu(WINDOW *menu, int curopt)
{
struct category *cat;
char buf[64];
@@ -114,7 +122,7 @@
wrefresh(menu);
}
-static void display_mem_info(WINDOW *menu, struct member *mem, int start, int end)
+void display_mem_info(WINDOW *menu, struct member *mem, int start, int end)
{
char buf[64];
struct depend *dep;
@@ -154,12 +162,11 @@
}
-static void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed)
-{
- int memnum = 0;
- int linenum = 0;
+void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed)
+{
+ int i = 0;
+ int j = 0;
struct member *mem;
- struct buildopt *bop;
char buf[64];
const char *desc = NULL;
@@ -167,10 +174,8 @@
/* If all we have to do is move the cursor,
* then don't clear the screen and start over */
AST_LIST_TRAVERSE(&cat->members, mem, list) {
- memnum++;
- AST_LIST_TRAVERSE(&mem->buildopts, bop, list)
- memnum++;
- if (curopt + 1 <= memnum) {
+ i++;
+ if (curopt + 1 == i) {
display_mem_info(menu, mem, start, end);
break;
}
@@ -182,39 +187,24 @@
wclear(menu);
- memnum = 0;
+ i = 0;
AST_LIST_TRAVERSE(&cat->members, mem, list) {
- if (memnum < start) {
- memnum++;
+ if (i < start) {
+ i++;
continue;
}
- wmove(menu, linenum++, max_x / 2 - 10);
- memnum++;
- if (mem->depsfailed) {
- snprintf(buf, sizeof(buf), "XXX %d.%s %s",
- memnum, memnum < 10 ? " " : "", mem->name);
- } else {
- snprintf(buf, sizeof(buf), "[%s] %d.%s %s",
- mem->enabled ? "*" : " ", memnum, memnum < 10 ? " " : "", mem->name);
- }
+ wmove(menu, j++, max_x / 2 - 10);
+ i++;
+ if (mem->depsfailed)
+ snprintf(buf, sizeof(buf), "XXX %d.%s %s", i, i < 10 ? " " : "", mem->name);
+ else
+ snprintf(buf, sizeof(buf), "[%s] %d.%s %s", mem->enabled ? "*" : " ", i, i < 10 ? " " : "", mem->name);
waddstr(menu, buf);
-
- if (curopt + 1 == memnum)
+
+ if (curopt + 1 == i)
display_mem_info(menu, mem, start, end);
- AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
- if (memnum++ == end)
- break;
- if (curopt + 1 == memnum)
- display_mem_info(menu, mem, start, end);
- snprintf(buf, sizeof(buf), " <%s> %s", bop->enabled ? "*" : " ", bop->name);
- wmove(menu, linenum++, max_x / 2 - 10);
- waddstr(menu, buf);
- if (memnum == end)
- break;
- }
-
- if (memnum >= end)
+ if (i == end)
break;
}
@@ -222,7 +212,7 @@
wrefresh(menu);
}
-static int run_category_menu(WINDOW *menu, int cat_num)
+int run_category_menu(WINDOW *menu, int cat_num)
{
struct category *cat;
int i = 0;
@@ -308,7 +298,7 @@
return c;
}
-static void draw_title_window(WINDOW *title)
+void draw_title_window(WINDOW *title)
{
wmove(title, 1, (max_x / 2) - (strlen(MENU_TITLE1) / 2));
waddstr(title, MENU_TITLE1);
@@ -320,6 +310,8 @@
waddstr(title, MENU_HELP);
wrefresh(title);
}
+
+
int run_menu(void)
{
More information about the asterisk-commits
mailing list