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

📄 indent.h

📁 代码格式化工具。 其实就是linux下indent的windows版本。
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Copyright (c) 1999 Carlo Wood.  All rights reserved. * Copyright (c) 1994 Joseph Arceneaux.  All rights reserved. * Copyright (c) 1992 Free Software Foundation, Inc.  All rights reserved. * * Copyright (c) 1985 Sun Microsystems, Inc. Copyright (c) 1980 The Regents * of the University of California. Copyright (c) 1976 Board of Trustees of * the University of Illinois. All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that * the above copyright notice and this paragraph are duplicated in all such * forms and that any documentation, advertising materials, and other * materials related to such distribution and use acknowledge that the * software was developed by the University of California, Berkeley, the * University of Illinois, Urbana, and Sun Microsystems, Inc.  The name of * either University or Sun Microsystems may not be used to endorse or * promote products derived from this software without specific prior written * permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES * OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * 2002-11-10 Cristalle Azundris Sabon <cristalle@azundris.com> *            Added --preprocessor-indentation (ppi)   if set, will indent nested *            preprocessor-statements with n spaces per level.  overrides -lps. */#ifndef INDENT_INDENT_H#define INDENT_INDENT_H#include "sys.h"RCSTAG_H (indent, "$Id: indent.h,v 1.37 2002/11/10 21:02:48 david Exp $");#include "config.h"#include "libgettext.h"#ifdef ENABLE_NLS#define _(X) gettext(X)#else#define _(X) X#endif#include "lexi.h"#include "io.h"#include "memfile.h"/* Values that `indent' can return for exit status. * *  `total_success' means no errors or warnings were found during a successful *    invocation of the program. * *  `invocation_error' is returned if an invocation problem (like an incorrect *    option) prevents any formatting to occur. * *  `indent_error' is returned if errors occur during formatting which *    do not prevent completion of the formatting, but which appear to be *    manifested by incorrect code (i.e, code which wouldn't compile). * *  `indent_punt' is returned if formatting of a file is halted because of *    an error with the file which prevents completion of formatting.  If more *    than one input file was specified, indent continues to the next file. * *  `indent_fatal' is returned if a serious internal problem occurs and *    the entire indent process is terminated, even if all specified files *    have not been processed. */typedef enum exit_values{  total_success = 0,  invocation_error = 1,  indent_error = 2,  indent_punt = 3,  indent_fatal = 4,  system_error = 5} exit_values_ty;typedef unsigned char BOOLEAN;#define false 0#define true  1#define DEFAULT_RIGHT_MARGIN 78#define DEFAULT_RIGHT_COMMENT_MARGIN 78/* Name of input file.  */extern char *in_name;extern char *in_prog;           /* pointer to the null-terminated input                                   program *//* Point to the position in the input program which we are currently looking   at.  */extern char *in_prog_pos;/* Point to the start of the current line.  */extern char *cur_line;/* Size of the input program, not including the ' \n\0' we add at the end */extern unsigned long in_prog_size;/* The output file. */extern MEMFILE *output;extern char *labbuf;            /* buffer for label */extern char *s_lab;             /* start ... */extern char *e_lab;             /* .. and end of stored label */extern char *l_lab;             /* limit of label buffer */extern char *codebuf;           /* buffer for code section */extern char *s_code;            /* start ... */extern char *s_code_corresponds_to;     /* If set, start of corresponding                                           code in token buffer... */extern char *e_code;            /* .. and end of stored code */extern char *l_code;            /* limit of code section */extern char *combuf;            /* buffer for comments */extern char *s_com;             /* start ... */extern char *e_com;             /* ... and end of stored comments */extern char *l_com;             /* limit of comment buffer */extern char *buf_ptr;           /* ptr to next character to be taken from                                   in_buffer */extern char *buf_end;           /* ptr to first after last char in in_buffer */extern int break_line;          /* Whether or not we should break the line. *//* pointer to the token that lexi() has just found */extern char *token;/* points to the first char after the end of token */extern char *token_end;extern int squest;extern file_buffer_ty *current_input;/* Used to keep track of buffers.  */typedef struct buf{  char *ptr;                    /* points to the start of the buffer */  char *end;                    /* points to the character beyond the last                                   one (e.g. is equal to ptr if the buffer is                                   empty).  */  int size;                     /* how many chars are currently allocated.  */  int len;                      /* how many chars we're actually using. */  int start_column;             /* corresponding column of first character                                   in the buffer. */  int column;                   /* Column we were in when we switched buffers. */} buf_ty;/* Buffer in which to save a comment which occurs between an if(), while(), * etc., and the statement following it.  Note: the fact that we point into * this buffer, and that we might realloc() it (via the need_chars macro) is * a bad thing (since when the buffer is realloc'd its address might change, * making any pointers into it point to garbage), but since the filling of * the buffer (hence the need_chars) and the using of the buffer (where * buf_ptr points into it) occur at different times, we can get away with it * (it would not be trivial to fix).  */extern buf_ty save_com;extern char *bp_save;           /* saved value of buf_ptr when taking input                                   from save_com */extern char *be_save;           /* similarly saved value of buf_end */extern int pointer_as_binop;extern int n_real_blanklines;extern int prefix_blankline_requested;extern codes_ty prefix_blankline_requested_code;      /* The code that caused                                                           the blank line to be                                                           requested */extern int postfix_blankline_requested;extern codes_ty postfix_blankline_requested_code;     /* The code that caused                                                         * the blank line to be                                                         * requested */extern int break_comma;         /* when true and not in parens, break after a                                 * comma *//* * This structure stores all the user options that come from (e.g.) * command line flags. */typedef struct user_options_st{    int verbose;			/*显示详细出错信息*/			/* when true, non-essential error messages are printed */    int use_tabs;			/*使用tab*/						/* does indent convert tabs to spaces or not */    int tabsize;			/*tab长度*/						/* The number of columns a tab character generates. */    int use_stdout;			/*TRUE*/							/* Where does output go. */    int space_sp_semicolon; /*if while for 和后面的(之间 有没有空格*/							/* If true, a space is inserted between if, while, or for, and a semicolon																					* for example while (*p++ == ' ') ; */    int swallow_optional_blanklines;/*是否删除无效空行*/    int star_comment_cont;			/*是否注释已星号开始*/					/* true if comment continuation lines should have stars at the beginning of each line. */    int struct_brace_indent;		/*struct union enum后{的缩进量*/		/* Indentation level to be used for a '{' directly following a struct, union or enum */    int space_after_while;			/*是否有while后的空格*/					/* Put a space after `while' */    int space_after_if;				/*是否有if否的空格*/					/* Put a space after `if' */    int space_after_for;			/*是否有for后的空格*/					/* Put a space after `for' */    int procnames_start_line;		/*是否在函数名之前另起一行(返回类型之后)*/	/* if true, the names of procedures being  defined get placed in column 1 (ie. a																				* newline is placed between the type of the procedure and its name) */    int parentheses_space;   /*是否括号内有空格,ie. ( foo ) */				/* If true, parentheses will look like: ( foo ) rather than (foo) */    int preserve_mtime;      /*FALSE*/										/* True when the modification time of the files should  be preserved. */    int paren_indent;		/*???每个括号的缩进量 ???*/					/* set to the indentation per open parens */    int proc_calls_space;    /*是否函数调用后有空格,ie. fun (param)	*/		/* If true, procedure calls look like: foo (bar) rather than foo(bar) */    int leave_preproc_space; /*是否与处理命令后有空格*/							/* if true, leave the spaces between  '#' and preprocessor commands. */    int force_preproc_width; /*预处理的缩进量*/									/* if this is >0, this becomes the preproc indent-level */    int lineup_to_parens;    /*是否 换行的代码与左括号对齐*/					/* if true, continued code within parens will be lined up to the open paren */    int honour_newlines;     /*??是否对新行高优先???*/						/* True when positions at which we read a newline in the input file, should get																				 * a high priority to break long lines at. */    int format_comments;	 /*是否所有的注释要格式化*/							 /* If any comments are to be reformatted */    int format_col1_comments;/*是否注释在第一列开始要格式化*/					 /* If comments which start in column 1 are to be magically reformatted */    int extra_expression_indent;/*是否在if(e) while(e) for(e;e;e)中的e换行要缩进*/		/* True if continuation lines from the expression part of "if(e)",																						* "while(e)", "for(e;e;e)" should be indented an extra tab stop so that																						* they don't conflict with the code that follows */    int ljust_decl;          /*是否声明左对齐*/											/* true if declarations should be left justified */    int cast_space;          /*是否类型转换后有空格*/									/* If true, casts look like: (char *) bar rather than (char *)bar */

⌨️ 快捷键说明

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