Scroll to navigation

PAS2JS-3.2.2(1) Free Pascal Compiler PAS2JS-3.2.2(1)

NAME

pas2js-3.2.2 - Pascal to JavaScript translator based on Free Pascal Compiler (FPC)

SYNOPSIS

pas2js-3.2.2 <your.pas>

DESCRIPTION

Pas2JS Compiler version 1.5.1 [2024/01/05] for Linux x86_64 Copyright © 2019 Free Pascal team.

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
: 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:
: Write compiler date

-iSO : Write compiler OS

-iSP : Write compiler host processor

-iTO : Write target platform

-iTP : Write target processor

: Write short compiler version
: Write full compiler version
: Write list of supported JS processors usable by -P<x>
: Write list of supported modeswitches usable by -M<x>
: Write list of supported optimizations usable by -Oo<x>
: Write list of supported targets usable by -T<x>
: Write list of supported JavaScript identifiers -JoRTL-<x>
: Code generation options. <x> is a combination of the following
letters:
: Overflow checking of integer operations
: Range checking
: Object checks. Verify method calls and object type casts.
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>

: Add <x> to include paths, same as -Fi
Extra options of pas2js
: 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.
: Unicode UTF-8. Default when using -Fe.
: 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-.
: lower case identifiers
: 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
: Set language mode or enable/disable a modeswitch

-MDelphi: Delphi 7 compatibility mode

-MObjFPC: FPC's Object Pascal compatibility mode (default)

: 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
: Optimizations:
: Disable optimizations
: 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

: Set target processor. Case insensitive:

-Pecmascript5: default

-Pecmascript6

: Syntax options. <x> is a combination of the following letters:
2
: Same as -Mobjfpc (default)
: Turn on assertions
: Support operators like C (*=,+=,/= and -=)
: Same as -Mdelphi
: Allows typed constants to be writeable (default)
: Enables macro replacements
: Set interface style to <x>
: COM, reference counted interface (default)

-SIcorba: CORBA interface

: Set target platform

-Tbrowser: default

-Tnodejs : add pas.run(), includes -Jc

: Undefines the symbol <x>
-v<x>
: Be verbose. <x> is a combination of the following letters:
: Show errors (default)
: Show warnings
: Show notes
: Show hints
: Show info
: Show line numbers, needs -vi
: Show everything
0
: Show nothing (except errors)
: Show file names with full path
: Show conditionals
: Show tried/used files
: Show debug notes and info, enables -vni
: Show message numbers
: Show used tools
: Write pas2jsdebug.log with lots of debugging info
: 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.

January 2024 pas2js-3.2.2