Re: [fpc-pascal] First pas2js public release

2018-01-07 Thread Sven Barth via fpc-pascal
On 07.01.2018 15:03, Ingemar Ragnemalm wrote:
> and here is an (almost) fully working snake game:
> 
> http://ragnemalm.se/images/santa/snake/snake.html
> 

Perhaps you should write somewhere how the snake is controlled. I
personally am used to using all four cursor keys to control the snake's
movement based on the global coordinate system instead of only left and
right from the local coordinate system on the snake. So I was quite
confused at first as I used "Up", but the snake didn't move there... ^^'

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

Re: [fpc-pascal] First pas2js public release

2018-01-07 Thread Sandro Cumerlato
Awesame work! :-)

areas for improvement:

in santa2
- loop Jingle Bells.mp3 for an infinite pleasure ;-)
- play boing.mp3 multiple times in case of multiple keyboard hits.

in snake:
- avoid this: https://imagebin.ca/v/3nOH4webezqH



On 7 January 2018 at 15:03, Ingemar Ragnemalm  wrote:

>
> An update on my tests with pas2js:
>
> I have overcome most problems now and am quite a bit happier with what I
> see - and what I did see before was good!
>
> Reimar Grabowski asked for interactivity. Done!
>
> Myself, I wanted to reduce the amount of information, like file references
> in the HTML file, because, yes, it does matter! And I wanted to load
> sounds, and of course I, too, wanted interactivity! Done! Adding missing
> methods, interfacing to more APIs (like audio), no problem! It was
> surprisingly easy.
>
> Here is an updated version of the Santa animation:
>
> http://ragnemalm.se/images/santa/santa2.html
>
> and here is an (almost) fully working snake game:
>
> http://ragnemalm.se/images/santa/snake/snake.html
>
> I really enjoyed making these! My code gets more and more comfortable,
> there is no problem hiding the JS libraries. Will I do that in the long
> run? Well, I don't know but doing that can help me making the code portable.
>
> I also made some minor additions to Lightweight IDE, so now I edit,
> compile and run directly from the IDE. "Run" passes the HTML to a web
> browser.
>
> I have implemented a different way to run animations, but still don't know
> if it flickers on other platforms. On my Mac, there is no flicker at all.
>
> For gaming and similar purposes, all I miss now is the ability to save
> scores on file. For a wider range of applications, I want the ability to
> download data to my local drive. I havn't considered the case of
> communicating directly with some server.
>
> For being a preliminary "0." version, pas2js works wonderfully well!
>
> /Ingemar
>
>
> Den 2017-12-24 kl. 12:00, skrev Ingemar Ragnemalm:
>
>> Den 2017-12-22 kl. 12:00, skrev Michael Van Canneyt:
>>
>>> On Wed, 20 Dec 2017, Reimar Grabowski wrote:
>>>
>>> On Wed, 20 Dec 2017 15:14:50 +0100
 Ingemar Ragnemalm  wrote:

 But I don't see anything wrong with putting them in the HTML. For more
 flexibility you could create the HTML via a template engine or something
 but I would only load them from JS if there is a good reason to do so.

>>> One reason is to collect information in one place. Making HTML load it
>> gives me two steps to the file instead of one. More chances to do it
>> wrong.
>>
>> While you are updating your code you can remove the two dependencies on
 bootstrap (as they are not satisfied anyway and I think the whole fpReport
 dir is superflous) and perhaps do something about the flickering of the
 text (although this may be a little bit too much asked).

>>> Ah. They just remained from an example I worked from.
>>
>> Text flicker is most likely caused by not double buffering. I need to
>> generate an image off-screen. Nothing strange with that, just one more
>> thing to figure out in the JS environment.
>>
>> It feels really nice to have my first Pascal web application running!
>
 Not dissing you or your work or pas2js but I fail to see the web
 application part. There is no communication between client and server.
 Actually there is no server side code at all and there is no interactivity.
 In my book this is a static page, but perhaps I miss something.

>>> There is no interactivity, and no client-server communication, but this
>> is my *first*, my "proof of concept" for the platform, like Hello World but
>> with some more features (animation, random numbers, graphics elements).
>> Doing *something* with it myself, showing myself the potential, making a
>> kind of "thanks" for it and a Christmas greeting atthe same time.
>> Interactivity is the next step, and the ability to save data somewhere.
>>
>> That is one of the points of pas2js. To allow you to program the browser.
>>>
>>> There is no need for a server. You can make e.g. a chess application
>>> that runs
>>> 100% in the browser, using a single HTML file. You can embed the JS and
>>> images in the HTML itself, and thus your HTML file is the 'executable'.
>>>
>>> See the browser as a desktop. Your program runs in that desktop.
>>> If need be, this program can contact a server - the classical
>>> client/server model, using HTTP as the protocol - but this is by no
>>> means a necessity.
>>>
>>> In that sense, the demo demonstrates this. The server is just there for
>>> you
>>> to be able to download the "program"...
>>>
>> Exactly. I get a cross-platform solution with no installations, in a way
>> that users are increasingly used to. And I can write it in FPC, which I
>> am a lot more happy with than a rubbish language like JavaScript! For me
>> it opens a lot of possibilities!
>>
>> But let me get back to my current problems. I can 

Re: [fpc-pascal] First pas2js public release

2018-01-07 Thread Ingemar Ragnemalm


An update on my tests with pas2js:

I have overcome most problems now and am quite a bit happier with what I 
see - and what I did see before was good!


Reimar Grabowski asked for interactivity. Done!

Myself, I wanted to reduce the amount of information, like file 
references in the HTML file, because, yes, it does matter! And I wanted 
to load sounds, and of course I, too, wanted interactivity! Done! Adding 
missing methods, interfacing to more APIs (like audio), no problem! It 
was surprisingly easy.


Here is an updated version of the Santa animation:

http://ragnemalm.se/images/santa/santa2.html

and here is an (almost) fully working snake game:

http://ragnemalm.se/images/santa/snake/snake.html

I really enjoyed making these! My code gets more and more comfortable, 
there is no problem hiding the JS libraries. Will I do that in the long 
run? Well, I don't know but doing that can help me making the code portable.


I also made some minor additions to Lightweight IDE, so now I edit, 
compile and run directly from the IDE. "Run" passes the HTML to a web 
browser.


I have implemented a different way to run animations, but still don't 
know if it flickers on other platforms. On my Mac, there is no flicker 
at all.


For gaming and similar purposes, all I miss now is the ability to save 
scores on file. For a wider range of applications, I want the ability to 
download data to my local drive. I havn't considered the case of 
communicating directly with some server.


For being a preliminary "0." version, pas2js works wonderfully well!

/Ingemar


Den 2017-12-24 kl. 12:00, skrev Ingemar Ragnemalm:

Den 2017-12-22 kl. 12:00, skrev Michael Van Canneyt:

On Wed, 20 Dec 2017, Reimar Grabowski wrote:


On Wed, 20 Dec 2017 15:14:50 +0100
Ingemar Ragnemalm  wrote:

But I don't see anything wrong with putting them in the HTML. For more 
flexibility you could create the HTML via a template engine or something but I 
would only load them from JS if there is a good reason to do so.

One reason is to collect information in one place. Making HTML load it
gives me two steps to the file instead of one. More chances to do it wrong.


While you are updating your code you can remove the two dependencies on 
bootstrap (as they are not satisfied anyway and I think the whole fpReport dir 
is superflous) and perhaps do something about the flickering of the text 
(although this may be a little bit too much asked).

Ah. They just remained from an example I worked from.

Text flicker is most likely caused by not double buffering. I need to
generate an image off-screen. Nothing strange with that, just one more
thing to figure out in the JS environment.


It feels really nice to have my first Pascal web application running!

Not dissing you or your work or pas2js but I fail to see the web application 
part. There is no communication between client and server. Actually there is no 
server side code at all and there is no interactivity. In my book this is a 
static page, but perhaps I miss something.

There is no interactivity, and no client-server communication, but this is my *first*, my 
"proof of concept" for the platform, like Hello World but with some more features 
(animation, random numbers, graphics elements). Doing *something* with it myself, showing myself 
the potential, making a kind of "thanks" for it and a Christmas greeting atthe same time. 
Interactivity is the next step, and the ability to save data somewhere.


That is one of the points of pas2js. To allow you to program the browser.

There is no need for a server. You can make e.g. a chess application that runs
100% in the browser, using a single HTML file. You can embed the JS and
images in the HTML itself, and thus your HTML file is the 'executable'.

See the browser as a desktop. Your program runs in that desktop.
If need be, this program can contact a server - the classical
client/server model, using HTTP as the protocol - but this is by no means a 
necessity.

In that sense, the demo demonstrates this. The server is just there for you
to be able to download the "program"...

Exactly. I get a cross-platform solution with no installations, in a way
that users are increasingly used to. And I can write it in FPC, which I
am a lot more happy with than a rubbish language like JavaScript! For me
it opens a lot of possibilities!

But let me get back to my current problems. I can accept loading images
through HTML for now, but how can I load and play sounds? There is an
"Audio" API in JavaScript but it seems that pas2js doesn't support it,
it can't find play(). I have searched web.pas and a few others for it.
Where do I start to fix that?

/Ingemar


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

Re: [fpc-pascal] First pas2js public release

2017-12-27 Thread el_es
On 24/12/17 09:20, Ingemar Ragnemalm wrote:
> 
> Den 2017-12-22 kl. 12:00, skrev Michael Van Canneyt:
>> On Wed, 20 Dec 2017, Reimar Grabowski wrote:
[...]

>>> While you are updating your code you can remove the two
>>> dependencies on bootstrap (as they are not satisfied anyway and I
>>> think the whole fpReport dir is superflous) and perhaps do
>>> something about the flickering of the text (although this may be
>>> a little bit too much asked).
> 
> Ah. They just remained from an example I worked from.
> 
> Text flicker is most likely caused by not double buffering. I need to
> generate an image off-screen. Nothing strange with that, just one
> more thing to figure out in the JS environment.
> 

Could be hw / sw dependant - no text flicker here, on Firefox 57 under Linux 
Debian Stretch (32bit),
Intel graphics (i915), KDE Plasma desktop.

[...]
> 
> /Ingemar
> 
> 

-L.

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

Re: [fpc-pascal] First pas2js public release

2017-12-26 Thread Graeme Geldenhuys

On 2017-12-24 09:36, Michael Van Canneyt wrote:

If it was standard on all browsers (it is not on IE), then we could add it to
web.pas. But since IE does not support it,  the classes can then be added
to a new units websound.pas.



Sounds like a good candidate for a Decorator or Factory Method/Class 
design pattern to have a single sound API for Pas2JS usage - no matter 
the web browser.


On a side note:
  Your posted web audio URL gives me a 404 error. I did find another URL
  though. Not sure how new or old that information is, but being on
  w3.org, I assume it is still relevant.

 https://www.w3.org/TR/webaudio/


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] First pas2js public release

2017-12-24 Thread Michael Van Canneyt



On Sun, 24 Dec 2017, Ingemar Ragnemalm wrote:



In that sense, the demo demonstrates this. The server is just there for you
to be able to download the "program"...


Exactly. I get a cross-platform solution with no installations, in a way that 
users are increasingly used to. And I can write it in FPC, which I am a lot 
more happy with than a rubbish language like JavaScript! For me it opens a 
lot of possibilities!


But let me get back to my current problems. I can accept loading images 
through HTML for now, but how can I load and play sounds? There is an "Audio" 
API in JavaScript but it seems that pas2js doesn't support it, it can't find 
play(). I have searched web.pas and a few others for it. Where do I start to 
fix that?


You go to e.g. MDN, look at the API, and write a series of import classes.

This looks like a good starting point:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_AP

If it was standard on all browsers (it is not on IE), then we could add it to
web.pas. But since IE does not support it,  the classes can then be added 
to a new units websound.pas.


The WIKI page of pas2js contains a rudimentary example that explains the
principle of an import class.

There is a demo (democlasstopas) that helps you to create a skeleton definition, 
I will add some documentation to the WIKI or maybe make it into a unit.


If you need help, mail me in private and I will do a few sample conversions.

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

Re: [fpc-pascal] First pas2js public release

2017-12-24 Thread Ingemar Ragnemalm


Den 2017-12-22 kl. 12:00, skrev Michael Van Canneyt:

On Wed, 20 Dec 2017, Reimar Grabowski wrote:


On Wed, 20 Dec 2017 15:14:50 +0100
Ingemar Ragnemalm  wrote:


Although I would like to make some improvements - who doesn't? To be
precise, I want to figure out a way to play sounds, and I want image
loading directly in the code and not dependent on the HTML. Any ideas
about that?

First of all I know nothing about pas2js, but...
As your code is running solely in the browser there is no option to load it 
from file for security reasons.
But you can embed the binary image data in the code (as Uint8Array) or you can 
use XHR (pas2js will surely support this somehow) to fetch the image data via 
HTTP.
Once you have the data put it into a blob, create an url and finally use that 
as you image url.
So you need pascal code that will produce this JS code:

var blob = new Blob([data], { type: "image/png" }); // where data is your 
Uint8Array
var url = URL.createObjectURL(blob);
var image = new Image();
image.src = url;


Yes, something like that. I have found JS examples that does this but 
can't see how to make pas2js do it.



But I don't see anything wrong with putting them in the HTML. For more 
flexibility you could create the HTML via a template engine or something but I 
would only load them from JS if there is a good reason to do so.


One reason is to collect information in one place. Making HTML load it 
gives me two steps to the file instead of one. More chances to do it wrong.



While you are updating your code you can remove the two dependencies on 
bootstrap (as they are not satisfied anyway and I think the whole fpReport dir 
is superflous) and perhaps do something about the flickering of the text 
(although this may be a little bit too much asked).


Ah. They just remained from an example I worked from.

Text flicker is most likely caused by not double buffering. I need to 
generate an image off-screen. Nothing strange with that, just one more 
thing to figure out in the JS environment.



It feels really nice to have my first Pascal web application running!

Not dissing you or your work or pas2js but I fail to see the web application 
part. There is no communication between client and server. Actually there is no 
server side code at all and there is no interactivity. In my book this is a 
static page, but perhaps I miss something.


There is no interactivity, and no client-server communication, but this is my *first*, my 
"proof of concept" for the platform, like Hello World but with some more features 
(animation, random numbers, graphics elements). Doing *something* with it myself, showing myself 
the potential, making a kind of "thanks" for it and a Christmas greeting atthe same time. 
Interactivity is the next step, and the ability to save data somewhere.


That is one of the points of pas2js. To allow you to program the browser.

There is no need for a server. You can make e.g. a chess application that runs
100% in the browser, using a single HTML file. You can embed the JS and
images in the HTML itself, and thus your HTML file is the 'executable'.

See the browser as a desktop. Your program runs in that desktop.
If need be, this program can contact a server - the classical
client/server model, using HTTP as the protocol - but this is by no means a 
necessity.

In that sense, the demo demonstrates this. The server is just there for you
to be able to download the "program"...


Exactly. I get a cross-platform solution with no installations, in a way 
that users are increasingly used to. And I can write it in FPC, which I 
am a lot more happy with than a rubbish language like JavaScript! For me 
it opens a lot of possibilities!


But let me get back to my current problems. I can accept loading images 
through HTML for now, but how can I load and play sounds? There is an 
"Audio" API in JavaScript but it seems that pas2js doesn't support it, 
it can't find play(). I have searched web.pas and a few others for it. 
Where do I start to fix that?


/Ingemar

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

Re: [fpc-pascal] First pas2js public release

2017-12-22 Thread Reimar Grabowski
On Thu, 21 Dec 2017 15:49:01 +0100
Michael Schnell  wrote:

> Rather obviously this 

> would needed to be provided by the library (e.g. Lazarus or mse).
LOL, no.

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

Re: [fpc-pascal] First pas2js public release

2017-12-22 Thread Reimar Grabowski
On Fri, 22 Dec 2017 08:53:03 +0100 (CET)
Michael Van Canneyt  wrote:

> That is one of the points of pas2js. To allow you to program the browser [in 
> pascal].
Fixed that for you.
And yes, that's what most transpilers to javascript are meant for.

> There is no need for a server. You can make e.g. a chess application that runs
> 100% in the browser, using a single HTML file. You can embed the JS and
> images in the HTML itself, and thus your HTML file is the 'executable'.
Really, that's amazing?
 
> See the browser as a desktop. Your program runs in that desktop.
> If need be, this program can contact a server - the classical 
> client/server model, using HTTP as the protocol - but this is by no means a 
> necessity.
If you say so.
 
> In that sense, the demo demonstrates this. The server is just there for you
> to be able to download the "program"...



Mighty web app




  alert("I am such a mighty web application");



Ok, if this is nowadays a 'web application' I seriously get old.
But whatever, every HTML page with a script is a web app now. Lesson learned.

R.

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

Re: [fpc-pascal] First pas2js public release

2017-12-21 Thread Michael Van Canneyt



On Wed, 20 Dec 2017, Reimar Grabowski wrote:


On Wed, 20 Dec 2017 15:14:50 +0100
Ingemar Ragnemalm  wrote:

Although I would like to make some improvements - who doesn't? To be 
precise, I want to figure out a way to play sounds, and I want image 
loading directly in the code and not dependent on the HTML. Any ideas 
about that?

First of all I know nothing about pas2js, but...
As your code is running solely in the browser there is no option to load it 
from file for security reasons.
But you can embed the binary image data in the code (as Uint8Array) or you can 
use XHR (pas2js will surely support this somehow) to fetch the image data via 
HTTP.
Once you have the data put it into a blob, create an url and finally use that 
as you image url.
So you need pascal code that will produce this JS code:

var blob = new Blob([data], { type: "image/png" }); // where data is your 
Uint8Array
var url = URL.createObjectURL(blob);
var image = new Image();
image.src = url;

But I don't see anything wrong with putting them in the HTML. For more 
flexibility you could create the HTML via a template engine or something but I 
would only load them from JS if there is a good reason to do so.

While you are updating your code you can remove the two dependencies on 
bootstrap (as they are not satisfied anyway and I think the whole fpReport dir 
is superflous) and perhaps do something about the flickering of the text 
(although this may be a little bit too much asked).

It feels really nice to have my first Pascal web application running! 

Not dissing you or your work or pas2js but I fail to see the web application 
part. There is no communication between client and server. Actually there is no 
server side code at all and there is no interactivity. In my book this is a 
static page, but perhaps I miss something.


That is one of the points of pas2js. To allow you to program the browser.

There is no need for a server. You can make e.g. a chess application that runs
100% in the browser, using a single HTML file. You can embed the JS and
images in the HTML itself, and thus your HTML file is the 'executable'.

See the browser as a desktop. Your program runs in that desktop. 
If need be, this program can contact a server - the classical 
client/server model, using HTTP as the protocol - but this is by no means a necessity.


In that sense, the demo demonstrates this. The server is just there for you
to be able to download the "program"...

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

Re: [fpc-pascal] First pas2js public release

2017-12-21 Thread Michael Schnell

On 20.12.2017 17:30, Reimar Grabowski wrote:
Not dissing you or your work or pas2js but I fail to see the web 
application part. There is no communication between client and server. 
Actually there is no server side code at all and there is no 
interactivity.
Rather obviously this would not be a compiler issue ("fpc development"), 
but would needed to be provided by the library (e.g. Lazarus or mse) .


There are some post about this in the fpc-devel mailing list (where they 
don't belong either, of course).


-Michael

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

Re: [fpc-pascal] First pas2js public release

2017-12-21 Thread el es
On 21/12/17 11:53, Ryan Joseph wrote:
> 
> 
>> On Dec 20, 2017, at 9:14 PM, Ingemar Ragnemalm  wrote:
>>
>> Absolutely, and I don't mind sharing the code. It is in the same folder! 
>> Very small and simple program, and all FPC. :)
> 
> Can you post the code? I haven’t actually seen any examples so I have no idea 
> how it works.
> 
> Regards,
>   Ryan Joseph
> 

Code seems to be in http://ragnemalm.se/images/santa/
(there is no 'index' page so it shows files)

-L.

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

Re: [fpc-pascal] First pas2js public release

2017-12-21 Thread Ryan Joseph


> On Dec 20, 2017, at 9:14 PM, Ingemar Ragnemalm  wrote:
> 
> Absolutely, and I don't mind sharing the code. It is in the same folder! Very 
> small and simple program, and all FPC. :)

Can you post the code? I haven’t actually seen any examples so I have no idea 
how it works.

Regards,
Ryan Joseph

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

Re: [fpc-pascal] First pas2js public release

2017-12-20 Thread Reimar Grabowski
On Wed, 20 Dec 2017 15:14:50 +0100
Ingemar Ragnemalm  wrote:

> Although I would like to make some improvements - who doesn't? To be 
> precise, I want to figure out a way to play sounds, and I want image 
> loading directly in the code and not dependent on the HTML. Any ideas 
> about that?
First of all I know nothing about pas2js, but...
As your code is running solely in the browser there is no option to load it 
from file for security reasons.
But you can embed the binary image data in the code (as Uint8Array) or you can 
use XHR (pas2js will surely support this somehow) to fetch the image data via 
HTTP.
Once you have the data put it into a blob, create an url and finally use that 
as you image url.
So you need pascal code that will produce this JS code:

var blob = new Blob([data], { type: "image/png" }); // where data is your 
Uint8Array
var url = URL.createObjectURL(blob);
var image = new Image();
image.src = url;

But I don't see anything wrong with putting them in the HTML. For more 
flexibility you could create the HTML via a template engine or something but I 
would only load them from JS if there is a good reason to do so.

While you are updating your code you can remove the two dependencies on 
bootstrap (as they are not satisfied anyway and I think the whole fpReport dir 
is superflous) and perhaps do something about the flickering of the text 
(although this may be a little bit too much asked).

> It feels really nice to have my first Pascal web application running! 
Not dissing you or your work or pas2js but I fail to see the web application 
part. There is no communication between client and server. Actually there is no 
server side code at all and there is no interactivity. In my book this is a 
static page, but perhaps I miss something.

> Well, I could do it in Java before but that isn't as universal as 
> JavaScript.
For this concrete project you could have done it with pure JS which would be 
about 950 lines less of JS code. ;)

Nonetheless, nice work.

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

Re: [fpc-pascal] First pas2js public release

2017-12-20 Thread Ingemar Ragnemalm


Den 2017-12-20 kl. 13:09, skrev Mattias Gaertner:

On Wed, 20 Dec 2017 12:29:25 +0100
Ingemar Ragnemalm  wrote:

And then I got some of the provided demos running too and
managed to write one of my own. So it looks good!

Here is an early result, expressing my feelings for this release:

http://ragnemalm.se/images/santa/santa.html

I couldn't get sound working, but otherwise it seems to work as it
should! (I hope it does for the rest of you.)

Beautiful.
Can I add the URL as an example?


Absolutely, and I don't mind sharing the code. It is in the same folder! 
Very small and simple program, and all FPC. :)


Although I would like to make some improvements - who doesn't? To be 
precise, I want to figure out a way to play sounds, and I want image 
loading directly in the code and not dependent on the HTML. Any ideas 
about that?


It feels really nice to have my first Pascal web application running! 
Well, I could do it in Java before but that isn't as universal as 
JavaScript.


/Ingemar

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

Re: [fpc-pascal] First pas2js public release

2017-12-20 Thread Graeme Geldenhuys

On 2017-12-20 11:29, Ingemar Ragnemalm wrote:

http://ragnemalm.se/images/santa/santa.html

I couldn't get sound working, but otherwise it seems to work as it
should! (I hope it does for the rest of you.)


Awesome - I still have to get my head around this whose Pas2JS 
functionality. It seems very impressive thus far. :)


ps:
  I tested your Santa demo under 64-bit FreeBSD with Firefox. Worked
  perfectly.

Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] First pas2js public release

2017-12-20 Thread Dave Connolly
This is fantastic. Great work everyone.

On 20 December 2017 at 11:59, Mattias Gaertner 
wrote:

> On Wed, 20 Dec 2017 12:29:25 +0100
> Ingemar Ragnemalm  wrote:
>
> >[...]
> > After some initial fiddling, I realized that there was a misspelling in
> > the wiki, and Hello World worked once I use -Jirtl.js rather than
> > -jirtl.js.
>
> Fixed.
>
>
> > And then I got some of the provided demos running too and
> > managed to write one of my own. So it looks good!
> >
> > Here is an early result, expressing my feelings for this release:
> >
> > http://ragnemalm.se/images/santa/santa.html
> >
> > I couldn't get sound working, but otherwise it seems to work as it
> > should! (I hope it does for the rest of you.)
>
> Beautiful.
> Can I add the URL as an example?
>
>
> Mattias
>
>
>
> >
> > /Ingemar
> >
> > Den 2017-12-17 kl. 12:00, skrev Michael Van Canneyt:
> > > From: Michael Van Canneyt
> > > To: FPC mailing list,  FPC
> > > development mailing list,  Lazarus
> > > mailing list
> > > Subject: [fpc-pascal] First pas2js public release
> > > Message-ID:
> > > Content-Type: text/plain; format=flowed; charset=US-ASCII
> > >
> > >
> > > Hello fellow Pascal enthousiasts,
> > >
> > > It is with great pleasure that I can finally announce the first
> publicly
> > > available version of pas2js. A "beta" version, version 0.8.39.
> > > The endpoint (for the time being) of nearly 10 years of (slow)
> development.
> > >
> > > pas2js is a Object Pascal to Javascript transpiler. It compiles Object
> > > pascal, and emits Javascript. The javascript is usable in the browser,
> and
> > > in Node.js.
> > >
> > > It is open source, and part of FPC/Lazarus.
> > > This makes Free Pascal a full-stack development environment for Web
> Development:
> > > You can use it to program the server and the browser alike, all from
> within
> > > the environment you love so much:)
> > >
> > > What does pas2js include ?
> > > --
> > >
> > > * On the language level:
> > >
> > > It supports basically Delphi 7 syntax, interfaces excepted.
> > > Naturally, any memory pointer operation is not possible in Javascript.
> > > Code that relies on this will not work.
> > >
> > > This is just the first version, we of course want to add the same
> language
> > > features that exist in Delphi and FPC today.
> > >
> > > * On the runtime level:
> > >
> > > Beside the compiler itself, there is a basic Object Pascal RTL,
> > > and several units from the FPC Packages are also available:
> > >
> > > system
> > > sysutils
> > > Math
> > > strutils
> > > rtlconst
> > > classes
> > > contnrs
> > > DB (yes, TDataset)
> > > fpcunit testsuite
> > > custapp
> > > restconnection
> > > js (javascript system objects)
> > > web (browser provided objects)
> > > libjquery (jquery is available too)
> > > nodejs (basic node runtime environment)
> > > typeinfo
> > > objpas
> > > browserconsole (support for writeln)
> > > dateutils
> > > browserapp
> > > nodejsapp
> > >
> > > * Debugging:
> > >
> > > Obviously, the browser debugger can be used to debug the Javascript.
> > > But there is more: the compiler can emit a source map, and this means
> that
> > > if the browser finds the source file, it will display the original
> source
> > > file instead of the javascript. You can debug Object pascal in the
> browser.
> > >
> > > * Demoes ?
> > >
> > > The package has several demoes, including FPReport, TDataset, JQuery
> and
> > > Bootstrap.
> > >
> > > * Documentation  ?
> > >
> > > As befits an open source project, docs are lagging behind :/
> > >
> > > But a WIKI page has been started, it will be expanded as time permits:
> > >
> > > http://wiki.freepascal.org/pas2js
> > >
> > > * Sources ?
> > >
> > > The pas2js compiler sources and RTL sources have been checked in in
> FPC's
> > > subversion repository. The page describes where to find it in SVN.
> > >
> > > * Binaries ?
> > >
> > > A snapshot is available:
> > > http://www.freepascal.org/~michael/pas2js/pas2js-demo-0.8.39.zip
> > >
> > > * Reporting bugs ?
> > >
> > > The FPC bugtracker has now a 'pas2js' project, it can be used to report
> > > bugs.
> > >
> > > * Can you help ?
> > >
> > > Yes, of course. There is still a lot of work to be done.
> > > Feel free to contact me or Mattias Gaertner with questions.
> > >
> > > What about Lazarus ?
> > > 
> > >
> > > Lazarus "understands" the extensions to object pascal (for importing
> Javascript
> > > classes) that were borrowed from the JVM version of the compiler, so
> the
> > > code completion will continue to work.
> > >
> > > Using the pre-compiler command, CTRL-F9 just works. On error, you will
> be
> > > shown the error location etc.
> > >
> > > Further and deeped integration of pas2js into lazarus is 

Re: [fpc-pascal] First pas2js public release

2017-12-20 Thread Mattias Gaertner
On Wed, 20 Dec 2017 12:29:25 +0100
Ingemar Ragnemalm  wrote:

>[...]
> After some initial fiddling, I realized that there was a misspelling in 
> the wiki, and Hello World worked once I use -Jirtl.js rather than 
> -jirtl.js.

Fixed.


> And then I got some of the provided demos running too and 
> managed to write one of my own. So it looks good!
> 
> Here is an early result, expressing my feelings for this release:
> 
> http://ragnemalm.se/images/santa/santa.html
> 
> I couldn't get sound working, but otherwise it seems to work as it 
> should! (I hope it does for the rest of you.)

Beautiful. 
Can I add the URL as an example?


Mattias



> 
> /Ingemar
> 
> Den 2017-12-17 kl. 12:00, skrev Michael Van Canneyt:
> > From: Michael Van Canneyt
> > To: FPC mailing list,  FPC
> > development mailing list,  Lazarus
> > mailing list
> > Subject: [fpc-pascal] First pas2js public release
> > Message-ID:
> > Content-Type: text/plain; format=flowed; charset=US-ASCII
> >
> >
> > Hello fellow Pascal enthousiasts,
> >
> > It is with great pleasure that I can finally announce the first publicly
> > available version of pas2js. A "beta" version, version 0.8.39.
> > The endpoint (for the time being) of nearly 10 years of (slow) development.
> >
> > pas2js is a Object Pascal to Javascript transpiler. It compiles Object
> > pascal, and emits Javascript. The javascript is usable in the browser, and
> > in Node.js.
> >
> > It is open source, and part of FPC/Lazarus.
> > This makes Free Pascal a full-stack development environment for Web 
> > Development:
> > You can use it to program the server and the browser alike, all from within
> > the environment you love so much:)
> >
> > What does pas2js include ?
> > --
> >
> > * On the language level:
> >
> > It supports basically Delphi 7 syntax, interfaces excepted.
> > Naturally, any memory pointer operation is not possible in Javascript.
> > Code that relies on this will not work.
> >
> > This is just the first version, we of course want to add the same language
> > features that exist in Delphi and FPC today.
> >
> > * On the runtime level:
> >
> > Beside the compiler itself, there is a basic Object Pascal RTL,
> > and several units from the FPC Packages are also available:
> >
> > system
> > sysutils
> > Math
> > strutils
> > rtlconst
> > classes
> > contnrs
> > DB (yes, TDataset)
> > fpcunit testsuite
> > custapp
> > restconnection
> > js (javascript system objects)
> > web (browser provided objects)
> > libjquery (jquery is available too)
> > nodejs (basic node runtime environment)
> > typeinfo
> > objpas
> > browserconsole (support for writeln)
> > dateutils
> > browserapp
> > nodejsapp
> >
> > * Debugging:
> >
> > Obviously, the browser debugger can be used to debug the Javascript.
> > But there is more: the compiler can emit a source map, and this means that
> > if the browser finds the source file, it will display the original source
> > file instead of the javascript. You can debug Object pascal in the browser.
> >
> > * Demoes ?
> >
> > The package has several demoes, including FPReport, TDataset, JQuery and
> > Bootstrap.
> >
> > * Documentation  ?
> >
> > As befits an open source project, docs are lagging behind :/
> >
> > But a WIKI page has been started, it will be expanded as time permits:
> >
> > http://wiki.freepascal.org/pas2js
> >
> > * Sources ?
> >
> > The pas2js compiler sources and RTL sources have been checked in in FPC's
> > subversion repository. The page describes where to find it in SVN.
> >
> > * Binaries ?
> >
> > A snapshot is available:
> > http://www.freepascal.org/~michael/pas2js/pas2js-demo-0.8.39.zip
> >
> > * Reporting bugs ?
> >
> > The FPC bugtracker has now a 'pas2js' project, it can be used to report
> > bugs.
> >
> > * Can you help ?
> >
> > Yes, of course. There is still a lot of work to be done.
> > Feel free to contact me or Mattias Gaertner with questions.
> >
> > What about Lazarus ?
> > 
> >
> > Lazarus "understands" the extensions to object pascal (for importing 
> > Javascript
> > classes) that were borrowed from the JVM version of the compiler, so the
> > code completion will continue to work.
> >
> > Using the pre-compiler command, CTRL-F9 just works. On error, you will be
> > shown the error location etc.
> >
> > Further and deeped integration of pas2js into lazarus is expected.
> > In the first place, IDE integration.
> > Later on, a real widget set for the browser can (and hopefully will) be 
> > created.
> >
> > But that is not all !
> > -
> >
> > In the very near future, a major Delphi component vendor will announce a
> > complete package for RAD web development in the Delphi IDE.
> > The expectation is that later on, the exact same components will be usable
> 

Re: [fpc-pascal] First pas2js public release

2017-12-20 Thread Ingemar Ragnemalm


This is great news, something that I have been longing for for years! 
There have been some related efforts but none that really solved my 
problem. Best Christmas present this year!


After some initial fiddling, I realized that there was a misspelling in 
the wiki, and Hello World worked once I use -Jirtl.js rather than 
-jirtl.js. And then I got some of the provided demos running too and 
managed to write one of my own. So it looks good!


Here is an early result, expressing my feelings for this release:

http://ragnemalm.se/images/santa/santa.html

I couldn't get sound working, but otherwise it seems to work as it 
should! (I hope it does for the rest of you.)


/Ingemar

Den 2017-12-17 kl. 12:00, skrev Michael Van Canneyt:

From: Michael Van Canneyt
To: FPC mailing list,  FPC
development mailing list,  Lazarus
mailing list
Subject: [fpc-pascal] First pas2js public release
Message-ID:
Content-Type: text/plain; format=flowed; charset=US-ASCII


Hello fellow Pascal enthousiasts,

It is with great pleasure that I can finally announce the first publicly
available version of pas2js. A "beta" version, version 0.8.39.
The endpoint (for the time being) of nearly 10 years of (slow) development.

pas2js is a Object Pascal to Javascript transpiler. It compiles Object
pascal, and emits Javascript. The javascript is usable in the browser, and
in Node.js.

It is open source, and part of FPC/Lazarus.
This makes Free Pascal a full-stack development environment for Web Development:
You can use it to program the server and the browser alike, all from within
the environment you love so much:)

What does pas2js include ?
--

* On the language level:

It supports basically Delphi 7 syntax, interfaces excepted.
Naturally, any memory pointer operation is not possible in Javascript.
Code that relies on this will not work.

This is just the first version, we of course want to add the same language
features that exist in Delphi and FPC today.

* On the runtime level:

Beside the compiler itself, there is a basic Object Pascal RTL,
and several units from the FPC Packages are also available:

system
sysutils
Math
strutils
rtlconst
classes
contnrs
DB (yes, TDataset)
fpcunit testsuite
custapp
restconnection
js (javascript system objects)
web (browser provided objects)
libjquery (jquery is available too)
nodejs (basic node runtime environment)
typeinfo
objpas
browserconsole (support for writeln)
dateutils
browserapp
nodejsapp

* Debugging:

Obviously, the browser debugger can be used to debug the Javascript.
But there is more: the compiler can emit a source map, and this means that
if the browser finds the source file, it will display the original source
file instead of the javascript. You can debug Object pascal in the browser.

* Demoes ?

The package has several demoes, including FPReport, TDataset, JQuery and
Bootstrap.

* Documentation  ?

As befits an open source project, docs are lagging behind :/

But a WIKI page has been started, it will be expanded as time permits:

http://wiki.freepascal.org/pas2js

* Sources ?

The pas2js compiler sources and RTL sources have been checked in in FPC's
subversion repository. The page describes where to find it in SVN.

* Binaries ?

A snapshot is available:
http://www.freepascal.org/~michael/pas2js/pas2js-demo-0.8.39.zip

* Reporting bugs ?

The FPC bugtracker has now a 'pas2js' project, it can be used to report
bugs.

* Can you help ?

Yes, of course. There is still a lot of work to be done.
Feel free to contact me or Mattias Gaertner with questions.

What about Lazarus ?


Lazarus "understands" the extensions to object pascal (for importing Javascript
classes) that were borrowed from the JVM version of the compiler, so the
code completion will continue to work.

Using the pre-compiler command, CTRL-F9 just works. On error, you will be
shown the error location etc.

Further and deeped integration of pas2js into lazarus is expected.
In the first place, IDE integration.
Later on, a real widget set for the browser can (and hopefully will) be created.

But that is not all !
-

In the very near future, a major Delphi component vendor will announce a
complete package for RAD web development in the Delphi IDE.
The expectation is that later on, the exact same components will be usable
in Lazarus. In essence, the component developer has created a complete browser
widgetset. More than 100 controls are available.

Using this, you can design a web application as you design a desktop app;
Fully RAD, as you are used to. But even more, you can bind controls on a
form to existing tags in a web page, thus preserving the style in the web page.

The first demoes for a selected audience have evoked very positive feedback
indeed.

All this is based on 

Re: [fpc-pascal] First pas2js public release

2017-12-17 Thread Graeme Geldenhuys

Well done to everybody involve. This is truly impressive news!


* Debugging:

Obviously, the browser debugger can be used to debug the Javascript.
But there is more: the compiler can emit a source map, and this means that
if the browser finds the source file, it will display the original source
file instead of the javascript. You can debug Object pascal in the browser.



Now that is impressive and very welcome news.


Good job to all.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] First pas2js public release

2017-12-17 Thread Snorkl e
Wow, nice job 

On Dec 17, 2017 2:29 AM, "Michael Van Canneyt" 
wrote:

>
>
> On Sun, 17 Dec 2017, Sven Barth via fpc-pascal wrote:
>
> Am 17.12.2017 08:01 schrieb "code dz" :
>>
>> good news & thanks for the effort
>>
>> is it similar to Emscripten ?
>>
>>
>> Not really. Emscripten (and WebAsm) has the goal to convert native
>> programs
>> that rely on pointers. It is essentially an assembly language in
>> JavaScript. Pas2JS is on the other hand a transpiler and does not - as
>> Michael explained - support native features like pointers. Also if you
>> look
>> at the generated code you can still understand it without much effort.
>>
>
> Completely correct.
>
> 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] First pas2js public release

2017-12-17 Thread Michael Van Canneyt



On Sun, 17 Dec 2017, Sven Barth via fpc-pascal wrote:


Am 17.12.2017 08:01 schrieb "code dz" :

good news & thanks for the effort

is it similar to Emscripten ?


Not really. Emscripten (and WebAsm) has the goal to convert native programs
that rely on pointers. It is essentially an assembly language in
JavaScript. Pas2JS is on the other hand a transpiler and does not - as
Michael explained - support native features like pointers. Also if you look
at the generated code you can still understand it without much effort.


Completely correct.

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

Re: [fpc-pascal] First pas2js public release

2017-12-17 Thread Sven Barth via fpc-pascal
Am 17.12.2017 08:01 schrieb "code dz" :

good news & thanks for the effort

is it similar to Emscripten ?


Not really. Emscripten (and WebAsm) has the goal to convert native programs
that rely on pointers. It is essentially an assembly language in
JavaScript. Pas2JS is on the other hand a transpiler and does not - as
Michael explained - support native features like pointers. Also if you look
at the generated code you can still understand it without much effort.

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

Re: [fpc-pascal] First pas2js public release

2017-12-16 Thread code dz
good news & thanks for the effort

is it similar to Emscripten ?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal