#include "forb-idl-c-backend.h"
#include <string.h>
+#include <inttypes.h>
/**
*
int indent = 0, i;
GString *id = g_string_new("");
char *serialize = (serialization == SERIALIZE) ? "serialize" : "deserialize";
+ gboolean use_ampersand = TRUE;
- //forb_idl_print_node(ts, 0);
-
switch(IDL_NODE_TYPE(name)) {
case IDLN_IDENT:
fprintf(of, " ");
if (use_name)
g_string_assign(id, IDL_IDENT(name).str);
+
+ if (IDL_NODE_TYPE(forb_cbe_get_typespec(ts)) == IDLN_TYPE_ARRAY)
+ use_ampersand = FALSE;
+
+/* printf("%s%s:\n", var_prefix, use_name ? id->str:""); */
+/* forb_idl_print_node(forb_cbe_get_typespec(ts), 2); */
+
break;
case IDLN_TYPE_ARRAY:
{
indent++;
for (i=0; i<indent+1; i++)
fprintf(of, " ");
- fprintf(of, "for (%c=0; %c<%" IDL_LL "d; %c++) \n",
+ fprintf(of, "for (%c=0; %c<%" PRId64 "; %c++) \n",
var, var, IDL_INTEGER(IDL_LIST(curitem).data).value, var);
var++;
}
}
fprintf(of, "if (!");
forb_cbe_write_typespec(of, ts);
- fprintf(of, "_%s(codec, &%s%s)) goto ser_exception;\n",
- serialize, var_prefix, id->str);
+ fprintf(of, "_%s(codec, %s%s%s)) goto ser_exception;\n",
+ serialize, use_ampersand ? "&":"", var_prefix, id->str);
if (indent)
fprintf(of, " }\n");
case IDLN_LIST:
case IDLN_GENTREE:
case IDLN_MEMBER:
- case IDLN_NATIVE:
case IDLN_CASE_STMT:
case IDLN_MODULE:
case IDLN_BINOP:
case IDLN_IDENT:
case IDLN_INTERFACE:
case IDLN_FORWARD_DCL:
+ case IDLN_NATIVE:
default:
return FALSE;
break;
}
break;
case IDLN_TYPE_FIXED:
- return g_strdup_printf( "CORBA_fixed_%" IDL_LL "d_%" IDL_LL "d",
+ return g_strdup_printf( "CORBA_fixed_%" PRId64 "_%" PRId64 "",
IDL_INTEGER(IDL_TYPE_FIXED(tree).positive_int_const).value,
IDL_INTEGER(IDL_TYPE_FIXED(tree).integer_lit).value);
break;
}
break;
case IDLN_NATIVE:
- retval = "gpointer"; /* FIXME: */
+ retval = forb_cbe_get_typespec_str(IDL_NATIVE(tree).ident);
break;
case IDLN_FORWARD_DCL:
case IDLN_INTERFACE:
g_string_printf(tmpstr, "%f", IDL_FLOAT(tree).value);
break;
case IDLN_INTEGER:
- g_string_printf(tmpstr, "%" IDL_LL "d", IDL_INTEGER(tree).value);
+ g_string_printf(tmpstr, "%" PRId64 "", IDL_INTEGER(tree).value);
break;
case IDLN_STRING:
g_string_printf(tmpstr, "\"%s\"", IDL_STRING(tree).value);