本文整理汇总了C++中IDL_IDENT函数的典型用法代码示例。如果您正苦于以下问题:C++ IDL_IDENT函数的具体用法?C++ IDL_IDENT怎么用?C++ IDL_IDENT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IDL_IDENT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_const_dcl
static gboolean
do_const_dcl(TreeState *state)
{
struct _IDL_CONST_DCL *dcl = &IDL_CONST_DCL(state->tree);
const char *name = IDL_IDENT(dcl->ident).str;
gboolean is_signed;
GSList *doc_comments = IDL_IDENT(dcl->ident).comments;
IDL_tree real_type;
const char *const_format;
if (!verify_const_declaration(state->tree))
return FALSE;
if (doc_comments != NULL) {
write_indent(state->file);
printlist(state->file, doc_comments);
}
/* Could be a typedef; try to map it to the real type. */
real_type = find_underlying_type(dcl->const_type);
real_type = real_type ? real_type : dcl->const_type;
is_signed = IDL_TYPE_INTEGER(real_type).f_signed;
const_format = is_signed ? "%" IDL_LL "d" : "%" IDL_LL "uU";
write_indent(state->file);
fprintf(state->file, "enum { %s = ", name);
fprintf(state->file, const_format, IDL_INTEGER(dcl->const_exp).value);
fprintf(state->file, " };\n\n");
return TRUE;
}
示例2: MateCORBA_imodule_create_alias_typecode
CORBA_TypeCode
MateCORBA_imodule_create_alias_typecode (GHashTable *typecodes,
IDL_tree tree,
CORBA_TypeCode original_type)
{
CORBA_Environment env;
CORBA_TypeCode retval;
CORBA_exception_init (&env);
g_return_val_if_fail (IDL_NODE_TYPE (tree) == IDLN_IDENT, NULL);
g_return_val_if_fail (g_hash_table_lookup (typecodes,
IDL_IDENT (tree).repo_id) == NULL, NULL);
retval = CORBA_ORB_create_alias_tc (NULL,
IDL_IDENT (tree).repo_id,
IDL_IDENT (tree).str,
original_type, &env);
MateCORBA_imodule_register_typecode (
typecodes, IDL_IDENT (tree).repo_id, retval);
if (env._major != CORBA_NO_EXCEPTION)
g_warning ("MateCORBA_imodule_create_alias_typecode: exception %s", env._id);
CORBA_exception_free (&env);
return retval;
}
示例3: orbit_idl_tree_type_to_typecode_exception
/*
* make exception typecode
*/
static CORBA_TypeCode orbit_idl_tree_type_to_typecode_exception(IDL_tree type)
{
CORBA_TypeCode type_code = NULL;
CORBA_StructMemberSeq * p_members = NULL;
#if 0
if (IDL_EXCEPT_DCL(type).members == NULL)
{
printf("no members\n");
goto error;
}
#endif
p_members = orbit_create_member_sequence(IDL_EXCEPT_DCL(type).members);
if (p_members == NULL)
goto error;
type_code = CORBA_ORB_create_exception_tc(
orbit_get_orb(),
IDL_IDENT(IDL_EXCEPT_DCL(type).ident).repo_id,
IDL_IDENT(IDL_EXCEPT_DCL(type).ident).str,
p_members,
orbit_get_environment());
goto exit;
error:
satellite_release_typecode(type_code);
exit:
CORBA_free(p_members);
return type_code;
}
示例4: VoyagerWriteParamsForParentCall
static
void VoyagerWriteParamsForParentCall(IDL_tree curif, InheritedOutputInfo2 *ioi)
{
IDL_tree curitem;
char* overridenMethodName;
if(curif == ioi->realif)
return;
overridenMethodName=ioi->chrOverridenMethodName;
for(curitem = IDL_INTERFACE(curif).body; curitem; curitem = IDL_LIST(curitem).next) {
IDL_tree curop = IDL_LIST(curitem).data;
switch(IDL_NODE_TYPE(curop)) {
case IDLN_OP_DCL:
{
/* Check if the current method (introduced by some parent) is the one to be
overriden. */
if(!strcmp(overridenMethodName, IDL_IDENT(IDL_OP_DCL(curop).ident).str)){
IDL_tree sub;
for (sub = IDL_OP_DCL (curop).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
IDL_tree parm = IDL_LIST (sub).data;
fprintf (ioi->of, "%s, ", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str);
}
}
break;
}
default:
break;
}
}
}
示例5: VoyagerDoWriteParamsForOverridenMethod
/*
This function is called for each parent to check if the current parent introduced the
overriden method. If yes, the parameter info is taken from this parent and put into the
file.
*/
static
void VoyagerDoWriteParamsForOverridenMethod(IDL_tree curif, InheritedOutputInfo2 *ioi)
{
IDL_tree curitem;
char* overridenMethodName;
if(curif == ioi->realif)
return;
overridenMethodName=ioi->chrOverridenMethodName;
for(curitem = IDL_INTERFACE(curif).body; curitem; curitem = IDL_LIST(curitem).next) {
IDL_tree curop = IDL_LIST(curitem).data;
switch(IDL_NODE_TYPE(curop)) {
case IDLN_OP_DCL:
{
/* Check if the current method (introduced by some parent) is the one to be
overriden. */
if(!strcmp(overridenMethodName, IDL_IDENT(IDL_OP_DCL(curop).ident).str)){
IDL_tree sub;
g_assert (IDL_NODE_TYPE(curop) == IDLN_OP_DCL);
/* return typespec */
orbit_cbe_write_param_typespec (ioi->of, curop);
/* The methodname */
fprintf (ioi->of, " %s%s_%s", "NOMLINK impl_",
ioi->chrClassName, overridenMethodName);
fprintf (ioi->of, "(%s* nomSelf, ", ioi->chrClassName);
/* Write the params including the typespec */
for (sub = IDL_OP_DCL (curop).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
IDL_tree parm = IDL_LIST (sub).data;
orbit_cbe_write_param_typespec (ioi->of, parm);
fprintf (ioi->of, " %s, ", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str);
}
if (IDL_OP_DCL (curop).context_expr)
fprintf (ioi->of, "CORBA_Context _ctx, ");
fprintf (ioi->of, "CORBA_Environment *ev)");
}
break;
}
default:
break;
}
}
}
示例6: add_interface_maybe
/*
* If p is an ident for an interface, and we don't have an entry in the
* interface map yet, add one.
*/
static gboolean
add_interface_maybe(IDL_tree_func_data *tfd, gpointer user_data)
{
TreeState *state = user_data;
IDL_tree up;
if (IDL_NODE_TYPE(tfd->tree) == IDLN_IDENT) {
IDL_tree_type node_type = IDL_NODE_TYPE((up = IDL_NODE_UP(tfd->tree)));
if (node_type == IDLN_INTERFACE || node_type == IDLN_FORWARD_DCL) {
/* We only want to add a new entry if there is no entry by this
* name or if the previously found entry was just a forward
* declaration and the new entry is not.
*/
char *iface = IDL_IDENT(tfd->tree).str;
NewInterfaceHolder *old_holder = (NewInterfaceHolder *)
g_hash_table_lookup(IFACE_MAP(state), iface);
if (old_holder && old_holder->is_forward_dcl &&
node_type != IDLN_FORWARD_DCL)
{
g_hash_table_remove(IFACE_MAP(state), iface);
DeleteNewInterfaceHolder(old_holder);
old_holder = NULL;
}
if (!old_holder) {
/* XXX should we parse here and store a struct nsID *? */
char *iid = (char *)IDL_tree_property_get(tfd->tree, "uuid");
char *name_space = (char *)
IDL_tree_property_get(tfd->tree, "namespace");
NewInterfaceHolder *holder =
CreateNewInterfaceHolder(iface, name_space, iid,
(gboolean) node_type == IDLN_FORWARD_DCL);
if (!holder)
return FALSE;
g_hash_table_insert(IFACE_MAP(state),
holder->full_name, holder);
IFACES(state)++;
#ifdef DEBUG_shaver_ifaces
fprintf(stderr, "adding interface #%d: %s/%s\n", IFACES(state),
iface, iid[0] ? iid : "<unresolved>");
#endif
}
} else {
#ifdef DEBUG_shaver_ifaces
fprintf(stderr, "ident %s isn't an interface (%s)\n",
IDL_IDENT(tfd->tree).str, IDL_NODE_TYPE_NAME(up));
#endif
}
}
return TRUE;
}
示例7: MateCORBA_imodule_get_struct_members
static CORBA_StructMemberSeq *
MateCORBA_imodule_get_struct_members (GHashTable *typecodes,
IDL_tree tree,
CORBA_Environment *ev)
{
CORBA_StructMemberSeq *members;
IDL_tree l;
int num_members = 0;
int i;
g_return_val_if_fail (IDL_NODE_TYPE (tree) == IDLN_TYPE_STRUCT ||
IDL_NODE_TYPE (tree) == IDLN_EXCEPT_DCL, NULL);
for (l = IDL_TYPE_STRUCT (tree).member_list; l; l = IDL_LIST (l).next)
num_members += IDL_list_length (IDL_MEMBER (IDL_LIST (l).data).dcls);
members = CORBA_StructMemberSeq__alloc ();
members->_length = members->_maximum = num_members;
members->_buffer = CORBA_StructMemberSeq_allocbuf (members->_length);
members->_release = CORBA_TRUE;
for (i = 0, l = IDL_TYPE_STRUCT (tree).member_list; l; l = IDL_LIST (l).next) {
CORBA_TypeCode subtc;
IDL_tree dcl;
subtc = MateCORBA_imodule_get_typecode (
typecodes, IDL_MEMBER (IDL_LIST (l).data).type_spec);
for (dcl = IDL_MEMBER (IDL_LIST (l).data).dcls; dcl;
dcl = IDL_LIST (dcl).next, i++) {
CORBA_StructMember *member = &members->_buffer [i];
CORBA_string name;
if (IDL_NODE_TYPE (dcl) == IDLN_IDENT)
name = IDL_IDENT (dcl).str;
else /* IDLN_TYPE_ARRAY */
name = IDL_IDENT (IDL_TYPE_ARRAY (dcl).ident).str;
member->name = CORBA_string_dup (name);
member->type = (CORBA_TypeCode)
CORBA_Object_duplicate ((CORBA_Object) subtc, ev);
member->type_def = CORBA_OBJECT_NIL; /* Not used? */
}
CORBA_Object_release ((CORBA_Object) subtc, ev);
}
g_assert (i == num_members);
return members;
}
示例8: do_typedef
static gboolean
do_typedef(TreeState *state)
{
IDL_tree type = IDL_TYPE_DCL(state->tree).type_spec;
IDL_tree dcls = IDL_TYPE_DCL(state->tree).dcls;
IDL_tree complex;
GSList *doc_comments;
if (IDL_NODE_TYPE(type) == IDLN_TYPE_SEQUENCE) {
XPIDL_WARNING((state->tree, IDL_WARNING1,
"sequences not supported, ignored"));
} else {
if (IDL_NODE_TYPE(complex = IDL_LIST(dcls).data) == IDLN_TYPE_ARRAY) {
IDL_tree dim = IDL_TYPE_ARRAY(complex).size_list;
doc_comments = IDL_IDENT(IDL_TYPE_ARRAY(complex).ident).comments;
if (doc_comments != NULL)
printlist(state->file, doc_comments);
fputs("typedef ", state->file);
if (!write_type(type, FALSE, state->file))
return FALSE;
fputs(" ", state->file);
fprintf(state->file, "%s",
IDL_IDENT(IDL_TYPE_ARRAY(complex).ident).str);
do {
fputc('[', state->file);
if (IDL_LIST(dim).data) {
fprintf(state->file, "%ld",
(long)IDL_INTEGER(IDL_LIST(dim).data).value);
}
fputc(']', state->file);
} while ((dim = IDL_LIST(dim).next) != NULL);
} else {
doc_comments = IDL_IDENT(IDL_LIST(dcls).data).comments;
if (doc_comments != NULL)
printlist(state->file, doc_comments);
fputs("typedef ", state->file);
if (!write_type(type, FALSE, state->file))
return FALSE;
fputs(" ", state->file);
fputs(IDL_IDENT(IDL_LIST(dcls).data).str, state->file);
}
fputs(";\n\n", state->file);
}
return TRUE;
}
示例9: orte_idl_attr_fake_ops
void
orte_idl_attr_fake_ops(IDL_tree attr, IDL_ns ns)
{
IDL_tree attr_name, ident, curnode, op1, op2, intf;
GString *attrname;
OIDL_Attr_Info *setme;
g_assert(attr && IDL_NODE_TYPE(attr) == IDLN_ATTR_DCL);
attrname = g_string_new(NULL);
for(curnode = IDL_ATTR_DCL(attr).simple_declarations; curnode; curnode = IDL_LIST(curnode).next) {
op1 = op2 = NULL;
attr_name = IDL_LIST(curnode).data;
g_string_printf(attrname, "_get_%s",
IDL_IDENT(attr_name).str);
ident = IDL_ident_new(g_strdup(attrname->str));
IDL_IDENT_TO_NS(ident) = IDL_IDENT_TO_NS(attr_name);
op1 = IDL_op_dcl_new(0, IDL_ATTR_DCL(attr).param_type_spec, ident, NULL, NULL, NULL);
IDL_NODE_UP(op1) = IDL_NODE_UP(attr);
intf = IDL_NODE_UP (IDL_NODE_UP (op1));
IDL_NS(ns).current = IDL_IDENT_TO_NS (IDL_INTERFACE (intf).ident);
IDL_ns_place_new(ns, ident);
if(!IDL_ATTR_DCL(attr).f_readonly) {
g_string_printf(attrname, "_set_%s",
IDL_IDENT(attr_name).str);
ident = IDL_ident_new(g_strdup(attrname->str));
IDL_IDENT_TO_NS(ident) = IDL_IDENT_TO_NS(attr_name);
op2 = IDL_op_dcl_new(0, NULL, ident, NULL, NULL, NULL);
IDL_NODE_UP(op2) = IDL_NODE_UP(attr);
intf = IDL_NODE_UP (IDL_NODE_UP (op2));
IDL_NS(ns).current = IDL_IDENT_TO_NS (IDL_INTERFACE (intf).ident);
IDL_ns_place_new(ns, ident);
IDL_OP_DCL(op2).parameter_dcls = IDL_list_new(
IDL_param_dcl_new(IDL_PARAM_IN,
IDL_ATTR_DCL(attr).param_type_spec,
IDL_ident_new(g_strdup("value"))));
}
setme = g_new0(OIDL_Attr_Info, 1);
setme->op1 = op1;
setme->op2 = op2;
attr_name->data = setme;
}
g_string_free(attrname, TRUE);
}
示例10: VoyagerOutputOverridenMethodTemplate
static void
VoyagerOutputOverridenMethodTemplate(IDL_tree curif, InheritedOutputInfo2 *ioi)
{
char *id, *realid;
IDL_tree curitem;
char* overridenMethodName;
if(curif == ioi->realif)
return;
overridenMethodName=ioi->chrOverridenMethodName;
realid = IDL_ns_ident_to_qstring(IDL_IDENT_TO_NS(IDL_INTERFACE(ioi->realif).ident), "_", 0);
id = IDL_ns_ident_to_qstring(IDL_IDENT_TO_NS(IDL_INTERFACE(curif).ident), "_", 0);
for(curitem = IDL_INTERFACE(curif).body; curitem; curitem = IDL_LIST(curitem).next) {
IDL_tree curop = IDL_LIST(curitem).data;
switch(IDL_NODE_TYPE(curop)) {
case IDLN_OP_DCL:
{
/* Check if the current method (introduced by some parent) is the one to be
overriden. */
if(!strcmp(overridenMethodName, IDL_IDENT(IDL_OP_DCL(curop).ident).str)){
fprintf(ioi->of, "/* Call parent */\n");
fprintf(ioi->of, "/* %s_%s_parent_resolved()*/\n",
realid, IDL_IDENT(IDL_OP_DCL(curop).ident).str);
#if 0
fprintf(ioi->of, "#define %s_%s() \\\n %s_%s()\n",
realid, IDL_IDENT(IDL_OP_DCL(curop).ident).str,
id, IDL_IDENT(IDL_OP_DCL(curop).ident).str);
#endif
}
break;
}
default:
break;
}
}
g_free(id);
g_free(realid);
}
示例11: typelib_const_dcl
static gboolean
typelib_const_dcl(TreeState *state)
{
struct _IDL_CONST_DCL *dcl = &IDL_CONST_DCL(state->tree);
const char *name = IDL_IDENT(dcl->ident).str;
gboolean is_long;
gboolean sign;
IDL_tree real_type;
XPTInterfaceDescriptor *id;
XPTConstDescriptor *cd;
IDL_longlong_t value;
if (!verify_const_declaration(state->tree))
return FALSE;
/* Could be a typedef; try to map it to the real type. */
real_type = find_underlying_type(dcl->const_type);
real_type = real_type ? real_type : dcl->const_type;
is_long = (IDL_TYPE_INTEGER(real_type).f_type == IDL_INTEGER_TYPE_LONG);
id = CURRENT(state);
if (!XPT_InterfaceDescriptorAddConsts(ARENA(state), id, 1))
return FALSE;
cd = &id->const_descriptors[NEXT_CONST(state)];
cd->name = IDL_IDENT(dcl->ident).str;
#ifdef DEBUG_shaver_const
fprintf(stderr, "DBG: adding const %s\n", cd->name);
#endif
if (!fill_td_from_type(state, &cd->type, dcl->const_type))
return FALSE;
value = IDL_INTEGER(dcl->const_exp).value;
sign = IDL_TYPE_INTEGER(dcl->const_type).f_signed;
if (is_long) {
if (sign)
cd->value.i32 = value;
else
cd->value.ui32 = value;
} else {
if (sign)
cd->value.i16 = value;
else
cd->value.ui16 = value;
}
NEXT_CONST(state)++;
return TRUE;
}
示例12: coder_get_type_info
static gboolean coder_get_type_info(IDL_tree tree, int attr, TypeInfo* type)
{
const char* name = "";
type->attr = attr;
if(attr == IDL_PARAM_INOUT)
{
assert(!"Not supported.");
}
memset(type, 0x00, sizeof(TypeInfo));
if(IDL_NODE_IS_TYPE(tree))
{
switch(IDL_NODE_TYPE(tree))
{
case IDLN_TYPE_INTEGER:
{
name = "int";
break;
}
case IDLN_TYPE_STRING:
{
name = "String";
break;
}
default:
{
assert(!"Not supported");
break;
}
}
}
else if(IDL_NODE_TYPE(tree) == IDLN_IDENT)
{
name = IDL_IDENT(tree).str;
}
strcat(type->org_name, name);
if(strcmp(name, "int") == 0)
{
strcat(type->name, "int");
}
else if(strcmp(name, "String") == 0)
{
strcat(type->name, attr == IDL_PARAM_OUT ? "" : "const ");
strcat(type->name, "char*");
}
else if(strcmp(name, "FBusBinary") == 0)
{
type->is_binary = TRUE;
}
else
{
strcat(type->name, attr == IDL_PARAM_OUT ? "" : "const ");
strcat(type->name, name);
strcat(type->name, attr == IDL_PARAM_IN ? "*" : "");
}
return TRUE;
}
示例13: MateCORBA_imodule_setup_label_any
static void
MateCORBA_imodule_setup_label_any (CORBA_TypeCode tc,
IDL_tree node,
CORBA_any *label)
{
if (!node) { /* default case */
label->_type = TC_CORBA_octet;
label->_value = MateCORBA_small_alloc (TC_CORBA_octet);
*(CORBA_octet *) label->_value = -1;
return;
}
label->_type = (CORBA_TypeCode)
CORBA_Object_duplicate (
(CORBA_Object) tc, NULL);
label->_value = MateCORBA_small_alloc (tc);
switch (IDL_NODE_TYPE (node)) {
case IDLN_BOOLEAN:
case IDLN_CHAR:
case IDLN_INTEGER:
MateCORBA_imodule_jam_int (node, tc, label->_value);
break;
case IDLN_FLOAT:
g_assert (tc->kind == CORBA_tk_float);
*(CORBA_float *) label->_value = IDL_FLOAT (node).value;
break;
case IDLN_BINOP: /* drop through */
case IDLN_UNARYOP: {
IDL_tree val;
if (IDL_NODE_TYPE (node) == IDLN_BINOP)
val = _IDL_binop_eval (IDL_BINOP (node).op,
IDL_BINOP (node).left,
IDL_BINOP (node).right);
else
val = _IDL_unaryop_eval (IDL_BINOP (node).op,
IDL_UNARYOP (node).operand);
MateCORBA_imodule_jam_int (val, tc, label->_value);
IDL_tree_free (val);
break;
}
case IDLN_IDENT: {
CORBA_long val;
g_assert (label->_type->kind == CORBA_tk_enum);
for (val = 0; val < label->_type->sub_parts; val++)
if (!strcmp (IDL_IDENT (node).str, label->_type->subnames [val]))
break;
g_assert (val < label->_type->sub_parts);
*(CORBA_long *) label->_value = val;
break;
}
default:
g_assert_not_reached ();
break;
}
}
示例14: find_arg_with_name
static gboolean
find_arg_with_name(TreeState *state, const char *name, int16 *argnum)
{
int16 count;
IDL_tree params;
XPT_ASSERT(state);
XPT_ASSERT(name);
XPT_ASSERT(argnum);
params = IDL_OP_DCL(IDL_NODE_UP(IDL_NODE_UP(state->tree))).parameter_dcls;
for (count = 0;
params != NULL && IDL_LIST(params).data != NULL;
params = IDL_LIST(params).next, count++)
{
const char *cur_name = IDL_IDENT(
IDL_PARAM_DCL(IDL_LIST(params).data).simple_declarator).str;
if (!strcmp(cur_name, name)) {
/* XXX ought to verify that this is the right type here */
/* XXX for iid_is this must be an iid */
/* XXX for size_is and length_is this must be a uint32 */
*argnum = count;
return TRUE;
}
}
return FALSE;
}
示例15: orbit_cbe_flatten_args
void
orbit_cbe_flatten_args (IDL_tree tree, FILE *of, const char *name)
{
int i = 0;
IDL_tree l;
for (l = IDL_OP_DCL(tree).parameter_dcls; l;
l = IDL_LIST(l).next)
i++;
fprintf (of, "gpointer %s[%d];\n", name, i);
i = 0;
for (l = IDL_OP_DCL(tree).parameter_dcls; l;
l = IDL_LIST(l).next) {
IDL_tree decl = IDL_LIST (l).data;
IDL_tree tspec = orbit_cbe_get_typespec (decl);
IDL_ParamRole r = 0;
switch(IDL_PARAM_DCL(decl).attr) {
case IDL_PARAM_IN: r = DATA_IN; break;
case IDL_PARAM_INOUT: r = DATA_INOUT; break;
case IDL_PARAM_OUT: r = DATA_OUT; break;
default:
g_error("Unknown IDL_PARAM type");
}
fprintf (of, "%s[%d] = %s%s;\n",
name, i,
orbit_cbe_flatten_ref (r, tspec),
IDL_IDENT (IDL_PARAM_DCL (decl).simple_declarator).str);
i++;
}
}