VirtualBox

Changeset 104378 in vbox for trunk/include


Ignore:
Timestamp:
Apr 19, 2024 2:43:14 PM (10 months ago)
Author:
vboxsync
Message:

VMM/IEM: Automtically convert IEMInternal.h & IEMN8veRecompiler.h into nasm/yasm include files so IEMAllN8veHlpA.asm can make use of some of the constants define in them for the prolog code. bugref:10653 bugref:10370

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/various.sed

    r98103 r104378  
    33# Converts some C header elements into nasm/yasm syntax.
    44#
    5 # This is used by 'incs' in /Maintenance.kmk (/Makefile.kmk).
    6 #
    7 
    8 #
    9 # Copyright (C) 2006-2023 Oracle and/or its affiliates.
     5# This is used by 'incs' in /Maintenance.kmk (/Makefile.kmk) as well as the VMM
     6# for IEM headers.
     7#
     8
     9#
     10# Copyright (C) 2006-2024 Oracle and/or its affiliates.
    1011#
    1112# This file is part of VirtualBox base platform packages, as
     
    4849:next
    4950
    50 # Check for markers (typically in comments).
    51 /ASM-INC/basm-inc
    52 /ASM-NOINC/basm-noinc
     51# Check for block markers (typically in comments).
     52/ASM-NOINC-START/,/ASM-NOINC-END/ {
     53    d
     54}
    5355
    5456# Newline escapes.
     
    5961:no-more-newline-escapes
    6062
    61 # Strip comments and trailing space.
    62 s/[[:space:]][[:space:]]*\/\*.*$//g
    63 s/[[:space:]][[:space:]]*\/\/.*$//g
     63# Check for line markers (typically in comments).
     64/ASM-INC/basm-inc
     65/ASM-NOINC/basm-noinc
     66
     67# Save the original line in the hold space for error reporting.
     68h
     69
     70# Strip comments.
     71/\/\*/!b strip_cpp_style_comment
     72:load_another_c_style_comment_line
     73/\*\//b strip_c_style_comment
     74N
     75b load_another_c_style_comment_line
     76:strip_c_style_comment
     77s/\/\*.*\*\// /g
     78
     79:strip_cpp_style_comment
     80s,//.*$, ,g
     81
     82# Strip trailing spaces
    6483s/[[:space:]][[:space:]]*$//g
    6584
     
    119138b end
    120139
     140
    121141:ifndef
    122142s/#\([[:space:]]*\)ifndef/\1%ifndef/
    123143b end
    124144
     145
    125146:if
    126147s/#\([[:space:]]*\)if/\1%if/
    127 b end
     148
     149# Replace 'defined(DOXYGEN_RUNNING)' with '0' to simplify subsequent matching to '[0]' when we mean 'defined[(]DOXYGEN_RUNNING[)]'.
     150s/defined[(]DOXYGEN_RUNNING[)]/0/
     151
     152# Simplify stuff that was turned into '0' in the previous step (or in the input file).
     153s/||[[:space:]]*0[[:space:]]*$//g
     154s/||[[:space:]]*0\([[:space:]|&]\)/\1/g
     155s/\([[:space:]|&]\)0[[:space:]]*||/\1/g
     156s/[[:space:]][[:space:]]*$//
     157
     158# Convert #if [!]defined(xxxx) into %if[n]def xxxx
     159s/%if[[:space:]][[:space:]]*defined[(]\([^)][^)]*\)[)]$/%ifdef \1/
     160s/%if[[:space:]][[:space:]]*[!][[:space:]]*defined[(]\([^)][^)]*\)[)]$/%ifndef \1/
     161
     162# Convert '#if ... && 0' and '#if 0 && ...' to %if 0
     163s/%if[[:space:]].*&&[[:space:]]*00*$/%if 0/
     164s/%if[[:space:]][[:space:]]*00*[[:space:]]*&&$/%if 0/
     165
     166# Convert '#if ... || 1' and '#if 1 || ...' to '%if 1'
     167s/%if[[:space:]].*||[[:space:]]*1[0-9]*$/%if 1/
     168s/%if[[:space:]][[:space:]]*1[0-9]*[[:space:]]*||$/%if 1/
     169
     170/defined/b defined_error
     171b end
     172
    128173
    129174:elif
    130175s/#\([[:space:]]*\)elif/\1%elif/
    131 b end
     176
     177# Replace 'defined(DOXYGEN_RUNNING)' with '0' to simplify subsequent matching to '[0]' when we mean 'defined[(]DOXYGEN_RUNNING[)]'.
     178s/defined[(]DOXYGEN_RUNNING[)]/0/
     179
     180# Simplify stuff that was turned into '0' in the previous step (or in the input file).
     181s/||[[:space:]]*0[[:space:]]*$//g
     182s/||[[:space:]]*0\([[:space:]|&]\)/\1/g
     183s/\([[:space:]|&]\)0[[:space:]]*||/\1/g
     184s/[[:space:]][[:space:]]*$//
     185
     186# Convert #if [!]defined(xxxx) into %if[n]def xxxx
     187s/%elif[[:space:]][[:space:]]*defined[(]\([^)][^)]*\)[)]$/%elifdef \1/
     188s/%elif[[:space:]][[:space:]]*[!][[:space:]]*defined[(]\([^)][^)]*\)[)]$/%elifndef \1/
     189
     190# Convert '#elif ... && 0' and '#elif 0 && ...' to '%elif 0'
     191s/%elif[[:space:]].*&&[[:space:]]*00*$/%elif 0/
     192s/%elif[[:space:]][[:space:]]*00*[[:space:]]*&&$/%elif 0/
     193
     194# Convert '#elif ... || 1' and '#elif 1 || ...' to '%elif 1'
     195s/%elif[[:space:]].*||[[:space:]]*1[0-9]*$/%elif 1/
     196s/%elif[[:space:]][[:space:]]*1[0-9]*[[:space:]]*||$/%elif 1/
     197
     198/defined/b defined_error
     199b end
     200
    132201
    133202:else
     
    135204b end
    136205
     206
    137207:endif
    138208s/#\([[:space:]]*\)endif.*$/\1%endif/
    139209b end
    140210
    141 #
    142 # Assembly statement... may need adjusting when used.
     211
     212:defined_error
     213x
     214s/^/error: yasm & nasm does not grok 'defined': /
     215p
     216x
     217s/^/info: state: /
     218q1
     219
     220
     221#
     222# Assembly statement inside a C-style comment.
    143223#
    144224:asm-inc
    145 b end
     225/\/\*[[:space:]]*ASM-INC:.*\*\//b asm-inc-c-style-oneliner
     226/\/\/[[:space:]]*ASM-INC:/b asm-inc-cpp-style-oneliner
     227/\/\*[[:space:]]*ASM-INC/b asm-inc-c-style-block
     228s/^/error: unknown ASM-INC form: /
     229q1
     230
     231# /* ASM-INC: %include "whatever.mac" */
     232:asm-inc-c-style-oneliner
     233s/[[:space:]]*\/\*[[:space:]][[:space:]]*ASM-INC:[[:space:]]*\(.*\)[[:space:]]*\*\//\1/
     234b end
     235
     236# // ASM-INC: %include "whatever.mac"
     237:asm-inc-cpp-style-oneliner
     238s/[[:space:]]*\/\/[[:space:]][[:space:]]*ASM-INC:[[:space:]]*\(.*\)[[:space:]]*$/\1/
     239b end
     240
     241# /* ASM-INC
     242# %include "whatever.mac"
     243# */
     244:asm-inc-c-style-block
     245s/.*$//
     246:asm-inc-c-style-block-next
     247h
     248N
     249/\*\//!b asm-inc-c-style-block-next
     250x
     251b end
     252
    146253
    147254:end
Note: See TracChangeset for help on using the changeset viewer.

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