Re: [fpc-pascal] Untyped var params

2017-01-08 Thread Ryan Joseph
> On Jan 8, 2017, at 5:36 PM, Ryan Joseph wrote: > > Casting TObject(input) := obj; worked but the value of “io” is still not > getting set. Because it’s a var I expected the value to be returned to the > caller. Never mind, I got it working, stupid mistake in my

Re: [fpc-pascal] Untyped var params

2017-01-08 Thread Sven Barth
On 08.01.2017 11:36, Ryan Joseph wrote: > >> On Jan 8, 2017, at 5:22 PM, Sven Barth wrote: >> >> 1. Why are you trying to assign something to io when you already did >> that with "obj := …"? > > I used absolute here so I could know the type of io and not type cast

Re: [fpc-pascal] Untyped var params

2017-01-08 Thread Sven Barth
On 08.01.2017 10:35, Ryan Joseph wrote: > >> On Jan 8, 2017, at 2:37 AM, Andrew Hall wrote: >> >> If you cast your “something” to a typed pointer, the compiler will do the >> work for you in the usual way: >> >> PDouble(something)^ := myDouble; >> PAnsiString(something)^ :=

Re: [fpc-pascal] FPC clean room project

2017-01-08 Thread Mark Morgan Lloyd
On 07/01/17 19:30, Lars wrote: On Fri, January 6, 2017 12:51 pm, Sven Barth wrote: Ehm... Delphi's compiler is written in C++, not Delphi as far as we know. Also their NEXTGEN compiler is utilizing LLVM, something we won't purely do. Yes the exe signature was c/c++ That does not forgive

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 10:55, Ryan Joseph wrote: > I’m going to attempt to translate a perlin noise function (from > https://gist.github.com/Flafla2/f0260a861be0ebdeef76) but there are a few > things that stopped me from starting. > > 1) What is & doing in this assignment? I see this many places in

Re: [fpc-pascal] Untyped var params

2017-01-08 Thread Ryan Joseph
> On Jan 8, 2017, at 5:22 PM, Sven Barth wrote: > > 1. Why are you trying to assign something to io when you already did > that with "obj := …"? I used absolute here so I could know the type of io and not type cast within the function. No good? The idea is I want

Re: [fpc-pascal] Untyped var params

2017-01-08 Thread Ryan Joseph
> On Jan 8, 2017, at 2:37 AM, Andrew Hall wrote: > > If you cast your “something” to a typed pointer, the compiler will do the > work for you in the usual way: > > PDouble(something)^ := myDouble; > PAnsiString(something)^ := myAnsiString; > myRecordStructure :=

[fpc-pascal] C# translatation

2017-01-08 Thread Ryan Joseph
I’m going to attempt to translate a perlin noise function (from https://gist.github.com/Flafla2/f0260a861be0ebdeef76) but there are a few things that stopped me from starting. 1) What is & doing in this assignment? I see this many places in assignments. int h = hash & 15; 2) % is the mod

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Ryan Joseph
> On Jan 8, 2017, at 5:46 PM, Sven Barth wrote: > >> 2) % is the mod operator in pascal right? So what is the modular assignment >> %=? num = num mod repeat? >> >> p[x] = permutation[x%256]; >> >> if (repeat > 0) num %= repeat; > > Correct for both. why am I

Re: [fpc-pascal] Repeat result in random

2017-01-08 Thread Pierre Free Pascal
Hi all, I finally found the location of the error, that I introduced in revision 34320. It should be fixed in revision 35259. Pierre PS: Explanation for those interested: Indeed this is my fault, the incrementation of global variable mt_index was done after the 'if ...=MTWIST_N

Re: [fpc-pascal] FPC 3.0.0 seed compiler for Rasperry Pi ARM?

2017-01-08 Thread Sven Barth
On 08.01.2017 11:20, Bo Berglund wrote: > On Sat, 7 Jan 2017 12:24:39 +0100 (CET), "Karoly Balogh (Charlie/SGR)" > wrote: > Then I went looking for the new ppcarm compiler and found it in these > locations: > > /home/pi/dev/fpc/3.0.2RC1/compiler/ppcarm (in the source

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Ryan Joseph
> On Jan 8, 2017, at 5:46 PM, Sven Barth wrote: > > if h and 1 = 0 then > result := u > else > result := -u; > if h and 2 = 0 then > result := result + v > else > result := result - v; Thanks Sven, I appreciate it. I forgot about binary and operator some how

Re: [fpc-pascal] Untyped var params

2017-01-08 Thread Sven Barth
Am 08.01.2017 04:43 schrieb "Dmitry Boyarintsev" : > > On Sat, Jan 7, 2017 at 6:02 PM, Lars wrote: >> >> Some brave soldiers once tried to reinvent generics using these tricks.. > > > Well, Pascal run-time has been using "hidden" generics forever. > >

Re: [fpc-pascal] FPC 3.0.0 seed compiler for Rasperry Pi ARM?

2017-01-08 Thread Bo Berglund
On Sat, 7 Jan 2017 12:24:39 +0100 (CET), "Karoly Balogh (Charlie/SGR)" wrote: >Hi > >On Sat, 7 Jan 2017, Bo Berglund wrote: > >> I went ahead and tried the command but it failed miserably... >> >> pi@rpi3-jessie:~/dev/fpc/3.0.2RC1 $ make all install >>

Re: [fpc-pascal] ppcjvm issues

2017-01-08 Thread Sven Barth
On 07.01.2017 03:12, Jon Foster wrote: > I've been working on building an app for Android using the FPC's JVM > target. I'm using fpc 3.0.0. I've run into a couple of things that I'm > not sure if they're bugs or I just don't know what I'm doing. I was > using fpc to avoid having to learn Java and

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Ryan Joseph
> On Jan 8, 2017, at 6:55 PM, Ryan Joseph wrote: > > why am I getting this error? Operator is not overloaded: "Double" mod > “LongInt”. Mod can’t be used with double and integers like in C? Sorry for the repeat. Same error here but "Operator is not overloaded:

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 12:55, Ryan Joseph wrote: > >> On Jan 8, 2017, at 5:46 PM, Sven Barth wrote: >> >>> 2) % is the mod operator in pascal right? So what is the modular assignment >>> %=? num = num mod repeat? >>> >>> p[x] = permutation[x%256]; >>> >>> if (repeat > 0) num

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 13:01, Ryan Joseph wrote: > >> On Jan 8, 2017, at 6:55 PM, Ryan Joseph wrote: >> >> why am I getting this error? Operator is not overloaded: "Double" mod >> “LongInt”. Mod can’t be used with double and integers like in C? > > > Sorry for the repeat.

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Ryan Joseph
> On Jan 8, 2017, at 7:54 PM, Sven Barth wrote: > > Ehm, right. Add the Math unit, it contains an operator overload for > floating points. Alternatively you can use (also from the Math unit) the > FMod() function. Hmmm, adding Math didn’t help and the FMod function

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 14:05, Ryan Joseph wrote: > >> On Jan 8, 2017, at 7:54 PM, Sven Barth wrote: >> >> Ehm, right. Add the Math unit, it contains an operator overload for >> floating points. Alternatively you can use (also from the Math unit) the >> FMod() function. > >

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
Am 08.01.2017 17:32 schrieb "Bernd Oppolzer" : > > Am 08.01.2017 um 11:46 schrieb Sven Barth: >> >> On 08.01.2017 10:55, Ryan Joseph wrote: >>> >>> I’m going to attempt to translate a perlin noise function (from https://gist.github.com/Flafla2/f0260a861be0ebdeef76) but

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Bernd Oppolzer
Am 08.01.2017 um 18:22 schrieb Sven Barth: Am 08.01.2017 17:32 schrieb "Bernd Oppolzer" >: > > Am 08.01.2017 um 11:46 schrieb Sven Barth: >> >> On 08.01.2017 10:55, Ryan Joseph wrote: >>> >>> I’m going to attempt to translate a

Re: [fpc-pascal] FPC 3.0.0 seed compiler for Rasperry Pi ARM?

2017-01-08 Thread Bo Berglund
On Sun, 8 Jan 2017 11:25:58 +0100, Sven Barth wrote: >> Is there a reason for this strange behaviour? Especially why the >> actual new compiler was placed in such a remote place? >> > >The install make target places the main binaries in /bin and the ppcXXX >binaries

Re: [fpc-pascal] C# translatation

2017-01-08 Thread José Mejuto
El 08/01/2017 a las 17:31, Bernd Oppolzer escribió: Please keep in mind that & is a bitwise and in C whereas && is a logical and; this makes much difference and has to be implemented or converted differently with Pascal, IMO. the closest equivalence to bitwise and in Pascal are set

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Bernd Oppolzer
Am 08.01.2017 um 11:46 schrieb Sven Barth: On 08.01.2017 10:55, Ryan Joseph wrote: I’m going to attempt to translate a perlin noise function (from https://gist.github.com/Flafla2/f0260a861be0ebdeef76) but there are a few things that stopped me from starting. 1) What is & doing in this

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Dmitry Boyarintsev
On Sun, Jan 8, 2017 at 12:22 PM, Sven Barth wrote: > The closest equivalence to bitwise and in Pascal is bitwise and. > > The operators "and", "or", "xor" and "not" are logical or bitwise > depending on their arguments. > With that said... On Sun, Jan 8, 2017 at

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 18:36, Bernd Oppolzer wrote: > Am 08.01.2017 um 18:22 schrieb Sven Barth: >> >> Am 08.01.2017 17:32 schrieb "Bernd Oppolzer" >> >: >> > >> > Am 08.01.2017 um 11:46 schrieb Sven Barth: >> >> >> >> On 08.01.2017 10:55, Ryan

[fpc-pascal] TProcess failed running Swift compiler

2017-01-08 Thread Mr Bee
Hi, I'm writing a simple editor for Swift language. I use TProcess to run the Swift REPL. Unfortunately, TProcess failed to execute the Swift REPL for no obvious reasons. The Swift compiler and REPL are installed just fine and able to execute any Swift codes. My exact same code has no problem