]> uap-core.de Git - note.git/commitdiff
prepare build system for macos main
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 26 Mar 2026 17:30:31 +0000 (18:30 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 26 Mar 2026 17:30:31 +0000 (18:30 +0100)
15 files changed:
application/Makefile
application/attachment.c
application/cocoa-image.h [new file with mode: 0644]
application/cocoa-image.m [new file with mode: 0644]
application/cocoa-text.h [new file with mode: 0644]
application/cocoa-text.m [new file with mode: 0644]
application/note.c
application/notebook.c
application/window.c
configure
dbutils/dbutils/dbutils.h
dbutils/json.c
dbutils/object.c
make/project.xml
ui/ui/icons.h

index 1beec5e384bbd65704168d160cece9eda0a3fca6..a09877c2928baf9cb3856ee7c6687d2aade88d86 100644 (file)
@@ -45,6 +45,7 @@ SRC += nbconfig.c
 SRC += $(APP_PLATFORM_SRC)
 
 OBJ = $(SRC:%.c=../build/application/%$(OBJ_EXT))
+OBJ += $(APP_PLATFORM_OBJC_SRC:%.m=../build/application/%$(OBJ_EXT))
 MAIN_OBJ = ../build/application/main$(OBJ_EXT)
        
 TEST_SRC  = tests/testmain.c
@@ -65,6 +66,9 @@ $(APP_BIN): $(MAIN_OBJ) $(OBJ) $(BUILD_ROOT)/build/lib/libuitk.a
 $(TEST_BIN): $(OBJ) $(TEST_OBJ) $(BUILD_ROOT)/build/lib/libuitk.a 
        $(CC) -o $(TEST_BIN) $(TEST_OBJ) $(OBJ) -L$(BUILD_ROOT)/build/lib $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)uitk$(LIB_EXT) $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)ucx$(LIB_EXT) -lidav -ldbutils -lmd4c -lnoteutils $(LDFLAGS) $(TK_LDFLAGS) $(DAV_LDFLAGS) $(DBU_LDFLAGS)
 
+../build/application/%$(OBJ_EXT): %.m
+       $(CC) $(CFLAGS) $(TK_CFLAGS) $(DAV_CFLAGS) -o $@ -c $<
+
 ../build/application/%$(OBJ_EXT): %.c
        $(CC) $(CFLAGS) $(TK_CFLAGS) $(DAV_CFLAGS) -o $@ -c $<
        
index fc2ce681e02e1d33d06015aa18d83cfd5240f93e..604f65053bfa8d89aa79ea8b728a4e462c2e4075 100644 (file)
@@ -31,6 +31,8 @@
 #include "note.h"
 #include "store.h"
 
+#include <stdio.h>
+#include <stdlib.h>
 #include <cx/printf.h>
 #include <cx/buffer.h>
 #include <cx/streams.h>
diff --git a/application/cocoa-image.h b/application/cocoa-image.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/application/cocoa-image.m b/application/cocoa-image.m
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/application/cocoa-text.h b/application/cocoa-text.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/application/cocoa-text.m b/application/cocoa-text.m
new file mode 100644 (file)
index 0000000..b47a2ac
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2025 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "cocoa-text.h"
+#include "cocoa-image.h"
+#include "editor.h"
+#include "note.h"
+#include "attachment.h"
+
+#include <cx/buffer.h>
+#include <cx/array_list.h>
+#include <cx/hash_map.h>
+#include <cx/string.h>
+#include <cx/printf.h>
+
+#include <libidav/utils.h>
+
+#include <ctype.h>
+#include <string.h>
+
+
+
+void editor_global_init() {
+       
+}
+void editor_init_textview(UiObject *obj, UIWIDGET textview) {
+       
+}
+void editor_init_textbuf(UiText *text) {
+       
+}
+void editor_apply_styles(Note *note, UIWIDGET textview, UiText *text, CxList /* MDDocStyleSection */ *styles) {
+       
+}
+cxmutstr editor_get_markdown(UiText *text, const CxAllocator *a) {
+       return CX_NULLSTR;
+}
+void editor_insert_image_file(UiText *text, const char *filepath) {
+       
+}
+
+UiBool editor_set_style(UiText *text, const char *style, UiBool enabled) {
+       return 0;
+}
+void editor_set_paragraph_style(UiText *text, const char *style) {
+       
+}
+void editor_insert_list(UiText *text, UiBool ordered) {
+       
+}
\ No newline at end of file
index 19fdabd3bbdba3175ae4ff2774824ea04443e8b0..5c090e5d1681e04a4da07a370cfbec19fd0bdbc3 100644 (file)
@@ -35,6 +35,8 @@
 
 #include "../utils/strreplace.h"
 
