Changeset 228


Ignore:
Timestamp:
04/24/14 23:57:44 (11 years ago)
Author:
Maciej Komosinski
Message:

More warnings for illegal ExtValue? operations: object+-*/%something and similar

Location:
cpp/frams
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/defgenoconv.cpp

    r197 r228  
    3131#include "f7/conv_f7.h"
    3232#endif
    33 #ifdef USE_GENCONV_f81
     33#ifdef USE_GENCONV_f81     
    3434#include "f8/conv_f8tof1.h"
    3535#endif
     
    6868#endif
    6969#ifdef USE_GENCONV_f81
    70         addConverter(new GenoConv_f8ToF1());
     70        addConverter(new GenoConv_F8ToF1()); //uncompilable for now... needs lemon, and still borland complains for a hundred of unknown reasons with all kinds of nonsense messages :/
    7171#endif
    7272#ifdef USE_GENCONV_f90
  • cpp/frams/util/extvalue.cpp

    r222 r228  
    222222///////////////////////////////////////
    223223
     224SString ExtValue::typeDescription() const
     225{
     226switch(type)
     227        {
     228        case TInt: return SString("integer value");
     229        case TDouble: return SString("floating point value");
     230        case TString: return SString("text string");
     231        case TUnknown: return SString("null value");
     232        case TInvalid: return SString("invalid value");
     233        case TObj: return getObject().isEmpty()?SString("null"):(SString(getObject().interfaceName())+" object");
     234        }
     235return SString::empty();
     236}
     237
    224238void *ExtValue::getObjectTarget(const char* classname,bool warn) const
    225239{
     
    360374                                vec->data+=d;
    361375                                }
    362                         }
    363                 }
     376                        return;
     377                        }
     378                }
     379                //NO break;
     380        case TUnknown:
     381        case TInvalid:
     382                FMprintf("ExtValue","operator+=",FMLV_WARN,"Can't add %s to %s",(const char*)src.typeDescription(),(const char*)typeDescription());
    364383        default:;
    365384        }
     
    372391        case TInt: idata()-=src.getInt(); break;
    373392        case TDouble: ddata()-=src.getDouble(); break;
     393        case TString: case TObj: case TUnknown: case TInvalid:
     394                FMprintf("ExtValue","operator-=",FMLV_WARN,"Can't subtract %s from %s",(const char*)src.typeDescription(),(const char*)typeDescription());
     395                break;
    374396        default:;
    375397        }
     
    408430                                        }
    409431                                }
    410                         }
     432                        return;
     433                        }
     434                }
     435                //NO break;
     436        case TUnknown: case TInvalid:
     437                FMprintf("ExtValue","operator*=",FMLV_WARN,"Can't multiply %s by %s",(const char*)typeDescription(),(const char*)src.typeDescription());
    411438                break;
    412                 }
    413439        default:;
    414440        }
     
    463489                break;
    464490
     491        case TString: case TObj: case TUnknown: case TInvalid:
     492                FMprintf("ExtValue","operator/=",FMLV_WARN,"Can't divide %s by %s",(const char*)typeDescription(),(const char*)src.typeDescription());
     493                break;
     494
    465495        default:;
    466496        }
     
    563593        }
    564594        break;
     595
     596        case TObj: case TUnknown: case TInvalid:
     597                FMprintf("ExtValue","operator%=",FMLV_WARN,"Can't apply modulo to %s",(const char*)typeDescription());
    565598
    566599        default:;
  • cpp/frams/util/extvalue.h

    r222 r228  
    157157ExtObject getObject() const;
    158158bool isNull() const {return (type==TUnknown)||((type==TObj)&&odata().isEmpty());}
     159SString typeDescription() const;//< @return human readable type name (used in error messages)
    159160const char* parseNumber(const char* in);
    160161const char* deserialize(const char* in);//< @return first character after the succesfully parsed string or NULL if failed
Note: See TracChangeset for help on using the changeset viewer.