/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <strings.h>
#include <assert.h>
#include <dt_xlator.h>
#include <dt_parser.h>
#include <dt_grammar.h>
#include <dt_module.h>
#include <dt_impl.h>
/*
* Create a member node corresponding to one of the output members of a dynamic
* translator. We set the member's dn_membexpr to a DT_NODE_XLATOR node that
* has dn_op set to DT_TOK_XLATE and refers back to the translator itself. The
* code generator will then use this as the indicator for dynamic translation.
*/
/*ARGSUSED*/
static int
{
/*
* For the member expression, we use a DT_NODE_XLATOR/TOK_XLATE whose
* xlator refers back to the translator and whose dn_xmember refers to
*/
/*
* For the member itself, we use a DT_NODE_MEMBER as usual with the
* appropriate name, output type, and member expression set to 'enp'.
*/
} else
return (0);
}
{
return (NULL);
return (NULL);
}
}
goto err; /* no memory for identifier */
/*
* If an input parameter name is given, this is a static translator
* definition: create an idhash and identifier for the parameter.
*/
goto err; /* no memory for identifier hash */
}
/*
* If a deferred pragma is pending on the keyword "translator", run all
* the deferred pragmas on dx_souid and then copy results to dx_ptrid.
* See the code in dt_pragma.c for details on deferred ident pragmas.
*/
}
/*
* If no input parameter is given, we're making a dynamic translator:
* create member nodes for every member of the output type. Otherwise
* retain the member and allocation node lists presented by the parser.
*/
dt_xlator_create_member, dxp) != 0)
goto err;
} else {
}
/*
* Assign member IDs to each member and allocate space for DIFOs
* if and when this translator is eventually compiled.
*/
}
dxp->dx_nmembers = 0;
goto err;
}
return (dxp);
err:
return (NULL);
}
void
{
uint_t i;
for (i = 0; i < dxp->dx_nmembers; i++)
}
{
return (NULL); /* fail if these are unresolvable types */
/*
* Translators are always defined using a struct or union type, so if
* we are attempting to translate to type "T *", we internally look
* for a translation to type "T" by following the pointer reference.
*/
if (ptr) {
}
return (NULL); /* fail if the output isn't a struct or union */
/*
* In order to find a matching translator, we iterate over the set of
* available translators in three passes. First, we look for a
* translation from the exact source type to the resolved destination.
* Second, we look for a translation from the resolved source type to
* the resolved destination. Third, we look for a translation from a
* compatible source type (using the same rules as parameter formals)
* to the resolved destination. If all passes fail, return NULL.
*/
goto out;
}
if (flags & DT_XLATE_EXACT)
goto out; /* skip remaining passes if exact match required */
goto out;
}
goto out;
}
out:
return (NULL); /* no translation available to pointer type */
return (dxp); /* we succeeded or not allowed to extern */
/*
* If we get here, then we didn't find an existing translator, but the
* caller and xlatemode permit us to create an extern to a dynamic one.
*/
}
{
}
{
else
}
{
return (dnp);
}
return (NULL);
}
int
{
}