Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003170 [JEDI VCL] 00 JVCL Components major always 2005-08-29 09:31 2006-04-05 01:18
Reporter ivan_ra View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.00
Summary 0003170: JvInterpreter assigns 0 to all integer var parameters
Description This 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 Information When 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
Tags No tags attached.
Attached Files zip file icon RunFormDemo.zip [^] (3,658 bytes) 2005-08-29 09:33

- Relationships
has duplicate 0003152resolvedobones var parameters don't work 

-  Notes
(0007889)
ivan_ra (developer)
2005-08-29 09:39

May be, not
      if (TVarData(V).VType = VarType) then
but:
      if (varBoolean = VarType) then
???
(0007895)
remkobonte (developer)
2005-08-30 15:05

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 [^]
(0007897)
ivan_ra (developer)
2005-08-31 00:58

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;
(0008824)
obones (administrator)
2006-04-03 04:14

This is now ready to be committed in CVS as soon as it is backonline
http://sourceforge.net/docs/A04/ [^]
(0008925)
obones (administrator)
2006-04-05 01:18

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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker