xmfract: change openmotif to motif and bump revision

* Add a patch to fix the configure tests, and correct the collision
  between the cimag / creal globals and the C99 complex functions.
* Add a patch to enable xmfract to run on TrueColor visuals.
* Add a patch to fix declarations with implicit int type.
* Added -std=c99 for compatibility with newer compilers.
* Fix port linting nits.
This commit is contained in:
Tim Hentenaar
2026-04-28 11:56:11 -04:00
committed by Renee Otten
parent 3749e366a0
commit f2deb2ebac
4 changed files with 550 additions and 4 deletions
+9 -4
View File
@@ -2,8 +2,8 @@ PortSystem 1.0
name xmfract
version 1.4
revision 1
categories math
platforms darwin
license GPL-2+
maintainers nomaintainer
@@ -15,12 +15,16 @@ homepage https://web.archive.org/web/20170703184826/http://www.nahee.com/spanky/
master_sites https://ftp.gwdg.de/pub/x11/x.org/contrib/graphics/ \
freebsd
distname ${name}_${version}
checksums md5 59cf6bf04fcfdfea06b5f4d903e1152e
checksums rmd160 3efe2632f91ca71c34d4e40c299ee3749e6966f2 \
sha256 7019d9f2b538e5767e8932a27ccefc0fe32654cc6395cbb73067e939970df2a9 \
size 902716
depends_lib lib:libXm:openmotif
depends_lib lib:libXm:motif
patchfiles patch-all-Makefile.in.diff patch-src_window_size.c.diff \
patch-xmfract.ini.diff
patch-xmfract.ini.diff fix-c99-collisions.diff truecolor.diff \
implicit-int.diff
post-patch {
reinplace "s|@PREFIX@|${prefix}|" ${worksrcpath}/xmfract.ini
}
@@ -28,6 +32,7 @@ post-patch {
configure.args --x-includes=${prefix}/include \
--x-libraries=${prefix}/lib \
--with-editres
configure.cflags-append -std=c99
post-destroot {
xinstall -m 644 -v -W ${worksrcpath} README Xmfract.ad xmfract.ini \
+105
View File
@@ -0,0 +1,105 @@
--- configure 1995-06-20 11:46:54.000000000 -0400
+++ configure 2026-04-29 21:23:17.000000000 -0400
@@ -1539,7 +1539,7 @@
cat > conftest.$ac_ext <<EOF
#line 1541 "configure"
#include "confdefs.h"
-main(){return(0);}
+int main(){return(0);}
EOF
eval $ac_link
if test -s conftest && (./conftest; exit) 2>/dev/null; then
@@ -1621,6 +1621,7 @@
cat > conftest.$ac_ext <<EOF
#line 1623 "configure"
#include "confdefs.h"
+#include <stdlib.h>
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
@@ -1770,7 +1771,7 @@
int main() { return 0; }
int t() {
-} $ac_kw foo() {
+} $ac_kw int foo() {
; return 0; }
EOF
if eval $ac_compile; then
@@ -1936,8 +1937,10 @@
cat > conftest.$ac_ext <<EOF
#line 1938 "configure"
#include "confdefs.h"
+#include <stdlib.h>
+#include <string.h>
-main()
+int main(void)
{
char c0 = 0x40, c1 = 0x80, c2 = 0x81;
exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
--- src/calcfracinit.c 2026-04-29 20:49:59.000000000 -0400
+++ src/calcfracinit.c 2026-04-29 22:11:46.000000000 -0400
@@ -189,8 +189,8 @@
if(fractype != CELLULAR)
{
/* integer equivs for it all */
- creal = fudgetolong(param[0]);
- cimag = fudgetolong(param[1]);
+ lcreal = fudgetolong(param[0]);
+ lcimag = fudgetolong(param[1]);
xmin = fudgetolong(xxmin);
xmax = fudgetolong(xxmax);
x3rd = fudgetolong(xx3rd);
--- src/globals.c 2026-04-29 20:49:59.000000000 -0400
+++ src/globals.c 2026-04-29 22:11:10.000000000 -0400
@@ -541,9 +541,9 @@
long ListFront;
long ListSize;
long calctime;
-long cimag;
+long lcimag;
long con;
-long creal;
+long lcreal;
long delmin;
long delx;
long dely;
--- src/globals.h 2026-04-29 20:49:59.000000000 -0400
+++ src/globals.h 2026-04-29 22:10:42.000000000 -0400
@@ -544,9 +544,9 @@
extern long ListFront;
extern long ListSize;
extern long calctime;
-extern long cimag;
+extern long lcimag;
extern long con;
-extern long creal;
+extern long lcreal;
extern long delmin;
extern long delx;
extern long dely;
--- src/prototyp.h 2026-04-29 20:49:59.000000000 -0400
+++ src/prototyp.h 2026-04-29 20:54:59.000000000 -0400
@@ -901,7 +901,7 @@
(Widget w, XtPointer client_data, XtPointer call_data);
/* xmfract.c */
-extern void main(int argc, char **argv);
+extern int main(int argc, char **argv);
extern void delay_display_authors_window
(XtPointer client_data, XtIntervalId Id);
extern void delay_display_disclaimer
diff -ru src/xmfract.c xmfract_1.4/src/xmfract.c
--- src/xmfract.c 2026-04-29 20:49:59.000000000 -0400
+++ src/xmfract.c 2026-04-29 20:55:25.000000000 -0400
@@ -20,8 +20,7 @@
NULL
};
-void
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
int n;
long xmversion;
+35
View File
@@ -0,0 +1,35 @@
--- src/decomposition.c 1995-06-20 11:46:59
+++ src/decomposition.c 2026-05-01 02:53:57
@@ -41,7 +41,7 @@
static long ltan2_8125 ; /* tan 2.8125 degrees */
static long ltan1_4063 ; /* tan 1.4063 degrees */
- static reset_fudge = -1;
+ static int reset_fudge = -1;
int temp = 0;
int i;
--- src/fractals.c 1995-06-20 11:47:02
+++ src/fractals.c 2026-05-01 02:54:32
@@ -1733,7 +1733,7 @@
register int col;
for (col = 0; col <= ixstop; col++) /* look at each point on screen */
{
- register color;
+ register int color;
init.y = dy0[row]+dy1[col];
init.x = dx0[col]+dx1[row];
if(check_key() != 0)
--- src/jiim.c 1995-06-20 11:47:04
+++ src/jiim.c 2026-05-01 02:53:45
@@ -48,8 +48,8 @@
static float luckyy = 0;
static int cursx;
static int cursy;
-static oldrootx = 0;
-static oldrooty = 0;
+static int oldrootx = 0;
+static int oldrooty = 0;
static int oldmyx = 0;
static int oldmyy = 0;
static int warned = 0;
+401
View File
@@ -0,0 +1,401 @@
--- src/coloredit.c 1995-06-20 11:46:59.000000000 -0400
+++ src/coloredit.c 2026-04-30 02:19:50.000000000 -0400
@@ -2736,7 +2736,9 @@
cols[n].blue = dacbox[n][2] * 256;
cols[n].green = dacbox[n][1] * 256;
- XStoreColor(display, colormap, &cols[n]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[n]);
+ else pixtab[n] = (dacbox[n][0] << 16) | (dacbox[n][1] << 8) | dacbox[n][2];
paledit.palette_colorbox_rect[n].intred = (int)cols[n].red / 256;
paledit.palette_colorbox_rect[n].intblue = (int)cols[n].blue / 256;
@@ -2781,7 +2783,9 @@
cols[n].blue = dacbox[n][2] * 256;
cols[n].green = dacbox[n][1] * 256;
- XStoreColor(display, colormap, &cols[n]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[n]);
+ else pixtab[n] = (dacbox[n][0] << 16) | (dacbox[n][1] << 8) | dacbox[n][2];
paledit.palette_colorbox_rect[n].intred =
(int)cols[n].red / 256;
@@ -2835,7 +2839,9 @@
cols[n].blue = dacbox[n][2] * 256;
cols[n].green = dacbox[n][1] * 256;
- XStoreColor(display, colormap, &cols[n]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[n]);
+ else pixtab[n] = (dacbox[n][0] << 16) | (dacbox[n][1] << 8) | dacbox[n][2];
paledit.palette_colorbox_rect[n].intred =
(int)cols[n].red / 256;
@@ -2944,8 +2950,15 @@
cols[paledit.active_color_register_color].green =
dacbox[paledit.active_color_register_color][1] * 256;
- XStoreColor(display, colormap,
- &cols[paledit.active_color_register_color]);
+ if (colormap) {
+ XStoreColor(display, colormap,
+ &cols[paledit.active_color_register_color]);
+ } else {
+ pixtab[paledit.active_color_register_color] =
+ (dacbox[paledit.active_color_register_color][0] << 16) |
+ (dacbox[paledit.active_color_register_color][1] << 8) |
+ dacbox[paledit.active_color_register_color][2];
+ }
change_xor_gc(0);
@@ -2992,8 +3005,15 @@
cols[paledit.active_color_register_color].green =
dacbox[paledit.active_color_register_color][1] * 256;
- XStoreColor(display, colormap,
- &cols[paledit.active_color_register_color]);
+ if (colormap) {
+ XStoreColor(display, colormap,
+ &cols[paledit.active_color_register_color]);
+ } else {
+ pixtab[paledit.active_color_register_color] =
+ (dacbox[paledit.active_color_register_color][0] << 16) |
+ (dacbox[paledit.active_color_register_color][1] << 8) |
+ dacbox[paledit.active_color_register_color][2];
+ }
change_xor_gc(0);
@@ -3212,8 +3232,15 @@
cols[paledit.active_color_register_color].green =
dacbox[paledit.active_color_register_color][1] * 256;
- XStoreColor(display, colormap,
- &cols[paledit.active_color_register_color]);
+ if (colormap) {
+ XStoreColor(display, colormap,
+ &cols[paledit.active_color_register_color]);
+ } else {
+ pixtab[paledit.active_color_register_color] =
+ (dacbox[paledit.active_color_register_color][0] << 16) |
+ (dacbox[paledit.active_color_register_color][1] << 8) |
+ dacbox[paledit.active_color_register_color][2];
+ }
i = paledit.active_color_register_color;
@@ -3329,7 +3356,9 @@
cols[i].blue = dacbox[i][2] * 256;
cols[i].green = dacbox[i][1] * 256;
- XStoreColor(display, colormap, &cols[i]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[i]);
+ else pixtab[i] = (dacbox[i][0] << 16) | (dacbox[i][1] << 8) | dacbox[i][2];
paledit.palette_colorbox_rect[i].red = dacbox[i][0];
paledit.palette_colorbox_rect[i].blue = dacbox[i][2];
@@ -3402,7 +3431,9 @@
cols[i].blue = dacbox[i][2] * 256;
cols[i].green = dacbox[i][1] * 256;
- XStoreColor(display, colormap, &cols[i]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[i]);
+ else pixtab[i] = (dacbox[i][0] << 16) | (dacbox[i][1] << 8) | dacbox[i][2];
paledit.palette_colorbox_rect[i].red = dacbox[i][0];
paledit.palette_colorbox_rect[i].blue = dacbox[i][2];
@@ -3519,7 +3550,9 @@
cols[i].blue = dacbox[i][2] * 256;
cols[i].green = dacbox[i][1] * 256;
- XStoreColor(display, colormap, &cols[i]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[i]);
+ else pixtab[i] = (dacbox[i][0] << 16) | (dacbox[i][1] << 8) | dacbox[i][2];
paledit.palette_colorbox_rect[i].red = dacbox[i][0];
paledit.palette_colorbox_rect[i].blue = dacbox[i][2];
@@ -3572,7 +3605,9 @@
cols[i].blue = dacbox[i][2] * 256;
cols[i].green = dacbox[i][1] * 256;
- XStoreColor(display, colormap, &cols[i]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[i]);
+ else pixtab[i] = (dacbox[i][0] << 16) | (dacbox[i][1] << 8) | dacbox[i][2];
paledit.palette_colorbox_rect[i].red = dacbox[i][0];
paledit.palette_colorbox_rect[i].blue = dacbox[i][2];
@@ -3607,7 +3642,9 @@
cols[i].blue = dacbox[i][2] * 256;
cols[i].green = dacbox[i][1] * 256;
- XStoreColor(display, colormap, &cols[i]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[i]);
+ else pixtab[i] = (dacbox[i][0] << 16) | (dacbox[i][1] << 8) | dacbox[i][2];
paledit.palette_colorbox_rect[i].red = dacbox[i][0];
paledit.palette_colorbox_rect[i].blue = dacbox[i][2];
@@ -3685,7 +3722,9 @@
cols[oldcolor].blue = dacbox[oldcolor][2] * 256;
cols[oldcolor].green = dacbox[oldcolor][1] * 256;
- XStoreColor(display, colormap, &cols[oldcolor]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[oldcolor]);
+ else pixtab[oldcolor] = (dacbox[oldcolor][0] << 16) | (dacbox[oldcolor][1] << 8) | dacbox[oldcolor][2];
change_xor_gc(0);
update_undo_index();
@@ -3751,7 +3790,9 @@
cols[oldcolor].blue = dacbox[oldcolor][2] * 256;
cols[oldcolor].green = dacbox[oldcolor][1] * 256;
- XStoreColor(display, colormap, &cols[oldcolor]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[oldcolor]);
+ else pixtab[oldcolor] = (dacbox[oldcolor][0] << 16) | (dacbox[oldcolor][1] << 8) | dacbox[oldcolor][2];
change_xor_gc(0);
update_undo_index();
@@ -3871,7 +3912,9 @@
cols[n].blue = dacbox[n][2] * 256;
cols[n].green = dacbox[n][1] * 256;
- XStoreColor(display, colormap, &cols[n]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[n]);
+ else pixtab[n] = (dacbox[n][0] << 16) | (dacbox[n][1] << 8) | dacbox[n][2];
paledit.palette_colorbox_rect[n].intred = (int)cols[n].red / 256;
paledit.palette_colorbox_rect[n].intblue = (int)cols[n].blue / 256;
@@ -3948,7 +3991,9 @@
cols[n].blue = dacbox[n][2] * 256;
cols[n].green = dacbox[n][1] * 256;
- XStoreColor(display, colormap, &cols[n]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[n]);
+ else pixtab[n] = (dacbox[n][0] << 16) | (dacbox[n][1] << 8) | dacbox[n][2];
paledit.palette_colorbox_rect[n].intred = (int)cols[n].red / 256;
paledit.palette_colorbox_rect[n].intblue = (int)cols[n].blue / 256;
@@ -4460,7 +4505,9 @@
cols[i].blue = dacbox[i][2] * 256;
cols[i].green = dacbox[i][1] * 256;
- XStoreColor(display, colormap, &cols[i]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[i]);
+ else pixtab[i] = (dacbox[i][0] << 16) | (dacbox[i][1] << 8) | dacbox[i][2];
paledit.palette_colorbox_rect[i].red = dacbox[i][0];
paledit.palette_colorbox_rect[i].blue = dacbox[i][2];
@@ -4565,7 +4612,9 @@
cols[i].blue = dacbox[i][2] * 256;
cols[i].green = dacbox[i][1] * 256;
- XStoreColor(display, colormap, &cols[i]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[i]);
+ else pixtab[i] = (dacbox[i][0] << 16) | (dacbox[i][1] << 8) | dacbox[i][2];
paledit.palette_colorbox_rect[i].red = dacbox[i][0];
paledit.palette_colorbox_rect[i].blue = dacbox[i][2];
@@ -5775,7 +5824,13 @@
cols[freestyle.color].blue = dacbox[freestyle.color][2] * 256;
cols[freestyle.color].green = dacbox[freestyle.color][1] * 256;
- XStoreColor(display, colormap, &cols[freestyle.color]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[freestyle.color]);
+ else {
+ pixtab[freestyle.color] = (dacbox[freestyle.color][0] << 16) |
+ (dacbox[freestyle.color][1] << 8) |
+ dacbox[freestyle.color][2];
+ }
paledit.palette_colorbox_rect[freestyle.color].red =
dacbox[freestyle.color][0];
@@ -6138,7 +6193,10 @@
cols[n].red = dacbox[n][0] * 256;
cols[n].blue = dacbox[n][2] * 256;
cols[n].green = dacbox[n][1] * 256;
- XStoreColor(display, colormap, &cols[n]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[n]);
+ else pixtab[n] = (dacbox[n][0] << 16) | (dacbox[n][1] << 8) | dacbox[n][2];
+
paledit.palette_colorbox_rect[n].intred =
(int)cols[n].red / 256;
paledit.palette_colorbox_rect[n].intblue =
--- src/file_menu.c 1995-06-20 11:47:00.000000000 -0400
+++ src/file_menu.c 2026-04-30 02:10:14.000000000 -0400
@@ -884,7 +884,7 @@
{
XSetWindowAttributes winattrs;
int backing_store;
- char msg[128];
+ char msg[256];
int ret;
if(editpal_cursor != 0)
--- src/globals.c 2026-04-30 02:09:18.000000000 -0400
+++ src/globals.c 2026-04-30 02:10:14.000000000 -0400
@@ -477,6 +477,7 @@
int slides;
int soundflag;
int started_resaves;
+int staticcolormap;
int sxdots;
int sxoffs;
int sydots;
--- src/globals.h 2026-04-30 02:09:18.000000000 -0400
+++ src/globals.h 2026-04-30 02:10:14.000000000 -0400
@@ -480,6 +480,7 @@
extern int slides;
extern int soundflag;
extern int started_resaves;
+extern int staticcolormap;
extern int sxdots;
extern int sxoffs;
extern int sydots;
--- src/init_data.c 1995-06-20 11:47:04.000000000 -0400
+++ src/init_data.c 2026-04-30 02:10:14.000000000 -0400
@@ -312,12 +312,14 @@
videotable[1].ydots = 0;
videotable[1].colors = 0;
+ colormap = None;
switch(visual->class)
{
case DirectColor:
case PseudoColor:
case GrayScale:
gotrealdac=1;
+ staticcolormap=0;
break;
case TrueColor:
@@ -325,6 +327,7 @@
case StaticGray:
default:
gotrealdac=0;
+ staticcolormap=1;
break;
}
--- src/resize_window.c 1995-06-20 11:47:09.000000000 -0400
+++ src/resize_window.c 2026-04-30 02:10:14.000000000 -0400
@@ -63,7 +63,7 @@
image = XCreateImage(display,
visual,
XDefaultDepth(display, screen_number),
- ZPixmap, 0, NULL, sxdots, sydots, 8, xdots);
+ ZPixmap, 0, NULL, sxdots, sydots, 32, xdots << 2);
if (image == NULL)
{
--- src/rotate.c 1995-06-20 11:47:09.000000000 -0400
+++ src/rotate.c 2026-04-30 02:10:14.000000000 -0400
@@ -538,7 +538,8 @@
cols[n].blue = dacbox[n][2] * 256;
cols[n].green = dacbox[n][1] * 256;
- XStoreColor(display, colormap, &cols[n]);
+ if (colormap)
+ XStoreColor(display, colormap, &cols[n]);
}
spindac(0, 0);
}
--- src/util.c 1995-06-20 11:47:13.000000000 -0400
+++ src/util.c 2026-04-30 02:10:14.000000000 -0400
@@ -1431,7 +1431,7 @@
image = XCreateImage(display,
visual,
XDefaultDepth(display, screen_number),
- ZPixmap, 0, NULL, sxdots, sydots, 8, xdots);
+ ZPixmap, 0, NULL, sxdots, sydots, 32, xdots << 2);
if (image == NULL)
{
--- src/video.c 1995-06-20 11:47:13.000000000 -0400
+++ src/video.c 2026-04-30 02:38:27.000000000 -0400
@@ -164,7 +164,17 @@
int readvideo(int x, int y)
{
- return ipixtab[XGetPixel(image, x, y)];
+ unsigned int i = 0;
+ Pixel p = XGetPixel(image, x, y);
+
+ if (colormap)
+ return ipixtab[p & 0xff];
+
+ for (i = 0; i < 256; i++) {
+ if (p == pixtab[i])
+ return ipixtab[i];
+ }
+ return 0;
}
void
@@ -224,6 +234,18 @@
{
int i;
+ if (usepixtab && !colormap) {
+ for (i = 0; i < 256; i++) {
+ cols[i].pixel = pixtab[i] = (dacbox[i][0] << 16) |
+ (dacbox[i][1] << 8) |
+ dacbox[i][2];
+ cols[i].red = dacbox[i][0] * 256;
+ cols[i].green = dacbox[i][1] * 256;
+ cols[i].blue = dacbox[i][2] * 256;
+ }
+ return 0;
+ }
+
if (!gotrealdac)
return -1;
@@ -236,9 +258,10 @@
cols[i].blue = dacbox[i][2] * 256;
}
- XStoreColors(display, colormap, cols, colors);
-
- XFlush(display);
+ if (colormap) {
+ XStoreColors(display, colormap, cols, colors);
+ XFlush(display);
+ }
return 0;
}
@@ -277,7 +300,10 @@
ipixtab[i] = 999;
}
- if (!gotrealdac)
+ if (staticcolormap) {
+ gotrealdac = 0;
+ usepixtab = 1;
+ } else if (!gotrealdac)
{
colors = 2;
}
@@ -285,6 +311,7 @@
{
colors = 256;
gotrealdac = 0;
+ sharecolor = 1;
}
else if (privatecolor)
{