Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fd9dc19

Browse files
committedDec 2, 2013
Added the exposed/ library and demo program to the Autotools build
The libslvs library and CDemo program can now be built by Autotools. A few code changes were needed for this: C++ comments in C code had to be converted, constraint.cpp required some massaging, and fltkutil.cpp needed a stub for InitHeaps().
1 parent 6c68294 commit fd9dc19

File tree

10 files changed

+202
-130
lines changed

10 files changed

+202
-130
lines changed
 

‎Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
ACLOCAL_AMFLAGS = -I ac-aux
44

5-
SUBDIRS = src
5+
SUBDIRS = src exposed
66

77
exposed = \
88
exposed/CDemo.c \

‎configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ AC_SUBST([LIBSPNAV_LIBS])
164164
## Wrap it up
165165
##
166166

167-
AC_CONFIG_FILES([Makefile src/Makefile])
167+
AC_CONFIG_FILES([Makefile exposed/Makefile src/Makefile])
168168
AC_OUTPUT
169169

170170
cat <<EOF

‎exposed/CDemo.c

Lines changed: 72 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1-
//-----------------------------------------------------------------------------
2-
// Some sample code for slvs.dll. We draw some geometric entities, provide
3-
// initial guesses for their positions, and then constrain them. The solver
4-
// calculates their new positions, in order to satisfy the constraints.
5-
//
6-
// Copyright 2008-2013 Jonathan Westhues.
7-
//-----------------------------------------------------------------------------
8-
#include <windows.h>
1+
/*-----------------------------------------------------------------------------
2+
* Some sample code for slvs.dll. We draw some geometric entities, provide
3+
* initial guesses for their positions, and then constrain them. The solver
4+
* calculates their new positions, in order to satisfy the constraints.
5+
*
6+
* Copyright 2008-2013 Jonathan Westhues.
7+
*---------------------------------------------------------------------------*/
8+
#ifdef HAVE_CONFIG_H
9+
# include <config.h>
10+
#endif
11+
#ifdef WIN32
12+
# include <windows.h>
13+
#endif
914
#include <stdio.h>
15+
#include <stdlib.h>
16+
#include <string.h>
17+
#ifdef HAVE_STDINT_H
18+
# include <stdint.h>
19+
#endif
1020

1121
#include "slvs.h"
1222

13-
Slvs_System sys;
23+
static Slvs_System sys;
1424

