Ignore:
Timestamp:
07/12/15 00:47:33 (9 years ago)
Author:
Maciej Komosinski
Message:

Print messages when unexpected lines are encountered in param/multiparam loaders

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/param/multiparamload.cpp

    r375 r413  
    9494SString buf;
    9595if (status==OnError) return status;
     96int unexpected_line = 0;
    9697while (!finished())
    9798        {
     
    103104                if ((status!=Finished) && maybeBreak(AfterObject))
    104105                        break;
     106                unexpected_line = 0;
    105107                continue;
    106108                }
     
    113115        if (!loadSStringLine(file,buf))
    114116                {
     117                unexpected_line = 0;
    115118                if (!returnFromIncluded())
    116119                        {
     
    124127        if (buf[0]=='#')
    125128                {
     129                unexpected_line = 0;
    126130                if (buf.startsWith("#include"))
    127131                        {
     
    150154                }
    151155        buf=trim(buf);
    152         if ((buf.len()>1)&&(buf[buf.len()-1]==':'))
    153                 {
     156        if (buf.len()==0)
     157                unexpected_line = 0;
     158        else if ((buf.len()>1)&&(buf[buf.len()-1]==':'))
     159                {
     160                unexpected_line = 0;
    154161                lastunknown=0;
    155162                lastunknown=buf.substr(0,buf.len()-1);
     
    170177                                }
    171178               
     179                }
     180        else
     181                {
     182                switch(unexpected_line)
     183                        {
     184                        case 0:
     185                        {
     186                        const char* thisfilename=file->VgetPath();
     187                        logPrintf("MultiParamLoader","go", LOG_WARN, "Ignored unexpected line %d%s",
     188                                  linenum,
     189                                  thisfilename ? SString::sprintf(" while reading '%s'",thisfilename).c_str():"");
     190                        }
     191                        break;
     192
     193                        case 1:
     194                        logPrintf("MultiParamLoader","go", LOG_WARN, "The following line(s) were also unexpected and were ignored");
     195                        break;
     196                        }
     197                unexpected_line++;
    172198                }
    173199        }
Note: See TracChangeset for help on using the changeset viewer.