Blame MacOSX/convert_reader_h.pl

Packit 9f0df5
#!/usr/bin/env perl
Packit 9f0df5
Packit 9f0df5
#    convert_reader_h.pl: convert reader.h.in in reader.h with
Packit 9f0df5
#
Packit 9f0df5
#    Copyright (C) 2008  Ludovic Rousseau  <ludovic.rousseau@free.fr>
Packit 9f0df5
#
Packit 9f0df5
#    This program is free software; you can redistribute it and/or modify
Packit 9f0df5
#    it under the terms of the GNU General Public License as published by
Packit 9f0df5
#    the Free Software Foundation; either version 2 of the License, or
Packit 9f0df5
#    (at your option) any later version.
Packit 9f0df5
#
Packit 9f0df5
#    This program is distributed in the hope that it will be useful,
Packit 9f0df5
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 9f0df5
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 9f0df5
#    GNU General Public License for more details.
Packit 9f0df5
#
Packit 9f0df5
#    You should have received a copy of the GNU General Public License along
Packit 9f0df5
#    with this program; if not, write to the Free Software Foundation, Inc.,
Packit 9f0df5
#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Packit 9f0df5
Packit 9f0df5
use warnings;
Packit 9f0df5
use strict;
Packit 9f0df5
Packit 9f0df5
my $text = 
Packit 9f0df5
"#ifdef __BIG_ENDIAN__
Packit 9f0df5
#define HOST_TO_CCID_16(x) ((((x) >> 8) & 0xFF) + ((x & 0xFF) << 8))
Packit 9f0df5
#define HOST_TO_CCID_32(x) ((((x) >> 24) & 0xFF) + (((x) >> 8) & 0xFF00) + ((x & 0xFF00) << 8) + (((x) & 0xFF) << 24))
Packit 9f0df5
#else
Packit 9f0df5
#define HOST_TO_CCID_16(x) (x)
Packit 9f0df5
#define HOST_TO_CCID_32(x) (x)
Packit 9f0df5
#endif
Packit 9f0df5
";
Packit 9f0df5
Packit 9f0df5
while (<>)
Packit 9f0df5
{
Packit 9f0df5
	if (m/host_to_ccid_16/)
Packit 9f0df5
	{
Packit 9f0df5
		print $text;
Packit 9f0df5
		<>;
Packit 9f0df5
		next;
Packit 9f0df5
	}
Packit 9f0df5
	print;
Packit 9f0df5
}