Esempio n. 1
0
void
mu_config_show_help (MuConfigCmd cmd)
{
	GOptionContext *ctx;
	GOptionGroup *group;
	char *cleanhelp;

	g_return_if_fail (mu_config_cmd_is_valid(cmd));

	ctx = g_option_context_new ("");
	g_option_context_set_main_group	(ctx, config_options_group_mu());

	group = get_option_group (cmd);
	if (group)
		g_option_context_add_group (ctx, group);

	g_option_context_set_description (ctx,
					  get_help_string (cmd, TRUE));
	cleanhelp = massage_help
		(g_option_context_get_help (ctx, TRUE, group));

	g_print ("usage:\n\t%s\n%s",
		 get_help_string (cmd, FALSE), cleanhelp);

	g_free (cleanhelp);
}
void editor_palette<Item>::select_bg_item(const std::string& item_id)
{
	if (selected_bg_item_ != item_id) {
		selected_bg_item_ = item_id;
		set_dirty();
	}
	gui_.video().clear_help_string(help_handle_);
	help_handle_ = gui_.video().set_help_string(get_help_string());
}
void editor_palette<Item>::adjust_size(const SDL_Rect& target)
{
	palette_x_ = target.x;
	palette_y_ = target.y;
	const int space_for_items = target.h;
	const int items_fitting = (space_for_items / item_space_) * item_width_;
	nitems_ = std::min(items_fitting, nmax_items_);
	if (num_visible_items() != nitems_) {
		buttons_.resize(nitems_, gui::tristate_button(gui_.video(), this));
	}
	set_location(target);
	set_dirty(true);
	gui_.video().clear_help_string(help_handle_);
	help_handle_ = gui_.video().set_help_string(get_help_string());
}
Esempio n. 4
0
void SimpleModule::execute(void)
{
  try {
    if ((_arguments.size() == 1) &&
	( _arguments[0] == LString("-help") ||
	  _arguments[0] == LString("-h") ||
	  _arguments[0] == LString("-?")))
      cerr << get_help_string() << endl;
    else
      execute(&_arguments);
  } catch (...) {
    _arguments.clear();
    throw;
  }
  _arguments.clear();
}
int main(int argc, char *argv[])
{
    int opt;
    int option_index = 0;

    char * name = "";
    int dts = -1;

    static struct option long_options[] =
    {
        {"name",              required_argument, 0, 'n'},
        {"singlylinkedlist",  no_argument,       0, 'l'},
        {"doublylinkedlist",  no_argument,       0, 'd'},
        {"stack",             no_argument,       0, 's'},
        {"queue",             no_argument,       0, 'q'},
        {"deque",             no_argument,       0, 'u'},
        {"rbtree",            no_argument,       0, 'r'},
        {"btree",             no_argument,       0, 'b'},
        {"bstree",            no_argument,       0, 't'},
        {"heap",              no_argument,       0, 'p'},
        {"hashmap",           no_argument,       0, 'm'},
        {"help",              no_argument,       0, 'h'},
        {0, 0, 0, 0}
    };

    while ((opt = getopt_long(argc, argv, "n:lds", long_options, &option_index)) != -1)
    {
        switch (opt)
        {
            case 'n': /* name */
                strcpy (name, optarg);
                break;
            case 'l': /* singly linked list */
                dts = SINGLYLINKEDLIST;
                break;
            case 'd': /* doubly linked list */
                dts = DOUBLYLINKEDLIST;
                break;
            case 's': /* stack */
                dts = STACK;
                break;
            case 'q': /* queue */
                dts = QUEUE;
                break;
            case 'u': /* deque */
                dts = DEQUE;
                break;
            case 'r': /* red-black tree */
                dts = REDBLACKTREE;
                break;
            case 'b': /* b-tree */ 
                dts = BTREE;
                break;
            case 't': /* binary search tree */
                dts = BINARYSEARCHTREE;
                break;
            case 'p': /* heap */
                dts = HEAP;
                break;
            case 'm': /* hash map */
                dts = HASHMAP;
                break;
            case 'h': /* help */
                printf("%s", get_help_string());
                return 0;
            case '?':
                /*Error message printed out by getopt_long*/
                if (isprint (optopt))
                    fprintf (stderr, "Unknown option `-%c'.\n", optopt);
                else
                    fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt);
                return 1;
        }
    }

    if (dts == -1)
    {
        printf("Please select a data structure to build\n");
    }


    return 0;
}
Esempio n. 6
0
String SimpleModule::get_description(void) const
{
  return get_help_string();
}