VirtualBox

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

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

Regenerated assmebly includes (kmk -f Maintenance.kmk incs) passing thru the file and copyright header, marking them as autogenerated and not for edit.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1# $Id: various.sed 69202 2017-10-24 11:57:59Z 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# Pass thru the file header and copyright.
301,/^\#ifndef/{
31/^\#ifndef/b next
32s/^[/ ]//
33s/^\*\//;/
34s/\*/;/g
354s/^.*$/; Automatically generated by various.sed. DO NOT EDIT!/
36b end
37}
38:next
39
40# Check for markers (typically in comments).
41/ASM-INC/basm-inc
42/ASM-NOINC/basm-noinc
43
44# Newline escapes.
45:check-newline-escape
46/\\$/!bno-more-newline-escapes
47N
48b check-newline-escape
49:no-more-newline-escapes
50
51# Strip comments and trailing space.
52s/[[:space:]][[:space:]]*\/\*.*$//g
53s/[[:space:]][[:space:]]*\/\/.*$//g
54s/[[:space:]][[:space:]]*$//g
55
56# Try identify the statement.
57/#[[:space:]]*define[[:space:]]/bdefine
58/#[[:space:]]*ifdef[[:space:]]/bifdef
59/#[[:space:]]*ifndef[[:space:]]/bifndef
60/#[[:space:]]*if[[:space:]]/bif
61/#[[:space:]]*elif[[:space:]]/belif
62/#[[:space:]]*else$/belse
63/#[[:space:]]*endif$/bendif
64
65# Not recognized, drop it.
66:asm-noinc
67d
68b end
69
70#
71# Defines needs some extra massaging to work in yasm.
72# Things like trailing type indicators ('U', 'ULL' ++) does not go down well.
73#
74:define
75/\$/d
76s/#\([[:space:]]*\)define/\1%define/
77
78s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)U$/\1/
79s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)U\([[:space:]]*\))$/\1\2)/
80s/\([[:space:]][0-9][0-9]*\)U[[:space:]]*$/\1/
81s/\([[:space:]][0-9][0-9]*\)U\([[:space:]]*\))$/\1\2)/
82
83s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)UL$/\1/
84s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)UL\([[:space:]]*\))$/\1\2)/
85s/\([[:space:]][0-9][0-9]*\)UL[[:space:]]*$/\1/
86s/\([[:space:]][0-9][0-9]*\)UL\([[:space:]]*\))$/\1\2)/
87
88s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)ULL$/\1/
89s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)ULL\([[:space:]]*\))$/\1\2)/
90s/\([[:space:]][0-9][0-9]*\)ULL[[:space:]]*$/\1/
91s/\([[:space:]][0-9][0-9]*\)ULL\([[:space:]]*\))$/\1\2)/
92
93s/UINT64_C([[:space:]]*\(0[xX][0-9a-fA-F][0-9a-fA-F]*\)[[:space:]]*)/\1/
94s/UINT64_C([[:space:]]*\([0-9][0-9]*\)[[:space:]]*)/\1/
95s/UINT32_C([[:space:]]*\(0[xX][0-9a-fA-F][0-9a-fA-F]*\)[[:space:]]*)/\1/
96s/UINT32_C([[:space:]]*\([0-9][0-9]*\)[[:space:]]*)/\1/
97s/UINT16_C([[:space:]]*\(0[xX][0-9a-fA-F][0-9a-fA-F]*\)[[:space:]]*)/\1/
98s/UINT16_C([[:space:]]*\([0-9][0-9]*\)[[:space:]]*)/\1/
99s/UINT8_C([[:space:]]*\(0[xX][0-9a-fA-F][0-9a-fA-F]*\)[[:space:]]*)/\1/
100s/UINT8_C([[:space:]]*\([0-9][0-9]*\)[[:space:]]*)/\1/
101
102b end
103
104#
105# Conditional statements, 1:1.
106#
107:ifdef
108s/#\([[:space:]]*\)ifdef/\1%ifdef/
109b end
110
111:ifndef
112s/#\([[:space:]]*\)ifndef/\1%ifndef/
113b end
114
115:if
116s/#\([[:space:]]*\)if/\1%if/
117b end
118
119:elif
120s/#\([[:space:]]*\)elif/\1%elif/
121b end
122
123:else
124s/#\([[:space:]]*\)else.*$/\1%else/
125b end
126
127:endif
128s/#\([[:space:]]*\)endif.*$/\1%endif/
129b end
130
131#
132# Assembly statement... may need adjusting when used.
133#
134:asm-inc
135b end
136
137:end
138
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