Difference between revisions of "Pascal for C users/fr"
From Lazarus wiki
Jump to navigationJump to search (Creating and titles translation) |
|||
Line 4: | Line 4: | ||
== Traduction == | == Traduction == | ||
− | {{Note| | + | {{Note|Les opérateurs logiques (AND/OR/XOR etc) sont logiques (bit à bit) ou booléens selon le types des arguments (resp. entiers ou booléen). Puisque Pascal possède un type booléen séparé depuis le début, les opérateurs booléens sur les entiers n'étaient pas nécessaires, et sont toujours logiques (bit à bit).}} |
{| class="wikitable" | {| class="wikitable" | ||
Line 10: | Line 10: | ||
|- | |- | ||
| { | | { | ||
− | | [[Begin]] | + | | [[Begin/fr|Begin]] |
| | | | ||
|- | |- | ||
| } | | } | ||
− | | [[End]] | + | | [[End/fr|End]] |
| | | | ||
|- | |- | ||
| = | | = | ||
| := | | := | ||
− | | [[Becomes]] | + | | [[Becomes/fr|Affectation]] |
|- | |- | ||
| == | | == | ||
| = | | = | ||
− | | [[Equal]] | + | | [[Equal/fr|Egalité]] |
|- | |- | ||
| / | | / | ||
| / | | / | ||
− | | [[Slash| | + | | [[Slash/fr|Division flottante]] (division entière: [[Div/fr|div]]) |
|- | |- | ||
| % | | % | ||
− | | [[Mod]] | + | | [[Mod/fr|Mod]] |
− | | '''Mod'''ulo | + | | Opération '''Mod'''ulo |
|- | |- | ||
| ! | | ! | ||
− | | [[Not]] | + | | [[Not/fr|Not]] |
− | | | + | | NON logique |
|- | |- | ||
| != | | != | ||
| <> | | <> | ||
− | | [[Not equal]] | + | | [[Not equal/fr|Différent de]] |
|- | |- | ||
| && | | && | ||
− | | [[And]] | + | | [[And/fr|And]] |
− | | | + | | ET logique |
|- | |- | ||
| <nowiki> || </nowiki> | | <nowiki> || </nowiki> | ||
− | | [[Or]] | + | | [[Or/fr|Or]] |
− | | | + | | OU logique |
|- | |- | ||
| & | | & | ||
− | | [[And]] | + | | [[And/fr|And]] |
− | | | + | | ET bit à bit |
|- | |- | ||
| <nowiki> | </nowiki> | | <nowiki> | </nowiki> | ||
− | | [[Or]] | + | | [[Or/fr|Or]] |
− | | | + | | OU bit à bit |
|- | |- | ||
| ^ | | ^ | ||
− | | [[Xor]] | + | | [[Xor/fr|Xor]] |
− | | | + | | OU exclusif |
|- | |- | ||
| ~ | | ~ | ||
− | | [[Not]] | + | | [[Not/fr|Not]] |
− | | | + | | Complément à 1 (inversion de bits) |
|- | |- | ||
| >> | | >> | ||
− | | [[Shr]] | + | | [[Shr/fr|Shr]] |
− | | | + | | Décalage à droite Note: shr est un '''décalage logique''' et non arithmétique. Si l'opérande de gauche est une valeur négative ou un type signé alors le résultat d'une opération shr peut ne pas être ce à quoi vous vous attendiez. |
|- | |- | ||
| << | | << | ||
| [[Shl]] | | [[Shl]] | ||
− | | | + | | Décalage à gauche |
|- | |- | ||
| ++ | | ++ | ||
− | | [[Inc]] | + | | [[Inc/fr|Inc]] |
| | | | ||
|- | |- | ||
| -- | | -- | ||
− | | [[Dec]] | + | | [[Dec/fr|Dec]] |
| | | | ||
|- | |- | ||
| /* | | /* | ||
− | | { | + | | { ou (* |
− | | [[Comments| | + | | Début de [[Comments/fr|commentaire]] |
|- | |- | ||
| */ | | */ | ||
− | | } | + | | } ou *) |
− | | | + | | Fin de commentaire |
|- | |- | ||
| // | | // | ||
| // | | // | ||
− | | | + | | Commentaire de fin de ligne (limité à une seule ligne) |
|- | |- | ||
| 0x | | 0x | ||
− | | [[Dollar_sign|$]] | + | | [[Dollar_sign/fr|$]] |
− | | | + | | Préfixe pour les nombres en hexadécimal p.ex. $FFFFFF |
|- | |- | ||
| 0 | | 0 | ||
− | | [[&|&]] | + | | [[&/fr|&]] |
− | | | + | | Préfixe pour les nombres en octal p.ex. &77777777 |
|- | |- | ||
| 0b | | 0b | ||
− | | [[Percent_sign|%]] | + | | [[Percent_sign/fr|%]] |
− | | | + | | Préfixe pour les nombres en binaire p.ex. %11111111 |
|- | |- | ||
| & | | & | ||
− | | [[@]] | + | | [[@/fr|@]] |
− | | [[@| | + | | [[@|Opérateur d'adresse]] |
|- | |- | ||
| * | | * | ||
− | | [[^]] | + | | [[^/fr|^]] |
− | | | + | | Voir [[Pointer/fr|Pointeur]] et [[Pointers/fr|Pointeurs]] |
|- | |- | ||
| if() | | if() | ||
− | | [[If]] [[Then]] | + | | [[If/fr|If]] [[Then/fr|Then]] |
| | | | ||
|- | |- | ||
| if() else | | if() else | ||
− | | [[If]] [[Then]] [[Else]] | + | | [[If/fr|If]] [[Then/fr|Then]] [[Else/fr|Else]] |
| | | | ||
|- | |- | ||
| while | | while | ||
− | | [[While]] [[Do]] | + | | [[While/fr|While]] [[Do/fr|Do]] |
| | | | ||
|- | |- | ||
| do while | | do while | ||
− | | [[Repeat]] [[Until]] [[Not]] | + | | [[Repeat/fr|Repeat]] [[Until/fr|Until]] [[Not/fr|Not]] |
| | | | ||
|- | |- | ||
|- | |- | ||
| do while ! | | do while ! | ||
− | | [[Repeat]] [[Until]] | + | | [[Repeat/fr|Repeat]] [[Until/fr|Until]] |
| | | | ||
|- | |- | ||
| for ++ | | for ++ | ||
− | | [[For]] [[To]] [[Do]] | + | | [[For/fr|For]] [[To/fr|To]] [[Do/fr|Do]] |
| | | | ||
|- | |- | ||
| for -- | | for -- | ||
− | | [[For]] [[Downto]] [[Do]] | + | | [[For/fr|For]] [[Downto/fr|Downto]] [[Do/fr|Do]] |
| | | | ||
|- | |- | ||
| switch case break | | switch case break | ||
− | | [[Case]] [[Of]] [[End]] | + | | [[Case/fr|Case]] [[Of/fr|Of]] [[End/fr|End]] |
| | | | ||
|- | |- | ||
| switch case break default | | switch case break default | ||
− | | [[Case]] [[Of]] [[Else]] [[End]] | + | | [[Case/fr|Case]] [[Of/fr|Of]] [[Else/fr|Else]] [[End/fr|End]] |
| | | | ||
|- | |- | ||
| const a_c_struct *arg | | const a_c_struct *arg | ||
− | | [[Constref]] arg : a_c_struct | + | | [[Constref/fr|Constref]] arg : a_c_struct |
| | | | ||
|- | |- | ||
| a_c_struct *arg | | a_c_struct *arg | ||
− | | [[Var]] arg : a_c_struct | + | | [[Var/fr|Var]] arg : a_c_struct |
| | | | ||
|- | |- | ||
Line 162: | Line 162: | ||
{| class="wikitable" | {| class="wikitable" | ||
− | ! C | + | ! Type C !! [[Pascal/fr|Pascal]] [[Data_type|Type]] !! Taille (bits) !! Etendue !! Notes |
|- | |- | ||
| char | | char | ||
− | | [[Char]] | + | | [[Char/fr|Char]] |
| 8-bit | | 8-bit | ||
| | | | ||
− | | [[ASCII]] | + | | [[ASCII/fr|ASCII]] |
|- | |- | ||
| signed char | | signed char | ||
− | | [[Shortint]] | + | | [[Shortint/fr|Shortint]] |
| 8-bit | | 8-bit | ||
| -128 .. 127 | | -128 .. 127 | ||
Line 177: | Line 177: | ||
|- | |- | ||
| unsigned char | | unsigned char | ||
− | | [[Byte]] | + | | [[Byte/fr|Byte]] |
| 8-bit | | 8-bit | ||
| 0 .. 255 | | 0 .. 255 | ||
Line 183: | Line 183: | ||
|- | |- | ||
| char* | | char* | ||
− | | [[PChar]] | + | | [[PChar/fr|PChar]] |
| (32-bit) | | (32-bit) | ||
| | | | ||
− | | | + | | Pointeur sur une chaîne à zéro terminal |
|- | |- | ||
| short int | | short int | ||
− | | [[Smallint]] | + | | [[Smallint/fr|Smallint]] |
| 16-bit | | 16-bit | ||
| -32768 .. 32767 | | -32768 .. 32767 | ||
Line 195: | Line 195: | ||
|- | |- | ||
| unsigned short int | | unsigned short int | ||
− | | [[Word]] | + | | [[Word/fr|Word]] |
| 16-bit | | 16-bit | ||
| 0 .. 65535 | | 0 .. 65535 | ||
Line 201: | Line 201: | ||
|- | |- | ||
| int | | int | ||
− | | [[Integer]] | + | | [[Integer/fr|Integer]] |
| (16-bit or) 32-bit | | (16-bit or) 32-bit | ||
| -2147483648..2147483647 | | -2147483648..2147483647 | ||
− | | | + | | Types entiers génériques |
|- | |- | ||
| unsigned int | | unsigned int | ||
− | | [[Cardinal]] | + | | [[Cardinal/fr|Cardinal]] |
| (16-bit or) 32-bit | | (16-bit or) 32-bit | ||
| 0 .. 4294967295 | | 0 .. 4294967295 | ||
− | | | + | | Types entiers génériques |
|- | |- | ||
| long int | | long int | ||
− | | [[Longint]] | + | | [[Longint/fr|Longint]] |
| 32-bit | | 32-bit | ||
| -2147483648..2147483647 | | -2147483648..2147483647 | ||
Line 219: | Line 219: | ||
|- | |- | ||
| unsigned long int | | unsigned long int | ||
− | | [[Longword]] | + | | [[Longword/fr|Longword]] |
| 32-bit | | 32-bit | ||
| 0 .. 4294967295 | | 0 .. 4294967295 | ||
Line 225: | Line 225: | ||
|- | |- | ||
| float | | float | ||
− | | [[Single]] | + | | [[Single/fr|Single]] |
| 32-bit | | 32-bit | ||
| 1.5E-45 .. 3.4E+38 | | 1.5E-45 .. 3.4E+38 | ||
Line 231: | Line 231: | ||
|- | |- | ||
| double | | double | ||
− | | [[Double]] | + | | [[Double/fr|Double]] |
| 64-bit | | 64-bit | ||
| 5.0E-324 .. 1.7E+308 | | 5.0E-324 .. 1.7E+308 | ||
| | | | ||
− | |||
|- | |- | ||
|} | |} | ||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
− | ! C | + | ! Type C !! [[Pascal/fr|Pascal]] !! Notes |
|- | |- | ||
| struct { } | | struct { } | ||
− | | [[Record]] [[End]] | + | | [[Record/fr|Record]] [[End/fr|End]] |
| | | | ||
|- | |- | ||
| union { } | | union { } | ||
− | | [[Record]] [[Case]] [[Of]] [[End]] | + | | [[Record/fr|Record]] [[Case/fr|Case]] [[Of/fr|Of]] [[End/fr|End]] |
− | | [[Case# | + | | [[Case/fr#Enregistrement avec variantes|Enregistrement avec variantes]] |
|- | |- | ||
|} | |} | ||
Line 255: | Line 253: | ||
{| class="wikitable" | {| class="wikitable" | ||
− | ! C !! [[Pascal]] !! [[Unit]] | + | ! C !! [[Pascal/fr|Pascal]] !! [[Unit/fr|Unit]] |
|- | |- | ||
| abs | | abs | ||
| Abs | | Abs | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
| acos | | acos | ||
| ArcCos | | ArcCos | ||
− | | [[Math unit|Math]] | + | | [[Math unit/fr|Math]] |
|- | |- | ||
| asin | | asin | ||
| ArcSin | | ArcSin | ||
− | | [[Math unit|Math]] | + | | [[Math unit/fr|Math]] |
|- | |- | ||
| atan | | atan | ||
| ArcTan | | ArcTan | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
| atof | | atof | ||
| StrToFloat | | StrToFloat | ||
− | | [[sysutils|SysUtils]] | + | | [[sysutils/fr|SysUtils]] |
|- | |- | ||
| atoi | | atoi | ||
| StrToInt | | StrToInt | ||
− | | [[sysutils|SysUtils]] | + | | [[sysutils/fr|SysUtils]] |
|- | |- | ||
| atol | | atol | ||
| StrToInt | | StrToInt | ||
− | | [[sysutils|SysUtils]] | + | | [[sysutils/fr|SysUtils]] |
|- | |- | ||
| atoll | | atoll | ||
| StrToInt64 | | StrToInt64 | ||
− | | [[sysutils|SysUtils]] | + | | [[sysutils/fr|SysUtils]] |
|- | |- | ||
| ceil | | ceil | ||
| Ceil | | Ceil | ||
− | | [[Math unit|Math]] | + | | [[Math unit/fr|Math]] |
|- | |- | ||
| cos | | cos | ||
| Cos | | Cos | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
| exp | | exp | ||
| Exp | | Exp | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
| floor | | floor | ||
| Floor | | Floor | ||
− | | [[Math unit|Math]] | + | | [[Math unit/fr|Math]] |
|- | |- | ||
| pow | | pow | ||
| Power | | Power | ||
− | | [[Math unit|Math]] | + | | [[Math unit/fr|Math]] |
|- | |- | ||
| round | | round | ||
| Round | | Round | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
| sin | | sin | ||
| Sin | | Sin | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
| sqrt | | sqrt | ||
| Sqrt | | Sqrt | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
| strcpy | | strcpy | ||
| Copy | | Copy | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
| strlen | | strlen | ||
| Length | | Length | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
| tan | | tan | ||
| Tan | | Tan | ||
− | | [[Math unit|Math]] | + | | [[Math unit/fr|Math]] |
|- | |- | ||
| toupper | | toupper | ||
| UpCase | | UpCase | ||
− | | [[System unit|System]] | + | | [[System unit/fr|System]] |
|- | |- | ||
|} | |} | ||
Line 341: | Line 339: | ||
=== C++ === | === C++ === | ||
{| class="wikitable" | {| class="wikitable" | ||
− | ! C++ type !! [[Pascal]] !! Notes | + | ! C++ type !! [[Pascal/fr|Pascal]] !! Notes |
|- | |- | ||
| class { } | | class { } | ||
− | | [[Class]] [[End]] | + | | [[Class/fr|Class]] [[End/fr|End]] |
| | | | ||
|- | |- | ||
| class: { } | | class: { } | ||
− | | [[Class]]( ) [[End]] | + | | [[Class/fr|Class]]( ) [[End/fr|End]] |
| | | | ||
|- | |- | ||
| template <class T> class { } | | template <class T> class { } | ||
− | | [[Generic]] = [[Class]]<T> [[End]] | + | | [[Generic/fr|Generic]] = [[Class/fr|Class]]<T> [[End/fr|End]] |
| | | | ||
|- | |- | ||
| struct { } | | struct { } | ||
− | | [[Object]] [[End]] | + | | [[Object/fr|Object]] [[End/fr|End]] |
− | | | + | | Si vous voulez des méthodes |
|- | |- | ||
|} | |} |
Revision as of 12:52, 2 May 2020
│
Deutsch (de) │
English (en) │
français (fr) │
Présentation
Cette page donne quelques traduction entre des concepts C(++) et Pascal.
Traduction
Remarque: Les opérateurs logiques (AND/OR/XOR etc) sont logiques (bit à bit) ou booléens selon le types des arguments (resp. entiers ou booléen). Puisque Pascal possède un type booléen séparé depuis le début, les opérateurs booléens sur les entiers n'étaient pas nécessaires, et sont toujours logiques (bit à bit).
C | Pascal | Notes |
---|---|---|
{ | Begin | |
} | End | |
= | := | Affectation |
== | = | Egalité |
/ | / | Division flottante (division entière: div) |
% | Mod | Opération Modulo |
! | Not | NON logique |
!= | <> | Différent de |
&& | And | ET logique |
|| | Or | OU logique |
& | And | ET bit à bit |
| | Or | OU bit à bit |
^ | Xor | OU exclusif |
~ | Not | Complément à 1 (inversion de bits) |
>> | Shr | Décalage à droite Note: shr est un décalage logique et non arithmétique. Si l'opérande de gauche est une valeur négative ou un type signé alors le résultat d'une opération shr peut ne pas être ce à quoi vous vous attendiez. |
<< | Shl | Décalage à gauche |
++ | Inc | |
-- | Dec | |
/* | { ou (* | Début de commentaire |
*/ | } ou *) | Fin de commentaire |
// | // | Commentaire de fin de ligne (limité à une seule ligne) |
0x | $ | Préfixe pour les nombres en hexadécimal p.ex. $FFFFFF |
0 | & | Préfixe pour les nombres en octal p.ex. &77777777 |
0b | % | Préfixe pour les nombres en binaire p.ex. %11111111 |
& | @ | Opérateur d'adresse |
* | ^ | Voir Pointeur et Pointeurs |
if() | If Then | |
if() else | If Then Else | |
while | While Do | |
do while | Repeat Until Not | |
do while ! | Repeat Until | |
for ++ | For To Do | |
for -- | For Downto Do | |
switch case break | Case Of End | |
switch case break default | Case Of Else End | |
const a_c_struct *arg | Constref arg : a_c_struct | |
a_c_struct *arg | Var arg : a_c_struct |
Type C | Pascal Type | Taille (bits) | Etendue | Notes |
---|---|---|---|---|
char | Char | 8-bit | ASCII | |
signed char | Shortint | 8-bit | -128 .. 127 | |
unsigned char | Byte | 8-bit | 0 .. 255 | |
char* | PChar | (32-bit) | Pointeur sur une chaîne à zéro terminal | |
short int | Smallint | 16-bit | -32768 .. 32767 | |
unsigned short int | Word | 16-bit | 0 .. 65535 | |
int | Integer | (16-bit or) 32-bit | -2147483648..2147483647 | Types entiers génériques |
unsigned int | Cardinal | (16-bit or) 32-bit | 0 .. 4294967295 | Types entiers génériques |
long int | Longint | 32-bit | -2147483648..2147483647 | |
unsigned long int | Longword | 32-bit | 0 .. 4294967295 | |
float | Single | 32-bit | 1.5E-45 .. 3.4E+38 | |
double | Double | 64-bit | 5.0E-324 .. 1.7E+308 |
Type C | Pascal | Notes |
---|---|---|
struct { } | Record End | |
union { } | Record Case Of End | Enregistrement avec variantes |
C | Pascal | Unit |
---|---|---|
abs | Abs | System |
acos | ArcCos | Math |
asin | ArcSin | Math |
atan | ArcTan | System |
atof | StrToFloat | SysUtils |
atoi | StrToInt | SysUtils |
atol | StrToInt | SysUtils |
atoll | StrToInt64 | SysUtils |
ceil | Ceil | Math |
cos | Cos | System |
exp | Exp | System |
floor | Floor | Math |
pow | Power | Math |
round | Round | System |
sin | Sin | System |
sqrt | Sqrt | System |
strcpy | Copy | System |
strlen | Length | System |
tan | Tan | Math |
toupper | UpCase | System |
C++
C++ type | Pascal | Notes |
---|---|---|
class { } | Class End | |
class: { } | Class( ) End | |
template <class T> class { } | Generic = Class<T> End | |
struct { } | Object End | Si vous voulez des méthodes |
Voir aussi
- [1] Short tutorial that describes the process of using C and C++ code in FreePascal, including writing of wrapper code
- Creating bindings for C libraries
- Common problems when converting C header files
- SWIG
- “comparison of Pascal and C” on the English Wikipedia