Imported Upstream version 2.4.2+dfsg
Gabriele Giacone
13 years ago
0 | <project name="LWJGL" default="all" basedir="."> | |
1 | ||
2 | <property name="build.sysclasspath" value="last" /> | |
3 | ||
4 | <import file="platform_build/build-definitions.xml"/> | |
5 | <import file="platform_build/build-generator.xml"/> | |
6 | <import file="platform_build/build-applet.xml"/> | |
7 | <import file="platform_build/build-webstart.xml"/> | |
8 | ||
9 | <!-- ================================================================== --> | |
10 | <!-- Everything below this line is targets. --> | |
11 | <!-- Do not modify, unless you know what you're doing --> | |
12 | <!-- ================================================================== --> | |
13 | ||
14 | <!-- ================================================================== --> | |
15 | <!-- Initialize build --> | |
16 | <!-- ================================================================== --> | |
17 | <target name="-initialize"> | |
18 | <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" /> | |
19 | <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing bin folder" /> | |
20 | <mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" /> | |
21 | <mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" /> | |
22 | <mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" /> | |
23 | <mkdir dir="${lwjgl.res}" taskname="initialiazing res folder" /> | |
24 | <mkdir dir="${lwjgl.temp}" taskname="initialiazing temp folder" /> | |
25 | <mkdir dir="${lwjgl.temp}/jar" taskname="initialiazing temp/jar folder" /> | |
26 | <mkdir dir="${lwjgl.temp}/doc" taskname="initialiazing temp/doc folder" /> | |
27 | <mkdir dir="${lwjgl.temp}/res" taskname="initialiazing temp/res folder" /> | |
28 | <mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" /> | |
29 | <mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" /> | |
30 | <mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" /> | |
31 | <mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" /> | |
32 | <mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" /> | |
33 | </target> | |
34 | ||
35 | <!-- Cleans up any files created during the execution of this script --> | |
36 | <target name="clean" description="Cleans the diectories controlled by this ant script" depends="clean-generated"> | |
37 | <delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" /> | |
38 | <delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" /> | |
39 | <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" /> | |
40 | </target> | |
41 | ||
42 | <!-- Creates a distribution of LWJGL --> | |
43 | <target name="release" description="Creates a distribution of LWJGL using supplied native binaries"> | |
44 | <!-- Warn user --> | |
45 | <echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/> | |
46 | <input | |
47 | message="All data in the ${lwjgl.dist} folder will be deleted. Continue? " | |
48 | validargs="yes,no" | |
49 | addproperty="do.delete" | |
50 | /> | |
51 | <condition property="do.abort"> | |
52 | <equals arg1="no" arg2="${do.delete}"/> | |
53 | </condition> | |
54 | <fail if="do.abort">Build aborted by user.</fail> | |
55 | ||
56 | <!-- prepare --> | |
57 | <delete dir="${lwjgl.dist}" quiet="true" failonerror="false" /> | |
58 | <antcall target="clean" /> | |
59 | <antcall target="-initialize" /> | |
60 | ||
61 | <!-- compile and create jars --> | |
62 | <antcall target="generate-debug"/> | |
63 | <antcall target="compile" /> | |
64 | <antcall target="-createdebugjars" /> | |
65 | <!-- Generator will skip all templates if we don't clean --> | |
66 | <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" /> | |
67 | <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" /> | |
68 | <antcall target="generate-all"/> | |
69 | <antcall target="compile" /> | |
70 | <antcall target="-createjars" /> | |
71 | <antcall target="-jars_NoDEP" /> | |
72 | <antcall target="javadoc" /> | |
73 | <antcall target="applet-release" /> | |
74 | ||
75 | <!-- copy resources to res folder --> | |
76 | <copy todir="${lwjgl.temp}/res"> | |
77 | <fileset dir="res"/> | |
78 | </copy> | |
79 | ||
80 | <!-- copy docs --> | |
81 | <copy todir="${lwjgl.temp}/doc"> | |
82 | <fileset dir="${lwjgl.docs}"> | |
83 | <patternset refid="lwjgl-docs.fileset" /> | |
84 | </fileset> | |
85 | </copy> | |
86 | ||
87 | <!-- create distribution from files in libs/ and temp/ --> | |
88 | <antcall target="-distribution_javadoc" /> | |
89 | <antcall target="-distribution_source" /> | |
90 | <antcall target="-distribute" /> | |
91 | </target> | |
92 | ||
93 | <target name="all" description="Creates the Java archives and the natives for the current platform" depends="jars, compile_native"/> | |
94 | ||
95 | <!-- Create ONLY the jar archives --> | |
96 | <target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, generate-all, compile, -createjars"> | |
97 | <antcall target="-jars_NoDEP" /> | |
98 | </target> | |
99 | ||
100 | <target name="-jars_NoDEP"> | |
101 | <move todir="libs/"> | |
102 | <fileset dir="${lwjgl.temp}/jar"> | |
103 | <include name="*.jar"/> | |
104 | </fileset> | |
105 | </move> | |
106 | </target> | |
107 | ||
108 | <!-- Packages the java files --> | |
109 | <target name="-createdebugjars"> | |
110 | <!-- Create lwjgl.jar --> | |
111 | <jar destfile="${lwjgl.temp}/jar/lwjgl-debug.jar" taskname="lwjgl-debug.jar"> | |
112 | <fileset refid="lwjgl.fileset" /> | |
113 | <manifest> | |
114 | <attribute name="Sealed" value="true"/> | |
115 | </manifest> | |
116 | </jar> | |
117 | </target> | |
118 | ||
119 | <!-- Packages the java files --> | |
120 | <target name="-createjars"> | |
121 | <!-- Create lwjgl.jar --> | |
122 | <jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar"> | |
123 | <fileset refid="lwjgl.fileset" /> | |
124 | <manifest> | |
125 | <attribute name="Sealed" value="true"/> | |
126 | <attribute name="Trusted-Library" value="true"/> | |
127 | </manifest> | |
128 | </jar> | |
129 | ||
130 | <!-- Create lwjgl_util_applet.jar --> | |
131 | <jar destfile="${lwjgl.temp}/jar/lwjgl_util_applet.jar" taskname="lwjgl_util_applet.jar"> | |
132 | <fileset refid="lwjgl_util_applet.fileset" /> | |
133 | <manifest> | |
134 | <attribute name="Sealed" value="true"/> | |
135 | <attribute name="Trusted-Library" value="true"/> | |
136 | </manifest> | |
137 | </jar> | |
138 | ||
139 | <!-- Create lwjgl_test.jar --> | |
140 | <jar destfile="${lwjgl.temp}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar"> | |
141 | <fileset refid="lwjgl_test.fileset" /> | |
142 | <fileset refid="lwjgl_test_extra.fileset" /> | |
143 | </jar> | |
144 | ||
145 | <!-- Create lwjgl_util.jar --> | |
146 | <jar destfile="${lwjgl.temp}/jar/lwjgl_util.jar" taskname="lwjgl_util.jar"> | |
147 | <fileset refid="lwjgl_util.fileset" /> | |
148 | </jar> | |
149 | </target> | |
150 | ||
151 | <!-- Distributes files --> | |
152 | <target name="-distribute"> | |
153 | <delete> | |
154 | <fileset dir="${lwjgl.temp}/native/" includes="**/*"/> | |
155 | </delete> | |
156 | ||
157 | <copy todir="${lwjgl.temp}/jar"> | |
158 | <fileset dir="${lwjgl.lib}/" includes="*.jar"/> | |
159 | </copy> | |
160 | <copy todir="${lwjgl.temp}/native/windows"> | |
161 | <fileset dir="${lwjgl.lib}/windows"> | |
162 | <patternset refid="lwjgl-windows.fileset" /> | |
163 | </fileset> | |
164 | </copy> | |
165 | <copy todir="${lwjgl.temp}/native/linux"> | |
166 | <fileset dir="${lwjgl.lib}/linux"> | |
167 | <patternset refid="lwjgl-linux.fileset" /> | |
168 | </fileset> | |
169 | </copy> | |
170 | <copy todir="${lwjgl.temp}/native/macosx"> | |
171 | <fileset dir="${lwjgl.lib}/macosx"> | |
172 | <patternset refid="lwjgl-macosx.fileset" /> | |
173 | </fileset> | |
174 | </copy> | |
175 | <copy todir="${lwjgl.temp}/native/solaris"> | |
176 | <fileset dir="${lwjgl.lib}/solaris"> | |
177 | <patternset refid="lwjgl-solaris.fileset" /> | |
178 | </fileset> | |
179 | </copy> | |
180 | ||
181 | <!-- create base package --> | |
182 | <zip destfile="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip"> | |
183 | <zipfileset dir="${lwjgl.temp}" prefix="lwjgl-${lwjgl.version}/"> | |
184 | <patternset refid="lwjgl_base"/> | |
185 | </zipfileset> | |
186 | </zip> | |
187 | ||
188 | <!-- create applet package --> | |
189 | <zip destfile="${lwjgl.dist}/lwjgl_applet-${lwjgl.version}.zip"> | |
190 | <zipfileset dir="." prefix="lwjgl_applet-${lwjgl.version}/"> | |
191 | <patternset refid="lwjgl_applet"/> | |
192 | </zipfileset> | |
193 | </zip> | |
194 | </target> | |
195 | ||
196 | <!-- Creates a versioned distribution of javadocs --> | |
197 | <target name="-distribution_javadoc"> | |
198 | <zip destfile="${lwjgl.dist}/lwjgl-docs-${lwjgl.version}.zip" basedir="${lwjgl.docs}" includes="javadoc/**" /> | |
199 | </target> | |
200 | ||
201 | <!-- Creates a versioned distribution of the source code --> | |
202 | <target name="-distribution_source"> | |
203 | <zip destfile="${lwjgl.dist}/lwjgl-source-${lwjgl.version}.zip"> | |
204 | <fileset refid="lwjgl.source.fileset" /> | |
205 | </zip> | |
206 | </target> | |
207 | ||
208 | <!-- Generates the native headers from source files --> | |
209 | <target name="headers" description="invokes javah on java classes" depends="compile"> | |
210 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes"> | |
211 | <class name="org.lwjgl.LinuxSysImplementation" /> | |
212 | <class name="org.lwjgl.opengl.LinuxEvent" /> | |
213 | <class name="org.lwjgl.opengl.LinuxMouse" /> | |
214 | <class name="org.lwjgl.opengl.LinuxKeyboard" /> | |
215 | <class name="org.lwjgl.opengl.LinuxDisplay" /> | |
216 | <class name="org.lwjgl.opengl.LinuxPeerInfo" /> | |
217 | <class name="org.lwjgl.opengl.LinuxPbufferPeerInfo" /> | |
218 | <class name="org.lwjgl.opengl.LinuxDisplayPeerInfo" /> | |
219 | <class name="org.lwjgl.opengl.LinuxAWTGLCanvasPeerInfo" /> | |
220 | <class name="org.lwjgl.opengl.LinuxContextImplementation" /> | |
221 | <class name="org.lwjgl.opengl.LinuxCanvasImplementation" /> | |
222 | </javah> | |
223 | ||
224 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes"> | |
225 | <class name="org.lwjgl.opengl.WindowsKeyboard" /> | |
226 | <class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" /> | |
227 | <class name="org.lwjgl.opengl.WindowsDisplay" /> | |
228 | <class name="org.lwjgl.opengl.WindowsRegistry" /> | |
229 | <class name="org.lwjgl.WindowsSysImplementation" /> | |
230 | <class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo" /> | |
231 | <class name="org.lwjgl.opengl.WindowsPeerInfo" /> | |
232 | <class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" /> | |
233 | <class name="org.lwjgl.opengl.WindowsContextImplementation" /> | |
234 | </javah> | |
235 | ||
236 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes"> | |
237 | <class name="org.lwjgl.MacOSXSysImplementation" /> | |
238 | <class name="org.lwjgl.opengl.MacOSXMouseEventQueue" /> | |
239 | <class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" /> | |
240 | <class name="org.lwjgl.opengl.MacOSXPeerInfo" /> | |
241 | <class name="org.lwjgl.opengl.MacOSXPbufferPeerInfo" /> | |
242 | <class name="org.lwjgl.opengl.MacOSXDisplay" /> | |
243 | <class name="org.lwjgl.opengl.MacOSXContextImplementation" /> | |
244 | </javah> | |
245 | ||
246 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes"> | |
247 | <class name="org.lwjgl.opengl.AWTSurfaceLock" /> | |
248 | <class name="org.lwjgl.DefaultSysImplementation" /> | |
249 | <class name="org.lwjgl.input.Cursor" /> | |
250 | <class name="org.lwjgl.input.Keyboard" /> | |
251 | <class name="org.lwjgl.input.Mouse" /> | |
252 | <class name="org.lwjgl.openal.AL" /> | |
253 | <class name="org.lwjgl.opengl.GLContext" /> | |
254 | <class name="org.lwjgl.opengl.Pbuffer" /> | |
255 | </javah> | |
256 | </target> | |
257 | ||
258 | <target name="touch-version"> | |
259 | <touch file="${lwjgl.src.native}/windows/org_lwjgl_opengl_Display.c"/> | |
260 | <touch file="${lwjgl.src.native}/linux/org_lwjgl_opengl_Display.c"/> | |
261 | <touch file="${lwjgl.src.native}/macosx/org_lwjgl_opengl_Display.m"/> | |
262 | </target> | |
263 | ||
264 | <target name="version-mismatch"> | |
265 | <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/WindowsSysImplementation.java" property="lwjgl.java.windows.version"> | |
266 | <filterchain> | |
267 | <tokenfilter> | |
268 | <containsstring contains="JNI_VERSION ="/> | |
269 | </tokenfilter> | |
270 | </filterchain> | |
271 | </loadfile> | |
272 | <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/LinuxSysImplementation.java" property="lwjgl.java.linux.version"> | |
273 | <filterchain> | |
274 | <tokenfilter> | |
275 | <containsstring contains="JNI_VERSION ="/> | |
276 | </tokenfilter> | |
277 | </filterchain> | |
278 | </loadfile> | |
279 | <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/MacOSXSysImplementation.java" property="lwjgl.java.macosx.version"> | |
280 | <filterchain> | |
281 | <tokenfilter> | |
282 | <containsstring contains="JNI_VERSION ="/> | |
283 | </tokenfilter> | |
284 | </filterchain> | |
285 | </loadfile> | |
286 | <loadfile srcfile="${lwjgl.src.native}/windows/org_lwjgl_WindowsSysImplementation.h" property="lwjgl.native.windows.version"> | |
287 | <filterchain> | |
288 | <tokenfilter> | |
289 | <containsstring contains="#define org_lwjgl_WindowsSysImplementation_JNI_VERSION"/> | |
290 | </tokenfilter> | |
291 | </filterchain> | |
292 | </loadfile> | |
293 | <loadfile srcfile="${lwjgl.src.native}/linux/org_lwjgl_LinuxSysImplementation.h" property="lwjgl.native.linux.version"> | |
294 | <filterchain> | |
295 | <tokenfilter> | |
296 | <containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/> | |
297 | </tokenfilter> | |
298 | </filterchain> | |
299 | </loadfile> | |
300 | <loadfile srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version"> | |
301 | <filterchain> | |
302 | <tokenfilter> | |
303 | <containsstring contains="#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION"/> | |
304 | </tokenfilter> | |
305 | </filterchain> | |
306 | </loadfile> | |
307 | <echo> | |
308 | lwjgl.java.windows.version = ${lwjgl.java.windows.version} | |
309 | lwjgl.native.windows.version = ${lwjgl.native.windows.version} | |
310 | lwjgl.java.linux.version = ${lwjgl.java.linux.version} | |
311 | lwjgl.native.linux.version = ${lwjgl.native.linux.version} | |
312 | lwjgl.java.macosx.version = ${lwjgl.java.macosx.version} | |
313 | lwjgl.native.macosx.version = ${lwjgl.native.macosx.version} | |
314 | </echo> | |
315 | </target> | |
316 | ||
317 | <macrodef name="version-check"> | |
318 | <attribute name="platform"/> | |
319 | <sequential> | |
320 | <java classname="org.lwjgl.test.NativeTest" logError="false" resultproperty="nativetest.res" outputproperty="nativetest.out" errorproperty="nativetest.err" fork="true"> | |
321 | <jvmarg value="-Djava.library.path=libs/@{platform}"/> | |
322 | <classpath> | |
323 | <pathelement path="${lwjgl.bin}"/> | |
324 | <pathelement path="${java.class.path}"/> | |
325 | </classpath> | |
326 | </java> | |
327 | ||
328 | <fail message="Unable to load native library: ${nativetest.err}"> | |
329 | <condition> | |
330 | <not> | |
331 | <equals arg1="OK" arg2="${nativetest.out}"/> | |
332 | </not> | |
333 | </condition> | |
334 | </fail> | |
335 | ||
336 | <echo message="Successfully executed NativeTest"/> | |
337 | </sequential> | |
338 | </macrodef> | |
339 | ||
340 | <!-- Compiles the Java source code --> | |
341 | <target name="compile" description="Compiles the java source code" depends="-initialize"> | |
342 | <javac debug="yes" destdir="${lwjgl.bin}" source="1.4" target="1.4" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core"> | |
343 | <src path="${lwjgl.src}/java/"/> | |
344 | <src path="${lwjgl.src}/generated/"/> | |
345 | <include name="org/lwjgl/*.java"/> | |
346 | <include name="org/lwjgl/input/**"/> | |
347 | <include name="org/lwjgl/opengl/**"/> | |
348 | <include name="org/lwjgl/openal/**"/> | |
349 | <include name="org/lwjgl/util/**"/> | |
350 | <exclude name="org/lwjgl/util/generator/**"/> | |
351 | </javac> | |
352 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.4" target="1.4" taskname="test" /> | |
353 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.4" target="1.4" taskname="examples" /> | |
354 | </target> | |
355 | ||
356 | <target name="compile_native" depends="headers, touch-version, version-mismatch" description="Compiles the native files"> | |
357 | <condition property="lwjgl.platform.windows"> | |
358 | <os family="windows" /> | |
359 | </condition> | |
360 | <antcall target="-compile_native_win32" /> | |
361 | ||
362 | <condition property="lwjgl.platform.linux"> | |
363 | <os name="Linux" /> | |
364 | </condition> | |
365 | <antcall target="-compile_native_linux" /> | |
366 | ||
367 | <condition property="lwjgl.platform.solaris"> | |
368 | <os name="SunOS" /> | |
369 | </condition> | |
370 | <antcall target="-compile_native_solaris" /> | |
371 | ||
372 | <condition property="lwjgl.platform.macosx"> | |
373 | <os name="Mac OS X" /> | |
374 | </condition> | |
375 | <antcall target="-compile_native_macosx" /> | |
376 | </target> | |
377 | ||
378 | <!-- Compiles LWJGL on Win32 platforms --> | |
379 | <target name="-compile_native_win32" if="lwjgl.platform.windows"> | |
380 | <ant antfile="platform_build/windows_ant/build.xml" inheritAll="false"/> | |
381 | <copy todir="${lwjgl.lib}/windows"> | |
382 | <fileset dir="${lwjgl.bin}/lwjgl" includes="lwjgl*.dll"/> | |
383 | </copy> | |
384 | <version-check platform="windows"/> | |
385 | </target> | |
386 | ||
387 | <!-- Compiles LWJGL on Linux platforms --> | |
388 | <target name="-compile_native_linux" if="lwjgl.platform.linux"> | |
389 | <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/> | |
390 | <copy todir="${lwjgl.lib}/linux"> | |
391 | <fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/> | |
392 | </copy> | |
393 | <!-- headless issues <version-check platform="linux"/> --> | |
394 | </target> | |
395 | ||
396 | <!-- Compiles LWJGL on solaris platforms --> | |
397 | <target name="-compile_native_solaris" if="lwjgl.platform.solaris"> | |
398 | <!-- Reusing the linux ant task, but copy the output to solaris --> | |
399 | <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/> | |
400 | <copy todir="${lwjgl.lib}/solaris"> | |
401 | <fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/> | |
402 | </copy> | |
403 | <version-check platform="solaris"/> | |
404 | </target> | |
405 | ||
406 | <!-- Compiles LWJGL on Mac platforms --> | |
407 | <target name="-compile_native_macosx" if="lwjgl.platform.macosx"> | |
408 | <ant antfile="platform_build/macosx_ant/build.xml" inheritAll="false"/> | |
409 | <copy file="${lwjgl.bin}/lwjgl/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/> | |
410 | <version-check platform="macosx"/> | |
411 | </target> | |
412 | ||
413 | <target name="repack200" description="Pack200-repack a jar file"> | |
414 | <pack200 src="${input}" destfile="${output}" repack="true"/> | |
415 | </target> | |
416 | ||
417 | <target name="pack200" description="Pack200 a jar file"> | |
418 | <pack200 src="${input}" destfile="${output}"/> | |
419 | </target> | |
420 | ||
421 | <target name="lzma" description="LZMA compress a file"> | |
422 | <java fork="true" classname="SevenZip.LzmaAlone"> | |
423 | <classpath> | |
424 | <pathelement location="platform_build/JLzma.jar"/> | |
425 | </classpath> | |
426 | <jvmarg value="-Xmx512m"/> | |
427 | <arg value="e"/> | |
428 | <arg value="${input}"/> | |
429 | <arg value="${output}"/> | |
430 | </java> | |
431 | </target> | |
432 | ||
433 | <target name="compress-sign-class"> | |
434 | <antcall target="repack200"> | |
435 | <param name="input" value="${dir}${jarfile}.jar"/> | |
436 | <param name="output" value="${dir}${jarfile}-repack.jar"/> | |
437 | </antcall> | |
438 | <signjar jar="${dir}${jarfile}-repack.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
439 | <antcall target="pack200"> | |
440 | <param name="input" value="${dir}${jarfile}-repack.jar"/> | |
441 | <param name="output" value="${dir}${jarfile}.jar.pack"/> | |
442 | </antcall> | |
443 | <antcall target="lzma"> | |
444 | <param name="input" value="${dir}${jarfile}.jar.pack"/> | |
445 | <param name="output" value="${dir}${jarfile}.jar.pack.lzma"/> | |
446 | </antcall> | |
447 | <delete file="${dir}${jarfile}-repack.jar"/> | |
448 | <delete file="${dir}${jarfile}.jar.pack"/> | |
449 | <delete file="${dir}${jarfile}.jar"/> | |
450 | </target> | |
451 | ||
452 | <target name="compress-resource"> | |
453 | <antcall target="lzma"> | |
454 | <param name="input" value="${input}"/> | |
455 | <param name="output" value="${output}"/> | |
456 | </antcall> | |
457 | </target> | |
458 | ||
459 | <target name="applettest" depends="applet"> | |
460 | <exec executable="appletviewer"> | |
461 | <arg value="-J-Djava.security.policy=applet/appletviewer.policy"/> | |
462 | <arg path="applet/applet.html"/> | |
463 | </exec> | |
464 | </target> | |
465 | ||
466 | <target name="runtest" depends="all"> | |
467 | <fail message="test.mainclass is not set. Use 'ant -Dtest.mainclass=<main-class> runtest'" unless="test.mainclass"/> | |
468 | <condition property="native_path" value="libs/windows"> | |
469 | <os family="windows" /> | |
470 | </condition> | |
471 | ||
472 | <condition property="native_path" value="libs/linux"> | |
473 | <or> | |
474 | <os name="Linux" /> | |
475 | <os name="SunOS" /> | |
476 | </or> | |
477 | </condition> | |
478 | ||
479 | <condition property="native_path" value="libs/macosx"> | |
480 | <os name="Mac OS X" /> | |
481 | </condition> | |
482 | <property name="native_path_expanded" location="${native_path}"/> | |
483 | <java classname="${test.mainclass}" classpath="res:${lwjgl.lib}/lwjgl.jar:${lwjgl.lib}/lwjgl_util.jar:${lwjgl.lib}/lwjgl_test.jar:${lwjgl.lib}/jinput.jar" fork="true"> | |
484 | <sysproperty key="org.lwjgl.util.Debug" value="true"/> | |
485 | <sysproperty key="java.library.path" value="${native_path_expanded}"/> | |
486 | <arg line="${args}"/> | |
487 | </java> | |
488 | </target> | |
489 | ||
490 | <!-- Creates the Javadoc --> | |
491 | <target name="javadoc" description="Creates javadoc from java source code"> | |
492 | <javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.4" windowtitle="LWJGL API" useexternalfile="true"> | |
493 | <fileset refid="lwjgl.javadoc.fileset" /> | |
494 | <doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle> | |
495 | <bottom><![CDATA[<i>Copyright © 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom> | |
496 | </javadoc> | |
497 | </target> | |
498 | </project> |
0 | <project name="applet"> | |
1 | ||
2 | <!-- Create our packer task --> | |
3 | <taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task" classpath="platform_build/Pack200Task.jar"/> | |
4 | ||
5 | <target name="applet" depends="all"> | |
6 | <antcall target="-applet"> | |
7 | <param name="keystore" value="applet/lwjglkeystore"/> | |
8 | <param name="alias" value="lwjgl"/> | |
9 | <param name="password" value="123456"/> | |
10 | </antcall> | |
11 | </target> | |
12 | ||
13 | <target name="applet-release"> | |
14 | <input message="Please enter the keystore" addproperty="keystore.location" defaultvalue="applet/lwjglkeystore"/> | |
15 | <input message="Please enter the keystore alias" addproperty="keystore.alias" defaultvalue="lwjgl"/> | |
16 | <input message="Please type the password for the keystore" addproperty="sign.pwd" defaultvalue="123456"/> | |
17 | ||
18 | <antcall target="-applet"> | |
19 | <!-- | |
20 | <param name="keystore" value="signing/matzon_java_code_signing.keystore"/> | |
21 | <param name="alias" value="oddlabs_java_code_signing"/> | |
22 | <param name="password" value="${sign.pwd}"/> | |
23 | --> | |
24 | <param name="keystore" value="${keystore.location}"/> | |
25 | <param name="alias" value="${keystore.alias}"/> | |
26 | <param name="password" value="${sign.pwd}"/> | |
27 | </antcall> | |
28 | </target> | |
29 | ||
30 | <target name="-applet"> | |
31 | ||
32 | <!-- Create lwjgl_applet.jar --> | |
33 | <jar destfile="applet/lwjgl_applet.jar" taskname="lwjgl_applet.jar"> | |
34 | <fileset refid="lwjgl_applet.fileset" /> | |
35 | </jar> | |
36 | ||
37 | <!-- create each of the native jars --> | |
38 | <jar destfile="applet/windows_natives.jar" taskname="windows_natives.jar"> | |
39 | <fileset dir="${lwjgl.lib}/windows"> | |
40 | <patternset refid="lwjgl-windows.fileset"/> | |
41 | </fileset> | |
42 | </jar> | |
43 | <signjar jar="applet/windows_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
44 | ||
45 | <jar destfile="applet/linux_natives.jar" taskname="linux_natives.jar"> | |
46 | <fileset dir="${lwjgl.lib}/linux"> | |
47 | <patternset refid="lwjgl-linux.fileset"/> | |
48 | </fileset> | |
49 | </jar> | |
50 | <signjar jar="applet/linux_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
51 | ||
52 | <jar destfile="applet/macosx_natives.jar" taskname="macosx_natives.jar"> | |
53 | <fileset dir="${lwjgl.lib}/macosx"> | |
54 | <patternset refid="lwjgl-macosx.fileset"/> | |
55 | </fileset> | |
56 | </jar> | |
57 | <signjar jar="applet/macosx_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
58 | ||
59 | <jar destfile="applet/solaris_natives.jar" taskname="solaris_natives.jar"> | |
60 | <fileset dir="${lwjgl.lib}/solaris"> | |
61 | <patternset refid="lwjgl-solaris.fileset"/> | |
62 | </fileset> | |
63 | </jar> | |
64 | <signjar jar="applet/solaris_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
65 | ||
66 | <jar destfile="${lwjgl.lib}/lwjgl_util_applet.jar" update="true"> | |
67 | <fileset dir="${lwjgl.res}" includes="applet*"/> | |
68 | </jar> | |
69 | ||
70 | <copy file="${lwjgl.lib}/lwjgl.jar" todir="applet" overwrite="true"/> | |
71 | <copy file="${lwjgl.lib}/lwjgl-debug.jar" todir="applet" overwrite="true"/> | |
72 | <copy file="${lwjgl.lib}/lwjgl_util_applet.jar" todir="applet" overwrite="true"/> | |
73 | <copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet" overwrite="true"/> | |
74 | <copy file="${lwjgl.lib}/jinput.jar" todir="applet" overwrite="true"/> | |
75 | <copy file="${lwjgl.lib}/lzma.jar" todir="applet" overwrite="true"/> | |
76 | <zip destfile="applet/res.jar"> | |
77 | <zipfileset dir="${lwjgl.res}" includes="Footsteps.wav, ILtest.tga, Missing_you.mod"/> | |
78 | </zip> | |
79 | <signjar jar="applet/lwjgl_util_applet.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
80 | <signjar jar="applet/lzma.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
81 | ||
82 | <!-- LZMA only, for 1.4 only clients --> | |
83 | <antcall target="compress-resource"> | |
84 | <param name="input" value="applet/lwjgl.jar"/> | |
85 | <param name="output" value="applet/lwjgl.jar.lzma"/> | |
86 | </antcall> | |
87 | <antcall target="compress-resource"> | |
88 | <param name="input" value="applet/lwjgl-debug.jar"/> | |
89 | <param name="output" value="applet/lwjgl-debug.jar.lzma"/> | |
90 | </antcall> | |
91 | ||
92 | <antcall target="compress-resource"> | |
93 | <param name="input" value="applet/lwjgl_util.jar"/> | |
94 | <param name="output" value="applet/lwjgl_util.jar.lzma"/> | |
95 | </antcall> | |
96 | <antcall target="compress-resource"> | |
97 | <param name="input" value="applet/jinput.jar"/> | |
98 | <param name="output" value="applet/jinput.jar.lzma"/> | |
99 | </antcall> | |
100 | <antcall target="compress-resource"> | |
101 | <param name="input" value="applet/lwjgl_applet.jar"/> | |
102 | <param name="output" value="applet/lwjgl_applet.jar.lzma"/> | |
103 | </antcall> | |
104 | <antcall target="compress-resource"> | |
105 | <param name="input" value="applet/windows_natives.jar"/> | |
106 | <param name="output" value="applet/windows_natives.jar.lzma"/> | |
107 | </antcall> | |
108 | <antcall target="compress-sign-class"> | |
109 | <param name="dir" value="applet/"/> | |
110 | <param name="jarfile" value="lwjgl"/> | |
111 | </antcall> | |
112 | <antcall target="compress-sign-class"> | |
113 | <param name="dir" value="applet/"/> | |
114 | <param name="jarfile" value="lwjgl-debug"/> | |
115 | </antcall> | |
116 | <antcall target="compress-sign-class"> | |
117 | <param name="dir" value="applet/"/> | |
118 | <param name="jarfile" value="lwjgl_util"/> | |
119 | </antcall> | |
120 | <antcall target="compress-sign-class"> | |
121 | <param name="dir" value="applet/"/> | |
122 | <param name="jarfile" value="jinput"/> | |
123 | </antcall> | |
124 | <antcall target="compress-sign-class"> | |
125 | <param name="dir" value="applet/"/> | |
126 | <param name="jarfile" value="lwjgl_applet"/> | |
127 | </antcall> | |
128 | <antcall target="compress-resource"> | |
129 | <param name="input" value="applet/windows_natives.jar"/> | |
130 | <param name="output" value="applet/windows_natives.jar.lzma"/> | |
131 | </antcall> | |
132 | <antcall target="compress-resource"> | |
133 | <param name="input" value="applet/macosx_natives.jar"/> | |
134 | <param name="output" value="applet/macosx_natives.jar.lzma"/> | |
135 | </antcall> | |
136 | <antcall target="compress-resource"> | |
137 | <param name="input" value="applet/linux_natives.jar"/> | |
138 | <param name="output" value="applet/linux_natives.jar.lzma"/> | |
139 | </antcall> | |
140 | <antcall target="compress-resource"> | |
141 | <param name="input" value="applet/solaris_natives.jar"/> | |
142 | <param name="output" value="applet/solaris_natives.jar.lzma"/> | |
143 | </antcall> | |
144 | ||
145 | <antcall target="compress-resource"> | |
146 | <param name="input" value="applet/res.jar"/> | |
147 | <param name="output" value="applet/res.jar.lzma"/> | |
148 | </antcall> | |
149 | </target> | |
150 | </project>⏎ |
0 | <project name="definitions"> | |
1 | <!-- ================================================================== --> | |
2 | <!-- Global properties for build --> | |
3 | <!-- ================================================================== --> | |
4 | <property name="lwjgl.src" location="src" /> | |
5 | <property name="lwjgl.src.native" location="${lwjgl.src}/native" /> | |
6 | <property name="lwjgl.src.headers" location="${lwjgl.src.native}/common" /> | |
7 | <property name="lwjgl.src.templates" location="${lwjgl.src}/templates" /> | |
8 | <property name="lwjgl.bin" location="bin" /> | |
9 | <property name="lwjgl.lib" location="libs" /> | |
10 | <property name="lwjgl.dist" location="dist" /> | |
11 | <property name="lwjgl.docs" location="doc" /> | |
12 | <property name="lwjgl.temp" location="temp" /> | |
13 | <property name="lwjgl.res" location="res" /> | |
14 | <property name="lwjgl.version" value="2.4.2" /> | |
15 | ||
16 | <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/NVX*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/> | |
17 | <!-- ================================================================== --> | |
18 | <!-- Filesets used for targets --> | |
19 | <!-- ================================================================== --> | |
20 | ||
21 | <!-- Files to include in the lwjgl.jar file --> | |
22 | <fileset id="lwjgl.fileset" dir="${lwjgl.bin}"> | |
23 | <include name="org/**/*" /> | |
24 | <exclude name="org/lwjgl/d3d/**" /> | |
25 | <exclude name="org/lwjgl/test/**" /> | |
26 | <exclude name="org/lwjgl/util/**" /> | |
27 | <exclude name="org/lwjgl/examples/**" /> | |
28 | </fileset> | |
29 | ||
30 | <fileset id="lwjgl_util_applet.fileset" dir="${lwjgl.bin}"> | |
31 | <exclude name="**.*"/> | |
32 | <include name="org/lwjgl/util/applet/**"/> | |
33 | </fileset> | |
34 | ||
35 | <!-- Files to include in the lwjgl_test.jar file --> | |
36 | <fileset id="lwjgl_test.fileset" dir="${lwjgl.bin}"> | |
37 | <exclude name="**.*" /> | |
38 | <include name="org/lwjgl/test/**" /> | |
39 | <include name="org/lwjgl/examples/**" /> | |
40 | </fileset> | |
41 | ||
42 | <!-- More files to include in the lwjgl_test.jar file --> | |
43 | <fileset id="lwjgl_test_extra.fileset" dir="${lwjgl.src}/java"> | |
44 | <exclude name="**.*" /> | |
45 | <include name="org/lwjgl/test/opengl/shaders/shaderFP.fp" /> | |
46 | <include name="org/lwjgl/test/opengl/shaders/shaderFP.vp" /> | |
47 | <include name="org/lwjgl/test/opengl/shaders/shaderFSH.fsh" /> | |
48 | <include name="org/lwjgl/test/opengl/shaders/shaderFSH.vsh" /> | |
49 | <include name="org/lwjgl/test/opengl/shaders/shaderVP.vp" /> | |
50 | <include name="org/lwjgl/test/opengl/shaders/shaderVSH.vsh" /> | |
51 | <include name="org/lwjgl/test/opengl/shaders/shaderUNI.vsh" /> | |
52 | </fileset> | |
53 | ||
54 | <!-- Files to include in the lwjgl_util.jar file --> | |
55 | <fileset id="lwjgl_util.fileset" dir="${lwjgl.bin}"> | |
56 | <exclude name="**.*" /> | |
57 | <exclude name="org/lwjgl/util/generator/**" /> | |
58 | <exclude name="org/lwjgl/util/applet/**" /> | |
59 | <include name="org/lwjgl/util/**" /> | |
60 | </fileset> | |
61 | ||
62 | <!-- Files to include in the lwjgl_applet.jar file --> | |
63 | <fileset id="lwjgl_applet.fileset" dir="${lwjgl.bin}"> | |
64 | <exclude name="**.*"/> | |
65 | <include name="org/lwjgl/test/applet/**"/> | |
66 | <include name="org/lwjgl/test/opengl/awt/AWTGearsCanvas.class"/> | |
67 | </fileset> | |
68 | ||
69 | <!-- Files to make Javadoc from --> | |
70 | <fileset id="lwjgl.javadoc.fileset" dir="${lwjgl.src}"> | |
71 | <include name="**/*.java" /> | |
72 | <exclude name="native/**" /> | |
73 | <exclude name="templates/**" /> | |
74 | <exclude name="java/org/lwjgl/test/**" /> | |
75 | <exclude name="java/org/lwjgl/examples/**" /> | |
76 | <exclude name="java/org/lwjgl/util/generator/**" /> | |
77 | </fileset> | |
78 | ||
79 | <!-- Files to include in doc package --> | |
80 | <patternset id="lwjgl-docs.fileset"> | |
81 | <include name="CREDITS" /> | |
82 | <include name="LICENSE" /> | |
83 | <include name="README" /> | |
84 | <include name="lwjgl_hidden_switches.text" /> | |
85 | <include name="3rdparty/*" /> | |
86 | </patternset> | |
87 | ||
88 | <!-- Files to include in windows package --> | |
89 | <patternset id="lwjgl-windows.fileset"> | |
90 | <include name="lwjgl.dll" /> | |
91 | <include name="lwjgl64.dll" /> | |
92 | <include name="OpenAL32.dll" /> | |
93 | <include name="OpenAL64.dll" /> | |
94 | <include name="jinput-dx8*.dll" /> | |
95 | <include name="jinput-raw*.dll" /> | |
96 | </patternset> | |
97 | ||
98 | <!-- Files to include in linux, glibc2.3 package --> | |
99 | <patternset id="lwjgl-linux.fileset"> | |
100 | <include name="liblwjgl*.so" /> | |
101 | <include name="libopenal*.so" /> | |
102 | <include name="libjinput-linux.so" /> | |
103 | <include name="libjinput-linux64.so" /> | |
104 | </patternset> | |
105 | ||
106 | <!-- Files to include in mac os x package --> | |
107 | <patternset id="lwjgl-macosx.fileset"> | |
108 | <include name="liblwjgl.jnilib" /> | |
109 | <include name="openal.dylib" /> | |
110 | <include name="libjinput-osx.jnilib" /> | |
111 | <include name="libjinput-osx-legacy.jnilib" /> | |
112 | </patternset> | |
113 | ||
114 | <!-- Files to include in solaris package --> | |
115 | <patternset id="lwjgl-solaris.fileset"> | |
116 | <include name="liblwjgl*.so" /> | |
117 | <include name="libopenal.so" /> | |
118 | </patternset> | |
119 | ||
120 | <!-- Files to include in source distribution --> | |
121 | <fileset id="lwjgl.source.fileset" dir="."> | |
122 | <include name="build.xml" /> | |
123 | <include name="src/**" /> | |
124 | <include name="platform_build/**/*" /> | |
125 | </fileset> | |
126 | ||
127 | <!-- files in the base package --> | |
128 | <patternset id="lwjgl_base"> | |
129 | <include name="**" /> | |
130 | <exclude name="res/ILtest.*" /> | |
131 | <exclude name="res/Missing_you.mod" /> | |
132 | <exclude name="res/phero*.*" /> | |
133 | </patternset> | |
134 | ||
135 | <!-- files in the optional package --> | |
136 | <patternset id="lwjgl_optional"> | |
137 | <include name="res/**" /> | |
138 | <exclude name="res/logo/**" /> | |
139 | <exclude name="res/spaceinvaders/**" /> | |
140 | <exclude name="res/*.wav" /> | |
141 | <exclude name="res/*.xpm" /> | |
142 | <include name="doc/CREDITS" /> | |
143 | <include name="doc/LICENSE" /> | |
144 | <include name="doc/README" /> | |
145 | </patternset> | |
146 | ||
147 | <!-- files in the lwjgl_applet package --> | |
148 | <patternset id="lwjgl_applet"> | |
149 | <include name="applet/**" /> | |
150 | <exclude name="applet/appletviewer.policy" /> | |
151 | <exclude name="applet/lwjglkeystore" /> | |
152 | </patternset> | |
153 | ||
154 | <uptodate property="lwjgl.main.built" targetfile="${lwjgl.lib}/windows/lwjgl.dll" > | |
155 | <srcfiles dir= "${lwjgl.src.native}/common" includes="*.c*"/> | |
156 | <srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/> | |
157 | </uptodate> | |
158 | </project>⏎ |
0 | <project name="generator"> | |
1 | ||
2 | <!-- clean the generated files --> | |
3 | <target name="clean-generated" description="Deletes the generated java and native source"> | |
4 | <delete quiet="true" failonerror="false"> | |
5 | <fileset dir="${lwjgl.src}/generated" includes="**"/> | |
6 | <fileset dir="${lwjgl.src.native}/generated" includes="**"/> | |
7 | </delete> | |
8 | </target> | |
9 | ||
10 | <!-- Compiles the Java generator source code --> | |
11 | <target name="generators" description="Compiles the native method generators"> | |
12 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator"> | |
13 | <compilerarg value="-Xlint:all"/> | |
14 | </javac> | |
15 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.4" target="1.4" taskname="generator"> | |
16 | <include name="org/lwjgl/opengl/GLSync.java"/> | |
17 | <include name="org/lwjgl/opengl/PointerWrapper.java"/> | |
18 | </javac> | |
19 | </target> | |
20 | ||
21 | <!-- Proxy target to generate it all --> | |
22 | <target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references" description="Generates java and native source"/> | |
23 | ||
24 | <target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references" description="Generates java and native source"/> | |
25 | ||
26 | <!-- Generate OpenAL --> | |
27 | <target name="generate-openal" depends="generators" description="Generates java and native source for AL"> | |
28 | <apply executable="apt" parallel="true"> | |
29 | <arg value="-nocompile"/> | |
30 | <arg value="-factory"/> | |
31 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
32 | <arg value="-cp"/> | |
33 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
34 | <arg value="-s"/> | |
35 | <arg path="${lwjgl.src}/generated"/> | |
36 | <arg value="-d"/> | |
37 | <arg path="${lwjgl.src.native}/generated"/> | |
38 | <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/> | |
39 | <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java"/> | |
40 | </apply> | |
41 | </target> | |
42 | ||
43 | <!-- Generate OpenAL [DEBUG] --> | |
44 | <target name="generate-openal-debug" depends="generators" description="Generates java and native source for AL"> | |
45 | <apply executable="apt" parallel="true"> | |
46 | <arg value="-nocompile"/> | |
47 | <arg value="-factory"/> | |
48 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
49 | <arg value="-cp"/> | |
50 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
51 | <arg value="-s"/> | |
52 | <arg path="${lwjgl.src}/generated"/> | |
53 | <arg value="-d"/> | |
54 | <arg path="${lwjgl.src.native}/generated"/> | |
55 | <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/> | |
56 | <arg value="-Ageneratechecks"/> | |
57 | <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java"/> | |
58 | </apply> | |
59 | </target> | |
60 | ||
61 | <!-- Generate OpenGL --> | |
62 | <target name="generate-opengl" depends="generators" description="Generates java and native source for GL"> | |
63 | <apply executable="apt" parallel="true"> | |
64 | <arg value="-nocompile"/> | |
65 | <arg value="-factory"/> | |
66 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
67 | <arg value="-cp"/> | |
68 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
69 | <arg value="-s"/> | |
70 | <arg path="${lwjgl.src}/generated"/> | |
71 | <arg value="-d"/> | |
72 | <arg path="${lwjgl.src.native}/generated"/> | |
73 | <arg value="-Acontextspecific"/> | |
74 | <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> | |
75 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
76 | </apply> | |
77 | </target> | |
78 | ||
79 | <!-- Generate OpenGL [DEBUG] --> | |
80 | <target name="generate-opengl-debug" depends="generators" description="Generates java and native source for GL"> | |
81 | <apply executable="apt" parallel="true"> | |
82 | <arg value="-nocompile"/> | |
83 | <arg value="-factory"/> | |
84 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
85 | <arg value="-cp"/> | |
86 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
87 | <arg value="-s"/> | |
88 | <arg path="${lwjgl.src}/generated"/> | |
89 | <arg value="-d"/> | |
90 | <arg path="${lwjgl.src.native}/generated"/> | |
91 | <arg value="-Ageneratechecks"/> | |
92 | <arg value="-Acontextspecific"/> | |
93 | <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> | |
94 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
95 | </apply> | |
96 | </target> | |
97 | ||
98 | <!-- Generate references --> | |
99 | <target name="generate-opengl-references" depends="generators" description="Generates java and native source for GL"> | |
100 | <apply executable="apt" parallel="true"> | |
101 | <arg value="-nocompile"/> | |
102 | <arg value="-factory"/> | |
103 | <arg value="org.lwjgl.util.generator.ReferencesGeneratorProcessorFactory"/> | |
104 | <arg value="-cp"/> | |
105 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
106 | <arg value="-s"/> | |
107 | <arg path="${lwjgl.src}/generated"/> | |
108 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
109 | </apply> | |
110 | </target> | |
111 | ||
112 | <!-- Generate context capabilities --> | |
113 | <target name="generate-opengl-capabilities" depends="generators" description="Generates java and native source for GL"> | |
114 | <apply executable="apt" parallel="true"> | |
115 | <arg value="-nocompile"/> | |
116 | <arg value="-factory"/> | |
117 | <arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/> | |
118 | <arg value="-cp"/> | |
119 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
120 | <arg value="-s"/> | |
121 | <arg path="${lwjgl.src}/generated"/> | |
122 | <arg value="-Acontextspecific"/> | |
123 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
124 | </apply> | |
125 | </target> | |
126 | ||
127 | <!-- Generate context capabilities [DEBUG] --> | |
128 | <target name="generate-opengl-capabilities-debug" depends="generators" description="Generates java and native source for GL"> | |
129 | <apply executable="apt" parallel="true"> | |
130 | <arg value="-nocompile"/> | |
131 | <arg value="-factory"/> | |
132 | <arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/> | |
133 | <arg value="-cp"/> | |
134 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
135 | <arg value="-s"/> | |
136 | <arg path="${lwjgl.src}/generated"/> | |
137 | <arg value="-Ageneratechecks"/> | |
138 | <arg value="-Acontextspecific"/> | |
139 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
140 | </apply> | |
141 | </target> | |
142 | </project> |
0 | <project name="webstart"> | |
1 | <target name="webstart_demo" depends="jars"> | |
2 | <antcall target="-webstart_demo"> | |
3 | <param name="keystore" value="applet/lwjglkeystore"/> | |
4 | <param name="alias" value="lwjgl"/> | |
5 | <param name="password" value="123456"/> | |
6 | </antcall> | |
7 | </target> | |
8 | ||
9 | <target name="webstart_demo-release" depends="jars"> | |
10 | <input message="Please type the password for the keystore" addproperty="sign.pwd"/> | |
11 | ||
12 | <antcall target="-webstart_demo"> | |
13 | <param name="keystore" value="signing/matzon_java_code_signing.keystore"/> | |
14 | <param name="alias" value="oddlabs_java_code_signing"/> | |
15 | <param name="password" value="${sign.pwd}"/> | |
16 | </antcall> | |
17 | </target> | |
18 | ||
19 | <!-- --> | |
20 | <target name="-webstart_demo" description="Using released files, creates the necessary files used for jnlp demos"> | |
21 | ||
22 | <!-- delete existing temp --> | |
23 | <delete dir="${lwjgl.temp}"/> | |
24 | ||
25 | <!-- unzip common files --> | |
26 | <unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/> | |
27 | ||
28 | <!-- move files to unified structure --> | |
29 | <move todir="${lwjgl.temp}/jnlp/temp"> | |
30 | <fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/"> | |
31 | <include name="**"/> | |
32 | </fileset> | |
33 | </move> | |
34 | ||
35 | <!-- move relevant files to root --> | |
36 | <move todir="${lwjgl.temp}/jnlp/" flatten="true"> | |
37 | <fileset dir="${lwjgl.temp}/jnlp/temp"> | |
38 | <include name="**/**.jar"/> | |
39 | </fileset> | |
40 | </move> | |
41 | ||
42 | <!-- create native jars --> | |
43 | <jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows"/> | |
44 | <jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux"/> | |
45 | <jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx"/> | |
46 | <jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris"/> | |
47 | ||
48 | <!-- create media jar --> | |
49 | <jar destfile="${lwjgl.temp}/jnlp/media.jar" basedir="${lwjgl.res}"/> | |
50 | ||
51 | <!-- sign 'em --> | |
52 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
53 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
54 | <signjar jar="${lwjgl.temp}/jnlp/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
55 | <signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
56 | <signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
57 | <signjar jar="${lwjgl.temp}/jnlp/native_windows.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
58 | <signjar jar="${lwjgl.temp}/jnlp/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
59 | </target> | |
60 | </project>⏎ |
0 | <project name="webstart"> | |
1 | <target name="webstart_demo" depends="jars"> | |
2 | <antcall target="-webstart_demo"> | |
3 | <param name="keystore" value="applet/lwjglkeystore"/> | |
4 | <param name="alias" value="lwjgl"/> | |
5 | <param name="password" value="123456"/> | |
6 | </antcall> | |
7 | </target> | |
8 | ||
9 | <target name="webstart_demo-release"> | |
10 | <input message="Please type the password for the keystore" addproperty="sign.pwd"/> | |
11 | ||
12 | <antcall target="-webstart_demo"> | |
13 | <param name="keystore" value="signing/matzon_java_code_signing.keystore"/> | |
14 | <param name="alias" value="oddlabs_java_code_signing"/> | |
15 | <param name="password" value="${sign.pwd}"/> | |
16 | </antcall> | |
17 | </target> | |
18 | ||
19 | <!-- --> | |
20 | <target name="-webstart_demo" description="Using released files, creates the necessary files used for jnlp demos"> | |
21 | ||
22 | <!-- delete existing temp --> | |
23 | <delete dir="${lwjgl.temp}"/> | |
24 | ||
25 | <!-- unzip common files --> | |
26 | <unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/> | |
27 | ||
28 | <!-- move files to unified structure --> | |
29 | <move todir="${lwjgl.temp}/jnlp/temp"> | |
30 | <fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/"> | |
31 | <include name="**"/> | |
32 | </fileset> | |
33 | </move> | |
34 | ||
35 | <!-- move relevant files to root --> | |
36 | <move todir="${lwjgl.temp}/jnlp/" flatten="true"> | |
37 | <fileset dir="${lwjgl.temp}/jnlp/temp"> | |
38 | <include name="**/**.jar"/> | |
39 | </fileset> | |
40 | </move> | |
41 | ||
42 | <!-- create native jars --> | |
43 | <jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows"/> | |
44 | <jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux"/> | |
45 | <jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx"/> | |
46 | <jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris"/> | |
47 | ||
48 | <!-- add media and trusted info --> | |
49 | <jar destfile="${lwjgl.temp}/jnlp/lwjgl_test.jar" update="true"> | |
50 | <manifest> | |
51 | <attribute name="Sealed" value="true"/> | |
52 | <attribute name="Trusted-Only" value="true"/> | |
53 | </manifest> | |
54 | </jar> | |
55 | ||
56 | <jar destfile="${lwjgl.temp}/jnlp/lwjgl_util.jar" update="true"> | |
57 | <fileset dir="${lwjgl.res}"/> | |
58 | <manifest> | |
59 | <attribute name="Sealed" value="true"/> | |
60 | <attribute name="Trusted-Library" value="true"/> | |
61 | </manifest> | |
62 | </jar> | |
63 | ||
64 | <jar destfile="${lwjgl.temp}/jnlp/jinput.jar" update="true"> | |
65 | <manifest> | |
66 | <attribute name="Sealed" value="true"/> | |
67 | <attribute name="Trusted-Library" value="true"/> | |
68 | </manifest> | |
69 | </jar> | |
70 | ||
71 | <!-- sign 'em --> | |
72 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
73 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
74 | <signjar jar="${lwjgl.temp}/jnlp/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
75 | ||
76 | <signjar jar="${lwjgl.temp}/jnlp/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
77 | <signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
78 | <signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
79 | <signjar jar="${lwjgl.temp}/jnlp/native_windows.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
80 | ||
81 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl_test.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
82 | ||
83 | </target> | |
84 | </project>⏎ |
0 | <?xml version="1.0"?> | |
1 | ||
2 | <project name="lwjgl native code, linux" basedir="../../bin/lwjgl" default="compile"> | |
3 | <property name="native" location="../../src/native"/> | |
4 | <property name="libname32" value="liblwjgl.so"/> | |
5 | <property name="libname64" value="liblwjgl64.so"/> | |
6 | <property name="libs32" value="-L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lXcursor -lXrandr -lpthread -L${java.home}/lib/i386 -ljawt" /> | |
7 | <property name="libs64" value="-L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib/amd64 -ljawt" /> | |
8 | <property name="cflags32" value="-O2 -Wall -c -fPIC -std=c99 -Wunused"/> | |
9 | ||
10 | <target name="clean"> | |
11 | <delete> | |
12 | <fileset dir="x32"/> | |
13 | <fileset dir="x64"/> | |
14 | <fileset dir="." includes="*.o"/> | |
15 | <fileset dir="." includes="*.so"/> | |
16 | </delete> | |
17 | </target> | |
18 | ||
19 | <target name="compile"> | |
20 | <exec executable="uname" outputproperty="hwplatform"> | |
21 | <arg value="-m"/> | |
22 | </exec> | |
23 | <condition property="xf86vm_lib" value="-lXxf86vm" else="-Wl,-static,-lXxf86vm,-call_shared"> | |
24 | <os name="SunOS" /> | |
25 | </condition> | |
26 | <condition property="cflags_pthread" value="-pthreads" else="-pthread"> | |
27 | <os name="SunOS" /> | |
28 | </condition> | |
29 | <condition property="version_script_flags32" value="" else="-Wl,--version-script=${native}/linux/lwjgl.map"> | |
30 | <os name="SunOS" /> | |
31 | </condition> | |
32 | <condition property="version_script_flags64" value="-m64" else="-Wl,--version-script=${native}/linux/lwjgl.map"> | |
33 | <and> | |
34 | <os name="SunOS" /> | |
35 | </and> | |
36 | </condition> | |
37 | <condition property="cflags64" value="-O2 -m64 -Wall -c -fPIC -std=c99 -Wunused" else="-O2 -Wall -c -fPIC -std=c99 -Wunused"> | |
38 | <os name="SunOS" /> | |
39 | </condition> | |
40 | ||
41 | <property name="linker_flags32" value="${version_script_flags32} -shared -O2 -Wall -o ${libname32} ${libs32} ${xf86vm_lib}"/> | |
42 | <property name="linker_flags64" value="${version_script_flags64} -shared -O2 -Wall -o ${libname64} ${libs64} ${xf86vm_lib}"/> | |
43 | ||
44 | <condition property="build.32bit.only"> | |
45 | <not> | |
46 | <or> | |
47 | <equals arg1="${hwplatform}" arg2="x86_64"/> | |
48 | <equals arg1="${hwplatform}" arg2="i86pc"/> | |
49 | </or> | |
50 | </not> | |
51 | </condition> | |
52 | ||
53 | <!-- On linux, the 64 bit jre doesn't have the 32 bit libs --> | |
54 | <condition property="build.64bit.only"> | |
55 | <and> | |
56 | <os name="Linux"/> | |
57 | <equals arg1="${hwplatform}" arg2="x86_64"/> | |
58 | </and> | |
59 | </condition> | |
60 | ||
61 | <antcall target="compile32"/> | |
62 | <antcall target="compile64"/> | |
63 | </target> | |
64 | ||
65 | <target name="compile32" unless="build.64bit.only"> | |
66 | <mkdir dir="x32"/> | |
67 | <apply dir="x32" executable="gcc" skipemptyfilesets="true" failonerror="true"> | |
68 | <arg line="${cflags32} ${cflags_pthread}"/> | |
69 | <arg value="-I${java.home}/include"/> | |
70 | <arg value="-I${java.home}/include/linux"/> | |
71 | <arg value="-I${java.home}/../include"/> | |
72 | <arg value="-I${java.home}/../include/linux"/> | |
73 | <arg value="-I${java.home}/../include/solaris"/> | |
74 | <arg value="-I${native}/common"/> | |
75 | <arg value="-I${native}/linux"/> | |
76 | <mapper type="glob" from="*.c" to="*.o"/> | |
77 | <fileset dir="${native}/linux" includes="*.c"/> | |
78 | <fileset dir="${native}/generated" includes="*.c"/> | |
79 | <fileset dir="${native}/common" includes="*.c"/> | |
80 | </apply> | |
81 | <apply dir="." parallel="true" executable="gcc" failonerror="true"> | |
82 | <srcfile/> | |
83 | <arg line="${linker_flags32}"/> | |
84 | <fileset dir="x32" includes="*.o"/> | |
85 | </apply> | |
86 | <apply dir="." parallel="true" executable="strip" failonerror="true"> | |
87 | <fileset file="${libname32}"/> | |
88 | </apply> | |
89 | </target> | |
90 | ||
91 | <target name="compile64" unless="build.32bit.only"> | |
92 | <mkdir dir="x64"/> | |
93 | <apply dir="x64" executable="gcc" skipemptyfilesets="true" failonerror="true"> | |
94 | <arg line="${cflags64} ${cflags_pthread}"/> | |
95 | <arg value="-I${java.home}/include"/> | |
96 | <arg value="-I${java.home}/include/linux"/> | |
97 | <arg value="-I${java.home}/../include"/> | |
98 | <arg value="-I${java.home}/../include/linux"/> | |
99 | <arg value="-I${java.home}/../include/solaris"/> | |
100 | <arg value="-I${native}/common"/> | |
101 | <arg value="-I${native}/linux"/> | |
102 | <mapper type="glob" from="*.c" to="*.o"/> | |
103 | <fileset dir="${native}/linux" includes="*.c"/> | |
104 | <fileset dir="${native}/generated" includes="*.c"/> | |
105 | <fileset dir="${native}/common" includes="*.c"/> | |
106 | </apply> | |
107 | <apply dir="." parallel="true" executable="gcc" failonerror="true"> | |
108 | <srcfile/> | |
109 | <arg line="${linker_flags64}"/> | |
110 | <fileset dir="x64" includes="*.o"/> | |
111 | </apply> | |
112 | <apply dir="." parallel="true" executable="strip" failonerror="true"> | |
113 | <fileset file="${libname64}"/> | |
114 | </apply> | |
115 | </target> | |
116 | </project> |
0 | #!/bin/sh | |
1 | ||
2 | nm -g "$1"/*.o | grep "Java_" | cut -d ' ' -f3 | cut -c 1- | |
3 | nm -g "$1"/*.o | grep "JNI_" | cut -d ' ' -f3 | cut -c 1- |
0 | ||
1 | <project name="OS X Native code" basedir="../../bin/lwjgl" default="nativelibrary"> | |
2 | <property name="native" location="../../src/native"/> | |
3 | ||
4 | <target name="init"> | |
5 | <mkdir dir="ppc"/> | |
6 | <mkdir dir="i386"/> | |
7 | <mkdir dir="x86_64"/> | |
8 | </target> | |
9 | ||
10 | <target name="clean"> | |
11 | <delete failonerror="false"> | |
12 | <fileset dir="i386"/> | |
13 | <fileset dir="x86_64"/> | |
14 | <fileset dir="ppc"/> | |
15 | <fileset dir="." includes="liblwjgl.jnilib"/> | |
16 | <fileset dir="." includes="lwjgl.symbols"/> | |
17 | </delete> | |
18 | </target> | |
19 | ||
20 | <target name="compile"> | |
21 | <apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}"> | |
22 | <arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common -I${native}/macosx"/> | |
23 | <!-- Map from *.m and *.c to .o --> | |
24 | <mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/> | |
25 | <fileset dir="${native}/macosx" includes="*.m"/> | |
26 | <fileset dir="${native}/macosx" includes="*.c"/> | |
27 | <fileset dir="${native}/common" includes="*.c"/> | |
28 | <fileset dir="${native}/generated" includes="*.c"/> | |
29 | </apply> | |
30 | </target> | |
31 | ||
32 | <target name="link"> | |
33 | <apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true" skipemptyfilesets="true"> | |
34 | <arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -framework AppKit -framework JavaVM -framework Carbon"/> | |
35 | <fileset dir="${objdir}" includes="*.o"/> | |
36 | </apply> | |
37 | <apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true"> | |
38 | <arg line="-S -X"/> | |
39 | <fileset dir="." file="${libname}"/> | |
40 | </apply> | |
41 | </target> | |
42 | ||
43 | <target name="nativelibrary" depends="init"> | |
44 | <property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/> | |
45 | <property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.3.9.sdk"/> | |
46 | <property name="x86_64_sdkroot" location="/Developer/SDKs/MacOSX10.5.sdk"/> | |
47 | <property name="universal_flags" value="-isysroot ${universal_sdkroot}"/> | |
48 | <property name="ppc_flags" value="-isysroot ${ppc_sdkroot}"/> | |
49 | <antcall target="compile"> | |
50 | <param name="dstdir" location="ppc"/> | |
51 | <param name="compiler" value="gcc-4.0"/> | |
52 | <param name="sdkroot" location="${ppc_sdkroot}"/> | |
53 | <param name="cflags" value="${universal_flags} -arch ppc -mmacosx-version-min=10.3"/> | |
54 | </antcall> | |
55 | <antcall target="compile"> | |
56 | <param name="dstdir" location="i386"/> | |
57 | <param name="compiler" value="gcc-4.0"/> | |
58 | <param name="sdkroot" location="${universal_sdkroot}"/> | |
59 | <param name="cflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.4"/> | |
60 | </antcall> | |
61 | <antcall target="compile"> | |
62 | <param name="dstdir" location="x86_64"/> | |
63 | <param name="compiler" value="gcc-4.0"/> | |
64 | <param name="sdkroot" location="${universal_sdkroot}"/> | |
65 | <param name="cflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/> | |
66 | </antcall> | |
67 | <exec vmlauncher="true" executable="sh" output="lwjgl.symbols" failonerror="true"> | |
68 | <arg path="../../platform_build/macosx_ant/build-symbol-list"/> | |
69 | <arg path="i386"/> | |
70 | </exec> | |
71 | <antcall target="link"> | |
72 | <param name="objdir" location="ppc"/> | |
73 | <param name="libname" value="liblwjgl-ppc.jnilib"/> | |
74 | <param name="linker" value="gcc-4.0"/> | |
75 | <param name="linkerflags" value="${universal_flags} -arch ppc -mmacosx-version-min=10.3"/> | |
76 | </antcall> | |
77 | <antcall target="link"> | |
78 | <param name="objdir" location="i386"/> | |
79 | <param name="libname" value="liblwjgl-i386.jnilib"/> | |
80 | <param name="linker" value="gcc-4.0"/> | |
81 | <param name="linkerflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.4"/> | |
82 | </antcall> | |
83 | <antcall target="link"> | |
84 | <param name="objdir" location="x86_64"/> | |
85 | <param name="libname" value="liblwjgl-i86_64.jnilib"/> | |
86 | <param name="linker" value="gcc-4.0"/> | |
87 | <param name="linkerflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/> | |
88 | </antcall> | |
89 | <apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" > | |
90 | <arg value="-create"/> | |
91 | <srcfile/> | |
92 | <arg value="-output"/> | |
93 | <arg path="liblwjgl.jnilib"/> | |
94 | <fileset file="ppc/liblwjgl-ppc.jnilib"/> | |
95 | <fileset file="i386/liblwjgl-i386.jnilib"/> | |
96 | <fileset file="x86_64/liblwjgl-i86_64.jnilib"/> | |
97 | </apply> | |
98 | </target> | |
99 | </project> |
0 | <?xml version="1.0"?> | |
1 | ||
2 | <project name="lwjgl native code, native code" basedir="../../bin/lwjgl" default="compile"> | |
3 | <property name="native" location="../../src/native"/> | |
4 | <property environment="env"/> | |
5 | <property name="mingwprefix" location="x86_64-pc-mingw32-"/> | |
6 | <property name="mingwhome" location="c:/MinGW64"/> | |
7 | <property name="strip" location="${mingwhome}/${mingwprefix}strip"/> | |
8 | <property name="gcc" location="${mingwhome}/${mingwprefix}gcc"/> | |
9 | <property name="dlltool" location="${mingwhome}/${mingwprefix}dlltool"/> | |
10 | <property name="dllname" value="lwjgl64.dll"/> | |
11 | ||
12 | <target name="compile_dir"> | |
13 | <apply dir="." failonerror="true" executable="${gcc}" dest="." skipemptyfilesets="true"> | |
14 | <arg line="-c -Wall -O2 -std=gnu99 -D_JNI_IMPLEMENTATION_"/> | |
15 | <arg value="-I${dxhome}/include"/> | |
16 | <arg value="-I${alhome}/include"/> | |
17 | <arg value="-I${jdkhome}/include"/> | |
18 | <arg value="-I${jdkhome}/include/win32"/> | |
19 | <arg value="-I${native}/common"/> | |
20 | <arg value="-I${native}/windows"/> | |
21 | <srcfile/> | |
22 | <fileset dir="${native}/windows" includes="*.c"/> | |
23 | <fileset dir="${native}/common" includes="*.c"/> | |
24 | <fileset dir="${native}/generated" includes="*.c"/> | |
25 | <mapper type="glob" from="*.c" to="*.o"/> | |
26 | </apply> | |
27 | </target> | |
28 | ||
29 | <target name="link"> | |
30 | <echo file="jawt.def"> | |
31 | EXPORTS | |
32 | JAWT_GetAWT | |
33 | </echo> | |
34 | <exec dir="." executable="${dlltool}" failonerror="true"> | |
35 | <arg line="--def jawt.def --kill-at --dllname jawt.dll --output-lib libjawt.a"/> | |
36 | </exec> | |
37 | <apply dir="." parallel="true" executable="${gcc}" failonerror="true"> | |
38 | <arg value="-Wl,--kill-at"/> | |
39 | <arg line="-shared -o ${dllname}"/> | |
40 | <srcfile/> | |
41 | <arg line="libjawt.a"/> | |
42 | <arg value="-L${java.home}/../lib"/> | |
43 | <arg value="-L${alhome}/libs"/> | |
44 | <arg line="${libs}"/> | |
45 | <fileset dir="." includes="*.o"/> | |
46 | </apply> | |
47 | </target> | |
48 | ||
49 | <target name="clean"> | |
50 | <delete> | |
51 | <fileset dir="." includes="*.o"/> | |
52 | <fileset dir="." includes="*.dll"/> | |
53 | </delete> | |
54 | </target> | |
55 | ||
56 | <target name="compile"> | |
57 | <property name="libs" value="-lkernel32 -lole32 -lopengl32 -lversion -luser32 -lgdi32 -ladvapi32 -lwinmm"/> | |
58 | <antcall target="compile_dir"/> | |
59 | <antcall target="link"/> | |
60 | <apply dir="." executable="${strip}"> | |
61 | <fileset file="${dllname}"/> | |
62 | </apply> | |
63 | </target> | |
64 | </project> | |
65 |
0 | <?xml version="1.0"?> | |
1 | ||
2 | <project name="lwjgl native code, native code" basedir="../../bin/lwjgl" default="compile"> | |
3 | <property name="native" location="../../src/native"/> | |
4 | <property environment="env"/> | |
5 | <property name="sdkhome" location="${env.MSSDK}"/> | |
6 | ||
7 | <target name="compile_dir"> | |
8 | <apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true"> | |
9 | <arg line="/Ox /W2 /nologo /Ox /Ob2 /Oi /Ot /Oy /FD /EHsc /MT /Gy /W2 /nologo /c"/> | |
10 | <arg value="/I${sdkhome}\include"/> | |
11 | <arg value="/I${java.home}\..\include"/> | |
12 | <arg value="/I${java.home}\..\include\win32"/> | |
13 | <arg value="/I${native}\common"/> | |
14 | <arg value="/I${native}\windows"/> | |
15 | <srcfile/> | |
16 | <fileset dir="${native}/windows" includes="*.c"/> | |
17 | <fileset dir="${native}/common" includes="*.c"/> | |
18 | <fileset dir="${native}/generated" includes="*.c"/> | |
19 | <mapper type="glob" from="*.c" to="*.obj"/> | |
20 | </apply> | |
21 | </target> | |
22 | ||
23 | <target name="link"> | |
24 | <apply dir="." parallel="true" executable="cl" failonerror="true"> | |
25 | <arg line="/LD /nologo"/> | |
26 | <srcfile/> | |
27 | <arg line="/Fe${dllname} /link"/> | |
28 | <arg value="/LIBPATH:${java.home}\..\lib"/> | |
29 | <arg value="/LIBPATH:${sdkhomelib}"/> | |
30 | <arg value="/OPT:REF"/> | |
31 | <arg value="/OPT:ICF"/> | |
32 | <arg line="/DLL /DELAYLOAD:jawt.dll ${libs}"/> | |
33 | <fileset dir="." includes="*.obj"/> | |
34 | </apply> | |
35 | </target> | |
36 | ||
37 | <target name="clean"> | |
38 | <delete> | |
39 | <fileset dir="." includes="*.obj"/> | |
40 | <fileset dir="." includes="*.dll"/> | |
41 | <fileset dir="." includes="*.exp"/> | |
42 | <fileset dir="." includes="*.lib"/> | |
43 | </delete> | |
44 | </target> | |
45 | ||
46 | <target name="compile"> | |
47 | <condition property="sdkhomelib" value="${sdkhome}\lib" else="${sdkhome}\lib\x64"> | |
48 | <equals arg1="${os.arch}" arg2="x86"/> | |
49 | </condition> | |
50 | <condition property="dllname" value="lwjgl.dll" else="lwjgl64.dll"> | |
51 | <equals arg1="${os.arch}" arg2="x86"/> | |
52 | </condition> | |
53 | <echo message="${sdkhomelib}"/> | |
54 | <property name="libs" value="Kernel32.lib ole32.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib delayimp.lib winmm.lib Comctl32.lib"/> | |
55 | <antcall target="compile_dir"/> | |
56 | <antcall target="link"/> | |
57 | </target> | |
58 | </project> | |
59 |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import java.nio.Buffer; | |
34 | import java.nio.ByteBuffer; | |
35 | import java.nio.DoubleBuffer; | |
36 | import java.nio.FloatBuffer; | |
37 | import java.nio.IntBuffer; | |
38 | import java.nio.ShortBuffer; | |
39 | import java.nio.LongBuffer; | |
40 | ||
41 | /** | |
42 | * <p>A class to check buffer boundaries in general. If there is unsufficient space | |
43 | * in the buffer when the call is made then a buffer overflow would otherwise | |
44 | * occur and cause unexpected behaviour, a crash, or worse, a security risk. | |
45 | * | |
46 | * Internal class, don't use. | |
47 | * </p> | |
48 | * @author cix_foo <cix_foo@users.sourceforge.net> | |
49 | * @author elias_naur <elias_naur@users.sourceforge.net> | |
50 | * @version $Revision: 3279 $ | |
51 | * $Id: BufferChecks.java 3279 2010-03-11 21:06:49Z spasi $ | |
52 | */ | |
53 | public class BufferChecks { | |
54 | /** Static methods only! */ | |
55 | private BufferChecks() { | |
56 | } | |
57 | ||
58 | /** | |
59 | * Helper methods to ensure a function pointer is not-null (0) | |
60 | */ | |
61 | public static void checkFunctionAddress(long pointer) { | |
62 | if (pointer == 0) { | |
63 | throw new IllegalStateException("Function is not supported"); | |
64 | } | |
65 | } | |
66 | ||
67 | /** | |
68 | * Helper methods to ensure a ByteBuffer is null-terminated | |
69 | */ | |
70 | public static void checkNullTerminated(ByteBuffer buf) { | |
71 | if (buf.get(buf.limit() - 1) != 0) { | |
72 | throw new IllegalArgumentException("Missing null termination"); | |
73 | } | |
74 | } | |
75 | ||
76 | public static void checkNullTerminated(ByteBuffer buf, int count) { | |
77 | int nullFound = 0; | |
78 | for ( int i = buf.position(); i < buf.limit(); i++ ) { | |
79 | if ( buf.get(i) == 0 ) | |
80 | nullFound++; | |
81 | } | |
82 | ||
83 | if ( nullFound < count ) | |
84 | throw new IllegalArgumentException("Missing null termination"); | |
85 | } | |
86 | ||
87 | /** Helper methods to ensure an IntBuffer is null-terminated */ | |
88 | public static void checkNullTerminated(IntBuffer buf) { | |
89 | if ( buf.get(buf.limit() - 1) != 0 ) { | |
90 | throw new IllegalArgumentException("Missing null termination"); | |
91 | } | |
92 | } | |
93 | ||
94 | public static void checkNotNull(Object o) { | |
95 | if (o == null) | |
96 | throw new IllegalArgumentException("Null argument"); | |
97 | } | |
98 | ||
99 | /** | |
100 | * Helper methods to ensure a buffer is direct (and, implicitly, non-null). | |
101 | */ | |
102 | public static void checkDirect(ByteBuffer buf) { | |
103 | if (!buf.isDirect()) { | |
104 | throw new IllegalArgumentException("ByteBuffer is not direct"); | |
105 | } | |
106 | } | |
107 | ||
108 | public static void checkDirect(ShortBuffer buf) { | |
109 | if (!buf.isDirect()) { | |
110 | throw new IllegalArgumentException("ShortBuffer is not direct"); | |
111 | } | |
112 | } | |
113 | ||
114 | public static void checkDirect(IntBuffer buf) { | |
115 | if (!buf.isDirect()) { | |
116 | throw new IllegalArgumentException("IntBuffer is not direct"); | |
117 | } | |
118 | } | |
119 | ||
120 | public static void checkDirect(LongBuffer buf) { | |
121 | if (!buf.isDirect()) { | |
122 | throw new IllegalArgumentException("LongBuffer is not direct"); | |
123 | } | |
124 | } | |
125 | ||
126 | public static void checkDirect(FloatBuffer buf) { | |
127 | if (!buf.isDirect()) { | |
128 | throw new IllegalArgumentException("FloatBuffer is not direct"); | |
129 | } | |
130 | } | |
131 | ||
132 | public static void checkDirect(DoubleBuffer buf) { | |
133 | if (!buf.isDirect()) { | |
134 | throw new IllegalArgumentException("DoubleBuffer is not direct"); | |
135 | } | |
136 | } | |
137 | ||
138 | /** | |
139 | * This is a separate call to help inline checkBufferSize. | |
140 | */ | |
141 | private static void throwBufferSizeException(Buffer buf, int size) { | |
142 | throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size); | |
143 | } | |
144 | ||
145 | /** | |
146 | * Helper method to ensure a buffer is big enough to receive data from a | |
147 | * glGet* operation. | |
148 | * | |
149 | * @param buf | |
150 | * The buffer to check | |
151 | * @param size | |
152 | * The minimum buffer size | |
153 | * @throws IllegalArgumentException | |
154 | */ | |
155 | public static void checkBufferSize(Buffer buf, int size) { | |
156 | if (buf.remaining() < size) { | |
157 | throwBufferSizeException(buf, size); | |
158 | } | |
159 | } | |
160 | ||
161 | public static void checkBuffer(ByteBuffer buf, int size) { | |
162 | checkBufferSize(buf, size); | |
163 | checkDirect(buf); | |
164 | } | |
165 | ||
166 | public static void checkBuffer(ShortBuffer buf, int size) { | |
167 | checkBufferSize(buf, size); | |
168 | checkDirect(buf); | |
169 | } | |
170 | ||
171 | public static void checkBuffer(IntBuffer buf, int size) { | |
172 | checkBufferSize(buf, size); | |
173 | checkDirect(buf); | |
174 | } | |
175 | ||
176 | public static void checkBuffer(LongBuffer buf, int size) { | |
177 | checkBufferSize(buf, size); | |
178 | checkDirect(buf); | |
179 | } | |
180 | ||
181 | public static void checkBuffer(FloatBuffer buf, int size) { | |
182 | checkBufferSize(buf, size); | |
183 | checkDirect(buf); | |
184 | } | |
185 | ||
186 | public static void checkBuffer(DoubleBuffer buf, int size) { | |
187 | checkBufferSize(buf, size); | |
188 | checkDirect(buf); | |
189 | } | |
190 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import java.nio.Buffer; | |
34 | import java.nio.ByteBuffer; | |
35 | import java.nio.ByteOrder; | |
36 | import java.nio.CharBuffer; | |
37 | import java.nio.DoubleBuffer; | |
38 | import java.nio.FloatBuffer; | |
39 | import java.nio.IntBuffer; | |
40 | import java.nio.LongBuffer; | |
41 | import java.nio.ShortBuffer; | |
42 | ||
43 | /** | |
44 | * Some often-used Buffer code for creating native buffers of the appropriate size. | |
45 | * | |
46 | * @author $Author: matzon $ | |
47 | * @version $Revision: 2983 $ | |
48 | * $Id: BufferUtils.java 2983 2008-04-07 18:36:09Z matzon $ | |
49 | */ | |
50 | ||
51 | public final class BufferUtils { | |
52 | ||
53 | /** | |
54 | * Construct a direct native-ordered bytebuffer with the specified size. | |
55 | * @param size The size, in bytes | |
56 | * @return a ByteBuffer | |
57 | */ | |
58 | public static ByteBuffer createByteBuffer(int size) { | |
59 | return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); | |
60 | } | |
61 | ||
62 | /** | |
63 | * Construct a direct native-order shortbuffer with the specified number | |
64 | * of elements. | |
65 | * @param size The size, in shorts | |
66 | * @return a ShortBuffer | |
67 | */ | |
68 | public static ShortBuffer createShortBuffer(int size) { | |
69 | return createByteBuffer(size << 1).asShortBuffer(); | |
70 | } | |
71 | ||
72 | /** | |
73 | * Construct a direct native-order charbuffer with the specified number | |
74 | * of elements. | |
75 | * @param size The size, in chars | |
76 | * @return an CharBuffer | |
77 | */ | |
78 | public static CharBuffer createCharBuffer(int size) { | |
79 | return createByteBuffer(size << 1).asCharBuffer(); | |
80 | } | |
81 | ||
82 | /** | |
83 | * Construct a direct native-order intbuffer with the specified number | |
84 | * of elements. | |
85 | * @param size The size, in ints | |
86 | * @return an IntBuffer | |
87 | */ | |
88 | public static IntBuffer createIntBuffer(int size) { | |
89 | return createByteBuffer(size << 2).asIntBuffer(); | |
90 | } | |
91 | ||
92 | /** | |
93 | * Construct a direct native-order longbuffer with the specified number | |
94 | * of elements. | |
95 | * @param size The size, in longs | |
96 | * @return an LongBuffer | |
97 | */ | |
98 | public static LongBuffer createLongBuffer(int size) { | |
99 | return createByteBuffer(size << 3).asLongBuffer(); | |
100 | } | |
101 | ||
102 | /** | |
103 | * Construct a direct native-order floatbuffer with the specified number | |
104 | * of elements. | |
105 | * @param size The size, in floats | |
106 | * @return a FloatBuffer | |
107 | */ | |
108 | public static FloatBuffer createFloatBuffer(int size) { | |
109 | return createByteBuffer(size << 2).asFloatBuffer(); | |
110 | } | |
111 | ||
112 | /** | |
113 | * Construct a direct native-order doublebuffer with the specified number | |
114 | * of elements. | |
115 | * @param size The size, in floats | |
116 | * @return a FloatBuffer | |
117 | */ | |
118 | public static DoubleBuffer createDoubleBuffer(int size) { | |
119 | return createByteBuffer(size << 3).asDoubleBuffer(); | |
120 | } | |
121 | ||
122 | /** | |
123 | * @return n, where buffer_element_size=2^n. | |
124 | */ | |
125 | public static int getElementSizeExponent(Buffer buf) { | |
126 | if (buf instanceof ByteBuffer) | |
127 | return 0; | |
128 | else if (buf instanceof ShortBuffer || buf instanceof CharBuffer) | |
129 | return 1; | |
130 | else if (buf instanceof FloatBuffer || buf instanceof IntBuffer) | |
131 | return 2; | |
132 | else if (buf instanceof LongBuffer || buf instanceof DoubleBuffer) | |
133 | return 3; | |
134 | else | |
135 | throw new IllegalStateException("Unsupported buffer type: " + buf); | |
136 | } | |
137 | ||
138 | /** | |
139 | * A helper function which is used to get the byte offset in an arbitrary buffer | |
140 | * based on its position | |
141 | * @return the position of the buffer, in BYTES | |
142 | */ | |
143 | public static int getOffset(Buffer buffer) { | |
144 | return buffer.position() << getElementSizeExponent(buffer); | |
145 | } | |
146 | ||
147 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | ||
34 | /** | |
35 | * | |
36 | * @author elias_naur <elias_naur@users.sourceforge.net> | |
37 | * @version $Revision: 3055 $ | |
38 | * $Id: DefaultSysImplementation.java 3055 2008-04-30 14:58:47Z elias_naur $ | |
39 | */ | |
40 | abstract class DefaultSysImplementation implements SysImplementation { | |
41 | public native int getJNIVersion(); | |
42 | public native void setDebug(boolean debug); | |
43 | ||
44 | public long getTimerResolution() { | |
45 | return 1000; | |
46 | } | |
47 | ||
48 | public boolean has64Bit() { | |
49 | return false; | |
50 | } | |
51 | ||
52 | public abstract long getTime(); | |
53 | public abstract void alert(String title, String message); | |
54 | public abstract String getClipboard(); | |
55 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import javax.swing.JOptionPane; | |
34 | import javax.swing.UIManager; | |
35 | ||
36 | /** | |
37 | * A SysImplementation which delegates as much as it can to J2SE. | |
38 | * <p> | |
39 | * @author $Author: matzon $ | |
40 | * @version $Revision: 2983 $ | |
41 | * $Id: J2SESysImplementation.java 2983 2008-04-07 18:36:09Z matzon $ | |
42 | */ | |
43 | abstract class J2SESysImplementation extends DefaultSysImplementation { | |
44 | ||
45 | public long getTime() { | |
46 | return System.currentTimeMillis(); | |
47 | } | |
48 | ||
49 | public void alert(String title, String message) { | |
50 | try { | |
51 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | |
52 | } catch(Exception e) { | |
53 | LWJGLUtil.log("Caught exception while setting LAF: " + e); | |
54 | } | |
55 | JOptionPane.showMessageDialog(null, message, title, JOptionPane.WARNING_MESSAGE); | |
56 | } | |
57 | ||
58 | public String getClipboard() { | |
59 | try { | |
60 | java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); | |
61 | java.awt.datatransfer.Transferable transferable = clipboard.getContents(null); | |
62 | if (transferable.isDataFlavorSupported(java.awt.datatransfer.DataFlavor.stringFlavor)) { | |
63 | return (String)transferable.getTransferData(java.awt.datatransfer.DataFlavor.stringFlavor); | |
64 | } | |
65 | } catch (Exception e) { | |
66 | LWJGLUtil.log("Exception while getting clipboard: " + e); | |
67 | } | |
68 | return null; | |
69 | } | |
70 | ||
71 | ||
72 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | /** | |
34 | * <p> | |
35 | * This exception is supplied to make exception handling more generic for LWJGL | |
36 | * specific exceptions | |
37 | * </p> | |
38 | * | |
39 | * @author Brian Matzon <brian@matzon.dk> | |
40 | * @version $Revision: 2983 $ | |
41 | * $Id: LWJGLException.java 2983 2008-04-07 18:36:09Z matzon $ | |
42 | */ | |
43 | public class LWJGLException extends Exception { | |
44 | ||
45 | private static final long serialVersionUID = 1L; | |
46 | ||
47 | /** | |
48 | * Plain c'tor | |
49 | */ | |
50 | public LWJGLException() { | |
51 | super(); | |
52 | } | |
53 | ||
54 | /** | |
55 | * Creates a new LWJGLException | |
56 | * | |
57 | * @param msg | |
58 | * String identifier for exception | |
59 | */ | |
60 | public LWJGLException(String msg) { | |
61 | super(msg); | |
62 | } | |
63 | ||
64 | /** | |
65 | * @param message | |
66 | * @param cause | |
67 | */ | |
68 | public LWJGLException(String message, Throwable cause) { | |
69 | super(message, cause); | |
70 | } | |
71 | ||
72 | /** | |
73 | * @param cause | |
74 | */ | |
75 | public LWJGLException(Throwable cause) { | |
76 | super(cause); | |
77 | } | |
78 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import java.io.File; | |
34 | import java.lang.reflect.Method; | |
35 | import java.nio.ByteBuffer; | |
36 | import java.security.AccessController; | |
37 | import java.security.PrivilegedAction; | |
38 | import java.security.PrivilegedActionException; | |
39 | import java.security.PrivilegedExceptionAction; | |
40 | import java.util.ArrayList; | |
41 | import java.util.List; | |
42 | import java.util.StringTokenizer; | |
43 | ||
44 | ||
45 | /** | |
46 | * <p> | |
47 | * Internal library methods | |
48 | * </p> | |
49 | * | |
50 | * @author Brian Matzon <brian@matzon.dk> | |
51 | * @version $Revision: 2983 $ | |
52 | * $Id: LWJGLUtil.java 2983 2008-04-07 18:36:09Z matzon $ | |
53 | */ | |
54 | public class LWJGLUtil { | |
55 | public static final int PLATFORM_LINUX = 1; | |
56 | public static final int PLATFORM_MACOSX = 2; | |
57 | public static final int PLATFORM_WINDOWS = 3; | |
58 | public static final String PLATFORM_LINUX_NAME = "linux"; | |
59 | public static final String PLATFORM_MACOSX_NAME = "macosx"; | |
60 | public static final String PLATFORM_WINDOWS_NAME = "windows"; | |
61 | ||
62 | /** LWJGL Logo - 16 by 16 pixels */ | |
63 | public static final ByteBuffer LWJGLIcon16x16 = BufferUtils.createByteBuffer(16 * 16 * 4).put(new byte[] { | |
64 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
65 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -62, -41, -24, -1, 116, -92, -53, -1, 80, -117, | |
66 | -67, -1, 84, -114, -65, -1, -122, -81, -46, -1, -25, -17, -10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
67 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -11, -11, -11, -1, | |
68 | -115, -113, -111, -1, 118, -126, -115, -1, 125, -115, -101, -1, -124, -103, -86, -1, -108, -73, -43, -1, | |
69 | 58, 125, -75, -1, 72, -122, -70, -1, -38, -25, -15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
70 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -12, -8, -5, -1, -100, -98, -96, -1, 0, 0, 0, -1, 0, 0, 0, -1, | |
71 | 0, 0, 0, -1, 0, 0, 0, -1, -28, -28, -28, -1, -124, -83, -48, -1, 58, 125, -75, -1, 91, -110, -63, -1, -4, | |
72 | -3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -111, -74, -43, | |
73 | -1, 95, 95, 95, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 34, 34, 34, -1, -1, -1, -1, -1, -24, -16, -10, | |
74 | -1, 57, 124, -75, -1, 58, 125, -75, -1, -60, -40, -23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
75 | -1, -1, -1, -1, -58, -39, -23, -1, -127, -85, -50, -1, 29, 29, 29, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, | |
76 | -1, 102, 102, 102, -1, -1, -1, -1, -1, -48, -32, -19, -1, 58, 125, -75, -1, 58, 125, -75, -1, -115, -76, | |
77 | -44, -1, -1, -1, -1, -1, -14, -14, -14, -1, -91, -91, -91, -1, -33, -33, -33, -1, -94, -63, -36, -1, -80, | |
78 | -59, -42, -1, 10, 10, 10, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -88, -88, -88, -1, -1, -1, -1, -1, | |
79 | -105, -70, -40, -1, 58, 125, -75, -1, 58, 125, -75, -1, 113, -95, -54, -1, -1, -1, -1, -1, -95, -95, -95, | |
80 | -1, 0, 0, 0, -1, 1, 1, 1, -1, 35, 35, 35, -1, -52, -52, -52, -1, -48, -48, -48, -1, -91, -91, -91, -1, | |
81 | -124, -124, -124, -1, 92, 92, 92, -1, -17, -17, -17, -1, -1, -1, -1, -1, 96, -106, -61, -1, 58, 125, -75, | |
82 | -1, 58, 125, -75, -1, 109, -98, -56, -1, -1, -1, -1, -1, 94, 94, 94, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, | |
83 | -1, -49, -49, -49, -1, 31, 31, 31, -1, 3, 3, 3, -1, 43, 43, 43, -1, 108, 108, 108, -1, -58, -58, -58, -1, | |
84 | -6, -4, -3, -1, -98, -65, -38, -1, 119, -91, -52, -1, 76, -119, -68, -1, 124, -88, -50, -1, -1, -1, -1, -1, | |
85 | 27, 27, 27, -1, 0, 0, 0, -1, 0, 0, 0, -1, 23, 23, 23, -1, -42, -42, -42, -1, 1, 1, 1, -1, 0, 0, 0, -1, 0, | |
86 | 0, 0, -1, 0, 0, 0, -1, 82, 82, 82, -1, -27, -27, -27, -1, 61, 61, 61, -1, 104, 104, 104, -1, -90, -90, -89, | |
87 | -1, -38, -34, -31, -1, -1, -1, -1, -1, 116, 116, 116, -1, 14, 14, 14, -1, 0, 0, 0, -1, 89, 89, 89, -1, | |
88 | -107, -107, -107, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -111, -111, -111, -1, -101, -101, | |
89 | -101, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 2, 2, 2, -1, 67, 67, 67, -1, -1, -1, -1, -1, -18, -18, | |
90 | -18, -1, -116, -116, -116, -1, -65, -65, -65, -1, 86, 86, 86, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, | |
91 | 0, 0, -1, -45, -45, -45, -1, 88, 88, 88, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 51, 51, | |
92 | 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -3, -2, -1, -1, -1, -1, -1, -64, -64, -64, -1, 64, 64, 64, -1, | |
93 | 2, 2, 2, -1, 0, 0, 0, -1, 27, 27, 27, -1, -5, -5, -5, -1, 23, 23, 23, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
94 | 0, -1, 0, 0, 0, -1, 120, 120, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -46, -31, -18, -1, 126, -87, -50, | |
95 | -1, -32, -22, -13, -1, -1, -1, -1, -1, -44, -44, -44, -1, 109, 109, 109, -1, -124, -124, -124, -1, -45, | |
96 | -45, -45, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -67, -67, -67, -1, -1, -1, | |
97 | -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, 102, -102, -59, -1, 61, 127, -74, -1, -126, -84, -48, -1, -28, -19, | |
98 | -11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -27, -27, -27, -1, 45, 45, 45, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
99 | 0, -1, 12, 12, 12, -1, -10, -10, -10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -30, -20, -12, | |
100 | -1, 77, -119, -68, -1, 58, 125, -75, -1, 62, -128, -74, -1, -121, -80, -46, -1, -25, -17, -10, -1, -1, -1, | |
101 | -1, -1, -2, -2, -2, -1, -68, -68, -68, -1, 79, 79, 79, -1, 3, 3, 3, -1, 74, 74, 74, -1, -1, -1, -1, -1, -1, | |
102 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -21, -14, -8, -1, -116, -77, -44, -1, 86, -112, | |
103 | -64, -1, 80, -116, -67, -1, 119, -91, -52, -1, -19, -13, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
104 | -1, -1, -33, -33, -33, -1, -26, -26, -26, -1, -1, -1, -1, -1 | |
105 | }); | |
106 | ||
107 | /** LWJGL Logo - 32 by 32 pixels */ | |
108 | public static final ByteBuffer LWJGLIcon32x32 = BufferUtils.createByteBuffer(32 * 32 * 4).put(new byte[] { | |
109 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
110 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
111 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -6, -4, -3, -1, -53, -35, | |
112 | -20, -1, -109, -73, -42, -1, 111, -96, -55, -1, 92, -109, -62, -1, 96, -106, -61, -1, 122, -89, -51, -1, | |
113 | -84, -56, -32, -1, -19, -13, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
114 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
115 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
116 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -3, -2, -1, -75, -50, -29, -1, 90, -110, -63, -1, | |
117 | 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, | |
118 | 58, 125, -75, -1, 69, -123, -71, -1, -95, -63, -36, -1, -4, -3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
119 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
120 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
121 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -4, -4, -1, -30, -22, -15, -1, -72, -49, -29, -1, -82, -55, -32, | |
122 | -1, -93, -62, -36, -1, -104, -70, -40, -1, -116, -77, -45, -1, -127, -84, -49, -1, 110, -97, -56, -1, 61, | |
123 | 127, -74, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 114, -94, -54, -1, -11, -8, -5, -1, -1, | |
124 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
125 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
126 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -40, -40, -40, -1, 49, 49, 49, -1, 36, 36, 36, -1, 49, 49, 49, -1, 64, | |
127 | 64, 64, -1, 82, 82, 82, -1, 101, 101, 101, -1, 116, 116, 116, -1, -113, -113, -113, -1, -9, -8, -8, -1, | |
128 | -84, -56, -33, -1, 59, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 121, -89, -51, | |
129 | -1, -4, -3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
130 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
131 | -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, 104, 104, 104, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
132 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -74, -74, -74, -1, -2, -2, -2, -1, -122, -82, | |
133 | -47, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -82, -54, -31, -1, -1, -1, | |
134 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
135 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -45, -30, -18, | |
136 | -1, -31, -22, -14, -1, 40, 40, 40, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, | |
137 | 0, 0, -1, 0, 0, 0, -1, 2, 2, 2, -1, -34, -34, -34, -1, -1, -1, -1, -1, -11, -8, -5, -1, 91, -110, -63, -1, | |
138 | 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 72, -122, -70, -1, -12, -8, -5, -1, -1, -1, -1, -1, | |
139 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
140 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -20, -13, -8, -1, 100, -103, -59, -1, -41, -39, -37, | |
141 | -1, 5, 5, 5, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, | |
142 | 36, 36, 36, -1, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -64, -43, -25, -1, 57, 124, -75, -1, 58, | |
143 | 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -85, -56, -32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
144 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
145 | -1, -1, -1, -1, -2, -1, -1, -1, 120, -90, -52, -1, 123, -89, -51, -1, -98, -98, -98, -1, 0, 0, 0, -1, 0, 0, | |
146 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 101, 101, 101, -1, -1, | |
147 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -30, -20, -12, -1, 55, 123, -76, -1, 58, 125, -75, -1, 58, 125, | |
148 | -75, -1, 58, 125, -75, -1, 102, -102, -59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
149 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -61, | |
150 | -41, -24, -1, 57, 125, -75, -1, -78, -52, -31, -1, 88, 88, 88, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, | |
151 | 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -87, -87, -87, -1, -1, -1, -1, -1, -1, -1, | |
152 | -1, -1, -1, -1, -1, -1, -68, -46, -27, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, | |
153 | -75, -1, 64, -127, -73, -1, -18, -12, -7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
154 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -6, -4, -3, -1, 90, -110, -63, -1, 61, | |
155 | 127, -74, -1, -35, -27, -19, -1, 28, 28, 28, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
156 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 7, 7, 7, -1, -25, -25, -25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
157 | -1, -1, -123, -82, -47, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 57, | |
158 | 125, -75, -1, -52, -34, -20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, | |
159 | -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -70, -46, -27, -1, 58, 125, -75, -1, 87, -112, -65, | |
160 | -1, -48, -47, -47, -1, 3, 3, 3, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
161 | 0, -1, 0, 0, 0, -1, 51, 51, 51, -1, -3, -3, -3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -5, -4, -3, -1, 80, | |
162 | -117, -67, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 57, 125, -75, -1, | |
163 | -79, -52, -30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -54, -54, -54, -1, 55, 55, 55, -1, 97, | |
164 | 97, 97, -1, -94, -94, -94, -1, -35, -35, -35, -1, -28, -20, -13, -1, -79, -53, -31, -1, -76, -51, -30, -1, | |
165 | -26, -26, -26, -1, 35, 35, 35, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
166 | 0, -1, 0, 0, 0, -1, 114, 114, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -40, -27, -16, -1, | |
167 | 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, | |
168 | -96, -64, -37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, 102, 102, -1, 0, 0, 0, -1, 0, 0, 0, | |
169 | -1, 0, 0, 0, -1, 6, 6, 6, -1, 39, 39, 39, -1, 102, 102, 102, -1, -44, -44, -44, -1, -1, -1, -1, -1, -10, | |
170 | -10, -10, -1, -48, -48, -48, -1, -105, -105, -105, -1, 94, 94, 94, -1, 39, 39, 39, -1, 4, 4, 4, -1, 0, 0, | |
171 | 0, -1, 3, 3, 3, -1, -64, -64, -64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -94, -63, -37, -1, | |
172 | 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, | |
173 | -98, -65, -38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -5, -5, -5, -1, 37, 37, 37, -1, 0, 0, 0, -1, 0, 0, 0, | |
174 | -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 92, 92, 92, -1, -1, -1, -1, -1, -22, -22, -22, -1, | |
175 | -113, -113, -113, -1, -75, -75, -75, -1, -23, -23, -23, -1, -3, -3, -3, -1, -25, -25, -25, -1, -78, -78, | |
176 | -78, -1, -67, -67, -67, -1, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, -99, -57, | |
177 | -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, | |
178 | -1, -95, -63, -36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -37, -37, -37, -1, 3, 3, 3, -1, 0, 0, 0, -1, 0, 0, | |
179 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -125, -125, -125, -1, -1, -1, -1, -1, 95, 95, | |
180 | 95, -1, 0, 0, 0, -1, 0, 0, 0, -1, 11, 11, 11, -1, 55, 55, 55, -1, 118, 118, 118, -1, -73, -73, -73, -1, | |
181 | -16, -16, -16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -16, -11, -7, -1, 75, -120, -69, -1, 61, | |
182 | 127, -74, -1, 57, 124, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, | |
183 | -78, -52, -30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -102, -102, -102, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, | |
184 | -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -59, -59, -59, -1, -9, -9, -9, -1, 29, 29, 29, -1, | |
185 | 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 7, 7, 7, -1, 60, 60, 60, -1, | |
186 | -33, -33, -33, -1, -1, -1, -1, -1, -5, -4, -3, -1, -4, -3, -2, -1, -13, -9, -6, -1, -52, -35, -21, -1, -98, | |
187 | -66, -38, -1, 114, -95, -55, -1, 76, -119, -69, -1, 58, 125, -75, -1, -55, -36, -21, -1, -1, -1, -1, -1, | |
188 | -1, -1, -1, -1, 86, 86, 86, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, | |
189 | -1, 15, 15, 15, -1, -7, -7, -7, -1, -47, -47, -47, -1, 3, 3, 3, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, | |
190 | 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -114, -114, -114, -1, -1, -1, -1, -1, -7, | |
191 | -7, -7, -1, -124, -124, -124, -1, 112, 112, 112, -1, -80, -80, -80, -1, -22, -22, -22, -1, -1, -1, -1, -1, | |
192 | -7, -5, -4, -1, -36, -24, -14, -1, -10, -7, -4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, 21, 21, -1, 0, 0, | |
193 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 78, 78, 78, -1, -1, -1, -1, -1, | |
194 | -111, -111, -111, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
195 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -69, -69, -69, -1, -1, -1, -1, -1, -98, -98, -98, -1, 0, 0, 0, -1, 0, 0, | |
196 | 0, -1, 0, 0, 0, -1, 4, 4, 4, -1, 47, 47, 47, -1, 112, 112, 112, -1, -80, -80, -80, -1, -26, -26, -26, -1, | |
197 | -2, -2, -2, -1, -1, -1, -1, -1, 57, 57, 57, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
198 | 0, -1, 0, 0, 0, -1, -112, -112, -112, -1, -1, -1, -1, -1, 77, 77, 77, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
199 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 16, 16, 16, -1, -16, -16, -16, -1, | |
200 | -1, -1, -1, -1, 90, 90, 90, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, | |
201 | -1, 0, 0, 0, -1, 9, 9, 9, -1, 50, 50, 50, -1, -79, -79, -79, -1, -10, -10, -10, -1, -95, -95, -95, -1, 53, | |
202 | 53, 53, -1, 2, 2, 2, -1, 0, 0, 0, -1, 0, 0, 0, -1, 2, 2, 2, -1, -47, -47, -47, -1, -11, -11, -11, -1, 19, | |
203 | 19, 19, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, | |
204 | 0, 0, -1, 69, 69, 69, -1, -2, -2, -2, -1, -8, -8, -8, -1, 29, 29, 29, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
205 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 43, 43, 43, -1, -1, | |
206 | -1, -1, -1, -1, -1, -1, -1, -4, -4, -4, -1, -66, -66, -66, -1, 80, 80, 80, -1, 5, 5, 5, -1, 37, 37, 37, -1, | |
207 | -7, -7, -7, -1, -62, -62, -62, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
208 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -122, -122, -122, -1, -1, -1, -1, -1, -46, -46, -46, -1, 1, | |
209 | 1, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
210 | 0, -1, 0, 0, 0, -1, 67, 67, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, | |
211 | -2, -1, -36, -36, -36, -1, -32, -32, -32, -1, -1, -1, -1, -1, -107, -107, -107, -1, 0, 0, 0, -1, 0, 0, 0, | |
212 | -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 1, 1, 1, -1, -56, -56, | |
213 | -56, -1, -1, -1, -1, -1, -114, -114, -114, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, | |
214 | -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -120, -120, -120, -1, -1, -1, -1, -1, | |
215 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
216 | -1, -33, -33, -33, -1, 41, 41, 41, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, | |
217 | 0, 0, -1, 0, 0, 0, -1, 24, 24, 24, -1, -11, -11, -11, -1, -1, -1, -1, -1, 74, 74, 74, -1, 0, 0, 0, -1, 0, | |
218 | 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
219 | 0, -1, -49, -49, -49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
220 | -15, -10, -6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -7, -7, -7, -1, -75, -75, -75, -1, 75, | |
221 | 75, 75, -1, 6, 6, 6, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 82, 82, 82, -1, -1, -1, -1, | |
222 | -1, -8, -8, -8, -1, 16, 16, 16, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, | |
223 | 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 28, 28, 28, -1, -8, -8, -8, -1, -1, -1, -1, -1, -1, -1, -1, | |
224 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -122, -81, -47, -1, -112, -75, -43, -1, -22, -15, -9, | |
225 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -37, -37, -37, -1, 120, 120, 120, -1, | |
226 | 27, 27, 27, -1, 0, 0, 0, -1, 0, 0, 0, -1, -106, -106, -106, -1, -1, -1, -1, -1, -58, -58, -58, -1, 0, 0, 0, | |
227 | -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, | |
228 | 0, 0, 0, -1, 90, 90, 90, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
229 | -1, -1, -1, -1, -1, -61, -40, -23, -1, 58, 125, -75, -1, 67, -125, -72, -1, -108, -72, -42, -1, -19, -13, | |
230 | -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -12, -12, -12, -1, -89, -89, -89, | |
231 | -1, -123, -123, -123, -1, -12, -12, -12, -1, -1, -1, -1, -1, -122, -122, -122, -1, 0, 0, 0, -1, 0, 0, 0, | |
232 | -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, | |
233 | -99, -99, -99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
234 | -1, -1, -6, -5, -3, -1, 93, -108, -62, -1, 58, 125, -75, -1, 58, 125, -75, -1, 70, -123, -71, -1, -104, | |
235 | -69, -40, -1, -17, -12, -7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
236 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -101, -101, -101, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, | |
237 | -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 5, 5, 5, -1, -35, -35, -35, -1, -1, | |
238 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
239 | -59, -39, -23, -1, 59, 126, -74, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 72, -122, -70, | |
240 | -1, -98, -66, -38, -1, -14, -10, -6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
241 | -1, -1, -1, -1, -5, -5, -5, -1, -114, -114, -114, -1, 37, 37, 37, -1, 1, 1, 1, -1, 0, 0, 0, -1, 0, 0, 0, | |
242 | -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 44, 44, 44, -1, -4, -4, -4, -1, -1, -1, -1, -1, -1, | |
243 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
244 | -113, -75, -43, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, | |
245 | -1, 74, -121, -69, -1, -93, -62, -36, -1, -13, -9, -6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
246 | -1, -1, -1, -1, -1, -1, -1, -1, -6, -6, -6, -1, -80, -80, -80, -1, 69, 69, 69, -1, 4, 4, 4, -1, 0, 0, 0, | |
247 | -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 110, 110, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
248 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -3, | |
249 | -2, -1, -123, -81, -47, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, | |
250 | 125, -75, -1, 58, 125, -75, -1, 77, -119, -68, -1, -88, -59, -34, -1, -10, -7, -4, -1, -1, -1, -1, -1, -1, | |
251 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, -46, -46, -46, -1, 104, 104, | |
252 | 104, -1, 14, 14, 14, -1, 0, 0, 0, -1, 1, 1, 1, -1, -72, -72, -72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
253 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
254 | -1, -1, -1, -1, -2, -2, -1, -1, -79, -53, -30, -1, 76, -119, -68, -1, 57, 125, -75, -1, 58, 125, -75, -1, | |
255 | 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 77, -119, -68, -1, -65, -44, -25, | |
256 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
257 | -1, -1, -20, -20, -20, -1, -109, -109, -109, -1, -101, -101, -101, -1, -3, -3, -3, -1, -1, -1, -1, -1, -1, | |
258 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
259 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -13, -9, -6, -1, -75, -50, -29, -1, -127, | |
260 | -84, -48, -1, 101, -103, -59, -1, 97, -105, -60, -1, 108, -98, -56, -1, -113, -75, -43, -1, -59, -39, -23, | |
261 | -1, -9, -6, -4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
262 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
263 | -1, -1, -1 | |
264 | }); | |
265 | ||
266 | /** Debug flag. */ | |
267 | public static final boolean DEBUG = getPrivilegedBoolean("org.lwjgl.util.Debug"); | |
268 | ||
269 | static { | |
270 | LWJGLIcon16x16.flip(); | |
271 | LWJGLIcon32x32.flip(); | |
272 | } | |
273 | ||
274 | /** | |
275 | * @see #PLATFORM_WINDOWS | |
276 | * @see #PLATFORM_LINUX | |
277 | * @see #PLATFORM_MACOSX | |
278 | * @return the current platform type | |
279 | */ | |
280 | public static int getPlatform() { | |
281 | String osName = getPrivilegedProperty("os.name"); | |
282 | ||
283 | if (osName.startsWith("Windows")) { | |
284 | return PLATFORM_WINDOWS; | |
285 | } else if (osName.startsWith("Linux") || osName.startsWith("FreeBSD") || osName.startsWith("SunOS")) { | |
286 | return PLATFORM_LINUX; | |
287 | } else if (osName.startsWith("Mac OS X")) { | |
288 | return PLATFORM_MACOSX; | |
289 | } else { | |
290 | throw new LinkageError("Unknown platform: " + osName); | |
291 | } | |
292 | } | |
293 | ||
294 | ||
295 | /** | |
296 | * @see #PLATFORM_WINDOWS_NAME | |
297 | * @see #PLATFORM_LINUX_NAME | |
298 | * @see #PLATFORM_MACOSX_NAME | |
299 | * @return current platform name | |
300 | */ | |
301 | public static String getPlatformName() { | |
302 | switch (LWJGLUtil.getPlatform()) { | |
303 | case LWJGLUtil.PLATFORM_LINUX: | |
304 | return PLATFORM_LINUX_NAME; | |
305 | case LWJGLUtil.PLATFORM_MACOSX: | |
306 | return PLATFORM_MACOSX_NAME; | |
307 | case LWJGLUtil.PLATFORM_WINDOWS: | |
308 | return PLATFORM_WINDOWS_NAME; | |
309 | default: | |
310 | return "unknown"; | |
311 | } | |
312 | } | |
313 | ||
314 | /** | |
315 | * Locates the paths required by a library. | |
316 | * | |
317 | * @param libname Local Library Name to search the classloader with ("openal"). | |
318 | * @param platform_lib_name The native library name ("libopenal.so") | |
319 | * @param classloader The classloader to ask for library paths | |
320 | * @return Paths to located libraries, if any | |
321 | */ | |
322 | public static String[] getLibraryPaths(String libname, String platform_lib_name, ClassLoader classloader) { | |
323 | return getLibraryPaths(libname, new String[]{platform_lib_name}, classloader); | |
324 | } | |
325 | ||
326 | /** | |
327 | * Locates the paths required by a library. | |
328 | * | |
329 | * @param libname Local Library Name to search the classloader with ("openal"). | |
330 | * @param platform_lib_names The list of possible library names ("libopenal.so") | |
331 | * @param classloader The classloader to ask for library paths | |
332 | * @return Paths to located libraries, if any | |
333 | */ | |
334 | public static String[] getLibraryPaths(String libname, String[] platform_lib_names, ClassLoader classloader) { | |
335 | // need to pass path of possible locations of library to native side | |
336 | List possible_paths = new ArrayList(); | |
337 | ||
338 | String classloader_path = getPathFromClassLoader(libname, classloader); | |
339 | if (classloader_path != null) { | |
340 | log("getPathFromClassLoader: Path found: " + classloader_path); | |
341 | possible_paths.add(classloader_path); | |
342 | } | |
343 | ||
344 | for (int i = 0; i < platform_lib_names.length; i++) { | |
345 | String platform_lib_name = platform_lib_names[i]; | |
346 | String lwjgl_classloader_path = getPathFromClassLoader("lwjgl", classloader); | |
347 | if (lwjgl_classloader_path != null) { | |
348 | log("getPathFromClassLoader: Path found: " + lwjgl_classloader_path); | |
349 | possible_paths.add(lwjgl_classloader_path.substring(0, lwjgl_classloader_path.lastIndexOf(File.separator)) | |
350 | + File.separator + platform_lib_name); | |
351 | } | |
352 | ||
353 | // add Installer path | |
354 | String alternative_path = getPrivilegedProperty("org.lwjgl.librarypath"); | |
355 | if (alternative_path != null) { | |
356 | possible_paths.add(alternative_path + File.separator + platform_lib_name); | |
357 | } | |
358 | ||
359 | // Add all possible paths from java.library.path | |
360 | String java_library_path = getPrivilegedProperty("java.library.path"); | |
361 | ||
362 | StringTokenizer st = new StringTokenizer(java_library_path, File.pathSeparator); | |
363 | while (st.hasMoreTokens()) { | |
364 | String path = st.nextToken(); | |
365 | possible_paths.add(path + File.separator + platform_lib_name); | |
366 | } | |
367 | ||
368 | //add current path | |
369 | String current_dir = getPrivilegedProperty("user.dir"); | |
370 | possible_paths.add(current_dir + File.separator + platform_lib_name); | |
371 | ||
372 | //add pure library (no path, let OS search) | |
373 | possible_paths.add(platform_lib_name); | |
374 | } | |
375 | ||
376 | //create needed string array | |
377 | String[] paths = new String[possible_paths.size()]; | |
378 | possible_paths.toArray(paths); | |
379 | return paths; | |
380 | } | |
381 | ||
382 | static void execPrivileged(final String[] cmd_array) throws Exception { | |
383 | try { | |
384 | Process process = (Process)AccessController.doPrivileged(new PrivilegedExceptionAction() { | |
385 | public Object run() throws Exception { | |
386 | return Runtime.getRuntime().exec(cmd_array); | |
387 | } | |
388 | }); | |
389 | // Close unused streams to make sure the child process won't hang | |
390 | process.getInputStream().close(); | |
391 | process.getOutputStream().close(); | |
392 | process.getErrorStream().close(); | |
393 | } catch (PrivilegedActionException e) { | |
394 | throw (Exception)e.getCause(); | |
395 | } | |
396 | } | |
397 | ||
398 | private static String getPrivilegedProperty(final String property_name) { | |
399 | return (String)AccessController.doPrivileged(new PrivilegedAction() { | |
400 | public Object run() { | |
401 | return System.getProperty(property_name); | |
402 | } | |
403 | }); | |
404 | } | |
405 | ||
406 | /** | |
407 | * Tries to locate named library from the current ClassLoader | |
408 | * This method exists because native libraries are loaded from native code, and as such | |
409 | * is exempt from ClassLoader library loading rutines. It therefore always fails. | |
410 | * We therefore invoke the protected method of the ClassLoader to see if it can | |
411 | * locate it. | |
412 | * | |
413 | * @param libname Name of library to search for | |
414 | * @param classloader Classloader to use | |
415 | * @return Absolute path to library if found, otherwise null | |
416 | */ | |
417 | private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) { | |
418 | try { | |
419 | log("getPathFromClassLoader: searching for: " + libname); | |
420 | Class c = classloader.getClass(); | |
421 | while (c != null) { | |
422 | final Class clazz = c; | |
423 | try { | |
424 | return (String)AccessController.doPrivileged(new PrivilegedExceptionAction() { | |
425 | public Object run() throws Exception { | |
426 | Method findLibrary = clazz.getDeclaredMethod("findLibrary", new Class[]{String.class}); | |
427 | findLibrary.setAccessible(true); | |
428 | Object[] arguments = new Object[] {libname}; | |
429 | String path = (String)findLibrary.invoke(classloader, arguments); | |
430 | return path; | |
431 | } | |
432 | }); | |
433 | } catch (PrivilegedActionException e) { | |
434 | log("Failed to locate findLibrary method: " + e.getCause()); | |
435 | c = c.getSuperclass(); | |
436 | } | |
437 | } | |
438 | } catch (Exception e) { | |
439 | log("Failure locating " + e + " using classloader:" + e); | |
440 | } | |
441 | return null; | |
442 | } | |
443 | ||
444 | /** | |
445 | * Gets a boolean property as a privileged action. | |
446 | */ | |
447 | private static boolean getPrivilegedBoolean(final String property_name) { | |
448 | Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() { | |
449 | public Object run() { | |
450 | return new Boolean(Boolean.getBoolean(property_name)); | |
451 | } | |
452 | }); | |
453 | return value.booleanValue(); | |
454 | } | |
455 | ||
456 | /** | |
457 | * Prints the given message to System.err if DEBUG is true. | |
458 | * | |
459 | * @param msg Message to print | |
460 | */ | |
461 | public static void log(String msg) { | |
462 | if (DEBUG) { | |
463 | System.err.println(msg); | |
464 | } | |
465 | } | |
466 | ||
467 | /** | |
468 | * Method to determine if the current system is running a version of | |
469 | * Mac OS X better than the given version. This is only useful for Mac OS X | |
470 | * specific code and will not work for any other platform. | |
471 | */ | |
472 | public static boolean isMacOSXEqualsOrBetterThan(int major_required, int minor_required) { | |
473 | String os_version = getPrivilegedProperty("os.version"); | |
474 | StringTokenizer version_tokenizer = new StringTokenizer(os_version, "."); | |
475 | int major; | |
476 | int minor; | |
477 | try { | |
478 | String major_str = version_tokenizer.nextToken(); | |
479 | String minor_str = version_tokenizer.nextToken(); | |
480 | major = Integer.parseInt(major_str); | |
481 | minor = Integer.parseInt(minor_str); | |
482 | } catch (Exception e) { | |
483 | LWJGLUtil.log("Exception occurred while trying to determine OS version: " + e); | |
484 | // Best guess, no | |
485 | return false; | |
486 | } | |
487 | return major > major_required || (major == major_required && minor >= minor_required); | |
488 | } | |
489 | ||
490 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | ||
34 | /** | |
35 | * | |
36 | * @author elias_naur <elias_naur@users.sourceforge.net> | |
37 | * @version $Revision: 3298 $ | |
38 | * $Id: LinuxSysImplementation.java 3298 2010-03-28 23:11:17Z matzon $ | |
39 | */ | |
40 | final class LinuxSysImplementation extends J2SESysImplementation { | |
41 | private final static int JNI_VERSION = 18; | |
42 | ||
43 | static { | |
44 | java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded | |
45 | } | |
46 | ||
47 | public int getRequiredJNIVersion() { | |
48 | return JNI_VERSION; | |
49 | } | |
50 | ||
51 | public boolean openURL(final String url) { | |
52 | // Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it | |
53 | // right anyway. | |
54 | ||
55 | String[] browsers = {"xdg-open", "firefox", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"}; | |
56 | ||
57 | for (int i = 0; i < browsers.length; i ++) { | |
58 | final String browser = browsers[i]; | |
59 | try { | |
60 | LWJGLUtil.execPrivileged(new String[] { browser, url }); | |
61 | return true; | |
62 | } catch (Exception e) { | |
63 | // Ignore | |
64 | e.printStackTrace(System.err); | |
65 | } | |
66 | } | |
67 | ||
68 | // Seems to have failed | |
69 | return false; | |
70 | } | |
71 | ||
72 | public boolean has64Bit() { | |
73 | return true; | |
74 | } | |
75 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import java.awt.Toolkit; | |
34 | ||
35 | import com.apple.eio.FileManager; | |
36 | ||
37 | /** | |
38 | * | |
39 | * @author elias_naur <elias_naur@users.sourceforge.net> | |
40 | * @version $Revision: 3298 $ | |
41 | * $Id: MacOSXSysImplementation.java 3298 2010-03-28 23:11:17Z matzon $ | |
42 | */ | |
43 | final class MacOSXSysImplementation extends J2SESysImplementation { | |
44 | private final static int JNI_VERSION = 18; | |
45 | ||
46 | static { | |
47 | // Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3 | |
48 | Toolkit.getDefaultToolkit(); | |
49 | } | |
50 | ||
51 | public int getRequiredJNIVersion() { | |
52 | return JNI_VERSION; | |
53 | } | |
54 | ||
55 | public boolean openURL(String url) { | |
56 | try { | |
57 | FileManager.openURL(url); | |
58 | return true; | |
59 | } catch (Exception e) { | |
60 | LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e); | |
61 | return false; | |
62 | } | |
63 | } | |
64 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import java.nio.ByteBuffer; | |
34 | import java.nio.ShortBuffer; | |
35 | import java.nio.IntBuffer; | |
36 | import java.nio.FloatBuffer; | |
37 | import java.nio.LongBuffer; | |
38 | import java.nio.DoubleBuffer; | |
39 | import java.nio.ByteOrder; | |
40 | ||
41 | /** | |
42 | * Utility class to cache thread local direct buffers so when we are passed a non-direct buffer, | |
43 | * we can put its contents into a cached direct buffer and use that at the native side instead. | |
44 | * | |
45 | * Internal class, don't use. | |
46 | * @author elias_naur <elias_naur@users.sourceforge.net> | |
47 | * @version $Revision: 2762 $ | |
48 | * $Id: BufferChecks.java 2762 2007-04-11 16:13:05Z elias_naur $ | |
49 | */ | |
50 | public final class NondirectBufferWrapper { | |
51 | private final static int INITIAL_BUFFER_SIZE = 1; | |
52 | ||
53 | private final static ThreadLocal thread_buffer = new ThreadLocal() { | |
54 | protected Object initialValue() { | |
55 | return new CachedBuffers(INITIAL_BUFFER_SIZE); | |
56 | } | |
57 | }; | |
58 | ||
59 | private static CachedBuffers getCachedBuffers(int minimum_byte_size) { | |
60 | CachedBuffers buffers = (CachedBuffers)thread_buffer.get(); | |
61 | int current_byte_size = buffers.byte_buffer.capacity(); | |
62 | if (minimum_byte_size > current_byte_size) { | |
63 | buffers = new CachedBuffers(minimum_byte_size); | |
64 | thread_buffer.set(buffers); | |
65 | } | |
66 | return buffers; | |
67 | } | |
68 | ||
69 | public static ByteBuffer wrapNoCopyBuffer(ByteBuffer buf, int size) { | |
70 | BufferChecks.checkBufferSize(buf, size); | |
71 | return wrapNoCopyDirect(buf); | |
72 | } | |
73 | ||
74 | public static ShortBuffer wrapNoCopyBuffer(ShortBuffer buf, int size) { | |
75 | BufferChecks.checkBufferSize(buf, size); | |
76 | return wrapNoCopyDirect(buf); | |
77 | } | |
78 | ||
79 | public static IntBuffer wrapNoCopyBuffer(IntBuffer buf, int size) { | |
80 | BufferChecks.checkBufferSize(buf, size); | |
81 | return wrapNoCopyDirect(buf); | |
82 | } | |
83 | ||
84 | public static LongBuffer wrapNoCopyBuffer(LongBuffer buf, int size) { | |
85 | BufferChecks.checkBufferSize(buf, size); | |
86 | return wrapNoCopyDirect(buf); | |
87 | } | |
88 | ||
89 | public static FloatBuffer wrapNoCopyBuffer(FloatBuffer buf, int size) { | |
90 | BufferChecks.checkBufferSize(buf, size); | |
91 | return wrapNoCopyDirect(buf); | |
92 | } | |
93 | ||
94 | public static DoubleBuffer wrapNoCopyBuffer(DoubleBuffer buf, int size) { | |
95 | BufferChecks.checkBufferSize(buf, size); | |
96 | return wrapNoCopyDirect(buf); | |
97 | } | |
98 | ||
99 | public static ByteBuffer wrapBuffer(ByteBuffer buf, int size) { | |
100 | BufferChecks.checkBufferSize(buf, size); | |
101 | return wrapDirect(buf); | |
102 | } | |
103 | ||
104 | public static ShortBuffer wrapBuffer(ShortBuffer buf, int size) { | |
105 | BufferChecks.checkBufferSize(buf, size); | |
106 | return wrapDirect(buf); | |
107 | } | |
108 | ||
109 | public static IntBuffer wrapBuffer(IntBuffer buf, int size) { | |
110 | BufferChecks.checkBufferSize(buf, size); | |
111 | return wrapDirect(buf); | |
112 | } | |
113 | ||
114 | public static LongBuffer wrapBuffer(LongBuffer buf, int size) { | |
115 | BufferChecks.checkBufferSize(buf, size); | |
116 | return wrapDirect(buf); | |
117 | } | |
118 | ||
119 | public static FloatBuffer wrapBuffer(FloatBuffer buf, int size) { | |
120 | BufferChecks.checkBufferSize(buf, size); | |
121 | return wrapDirect(buf); | |
122 | } | |
123 | ||
124 | public static DoubleBuffer wrapBuffer(DoubleBuffer buf, int size) { | |
125 | BufferChecks.checkBufferSize(buf, size); | |
126 | return wrapDirect(buf); | |
127 | } | |
128 | ||
129 | public static ByteBuffer wrapDirect(ByteBuffer buffer) { | |
130 | if (!buffer.isDirect()) | |
131 | return doWrap(buffer); | |
132 | return buffer; | |
133 | } | |
134 | ||
135 | public static ShortBuffer wrapDirect(ShortBuffer buffer) { | |
136 | if (!buffer.isDirect()) | |
137 | return doWrap(buffer); | |
138 | return buffer; | |
139 | } | |
140 | ||
141 | public static FloatBuffer wrapDirect(FloatBuffer buffer) { | |
142 | if (!buffer.isDirect()) | |
143 | return doWrap(buffer); | |
144 | return buffer; | |
145 | } | |
146 | ||
147 | public static IntBuffer wrapDirect(IntBuffer buffer) { | |
148 | if (!buffer.isDirect()) | |
149 | return doWrap(buffer); | |
150 | return buffer; | |
151 | } | |
152 | ||
153 | public static LongBuffer wrapDirect(LongBuffer buffer) { | |
154 | if (!buffer.isDirect()) | |
155 | return doWrap(buffer); | |
156 | return buffer; | |
157 | } | |
158 | ||
159 | public static DoubleBuffer wrapDirect(DoubleBuffer buffer) { | |
160 | if (!buffer.isDirect()) | |
161 | return doWrap(buffer); | |
162 | return buffer; | |
163 | } | |
164 | ||
165 | public static ByteBuffer wrapNoCopyDirect(ByteBuffer buffer) { | |
166 | if (!buffer.isDirect()) | |
167 | return doNoCopyWrap(buffer); | |
168 | return buffer; | |
169 | } | |
170 | ||
171 | public static ShortBuffer wrapNoCopyDirect(ShortBuffer buffer) { | |
172 | if (!buffer.isDirect()) | |
173 | return doNoCopyWrap(buffer); | |
174 | return buffer; | |
175 | } | |
176 | ||
177 | public static FloatBuffer wrapNoCopyDirect(FloatBuffer buffer) { | |
178 | if (!buffer.isDirect()) | |
179 | return doNoCopyWrap(buffer); | |
180 | return buffer; | |
181 | } | |
182 | ||
183 | public static IntBuffer wrapNoCopyDirect(IntBuffer buffer) { | |
184 | if (!buffer.isDirect()) | |
185 | return doNoCopyWrap(buffer); | |
186 | return buffer; | |
187 | } | |
188 | ||
189 | public static LongBuffer wrapNoCopyDirect(LongBuffer buffer) { | |
190 | if (!buffer.isDirect()) | |
191 | return doNoCopyWrap(buffer); | |
192 | return buffer; | |
193 | } | |
194 | ||
195 | public static DoubleBuffer wrapNoCopyDirect(DoubleBuffer buffer) { | |
196 | if (!buffer.isDirect()) | |
197 | return doNoCopyWrap(buffer); | |
198 | return buffer; | |
199 | } | |
200 | ||
201 | public static void copy(ByteBuffer src, ByteBuffer dst) { | |
202 | if (dst != null && !dst.isDirect()) { | |
203 | int saved_position = dst.position(); | |
204 | dst.put(src); | |
205 | dst.position(saved_position); | |
206 | } | |
207 | } | |
208 | ||
209 | public static void copy(ShortBuffer src, ShortBuffer dst) { | |
210 | if (dst != null && !dst.isDirect()) { | |
211 | int saved_position = dst.position(); | |
212 | dst.put(src); | |
213 | dst.position(saved_position); | |
214 | } | |
215 | } | |
216 | ||
217 | public static void copy(IntBuffer src, IntBuffer dst) { | |
218 | if (dst != null && !dst.isDirect()) { | |
219 | int saved_position = dst.position(); | |
220 | dst.put(src); | |
221 | dst.position(saved_position); | |
222 | } | |
223 | } | |
224 | ||
225 | public static void copy(FloatBuffer src, FloatBuffer dst) { | |
226 | if (dst != null && !dst.isDirect()) { | |
227 | int saved_position = dst.position(); | |
228 | dst.put(src); | |
229 | dst.position(saved_position); | |
230 | } | |
231 | } | |
232 | ||
233 | public static void copy(LongBuffer src, LongBuffer dst) { | |
234 | if (dst != null && !dst.isDirect()) { | |
235 | int saved_position = dst.position(); | |
236 | dst.put(src); | |
237 | dst.position(saved_position); | |
238 | } | |
239 | } | |
240 | ||
241 | public static void copy(DoubleBuffer src, DoubleBuffer dst) { | |
242 | if (dst != null && !dst.isDirect()) { | |
243 | int saved_position = dst.position(); | |
244 | dst.put(src); | |
245 | dst.position(saved_position); | |
246 | } | |
247 | } | |
248 | ||
249 | private static ByteBuffer doNoCopyWrap(ByteBuffer buffer) { | |
250 | ByteBuffer direct_buffer = lookupBuffer(buffer); | |
251 | direct_buffer.limit(buffer.limit()); | |
252 | direct_buffer.position(buffer.position()); | |
253 | return direct_buffer; | |
254 | } | |
255 | ||
256 | private static ShortBuffer doNoCopyWrap(ShortBuffer buffer) { | |
257 | ShortBuffer direct_buffer = lookupBuffer(buffer); | |
258 | direct_buffer.limit(buffer.limit()); | |
259 | direct_buffer.position(buffer.position()); | |
260 | return direct_buffer; | |
261 | } | |
262 | ||
263 | private static IntBuffer doNoCopyWrap(IntBuffer buffer) { | |
264 | IntBuffer direct_buffer = lookupBuffer(buffer); | |
265 | direct_buffer.limit(buffer.limit()); | |
266 | direct_buffer.position(buffer.position()); | |
267 | return direct_buffer; | |
268 | } | |
269 | ||
270 | private static FloatBuffer doNoCopyWrap(FloatBuffer buffer) { | |
271 | FloatBuffer direct_buffer = lookupBuffer(buffer); | |
272 | direct_buffer.limit(buffer.limit()); | |
273 | direct_buffer.position(buffer.position()); | |
274 | return direct_buffer; | |
275 | } | |
276 | ||
277 | private static LongBuffer doNoCopyWrap(LongBuffer buffer) { | |
278 | LongBuffer direct_buffer = lookupBuffer(buffer); | |
279 | direct_buffer.limit(buffer.limit()); | |
280 | direct_buffer.position(buffer.position()); | |
281 | return direct_buffer; | |
282 | } | |
283 | ||
284 | private static DoubleBuffer doNoCopyWrap(DoubleBuffer buffer) { | |
285 | DoubleBuffer direct_buffer = lookupBuffer(buffer); | |
286 | direct_buffer.limit(buffer.limit()); | |
287 | direct_buffer.position(buffer.position()); | |
288 | return direct_buffer; | |
289 | } | |
290 | ||
291 | private static ByteBuffer lookupBuffer(ByteBuffer buffer) { | |
292 | return getCachedBuffers(buffer.remaining()).byte_buffer; | |
293 | } | |
294 | ||
295 | private static ByteBuffer doWrap(ByteBuffer buffer) { | |
296 | ByteBuffer direct_buffer = lookupBuffer(buffer); | |
297 | direct_buffer.clear(); | |
298 | int saved_position = buffer.position(); | |
299 | direct_buffer.put(buffer); | |
300 | buffer.position(saved_position); | |
301 | direct_buffer.flip(); | |
302 | return direct_buffer; | |
303 | } | |
304 | ||
305 | private static ShortBuffer lookupBuffer(ShortBuffer buffer) { | |
306 | CachedBuffers buffers = getCachedBuffers(buffer.remaining()*2); | |
307 | return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.short_buffer_little : buffers.short_buffer_big; | |
308 | } | |
309 | ||
310 | private static ShortBuffer doWrap(ShortBuffer buffer) { | |
311 | ShortBuffer direct_buffer = lookupBuffer(buffer); | |
312 | direct_buffer.clear(); | |
313 | int saved_position = buffer.position(); | |
314 | direct_buffer.put(buffer); | |
315 | buffer.position(saved_position); |