View Issue Details

IDProjectCategoryView StatusLast Update
0003170JEDI VCL00 JVCL Componentspublic2006-04-05 01:18
Reporterivan_raAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.30 
Summary0003170: JvInterpreter assigns 0 to all integer var parameters
DescriptionThis is simple procedure with var integer parameter:

procedure GetVarParameter(var MyPar:integer);
begin
  MyPar:=4;
end;

When I run this procedure in JvInterpreter it always set MyPar to 0.

Please fix it
Additional InformationWhen I look to code I see strange things:
function JvInterpreterVarAsType(const V: Variant; const VarType: Integer): Variant;
begin
  if (TVarData(V).VType = varEmpty) or (TVarData(V).VType = varNull) then
  begin
...
  end
  else
  begin
    if TVarData(V).VType = varInteger then
    begin
      if (TVarData(V).VType = VarType) then
        /////////////////////////////////////////////////////////////////
        Result := Ord(V = True)
        // when V is integer and desired result is integer it's always 0!
        ////////////////////////////////////////////////////////////////
      else
        Result := Integer(V)
    end
    else
...

This procedure is calling from TJvInterpreterVarList.SetValue, so all integer var parameters will be 0
TagsNo tags attached.

Relationships

has duplicate 0003152 resolvedobones var parameters don't work 

Activities

2005-08-29 09:33

 

RunFormDemo.zip (3,658 bytes)

ivan_ra

2005-08-29 09:39

developer   ~0007889

May be, not
      if (TVarData(V).VType = VarType) then
but:
      if (varBoolean = VarType) then
???

remkobonte

2005-08-30 15:05

developer   ~0007895

This seems to be already fixed in rev. 1.66 of JvInterpreter.pas:

http://cvs.sourceforge.net/viewcvs.py/jvcl/dev/JVCL3/run/JvInterpreter.pas?r1=1.65&r2=1.66

ivan_ra

2005-08-31 00:58

developer   ~0007897

Ok. But I think this part of code is unnecessary:
...
  else
  begin
 //--------------------- cut here ----------------------------------
    if (TVarData(V).VType = varBoolean) and (VarType = varInteger) then
      Result := Ord(V = True)
    else
    if TVarData(V).VType = varInteger then
      Result := Integer(V)
    else
//--------------------- cut here ----------------------------------
    if TVarData(V).VType = varArray then
    begin
      TVarData(Result) := TVarData(V);
      TVarData(Result).VType := VarType;
    end
    else
      Result := VarAsType(V, VarType);
  end;

This typecasting converts boolean "true" to 1, not to -1 as VarAsType function, and nothing else. This feature is not uses anywhere. So, code can be shorter and clear:
...
  else
  begin
    if TVarData(V).VType = varArray then
    begin
      TVarData(Result) := TVarData(V);
      TVarData(Result).VType := VarType;
    end
    else
      Result := VarAsType(V, VarType);
  end;

obones

2006-04-03 04:14

administrator   ~0008824

This is now ready to be committed in CVS as soon as it is backonline
http://sourceforge.net/docs/A04/

obones

2006-04-05 01:18

administrator   ~0008925

This is now in CVS

Issue History

Date Modified Username Field Change
2005-08-29 09:31 ivan_ra New Issue
2005-08-29 09:33 ivan_ra File Added: RunFormDemo.zip
2005-08-29 09:39 ivan_ra Note Added: 0007889
2005-08-30 15:05 remkobonte Note Added: 0007895
2005-08-31 00:58 ivan_ra Note Added: 0007897
2006-04-03 04:03 obones Relationship added has duplicate 0003152
2006-04-03 04:14 obones Note Added: 0008824
2006-04-03 04:14 obones Status new => confirmed
2006-04-05 01:18 obones Status confirmed => resolved
2006-04-05 01:18 obones Resolution open => fixed
2006-04-05 01:18 obones Assigned To => obones
2006-04-05 01:18 obones Note Added: 0008925