mirror of https://gitlab.com/nakst/essence
simplify C header; C89 support
This commit is contained in:
parent
ee115fabd8
commit
00c2deea80
|
@ -3,9 +3,7 @@
|
|||
// Written by: nakst.
|
||||
|
||||
#define ES_API
|
||||
#define ES_FORWARD(x) x
|
||||
#define ES_EXTERN_FORWARD extern "C"
|
||||
#define ES_DIRECT_API
|
||||
#define ES_FORWARD
|
||||
#include <essence.h>
|
||||
|
||||
#ifdef USE_STB_IMAGE
|
||||
|
@ -1475,10 +1473,10 @@ extern "C" void _start(EsProcessStartupInformation *_startupInformation) {
|
|||
ThreadLocalStorage threadLocalStorage;
|
||||
|
||||
api.startupInformation = _startupInformation;
|
||||
bool desktop = api.startupInformation->isDesktop;
|
||||
bool isDesktop = api.startupInformation->isDesktop;
|
||||
|
||||
#ifndef NO_API_TABLE
|
||||
if (desktop) {
|
||||
if (isDesktop) {
|
||||
// Initialise the API table.
|
||||
|
||||
EsAssert(sizeof(apiTable) <= 0xF000); // API table is too large.
|
||||
|
@ -1495,12 +1493,11 @@ extern "C" void _start(EsProcessStartupInformation *_startupInformation) {
|
|||
EsMessageMutexAcquire();
|
||||
|
||||
api.global = (GlobalData *) EsMemoryMapObject(api.startupInformation->globalDataRegion,
|
||||
0, sizeof(GlobalData), desktop ? ES_MEMORY_MAP_OBJECT_READ_WRITE : ES_MEMORY_MAP_OBJECT_READ_ONLY);
|
||||
0, sizeof(GlobalData), isDesktop ? ES_MEMORY_MAP_OBJECT_READ_WRITE : ES_MEMORY_MAP_OBJECT_READ_ONLY);
|
||||
theming.scale = api.global->uiScale; // We'll receive ES_MSG_UI_SCALE_CHANGED when this changes.
|
||||
}
|
||||
|
||||
bool uiProcess = true; // TODO Determine this properly.
|
||||
|
||||
if (desktop) {
|
||||
if (isDesktop) {
|
||||
EsPrint("Reached Desktop process.\n");
|
||||
|
||||
#ifdef PROFILE_DESKTOP_FUNCTIONS
|
||||
|
@ -1533,6 +1530,10 @@ extern "C" void _start(EsProcessStartupInformation *_startupInformation) {
|
|||
SettingsLoadDefaults();
|
||||
SettingsUpdateGlobalAndWindowManager();
|
||||
SettingsWindowColorUpdated();
|
||||
|
||||
ThemeInitialise();
|
||||
|
||||
DesktopEntry();
|
||||
} else {
|
||||
EsBuffer buffer = {};
|
||||
buffer.bytes = EsConstantBufferGetSize(api.startupInformation->data.systemData);
|
||||
|
@ -1561,15 +1562,7 @@ extern "C" void _start(EsProcessStartupInformation *_startupInformation) {
|
|||
MessageDesktop(&m, 1, ES_INVALID_HANDLE, &responseBuffer);
|
||||
SystemConfigurationLoad((char *) responseBuffer.out, responseBuffer.bytes);
|
||||
EsHeapFree(responseBuffer.out);
|
||||
}
|
||||
|
||||
if (uiProcess) {
|
||||
EsAssert(ThemeInitialise());
|
||||
}
|
||||
|
||||
if (desktop) {
|
||||
DesktopEntry();
|
||||
} else {
|
||||
((StartFunction) api.startupInformation->applicationStartAddress)();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,13 +8,11 @@
|
|||
// - Duplicate tabs.
|
||||
|
||||
// TODO Graphical issues:
|
||||
// - Closing tabs isn't animating.
|
||||
// - Inactivate windows don't dim outline around tabs.
|
||||
// - Resizing windows doesn't redraw old shadow sometimes.
|
||||
|
||||
// TODO Task bar:
|
||||
// - Right click menu.
|
||||
// - Notification area.
|
||||
// - Notification area?
|
||||
|
||||
// TODO Desktop experience:
|
||||
// - Alt+tab.
|
||||
|
|
|
@ -7259,6 +7259,8 @@ void UIWindowLayoutNow(EsWindow *window, ProcessMessageTiming *timing) {
|
|||
}
|
||||
|
||||
bool UISetCursor(EsWindow *window) {
|
||||
ThemeInitialise();
|
||||
|
||||
EsCursorStyle cursorStyle = ES_CURSOR_NORMAL;
|
||||
EsElement *element = window->dragged ?: window->pressed ?: window->hovered;
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
// Written by: nakst.
|
||||
|
||||
#define ES_API
|
||||
#define ES_FORWARD(x) x
|
||||
#define ES_EXTERN_FORWARD extern "C"
|
||||
#define ES_DIRECT_API
|
||||
#define ES_FORWARD
|
||||
#include <essence.h>
|
||||
|
||||
#ifdef ENABLE_POSIX_SUBSYSTEM
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// This file is part of the Essence operating system.
|
||||
// It is released under the terms of the MIT license -- see LICENSE.md.
|
||||
// Written by: nakst.
|
||||
/* This file is part of the Essence operating system. */
|
||||
/* It is released under the terms of the MIT license -- see LICENSE.md. */
|
||||
/* Written by: nakst. */
|
||||
|
||||
// ----------------- Includes:
|
||||
/* ----------------- Includes: */
|
||||
|
||||
#ifndef IncludedEssenceAPIHeader
|
||||
#define IncludedEssenceAPIHeader
|
||||
|
@ -15,7 +15,7 @@
|
|||
#endif
|
||||
#include <stdarg.h>
|
||||
|
||||
// --------- Architecture defines:
|
||||
/* --------- Architecture defines: */
|
||||
|
||||
#if defined(__i386__)
|
||||
#define ES_ARCH_X86_32
|
||||
|
@ -27,7 +27,7 @@
|
|||
#error Architecture is not supported.
|
||||
#endif
|
||||
|
||||
// --------- C++/C differences:
|
||||
/* --------- C++/C differences: */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
#define ES_CONSTRUCTOR(x) x
|
||||
#define ES_NULL nullptr
|
||||
|
||||
// Scoped defer: http://www.gingerbill.org/article/defer-in-cpp.html
|
||||
/* Scoped defer: http://www.gingerbill.org/article/defer-in-cpp.html */
|
||||
template <typename F> struct _EsDefer4 { F f; _EsDefer4(F f) : f(f) {} ~_EsDefer4() { f(); } };
|
||||
template <typename F> _EsDefer4<F> _EsDeferFunction(F f) { return _EsDefer4<F>(f); }
|
||||
#define EsDEFER_3(x) ES_C_PREPROCESSOR_JOIN(x, __COUNTER__)
|
||||
|
@ -76,7 +76,7 @@ typedef struct EsElementPublic EsElementPublic;
|
|||
|
||||
#endif
|
||||
|
||||
// --------- Macros:
|
||||
/* --------- Macros: */
|
||||
|
||||
#ifdef ES_ARCH_X86_64
|
||||
#define ES_API_BASE ((void **) 0x1000)
|
||||
|
@ -163,8 +163,8 @@ struct ES_INSTANCE_TYPE;
|
|||
#define ES_SAMPLE_FORMAT_BYTES_PER_SAMPLE(x) \
|
||||
((x) == ES_SAMPLE_FORMAT_U8 ? 1 : (x) == ES_SAMPLE_FORMAT_S16LE ? 2 : 4)
|
||||
|
||||
#define ES_EXTRACT_BITS(value, end, start) (((value) >> (start)) & ((1 << ((end) - (start) + 1)) - 1)) // Moves the bits to the start.
|
||||
#define ES_ISOLATE_BITS(value, end, start) (((value)) & (((1 << ((end) - (start) + 1)) - 1) << (start))) // Keeps the bits in place.
|
||||
#define ES_EXTRACT_BITS(value, end, start) (((value) >> (start)) & ((1 << ((end) - (start) + 1)) - 1)) /* Moves the bits to the start. */
|
||||
#define ES_ISOLATE_BITS(value, end, start) (((value)) & (((1 << ((end) - (start) + 1)) - 1) << (start))) /* Keeps the bits in place. */
|
||||
|
||||
#ifndef KERNEL
|
||||
#ifdef ES_API
|
||||
|
@ -191,7 +191,7 @@ ES_EXTERN_C uintptr_t _APISyscall(uintptr_t argument0, uintptr_t argument1, uint
|
|||
#define EsPerformanceTimerPush() double _performanceTimerStart = EsTimeStampMs()
|
||||
#define EsPerformanceTimerPop() ((EsTimeStampMs() - _performanceTimerStart) / 1000.0)
|
||||
|
||||
// --------- Algorithms:
|
||||
/* --------- Algorithms: */
|
||||
|
||||
#define ES_MACRO_SORT(_name, _type, _compar, _contextType) void _name(_type *base, size_t nmemb, _contextType context) { \
|
||||
(void) context; \
|
||||
|
@ -264,7 +264,7 @@ ES_EXTERN_C uintptr_t _APISyscall(uintptr_t argument0, uintptr_t argument1, uint
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
// --------- Misc:
|
||||
/* --------- Misc: */
|
||||
|
||||
typedef uint64_t _EsLongConstant;
|
||||
typedef long double EsLongDouble;
|
||||
|
@ -281,7 +281,7 @@ ES_EXTERN_C void _start();
|
|||
#define ES_INFINITY __builtin_inff()
|
||||
#define ES_PI (3.1415926535897932384626433832795028841971693994)
|
||||
|
||||
// --------- Internals:
|
||||
/* --------- Internals: */
|
||||
|
||||
#if defined(ES_API) || defined(KERNEL) || defined(INSTALLER)
|
||||
|
||||
|
@ -338,7 +338,7 @@ struct GlobalData {
|
|||
};
|
||||
|
||||
struct SystemStartupDataHeader {
|
||||
// TODO Make mount points and devices equal, somehow?
|
||||
/* TODO Make mount points and devices equal, somehow? */
|
||||
size_t initialMountPointCount;
|
||||
size_t initialDeviceCount;
|
||||
uintptr_t themeCursorData;
|
||||
|
@ -387,33 +387,33 @@ extern "C" void *EsBufferWrite(EsBuffer *buffer, const void *source, size_t writ
|
|||
#define ES_THEME_CURSORS_WIDTH (264)
|
||||
#define ES_THEME_CURSORS_HEIGHT (128)
|
||||
|
||||
// Desktop messages:
|
||||
/* Desktop messages: */
|
||||
#define ES_MSG_EMBEDDED_WINDOW_DESTROYED ((EsMessageType) (ES_MSG_SYSTEM_START + 0x001))
|
||||
#define ES_MSG_SET_SCREEN_RESOLUTION ((EsMessageType) (ES_MSG_SYSTEM_START + 0x002))
|
||||
#define ES_MSG_DESKTOP ((EsMessageType) (ES_MSG_SYSTEM_START + 0x005))
|
||||
|
||||
// Messages sent from Desktop to application instances:
|
||||
/* Messages sent from Desktop to application instances: */
|
||||
#define ES_MSG_TAB_INSPECT_UI ((EsMessageType) (ES_MSG_SYSTEM_START + 0x101))
|
||||
#define ES_MSG_TAB_CLOSE_REQUEST ((EsMessageType) (ES_MSG_SYSTEM_START + 0x102))
|
||||
#define ES_MSG_INSTANCE_SAVE_RESPONSE ((EsMessageType) (ES_MSG_SYSTEM_START + 0x103)) // Sent by Desktop after an application requested to save its document.
|
||||
#define ES_MSG_INSTANCE_SAVE_RESPONSE ((EsMessageType) (ES_MSG_SYSTEM_START + 0x103)) /* Sent by Desktop after an application requested to save its document. */
|
||||
#define ES_MSG_INSTANCE_DOCUMENT_RENAMED ((EsMessageType) (ES_MSG_SYSTEM_START + 0x104))
|
||||
#define ES_MSG_INSTANCE_DOCUMENT_UPDATED ((EsMessageType) (ES_MSG_SYSTEM_START + 0x105))
|
||||
#define ES_MSG_INSTANCE_RENAME_RESPONSE ((EsMessageType) (ES_MSG_SYSTEM_START + 0x107))
|
||||
|
||||
// Debugger messages:
|
||||
/* Debugger messages: */
|
||||
#define ES_MSG_APPLICATION_CRASH ((EsMessageType) (ES_MSG_SYSTEM_START + 0x201))
|
||||
#define ES_MSG_PROCESS_TERMINATED ((EsMessageType) (ES_MSG_SYSTEM_START + 0x202))
|
||||
|
||||
// Misc messages:
|
||||
/* Misc messages: */
|
||||
#define ES_MSG_EYEDROP_REPORT ((EsMessageType) (ES_MSG_SYSTEM_START + 0x301))
|
||||
#define ES_MSG_TIMER ((EsMessageType) (ES_MSG_SYSTEM_START + 0x302))
|
||||
#define ES_MSG_PING ((EsMessageType) (ES_MSG_SYSTEM_START + 0x303)) // Sent by Desktop to check processes are processing messages.
|
||||
#define ES_MSG_WAKEUP ((EsMessageType) (ES_MSG_SYSTEM_START + 0x304)) // Sent to wakeup the message thread, so that it can process locally posted messages.
|
||||
#define ES_MSG_PING ((EsMessageType) (ES_MSG_SYSTEM_START + 0x303)) /* Sent by Desktop to check processes are processing messages. */
|
||||
#define ES_MSG_WAKEUP ((EsMessageType) (ES_MSG_SYSTEM_START + 0x304)) /* Sent to wakeup the message thread, so that it can process locally posted messages. */
|
||||
#define ES_MSG_INSTANCE_OPEN_DELAYED ((EsMessageType) (ES_MSG_SYSTEM_START + 0x305))
|
||||
|
||||
#endif
|
||||
|
||||
// --------- CRT function macros:
|
||||
/* --------- CRT function macros: */
|
||||
|
||||
#ifdef ES_CRT_WITHOUT_PREFIX
|
||||
#define abs EsCRTabs
|
||||
|
|
|
@ -354,6 +354,7 @@ struct UIStyleKey {
|
|||
};
|
||||
|
||||
struct {
|
||||
bool initialised;
|
||||
EsBuffer system;
|
||||
const ThemeHeader *header;
|
||||
EsPaintTarget cursors;
|
||||
|
@ -1240,7 +1241,41 @@ struct UIStyle {
|
|||
inline void GetTextStyle(EsTextStyle *style);
|
||||
};
|
||||
|
||||
void ThemeInitialise() {
|
||||
if (theming.initialised) return;
|
||||
theming.initialised = true;
|
||||
|
||||
EsBuffer data = {};
|
||||
data.in = (const uint8_t *) EsBundleFind(&bundleDesktop, EsLiteral("Theme.dat"), &data.bytes);
|
||||
|
||||
const ThemeHeader *header = (const ThemeHeader *) EsBufferRead(&data, sizeof(ThemeHeader));
|
||||
EsAssert(header && header->signature == THEME_HEADER_SIGNATURE && header->styleCount && EsBufferRead(&data, sizeof(ThemeStyle)));
|
||||
theming.system.in = (const uint8_t *) data.in;
|
||||
theming.system.bytes = data.bytes;
|
||||
theming.header = header;
|
||||
|
||||
theming.scale = api.global->uiScale;
|
||||
|
||||
if (!theming.cursorData) {
|
||||
size_t cursorsBitmapBytes;
|
||||
const void *cursorsBitmap = EsBundleFind(&bundleDesktop, EsLiteral("Cursors.png"), &cursorsBitmapBytes);
|
||||
theming.cursorData = EsMemoryCreateShareableRegion(ES_THEME_CURSORS_WIDTH * ES_THEME_CURSORS_HEIGHT * 4);
|
||||
void *destination = EsMemoryMapObject(theming.cursorData, 0, ES_THEME_CURSORS_WIDTH * ES_THEME_CURSORS_HEIGHT * 4, ES_MEMORY_MAP_OBJECT_READ_WRITE);
|
||||
LoadImage(cursorsBitmap, cursorsBitmapBytes, destination, ES_THEME_CURSORS_WIDTH, ES_THEME_CURSORS_HEIGHT, true);
|
||||
EsObjectUnmap(destination);
|
||||
}
|
||||
|
||||
theming.cursors.width = ES_THEME_CURSORS_WIDTH;
|
||||
theming.cursors.height = ES_THEME_CURSORS_HEIGHT;
|
||||
theming.cursors.stride = ES_THEME_CURSORS_WIDTH * 4;
|
||||
theming.cursors.bits = EsMemoryMapObject(theming.cursorData, 0, ES_MEMORY_MAP_OBJECT_ALL, ES_MEMORY_MAP_OBJECT_READ_ONLY);
|
||||
theming.cursors.fullAlpha = true;
|
||||
theming.cursors.readOnly = true;
|
||||
}
|
||||
|
||||
const void *GetConstant(const char *cKey, size_t *byteCount, bool *scale) {
|
||||
ThemeInitialise();
|
||||
|
||||
EsBuffer data = theming.system;
|
||||
const ThemeHeader *header = (const ThemeHeader *) EsBufferRead(&data, sizeof(ThemeHeader));
|
||||
EsBufferRead(&data, sizeof(ThemeStyle) * header->styleCount);
|
||||
|
@ -1292,41 +1327,6 @@ const char *GetConstantString(const char *cKey) {
|
|||
return !value || !byteCount || value[byteCount - 1] ? nullptr : value;
|
||||
}
|
||||
|
||||
bool ThemeInitialise() {
|
||||
EsBuffer data = {};
|
||||
data.in = (const uint8_t *) EsBundleFind(&bundleDesktop, EsLiteral("Theme.dat"), &data.bytes);
|
||||
|
||||
const ThemeHeader *header = (const ThemeHeader *) EsBufferRead(&data, sizeof(ThemeHeader));
|
||||
|
||||
if (!header || header->signature != THEME_HEADER_SIGNATURE || !header->styleCount || !EsBufferRead(&data, sizeof(ThemeStyle))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
theming.system.in = (const uint8_t *) data.in;
|
||||
theming.system.bytes = data.bytes;
|
||||
theming.header = header;
|
||||
|
||||
theming.scale = api.global->uiScale;
|
||||
|
||||
if (!theming.cursorData) {
|
||||
size_t cursorsBitmapBytes;
|
||||
const void *cursorsBitmap = EsBundleFind(&bundleDesktop, EsLiteral("Cursors.png"), &cursorsBitmapBytes);
|
||||
theming.cursorData = EsMemoryCreateShareableRegion(ES_THEME_CURSORS_WIDTH * ES_THEME_CURSORS_HEIGHT * 4);
|
||||
void *destination = EsMemoryMapObject(theming.cursorData, 0, ES_THEME_CURSORS_WIDTH * ES_THEME_CURSORS_HEIGHT * 4, ES_MEMORY_MAP_OBJECT_READ_WRITE);
|
||||
LoadImage(cursorsBitmap, cursorsBitmapBytes, destination, ES_THEME_CURSORS_WIDTH, ES_THEME_CURSORS_HEIGHT, true);
|
||||
EsObjectUnmap(destination);
|
||||
}
|
||||
|
||||
theming.cursors.width = ES_THEME_CURSORS_WIDTH;
|
||||
theming.cursors.height = ES_THEME_CURSORS_HEIGHT;
|
||||
theming.cursors.stride = ES_THEME_CURSORS_WIDTH * 4;
|
||||
theming.cursors.bits = EsMemoryMapObject(theming.cursorData, 0, ES_MEMORY_MAP_OBJECT_ALL, ES_MEMORY_MAP_OBJECT_READ_ONLY);
|
||||
theming.cursors.fullAlpha = true;
|
||||
theming.cursors.readOnly = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ThemeStyleCopyInlineMetrics(UIStyle *style) {
|
||||
style->font.family = style->metrics->fontFamily;
|
||||
style->font.weight = style->metrics->fontWeight;
|
||||
|
@ -1613,6 +1613,8 @@ void ThemeStylePrepare(UIStyle *style, UIStyleKey key) {
|
|||
}
|
||||
|
||||
UIStyle *ThemeStyleInitialise(UIStyleKey key) {
|
||||
ThemeInitialise();
|
||||
|
||||
// Find the ThemeStyle entry.
|
||||
|
||||
EsStyle *esStyle = (key.part & 1) || (!key.part) ? nullptr : (EsStyle *) (key.part);
|
||||
|
|
|
@ -32,16 +32,9 @@ extern "C" uint64_t GetKernelVersion() { return KERNEL_VERSION; }
|
|||
// API header.
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#define ES_DIRECT_API
|
||||
#define ES_FORWARD(x) x
|
||||
#define ES_EXTERN_FORWARD ES_EXTERN_C
|
||||
#define ES_FORWARD
|
||||
#include <essence.h>
|
||||
|
||||
// TODO stb's behaviour with null termination is non-standard.
|
||||
extern "C" int EsCRTsprintf(char *buffer, const char *format, ...);
|
||||
extern "C" int EsCRTsnprintf(char *buffer, size_t bufferSize, const char *format, ...);
|
||||
extern "C" int EsCRTvsnprintf(char *buffer, size_t bufferSize, const char *format, va_list arguments);
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
// Global defines.
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -21,8 +21,8 @@ if [ "$1" = "x86_64" ]; then
|
|||
rm -f objs/.libs/libfreetype.a
|
||||
./configure --without-zlib --without-bzip2 --without-png --without-harfbuzz \
|
||||
CC=x86_64-essence-gcc CFLAGS="-g -ffreestanding -Wno-unused-function -O3" \
|
||||
LDFLAGS="-nostdlib -lgcc" --host=x86_64-essence > ../Logs/freetype_configure.txt 2>&1
|
||||
make ANSIFLAGS="" > /dev/null
|
||||
--host=x86_64-essence > ../Logs/freetype_configure.txt 2>&1
|
||||
make -j`nproc` > /dev/null
|
||||
cp objs/.libs/libfreetype.a libfreetype_x86_64.a
|
||||
cd ../..
|
||||
fi
|
||||
|
@ -40,7 +40,7 @@ if [ "$1" = "x86_32" ]; then
|
|||
CC=i686-elf-gcc CFLAGS="-g -ffreestanding -Wno-unused-function -O3 -I$INC" \
|
||||
LDFLAGS="-nostdlib -lgcc" --host=i686-elf > ../Logs/freetype_configure.txt 2>&1
|
||||
sed -i '/define FT_USE_AUTOCONF_SIZEOF_TYPES/d' builds/unix/ftconfig.h
|
||||
make ANSIFLAGS="" > /dev/null
|
||||
make -j`nproc` > /dev/null
|
||||
cp objs/.libs/libfreetype.a libfreetype_x86_32.a
|
||||
cd ../..
|
||||
fi
|
||||
|
|
|
@ -101,7 +101,7 @@ FT_BEGIN_HEADER
|
|||
/* cff:no-stem-darkening=1 \ */
|
||||
/* autofitter:warping=1 */
|
||||
/* */
|
||||
// #define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||
/* #define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -174,7 +174,7 @@ FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* Define this macro if you want to enable this `feature'. */
|
||||
/* */
|
||||
// #define FT_CONFIG_OPTION_USE_LZW
|
||||
/* #define FT_CONFIG_OPTION_USE_LZW */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -189,7 +189,7 @@ FT_BEGIN_HEADER
|
|||
/* Define this macro if you want to enable this `feature'. See also */
|
||||
/* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
|
||||
/* */
|
||||
// #define FT_CONFIG_OPTION_USE_ZLIB
|
||||
/* #define FT_CONFIG_OPTION_USE_ZLIB */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -31,14 +31,8 @@
|
|||
#ifndef FTSTDLIB_H_
|
||||
#define FTSTDLIB_H_
|
||||
|
||||
#ifndef IncludedEssenceAPIHeader
|
||||
#define ES_CRT
|
||||
#define ES_API
|
||||
#define ES_FORWARD(x) x
|
||||
#define ES_DIRECT_API
|
||||
#define ES_EXTERN_FORWARD extern
|
||||
#define ES_FORWARD
|
||||
#include <essence.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
@ -83,7 +77,7 @@
|
|||
/**********************************************************************/
|
||||
|
||||
|
||||
// #include <string.h>
|
||||
/* #include <string.h> */
|
||||
|
||||
#define ft_memchr EsCRTmemchr
|
||||
#define ft_memcmp EsCRTmemcmp
|
||||
|
@ -107,7 +101,7 @@
|
|||
/**********************************************************************/
|
||||
|
||||
|
||||
// #include <stdio.h>
|
||||
/* #include <stdio.h> */
|
||||
|
||||
#define FT_FILE FILE
|
||||
#define ft_fclose fclose
|
||||
|
@ -125,7 +119,7 @@
|
|||
/**********************************************************************/
|
||||
|
||||
|
||||
// #include <stdlib.h>
|
||||
/* #include <stdlib.h> */
|
||||
|
||||
#define ft_qsort EsCRTqsort
|
||||
|
||||
|
@ -161,7 +155,7 @@
|
|||
/**********************************************************************/
|
||||
|
||||
|
||||
// #include <setjmp.h>
|
||||
/* #include <setjmp.h> */
|
||||
|
||||
#define ft_jmp_buf EsCRTjmp_buf /* note: this cannot be a typedef since */
|
||||
/* jmp_buf is defined as a macro */
|
||||
|
|
|
@ -29,10 +29,7 @@
|
|||
#define STDC_HEADERS 1
|
||||
#define HAVE_FREETYPE 1
|
||||
|
||||
#define ES_API
|
||||
#define ES_FORWARD(x) x
|
||||
#define ES_EXTERN_FORWARD extern "C"
|
||||
#define ES_DIRECT_API
|
||||
#define ES_FORWARD
|
||||
|
||||
#define abs EsCRTabs
|
||||
#define assert EsCRTassert
|
||||
|
|
Binary file not shown.
|
@ -348,7 +348,7 @@ void Compile(uint32_t flags, int partitionSize, const char *volumeLabel) {
|
|||
CallSystem("bin/build_core standard bin/build.ini");
|
||||
|
||||
#ifdef TOOLCHAIN_HAS_CSTDLIB
|
||||
CallSystem(TOOLCHAIN_PREFIX "-gcc -o root/Applications/POSIX/bin/hello ports/gcc/hello.c");
|
||||
CallSystem(TOOLCHAIN_PREFIX "-gcc -o root/Applications/POSIX/bin/hello -std=c89 ports/gcc/hello.c");
|
||||
#endif
|
||||
|
||||
forceRebuild = false;
|
||||
|
|
|
@ -491,7 +491,7 @@ void OutputCFunction(Entry *entry) {
|
|||
|
||||
bool inKernel = entry->function.inKernel;
|
||||
if (!inKernel) FilePrintFormat(output, "#ifndef KERNEL\n");
|
||||
FilePrintFormat(output, "#ifdef ES_FORWARD\n#ifndef __cplusplus\nES_EXTERN_FORWARD ");
|
||||
FilePrintFormat(output, "#ifdef ES_FORWARD\n#ifndef __cplusplus\nES_EXTERN_C ");
|
||||
|
||||
// C code in API.
|
||||
|
||||
|
@ -502,7 +502,7 @@ void OutputCFunction(Entry *entry) {
|
|||
if (i == 0) FilePrintFormat(output, "(");
|
||||
}
|
||||
|
||||
FilePrintFormat(output, ");\n#else\nES_EXTERN_FORWARD ");
|
||||
FilePrintFormat(output, ");\n#else\nES_EXTERN_C ");
|
||||
|
||||
// C++ code in API.
|
||||
|
||||
|
@ -515,7 +515,7 @@ void OutputCFunction(Entry *entry) {
|
|||
if (i == 0) FilePrintFormat(output, "(");
|
||||
}
|
||||
|
||||
FilePrintFormat(output, ");\n#endif\n#endif\n#ifndef ES_DIRECT_API\ntypedef ");
|
||||
FilePrintFormat(output, ");\n#endif\n#else\ntypedef ");
|
||||
|
||||
// Code in application.
|
||||
|
||||
|
|
Loading…
Reference in New Issue