Exemple #1
0
int
osRunQuoteArg(String word, int (*putter)(int))
{
    String	s;
    Bool	hasFunky = false;
    int	cc = 0;

    for (s = word ; *s && !hasFunky ; s++ ) {
	if ( hasFunky = isupper(*s) ) break;
	switch (*s) {
	    case '!' :
	    case '@' :
	    case '&' :
	    case '"' :
	    case '\'' :
		hasFunky = true;
	}
    }

    if (hasFunky) {
	putter('"'); cc++;
	for (s = word; *s; s++) {
	    if (*s == '"') { putter('"'); cc++; }
	    putter(*s); cc++;
	}
	putter('"'); cc++;
    }
    else
	for (s = word; *s; s++) { putter(*s); cc++; }

    return cc;
}
Exemple #2
0
void be_structure::generate_tc_put_val (be_Source & source)
{
   ostream & os = source.Stream ();
   be_Tab tab (source);
   unsigned long uid = 0;

   // declare writer body

   os << "void " << m_tc_put_val << nl;
   os << "(" << nl;
   tab.indent ();
   os << tab << "DDS::Codec::OutStream & os," << nl;
   os << tab << "const void * arg," << nl;
   os << tab << "DDS::ParameterMode mode" << nl;
   if (XBE_Ev::generate ())
   {
      os << tab << XBE_Ev::arg (XBE_ENV_ARGN, false) << nl;
   }
   tab.outdent ();
   os << ")" << nl;
   os << "{" << nl;
   tab.indent ();

   // first, cast that pesky void *

   os << tab << ScopedName () << " * p = (" << ScopedName () << "*) arg;" << nl;

   // now, let's put our fields

   putter (os, tab, "p", uid);

   tab.outdent ();
   os << tab << "}" << nl << nl;
}
Exemple #3
0
int tputs(const char *str, int affcnt, int (*putter)(int))
{
	if (!str) {
		return(1);
	}

	while (*str) {
		putter(*str);
		str++;
	}
	return(1);
}
Exemple #4
0
void be_sequence::generate_tc_put_val (be_Source & source)
{
   be_predefined_type * prtype = be_predefined_type::_narrow (base_type ());
   ostream & os = source.Stream ();
   be_Tab tab (source);

   // declare writer body

   os << tab << "void " << m_tc_put_val << nl;
   os << tab << "(" << nl;
   tab.indent ();
   os << tab << "DDS::Codec::OutStream & os," << nl;
   os << tab << "const void * arg," << nl;
   os << tab << "DDS::ParameterMode mode" << nl;
   if (XBE_Ev::generate ())
   {
      os << tab << XBE_Ev::arg (XBE_ENV_ARGN, false) << nl;
   }
   tab.outdent ();
   os << tab << ")" << nl;
   os << tab << "{" << nl;
   tab.indent ();

   /* Sequences of 1/2/4 byte types handled as special cases */

   if 
   (
      prtype &&
      ! IsBounded () &&
      (
         (prtype->pt () == AST_PredefinedType::PT_octet) ||
         (prtype->pt () == AST_PredefinedType::PT_char) ||
         (prtype->pt () == AST_PredefinedType::PT_long) ||
         (prtype->pt () == AST_PredefinedType::PT_ulong) ||
         (prtype->pt () == AST_PredefinedType::PT_float) ||
         (prtype->pt () == AST_PredefinedType::PT_short) ||
         (prtype->pt () == AST_PredefinedType::PT_ushort)
      )
   )
   {
      os << tab << "DDS::Codec::Param p = { ";

      if
      (
         (prtype->pt () == AST_PredefinedType::PT_octet) ||
         (prtype->pt () == AST_PredefinedType::PT_char)
      )
      {
         os << "DDS::_tc_sequence";
      }
      else if
      (
         (prtype->pt () == AST_PredefinedType::PT_short) ||
         (prtype->pt () == AST_PredefinedType::PT_ushort)
      )
      {
         os << "DDS::_tc_sequence2";
      }
      else
      {
         os << "DDS::_tc_sequence4";
      }

      os << ", (void*) arg, mode };" << nl
         << tab << "os.put (&p, 1"
         << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   }
   else
   {
      // since the put param must be a sequence pointer pointer,
      // that's what the writer takes.  The putter, however,

      os << tab << ScopedName () << " * p = (" 
         << ScopedName () << "*) arg;" << nl;

      // now put the data

      putter (os, tab, "p", 0);
   }

   tab.outdent ();
   os << tab << "}" << nl << nl;
}