id = "fpc" name = "Free Pascal" homepage = "https://www.freepascal.org/" description = "A professional Pascal compiler" executables = ["fpc", "ppcx64", "ppcarm"] [dotfiles] # Free Pascal's official user guide says the Unix compiler searches the home # directory for .fpc.cfg before system locations. Compiler/search paths in the # file are machine-specific and stay local. # https://www.freepascal.org/docs-html/user/usersu10.html # https://docs.freepascal.org/docs-html/current/user/usersu5.html paths = ["~/.fpc.cfg"] secret = [] [[dotfiles.machine_lines]] file = "~/.fpc.cfg" match = { prefix = ["-Fu", "-Fi", "-Fl", "-FD", "-FU"] } scope = "platform" [commands] format = 1 label = "Compile Pascal program" description = "Compile a Pascal source file with fpc. Options are written attached to their value (-O2, -Mdelphi, -FEdir). Target selection, linking and assembler options are left out." quality = "ai-draft" parser = { end_of_options = "--", interleave = "permute", long_equals = false, short_attached = true, short_bundles = false } [[commands.source]] id = "manual" kind = "manual" url = "https://man.archlinux.org/man/fpc.1" revision = "fpc(1) man page" evidence = """ fpc [options] [sourcefile] -FE xxx set the executable/unit output path to xxx -Fi xxx adds xxx to the path where the compiler searches for its include files. -Fu xxx Adds xxx to the unit path. -FU xxx Tells the compiler to write units in directory xxx instead of the current directory. -g Generate debugging information for debugging with GDB. -d xxx Define the symbol name xxx. This can be used to conditionally compile parts of your code. -O xxx optimize the compiler's output; 1 Level 1 optimizations (quick optimizations). 2 Level 2 optimizations (-O1 plus some slower optimizations). 3 Level 3 optimizations (-O2 plus -Ou). -o xxx Tells the compiler to use xxx as the name of the output file (executable). Only with programs. -M mode Specify the language mode. delphi, fpc, gpc, macpas, objfpc, tp -n Tells the compiler not to read the configuration file fpc.cfg """ [[commands.field]] id = "source" label = "Source file" type = "path" position = 0 min = 1 path = { kind = "file", role = "input" } sources = ["manual"] [[commands.field]] id = "output" label = "Output file name" type = "string" option = ["-o"] effect = "overwrite" sources = ["manual"] [[commands.field]] id = "mode" label = "Language mode" type = "enum" option = ["-M"] choices = [{ value = "fpc", label = "FPC (default)" }, { value = "objfpc", label = "Object Pascal" }, { value = "delphi", label = "Delphi" }, { value = "tp", label = "Turbo Pascal" }, { value = "macpas", label = "Mac Pascal" }] sources = ["manual"] [[commands.field]] id = "optimize" label = "Optimization level" type = "enum" option = ["-O"] choices = [{ value = "1", label = "Level 1 (quick)" }, { value = "2", label = "Level 2" }, { value = "3", label = "Level 3" }] sources = ["manual"] [[commands.field]] id = "debug" label = "Debug info (GDB)" type = "boolean" option = ["-g"] sources = ["manual"] [[commands.field]] id = "defines" label = "Define symbols" type = "string" option = ["-d"] multiple = true sources = ["manual"] [[commands.field]] id = "unit_paths" label = "Unit search paths" type = "path" option = ["-Fu"] multiple = true path = { kind = "directory", role = "input" } sources = ["manual"] [[commands.field]] id = "include_paths" label = "Include search paths" type = "path" option = ["-Fi"] multiple = true path = { kind = "directory", role = "input" } sources = ["manual"] [[commands.field]] id = "exe_dir" label = "Executable output directory" type = "path" option = ["-FE"] path = { kind = "directory", role = "output", must_exist = false } sources = ["manual"] [[commands.field]] id = "unit_dir" label = "Unit output directory" type = "path" option = ["-FU"] path = { kind = "directory", role = "output", must_exist = false } sources = ["manual"] [[commands.field]] id = "no_config" label = "Ignore fpc.cfg" type = "boolean" option = ["-n"] sources = ["manual"] [[commands.task]] id = "compile" label = "Compile" fields = ["source", "mode", "output"] required = ["source"] [[commands.task]] id = "debug_build" label = "Debug build" fields = ["source", "mode", "debug"] required = ["source"] set = { debug = [true] } [[commands.group]] id = "basic" label = "Basic" fields = ["source", "output", "mode", "optimize", "debug", "defines"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["unit_paths", "include_paths", "exe_dir", "unit_dir", "no_config"]