+ // The raw input line.
+ std::string Input;
+ // The input line with comments stripped.
+ std::string Fragment;
+
+ // Grab the next line of F and place it in Input.
+ do
+ {
+ char *Buffer = new char[1024];
+
+ F.clear();
+ F.getline(Buffer,sizeof(Buffer) / 2);
+
+ Input += Buffer;
+ }
+ while (F.fail() && !F.eof());
+
+ // Expand tabs in the input line and remove leading and trailing
+ // whitespace.
+ {
+ const int BufferSize = Input.size() * 8 + 1;
+ char *Buffer = new char[BufferSize];
+ try
+ {
+ memcpy(Buffer, Input.c_str(), Input.size() + 1);
+
+ _strtabexpand(Buffer, BufferSize);
+ _strstrip(Buffer);
+ Input = Buffer;
+ }
+ catch(...)
+ {
+ delete[] Buffer;
+ throw;
+ }
+ delete[] Buffer;
+ }