Recent

Author Topic: which are the different parts of pas2JS and is the wiki page still up to date?  (Read 7227 times)

prof7bit

  • Full Member
  • ***
  • Posts: 161
Which are the different parts of pas2JS and how are they related to each other?

The wiki page says I need to checkout the sources and when building it it will also build the pas2js compiler. However, when installing standard FPC it will also already install a pas2js compiler and Lazarus will try to use THAT by default.

Why are there 2 different compilers, why is a pas2js compiler maintained and distributed by the FPC team when I still need to checkout a different repo and build this same(?) compiler from there again?

Or can I omit this step and only build the additional stuff that has still not made its way into FPC?

Is the wiki page still up to date in this regard because it doesen't mention any of the pas2js parts that already come with FPC (and the reasons for them to be there). It is rather confusing.

Can anybody please give a detailed architectural top-down overview of all the parts that belong to it, how they play together, etc?






PierceNg

  • Sr. Member
  • ****
  • Posts: 369
    • SamadhiWeb
On my Linux box, the version of pas2js that was built together with FPC:

Code: Bash  [Select][+][-]
  1. % /bin/pas2js -h
  2. Pas2JS Compiler version 1.5.1 [2020/07/07] for Linux x86_64
  3. Copyright (c) 2019 Free Pascal team.

According to https://wiki.freepascal.org/Pas2JS_Version_Changes, currently released version is 2.0.6.

I happened to be running pas2js trunk on my machine:

Code: Bash  [Select][+][-]
  1. % pas2js -h
  2. Pas2JS Compiler version 2.1.1 [2021/07/05] for Linux x86_64
  3. Copyright (c) 2021 Free Pascal team.

Bottomline easy answer, if you want to use current released version: Build v2.0.6 from source yourself. Ignore what comes with FPC.

prof7bit

  • Full Member
  • ***
  • Posts: 161
Bottomline easy answer, if you want to use current released version: Build v2.0.6 from source yourself. Ignore what comes with FPC.
This is actually not an answer at all, it just reinforces the question. My FPC installation (main branch) comes with Pas2JS Compiler version 2.1.1 [2021/10/24] for Linux x86_64. Why this confusing redundancy? Why is an incomplete pas2js environment that cannot be used anyway because it is incomplete contained in the FPC install? is this a leftover? Or is it planned to move it all into FPC and the move is just not completed yet?
« Last Edit: October 24, 2021, 10:32:52 am by prof7bit »

PierceNg

  • Sr. Member
  • ****
  • Posts: 369
    • SamadhiWeb
Bottomline easy answer, if you want to use current released version: Build v2.0.6 from source yourself. Ignore what comes with FPC.
This is actually not an answer at all, it just reinforces the question. My FPC installation (main branch) comes with Pas2JS Compiler version 2.1.1 [2021/10/24] for Linux x86_64.

If you are ok using pas2js 2.1.1, then you are all set.

pas2js is a Pascal transpiler written in Pascal, built using FPC. Once the transpiler is built, then just use it.

Oh ok you edited your post after I answered.
« Last Edit: October 24, 2021, 10:45:47 am by PierceNg »

prof7bit

  • Full Member
  • ***
  • Posts: 161
If you are ok using pas2js 2.1.1, then you are all set.

pas2js is a Pascal transpiler written in Pascal, built using FPC. Once the transpiler is built, then just use it.
I cannot use it, it is missing the rtl or whatever, it complains about missing unit system.

So the question remains: Why is there an incomplete pas2js environment contained in FPC (and why is it maintained at the most recent version of pas2js) when it is not meant to be used and instead one needs to install all the same stuff (plus some more) from a different repo separately again?

Maybe I am not expressing myself clearly enough, but I did not ask "what" or "how", I asked "why". Because I am trying to understand! Is here anybody who can actually answer this question?
« Last Edit: October 24, 2021, 10:48:46 am by prof7bit »

PierceNg

  • Sr. Member
  • ****
  • Posts: 369
    • SamadhiWeb
