diff options
author | H. Peter Anvin <hpa@zytor.com> | 2002-05-20 01:04:34 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2002-05-20 01:04:34 +0000 |
commit | 5a09ee3cf39dce27cc5a8e48ec50fa998617245b (patch) | |
tree | 2dafc249bd74b739f6009c22fb9765b3f6d23609 /version.pl | |
parent | ac7e75a05d0b0de194fff245639c7e2eac72bc1d (diff) | |
download | nasm-5a09ee3cf39dce27cc5a8e48ec50fa998617245b.tar.gz nasm-5a09ee3cf39dce27cc5a8e48ec50fa998617245b.tar.bz2 nasm-5a09ee3cf39dce27cc5a8e48ec50fa998617245b.zip |
Add __NASM_PATCHLEVEL__ and __NASM_VERSION_ID__ macros
Diffstat (limited to 'version.pl')
-rwxr-xr-x | version.pl | 31 |
1 files changed, 24 insertions, 7 deletions
@@ -7,7 +7,7 @@ # # The NASM version number is assumed to consist of: # -# <major>.<minor>[.<subminor>]<tail> +# <major>.<minor>[.<subminor>[.<patchlevel>]]<tail> # # ... where <tail> is not necessarily numeric. # @@ -17,12 +17,16 @@ # NASM_MAJOR_VER # NASM_MINOR_VER # NASM_SUBMINOR_VER -- this is zero if no subminor +# NASM_PATCHLEVEL_VER -- this is zero is no patchlevel +# NASM_VERSION_ID -- version number encoded # NASM_VER -- whole version number as a string # # version.mac: # __NASM_MAJOR__ # __NASM_MINOR__ # __NASM_SUBMINOR__ +# __NASM_PATCHLEVEL__ +# __NASM_VERSION_ID__ # __NASM_VER__ # @@ -31,32 +35,46 @@ $line = <STDIN>; chomp $line; -if ( $line =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)/ ) { +if ( $line =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/ ) { $maj = $1; $nmaj = $maj+0; $min = $2; $nmin = $min+0; $smin = $3; $nsmin = $smin+0; + $plvl = $4; $nplvl = $plvl+0; + $tail = $'; +} elsif ( $line =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)/ ) { + $maj = $1; $nmaj = $maj+0; + $min = $2; $nmin = $min+0; + $smin = $3; $nsmin = $smin+0; + $plvl = ''; $nplvl = 0; $tail = $'; } elsif ( $line =~ /^([0-9]+)\.([0-9]+)/ ) { $maj = $1; $nmaj = $maj+0; $min = $2; $nmin = $min+0; $smin = ''; $nsmin = 0; + $plvl = ''; $nplvl = 0; $tail = $'; } else { die "$0: Invalid input format\n"; } +$nasm_id = ($nmaj << 24)+($nmin << 16)+($nsmin << 8)+$nplvl; + if ( $what eq 'h' ) { print "#ifndef NASM_VERSION_H\n"; print "#define NASM_VERSION_H\n"; - printf "#define NASM_MAJOR_VER %d\n", $nmaj; - printf "#define NASM_MINOR_VER %d\n", $nmin; - printf "#define NASM_SUBMINOR_VER %d\n", $nsmin; - printf "#define NASM_VER \"%s\"\n", $line; + printf "#define NASM_MAJOR_VER %d\n", $nmaj; + printf "#define NASM_MINOR_VER %d\n", $nmin; + printf "#define NASM_SUBMINOR_VER %d\n", $nsmin; + printf "#define NASM_PATCHLEVEL_VER %d\n", $nplvl; + printf "#define NASM_VERSION_ID 0x%08x\n", $nasm_id; + printf "#define NASM_VER \"%s\"\n", $line; print "#endif /* NASM_VERSION_H */\n"; } elsif ( $what eq 'mac' ) { printf "%%define __NASM_MAJOR__ %d\n", $nmaj; printf "%%define __NASM_MINOR__ %d\n", $nmin; printf "%%define __NASM_SUBMINOR__ %d\n", $nsmin; + printf "%%define __NASM_PATCHLEVEL__ %d\n", $nplvl; + printf "%%define __NASM_VERSION_ID__ 0%08Xh\n", $nasm_id; printf "%%define __NASM_VER__ \"%s\"\n", $line; } else { die "$0: Unknown output: $what\n"; @@ -64,4 +82,3 @@ if ( $what eq 'h' ) { exit 0; - |