NAME
pas2js-3.2.2 - Pascal to JavaScript translator based on Free Pascal Compiler (FPC)
SYNOPSIS
bin
DESCRIPTION
Pas2JS Compiler version 1.5.1 [2025/02/08] for Linux x86_64 Copyright © 2019 Free Pascal team.
-
/pas2js-3.2.2 <your.pas>
OPTIONS
Put + after a boolean switch option to enable it, - to disable it
- @<x>
-
: Read compiler options from file <x> in addition to the default
-
pas2js.cfg
- -B
-
: Rebuild all
- -d<x>
-
: Defines the symbol <x>. Optional: -d<x>:=<value>
- -i<x>
-
: Write information and halt. <x> is a combination of the following:
- -iD
-
: Write compiler date
-iSO : Write compiler OS
-iSP : Write compiler host processor
-iTO : Write target platform
-iTP : Write target processor
- -iV
-
: Write short compiler version
- -iW
-
: Write full compiler version
- -ic
-
: Write list of supported JS processors usable by -P<x>
- -im
-
: Write list of supported modeswitches usable by -M<x>
- -io
-
: Write list of supported optimizations usable by -Oo<x>
- -it
-
: Write list of supported targets usable by -T<x>
- -iJ
-
: Write list of supported JavaScript identifiers -JoRTL-<x>
- -C<x>
-
: Code generation options. <x> is a combination of the following
-
letters:
- o
-
: Overflow checking of integer operations
- r
-
: Range checking
- R
-
: Object checks. Verify method calls and object type casts.
- -F...
-
Set file names and paths:
-Fe<x>: Redirect output to file <x>. UTF-8 encoded.
-FE<x>: Set main output path to <x>
-Fi<x>: Add <x> to include paths
-FN<x>: add <x> to namespaces. Namespaces with trailing - are removed.
-
Delphi calls this flag "unit scope names".
-Fu<x>: Add <x> to unit paths
-FU<x>: Set unit output path to <x>
- -I<x>
-
: Add <x> to include paths, same as -Fi
- -J...
-
Extra options of pas2js
- -Jc
-
: Write all JavaScript concatenated into the output file
-Je<x>: Encode messages as <x>.
-Jeconsole: Console codepage. This is the default.
-Jesystem : System codepage. On non Windows console and system are the
-
same.
- -Jeutf-8
-
: Unicode UTF-8. Default when using -Fe.
- -JeJSON
-
: Output compiler messages as JSON. Logo etc are outputted
-
as-is.
-Ji<x>: Insert JS file <x> into main JS file. E.g. -Jirtl.js. Can be given
-
multiple times. To remove a file name append a minus, e.g. -Jirtl.js-.
- -Jl
-
: lower case identifiers
- -Jm
-
: generate source maps
-Jmsourceroot=<x>: use x as "sourceRoot", prefix URL for source file
-
names.
-Jmbasedir=<x>: write source file names relative to directory x, default
-
is map file folder.
-Jminclude: include Pascal sources in source map.
-Jmabsolute: store absolute filenames, not relative.
-Jmxssiheader: start source map with XSSI protection )]}', default.
-Jm-: disable generating source maps
-Jo<x>: Enable or disable extra option. The x is case insensitive:
-JoSearchLikeFPC: search source files like FPC, default: search case
-
insensitive.
-JoUseStrict: add "use strict" to modules, default.
-JoCheckVersion-: do not add rtl version check, default.
-JoCheckVersion=main: insert rtl version check into main.
-JoCheckVersion=system: insert rtl version check into system unit init.
-JoCheckVersion=unit: insert rtl version check into every unit init.
-JoRTL-<y>=<z>: set RTL identifier y to value z. See -iJ.
-Jr<x> Control writing of resource string file
-Jrnone: Do not write resource string file
-Jrunit: Write resource string file per unit with all resource strings
-Jrprogram: Write resource string file per program with all used
-
resource strings in program
-Jr<x> Control writing of linked resources
-JRnone: Do not write resources
-JRjs: Write resources in Javascript structure
-JRhtml[=filename] : Write resources as preload links in HTML file
-
(default is projectfile-res.html)
-Jpcmd<command>: Run postprocessor. For each generated js execute command
-
passing the js as stdin and read the new js from stdout. This option can be added multiple times to call several postprocessors in succession.
-Ju<x>: Add <x> to foreign unit paths. Foreign units are not compiled.
-JU: This pas2js does not support PCU files
- -l
-
: Write logo
- -M<x>
-
: Set language mode or enable/disable a modeswitch
-MDelphi: Delphi 7 compatibility mode
-MObjFPC: FPC's Object Pascal compatibility mode (default)
- -M<x>
-
: enable or disable modeswitch, see option -im
-
Each mode (as listed above) enables its default set of modeswitches. Other modeswitches are disabled and need to be enabled one by another.
-NS<x> : obsolete: add <x> to namespaces. Same as -FN<x>
- -n
-
: Do not read the default config files
- -o<x>
-
: Change main JavaScript file to <x>, "." means stdout
- -O<x>
-
: Optimizations:
- -O-
-
: Disable optimizations
- -O1
-
: Level 1 optimizations (quick and debugger friendly)
-Oo<x>: Enable or disable optimization. The x is case insensitive:
-OoEnumNumbers[-]: write enum value as number instead of name. Default
-
in -O1.
-OoRemoveNotUsedPrivates[-]: Default is enabled
-OoRemoveNotUsedDeclarations[-]: Default enabled for programs with -Jc
- -P<x>
-
: Set target processor. Case insensitive:
-Pecmascript5: default
-Pecmascript6
- -S<x>
-
: Syntax options. <x> is a combination of the following letters:
- 2
-
: Same as -Mobjfpc (default)
- a
-
: Turn on assertions
- c
-
: Support operators like C (*=,+=,/= and -=)
- d
-
: Same as -Mdelphi
- j
-
: Allows typed constants to be writeable (default)
- m
-
: Enables macro replacements
- -SI<x>
-
: Set interface style to <x>
- -SIcom
-
: COM, reference counted interface (default)
-SIcorba: CORBA interface
- -T<x>
-
: Set target platform
-Tbrowser: default
-Tnodejs : add pas.run(), includes -Jc
- -u<x>
-
: Undefines the symbol <x>
- -v<x>
-
: Be verbose. <x> is a combination of the following letters:
- e
-
: Show errors (default)
- w
-
: Show warnings
- n
-
: Show notes
- h
-
: Show hints
- i
-
: Show info
- l
-
: Show line numbers, needs -vi
- a
-
: Show everything
- 0
-
: Show nothing (except errors)
- b
-
: Show file names with full path
- c
-
: Show conditionals
- t
-
: Show tried/used files
- d
-
: Show debug notes and info, enables -vni
- q
-
: Show message numbers
- x
-
: Show used tools
- v
-
: Write pas2jsdebug.log with lots of debugging info
- z
-
: Write messages to stderr, -o. still uses stdout.
-vm<x>,<y>: Do not show messages numbered <x> and <y>.
- -?
-
: Show this help
- -h
-
: Show this help
Environment variable PAS2JS_OPTS is parsed after default config and before
-
command line parameters.
Macros: Format is $Name, $Name$ or $Name()
-
$Pas2jsFullVersion: major.minor.release<extra> $Pas2jsVersion: major.minor.release $CfgDir: Use within a config file. The directory of this config file $Env(): environment variable, e.g. $Env(HOME)
SEE ALSO
The full documentation for pas2js-3.2.2 is maintained as a Texinfo manual. If the info and pas2js-3.2.2 programs are properly installed at your site, the command
-
info pas2js-3.2.2
should give you access to the complete manual.