shithub: microui

Download patch

ref: 6f5f943b97fd091996911d67ff0c862ee4c33fd7
parent: c988730f1b744ce3c7169da8794e4d8dbd4ee777
author: Sigrid Haflínudóttir <[email protected]>
date: Wed Jan 1 10:45:20 EST 2020

fix compilation on Plan 9; add "-D__plan9__ -p" to CFLAGS

--- a/src/microui.c
+++ b/src/microui.c
@@ -20,13 +20,23 @@
 ** IN THE SOFTWARE.
 */
 
+#ifdef __plan9__
+#include <u.h>
+#include <libc.h>
+#define unused USED
+#define NULL nil
+#define sprintf sprint
+#define vsnprintf vsnprint
+#define fprintf fprint
+#define stderr 2
+#else
 #include <stdio.h>
 #include <string.h>
+#define unused(x) ((void) (x))
+#endif
 
 #include "microui.h"
 
-#define unused(x) ((void) (x))
-
 #define expect(x) do {                                               \
     if (!(x)) {                                                      \
       fprintf(stderr, "Fatal error: %s:%d: assertion '%s' failed\n", \
@@ -554,7 +564,10 @@
     int type = layout->next_type;
     layout->next_type = 0;
     res = layout->next;
-    if (type == ABSOLUTE) { return (ctx->last_rect = res); }
+    if (type == ABSOLUTE) {
+      ctx->last_rect = res;
+      return res;
+    }
 
   } else {
     /* handle next row */
@@ -590,7 +603,8 @@
   layout->max.x = mu_max(layout->max.x, res.x + res.w);
   layout->max.y = mu_max(layout->max.y, res.y + res.h);
 
-  return (ctx->last_rect = res);
+  ctx->last_rect = res;
+  return res;
 }