VirtualBox

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

Last change on this file since 30736 was 30736, checked in by vboxsync, 15 years ago

bootsector2-test1.asm,++: real mode tests.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1
2# Check for markers (typically in comments).
3/ASM-INC/basm-inc
4/ASM-NOINC/basm-noinc
5
6# Strip comments and trailing space.
7s/[[:space:]][[:space:]]*\/\*.*$//g
8s/[[:space:]][[:space:]]*\/\/.*$//g
9s/[[:space:]][[:space:]]*$//g
10
11# Try identify the statement.
12/#[[:space:]]*define[[:space:]]/bdefine
13/#[[:space:]]*ifdef[[:space:]]/bifdef
14/#[[:space:]]*ifndef[[:space:]]/bifndef
15/#[[:space:]]*if[[:space:]]/bif
16/#[[:space:]]*elif[[:space:]]/belif
17/#[[:space:]]*else$/belse
18/#[[:space:]]*endif$/bendif
19
20# Not recognized, drop it.
21:asm-noinc
22d
23b end
24
25#
26# Defines needs some extra massaging to work in yasm.
27# Things like trailing type indicators ('U', 'ULL' ++) does not go down well.
28#
29:define
30/\$/d
31s/#\([[:space:]]*\)define/\1%define/
32
33s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)U$/\1/
34s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)U\([[:space:]]*\))$/\1\2)/
35s/\([[:space:]][0-9][0-9]*\)U[[:space:]]*$/\1/
36s/\([[:space:]][0-9][0-9]*\)U\([[:space:]]*\))$/\1\2)/
37
38s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)UL$/\1/
39s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)UL\([[:space:]]*\))$/\1\2)/
40s/\([[:space:]][0-9][0-9]*\)UL[[:space:]]*$/\1/
41s/\([[:space:]][0-9][0-9]*\)UL\([[:space:]]*\))$/\1\2)/
42
43s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)ULL$/\1/
44s/\([[:space:]]0[xX][0-9a-fA-F][0-9a-fA-F]*\)ULL\([[:space:]]*\))$/\1\2)/
45s/\([[:space:]][0-9][0-9]*\)ULL[[:space:]]*$/\1/
46s/\([[:space:]][0-9][0-9]*\)ULL\([[:space:]]*\))$/\1\2)/
47
48s/UINT32_C([[:space:]]*\(0[xX][0-9a-fA-F][0-9a-fA-F]*\)[[:space:]]*)/\1/
49s/UINT32_C([[:space:]]*\([0-9][0-9]*\)[[:space:]]*)/\1/
50
51b end
52
53#
54# Conditional statements, 1:1.
55#
56:ifdef
57s/#\([[:space:]]*\)ifdef/\1%ifdef/
58b end
59
60:ifndef
61s/#\([[:space:]]*\)ifndef/\1%ifndef/
62b end
63
64:if
65s/#\([[:space:]]*\)if/\1%if/
66b end
67
68:elif
69s/#\([[:space:]]*\)elif/\1%elif/
70b end
71
72:else
73s/#\([[:space:]]*\)else.*$/\1%else/
74b end
75
76:endif
77s/#\([[:space:]]*\)endif.*$/\1%endif/
78b end
79
80#
81# Assembly statement... may need adjusting when used.
82#
83:asm-inc
84b end
85
86:end
87
Note: See TracBrowser for help on using the repository browser.

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