VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/drm/indent.sed@ 68760

Last change on this file since 68760 was 68308, checked in by vboxsync, 7 years ago

Additions/Linux: reindent the kernel module source files in Additions installer.

bugref:8524: Additions/linux: play nicely with distribution-installed Additions
In order to reduce the delta between in-kernel and our kernel modules, run
the source files through a sed script to convert them to kernel indentation
style when we copy them from our tree to the Additions archive. Now using
sed instead of indent as it avoids new tools and also allows for adding
further changes in the script.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1# Oracle VM VirtualBox
2# VirtualBox to Linux kernel coding style conversion script.
3
4#
5# Copyright (C) 2017 Oracle Corporation
6#
7# This file is part of VirtualBox Open Source Edition (OSE), as
8# available from http://www.virtualbox.org. This file is free software;
9# you can redistribute it and/or modify it under the terms of the GNU
10# General Public License (GPL) as published by the Free Software
11# Foundation, in version 2 as it comes in the "COPYING" file of the
12# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14#
15
16# This script is for converting code inside the vboxvideo module to Linux
17# kernel coding style. It assumes correct VirtualBox coding style, will break
18# break if the coding style is wrong (e.g. tab instead of spaces) and is not
19# indended to be a generic solution: for example, identifiers will be
20# translated case by case, not algorithmically. It also assumes that any
21# flexibility in either coding style will be used where possible to make the
22# code conform to both at once.
23
24# Replace up to six leading groups of four spaces with tabs.
25s/^ /\t\t\t\t\t\t/g
26s/^ /\t\t\t\t\t/g
27s/^ /\t\t\t\t/g
28s/^ /\t\t\t/g
29s/^ /\t\t/g
30s/^ /\t/g
31# Remove any spaces left after the tabs. This also limits maximum indentation.
32s/^\(\t\t*\) */\1/g
33# And move braces. This must be the last expression as it jumps to the next
34# line.
35/..*$/ {
36 N
37 s/^\([\t ][\t ]*\)} *\n[\t ]*else/\1} else/g
38 t continue_else
39 b try_brace
40:continue_else
41 N
42:try_brace
43 s/^\([\t ].*\)\n[\t ][\t ]*{/\1 {/g
44 t done_brace
45 P
46 D
47:done_brace
48 p
49 d
50}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette