#!/bin/sh -
#	$Id: s_win32,v 1.1.1.1.2.2 2000/02/08 00:44:15 noriko Exp $
#
# Build Windows/32 include files.

msgc="/* DO NOT EDIT: automatically built by dist/distrib. */"

. RELEASE

f=../build_win32/db.h
rm -f $f
echo "Building $f"
(echo "$msgc" && sed \
    -e 's/@u_int8_decl@/typedef unsigned char u_int8_t;/' \
    -e 's/@int16_decl@/typedef short int16_t;/' \
    -e 's/@u_int16_decl@/typedef unsigned short u_int16_t;/' \
    -e 's/@int32_decl@/typedef int int32_t;/' \
    -e 's/@u_int32_decl@/typedef unsigned int u_int32_t;/' \
    -e '/@u_char_decl@/{' \
    -e		'i\' \
    -e		'#if !defined(_WINSOCKAPI_)' \
    -e		's/@u_char_decl@/typedef unsigned char u_char;/' \
    -e '}' \
    -e 's/@u_short_decl@/typedef unsigned short u_short;/' \
    -e 's/@u_int_decl@/typedef unsigned int u_int;/' \
    -e '/@u_long_decl@/{' \
    -e		's/@u_long_decl@/typedef unsigned long u_long;/' \
    -e	 	'a\' \
    -e		'#endif' \
    -e '}' \
    -e 's/@ssize_t_decl@/typedef int ssize_t;/' \
    -e "s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/" \
    -e "s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/" \
    -e "s/@DB_VERSION_PATCH@/$DB_VERSION_PATCH/" \
    -e "s/@DB_VERSION_STRING@/\"$DB_VERSION_STRING\"/" \
    < ../include/db.src) > $f
chmod 444 $f

f=../build_win32/db_int.h
echo "Building $f"
rm -f $f
(echo "$msgc" && sed \
    -e 's/\(PATH_SEPARATOR[^"]*"\)\/"/\1\\\\\/"/' \
    -e 's/@db_align_t_decl@/typedef unsigned long db_align_t;/' \
    -e 's/@db_alignp_t_decl@/typedef unsigned long db_alignp_t;/' \
    < ../include/db_int.src) > $f
chmod 444 $f

f=../build_win32/libdb.rc
echo "Building $f"
rm -f $f
sed -e "s/%MAJOR%/$DB_VERSION_MAJOR/" \
    -e "s/%MINOR%/$DB_VERSION_MINOR/" \
    -e "s/%PATCH%/$DB_VERSION_PATCH/" \
    < ../build_win32/libdbrc.src > $f
chmod 444 $f
