Changeset 13731


Ignore:
Timestamp:
05/15/12 08:42:32 (13 years ago)
Author:
tbretz
Message:
Fixed a problem with the label interpretation; added a storage variable for the script name
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Readline.cc

    r13714 r13731  
    7070using namespace std;
    7171
    72 Readline *Readline::This   =  0;
    73 int       Readline::fLabel = -3;
     72Readline   *Readline::This   =  0;
     73int         Readline::fLabel = -3;
     74std::string Readline::fScript;
    7475
    7576// --------------------------------------------------------------------------
     
    10051006    if (str[0]==':')
    10061007    {
    1007         const int section = atoi(str.substr(1).c_str());
    1008         SetSection(section);
    1009 
    1010         if (fLabel!=section)
     1008        try
     1009        {
     1010            const int section = stoi(str.substr(1));
     1011            SetSection(section);
     1012
     1013            if (fLabel!=section)
     1014                return true;
     1015        }
     1016        catch (const logic_error &e)
     1017        {
     1018            fCommandLog << "# ERROR - Inavlid label '" << str.substr(1) << "'" << endl;
     1019            fLabel = -2;
    10111020            return true;
     1021        }
    10121022
    10131023        fLabel=-1;
     
    12561266        return 0;
    12571267
     1268    string name = Tools::Trim(fname);
     1269    fScript = name;
     1270
    12581271    SetSection(-2);
    12591272    fLabel = -1;
    1260 
    1261     string name = Tools::Trim(fname);
    12621273
    12631274    const size_t p = name.find_last_of(':');
  • trunk/FACT++/src/Readline.h

    r13702 r13731  
    2828    int fLine;
    2929    static int fLabel;
     30    static std::string fScript;
    3031
    3132    // Static member function which are used to adapt readline to ncurses
     
    102103    static  int  GetLabel() { return fLabel; }
    103104
     105    static std::string GetScript() { return fScript; }
     106
    104107    int GetLine() const { return fLine; }
    105108    virtual std::string GetLinePrompt() const;
Note: See TracChangeset for help on using the changeset viewer.