Giter Club home page Giter Club logo

lape's People

Contributors

ineedbots avatar johnpeel avatar merlijnwajer avatar nielsad avatar ollydev avatar slackydev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lape's Issues

System unit - variable forwarding bug

A small dosage of wtf is healthy. Read comments, or just run it to see what's crazy here.

function MuchWTF(): Int32;
var
  mfw:Int32 := (@system.wtf)^; //any kind of "operation" works
begin
  WriteLn('MFW: ', mfw );         //1024
  WriteLn('WTF: ', system.wtf );  //1024

  Result := {--}system.wtf;                  //uncomment `--` for it to work
  WriteLn('Didnt work: Result is ', result); //result is 0

  Result := mfw;
  WriteLn('Did work:   Result is ', result); //result is 1024

  system.wtf := 9999;  //works
end;

var
  wtf: Int32 = 1024;
begin
  WriteLn(MuchWTF());
  WriteLn(wtf);
end;   

IDispatch and varargs

With la-pe supporting overload, ovveride keyword its make
superior to the other pascal scripting engine like RemObjects
Pascal Script.

Well maybe you at least consider to add this supporting
feature.

# IUnknown and IDispatch support for COM object variant.
# varargs support for cdecl calling convention.

When the time it's come la-pe support these features,
I believe, La-pe will be the greatest Pascal Scripting
engine.

Hm, I only suggestting it and I don't mean to add an
burden to you. Just suggestion.

Original issue reported on code.google.com by prasetyopriadi on 10 Sep 2013 at 2:34

  • Merged into: #6

Passing function/procedure to a method

procedure Foo(func:procedure); 
begin
end;

Compilation error: "Can't assign "Variant" to "procedure()" at line 490, column 61 in file "!addDelayedExpose" at line 490, column 68 in file "!addDelayedExpose""

Traced it down to this commit:
~ https://github.com/nielsAD/lape/tree/1f671d67ec2aafed6cf26885a66ce69178632b51

Error line in addDelayedExpose VariantInvoke:

function VariantInvoke(Name: string; Params: array of Variant = []): Variant; override;
var ParamsLen: Integer := Length(Params);
begin 
  Result := Unassigned;
  case LowerCase(Name) of 
     // this ...->
     'foo': begin Assert(ParamsLen = 1);Result := Unassigned; foo(Params[0]); end;

This is a bit weird to me, assigning variant to a pointer of some sort.. Guess it's just one of those hacks in Lape.


Update:
Issue comes from this change: 1f671d6#diff-52ce7244cb5e48d1de8a2e4c6e88e959L2468

Where everything that matched {nothing} (in this case Right is TLapeType_Variant) would before the above commit pass on to Result := inherited; changing it back to that fixes it.

Can't deref certain typed Pointers

What will reproduce the problem?
  http://paste.villavu.com/show/x7iV1TALSkH1wzLwtYL1/

What is the expected output? What do you see instead?
  42, Exception

Which version are you using?
  r105

Please provide any additional information below.
  Only on Pointers of Records.

Original issue reported on code.google.com by [email protected] on 25 Jun 2011 at 11:35

Forwarding of type method

Type methods don't seem to automatically forward if needed, executing this code should explain all.

var CallMe: procedure of object;
type TFoo = type Pointer;
var Foo: TFoo;

procedure TFoo.Free; forward; //comment me to break shit.

procedure TFoo.Init;
begin
  CallMe := @Self.Free;
end;

procedure TFoo.Free;
begin
  Writeln('Free');
end;

begin
  Foo.Init;
  WriteLn(@CallMe);
  WriteLn(@Foo.Free);

  CallMe(); // Error: Access violation at line 22
end;       

[Suggestion] Allow nested routine to access param & local var

procedure foo(x: integer = 111);
var
  y: Integer = 333;

  procedure nested;
  begin
    writeln(x, ' ', y);
    y := y + 1;
  end;

begin
  nested;
  x:= 999;
  nested;
end; 

This is valid in FPC. (prints 111 333, 999 334)
Will be convenient to have it in lape (currently we have to pass them by reference to the nested routine)

Writeln of a pointer to a type with a pointer to its same type gives duplicate declaration

If you create a custom type with a field which is a pointer to the same type, 
trying to Writeln a pointer to your type will produce a Duplicate declaration 
error, but only if you haven't already printed your type using Writeln.

Example code:
type
  PMyType = ^MyType;
  MyType = record
    toast: PMyType;
  end;

var
  myVar: PMyType;
begin
  New(myVar);
  //Writeln(myVar^); // Doesn't throw error if uncommented
  Writeln(myVar); // Throws error
end.

Uncommenting the line and leaving the second Writeln in results in the script 
running to completion without a problem.

Original issue reported on code.google.com by [email protected] on 14 Mar 2012 at 8:58

Defines don't work.

What will reproduce the problem?
  {$IFDEF WTF}WriteLn('Hmmm');{$ENDIF}

What is the expected output? What do you see instead?
  Nothing, Hmmm

Which version are you using?
  r105

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 25 Jun 2011 at 10:35

Function list killed by global Var and Const.

https://github.com/SRL/SRL-6/commit/dc82f7ef0305b6862d37a78e643585db42545d5e#L2R
42

For actual code on the error.


<BraK> Just so you can see the code where the error accuors
<Wizzup> oh, a bug
<BraK> Lape allows us to declare Const and Var globally that way but it kills 
the function list.
<BraK> So I figured it was an issue in Simba.
<Wizzup> BraK, if pascalscript or another parser is used to parse the script 
(which it is), then it may not support all lape syntax and break
<Wizzup> best bug niels about this

Original issue reported on code.google.com by [email protected] on 11 Oct 2012 at 3:08

[Suggestion] else clause for for/while loops

The current behaviour is pretty pointless since checking if at least 1 iteration is executed is trivial and rarely done.
Perhaps add an option (or just change it) to match its behaviour to that of Python: else clause will be executed if no 'break' happened in the body.

This is in practice much more frequently done, like

for 1 to 10 do
begin
  if trySth() then
   break;
end else
begin
  writeln('tried 10 times but still failed!');
  TerminateScript();
end;

Without this else clause behaviour, extra variable would be needed to accommodate the control flow.

Index array with result of overloaded method

What will reproduce the problem?
var Arr:Array of Integer = [0,0];
begin
  Arr[ round(1) ];
end.

What is the expected output? What do you see instead?
Error: Don't know which overloaded method to call with params (Int32) at line 6

Which version are you using?
c96f612e0066    

Please provide any additional information below.
This happens whenever you try to index an array with the result of any 
overloaded method. If methods is not overloaded it works, IE: `Arr[ ceil(1) ]` 
works fine.

Original issue reported on code.google.com by [email protected] on 9 Sep 2014 at 1:06

Simba closes second time I run my script .

What will reproduce the problem?

running the following script:
http://paste.villavu.com/show/3667/

line 33 will cause the error. The first time I run it will cause no errors and 
the expected outcome. The second time will close simba.

What is the expected output? What do you see instead?

Simba closes. Lazarus directs me to: lpeval -> line 475

procedure _LapeToString_Extended(const Params: PParamArray; const Result: 
Pointer); {$IFDEF Lape_CDECL}cdecl;{$ENDIF}
begin
  PlpString(Result)^ := FloatToStr(PExtended(Params^[0])^);
end;  

Which version are you using?

Pulled the latest with git.

Gr,
Bart de Boer,
masterBB

Original issue reported on code.google.com by [email protected] on 5 Dec 2012 at 2:06

Math Function Additions

Can we get the Functions from Math.simba in SRL5 added to LAPE Pretty please.

BTW have I told you I <3 Lape Lately. We started work on SRL6. :D


Original issue reported on code.google.com by [email protected] on 11 Oct 2012 at 12:49

PBoolean, wrong type in Windows unit.

What will reproduce the problem?
  Don't define LCL, and try to compile.

What is the expected output? What do you see instead?
  It should compile, Errors.

Which version are you using?
  FPC 2.6.0
  Lape 5784e9fe0725fa8aff2b6144b7c76e59e3002c58

Please provide any additional information below.
  The Windows unit defines PBoolean as ^Byte for compatibility with Delphi.
  Add a redefinition of PBoolean as ^Boolean after the Windows unit is loaded.

