Forum > Pas2JS

which are the different parts of pas2JS and is the wiki page still up to date?

<< < (2/3) > >>

PierceNg:

--- Quote from: prof7bit on October 24, 2021, 10:37:55 am ---I cannot use it, it is missing the rtl or whatever, it complains about missing unit system.

--- End quote ---

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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ----Fu/home/pierce/pkg/pas2js/dist/-Fu/home/pierce/pkg/pas2js/packages/* 
What my /home/pierce/pkg/pas2js look like:


--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- % ls -ltotal 12drwxr-xr-x  2 pierce pierce 4096 Jul  5 13:49 bin/drwxr-xr-x  2 pierce pierce 4096 Jul  5 13:47 dist/drwxr-xr-x 21 pierce pierce 4096 Jul  5 13:46 packages/ % ls -l bintotal 12732-rwxr-xr-x 1 pierce pierce 3274816 Jul  5 13:46 compileserver*-rwxr-xr-x 1 pierce pierce 4229992 Jul  5 13:46 libpas2js.so*-rwxr-xr-x 1 pierce pierce 1417328 Jul  5 13:46 makestub*-rwxr-xr-x 1 pierce pierce 3069360 Jul  5 13:46 pas2js*-rwxr-xr-x 1 pierce pierce 1033632 Jul  5 13:46 webidl2pas*  % ls -l disttotal 44-rw-r--r-- 1 pierce pierce 44057 Jul  5 13:45 rtl.js  % ls -l packagestotal 76drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 atom/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 bootstrap/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 chartjs/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 dataabstract/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fcl-base/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fcl-db/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fcl-json/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 flatpickr/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fpcunit/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 fullcalendar/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 jitsimeet/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 jspdf/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 kurento/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 nodejs/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 opentok/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 pushjs/drwxr-xr-x 3 pierce pierce 4096 Oct  2 21:47 rtl/drwxr-xr-x 2 pierce pierce 4096 Jul  5 13:45 vscode/drwxr-xr-x 3 pierce pierce 4096 Jul  5 13:45 webwidget/pierce@Linben:~/pkg/pas2js%  
My installation works. I am writing browser apps with it.

I will leave to others to answer your why questions.

prof7bit:
Where is the folder that contains the unit system?

I have:

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

--- End code ---

and I have


--- Code: ---$ 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

--- End code ---

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?

PierceNg:

--- Quote from: prof7bit on October 24, 2021, 11:15:10 am ---Where is the folder that contains the unit system?

--- End quote ---

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


--- Code: ---% 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

--- End code ---


--- Quote from: prof7bit on October 24, 2021, 11:15:10 am ---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?

--- End quote ---

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: ---% 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/
--- End code ---

WayneSherman:

--- 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?
--- End quote ---

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

kveroneau:
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.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version