Changeset 6132 for branches/stable_5.0

Show
Ignore:
Timestamp:
13/08/09 07:15:12 (3 years ago)
Author:
westram
Message:
  • backporting parts of [6131]. Fixes truncated helpfiles for release (e.g. rna3d_general). Increased read-buffer to 5000 (which is longer than longest existing help file line)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/stable_5.0/HELP_SOURCE/arb_help2xml.cxx

    r5785 r6132  
    4242 
    4343// #define DUMP_DATA // use this to see internal data (class Helpfile) 
    44 #define MAX_LINE_LENGTH 500     // maximum length of lines in input stream 
     44#define MAX_LINE_LENGTH 2000     // maximum length of lines in input stream 
    4545#define TABSIZE         8 
    4646 
     
    139139    void getline() { 
    140140        if (!eof) { 
    141             if (!in.good()) eof = true; 
    142             in.getline(lineBuffer, MAX_LINE_LENGTH); 
    143             lineNo++; 
    144  
    145             if (strchr(lineBuffer, '\t')) { 
    146                 int o2 = 0; 
    147  
    148                 for (int o = 0; lineBuffer[o]; ++o) { 
    149                     if (lineBuffer[o] == '\t') { 
    150                         int spaces = TABSIZE - (o2 % TABSIZE); 
    151                         while (spaces--) lineBuffer2[o2++] = ' '; 
     141            if (in.eof()) eof = true; 
     142            else { 
     143                h2x_assert(in.good()); 
     144 
     145                in.getline(lineBuffer, MAX_LINE_LENGTH); 
     146                lineNo++; 
     147 
     148                if (in.eof()) eof = true; 
     149                else if (in.fail()) throw "line too long"; 
     150 
     151                if (strchr(lineBuffer, '\t')) { 
     152                    int o2 = 0; 
     153 
     154                    for (int o = 0; lineBuffer[o]; ++o) { 
     155                        if (lineBuffer[o] == '\t') { 
     156                            int spaces = TABSIZE - (o2 % TABSIZE); 
     157                            while (spaces--) lineBuffer2[o2++] = ' '; 
     158                        } 
     159                        else { 
     160                            lineBuffer2[o2++] = lineBuffer[o]; 
     161                        } 
    152162                    } 
    153                     else { 
    154                         lineBuffer2[o2++] = lineBuffer[o]; 
    155                     } 
    156                 } 
    157                 lineBuffer2[o2] = 0; 
    158                 strcpy(lineBuffer, lineBuffer2); 
     163                    lineBuffer2[o2] = 0; 
     164                    strcpy(lineBuffer, lineBuffer2); 
     165                } 
    159166            } 
    160167        }