Difference between revisions of "System unit structure/fr"

From Free Pascal wiki
Jump to navigationJump to search
Line 57: Line 57:
 
==== SysInitExceptions ====
 
==== SysInitExceptions ====
  
Initialization of internal structures used by the exception support.
+
Initialisation des structures internes utilisées par le support des exceptions.
  
 
<TODO>
 
<TODO>

Revision as of 12:35, 25 October 2014

An editor has declared this article to be a stub, meaning that it needs more information. Can you help out and add some? If you have some useful information, you can help the Free Pascal Wiki by clicking on the edit box on the left and expanding this page.

English (en) español (es) français (fr)

Structure de l'unité System

(travail en cours - incomplet!)

Cette page est censée documenter les fonctions et procédures servant comme "interfaces" entre les parties communes et celles spécifique à une plate-forme de l'unité System aussi bien que les sous-routines utilisée communément pour des tâches particulières réalisées pendant l'initialisation et spécifie leur comportement. Cela pourrait alors servir de spécification pour les mainteneurs des plate-formes existantes ou à venir pour garantir un comportement totalement compatible (en prenant en compte autant que possible les limitations individuelles des plate-formes).

Toutes les routines listées sont obligatoires (au moins comme stub) sauf indication contraire. Si le nom du fichier source habituel contenant l'implémentation d'une routine particulière n'est pas mentionné, il est supposé être system.pas pour le code spécifique à une plate-forme et system.inc pour les routines partagées entre les plate-formes.

Types

Les types suivants sont supposés définis dans l'interface de la partie spécifique plate-forme de l'unité System.

  • THandle
  • TThreadID
  • TRTLCriticalSection
  • PRTLCriticalSection

Constantes et variables

La liste suivante énumère les constantes et variables qui doivent être déclarées (et habituellement initialisées à une valeur raisonnable pour la plate-forme particulière) pour toutes les plates-formes:

  • LineEnding
  • DirectorySeparator
  • DriveSeparator
  • PathSeparator
  • MaxExitCode
  • MaxPathLen
  • UnusedHandle
  • StdInputHandle
  • StdOutputHandle
  • StdErrorHandle
  • LFNSupport
  • FileNameCaseSensitive
  • CtrlZMarksEof
  • sLineBreak
  • DefaultTextLineBreakStyle
  • ArgC
  • ArgV
  • EnvC
  • EnvP


<TODO>

Initialization

Partagé

InitHeap

Implementé dans heap.inc.

Initialisation des structutres internes utilisées par le gestionnaire de tas par défault. Aucun tas ne peut être utilisé avant avoir appelé InitHeap.

SysInitExceptions

Initialisation des structures internes utilisées par le support des exceptions.

<TODO>

OpenStdIO

Common part of initialization for standard file variables. It's similar to Assign and Reset/Rewrite calls for normal text files, but the files are associated with empty file names and no attempt is made to open the files (they're assumed to be already open).

<TODO>

InitSystemThreads

<TODO>

SetThreadManager

<TODO>

InitHeapMutexes

<TODO>

InitVariantManager

<TODO>

InitWideStringManager

<TODO>

Sysinit unit and indirect entry information

(note: This is currently at very initial stage and applies only to i386-win32 target)

Supporting runtime packages requires possibility to link the system unit and the main program into different executable modules. Therefore, global information generated by compiler, such as unit initialization table, cannot be directly referenced from the system unit. Instead, it is referenced from a separate small unit ('sysinit') and passed to routines in system unit via function arguments. The module entry point is placed in sysinit unit, too. A copy of sysinit unit is statically linked into every executable module, so every module ends up containing the initialization table only for the units it actually contains.

This global information is not limited to unit initialization table, see TEntryInformation record for complete list.

A target may have more than one sysinit unit, each solving specific initialization tasks. A particular unit to use is determined by compiler, see InitSysInitUnitName method in descendants of TLinker class. For example, while normally using sysinitpas.pp, complier will use sysinitcyg.pp instead if it detects linking with cygwin libraries.

Spécifique à une plate-forme

Initialisation de l'unité

The following tasks are performed:

  • IsLibrary variable initialization (true if running in a shared library, false otherwise)
  • ProcessID and ThreadID variables initialization
  • IsConsole variable initialization (true if running in a text console, false if running in windowed GUI application)
  • ExitProc variable initialization <TODO>
  • Heap initialization (calling shared InitHeap)
  • Initialization of potential procedural variables and/or parameters needed to support System unit routines requiring different implementation depending on detected version of operating system (possibly including dynamic loading of procedures or functions from shared libraries where appropriate) - see OS aware RTL
  • InOutRes variable initialization (set to 0)
  • Environment variables initialization (EnvC and EnvP), usually by calling InitEnvironment - only needed for platforms not providing access to these variables natively
  • Internal thread manager is initialized by calling InitSystemThreads
  • Internal variant manager is initialized by calling InitVariantManager
  • Internal widestring manager is initialized by calling InitWideStringManager

InitEnvironment

Only needed for platforms not providing access to EnvC and EnvP variables natively.

Procedure checks amount of environment variables and stores it in EnvC. Then memory for EnvP^ is allocated from heap (array of EnvC + 1 items of type PChar - the list pointer will point to nil). Finally the individual items in the array are initialized with PChars pointing to null terminated strings containing the environment variable name, equal sign and the environment variable value. Memory for the individual null terminated strings may be allocated from heap for these strings and they may be copied there if needed (i.e. if the particular platform doesn't provide pointer to a fixed location for these strings in required format).

InitArguments

Only needed for platforms not providing access to ArgC, ArgV and/or CmdLine variables natively.

<TODO>

SysInitStdIO

Initialization of standard file variables (Input, Output, ErrOutput, StdOut and StdErr).

<TODO>


InitSystemThreads

<TODO>

Tâches générales

Platform specific

Manipulation de fichier

Habituellement implémenté dans sysfile.inc.

Do_Close
Do_Erase
Do_Rename
Do_Read
Do_Write
Do_FilePos
Do_Seek
Do_SeekEnd
Do_FileSize
Do_Truncate
Do_Open
Do_IsDevice

Gestion du tas

SysOSAlloc
SysOSFree

Support du Threading

SysInitThreadVar
SysRelocateThreadVar

Autre

System_Exit

Routines publiques

The following routines are part of System unit interface and are supposed to be implemented fully in platform specific way. Their specification is available in FPC documentation, so they're listed here mostly for completeness sake to provide complete list for porting purposes.

Manipulation de répertoire

Habituellement implémenté dans sysdir.inc.

  • MkDir
  • RmDir
  • ChDir
  • GetDir

Autres

  • Randomize
  • ParamCount, ParamStr (possibly to be moved to common - <TODO>)


Finalization

Partagés

InternalExit

<TODO>

FinalizeHeap

<TODO>

Platform specific

FinalDeallocation

<TODO>