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

📄 args.c

📁 代码格式化工具。 其实就是linux下indent的windows版本。
💻 C
📖 第 1 页 / 共 3 页
字号:
  {"nbbo", PRO_BOOL, true, OFF, &settings.break_before_boolean_operator,   &exp_bbo},  {"nbbb", PRO_BOOL, false, OFF, &settings.blanklines_before_blockcomments,   &exp_bbb},  {"nbap", PRO_BOOL, true, OFF, &settings.blanklines_after_procs, &exp_bap},  {"nbadp", PRO_BOOL, false, OFF,   &settings.blanklines_after_declarations_at_proctop, &exp_badp},  {"nbad", PRO_BOOL, false, OFF, &settings.blanklines_after_declarations,   &exp_bad},  {"nbacc", PRO_BOOL, false, OFF,   &settings.blanklines_around_conditional_compilation, &exp_bacc},  {"lps", PRO_BOOL, false, ON, &settings.leave_preproc_space, &exp_lps},  {"lp", PRO_BOOL, true, ON, &settings.lineup_to_parens, &exp_lp},  {"lc", PRO_INT, DEFAULT_RIGHT_COMMENT_MARGIN, ONOFF_NA,   &settings.comment_max_col, &exp_lc},  {"l", PRO_INT, DEFAULT_RIGHT_MARGIN, ONOFF_NA, &settings.max_col, &exp_l},  {"kr", PRO_SETTINGS, 0, ONOFF_NA, KR_SETTINGS_STRING, &exp_kr},  {"ip", PRO_INT, 5, ONOFF_NA, &settings.indent_parameters, &exp_ip},  {"i", PRO_INT, 2, ONOFF_NA, &settings.ind_size, &exp_i},  {"hnl", PRO_BOOL, true, ON, &settings.honour_newlines, &exp_hnl},  {"h", PRO_FUNCTION, 0, ONOFF_NA, (int *) usage, &exp_version},  /* This is now the default. */  {"gnu", PRO_SETTINGS, 0, ONOFF_NA, GNU_SETTINGS_STRING, &exp_gnu},  {"fca", PRO_BOOL, false, ON, &settings.format_comments, &exp_fca},  {"fc1", PRO_BOOL, false, ON, &settings.format_col1_comments, &exp_fc1},  {"eei", PRO_BOOL, false, ON, &settings.extra_expression_indent, &exp_eei},  {"dj", PRO_BOOL, false, ON, &settings.ljust_decl, &exp_dj},  {"di", PRO_INT, 2, ONOFF_NA, &settings.decl_indent, &exp_di},  {"d", PRO_INT, 0, ONOFF_NA, &settings.unindent_displace, &exp_d},  {"cs", PRO_BOOL, true, ON, &settings.cast_space, &exp_cs},  {"cp", PRO_INT, 1, ONOFF_NA, &settings.else_endif_col, &exp_cp},  {"cli", PRO_INT, 0, ONOFF_NA, &settings.case_indent, &exp_cli},  {"ci", PRO_INT, 0, ONOFF_NA, &settings.continuation_indent, &exp_ci},  {"ce", PRO_BOOL, false, ON, &settings.cuddle_else, &exp_ce},  {"cdw", PRO_BOOL, false, ON, &settings.cuddle_do_while, &exp_cdw},  {"cdb", PRO_BOOL, false, ON, &settings.comment_delimiter_on_blankline,   &exp_cdb},  {"cd", PRO_INT, 33, ONOFF_NA, &settings.decl_com_ind, &exp_cd},  {"cbi", PRO_INT, -1, ONOFF_NA, &settings.case_brace_indent, &exp_cbi},  {"c++", PRO_BOOL, false, ON, &settings.c_plus_plus, &exp_cpp},  {"c", PRO_INT, 33, ONOFF_NA, &settings.com_ind, &exp_c},  {"bs", PRO_BOOL, false, ON, &settings.blank_after_sizeof, &exp_bs},  {"brs", PRO_BOOL, false, ON, &settings.braces_on_struct_decl_line,   &exp_bls},  {"bls", PRO_BOOL, false, OFF, &settings.braces_on_struct_decl_line,   &exp_bls},  {"brf", PRO_BOOL, false, ON, &settings.braces_on_func_def_line, &exp_blf},  {"blf", PRO_BOOL, false, OFF, &settings.braces_on_func_def_line, &exp_blf},  {"bli", PRO_INT, 2, ONOFF_NA, &settings.brace_indent, &exp_bli},  {"br", PRO_BOOL, false, ON, &settings.btype_2, &exp_bl},  {"bl", PRO_BOOL, false, OFF, &settings.btype_2, &exp_bl},  {"bfda", PRO_BOOL, false, ON, &settings.break_function_decl_args,   &exp_bfda},  {"bfde", PRO_BOOL, false, ON, &settings.break_function_decl_args_end,   &exp_bfde},  {"bc", PRO_BOOL, true, OFF, &settings.leave_comma, &exp_bc},  {"bbo", PRO_BOOL, true, ON, &settings.break_before_boolean_operator,   &exp_bbo},  {"bbb", PRO_BOOL, false, ON, &settings.blanklines_before_blockcomments,   &exp_bbb},  {"bap", PRO_BOOL, true, ON, &settings.blanklines_after_procs, &exp_bap},  {"badp", PRO_BOOL, false, ON,   &settings.blanklines_after_declarations_at_proctop, &exp_badp},  {"bad", PRO_BOOL, false, ON, &settings.blanklines_after_declarations,   &exp_bad},  {"bacc", PRO_BOOL, false, ON,   &settings.blanklines_around_conditional_compilation, &exp_bacc},  {"T", PRO_KEY, 0, ONOFF_NA, 0, &exp_T},  {"ppi", PRO_INT, 0, ONOFF_NA, &settings.force_preproc_width, &exp_ppi},  /* Signify end of structure.  */  {0, PRO_IGN, 0, ONOFF_NA, 0, 0}};#endif /* GNU defaults */typedef struct long_option_conversion{  char *long_name;  char *short_name;} long_option_conversion_ty;const long_option_conversion_ty option_conversions[] = {  {"version", "version"},  {"verbose", "v"},  {"usage", "h"},  {"use-tabs", "ut"},  {"tab-size", "ts"},  {"swallow-optional-blank-lines", "sob"},  {"struct-brace-indentation", "sbi"},  {"start-left-side-of-comments", "sc"},  {"standard-output", "st"},  {"space-special-semicolon", "ss"},  {"space-after-while", "saw"},  {"space-after-procedure-calls", "pcs"},  {"space-after-parentheses", "prs"},  {"space-after-if", "sai"},  {"space-after-for", "saf"},  {"space-after-cast", "cs"},  {"remove-preprocessor-space", "nlps"},  {"procnames-start-lines", "psl"},#ifdef PRESERVE_MTIME  {"preserve-mtime", "pmt"},#endif  {"paren-indentation", "pi"},  {"parameter-indentation", "ip"},  {"output-file", "o"},  {"output", "o"},  {"original-style", "orig"},  {"original", "orig"},  {"no-verbosity", "nv"},  {"no-tabs", "nut"},  {"no-space-after-while", "nsaw"},  {"no-space-after-parentheses", "nprs"},  {"no-space-after-if", "nsai"},  {"no-space-after-function-call-names", "npcs"},  {"no-space-after-for", "nsaf"},  {"no-space-after-casts", "ncs"},  {"no-parameter-indentation", "nip"},  {"no-extra-expression-indentation", "neei"},  {"no-comment-delimiters-on-blank-lines", "ncdb"},  {"no-blank-lines-before-block-comments", "nbbb"},  {"no-blank-lines-after-procedures", "nbap"},  {"no-blank-lines-after-procedure-declarations", "nbadp"},  {"no-blank-lines-after-ifdefs", "nbacc"},  {"no-blank-lines-after-declarations", "nbad"},  {"no-blank-lines-after-commas", "nbc"},  {"no-blank-before-sizeof", "nbs"},  {"no-Bill-Shannon", "nbs"},  {"line-length", "l"},  {"line-comments-indentation", "d"},  {"left-justify-declarations", "dj"},  {"leave-preprocessor-space", "lps"},  {"leave-optional-blank-lines", "nsob"},  {"kernighan-and-ritchie-style", "kr"},  {"kernighan-and-ritchie", "kr"},  {"k-and-r-style", "kr"},  {"indentation-level", "i"},  {"indent-level", "i"},  {"ignore-profile", "npro"},  {"ignore-newlines", "nhnl"},  {"honour-newlines", "hnl"},  {"help", "h"},  {"gnu-style", "gnu"},  {"format-first-column-comments", "fc1"},  {"format-all-comments", "fca"},  {"extra-expression-indentation", "eei"},  {"else-endif-column", "cp"},  {"dont-star-comments", "nsc"},  {"dont-space-special-semicolon", "nss"},  {"dont-line-up-parentheses", "nlp"},  {"dont-left-justify-declarations", "ndj"},  {"dont-indent-parameters", "nip"},  {"dont-format-first-column-comments", "nfc1"},  {"dont-format-comments", "nfca"},  {"dont-cuddle-else", "nce"},  {"dont-cuddle-do-while", "ncdw"},  {"dont-break-procedure-type", "npsl"},  {"dont-break-function-decl-args", "nbfda"},  {"dont-break-function-decl-args-end", "nbfde"},  {"declaration-indentation", "di"},  {"declaration-comment-column", "cd"},  {"cuddle-else", "ce"},  {"cuddle-do-while", "cdw"},  {"continue-at-parentheses", "lp"},  {"continuation-indentation", "ci"},  {"comment-line-length", "lc"},  {"comment-indentation", "c"},  {"comment-delimiters-on-blank-lines", "cdb"},  {"case-indentation", "cli"},  {"case-brace-indentation", "cbi"},  {"c-plus-plus", "c++"},  {"break-function-decl-args", "bfda"},  {"break-function-decl-args-end", "bfde"},  {"break-before-boolean-operator", "bbo"},  {"break-after-boolean-operator", "nbbo"},  {"braces-on-struct-decl-line", "brs"},  {"braces-on-func-def-line", "brf"},  {"braces-on-if-line", "br"},  {"braces-after-struct-decl-line", "bls"},  {"braces-after-func-def-line", "blf"},  {"braces-after-if-line", "bl"},  {"brace-indent", "bli"},  {"blank-lines-before-block-comments", "bbb"},  {"blank-lines-after-procedures", "bap"},  {"blank-lines-after-procedure-declarations", "badp"},  {"blank-lines-after-ifdefs", "bacc"},  {"blank-lines-after-declarations", "bad"},  {"blank-lines-after-commas", "bc"},  {"blank-before-sizeof", "bs"},  {"berkeley-style", "orig"},  {"berkeley", "orig"},  {"Bill-Shannon", "bs"},  {"preprocessor-indentation", "ppi"},  {0, 0},};static void usage (void){  fprintf (stderr, _("usage: indent file [-o outfile ] [ options ]\n"));  fprintf (stderr, _("       indent file1 file2 ... fileN [ options ]\n"));  exit (invocation_error);}/* S1 should be a string.  S2 should be a string, perhaps followed by an   argument.  Compare the two, returning true if they are equal, and if they   are equal set *START_PARAM to point to the argument in S2.  */static BOOLEAN eqin (const char *s1, const char *s2, const char **start_param){  BOOLEAN ret = true;  while (*s1)    {      if (*s1++ != *s2++)	{	  ret = false;	}    }  *start_param = s2;  return ret;}/* Set the defaults. */void set_defaults (void){  const pro_ty *p;  for (p = pro; p->p_name; p++)    {      if ((p->p_type == PRO_BOOL && p->p_special == ON)	  || p->p_type == PRO_INT)	{	  *p->p_obj = p->p_default;	}    }}/* Set the defaults after options set */void set_defaults_after (void){  if (!exp_lc)			/* if no -lc option was given */    {      settings.comment_max_col = settings.max_col;    }}/* Strings which can prefix an option, longest first. */static char *option_prefixes[] = {  "--",  "-",  "+",  0};static void arg_missing (const char *option){  fprintf (stderr, _("indent: missing argument to parameter %s\n"), option);  exit (invocation_error);}static int option_prefix (const char *arg){  char **prefixes = option_prefixes;  char *this_prefix = *prefixes;  const char *argp = arg;  int ret = 0;  do    {      this_prefix = *prefixes;      argp = arg;      while (*this_prefix == *argp)	{	  this_prefix++;	  argp++;	}      if (*this_prefix == '\0')	{	  ret = this_prefix - *prefixes;	  break;	}    }  while (*++prefixes);  return ret;}/* Process an option ARG (e.g. "-l60").  PARAM is a possible value * for ARG, if PARAM is nonzero.  EXPLICT should be nonzero iff the * argument is being explicitly specified (as opposed to being taken from a * PRO_SETTINGS group of settings). * * Returns 1 if the option had a value, returns 0 otherwise. * * 2002-06-13 D.Ingamells. Fixed check for int param without an int argument. */int set_option (const char *option, const char *param, int explicit){  const pro_ty *p = pro;  const char *param_start = NULL;  int option_length = option_prefix (option);  int val = 0;  BOOLEAN found = false;  if (option_length > 0)    {      if ((option_length == 1) && (*option == '-'))	{	  /* Short option prefix */	  option++;	  for (p = pro; p->p_name; p++)	    {	      if ((*p->p_name == *option) &&		  eqin (p->p_name, option, &param_start))		{		  found = true;		  break;		}	    }	}      else	{	  /* Long prefix */	  const long_option_conversion_ty *o = option_conversions;	  option += option_length;	  while (o->short_name)	    {	      if (eqin (o->long_name, option, &param_start))		{		  break;		}	      o++;	    }	  /* Searching twice means we don't have to keep the two tables in	   * sync. */	  if (o->short_name)	    {	      for (p = pro; p->p_name; p++)		{		  if (!strcmp (p->p_name, o->short_name))		    {		      found = true;		      break;		    }		}	    }	}    }  if (!found)    {      fprintf (stderr, _("indent: unknown option \"%s\"\n"), option - 1);      exit (invocation_error);    }  else    {      /* If the parameter has been explicitly specified, we don't       * want a group of bundled settings to override the explicit       * setting.  */      if (settings.verbose)	{	  fprintf (stderr, _("option: %s\n"), p->p_name);	}      if (explicit || !*(p->p_explicit))	{	  if (explicit)

⌨️ 快捷键说明

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