Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
1f735c32
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1f735c32
编写于
11月 15, 2007
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add blank lines to pgindent.
上级
591b9b09
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
2 deletion
+22
-2
src/tools/pgindent/pgindent
src/tools/pgindent/pgindent
+22
-2
未找到文件。
src/tools/pgindent/pgindent
浏览文件 @
1f735c32
#!/bin/sh
# $PostgreSQL: pgsql/src/tools/pgindent/pgindent,v 1.9
0 2006/12/27 23:03:52
momjian Exp $
# $PostgreSQL: pgsql/src/tools/pgindent/pgindent,v 1.9
1 2007/11/15 21:52:39
momjian Exp $
# Known bugs:
#
...
...
@@ -47,6 +47,7 @@ do
sed
's;\([} ]\)else[ ]*\(/\*.*[^\*][^/]\)$;\1else\
\2;g'
|
detab
-t4
-qc
|
# work around bug where function that defines no local variables misindents
# switch() case lines and line after #else. Do not do for struct/enum.
awk
' BEGIN {line1 = ""; line2 = ""}
...
...
@@ -69,6 +70,7 @@ do
if (NR >= 1)
print line1;
}'
|
# prevent indenting of code in 'extern "C"' blocks
awk
' BEGIN {line1 = ""; line2 = ""; skips = 0}
{
...
...
@@ -103,8 +105,10 @@ do
if (NR >= 1 && skips <= 1)
print line1;
}'
|
# protect backslashes in DATA()
sed
's;^DATA(.*$;/*&*/;'
|
# protect wrapping in CATALOG()
sed
's;^CATALOG(.*$;/*&*/;'
>
/tmp/
$$
a
...
...
@@ -1878,30 +1882,37 @@ do
-Tz_stream
\
-Tz_streamp
\
/tmp/
$$
a
>
/tmp/
$$
2>&1
if
[
"
$?
"
-ne
0
-o
-s
/tmp/
$$
]
then
echo
echo
"
$FILE
"
cat
/tmp/
$$
fi
cat
/tmp/
$$
a |
# restore DATA/CATALOG lines
sed
's;^/\*\(DATA(.*\)\*/$;\1;'
|
sed
's;^/\*\(CATALOG(.*\)\*/$;\1;'
|
# remove tabs and retab with four spaces
detab
-t8
-qc
|
entab
-t4
-qc
|
sed
's;^/\* Open extern \"C\" \*/$;{;'
|
sed
's;^/\* Close extern \"C\" \*/$;};'
|
sed
's;/\*---X_X;/* ---;g'
|
# workaround indent bug for 'static'
sed
's;^static[ ][ ]*;static ;g'
|
# remove too much indenting after closing brace
sed
's;^} [ ]*;} ;'
|
# indent single-line after-'else' comment by only one tab
sed
's;\([} ]\)else[ ]*\(/\*.*\*/\)[ ]*$;\1else \2;g'
|
# pull in #endif comments
sed
's;^#endif[ ][ ]*/\*;#endif /*;'
|
# work around #else indenting next line if #ifdef defines variables at top
# work around misindenting of function with no variables defined
awk
'
{
...
...
@@ -1912,10 +1923,13 @@ do
}
else print $0;
}'
|
# add space after comments that start on tab stops
sed
's;\([^ ]\)\(/\*.*\*/\)$;\1 \2;'
|
# move trailing * in function return type
sed
's;^\([A-Za-z_][^ ]*\)[ ][ ]*\*$;\1 *;'
|
# remove un-needed braces around single statements
# Do not use because it uglifies PG_TRY/PG_CATCH blocks and probably
# isn't needed for general use.
...
...
@@ -1945,6 +1959,7 @@ do
# if (NR >= 1 && skips <= 2)
# print line2;
# }' |
# remove blank line between opening brace and block comment
awk
'
{
...
...
@@ -1973,6 +1988,7 @@ do
if (NR >= 1 && skips <= 2)
print line2;
}'
|
# remove trailing blank lines, helps with adding blank before trailing #endif
awk
' BEGIN {blank_lines = 0;}
{
...
...
@@ -1986,6 +2002,7 @@ do
print line1;
}
}'
|
# remove blank line before #else, #elif, and #endif
awk
' BEGIN {line1 = ""; line2 = ""; skips = 0}
{
...
...
@@ -2010,6 +2027,7 @@ do
if (NR >= 1 && skips <= 1)
print line1;
}'
|
# add blank line before #endif if it is the last line in the file
awk
' BEGIN {line1 = ""; line2 = ""}
{
...
...
@@ -2023,6 +2041,7 @@ do
printf "\n";
print line1;
}'
|
# Move prototype names to the same line as return type. Useful for ctags.
# Indent should do this, but it does not. It formats prototypes just
# like real functions.
...
...
@@ -2066,6 +2085,7 @@ do
}
else print $0;
}'
|
# fix indenting of typedef caused by __cplusplus in libpq-fe.h
(
if
echo
"
$FILE
"
|
grep
-q
'libpq-fe.h$'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录