Git Product home page Git Product logo

dwscript's People

Watchers

 avatar

dwscript's Issues

Access violation on a script compilation

Code:

var arr := [1, 2, '3', 3.14];
var ndx : Integer;

for ndx := Low(arr) To High(arr) do

Out:

Syntax Error: Access violation at address 00519C59 in module 'test.exe'. Read 
of address 00000000

Original issue reported on code.google.com by [email protected] on 21 Oct 2010 at 10:18

Incorrect array indexing

Code:

var arr := [1, 2, '3', 3.14, Now(), 'end'];
var ndx : Integer;

for ndx := Low(arr) To High(arr) do
 println(arr[ndx]);

Out:

6
1
2
3
3,14
40472,6723455671

First item contains a array size

Original issue reported on code.google.com by [email protected] on 21 Oct 2010 at 11:10

Add support for "type" sections

Code:

Type

 TMyObj = Class;

 TMyObj = Class

  Procedure Add(AObject : TMyObj);

 End;

Procedure TMyObj.Add(AObject : TMyObj);
Begin
End;

Out:

Syntax Error: Invalid Instruction - function or assignment expected [line: 5, 
column: 9]

Workaround:

 Add "Type" before declaration of TMyObj;

Original issue reported on code.google.com by [email protected] on 2 Nov 2010 at 2:07

Problem with objects cross-references

Objects, which have a cross-reference not will be destroyed even after 
destruction of TdwsProgram.

Code:

Type

 TObj = Class

  FOwner : TObj;

  Constructor Create(AOwner : TObj);

 End;

Constructor TObj.Create(AOwner : TObj);
Begin

 Inherited Create;

 FOwner := AOwner;
 If AOwner <> NIL Then
  AOwner.FOwner := Self;

End;

Var i := 0;

While i < 1000000 Do
 Begin

  TObj.Create(TObj.Create(NIL));
  Inc(i);

 End; 

Original issue reported on code.google.com by [email protected] on 3 Nov 2010 at 12:15

TString.SaveToFile() lost data

What steps will reproduce the problem?

In unit dwsClasses use TString.SaveToFile() is lost data:

procedure TdwsStrings.SaveToStream(Stream: TStream);
var
  S: string;
begin
  S := GetTextStr;
  Stream.WriteBuffer(Pointer(S)^, Length(S));
end;

Request change to:

procedure TdwsStrings.SaveToStream(Stream: TStream);
var
  S: string;
begin
  S := GetTextStr;
  Stream.WriteBuffer(Pointer(S)^, Length(S) * SizeOf(WideChar));
end;


Original issue reported on code.google.com by [email protected] on 30 Sep 2010 at 8:56

Add directive for check of declarations

I offer to add the directive {$IFDECL 'TObject'} (or with other name) similar 
{$IF Declared (TObject)}, but with an opportunity to check presence of members 
at classes (also variables, types, procedures, functions).

Example:

{$IFDECL 'Exception.ToString'}s := Excep.ToString{$ELSE}s := 
Excep.Message{$ENDIF}

{$IFDECL 'WriteLn'}WriteLn(s){$ELSE}PrintLn(s){$ENDIF}

{$IFNDECL 'GlobalVar'}{$ERROR 'GlobalVar must be declared'}{$ENDIF}

Original issue reported on code.google.com by [email protected] on 11 Nov 2010 at 11:04

DWS Inheritance issue

Consider this script:

// begin of script
procedure Process(List: TStringList);
var i: Integer;
begin
  for i := 0 to List.Count-1 do
    println(Format('%d. %s', [i, List[i]]));
end;

type
  TMyStringList = class(TStringList)
  end;

var MyList = TMyStringList.Create;
var i: Integer;

begin
  for i := 1 to 100 do
    MyList.Add(IntToStr(i));
  Process(MyList);
end;
// end of script

It does not compile, but it should: Process should accept MyList for it is a 
TStringList descendant.

Original issue reported on code.google.com by [email protected] on 27 Oct 2010 at 8:35

Unexpected syntax error

Code:

Type

 TMyObj = Class

  Procedure Add(AObject : TMyObj);

 End;

Out:

Syntax Error: Type "TMyObj" not found [line: 5, column: 27]

Original issue reported on code.google.com by [email protected] on 2 Nov 2010 at 12:20

Constants initialization problem

What steps will reproduce the problem?

When value of constant must be calculated with functions using, we has problem.

Code:

Const X = 1024;
Const Y = Round(X / 5);

What do you see instead?

Syntax Error: Constant expression expected [line: 2, column: 23]

Original issue reported on code.google.com by [email protected] on 30 Sep 2010 at 9:55

Unexpected error on a internal record-type variables of TdwsUnit component

What steps will reproduce the problem?
1. Add new record type (TRec = Record Member : String; End) in TdwsUnit 
component
2. Add new variable (rec : TRec) in TdwsUnit component
3. Try to compile script: "rec."

What is the expected output?

Syntax Error: "." expected ("<CRLF>") [line: 1, column: 5]

4. Try to compile script: "rec.member := 'test'"

What is the expected output?

Syntax Error: ":=" expected [line: 1, column: 4]

Original issue reported on code.google.com by [email protected] on 27 Sep 2010 at 8:15

ComConnector. Suggestion to difference of Integer types

So far as in DWS all integer meanings are stored in Int64, it would be 
desirable to have the mechanism of type differentiation in ComConnector. If the 
meaning of variable is in a range of Integer type, that she was passed as VT_I4 
instead of VT_I8, but if was used explicit type cast ( Int64 (5) ), then to use 
VT_I8. It can appear necessary at interaction with external objects since they 
can expect only VT_I4, and VT_I8 in some cases.

Original issue reported on code.google.com by [email protected] on 27 Oct 2010 at 11:40

Some Chinese characters can not be displayed

What steps will reproduce the problem?
1. use TDelphiWebScript, TdwsHTMLFilter, TdwsHTMLUnit in my program.
2. Input HTML code below:
<html>
<body>
<table>
<?pas Send('test 中文'); ?>
中文測試:戊
</table>
</body>
</html>


What is the expected output?
test 中文中文測試:戊


What do you see instead?
Syntax Error: End of string constant not found (end of line) ("戊") [line: 4, 
column: 40]


What version of the product are you using? On what operating system?
Delphi 2010


Please provide any additional information below.
Thank you!

Original issue reported on code.google.com by [email protected] on 23 Sep 2010 at 11:19

Doesn't compile under Delphi Win32 (BDS2006)

What steps will reproduce the problem?
1.Just compile under BDS2006 under Win32 mode

What version of the product are you using? On what operating system?
- preview 3

I have changes a small portion of the source code and it works now under Win32, 
so it is a very minor change:
- All "exit(ResultVal)" should be replaced by "Result:=ResultVal;Exit;"
- System.MonitorEnter(var) / System.MonitorExit(var) doestn't work 
- RawByteString isn't supported (I defined RawByteString as normal string)
- UString is not supported, changed this to normal string

Original issue reported on code.google.com by [email protected] on 25 Oct 2010 at 12:18

Problem with open array parameter

Code:

//
Procedure test(Const arr : Array Of Variant);
Begin

 Var ndx : integer;
 For ndx := Low(arr) To High(arr) Do
  PrintLn(arr[ndx]);

End;
//

test([4,5,6]);
test([]);

Out:

Syntax Error: Argument 0 expects type "array of Variant" instead of "array 
[0..2] of Variant" [line: 12, column: 1]
Syntax Error: Argument 0 expects type "array of Variant" instead of "array 
[0..-1] of Variant" [line: 13, column: 1]

Original issue reported on code.google.com by [email protected] on 21 Oct 2010 at 5:07

ComConnector. Parameter passing

var server : ComVariant := XmlRpcServer('http://api.example.com'); // some 
initialization

server.namespace.method(1); // passed as Int64. dwsComConnector cannot convert 
its
// (Runtime Error: Invalid data type (20) for DWSII Com-Wrapper! [line: 3, 
column: 24])

server.namespace.method(Now);// passed as Double. must be varDate

Original issue reported on code.google.com by [email protected] on 26 Oct 2010 at 6:08

Default parameters for internal functions

From Wilbert van Leijen mail.

Is it possible to give TInternalFunction default parameters?

"Inc" and "Dec" both ought to have those: an increment or decrement of 1. Just 
like it is in the Delphi RTL.

It is not a biggie - I mean, I can implement those easily in a dwsUnit - it is 
just that I have to comment out

//   RegisterInternalIntFunction(TIncFunc, 'Inc', ['@a', cInteger, 'b', 
cInteger], True);
//   RegisterInternalIntFunction(TDecFunc, 'Dec', ['@a', cInteger, 'b', 
cInteger], True);

each time you update unit dwsMathFunctions.

Original issue reported on code.google.com by [email protected] on 27 Oct 2010 at 7:20

