File: refmt.sh

package info (click to toggle)
simulavr 0.1.2.2-6.1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 2,756 kB
  • ctags: 3,179
  • sloc: ansic: 19,987; sh: 3,623; python: 3,528; makefile: 406; asm: 308; yacc: 145; lex: 48
file content (56 lines) | stat: -rwxr-xr-x 1,591 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /bin/bash
#
# $Id: refmt.sh,v 1.5 2003/12/01 05:48:34 troth Exp $
#
# Please use this script to indent your C code before submitting patches.
#

set -x

OPTS="\
--no-tabs \
--no-blank-lines-after-declarations \
--blank-lines-after-procedures \
--no-blank-lines-after-commas \
--break-before-boolean-operator \
--braces-after-if-line \
--brace-indent0 \
--braces-after-struct-decl-line \
--no-comment-delimiters-on-blank-lines \
--dont-cuddle-else \
--else-endif-column1 \
--declaration-indentation2 \
--dont-format-first-column-comments \
--dont-format-comments \
--indent-level4 \
--parameter-indentation5 \
--continue-at-parentheses \
--space-after-procedure-calls \
--no-space-after-parentheses \
--procnames-start-lines \
--space-after-for \
--space-after-if \
--space-after-while \
--dont-star-comments \
--swallow-optional-blank-lines \
--no-space-after-casts \
--case-indentation4 \
--ignore-newlines \
--tab-size1 \
"

if [ "x${STATIC_TYPES}" != "x" ]
then
  TYPES="-T AvrClass -T BreakPt -T Irq -T AvrCore -T CallBack -T DevSuppDefn \
  -T EEProm -T Flash -T GdbComm_T -T IntVect -T IntVectTable -T Memory \
  -T Port -T PortA -T PortB -T PortC -T PortD -T PortE -T PortF -T SREG \
  -T GPWR -T ACSR -T MCUCR -T WDTCR -T RAMPZ -T SPIIntr_T -T SPI_T -T SRAM \
  -T StackPointer -T Stack -T HWStack -T MemStack -T Storage -T TimerIntr_T \
  -T Timer0_T -T OCReg16Def -T OCReg16_T -T Timer16Def -T Timer16_T -T DList \
  -T VDevice"
else
  # This is the default case.
  TYPES=$(grep typedef *.[ch] | awk '/struct/ {print "-T " $NF}' | sed 's/;//')
fi

indent -v ${OPTS} ${TYPES} $@