#
# $Id: typemap,v 23.1 2003/04/10 19:09:15 biersma Exp $
#
# (c) 1999-2003 Morgan Stanley Dean Witter and Co.
# See ..../src/LICENSE for terms of distribution.
#

PMQCHAR		T_PV
MQLONG          T_IV

MQRFH		T_MQRFH


INPUT

T_MQRFH
    {
        /* input a MQRFH */
        STRLEN len = 0;
        MQRFH default_MQRFH = { MQRFH_DEFAULT };
 
        if (!SvROK($arg))
            croak(\"Reference expected for parameter $var\");
        /* copy in the default value of structure... */
        memcpy((char *)&$var, &default_MQRFH, sizeof(MQRFH));
 
        if (hv_exists((HV*)SvRV($arg),\"Version\",7))
          $var.Version = SvIV(*(hv_fetch((HV*)SvRV($arg),
                \"Version\",7,0)));
        if (hv_exists((HV*)SvRV($arg),\"StrucLength\",11))
          $var.StrucLength = SvIV(*(hv_fetch((HV*)SvRV($arg),
                \"StrucLength\",11,0)));
        if (hv_exists((HV*)SvRV($arg),\"Encoding\",8))
          $var.Encoding = SvIV(*(hv_fetch((HV*)SvRV($arg),
                \"Encoding\",8,0)));
        if (hv_exists((HV*)SvRV($arg),\"CodedCharSetId\",14))
          $var.CodedCharSetId = SvIV(*(hv_fetch((HV*)SvRV($arg),
                \"CodedCharSetId\",14,0)));
        if (hv_exists((HV*)SvRV($arg), \"Format\", 6)) {
            SV **scalar;
 
            scalar = hv_fetch((HV *)SvRV($arg), \"Format\", 6, 0);
            strncpy($var.Format,
                    (char *)SvPV(*scalar, len),
                    8);
        }
 
                          
        if (hv_exists((HV*)SvRV($arg),\"Flags\",5))
          $var.Flags = SvIV(*(hv_fetch((HV*)SvRV($arg),
                \"Flags\",5,0)));
    }

OUTPUT
 
T_MQRFH
    /* output a MQRFH: */
 
 
        hv_store((HV*)SvRV($arg),\"Version\",7,
                 (newSViv($var.Version)),0);
        hv_store((HV*)SvRV($arg),\"StrucLength\",11,
                 (newSViv($var.StrucLength)),0);
        hv_store((HV*)SvRV($arg),\"Encoding\",8,
                 (newSViv($var.Encoding)),0);
        hv_store((HV*)SvRV($arg),\"CodedCharSetId\",14,
                 (newSViv($var.CodedCharSetId)),0);
        hv_store((HV*)SvRV($arg),\"Format\",6,
                 (newSVpv($var.Format, 8)),0);
        hv_store((HV*)SvRV($arg),\"Flags\",5,
                 (newSViv($var.Flags)),0);
 
