I finally got around to dusting off the source code for this, completing the move away from sourceforge, and making a new release. This is just a maintenance release, fixing some compilation problems on 64 bit and big-endian systems. No new binary for Windows released, as there are no changes, and I can't be bothered to dig out a Windows compiler. Get it here.
Sun, 13 Aug 2006
BSP 5.2
[19:21] | [/games/doom/bsp] | #
Activity
[19:13] | [/games/doom/prboom] | #
Sat, 12 Aug 2006
Bad MIDI Synthesis on x64_64 Systems
Just some google food for anyone having trouble with the music in PrBoom on amd64 systems. There is a bug in SDL_mixer 1.2.6 (and earlier), which causes this problem; this is the version of SDL_mixer in Ubuntu Hoary and Dapper, and in Debian at the moment. It is this patch:
--- ./timidity/config.h 2006-08-12 11:59:44.492723500 +0100 +++ ../sdl-mixer1.2-1.2.6-cph1/timidity/config.h 2006-08-12 11:30:06.988427250 +0100 @@ -185,14 +185,8 @@ typedef double FLOAT_T; #define LITTLE_ENDIAN #endif -/* DEC MMS has 64 bit long words */ -#ifdef DEC typedef unsigned int uint32; -typedef int int32; -#else -typedef unsigned long uint32; -typedef long int32; -#endif +typedef int int32; typedef unsigned short uint16; typedef short int16; typedef unsigned char uint8;
to the timidity code that fixes the problem. You can download a fixed libsdl-mixer1.2 and libsdl-mixer1.2-dev if you don't want to rebuild the packages yourself.
[13:30] | [/games/doom/prboom] | #
Sun, 06 Aug 2006
Finding Unused Externs in C
gcc -Wunused-function -Wmissing-declarations does a good job at identifying functions that are not declared in any header file, and once you mark them static then tells you if they are unused. However, with programs that have been developed over many years, and have a lot of cruft in the source code (such as Doom/PrBoom), there may be many functions that are prototyped in header files but are not actually used from other files; gcc cannot tell you about these.
I had an idea for locating these unnecessary externs: just run the link stage of gcc with one .o file taken out, and record all the 'undefined reference to' errors you get. That gives you the list of used externs; so any others are unused. So I wrote a couple of scripts to assist with this. First, find-used-externs:
#!/usr/bin/ruby -w
def filter_gcc(cmdline)
IO.popen(cmdline.join(" ") + " 2>&1 ") do |p|
p.each_line do |l|
print $1,"\n" if l =~ /undefined reference to \`(.*)'/;
end
end
end
ARGV.each do | a |
next unless a =~ /\.o$/;
cmdline = ARGV.reject { |b| b == a }
filter_gcc(cmdline)
end
Which tells you all the symbols in .o files referenced by other files — cut and paste the normal link step for the project, and prefix the command with ./find-used-externs. It runs the link command once for each .o file, omitting only that .o file from the command line, and parsing the errors.
Secondly, you have to find all the externs provided by each .h file, and see if any are not on the used list. list-externs is a very crude script to try and read extern variables and function prototypes from header files:
#!/usr/bin/ruby -w
ARGF.each_line do |l|
l.sub!(/\/\/.*/,'')
l.sub!(/\/\*.*/,'')
print $1,"\n" if l =~ /^\s*extern.*\s([a-zA-Z_][a-zA-Z_0-9]*)\s*;/
print $1,"\n" if l =~ /^\s*[^#].*\s([a-zA-Z_][a-zA-Z_0-9]*)\s*\(/
end
So sort the output of that, and use comm(1) to find the entries that are not in the (sorted) output of find-used-externs. And that tells you what header file declarations are not currently needed.
[13:38] | [/computers/code] | #
zsync 0.5
The main feature of this release is that large file support is now enabled on systems (Linux/i386 in particular) where it needs to be explicitely selected. As I do most of the development on Linux/x86_64 now, I was blissfully ignorant of this problem until Robert Lemmen forwarded a complaint about it.
I have also fixed some compilation problems to MacOS X and Solaris. There is also a substitute for getaddrinfo provided for systems that need it, which someone emailed me about.
Finally, I have made the source code repository for zsync available online. This, and the new release, are available from the download page.
[11:36] | [/computers/zsync] | #