Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread wkitty42
On 05/01/2018 07:09 AM, Ryan Joseph wrote: In PHP I always just load the file into string and loop over it line by line using regex to cut out the parts I need. I like it because it’s so easy to write and gets the job done. What ever I would make it Pascal would be 10x larger probably. FWIW: yo

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ryan Joseph
> On May 1, 2018, at 5:55 PM, Marco van de Voort wrote: > > I already stumbled on regex :_) Anyone feel free to make a good example of a token parser in Pascal so I can see how it looks. I never an actual good parser that understands syntax so I don’t have any good examples to go by. In PHP

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > >> If you have access to the underlying API spec in the form of an IDL, then > >> we > >> could make a tool that parses the IDL and dumps the API in the form of > >> "external" declarations. > > > > There it is. A parser needs to be made I guess

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Ryan Joseph wrote: On May 1, 2018, at 4:37 PM, Michael Van Canneyt wrote: What's wrong with the above code ? It obviously works well enough, otherwise they wouldn't have made the API so. The float32 array is a Javascript type that encapsulates a memory buffer. I assu

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Mattias Gaertner
On Tue, 1 May 2018 10:52:32 +0200 (CEST) Michael Van Canneyt wrote: >[...] > > Note that the 'var' is a workaround till eventually pas2js supports > > external 'const' without expression. > > Well, I specially did not mention this, because I consider it a dirty hack. > a var doesn't protect yo

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ryan Joseph
> On May 1, 2018, at 4:37 PM, Michael Van Canneyt > wrote: > > What's wrong with the above code ? > > It obviously works well enough, otherwise they wouldn't have made the API so. > > The float32 array is a Javascript type that encapsulates a memory buffer. > I assu It’s difficult to work w

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Ingemar Ragnemalm wrote: Den 2018-05-01 kl. 09:50, Ryan Joseph wrote: On Apr 25, 2018, at 9:43 PM, Michael Van Canneyt wrote: Ah, webgl... I had a look at this some time ago, and got depressed. Quickly closed the browser and didn't look back. Same for webaudio:( I’m

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Ryan Joseph wrote: On May 1, 2018, at 4:10 PM, Mattias Gaertner wrote: In pas2js it will probably look similar to this: var vertices: array of glfloat = (-0.5, 0.5, -0.5, -0.5, 0.0, -0.5); var vertex_buffer: TInsertNameHere; begin // Create a new buffer object verte

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ryan Joseph
> On May 1, 2018, at 4:10 PM, Mattias Gaertner > wrote: > > In pas2js it will probably look similar to this: > > var vertices: array of glfloat = (-0.5, 0.5, -0.5, -0.5, 0.0, -0.5); > var vertex_buffer: TInsertNameHere; > begin > // Create a new buffer object > vertex_buffer = gl.createBuff

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Ryan Joseph wrote: On May 1, 2018, at 4:12 PM, Michael Van Canneyt wrote: If you have access to the underlying API spec in the form of an IDL, then we could make a tool that parses the IDL and dumps the API in the form of "external" declarations. There it is. A parse

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ryan Joseph
> On May 1, 2018, at 4:12 PM, Michael Van Canneyt > wrote: > > If you have access to the underlying API spec in the form of an IDL, then we > could make a tool that parses the IDL and dumps the API in the form of > "external" declarations. There it is. A parser needs to be made I guess. You c

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Mattias Gaertner wrote: On Tue, 1 May 2018 15:23:25 +0700 Ryan Joseph wrote: [...] what do we do for records then? We often need to pass arrays of specific types for functions such as glBufferData. type TVec2f = record x, y: GLfloat; end; type TVec2b = recor

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Ryan Joseph wrote: The above would be Type WebGLActiveInfo = class external name 'WebGLActiveInfo' Private fSize : GLint; external name 'size'; ftype: GLEnum; external name 'type'; fName : DOMString ; external name 'name'; Public Property size : GLInt Read

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Mattias Gaertner
On Tue, 1 May 2018 15:23:25 +0700 Ryan Joseph wrote: >[...] > what do we do for records then? We often need to pass arrays of specific > types for functions such as glBufferData. > > type > TVec2f = record > x, y: GLfloat; > end; > > type > TVec2b = record > x, y: GLubyte; > en

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Ryan Joseph wrote: On May 1, 2018, at 3:17 PM, Mattias Gaertner wrote: JS only knows double for numbers. At compile time you can use almost all the normal types: byte, word, longint, etc. pas2js has an alias single, but because internally it is a double this gives war

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ryan Joseph
> On May 1, 2018, at 3:50 PM, Michael Van Canneyt > wrote: > > > As far as I know, all consts in Javascript are scoped ? > > If this is not the case, then of course we should allow it. I think they added const. In the past I’ve seen using “let” but I don’t think that’s a real const if that

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Mattias Gaertner
On Tue, 1 May 2018 15:36:59 +0700 Ryan Joseph wrote: >[...] > > Constants without expression can only exist in an external class. > > Just curious but why can’t you declare a const anywhere for any reasons? You can. > >> Also I mistyped, GLfloat is a type so how do this map to JS, or do I e

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ryan Joseph
> On May 1, 2018, at 3:17 PM, Mattias Gaertner > wrote: > > JS only knows double for numbers. > > At compile time you can use almost all the normal types: byte, > word, longint, etc. > pas2js has an alias single, but because internally it is a double this > gives warnings. what do we do for

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Mattias Gaertner wrote: On Tue, 1 May 2018 14:20:12 +0700 Ryan Joseph wrote: > On May 1, 2018, at 2:03 PM, Michael Van Canneyt wrote: > > Of sorts. > MyClass = Class external name 'my' > const >MyConst : integer > end; > > Will emit MyClass.MyConst. The compi

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Ryan Joseph wrote: On May 1, 2018, at 3:17 PM, Michael Van Canneyt wrote: So constants must be part of the class? In the example below gl.COLOR_BUFFER_BIT is scoped to WebGLRenderingContext so I guess that’s the reason. Yes. Constants without expression can only

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ryan Joseph
> On May 1, 2018, at 3:17 PM, Michael Van Canneyt > wrote: > >> So constants must be part of the class? In the example below >> gl.COLOR_BUFFER_BIT is scoped to WebGLRenderingContext so I guess that’s the >> reason. > > Yes. > > Constants without expression can only exist in an external cl

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Mattias Gaertner
On Tue, 1 May 2018 14:20:12 +0700 Ryan Joseph wrote: > > On May 1, 2018, at 2:03 PM, Michael Van Canneyt > > wrote: > > > > Of sorts. > > MyClass = Class external name 'my' > > const > >MyConst : integer > > end; > > > > Will emit MyClass.MyConst. The compiler needs to know the type.

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Ryan Joseph wrote: On May 1, 2018, at 2:03 PM, Michael Van Canneyt wrote: Of sorts. MyClass = Class external name 'my' const MyConst : integer end; Will emit MyClass.MyConst. The compiler needs to know the type. I’m confused now. The class is named WebGLRende

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Mattias Gaertner
On Tue, 1 May 2018 15:03:30 +0700 Ryan Joseph wrote: > > On May 1, 2018, at 2:55 PM, Mattias Gaertner > > wrote: > > > > GLFloat is a type, not a const. > > > > type GLFloat = double; > > Yeah I mistyped. We shouldn’t be redefining GLfloat though (I doubt it’s a > double in OpenGLES/WebGL

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ryan Joseph
> On May 1, 2018, at 2:55 PM, Mattias Gaertner > wrote: > > GLFloat is a type, not a const. > > type GLFloat = double; Yeah I mistyped. We shouldn’t be redefining GLfloat though (I doubt it’s a double in OpenGLES/WebGL either) so how does this (or other types) translate for the parser? Re

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Mattias Gaertner
On Tue, 1 May 2018 12:11:37 +0700 Ryan Joseph wrote: >[...] > const > GLfloat = MAP_TO_SOMETHING; // do we have external consts? GLFloat is a type, not a const. type GLFloat = double; Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Ryan Joseph
> On May 1, 2018, at 2:03 PM, Michael Van Canneyt > wrote: > > Of sorts. > MyClass = Class external name 'my' > const >MyConst : integer > end; > > Will emit MyClass.MyConst. The compiler needs to know the type. I’m confused now. The class is named WebGLRenderingContext in JS (I think

Re: [fpc-pascal] Next language feature for pas2js...

2018-05-01 Thread Michael Van Canneyt
On Tue, 1 May 2018, Ryan Joseph wrote: On May 1, 2018, at 11:27 AM, Michalis Kamburelis wrote: I suspect that we will have a unit like WebGL in pas2js that exposes the necessary JS functions for Pascal applications. Sure but how does the porting process look? I’m reading the wiki and i

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-30 Thread Michael Van Canneyt
On Tue, 1 May 2018, Michalis Kamburelis wrote: I had a look at this some time ago, and got depressed. Quickly closed the browser and didn't look back. Same for webaudio :( The API of WebGL is actually mostly a subset of OpenGLES which is a subset of OpenGL. WebGL is quite small, if you com

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-30 Thread Ryan Joseph
> On May 1, 2018, at 11:27 AM, Michalis Kamburelis > wrote: > > I suspect that we will have a unit like WebGL in pas2js that exposes > the necessary JS functions for Pascal applications. Sure but how does the porting process look? I’m reading the wiki and it looks like it wraps JavaScript cl

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-30 Thread Michalis Kamburelis
2018-05-01 4:50 GMT+02:00 Ryan Joseph : > > >> On Apr 25, 2018, at 9:43 PM, Michael Van Canneyt >> wrote: >> >> Ah, webgl... >> >> I had a look at this some time ago, and got depressed. Quickly closed the >> browser and didn't look back. Same for webaudio :( The API of WebGL is actually mostly

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-30 Thread Ryan Joseph
> On Apr 25, 2018, at 9:43 PM, Michael Van Canneyt > wrote: > > Ah, webgl... > > I had a look at this some time ago, and got depressed. Quickly closed the > browser and didn't look back. Same for webaudio :( I’m actually a little curious about this myself because I’ve been using OpenGL oft

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-26 Thread Michael Van Canneyt
On Thu, 26 Apr 2018, Michael Schnell wrote: On 25.04.2018 15:20, Michael Van Canneyt wrote: Now that interface support has been added to the list of implemented language features of pas2js, we're looking to get feedback on what best to tackle next. Of course rather off-topic here, but as yo

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-26 Thread Michael Schnell
On 25.04.2018 15:20, Michael Van Canneyt wrote: Now that interface support has been added to the list of implemented language features of pas2js, we're looking to get feedback on what best to tackle next. Of course rather off-topic here, but as you ask: How usable is Lazarus for pas2js developm

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-26 Thread Mattias Gaertner
On Thu, 26 Apr 2018 13:13:25 +0200 (CEST) Michael Van Canneyt wrote: > On Thu, 26 Apr 2018, Benito van der Zander wrote: > > > > > Hi, > > > > I would like to vote for pointer support... > > "Pointers to records" are supported. Basically pointers are implemented as JS references. For example

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-26 Thread Michael Van Canneyt
On Thu, 26 Apr 2018, Benito van der Zander wrote: Hi, I would like to vote for pointer support... "Pointers to records" are supported. But general purpose pointers and such are not planned. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-26 Thread Benito van der Zander
Hi, I would like to vote for pointer support... Cheers, Benito On 25.04.2018 15:20, Michael Van Canneyt wrote: Hello, Now that interface support has been added to the list of implemented language features of pas2js, we're looking to get feedback on what best to tackle next. This tim

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-26 Thread Michael Van Canneyt
On Wed, 25 Apr 2018, Reimar Grabowski wrote: On Wed, 25 Apr 2018 16:43:30 +0200 (CEST) Michael Van Canneyt wrote: Ah, webgl... I had a look at this some time ago, and got depressed. Can you elaborate? Nothing special, simply the sheer size of it :( Michael. ___

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-25 Thread Reimar Grabowski
On Wed, 25 Apr 2018 16:43:30 +0200 (CEST) Michael Van Canneyt wrote: > Ah, webgl... > > I had a look at this some time ago, and got depressed. Can you elaborate? R. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.o

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-25 Thread Michael Van Canneyt
On Wed, 25 Apr 2018, Ingemar Ragnemalm wrote: Michael Van Canneyt wrote: Hello, Now that interface support has been added to the list of implemented language features of pas2js, we're looking to get feedback on what best to tackle next. This time, the poll is not on the forum, so you