#ifdef __cplusplus
#include <stdlib.h>
-#if !defined(__DECCXX) && !defined(USL)
+#if !defined(__DECCXX) && !defined(USL) && !defined(CSRG_BASED)
#include <osfcn.h>
#else
#include <unistd.h>
/* All Rights Reserved */
#include <string.h>
-#include <strstream.h>
+#include <strstream>
+#include <iostream>
#define BUFFER_INCR_UNIT 64
-ostrstream **sets;
+std::ostrstream **sets;
int sets_cnt = 0; /* number of sets slots occupied */
int sets_max = 0; /* total number of sets slots */
sets_max += BUFFER_INCR_UNIT;
if (sets_cnt == 0) {
- sets = (ostrstream **)
- malloc(sizeof(ostrstream *) * sets_max);
+ sets = (std::ostrstream **)
+ malloc(sizeof(std::ostrstream *) * sets_max);
set_nums = (int *)
malloc(sizeof(int) * sets_max);
}
else {
- sets = (ostrstream **)
- realloc(sets, sizeof(ostrstream *) * sets_max);
+ sets = (std::ostrstream **)
+ realloc(sets, sizeof(std::ostrstream *) * sets_max);
set_nums = (int *)
realloc(set_nums, sizeof(int) * sets_max);
}
}
if (cur_set >= 0)
*sets[cur_set] << '\0';
- sets[cur_set = sets_cnt++] = new ostrstream;
+ sets[cur_set = sets_cnt++] = new std::ostrstream;
*sets[cur_set] << (char*)yytext;
case 4:
{
if (cur_set < 0) { // maybe not a message id
- cout << (char*)yytext;
+ std::cout << (char*)yytext;
}
else { // must be a message id
*sets[cur_set] << (char*)yytext;
case 8:
{
if (cur_set < 0)
- cout << *(char*)yytext;
+ std::cout << *(char*)yytext;
else
*sets[cur_set] << *(char*)yytext;
}
for (i = 0; i < sets_cnt; i++) {
const char* record = sets[sorted[i]]->str();
- cout << record << '\n' << flush;
+ std::cout << record << '\n' << std::flush;
}
free(sorted);