~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to packages/extra/univint/AppleScript.pas

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
     File:       AppleScript.p
 
3
 
 
4
     Contains:   AppleScript Specific Interfaces.
 
5
 
 
6
     Version:    Technology: AppleScript 1.1
 
7
                 Release:    Universal Interfaces 3.4.2
 
8
 
 
9
     Copyright:  � 1992-2002 by Apple Computer, Inc., all rights reserved
 
10
 
 
11
     Bugs?:      For bug reports, consult the following page on
 
12
                 the World Wide Web:
 
13
 
 
14
                     http://www.freepascal.org/bugs.html
 
15
 
 
16
}
 
17
 
 
18
 
 
19
{
 
20
    Modified for use with Free Pascal
 
21
    Version 200
 
22
    Please report any bugs to <gpc@microbizz.nl>
 
23
}
 
24
 
 
25
{$mode macpas}
 
26
{$packenum 1}
 
27
{$macro on}
 
28
{$inline on}
 
29
{$CALLING MWPASCAL}
 
30
 
 
31
unit AppleScript;
 
32
interface
 
33
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
 
34
{$setc GAP_INTERFACES_VERSION := $0200}
 
35
 
 
36
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
 
37
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
 
38
{$endc}
 
39
 
 
40
{$ifc defined CPUPOWERPC and defined CPUI386}
 
41
        {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
 
42
{$endc}
 
43
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
 
44
        {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
 
45
{$endc}
 
46
 
 
47
{$ifc not defined __ppc__ and defined CPUPOWERPC}
 
48
        {$setc __ppc__ := 1}
 
49
{$elsec}
 
50
        {$setc __ppc__ := 0}
 
51
{$endc}
 
52
{$ifc not defined __i386__ and defined CPUI386}
 
53
        {$setc __i386__ := 1}
 
54
{$elsec}
 
55
        {$setc __i386__ := 0}
 
56
{$endc}
 
57
 
 
58
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
 
59
        {$error Conflicting definitions for __ppc__ and __i386__}
 
60
{$endc}
 
61
 
 
62
{$ifc defined __ppc__ and __ppc__}
 
63
        {$setc TARGET_CPU_PPC := TRUE}
 
64
        {$setc TARGET_CPU_X86 := FALSE}
 
65
{$elifc defined __i386__ and __i386__}
 
66
        {$setc TARGET_CPU_PPC := FALSE}
 
67
        {$setc TARGET_CPU_X86 := TRUE}
 
68
{$elsec}
 
69
        {$error Neither __ppc__ nor __i386__ is defined.}
 
70
{$endc}
 
71
{$setc TARGET_CPU_PPC_64 := FALSE}
 
72
 
 
73
{$ifc defined FPC_BIG_ENDIAN}
 
74
        {$setc TARGET_RT_BIG_ENDIAN := TRUE}
 
75
        {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
 
76
{$elifc defined FPC_LITTLE_ENDIAN}
 
77
        {$setc TARGET_RT_BIG_ENDIAN := FALSE}
 
78
        {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
 
79
{$elsec}
 
80
        {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
 
81
{$endc}
 
82
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
 
83
{$setc CALL_NOT_IN_CARBON := FALSE}
 
84
{$setc OLDROUTINENAMES := FALSE}
 
85
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
 
86
{$setc OPAQUE_UPP_TYPES := TRUE}
 
87
{$setc OTCARBONAPPLICATION := TRUE}
 
88
{$setc OTKERNEL := FALSE}
 
89
{$setc PM_USE_SESSION_APIS := TRUE}
 
90
{$setc TARGET_API_MAC_CARBON := TRUE}
 
91
{$setc TARGET_API_MAC_OS8 := FALSE}
 
92
{$setc TARGET_API_MAC_OSX := TRUE}
 
93
{$setc TARGET_CARBON := TRUE}
 
94
{$setc TARGET_CPU_68K := FALSE}
 
95
{$setc TARGET_CPU_MIPS := FALSE}
 
96
{$setc TARGET_CPU_SPARC := FALSE}
 
97
{$setc TARGET_OS_MAC := TRUE}
 
98
{$setc TARGET_OS_UNIX := FALSE}
 
99
{$setc TARGET_OS_WIN32 := FALSE}
 
100
{$setc TARGET_RT_MAC_68881 := FALSE}
 
101
{$setc TARGET_RT_MAC_CFM := FALSE}
 
102
{$setc TARGET_RT_MAC_MACHO := TRUE}
 
103
{$setc TYPED_FUNCTION_POINTERS := TRUE}
 
104
{$setc TYPE_BOOL := FALSE}
 
105
{$setc TYPE_EXTENDED := FALSE}
 
106
{$setc TYPE_LONGLONG := TRUE}
 
107
uses MacTypes,AEDataModel,Components,MacErrors,AppleEvents,OSA,TextEdit;
 
108
 
 
109
 
 
110
{$ALIGN MAC68K}
 
111
 
 
112
{*************************************************************************
 
113
    Types and Constants
 
114
*************************************************************************}
 
115
{
 
116
    The specific type for the AppleScript instance of the
 
117
    Open Scripting Architecture type.
 
118
}
 
119
 
 
120
const
 
121
        typeAppleScript                         = $61736372 (* 'ascr' *);
 
122
        kAppleScriptSubtype                     = $61736372 (* 'ascr' *);
 
123
        typeASStorage                           = $61736372 (* 'ascr' *);
 
124
 
 
125
        {       *************************************************************************
 
126
            Component Selectors
 
127
        *************************************************************************       }
 
128
 
 
129
        kASSelectInit                           = $1001;
 
130
        kASSelectSetSourceStyles        = $1002;
 
131
        kASSelectGetSourceStyles        = $1003;
 
132
        kASSelectGetSourceStyleNames = $1004;
 
133
 
 
134
 
 
135
        {       *************************************************************************
 
136
            OSAGetScriptInfo Selectors
 
137
        *************************************************************************       }
 
138
        kASHasOpenHandler                       = $68736F64 (* 'hsod' *);
 
139
 
 
140
        {       
 
141
                This selector is used to query a context as to whether it contains
 
142
                a handler for the kAEOpenDocuments event. This allows "applets" to be 
 
143
                distinguished from "droplets."  OSAGetScriptInfo returns false if
 
144
                there is no kAEOpenDocuments handler, and returns the error value 
 
145
                errOSAInvalidAccess if the input is not a context.
 
146
                }
 
147
        {       *************************************************************************
 
148
            Initialization
 
149
        *************************************************************************       }
 
150
        {
 
151
         *  ASInit()
 
152
         *  
 
153
         *  Availability:
 
154
         *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 
155
         *    CarbonLib:        in CarbonLib 1.0 and later
 
156
         *    Mac OS X:         in version 10.0 and later
 
157
                }
 
158
function ASInit(scriptingComponent: ComponentInstance; modeFlags: SInt32; minStackSize: SInt32; preferredStackSize: SInt32; maxStackSize: SInt32; minHeapSize: SInt32; preferredHeapSize: SInt32; maxHeapSize: SInt32): OSAError; external name '_ASInit';
 
159
{
 
160
        ComponentCallNow(kASSelectInit, 28);
 
161
        This call can be used to explicitly initialize AppleScript.  If it is
 
162
        not called, the a scripting size resource is looked for and used. If
 
163
        there is no scripting size resource, then the constants listed below
 
164
        are used.  If at any stage (the init call, the size resource, the 
 
165
        defaults) any of these parameters are zero, then parameters from the
 
166
        next stage are used.  ModeFlags are not currently used.
 
167
        Errors:
 
168
        errOSASystemError       initialization failed
 
169
    }
 
170
{
 
171
    These values will be used if ASInit is not called explicitly, or if any
 
172
    of ASInit's parameters are zero:
 
173
}
 
174
 
 
175
const
 
176
        kASDefaultMinStackSize          = 4096;
 
177
        kASDefaultPreferredStackSize = 16384;
 
178
        kASDefaultMaxStackSize          = 16384;
 
179
        kASDefaultMinHeapSize           = 4096;
 
180
        kASDefaultPreferredHeapSize     = 16384;
 
181
        kASDefaultMaxHeapSize           = 33554432;
 
182
 
 
183
        {       *************************************************************************
 
184
            Source Styles
 
185
        *************************************************************************       }
 
186
        {
 
187
         *  ASSetSourceStyles()
 
188
         *  
 
189
         *  Availability:
 
190
         *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 
191
         *    CarbonLib:        in CarbonLib 1.0 and later
 
192
         *    Mac OS X:         in version 10.0 and later
 
193
                }
 
194
function ASSetSourceStyles(scriptingComponent: ComponentInstance; sourceStyles: STHandle): OSAError; external name '_ASSetSourceStyles';
 
195
{
 
196
        ComponentCallNow(kASSelectSetSourceStyles, 4);
 
197
        Errors:
 
198
        errOSASystemError       operation failed
 
199
    }
 
200
{
 
201
 *  ASGetSourceStyles()
 
202
 *  
 
203
 *  Availability:
 
204
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 
205
 *    CarbonLib:        in CarbonLib 1.0 and later
 
206
 *    Mac OS X:         in version 10.0 and later
 
207
 }
 
208
function ASGetSourceStyles(scriptingComponent: ComponentInstance; var resultingSourceStyles: STHandle): OSAError; external name '_ASGetSourceStyles';
 
209
{
 
210
        ComponentCallNow(kASSelectGetSourceStyles, 4);
 
211
        Errors:
 
212
        errOSASystemError       operation failed
 
213
    }
 
214
{
 
215
 *  ASGetSourceStyleNames()
 
216
 *  
 
217
 *  Availability:
 
218
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 
219
 *    CarbonLib:        in CarbonLib 1.0 and later
 
220
 *    Mac OS X:         in version 10.0 and later
 
221
 }
 
222
function ASGetSourceStyleNames(scriptingComponent: ComponentInstance; modeFlags: SInt32; var resultingSourceStyleNamesList: AEDescList): OSAError; external name '_ASGetSourceStyleNames';
 
223
{
 
224
        ComponentCallNow(kASSelectGetSourceStyleNames, 8);
 
225
        This call returns an AEList of styled text descriptors the names of the
 
226
        source styles in the current dialect.  The order of the names corresponds
 
227
        to the order of the source style constants, below.  The style of each
 
228
        name is the same as the styles returned by ASGetSourceStyles.
 
229
        
 
230
        Errors:
 
231
        errOSASystemError       operation failed
 
232
    }
 
233
{
 
234
    Elements of STHandle correspond to following categories of tokens, and
 
235
    accessed through following index constants:
 
236
}
 
237
 
 
238
const
 
239
        kASSourceStyleUncompiledText = 0;
 
240
        kASSourceStyleNormalText        = 1;
 
241
        kASSourceStyleLanguageKeyword = 2;
 
242
        kASSourceStyleApplicationKeyword = 3;
 
243
        kASSourceStyleComment           = 4;
 
244
        kASSourceStyleLiteral           = 5;
 
245
        kASSourceStyleUserSymbol        = 6;
 
246
        kASSourceStyleObjectSpecifier = 7;
 
247
        kASNumberOfSourceStyles         = 8;
 
248
 
 
249
 
 
250
{$ALIGN MAC68K}
 
251
 
 
252
 
 
253
end.