网站大量收购独家精品文档,联系QQ:2885784924

indent进行格式化.docx

  1. 1、本文档共5页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
indent进行格式化

用 indent 进行代码格式化1. introduce indent2. Indent参数规范一个范例,胜过前言万语。用 indent 格式化代码,再从格式化前后的格式变化,来学习格式化规范。可以用不同的参数调用 indent,1.?introduce indentWhat is IndentThe `indent program can be used to make code easier to read. It can also convert from one style of writing C to another.DownloadCurrent Version: GNU indent 2.2.7。 Download :?/gnu/indent/indent-2.2.7.tar.gz2.?Indent参数规范我们参照GNU,Kernighan Ritchie,Berkeley风格,制定了自己风格:indent命令参数:-bad -bap -bbb -bbo -nbc -bl -bli0 -bls -c33 -cd33 -ncdb -ncdw -nce -cli0 -cp33 -cs -d0 -nbfda -di2 -nfc1 -nfca -hnl -ip5 -l75 -lp -pcs -nprs -psl -saf -sai -saw -nsc -nsob -nss -i4 -ts4 -utindent配置文件如上参数可写入用户目录下的文件:.,作为运行indent的确省参数。indent配置说明表?1.?Indent代码格式化说明使用的indent参数值含义--blank-lines-after-declarationsbad变量声明后加空行--blank-lines-after-proceduresbap函数结束后加空行--blank-lines-before-block-commentsbbb块注释前加空行--break-before-boolean-operatorbbo较长的行,在逻辑运算符前分行--blank-lines-after-commasnbc变量声明中,逗号分隔的变量不分行--braces-after-if-lineblif和{分做两行--brace-indent 0bli0{不继续缩进--braces-after-struct-decl-linebls定义结构,struct和{分行--comment-indentationnc33语句后注释开始于行33--declaration-comment-columnncd33变量声明后注释开始于行33--comment-delimiters-on-blank-linesncdb不将单行注释变为块注释--cuddle-do-whilencdwdo --- while的while和其前面的}另起一行--cuddle-elsenceelse和其前面的}另起一行--case-indentation 0cli0switch中的case语句所进0个空格--else-endif-columnncp33#else, #endif后面的注释开始于行33--space-after-castcs在类型转换后面加空格--line-comments-indentation nd0单行注释(不从1列开始的),不向左缩进--break-function-decl-argsnbfda关闭:函数的参数一个一行--declaration-indentationndi2变量声明,变量开始于2行,即不必对齐--format-first-column-commentsnfc1不格式化起于第一行的注释--format-all-commentsnfca不开启全部格式化注释的开关--honour-newlineshnlPrefer to break long lines at the position of newlines in the input.--indent-levelni4设置缩进多少字符,如果为tab的整数倍,用tab来缩进,否则用空格填充。--parameter-indentationnip5旧风格的函数定义中参数说明缩进5个空格--line-length 75l75非注释行最长75--continue-at-parentheseslp续行从上一行出现的括号开始--space-after-procedure-callspcs函数和(之间插入一个空格--space-after-parenthesesnprs在(后)前不插入空格--procnames-start-linespsl将函数名和返回类型放在两行定义--space-after-forsaffor后面有空格--space-a

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档