Package: oolite / 1.77.1-3

generate_planet_data.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Description: GNUmakefile compiling tools/icosmesh
 GNUstep Makefile building icosmesh executable.
 .
 Whatever the locale, use a dot as decimal separator
 in the produced C code.
Author: Nicolas Boulenguez <nicolas@debian.org>
Forwarded: Michael Werle <micha@michaelwerle.com>

--- /dev/null
+++ b/tools/icosmesh/GNUmakefile
@@ -0,0 +1,17 @@
+# Build the icosmesh executable.
+
+# Icosmesh generates two C sources named COOPlanetData.[ch],
+# containing roughly 14Mo of precomputed data,
+# and intended to be installed into src/Core/ among Oolite sources.
+
+include $(GNUSTEP_MAKEFILES)/common.make
+
+TOOL_NAME := icosmesh
+
+icosmesh_OBJC_FILES := \
+ JAIcosMesh.m \
+ JAIcosTriangle.m \
+ JAVertexSet.m \
+ main.m \
+
+include $(GNUSTEP_MAKEFILES)/tool.make
--- a/tools/icosmesh/main.m
+++ b/tools/icosmesh/main.m
@@ -3,6 +3,7 @@
 	Tool to generate subdivided icosahedron mesh data.
 */
 
+#import <locale.h>
 #import <stdio.h>
 #import "icosmesh.h"
 #import "JAIcosTriangle.h"
@@ -79,6 +80,14 @@
 	*/
 	(void)[NSAutoreleasePool new];
 	
+	/* Let printf ignore local number formatting conventions. */
+	/* For example, use a dot as decimal separator. */
+	if (setlocale (LC_NUMERIC, "C") == NULL)
+	{
+		fprintf(stderr, "Failed to set locale.\n");
+		return EXIT_FAILURE;
+	}
+
 	FILE *header = fopen(kFileName ".h", "w");
 	FILE *source = fopen(kFileName ".c", "w");
 	if (header == NULL || source == NULL)