[omniORB] omniORB 3.0 on WinNT

Sai-Lai Lo S.Lo@uk.research.att.com
03 Oct 1999 18:16:03 +0100


Rosimildo,

The generated stub corbaidl_defs.hh definitely does not look right.
I think the problem is to do with MSVC++ not picking up the correct
conversion operator to convert the StringBuf class in omniidl3 to a const
char* when the << operation is invoked on the ostream class.

I'll let David to comb through the omniidl3 code to make sure that all
usage of StringBuf is explicitly casted to const char*.

In the mean time, at least these 2 functions have to be changed.

Sai-Lai

-------
<top>/tool/omniidl2/omniORB_be/o2be_util.cc:

std::ostream& operator << (std::ostream& s, o2be_verbatim v)
{
  StringBuf sb;
  const char* p = v.data;

  while( *p ) {
    const char* e;

    if( (e = strchr(p, '\n')) ) {
      if( e == p )  s << '\n';
      else {
	IND(s);
	sb.clear();
	sb += StringBuf::extent(p, e);
	s << (const char*) sb << '\n'; <------------------
      }
      p = e + 1;
    }
    else {
      if( *p )  IND(s);
      s << p;
      return s;
    }
  }

  return s;
}

std::ostream& operator << (std::ostream& s, o2be_template t)
{
  StringBuf sb;
  const char* p = t.data;
  int start_of_line = 1;

  while( *p ) {

    const char* e = p;

    while( *e && *e != '\n' && !isalpha(*e) && *e != '_' )
      e++;

    if( start_of_line ) {
      if( *p != '\n' && *p != '#' )  IND(s);
      start_of_line = 0;
    }

    if( !*e ) {
      s << p;
      return s;
    }
    else if( *e == '\n' ) {
      sb.clear();
      sb += StringBuf::extent(p, e);
      s << (const char*) sb << '\n';  <---------------------------------
      p = e + 1;
      start_of_line = 1;
    }
    else {
      // isalpha(*e) || *e == '_'
      sb.clear();
      sb += StringBuf::extent(p, e);
      s << (const char*) sb;           <----------------------------------

      p = e;
      do e++; while( isalnum(*e) || *e == '_' );

      sb.clear();
      sb += StringBuf::extent(p, e);
      const char* val = t.map[sb];
      if( val )  s << val;
      else       s << (const char*) sb;   <---------------------------
      p = e;

      // @ is used to concatenate ids, so skip.
      if( *p == '@' )  p++;
    }

  }

  return s;
}



-- 
Sai-Lai Lo                                   S.Lo@uk.research.att.com
AT&T Laboratories Cambridge           WWW:   http://www.uk.research.att.com 
24a Trumpington Street                Tel:   +44 1223 343000
Cambridge CB2 1QA                     Fax:   +44 1223 313542
ENGLAND