this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #523 from jamesu/torque_carbon_stubs

Add more basic Carbon, ApplicationServices, CoreServices stubs

authored by

Andrew Hyatt and committed by
GitHub
5fd499e6 1cc9ae5d

+893 -20
+315
src/ApplicationServices/ApplicationServices.c
··· 11 11 /* Not const for some reason */ 12 12 CFStringRef kAXTrustedCheckOptionPrompt = CFSTR("AXTrustedCheckOptionPrompt"); 13 13 14 + #include <CoreFoundation/CoreFoundation.h> 15 + #include <CoreGraphics/CGDirectDisplay.h> 16 + #include <CoreGraphics/CGGeometry.h> 17 + #include "MacTypes.h" 18 + 19 + static int verbose = 0; 20 + 21 + __attribute__((constructor)) 22 + static void initme(void) { 23 + verbose = getenv("STUB_VERBOSE") != NULL; 24 + } 25 + 26 + // Types we need for the following stubs... 27 + 28 + typedef uint32_t ATSFontRef; 29 + typedef OptionBits ATSOptionFlags; 30 + typedef void* ATSUTextLayout; 31 + typedef void* ATSUStyle; 32 + typedef uint32_t ATSUAttributeTag; 33 + typedef Fixed ATSUTextMeasurement; 34 + typedef void* ATSUAttributeValuePtr; 35 + 36 + typedef float CGGammaValue; 37 + typedef int32_t CGWindowLevel; 38 + 39 + typedef uint32_t UniCharArrayOffset; 40 + typedef char* ConstUniCharArrayPtr; 41 + 42 + typedef void* ATSFontMetrics; 43 + typedef void** GDHandle; 44 + 45 + typedef uint32_t FMFont; 46 + 47 + 48 + // CGDirect Stubs - should probably be in cocoatron 49 + 50 + CGError CGDisplayShowCursor(CGDirectDisplayID display) 51 + { 52 + if (verbose) puts("STUB: CGDisplayShowCursor called"); 53 + return (CGError)0; 54 + } 55 + 56 + boolean_t CGCursorIsVisible(void) 57 + { 58 + if (verbose) puts("STUB: CGCursorIsVisible called"); 59 + return false; 60 + } 61 + 62 + CFArrayRef CGDisplayAvailableModes(CGDirectDisplayID a) 63 + { 64 + // Usual keys: Width, Height, Mode, BitsPerPixel, SamplesPerPixel, RefreshRate, UsableForDesktopGUI, IOFlags, kCGDisplayBytesPerRow, IODisplayModeID 65 + 66 + if (verbose) puts("STUB: CGDisplayAvailableModes called"); 67 + 68 + CFTypeRef arrayValues[ 1 ]; 69 + 70 + CFTypeRef dummyDisplayKeys[ 3 ]; 71 + CFTypeRef dummyDisplayValues[ 3 ]; 72 + 73 + dummyDisplayKeys[0] = CFSTR("Width"); 74 + dummyDisplayKeys[1] = CFSTR("Height"); 75 + dummyDisplayKeys[2] = CFSTR("BitsPerPixel"); 76 + 77 + // TODO: put some real values here 78 + int val = 640; 79 + dummyDisplayValues[0] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &val); 80 + val = 480; 81 + dummyDisplayValues[1] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &val); 82 + val = 32; 83 + dummyDisplayValues[2] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &val); 84 + 85 + CFDictionaryRef dictionary = CFDictionaryCreate( 86 + kCFAllocatorDefault, 87 + (const void **)&dummyDisplayKeys, 88 + (const void **)&dummyDisplayValues, 89 + 3, 90 + &kCFTypeDictionaryKeyCallBacks, 91 + &kCFTypeDictionaryValueCallBacks 92 + ); 93 + 94 + arrayValues[0] = dictionary; 95 + 96 + CFArrayRef ret = CFArrayCreate(kCFAllocatorDefault, 97 + &arrayValues, 98 + 1, 99 + &kCFTypeArrayCallBacks); 100 + 101 + CFRelease(dummyDisplayValues[0]); 102 + CFRelease(dummyDisplayValues[1]); 103 + CFRelease(dummyDisplayValues[2]); 104 + 105 + // TODO: autorelease ret? 106 + return ret; 107 + } 108 + 109 + CGRect CGDisplayBounds(CGDirectDisplayID a) 110 + { 111 + if (verbose) puts("STUB: CGDisplayBounds called"); 112 + return CGRectMake(0,0,640,480); 113 + } 114 + 115 + CGError CGDisplayHideCursor(CGDirectDisplayID a) 116 + { 117 + if (verbose) puts("STUB: CGDisplayHideCursor called"); 118 + return (CGError)0; 119 + } 120 + 121 + CGOpenGLDisplayMask CGDisplayIDToOpenGLDisplayMask(CGDirectDisplayID a) 122 + { 123 + if (verbose) puts("STUB: CGDisplayIDToOpenGLDisplayMask called"); 124 + return 0; 125 + } 126 + 127 + CGError CGDisplayMoveCursorToPoint(CGDirectDisplayID a, CGPoint b) 128 + { 129 + if (verbose) puts("STUB: CGDisplayMoveCursorToPoint called"); 130 + return (CGError)0; 131 + } 132 + 133 + void CGDisplayRestoreColorSyncSettings(void) 134 + { 135 + if (verbose) puts("STUB: CGDisplayRestoreColorSyncSettings called"); 136 + 137 + } 138 + 139 + CGError CGGetActiveDisplayList(uint32_t a, CGDirectDisplayID *b, uint32_t *c) 140 + { 141 + if (verbose) puts("STUB: CGGetActiveDisplayList called"); 142 + return (CGError)0; 143 + } 144 + 145 + CGError CGGetDisplayTransferByFormula(CGDirectDisplayID a, CGGammaValue *b, CGGammaValue *c, CGGammaValue *d, CGGammaValue *e, CGGammaValue *f, CGGammaValue *g, CGGammaValue *h, CGGammaValue *i, CGGammaValue *j) 146 + { 147 + if (verbose) puts("STUB: CGGetDisplayTransferByFormula called"); 148 + return (CGError)0; 149 + } 150 + 151 + CGError CGGetDisplayTransferByTable(CGDirectDisplayID a, uint32_t b, CGGammaValue *c, CGGammaValue *d, CGGammaValue *e, uint32_t *f) 152 + { 153 + if (verbose) puts("STUB: CGGetDisplayTransferByTable called"); 154 + return (CGError)0; 155 + } 156 + 157 + void CGGetLastMouseDelta(int32_t *a, int32_t *b) 158 + { 159 + if (verbose) puts("STUB: CGGetLastMouseDelta called"); 160 + 161 + } 162 + 163 + CGDirectDisplayID CGMainDisplayID(void) 164 + { 165 + if (verbose) puts("STUB: CGMainDisplayID called"); 166 + return (CGDirectDisplayID)0; 167 + } 168 + 169 + CGError CGSetDisplayTransferByFormula(CGDirectDisplayID a, CGGammaValue b, CGGammaValue c, CGGammaValue d, CGGammaValue e, CGGammaValue f, CGGammaValue g, CGGammaValue h, CGGammaValue i, CGGammaValue j) 170 + { 171 + if (verbose) puts("STUB: CGSetDisplayTransferByFormula called"); 172 + return (CGError)0; 173 + } 174 + 175 + CGError CGSetDisplayTransferByTable(CGDirectDisplayID a, uint32_t b, const CGGammaValue *c, const CGGammaValue *d, const CGGammaValue *e) 176 + { 177 + if (verbose) puts("STUB: CGSetDisplayTransferByTable called"); 178 + return (CGError)0; 179 + } 180 + 181 + CGError CGSetLocalEventsSuppressionInterval(CFTimeInterval a) 182 + { 183 + if (verbose) puts("STUB: CGSetLocalEventsSuppressionInterval called"); 184 + return (CGError)0; 185 + } 186 + 187 + CGWindowLevel CGShieldingWindowLevel(void) 188 + { 189 + if (verbose) puts("STUB: CGShieldingWindowLevel called"); 190 + return 0; 191 + } 192 + 193 + // End CGDirect Stubs 194 + 195 + 196 + // ATS Stubs 197 + 198 + ATSFontRef ATSFontFindFromName(CFStringRef a, ATSOptionFlags b) 199 + { 200 + if (verbose) puts("STUB: ATSFontFindFromName called"); 201 + return 0; 202 + } 203 + 204 + OSStatus ATSFontGetHorizontalMetrics(ATSFontRef a, ATSOptionFlags b, ATSFontMetrics *c) 205 + { 206 + if (verbose) puts("STUB: ATSFontGetHorizontalMetrics called"); 207 + return 0; 208 + } 209 + 210 + OSStatus ATSUCreateStyle(ATSUStyle *a) 211 + { 212 + if (verbose) puts("STUB: ATSUCreateStyle called"); 213 + return 0; 214 + } 215 + 216 + OSStatus ATSUCreateTextLayout(ATSUTextLayout *a) 217 + { 218 + if (verbose) puts("STUB: ATSUCreateTextLayout called"); 219 + return 0; 220 + } 221 + 222 + OSStatus ATSUDisposeStyle(ATSUStyle *a) 223 + { 224 + if (verbose) puts("STUB: ATSUDisposeStyle called"); 225 + return 0; 226 + } 227 + 228 + OSStatus ATSUDisposeTextLayout(ATSUTextLayout *a) 229 + { 230 + if (verbose) puts("STUB: ATSUDisposeTextLayout called"); 231 + return 0; 232 + } 233 + 234 + OSStatus ATSUDrawText(ATSUTextLayout a, UniCharArrayOffset b, UniCharCount c, ATSUTextMeasurement d, ATSUTextMeasurement e) 235 + { 236 + if (verbose) puts("STUB: ATSUDrawText called"); 237 + return 0; 238 + } 239 + 240 + OSStatus ATSUGetUnjustifiedBounds(ATSUTextLayout a , UniCharArrayOffset b , UniCharCount c , ATSUTextMeasurement * d , ATSUTextMeasurement * e , ATSUTextMeasurement * f , ATSUTextMeasurement * g) 241 + { 242 + if (verbose) puts("STUB: ATSUGetUnjustifiedBounds called"); 243 + return 0; 244 + } 245 + 246 + OSStatus ATSUMeasureTextImage(ATSUTextLayout a, UniCharArrayOffset b, UniCharCount c, ATSUTextMeasurement d, ATSUTextMeasurement e, Rect *f) 247 + { 248 + if (verbose) puts("STUB: ATSUMeasureTextImage called"); 249 + return 0; 250 + } 251 + 252 + OSStatus ATSUSetAttributes(ATSUStyle a, ItemCount b, const ATSUAttributeTag *c, const ByteCount *d, const ATSUAttributeValuePtr *e) 253 + { 254 + if (verbose) puts("STUB: ATSUSetAttributes called"); 255 + return 0; 256 + } 257 + 258 + OSStatus ATSUSetLayoutControls(ATSUTextLayout a, ItemCount b, const ATSUAttributeTag *c, const ByteCount *d, const ATSUAttributeValuePtr *e) 259 + { 260 + if (verbose) puts("STUB: ATSUSetLayoutControls called"); 261 + return 0; 262 + } 263 + 264 + OSStatus ATSUSetRunStyle(ATSUTextLayout a, ATSUStyle b, UniCharArrayOffset c, UniCharCount d) 265 + { 266 + if (verbose) puts("STUB: ATSUSetRunStyle called"); 267 + return 0; 268 + } 269 + 270 + OSStatus ATSUSetTextPointerLocation(ATSUTextLayout a, ConstUniCharArrayPtr b, UniCharArrayOffset c, UniCharCount d, UniCharCount e) 271 + { 272 + if (verbose) puts("STUB: ATSUSetTextPointerLocation called"); 273 + return 0; 274 + } 275 + 276 + OSStatus ATSUSetTransientFontMatching(ATSUTextLayout a, Boolean b) 277 + { 278 + if (verbose) puts("STUB: ATSUSetTransientFontMatching called"); 279 + return 0; 280 + } 281 + 282 + // End ATS Stubs 283 + 284 + // QuickDraw Stubs 285 + 286 + void InitCursor() 287 + { 288 + if (verbose) puts("STUB: InitCursor called"); 289 + } 290 + 291 + static uint32_t gFakeScreenDevice; 292 + 293 + GDHandle DMGetFirstScreenDevice(Boolean a) 294 + { 295 + if (verbose) puts("STUB: DMGetFirstScreenDevice called"); 296 + return (GDHandle)&gFakeScreenDevice; 297 + } 298 + 299 + GDHandle DMGetNextScreenDevice (GDHandle a, Boolean b) 300 + { 301 + if (verbose) puts("STUB: DMGetNextScreenDevice called"); 302 + return (GDHandle)0; 303 + } 304 + 305 + GDHandle GetMainDevice() 306 + { 307 + if (verbose) puts("STUB: GetMainDevice called"); 308 + return (GDHandle)0; 309 + } 310 + 311 + CGDirectDisplayID QDGetCGDirectDisplayID(GDHandle a) 312 + { 313 + if (verbose) puts("STUB: QDGetCGDirectDisplayID called"); 314 + return (CGDirectDisplayID)a; 315 + } 316 + 317 + // End QuickDraw Stubs 318 + 319 + 320 + // Old QuickDraw Font Stubs 321 + 322 + FMFont FMGetFontFromATSFontRef(ATSFontRef a) 323 + { 324 + if (verbose) puts("STUB: FMGetFontFromATSFontRef called"); 325 + return (FMFont)0; 326 + } 327 + 328 + // End Old QuickDraw Font Stubs 14 329
+2 -1
src/Carbon/CMakeLists.txt
··· 10 10 11 11 SOURCES 12 12 src/Carbon.c 13 - src/constants.c 13 + src/constants.c 14 + HIToolbox/MacWindows.cpp 14 15 15 16 DEPENDENCIES 16 17 CoreFoundation
+114 -7
src/Carbon/HIToolbox/MacWindows.cpp
··· 1 1 #include "MacWindows.h" 2 2 #include <X11/Xlib.h> 3 - #include <iostream> 4 - #include <cstdlib> 3 + #include <stdlib.h> 4 + #include <stdio.h> 5 + 6 + #define NO_X11 7 + 8 + 9 + static int verbose = 0; 10 + 11 + __attribute__((constructor)) 12 + static void initme(void) { 13 + verbose = getenv("STUB_VERBOSE") != NULL; 14 + } 15 + 5 16 6 17 static Display* g_display = nullptr; 7 18 static void closeDisplay() __attribute__((destructor)); 8 19 9 - Display* Darling::Carbon::getDisplay() 20 + namespace Darling 21 + { 22 + 23 + namespace Carbon 10 24 { 25 + 26 + Display* getDisplay() 27 + { 28 + #ifndef NO_X11 11 29 if (g_display) 12 30 return g_display; 13 31 ··· 15 33 16 34 if (!g_display) 17 35 { 18 - std::cerr << "Darling Carbon: Cannot open a connection to the X server!\n"; 36 + fprintf(stderr, "Darling Carbon: Cannot open a connection to the X server!\n"); 19 37 if (!getenv("DISPLAY")) 20 - std::cerr << "The application you are trying to run requires an X server and cannot be run only in the console.\n"; 38 + fprintf(stderr, "The application you are trying to run requires an X server and cannot be run only in the console.\n"); 21 39 abort(); 22 40 } 23 41 42 + #endif 24 43 return g_display; 25 44 } 26 45 27 46 void closeDisplay() 28 47 { 48 + #ifndef NO_X11 29 49 if (g_display) 30 50 { 31 51 XCloseDisplay(g_display); 32 52 g_display = nullptr; 33 53 } 54 + #endif 55 + } 56 + 57 + } 34 58 } 35 59 36 60 OSStatus CreateNewWindow(WindowClass cls, WindowAttributes attr, const Rect* rect, WindowRef* newWindow) 37 61 { 62 + #ifndef NO_X11 38 63 Window win; 39 64 Display* dpy; 40 65 int blackColor, whiteColor; ··· 56 81 return paramErr; 57 82 58 83 *newWindow = win; 84 + #endif 59 85 return noErr; 60 86 } 61 87 62 88 void DisposeWindow(WindowRef wnd) 63 89 { 90 + #ifndef NO_X11 64 91 if (wnd) 65 - XDestroyWindow(wnd); 92 + XDestroyWindow(Darling::Carbon::getDisplay(), wnd); 93 + #endif 66 94 } 67 95 68 96 void ShowWindow(WindowRef wnd) 69 97 { 98 + #ifndef NO_X11 70 99 if (wnd) 71 100 XMapWindow(Darling::Carbon::getDisplay(), Window(wnd)); 101 + #endif 72 102 } 73 103 74 104 void HideWindow(WindowRef wnd) 75 105 { 106 + #ifndef NO_X11 76 107 if (wnd) 77 108 XUnmapWindow(Darling::Carbon::getDisplay(), Window(wnd)); 109 + #endif 78 110 } 79 111 80 112 void ShowHide(WindowRef wnd, Boolean showFlag) ··· 87 119 88 120 Boolean IsWindowVisible(WindowRef wnd) 89 121 { 90 - 122 + return 0; 123 + } 124 + 125 + 126 + OSStatus SelectWindow(WindowRef a) 127 + { 128 + return 0; 129 + } 130 + 131 + OSStatus SetWindowContentColor(WindowRef a, const RGBColor * b) 132 + { 133 + return 0; 134 + } 135 + 136 + OSStatus SetWindowGroup(WindowRef a, WindowGroupRef b) 137 + { 138 + return 0; 139 + } 140 + 141 + OSStatus SetWindowGroupLevel(WindowGroupRef a, SInt32 b) 142 + { 143 + return 0; 144 + } 145 + 146 + OSStatus SetWindowTitleWithCFString(WindowRef a, CFStringRef b) 147 + { 148 + return 0; 91 149 } 92 150 151 + OSStatus TransitionWindowWithOptions(WindowRef a, WindowTransitionEffect b, WindowTransitionAction c, const HIRect * d, Boolean e, TransitionWindowOptions * f) 152 + { 153 + return 0; 154 + } 155 + 156 + OSStatus CreateWindowGroup(WindowGroupAttributes a, WindowGroupRef *b) 157 + { 158 + return 0; 159 + } 160 + 161 + OSStatus GetWindowBounds(WindowRef a, WindowRegionCode b, Rect * c) 162 + { 163 + return 0; 164 + } 165 + 166 + OSStatus GetWindowEventTarget(WindowRef a) 167 + { 168 + return 0; 169 + } 170 + 171 + OSStatus GetWindowGroupLevel(WindowGroupRef a, SInt32 * b) 172 + { 173 + return 0; 174 + } 175 + 176 + WindowGroupRef GetWindowGroupOfClass(WindowClass a) 177 + { 178 + return (WindowGroupRef)0; 179 + } 180 + 181 + CGrafPtr GetWindowPort(WindowRef a) 182 + { 183 + return (CGrafPtr)0; 184 + } 185 + 186 + Rect* GetWindowPortBounds(WindowRef window, Rect * bounds) 187 + { 188 + return NULL; 189 + } 190 + 191 + Boolean IsValidWindowPtr(WindowRef a) 192 + { 193 + return 0; 194 + } 195 + 196 + OSStatus ReleaseWindow(WindowRef a) 197 + { 198 + return 0; 199 + }
+36 -12
src/Carbon/HIToolbox/MacWindows.h
··· 1 1 #ifndef MACWINDOWS_H 2 2 #define MACWINDOWS_H 3 - //#include <X11/Xlib.h> 4 - #include "../../CoreServices/MacErrors.h" 5 - #include "../../CoreServices/MacTypes.h" 3 + 4 + #include <X11/Xlib.h> 5 + #include "CoreServices/MacErrors.h" 6 + #include "CoreServices/MacTypes.h" 6 7 #include <stdint.h> 7 8 8 9 #pragma pack(2) 9 10 11 + #ifdef __cplusplus 10 12 extern "C" { 13 + #endif 11 14 12 15 typedef int WindowRef; // mapped to X11 Window 13 16 typedef WindowRef HIWindowRef; 17 + typedef int WindowGroupRef; 18 + typedef void* CGrafPtr; 14 19 15 20 typedef uint32_t WindowClass; 16 21 typedef OptionBits WindowAttributes; 22 + typedef OptionBits WindowGroupAttributes; 23 + typedef uint32_t WindowRegionCode; 17 24 18 - struct Rect 19 - { 20 - short top, left, bottom, right; 21 - }; 25 + typedef Rect HIRect; 26 + typedef void* TransitionWindowOptions; 27 + typedef uint32_t WindowTransitionAction; 28 + typedef uint32_t WindowTransitionEffect; 29 + 30 + typedef struct RGBColor { 31 + uint16_t components[3]; 32 + } RGBColor; 22 33 23 34 OSStatus CreateNewWindow(WindowClass cls, WindowAttributes attr, const Rect* rect, WindowRef* newWindow); 24 35 void DisposeWindow(WindowRef wnd); ··· 28 39 void ShowHide(WindowRef wnd, Boolean showFlag); 29 40 Boolean IsWindowVisible(WindowRef wnd); 30 41 31 - } 32 42 33 - namespace Darling { 34 - namespace Carbon { 43 + OSStatus SelectWindow(WindowRef a); 44 + OSStatus SetWindowContentColor(WindowRef a, const RGBColor * b); 45 + OSStatus SetWindowGroup(WindowRef a, WindowGroupRef b); 46 + OSStatus SetWindowGroupLevel(WindowGroupRef a, SInt32 b); 47 + OSStatus SetWindowTitleWithCFString(WindowRef a, CFStringRef b); 48 + OSStatus TransitionWindowWithOptions(WindowRef a, WindowTransitionEffect b, WindowTransitionAction c, const HIRect * d, Boolean e, TransitionWindowOptions * f); 49 + OSStatus CreateWindowGroup(WindowGroupAttributes a, WindowGroupRef *b); 50 + OSStatus GetWindowBounds(WindowRef a, WindowRegionCode b, Rect * c); 51 + OSStatus GetWindowEventTarget(WindowRef a); 52 + OSStatus GetWindowGroupLevel(WindowGroupRef a, SInt32 * b); 53 + WindowGroupRef GetWindowGroupOfClass(WindowClass a); 54 + CGrafPtr GetWindowPort(WindowRef a); 55 + Rect* GetWindowPortBounds(WindowRef window, Rect * bounds); 56 + Boolean IsValidWindowPtr(WindowRef a); 57 + OSStatus ReleaseWindow(WindowRef a); 35 58 36 - Display* getDisplay(); 37 59 38 - }} // end namespaces 60 + #ifdef __cplusplus 61 + } 62 + #endif 39 63 40 64 #pragma pack() 41 65
+11
src/Carbon/include/Carbon/Carbon.h
··· 21 21 #ifndef _Carbon_H_ 22 22 #define _Carbon_H_ 23 23 24 + #include "CoreServices/MacErrors.h" 25 + #include "CoreServices/MacTypes.h" 26 + 27 + #include <HIToolbox/CarbonEventsCore.h> 28 + #include <HIToolbox/CarbonEvents.h> 29 + #include <HIToolbox/Dialogs.h> 30 + #include <HIToolbox/Events.h> 31 + #include <HIToolbox/Menus.h> 32 + #include <HIToolbox/Notification.h> 33 + #include <HIToolbox/Scrap.h> 34 + #include <HIToolbox/TextServices.h> 24 35 25 36 #endif
+20
src/Carbon/include/HIToolbox/CarbonEvents.h
··· 1 + #ifndef _Carbon_Carbon_Events_H_ 2 + #define _Carbon_Carbon_Events_H_ 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + EventTargetRef GetApplicationEventTarget(void); 9 + OSStatus GetEventDispatcherTarget(); 10 + 11 + OSStatus ProcessHICommand(const HICommand * a); 12 + 13 + void RunApplicationEventLoop(void); 14 + 15 + 16 + #ifdef __cplusplus 17 + } 18 + #endif 19 + 20 + #endif
+54
src/Carbon/include/HIToolbox/CarbonEventsCore.h
··· 1 + #ifndef _Carbon_Carbon_Events_Core_H_ 2 + #define _Carbon_Carbon_Events_Core_H_ 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + typedef int EventRef; 9 + typedef void* EventHandlerCallRef; 10 + typedef OSType EventParamType; 11 + 12 + typedef double EventTime; 13 + typedef uint32_t EventMask; 14 + typedef void* EventTargetRef; 15 + typedef OSType EventParamName; 16 + typedef struct EventTypeSpec { uint32_t params[2]; } EventTypeSpec; 17 + typedef EventTime EventTimeout; 18 + typedef void* EventHandlerProcPtr; 19 + typedef uint32_t EventAttributes; 20 + typedef uint32_t EventQueueRef; 21 + typedef void* EventHandlerUPP; 22 + typedef int16_t EventPriority; 23 + typedef void* EventHandlerRef; 24 + 25 + 26 + typedef struct HICommand { uint8_t data[16]; } HICommand; 27 + typedef struct KeyMap { char data[16]; } KeyMap; 28 + 29 + 30 + OSStatus CallNextEventHandler(EventHandlerCallRef a, EventRef b); 31 + OSStatus CreateEvent(CFAllocatorRef a, UInt32 b, UInt32 c, EventTime d, EventAttributes e, EventRef * f); 32 + UInt32 GetEventClass(EventRef a); 33 + UInt32 GetEventKind(EventRef a); 34 + OSStatus GetEventParameter(EventRef a, EventParamName b, EventParamType c, EventParamType * d, UInt32 e, UInt32 * f, void * g); 35 + 36 + OSStatus GetMainEventQueue(); 37 + OSStatus InstallEventHandler(EventTargetRef a, EventHandlerUPP b, UInt32 c, const EventTypeSpec * d, void * e, EventHandlerRef * f); 38 + 39 + 40 + EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr a); 41 + OSStatus PostEventToQueue(EventQueueRef a, EventRef b, EventPriority c); 42 + 43 + OSStatus ReceiveNextEvent(UInt32 a, const EventTypeSpec * b, EventTimeout c, Boolean d, EventRef * e); 44 + 45 + OSStatus ReleaseEvent(EventRef a); 46 + OSStatus RemoveEventHandler(EventHandlerRef a); 47 + 48 + OSStatus SendEventToEventTarget(EventRef a, EventTargetRef b); 49 + 50 + #ifdef __cplusplus 51 + } 52 + #endif 53 + 54 + #endif
+26
src/Carbon/include/HIToolbox/Dialogs.h
··· 1 + #ifndef _Carbon_Dialogs_H_ 2 + #define _Carbon_Dialogs_H_ 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + typedef int16_t AlertType; 9 + typedef void* DialogRef; 10 + typedef uint32_t AlertStdCFStringAlertParamRec; 11 + typedef void* AlertStdCFStringAlertParamPtr; 12 + 13 + typedef int16_t DialogItemIndex; 14 + typedef void* ModalFilterUPP; 15 + 16 + OSStatus CreateStandardAlert(AlertType a, CFStringRef b, CFStringRef c, const AlertStdCFStringAlertParamRec * d, DialogRef * e); 17 + OSStatus GetStandardAlertDefaultParams(AlertStdCFStringAlertParamPtr a, UInt32 b); 18 + 19 + OSStatus RunStandardAlert(DialogRef a, ModalFilterUPP b, DialogItemIndex * c); 20 + 21 + 22 + #ifdef __cplusplus 23 + } 24 + #endif 25 + 26 + #endif
+18
src/Carbon/include/HIToolbox/Events.h
··· 1 + #ifndef _Carbon_Events_H_ 2 + #define _Carbon_Events_H_ 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + void GetKeys(KeyMap theKeys); 9 + void FlushEvents(EventMask a, EventMask b); 10 + 11 + OSStatus SetEventMask(EventMask a); 12 + OSStatus SetEventParameter(EventRef a, EventParamName b, EventParamType c, UInt32 d, const void * e); 13 + 14 + #ifdef __cplusplus 15 + } 16 + #endif 17 + 18 + #endif
+15
src/Carbon/include/HIToolbox/Menus.h
··· 1 + #ifndef _Carbon_Menus_H_ 2 + #define _Carbon_Menus_H_ 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + void ShowMenuBar(void); 9 + void HideMenuBar(void); 10 + 11 + #ifdef __cplusplus 12 + } 13 + #endif 14 + 15 + #endif
+17
src/Carbon/include/HIToolbox/Notification.h
··· 1 + #ifndef _Carbon_Notification_H_ 2 + #define _Carbon_Notification_H_ 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + typedef void* NMRecPtr; 9 + 10 + OSErr NMInstall(NMRecPtr a); 11 + 12 + 13 + #ifdef __cplusplus 14 + } 15 + #endif 16 + 17 + #endif
+24
src/Carbon/include/HIToolbox/Scrap.h
··· 1 + #ifndef _Carbon_Scrap_H_ 2 + #define _Carbon_Scrap_H_ 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + typedef void* ScrapRef; 9 + typedef uint32_t ScrapFlavorType; 10 + typedef uint32_t ScrapFlavorFlags; 11 + typedef uint32_t ScrapFlavorType; 12 + 13 + OSStatus PutScrapFlavor(ScrapRef a, ScrapFlavorType b, ScrapFlavorFlags c, Size d, const void * e); 14 + 15 + OSStatus GetScrapByName(CFStringRef a, OptionBits b, ScrapRef * c); 16 + OSStatus GetScrapFlavorData(ScrapRef a, ScrapFlavorType b, Size * c, void * d); 17 + OSStatus GetScrapFlavorSize(ScrapRef a, ScrapFlavorType b, Size * c); 18 + 19 + 20 + #ifdef __cplusplus 21 + } 22 + #endif 23 + 24 + #endif
+22
src/Carbon/include/HIToolbox/TextServices.h
··· 1 + #ifndef _Carbon_TextServices_H_ 2 + #define _Carbon_TextServices_H_ 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + typedef uint32_t TSMDocumentID; 9 + typedef OSType InterfaceTypeList[1]; 10 + 11 + OSErr ActivateTSMDocument(TSMDocumentID a); 12 + OSErr DeactivateTSMDocument(TSMDocumentID a); 13 + OSErr NewTSMDocument(short a, InterfaceTypeList b, TSMDocumentID * c, long d); 14 + 15 + 16 + OSErr UseInputWindow(TSMDocumentID a, Boolean b); 17 + 18 + #ifdef __cplusplus 19 + } 20 + #endif 21 + 22 + #endif
+213
src/Carbon/src/Carbon.c
··· 19 19 20 20 21 21 #include <Carbon/Carbon.h> 22 + 22 23 #include <stdlib.h> 23 24 #include <stdio.h> 24 25 ··· 28 29 static void initme(void) { 29 30 verbose = getenv("STUB_VERBOSE") != NULL; 30 31 } 32 + 33 + 34 + // These stubs should prob be moved elsewhere 35 + 36 + OSErr ActivateTSMDocument(TSMDocumentID a) 37 + { 38 + if (verbose) puts("STUB: ActivateTSMDocument called"); 39 + return 0; 40 + } 41 + 42 + OSErr DeactivateTSMDocument(TSMDocumentID a) 43 + { 44 + if (verbose) puts("STUB: DeactivateTSMDocument called"); 45 + return 0; 46 + } 47 + 48 + OSStatus CallNextEventHandler(EventHandlerCallRef a, EventRef b) 49 + { 50 + if (verbose) puts("STUB: CallNextEventHandler called"); 51 + return 0; 52 + } 53 + 54 + OSStatus CreateEvent(CFAllocatorRef a, UInt32 b, UInt32 c, EventTime d, EventAttributes e, EventRef * f) 55 + { 56 + if (verbose) puts("STUB: CreateEvent called"); 57 + return 0; 58 + } 59 + 60 + OSStatus CreateStandardAlert(AlertType a, CFStringRef b, CFStringRef c, const AlertStdCFStringAlertParamRec * d, DialogRef * e) 61 + { 62 + if (verbose) puts("STUB: CreateStandardAlert called"); 63 + return 0; 64 + } 65 + 66 + OSErr UseInputWindow(TSMDocumentID a, Boolean b) 67 + { 68 + if (verbose) puts("STUB: UseInputWindow called"); 69 + return 0; 70 + } 71 + 72 + void FlushEvents(EventMask a, EventMask b) 73 + { 74 + if (verbose) puts("STUB: FlushEvents called"); 75 + } 76 + 77 + EventTargetRef GetApplicationEventTarget(void) 78 + { 79 + if (verbose) puts("STUB: GetApplicationEventTarget called"); 80 + return (EventTargetRef)0; 81 + } 82 + 83 + UInt32 GetEventClass(EventRef a) 84 + { 85 + if (verbose) puts("STUB: GetEventClass called"); 86 + return 0; 87 + } 88 + 89 + OSStatus GetEventDispatcherTarget() 90 + { 91 + if (verbose) puts("STUB: GetEventDispatcherTarget called"); 92 + return 0; 93 + } 94 + 95 + UInt32 GetEventKind(EventRef a) 96 + { 97 + if (verbose) puts("STUB: GetEventKind called"); 98 + return 0; 99 + } 100 + 101 + OSStatus GetEventParameter(EventRef a, EventParamName b, EventParamType c, EventParamType * d, UInt32 e, UInt32 * f, void * g) 102 + { 103 + if (verbose) puts("STUB: GetEventParameter called"); 104 + return 0; 105 + } 106 + 107 + OSStatus GetMainEventQueue() 108 + { 109 + if (verbose) puts("STUB: GetMainEventQueue called"); 110 + return 0; 111 + } 112 + 113 + OSStatus GetScrapByName(CFStringRef a, OptionBits b, ScrapRef * c) 114 + { 115 + if (verbose) puts("STUB: GetScrapByName called"); 116 + return 0; 117 + } 118 + 119 + OSStatus GetScrapFlavorData(ScrapRef a, ScrapFlavorType b, Size * c, void * d) 120 + { 121 + if (verbose) puts("STUB: GetScrapFlavorData called"); 122 + return 0; 123 + } 124 + 125 + OSStatus GetScrapFlavorSize(ScrapRef a, ScrapFlavorType b, Size * c) 126 + { 127 + if (verbose) puts("STUB: GetScrapFlavorSize called"); 128 + return 0; 129 + } 130 + 131 + OSStatus GetStandardAlertDefaultParams(AlertStdCFStringAlertParamPtr a, UInt32 b) 132 + { 133 + if (verbose) puts("STUB: GetStandardAlertDefaultParams called"); 134 + return 0; 135 + } 136 + 137 + void HideMenuBar(void) 138 + { 139 + if (verbose) puts("STUB: HideMenuBar called"); 140 + 141 + } 142 + 143 + OSStatus InstallEventHandler(EventTargetRef a, EventHandlerUPP b, UInt32 c, const EventTypeSpec * d, void * e, EventHandlerRef * f) 144 + { 145 + if (verbose) puts("STUB: InstallEventHandler called"); 146 + return 0; 147 + } 148 + 149 + OSErr NMInstall(NMRecPtr a) 150 + { 151 + if (verbose) puts("STUB: NMInstall called"); 152 + return 0; 153 + } 154 + 155 + EventHandlerUPP NewEventHandlerUPP(EventHandlerProcPtr a) 156 + { 157 + if (verbose) puts("STUB: NewEventHandlerUPP called"); 158 + return (EventHandlerUPP)0; 159 + } 160 + 161 + OSErr NewTSMDocument(short a, InterfaceTypeList b, TSMDocumentID * c, long d) 162 + { 163 + if (verbose) puts("STUB: NewTSMDocument called"); 164 + return 0; 165 + } 166 + 167 + OSStatus PostEventToQueue(EventQueueRef a, EventRef b, EventPriority c) 168 + { 169 + if (verbose) puts("STUB: PostEventToQueue called"); 170 + return 0; 171 + } 172 + 173 + OSStatus ProcessHICommand(const HICommand * a) 174 + { 175 + if (verbose) puts("STUB: ProcessHICommand called"); 176 + return 0; 177 + } 178 + 179 + OSStatus PutScrapFlavor(ScrapRef a, ScrapFlavorType b, ScrapFlavorFlags c, Size d, const void * e) 180 + { 181 + if (verbose) puts("STUB: PutScrapFlavor called"); 182 + return 0; 183 + } 184 + 185 + OSStatus ReceiveNextEvent(UInt32 a, const EventTypeSpec * b, EventTimeout c, Boolean d, EventRef * e) 186 + { 187 + if (verbose) puts("STUB: ReceiveNextEvent called"); 188 + return 0; 189 + } 190 + 191 + OSStatus ReleaseEvent(EventRef a) 192 + { 193 + if (verbose) puts("STUB: ReleaseEvent called"); 194 + return 0; 195 + } 196 + 197 + OSStatus RemoveEventHandler(EventHandlerRef a) 198 + { 199 + if (verbose) puts("STUB: RemoveEventHandler called"); 200 + return 0; 201 + } 202 + 203 + void RunApplicationEventLoop(void) 204 + { 205 + if (verbose) puts("STUB: RunApplicationEventLoop called"); 206 + 207 + } 208 + 209 + OSStatus RunStandardAlert(DialogRef a, ModalFilterUPP b, DialogItemIndex * c) 210 + { 211 + if (verbose) puts("STUB: RunStandardAlert called"); 212 + return 0; 213 + } 214 + 215 + OSStatus SendEventToEventTarget(EventRef a, EventTargetRef b) 216 + { 217 + if (verbose) puts("STUB: SendEventToEventTarget called"); 218 + return 0; 219 + } 220 + 221 + OSStatus SetEventMask(EventMask a) 222 + { 223 + if (verbose) puts("STUB: SetEventMask called"); 224 + return 0; 225 + } 226 + 227 + OSStatus SetEventParameter(EventRef a, EventParamName b, EventParamType c, UInt32 d, const void * e) 228 + { 229 + if (verbose) puts("STUB: SetEventParameter called"); 230 + return 0; 231 + } 232 + 233 + void ShowMenuBar(void) 234 + { 235 + if (verbose) puts("STUB: ShowMenuBar called"); 236 + } 237 + 238 + 239 + void GetKeys (KeyMap theKeys) 240 + { 241 + 242 + } 243 +
+6
src/CoreServices/Processes.cpp
··· 222 222 return noErr; 223 223 } 224 224 225 + void DebugStr(ConstStr255Param a) 226 + { 227 + printf("%s\n", a); 228 + } 229 + 230 + 225 231