#!/bin/sh
V=`printf "0x%02x%02x0000" $1 $2`

echo '; This file specifies the import forwarding for python3.dll'
echo '; It is used when building python3dll.vcxproj'
echo 'LIBRARY	"python3"'
echo 'EXPORTS'

cppargs="-DPy_LIMITED_API=$V -DPyAPI_FUNC(x)=_PyAPI_FUNC -DPyAPI_DATA(x)=_PyAPI_DATA -IInclude -I. Include/Python.h"
(cpp $cppargs;
 cpp -DPY_SSIZE_T_CLEAN $cppargs;
) | egrep '_PyAPI_FUNC|_PyAPI_DATA' | sed -re '
s/^ *_PyAPI_FUNC +([a-zA-Z0-9_]+).*/  \1=python'$1$2'.\1/
s/^ *_PyAPI_DATA[ (*]+([a-zA-Z0-9_]+).*/  \1=python'$1$2'.\1 DATA/
' | (LC_ALL=C sort -u)
