Changeset 950
- Timestamp:
- 06/20/20 01:02:20 (4 years ago)
- Location:
- cpp/frams
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.cpp
r914 r950 331 331 } 332 332 333 SString ParamInterface::nameDotProperty(int prop) 334 { 335 SString ret = getName(); 336 ret+="."; 337 ret+=id(prop); 338 return ret; 339 } 340 341 SString ParamInterface::nameDotPropertyForMessages(int prop) 342 { 343 SString name_dot_prop = nameDotProperty(prop); 344 if (strcmp(getName(),getLongName())==0) 345 { 346 if (strcmp(id(prop),name(prop))==0) 347 return name_dot_prop; 348 else 349 return SString("'")+name(prop)+"': "+name_dot_prop; 350 } 351 else 352 return SString("'")+name(prop)+"' in '"+getLongName()+"': "+name_dot_prop; 353 } 333 354 334 355 int SimpleAbstractParam::isequal(int i, void* defdata) … … 421 442 SString field; 422 443 if (field_index >= 0) 423 field = SString::sprintf("'%s.%s'", pi->getName(), pi->id(field_index));444 field = pi->nameDotPropertyForMessages(field_index); 424 445 else 425 446 field = SString::sprintf("unknown property of '%s'", pi->getName()); … … 445 466 bool show_length = valuetoset.getType() == TString; 446 467 const char* quote = (valuetoset.getType() == TString) ? "\"" : "'"; 447 logPrintf("Param", "set", LOG_WARN, "Setting %s .%s= %s exceeded allowed range (too %s). %s to %s.",448 getName(), id(i),468 logPrintf("Param", "set", LOG_WARN, "Setting %s = %s exceeded allowed range (too %s). %s to %s.", 469 nameDotPropertyForMessages(i).c_str(), 449 470 ::sstringDelimitAndShorten(svaluetoset, 30, show_length, quote, quote).c_str(), 450 471 (setflags&PSET_HITMAX) ? (s_type ? "long" : "big") : "small", s_type ? "Truncated" : "Adjusted", … … 674 695 case 'o': ret.setObject(getObject(i)); break; 675 696 case 'x': ret = getExtValue(i); break; 676 default: logPrintf("ParamInterface", "get", LOG_ERROR, " '%s.%s' is not a property", getName(), id(i));697 default: logPrintf("ParamInterface", "get", LOG_ERROR, "%s is not a property", nameDotPropertyForMessages(i).c_str()); 677 698 } 678 699 } … … 718 739 if (v.type == TObj) 719 740 { 720 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting int '%s.%s' from object reference (%s)", getName(), id(i), v.getString().c_str());741 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting int %s from object reference (%s)", nameDotPropertyForMessages(i).c_str(), v.getString().c_str()); 721 742 return 0; 722 743 } … … 730 751 if (v.type == TObj) 731 752 { 732 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting float '%s.%s' from object reference (%s)", getName(), id(i), v.getString().c_str());753 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting float %s from object reference (%s)", nameDotPropertyForMessages(i).c_str(), v.getString().c_str()); 733 754 return 0; 734 755 } … … 739 760 case 'o': 740 761 if ((v.type != TUnknown) && (v.type != TObj)) 741 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting object '%s.%s' from %s", getName(), id(i), v.typeAndValue().c_str());762 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting object %s from %s", nameDotPropertyForMessages(i).c_str(), v.typeAndValue().c_str()); 742 763 else 743 764 return setObject(i, v.getObject()); 744 765 break; 745 766 case 'x': return setExtValue(i, v); 746 default: logPrintf("ParamInterface", "set", LOG_ERROR, " '%s.%s' is not a property", getName(), id(i));767 default: logPrintf("ParamInterface", "set", LOG_ERROR, "%s is not a property", nameDotPropertyForMessages(i).c_str()); 747 768 } 748 769 return 0; … … 922 943 if (err != NULL) 923 944 logPrintf("SimpleAbstractParam", "sanityCheck", LOG_ERROR, 924 "Invalid ParamEntry for %s.%s (%s)", getName(), pe->id, err);945 "Invalid ParamEntry for %s (%s)", nameDotPropertyForMessages(i).c_str(), err); 925 946 } 926 947 #endif … … 1156 1177 else 1157 1178 logPrintf("SimpleAbstractParam", "setObject", LOG_ERROR, 1158 " '%s.%s' is PARAM_OBJECTSET but no 'assign()' in %s", getName(), pe->id, o.interfaceName());1179 "%s is PARAM_OBJECTSET but no 'assign()' in %s", nameDotPropertyForMessages(i).c_str(), o.interfaceName()); 1159 1180 return PSET_CHANGED; 1160 1181 } … … 1205 1226 { 1206 1227 logPrintf("SimpleAbstractParam", "call", LOG_ERROR, 1207 (*pe->type != 'p') ? " '%s.%s' is not a function" : "Internal error - undefined function pointer for '%s.%s'", getName(), pe->id);1228 (*pe->type != 'p') ? "%s is not a function" : "Internal error - undefined function pointer for %s", nameDotPropertyForMessages(i).c_str()); 1208 1229 ret->setInvalid(); 1209 1230 } -
cpp/frams/param/param.h
r805 r950 72 72 73 73 virtual const char* getName() = 0; 74 virtual const char* getLongName() { return getName(); } 74 75 virtual const char* getDescription() { return 0; } 75 76 virtual ParamEntry *getParamTab() const { return NULL; } … … 193 194 virtual void sanityCheck(int i) {} 194 195 #endif 196 SString nameDotProperty(int prop); 197 SString nameDotPropertyForMessages(int prop); 195 198 }; 196 199 … … 257 260 virtual void *getTarget(int i); 258 261 const char* myname; 262 const char* mylongname; 259 263 bool dontcheckchanges; 260 264 … … 263 267 264 268 const char* getName() { return myname; } 269 const char* getLongName() { return mylongname ? mylongname : myname; } 270 265 271 void setName(const char* n) { myname = n; } 272 void setLongName(const char* n) { mylongname = n; } 266 273 267 274 /** … … 270 277 @param n Param's name 271 278 */ 272 SimpleAbstractParam(void* o = 0, const char*n = 0) :myname(n), dontcheckchanges(0), object(o) {}279 SimpleAbstractParam(void* o = 0, const char*n = 0) :myname(n), mylongname(NULL), dontcheckchanges(0), object(o) {} 273 280 void setDontCheckChanges(bool x) { dontcheckchanges = x; } 274 281 … … 330 337 331 338 const char* getDescription() { return tab[0].type; } 339 const char* getLongName() { return tab[0].help ? tab[0].help : SimpleAbstractParam::getLongName(); } 332 340 333 341 int getGroupCount() { return tab[0].group; } -
cpp/frams/vm/framscript.l
r477 r950 35 35 "'''" {trctx.tmp=""; trctx.multilimit='\''; BEGIN multiline;} 36 36 "@line "[0-9]+\n {trctx.line=atol(yytext+6);trctx.linechanged=true;} 37 "@file "[^\n\t\r]+\n {trctx.s rcname=SString(yytext+6,yyleng-7);trctx.namechanged=true;}37 "@file "[^\n\t\r]+\n {trctx.setSrcname(SString(yytext+6,yyleng-7),true);trctx.namechanged=true;} 38 38 39 39 [a-zA-Z_][a-zA-Z0-9_]* { int t=lookupToken(yytext);
Note: See TracChangeset
for help on using the changeset viewer.