Difference between revisions of "Pascal for Java users"
From Free Pascal wiki
Jump to navigationJump to searchLine 2: | Line 2: | ||
! Java | ! Java | ||
! [[Pascal]] | ! [[Pascal]] | ||
− | ! | + | ! Additional comments |
|- | |- | ||
| { | | { | ||
Line 66: | Line 66: | ||
| /* | | /* | ||
| { | | { | ||
+ | | [[Comments|Comment]] start | ||
+ | |- | ||
+ | | /* | ||
+ | | (* | ||
| [[Comments|Comment]] start | | [[Comments|Comment]] start | ||
|- | |- | ||
| */ | | */ | ||
| } | | } | ||
+ | | Comment end | ||
+ | |- | ||
+ | | */ | ||
+ | | *) | ||
| Comment end | | Comment end | ||
|- | |- | ||
Line 82: | Line 90: | ||
| abstract | | abstract | ||
| [[Abstract]] | | [[Abstract]] | ||
+ | | | ||
+ | |- | ||
+ | | break | ||
+ | | [[Break]] | ||
| | | | ||
|- | |- | ||
Line 87: | Line 99: | ||
| TheClass = [[Class]] [[End]]; | | TheClass = [[Class]] [[End]]; | ||
| | | | ||
+ | |- | ||
+ | | class TheClass<T> { } | ||
+ | | [[Generic]] TheClass = [[Class]]<T> [[End]]; | ||
+ | | Generics are classes only as of 2.2.2, likely to support more in the future | ||
|- | |- | ||
| continue | | continue | ||
− | | | + | | [[Continue]] |
| | | | ||
|- | |- | ||
Line 141: | Line 157: | ||
|- | |- | ||
| native | | native | ||
+ | | [[StdCall]] | ||
| | | | ||
+ | |- | ||
+ | | native | ||
+ | | [[CDecl]] | ||
| | | | ||
|- | |- | ||
Line 166: | Line 186: | ||
| public | | public | ||
| [[Public]] | | [[Public]] | ||
+ | | | ||
+ | |- | ||
+ | | return | ||
+ | | FunctionName | ||
| | | | ||
|- | |- | ||
Line 173: | Line 197: | ||
|- | |- | ||
| static | | static | ||
+ | | [[Static]] | ||
| | | | ||
+ | |- | ||
+ | | static | ||
+ | | [[Class]] [[Function]] | ||
+ | | | ||
+ | |- | ||
+ | | static | ||
+ | | [[Class]] [[Procedure]] | ||
| | | | ||
|- | |- | ||
| super | | super | ||
| [[Inherited]] | | [[Inherited]] | ||
− | | | + | | Parent constructor call |
|- | |- | ||
| switch case break | | switch case break | ||
Line 241: | Line 273: | ||
| 8-bit | | 8-bit | ||
| -128 .. 127 | | -128 .. 127 | ||
+ | | | ||
+ | |- | ||
+ | | byte | ||
+ | | [[Byte]] | ||
+ | | 8-bit | ||
+ | | 0 .. 255 | ||
| | | | ||
|- | |- | ||
Line 247: | Line 285: | ||
| 16-bit | | 16-bit | ||
| -32768 .. 32767 | | -32768 .. 32767 | ||
− | | | + | |- |
+ | | short | ||
+ | | [[Word]] | ||
+ | | 16-bit | ||
+ | | 0 .. 65535 | ||
|- | |- | ||
| int | | int | ||
Line 254: | Line 296: | ||
| -2147483648..2147483647 | | -2147483648..2147483647 | ||
| | | | ||
+ | |- | ||
+ | | int | ||
+ | | [[Integer]] | ||
+ | | 32-bit | ||
+ | | -2147483648..2147483647 | ||
+ | | | ||
+ | |- | ||
+ | | int | ||
+ | | [[Cardinal]] | ||
+ | | 32-bit | ||
+ | | 0..4294967295 | ||
+ | | Cardinal is alias for LongWord | ||
+ | |- | ||
+ | | int | ||
+ | | [[LongWord]] | ||
+ | | 32-bit | ||
+ | | 0..4294967295 | ||
+ | | | ||
|- | |- | ||
| long | | long | ||
− | | [[ | + | | [[Int64]] |
| 64-bit | | 64-bit | ||
| -9 223 372 036 854 775 808 .. 9 223 372 036 854 775 807 | | -9 223 372 036 854 775 808 .. 9 223 372 036 854 775 807 | ||
+ | | | ||
+ | |- | ||
+ | | long | ||
+ | | [[QWord]] | ||
+ | | 64-bit | ||
+ | | 0 .. 18 446 744 073 709 551 615 | ||
| | | | ||
|- | |- |
Revision as of 01:13, 30 March 2009
Java | Pascal | Additional comments |
---|---|---|
{ | Begin | |
} | End | |
= | := | Becomes |
== | = | Equal |
/ | / | Division (or sometimes div) |
% | Mod | Modulo operation |
! | Not | |
!= | <> | Not equal |
&& | And | |
|| | Or | |
^ | Xor | |
>> | Shr | bit shift right |
<< | Shl | bit shift left |
++ | Inc | |
-- | Dec | |
/* | { | Comment start |
/* | (* | Comment start |
*/ | } | Comment end |
*/ | *) | Comment end |
// | // | End of line comment (only one line comment) |
null | Nil | |
abstract | Abstract | |
break | Break | |
class TheClass { } | TheClass = Class End; | |
class TheClass<T> { } | Generic TheClass = Class<T> End; | Generics are classes only as of 2.2.2, likely to support more in the future |
continue | Continue | |
do while | Repeat Until Not | |
do while ! | Repeat Until | |
extends | SubClass = Class(BaseClass) | class SubClass extends BaseClass --> SubClass(BaseClass) |
final | Const | for constants, not uninheritables |
for ++ | For To Do | |
for -- | For Downto Do | |
if() | If Then | |
if() else | If Then Else | |
implements | SomeClass = Class(SomeInterface) | |
import | Uses | |
instanceof | Is | |
interface | TheInterface = Interface | |
native | StdCall | |
native | CDecl | |
new primitive_type[#]; | SetLength(ArrayVar, #); | |
new Class(); | InstanceVar := TheClass.Create; | |
package | Unit | |
private | Private | |
protected | Protected | |
public | Public | |
return | FunctionName | |
return | Result | |
static | Static | |
static | Class Function | |
static | Class Procedure | |
super | Inherited | Parent constructor call |
switch case break | Case Of End | |
switch case break default | Case Of Else End | |
synchronized | ||
this | Self | |
throw | Raise | |
throws | ||
transient | ||
try { } catch | Try except | |
try { } catch finally | Try Finally | |
void | Procedure | |
volatile | ||
while | While Do |
Java type | Pascal type | Size (bits) | Range | |
---|---|---|---|---|
byte | Shortint | 8-bit | -128 .. 127 | |
byte | Byte | 8-bit | 0 .. 255 | |
short | SmallInt | 16-bit | -32768 .. 32767 | |
short | Word | 16-bit | 0 .. 65535 | |
int | LongInt | 32-bit | -2147483648..2147483647 | |
int | Integer | 32-bit | -2147483648..2147483647 | |
int | Cardinal | 32-bit | 0..4294967295 | Cardinal is alias for LongWord |
int | LongWord | 32-bit | 0..4294967295 | |
long | Int64 | 64-bit | -9 223 372 036 854 775 808 .. 9 223 372 036 854 775 807 | |
long | QWord | 64-bit | 0 .. 18 446 744 073 709 551 615 | |
float | Single | 32-bit | 1.5E-45 .. 3.4E+38 | |
double | Double | 64-bit | 5.0E-324 .. 1.7E+308 | |
boolean | Boolean | False True | ||
char | WideChar | 16-bit |