Phasor
3.3.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
nativeerror.h
Go to the documentation of this file.
1
#pragma once
2
#include <print>
3
#include <iostream>
4
#include <string>
5
6
#define _phs_nativeerror_console(msg) std::println(std::cerr, "Error: {}", msg)
7
8
#define error(msg) _phs_nativeerror_console(msg)
9
10
#if !defined(SANDBOXED) && defined(_DEBUG)
11
#if defined(_WIN32)
12
#include <Windows.h>
13
#undef error
14
#define error(msg) \
15
do \
16
{ \
17
std::string _msg = (msg); \
18
MessageBoxA(NULL, _msg.c_str(), "Phasor VM Runtime Error", MB_OK | MB_ICONERROR); \
19
_phs_nativeerror_console(_msg); \
20
} while (0)
21
#elif defined(__APPLE__)
22
#include <CoreFoundation/CoreFoundation.h>
23
#undef error
24
#define error(msg) \
25
do \
26
{ \
27
std::string _msg = (msg); \
28
CFStringRef _cfMsg = CFStringCreateWithCString(NULL, _msg.c_str(), kCFStringEncodingUTF8); \
29
CFUserNotificationDisplayAlert(0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL, \
30
CFSTR("Phasor VM Runtime Error"), _cfMsg, CFSTR("OK"), NULL, NULL, NULL); \
31
CFRelease(_cfMsg); \
32
_phs_nativeerror_console(_msg); \
33
} while (0)
34
#endif
35
#endif
src
include
nativeerror.h
Generated by
1.16.1