Can't set '?>' to a string in dwsHtml?

What steps will reproduce the problem?
uses dwsHtmlFilter & following HTML:
<?pas
var s: string;
s := '?>';
Send(s);
?>

What is the expected output?
?>

What do you see instead?
Syntax Error: Invalid character ("S") [line: 3, column: 24]

Original issue reported on code.google.com by [email protected] on 30 Sep 2010 at 8:28

Enumerations support

type

 TEnum = (enOne, enTwo, enThree);

var e : TEnum;
var i : Integer;

Inc(e); // supported
Dec(e); // supported

i := Ord(e); // unsupported
e := High(e); // unsupported
e := Low(e); // unsupported
succ(e); // unsupported
pred(e); // unsupported

for e := enOne to enThree do; // unsupported

Original issue reported on code.google.com by [email protected] on 29 Oct 2010 at 4:45

New InSet function

From Wilbert van Leijen

The declaration would be as follows

function InSet(n : Integer; values: array of Integer): boolean

so you can write in script

if InSet(n, [2, 5, 9, 11]) then ...

rather than

if (n = 2) or (n = 5) or (n = 9) or (n = 11) then ...

and the implementation thereof is

 TInSetFunc = class(TInternalMagicBoolFunction)
   function DoEvalAsBoolean(args : TExprBaseList) : Boolean; override;
 end;

{ ... }

function TInSetFunc.DoEvalAsBoolean;
var
 expr : TExprBase;
 varRecs : TVarRecArrayContainer;
 value, i : Integer;

begin
 expr := args.ExprBase[1];
 if not (expr is TArrayConstantExpr) then
   raise EScriptException.Create(CPE_ConstantExpressionExpected);
 varRecs := TArrayConstantExpr(expr).EvalAsVarRecArray;
 value := args.AsInteger[0];
 Result := False;
 try
   for i := 0 to High(varRecs.VarRecArray) do
   with varRecs.VarRecArray[i] do
     if VType = vtInt64 then
       if value = VInt64^ then
       begin
         Result := True;
         Break;
       end;
 finally
   varRecs.Free;
 end;
end;



{ ... }

  RegisterInternalBoolFunction(TInSetFunc, 'InSet', ['n', cInteger, 'values', 'array of Variant'], True);  // should be array of Integer

Original issue reported on code.google.com by [email protected] on 28 Oct 2010 at 10:25

Unexpected error on a internal array-type variables of TdwsUnit component

What steps will reproduce the problem?

1. Add new array type (TStringArray : Array [0 .. 10] Of String) in TdwsUnit 
component
2. Add new variable (arr : TStringArray) in TdwsUnit component
3. Try to compile script: "arr[0] := 'test';"

What is the expected output?

Syntax Error: ":=" expected [line: 1, column: 4]

Original issue reported on code.google.com by [email protected] on 26 Sep 2010 at 12:32

Access violation when compiling incorrect script

What steps will reproduce the problem?
1. Use TWebDelphiScript with default settings

2. Compile code:
//
Function Percent(AMax, AValue : Integer) : Integer;
Begin

 Result := Round(100 / Max * AValue);

End;
//

What is the expected output?
Syntax Error: Unknown name "Max" [line: 5, column: 24]

What do you see instead?
Syntax Error: Access violation at address 0053A7FC in module 'realfire.exe'. 
Read of address 00000000


What version of the product are you using?
Delphi 2010.

Original issue reported on code.google.com by [email protected] on 24 Sep 2010 at 1:37

Bitwise operations error

Code:
PrintLn(FloatToStr(3.14 Shr 2));
PrintLn(FloatToStr(3.14 And 5));

What is the expected output?

Operator not applicable to this operand type.

What do you see instead?

Normal compilation;

Original issue reported on code.google.com by [email protected] on 1 Oct 2010 at 4:51

Runtime Error: Could not convert variant of type...

Code:

//
Function Percent(Const AMax, AValue : Integer) : Integer;
Begin

 Result := Round(100 / AMax * AValue);

End;
//

Var

 x, y : Integer;

x := 216;
y := 108; 

Percent(x - y, x - y); 

Out:

Runtime Error: Could not convert variant of type (Int64) into type (Unknown) 
[line: 5, column: 12]

Workaround: to declare parameters without "Const"

Original issue reported on code.google.com by [email protected] on 19 Oct 2010 at 5:25

TightList.Assign Count=0

