break;
case IDLN_TYPE_ARRAY:
break;
- case IDLN_TYPE_SEQUENCE:
- fprintf(ci->fh, " ");
- fprintf(ci->fh, "if (CORBA_sequence_get_release(%s%s)) { forb_free(%s%s_buffer); }\n",
- n==2?"":"&",name, name, n==2?"->":".");
+ case IDLN_TYPE_SEQUENCE: {
+ char *dot = n==2?"->":".";
+ IDL_tree simple_type = forb_cbe_get_typespec(IDL_TYPE_SEQUENCE(type_spec).simple_type_spec);
+
+ fprintf(ci->fh, " if (CORBA_sequence_get_release(%s%s)) {\n",
+ n==2?"":"&",name);
+ if (IDLN_NATIVE == IDL_NODE_TYPE(simple_type)) {
+ fprintf(ci->fh, " int i;\n"
+ " for (i=0; i<%s%s_length; i++)\n"
+ " %s_free(%s%s_buffer[i]);\n",
+ name, dot, forb_cbe_get_typespec_str(IDL_NATIVE(type_spec).ident),
+ name, dot);
+ }
+ fprintf(ci->fh, " forb_free(%s%s_buffer);\n"
+ " }\n", name, dot);
+ if (n==2) {
+ fprintf(ci->fh, " ");
+ fprintf(ci->fh, "forb_free(%s);\n", name);
+ }
break;
+ }
case IDLN_NATIVE:
fprintf(ci->fh, " ");
fprintf(ci->fh, "%s_free(%s);\n",
char *id, *id_plain;
IDL_tree sub;
gboolean has_retval, has_args;
+ const char *const seq_init = " = {0,0,NULL}";
has_retval = IDL_OP_DCL (op).op_type_spec != NULL;
has_args = IDL_OP_DCL (op).parameter_dcls != NULL;
id = IDL_ns_ident_to_qstring(IDL_IDENT_TO_NS(IDL_OP_DCL(op).ident), "_", 0);
id_plain = IDL_IDENT(IDL_OP_DCL(op).ident).str;
fprintf(ci->fh, "static void\n"
- "forb_skel_%s(CDR_Codec *cin, CDR_Codec *cout, %s _obj, struct forb_env *env)\n"
+ "forb_skel_%s(FORB_CDR_Codec *cin, FORB_CDR_Codec *cout, %s _obj, struct forb_env *env)\n"
"{\n",
id, intf_id);
/* fprintf(ci->fh, " if (_obj->interface != %s_interface) {\n", intf_id); */
fprintf(ci->fh, " ");
forb_cbe_write_typespec(ci->fh, IDL_PARAM_DCL(parm).param_type_spec);
- fprintf(ci->fh, " %s%s;\n", n == 2 ? "*":"", name);
+ fprintf(ci->fh, " %s%s%s;\n",
+ n == 2 ? "*":"",
+ name,
+ (n < 2 && IDL_NODE_TYPE(ts) == IDLN_TYPE_SEQUENCE)?seq_init : "");
}
if (has_retval) {
fprintf (ci->fh, " ");
forb_cbe_write_param_typespec (ci->fh, op);
- fprintf (ci->fh, " _forb_ret;\n");
+ fprintf (ci->fh, " _forb_ret;\n"); /* TODO: seq_init */
}
/* Deserialize in parameters */
role = oidl_attr_to_paramrole(IDL_PARAM_DCL(parm).attr);
if (role == DATA_IN || role == DATA_INOUT) {
char *name = IDL_IDENT(IDL_PARAM_DCL(parm).simple_declarator).str;
- fprintf(ci->fh, /* " r = " */ " ");
+ fprintf(ci->fh, " if (!");
forb_cbe_write_typespec(ci->fh, IDL_PARAM_DCL(parm).param_type_spec);
- if (IDL_NODE_TYPE(forb_cbe_get_typespec(parm)) == IDLN_INTERFACE) {
- fprintf(ci->fh, "_deserialize(cin, &%s, _obj->orb);\n", name);
- } else {
- fprintf(ci->fh, "_deserialize(cin, &%s);\n", name);
- }
-/* fprintf(ci->fh, " if (!r) { ev->major = FORB_EX_IMP_LIMIT; goto exception; }\n"); */
+ fprintf(ci->fh, "_deserialize(cin, &%s)) {\n", name);
+ fprintf(ci->fh, " env->major = FORB_EX_MARSHAL; goto exception;\n }\n");
}
}
}
fprintf(ci->fh, "env);\n");
fprintf(ci->fh,
- " if (forb_exception_occured(env)) goto exception;\n");
+ " if (forb_exception_occurred(env)) goto exception;\n");
if (has_retval) {
fprintf(ci->fh, " ");
forb_cbe_write_typespec(ci->fh, IDL_OP_DCL(op).op_type_spec);