VirtualBox

source: vbox/trunk/include/VBox/various.sed@ 69181

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

include/VBox/: A couple of license adjustments and other scm cleanups.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1# $Id: various.sed 69181 2017-10-23 18:13:56Z vboxsync $
2## @file
3# Converts some C header elements into nasm/yasm syntax.
4#
5# This is used by 'incs' in /Maintenance.kmk (/Makefile.kmk).
6#
7
8#
9# Copyright (C) 2006-2017 Oracle Corporation
10#
11# This file is part of VirtualBox Open Source Edition (OSE), as
12# available from http://www.virtualbox.org. This file is free software;
13# you can redistribute it and/or modify it under the terms of the GNU
14# General Public License (GPL) as published by the Free Software
15# Foundation, in version 2 as it comes in the "COPYING" file of the
16# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18#
19# The contents of this file may alternatively be used under the terms
20# of the Common Development and Distribution License Version 1.0
21# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
22# VirtualBox OSE distribution, in which case the provisions of the
23# CDDL are applicable instead of those of the GPL.
24#
25# You may elect to license modified versions of this file under the
26# terms and conditions of either the GPL or the CDDL or both.
27#
28
29
30# Check for markers (typically in comments).
31/ASM-INC/basm-inc
32/ASM-NOINC/basm-noinc
33
34# Newline escapes.
35:check-newline-escape
36/\\$/!bno-more-newline-escapes
37N
38b check-newline-escape
39:no-more-newline-escapes
40
41# Strip comments and trailing space.
42s/[[:space:]][[:space:]]*\/\*.*$//g
43s/[[:space:]][[:space:]]*\/\/.*$//g
44s/[[:space:]][[:space:]]*$//g
45
46# Try identify the statement.
47/#[[:space:]]*define[[:space:]]/bdefine
48/#[[:space:]]*ifdef[[:space:]]/bifdef
49/#[[:space:]]*ifndef[[:space:]]/bifndef
50/#[[:space:]]*if[[:space:]]/bif
51/#[[:space:]]*elif[[:space:]]/belif
52/#[[:space:]]*else$/belse
53/#[[:space:]]*endif$/bendif
54
55# Not recognized, drop it.
56:asm-noinc
57d
58b end
59
60#
61# Defines needs some extra massaging to work in yasm.
62# Things like trailing type indicators ('U', 'ULL' ++) does not go down well.
63#
64:define
65/\$/d
66s/#\([[:space:]]*\)define/\1%define/
67
68s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)U$/\1/
69s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)U\([[:space:]]*\))$/\1\2)/
70s/\([[:space:]][0-9][0-9]*\)U[[:space:]]*$/\1/
71s/\([[:space:]][0-9][0-9]*\)U\([[:space:]]*\))$/\1\2)/
72
73s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)UL$/\1/
74s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)UL\([[:space:]]*\))$/\1\2)/
75s/\([[:space:]][0-9][0-9]*\)UL[[:space:]]*$/\1/
76s/\([[:space:]][0-9][0-9]*\)UL\([[:space:]]*\))$/\1\2)/
77
78s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)ULL$/\1/
79s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)ULL\([[:space:]]*\))$/\1\2)/
80s/\([[:space:]][0-9][0-9]*\)ULL[[:space:]]*$/\1/
81s/\([[:space:]][0-9][0-9]*\)ULL\([[:space:]]*\))$/\1\2)/
82
83s/UINT64_C([[:space:]]*\(0[xX][0-9a-fA-F][0-9a-fA-F]*\)[[:space:]]*)/\1/
84s/UINT64_C([[:space:]]*\([0-9][0-9]*\)[[:space:]]*)/\1/
85s/UINT32_C([[:space:]]*\(0[xX][0-9a-fA-F][0-9a-fA-F]*\)[[:space:]]*)/\1/
86s/UINT32_C([[:space:]]*\([0-9][0-9]*\)[[:space:]]*)/\1/
87s/UINT16_C([[:space:]]*\(0[xX][0-9a-fA-F][0-9a-fA-F]*\)[[:space:]]*)/\1/
88s/UINT16_C([[:space:]]*\([0-9][0-9]*\)[[:space:]]*)/\1/
89s/UINT8_C([[:space:]]*\(0[xX][0-9a-fA-F][0-9a-fA-F]*\)[[:space:]]*)/\1/
90s/UINT8_C([[:space:]]*\([0-9][0-9]*\)[[:space:]]*)/\1/
91
92b end
93
94#
95# Conditional statements, 1:1.
96#
97:ifdef
98s/#\([[:space:]]*\)ifdef/\1%ifdef/
99b end
100
101:ifndef
102s/#\([[:space:]]*\)ifndef/\1%ifndef/
103b end
104
105:if
106s/#\([[:space:]]*\)if/\1%if/
107b end
108
109:elif
110s/#\([[:space:]]*\)elif/\1%elif/
111b end
112
113:else
114s/#\([[:space:]]*\)else.*$/\1%else/
115b end
116
117:endif
118s/#\([[:space:]]*\)endif.*$/\1%endif/
119b end
120
121#
122# Assembly statement... may need adjusting when used.
123#
124:asm-inc
125b end
126
127:end
128
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