Re: [fpc-pascal] googleapiconv

2016-08-22 Thread Dave Connolly
>From what I can see the error seems to involve these two lines in the
procedure TBaseObject.SetObjectProperty(P: PPropInfo; AValue: TJSONObject);
in restbase.pp (fcl-web)

PA:=@(pdynarraytypeinfo(P^.PropType)^.elesize)+i;
PA:=@(pdynarraytypeinfo(P^.PropType)^.eletype)+i;


AN:=PTYpeInfo(PA^)^.Name;

In my scenario the PTYpeInfo(PA^)^.Name is "t�/t�/t�/t0t@0t"

FPC 3.1.1 revision 34368

Regards,
Dave


On 16 August 2016 at 08:51, Michael Van Canneyt 
wrote:

>
>
> On Mon, 15 Aug 2016, Dave Connolly wrote:
>
> The Google APIs run fine when compiled with FPC 3.0.0
>>
>
> Strange. I will look into it.
>
>
> Michael.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] googleapiconv

2016-08-22 Thread Michael Van Canneyt



On Mon, 22 Aug 2016, Dave Connolly wrote:


From what I can see the error seems to involve these two lines in the

procedure TBaseObject.SetObjectProperty(P: PPropInfo; AValue: TJSONObject);
in restbase.pp (fcl-web)

   PA:=@(pdynarraytypeinfo(P^.PropType)^.elesize)+i;
   PA:=@(pdynarraytypeinfo(P^.PropType)^.eletype)+i;


   AN:=PTYpeInfo(PA^)^.Name;

In my scenario the PTYpeInfo(PA^)^.Name is "t???/t???/t???/t0t@0t"

FPC 3.1.1 revision 34368


I suspect this has to do with the additional level of indirection added by
Sven Barth. I will need to check that.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] googleapiconv

2016-08-22 Thread Sven Barth
Am 22.08.2016 15:16 schrieb "Michael Van Canneyt" :
>
>
>
> On Mon, 22 Aug 2016, Dave Connolly wrote:
>
>>> From what I can see the error seems to involve these two lines in the
>>
>> procedure TBaseObject.SetObjectProperty(P: PPropInfo; AValue:
TJSONObject);
>> in restbase.pp (fcl-web)
>>
>>PA:=@(pdynarraytypeinfo(P^.PropType)^.elesize)+i;
>>PA:=@(pdynarraytypeinfo(P^.PropType)^.eletype)+i;
>>
>>
>>AN:=PTYpeInfo(PA^)^.Name;
>>
>> In my scenario the PTYpeInfo(PA^)^.Name is "t???/t???/t???/t0t@0t"
>>
>> FPC 3.1.1 revision 34368
>
>
> I suspect this has to do with the additional level of indirection added by
> Sven Barth. I will need to check that.

Best don't use pdynarraytypeinfo as that doesn't correctly handle alignment
either, use PTypeData instead.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] googleapiconv

2016-08-22 Thread Michael Van Canneyt



On Mon, 22 Aug 2016, Sven Barth wrote:


Am 22.08.2016 15:16 schrieb "Michael Van Canneyt" :




On Mon, 22 Aug 2016, Dave Connolly wrote:


From what I can see the error seems to involve these two lines in the


procedure TBaseObject.SetObjectProperty(P: PPropInfo; AValue:

TJSONObject);

in restbase.pp (fcl-web)

   PA:=@(pdynarraytypeinfo(P^.PropType)^.elesize)+i;
   PA:=@(pdynarraytypeinfo(P^.PropType)^.eletype)+i;


   AN:=PTYpeInfo(PA^)^.Name;

In my scenario the PTYpeInfo(PA^)^.Name is "t???/t???/t???/t0t@0t"

FPC 3.1.1 revision 34368



I suspect this has to do with the additional level of indirection added by
Sven Barth. I will need to check that.


Best don't use pdynarraytypeinfo as that doesn't correctly handle alignment
either, use PTypeData instead.



So what should this be changed to:

