From pas2js at gauns.org Tue Oct 3 15:28:15 2023 From: pas2js at gauns.org (pas2js at gauns.org) Date: Tue, 03 Oct 2023 10:28:15 -0300 Subject: [Pas2js] pas2js node Message-ID: <3370ebf7a9eb6982cfdb946c89d0a9ad@gauns.org> Hi guys, is it possible to build a websocket server with pas2js and the node modules? thanks k1 From michael at freepascal.org Tue Oct 3 16:21:08 2023 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 3 Oct 2023 16:21:08 +0200 (CEST) Subject: [Pas2js] pas2js node In-Reply-To: <3370ebf7a9eb6982cfdb946c89d0a9ad@gauns.org> References: <3370ebf7a9eb6982cfdb946c89d0a9ad@gauns.org> Message-ID: On Tue, 3 Oct 2023, Peter via Pas2js wrote: > > Hi guys, > > is it possible to build a websocket server with pas2js and the node modules? Yes, it is. Node does not have websockets built-in, so you may need to use a third-party library such as "ws" if you don't want to write the socket server from scratch. We don't provide a unit that describes the ws library, but using dts2pas you should be able to create the unit, since there is a typescript module description available in the DefinitelyTyped repo. See the following article, it describes how to go about it: https://www.freepascal.org/~michael/articles/#typescript If you need help, feel free to mail me. Michael. From luca at ventoso.org Tue Oct 3 17:45:59 2023 From: luca at ventoso.org (Luca Olivetti) Date: Tue, 3 Oct 2023 17:45:59 +0200 Subject: [Pas2js] pas2js node In-Reply-To: References: <3370ebf7a9eb6982cfdb946c89d0a9ad@gauns.org> Message-ID: <67026f91-e149-909a-a56a-c92afc3eabbe@ventoso.org> El 3/10/23 a les 16:21, Michael Van Canneyt via Pas2js ha escrit: > > https://www.freepascal.org/~michael/articles/#typescript Wonderful, but I think that the lazarus integration is for the next version (I cannot see in in 2.2.6), the online service gives an error (the frontend, the url with full parameters works, as well as the one in the screen capture). But how do I compile dts2pas? I find a couple of dts2pas.pp in the checked out sources, but no Makefile references them (I see it's references in fpmake but I don't know how to use it). $ find -name dts2pas* ./compiler/packages/fcl-js/examples/dts2pas.pp ./compiler/utils/pas2js/dts2pas.pp $ grep -Ri dts2pas packages/electron/libelectron.pas: Electron API description. Mostly autogenerated using dts2pas grep: .git/modules/compiler/index: binary file matches compiler/packages/fcl-js/examples/.gitignore:dts2pas compiler/packages/fcl-js/examples/dts2pas.pp:program dts2pas; compiler/utils/pas2js/fpmake.pp: PT:=P.Targets.AddProgram('dts2pas.pp'); compiler/utils/pas2js/dts2pas.pp:program dts2pas; Bye -- Luca From michael at freepascal.org Tue Oct 3 17:57:22 2023 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 3 Oct 2023 17:57:22 +0200 (CEST) Subject: [Pas2js] pas2js node In-Reply-To: <67026f91-e149-909a-a56a-c92afc3eabbe@ventoso.org> References: <3370ebf7a9eb6982cfdb946c89d0a9ad@gauns.org> <67026f91-e149-909a-a56a-c92afc3eabbe@ventoso.org> Message-ID: <79692d6f-c691-c0a5-11b3-e22f4bfb786@freepascal.org> On Tue, 3 Oct 2023, Luca Olivetti via Pas2js wrote: > El 3/10/23 a les 16:21, Michael Van Canneyt via Pas2js ha escrit: > >> >> https://www.freepascal.org/~michael/articles/#typescript > > Wonderful, but I think that the lazarus integration is for the next version > (I cannot see in in 2.2.6), the online service gives an error (the frontend, > the url with full parameters works, as well as the one in the screen > capture). The lazarus integration indeed only exists in trunk. > > But how do I compile dts2pas? > I find a couple of dts2pas.pp in the checked out sources, but no Makefile > references them (I see it's references in fpmake but I don't know how to use > it). > > $ find -name dts2pas* > ./compiler/packages/fcl-js/examples/dts2pas.pp > ./compiler/utils/pas2js/dts2pas.pp You should use the latter one. Just run make in compiler/utils/pas2js, and make will run fpmake and compile dts2pas. Michael. From luca at ventoso.org Tue Oct 3 18:40:57 2023 From: luca at ventoso.org (Luca Olivetti) Date: Tue, 3 Oct 2023 18:40:57 +0200 Subject: [Pas2js] pas2js node In-Reply-To: <79692d6f-c691-c0a5-11b3-e22f4bfb786@freepascal.org> References: <3370ebf7a9eb6982cfdb946c89d0a9ad@gauns.org> <67026f91-e149-909a-a56a-c92afc3eabbe@ventoso.org> <79692d6f-c691-c0a5-11b3-e22f4bfb786@freepascal.org> Message-ID: El 3/10/23 a les 17:57, Michael Van Canneyt via Pas2js ha escrit: > You should use the latter one. > > Just run make in compiler/utils/pas2js, and make will run fpmake and > compile dts2pas. $ make /usr/local/bin/ppcx64 fpmake.pp -n -Fu../../rtl -Fu../../packages/paszlib -Fu../../packages/fcl-process -Fu../../packages/hash -Fu../../packages/libtar -Fu../../packages/fpmkunit -Fl/usr/lib/gcc/x86_64-linux-gnu/12 Fatal: Can't find unit system used by fpmake Fatal: Compilation aborted make: *** [Makefile:2804: fpmake] Error 1 Bye -- Luca From michael at freepascal.org Tue Oct 3 23:35:41 2023 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 3 Oct 2023 23:35:41 +0200 (CEST) Subject: [Pas2js] pas2js node In-Reply-To: References: <3370ebf7a9eb6982cfdb946c89d0a9ad@gauns.org> <67026f91-e149-909a-a56a-c92afc3eabbe@ventoso.org> <79692d6f-c691-c0a5-11b3-e22f4bfb786@freepascal.org> Message-ID: <109225d6-2455-c63d-f45b-bca13983d7f7@freepascal.org> On Tue, 3 Oct 2023, Luca Olivetti via Pas2js wrote: > El 3/10/23 a les 17:57, Michael Van Canneyt via Pas2js ha escrit: > >> You should use the latter one. >> >> Just run make in compiler/utils/pas2js, and make will run fpmake and >> compile dts2pas. > > $ make > /usr/local/bin/ppcx64 fpmake.pp -n -Fu../../rtl -Fu../../packages/paszlib > -Fu../../packages/fcl-process -Fu../../packages/hash -Fu../../packages/libtar > -Fu../../packages/fpmkunit -Fl/usr/lib/gcc/x86_64-linux-gnu/12 > Fatal: Can't find unit system used by fpmake > Fatal: Compilation aborted > make: *** [Makefile:2804: fpmake] Error 1 Hm. It seems it does not detect your target platform, the unit paths are all wrong ? Michael. From luca at ventoso.org Fri Oct 6 11:22:44 2023 From: luca at ventoso.org (Luca Olivetti) Date: Fri, 6 Oct 2023 11:22:44 +0200 Subject: [Pas2js] pas2js node In-Reply-To: <109225d6-2455-c63d-f45b-bca13983d7f7@freepascal.org> References: <3370ebf7a9eb6982cfdb946c89d0a9ad@gauns.org> <67026f91-e149-909a-a56a-c92afc3eabbe@ventoso.org> <79692d6f-c691-c0a5-11b3-e22f4bfb786@freepascal.org> <109225d6-2455-c63d-f45b-bca13983d7f7@freepascal.org> Message-ID: El 3/10/23 a les 23:35, Michael Van Canneyt via Pas2js ha escrit: > > > On Tue, 3 Oct 2023, Luca Olivetti via Pas2js wrote: > >> El 3/10/23 a les 17:57, Michael Van Canneyt via Pas2js ha escrit: >> >>> You should use the latter one. >>> >>> Just run make in compiler/utils/pas2js, and make will run fpmake and >>> compile dts2pas. >> >> $ make >> /usr/local/bin/ppcx64 fpmake.pp -n -Fu../../rtl >> -Fu../../packages/paszlib -Fu../../packages/fcl-process >> -Fu../../packages/hash -Fu../../packages/libtar >> -Fu../../packages/fpmkunit -Fl/usr/lib/gcc/x86_64-linux-gnu/12 >> Fatal: Can't find unit system used by fpmake >> Fatal: Compilation aborted >> make: *** [Makefile:2804: fpmake] Error 1 > > Hm. It seems it does not detect your target platform, the unit paths are > all wrong ? > Well, it's the same compiler I used to build pas2js and the same pas2js I use to compile my pas2js projects (using lazarus). Bye -- Luca