summaryrefslogtreecommitdiff
path: root/libcroco-indent
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@gnome.org>2004-03-07 13:22:49 +0000
committerDodji Seketeli <dodji@src.gnome.org>2004-03-07 13:22:49 +0000
commit94f1a410a3d257124c3131b41ccaa883ccabb9c3 (patch)
treea5ba5d6805fb556194553df761754b640e600d2b /libcroco-indent
parent9e1a6d35382841cbbaaca9779fe21c3123cc367f (diff)
downloadlibcroco-94f1a410a3d257124c3131b41ccaa883ccabb9c3.tar.gz
re-indented the source files to make'em comply with gnome indentation
2004-03-07 Dodji Seketeli <dodji@gnome.org> * src/*.c: re-indented the source files to make'em comply with gnome indentation rules. * libcroco-indent: added this indentation script.
Diffstat (limited to 'libcroco-indent')
-rwxr-xr-xlibcroco-indent102
1 files changed, 102 insertions, 0 deletions
diff --git a/libcroco-indent b/libcroco-indent
new file mode 100755
index 0000000..c6477ab
--- /dev/null
+++ b/libcroco-indent
@@ -0,0 +1,102 @@
+#!/bin/sh
+#This is just a smallish indent script to indent mlview
+#to indent all the sources correctly (before commiting for ex),
+#type:
+#./indent-mlview src/*.[ch]
+
+#Here go some explanations of the indent options:
+#
+#-bad: forces a blank line after every block of declaration
+#=============================================================
+#-bap: forces a blank line after every procedure body
+#=============================================================
+#-bbb: forces a blank line before every boxed comment.
+#=============================================================
+#-sob: forces indent to swallow every optional blank line.
+#=============================================================
+#-bl -bli2 formats braces like this:
+#if (x > 2)
+# {
+# x-- ;
+# }
+#=============================================================
+#-nce formats the "else" not to cudle up to the
+#immediately preceding }:
+#if (x > 2)
+# {
+# x-- ;
+# }
+#else
+# {
+# x++ ;
+# }
+#==============================
+#-ce is the contrary of -nce
+#=============================================================
+#-ss: put a space before a semi colon that is at the same line as a
+#for.
+#=============================================================
+#-pcs: puts a space between the name of a procedure being called
+#and the '('.
+#=============================================================
+#-bs: puts a space between the sizeof operator and its argument.
+#=============================================================
+#-saf: puts a space between a for an the following parenthesis.
+#=============================================================
+#-sai: puts a space between an if and its arguments
+#=============================================================
+#-saw: puts a space between a while and its arguments
+#=============================================================
+#-psl: causes the type of a procedure being defined to be placed
+#on the line before the name of the procedure.
+#=============================================================
+#-bls: formats braces in struct declarations like this:
+#struct foo
+#{
+# int x;
+#};
+#-brs: formats braces in struct decls like this:
+#struct foo {
+# int x;
+#};
+#=============================================================
+#-bc: forces a newline after each comma in a declaration.
+#=============================================================
+#-i2: puts indentation at 2 blank chars.
+#=============================================================
+#-lp:
+#without -lp the code looks like this:
+#p1 = first_procedure (second_procedure (p2, p3),
+# third_procedure (p4, p5));
+#with -lp the code looks like this:
+#p1 = first_procedure (second_procedure (p2, p3),
+# third_procedure (p4, p5));
+#=============================================================
+#-ppi2: indents preprocessor directives using 2 spaces.
+#=============================================================
+#=============================================================
+#-ts2:set tabs spaces to 2 blank chars.
+#=============================================================
+#-l60 == --line-length60
+#=============================================================
+#-bbo: break long lines before boolean operators when found.
+#=============================================================
+
+INDENT=`which indent`
+GREP=`which grep`
+if test x$INDENT = x ; then
+ echo "Argh !!! Could not find indent in your PATH. Exited."
+ exit -1
+ if test x$GREP = x ; then
+ echo "Argh!!! Could not find grep in you PATH. Exited."
+ exit -1 ;
+ fi
+ is_gnu=`$INDENT -version | $GREP gnu`
+ if test x$is_gnu = x ; then
+ echo "Found a indent that is not the GNU one. Exited."
+ exit -1 ;
+ fi
+fi
+
+exec $INDENT -bad -bap -nbbb -br -ce -ss -pcs -bs -saf -sai \
+-cdw -saw -psl -brs -bc -i8 -ppi0 -lp -ts0 -bbo -sob $@