i:=Length(P^.PropType^.name);
PA:=@(pdynarraytypeinfo(P^.PropType)^.eletype)+i;
ET:=PTYpeInfo(PA^);
if (ET^.Kind=tkClass) then
  begin
  // get object type name
  AN:=ET^.Name;
  // Free all objects
  O:=TObjectArray(AP);
  For I:=0 to Length(O)-1 do
FreeAndNil(O[i]);
  end;
// Clear array
{$ifdef ver2_6}
LPN:=Lowercase(P^.Name);
SetArrayLength(LPN,0);
{$else}
I:=0;
DynArraySetLength(AP,P^.PropType,1,@i);
{$endif}
// Now, set new length



Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Doubt related to the issue #30498

2016-08-22 Thread silvioprog
Hello,

A possible inline way (without declaring specialized local variables) to
compile the attached test at the issue #30498
 is:

...
  procedure Test(const AItems: TArray);
  begin
  end;

begin
  // Test(['foo', 'bar']); issue #30498
  Test(TArray.Create('foo', 'bar'));
...

However, how to do something like this in the following declaration?:

...
procedure Test(const AItems: TArray>);
...

I've tried:

...
  procedure Test(const AItems: TArray>);
  begin
  end;

begin
  Test(TArray>.Create(TPair.Create('foo', 'bar')));
...

Got:

project1.dpr(18,37) Error: Illegal expression
project1.dpr(18,38) Fatal: Syntax error, ")" expected but "identifier
CREATE" found

Thank you!

--
Silvio Clécio
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Can not set voice property of SpVoice

2016-08-22 Thread Toru Takubo

Hello,

I am testing a text to speech program working on Windows SAPI, and I
encountered a problem that I can not set the Voice property because
"member not found".

Below is the code which describe the problem. It is originally from
the freepascal wiki (http://wiki.freepascal.org/SAPI) and slightly
modified. Setting the voice property in this code is meaningless,
I know. It is just to reproduce the problem.

The SpVoice.Speak method itself works fine. I am working with fpc
3.0.0 on Windows 7 64bit. Any advice would be appreciated.

Regards,

Toru

___
program TestSAPI;

uses
  SysUtils, comobj;
var
  SavedCW: Word;
  SpVoice: Variant;
  Token: Variant;
begin
  SpVoice := CreateOleObject('SAPI.SpVoice');
  // Change FPU interrupt mask to avoid SIGFPE exceptions
  SavedCW := Get8087CW;
  try
Set8087CW(SavedCW or $4);

Token := SpVoice.Voice; //I can get a voice token.
Writeln(Token.GetDescription); //The token actually works.

try
  SpVoice.Voice := Token; //"member not found" exception here. I can't set 
it.
except
  on E:Exception do begin
Writeln(E.Message);
  end;
end;

SpVoice.Speak('hi', 0);
  finally
// Restore FPU mask
Set8087CW(SavedCW);
  end;
  Readln;
end.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Doubt related to the issue #30498

2016-08-22 Thread Sven Barth
Am 23.08.2016 04:24 schrieb "silvioprog" :
>
> Hello,
>
> A possible inline way (without declaring specialized local variables) to
compile the attached test at the issue #30498 is:
>
> ...
>   procedure Test(const AItems: TArray);
>   begin
>   end;
>
> begin
>   // Test(['foo', 'bar']); issue #30498
>   Test(TArray.Create('foo', 'bar'));
> ...
>
> However, how to do something like this in the following declaration?:
>
> ...
> procedure Test(const AItems: TArray>);
> ...
>
> I've tried:
>
> ...
>   procedure Test(const AItems: TArray>);
>   begin
>   end;
>
> begin
>   Test(TArray>.Create(TPair.Create('foo', 'bar')));
> ...
>
> Got:
>
> project1.dpr(18,37) Error: Illegal expression
> project1.dpr(18,38) Fatal: Syntax error, ")" expected but "identifier
CREATE" found

See here: http://bugs.freepascal.org/view.php?id=30503

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal