Changeset 104378 in vbox for trunk/include
- Timestamp:
- Apr 19, 2024 2:43:14 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/various.sed
r98103 r104378 3 3 # Converts some C header elements into nasm/yasm syntax. 4 4 # 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. 10 11 # 11 12 # This file is part of VirtualBox base platform packages, as … … 48 49 :next 49 50 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 } 53 55 54 56 # Newline escapes. … … 59 61 :no-more-newline-escapes 60 62 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. 68 h 69 70 # Strip comments. 71 /\/\*/!b strip_cpp_style_comment 72 :load_another_c_style_comment_line 73 /\*\//b strip_c_style_comment 74 N 75 b load_another_c_style_comment_line 76 :strip_c_style_comment 77 s/\/\*.*\*\// /g 78 79 :strip_cpp_style_comment 80 s,//.*$, ,g 81 82 # Strip trailing spaces 64 83 s/[[:space:]][[:space:]]*$//g 65 84 … … 119 138 b end 120 139 140 121 141 :ifndef 122 142 s/#\([[:space:]]*\)ifndef/\1%ifndef/ 123 143 b end 124 144 145 125 146 :if 126 147 s/#\([[: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[)]'. 150 s/defined[(]DOXYGEN_RUNNING[)]/0/ 151 152 # Simplify stuff that was turned into '0' in the previous step (or in the input file). 153 s/||[[:space:]]*0[[:space:]]*$//g 154 s/||[[:space:]]*0\([[:space:]|&]\)/\1/g 155 s/\([[:space:]|&]\)0[[:space:]]*||/\1/g 156 s/[[:space:]][[:space:]]*$// 157 158 # Convert #if [!]defined(xxxx) into %if[n]def xxxx 159 s/%if[[:space:]][[:space:]]*defined[(]\([^)][^)]*\)[)]$/%ifdef \1/ 160 s/%if[[:space:]][[:space:]]*[!][[:space:]]*defined[(]\([^)][^)]*\)[)]$/%ifndef \1/ 161 162 # Convert '#if ... && 0' and '#if 0 && ...' to %if 0 163 s/%if[[:space:]].*&&[[:space:]]*00*$/%if 0/ 164 s/%if[[:space:]][[:space:]]*00*[[:space:]]*&&$/%if 0/ 165 166 # Convert '#if ... || 1' and '#if 1 || ...' to '%if 1' 167 s/%if[[:space:]].*||[[:space:]]*1[0-9]*$/%if 1/ 168 s/%if[[:space:]][[:space:]]*1[0-9]*[[:space:]]*||$/%if 1/ 169 170 /defined/b defined_error 171 b end 172 128 173 129 174 :elif 130 175 s/#\([[: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[)]'. 178 s/defined[(]DOXYGEN_RUNNING[)]/0/ 179 180 # Simplify stuff that was turned into '0' in the previous step (or in the input file). 181 s/||[[:space:]]*0[[:space:]]*$//g 182 s/||[[:space:]]*0\([[:space:]|&]\)/\1/g 183 s/\([[:space:]|&]\)0[[:space:]]*||/\1/g 184 s/[[:space:]][[:space:]]*$// 185 186 # Convert #if [!]defined(xxxx) into %if[n]def xxxx 187 s/%elif[[:space:]][[:space:]]*defined[(]\([^)][^)]*\)[)]$/%elifdef \1/ 188 s/%elif[[:space:]][[:space:]]*[!][[:space:]]*defined[(]\([^)][^)]*\)[)]$/%elifndef \1/ 189 190 # Convert '#elif ... && 0' and '#elif 0 && ...' to '%elif 0' 191 s/%elif[[:space:]].*&&[[:space:]]*00*$/%elif 0/ 192 s/%elif[[:space:]][[:space:]]*00*[[:space:]]*&&$/%elif 0/ 193 194 # Convert '#elif ... || 1' and '#elif 1 || ...' to '%elif 1' 195 s/%elif[[:space:]].*||[[:space:]]*1[0-9]*$/%elif 1/ 196 s/%elif[[:space:]][[:space:]]*1[0-9]*[[:space:]]*||$/%elif 1/ 197 198 /defined/b defined_error 199 b end 200 132 201 133 202 :else … … 135 204 b end 136 205 206 137 207 :endif 138 208 s/#\([[:space:]]*\)endif.*$/\1%endif/ 139 209 b end 140 210 141 # 142 # Assembly statement... may need adjusting when used. 211 212 :defined_error 213 x 214 s/^/error: yasm & nasm does not grok 'defined': / 215 p 216 x 217 s/^/info: state: / 218 q1 219 220 221 # 222 # Assembly statement inside a C-style comment. 143 223 # 144 224 :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 228 s/^/error: unknown ASM-INC form: / 229 q1 230 231 # /* ASM-INC: %include "whatever.mac" */ 232 :asm-inc-c-style-oneliner 233 s/[[:space:]]*\/\*[[:space:]][[:space:]]*ASM-INC:[[:space:]]*\(.*\)[[:space:]]*\*\//\1/ 234 b end 235 236 # // ASM-INC: %include "whatever.mac" 237 :asm-inc-cpp-style-oneliner 238 s/[[:space:]]*\/\/[[:space:]][[:space:]]*ASM-INC:[[:space:]]*\(.*\)[[:space:]]*$/\1/ 239 b end 240 241 # /* ASM-INC 242 # %include "whatever.mac" 243 # */ 244 :asm-inc-c-style-block 245 s/.*$// 246 :asm-inc-c-style-block-next 247 h 248 N 249 /\*\//!b asm-inc-c-style-block-next 250 x 251 b end 252 146 253 147 254 :end
Note:
See TracChangeset
for help on using the changeset viewer.