I cannot use it, it is missing the rtl or whatever, it complains about missing unit system.

I answered that in another post of yours. You need to set up pas2js.cfg to point to the right location.

Relevant lines from my ~/.pas2js.cfg:

Code: Pascal  [Select][+][-]
  1. -Fu/home/pierce/pkg/pas2js/dist/
  2. -Fu/home/pierce/pkg/pas2js/packages/*
  3.  

What my /home/pierce/pkg/pas2js look like:

Code: Bash  [Select][+][-]
  1.  % ls -l
  2. total 12
  3. drwxr-xr-x  2 pierce pierce 4096 Jul  5 13:49 bin/
  4. drwxr-xr-x  2 pierce pierce 4096 Jul  5 13:47 dist/
  5. drwxr-xr-x 21 pierce pierce 4096 Jul  5 13:46 packages/
  6.  
  7. % ls -l bin
  8. total 12732
  9. -rwxr-xr-x 1 pierce pierce 3274816 Jul  5 13:46 compileserver*
  10. -rwxr-xr-x 1 pierce pierce 4229992 Jul  5 13:46 libpas2js.so*
  11. -rwxr-xr-x 1 pierce pierce 1417328 Jul  5 13:46 makestub*
  12. -rwxr-xr-x 1 pierce pierce 3069360 Jul  5 13:46 pas2js*
  13. -rwxr-xr-x 1 pierce pierce 1033632 Jul  5 13:46 webidl2pas*
  14.  
  15.  
  16. % ls -l dist
  17. total 44
  18. -rw-r--r-- 1 pierce pierce 44057 Jul  5 13:45 rtl.js
  19.  
  20.  
  21. % ls -l packages
  22. total 76
  23. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 atom/
  24. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 bootstrap/
  25. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 chartjs/
  26. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 dataabstract/
  27. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fcl-base/
  28. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fcl-db/
  29. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fcl-json/
  30. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 flatpickr/
  31. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fpcunit/
  32. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fullcalendar/
  33. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 jitsimeet/
  34. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 jspdf/
  35. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 kurento/
  36. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 nodejs/
  37. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 opentok/
  38. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 pushjs/
  39. drwxr-xr-x 3 pierce pierce 4096 Oct  2 21:47 rtl/
  40. drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 vscode/
  41. drwxr-xr-x 3 pierce pierce 4096 Jul  5 13:45 webwidget/
  42. pierce@Linben:~/pkg/pas2js%
  43.  

My installation works. I am writing browser apps with it.

I will leave to others to answer your why questions.

prof7bit

  • Full Member
  • ***
  • Posts: 161
Where is the folder that contains the unit system?

I have:
Code: [Select]
$ ls -l /home/bernd/fpcupdeluxe/fpcsrc/utils/pas2js/dist
insgesamt 44
-rw-rw-r-- 1 bernd bernd 44214 Okt 20 17:36 rtl.js

and I have

Code: [Select]
$ ls -l /home/bernd/fpcupdeluxe/fpcsrc/packages/
insgesamt 4564
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 a52
drwxrwxr-x 1 bernd bernd     140 Okt 18 18:03 ami-extra
drwxrwxr-x 1 bernd bernd     182 Okt 18 18:03 amunits
drwxrwxr-x 1 bernd bernd     104 Okt 18 18:03 arosunits
drwxrwxr-x 1 bernd bernd     180 Okt 24 09:21 aspell
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 bfd
drwxrwxr-x 1 bernd bernd     154 Okt 24 09:21 bzip2
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 cairo
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 cdrom
drwxrwxr-x 1 bernd bernd     146 Okt 24 09:21 chm
drwxrwxr-x 1 bernd bernd     130 Okt 18 18:03 cocoaint
drwxrwxr-x 1 bernd bernd      74 Okt 24 09:21 dblib
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 dbus
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 dts
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:21 fastcgi
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:21 fcl-async
drwxrwxr-x 1 bernd bernd     150 Okt 24 09:21 fcl-base
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 fcl-db
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:21 fcl-extra
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:21 fcl-fpcunit
drwxrwxr-x 1 bernd bernd     138 Okt 24 09:21 fcl-image
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 fcl-js
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 fcl-json
drwxrwxr-x 1 bernd bernd     100 Okt 24 09:21 fcl-mustache
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 fcl-net
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 fcl-passrc
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:21 fcl-pdf
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:21 fcl-process
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 fcl-registry
drwxrwxr-x 1 bernd bernd     108 Okt 24 09:21 fcl-report
drwxrwxr-x 1 bernd bernd     120 Okt 24 09:21 fcl-res
drwxrwxr-x 1 bernd bernd     112 Okt 24 09:21 fcl-sdo
drwxrwxr-x 1 bernd bernd      84 Okt 24 09:21 fcl-sound
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:21 fcl-stl
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 fcl-web
drwxrwxr-x 1 bernd bernd     198 Okt 24 09:21 fcl-xml
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 fftw
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 fpgtk
drwxrwxr-x 1 bernd bernd     110 Okt 24 09:21 fpindexer
-rwxrwxr-x 1 bernd bernd 1920160 Okt 24 09:20 fpmake
-rw-rw-r-- 1 bernd bernd    9886 Okt 18 18:03 fpmake_add.inc
-rw-rw-r-- 1 bernd bernd 2624416 Okt 24 09:20 fpmake.o
-rw-rw-r-- 1 bernd bernd    1777 Okt 18 18:03 fpmake.pp
-rw-rw-r-- 1 bernd bernd   15081 Okt 18 18:03 fpmake_proc.inc
drwxrwxr-x 1 bernd bernd     146 Okt 24 09:21 fpmkunit
drwxrwxr-x 1 bernd bernd     164 Okt 24 09:21 fppkg
drwxrwxr-x 1 bernd bernd     162 Okt 18 18:03 fuse
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:21 fv
drwxrwxr-x 1 bernd bernd     170 Okt 24 09:21 gdbint
drwxrwxr-x 1 bernd bernd     150 Okt 24 09:21 gdbm
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 ggi
drwxrwxr-x 1 bernd bernd      90 Okt 24 09:21 gitlab
drwxrwxr-x 1 bernd bernd     142 Okt 24 09:21 gmp
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 gnome1
drwxrwxr-x 1 bernd bernd      90 Okt 24 09:21 gnutls
drwxrwxr-x 1 bernd bernd     110 Okt 24 09:21 googleapi
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:19 graph
drwxrwxr-x 1 bernd bernd     150 Okt 24 09:21 gtk1
drwxrwxr-x 1 bernd bernd     176 Okt 24 09:21 gtk2
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 hash
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 hermes
drwxrwxr-x 1 bernd bernd     130 Okt 18 18:03 httpd13
drwxrwxr-x 1 bernd bernd     130 Okt 18 18:03 httpd20
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 httpd22
drwxrwxr-x 1 bernd bernd      90 Okt 24 09:21 httpd24
drwxrwxr-x 1 bernd bernd     174 Okt 24 09:21 ibase
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:21 iconvenc
drwxrwxr-x 1 bernd bernd    2098 Okt 24 09:21 ide
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 imagemagick
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:21 imlib
drwxrwxr-x 1 bernd bernd     104 Okt 18 18:03 iosxlocale
drwxrwxr-x 1 bernd bernd      74 Okt 24 09:21 jni
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 ldap
drwxrwxr-x 1 bernd bernd     164 Okt 18 18:03 libc
drwxrwxr-x 1 bernd bernd     100 Okt 24 09:21 libcups
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 libcurl
drwxrwxr-x 1 bernd bernd      90 Okt 24 09:21 libenet
drwxrwxr-x 1 bernd bernd      90 Okt 24 09:21 libffi
drwxrwxr-x 1 bernd bernd      90 Okt 24 09:21 libfontconfig
drwxrwxr-x 1 bernd bernd     128 Okt 18 18:03 libgbafpc
drwxrwxr-x 1 bernd bernd      90 Okt 24 09:21 libgc
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 libgd
drwxrwxr-x 1 bernd bernd      90 Okt 24 09:21 libmagic
drwxrwxr-x 1 bernd bernd      90 Okt 24 09:21 libmicrohttpd
drwxrwxr-x 1 bernd bernd     130 Okt 18 18:03 libndsfpc
drwxrwxr-x 1 bernd bernd     130 Okt 18 18:03 libogcfpc
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 libpng
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:21 librsvg
drwxrwxr-x 1 bernd bernd     150 Okt 24 09:21 libsee
drwxrwxr-x 1 bernd bernd      74 Okt 24 09:21 libtar
drwxrwxr-x 1 bernd bernd      74 Okt 24 09:21 libusb
drwxrwxr-x 1 bernd bernd      88 Okt 24 09:21 libvlc
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:21 libxml
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 lua
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 mad
-rw-rw-r-- 1 bernd bernd   48931 Okt 18 18:03 Makefile
-rw-rw-r-- 1 bernd bernd    6299 Okt 18 18:03 Makefile.fpc
-rw-rw-r-- 1 bernd bernd   34550 Aug  8 15:26 Makefile.fpc.fpcmake
drwxrwxr-x 1 bernd bernd     148 Okt 18 18:03 matroska
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 modplug
drwxrwxr-x 1 bernd bernd     104 Okt 18 18:03 morphunits
drwxrwxr-x 1 bernd bernd     174 Okt 24 09:21 mysql
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 ncurses
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 newt
drwxrwxr-x 1 bernd bernd     166 Okt 24 09:21 numlib
drwxrwxr-x 1 bernd bernd     120 Okt 24 09:19 nvapi
drwxrwxr-x 1 bernd bernd     120 Okt 18 18:03 objcrtl
drwxrwxr-x 1 bernd bernd     122 Okt 24 09:21 odata
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 odbc
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 oggvorbis
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 openal
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:19 opencl
drwxrwxr-x 1 bernd bernd     174 Okt 24 09:21 opengl
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:21 opengles
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 openssl
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 oracle
drwxrwxr-x 1 bernd bernd     150 Okt 18 18:03 os2units
drwxrwxr-x 1 bernd bernd     104 Okt 18 18:03 os4units
drwxrwxr-x 1 bernd bernd     130 Okt 18 18:03 palmunits
drwxrwxr-x 1 bernd bernd     150 Okt 24 09:21 pasjpeg
drwxrwxr-x 1 bernd bernd      84 Okt 24 09:21 pastojs
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 paszlib
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 pcap
drwxrwxr-x 1 bernd bernd     174 Okt 24 09:21 postgres
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:21 proj4
drwxrwxr-x 1 bernd bernd     148 Okt 24 09:21 ptc
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 pthreads
drwxrwxr-x 1 bernd bernd     130 Okt 24 09:21 pxlib
drwxrwxr-x 1 bernd bernd     110 Okt 18 18:03 qlunits
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 regexpr
drwxrwxr-x 1 bernd bernd     150 Okt 18 18:03 rexx
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:21 rtl-console
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:21 rtl-extra
drwxrwxr-x 1 bernd bernd     120 Okt 24 09:21 rtl-generics
drwxrwxr-x 1 bernd bernd     124 Okt 24 09:21 rtl-objpas
drwxrwxr-x 1 bernd bernd      74 Okt 24 09:21 rtl-unicode
drwxrwxr-x 1 bernd bernd     202 Okt 24 09:21 sdl
drwxrwxr-x 1 bernd bernd     182 Okt 18 18:03 sndfile
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 sqlite
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 svgalib
drwxrwxr-x 1 bernd bernd     136 Okt 24 09:21 symbolic
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 syslog
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 tcl
drwxrwxr-x 1 bernd bernd     100 Okt 18 18:03 tosunits
drwxrwxr-x 1 bernd bernd      74 Okt 24 09:21 tplylib
drwxrwxr-x 1 bernd bernd     130 Okt 18 18:03 univint
drwxrwxr-x 1 bernd bernd     130 Okt 18 18:03 unixutil
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 unzip
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 users
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 utmp
drwxrwxr-x 1 bernd bernd     160 Okt 24 09:21 uuid
drwxrwxr-x 1 bernd bernd      84 Okt 24 09:21 vcl-compat
drwxrwxr-x 1 bernd bernd     100 Okt 24 09:21 webidl
drwxrwxr-x 1 bernd bernd     104 Okt 18 18:03 winceunits
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:19 winunits-base
drwxrwxr-x 1 bernd bernd     114 Okt 24 09:19 winunits-jedi
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 x11
drwxrwxr-x 1 bernd bernd     190 Okt 24 09:21 xforms
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 zlib
drwxrwxr-x 1 bernd bernd     140 Okt 24 09:21 zorba

and it cannot find unit system.

If you say that the pas2js installation that came along with your FPC installation is complete and working then maybe you can tell me the location of that unit, so I can add it to the -Fu path?
« Last Edit: October 24, 2021, 11:47:30 am by prof7bit »

PierceNg

  • Sr. Member
  • ****
  • Posts: 369
    • SamadhiWeb
Where is the folder that contains the unit system?

For me, in /home/pierce/pkg/pas2js/packages/rtl:

Code: [Select]
% ls -l ~/pkg/pas2js/packages/rtl/system.pas
-rw-r--r-- 1 pierce pierce 30128 Jul  5 13:45 /home/pierce/pkg/pas2js/packages/rtl/system.pas

If you say that the pas2js installation that came along with your FPC installation is complete and working then maybe you can tell me the location of that unit, so I can add it to the -Fu path?

I don't think I've ever said that. I built pas2js from source. I'm not using the version that came with FPC. In fact, showing the '-h' output in the earlier post was the first time I ran that particular executable; before reading your first post in this thread I've never considered that executable's existence at all.

Your directory listing of /home/bernd/fpcupdeluxe/fpcsrc/packages is for FPC.

If you have cloned the pas2js repo, it should look like below. See that part that I've marked. You could set your pas2js.cfg "-Fu" to point to that directory/*. (What I did is I moved the "runtime" parts of the repo out to ~/pkg/pas2js. It's just the way I like to organize my stuff.)

Code: [Select]
% ls -l
total 1392
drwxr-xr-x  3 pierce pierce    4096 Jul  5 13:46 bin/
drwxr-xr-x  4 pierce pierce    4096 Jul  5 13:45 compiler/
drwxr-xr-x 36 pierce pierce    4096 Jul  5 13:45 demo/
-rwxr-xr-x  1 pierce pierce 1250088 Jul  5 13:46 fpmake*
-rw-r--r--  1 pierce pierce   60728 Jul  5 13:46 fpmake.o
-rw-r--r--  1 pierce pierce    8794 Jul  5 13:45 fpmake.pp
-rw-r--r--  1 pierce pierce   42969 Jul  5 13:45 Makefile
-rw-r--r--  1 pierce pierce    7095 Jul  5 13:45 Makefile.fpc
drwxr-xr-x 21 pierce pierce    4096 Jul  5 13:45 packages/                      <====== These are pas2js packages. RTL including system.pas is here.
-rw-r--r--  1 pierce pierce     184 Jul  5 13:46 pas2js-x86_64-linux.fpm
-rw-r--r--  1 pierce pierce    2052 Jul  5 13:45 README.txt
drwxr-xr-x  2 pierce pierce    4096 Jul  5 13:45 scripts/
drwxr-xr-x  2 pierce pierce    4096 Jul  5 13:45 test/
drwxr-xr-x  3 pierce pierce    4096 Jul  5 13:45 tools/
drwxr-xr-x  3 pierce pierce    4096 Jul  5 13:46 units/
drwxr-xr-x  2 pierce pierce    4096 Jul  5 13:45 utils/

WayneSherman

  • Full Member
  • ***
  • Posts: 243
Quote from: prof7bit
  • Which are the different parts of pas2JS and how are they related to each other?
  • Can anybody please give a detailed architectural top-down overview of all the parts that belong to it, how they play together, etc?
  • I did not ask "what" or "how", I asked "why". Because I am trying to understand!
  • Is here anybody who can actually answer this question?

Good questions.  The documentation is sparse and an installation "how-to" or tutorial would be nice.  I have been thinking about making one.
The main developer(s) for pas2js can be found on the pas2js mailing list.  They may not use these forums, so the mailing list is the best place to collaborate.

FPC mailing list info: https://www.freepascal.org/maillist.html
« Last Edit: October 25, 2021, 02:16:10 am by WayneSherman »

kveroneau

  • Full Member
  • ***
  • Posts: 119
I don't think I struggled as much to get it working.  I followed the Wiki for how to get it installed and working with the Lazarus IDE.  If you install the package into Lazarus for Pas2JS integration as the Wiki mentions, it makes compiling programs with it easy.  The Lazarus package adds a few extras to the IDE which are needed to get the compiler to work correctly with it.  There was another problem I ran into, as I am using the current stable FPC that doesn't support some newer modern Pascal syntax Pas2JS uses, I had to add a new IDE Macro called InLazIDE and put ifndef around a lot to get code completion to work correctly.  But once I got that worked out, it was smooth sailing afterwards.

Also, don't expect to design your app using the Lazarus RAD designer and then magically make it all work on the Web.  That's not what Pas2JS can do just yet.  There are some widgetsets available, but I haven't really dived into those just yet.  But as an awesome way to write Pascal that can be compiled to JavaScript, it's great once you understand some of the differences between using it and regular FPC/Lazarus.  The Types and having to Typecast a lot really got me at first, as I don't tend to use typecasts very often in regular FPC/Lazarus, but it's almost a requirement for Pas2JS.

thierrybo

  • Full Member
  • ***
  • Posts: 143
As I was just searching for the same information myself:

Quoted from https://lists.freepascal.org/pipermail/pas2js/2021-November/001021.html

Quote
On Mon Nov 1 2021, Michael Van Canneyt wrote:
On Sun, 31 Oct 2021, Wayne Sherman wrote:

> There are currently two development trees for pas2js:
>
>  Source Tree "fpc/pas2js":
https://gitlab.com/freepascal.org/fpc/pas2js

This tree contains the pas2js RTL and packages.

It contains the below tree as a submodule, however we're thinking to remove
that. Git submodules are a little awkward to work with - to say the least.

>
>  Source Tree "fpc/source"
https://gitlab.com/freepascal.org/fpc/source/-/tree/main/utils/pas2js
https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/pastojs

This tree contains the compiler sources. They are part of Free Pascal:
the scanner/parser/AST is also used in the documentation generator of FPC.


>
> With respect to pas2js, these source trees have different directory
> structures.  Some pas2js files in one tree do not exist in the other.
> In some cases, pas2js files within these trees have the same name, but
> have different changes and commit histories.

Some of the pas2js rtl/package units have a history in FPC, they have been
ported to pas2JS.

>
> I have been considering creating a pas2js "how-to" installation walk
> thru for Linux.  I am trying to decide which tree to use, or if I
> should show both trees and explain why to use one tree or the other
> depending on the intent.

You will always need both trees.

>
> Some questions please:
> 1) How are these two pas2js trees related and what is the intent of each tree?

See above.

> 2) Which tree receives new pas2js features first?

The compiler features always go to the "fpc/source" tree.

RTL/Package features always go to the "fpc/pas2js" tree.

> 3) Is the intent to unify these into a single tree at some point?

No.

Although that was my original intent, but
a) the rtl/packages differ too much.
b) the FPC team itself prefers to keep things separate, so it will remain separate.

Michael.

 

TinyPortal © 2005-2018