2025-09-30 13:04:40 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @file Mw/MachDep.h
|
|
|
|
|
* @brief Machine dependent headers and macros
|
2025-09-30 13:04:40 +00:00
|
|
|
*/
|
2025-09-29 00:06:16 +00:00
|
|
|
#ifndef __MW_MACHDEP_H__
|
|
|
|
|
#define __MW_MACHDEP_H__
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdarg.h>
|
2025-10-01 05:59:53 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <assert.h>
|
2025-10-04 17:28:33 +00:00
|
|
|
#include <math.h>
|
2025-12-09 20:11:01 -06:00
|
|
|
#include <errno.h>
|
2025-10-08 18:03:46 +00:00
|
|
|
#include <ctype.h>
|
2025-10-13 12:39:37 +00:00
|
|
|
#include <time.h>
|
2025-11-26 22:04:02 +00:00
|
|
|
#include <sys/stat.h>
|
2026-04-23 14:59:35 +09:00
|
|
|
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L
|
|
|
|
|
#include <wchar.h>
|
|
|
|
|
#define MW_HAS_WCHAR
|
|
|
|
|
#endif
|
2025-10-17 00:16:02 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
#include <direct.h>
|
2025-11-13 03:28:25 +00:00
|
|
|
|
|
|
|
|
#ifdef _MILSKO
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#ifndef GWLP_USERDATA
|
|
|
|
|
#define GWLP_USERDATA GWL_USERDATA
|
|
|
|
|
#define GWLP_WNDPROC GWL_WNDPROC
|
|
|
|
|
#define GCLP_HICON GCL_HICON
|
|
|
|
|
#define GCLP_HCURSOR GCL_HCURSOR
|
|
|
|
|
#define SetWindowLongPtr SetWindowLong
|
|
|
|
|
#define GetWindowLongPtr GetWindowLong
|
|
|
|
|
#define SetClassLongPtr SetClassLong
|
|
|
|
|
#define GetClassLongPtr GetClassLong
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef WM_MOUSEWHEEL
|
|
|
|
|
#define WM_MOUSEWHEEL 0x020a
|
|
|
|
|
#define GET_WHEEL_DELTA_WPARAM(x) ((short)HIWORD(x))
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2026-04-15 20:21:20 -07:00
|
|
|
#elif defined(CLASSIC_MAC_OS)
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <MacTypes.h>
|
|
|
|
|
#include <CFBundle.h>
|
|
|
|
|
#include <CodeFragments.h>
|
|
|
|
|
#include <Timer.h>
|
|
|
|
|
#include <MacWindows.h>
|
|
|
|
|
#include <TextEdit.h>
|
|
|
|
|
#include <Dialogs.h>
|
2025-10-17 00:16:02 +00:00
|
|
|
#else
|
2025-09-29 00:06:16 +00:00
|
|
|
#include <unistd.h>
|
2025-10-18 16:31:59 +00:00
|
|
|
#include <pwd.h>
|
2025-10-04 12:33:26 +00:00
|
|
|
#include <signal.h>
|
2025-12-09 20:11:01 -06:00
|
|
|
#include <fcntl.h>
|
2026-01-23 13:57:05 +09:00
|
|
|
#include <limits.h>
|
2025-09-29 00:06:16 +00:00
|
|
|
#endif
|
|
|
|
|
|
2026-04-28 15:06:38 +00:00
|
|
|
#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
|
2026-04-15 20:21:20 -07:00
|
|
|
#include <dirent.h>
|
|
|
|
|
#include <dlfcn.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2026-04-28 22:01:42 +09:00
|
|
|
#ifdef __HAIKU__
|
|
|
|
|
#ifdef __cplusplus
|
2026-04-28 16:30:01 +00:00
|
|
|
#include <Window.h>
|
|
|
|
|
#include <View.h>
|
2026-04-28 17:44:59 +00:00
|
|
|
#include <Screen.h>
|
|
|
|
|
#include <Application.h>
|
2026-04-28 17:48:20 +00:00
|
|
|
#include <Locker.h>
|
2026-04-29 04:24:01 +09:00
|
|
|
#include <Picture.h>
|
2026-04-29 01:03:50 +09:00
|
|
|
#include <Bitmap.h>
|
2026-04-28 22:01:42 +09:00
|
|
|
#endif
|
2026-04-28 12:59:25 +00:00
|
|
|
#include <OS.h>
|
2026-04-28 16:30:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
2026-01-09 14:43:44 -07:00
|
|
|
#ifdef __APPLE__
|
|
|
|
|
#include <mach/clock.h>
|
|
|
|
|
#include <mach/mach.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2026-04-15 16:12:38 -07:00
|
|
|
#ifdef USE_DBUS
|
|
|
|
|
#include <dbus/dbus.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-10-08 11:15:48 +00:00
|
|
|
#ifndef M_PI
|
|
|
|
|
#define M_PI 3.14159265
|
|
|
|
|
#endif
|
|
|
|
|
|
2026-04-13 13:46:25 -07:00
|
|
|
/* Windows */
|
2026-05-15 01:32:22 +09:00
|
|
|
#if defined(_MILSKO) && defined(_MILSKO_BUILD) && defined(_WIN32)
|
2025-09-29 00:06:16 +00:00
|
|
|
#define MWDECL extern __declspec(dllexport)
|
|
|
|
|
#elif defined(_WIN32)
|
|
|
|
|
#define MWDECL extern __declspec(dllimport)
|
2026-04-13 13:46:25 -07:00
|
|
|
/* GCC/Clang */
|
|
|
|
|
/* First check if we have __has_attribute and can check for the existence of visibility */
|
2026-03-31 16:54:01 -07:00
|
|
|
#elif defined(__has_attribute)
|
|
|
|
|
#if __has_attribute(visibility)
|
|
|
|
|
#define MWDECL extern __attribute__((visibility("default")))
|
|
|
|
|
#else
|
|
|
|
|
#define MWDECL extern
|
|
|
|
|
#endif
|
2026-04-13 13:46:25 -07:00
|
|
|
/* It might be that we're on an old version of GCC (like the one Apple ships with older versions of Mac OS).
|
|
|
|
|
* If we're on gcc 3 or above, assume it's there
|
|
|
|
|
*/
|
|
|
|
|
#elif __GNUC__ >= 3
|
|
|
|
|
#define MWDECL extern __attribute__((visibility("default")))
|
2025-09-29 00:06:16 +00:00
|
|
|
#else
|
2026-04-13 13:46:25 -07:00
|
|
|
/* all else fails */
|
2025-09-29 00:06:16 +00:00
|
|
|
#define MWDECL extern
|
|
|
|
|
#endif
|
|
|
|
|
|
2026-04-22 12:05:49 +09:00
|
|
|
#if defined(_WIN32)
|
|
|
|
|
#define MWAPI __cdecl
|
|
|
|
|
#else
|
|
|
|
|
#define MWAPI
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-10-21 16:46:20 +00:00
|
|
|
#define MwInline static __inline
|
2025-10-20 21:55:30 +00:00
|
|
|
|
2025-09-29 00:06:16 +00:00
|
|
|
#endif
|