File: CPS.h

package info (click to toggle)
squeak-vm 1%3A4.10.2.2614-4.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 13,284 kB
  • ctags: 15,344
  • sloc: ansic: 75,096; cs: 11,191; objc: 5,494; sh: 3,170; asm: 1,533; cpp: 449; pascal: 372; makefile: 366; awk: 103
file content (277 lines) | stat: -rw-r--r-- 5,407 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
// CPS.h --  generously provided by Bob Ippolito (bob@redivi.com)

#pragma once

#include <Carbon/Carbon.h>


#ifdef __cplusplus
extern "C" {
#endif

#if PRAGMA_STRUCT_ALIGN
    #pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
    #pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
    #pragma pack(2)
#endif


struct CPSProcessSerNum
{
	UInt32		lo;
	UInt32		hi;
};

typedef struct CPSProcessSerNum	CPSProcessSerNum;

enum
{
	kCPSNoProcess		=	0,
	kCPSSystemProcess	=	1,
	kCPSCurrentProcess	=	2
};


enum
{
	bfCPSIntraProcessSwitch =	1,
	bfCPSDeathBySignal	=	2
};

typedef UInt16	CPSEventFlags;

enum
{
	kCPSBlueApp	=	0,
	kCPSBlueBox	=	1,
	kCPSCarbonApp	=	2,
	kCPSYellowApp	=	3,
	kCPSUnknownApp	=	4
};

typedef UInt32	CPSAppFlavour;


enum
{
	kCPSBGOnlyAttr		=	1024,
	kCPSUIElementAttr	=	65536,
	kCPSHiddenAttr		=	131072,
	kCPSNoConnectAttr	=	262144,
	kCPSFullScreenAttr	=	524288,
	kCPSClassicReqAttr	=	1048576,
	kCPSNativeReqAttr	=	2097152
};

typedef UInt32	CPSProcAttributes;

struct CPSProcessInfoRec
{
	CPSProcessSerNum 	Parent;
	UInt64			LaunchDate;
	CPSAppFlavour		Flavour;
	CPSProcAttributes	Attributes;
	UInt32			ExecFileType;
	UInt32			ExecFileCreator;
	UInt32			UnixPID;
};

typedef struct CPSProcessInfoRec	CPSProcessInfoRec;

enum
{
	kCPSNotifyChildDeath	=	1,
	kCPSNotifyNewFront	=	2,
	kCPSNotifyAppBirth	=	4,
	kCPSNotifyAppDeath	=	8,
	kCPSNotifyLaunch	=	9,
	kCPSNotifyServiceReq	=	16,
	kCPSNotifyAppHidden	=	32,
	kCPSNotifyAppRevealed	=	64,
	kCPSNotifyFGEnabled	=	128,
	kCPSNotifyLaunchStart	=	256,
	kCPSNotifyAppReady	=	512,
	kCPSNotifyLaunchFail	=	1024,
	kCPSNotifyAppDeathExt	=	2048,
	kCPSNotifyLostKeyFocus	=	4096
};

typedef UInt32	CPSNotificationCodes;

enum
{
	bfCPSLaunchInhibitDaemon	=	128,
	bfCPSLaunchDontSwitch		=	512,
	bfCPSLaunchNoProcAttr		=	2048,
	bfCPSLaunchAsync		=	65536,
	bfCPSLaunchStartClassic		=	131072,
	bfCPSLaunchInClassic		=	262144,
	bfCPSLaunchInstance		=	524288,
	bfCPSLaunchAndHide		=	1048576,
	bfCPSLaunchAndHideOthers	=	2097152
};

typedef UInt32	CPSLaunchOptions;
typedef	UInt8	*CPSLaunchRefcon;
typedef	UInt8	*CPSLaunchData;

enum
{
	bfCPSExtLaunchWithData	=	2,
	bfCPSExtLaunchByParent	=	4,
	bfCPSExtLaunchAsUidGid	=	8
};

typedef UInt32	CPSLaunchPBFields;

struct CPSLaunchPB
{
	CPSLaunchPBFields	Contents;
	CPSLaunchData		pData;
	UInt32			DataLen;
	UInt32			DataTag;
	UInt32			RefCon;
	CPSProcessSerNum	Parent;
	UInt32			ChildUID;
	UInt32			ChildGID;
};

typedef struct CPSLaunchPB	CPSLaunchPB;


enum
{
	bfCPSKillHard		=	1,
	bfCPSKillAllClassicApps	=	2
};

typedef UInt32	CPSKillOptions;


enum
{
	kCPSLaunchService	=	0,
	kCPSKillService		=	1,
	kCPSHideService		=	2,
	kCPSShowService		=	3,
	kCPSPrivService		=	4,
	kCPSExtDeathNoteService	=	5
};

typedef UInt32	CPSServiceReqType;


struct CPSLaunchRequest
{
	CPSProcessSerNum	TargetPSN;
	CPSLaunchOptions 	Options;
	CPSProcAttributes 	ProcAttributes;
	UInt8			*pUTF8TargetPath;
	UInt32			PathLen;
};

typedef struct CPSLaunchRequest	CPSLaunchRequest;


struct CPSKillRequest
{
	CPSProcessSerNum	TargetPSN;
	CPSKillOptions		Options;
};

typedef struct CPSKillRequest	CPSKillRequest;


struct CPSHideRequest
{
	CPSProcessSerNum 	TargetPSN;
};

typedef struct CPSHideRequest	CPSHideRequest;


struct CPSShowRequest
{
	CPSProcessSerNum 	TargetPSN;
};

typedef struct CPSShowRequest	CPSShowRequest;


struct CPSExtDeathNotice
{
	CPSProcessSerNum 	DeadPSN;
	UInt32			Flags;
	UInt8			*pUTF8AppPath;
	UInt32			PathLen;
};

typedef struct CPSExtDeathNotice	CPSExtDeathNotice;


union CPSRequestDetails
{
	CPSLaunchRequest 	LaunchReq;
	CPSKillRequest 		KillReq;
	CPSHideRequest 		HideReq;
	CPSShowRequest 		ShowReq;
	CPSExtDeathNotice 	DeathNotice;
};

typedef union CPSRequestDetails	CPSRequestDetails;


struct CPSServiceRequest
{
	CPSServiceReqType 	Type;
	SInt32			ID;
	CPSRequestDetails 	Details;
};

typedef struct CPSServiceRequest	CPSServiceRequest;


enum
{
	kCPSProcessInterruptKey	=	0,
	kCPSAppSwitchFwdKey	=	1,
	kCPSAppSwitchBackKey	=	2,
	kCPSSessionInterruptKey	=	3,
	kCPSScreenSaverKey	=	4,
	kCPSDiskEjectKey	=	5,
	kCPSSpecialKeyCount	=	6
};

typedef SInt32	CPSSpecialKeyID;

extern Boolean	CPSEqualProcess( CPSProcessSerNum *psn1, CPSProcessSerNum *psn2);
extern OSErr	CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr	CPSGetFrontProcess( CPSProcessSerNum *psn);
extern OSErr	CPSGetNextProcess( CPSProcessSerNum *psn);
extern OSErr	CPSGetNextToFrontProcess( CPSProcessSerNum *psn);
extern OSErr	CPSGetProcessInfo( CPSProcessSerNum *psn, CPSProcessInfoRec *info, char *path, int maxPathLen, int *len, char *name, int maxNameLen);
extern OSErr	CPSPostHideMostReq( CPSProcessSerNum *psn);
extern OSErr	CPSPostHideReq( CPSProcessSerNum *psn);
extern OSErr	CPSPostKillRequest( CPSProcessSerNum *psn, CPSKillOptions options);
extern OSErr	CPSPostShowAllReq( CPSProcessSerNum *psn);
extern OSErr	CPSPostShowReq( CPSProcessSerNum *psn);
extern OSErr	CPSSetFrontProcess( CPSProcessSerNum *psn);
extern OSErr	CPSReleaseKeyFocus( CPSProcessSerNum *psn);
extern OSErr	CPSStealKeyFocus( CPSProcessSerNum *psn);
extern OSErr 	CPSSetProcessName ( CPSProcessSerNum *psn, char *processname);
extern OSErr 	CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);


#if PRAGMA_STRUCT_ALIGN
    #pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
    #pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
    #pragma pack()
#endif

#ifdef __cplusplus
}
#endif