#include <fcntl.h>
#include <unistd.h>
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
-#include <strstream>
-#else
-#include <strstream.h>
-#endif
+#include <sstream>
#include <Xm/TextF.h>
#include <Dt/SpinBox.h>
)
{
Tt_status status = tt_ptr_error( val );
- std::ostrstream errStream;
+ std::ostringstream errStream;
errStream << func << " = " << val << " (" << status << ")" << ends;
- char *label = errStream.str();
+ const char *label = errStream.str().c_str();
DtTtSetLabel( labelWidget, label );
- delete label;
return status;
}
Tt_status status
)
{
- std::ostrstream errStream;
+ std::ostringstream errStream;
errStream << func << " = " << status << ends;
- char *label = errStream.str();
+ const char *label = errStream.str().c_str();
DtTtSetLabel( labelWidget, label );
- delete label;
return status;
}
int returnVal
)
{
- std::ostrstream errStream;
+ std::ostringstream errStream;
errStream << func << " = " << returnVal << ends;
- char *label = errStream.str();
+ const char *label = errStream.str().c_str();
DtTtSetLabel( labelWidget, label );
- delete label;
return returnVal;
}
return 0;
}
for (int i = 0; i < count; i++) {
- std::ostrstream itemStream;
+ std::ostringstream itemStream;
itemStream << (void *)pPats[ i ];
char *name = (char *)
tt_pattern_user( *pPats[ i ], _DtTtPatsNameKey );
tt_free( name );
}
itemStream << ends;
- char *string = itemStream.str();
+ char *string = const_cast<char *>(itemStream.str().c_str());
items[ i ] = XmStringCreateLocalized( string );
- delete string;
}
return items;
}
}
*itemCount = dtTtMessagesCount;
for (i = 0; i < dtTtMessagesCount; i++) {
- std::ostrstream itemStream;
+ std::ostringstream itemStream;
itemStream << (void *)dtTtMessages[ i ];
char *op = tt_message_op( dtTtMessages[ i ] );
if (! tt_is_err( tt_ptr_error( op ))) {
tt_free( id );
}
itemStream << ends;
- char *string = itemStream.str();
+ char *string = const_cast<char *>(itemStream.str().c_str());
items[ i ] = XmStringCreateLocalized( string );
- delete string;
}
return items;
case DTTT_PATTERN:
}
*itemCount = dtTtPatternsCount;
for (i = 0; i < dtTtPatternsCount; i++) {
- std::ostrstream itemStream;
+ std::ostringstream itemStream;
itemStream << (void *)dtTtPatterns[ i ] << ends;
items[ i ] = XmStringCreateLocalized(
- itemStream.str() );
- delete itemStream.str();
+ const_cast<char *>(itemStream.str().c_str()) );
}
return items;
case DTTT_DTSESSION:
)
{
char *file = tempnam( 0, AIX_CONST_STRING tempnamTemplate );
- std::ostrstream cmdStream;
+ std::ostringstream cmdStream;
cmdStream << cmd << " > " << file << ends;
- int sysStat = system( cmdStream.str() );
+ int sysStat = system( cmdStream.str().c_str() );
if (! WIFEXITED( sysStat )) {
- std::ostrstream func;
+ std::ostringstream func;
func << "system( \"" << cmdStream.str() << "\" )" << ends;
- DtTtSetLabel( label, func.str(), sysStat );
- delete cmdStream.str();
- delete func.str();
+ DtTtSetLabel( label, func.str().c_str(), sysStat );
return;
}
if (WEXITSTATUS( sysStat ) != 0) {
- DtTtSetLabel( label, cmdStream.str(), WEXITSTATUS( sysStat ));
- delete cmdStream.str();
+ DtTtSetLabel( label, cmdStream.str().c_str(), WEXITSTATUS( sysStat ));
return;
}
- delete cmdStream.str();
_DtOpen( label, file );
}
const char * file
)
{
- std::ostrstream labelStream;
+ std::ostringstream labelStream;
labelStream << "dtaction Open " << file << ends;
- DtTtSetLabel( label, labelStream.str() );
- delete labelStream.str();
+ DtTtSetLabel( label, labelStream.str().c_str() );
- std::ostrstream cmd;
+ std::ostringstream cmd;
cmd << "( unset TT_TRACE_SCRIPT; if dtaction Open " << file
<< "; then :; else textedit " << file << "; fi; sleep 600; rm -f "
<< file << " ) &" << ends;
- system( cmd.str() );
- delete cmd.str();
+ system( cmd.str().c_str() );
}
void
const char * topic
)
{
- std::ostrstream labelStream;
+ std::ostringstream labelStream;
labelStream << "dtaction Dtmanpageview " << topic << ends;
- DtTtSetLabel( label, labelStream.str() );
- delete labelStream.str();
+ DtTtSetLabel( label, labelStream.str().c_str() );
- std::ostrstream cmd;
+ std::ostringstream cmd;
cmd << "unset TT_TRACE_SCRIPT; if dtaction Dtmanpageview " << topic
<< "; then :; else cmdtool -c man " << topic << "; fi &" << ends;
- system( cmd.str() );
- delete cmd.str();
+ system( cmd.str().c_str() );
}
Boolean
*** Add include files, types, macros, externs, and user functions here.
***/
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <fstream>
-#include <strstream>
-#else
-#include <fstream.h>
-#include <strstream.h>
-#endif
+#include <sstream>
#include "DtTt.h"
#include <sys/wait.h>
#include <Xm/TextF.h>
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <fstream>
-#include <strstream>
-#else
-#include <fstream.h>
-#include <strstream.h>
-#endif
+#include <sstream>
#include "DtTt.h"
#include "ttsnoop_ui.h"
XtVaGetValues( instance->fchooser, XmNuserData, &xtPtr, NULL );
FileChooserInfo *info = (FileChooserInfo *)xtPtr;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
- std::ostrstream script;
+ std::ostringstream script;
switch (info->choice) {
Tt_pattern *pats;
Tt_message msg;
script << "numChars=`tt_type_comp -p \"" << path;
script << "\" | wc -c`; if [ $numChars = 0 ]; "
"then exit 1; else exit 0; fi" << endl;
- ival = system( script.str() );
- delete script.str();
+ ival = system( script.str().c_str() );
if (! WIFEXITED( ival )) {
DtTtSetLabel( label,
"system( \"tt_type_comp -p\" )", ival );
break;
}
if (WEXITSTATUS( ival ) != 0) {
- std::ostrstream diagnosis;
+ std::ostringstream diagnosis;
diagnosis << "tt_type_comp -p: syntax error in "
<< path << ends;
- DtTtSetLabel( label, diagnosis.str() );
- delete diagnosis.str();
+ DtTtSetLabel( label, diagnosis.str().c_str() );
break;
}
sess = tt_default_session();
*** Add include files, types, macros, externs, and user functions here.
***/
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
-#include <strstream>
-#else
-#include <strstream.h>
-#endif
+#include <sstream>
#include <Xm/TextF.h>
#include <Dt/SpinBox.h>
}
}
- std::ostrstream labelStream;
+ std::ostringstream labelStream;
labelStream << "Tt_message " << (void *)msg;
XtVaSetValues( instance->messageProps,
- XmNtitle, labelStream.str(),
+ XmNtitle, labelStream.str().c_str(),
NULL );
- delete labelStream.str();
_DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
- std::ostrstream action; // XXX when to delete .str()?
+ std::ostringstream action;
DtbMessagePropsMessagePropsInfo instance =
(DtbMessagePropsMessagePropsInfo)clientData;
Tt_message msg = messageProps2Msg( instance );
}
// XXX emit commented warnings for e.g. TT_OFFER, TT_HANDLER
action << "}\n";
- // XtVaSetValues( instance->messageText, XmNvalue, action.str(), 0 );
- _DtOpen( instance->messageFooterLabel, (void *)action.str(),
- action.pcount(), "actio" );
- delete action.str();
+ // XtVaSetValues( instance->messageText, XmNvalue, action.str().c_str(), 0 );
+ _DtOpen( instance->messageFooterLabel, (void *)action.str().c_str(),
+ action.str().size(), "actio" );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
- std::ostrstream code; // XXX when to delete .str()?
+ std::ostringstream code;
DtbMessagePropsMessagePropsInfo instance =
(DtbMessagePropsMessagePropsInfo)clientData;
Tt_message msg = messageProps2Msg( instance );
code << "}\n";
}
tt_free( op );
- // XtVaSetValues( instance->messageText, XmNvalue, code.str(), 0 );
- _DtOpen( instance->messageFooterLabel, (void *)code.str(),
- code.pcount(), "msgC" );
- delete code.str();
+ // XtVaSetValues( instance->messageText, XmNvalue, code.str().c_str(), 0 );
+ _DtOpen( instance->messageFooterLabel, (void *)code.str().c_str(),
+ code.str().size(), "msgC" );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
- std::ostrstream ptype; // XXX when to delete .str()?
+ std::ostringstream ptype;
DtbMessagePropsMessagePropsInfo instance =
(DtbMessagePropsMessagePropsInfo)clientData;
Tt_message msg = messageProps2Msg( instance );
ptype << "\t\t\t) => start opnum=1;\n";
ptype << "};\n";
// XXX contexts
- // XtVaSetValues( instance->messageText, XmNvalue, ptype.str(), 0 );
- _DtOpen( instance->messageFooterLabel, (void *)ptype.str(),
- ptype.pcount(), "ptype" );
- delete ptype.str();
+ // XtVaSetValues( instance->messageText, XmNvalue, ptype.str().c_str(), 0 );
+ _DtOpen( instance->messageFooterLabel, (void *)ptype.str().c_str(),
+ ptype.str().size(), "ptype" );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
*** Add include files, types, macros, externs, and user functions here.
***/
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
-#include <strstream>
-#else
-#include <strstream.h>
-#endif
+#include <sstream>
#include <Tt/tttk.h>
#include "DtTt.h"
}
}
- std::ostrstream labelStream;
+ std::ostringstream labelStream;
labelStream << "Tt_pattern " << (void *)pat << ends;
XtVaSetValues( instance->patternProps,
- XmNtitle, labelStream.str(),
+ XmNtitle, labelStream.str().c_str(),
NULL );
- delete labelStream.str();
_DtTtPatternWidgetUpdate( instance, pat );
#include <Xm/TextF.h>
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <fstream>
-#include <strstream>
-#else
-#include <fstream.h>
-#include <strstream.h>
-#endif
+#include <sstream>
#include "DtTt.h"
#include <Xm/TextF.h>
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <fstream>
-#else
-#include <fstream.h>
-#endif
#include "DtTt.h"
#include <stdio.h>
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
-#include <strstream>
-#else
-#include <strstream.h>
-#endif
+#include <sstream>
#include <Xm/TextF.h>
#include <Xm/List.h>
XmTextFieldSetString( instance->chooserText, 0 );
XtVaSetValues( instance->chooser, XmNtitle, title, NULL );
- std::ostrstream valuesStream;
+ std::ostringstream valuesStream;
valuesStream << itemCount << " " << valuesLabel;
if (itemCount != 1) valuesStream << "s";
valuesStream << ends;
- DtTtSetLabel( instance->chooserList_label, valuesStream.str() );
- delete valuesStream.str();
+ DtTtSetLabel( instance->chooserList_label, valuesStream.str().c_str() );
// Remember dialog mode, entity
XtVaSetValues( instance->chooserOkButton, XmNuserData, choice, NULL );
break;
}
void *entity = DtTtNth( type, info->item_position - 1 );
- std::ostrstream entityName;
+ std::ostringstream entityName;
if (isString) {
entityName << (char *)entity << ends;
} else {
entityName << entity << ends;
}
- XmTextFieldSetString( instance->chooserText, entityName.str() );
- delete entityName.str();
+ XmTextFieldSetString( instance->chooserText, const_cast<char *>(entityName.str().c_str()) );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
#include <sys/stat.h>
#include <time.h>
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <iostream>
-#include <strstream>
+#include <sstream>
#include <fstream>
-#else
-#include <iostream.h>
-#include <strstream.h>
-#include <fstream.h>
-#endif
#include <Dt/Term.h>
#include <Tt/tt_c.h>
Boolean unlinkSnoopFile = True;
char * traceFile = 0;
Boolean unlinkTraceFile = True;
-char * traceScript = 0;
+const char * traceScript = 0;
int globalTimeout = 20000;
unsigned int globalSaveLines = 5000;
const char * globalVersionString = "1.0";
char * optTraceScript = 0;
String apiTracerArgv[ 10 ];
String snooperArgv[ 10 ];
-std::ostrstream tttraceCmd;
+std::ostringstream tttraceCmd;
std::ofstream snoopStream;
// Xt squats on -tf ?! XXX
if ((child > 0) && WIFEXITED( status )) {
snoopStream << endl << endl << "SIGCHLD: WEXITSTATUS=="
<< WEXITSTATUS(status) << ": "
- << tttraceCmd.str() << endl << endl;
+ << tttraceCmd.str().c_str() << endl << endl;
}
break;
case SIGCONT:
installSignalHandler();
if (snoopedArgsCount > 0) {
DtTtSetLabel( dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label,
- tttraceCmd.str() );
+ tttraceCmd.str().c_str() );
}
Tt_status status;
snoopStream.open( snoopFile, ios::app );
- std::ostrstream envStr;
+ std::ostringstream envStr;
envStr << "TT_TRACE_SCRIPT=> ";
envStr << traceFile << ends;
- traceScript = envStr.str();
+ traceScript = envStr.str().c_str();
if (optImmediateTracing) {
turnOnTracing( 0, 0, 0 );
}
#include <unistd.h>
-#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <fstream>
-#include <strstream>
-#else
-#include <fstream.h>
-#include <strstream.h>
-#endif
+#include <sstream>
#include "apiTracer_ui.h"
#include "DtTt.h"
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
- std::ostrstream tttraceCmd;
+ std::ostringstream tttraceCmd;
tttraceCmd << "unset TT_TRACE_SCRIPT; dtterm -sb -sl ";
tttraceCmd << globalSaveLines;
tttraceCmd << " -title tttrace -geometry 120x24 -e tttrace &";
DtTtSetLabel( instance->ttsnoopWin_label, "tttrace" );
- system( tttraceCmd.str() );
- delete tttraceCmd.str();
+ system( tttraceCmd.str().c_str() );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
- std::ostrstream advice;
+ std::ostringstream advice;
advice << "pause(); /* kill -CONT " << getpid() << " */";
- DtTtSetLabel( instance->ttsnoopWin_label, advice.str() );
- delete advice.str();
+ DtTtSetLabel( instance->ttsnoopWin_label, advice.str().c_str() );
//
// run "(if dterror.ds blah blah; then kill -CONT pid; fi)&"
//
- std::ostrstream script;
+ std::ostringstream script;
script << "(if dterror.ds ";
// arg 1: text
script << "\"kill -CONT " << getpid() << "\" ";
script << "CONT; then ";
// After confirmation, invoke kill(1)
script << "kill -CONT " << getpid() << "; fi)&";
- system( script.str() );
- delete script.str();
+ system( script.str().c_str() );
// Run the event loop a few laps, to paint the footer
tttk_block_while( XtWidgetToApplicationContext( widget ), 0, 50 );
if (! tt_is_err( status )) {
snoopPatIsRegistered = ! snoopPatIsRegistered;
}
- std::ostrstream stream;
+ std::ostringstream stream;
stream << func << (void *)snoopPat << ")" << ends;
- DtTtSetLabel( instance->ttsnoopWin_label, stream.str(), status );
- delete stream.str();
+ DtTtSetLabel( instance->ttsnoopWin_label, stream.str().c_str(), status );
DtTtSetLabel( instance->menubar_Snoop_item_Snoop_menu_items.Off_item,
snoopPatIsRegistered ? "Off" : "On" );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/