Sign in Join
Wiki copytemporary

Codetools/fr: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Que sont les outils de code(codetools)
22
33Le paquet "outils de code" est un paquet de Lazarus fournissant des outils pour analyser, explorer, éditer et refactoriser les sources en langage Pascal. Les outils de code sont un module par eux-mêmes et sont proposés sous la licence GPL. Il existe de nombreux exemples sur comment utiliser les outils de code dans vos propres programmes dans le répertoire components/codetools/examples.
44
55svn:
66
77- Lazarus : <http://svn.freepascal.org/svn/lazarus/trunk>
88- Seulement les outils de code : <http://svn.freepascal.org/svn/lazarus/trunk/components/codetools>
99
1010## Utilisation des outils de code sans l'IDE
1111
1212Vous pouvez utiliser les outils de code sans l'IDE. Ceci peut être utile pour tester un nouvel outil. Un exemple simple est proposé avec
1313
14-` <lazarusdir>/components/codetools/examples/methodjumping.lpi`
14+```
15+ <lazarusdir>/components/codetools/examples/methodjumping.lpi
16+```
1517
1618Pour tester et trouver les déclarations, les outils de code ont besoin d'analyser les sources, notamment les sources RTL et FCL. Les exemples utilisent les variables d'environnement suivantes :
1719
1820- FPCDIR : chemin des sources FPC, par défaut *~/freepascal/fpc*.
1921- PP : chemin de l'exécutable du compilateur (/usr/bin/fpc ou /usr/bin/ppc386 ou C:\lazarus\ppc386.exe). Les codetools ont besoin de demander au compilateurs les paramètres d'exécution. Par défaut, la recherche s'effectue grâce à 'fpc' *via* la variable PATH.
2022- FPCTARGETOS : indique aux codetools de travailler pour un autre système d'exploitation (compilation transversale). Par exemple : linux, freebsd, darwin, win32, win64, wince.
2123- FPCTARGETCPU : lors d'un travail avec un autre CPU. Par exemple : i386, powerpc, x86_64, arm, sparc.
2224- LAZARUSDIR: chemin des sources de Lazarus. Utile seulement si vous travaillez avec elles.
2325
2426FPC is a very complex project with lots of search paths, include files and macros. The codetools need to know all these paths and macros in order to parse this jungle. To setup all this easily the codetools contain predefined templates for FPC, Lazarus, Delphi and Kylix source directories. See for a find declaration example
2527
26-` <lazarusdir>/components/codetools/examples/finddeclaration.lpi`
28+```
29+ <lazarusdir>/components/codetools/examples/finddeclaration.lpi
30+```
2731
2832Because the FPC sources contain multiple versions of some units, and the FPC sources changes often, the codetools does not use a fixed path table, but instead scan first the whole FPC directory structure and try to guess, what source is the right for the current TargetOS and TargetCPU. This scan may take a while depending on your disk speed. All examples save the result in **codetools.config**, so that on next start the scan is skipped.
2933
3034Whenever the FPC sources have moved or a unit is renamed, just delete the file **codetools.config**. The Lazarus IDE has its own config file and does the rescan, whenever the compiler executable has changed or the user forces a 'Environment \> Rescan FPC source directory'.
3135
3236## Using the codetools in the IDE with the IDEIntf
3337
3438See \<lazarusdir\>/examples/idequickfix/quickfixexample.lpk package. It demonstrates:
3539
3640- How to write an IDE package.
3741
38-` When You install it will register a Quick Fix item.`
42+```
43+ When You install it will register a Quick Fix item.
44+```
3945
4046- How to write Quick Fix item for compiler messages 'Parameter "Sender" not used'
4147- How to use the codetools to
4248
43-`     * parsing a unit`\
44-`     * conversion of Filename,Line,Column to codetools source position`\
45-`     * finding a codetools node at a cursor position`\
46-`     * finding a procedure node and the begin..end node`\
47-`     * creating a nice insertion position for a statement at the beginning of`\
48-`       the begin..end block`\
49-`     * getting the indentation of a line, so that the new line will`\
50-`       work in sub procedure as well`\
51-`     * inserting code with the codetools`
49+``` pascal
50+ * parsing a unit
51+ * conversion of Filename,Line,Column to codetools source position
52+ * finding a codetools node at a cursor position
53+ * finding a procedure node and the begin..end node
54+ * creating a nice insertion position for a statement at the beginning of
55+ the begin..end block
56+ * getting the indentation of a line, so that the new line will
57+ work in sub procedure as well
58+ * inserting code with the codetools
59+```
5260
5361---
5462*From the Free Pascal wiki, page "Codetools/fr", as it stood on 2017-12-05 after a change by Gillou58, 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).*
5563Category: Français

Back to history