mods to omniidl2 for msvc compiles
Matthew Newhook
matthew_newhook@stratos.ca
Thu, 3 Jul 1997 15:28:59 -0230
Hi,
As promised here are the diffs for omniidl2 to enable the generation
of code from .idl files that compile under both Solaris and MSVC.
I have no reason to believe that the generated code won't compile
under other platforms, but I haven't got access so no promises.
I think that I have all of the cases, but it's quite possible that
I've missed some. Currently about ~4k lines idl files that we use
all compile and work under both Solaris and NT.
In order to get around MSVC bugs the following changes were made:
- instead of always fully qualifying the name the name qualification
is based on the scope of the current definition. It emits
as little as possible of the scope.
ie.
module x
{
struct y
{
};
interface z
{
void zz(in y yy);
}
}
used to produce
class x
{
public:
struct y
{
};
class z
{
public:
virtual void zz(const x::y& yy);
};
};
Now it produces:
class x
{
public:
struct y
{
};
class z
{
public:
virtual void zz(const y& yy);
};
};
It takes into the account the case of:
module x
{
struct y
{
};
interface z
{
void zz(in y yy);
}
}
module x2
{
interface z2
{
void zz(in x::y yy);
}
};
Changes were necessary in the generated skeleton code also. If you need
more details I can provide the necessary info.
Diffs follow:
----
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be.h /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be.h
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be.h Tue May 6 11:17:56 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be.h Mon Jun 30 14:29:41 1997
@@ -75,6 +75,8 @@
static char *narrow_and_produce__scopename(AST_Decl *type);
static char *narrow_and_produce_uqname(AST_Decl *type);
+ void emit_sfqname(fstream& s, const char* fqname);
+
private:
o2be_name();
@@ -461,11 +463,13 @@
void produce_decl_rd(fstream &s,
const char *prefix = 0,
- idl_bool out_var_default = I_TRUE);
+ idl_bool out_var_default = I_TRUE,
+ idl_bool in_header = I_TRUE);
void produce_decl_wr(fstream &s,
const char *prefix = 0,
- idl_bool out_var_default = I_TRUE);
+ idl_bool out_var_default = I_TRUE,
+ idl_bool in_header = I_TRUE);
void produce_proxy_rd_skel(fstream &s,o2be_interface &defined_in);
// produce the definition of the proxy's method to get this attribute
@@ -507,6 +511,7 @@
void produce_decl(fstream &s,
const char *prefix = 0,
const char *alias_prefix = 0,
+ idl_bool in_header = I_TRUE,
idl_bool out_var_default = I_TRUE);
// produce the declaration of the mapping of this operation
@@ -577,7 +582,7 @@
static
void declareVarType(fstream &s, AST_Decl *decl, idl_bool is_var=0,
- idl_bool is_arrayslice=0);
+ idl_bool is_arrayslice=0, idl_bool in_header = 1);
static
void produceUnMarshalCode(fstream &s, AST_Decl *decl,
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_array.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_array.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_array.cc Tue May 6 11:19:12 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_array.cc Fri Jun 27 13:51:58 1997
@@ -27,6 +27,9 @@
/*
$Log: o2be_array.cc,v $
+// Revision 1.1 1997/06/27 16:21:03 matthew
+// Initial revision
+//
// Revision 1.5 1997/05/06 13:49:08 sll
// Public release.
//
@@ -263,7 +266,7 @@
break;
#endif
default:
- elm_fqname = o2be_name::narrow_and_produce_fqname(decl);
+ elm_fqname = o2be_name::narrow_and_produce_uqname(decl);
break;
}
@@ -568,7 +571,7 @@
break;
#endif
default:
- elm_fqname = o2be_name::narrow_and_produce_fqname(decl);
+ elm_fqname = o2be_name::narrow_and_produce_uqname(decl);
break;
}
@@ -644,7 +647,7 @@
break;
#endif
default:
- elm_fqname = o2be_name::narrow_and_produce_fqname(decl);
+ elm_fqname = o2be_name::narrow_and_produce_uqname(decl);
break;
}
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_attribute.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_attribute.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_attribute.cc Tue May 6 11:20:34 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_attribute.cc Fri Jun 27 17:34:43 1997
@@ -27,6 +27,9 @@
/*
$Log: o2be_attribute.cc,v $
+// Revision 1.1 1997/06/27 16:21:07 matthew
+// Initial revision
+//
// Revision 1.8 1997/05/06 13:50:29 sll
// Public release.
//
@@ -49,7 +52,8 @@
void
o2be_attribute::produce_decl_rd(fstream &s,const char *prefix,
- idl_bool out_var_default)
+ idl_bool out_var_default,
+ idl_bool in_header)
{
o2be_operation::argMapping mapping;
o2be_operation::argType ntype = o2be_operation::ast2ArgMapping(field_type(),
@@ -59,13 +63,19 @@
while (decl->node_type() == AST_Decl::NT_typedef) {
decl = o2be_typedef::narrow_from_decl(decl)->base_type();
}
- s << o2be_interface::narrow_from_decl(decl)->objref_fqname();
+ if (in_header)
+ s << o2be_interface::narrow_from_decl(decl)->objref_uqname();
+ else
+ s << o2be_interface::narrow_from_decl(decl)->objref_fqname();
}
else if (ntype == o2be_operation::tString) {
s << "char *";
}
else {
- s << o2be_name::narrow_and_produce_fqname(field_type());
+ if (in_header)
+ s << o2be_name::narrow_and_produce_uqname(field_type());
+ else
+ s << o2be_name::narrow_and_produce_fqname(field_type());
}
s << ((mapping.is_arrayslice) ? "_slice":"")
<< " "
@@ -80,7 +90,8 @@
void
o2be_attribute::produce_decl_wr(fstream &s,const char *prefix,
- idl_bool out_var_default)
+ idl_bool out_var_default,
+ idl_bool in_header)
{
o2be_operation::argMapping mapping;
o2be_operation::argType ntype = o2be_operation::ast2ArgMapping(field_type(),
@@ -95,13 +106,19 @@
while (decl->node_type() == AST_Decl::NT_typedef) {
decl = o2be_typedef::narrow_from_decl(decl)->base_type();
}
- s << o2be_interface::narrow_from_decl(decl)->objref_fqname();
+ if (in_header)
+ s << o2be_interface::narrow_from_decl(decl)->objref_uqname();
+ else
+ s << o2be_interface::narrow_from_decl(decl)->objref_fqname();
}
else if (ntype == o2be_operation::tString) {
s << "char *";
}
else {
- s << o2be_name::narrow_and_produce_fqname(field_type());
+ if (in_header)
+ s << o2be_name::narrow_and_produce_uqname(field_type());
+ else
+ s << o2be_name::narrow_and_produce_fqname(field_type());
}
s << ((mapping.is_arrayslice) ? "_slice":"")
<< " "
@@ -116,7 +133,7 @@
{
idl_bool hasVariableLenOutArgs = I_FALSE;
- IND(s); produce_decl_rd(s,defined_in.proxy_fqname(),I_FALSE);
+ IND(s); produce_decl_rd(s,defined_in.proxy_fqname(),I_FALSE, I_FALSE);
s << " {\n";
INC_INDENT_LEVEL();
IND(s); s << "assertObjectExistent();\n";
@@ -399,7 +416,7 @@
{
idl_bool hasVariableLenOutArgs = I_FALSE;
- IND(s); produce_decl_wr(s,defined_in.proxy_fqname(),I_FALSE);
+ IND(s); produce_decl_wr(s,defined_in.proxy_fqname(),I_FALSE,I_FALSE);
s << " {\n";
INC_INDENT_LEVEL();
IND(s); s << "assertObjectExistent();\n";
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_exception.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_exception.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_exception.cc Tue May 6 11:24:52 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_exception.cc Thu Jul 3 10:00:30 1997
@@ -25,6 +25,9 @@
/*
$Log: o2be_exception.cc,v $
+// Revision 1.1 1997/06/25 15:04:25 matthew
+// Initial revision
+//
// Revision 1.4 1997/05/06 13:54:46 sll
// Public release.
//
@@ -76,7 +79,7 @@
{
while (decl->node_type() == AST_Decl::NT_typedef)
decl = o2be_typedef::narrow_from_decl(decl)->base_type();
- s << o2be_interface::narrow_from_decl(decl)->fieldMemberType_fqname();
+ s << o2be_interface::narrow_from_decl(decl)->fieldMemberType_uqname();
}
break;
default:
@@ -108,13 +111,13 @@
s << ((mapping.is_const) ? "const ":"");
if (ntype == o2be_operation::tObjref) {
- s << o2be_interface::narrow_from_decl(decl)->objref_fqname();
+ s << o2be_interface::narrow_from_decl(decl)->objref_uqname();
}
else if (ntype == o2be_operation::tString) {
s << "char* ";
}
else {
- s << o2be_name::narrow_and_produce_fqname(decl)
+ s << o2be_name::narrow_and_produce_uqname(decl)
<< ((mapping.is_arrayslice) ? "_slice":"")
<< " "
<< ((mapping.is_pointer) ? "*":"")
@@ -240,7 +243,7 @@
s << "char* ";
}
else {
- s << o2be_name::narrow_and_produce_fqname(decl)
+ s << o2be_name::narrow_and_produce_uqname(decl)
<< ((mapping.is_arrayslice) ? "_slice":"")
<< " "
<< ((mapping.is_pointer) ? "*":"")
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_interface.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_interface.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_interface.cc Tue May 6 11:28:57 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_interface.cc Thu Jul 3 10:00:43 1997
@@ -27,6 +27,9 @@
/*
$Log: o2be_interface.cc,v $
+// Revision 1.1 1997/06/27 17:31:12 matthew
+// Initial revision
+//
// Revision 1.9 1997/05/06 13:58:53 sll
// Public release.
//
@@ -142,14 +145,14 @@
strcat(pd_fieldmem_uqname,"_Helper");
strcat(pd_fieldmem_uqname,">");
- pd_fieldmem_fqname = new char[strlen(fqname())+
- strlen(fqname())+strlen("_Helper")+
+ pd_fieldmem_fqname = new char[strlen(uqname())+
+ strlen(uqname())+strlen("_Helper")+
strlen(FIELD_MEMBER_TEMPLATE)+4];
strcpy(pd_fieldmem_fqname,FIELD_MEMBER_TEMPLATE);
strcat(pd_fieldmem_fqname,"<");
- strcat(pd_fieldmem_fqname,fqname());
+ strcat(pd_fieldmem_fqname,uqname());
strcat(pd_fieldmem_fqname,",");
- strcat(pd_fieldmem_fqname,fqname());
+ strcat(pd_fieldmem_fqname,uqname());
strcat(pd_fieldmem_fqname,"_Helper");
strcat(pd_fieldmem_fqname,">");
@@ -160,33 +163,33 @@
pd_inout_adptarg_name = new char[strlen(ADPT_INOUT_CLASS_TEMPLATE)+
strlen("<,, >")+
- strlen(fqname())+
- strlen(fqname())+strlen("_var")+
- strlen(pd_fieldmem_fqname)+1];
+ strlen(uqname())+
+ strlen(uqname())+strlen("_var")+
+ strlen(pd_fieldmem_uqname)+1];
strcpy(pd_inout_adptarg_name,ADPT_INOUT_CLASS_TEMPLATE);
strcat(pd_inout_adptarg_name,"<");
- strcat(pd_inout_adptarg_name,fqname());
+ strcat(pd_inout_adptarg_name,uqname());
strcat(pd_inout_adptarg_name,",");
- strcat(pd_inout_adptarg_name,fqname());
+ strcat(pd_inout_adptarg_name,uqname());
strcat(pd_inout_adptarg_name,"_var,");
- strcat(pd_inout_adptarg_name,pd_fieldmem_fqname);
+ strcat(pd_inout_adptarg_name,pd_fieldmem_uqname);
strcat(pd_inout_adptarg_name," >");
pd_out_adptarg_name = new char[strlen(ADPT_OUT_CLASS_TEMPLATE)+
strlen("<,,, >")+
- strlen(fqname())+
- strlen(fqname())+strlen("_var")+
- strlen(pd_fieldmem_fqname)+
- strlen(fqname())+strlen("_Helper")+1];
+ strlen(uqname())+
+ strlen(uqname())+strlen("_var")+
+ strlen(pd_fieldmem_uqname)+
+ strlen(uqname())+strlen("_Helper")+1];
strcpy(pd_out_adptarg_name,ADPT_OUT_CLASS_TEMPLATE);
strcat(pd_out_adptarg_name,"<");
- strcat(pd_out_adptarg_name,fqname());
+ strcat(pd_out_adptarg_name,uqname());
strcat(pd_out_adptarg_name,",");
- strcat(pd_out_adptarg_name,fqname());
+ strcat(pd_out_adptarg_name,uqname());
strcat(pd_out_adptarg_name,"_var,");
- strcat(pd_out_adptarg_name,pd_fieldmem_fqname);
+ strcat(pd_out_adptarg_name,pd_fieldmem_uqname);
strcat(pd_out_adptarg_name,",");
- strcat(pd_out_adptarg_name,fqname());
+ strcat(pd_out_adptarg_name,uqname());
strcat(pd_out_adptarg_name,"_Helper");
strcat(pd_out_adptarg_name," >");
}
@@ -259,10 +262,10 @@
{
s << "#ifndef __" << _fqname() << "__\n";
s << "#define __" << _fqname() << "__\n";
- IND(s); s << "class " << uqname() << ";\n";
+ IND(s); s << "class " << uqname() << ";\n";
IND(s); s << "typedef " << uqname() << "* " << objref_uqname() << ";\n";
IND(s); s << "typedef " << objref_uqname() << " " << uqname() << "Ref;\n\n";
- IND(s); s << "class " << uqname() << "_Helper {\n";
+ IND(s); s << "class " << uqname() << "_Helper {\n";
INC_INDENT_LEVEL();
IND(s); s << "public:\n";
IND(s); s << "static " << objref_uqname() << " _nil();\n";
@@ -697,7 +700,7 @@
IND(s); s << "virtual CORBA::Object_ptr newProxyObject(Rope *r,CORBA::Octet *key,size_t keysize,IOP::TaggedProfileList *profiles,CORBA::Boolean release);\n";
IND(s); s << "virtual CORBA::Boolean is_a(const char *base_repoId) const;\n";
// _nil()
- IND(s); s << "static " << objref_fqname() << " _nil() {\n";
+ IND(s); s << "static " << objref_uqname() << " _nil() {\n";
INC_INDENT_LEVEL();
IND(s); s << "if (!_" << nil_uqname() << ") {\n";
INC_INDENT_LEVEL();
@@ -710,7 +713,7 @@
DEC_INDENT_LEVEL();
IND(s); s << "private:\n";
INC_INDENT_LEVEL();
- IND(s); s << "static " << objref_fqname() << " _" << nil_uqname() << ";\n";
+ IND(s); s << "static " << objref_uqname() << " _" << nil_uqname() << ";\n";
DEC_INDENT_LEVEL();
IND(s); s << "};\n\n";
@@ -889,7 +892,7 @@
{
o2be_interface * intf = o2be_interface::narrow_from_decl(intftable[j]);
IND(s); s << ((notfirst)?"else ":"")
- << "if (" << intf->server_fqname()
+ << "if (" << intf->server_uqname()
<< "::dispatch(_s,_op,_response_expected)) {\n";
INC_INDENT_LEVEL();
IND(s); s << "return 1;\n";
@@ -993,7 +996,7 @@
{
o2be_interface * intf = o2be_interface::narrow_from_decl(intftable[j]);
IND(s); s << ((j)?"else ":"")
- << "if ((_p = " << intf->fqname()
+ << "if ((_p = " << intf->uqname()
<< "::_widenFromTheMostDerivedIntf(repoId))) {\n";
INC_INDENT_LEVEL();
IND(s); s << "return _p;\n";
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_name.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_name.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_name.cc Tue May 6 11:31:22 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_name.cc Mon Jun 30 17:17:19 1997
@@ -27,6 +27,9 @@
/*
$Log: o2be_name.cc,v $
+// Revision 1.1 1997/06/30 17:00:03 matthew
+// Initial revision
+//
// Revision 1.5 1997/05/06 14:01:18 sll
// Public release.
//
@@ -496,4 +499,49 @@
throw o2be_internal_error(__FILE__,__LINE__,"Unrecognised argument type");
}
return 0; // For MSVC++ 4.2
+}
+
+//
+// emit_sfqname
+// display the `scoped fully qualified name'
+// that is remove any common parts from the fully qualified name.
+//
+// IE.
+// if scope_name is CORBA::, and fqname is CORBA::String
+// then display String.
+//
+void
+o2be_name::emit_sfqname(
+ fstream& s,
+ const char* fqname
+)
+{
+ const char* sn_start = scopename();
+ const char* sn_end;
+ const char* fq_start = fqname;
+ const char* fq_end;
+ do
+ {
+ sn_end = strchr(sn_start, ':');
+ fq_end = strchr(fq_start, ':');
+ if (fq_end != 0 && sn_end != 0)
+ {
+ int fq_len = fq_end - fq_start;
+ if (fq_len == sn_end - sn_start &&
+ strncmp(fq_start, sn_start, fq_len) == 0)
+ {
+ fq_start = fq_end + 2; // skip ::
+ sn_start = sn_end + 2;
+ continue;
+ }
+ }
+ break;
+ }
+ while (sn_end != 0 && fq_end != 0);
+
+ //cout << "scope_name: " << scopename() << endl;
+ //cout << "fqname: " << fqname << endl;
+ //cout << "emitting: " << fq_start << endl;
+
+ s << fq_start;
}
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_operation.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_operation.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_operation.cc Tue May 6 11:33:13 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_operation.cc Wed Jul 2 11:21:55 1997
@@ -28,6 +28,9 @@
/*
$Log: o2be_operation.cc,v $
+// Revision 1.1 1997/06/25 15:31:03 matthew
+// Initial revision
+//
// Revision 1.11 1997/05/06 14:03:08 sll
// Public release.
//
@@ -59,6 +62,7 @@
o2be_operation::produce_decl(fstream &s,
const char *prefix,
const char *alias_prefix,
+ idl_bool in_header,
idl_bool out_var_default /* ignored */)
{
if (context())
@@ -79,13 +83,27 @@
while (decl->node_type() == AST_Decl::NT_typedef) {
decl = o2be_typedef::narrow_from_decl(decl)->base_type();
}
- s << o2be_interface::narrow_from_decl(decl)->objref_fqname();
+ if (in_header)
+ {
+ emit_sfqname(s, o2be_interface::narrow_from_decl(decl)->objref_fqname());
+ }
+ else
+ {
+ s << o2be_interface::narrow_from_decl(decl)->objref_fqname();
+ }
}
else if (ntype == tString) {
s << "char *";
}
else {
- s << o2be_name::narrow_and_produce_fqname(return_type());
+ if (in_header)
+ {
+ emit_sfqname(s, o2be_name::narrow_and_produce_fqname(return_type()));
+ }
+ else
+ {
+ s << o2be_name::narrow_and_produce_fqname(return_type());
+ }
}
s << ((mapping.is_arrayslice) ? "_slice":"")
<< " "
@@ -130,13 +148,13 @@
while (decl->node_type() == AST_Decl::NT_typedef) {
decl = o2be_typedef::narrow_from_decl(decl)->base_type();
}
- s << o2be_interface::narrow_from_decl(decl)->objref_fqname();
+ emit_sfqname(s, o2be_interface::narrow_from_decl(decl)->objref_fqname());
}
else if (ntype == tString) {
s << "char *";
}
else {
- s << o2be_name::narrow_and_produce_fqname(a->field_type());
+ emit_sfqname(s, o2be_name::narrow_and_produce_fqname(a->field_type()));
}
s << ((mapping.is_arrayslice) ? "_slice":"")
<< " "
@@ -175,7 +193,7 @@
{
idl_bool hasVariableLenOutArgs = I_FALSE;
- IND(s); produce_decl(s,defined_in.proxy_fqname(),alias_prefix,I_FALSE);
+ IND(s); produce_decl(s,defined_in.proxy_fqname(),alias_prefix,I_FALSE, I_FALSE);
s << "\n";
IND(s); s << "{\n";
INC_INDENT_LEVEL();
@@ -202,7 +220,7 @@
hasVariableLenOutArgs = I_TRUE;
// Declare a local pointer variable
IND(s);
- declareVarType(s,a->field_type(),0,mapping.is_arrayslice);
+ declareVarType(s,a->field_type(),0,mapping.is_arrayslice, 0);
s << ((ntype != tObjref && ntype != tString)?" *":"")
<< " _" << a->uqname() << "= 0;\n";
}
@@ -220,14 +238,14 @@
{
hasVariableLenOutArgs = I_TRUE;
IND(s);
- declareVarType(s,return_type(),0,mapping.is_arrayslice);
+ declareVarType(s,return_type(),0,mapping.is_arrayslice, 0);
s << ((ntype != tObjref && ntype != tString)?" *":"")
<< " _result" << "= 0;\n";
}
else
{
IND(s);
- declareVarType(s,return_type());
+ declareVarType(s,return_type(), 0, 0, 0);
s << " _result;\n";
}
}
@@ -343,7 +361,7 @@
}
else if (mapping.is_reference && mapping.is_pointer) {
IND(s); s << "_" << a->uqname() << " = new ";
- declareVarType(s,a->field_type());
+ declareVarType(s,a->field_type(), 0, 0, 0);
s << ";\n";
}
}
@@ -366,7 +384,7 @@
}
else if (mapping.is_pointer) {
IND(s); s << "_result = new ";
- declareVarType(s,return_type());
+ declareVarType(s,return_type(), 0, 0, 0);
s << ";\n";
}
}
@@ -401,7 +419,7 @@
strcpy(_argname,"_");
strcat(_argname,a->uqname());
IND(s);
- declareVarType(s,a->field_type(),0,0);
+ declareVarType(s,a->field_type(),0,0,0);
s << " " << _argname << ";\n";
produceUnMarshalCode(s,a->field_type(),"_c",_argname,
ntype,mapping);
@@ -416,7 +434,7 @@
strcpy(_argname,"_");
strcat(_argname,a->uqname());
IND(s);
- declareVarType(s,a->field_type(),0,0);
+ declareVarType(s,a->field_type(),0,0,0);
s << " " << _argname << ";\n";
produceUnMarshalCode(s,a->field_type(),"_c",_argname,
ntype,mapping);
@@ -514,8 +532,9 @@
while (!i.is_done())
{
o2be_exception *excpt = o2be_exception::narrow_from_decl(i.item());
- if (excpt->repoIdConstLen() > maxIdsize)
- maxIdsize = excpt->repoIdConstLen();
+ int len = strlen(excpt->repositoryID())+1;
+ if (len > maxIdsize)
+ maxIdsize = len;
i.next();
}
}
@@ -764,14 +783,14 @@
(mapping.is_pointer))
{
IND(s);
- declareVarType(s,return_type(),0,mapping.is_arrayslice);
+ declareVarType(s,return_type(),0,mapping.is_arrayslice, 0);
s << ((ntype != tObjref && ntype != tString)?" *":"")
<< " _result" << "= 0;\n";
}
else
{
IND(s);
- declareVarType(s,return_type());
+ declareVarType(s,return_type(), 0, 0, 0);
s << " _result";
switch (ntype)
{
@@ -858,9 +877,9 @@
ntype = ast2ArgMapping(a->field_type(),wIN,mapping);
if (ntype == tObjref || ntype == tString)
// declare a <type>_var variable to manage the pointer type
- declareVarType(s,a->field_type(),1);
+ declareVarType(s,a->field_type(),1, 0, 0);
else
- declareVarType(s,a->field_type());
+ declareVarType(s,a->field_type(), 0, 0,0);
s << " " << a->uqname() << ";\n";
produceUnMarshalCode(s,a->field_type(),"_s",a->uqname(),
ntype,mapping);
@@ -874,10 +893,10 @@
(mapping.is_reference && mapping.is_pointer))
{
// declare a <type>_var variable to manage the pointer type
- declareVarType(s,a->field_type(),1,mapping.is_arrayslice);
+ declareVarType(s,a->field_type(),1,mapping.is_arrayslice, 0);
}
else
- declareVarType(s,a->field_type());
+ declareVarType(s,a->field_type(), 0,0,0);
s << " " << a->uqname() << ";\n";
break;
}
@@ -887,10 +906,10 @@
if (ntype == tObjref || ntype == tString)
{
// declare a <type>_var variable to manage the pointer type
- declareVarType(s,a->field_type(),1);
+ declareVarType(s,a->field_type(),1, 0,0);
}
else
- declareVarType(s,a->field_type());
+ declareVarType(s,a->field_type(), 0,0);
s << " " << a->uqname() << ";\n";
produceUnMarshalCode(s,a->field_type(),"_s",a->uqname(),
ntype,mapping);
@@ -912,11 +931,11 @@
(mapping.is_pointer))
{
// declare a <type>_var variable to manage the pointer type
- declareVarType(s,return_type(),1,mapping.is_arrayslice);
+ declareVarType(s,return_type(),1,mapping.is_arrayslice, 0);
}
else
{
- declareVarType(s,return_type());
+ declareVarType(s,return_type(), 0, 0,0);
}
s << " _result;\n";
}
@@ -930,7 +949,8 @@
s << "_result = ";
if (has_variable_out_arg() || has_pointer_inout_arg()) {
// Use the indirection function in the base class
- s << defined_in.fqname() << "::";
+ //s << defined_in.fqname() << "::";
+ s << defined_in.uqname() << "::";
}
produce_invoke(s);
s << ";\n";
@@ -938,7 +958,8 @@
else {
if (has_variable_out_arg() || has_pointer_inout_arg()) {
// Use the indirection function in the base class
- s << defined_in.fqname() << "::";
+ //s << defined_in.fqname() << "::";
+ s << defined_in.uqname() << "::";
}
produce_invoke(s);
s << ";\n";
@@ -966,12 +987,12 @@
IND(s); s << "size_t _msgsize = (size_t) GIOP_S::ReplyHeaderSize();\n";
- produceConstStringSizeCalculation(s,"_msgsize",excpt->repoIdConstLen());
+ int len = strlen(excpt->repositoryID())+1;
+ produceConstStringSizeCalculation(s,"_msgsize", len);
produceSizeCalculation(s,i.item(),"_s","_msgsize","ex",ntype,mapping);
IND(s); s << "_s.InitialiseReply(GIOP::USER_EXCEPTION,(CORBA::ULong)_msgsize);\n";
- produceConstStringMarshalCode(s,"_s",excpt->repoIdConstName(),
- excpt->repoIdConstLen());
+ produceConstStringMarshalCode(s,"_s",excpt->repoIdConstName(), len);
produceMarshalCode(s,i.item(),"_s","ex",ntype,mapping);
IND(s); s << "_s.ReplyCompleted();\n";
IND(s); s << "return 1;\n";
@@ -1154,7 +1175,7 @@
void
o2be_operation::produce_nil_skel(fstream &s,const char* alias_prefix)
{
- IND(s); produce_decl(s,0,alias_prefix);
+ IND(s); produce_decl(s,0,alias_prefix, I_TRUE);
s << "{\n";
INC_INDENT_LEVEL();
IND(s); s << "throw CORBA::BAD_OPERATION(0,CORBA::COMPLETED_NO);\n";
@@ -1168,14 +1189,14 @@
(mapping.is_pointer))
{
IND(s);
- declareVarType(s,return_type(),0,mapping.is_arrayslice);
+ declareVarType(s,return_type(),0,mapping.is_arrayslice, 0);
s << ((ntype != tObjref && ntype != tString)?" *":"")
<< " _result" << "= 0;\n";
}
else
{
IND(s);
- declareVarType(s,return_type());
+ declareVarType(s,return_type(), 0,0,0);
s << " _result";
switch (ntype)
{
@@ -1261,7 +1282,7 @@
indent_pos += 6;
}
else {
- str = o2be_name::narrow_and_produce_fqname(return_type());
+ str = o2be_name::narrow_and_produce_uqname(return_type());
s << str;
indent_pos += strlen(str);
}
@@ -1351,7 +1372,7 @@
s << "char *";
}
else {
- s << o2be_name::narrow_and_produce_fqname(a->field_type());
+ s << o2be_name::narrow_and_produce_uqname(a->field_type());
}
s << ((mapping.is_arrayslice) ? "_slice":"")
<< " "
@@ -1842,7 +1863,7 @@
void
o2be_operation::declareVarType(fstream &s,AST_Decl *decl,idl_bool is_var,
- idl_bool is_arrayslice)
+ idl_bool is_arrayslice, idl_bool in_header)
{
AST_Decl *truetype = decl;
while (truetype->node_type() == AST_Decl::NT_typedef) {
@@ -1852,9 +1873,27 @@
if (truetype->node_type() == AST_Decl::NT_interface)
{
if (!is_var)
- s << o2be_interface::narrow_from_decl(truetype)->objref_fqname();
+ {
+ if (in_header)
+ {
+ s << o2be_interface::narrow_from_decl(truetype)->objref_uqname();
+ }
+ else
+ {
+ s << o2be_interface::narrow_from_decl(truetype)->objref_fqname();
+ }
+ }
else
- s << o2be_name::narrow_and_produce_fqname(truetype) << "_var";
+ {
+ if (in_header)
+ {
+ s << o2be_name::narrow_and_produce_uqname(truetype) << "_var";
+ }
+ else
+ {
+ s << o2be_name::narrow_and_produce_fqname(truetype) << "_var";
+ }
+ }
}
else
if (truetype->node_type() == AST_Decl::NT_string)
@@ -1866,7 +1905,10 @@
}
else
{
- s << o2be_name::narrow_and_produce_fqname(decl);
+ if (in_header)
+ s << o2be_name::narrow_and_produce_uqname(decl);
+ else
+ s << o2be_name::narrow_and_produce_fqname(decl);
if (is_var)
s << "_var";
else
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_sequence.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_sequence.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_sequence.cc Tue May 6 11:35:32 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_sequence.cc Fri Jun 27 15:14:06 1997
@@ -27,6 +27,9 @@
/*
$Log: o2be_sequence.cc,v $
+// Revision 1.1 1997/06/27 17:14:36 matthew
+// Initial revision
+//
// Revision 1.5 1997/05/06 14:05:26 sll
// Public release.
//
@@ -194,7 +197,7 @@
size_t s_max = astExpr2val(max_size());
size_t elmsize = 0;
size_t alignment = 0;
- const char* baseclassname = o2be_name::narrow_and_produce_fqname(base_type());
+ const char* baseclassname = o2be_name::narrow_and_produce_uqname(base_type());
switch (ntype)
{
case o2be_operation::tBoolean:
@@ -227,7 +230,7 @@
AST_Decl *decl = base_type();
while (decl->node_type() == AST_Decl::NT_typedef)
decl = o2be_typedef::narrow_from_decl(decl)->base_type();
- baseclassname = o2be_interface::narrow_from_decl(decl)->fieldMemberType_fqname();
+ baseclassname = o2be_interface::narrow_from_decl(decl)->fieldMemberType_uqname();
break;
}
case o2be_operation::tString:
@@ -576,9 +579,9 @@
strlen(tdef->fqname())*2+strlen("_var")+1];
strcpy(p,SEQUENCE_TEMPLATE_ADPT_CLASS);
strcat(p,"<");
- strcat(p,tdef->fqname());
+ strcat(p,tdef->uqname());
strcat(p,",");
- strcat(p,tdef->fqname());
+ strcat(p,tdef->uqname());
strcat(p,"_var >");
return p;
}
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_struct.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_struct.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_struct.cc Tue May 6 11:38:31 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_struct.cc Mon Jun 30 14:37:15 1997
@@ -120,13 +120,13 @@
pd_skel_produced_in_field = I_FALSE;
pd_out_adptarg_name = new char[strlen(ADPT_CLASS_TEMPLATE)+strlen("<,>")+
- strlen(fqname())+
- strlen(fqname())+strlen("_var")+1];
+ strlen(uqname())+
+ strlen(uqname())+strlen("_var")+1];
strcpy(pd_out_adptarg_name,ADPT_CLASS_TEMPLATE);
strcat(pd_out_adptarg_name,"<");
- strcat(pd_out_adptarg_name,fqname());
+ strcat(pd_out_adptarg_name,uqname());
strcat(pd_out_adptarg_name,",");
- strcat(pd_out_adptarg_name,fqname());
+ strcat(pd_out_adptarg_name,uqname());
strcat(pd_out_adptarg_name,"_var>");
}
@@ -258,10 +258,15 @@
case AST_Decl::NT_interface:
{
if (decl->node_type() == AST_Decl::NT_interface)
- s << o2be_interface::narrow_from_decl(decl)->fieldMemberType_fqname();
+ {
+ emit_sfqname(s, o2be_interface::narrow_from_decl(decl)->fieldMemberType_fqname());
+ }
else
- s << o2be_typedef::narrow_from_decl(decl)->fieldMemberType_fqname();
+ {
+ s << o2be_interface::narrow_from_decl(decl)->fieldMemberType_uqname();
+ }
s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n";
+
break;
}
case AST_Decl::NT_array:
@@ -269,7 +274,7 @@
if (decl->node_type() == AST_Decl::NT_array)
o2be_array::narrow_from_decl(decl)->produce_struct_member_decl(s,d);
else {
- s << o2be_typedef::narrow_from_decl(decl)->fqname();
+ s << o2be_typedef::narrow_from_decl(decl)->uqname();
s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n";
}
break;
@@ -284,14 +289,14 @@
<< ";\n";
}
else {
- s << o2be_typedef::narrow_from_decl(decl)->fqname();
+ s << o2be_typedef::narrow_from_decl(decl)->uqname();
s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n";
}
break;
}
#endif
default:
- s << o2be_name::narrow_and_produce_fqname(decl)
+ s << o2be_name::narrow_and_produce_uqname(decl)
<< " " << o2be_field::narrow_from_decl(d)->uqname() << ";\n";
}
}
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_typedef.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_typedef.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_typedef.cc Tue May 6 11:39:08 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_typedef.cc Fri Jun 27 14:45:00 1997
@@ -27,6 +27,9 @@
/*
$Log: o2be_typedef.cc,v $
+// Revision 1.1 1997/06/27 17:14:36 matthew
+// Initial revision
+//
// Revision 1.3 1997/05/06 14:09:04 sll
// Public release.
//
@@ -48,7 +51,7 @@
o2be_sequence_chain(this)
{
AST_Decl *decl = base_type();
- const char *tname = o2be_name::narrow_and_produce_fqname(decl);
+ const char *tname = o2be_name::narrow_and_produce_uqname(decl);
while (decl->node_type() == AST_Decl::NT_typedef) {
decl = o2be_typedef::narrow_from_decl(decl)->base_type();
@@ -95,7 +98,7 @@
o2be_typedef::produce_hdr(fstream &s)
{
AST_Decl *decl = base_type();
- const char *tname = o2be_name::narrow_and_produce_fqname(decl);
+ const char *tname = o2be_name::narrow_and_produce_uqname(decl);
while (decl->node_type() == AST_Decl::NT_typedef) {
decl = o2be_typedef::narrow_from_decl(decl)->base_type();
diff -u /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_union.cc /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_union.cc
--- /pub/corba/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_union.cc Tue May 6 11:40:07 1997
+++ /shad/src/matthew/omniORB_2.2.0/src/tool/omniidl2/omniORB2_be/o2be_union.cc Thu Jul 3 10:00:46 1997
@@ -144,13 +144,13 @@
pd_skel_produced_in_field = I_FALSE;
pd_out_adptarg_name = new char[strlen(ADPT_CLASS_TEMPLATE)+strlen("<,>")+
- strlen(fqname())+
- strlen(fqname())+strlen("_var")+1];
+ strlen(uqname())+
+ strlen(uqname())+strlen("_var")+1];
strcpy(pd_out_adptarg_name,ADPT_CLASS_TEMPLATE);
strcat(pd_out_adptarg_name,"<");
- strcat(pd_out_adptarg_name,fqname());
+ strcat(pd_out_adptarg_name,uqname());
strcat(pd_out_adptarg_name,",");
- strcat(pd_out_adptarg_name,fqname());
+ strcat(pd_out_adptarg_name,uqname());
strcat(pd_out_adptarg_name,"_var>");
}
@@ -421,10 +421,10 @@
DEC_INDENT_LEVEL();
IND(s); s << "}\n\n";
- IND(s); s << o2be_name::narrow_and_produce_fqname(disc_type())
+ IND(s); s << o2be_name::narrow_and_produce_uqname(disc_type())
<< " _d () const { return pd_d;}\n";
IND(s); s << "void _d("
- << o2be_name::narrow_and_produce_fqname(disc_type())
+ << o2be_name::narrow_and_produce_uqname(disc_type())
<< " _value) {}\n\n";
if (nodefault() && !no_missing_disc_value())
@@ -501,11 +501,11 @@
else
{
IND(s); s << "const "
- << o2be_name::narrow_and_produce_fqname(f->field_type())
+ << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " &"
<< f->uqname() << " () const { return pd_"
<< f->uqname() << "; }\n";
- IND(s); s << o2be_name::narrow_and_produce_fqname(f->field_type())
+ IND(s); s << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " &"
<< f->uqname() << " () { return pd_"
<< f->uqname() << "; }\n";
@@ -519,11 +519,11 @@
case o2be_operation::tUnionVariable:
case o2be_operation::tAny:
IND(s); s << "const "
- << o2be_name::narrow_and_produce_fqname(f->field_type())
+ << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " &"
<< f->uqname() << " () const { return pd_"
<< f->uqname() << "; }\n";
- IND(s); s << o2be_name::narrow_and_produce_fqname(f->field_type())
+ IND(s); s << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " &"
<< f->uqname() << " () { return pd_"
<< f->uqname() << "; }\n";
@@ -549,7 +549,7 @@
else
{
IND(s); s << "const "
- << o2be_name::narrow_and_produce_fqname(f->field_type())
+ << o2be_name::narrow_and_produce_uqname(f->field_type())
<< ((mapping.is_arrayslice) ? "_slice":"")
<< " "
<< ((mapping.is_pointer) ? "*":"")
@@ -560,7 +560,7 @@
break;
}
default:
- IND(s); s << o2be_name::narrow_and_produce_fqname(f->field_type())
+ IND(s); s << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " "
<< ((mapping.is_pointer) ? "*":"")
<< ((mapping.is_reference) ? "&":"")
@@ -765,7 +765,7 @@
{
IND(s); s << "void "
<< f->uqname() << " (const "
- << o2be_name::narrow_and_produce_fqname(f->field_type())
+ << o2be_name::narrow_and_produce_uqname(f->field_type())
<< "& _value) {\n";
INC_INDENT_LEVEL();
if (l->label_kind() == AST_UnionLabel::UL_label)
@@ -795,7 +795,7 @@
case o2be_operation::tAny:
IND(s); s << "void "
<< f->uqname() << " (const "
- << o2be_name::narrow_and_produce_fqname(f->field_type())
+ << o2be_name::narrow_and_produce_uqname(f->field_type())
<< "& _value) {\n";
INC_INDENT_LEVEL();
if (l->label_kind() == AST_UnionLabel::UL_label)
@@ -833,7 +833,7 @@
{
IND(s); s << "void "
<< f->uqname() << " (const "
- << o2be_name::narrow_and_produce_fqname(f->field_type())
+ << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " _value) {\n";
}
INC_INDENT_LEVEL();
@@ -899,7 +899,7 @@
IND(s); s << "void "
<< f->uqname() << " ("
<< ((mapping.is_const) ? "const ":"")
- << o2be_name::narrow_and_produce_fqname(f->field_type())
+ << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " "
<< ((mapping.is_pointer) ? "*":"")
<< ((mapping.is_reference) ? "&":"")
@@ -941,7 +941,7 @@
IND(s); s << "private:\n\n";
INC_INDENT_LEVEL();
- IND(s); s << o2be_name::narrow_and_produce_fqname(disc_type()) << " pd_d;\n";
+ IND(s); s << o2be_name::narrow_and_produce_uqname(disc_type()) << " pd_d;\n";
IND(s); s << "CORBA::Boolean pd_default;\n";
if (has_fix_member) {
@@ -972,7 +972,7 @@
case o2be_operation::tOctet:
case o2be_operation::tEnum:
case o2be_operation::tStructFixed:
- IND(s); s << o2be_name::narrow_and_produce_fqname(f->field_type())
+ IND(s); s << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " pd_" << f->uqname() << ";\n";
break;
case o2be_operation::tArrayFixed:
@@ -1031,7 +1031,7 @@
case o2be_operation::tUnionFixed:
case o2be_operation::tUnionVariable:
case o2be_operation::tAny:
- IND(s); s << o2be_name::narrow_and_produce_fqname(f->field_type())
+ IND(s); s << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " pd_" << f->uqname() << ";\n";
break;
case o2be_operation::tSequence:
@@ -1047,7 +1047,7 @@
<< " pd_" << f->uqname() << ";\n";
}
#else
- IND(s); s << o2be_name::narrow_and_produce_fqname(f->field_type())
+ IND(s); s << o2be_name::narrow_and_produce_uqname(f->field_type())
<< " pd_" << f->uqname() << ";\n";
#endif
break;
--
Matthew Newhook. matthew_newhook@stratos.ca, http://www.engr.mun.ca/~matthew
Software Designer, Stratos Network Research.
w: (709) 364-5950, h: (709)-745-4346