pas2js.cfg: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | # Locations | |
| 2 | 2 | ||
| 3 | 3 | You can see where [[pas2js]] searches for its cfg file and what it finds using the command line parameter **-vt**. | |
| 4 | 4 | ||
| 5 | 5 | On Unix (Linux, MacOS, BSD) pas2js searches | |
| 6 | 6 | ||
| 7 | 7 | - \$HOME/.pas2js.cfg - note the dot at the beginning of *.pas2js.cfg* | |
| 8 | 8 | - in the directory of the compiler binary. For example if pas2js is installed in */usr/lib/fpc/3.0.4/bin/pas2js*, then it searches */usr/lib/fpc/3.0.4/bin/pas2js.cfg* | |
| 9 | 9 | - in */etc/pas2js.cfg* | |
| 10 | 10 | ||
| 11 | 11 | On Windows the compiler searches: | |
| 12 | 12 | ||
| 13 | 13 | - %HOME%\pas2js.cfg | |
| 14 | 14 | - in the directory of the compiler binary. For example if pas2js is installed in *C:\pascal\pas2js\bin\pas2js*, then it searches *C:\pascal\pas2js\bin\pas2js.cfg* | |
| 15 | 15 | ||
| 16 | 16 | You can disable the search for the default config file using the parameter **-n**. | |
| 17 | 17 | ||
| 18 | 18 | You can pass additional config files using the @ parameter. For example: | |
| 19 | 19 | ||
| 20 | - | ||
| 20 | + | ```text | |
| 21 | + | pas2js -n @/etc/pas2js.cfg | |
| 22 | + | ``` | |
| 21 | 23 | ||
| 22 | 24 | This will skip the default config file and parse */etc/pas2js.cfg*. | |
| 23 | 25 | ||
| 24 | 26 | # Structure | |
| 25 | 27 | ||
| 26 | 28 | - Leading spaces and tabs are skipped. | |
| 27 | 29 | - Empty lines or lines only containing spaces are skipped | |
| 28 | 30 | - Lines beginning with **\#** followed by a space or tab are comment lines | |
| 29 | 31 | - Lines beginning with \#name are config directives: | |
| 30 | 32 | - \#IFDEF define | |
| 31 | 33 | - \#IFNDEF define | |
| 32 | 34 | - \#IF expression - same as \$if, except only defines | |
| 33 | 35 | - \#ELSEIF | |
| 34 | 36 | - \#ELSE | |
| 35 | 37 | - \#ENDIF | |
| 36 | 38 | - \#ERROR text | |
| 37 | 39 | - Other lines are treated as single parameters. For example *-FuFol der* is the same as passing *"-FuFol der"* as [command line parameter](https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/utils/pas2js/docs/translation.html?view=co#commandlineparameters). | |
| 38 | 40 | - Search paths (e.g. *-Fu* or *-Fi*) in config files are searched from top to bottom, while on the command line they are searched from right to left. | |
| 39 | 41 | - For *defines* see [Compiler directives](https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/utils/pas2js/docs/translation.html?view=co#compilerdirectives) | |
| 40 | 42 | ||
| 41 | 43 | # Macros | |
| 42 | 44 | ||
| 43 | 45 | - \$Pas2jsFullVersion - major.minor.release\<extra\> | |
| 44 | 46 | - \$Pas2jsVersion - major.minor.release | |
| 45 | 47 | - \$CfgDir - The directory of this config file | |
| 46 | 48 | - \$Env - environment variable, e.g. \$Env(HOME) | |
| 47 | 49 | ||
| 48 | 50 | You can see the supported macros running *pas2js -h* | |
| 49 | 51 | ||
| 50 | 52 | # Examples | |
| 51 | 53 | ||
| 52 | 54 | Here is a typical pas2js.cfg file: | |
| 53 | 55 | ||
| 54 | 56 | # | |
| 55 | 57 | # Minimal config file for pas2js compiler | |
| 56 | 58 | # | |
| 57 | 59 | # -d is the same as #DEFINE | |
| 58 | 60 | # -u is the same as #UNDEF | |
| 59 | 61 | # | |
| 60 | 62 | # Write always a nice logo ;) | |
| 61 | 63 | -l | |
| 62 | 64 | ||
| 63 | 65 | # Display Warnings, Notes and Hints | |
| 64 | 66 | -vwnh | |
| 65 | 67 | # If you don't want so much verbosity use | |
| 66 | 68 | #-vw | |
| 67 | 69 | ||
| 68 | 70 | # Allow C-operators | |
| 69 | 71 | -Sc | |
| 70 | 72 | ||
| 71 | 73 | #IFDEF FPC_SUBTARGET_NAMESPACED | |
| 72 | 74 | -Fu$CfgDir/../../packages/*/*/namespaced | |
| 73 | 75 | -Fi$CfgDir/../../packages/*/*/src | |
| 74 | 76 | #else | |
| 75 | 77 | -Fu$CfgDir/../../packages/*/*/src | |
| 76 | 78 | #endif | |
| 77 | 79 | ||
| 78 | 80 | # path to rtl.js | |
| 79 | 81 | -Fu../../compiler/utils/pas2js/dist/ | |
| 80 | 82 | ||
| 81 | 83 | #IFDEF nodejs | |
| 82 | 84 | -Jirtl.js | |
| 83 | 85 | #ENDIF | |
| 84 | 86 | ||
| 85 | 87 | # Put all generated JavaScript into one file | |
| 86 | 88 | -Jc | |
| 87 | 89 | ||
| 88 | 90 | # end. | |
| 89 | 91 | ||
| 90 | 92 | # Creating pas2js.cfg | |
| 91 | 93 | ||
| 92 | 94 | When you built via **make**, it creates a **pas2js.cfg** in *bin/\$(TargetCPU)-\$(TargetOS)/*. | |
| 93 | 95 | ||
| 94 | 96 | There is a tool to create a basic pas2js.cfg: *tools/createconfig/createconfig* | |
| 95 | 97 | ||
| 96 | 98 | --- | |
| 97 | 99 | *From the Free Pascal wiki, page "pas2js.cfg", as it stood on 2024-02-27 after a change by Mattias2, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 98 | 100 | Category: Pas2js |
