summaryrefslogtreecommitdiff
path: root/doc/spice_indent
blob: f582bc8bda30f18f4ae36a0f7437d72672651f4e (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
#
#   spice_indent
#       This utility was used by Jeremy White to attempt to make the
#   x11spice code largely conform to the Spice Project Coding Style.
#   It's preserved here as a form of documentation.

# Note: Spice is now relaxed about function declarations,
#       and allow either style, e.g.
#  char *func()  or
#
#  char *
#  func()
#   That requires calling indent with some thoughtfulness
# By default, it will break procedure types onto newlines
#   which is not always the desired behavior
# Add  --dont-break-procedure-type  to change that


if [ $# -lt 1 ] ; then
    echo Error: specify at least one file to process with indent
    echo Usage:
    echo '  spice_indent [ extra-options ] <filename> [ filename... ]'
    echo 'A useful option is --dont-break-procedure-type'
    exit 1
fi

# Run the indent command with no version control; we're using git after all...
VERSION_CONTROL=none \
indent \
  --no-space-after-function-call-names \
  --braces-after-func-def-line \
  --braces-on-if-line \
  --braces-on-struct-decl-line \
  --line-length 100 \
  --no-space-after-parentheses \
  --no-tabs \
  --case-indentation 0 \
  --tab-size 4\
  --indent-label 0\
  --indent-level 4\
  --declaration-indentation 1 \
  --space-after-for \
  --space-after-while \
  --space-after-casts \
  --space-after-if \
  --cuddle-else \
  -cd0 \
  -c0 \
  -T agent_t \
  -T SpiceCharDeviceInstance \
  -T SpiceChannelEventInfo \
  -T QXLInstance \
  -T QXLWorker \
  -T QXLDevInitInfo \
  -T VDAgentMonitorsConfig \
  -T SpiceTimer \
  -T SpiceKbdInstance \
  -T SpiceTabletInstance \
  -T SpiceWatch \
  -T GIOChannel \
  -T spice_t \
  -T options_t \
  -T uint8_t  \
  -T uint16_t  \
  -T uint32_t  \
  -T scan_type_t \
  -T scan_report_t \
  -T scanner_t \
  -T session_t \
  -T shm_image_t \
  -T spice_release_t \
  -T xcb_connection_t \
  -T xcb_xfixes_cursor_notify_event_t \
  -T xcb_damage_notify_event_t \
  -T xcb_damage_notify_event_t \
  -T xcb_configure_notify_event_t \
  -T xcb_screen_t \
  -T display_t \
  -T gui_t  \
  -T GKeyFile \
  -T gchar \
  -T xdummy_t \
  -T x11spice_server_t \
  -T test_t \
  -T Bool \
  -T shm_segment_t \
  -T GtkWidget \
  -T ssl_options_t \
  -T GAsyncQueue \
  "$@"