Difference between revisions of "ReNamer:Pascal Script:Types"
Jump to navigation
Jump to search
(Created page with '{{Template:Expand}} {| align="right" | __TOC__ |} == Integer types == {| class="wikitable" ! Type ! Size ! Range |- | Byte | 1 byte | align="center" | 0 .. 255 |- | ShortInt | ...') |
(→String types: Default encoding and type conversions) |
||
(19 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{Go|up=ReNamer:Pascal Script|next=ReNamer:Pascal Script:Functions}} |
− | + | This page lists and explains all supported types in [[ReNamer:Pascal Script|Pascal Script]] used within ReNamer. | |
− | |||
− | |||
== Integer types == | == Integer types == | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
! Type | ! Type | ||
! Size | ! Size | ||
− | ! | + | ! Lowest Value |
+ | ! Highest Value | ||
|- | |- | ||
− | | Byte | + | | '''Byte''' |
| 1 byte | | 1 byte | ||
− | | align="center" | 0 | + | | align="center" | 0 |
+ | | align="center" | 255 | ||
|- | |- | ||
− | | ShortInt | + | | '''ShortInt''' |
| 1 byte | | 1 byte | ||
− | | align="center" | -128 | + | | align="center" | -128 |
+ | | align="center" | 127 | ||
|- | |- | ||
− | | Word | + | | '''Word''' |
| 2 bytes | | 2 bytes | ||
− | | align="center" | 0 | + | | align="center" | 0 |
+ | | align="center" | 65,535 | ||
|- | |- | ||
− | | SmallInt | + | | '''SmallInt''' |
| 2 bytes | | 2 bytes | ||
− | | align="center" | - | + | | align="center" | -32,768 |
+ | | align="center" | 32,767 | ||
|- | |- | ||
− | | Cardinal | + | | '''Cardinal''' |
| 4 bytes | | 4 bytes | ||
− | | align="center" | 0 | + | | align="center" | 0 |
+ | | align="center" | 4,294,967,295 | ||
|- | |- | ||
− | | Integer | + | | '''Integer''' |
| 4 bytes | | 4 bytes | ||
− | | align="center" | - | + | | align="center" | -2,147,483,648 |
+ | | align="center" | 2,147,483,647 | ||
+ | |- | ||
+ | | '''Int64''' | ||
+ | | 8 bytes | ||
+ | | align="center" | -9,223,372,036,854,775,808 | ||
+ | | align="center" | 9,223,372,036,854,775,807 | ||
|} | |} | ||
== Floating point types == | == Floating point types == | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
! Type | ! Type | ||
Line 42: | Line 54: | ||
! Range | ! Range | ||
|- | |- | ||
− | | Single | + | | '''Single''' |
− | | | + | | 4 bytes |
− | | 1. | + | | align="center" | 1.5 x 10<sup>-45</sup> .. 3.4 x 10<sup>38</sup> |
|- | |- | ||
− | | Double | + | | '''Double''' |
− | | | + | | 8 bytes |
− | | | + | | align="center" | 5.0 x 10<sup>-324</sup> .. 1.7 x 10<sup>308</sup> |
|- | |- | ||
− | | Extended | + | | '''Extended''' |
− | | | + | | 10 bytes |
− | | 3. | + | | align="center" | 3.6 x 10<sup>-4951</sup> .. 1.1 x 10<sup>4932</sup> |
|} | |} | ||
== String types == | == String types == | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
! Type | ! Type | ||
! Description | ! Description | ||
|- | |- | ||
− | | Char | + | | '''Char''' |
− | | Stores a single | + | | Stores a single 8-bit character. |
+ | |- | ||
+ | | '''String''' | ||
+ | | Holds a sequence of 8-bit characters. Commonly used for ANSI or UTF-8 encoded text. | ||
+ | |- | ||
+ | | '''AnsiChar''' | ||
+ | | Alias for ''Char'' type. | ||
+ | |- | ||
+ | | '''AnsiString''' | ||
+ | | Alias for ''String'' type. | ||
+ | |- | ||
+ | | '''WideChar''' | ||
+ | | Stores a single 16-bit character. | ||
|- | |- | ||
− | | | + | | '''WideString''' |
− | | Holds a sequence of | + | | Holds a sequence of 16-bit characters. Commonly used for UCS-2 or UTF-16 encoded text. |
|- | |- | ||
− | | | + | | '''UnicodeChar''' |
− | | | + | | Alias for ''WideChar'' type. |
+ | |- | ||
+ | | '''UnicodeString''' | ||
+ | | Alias for ''WideString'' type. | ||
|} | |} | ||
− | == | + | The default encoding for String/AnsiString type and the conversion process to/from UnicodeString/WideString type differ between versions of ReNamer. |
+ | |||
+ | {| class="wikitable" | ||
+ | ! ReNamer version | ||
+ | ! Default encoding for AnsiString type | ||
+ | ! Conversion between WideString and AnsiString types | ||
+ | |- | ||
+ | | 7.0 and later | ||
+ | | UTF8 | ||
+ | | Automatic, on assignment | ||
+ | |- | ||
+ | | Prior to 7.0 | ||
+ | | Active [https://en.wikipedia.org/wiki/Windows_code_page system code page] | ||
+ | | Manual, using conversion functions | ||
+ | |} | ||
+ | |||
+ | The [[Unicode]] article highlights the differences between various encodings. | ||
+ | |||
+ | == Mixed types == | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 76: | Line 122: | ||
! Description | ! Description | ||
|- | |- | ||
− | | Boolean | + | | '''Boolean''' |
− | | | + | | Provides an enumeration of the logical '''True''' and '''False''' values. |
|- | |- | ||
− | | Array | + | | '''Array''' |
− | | | + | | Single and multi dimensional indexable sequences of data. |
|- | |- | ||
− | | Record | + | | '''Record''' |
− | | | + | | Provides means of collecting together a set of different data types into one named structure. |
|- | |- | ||
− | | | + | | '''Variant''' |
− | | | + | | Provides a flexible general purpose data type. |
|- | |- | ||
− | | | + | | '''PChar''' |
− | | | + | | Pointer to a ''Char'' value, and can also be used to point to characters within a string. |
|} | |} | ||
+ | |||
+ | == Extra types == | ||
+ | |||
+ | Several extra types have been defined to simplify the use of some functions. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Type | ||
+ | ! Declared as | ||
+ | ! Description | ||
+ | |- | ||
+ | | '''TDateTime''' | ||
+ | | Double | ||
+ | | Represents a date and time. | ||
+ | |- | ||
+ | | <strike>'''TStringsArray'''</strike> | ||
+ | | Array of WideString | ||
+ | | Indexed list of ''WideString'' values.<br/>''Deprecated in v5.74.4 Beta. Please use TWideStringArray instead.'' | ||
+ | |- | ||
+ | | '''TWideStringArray''' | ||
+ | | Array of WideString | ||
+ | | Indexed list of ''WideString'' values.<br/>''Added in v5.74.4 Beta. Replaces ambiguous TStringsArray type.'' | ||
+ | |- | ||
+ | | '''TAnsiStringArray''' | ||
+ | | Array of AnsiString | ||
+ | | Indexed list of ''AnsiString'' values.<br/>''Added in v5.74.4 Beta.'' | ||
+ | |- | ||
+ | | '''TIntegerArray''' | ||
+ | | Array of Integer | ||
+ | | Indexed list of ''Integer'' values.<br/>''Added in v7.3.0.4 Beta.'' | ||
+ | |} | ||
+ | |||
+ | == Enumerations and Sets == | ||
+ | |||
+ | An enumeration is simply a fixed range of named values. | ||
+ | |||
+ | For example, the fundamental ''Boolean'' data type can be considered as an enumeration consisting of two values: ''True'' and ''False''. | ||
+ | |||
+ | A variable of an enumeration type can be assigned a single value from the enumeration. | ||
+ | |||
+ | <pre> | ||
+ | type | ||
+ | TDay = (Mon, Tue, Wed, Thu, Fri, Sat, Sun); | ||
+ | var | ||
+ | Day: TDay; | ||
+ | begin | ||
+ | Day := Mon; | ||
+ | if Day <> Tue then | ||
+ | Day := Wed; | ||
+ | end. | ||
+ | </pre> | ||
+ | |||
+ | Sets allow you to defined variables which can hold multiple values out of the enumeration. | ||
+ | |||
+ | <pre> | ||
+ | type | ||
+ | TDay = (Mon, Tue, Wed, Thu, Fri, Sat, Sun); | ||
+ | TDays = set of TDay; | ||
+ | var | ||
+ | Days: TDays; | ||
+ | begin | ||
+ | Days := [Mon, Tue, Wed]; | ||
+ | if Sun in Days then | ||
+ | Days := Days - [Sun]; | ||
+ | end. | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | |||
+ | [[Category:ReNamer]] |
Latest revision as of 12:41, 23 December 2022
This page lists and explains all supported types in Pascal Script used within ReNamer.
Integer types
Type | Size | Lowest Value | Highest Value |
---|---|---|---|
Byte | 1 byte | 0 | 255 |
ShortInt | 1 byte | -128 | 127 |
Word | 2 bytes | 0 | 65,535 |
SmallInt | 2 bytes | -32,768 | 32,767 |
Cardinal | 4 bytes | 0 | 4,294,967,295 |
Integer | 4 bytes | -2,147,483,648 | 2,147,483,647 |
Int64 | 8 bytes | -9,223,372,036,854,775,808 | 9,223,372,036,854,775,807 |
Floating point types
Type | Size | Range |
---|---|---|
Single | 4 bytes | 1.5 x 10-45 .. 3.4 x 1038 |
Double | 8 bytes | 5.0 x 10-324 .. 1.7 x 10308 |
Extended | 10 bytes | 3.6 x 10-4951 .. 1.1 x 104932 |
String types
Type | Description |
---|---|
Char | Stores a single 8-bit character. |
String | Holds a sequence of 8-bit characters. Commonly used for ANSI or UTF-8 encoded text. |
AnsiChar | Alias for Char type. |
AnsiString | Alias for String type. |
WideChar | Stores a single 16-bit character. |
WideString | Holds a sequence of 16-bit characters. Commonly used for UCS-2 or UTF-16 encoded text. |
UnicodeChar | Alias for WideChar type. |
UnicodeString | Alias for WideString type. |
The default encoding for String/AnsiString type and the conversion process to/from UnicodeString/WideString type differ between versions of ReNamer.
ReNamer version | Default encoding for AnsiString type | Conversion between WideString and AnsiString types |
---|---|---|
7.0 and later | UTF8 | Automatic, on assignment |
Prior to 7.0 | Active system code page | Manual, using conversion functions |
The Unicode article highlights the differences between various encodings.
Mixed types
Type | Description |
---|---|
Boolean | Provides an enumeration of the logical True and False values. |
Array | Single and multi dimensional indexable sequences of data. |
Record | Provides means of collecting together a set of different data types into one named structure. |
Variant | Provides a flexible general purpose data type. |
PChar | Pointer to a Char value, and can also be used to point to characters within a string. |
Extra types
Several extra types have been defined to simplify the use of some functions.
Type | Declared as | Description |
---|---|---|
TDateTime | Double | Represents a date and time. |
Array of WideString | Indexed list of WideString values. Deprecated in v5.74.4 Beta. Please use TWideStringArray instead. | |
TWideStringArray | Array of WideString | Indexed list of WideString values. Added in v5.74.4 Beta. Replaces ambiguous TStringsArray type. |
TAnsiStringArray | Array of AnsiString | Indexed list of AnsiString values. Added in v5.74.4 Beta. |
TIntegerArray | Array of Integer | Indexed list of Integer values. Added in v7.3.0.4 Beta. |
Enumerations and Sets
An enumeration is simply a fixed range of named values.
For example, the fundamental Boolean data type can be considered as an enumeration consisting of two values: True and False.
A variable of an enumeration type can be assigned a single value from the enumeration.
type TDay = (Mon, Tue, Wed, Thu, Fri, Sat, Sun); var Day: TDay; begin Day := Mon; if Day <> Tue then Day := Wed; end.
Sets allow you to defined variables which can hold multiple values out of the enumeration.
type TDay = (Mon, Tue, Wed, Thu, Fri, Sat, Sun); TDays = set of TDay; var Days: TDays; begin Days := [Mon, Tue, Wed]; if Sun in Days then Days := Days - [Sun]; end.