diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-21 12:55:09 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-21 13:54:42 -0700 |
commit | 9838b7032ea9792bec21af424c53c07078636d21 (patch) | |
tree | b72d0827dac50f0f3b8eab29b3b7639546d735d7 /hw/dmx/examples/xbell.c | |
parent | 75199129c603fc8567185ac31866c9518193cb78 (diff) |
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:
-bap
-psl
-T PrivatePtr
-T pmWait
-T _XFUNCPROTOBEGIN
-T _XFUNCPROTOEND
-T _X_EXPORT
The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.
The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.
The comparison was done with this script:
dir1=$1
dir2=$2
for dir in $dir1 $dir2; do
(cd $dir && find . -name '*.o' | while read file; do
dir=`dirname $file`
base=`basename $file .o`
dump=$dir/$base.dump
objdump -d $file > $dump
done)
done
find $dir1 -name '*.dump' | while read dump; do
otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
diff -u $dump $otherdump
done
Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'hw/dmx/examples/xbell.c')
-rw-r--r-- | hw/dmx/examples/xbell.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/hw/dmx/examples/xbell.c b/hw/dmx/examples/xbell.c index 79419d324..543db24bf 100644 --- a/hw/dmx/examples/xbell.c +++ b/hw/dmx/examples/xbell.c @@ -35,27 +35,29 @@ #include <stdlib.h> #include <X11/Xlib.h> -static void pkc(XKeyboardControl *kc, unsigned long vm) +static void +pkc(XKeyboardControl * kc, unsigned long vm) { - if (vm&KBKeyClickPercent) + if (vm & KBKeyClickPercent) printf(" key_click_percent = %d\n", kc->key_click_percent); - if (vm&KBBellPercent) + if (vm & KBBellPercent) printf(" bell_percent = %d\n", kc->bell_percent); - if (vm&KBBellPitch) + if (vm & KBBellPitch) printf(" bell_pitch = %d\n", kc->bell_pitch); - if (vm&KBBellDuration) + if (vm & KBBellDuration) printf(" bell_duration = %d\n", kc->bell_duration); - if (vm&KBLed) + if (vm & KBLed) printf(" led = 0x%x\n", kc->led); - if (vm&KBLedMode) + if (vm & KBLedMode) printf(" led_mode = %d\n", kc->led_mode); - if (vm&KBKey) + if (vm & KBKey) printf(" key = %d\n", kc->key); - if (vm&KBAutoRepeatMode) + if (vm & KBAutoRepeatMode) printf(" auto_repeat_mode = %d\n", kc->auto_repeat_mode); } -static void pks(XKeyboardState *ks) +static void +pks(XKeyboardState * ks) { printf(" key_click_percent = %d\n", ks->key_click_percent); printf(" bell_percent = %d\n", ks->bell_percent); @@ -65,24 +67,23 @@ static void pks(XKeyboardState *ks) printf(" global_auto_repeat = %d\n", ks->global_auto_repeat); } -int main(int argc, char **argv) +int +main(int argc, char **argv) { - Display *display = XOpenDisplay(NULL); + Display *display = XOpenDisplay(NULL); XKeyboardControl kc; - XKeyboardState ks; - unsigned long vm; + XKeyboardState ks; + unsigned long vm; if (argc != 5) { printf("Usage: xbell percent baseVolume pitch duration\n"); return 1; } - - vm = (KBBellPercent - | KBBellPitch - | KBBellDuration); + + vm = (KBBellPercent | KBBellPitch | KBBellDuration); kc.key_click_percent = atoi(argv[1]); - kc.bell_percent = atoi(argv[2]); - kc.bell_pitch = atoi(argv[3]); + kc.bell_percent = atoi(argv[2]); + kc.bell_pitch = atoi(argv[3]); kc.bell_duration = atoi(argv[4]); printf("Setting:\n"); @@ -92,9 +93,9 @@ int main(int argc, char **argv) printf("Have:\n"); XGetKeyboardControl(display, &ks); pks(&ks); - + XBell(display, 100); - + XCloseDisplay(display); return 0; } |