cppannotations/yo/verbinsert.cc
fbbrokken 6881bc3814 The trunk directory contains the latest version (6.4.0c) of the C++
Annotations. 

The branches and tags directory are empty, since I couldn't
svnadmin import a repostitory dump. Many earlier versions exist, though, and
if you want the full archive, just let me know and I'll send you the svnadmin
dump of my full C++ Annotations archive.

Frank B. Brokken <f.b.brokken@rug.nl>



git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@3 f6dd340e-d3f9-0310-b409-bdd246841980
2006-09-04 08:26:34 +00:00

49 lines
1 KiB
C++

#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
int main(int argc, char **argv)
{
string label(argv[1]);
string endlabel(label[1] == '/' ? "//=" : "/**/");
ifstream input(argv[2]);
string line;
bool print = false;
cout << " verb(\n";
while (getline(input, line))
{
istringstream istr(line);
string word1;
istr >> word1;
if (word1 == label)
{
if (print)
break;
print = true;
label = endlabel;
continue;
}
if (print)
cout << line << endl;
}
cout << " )\n";
if (!print)
{
cerr << "verbinsert(" << argv[1] << ")(" << argv[2] << ")\n" <<
" label section not found\n";
return 1;
}
if (label != endlabel)
{
cerr << "verbinsert(" << argv[1] << ")(" << argv[2] << ")\n" <<
" unterminated label section\n";
return 1;
}
return 0;
}