Thursday, December 28, 2023

Re: irrlamb vs ctype.h

On Thu, Dec 28, 2023 at 11:29:39PM +0100, Sebastian Reitenbach wrote:
> Hi,
>
> FWIW: irrlamb got a new home on https://gitlab.com/irrlamb/code, maybe it's easier to just update the port.
> See games/choria and games/emptyclip, they're from the same author.
>

Thanks. I'm not interested in updating this game, nor am I interested in
spending more time on this issue. The main branch still has the same problem:

https://gitlab.com/irrlamb/code/-/blob/main/src/ode/src/lcp.cpp?ref_type=heads#L277

So we'll have to fix this anyway. If anyone wants to update the port and
incorporate this diff, they're very welcome, I'll assume that they will
have reviewed in the process and I have one less diff to carry and
commit.

> cheers,
> Sebastian
>
> On Thursday, December 28, 2023 18:57 CET, Theo Buehler <tb@theobuehler.org> wrote:
>
> > I could use a set of eyes on this for the case that I'm missing something.
> >
> > Newer libcxx pulls in ctype.h which defines _L and _C to flag values, that
> > doesn't work well with the existing code. This results in this kind of error:
> >
> > c++: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
> > /tmp/pobj/irrlamb-1.0.1/irrlamb-1.0.1r613/src/ode/src/lcp.cpp:382:33: error: expected ')'
> > dReal *_pairslh, dReal *_L, dReal *_d,
> > ^
> > /usr/include/ctype.h:46:12: note: expanded from macro '_L'
> > #define _L 0x02
> > ^
> >
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/games/irrlamb/Makefile,v
> > diff -u -p -r1.19 Makefile
> > --- Makefile 26 Sep 2023 09:41:37 -0000 1.19
> > +++ Makefile 28 Dec 2023 17:50:24 -0000
> > @@ -3,6 +3,7 @@ COMMENT = third person, 3D physics game
> > DISTNAME = irrlamb-$Vr613-src
> > PKGNAME = irrlamb-$V
> > CATEGORIES = games x11
> > +REVISION = 0
> >
> > # GPLv3+
> > PERMIT_PACKAGE = Yes
> > @@ -36,6 +37,8 @@ SSE_FLAGS = -msse -mfpmath=sse
> > SSE_FLAGS =
> > .endif
> > SUBST_VARS += SSE_FLAGS
> > +
> > +FIX_CRLF_FILES += ./src/ode/src/lcp.cpp
> >
> > post-extract:
> > rm -rf ${WRKSRC}/src/irrlicht
> > Index: patches/patch-src_ode_src_lcp_cpp
> > ===================================================================
> > RCS file: patches/patch-src_ode_src_lcp_cpp
> > diff -N patches/patch-src_ode_src_lcp_cpp
> > --- /dev/null 1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-src_ode_src_lcp_cpp 28 Dec 2023 13:48:57 -0000
> > @@ -0,0 +1,58 @@
> > +Avoid conflict with ctype.h's _C and _L macros
> > +
> > +Index: src/ode/src/lcp.cpp
> > +--- src/ode/src/lcp.cpp.orig
> > ++++ src/ode/src/lcp.cpp
> > +@@ -274,7 +274,7 @@ void swapProblem (ATYPE A, dReal pairsbx[PBX__MAX], dR
> > + #ifdef DEBUG_LCP
> > +
> > + static
> > +-void checkFactorization (ATYPE A, dReal *_L, dReal *_d,
> > ++void checkFactorization (ATYPE A, dReal *_l, dReal *_d,
> > + unsigned nC, unsigned *C, unsigned nskip)
> > + {
> > + unsigned i, j;
> > +@@ -291,7 +291,7 @@ void checkFactorization (ATYPE A, dReal *_L, dReal *_d
> > + // printf ("A2=\n"); A2.print(); printf ("\n");
> > +
> > + // compute A3 = L*D*L'
> > +- dMatrix L (nC, nC, _L, nskip, 1);
> > ++ dMatrix L (nC, nC, _l, nskip, 1);
> > + dMatrix D (nC, nC);
> > + for (i = 0; i < nC; i++) D(i, i) = 1.0 / _d[i];
> > + L.clearUpperTriangle();
> > +@@ -379,9 +379,9 @@ struct dLCP {
> > + unsigned *const m_p, *const m_C;
> > +
> > + dLCP (unsigned _n, unsigned _nskip, unsigned _nub, dReal *_Adata, dReal *_pairsbx, dReal *_w,
> > +- dReal *_pairslh, dReal *_L, dReal *_d,
> > ++ dReal *_pairslh, dReal *_l, dReal *_d,
> > + dReal *_Dell, dReal *_ell, dReal *_tmp,
> > +- bool *_state, int *_findex, unsigned *_p, unsigned *_C, dReal **Arows);
> > ++ bool *_state, int *_findex, unsigned *_p, unsigned *_c, dReal **Arows);
> > + unsigned getNub() const { return m_nub; }
> > + void transfer_i_to_C (unsigned i);
> > + void transfer_i_to_N (unsigned /*i*/) { m_nN++; } // because we can assume C and N span 1:i-1
> > +@@ -409,9 +409,9 @@ struct dLCP {
> > +
> > +
> > + dLCP::dLCP (unsigned _n, unsigned _nskip, unsigned _nub, dReal *_Adata, dReal *_pairsbx, dReal *_w,
> > +- dReal *_pairslh, dReal *_L, dReal *_d,
> > ++ dReal *_pairslh, dReal *_l, dReal *_d,
> > + dReal *_Dell, dReal *_ell, dReal *_tmp,
> > +- bool *_state, int *_findex, unsigned *_p, unsigned *_C, dReal **Arows):
> > ++ bool *_state, int *_findex, unsigned *_p, unsigned *_c, dReal **Arows):
> > + m_n(_n), m_nskip(_nskip), m_nub(_nub), m_nC(0), m_nN(0),
> > + # ifdef ROWPTRS
> > + m_A(Arows),
> > +@@ -419,8 +419,8 @@ dLCP::dLCP (unsigned _n, unsigned _nskip, unsigned _nu
> > + m_A(_Adata),
> > +

No comments:

Post a Comment