15-
void *CheckMalloc(size_t n)
25+
static void *CheckMalloc(size_t n)
1626
{
1727
void *r = malloc(n);
1828
if(!r) {
@@ -22,44 +32,44 @@ void *CheckMalloc(size_t n)
2232
return r;
2333
}
2434

25-
//-----------------------------------------------------------------------------
26-
// An example of a constraint in 3d. We create a single group, with some
27-
// entities and constraints.
28-
//-----------------------------------------------------------------------------
29-
void Example3d(void)
35+
/*-----------------------------------------------------------------------------
36+
* An example of a constraint in 3d. We create a single group, with some
37+
* entities and constraints.
38+
*---------------------------------------------------------------------------*/
39+
static void Example3d(void)
3040
{
31-
// This will contain a single group, which will arbitrarily number 1.
32-
int g = 1;
41+
/* This will contain a single group, which will arbitrarily number 1. */
42+
Slvs_hGroup g = 1;
3343

34-
// A point, initially at (x y z) = (10 10 10)
44+
/* A point, initially at (x y z) = (10 10 10) */
3545
sys.param[sys.params++] = Slvs_MakeParam(1, g, 10.0);
3646
sys.param[sys.params++] = Slvs_MakeParam(2, g, 10.0);
3747
sys.param[sys.params++] = Slvs_MakeParam(3, g, 10.0);
3848
sys.entity[sys.entities++] = Slvs_MakePoint3d(101, g, 1, 2, 3);
39-
// and a second point at (20 20 20)
49+
/* and a second point at (20 20 20) */
4050
sys.param[sys.params++] = Slvs_MakeParam(4, g, 20.0);
4151
sys.param[sys.params++] = Slvs_MakeParam(5, g, 20.0);
4252
sys.param[sys.params++] = Slvs_MakeParam(6, g, 20.0);
4353
sys.entity[sys.entities++] = Slvs_MakePoint3d(102, g, 4, 5, 6);
44-
// and a line segment connecting them.
54+
/* and a line segment connecting them. */
4555
sys.entity[sys.entities++] = Slvs_MakeLineSegment(200, g,
4656
SLVS_FREE_IN_3D, 101, 102);
4757

48-
// The distance between the points should be 30.0 units.
58+
/* The distance between the points should be 30.0 units. */
4959
sys.constraint[sys.constraints++] = Slvs_MakeConstraint(
5060
1, g,
5161
SLVS_C_PT_PT_DISTANCE,
5262
SLVS_FREE_IN_3D,
5363
30.0,
5464
101, 102, 0, 0);
5565

56-
// Let's tell the solver to keep the second point as close to constant
57-
// as possible, instead moving the first point.
66+
/* Let's tell the solver to keep the second point as close to constant
67+
* as possible, instead moving the first point. */
5868
sys.dragged[0] = 4;
5969
sys.dragged[1] = 5;
6070
sys.dragged[2] = 6;
6171

62-
// Now that we have written our system, we solve.
72+
/* Now that we have written our system, we solve. */
6373
Slvs_Solve(&sys, g);
6474

6575
if(sys.result == SLVS_RESULT_OKAY) {
@@ -73,25 +83,25 @@ void Example3d(void)
7383
}
7484
}
7585

76-
//-----------------------------------------------------------------------------
77-
// An example of a constraint in 2d. In our first group, we create a workplane
78-
// along the reference frame's xy plane. In a second group, we create some
79-
// entities in that group and dimension them.
80-
//-----------------------------------------------------------------------------
81-
void Example2d(void)
86+
/*-----------------------------------------------------------------------------
87+
* An example of a constraint in 2d. In our first group, we create a workplane
88+
* along the reference frame's xy plane. In a second group, we create some
89+
* entities in that group and dimension them.
90+
*---------------------------------------------------------------------------*/
91+
static void Example2d(void)
8292
{
83-
int g;
93+
Slvs_hGroup g;
8494
double qw, qx, qy, qz;
8595

8696
g = 1;
87-
// First, we create our workplane. Its origin corresponds to the origin
88-
// of our base frame (x y z) = (0 0 0)
97+
/* First, we create our workplane. Its origin corresponds to the origin
98+
* of our base frame (x y z) = (0 0 0) */
8999
sys.param[sys.params++] = Slvs_MakeParam(1, g, 0.0);
90100
sys.param[sys.params++] = Slvs_MakeParam(2, g, 0.0);
91101
sys.param[sys.params++] = Slvs_MakeParam(3, g, 0.0);
92102
sys.entity[sys.entities++] = Slvs_MakePoint3d(101, g, 1, 2, 3);
93-
// and it is parallel to the xy plane, so it has basis vectors (1 0 0)
94-
// and (0 1 0).
103+
/* and it is parallel to the xy plane, so it has basis vectors (1 0 0)
104+
* and (0 1 0). */
95105
Slvs_MakeQuaternion(1, 0, 0,
96106
0, 1, 0, &qw, &qx, &qy, &qz);
97107
sys.param[sys.params++] = Slvs_MakeParam(4, g, qw);
@@ -102,12 +112,12 @@ void Example2d(void)
102112

103113
sys.entity[sys.entities++] = Slvs_MakeWorkplane(200, g, 101, 102);
104114

105-
// Now create a second group. We'll solve group 2, while leaving group 1
106-
// constant; so the workplane that we've created will be locked down,
107-
// and the solver can't move it.
115+
/* Now create a second group. We'll solve group 2, while leaving group 1
116+
* constant; so the workplane that we've created will be locked down,
117+
* and the solver can't move it. */
108118
g = 2;
109-
// These points are represented by their coordinates (u v) within the
110-
// workplane, so they need only two parameters each.
119+
/* These points are represented by their coordinates (u v) within the
120+
* workplane, so they need only two parameters each. */
111121
sys.param[sys.params++] = Slvs_MakeParam(11, g, 10.0);
112122
sys.param[sys.params++] = Slvs_MakeParam(12, g, 20.0);
113123
sys.entity[sys.entities++] = Slvs_MakePoint2d(301, g, 200, 11, 12);
@@ -116,11 +126,11 @@ void Example2d(void)
116126
sys.param[sys.params++] = Slvs_MakeParam(14, g, 10.0);
117127
sys.entity[sys.entities++] = Slvs_MakePoint2d(302, g, 200, 13, 14);
118128

119-
// And we create a line segment with those endpoints.
129+
/* And we create a line segment with those endpoints. */
120130
sys.entity[sys.entities++] = Slvs_MakeLineSegment(400, g,
121131
200, 301, 302);
122132

123-
// Now three more points.
133+
/* Now three more points. */
124134
sys.param[sys.params++] = Slvs_MakeParam(15, g, 100.0);
125135
sys.param[sys.params++] = Slvs_MakeParam(16, g, 120.0);
126136
sys.entity[sys.entities++] = Slvs_MakePoint2d(303, g, 200, 15, 16);
@@ -133,84 +143,85 @@ void Example2d(void)
133143
sys.param[sys.params++] = Slvs_MakeParam(20, g, 115.0);
134144
sys.entity[sys.entities++] = Slvs_MakePoint2d(305, g, 200, 19, 20);
135145

136-
// And arc, centered at point 303, starting at point 304, ending at
137-
// point 305.
146+
/* And arc, centered at point 303, starting at point 304, ending at
147+
* point 305. */
138148
sys.entity[sys.entities++] = Slvs_MakeArcOfCircle(401, g, 200, 102,
139149
303, 304, 305);
140150

141-
// Now one more point, and a distance
151+
/* Now one more point, and a distance */
142152
sys.param[sys.params++] = Slvs_MakeParam(21, g, 200.0);
143153
sys.param[sys.params++] = Slvs_MakeParam(22, g, 200.0);
144154
sys.entity[sys.entities++] = Slvs_MakePoint2d(306, g, 200, 21, 22);
145155

146156
sys.param[sys.params++] = Slvs_MakeParam(23, g, 30.0);
147157
sys.entity[sys.entities++] = Slvs_MakeDistance(307, g, 200, 23);
148158

149-
// And a complete circle, centered at point 306 with radius equal to
150-
// distance 307. The normal is 102, the same as our workplane.
159+
/* And a complete circle, centered at point 306 with radius equal to
160+
* distance 307. The normal is 102, the same as our workplane. */
151161
sys.entity[sys.entities++] = Slvs_MakeCircle(402, g, 200,
152162
306, 102, 307);
153163

154164

155-
// The length of our line segment is 30.0 units.
165+
/* The length of our line segment is 30.0 units. */
156166
sys.constraint[sys.constraints++] = Slvs_MakeConstraint(
157167
1, g,
158168
SLVS_C_PT_PT_DISTANCE,
159169
200,
160170
30.0,
161171
301, 302, 0, 0);
162172

163-
// And the distance from our line segment to the origin is 10.0 units.
173+
/* And the distance from our line segment to the origin is 10.0 units. */
164174
sys.constraint[sys.constraints++] = Slvs_MakeConstraint(
165175
2, g,
166176
SLVS_C_PT_LINE_DISTANCE,
167177
200,
168178
10.0,
169179
101, 0, 400, 0);
170-
// And the line segment is vertical.
180+
/* And the line segment is vertical. */
171181
sys.constraint[sys.constraints++] = Slvs_MakeConstraint(
172182
3, g,
173183
SLVS_C_VERTICAL,
174184
200,
175185
0.0,
176186
0, 0, 400, 0);
177-
// And the distance from one endpoint to the origin is 15.0 units.
187+
/* And the distance from one endpoint to the origin is 15.0 units. */
178188
sys.constraint[sys.constraints++] = Slvs_MakeConstraint(
179189
4, g,
180190
SLVS_C_PT_PT_DISTANCE,
181191
200,
182192
15.0,
183193
301, 101, 0, 0);
184-
/*
185-
// And same for the other endpoint; so if you add this constraint then
186-
// the sketch is overconstrained and will signal an error.
194+
#if 0
195+
/* And same for the other endpoint; so if you add this constraint then
196+
* the sketch is overconstrained and will signal an error. */
187197
sys.constraint[sys.constraints++] = Slvs_MakeConstraint(
188198
5, g,
189199
SLVS_C_PT_PT_DISTANCE,
190200
200,
191201
18.0,
192-
302, 101, 0, 0); */
202+
302, 101, 0, 0);
203+
#endif /* 0 */
193204

194-
// The arc and the circle have equal radius.
205+
/* The arc and the circle have equal radius. */
195206
sys.constraint[sys.constraints++] = Slvs_MakeConstraint(
196207
6, g,
197208
SLVS_C_EQUAL_RADIUS,
198209
200,
199210
0.0,
200211
0, 0, 401, 402);
201-
// The arc has radius 17.0 units.
212+
/* The arc has radius 17.0 units. */
202213
sys.constraint[sys.constraints++] = Slvs_MakeConstraint(
203214
7, g,
204215
SLVS_C_DIAMETER,
205216
200,
206217
17.0*2,
207218
0, 0, 401, 0);
208219

209-
// If the solver fails, then ask it to report which constraints caused
210-
// the problem.
220+
/* If the solver fails, then ask it to report which constraints caused
221+
* the problem. */
211222
sys.calculateFaileds = 1;
212223

213-
// And solve.
224+
/* And solve. */
214225
Slvs_Solve(&sys, g);
215226

216227
if(sys.result == SLVS_RESULT_OKAY) {
@@ -253,7 +264,7 @@ int main(void)
253264
sys.failed = CheckMalloc(50*sizeof(sys.failed[0]));
254265
sys.faileds = 50;
255266

256-
// Example3d();
267+
/*Example3d();*/
257268
for(;;) {
258269
Example2d();
259270
sys.params = sys.constraints = sys.entities = 0;

‎exposed/Makefile.am

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## exposed/Makefile.am
2+
3+
AM_CPPFLAGS = -DLIBRARY -I$(top_srcdir)/src
4+
5+
AM_LDFLAGS = -L.
6+
7+
noinst_PROGRAMS = CDemo
8+
noinst_LIBRARIES = libslvs.a
9+
10+
CDemo_SOURCES = CDemo.c
11+
12+
libslvs_a_SOURCES = \
13+
slvs.h \
14+
lib.cpp \
15+
../src/util.cpp \
16+
../src/entity.cpp \
17+
../src/expr.cpp \
18+
../src/constraint.cpp \
19+
../src/constrainteq.cpp \
20+
../src/system.cpp
21+
22+
if HAVE_FLTK
23+
CDemo_SOURCES += ../src/fltk/fltkutil.cpp
24+
endif
25+
if WIN32
26+
CDemo_SOURCES += ../src/win32/w32util.cpp
27+
endif
28+
29+
CDemo_LDADD = -lslvs $(FLTK_LDSTATICFLAGS)
30+
31+
EXTRA_DIST = \
32+
DOC.txt \
33+
Makefile.msvc \
34+
VbDemo.vb
35+
36+
## end exposed/Makefile.am
File renamed without changes.

‎exposed/lib.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,27 @@
99
#include "slvs.h"
1010

1111
Sketch SK;
12-
System SYS;
12+
static System SYS;
1313

14-
int IsInit = 0;
14+
static int IsInit = 0;
1515

1616
void Group::GenerateEquations(IdList<Equation,hEquation> *l) {
1717
// Nothing to do for now.
1818
}
1919

20-
void DoMessageBox(char *str, int rows, int cols, bool error)
20+
void CnfFreezeInt(uint32_t v, const char *name)
2121
{
22+
abort();
23+
}
24+
25+
uint32_t CnfThawInt(uint32_t v, const char *name)
26+
{
27+
abort();
28+
}
29+
30+
void DoMessageBox(const char *str, int rows, int cols, bool error)
31+
{
32+
abort();
2233
}
2334

2435
extern "C" {
@@ -185,7 +196,7 @@ default: dbp("bad constraint type %d", sc->type); return;
185196
SK.constraint.Add(&c);
186197
}
187198

188-
for(i = 0; i < arraylen(ssys->dragged); i++) {
199+
for(i = 0; i < (int)arraylen(ssys->dragged); i++) {
189200
if(ssys->dragged[i]) {
190201
hParam hp = { ssys->dragged[i] };
191202
SYS.dragged.Add(&hp);
@@ -251,4 +262,4 @@ default: dbp("bad constraint type %d", sc->type); return;
251262
FreeAllTemporary();
252263
}
253264

254-
}
265+
} /* extern "C" */

‎exposed/obj/t

Whitespace-only changes.

‎exposed/slvs.h

Lines changed: 68 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
1-
//-----------------------------------------------------------------------------
2-
// Data structures and prototypes for slvs.lib, a geometric constraint solver.
3-
//
4-
// See the comments in this file, the accompanying sample code that uses
5-
// this library, and the accompanying documentation (DOC.txt).
6-
//
7-
// Copyright 2009-2013 Jonathan Westhues.
8-
//-----------------------------------------------------------------------------
1+
/*-----------------------------------------------------------------------------
2+
* Data structures and prototypes for slvs.lib, a geometric constraint solver.
3+
*
4+
* See the comments in this file, the accompanying sample code that uses
5+
* this library, and the accompanying documentation (DOC.txt).
6+
*
7+
* Copyright 2009-2013 Jonathan Westhues.
8+
*---------------------------------------------------------------------------*/
99

1010
#ifndef __SLVS_H
1111
#define __SLVS_H
1212

13-
#ifdef EXPORT_DLL
14-
#define DLL __declspec( dllexport )
13+
#ifdef WIN32
14+
# ifdef EXPORT_DLL
15+
# define DLL __declspec( dllexport )
16+
# else
17+
# define DLL __declspec( dllimport )
18+
# endif
1519
#else
16-
#define DLL __declspec( dllimport )
20+
# define DLL
1721
#endif
1822

1923
#ifdef __cplusplus
2024
extern "C" {
2125
#endif
2226

27+
#if defined(WIN32) && !defined(HAVE_C99_INTEGER_TYPES)
28+
typedef UINT32 uint32_t;
29+
#endif
30+
2331
typedef uint32_t Slvs_hParam;
2432
typedef uint32_t Slvs_hEntity;
2533
typedef uint32_t Slvs_hConstraint;
2634
typedef uint32_t Slvs_hGroup;
2735

28-
// To obtain the 3d (not projected into a workplane) of a constraint or
29-
// an entity, specify this instead of the workplane.
36+
/* To obtain the 3d (not projected into a workplane) of a constraint or
37+
* an entity, specify this instead of the workplane. */
3038
#define SLVS_FREE_IN_3D 0
3139

3240

@@ -45,9 +53,9 @@ typedef struct {
4553

4654
#define SLVS_E_DISTANCE 70000
4755

48-
// The special point, normal, and distance types used for parametric step
49-
// and repeat, extrude, and assembly are currently not exposed. Please
50-
// contact us if you are interested in using these.
56+
/* The special point, normal, and distance types used for parametric step
57+
* and repeat, extrude, and assembly are currently not exposed. Please
58+
* contact us if you are interested in using these. */
5159

5260
#define SLVS_E_WORKPLANE 80000
5361
#define SLVS_E_LINE_SEGMENT 80001
@@ -125,56 +133,55 @@ typedef struct {
125133

126134

127135
typedef struct {
128-
//// INPUT VARIABLES
129-
//
130-
// Here, we specify the parameters and their initial values, the entities,
131-
// and the constraints. For example, param[] points to the array of
132-
// parameters, which has length params, so that the last valid element
133-
// is param[params-1].
134-
//
135-
// param[] is actually an in/out variable; if the solver is successful,
136-
// then the new values (that satisfy the constraints) are written to it.
137-
//
136+
/*** INPUT VARIABLES
137+
*
138+
* Here, we specify the parameters and their initial values, the entities,
139+
* and the constraints. For example, param[] points to the array of
140+
* parameters, which has length params, so that the last valid element
141+
* is param[params-1].
142+
*
143+
* param[] is actually an in/out variable; if the solver is successful,
144+
* then the new values (that satisfy the constraints) are written to it. */
138145
Slvs_Param *param;
139146
int params;
140147
Slvs_Entity *entity;
141148
int entities;
142149
Slvs_Constraint *constraint;
143150
int constraints;
144151

145-
// If a parameter corresponds to a point (distance, normal, etc.) being
146-
// dragged, then specify it here. This will cause the solver to favor
147-
// that parameter, and attempt to change it as little as possible even
148-
// if that requires it to change other parameters more.
149-
//
150-
// Unused members of this array should be set to zero.
152+
/* If a parameter corresponds to a point (distance, normal, etc.) being
153+
* dragged, then specify it here. This will cause the solver to favor
154+
* that parameter, and attempt to change it as little as possible even
155+
* if that requires it to change other parameters more.
156+
*
157+
* Unused members of this array should be set to zero. */
151158
Slvs_hParam dragged[4];
152159

153-
// If the solver fails, then it can determine which constraints are
154-
// causing the problem. But this is a relatively slow process (for
155-
// a system with n constraints, about n times as long as just solving).
156-
// If calculateFaileds is true, then the solver will do so, otherwise
157-
// not.
160+
/* If the solver fails, then it can determine which constraints are
161+
* causing the problem. But this is a relatively slow process (for
162+
* a system with n constraints, about n times as long as just solving).
163+
* If calculateFaileds is true, then the solver will do so, otherwise
164+
* not. */
158165
int calculateFaileds;
159166

160-
//// OUTPUT VARIABLES
161-
//
162-
// If the solver fails, then it can report which constraints are causing
163-
// the problem. The caller should allocate the array failed[], and pass
164-
// its size in faileds.
165-
//
166-
// The solver will set faileds equal to the number of problematic
167-
// constraints, and write their Slvs_hConstraints into failed[]. To
168-
// ensure that there is sufficient space for any possible set of
169-
// failing constraints, faileds should be greater than or equal to
170-
// constraints.
167+
/*** OUTPUT VARIABLES
168+
*
169+
* If the solver fails, then it can report which constraints are causing
170+
* the problem. The caller should allocate the array failed[], and pass
171+
* its size in faileds.
172+
*
173+
* The solver will set faileds equal to the number of problematic
174+
* constraints, and write their Slvs_hConstraints into failed[]. To
175+
* ensure that there is sufficient space for any possible set of
176+
* failing constraints, faileds should be greater than or equal to
177+
* constraints. */
171178
Slvs_hConstraint *failed;
172179
int faileds;
173180

174-
// The solver indicates the number of unconstrained degrees of freedom.
181+
/* The solver indicates the number of unconstrained degrees of freedom. */
175182
int dof;
176183

177-
// The solver indicates whether the solution succeeded.
184+
/* The solver indicates whether the solution succeeded. */
178185
#define SLVS_RESULT_OKAY 0
179186
#define SLVS_RESULT_INCONSISTENT 1
180187
#define SLVS_RESULT_DIDNT_CONVERGE 2
@@ -185,29 +192,29 @@ typedef struct {
185192
DLL void Slvs_Solve(Slvs_System *sys, Slvs_hGroup hg);
186193

187194

188-
// Our base coordinate system has basis vectors
189-
// (1, 0, 0) (0, 1, 0) (0, 0, 1)
190-
// A unit quaternion defines a rotation to a new coordinate system with
191-
// basis vectors
192-
// U V N
193-
// which these functions compute from the quaternion.
195+
/* Our base coordinate system has basis vectors
196+
* (1, 0, 0) (0, 1, 0) (0, 0, 1)
197+
* A unit quaternion defines a rotation to a new coordinate system with
198+
* basis vectors
199+
* U V N
200+
* which these functions compute from the quaternion. */
194201
DLL void Slvs_QuaternionU(double qw, double qx, double qy, double qz,
195202
double *x, double *y, double *z);
196203
DLL void Slvs_QuaternionV(double qw, double qx, double qy, double qz,
197204
double *x, double *y, double *z);
198205
DLL void Slvs_QuaternionN(double qw, double qx, double qy, double qz,
199206
double *x, double *y, double *z);
200207

201-
// Similarly, compute a unit quaternion in terms of two basis vectors.
208+
/* Similarly, compute a unit quaternion in terms of two basis vectors. */
202209
DLL void Slvs_MakeQuaternion(double ux, double uy, double uz,
203210
double vx, double vy, double vz,
204211
double *qw, double *qx, double *qy, double *qz);
205212

206213

207-
//-------------------------------------
208-
// These are just convenience functions, to save you the trouble of filling
209-
// out the structures by hand. The code is included in the header file to
210-
// let the compiler inline them if possible.
214+
/*-------------------------------------
215+
* These are just convenience functions, to save you the trouble of filling
216+
* out the structures by hand. The code is included in the header file to
217+
* let the compiler inline them if possible. */
211218

212219
static Slvs_Param Slvs_MakeParam(Slvs_hParam h, Slvs_hGroup group, double val)
213220
{

‎src/constraint.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void Constraint::DeleteAllConstraintsFor(int type, hEntity entityA, hEntity ptA)
6060
{
6161
SK.constraint.ClearTags();
6262
for(int i = 0; i < SK.constraint.n; i++) {
63-
Constraint *ct = &(SK.constraint.elem[i]);
63+
ConstraintBase *ct = &(SK.constraint.elem[i]);
6464
if(ct->type != type) continue;
6565

6666
if(ct->entityA.v != entityA.v) continue;
@@ -112,6 +112,8 @@ void Constraint::ConstrainCoincident(hEntity ptA, hEntity ptB) {
112112
Entity::NO_ENTITY, Entity::NO_ENTITY, false, false);
113113
}
114114

115+
#ifndef LIBRARY
116+
115117
void Constraint::MenuConstrain(int id) {
116118
Constraint c;
117119
ZERO(&c);
@@ -707,3 +709,4 @@ void Constraint::MenuConstrain(int id) {
707709
InvalidateGraphics();
708710
}
709711

712+
#endif /* ! LIBRARY */

‎src/fltk/fltkutil.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,7 @@ void *MemAlloc(size_t n) {
105105
void MemFree(void *p) {
106106
free(p);
107107
}
108+
109+
void InitHeaps(void) {
110+
/* nothing to do */
111+
}

0 commit comments

Comments
 (0)
Please sign in to comment.