⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dx_parser.h

📁 一个很全的matlab工具包
💻 H
字号:
// $Id: dx_parser.h,v 2.4 2004/01/14 17:28:44 kgadeyne Exp $// Copyright (C) 2003 Klaas Gadeyne <klaas dot gadeyne at mech dot kuleuven dot ac dot be>//  // This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//  // This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.//  // You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.//  #ifndef __PARSER__#define __PARSER__extern "C"{#include <argp.h>#include <stdlib.h>#define MAX_NUM_ARGS 6    const char *argp_program_version = "dxlinkclient version double o five";  const char *argp_program_bug_address = "<klaas dot gadeyne at mech dot kuleuven dot ac dot be>";  /** Structure used by main to communicate with parse_opt. */  struct arguments  {    char *args[MAX_NUM_ARGS];  /* args */    /// Verbose or not?    int verbose;    /// File used to read from    char *file;    /// Host to send data to    char *host;    /// Port number used to send (only if compiled with #ifdef _SOCKET_?)    unsigned int port;  };  /*    OPTIONS.  Field 1 in ARGP.    Order of fields:     {    NAME of the long option,     KEY (= short option),     ARG (name of the options argument),     FLAGS (flags describing the option, eg. OPTION_HIDDEN: Don't show the current option in --help output.,     DOC (documentation)    }.  */  static struct argp_option options[MAX_NUM_ARGS+1+1] =    {      {"verbose", 'v', 0, 0, "Produce verbose output"},      {"file", 'f', "FILE", 0, "Set location of dx visualisation file"},      {"port", 'p', "PORT", 0,"Set connection port to PORT"},      {"host", 'h', "HOST", 0, "Set host name"},      {0} // This should always be the last option    };  /*    ARGS_DOC. Field 3 in ARGP.    A description of the non-option command-line arguments    that we accept.  */  static char args_doc[] = "";  /*    DOC.  Field 4 in ARGP.    Program documentation.  */  static char doc[] = "Test Bootstrap Filter Visualisation -- A program to visualize the estimation of the location of a Mobile Robot by means of a laser scanner and a particle filter";  /*    PARSER. Field 2 in ARGP. Order of parameters: KEY, ARG, STATE.  */  static error_t  parse_opt (int key, char *arg, struct argp_state *state)  {    struct arguments *arguments = (struct arguments *)state->input;    switch (key)      {      case 'v':	arguments->verbose = 1;	break;      case 'f':	arguments->file = arg;	break;      case 'p':	arguments->port = strtoul(arg,NULL,0);	break;      case 'h':	arguments->host = arg;	break;      case ARGP_KEY_ARG: // Current CL argument is not an option	if (state->arg_num >= MAX_NUM_ARGS) argp_usage(state);	arguments->args[state->arg_num] = arg;	break;      case ARGP_KEY_END: // All CLs have been parsed	// if (state->arg_num < MAX_NUM_ARGS)argp_usage (state);	break;      default:	return ARGP_ERR_UNKNOWN;      }    return 0;  }  /*    The ARGP structure itself.  */  static struct argp argp = {options, parse_opt, args_doc, doc};} // End extern "C"#endif // __PARSER__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -