Re: [fpc-pascal] First pas2js public release
On Wed, 20 Dec 2017 15:14:50 +0100 Ingemar Ragnemalmwrote: > 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
Den 2017-12-20 kl. 13:09, skrev Mattias Gaertner: On Wed, 20 Dec 2017 12:29:25 +0100 Ingemar Ragnemalmwrote: 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
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
This is fantastic. Great work everyone. On 20 December 2017 at 11:59, Mattias Gaertnerwrote: > 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
On Wed, 20 Dec 2017 12:29:25 +0100 Ingemar Ragnemalmwrote: >[...] > 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
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 CanneytTo: 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