···11+/*
22+ This file is part of Darling.
33+44+ Copyright (C) 2025 Lubos Dolezel
55+66+ Darling is free software: you can redistribute it and/or modify
77+ it under the terms of the GNU General Public License as published by
88+ the Free Software Foundation, either version 3 of the License, or
99+ (at your option) any later version.
1010+1111+ Darling is distributed in the hope that it will be useful,
1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+ GNU General Public License for more details.
1515+1616+ You should have received a copy of the GNU General Public License
1717+ along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+#include <HIToolbox/CarbonEventsCore.h>
2121+2222+#include <stdlib.h>
2323+#include <stdio.h>
2424+2525+static int verbose = 0;
2626+2727+__attribute__((constructor))
2828+static void initme(void) {
2929+ verbose = getenv("STUB_VERBOSE") != NULL;
3030+}
3131+3232+OSStatus CallNextEventHandler(EventHandlerCallRef a, EventRef b)
3333+{
3434+ if (verbose) puts("STUB: CallNextEventHandler called");
3535+ return 0;
3636+}
3737+3838+OSStatus CreateEvent(CFAllocatorRef a, OSType b, UInt32 c, EventTime d, EventAttributes e, EventRef* f)
3939+{
4040+ if (verbose) puts("STUB: CreateEvent called");
4141+ return 0;
4242+}
4343+4444+OSType GetEventClass(EventRef a)
4545+{
4646+ if (verbose) puts("STUB: GetEventClass called");
4747+ return 0;
4848+}
4949+5050+UInt32 GetEventKind(EventRef a)
5151+{
5252+ if (verbose) puts("STUB: GetEventKind called");
5353+ return 0;
5454+}
5555+5656+OSStatus GetEventParameter(EventRef a, EventParamName b, EventParamType c, EventParamType* d, ByteCount e, ByteCount* f, void* g)
5757+{
5858+ if (verbose) puts("STUB: GetEventParameter called");
5959+ return 0;
6060+}
6161+6262+EventQueueRef GetMainEventQueue()
6363+{
6464+ if (verbose) puts("STUB: GetMainEventQueue called");
6565+ return 0;
6666+}
6767+6868+OSStatus InstallEventHandler(EventTargetRef a, EventHandlerUPP b, ItemCount c, const EventTypeSpec* d, void* e, EventHandlerRef* f)
6969+{
7070+ if (verbose) puts("STUB: InstallEventHandler called");
7171+ return 0;
7272+}
7373+7474+EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr a)
7575+{
7676+ if (verbose) puts("STUB: NewEventHandlerUPP called");
7777+ return (EventHandlerUPP)0;
7878+}
7979+8080+OSStatus PostEventToQueue(EventQueueRef a, EventRef b, EventPriority c)
8181+{
8282+ if (verbose) puts("STUB: PostEventToQueue called");
8383+ return 0;
8484+}
8585+8686+OSStatus ReceiveNextEvent(ItemCount a, const EventTypeSpec* b, EventTimeout c, Boolean d, EventRef* e)
8787+{
8888+ if (verbose) puts("STUB: ReceiveNextEvent called");
8989+ return 0;
9090+}
9191+9292+void ReleaseEvent(EventRef a)
9393+{
9494+ if (verbose) puts("STUB: ReleaseEvent called");
9595+}
9696+9797+OSStatus RemoveEventHandler(EventHandlerRef a)
9898+{
9999+ if (verbose) puts("STUB: RemoveEventHandler called");
100100+ return 0;
101101+}
102102+103103+OSStatus SendEventToEventTarget(EventRef a, EventTargetRef b)
104104+{
105105+ if (verbose) puts("STUB: SendEventToEventTarget called");
106106+ return 0;
107107+}
-78
src/frameworks/Carbon/src/Carbon.c
···4545 return 0;
4646}
47474848-OSStatus CallNextEventHandler(EventHandlerCallRef a, EventRef b)
4949-{
5050- if (verbose) puts("STUB: CallNextEventHandler called");
5151- return 0;
5252-}
5353-5454-OSStatus CreateEvent(CFAllocatorRef a, UInt32 b, UInt32 c, EventTime d, EventAttributes e, EventRef * f)
5555-{
5656- if (verbose) puts("STUB: CreateEvent called");
5757- return 0;
5858-}
5959-6048OSStatus CreateStandardAlert(AlertType a, CFStringRef b, CFStringRef c, const AlertStdCFStringAlertParamRec * d, DialogRef * e)
6149{
6250 if (verbose) puts("STUB: CreateStandardAlert called");
···8068 return (EventTargetRef)0;
8169}
82708383-UInt32 GetEventClass(EventRef a)
8484-{
8585- if (verbose) puts("STUB: GetEventClass called");
8686- return 0;
8787-}
8888-8971OSStatus GetEventDispatcherTarget()
9072{
9173 if (verbose) puts("STUB: GetEventDispatcherTarget called");
9274 return 0;
9375}
94769595-UInt32 GetEventKind(EventRef a)
9696-{
9797- if (verbose) puts("STUB: GetEventKind called");
9898- return 0;
9999-}
100100-101101-OSStatus GetEventParameter(EventRef a, EventParamName b, EventParamType c, EventParamType * d, UInt32 e, UInt32 * f, void * g)
102102-{
103103- if (verbose) puts("STUB: GetEventParameter called");
104104- return 0;
105105-}
106106-107107-OSStatus GetMainEventQueue()
108108-{
109109- if (verbose) puts("STUB: GetMainEventQueue called");
110110- return 0;
111111-}
112112-11377OSStatus GetScrapByName(CFStringRef a, OptionBits b, ScrapRef * c)
11478{
11579 if (verbose) puts("STUB: GetScrapByName called");
···140104141105}
142106143143-OSStatus InstallEventHandler(EventTargetRef a, EventHandlerUPP b, UInt32 c, const EventTypeSpec * d, void * e, EventHandlerRef * f)
144144-{
145145- if (verbose) puts("STUB: InstallEventHandler called");
146146- return 0;
147147-}
148148-149107OSErr NMInstall(NMRecPtr a)
150108{
151109 if (verbose) puts("STUB: NMInstall called");
152110 return 0;
153111}
154112155155-EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr a)
156156-{
157157- if (verbose) puts("STUB: NewEventHandlerUPP called");
158158- return (EventHandlerUPP)0;
159159-}
160160-161113OSErr NewTSMDocument(short a, InterfaceTypeList b, TSMDocumentID * c, long d)
162114{
163115 if (verbose) puts("STUB: NewTSMDocument called");
164116 return 0;
165117}
166118167167-OSStatus PostEventToQueue(EventQueueRef a, EventRef b, EventPriority c)
168168-{
169169- if (verbose) puts("STUB: PostEventToQueue called");
170170- return 0;
171171-}
172172-173119OSStatus ProcessHICommand(const HICommand * a)
174120{
175121 if (verbose) puts("STUB: ProcessHICommand called");
···182128 return 0;
183129}
184130185185-OSStatus ReceiveNextEvent(UInt32 a, const EventTypeSpec * b, EventTimeout c, Boolean d, EventRef * e)
186186-{
187187- if (verbose) puts("STUB: ReceiveNextEvent called");
188188- return 0;
189189-}
190190-191191-OSStatus ReleaseEvent(EventRef a)
192192-{
193193- if (verbose) puts("STUB: ReleaseEvent called");
194194- return 0;
195195-}
196196-197197-OSStatus RemoveEventHandler(EventHandlerRef a)
198198-{
199199- if (verbose) puts("STUB: RemoveEventHandler called");
200200- return 0;
201201-}
202202-203131void RunApplicationEventLoop(void)
204132{
205133 if (verbose) puts("STUB: RunApplicationEventLoop called");
···209137OSStatus RunStandardAlert(DialogRef a, ModalFilterUPP b, DialogItemIndex * c)
210138{
211139 if (verbose) puts("STUB: RunStandardAlert called");
212212- return 0;
213213-}
214214-215215-OSStatus SendEventToEventTarget(EventRef a, EventTargetRef b)
216216-{
217217- if (verbose) puts("STUB: SendEventToEventTarget called");
218140 return 0;
219141}
220142