In TightList.Assign, the case Count=0 is put through ReallocMem and 
System.Move, while a simple "0: Exit;" would have sufficed.

Also, Move is quite expensive, with the Delete and Insert moving on average 
half the items aroung TWICE! Better to remember the source, Move the items 
in-between 1 step aside, so you can put the item back in the slot that came 
free. (Just for fun: Trace what happens if you Move(0,1) when Count=2!)

Original issue reported on code.google.com by [email protected] on 1 Nov 2010 at 1:25

ComConnector. The maximum quantity of parameters of a invoked method isn't checked.

This code silently kill my application.

var server : ComVariant := XmlRpcServer('http://api.example.com/'); // some 
initialization

server.namespace.method(
//                        '1', '2', '3', '4', '5', '6', '7', '8', // uncomment 
for effect
                        '1', '2', '3', '4', '5', '6', '7', '8', 
                        '1', '2', '3', '4', '5', '6', '7', '8', 
                        '1', '2', '3', '4', '5', '6', '7', '8', 
                        '1', '2', '3', '4', '5', '6', '7', '8', 
                        '1', '2', '3', '4', '5', '6', '7', '8', 
                        '1', '2', '3', '4', '5', '6', '7', '8', 
                        '1', '2', '3', '4', '5', '6', '7', '8', 
                        '1', '2', '3', '4', '5', '6', '7', '8' 
                        ); // 72 params. maxDispArgs = 64.

Original issue reported on code.google.com by [email protected] on 26 Oct 2010 at 9:00

The duplicated compilation error messages

Code:

Procedure Log(AStr : string);
Begin
End;

Log(Float(now));

Out:

Syntax Error: Integer expected [line: 5, column: 5]
Syntax Error: Argument 0 expects type "String" instead of "Float" [line: 5, 
column: 1]
Syntax Error: Integer expected [line: 5, column: 5]
Syntax Error: Argument 0 expects type "String" instead of "Float" [line: 5, 
column: 1]

Original issue reported on code.google.com by [email protected] on 23 Oct 2010 at 7:13

Assertion failure in dwsExprs

Code:
Procedure SetXY(Const AX, AY, AValue : Integer);
Begin

 Print(Format('X = %d, Y = %d, Value = %d', [AX, AY, AValue]));

End;

SetXY(100, 100, RandomInt(High(Integer)));

Out:
Runtime Error: Assertion failure (C:\DWS\Source\dwsExprs.pas, line 2777) [line: 
8, column: 1]

Original issue reported on code.google.com by [email protected] on 16 Oct 2010 at 2:19

Strange syntax error

Code:

var arr := [];
PrintLn(arr[0]);

Out:

Syntax Error: Argument 0 expects type "Variant" instead of "nil" [line: 2, 
column: 1]

Original issue reported on code.google.com by [email protected] on 21 Oct 2010 at 12:06

Constant parameters issue

Wilbert van Leijen


I have still an issue with constant parameters in DWS:

// begin script
function f(a : string; b : array of string) : Boolean;
begin
 Result := SameText(a, b[0]);
end;

begin
 if f('a text', ['compare against', 'compare against too']) then
   PrintLn('Odd')
 else
   PrintLn('Expected');
end;
// end script

results in "Argument 1 expects type " " instead or " "

Original issue reported on code.google.com by [email protected] on 10 Nov 2010 at 10:26

Access violation on application starting if dwsComp unit place before dwsFunctions unit

What steps will reproduce the problem?
1. Place unit dwsFunctions before dwsComp unit
2. Compile and run application

What is the expected output?
Normal work

What do you see instead?
---------------------------
Debugger Exception Notification
---------------------------
Project script.exe raised exception class EAccessViolation with message 'Access 
violation at address 0047CE2C in module 'script.exe'. Read of address 0000000C'.
---------------------------
Break   Continue   Help   
---------------------------

What version of the product are you using?
Delphi 2009, 2010

Original issue reported on code.google.com by [email protected] on 24 Sep 2010 at 5:38

Indistinct diagnostic message

What steps will reproduce the problem?

Compile code:

Var Ndx : Integer;

Procedure Test;
Begin

 For Ndx := 0 To 10 Do
  PrintLn(IntToStr(Ndx));

End; 

What is the expected output?
For loop control variable must be simple local variable (Delphi variant), or 
normal compilation if it is possible.

What do you see instead?
Syntax Error: Integer expected [line: 6, column: 10]

Original issue reported on code.google.com by [email protected] on 30 Sep 2010 at 9:19

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.