[packages/ocaml-lablgl] - up to 1.07 - add fixes from fedora

baggins baggins at pld-linux.org
Sat Apr 25 10:03:55 CEST 2026


commit 6266491f892f480071046a1ceb07813aefd92bd9
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sat Apr 25 12:03:31 2026 +0200

    - up to 1.07
    - add fixes from fedora

 0001-Avoid-possible-use-after-free-in-Togl.patch   |  32 ++
 0002-Fix-mismatched-pointer-types-for-GCC-14.patch |  31 ++
 ...nore-file-to-ignore-various-generated-fil.patch |  43 ++
 0004-Update-Tk-code-for-OCaml-5.patch              |  81 ++++
 0005-Togl-Remove-useless-definition-of-NULL.patch  |  27 ++
 0006-Togl-Remove-use-of-some-Tcl-Tk-macros.patch   | 441 +++++++++++++++++++++
 ocaml-lablgl.spec                                  |  27 +-
 7 files changed, 679 insertions(+), 3 deletions(-)
---
diff --git a/ocaml-lablgl.spec b/ocaml-lablgl.spec
index 60811cb..9231898 100644
--- a/ocaml-lablgl.spec
+++ b/ocaml-lablgl.spec
@@ -15,13 +15,28 @@
 Summary:	OpenGL binding for OCaml
 Summary(pl.UTF-8):	Wiązania OpenGL dla OCamla
 Name:		ocaml-lablgl
-Version:	1.06
-Release:	3
+Version:	1.07
+Release:	1
 License:	BSD
 Group:		Libraries
 #Source0Download: https://github.com/garrigue/lablgl/releases
 Source0:	https://github.com/garrigue/lablgl/archive/v%{version}/lablgl-%{version}.tar.gz
-# Source0-md5:	8ee7a37b016095c4f7cd066f0ebd4436
+# Source0-md5:	5345199a125069371ef3fc859c55cc43
+# Fix a use-after-free bug
+# https://github.com/garrigue/lablgl/pull/5
+Patch0:		0001-Avoid-possible-use-after-free-in-Togl.patch
+# Fix a build error with the Modern C initiative
+# https://github.com/garrigue/lablgl/pull/6
+Patch1:		0002-Fix-mismatched-pointer-types-for-GCC-14.patch
+# https://github.com/garrigue/lablgl/pull/11
+Patch2:		0003-Add-a-gitignore-file-to-ignore-various-generated-fil.patch
+# Adapt to OCaml 5
+# https://github.com/garrigue/lablgl/pull/10
+Patch3:		0004-Update-Tk-code-for-OCaml-5.patch
+# Fix for Tcl/Tk 9.0
+# https://github.com/garrigue/lablgl/pull/12
+Patch4:		0005-Togl-Remove-useless-definition-of-NULL.patch
+Patch5:		0006-Togl-Remove-use-of-some-Tcl-Tk-macros.patch
 URL:		http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgl.html
 BuildRequires:	OpenGL-GLX-devel
 BuildRequires:	OpenGL-glut-devel >= 3.7
@@ -164,6 +179,12 @@ Pakiet ten zawiera system interaktywny OCamla skonsolidowany z lablgl.
 
 %prep
 %setup -q -n lablgl-%{version}
+%patch -P0 -p1
+%patch -P1 -p1
+%patch -P2 -p1
+%patch -P3 -p1
+%patch -P4 -p1
+%patch -P5 -p1
 
 find LablGlut/examples -name '*.ml' -print0 | xargs --null \
 	%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+lablglut(\s|$),#!%{_bindir}/lablglut\1,' \
diff --git a/0001-Avoid-possible-use-after-free-in-Togl.patch b/0001-Avoid-possible-use-after-free-in-Togl.patch
new file mode 100644
index 0000000..f40a2b5
--- /dev/null
+++ b/0001-Avoid-possible-use-after-free-in-Togl.patch
@@ -0,0 +1,32 @@
+From ac8e5b6ac6a99b7b086e27b5881cd7bb79d3df65 Mon Sep 17 00:00:00 2001
+From: Jerry James <loganjerry at gmail.com>
+Date: Thu, 29 Jun 2023 16:16:46 -0600
+Subject: [PATCH 1/8] Avoid possible use-after-free in Togl
+
+---
+ Togl/src/Togl/togl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Togl/src/Togl/togl.c b/Togl/src/Togl/togl.c
+index 0b71b99..0fbcd15 100644
+--- a/Togl/src/Togl/togl.c
++++ b/Togl/src/Togl/togl.c
+@@ -2780,7 +2780,6 @@ noFaultXAllocColor(Display *dpy, Colormap cmap, int cmapSize,
+     subColor.red = ctable[bestmatch].red;
+     subColor.green = ctable[bestmatch].green;
+     subColor.blue = ctable[bestmatch].blue;
+-    free(ctable);
+     /* Try to allocate the closest match color.  This should only fail if the
+      * cell is read/write.  Otherwise, we're incrementing the cell's reference
+      * count. */
+@@ -2792,6 +2791,7 @@ noFaultXAllocColor(Display *dpy, Colormap cmap, int cmapSize,
+         subColor.blue = ctable[bestmatch].blue;
+         subColor.flags = DoRed | DoGreen | DoBlue;
+     }
++    free(ctable);
+     *color = subColor;
+ }
+ 
+-- 
+2.48.1
+
diff --git a/0002-Fix-mismatched-pointer-types-for-GCC-14.patch b/0002-Fix-mismatched-pointer-types-for-GCC-14.patch
new file mode 100644
index 0000000..2a20497
--- /dev/null
+++ b/0002-Fix-mismatched-pointer-types-for-GCC-14.patch
@@ -0,0 +1,31 @@
+From 676e27de229569063732da26ce5c7f0c88366891 Mon Sep 17 00:00:00 2001
+From: Jerry James <loganjerry at gmail.com>
+Date: Fri, 1 Dec 2023 13:39:05 -0700
+Subject: [PATCH 2/8] Fix mismatched pointer types for GCC 14
+
+---
+ Togl/src/Togl/togl.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/Togl/src/Togl/togl.c b/Togl/src/Togl/togl.c
+index 0fbcd15..e2f5134 100644
+--- a/Togl/src/Togl/togl.c
++++ b/Togl/src/Togl/togl.c
+@@ -95,9 +95,14 @@
+ #  define HAVE_TK_SETCLASSPROCS
+ /* pointer to Tk_SetClassProcs function in the stub table */
+ 
++#if TK_MAJOR_VERSION > 8 || (TK_MAJOR_VERSION == 8 && TK_MINOR_VERSION >= 6)
++static void (*SetClassProcsPtr)
++        _ANSI_ARGS_((Tk_Window, const Tk_ClassProcs *, ClientData));
++#else
+ static void (*SetClassProcsPtr)
+         _ANSI_ARGS_((Tk_Window, Tk_ClassProcs *, ClientData));
+ #endif
++#endif
+ 
+ /* 
+  * Copy of TkClassProcs declarations form tkInt.h
+-- 
+2.48.1
+
diff --git a/0003-Add-a-gitignore-file-to-ignore-various-generated-fil.patch b/0003-Add-a-gitignore-file-to-ignore-various-generated-fil.patch
new file mode 100644
index 0000000..b619090
--- /dev/null
+++ b/0003-Add-a-gitignore-file-to-ignore-various-generated-fil.patch
@@ -0,0 +1,43 @@
+From 882a6547dd032cce66d00f464c60c074103a5b8e Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Mon, 17 Feb 2025 09:59:28 +0000
+Subject: [PATCH 3/8] Add a gitignore file to ignore various generated files
+
+---
+ .gitignore | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+ create mode 100644 .gitignore
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..f4db3c0
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,24 @@
++*~
++*.cmi
++*.cmo
++*.cmx
++*.cma
++*.cmxa
++*.o
++*.so
++*.a
++
++/Makefile.config
++/LablGlut/src/lablglut
++/LablGlut/src/lablgluttop
++/Togl/src/lablgl
++/Togl/src/lablgltop
++/Togl/src/togl_tags.c
++/Togl/src/togl_tags.h
++/src/gl_tags.c
++/src/gl_tags.h
++/src/glu_tags.c
++/src/glu_tags.h
++/src/raw_tags.h
++/src/var2def
++/src/var2switch
+-- 
+2.48.1
+
diff --git a/0004-Update-Tk-code-for-OCaml-5.patch b/0004-Update-Tk-code-for-OCaml-5.patch
new file mode 100644
index 0000000..dc68058
--- /dev/null
+++ b/0004-Update-Tk-code-for-OCaml-5.patch
@@ -0,0 +1,81 @@
+From c42edbcfb5b275388b02d23ca24e928d52dd69b1 Mon Sep 17 00:00:00 2001
+From: Jerry James <loganjerry at gmail.com>
+Date: Mon, 17 Feb 2025 09:55:14 +0000
+Subject: [PATCH 4/8] Update Tk code for OCaml 5
+
+---
+ Togl/src/ml_togl.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/Togl/src/ml_togl.c b/Togl/src/ml_togl.c
+index 2f833db..a197c36 100644
+--- a/Togl/src/ml_togl.c
++++ b/Togl/src/ml_togl.c
+@@ -31,13 +31,13 @@ int TOGLenum_val(value tag)
+     {
+ #include "togl_tags.c"
+     }
+-    invalid_argument ("Unknown Togl tag");
++    caml_invalid_argument ("Unknown Togl tag");
+ }
+ 
+ /* Avoid direct use of stderr */
+ void togl_prerr(const char *msg)
+ {
+-    value ml_msg = copy_string(msg);
++    value ml_msg = caml_copy_string(msg);
+     value *prerr = caml_named_value("togl_prerr");
+     if (!prerr) caml_failwith(msg);
+     caml_callback_exn(*prerr, ml_msg);
+@@ -49,7 +49,7 @@ CAMLprim value ml_Togl_Init (value unit)  /* ML */
+     Tcl_Interp *cltclinterp =
+       (interp ? (Tcl_Interp *) Nativeint_val(Field(*interp,0)) : NULL);
+     if (cltclinterp == NULL || Togl_Init(cltclinterp) == TCL_ERROR)
+-      raise_with_string(*caml_named_value("tkerror"), "Togl_Init failed");
++      caml_raise_with_string(*caml_named_value("tkerror"), "Togl_Init failed");
+     return Val_unit;
+ }
+ 
+@@ -77,10 +77,10 @@ static value *callbacks = NULL;
+ 
+ #define CALLBACK(func) \
+ static void callback_##func (struct Togl *togl) \
+-{ callback (Field(*callbacks, func), Val_addr(togl)); }
++{ caml_callback (Field(*callbacks, func), Val_addr(togl)); }
+ #define CALLBACK_const(func) \
+ static void callback_##func (const struct Togl *togl) \
+-{ callback (Field(*callbacks, func), Val_addr(togl)); }
++{ caml_callback (Field(*callbacks, func), Val_addr(togl)); }
+ 
+ #define ENABLER(func) \
+ CAMLprim value ml_Togl_##func (value unit) \
+@@ -106,7 +106,7 @@ ENABLER (OverlayDisplayFunc)
+ ML_0 (Togl_ResetDefaultCallbacks)
+ ML_1 (Togl_PostRedisplay, Addr_val)
+ ML_1 (Togl_SwapBuffers, Addr_val)
+-ML_1_ (Togl_Ident, Addr_val, copy_string)
++ML_1_ (Togl_Ident, Addr_val, caml_copy_string)
+ ML_1_ (Togl_Width, Addr_val, Val_int)
+ ML_1_ (Togl_Height, Addr_val, Val_int)
+ 
+@@ -131,7 +131,7 @@ ML_2 (Togl_UnloadBitmapFont, Addr_val, Int_val)
+ ML_2 (Togl_UseLayer, Addr_val, TOGLenum_val)
+ #ifdef _WIN32
+ CAMLprim value ml_Togl_ShowOverlay(value v)
+-{ invalid_argument("Togl_ShowOverlay: not implemented"); return Val_unit; }
++{ caml_invalid_argument("Togl_ShowOverlay: not implemented"); return Val_unit; }
+ #else
+ ML_1 (Togl_ShowOverlay, Addr_val)
+ #endif
+@@ -146,7 +146,7 @@ CAMLprim value ml_Togl_DumpToEpsFile (value togl, value filename, value rgb)
+     if (Togl_DumpToEpsFile(Addr_val(togl), String_val(filename),
+ 			   Int_val(rgb), callback_RenderFunc)
+ 	== TCL_ERROR)
+-        raise_with_string(*caml_named_value("tkerror"),
++        caml_raise_with_string(*caml_named_value("tkerror"),
+                           "Dump to EPS file failed");
+     return Val_unit;
+ }
+-- 
+2.48.1
+
diff --git a/0005-Togl-Remove-useless-definition-of-NULL.patch b/0005-Togl-Remove-useless-definition-of-NULL.patch
new file mode 100644
index 0000000..717fff7
--- /dev/null
+++ b/0005-Togl-Remove-useless-definition-of-NULL.patch
@@ -0,0 +1,27 @@
+From 9fe3b86c0e7ff9db55bf722f30637f2b1550288d Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Mon, 17 Feb 2025 10:14:02 +0000
+Subject: [PATCH 5/8] Togl: Remove useless definition of NULL
+
+---
+ Togl/src/Togl/togl.h | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/Togl/src/Togl/togl.h b/Togl/src/Togl/togl.h
+index 35e4043..6726a6e 100644
+--- a/Togl/src/Togl/togl.h
++++ b/Togl/src/Togl/togl.h
+@@ -63,10 +63,6 @@
+ #    define CONST84
+ #  endif
+ 
+-#  ifndef NULL
+-#    define NULL 0
+-#  endif
+-
+ #  ifndef TOGL_USE_FONTS
+ #    define TOGL_USE_FONTS 1    /* needed for demos */
+ #  endif
+-- 
+2.48.1
+
diff --git a/0006-Togl-Remove-use-of-some-Tcl-Tk-macros.patch b/0006-Togl-Remove-use-of-some-Tcl-Tk-macros.patch
new file mode 100644
index 0000000..968fc0f
--- /dev/null
+++ b/0006-Togl-Remove-use-of-some-Tcl-Tk-macros.patch
@@ -0,0 +1,441 @@
+From a6bf8ef491141af542281e7bb5ff94543c8dde17 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Mon, 17 Feb 2025 10:07:56 +0000
+Subject: [PATCH 6/8] Togl: Remove use of some Tcl/Tk macros
+
+All of these macros were removed from header files in Tcl/Tk 9.0.
+
+* Erase _ANSI_ARGS_, no compiler has needed this for about 35 years.
+
+* Replace Tk_Offset with offsetof.  Apparently some compilers lacked
+  this, but none that we care about.
+
+* Replace CONST84 with const.
+---
+ Togl/src/Togl/double.c  |  4 +-
+ Togl/src/Togl/gears.c   |  4 +-
+ Togl/src/Togl/stereo.c  | 10 ++---
+ Togl/src/Togl/texture.c | 22 +++++------
+ Togl/src/Togl/togl.c    | 81 ++++++++++++++++++++---------------------
+ Togl/src/Togl/togl.h    |  6 +--
+ 6 files changed, 61 insertions(+), 66 deletions(-)
+
+diff --git a/Togl/src/Togl/double.c b/Togl/src/Togl/double.c
+index ba07257..4e218f8 100644
+--- a/Togl/src/Togl/double.c
++++ b/Togl/src/Togl/double.c
+@@ -153,7 +153,7 @@ display_cb(Togl *togl)
+ 
+ 
+ int
+-setXrot_cb(Togl *togl, int argc, CONST84 char *argv[])
++setXrot_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -187,7 +187,7 @@ setXrot_cb(Togl *togl, int argc, CONST84 char *argv[])
+ 
+ 
+ int
+-setYrot_cb(Togl *togl, int argc, CONST84 char *argv[])
++setYrot_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+diff --git a/Togl/src/Togl/gears.c b/Togl/src/Togl/gears.c
+index 9999a72..2d5657b 100644
+--- a/Togl/src/Togl/gears.c
++++ b/Togl/src/Togl/gears.c
+@@ -322,7 +322,7 @@ init(Togl *togl)
+ }
+ 
+ int
+-position(Togl *togl, int argc, CONST84 char *argv[])
++position(Togl *togl, int argc, const char *argv[])
+ {
+     struct WHIRLYGIZMO *Wg;
+     Tcl_Interp *interp = Togl_Interp(togl);
+@@ -344,7 +344,7 @@ position(Togl *togl, int argc, CONST84 char *argv[])
+ }
+ 
+ int
+-rotate(Togl *togl, int argc, CONST84 char *argv[])
++rotate(Togl *togl, int argc, const char *argv[])
+ {
+     struct WHIRLYGIZMO *Wg;
+     Tcl_Interp *interp = Togl_Interp(togl);
+diff --git a/Togl/src/Togl/stereo.c b/Togl/src/Togl/stereo.c
+index 0a33f1e..1e09161 100644
+--- a/Togl/src/Togl/stereo.c
++++ b/Togl/src/Togl/stereo.c
+@@ -199,7 +199,7 @@ display_cb(Togl *togl)
+ 
+ 
+ int
+-setXrot_cb(Togl *togl, int argc, CONST84 char *argv[])
++setXrot_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -232,7 +232,7 @@ setXrot_cb(Togl *togl, int argc, CONST84 char *argv[])
+ 
+ 
+ int
+-setYrot_cb(Togl *togl, int argc, CONST84 char *argv[])
++setYrot_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -262,7 +262,7 @@ setYrot_cb(Togl *togl, int argc, CONST84 char *argv[])
+ 
+ int
+ getXrot_cb(ClientData clientData, Tcl_Interp *interp,
+-        int argc, CONST84 char *argv[])
++        int argc, const char *argv[])
+ {
+     sprintf(interp->result, "%d", (int) xAngle);
+     return TCL_OK;
+@@ -271,7 +271,7 @@ getXrot_cb(ClientData clientData, Tcl_Interp *interp,
+ 
+ int
+ getYrot_cb(ClientData clientData, Tcl_Interp *interp,
+-        int argc, CONST84 char *argv[])
++        int argc, const char *argv[])
+ {
+     sprintf(interp->result, "%d", (int) yAngle);
+     return TCL_OK;
+@@ -279,7 +279,7 @@ getYrot_cb(ClientData clientData, Tcl_Interp *interp,
+ 
+ 
+ int
+-scale_cb(Togl *togl, int argc, CONST84 char *argv[])
++scale_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+diff --git a/Togl/src/Togl/texture.c b/Togl/src/Togl/texture.c
+index 6a6f39f..edb7a09 100644
+--- a/Togl/src/Togl/texture.c
++++ b/Togl/src/Togl/texture.c
+@@ -238,7 +238,7 @@ display_cb(Togl *togl)
+  * Called when a magnification filter radio button is pressed.
+  */
+ int
+-magfilter_cb(Togl *togl, int argc, CONST84 char *argv[])
++magfilter_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -262,7 +262,7 @@ magfilter_cb(Togl *togl, int argc, CONST84 char *argv[])
+  * Called when a minification filter radio button is pressed.
+  */
+ int
+-minfilter_cb(Togl *togl, int argc, CONST84 char *argv[])
++minfilter_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -291,7 +291,7 @@ minfilter_cb(Togl *togl, int argc, CONST84 char *argv[])
+ 
+ 
+ int
+-xrot_cb(Togl *togl, int argc, CONST84 char *argv[])
++xrot_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -314,7 +314,7 @@ xrot_cb(Togl *togl, int argc, CONST84 char *argv[])
+ 
+ 
+ int
+-yrot_cb(Togl *togl, int argc, CONST84 char *argv[])
++yrot_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -337,7 +337,7 @@ yrot_cb(Togl *togl, int argc, CONST84 char *argv[])
+ 
+ 
+ int
+-scale_cb(Togl *togl, int argc, CONST84 char *argv[])
++scale_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -363,7 +363,7 @@ scale_cb(Togl *togl, int argc, CONST84 char *argv[])
+  * Called when S texture coordinate wrapping is changed.
+  */
+ int
+-swrap_cb(Togl *togl, int argc, CONST84 char *argv[])
++swrap_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -397,7 +397,7 @@ swrap_cb(Togl *togl, int argc, CONST84 char *argv[])
+  * Called when T texture coordinate wrapping is changed.
+  */
+ int
+-twrap_cb(Togl *togl, int argc, CONST84 char *argv[])
++twrap_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -431,7 +431,7 @@ twrap_cb(Togl *togl, int argc, CONST84 char *argv[])
+  * Called when the texture environment mode is changed.
+  */
+ int
+-envmode_cb(Togl *togl, int argc, CONST84 char *argv[])
++envmode_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -467,7 +467,7 @@ envmode_cb(Togl *togl, int argc, CONST84 char *argv[])
+  * Called when the polygon color is changed.
+  */
+ int
+-polycolor_cb(Togl *togl, int argc, CONST84 char *argv[])
++polycolor_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -495,7 +495,7 @@ polycolor_cb(Togl *togl, int argc, CONST84 char *argv[])
+  * Called when the texture image is to be changed
+  */
+ int
+-image_cb(Togl *togl, int argc, CONST84 char *argv[])
++image_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+ 
+@@ -530,7 +530,7 @@ image_cb(Togl *togl, int argc, CONST84 char *argv[])
+  * Called when the texture coordinate scale is changed.
+  */
+ int
+-coord_scale_cb(Togl *togl, int argc, CONST84 char *argv[])
++coord_scale_cb(Togl *togl, int argc, const char *argv[])
+ {
+     Tcl_Interp *interp = Togl_Interp(togl);
+     float   s;
+diff --git a/Togl/src/Togl/togl.c b/Togl/src/Togl/togl.c
+index e2f5134..ad424e2 100644
+--- a/Togl/src/Togl/togl.c
++++ b/Togl/src/Togl/togl.c
+@@ -97,10 +97,10 @@
+ 
+ #if TK_MAJOR_VERSION > 8 || (TK_MAJOR_VERSION == 8 && TK_MINOR_VERSION >= 6)
+ static void (*SetClassProcsPtr)
+-        _ANSI_ARGS_((Tk_Window, const Tk_ClassProcs *, ClientData));
++        (Tk_Window, const Tk_ClassProcs *, ClientData);
+ #else
+ static void (*SetClassProcsPtr)
+-        _ANSI_ARGS_((Tk_Window, Tk_ClassProcs *, ClientData));
++        (Tk_Window, Tk_ClassProcs *, ClientData);
+ #endif
+ #endif
+ 
+@@ -109,11 +109,10 @@ static void (*SetClassProcsPtr)
+  * (this is needed for Tcl ver =< 8.4a3)
+  */
+ 
+-typedef Window (TkClassCreateProc) _ANSI_ARGS_((Tk_Window tkwin,
+-                Window parent, ClientData instanceData));
+-typedef void (TkClassGeometryProc) _ANSI_ARGS_((ClientData instanceData));
+-typedef void (TkClassModalProc) _ANSI_ARGS_((Tk_Window tkwin,
+-                XEvent *eventPtr));
++typedef Window (TkClassCreateProc) (Tk_Window tkwin,
++                Window parent, ClientData instanceData);
++typedef void (TkClassGeometryProc) (ClientData instanceData);
++typedef void (TkClassModalProc) (Tk_Window tkwin, XEvent *eventPtr);
+ typedef struct TkClassProcs
+ {
+     TkClassCreateProc *createProc;
+@@ -288,7 +287,7 @@ struct Togl
+  * Prototypes for functions local to this file
+  */
+ static int Togl_Cmd(ClientData clientData, Tcl_Interp *interp,
+-        int argc, CONST84 char **argv);
++        int argc, const char **argv);
+ static void Togl_EventProc(ClientData clientData, XEvent *eventPtr);
+ static Window Togl_CreateWindow(Tk_Window, Window, ClientData);
+ static void Togl_WorldChanged(ClientData);
+@@ -319,104 +318,104 @@ static void SetMacBufRect(Togl *togl);
+ 
+ static Tk_ConfigSpec configSpecs[] = {
+     {TK_CONFIG_PIXELS, TCL_STUPID "-height", "height", "Height",
+-            DEFAULT_HEIGHT, Tk_Offset(Togl, Height), 0, NULL},
++            DEFAULT_HEIGHT, offsetof(Togl, Height), 0, NULL},
+ 
+     {TK_CONFIG_PIXELS, TCL_STUPID "-width", "width", "Width",
+-            DEFAULT_WIDTH, Tk_Offset(Togl, Width), 0, NULL},
++            DEFAULT_WIDTH, offsetof(Togl, Width), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-setgrid", "setGrid", "SetGrid",
+-            "0", Tk_Offset(Togl, SetGrid), 0},
++            "0", offsetof(Togl, SetGrid), 0},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-rgba", "rgba", "Rgba",
+-            "true", Tk_Offset(Togl, RgbaFlag), 0, NULL},
++            "true", offsetof(Togl, RgbaFlag), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-redsize", "redsize", "RedSize",
+-            "1", Tk_Offset(Togl, RgbaRed), 0, NULL},
++            "1", offsetof(Togl, RgbaRed), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-greensize", "greensize", "GreenSize",
+-            "1", Tk_Offset(Togl, RgbaGreen), 0, NULL},
++            "1", offsetof(Togl, RgbaGreen), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-bluesize", "bluesize", "BlueSize",
+-            "1", Tk_Offset(Togl, RgbaBlue), 0, NULL},
++            "1", offsetof(Togl, RgbaBlue), 0, NULL},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-double", "double", "Double",
+-            "false", Tk_Offset(Togl, DoubleFlag), 0, NULL},
++            "false", offsetof(Togl, DoubleFlag), 0, NULL},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-depth", "depth", "Depth",
+-            "false", Tk_Offset(Togl, DepthFlag), 0, NULL},
++            "false", offsetof(Togl, DepthFlag), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-depthsize", "depthsize", "DepthSize",
+-            "1", Tk_Offset(Togl, DepthSize), 0, NULL},
++            "1", offsetof(Togl, DepthSize), 0, NULL},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-accum", "accum", "Accum",
+-            "false", Tk_Offset(Togl, AccumFlag), 0, NULL},
++            "false", offsetof(Togl, AccumFlag), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-accumredsize", "accumredsize", "AccumRedSize",
+-            "1", Tk_Offset(Togl, AccumRed), 0, NULL},
++            "1", offsetof(Togl, AccumRed), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-accumgreensize", "accumgreensize",
+                 "AccumGreenSize",
+-            "1", Tk_Offset(Togl, AccumGreen), 0, NULL},
++            "1", offsetof(Togl, AccumGreen), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-accumbluesize", "accumbluesize",
+                 "AccumBlueSize",
+-            "1", Tk_Offset(Togl, AccumBlue), 0, NULL},
++            "1", offsetof(Togl, AccumBlue), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-accumalphasize", "accumalphasize",
+                 "AccumAlphaSize",
+-            "1", Tk_Offset(Togl, AccumAlpha), 0, NULL},
++            "1", offsetof(Togl, AccumAlpha), 0, NULL},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-alpha", "alpha", "Alpha",
+-            "false", Tk_Offset(Togl, AlphaFlag), 0, NULL},
++            "false", offsetof(Togl, AlphaFlag), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-alphasize", "alphasize", "AlphaSize",
+-            "1", Tk_Offset(Togl, AlphaSize), 0, NULL},
++            "1", offsetof(Togl, AlphaSize), 0, NULL},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-stencil", "stencil", "Stencil",
+-            "false", Tk_Offset(Togl, StencilFlag), 0, NULL},
++            "false", offsetof(Togl, StencilFlag), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-stencilsize", "stencilsize", "StencilSize",
+-            "1", Tk_Offset(Togl, StencilSize), 0, NULL},
++            "1", offsetof(Togl, StencilSize), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-auxbuffers", "auxbuffers", "AuxBuffers",
+-            "0", Tk_Offset(Togl, AuxNumber), 0, NULL},
++            "0", offsetof(Togl, AuxNumber), 0, NULL},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-privatecmap", "privateCmap", "PrivateCmap",
+-            "false", Tk_Offset(Togl, PrivateCmapFlag), 0, NULL},
++            "false", offsetof(Togl, PrivateCmapFlag), 0, NULL},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-overlay", "overlay", "Overlay",
+-            "false", Tk_Offset(Togl, OverlayFlag), 0, NULL},
++            "false", offsetof(Togl, OverlayFlag), 0, NULL},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-stereo", "stereo", "Stereo",
+-            "false", Tk_Offset(Togl, StereoFlag), 0, NULL},
++            "false", offsetof(Togl, StereoFlag), 0, NULL},
+ 
+ #ifdef __sgi
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-oldstereo", "oldstereo", "OldStereo",
+-            "false", Tk_Offset(Togl, OldStereoFlag), 0, NULL},
++            "false", offsetof(Togl, OldStereoFlag), 0, NULL},
+ #endif
+ 
+ #ifndef NO_TK_CURSOR
+     {TK_CONFIG_ACTIVE_CURSOR, TCL_STUPID "-cursor", "cursor", "Cursor",
+-            "", Tk_Offset(Togl, Cursor), TK_CONFIG_NULL_OK},
++            "", offsetof(Togl, Cursor), TK_CONFIG_NULL_OK},
+ #endif
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-time", "time", "Time",
+-            DEFAULT_TIME, Tk_Offset(Togl, TimerInterval), 0, NULL},
++            DEFAULT_TIME, offsetof(Togl, TimerInterval), 0, NULL},
+ 
+     {TK_CONFIG_STRING, TCL_STUPID "-sharelist", "sharelist", "ShareList",
+-            NULL, Tk_Offset(Togl, ShareList), 0, NULL},
++            NULL, offsetof(Togl, ShareList), 0, NULL},
+ 
+     {TK_CONFIG_STRING, TCL_STUPID "-sharecontext", "sharecontext",
+-            "ShareContext", NULL, Tk_Offset(Togl, ShareContext), 0, NULL},
++            "ShareContext", NULL, offsetof(Togl, ShareContext), 0, NULL},
+ 
+     {TK_CONFIG_STRING, TCL_STUPID "-ident", "ident", "Ident",
+-            DEFAULT_IDENT, Tk_Offset(Togl, Ident), 0, NULL},
++            DEFAULT_IDENT, offsetof(Togl, Ident), 0, NULL},
+ 
+     {TK_CONFIG_BOOLEAN, TCL_STUPID "-indirect", "indirect", "Indirect",
+-            "false", Tk_Offset(Togl, Indirect), 0, NULL},
++            "false", offsetof(Togl, Indirect), 0, NULL},
+ 
+     {TK_CONFIG_INT, TCL_STUPID "-pixelformat", "pixelFormat", "PixelFormat",
+-            "0", Tk_Offset(Togl, PixelFormat), 0, NULL},
++            "0", offsetof(Togl, PixelFormat), 0, NULL},
+ 
+     {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
+ };
+@@ -1309,7 +1308,7 @@ Togl_Configure(Tcl_Interp *interp, Togl *togl,
+ 
+ static int
+ Togl_Widget(ClientData clientData, Tcl_Interp *interp, int argc,
+-        CONST84 char *argv[])
++        const char *argv[])
+ {
+     Togl   *togl = (Togl *) clientData;
+     int     result = TCL_OK;
+@@ -1425,7 +1424,7 @@ Togl_Widget(ClientData clientData, Tcl_Interp *interp, int argc,
+  */
+ static int
+ Togl_Cmd(ClientData clientData, Tcl_Interp *interp, int argc,
+-        CONST84 char **argv)
++        const char **argv)
+ {
+     const char *name;
+     Tk_Window mainwin = (Tk_Window) clientData;
+diff --git a/Togl/src/Togl/togl.h b/Togl/src/Togl/togl.h
+index 6726a6e..2b07663 100644
+--- a/Togl/src/Togl/togl.h
++++ b/Togl/src/Togl/togl.h
+@@ -59,10 +59,6 @@
+ #    include <X11/extensions/SGIStereo.h>
+ #  endif
+ 
+-#  ifndef CONST84
+-#    define CONST84
+-#  endif
+-
+ #  ifndef TOGL_USE_FONTS
+ #    define TOGL_USE_FONTS 1    /* needed for demos */
+ #  endif
+@@ -98,7 +94,7 @@ struct Togl;
+ typedef struct Togl Togl;
+ 
+ typedef void (Togl_Callback) (Togl *togl);
+-typedef int (Togl_CmdProc) (Togl *togl, int argc, CONST84 char *argv[]);
++typedef int (Togl_CmdProc) (Togl *togl, int argc, const char *argv[]);
+ 
+ TOGL_EXTERN int Togl_Init(Tcl_Interp *interp);
+ 
+-- 
+2.48.1
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ocaml-lablgl.git/commitdiff/6266491f892f480071046a1ceb07813aefd92bd9



More information about the pld-cvs-commit mailing list