~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/extra/univint/CFNumber.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{       CFNumber.h
 
2
        Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
 
3
}
 
4
{   Pascal Translation Updated:  Peter N Lewis, <peter@stairways.com.au>, September 2005 }
 
5
{
 
6
    Modified for use with Free Pascal
 
7
    Version 200
 
8
    Please report any bugs to <gpc@microbizz.nl>
 
9
}
 
10
 
 
11
{$mode macpas}
 
12
{$packenum 1}
 
13
{$macro on}
 
14
{$inline on}
 
15
{$CALLING MWPASCAL}
 
16
 
 
17
unit CFNumber;
 
18
interface
 
19
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
 
20
{$setc GAP_INTERFACES_VERSION := $0200}
 
21
 
 
22
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
 
23
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
 
24
{$endc}
 
25
 
 
26
{$ifc defined CPUPOWERPC and defined CPUI386}
 
27
        {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
 
28
{$endc}
 
29
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
 
30
        {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
 
31
{$endc}
 
32
 
 
33
{$ifc not defined __ppc__ and defined CPUPOWERPC}
 
34
        {$setc __ppc__ := 1}
 
35
{$elsec}
 
36
        {$setc __ppc__ := 0}
 
37
{$endc}
 
38
{$ifc not defined __i386__ and defined CPUI386}
 
39
        {$setc __i386__ := 1}
 
40
{$elsec}
 
41
        {$setc __i386__ := 0}
 
42
{$endc}
 
43
 
 
44
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
 
45
        {$error Conflicting definitions for __ppc__ and __i386__}
 
46
{$endc}
 
47
 
 
48
{$ifc defined __ppc__ and __ppc__}
 
49
        {$setc TARGET_CPU_PPC := TRUE}
 
50
        {$setc TARGET_CPU_X86 := FALSE}
 
51
{$elifc defined __i386__ and __i386__}
 
52
        {$setc TARGET_CPU_PPC := FALSE}
 
53
        {$setc TARGET_CPU_X86 := TRUE}
 
54
{$elsec}
 
55
        {$error Neither __ppc__ nor __i386__ is defined.}
 
56
{$endc}
 
57
{$setc TARGET_CPU_PPC_64 := FALSE}
 
58
 
 
59
{$ifc defined FPC_BIG_ENDIAN}
 
60
        {$setc TARGET_RT_BIG_ENDIAN := TRUE}
 
61
        {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
 
62
{$elifc defined FPC_LITTLE_ENDIAN}
 
63
        {$setc TARGET_RT_BIG_ENDIAN := FALSE}
 
64
        {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
 
65
{$elsec}
 
66
        {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
 
67
{$endc}
 
68
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
 
69
{$setc CALL_NOT_IN_CARBON := FALSE}
 
70
{$setc OLDROUTINENAMES := FALSE}
 
71
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
 
72
{$setc OPAQUE_UPP_TYPES := TRUE}
 
73
{$setc OTCARBONAPPLICATION := TRUE}
 
74
{$setc OTKERNEL := FALSE}
 
75
{$setc PM_USE_SESSION_APIS := TRUE}
 
76
{$setc TARGET_API_MAC_CARBON := TRUE}
 
77
{$setc TARGET_API_MAC_OS8 := FALSE}
 
78
{$setc TARGET_API_MAC_OSX := TRUE}
 
79
{$setc TARGET_CARBON := TRUE}
 
80
{$setc TARGET_CPU_68K := FALSE}
 
81
{$setc TARGET_CPU_MIPS := FALSE}
 
82
{$setc TARGET_CPU_SPARC := FALSE}
 
83
{$setc TARGET_OS_MAC := TRUE}
 
84
{$setc TARGET_OS_UNIX := FALSE}
 
85
{$setc TARGET_OS_WIN32 := FALSE}
 
86
{$setc TARGET_RT_MAC_68881 := FALSE}
 
87
{$setc TARGET_RT_MAC_CFM := FALSE}
 
88
{$setc TARGET_RT_MAC_MACHO := TRUE}
 
89
{$setc TYPED_FUNCTION_POINTERS := TRUE}
 
90
{$setc TYPE_BOOL := FALSE}
 
91
{$setc TYPE_EXTENDED := FALSE}
 
92
{$setc TYPE_LONGLONG := TRUE}
 
93
uses MacTypes,CFBase;
 
94
{$ALIGN POWER}
 
95
 
 
96
 
 
97
type
 
98
        CFBooleanRef = ^SInt32; { an opaque 32-bit type }
 
99
        CFBooleanRefPtr = ^CFBooleanRef;
 
100
 
 
101
var kCFBooleanTrue: CFBooleanRef; external name '_kCFBooleanTrue'; (* attribute const *)
 
102
var kCFBooleanFalse: CFBooleanRef; external name '_kCFBooleanFalse'; (* attribute const *)
 
103
 
 
104
function CFBooleanGetTypeID: CFTypeID; external name '_CFBooleanGetTypeID';
 
105
 
 
106
function CFBooleanGetValue( value: CFBooleanRef ): Boolean; external name '_CFBooleanGetValue';
 
107
 
 
108
type
 
109
        CFNumberType = SInt32;
 
110
const
 
111
                                                                                                                                {  Types from MacTypes.h  }
 
112
        kCFNumberSInt8Type = 1;
 
113
        kCFNumberSInt16Type = 2;
 
114
        kCFNumberSInt32Type = 3;
 
115
        kCFNumberSInt64Type = 4;
 
116
        kCFNumberFloat32Type = 5;
 
117
        kCFNumberFloat64Type = 6;                                                       {  64-bit IEEE 754  }
 
118
                                                                                                                                {  Basic C types  }
 
119
        kCFNumberCharType = 7;
 
120
        kCFNumberShortType = 8;
 
121
        kCFNumberIntType = 9;
 
122
        kCFNumberLongType = 10;
 
123
        kCFNumberLongLongType = 11;
 
124
        kCFNumberFloatType = 12;
 
125
        kCFNumberDoubleType = 13;                                                       {  Other  }
 
126
        kCFNumberCFIndexType = 14;
 
127
        kCFNumberMaxType = 14;
 
128
 
 
129
type
 
130
        CFNumberRef = ^SInt32; { an opaque 32-bit type }
 
131
        CFNumberRefPtr = ^CFNumberRef;
 
132
 
 
133
var kCFNumberPositiveInfinity: CFNumberRef; external name '_kCFNumberPositiveInfinity'; (* attribute const *)
 
134
var kCFNumberNegativeInfinity: CFNumberRef; external name '_kCFNumberNegativeInfinity'; (* attribute const *)
 
135
var kCFNumberNaN: CFNumberRef; external name '_kCFNumberNaN'; (* attribute const *)
 
136
 
 
137
function CFNumberGetTypeID: CFTypeID; external name '_CFNumberGetTypeID';
 
138
 
 
139
{
 
140
        Creates a CFNumber with the given value. The type of number pointed
 
141
        to by the valuePtr is specified by type. If type is a floating point
 
142
        type and the value represents one of the infinities or NaN, the
 
143
        well-defined CFNumber for that value is returned. If either of
 
144
        valuePtr or type is an invalid value, the result is undefined.
 
145
}
 
146
function CFNumberCreate( allocator: CFAllocatorRef; theType: CFNumberType; valuePtr: {const} UnivPtr ): CFNumberRef; external name '_CFNumberCreate';
 
147
 
 
148
{
 
149
        Returns the storage format of the CFNumber's value.  Note that
 
150
        this is not necessarily the type provided in CFNumberCreate().
 
151
}
 
152
function CFNumberGetType( number: CFNumberRef ): CFNumberType; external name '_CFNumberGetType';
 
153
 
 
154
{
 
155
        Returns the size in bytes of the type of the number.
 
156
}
 
157
function CFNumberGetByteSize( number: CFNumberRef ): CFIndex; external name '_CFNumberGetByteSize';
 
158
 
 
159
{
 
160
        Returns true if the type of the CFNumber's value is one of
 
161
        the defined floating point types.
 
162
}
 
163
function CFNumberIsFloatType( number: CFNumberRef ): Boolean; external name '_CFNumberIsFloatType';
 
164
 
 
165
{
 
166
        Copies the CFNumber's value into the space pointed to by
 
167
        valuePtr, as the specified type. If conversion needs to take
 
168
        place, the conversion rules follow human expectation and not
 
169
        C's promotion and truncation rules. If the conversion is
 
170
        lossy, or the value is out of range, false is returned. Best
 
171
        attempt at conversion will still be in *valuePtr.
 
172
}
 
173
function CFNumberGetValue( number: CFNumberRef; theType: CFNumberType; valuePtr: UnivPtr ): Boolean; external name '_CFNumberGetValue';
 
174
 
 
175
{
 
176
        Compares the two CFNumber instances. If conversion of the
 
177
        types of the values is needed, the conversion and comparison
 
178
        follow human expectations and not C's promotion and comparison
 
179
        rules. Negative zero compares less than positive zero.
 
180
        Positive infinity compares greater than everything except
 
181
        itself, to which it compares equal. Negative infinity compares
 
182
        less than everything except itself, to which it compares equal.
 
183
        Unlike standard practice, if both numbers are NaN, then they
 
184
        compare equal; if only one of the numbers is NaN, then the NaN
 
185
        compares greater than the other number if it is negative, and
 
186
        smaller than the other number if it is positive. (Note that in
 
187
        CFEqual() with two CFNumbers, if either or both of the numbers
 
188
        is NaN, true is returned.)
 
189
}
 
190
function CFNumberCompare( number: CFNumberRef; otherNumber: CFNumberRef; context: UnivPtr ): CFComparisonResult; external name '_CFNumberCompare';
 
191
 
 
192
 
 
193
end.