Original issue reported on code.google.com by [email protected] on 2 Jan 2012 at 5:57

todo: how to create method/class method as global function

todo: how to crete method/class method as global function (without usage global 
pameters)

class procedure TForm1.MyWrite1(S: string);
begin
  System.Write(...
end;

procedure TForm1.MyWrite2(S: string);
begin
  Memo.Lines.Add(...
end;

????:

Compiler.addGlobalFuncFromClass('function VarCreateOLEObject(const ClassName: 
string): Variant;', @TForm1.MyWrite1, TForm1);

Compiler.addGlobalFuncFromObject('function VarCreateOLEObject(const ClassName: 
string): Variant;', @TForm1.MyWrite2);

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

Delphi compatibility

Does LaPe support Delphi as advertized?

I'm getting numerous warnings when compiling under Delphi XE, and compiling 
simple scripts (f.i. just "program test; const c = 1; end;" results in stack 
corruption of the host application.

Original issue reported on code.google.com by [email protected] on 29 Mar 2013 at 6:59

You cannot externally add sets

What will reproduce the problem?
  Using addGlobalType to add a set like
    addGlobalType('(test1, test2)', 'TTest'); 

What is the expected output? What do you see instead?
  It should add the set, I get a exception on running a blank script.

Which version are you using?
  Revision 49

Please provide any additional information below.
  I can create types like that internally.

  type
    TTest = (test1, test2);

  This Works.

Original issue reported on code.google.com by [email protected] on 24 Mar 2011 at 9:24

ToString type method causes WriteLn to fail.

What will reproduce the problem?
http://paste.villavu.com/show/AWaEmivhUS0gfu7WcwLm/

What is the expected output?
nil
[]

What do you see instead?
Access violation

Which version are you using?
e2c7fdaf2bd7

Please provide any additional information below.
Using Simba build 150.

Original issue reported on code.google.com by [email protected] on 3 Jun 2013 at 12:14

How does Lape Unions work?

I can't find out how Unions work for anything.

Would also like to know if External should be working yet?
I see you have it as a keyword, tho it doesn't work for me.

Would also like to see inline added. =)


Original issue reported on code.google.com by [email protected] on 8 Jun 2011 at 6:06

Colon added to keywords - "Out of stack range"

What will reproduce the problem?
-------
var i:Int32; 
begin
  for: i:=0 to 100 do Continue;

  //or ...
  case i of
    0: WriteLn('0');
    else: WriteLn('...');
  end;
end;


Expected output:
-------
-> Raise a proper exception when parsing "for:" as there is a colon there.


Version:
-------
-> The latest lape build for Simba


Additional information:
-------
Raises: "Error: Out of stack range" (no line number as well)
Now, this is just some bad/missing error handling. My guess is that Lape 
assumes "for:", or "else:" is a label, due to the colon, and handles it 
incorrectly.
Should raise a more proper error.

It's just a minor, almost irrelevant "issue" tho..

- slacky

Original issue reported on code.google.com by [email protected] on 12 Aug 2014 at 6:22

libffi support

I've been working on a FPC libffi unit, and some of the basic cases seem to 
work just fine. (See below)

My question is, how exactly do you want this integrated in lape?
Do you want to generate CIF's automatically when someone uses a specific 
keyword? The same goes for function wrappers, do you want to generate those 
automatically for lape functions? (You can even make a 
call-this-function-with-any-arguments-wrap-all function with libffi, or so I 
have read)


----------------------------------------
var
  Cif: TFFICif;
  s: TFFIStatus;
  ret: ptruint;
  int_type: TFFIType;     

begin
  writeln(fpgetpid());

  s := ffi_prep_cif(@cif, FFI_DEFAULT_ABI, 0, @ffi_type_uint64, nil);
  writeln('S:' + inttostr(PtrUInt(s)));

  if s = FFI_OK then
  begin
    writeln('Woo');
    ffi_call(@cif, @fpgetpid, @ret, nil);
    writeln('Result: ' + inttostr(ret));
  end;
end;

Results in:
$ ./project1
5853
S:0
Woo
Result: 5853


Original issue reported on code.google.com by [email protected] on 26 Apr 2012 at 3:08

lpexceptions.pas function ReturnAddress for XE2 UP

XE2 UP has a built-in implementation function (ReturnAddress). You can now 
write the cross-platform for "lpexceptions.pas":

implementation

{$IFDEF Delphi}
{$IF CompilerVersion < 21.00}
function ReturnAddress: Pointer;
asm
  MOV  EAX, [EBP+4]
end;
{$IFEND}
{$ENDIF}

procedure _LapeException(Msg: lpString); inline;
{$IFDEF FPC}
begin
...
end;
{$ELSE}
begin
  raise lpException.Create(Msg) at ReturnAddress;
end;
{$ENDIF}
...


Original issue reported on code.google.com by [email protected] on 8 Dec 2012 at 2:49

Type field in nested method compiles.

I believe this should raise a compiling error

type
  TFoo = record
    FField: Integer;
  end;


procedure TFoo.Bar;

  procedure Nested;
  begin
    //Writeln(Self.FField); // Unknown decl "Self"
    Writeln(FField); // Compiles but access violation
  end;

begin
  Nested();
end;

var
  Foo: TFoo;

begin
  Foo.Bar;
end;      

todo: OLE

//
// file: main.pas
//
uses
  {+}
  {$IFDEF MSWINDOWS}Windows,{$ENDIF}
  {+.}
...
  ,StrUtils
  {$IFDEF COM}
  ,ComObj {$IFDEF FPC},Ole2{$ENDIF}, ActiveX
  {$ENDIF COM}
;
...

{$IFDEF COM}
function CreateOLEObject(const ClassName: string): Variant;
begin
  Result := CreateOLEObject(ClassName);
end;
{$ENDIF COM}
...
procedure TForm1.FormCreate(Sender: TObject);
begin
  CoInitializeEx(nil, 0);
end;
...
procedure Compile(Run, Disassemble: Boolean);
...
      Compiler.addGlobalFunc('function CreateOLEObject(const ClassName: string): Variant;', @CreateOLEObject);

//
// file: test\ole.lap
//
var
  s: string;
  xmlDoc: Variant;
begin
  s := 'MSXML2.DOMDocument';
  WriteLn('com(1):', s);
  xmlDoc := VarCreateOLEObject('MSXML2.DOMDocument');
  xmlDoc.validateOnParse := True; // *** LINE 8 ***
  xmlDoc.async := False;
  xmlDoc := Null;
  WriteLn('com(1)!', s);
end;

//
// error:
//
Compilation error: "Operator "Dot" not compatible with types "Variant" and 
"AnsiString" at line 8, column 9"

Original issue reported on code.google.com by [email protected] on 19 Sep 2011 at 6:59

Unexpected behaviour in untyped parametres?

What will reproduce the problem?

procedure Foo(var G);
begin
  Writeln(G);  // Produces error.
  Writeln(VarType(G));  // Produces same error.
  if(G = 10) then  
    Writeln('Blegh');
end;

What is the expected output? What do you see instead?
Expected output:
 * The value of the variable.
 * The type of the variable, as described in https://code.google.com/p/la-pe/source/browse/lpeval_import_variant.inc

Actual output:
"Exception in Script: Cannot invoke identifier"

Which version are you using?

Most recent (Simba build #493, http://l0.lt/builders/master/builds/493 )

Please provide any additional information below.

See post - http://villavu.com/forum/showthread.php?t=68613&p=1265797#post1265797

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

Ambiguous call with [] as TBox

procedure Test(box: TBox);
begin
  writeln(box);
end;

begin
  Test([1, 2, 3, 4]);
end.

This works fine but adding any overloaded method would result in ambiguous 
call. Since the argument [1, 2, 3, 4] could only be either a TBox or 
TIntegerArray, adding an overloaded method with parameter not being 
TIntegerArray should work fine?

Original issue reported on code.google.com by [email protected] on 10 Apr 2014 at 12:44

Small issue with enums

Well this is really a tiny not important issue, which is why I haven't reported it before now..

Both these test-cases can, and will from time to time cause lape to crash.

type E = (ea, eb, ec, ed=9);  //this can crash lape from time to time
begin
  WriteLn(ed); //InvalidEnum(..)
end;
type E = (ea=1, eb=2, ec=5, ed=9);
var aa:E;
begin
  aa := ed;
  WriteLn(ed); //InvalidEnum(..)
end.

There is also lacking error-handling here, allowing this:

type E = (ea=7, eb=1, ec, ed)

to compile and crash the interpreter.


This is tested with the versions of lape that Simba has used up to this date.

Call a procedure directly

This post is more a newbie question than a bug report...
Thanks for your great job, looks very promising.

I have a question : how to call a procedure with parameters directly?

RunCode(Compiler.Emitter.Code);

runs all the script but I need to call only one declared procedure.
Any solution?

Please provide any additional information below.

Thanks 

Original issue reported on code.google.com by [email protected] on 15 Jun 2013 at 8:53

Nested IFDEFs produce unexpected, unwanted results.

What will reproduce the problem?

program new;
{$DEFINE BAR}
{$IFDEF FOO}
{$IFDEF BAR}
var gsb: integer;
{$ELSE}
var gsgss: integer;
{$ENDIF}
{$ENDIF}

begin
// this should not be possible. neither should exist!
gsgss := 42;
end.

What is the expected output? What do you see instead?

See above.

Which version are you using?

Latest in Simba.

Original issue reported on code.google.com by [email protected] on 27 Jul 2012 at 11:55

[Enhancement] Loose syntax

1. Refer to http://villavu.com/forum/showthread.php?t=105747

2.
Can you make it possible to declare variables in arguments?
Eg. 
FindColors(var TPA, ...)
GetMousePos(var x, var y)
Would be so much more convenient :p

Original issue reported on code.google.com by [email protected] on 13 Sep 2013 at 10:52

Issue with ffi exporting

Resulting a string, variant, or an array in a ffi export fails. This snippet should explain everything, just replace Compile in main.pas with this.

procedure Compile(Run, Disassemble: Boolean);

  function CombineDeclArray(a, b: TLapeDeclArray): TLapeDeclArray;
  var
    i, l: Integer;
  begin
    Result := a;
    l := Length(a);
    SetLength(Result, l + Length(b));
    for i := High(b) downto 0 do
      Result[l + i] := b[i];
  end;

type
  TArrayFunc = function(): TIntegerArray; cdecl;
  TStringFunc = function(): lpString; cdecl;
  TVariantFunc = function(): Variant; cdecl;
  TSimpleFunc = function(): Integer; cdecl;
var
  t: Cardinal;
  Parser: TLapeTokenizerBase;
  Compiler: TLapeCompiler;
  c: TImportClosure;
  SimpleExport, ArrayExport, StringExport, VariantExport: TExportClosure;
  a: TIntegerArray;
  i: Integer;
  s: lpString;
  v: Variant;
begin
  Parser := nil;
  Compiler := nil;
  with Form1 do
    try
      Parser := TLapeTokenizerString.Create({$IF DEFINED(Lape_Unicode)}UTF8Decode(e.Lines.Text){$ELSE}e.Lines.Text{$IFEND});
      Compiler := TLapeCompiler.Create(Parser);

      InitializePascalScriptBasics(Compiler, [psiTypeAlias]);
      ExposeGlobals(Compiler);

      Compiler.addGlobalMethod('procedure _write(s: string); override;', @MyWrite, Form1);
      Compiler.addGlobalMethod('procedure _writeln; override;', @MyWriteLn, Form1);
      Compiler.addGlobalFunc('function MyStupidProc: array of integer', @MyStupidProc);

      c := LapeImportWrapper(@StupidProc, Compiler, 'function(abc: array of integer): array of integer', FFI_SYSV);
      Compiler.addGlobalFunc('function StupidProc(abc: array of integer): array of integer', c.Func);

      Compiler.addGlobalType('array of Integer', 'TIntegerArray');
      Compiler.addDelayedCode('function StupidFunc: TIntegerArray; begin Exit([10, 20, 30, 40, 50]); end;');

      Compiler.addDelayedCode('function StupidFunc2: String; begin Exit(''testing''); end;');
      Compiler.addDelayedCode('function StupidFunc3: Variant; begin Exit(12345); end;');

      Compiler.addDelayedCode('function StupidFuncEx: Integer; begin Exit(12345); end;');

      try
        t := getTickCount;
        if Compiler.Compile() then
        begin
          SimpleExport := LapeExportWrapper(Compiler.Globals['StupidFuncEx'], FFI_SYSV);
          ArrayExport := LapeExportWrapper(Compiler.Globals['StupidFunc'], FFI_SYSV);
          StringExport := LapeExportWrapper(Compiler.Globals['StupidFunc2'], FFI_SYSV);
          VariantExport := LapeExportWrapper(Compiler.Globals['StupidFunc3'], FFI_SYSV);

          m.Lines.add('Compiling Time: ' + IntToStr(getTickCount - t) + 'ms.')
        end else
          m.Lines.add('Error!');
      except
        on E: Exception do
        begin
          m.Lines.add('Compilation error: "' + E.Message + '"');
          Exit;
        end;
      end;

      try
        if (Disassemble) then
          DisassembleCode(Compiler.Emitter.Code, CombineDeclArray(Compiler.ManagedDeclarations.getByClass(TLapeGlobalVar, bTrue), Compiler.GlobalDeclarations.getByClass(TLapeGlobalVar, bTrue)));

        if (Run) then
        begin
          t := getTickCount;
          RunCode(Compiler.Emitter.Code);
          m.Lines.add('Running Time: ' + IntToStr(getTickCount - t) + 'ms.');

          { works }
          i := TSimpleFunc(SimpleExport.Func)();
          writeln('Simple done');

          { fails - massive console mem leak spam }
          a := TArrayFunc(ArrayExport.Func)();
          Writeln('Array done');

          { runs but throws a exception later on? }
          //s := TStringFunc(StringExport.Func)();
          //Writeln('String done: ', s);

          { runs but throws a exception later on? }
          //v := TVariantFunc(VariantExport.Func)();
          //Writeln('Variant done: ', v);

        end;
      except
        on E: Exception do
        begin
          Writeln(e.Message);
          m.Lines.add(E.Message);
        end;
      end;
    finally
      if (Compiler <> nil) then
        Compiler.Free()
      else if (Parser <> nil) then
        Parser.Free();

      SimpleExport.Free;
      ArrayExport.Free;
      StringExport.Free;
      VariantExport.Free;
    end;
end;    

Calling Conv problem with FPC2.4.4

What will reproduce the problem?
  Compiling Lape on Linux with FPC 2.4.4

What is the expected output? What do you see instead?
  Compiled Sucessfully. Error.

Which version are you using?
  N/A, FPC 2.4.4

Please provide any additional information below.
  Your changes in 
  186015e8e9cd46073f69edf2ff3c74f86004710d and fd8825655b10340c37619e2d945c5d27d6343589
  broke compatibility with FPC 2.4.4. In 2.4.4 even on linux it should be stdcall.

  Here's an example of what it should be like: http://paste.villavu.com/show/9QAEdGLcjQgRfHu58ntt/

Original issue reported on code.google.com by [email protected] on 28 Mar 2012 at 8:59

Initializing inside the var block

Initializing a method pointer inside of the variable block doesn't work when 
the value is a script method.

Access Violation

http://pastebin.com/1i7kmzmn

Original issue reported on code.google.com by [email protected] on 4 Feb 2013 at 1:32

Statically linking ffi on OS X

I'm attempting to compile la-pe on OS X. I realize you haven't really built 
support for this yet and you have a todo in the ffi.pas file to do Mac support, 
but I was just having a go at it.

I was able to change a few IFDEF's in order to get the project to compile 
however now I'm running into some linking issues. When set to dynamically link 
everything compiles and links fine (obviously because it's not trying to link 
ffi at compile time). However, when I set it to static linking I'm getting 
errors with the linking.

Undefined symbols for architecture i386:
  "_ffi_closure_free", referenced from:
      _INIT$_FFI in ffi.o
  "_ffi_prep_closure_loc", referenced from:
      _INIT$_FFI in ffi.o
  "_ffi_closure_alloc", referenced from:
      _INIT$_FFI in ffi.o
ld: symbol(s) not found for architecture i386
An error occurred while linking 

I've made an extra directory under extensions/ffi/bin named "darwin" because 
that is where the linker is pointing. And I've added libffi.a and libffi.dylib 
to that folder but it's not helping. Apparently the linker is not finding it.

Just in case, I did a symbol dump on libffi.dylib and was able to find 
ffi_closure_free, ffi_prep_closure_loc, and ffi_closure_alloc in the list. 
Another interesting thing is that it's not complaining about not being able to 
find ffi_prep_cif or ffi_call which are also referenced from ffi.pas.

I don't specifically think this is necessarily a la-pe problem, I'm more 
leaning towards it might be something weird with how OS X does linking but I 
was just wondering if you might have any info or places you might start 
investigating.

Original issue reported on code.google.com by [email protected] on 22 Sep 2014 at 7:05

Internal methods don't inherit they're parents variables/types/constants

What will reproduce the problem?
  http://pastebin.com/q3sePpqB

What is the expected output? What do you see instead?
  Should print "42" (It works in Laz)
  I get "Exception in Script: Unknown declaration "c" at line 8, column 15"

Which version are you using?
  http://nala.villavu.com/downloads/settings-form/a1e88941403676e79607acc0ee1d54630e90d1e9/

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 28 Jan 2012 at 1:41

Internal Range Overflow/Loop

var
A:Byte;

for A:=1 to 255 do write(a," ");

output:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ... 251 252 253 254 255 0

It's impossible with certain boolean comparisons.

What will reproduce the problem?
  if (SomeBool and True) then

What is the expected output? What do you see instead?
  I get "It's impossible!" (Line 706 of lpvartypes_ord.pas)

Which version are you using?
  c96f612e0066  

Please provide any additional information below.
  Seems to not be an issue if True is first.

Original issue reported on code.google.com by [email protected] on 7 Sep 2014 at 12:33

Nested functions can't be recursive

A function (or procedure) declared inside a function cannot be recursive or 
call any other nested functions.

Test code here:
procedure Test;
  procedure Woof;
  begin
    Woof;
  end;
  procedure Meow;
  begin
    Woof;
  end;
begin
end;
begin
end.

Commenting out the recursive Woof call then gives the unknown declaration error 
on Meow's call of Woof.

Not sure if this is a bug, a bug/feature, or unsupported functionality, so 
hopefully I'm not being silly.

Original issue reported on code.google.com by [email protected] on 23 Mar 2012 at 9:03

  • Merged into: #10

keyword in, enum in set - does not work

program setColors;
type
color = (red, blue, yellow, green, white, black, orange);
colors = set of color;

procedure displayColors(c : colors);
const
names : array [color] of String[7] = ['red', 'blue', 'yellow', 'green', 'white', 'black', 'orange'];
var
cl : color;
s : String;
begin
s:= ' ';
if red in c then writeln('RED');
for cl:=red to orange do
if cl=red then writeln('*RED');
if cl in c then begin // has a bug!
writeln('never gets here');
if (s<>' ') then s :=s +' , ';
s:=s+names[cl];
end;
writeln('[',s,']');
end;

var
c : colors;

begin
c:= [red, blue, yellow, green, white, black, orange];
displayColors(c);
c:=[red, blue]+[yellow, green];
displayColors(c);
c:=[red, blue, yellow, green, white, black, orange] - [green, white];
displayColors(c);
c:= [red, blue, yellow, green, white, black, orange]*[green, white];
displayColors(c);
end.

All compiler defines are parsed at all times

What will reproduce the problem?
  If you compile the test program with a handler for OnHandleDirective.
  Then have any {$IFDEF SomethingNoDefined}{$MyCustomDirective}{$ENDIF}

What is the expected output? What do you see instead?
  It shouldn't call handleDirective (or at least have a param stating were in a section of code that shouldn't be there...

Which version are you using?
  Latest

Please provide any additional information below.
  This is an issue for custom compiler defines being used inside of a IFDEF.

Original issue reported on code.google.com by [email protected] on 7 Oct 2014 at 4:02

Exit'ing out of a try..finally doesn't work

What will reproduce the problem?
  http://paste.villavu.com/show/543/

What is the expected output? What do you see instead?
  Before Try
  After Try
  In Finally (You don't get this.)

Which version are you using?
  r72


Original issue reported on code.google.com by [email protected] on 31 Mar 2011 at 12:32

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.