1 | # $Id: errmsg.sed 47443 2013-07-28 16:58:01Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # IPRT - SED script for converting */err.h.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2011 Oracle Corporation
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 | # The contents of this file may alternatively be used under the terms
|
---|
18 | # of the Common Development and Distribution License Version 1.0
|
---|
19 | # (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | # VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | # CDDL are applicable instead of those of the GPL.
|
---|
22 | #
|
---|
23 | # You may elect to license modified versions of this file under the
|
---|
24 | # terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | #
|
---|
26 |
|
---|
27 | # Handle text inside the markers.
|
---|
28 | /SED-START/,/SED-END/{
|
---|
29 |
|
---|
30 | # if (#define) goto defines
|
---|
31 | /^[[:space:]]*#[[:space:]]*define/b defines
|
---|
32 |
|
---|
33 | # if (/**) goto description
|
---|
34 | /\/\*\*/b description
|
---|
35 |
|
---|
36 | }
|
---|
37 |
|
---|
38 | # Everything else is deleted!
|
---|
39 | d
|
---|
40 | b end
|
---|
41 |
|
---|
42 |
|
---|
43 | ##
|
---|
44 | # Convert the defines
|
---|
45 | :defines
|
---|
46 | s/^[[:space:]]*#[[:space:]]*define[[:space:]]*\([[:alnum:]_]*\)[[:space:]]*\(.*\)[[:space:]]*$/ "\1",\n \1 }, /
|
---|
47 | b end
|
---|
48 |
|
---|
49 | ##
|
---|
50 | # Convert descriptive comments. /** desc */
|
---|
51 | :description
|
---|
52 |
|
---|
53 | # Read all the lines belonging to the comment into the buffer.
|
---|
54 | :look-for-end-of-comment
|
---|
55 | /\*\//bend-of-comment
|
---|
56 | N
|
---|
57 | blook-for-end-of-comment
|
---|
58 | :end-of-comment
|
---|
59 |
|
---|
60 | # anything with @{ and @} is skipped
|
---|
61 | /@[\{\}]/d
|
---|
62 |
|
---|
63 | # Fix double spaces
|
---|
64 | s/[[:space:]][[:space:]]/ /g
|
---|
65 |
|
---|
66 | # Fix \# sequences (doxygen needs them, we don't).
|
---|
67 | s/\\#/#/g
|
---|
68 |
|
---|
69 | # insert punctuation.
|
---|
70 | s/\([^.[:space:]]\)[[:space:]]*\*\//\1. \*\//
|
---|
71 |
|
---|
72 | # convert /** short. more
|
---|
73 | s/[[:space:]]*\/\*\*[[:space:]]*/ { NULL, \"/
|
---|
74 | s/ { NULL, \"\([^.!?"]*[.!?][.!?]*\)/ { \"\1\",\n \"\1/
|
---|
75 |
|
---|
76 | # terminate the string
|
---|
77 | s/[[:space:]]*\*\//\"\,/
|
---|
78 |
|
---|
79 | # translate empty lines into new-lines (only one, please).
|
---|
80 | s/[[:space:]]*[[:space:]]\*[[:space:]][[:space:]]*\*[[:space:]][[:space:]]*/\\n/g
|
---|
81 |
|
---|
82 | # remove asterics.
|
---|
83 | s/[[:space:]]*[[:space:]]\*[[:space:]][[:space:]]*/ /g
|
---|
84 | b end
|
---|
85 |
|
---|
86 |
|
---|
87 | # next expression
|
---|
88 | :end
|
---|