+ switch(ch)
+ {
+ case 0xf6: // ö
+ case 0xe4: // ü
+ case 0xfc: // ü
+ case 0xd6: // Ö
+ case 0xc4: // Ä
+ case 0xdc: // Ü
+ if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE)
+ {
+ wxString errBuf;
+ errBuf.Printf("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated.",
+ LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
+ OnError((char *)errBuf.c_str());
+ return FALSE;
+ }
+ buf[bufIndex++]='\\';
+ buf[bufIndex++]='"';
+ buf[bufIndex++]='{';
+ switch(ch)
+ {
+ case 0xf6:buf[bufIndex++]='o';break; // ö
+ case 0xe4:buf[bufIndex++]='a';break; // ä
+ case 0xfc:buf[bufIndex++]='u';break; // ü
+ case 0xd6:buf[bufIndex++]='O';break; // Ö
+ case 0xc4:buf[bufIndex++]='A';break; // Ä
+ case 0xdc:buf[bufIndex++]='U';break; // Ü
+ }
+ buf[bufIndex++]='}';
+ break;
+ case 0xdf: // ß
+ if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE)
+ {
+ wxString errBuf;
+ errBuf.Printf("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated.",
+ LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
+ OnError((char *)errBuf.c_str());
+ return FALSE;
+ }
+ buf[bufIndex++]='\\';
+ buf[bufIndex++]='s';
+ buf[bufIndex++]='s';
+ buf[bufIndex++]='\\';
+ buf[bufIndex++]='/';
+ break;
+ default:
+ if (bufIndex >= MAX_LINE_BUFFER_SIZE)
+ {
+ wxString errBuf;
+ errBuf.Printf("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated.",
+ LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
+ OnError((char *)errBuf.c_str());
+ return FALSE;
+ }
+ // If the current character read in is a '_', we need to check
+ // whether there should be a '\' before it or not
+ if (ch != '_')
+ {
+ buf[bufIndex++] = ch;
+ break;
+ }
+
+ if (checkSyntax)
+ {
+ if (readInVerbatim)
+ {
+ // There should NOT be a '\' before the '_'
+ if ((bufIndex > 0 && (buf[bufIndex-1] == '\\')) && (buf[0] != '%'))
+ {
+ wxString errBuf;
+ errBuf.Printf("An underscore ('_') was detected at line %lu inside file %s that should NOT have a '\\' before it.",LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str());
+ OnError((char *)errBuf.c_str());
+ }
+ }
+ else
+ {
+ // There should be a '\' before the '_'
+ if (bufIndex == 0)
+ {
+ wxString errBuf;
+ errBuf.Printf("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it.",LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str());
+ OnError((char *)errBuf.c_str());
+ }
+ else if ((buf[bufIndex-1] != '\\') && (buf[0] != '%') && // If it is a comment line, then no warnings
+ (strncmp(buf, "\\input", 6))) // do not report filenames that have underscores in them
+ {
+ wxString errBuf;
+ errBuf.Printf("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it.",LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str());
+ OnError((char *)errBuf.c_str());
+ }
+ }
+ }
+ buf[bufIndex++] = ch;
+ break;
+ } // switch
+ } // else