+#include <stdio.h>
+#include <stdlib.h>
 #include <cx/array_list.h>
 
 static TextNoteParagraphStyles paragraph_styles[] = {
index 7946556623d2c435d3328e5384a6600bcfbea4fb..3f182dbfbf597718038a61cad5d57a9fe74e0f5a 100644 (file)
@@ -32,6 +32,9 @@
 #include "note.h"
 #include "editor.h"
 
+#include <stdio.h>
+#include <stdlib.h>
+
 #include <cx/printf.h>
 
 NotebookModel* notebookmodel_create() {
index 4059c6ee9146e882da4fd6b14f9478e4bd800afd..0f3e2b568720f5d580bb60faf7d02584db285af2 100644 (file)
@@ -36,6 +36,9 @@
 #include "attachment.h"
 #include "nbconfig.h"
 
+#include <stdio.h>
+#include <stdlib.h>
+
 #include <cx/array_list.h>
 #include <cx/hash_map.h>
 
index bab46c46c64938f74452d8a76a911a4311df06bc..edfe3ace039452626a391e48834480759e235916 100755 (executable)
--- a/configure
+++ b/configure
@@ -1051,7 +1051,8 @@ checkopt_toolkit_cocoa()
     fi
     cat >> "$TEMP_DIR/make.mk" << __EOF__
 TOOLKIT = cocoa
-APP_PLATFORM_SRC = cocoa-text.m
+APP_PLATFORM_OBJC_SRC = cocoa-text.m
+APP_PLATFORM_OBJC_SRC += cocoa-image.m
 __EOF__
     return 0
 }
index 12eb671d862b9f55570890e3222e12b29973f1f7..161540e4a6fa848e848ab74c26d491e113653bd0 100644 (file)
@@ -97,7 +97,7 @@ struct DBUClass {
      * value: DBUField*
      */
     CxMap *fields;
-    
+     
     /*
      * object fields
      * 
@@ -384,33 +384,47 @@ void dbuClassAddField(DBUClass *cls, const char *name, DBUField *field);
 void dbuClassAddFKField(DBUClass *cls, const char *name, DBUField *field, DBUClass *fkcls);
 void dbuClassAddObjField(DBUClass *cls, const char *name, DBUField *field, DBUClass *foreign_cls);
 
+#if !defined(__SIZEOF_LONG__) || __SIZEOF_LONG__ == 8
+#define dbuClassAddLong dbuClassAddInt64
+#define dbuClassAddULong dbuClassAddUInt64
+#define dbuClassAddLongFK dbuClassAddInt64FK
+#define dbuClassAddULongFK dbuClassAddUInt64FK
+#elif __SIZEOF_LONG__ == 4
+#define dbuClassAddLong dbuClassAddInt32
+#define dbuClassAddULong dbuClassAddUInt32
+#endif
+
 #define dbuClassAdd(cls, type, member) \
     dbuClassAddWithName(cls, type, member, #member)
 #define dbuClassAddWithName(cls, type, member, member_name) \
     _Generic(((type*)0)->member, \
-    int8_t:       dbuClassAddInt8,     \
-    uint8_t:      dbuClassAddUInt8,    \
-    int16_t:      dbuClassAddInt16,    \
-    uint16_t:     dbuClassAddUInt16,   \
-    int32_t:      dbuClassAddInt32,    \
-    uint32_t:     dbuClassAddUInt32,   \
-    int64_t:      dbuClassAddInt64,    \
-    uint64_t:     dbuClassAddUInt64,   \
-    bool:         dbuClassAddBool,     \
-    float:        dbuClassAddFloat,    \
-    double:       dbuClassAddDouble,   \
-    char*:        dbuClassAddString,   \
-    cxmutstr:     dbuClassAddCXMutStr) \
+    int8_t:             dbuClassAddInt8,     \
+    uint8_t:            dbuClassAddUInt8,    \
+    int16_t:            dbuClassAddInt16,    \
+    uint16_t:           dbuClassAddUInt16,   \
+    int32_t:            dbuClassAddInt32,    \
+    uint32_t:           dbuClassAddUInt32,   \
+    long:               dbuClassAddLong,     \
+    unsigned long:      dbuClassAddULong,    \
+    long long:          dbuClassAddInt64,    \
+    unsigned long long: dbuClassAddUInt64,   \
+    bool:               dbuClassAddBool,     \
+    float:              dbuClassAddFloat,    \
+    double:             dbuClassAddDouble,   \
+    char*:              dbuClassAddString,   \
+    cxmutstr:           dbuClassAddCXMutStr) \
     (cls, member_name, offsetof(type, member), 0)
 
 #define dbuClassAddForeignKey(cls, type, member, foreigncls) \
     _Generic(((type*)0)->member, \
-    int32_t:      dbuClassAddInt32FK,    \
-    uint32_t:     dbuClassAddUInt32FK,   \
-    int64_t:      dbuClassAddInt64FK,    \
-    uint64_t:     dbuClassAddUInt64FK,   \
-    char*:        dbuClassAddStringFK,   \
-    cxmutstr:     dbuClassAddCXMutStrFK) \
+    int32_t:            dbuClassAddInt32FK,    \
+    uint32_t:           dbuClassAddUInt32FK,   \
+    long:               dbuClassAddLongFK,     \
+    unsigned long:       dbuClassAddULongFK,   \
+    long long:          dbuClassAddInt64FK,    \
+    unsigned long long: dbuClassAddUInt64FK,   \
+    char*:              dbuClassAddStringFK,   \
+    cxmutstr:           dbuClassAddCXMutStrFK) \
     (cls, #member, offsetof(type, member), foreigncls, 0)
 
 void dbuClassAddInt(DBUClass *cls, const char *name, off_t offset, bool nonnull);
@@ -423,8 +437,6 @@ void dbuClassAddInt32(DBUClass *cls, const char *name, off_t offset, bool nonnul
 void dbuClassAddUInt32(DBUClass *cls, const char *name, off_t offset, bool nonnull);
 void dbuClassAddInt64(DBUClass *cls, const char *name, off_t offset, bool nonnull);
 void dbuClassAddUInt64(DBUClass *cls, const char *name, off_t offset, bool nonnull);
-void dbuClassAddSize(DBUClass *cls, const char *name, off_t offset, bool nonnull);
-void dbuClassAddSSize(DBUClass *cls, const char *name, off_t offset, bool nonnull);
 void dbuClassAddBool(DBUClass *cls, const char *name, off_t offset, bool nonnull);
 void dbuClassAddFloat(DBUClass *cls, const char *name, off_t offset, bool nonnull);
 void dbuClassAddDouble(DBUClass *cls, const char *name, off_t offset, bool nonnull);
index 55339b3402e943b6e9a9f2141b059fbb13c570c5..296f3216ceaea93da96646535337ca2c8812a97a 100644 (file)
@@ -85,7 +85,7 @@ CxJsonValue* dbuObjectToJson2(DBUClass *type, void *obj, const CxAllocator *a, b
             } else if(field->toObject) {
                 DBUObject child_obj = field->toObject(field, obj);
                 if(child_obj == NULL) {
-                    child = CX_JSON_NULL;
+                    child = cxJsonCreateLiteral(a, CX_JSON_NULL);
                 } else if(field->objType) {
                     child = dbuObjectToJson2(field->objType, child_obj, a, setNull, forceString);
                 }
index 6c3a7ad9f7dc92a5acbcb8fb7e44c5500cba1dbf..e5936ac46ea41df6ebd75f684d4e1f432c92a2fb 100644 (file)
@@ -153,7 +153,7 @@ CxList* dbuObjectBuilderGetValueList(DBUObjectBuilder *builder) {
 }
 
 int dbuObjectBuilderGetArray(DBUObjectBuilder *builder, void **array, size_t *size) {
-    
+    return 1;
 }
 
 void dbuObjectBuilderDestroy(DBUObjectBuilder *builder) {
index 9ba21b6c41f7a6118d5f30afe3d3096f403e0614..2e34e93c6b4eb25dd23fbdf09dc6ba1ff4e8af37 100644 (file)
                        <value str="cocoa">
                                <dependencies>cocoa</dependencies>
                                <make>TOOLKIT = cocoa</make>
-                               <make>APP_PLATFORM_SRC = cocoa-text.m</make>
+                               <make>APP_PLATFORM_OBJC_SRC = cocoa-text.m</make>
+                               <make>APP_PLATFORM_OBJC_SRC += cocoa-image.m</make>
                        </value>
                        <value str="qt5">
                                <dependencies>qt5</dependencies>
index 9bc86a44927ced04df40d59a9cfd3c62ab5ed490..6589cc9a2ddc68e7edc700d285290c269834f82f 100644 (file)
@@ -74,6 +74,25 @@ extern "C" {
 #define UI_ICON_GO_DOWN "" // TODO: implement workaround for missing down symbol
     
 #endif /* UI_WINUI */
+
+#ifdef UI_COCOA
+
+#define UI_ICON_HOME "NSImageNameHomeTemplate"
+#define UI_ICON_NEW_WINDOW ""
+#define UI_ICON_REFRESH "NSImageNameRefreshTemplate"
+#define UI_ICON_NEW_FOLDER ""
+#define UI_ICON_ADD "NSImageNameAddTemplate"
+#define UI_ICON_UPLOAD ""
+#define UI_ICON_SAVE_LOCAL ""
+#define UI_ICON_DELETE ""
+#define UI_ICON_DOCK_LEFT ""
+#define UI_ICON_DOCK_RIGHT ""
+#define UI_ICON_GO_BACK "NSImageNameGoLeftTemplate"
+#define UI_ICON_GO_FORWARD "NSImageNameGoRightTemplate"
+#define UI_ICON_GO_UP ""
+#define UI_ICON_GO_DOWN ""
+
+#endif /* UI_COCOA */
     
     
 UIEXPORT UiIcon* ui_icon(const char* name, size_t size);