summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGentoo <installgentoo@endianness.com>2022-07-22 22:42:24 +1000
committerGentoo <installgentoo@endianness.com>2022-07-22 22:42:24 +1000
commitdb05b9bc0f02b260bd4e35e9aa4fbe980450617d (patch)
treecf50ac2ec7117fcbc0468a159d257dc79139d64d
downloadgl-tron-db05b9bc0f02b260bd4e35e9aa4fbe980450617d.tar.gz
gl-tron-db05b9bc0f02b260bd4e35e9aa4fbe980450617d.tar.bz2
gl-tron-db05b9bc0f02b260bd4e35e9aa4fbe980450617d.zip
version 0.70
-rw-r--r--COPYING340
-rw-r--r--ChangeLog362
-rw-r--r--INSTALL47
-rw-r--r--Makefile.am38
-rw-r--r--Makefile.in508
-rw-r--r--README28
-rw-r--r--aclocal.m4669
-rw-r--r--art/Makefile.am1
-rw-r--r--art/Makefile.in315
-rw-r--r--art/default/Makefile.am8
-rw-r--r--art/default/Makefile.in227
-rw-r--r--art/default/artpack.lua0
-rw-r--r--art/default/babbage.0.pngbin0 -> 72605 bytes
-rw-r--r--art/default/babbage.1.pngbin0 -> 40742 bytes
-rw-r--r--art/default/gltron.pngbin0 -> 46135 bytes
-rw-r--r--art/default/gltron_bitmap.pngbin0 -> 51401 bytes
-rw-r--r--art/default/gltron_floor.pngbin0 -> 1127 bytes
-rw-r--r--art/default/gltron_impact.pngbin0 -> 4004 bytes
-rw-r--r--art/default/gltron_logo.pngbin0 -> 20141 bytes
-rw-r--r--art/default/gltron_trail.pngbin0 -> 1056 bytes
-rw-r--r--art/default/gltron_traildecal.pngbin0 -> 226 bytes
-rw-r--r--art/default/gltron_wall_1.pngbin0 -> 15788 bytes
-rw-r--r--art/default/gltron_wall_2.pngbin0 -> 13944 bytes
-rw-r--r--art/default/gltron_wall_3.pngbin0 -> 18827 bytes
-rw-r--r--art/default/gltron_wall_4.pngbin0 -> 17497 bytes
-rw-r--r--art/default/skybox0.pngbin0 -> 81 bytes
-rw-r--r--art/default/skybox1.pngbin0 -> 81 bytes
-rw-r--r--art/default/skybox2.pngbin0 -> 81 bytes
-rw-r--r--art/default/skybox3.pngbin0 -> 81 bytes
-rw-r--r--art/default/skybox4.pngbin0 -> 81 bytes
-rw-r--r--art/default/skybox5.pngbin0 -> 81 bytes
-rw-r--r--art/default/test.bitmap.pngbin0 -> 6242 bytes
-rw-r--r--art/default/xenotron.0.pngbin0 -> 12918 bytes
-rw-r--r--art/default/xenotron.1.pngbin0 -> 5800 bytes
-rwxr-xr-xconfig.guess1327
-rwxr-xr-xconfig.sub1410
-rwxr-xr-xconfigure5169
-rw-r--r--configure.in188
-rw-r--r--data/Makefile.am6
-rw-r--r--data/Makefile.in225
-rw-r--r--data/babbage.ftx5
-rw-r--r--data/fonts.txt2
-rw-r--r--data/game_crash.oggbin0 -> 34794 bytes
-rw-r--r--data/game_crash.wavbin0 -> 277972 bytes
-rw-r--r--data/game_engine.oggbin0 -> 27956 bytes
-rw-r--r--data/game_engine.wavbin0 -> 231096 bytes
-rw-r--r--data/game_recognizer.oggbin0 -> 75049 bytes
-rw-r--r--data/game_recognizer.wavbin0 -> 394892 bytes
-rw-r--r--data/lightcycle-high.obj5394
-rw-r--r--data/lightcycle-low.obj418
-rw-r--r--data/lightcycle-med.obj2066
-rw-r--r--data/lightcycle.mtl44
-rw-r--r--data/recognizer.mtl11
-rw-r--r--data/recognizer.obj813
-rw-r--r--data/recognizer_quad.obj663
-rw-r--r--data/test.fbmp3
-rw-r--r--data/xenotron.ftx5
-rwxr-xr-xdepcomp411
-rwxr-xr-xinstall-sh251
-rw-r--r--lua/Makefile.am1
-rw-r--r--lua/Makefile.in315
-rw-r--r--lua/README72
-rw-r--r--lua/include/Makefile.am1
-rw-r--r--lua/include/Makefile.in230
-rw-r--r--lua/include/lauxlib.h100
-rw-r--r--lua/include/lua.h248
-rw-r--r--lua/include/luadebug.h46
-rw-r--r--lua/include/lualib.h34
-rw-r--r--lua/src/Makefile.am16
-rw-r--r--lua/src/Makefile.in417
-rw-r--r--lua/src/lapi.c494
-rw-r--r--lua/src/lapi.h17
-rw-r--r--lua/src/lcode.c701
-rw-r--r--lua/src/lcode.h70
-rw-r--r--lua/src/ldebug.c466
-rw-r--r--lua/src/ldebug.h21
-rw-r--r--lua/src/ldo.c388
-rw-r--r--lua/src/ldo.h33
-rw-r--r--lua/src/lfunc.c109
-rw-r--r--lua/src/lfunc.h24
-rw-r--r--lua/src/lgc.c353
-rw-r--r--lua/src/lgc.h19
-rw-r--r--lua/src/lib/Makefile.am11
-rw-r--r--lua/src/lib/Makefile.in299
-rw-r--r--lua/src/lib/README6
-rw-r--r--lua/src/lib/lauxlib.c216
-rw-r--r--lua/src/lib/lbaselib.c651
-rw-r--r--lua/src/lib/ldblib.c188
-rw-r--r--lua/src/lib/liolib.c747
-rw-r--r--lua/src/lib/lmathlib.c238
-rw-r--r--lua/src/lib/lstrlib.c621
-rw-r--r--lua/src/llex.c380
-rw-r--r--lua/src/llex.h72
-rw-r--r--lua/src/llimits.h204
-rw-r--r--lua/src/lmem.c150
-rw-r--r--lua/src/lmem.h42
-rw-r--r--lua/src/lobject.c125
-rw-r--r--lua/src/lobject.h204
-rw-r--r--lua/src/lopcodes.h168
-rw-r--r--lua/src/lparser.c1124
-rw-r--r--lua/src/lparser.h60
-rw-r--r--lua/src/lstate.c121
-rw-r--r--lua/src/lstate.h77
-rw-r--r--lua/src/lstring.c155
-rw-r--r--lua/src/lstring.h37
-rw-r--r--lua/src/ltable.c303
-rw-r--r--lua/src/ltable.h34
-rw-r--r--lua/src/ltests.c543
-rw-r--r--lua/src/ltm.c163
-rw-r--r--lua/src/ltm.h59
-rw-r--r--lua/src/lundump.c244
-rw-r--r--lua/src/lundump.h35
-rw-r--r--lua/src/lvm.c710
-rw-r--r--lua/src/lvm.h32
-rw-r--r--lua/src/lzio.c84
-rw-r--r--lua/src/lzio.h53
-rwxr-xr-xmissing283
-rwxr-xr-xmkinstalldirs40
-rw-r--r--music/Makefile.am3
-rw-r--r--music/Makefile.in221
-rw-r--r--music/song_revenge_of_cats.itbin0 -> 638032 bytes
-rw-r--r--nebu/Makefile.am16
-rw-r--r--nebu/Makefile.in365
-rw-r--r--nebu/audio/Makefile.am9
-rw-r--r--nebu/audio/Makefile.in308
-rw-r--r--nebu/audio/SoundSystem.cpp84
-rw-r--r--nebu/audio/Source.cpp42
-rw-r--r--nebu/audio/Source3D.cpp199
-rw-r--r--nebu/audio/SourceCopy.cpp38
-rw-r--r--nebu/audio/SourceEngine.cpp14
-rw-r--r--nebu/audio/SourceMusic.cpp186
-rw-r--r--nebu/audio/SourceSample.cpp80
-rw-r--r--nebu/base/Makefile.am6
-rw-r--r--nebu/base/Makefile.in300
-rw-r--r--nebu/base/geom.c118
-rw-r--r--nebu/base/matrix.c189
-rw-r--r--nebu/base/random.c37
-rw-r--r--nebu/base/system.c68
-rw-r--r--nebu/base/util.c41
-rw-r--r--nebu/base/vector.c322
-rw-r--r--nebu/filesystem/Makefile.am7
-rw-r--r--nebu/filesystem/Makefile.in299
-rw-r--r--nebu/filesystem/directory.c56
-rw-r--r--nebu/filesystem/file_io.c42
-rw-r--r--nebu/filesystem/filesystem.c16
-rw-r--r--nebu/filesystem/findpath.c106
-rw-r--r--nebu/include/Makefile.am3
-rw-r--r--nebu/include/Makefile.in319
-rw-r--r--nebu/include/Nebu.h11
-rw-r--r--nebu/include/Nebu_audio.h13
-rw-r--r--nebu/include/Nebu_base.h13
-rw-r--r--nebu/include/Nebu_configuration.h5
-rw-r--r--nebu/include/Nebu_filesystem.h7
-rw-r--r--nebu/include/Nebu_input.h7
-rw-r--r--nebu/include/Nebu_scripting.h6
-rw-r--r--nebu/include/Nebu_video.h12
-rw-r--r--nebu/include/audio/Makefile.am1
-rw-r--r--nebu/include/audio/Makefile.in230
-rw-r--r--nebu/include/audio/nebu_Sound.h4
-rw-r--r--nebu/include/audio/nebu_SoundSystem.h56
-rw-r--r--nebu/include/audio/nebu_Source.h59
-rw-r--r--nebu/include/audio/nebu_Source3D.h45
-rw-r--r--nebu/include/audio/nebu_SourceCopy.h24
-rw-r--r--nebu/include/audio/nebu_SourceEngine.h24
-rw-r--r--nebu/include/audio/nebu_SourceMusic.h42
-rw-r--r--nebu/include/audio/nebu_SourceSample.h33
-rw-r--r--nebu/include/audio/nebu_audio_system.h4
-rw-r--r--nebu/include/base/Makefile.am1
-rw-r--r--nebu/include/base/Makefile.in230
-rw-r--r--nebu/include/base/nebu_Vector3.h85
-rw-r--r--nebu/include/base/nebu_callbacks.h16
-rw-r--r--nebu/include/base/nebu_geom.h49
-rw-r--r--nebu/include/base/nebu_matrix.h27
-rw-r--r--nebu/include/base/nebu_random.h8
-rw-r--r--nebu/include/base/nebu_system.h20
-rw-r--r--nebu/include/base/nebu_types.h19
-rw-r--r--nebu/include/base/nebu_util.h20
-rw-r--r--nebu/include/base/nebu_vector.h53
-rw-r--r--nebu/include/filesystem/Makefile.am1
-rw-r--r--nebu/include/filesystem/Makefile.in230
-rw-r--r--nebu/include/filesystem/nebu_file_io.h20
-rw-r--r--nebu/include/filesystem/nebu_filesystem.h21
-rw-r--r--nebu/include/input/Makefile.am1
-rw-r--r--nebu/include/input/Makefile.in230
-rw-r--r--nebu/include/input/nebu_input_system.h80
-rw-r--r--nebu/include/input/nebu_system_keynames.h17
-rw-r--r--nebu/include/scripting/Makefile.am1
-rw-r--r--nebu/include/scripting/Makefile.in230
-rw-r--r--nebu/include/scripting/nebu_scripting.h27
-rw-r--r--nebu/include/video/Makefile.am1
-rw-r--r--nebu/include/video/Makefile.in230
-rw-r--r--nebu/include/video/nebu_console.h17
-rw-r--r--nebu/include/video/nebu_extgl.h3816
-rw-r--r--nebu/include/video/nebu_light.h15
-rw-r--r--nebu/include/video/nebu_png_texture.h16
-rw-r--r--nebu/include/video/nebu_quad.h90
-rw-r--r--nebu/include/video/nebu_renderer_gl.h39
-rw-r--r--nebu/include/video/nebu_video_system.h27
-rw-r--r--nebu/include/video/nebu_video_types.h15
-rw-r--r--nebu/input/Makefile.am8
-rw-r--r--nebu/input/Makefile.in297
-rw-r--r--nebu/input/input_system.c167
-rw-r--r--nebu/input/system_keynames.c55
-rw-r--r--nebu/scripting/Makefile.am15
-rw-r--r--nebu/scripting/Makefile.in304
-rw-r--r--nebu/scripting/scripting.c200
-rw-r--r--nebu/video/Makefile.am8
-rw-r--r--nebu/video/Makefile.in300
-rw-r--r--nebu/video/console.c103
-rw-r--r--nebu/video/pixels.c84
-rw-r--r--nebu/video/png_texture.c157
-rw-r--r--nebu/video/video_system.c112
-rw-r--r--scripts/Makefile.am3
-rw-r--r--scripts/Makefile.in221
-rw-r--r--scripts/artpack.lua30
-rw-r--r--scripts/audio.lua64
-rw-r--r--scripts/basics.lua8
-rw-r--r--scripts/config.lua125
-rw-r--r--scripts/joystick.lua13
-rw-r--r--scripts/main.lua62
-rw-r--r--scripts/menu.lua581
-rw-r--r--scripts/menu_functions.lua91
-rw-r--r--scripts/save.lua33
-rw-r--r--scripts/video.lua36
-rw-r--r--src/Makefile.am21
-rw-r--r--src/Makefile.in365
-rw-r--r--src/audio/Makefile.am15
-rw-r--r--src/audio/Makefile.in322
-rw-r--r--src/audio/sound.c127
-rw-r--r--src/audio/sound_glue.cpp297
-rw-r--r--src/base/Makefile.am9
-rw-r--r--src/base/Makefile.in296
-rw-r--r--src/base/util.c12
-rw-r--r--src/configuration/Makefile.am9
-rw-r--r--src/configuration/Makefile.in296
-rw-r--r--src/configuration/settings.c145
-rw-r--r--src/filesystem/Makefile.am8
-rw-r--r--src/filesystem/Makefile.in296
-rw-r--r--src/filesystem/dirsetup.c17
-rw-r--r--src/filesystem/path.c125
-rw-r--r--src/game/Makefile.am12
-rw-r--r--src/game/Makefile.in327
-rw-r--r--src/game/camera.c281
-rw-r--r--src/game/computer.c169
-rw-r--r--src/game/computer_utilities.c313
-rw-r--r--src/game/credits.c87
-rw-r--r--src/game/engine.c221
-rw-r--r--src/game/event.c445
-rw-r--r--src/game/game.c88
-rw-r--r--src/game/globals.c138
-rw-r--r--src/game/gui.c256
-rw-r--r--src/game/init.c112
-rw-r--r--src/game/init_sdl.c47
-rw-r--r--src/game/menu.c137
-rw-r--r--src/game/pause.c117
-rw-r--r--src/game/scripting_interface.c136
-rw-r--r--src/game/switchCallbacks.c73
-rw-r--r--src/game/timedemo.c152
-rw-r--r--src/gltron.c23
-rw-r--r--src/include/Makefile.am1
-rw-r--r--src/include/Makefile.in315
-rw-r--r--src/include/audio/Makefile.am1
-rw-r--r--src/include/audio/Makefile.in230
-rw-r--r--src/include/audio/audio.h34
-rw-r--r--src/include/audio/sound_glue.h31
-rw-r--r--src/include/base/Makefile.am1
-rw-r--r--src/include/base/Makefile.in230
-rw-r--r--src/include/base/switchCallbacks.h20
-rw-r--r--src/include/base/util.h6
-rw-r--r--src/include/configuration/Makefile.am1
-rw-r--r--src/include/configuration/Makefile.in230
-rw-r--r--src/include/configuration/configuration.h12
-rw-r--r--src/include/configuration/settings.h51
-rw-r--r--src/include/filesystem/Makefile.am1
-rw-r--r--src/include/filesystem/Makefile.in230
-rw-r--r--src/include/filesystem/dirsetup.h9
-rw-r--r--src/include/filesystem/path.h19
-rw-r--r--src/include/game/Makefile.am1
-rw-r--r--src/include/game/Makefile.in230
-rw-r--r--src/include/game/ai.h29
-rw-r--r--src/include/game/camera.h39
-rw-r--r--src/include/game/client_data.h6
-rw-r--r--src/include/game/data.h22
-rw-r--r--src/include/game/engine.h12
-rw-r--r--src/include/game/event.h22
-rw-r--r--src/include/game/game.h117
-rw-r--r--src/include/game/game_data.h93
-rw-r--r--src/include/game/gltron.h43
-rw-r--r--src/include/game/init.h17
-rw-r--r--src/include/game/menu.h35
-rw-r--r--src/include/game/timedemo.h3
-rw-r--r--src/include/game/timesystem.h6
-rw-r--r--src/include/input/Makefile.am1
-rw-r--r--src/include/input/Makefile.in230
-rw-r--r--src/include/input/input.h22
-rw-r--r--src/include/scripting/Makefile.am1
-rw-r--r--src/include/scripting/Makefile.in230
-rw-r--r--src/include/scripting/scripting.h6
-rw-r--r--src/include/video/Makefile.am1
-rw-r--r--src/include/video/Makefile.in230
-rw-r--r--src/include/video/explosion.h7
-rw-r--r--src/include/video/fonttex.h21
-rw-r--r--src/include/video/graphics_fx.h11
-rw-r--r--src/include/video/graphics_hud.h16
-rw-r--r--src/include/video/graphics_lights.h12
-rw-r--r--src/include/video/graphics_utility.h12
-rw-r--r--src/include/video/graphics_world.h9
-rw-r--r--src/include/video/model.h73
-rw-r--r--src/include/video/recognizer.h12
-rw-r--r--src/include/video/skybox.h10
-rw-r--r--src/include/video/texture.h32
-rw-r--r--src/include/video/trail_geometry.h31
-rw-r--r--src/include/video/video.h280
-rw-r--r--src/input/Makefile.am9
-rw-r--r--src/input/Makefile.in296
-rw-r--r--src/input/input.c207
-rw-r--r--src/video/Makefile.am14
-rw-r--r--src/video/Makefile.in343
-rw-r--r--src/video/artpack.c59
-rw-r--r--src/video/compile102
-rw-r--r--src/video/explosion.c149
-rw-r--r--src/video/fonts.c58
-rw-r--r--src/video/fonttex.c202
-rw-r--r--src/video/gamegraphics.c480
-rw-r--r--src/video/graphics_fx.c116
-rw-r--r--src/video/graphics_hud.c149
-rw-r--r--src/video/graphics_lights.c70
-rw-r--r--src/video/graphics_utility.c71
-rw-r--r--src/video/graphics_world.c138
-rw-r--r--src/video/load_texture.c77
-rw-r--r--src/video/material.c155
-rw-r--r--src/video/model.c391
-rw-r--r--src/video/recognizer.c145
-rw-r--r--src/video/screenshot.c158
-rw-r--r--src/video/skybox.c62
-rw-r--r--src/video/texture.c77
-rw-r--r--src/video/trail.c224
-rw-r--r--src/video/trail_geometry.c235
-rw-r--r--src/video/trail_render.c73
-rw-r--r--src/video/video.c282
-rw-r--r--src/video/visuals_2d.c161
341 files changed, 59768 insertions, 0 deletions
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..60549be
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..c9332b9
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,362 @@
+0.62 to 0.70
+
+- booster
+- wall acceleration
+- better handling of .ini file (versioning & protection against partly
+ written files)
+- simplified GUI
+- new bot AI
+
+
+0.61 to 0.62
+- better & faster shadows
+- red outlines on the recognizer
+
+- better 3D sound effects
+- sound effects for player's lightcycle
+- sound effects for recognizer flying overhead
+- support for 'switching songs' (add your own music)
+- mp3 support
+- ogg/vorbis support (only linux version)
+
+- better camera zoom functions
+
+- integrated scripting language
+- more & more intuitive configuration options
+- many stability & performance enhancements
+- distribution friendly build process
+
+
+0.59 to 0.61
+- fixed lightcycle-hits-lightcycle lockup bug
+- fixed a view z-buffer issues
+- camera settings are saved
+
+0.59 to 0.60
+
+Usage:
+- new camera controls, use the mouse to tweak/rotate/zoom
+- removed the 2D map
+- simplified the menu structure
+Graphics:
+- vastly better visuals due to lighting & shadows
+- fixed many rendering artefacts
+- added recognizers
+- new textures / create your own
+Audio:
+- 3D positional sound & doppler effects
+Gameplay:
+- more movie-like default
+- much much stronger AI options (try to beat the MCP)
+Others:
+- in-game credits
+
+some details (outdated):
+- fixed load/save of player options (computer/human/none)
+- fixed crash on exit on linux/3dfx
+- converted all '// ... ' comments to '/* ... */' for added portability
+- added z-tests for almost everything to prevent visual artefacts
+- back-to-front ordering of transparent surfaces (sort-of)
+- converted 0 to NULL for null pointers
+- changed internals for:
+- collision detection, turns, movement, trails,
+- messed with trail drawing (z-buffer), moved that to trail.c
+- added mouse callbacks (glut only) and stubs in the gui
+- added mouse callbacks for SDL and SYSTEM_MOUSEUP, SYSTEM_MOUSEDOWN constants
+- colored debug texture (2D map)
+- added second 2D map for evaluation (one line drawing, one textured)
+- added "console" for status messages
+- added ligthing for trails
+- added shadows to trails
+- added line to trail-top to make them appear 'thick'
+- added 'art-pack' support
+- rewritten texture handling / loading. added 'fallback' path
+- texture repeat or stretch on larger arenas (configurable)
+- too many to add
+
+0.53 to 0.59
+most important visible changes (including the ones to 0.59beta)
+Game play:
+- rewrote computer player / added skill levels
+- different arena sizes (menu item)
+- different speeds (menu item)
+- experimental speed oszillation
+- configure players (human, computer, none)
+Other:
+- very cool new model from Charles Babbage
+- levels-of-detail for the model
+- configure keyboard controls (not saved between games yet)
+- added volume settings for music / fx to Audio menu
+- used wall & floor texture from Nicolas Zimmermann
+- (optional) sound effects, SDL version only
+- added trail decals on solid trails (option)
+- added trail bow before cycle
+- changed GUI background
+- resized menu (dynamic size now)
+- added screenshot function (F12 - disabled on MacOS)
+- fixed lightcycle going backwards (if you liked the old way better,
+ that's an option now)
+- added arena overview camera mode when dead
+- GNU autoconf WOOO! WOOO!
+- textures in png format
+
+other visible changes (including the ones to 0.59beta)
+- played with wall dimensions
+- fixed chase camera starting position
+- fixed bug with crash texture turning then crashing during smooth turn
+- 4 different wall textures (Nicolas, Darrell)
+- added mipmapping with GLU box filter (Darrell)
+- choose bitween bilinear & trilinear filtering
+- fixed wall textures being upside down
+- adjusted clip plane (better 1st person view now)
+- added polygon counter
+- added support for multiple fonts
+- cam chase speed scales with cycle speed now
+
+code changes:
+- see cvs logs
+
+to 0.59beta
+visible changes
+- Arena size is now a variable (game->settins->grid_size or grid_size
+ in gltron.ini)
+- cam chase speed scales with cycle speed now
+- fixed lightcycle going backwards (if you liked the old way better,
+ that's an option now)
+- (optional) sound effects, SDL version only
+- fixed wall textures being upside down
+- used wall & floor texture from Nicolas Zimmermann <nicozim@libertysurf.fr>
+- fixed bug with crash texture turning then crashing during smooth turn
+- 4 different wall textures (Nicolas, Darrell)
+- added mipmapping with GLU box filter (Darrell)
+- added different speeds to Game Settings menu (boring, normal, fast, crazy)
+- fixed chase camera starting position
+- played with wall dimensions
+- experimental speed oszillation
+- very cool new model from Charles Babbage
+- levels-of-detail for the model
+- configure players (human, computer, none)
+- configure keyboard controls (not saved between games yet)
+- added arena overview camera mode when dead
+- GNU autoconf WOOO! WOOO!
+
+code changes
+- removed clearCol
+- added parameters for value, colmap, colwidth to setCol, getCol
+ to remove dependency from global variable
+- moved all data files (except sound effects) into data/ subdirectory
+ this breaks make install of course
+- regrouped variable declarations in data.h
+- hopefully fixed stupid file loading bug now
+- changed MAX_VAR_NAME_LEN to 64
+- sanity check for grid_size and speed
+- added sound effect stubs to libmikmod code for compatibility
+- halfed crash texture
+- changed wall texture OGL format to GL_RGB (565 is better than 4444)
+- fixed bug with capped walls (wrong texcoords)
+- properly shut down SDL sound at exit
+- unite special&keyboard callbacks
+
+to 0.54
+- fixed bug that caused a crash on non-linux unices: do not free pointer
+ returned by getenv
+- removed error.h dependancy from sgi_texture.c
+- moved all glut stuff to system_glut.c, makes porting to SDL easier
+- moved data structures from gltron.h to data.h
+- added glutReshapeCallback to center the game area when the window is
+ maximised
+
+to 0.53
+- added switch/option to capture mouse pointer (useful for Voodoo1/2 owners)
+- added switch/option do disable lightcycle turning smoothly
+- added switch/option to disable crash texture
+- moved lightcycle option to video/options
+- added bilinear filtering for wall & crash textures
+ (thanks David for pointing that out, I just forgot it)
+- new logo from David Banz <David.Banz@ux-2s02.inf.fh-rhein-sieg.de>
+- accordingly, changed the color of the menu foreground and background
+ to fit the logo
+- moved player loading into initGameStructures and the mesh data
+ into Player->Model->Mesh
+- moved player color into Player->Model
+- small clean-ups
+- changed FPS code, added average / worst case FPS counter
+- fixed bug in drawText
+- added seperate display callback for gui pause mode
+- changed all display() calls in idle functions to glutPostRedisplay()
+- game finishes now after last crash is over (less abrupt)
+- can't turn cycle now after crash
+- randomized explosion vectors a bit, looks much better now
+- explosion debris fades slowly
+to 0.52
+- added crash texture
+- +necessary files: gltron_crash.cgi
+- added exploding lightcycle upon crash
+- added rotating lightcycle when doing corners (still ugly)
+- fixed lightcycle material alpha
+- changed floor texture a bit
+to 0.51:
+- moved to CVS (now on www.ards.net)
+- fixed model coloring
+- fixed a few win32 problems
+- fixed chase camera (finally)
+to 0.50:
+- optimised drawPlayers, does now frustum culling based on object coordinates
+- added configuration menu for the bots
+- threw some junk out
+to 0.50beta4:
+- incorporated the low poly models, not yet optimized
+- fixed font / font-tex.pl generating distorted texture
+- added Game Settings menu
+- made font size screen size dependent (where useful)
+- changed menu layout and initialization a bit
+- changed menu highlighting (it's now done by font color)
+- necessary files: + t-u-low.obj
+to 0.50beta3:
+- added new font handling and font textures
+- consequently dropped M. Kilgards TexFont
+- organized files (a bit)
+- necessary files: + xenotron.ftx, xenotron.0.sgi, xenotron.1.sgi
+- necessary files: - helvetica.txf
+to 0.50beta2:
+- broke FPS counter again (actually, it wasn't ever working really good)
+- changed texture format to 'SGI image data, 3-D, 4 channels, uncompressed'
+- broke a LOT of stuff
+- rewrote some more
+- it's too late in the evening
+- added some nifty background effects to the UI
+- added new callback management, works GREAT so far
+- necessary files: + gltron.sgi
+
+to 0.50alpha:
+- GPL'd all my stuff
+- rewrote a whole LOT of code not mentioned here
+- added a (primitive) menu system
+- added general file searching routine,
+ it now looks in ., GLTRON_HOME, /usr/share/games/gltron and
+ /usr/local/share/games/gltron
+- necessary files are (currently): menu.txt settings.txt helvetica.txf
+- added these to make install...
+- changed INSTALL to mention the files from above
+- changed GLTRON_SNDDIR to GLTRON_HOME
+- changed the way settings are loaded (and pointers to
+ game->settings->whatever are obtained)
+- finally really fixed the 'behind'-view (F10 to switch)
+- switched to Mark Kilgard's TexFont for Fonts (not permanent, because
+ it's not GPL'd)
+- hopefully didn't break the rpm.specs
+
+to 0.47: (all changes by Thomas Flynn)
+- Added ifdefs to .h files to allow multiple inclusion
+
+- Moved a bunch of functions from gltron.c to engine.c
+ These seem to be functions necessary for the game and do not contain OpenGL
+ or glut code. List of functions are:
+ setCol();
+ clearCol();
+ getCol();
+ turn();
+ initDisplay();
+ changeDisplay();
+ initGame();
+ initdata();
+ colldetect();
+ doTrail();
+ fixTrails();
+ clearTrails();
+ mainIdle();
+ gameIdle();
+ defaultDisplay();
+ cycleDisplay();
+ allAI();
+ resetScores();
+ movePlayers();
+ timediff();
+ chaseCamMove();
+ camMove();
+ screenSaverCheck();
+
+- Added argument to drawTraces() so that pfTron knows which player (0,1,2,3)
+ to draw traces for.
+
+- Created getElapsedTime() to replace frequent calls to
+ glutGet(GLUT_ELAPSED_TIME); which are specific to glut.
+
+- Changed name of Display structure to gDisplay. Conflicts with Display
+ structure in Xlib.h
+
+- Changed movePlayers() to call setGameIdleFunc() where it used to call
+ glutIdleFunc(). Needed to move that glut call elsewhere.
+
+- Changed it so that scores are not updated if in screensaver mode.
+ Didn't seem to make sense. If you disagree, lemme know.
+
+- Changed it so that the sound file is searched for in $GLTRON_SNDDIR then ./
+ then /usr/share/games/gltron.
+
+- Decided to get consistant with the naming. All instances of gltron are now
+ gltron.
+
+- Added gltron.rpm.spec and gltron_sound.rpm.spec.
+
+- New Makefile. New rules: install, packages. Must be root for both.
+ The packages rule makes .rpms, .tgz, and .deb files.
+
+to 0.46:
+- fixed bug with -k option, no more crashes
+- capped FPS at 90-100 FPS (you need more???)
+- fixed crazy FPS counter under windows - now shows the real numbers
+- fixed alternate camera mode under windows
+- did a new windows version (with sound!)
+- included glut.dll in the win32 distribution
+- changed texture format, it's now char[] instead of char*, that should
+remove problems with non-gcc compilers
+- fullscreen rendering under win32 (switched to glutGameMode where avaiable)
+- added '-i' switch, forces in-a-window-rendering under win32
+- added '-v' switch, demo/screensafer mode (don't use with -f!)
+to 0.45:
+- added sound (Song by Peter Hajba)
+- added load/save for preferences
+- split code over several files
+
+to 0.44:
+- added help screen
+
+to 0.43:
+- fixed bug with uninitialised variable 'loop' in mainIdle() that
+ caused the game to crash sometimes
+- added #ifdefs for FreeBSD (patch from Andrey Zahkhatov)
+
+to 0.42:
+
+- added glow around players (patch from Xavier Bouchoux)
+- added second camera (patch from Mike Field)
+- added nice color fade to model color where actually the bikes should be
+ (I hope I'll receive the models soon)
+- added optional erasing of crashed players (like in the movie)
+- added optional fast finishing of the game after human crashes (no more
+ long wait for next round if the computers decide to go in circles around
+ the block)
+- added message who actually won the round (if you can't find it, it's
+ at the bottom of the screen)
+- added CREDITS file
+- added keys for steering player 3 & 4 (you're silly if you think you
+ can get 4 people to use one keyboard)
+- fixed a few minor bugs (e.g. speed change is now persistent)
+- changed behaviour of Display->onScreen
+- added keys for cycling players in upper/lower window in split-screen mode
+- changed FOV to 105
+- added keys to change FOV
+- introduced a bug that makes the game freeze (very very rare), perhaps
+ someone finds out why?
+
+to 0.41:
+
+- changed floor & wall textures (I'm still no artist though)
+- changed trail colors to fit new floor texture
+- multiple perspectives, view 1, 2 or 4 players (F1-F3 changes
+ that on the fly) - it's worth the download!
+- fixed typos with -h switch
+- fixed Makefile, compiles now with -O2 instead of -g (debug)
+ I can't see an obvious speed increase though
+- added this CHANGELOG file
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..bf81765
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,47 @@
+GLtron - Installation from source
+
+If you install from CVS, read also README.CVS
+
+Requirements:
+
+Get a working OpenGL / Mesa installation
+Get libpng / zlib (standard on almost any system)
+Get SDL-1.2 (1.1 might work, but is unsupported)
+
+If you want sound, you need to grab SDL_sound 0.1.4 or later from
+http://icculus.org/SDL_sound/
+
+Required libraries for SDL_sound: libmikmod 3.1.5 or newer
+
+Compiling:
+
+./configure
+make
+
+And (probably as root)
+make install
+
+Data files get installed by default to /usr/local/share/gltron
+The config file gets stored in $HOME/.gltronrc and any screenshots you
+make get stored in $HOME/gltron-$version-$index.png
+
+You can tweak most file locations using ./configure options.
+Try ./configure --help
+
+If you want to play from the source directory, use
+./configure --enable-localdata
+
+GLtron will then chdir() to the binary location upon startup, and
+load things from there. This is useful for the loki installer.
+You can put everything (binary & data) into one directory, and but
+a symlink into e.g. /usr/local/bin.
+
+Usage:
+
+'gltron -h' lists a few runtime options. Most notably is the -O option,
+which will speed things up greatly *if you don't have a 3D card*. Don't
+use this unless the game runs really slow, the visuals will suffer terribly.
+
+Start gltron with the -s option if you don't want the sound playing.
+
+Visit http://www.gltron.org/ frequently for updates and patches!
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..858c5f7
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,38 @@
+SUBDIRS = lua nebu src art data music scripts
+
+bin_PROGRAMS = gltron
+
+gltron_SOURCES = @top_srcdir@/src/gltron.c
+
+gltron_LINK = $(CXX) -o $@
+gltron_LDADD = \
+ src/game/libgame.a \
+ src/input/libinput.a \
+ src/audio/libaudio.a \
+ src/video/libvideo.a \
+ src/configuration/libconfiguration.a \
+ src/base/libbase.a \
+ src/filesystem/libfilesystem.a \
+ nebu/input/libinput.a \
+ nebu/audio/libaudio.a \
+ nebu/video/libvideo.a \
+ nebu/scripting/libscripting.a \
+ nebu/filesystem/libfilesystem.a \
+ nebu/base/libbase.a \
+ lua/src/liblua.a \
+ lua/src/lib/liblualib.a
+
+#gltron_LDFLAGS = -static
+
+AM_CFLAGS = \
+ -I@top_srcdir@/src/include \
+ -I@top_srcdir@/lua/include \
+ -I@top_srcdir@/nebu/include
+
+AM_CXXFLAGS = \
+ -I@top_srcdir@/src/include \
+ -I@top_srcdir@/lua/include \
+ -I@top_srcdir@/nebu/include
+
+tags:
+ etags `find -name '*.c' -or -name '*.cpp' -or -name '*.h' -or -name '*.lua'`
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..7e0d0ac
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,508 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+SUBDIRS = lua nebu src art data music scripts
+
+bin_PROGRAMS = gltron
+
+gltron_SOURCES = @top_srcdir@/src/gltron.c
+
+gltron_LINK = $(CXX) -o $@
+gltron_LDADD = \
+ src/game/libgame.a \
+ src/input/libinput.a \
+ src/audio/libaudio.a \
+ src/video/libvideo.a \
+ src/configuration/libconfiguration.a \
+ src/base/libbase.a \
+ src/filesystem/libfilesystem.a \
+ nebu/input/libinput.a \
+ nebu/audio/libaudio.a \
+ nebu/video/libvideo.a \
+ nebu/scripting/libscripting.a \
+ nebu/filesystem/libfilesystem.a \
+ nebu/base/libbase.a \
+ lua/src/liblua.a \
+ lua/src/lib/liblualib.a
+
+
+
+#gltron_LDFLAGS = -static
+AM_CFLAGS = \
+ -I@top_srcdir@/src/include \
+ -I@top_srcdir@/lua/include \
+ -I@top_srcdir@/nebu/include
+
+
+AM_CXXFLAGS = \
+ -I@top_srcdir@/src/include \
+ -I@top_srcdir@/lua/include \
+ -I@top_srcdir@/nebu/include
+
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+bin_PROGRAMS = gltron$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS)
+
+am_gltron_OBJECTS = gltron.$(OBJEXT)
+gltron_OBJECTS = $(am_gltron_OBJECTS)
+gltron_DEPENDENCIES = src/game/libgame.a src/input/libinput.a \
+ src/audio/libaudio.a src/video/libvideo.a \
+ src/configuration/libconfiguration.a src/base/libbase.a \
+ src/filesystem/libfilesystem.a nebu/input/libinput.a \
+ nebu/audio/libaudio.a nebu/video/libvideo.a \
+ nebu/scripting/libscripting.a nebu/filesystem/libfilesystem.a \
+ nebu/base/libbase.a lua/src/liblua.a lua/src/lib/liblualib.a
+gltron_LDFLAGS =
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/gltron.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(gltron_SOURCES)
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
+ uninstall-info-recursive all-recursive install-data-recursive \
+ install-exec-recursive installdirs-recursive install-recursive \
+ uninstall-recursive check-recursive installcheck-recursive
+DIST_COMMON = README COPYING ChangeLog INSTALL Makefile.am Makefile.in \
+ aclocal.m4 config.guess config.sub configure configure.in \
+ depcomp install-sh missing mkinstalldirs
+DIST_SUBDIRS = $(SUBDIRS)
+SOURCES = $(gltron_SOURCES)
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$@ $(SHELL) ./config.status
+
+$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+
+$(ACLOCAL_M4): configure.in
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+ rm -f $(DESTDIR)$(bindir)/$$f; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+gltron.$(OBJEXT): @top_srcdir@/src/gltron.c
+gltron$(EXEEXT): $(gltron_OBJECTS) $(gltron_DEPENDENCIES)
+ @rm -f gltron$(EXEEXT)
+ $(gltron_LINK) $(gltron_LDFLAGS) $(gltron_OBJECTS) $(gltron_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/gltron.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+
+gltron.o: @top_srcdir@/src/gltron.c
+@AMDEP_TRUE@ source='@top_srcdir@/src/gltron.c' object='gltron.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/gltron.Po' tmpdepfile='$(DEPDIR)/gltron.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gltron.o `test -f @top_srcdir@/src/gltron.c || echo '$(srcdir)/'`@top_srcdir@/src/gltron.c
+
+gltron.obj: @top_srcdir@/src/gltron.c
+@AMDEP_TRUE@ source='@top_srcdir@/src/gltron.c' object='gltron.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/gltron.Po' tmpdepfile='$(DEPDIR)/gltron.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gltron.obj `cygpath -w @top_srcdir@/src/gltron.c`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = .
+# Avoid unsightly `./'.
+distdir = $(PACKAGE)-$(VERSION)
+
+GZIP_ENV = --best
+
+distdir: $(DISTFILES)
+ -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+ mkdir $(distdir)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist: distdir
+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ chmod a-w $(distdir)
+ dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
+ && cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+ || (echo "Error: files left after uninstall" 1>&2; \
+ exit 1) ) \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && $(MAKE) $(AM_MAKEFLAGS) distclean \
+ && rm -f $(distdir).tar.gz \
+ && (test `find . -type f -print | wc -l` -eq 0 \
+ || (echo "Error: files left after distclean" 1>&2; \
+ exit 1) )
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+ @echo "$(distdir).tar.gz is ready for distribution" | \
+ sed 'h;s/./=/g;p;x;p;x'
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS)
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+dist-all: distdir
+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+distclean: distclean-recursive
+ -rm -f config.status config.cache config.log
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
+ clean-binPROGRAMS clean-generic clean-recursive dist dist-all \
+ distcheck distclean distclean-compile distclean-depend \
+ distclean-generic distclean-recursive distclean-tags distdir \
+ dvi dvi-am dvi-recursive info info-am info-recursive install \
+ install-am install-binPROGRAMS install-data install-data-am \
+ install-data-recursive install-exec install-exec-am \
+ install-exec-recursive install-info install-info-am \
+ install-info-recursive install-man install-recursive \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am installdirs-recursive maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-recursive \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-info-am \
+ uninstall-info-recursive uninstall-recursive
+
+
+tags:
+ etags `find -name '*.c' -or -name '*.cpp' -or -name '*.h' -or -name '*.lua'`
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/README b/README
new file mode 100644
index 0000000..c881bfb
--- /dev/null
+++ b/README
@@ -0,0 +1,28 @@
+gltron, a 3d lightcycle game using OpenGL
+Copyright (C) 1999 Andreas Umbach <marvin@dataway.ch>
+
+Soundtrack:
+gltron.it - 'Revenge of Cats' is copyright by Peter Hajba <skaven@remedy.fi>
+
+The latest manual & information can be found at
+http://www.gltron.org/
+
+Installation from source:
+
+see the INSTALL file in this archive
+
+License:
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..d2f994e
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,669 @@
+# aclocal.m4 generated automatically by aclocal 1.5
+
+# Copyright 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 5
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# We require 2.13 because we rely on SHELL being computed by configure.
+AC_PREREQ([2.13])
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
+# The purpose of this macro is to provide the user with a means to
+# check macros which are provided without letting her know how the
+# information is coded.
+# If this macro is not defined by Autoconf, define it here.
+ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [define([AC_PROVIDE_IFELSE],
+ [ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
+
+
+# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
+# ----------------------------------------------
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])
+fi
+
+# Define the identity of the package.
+PACKAGE=$1
+AC_SUBST(PACKAGE)dnl
+VERSION=$2
+AC_SUBST(VERSION)dnl
+ifelse([$3],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
+
+# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
+# the ones we care about.
+ifdef([m4_pattern_allow],
+ [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl
+
+# Autoconf 2.50 always computes EXEEXT. However we need to be
+# compatible with 2.13, for now. So we always define EXEEXT, but we
+# don't compute it.
+AC_SUBST(EXEEXT)
+# Similar for OBJEXT -- only we only use OBJEXT if the user actually
+# requests that it be used. This is a bit dumb.
+: ${OBJEXT=o}
+AC_SUBST(OBJEXT)
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal)
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake)
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG(AMTAR, tar)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_PROVIDE_IFELSE([AC_PROG_][CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_][CC],
+ defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_][CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_][CXX],
+ defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+# serial 3
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+
+# serial 2
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ am_backtick='`'
+ AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
+fi
+])
+
+# AM_AUX_DIR_EXPAND
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND], [
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
+])
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# serial 4 -*- Autoconf -*-
+
+
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+
+# _AM_DEPENDENCIES(NAME)
+# ---------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX" or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc']
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ echo '#include "conftest.h"' > conftest.c
+ echo 'int i;' > conftest.h
+ echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=conftest.c object=conftest.o \
+ depfile=conftest.Po tmpdepfile=conftest.TPo \
+ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
+ grep conftest.h conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+$1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type"
+AC_SUBST([$1DEPMODE])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[rm -f .deps 2>/dev/null
+mkdir .deps 2>/dev/null
+if test -d .deps; then
+ DEPDIR=.deps
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ DEPDIR=_deps
+fi
+rmdir .deps 2>/dev/null
+AC_SUBST(DEPDIR)
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+pushdef([subst], defn([AC_SUBST]))
+subst(AMDEPBACKSLASH)
+popdef([subst])
+])
+
+# Generate code to set up dependency tracking.
+# This macro should only be invoked once -- use via AC_REQUIRE.
+# Usage:
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
+AC_OUTPUT_COMMANDS([
+test x"$AMDEP_TRUE" != x"" ||
+for mf in $CONFIG_FILES; do
+ case "$mf" in
+ Makefile) dirpart=.;;
+ */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
+ *) continue;;
+ esac
+ grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
+ # Extract the definition of DEP_FILES from the Makefile without
+ # running `make'.
+ DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n -e '/^U = / s///p' < "$mf"`
+ test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+ # We invoke sed twice because it is the simplest approach to
+ # changing $(DEPDIR) to its actual value in the expansion.
+ for file in `sed -n -e '
+ /^DEP_FILES = .*\\\\$/ {
+ s/^DEP_FILES = //
+ :loop
+ s/\\\\$//
+ p
+ n
+ /\\\\$/ b loop
+ p
+ }
+ /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
+ $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+], [AMDEP_TRUE="$AMDEP_TRUE"
+ac_aux_dir="$ac_aux_dir"])])
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+doit:
+ @echo done
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include='#'
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote='"'
+ _am_result=BSD
+ fi
+fi
+AC_SUBST(am__include)
+AC_SUBST(am__quote)
+AC_MSG_RESULT($_am_result)
+rm -f confinc confmf
+])
+
+# serial 3
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+#
+# FIXME: Once using 2.50, use this:
+# m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_DEFUN([AM_CONDITIONAL],
+[ifelse([$1], [TRUE],
+ [errprint(__file__:__line__: [$0: invalid condition: $1
+])dnl
+m4exit(1)])dnl
+ifelse([$1], [FALSE],
+ [errprint(__file__:__line__: [$0: invalid condition: $1
+])dnl
+m4exit(1)])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi])
+
+# Configure paths for SDL
+# Sam Lantinga 9/21/99
+# stolen from Manish Singh
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
+dnl
+AC_DEFUN(AM_PATH_SDL,
+[dnl
+dnl Get the cflags and libraries from the sdl-config script
+dnl
+AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
+ sdl_prefix="$withval", sdl_prefix="")
+AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
+ sdl_exec_prefix="$withval", sdl_exec_prefix="")
+AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
+ , enable_sdltest=yes)
+
+ if test x$sdl_exec_prefix != x ; then
+ sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
+ if test x${SDL_CONFIG+set} != xset ; then
+ SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
+ fi
+ fi
+ if test x$sdl_prefix != x ; then
+ sdl_args="$sdl_args --prefix=$sdl_prefix"
+ if test x${SDL_CONFIG+set} != xset ; then
+ SDL_CONFIG=$sdl_prefix/bin/sdl-config
+ fi
+ fi
+
+ AC_REQUIRE([AC_CANONICAL_TARGET])
+ PATH="$prefix/bin:$prefix/usr/bin:$PATH"
+ AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
+ min_sdl_version=ifelse([$1], ,0.11.0,$1)
+ AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
+ no_sdl=""
+ if test "$SDL_CONFIG" = "no" ; then
+ no_sdl=yes
+ else
+ SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
+ SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
+
+ sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_sdltest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $SDL_CFLAGS"
+ LIBS="$LIBS $SDL_LIBS"
+dnl
+dnl Now check if the installed SDL is sufficiently new. (Also sanity
+dnl checks the results of sdl-config to some extent
+dnl
+ rm -f conf.sdltest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "SDL.h"
+
+char*
+my_strdup (char *str)
+{
+ char *new_str;
+
+ if (str)
+ {
+ new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
+ strcpy (new_str, str);
+ }
+ else
+ new_str = NULL;
+
+ return new_str;
+}
+
+int main (int argc, char *argv[])
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ /* This hangs on some systems (?)
+ system ("touch conf.sdltest");
+ */
+ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = my_strdup("$min_sdl_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ printf("%s, bad version string\n", "$min_sdl_version");
+ exit(1);
+ }
+
+ if (($sdl_major_version > major) ||
+ (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
+ (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
+ printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
+ printf("*** best to upgrade to the required version.\n");
+ printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
+ printf("*** to point to the correct copy of sdl-config, and remove the file\n");
+ printf("*** config.cache before re-running configure\n");
+ return 1;
+ }
+}
+
+],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_sdl" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$SDL_CONFIG" = "no" ; then
+ echo "*** The sdl-config script installed by SDL could not be found"
+ echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the SDL_CONFIG environment variable to the"
+ echo "*** full path to sdl-config."
+ else
+ if test -f conf.sdltest ; then
+ :
+ else
+ echo "*** Could not run SDL test program, checking why..."
+ CFLAGS="$CFLAGS $SDL_CFLAGS"
+ LIBS="$LIBS $SDL_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include "SDL.h"
+
+int main(int argc, char *argv[])
+{ return 0; }
+#undef main
+#define main K_and_R_C_main
+], [ return 0; ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding SDL or finding the wrong"
+ echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means SDL was incorrectly installed"
+ echo "*** or that you have moved SDL since it was installed. In the latter case, you"
+ echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ SDL_CFLAGS=""
+ SDL_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(SDL_CFLAGS)
+ AC_SUBST(SDL_LIBS)
+ rm -f conf.sdltest
+])
+
diff --git a/art/Makefile.am b/art/Makefile.am
new file mode 100644
index 0000000..60ecff8
--- /dev/null
+++ b/art/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = default
diff --git a/art/Makefile.in b/art/Makefile.in
new file mode 100644
index 0000000..f5f7657
--- /dev/null
+++ b/art/Makefile.in
@@ -0,0 +1,315 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+SUBDIRS = default
+subdir = art
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
+ uninstall-info-recursive all-recursive install-data-recursive \
+ install-exec-recursive installdirs-recursive install-recursive \
+ uninstall-recursive check-recursive installcheck-recursive
+DIST_COMMON = Makefile.am Makefile.in
+DIST_SUBDIRS = $(SUBDIRS)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign art/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
+ clean-generic clean-recursive distclean distclean-generic \
+ distclean-recursive distclean-tags distdir dvi dvi-am \
+ dvi-recursive info info-am info-recursive install install-am \
+ install-data install-data-am install-data-recursive \
+ install-exec install-exec-am install-exec-recursive \
+ install-info install-info-am install-info-recursive install-man \
+ install-recursive install-strip installcheck installcheck-am \
+ installdirs installdirs-am installdirs-recursive \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-recursive tags tags-recursive uninstall \
+ uninstall-am uninstall-info-am uninstall-info-recursive \
+ uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/art/default/Makefile.am b/art/default/Makefile.am
new file mode 100644
index 0000000..b2339a4
--- /dev/null
+++ b/art/default/Makefile.am
@@ -0,0 +1,8 @@
+dist_pkgdata_DATA = artpack.lua babbage.0.png babbage.1.png gltron.png \
+gltron_bitmap.png gltron_floor.png gltron_logo.png \
+gltron_trail.png gltron_traildecal.png gltron_wall_1.png \
+gltron_wall_2.png gltron_wall_3.png gltron_wall_4.png skybox0.png skybox1.png \
+skybox2.png skybox3.png skybox4.png skybox5.png test.bitmap.png \
+xenotron.0.png xenotron.1.png gltron_impact.png
+
+pkgdatadir = @datadir@/@PACKAGE@/art/default
diff --git a/art/default/Makefile.in b/art/default/Makefile.in
new file mode 100644
index 0000000..f22128c
--- /dev/null
+++ b/art/default/Makefile.in
@@ -0,0 +1,227 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+pkgdatadir = @datadir@/@PACKAGE@/art/default
+
+dist_pkgdata_DATA = artpack.lua babbage.0.png babbage.1.png gltron.png \
+gltron_bitmap.png gltron_floor.png gltron_logo.png \
+gltron_trail.png gltron_traildecal.png gltron_wall_1.png \
+gltron_wall_2.png gltron_wall_3.png gltron_wall_4.png skybox0.png skybox1.png \
+skybox2.png skybox3.png skybox4.png skybox5.png test.bitmap.png \
+xenotron.0.png xenotron.1.png gltron_impact.png
+
+subdir = art/default
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DATA = $(dist_pkgdata_DATA)
+
+DIST_COMMON = $(dist_pkgdata_DATA) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign art/default/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+ @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
+
+uninstall-dist_pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \
+ rm -f $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
+tags: TAGS
+TAGS:
+
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_pkgdataDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am \
+ install-dist_pkgdataDATA install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ uninstall uninstall-am uninstall-dist_pkgdataDATA \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/art/default/artpack.lua b/art/default/artpack.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/art/default/artpack.lua
diff --git a/art/default/babbage.0.png b/art/default/babbage.0.png
new file mode 100644
index 0000000..ce2a71b
--- /dev/null
+++ b/art/default/babbage.0.png
Binary files differ
diff --git a/art/default/babbage.1.png b/art/default/babbage.1.png
new file mode 100644
index 0000000..3eedf68
--- /dev/null
+++ b/art/default/babbage.1.png
Binary files differ
diff --git a/art/default/gltron.png b/art/default/gltron.png
new file mode 100644
index 0000000..b9a1e33
--- /dev/null
+++ b/art/default/gltron.png
Binary files differ
diff --git a/art/default/gltron_bitmap.png b/art/default/gltron_bitmap.png
new file mode 100644
index 0000000..37da35f
--- /dev/null
+++ b/art/default/gltron_bitmap.png
Binary files differ
diff --git a/art/default/gltron_floor.png b/art/default/gltron_floor.png
new file mode 100644
index 0000000..986af8d
--- /dev/null
+++ b/art/default/gltron_floor.png
Binary files differ
diff --git a/art/default/gltron_impact.png b/art/default/gltron_impact.png
new file mode 100644
index 0000000..75c53bc
--- /dev/null
+++ b/art/default/gltron_impact.png
Binary files differ
diff --git a/art/default/gltron_logo.png b/art/default/gltron_logo.png
new file mode 100644
index 0000000..1617a16
--- /dev/null
+++ b/art/default/gltron_logo.png
Binary files differ
diff --git a/art/default/gltron_trail.png b/art/default/gltron_trail.png
new file mode 100644
index 0000000..a6fc91e
--- /dev/null
+++ b/art/default/gltron_trail.png
Binary files differ
diff --git a/art/default/gltron_traildecal.png b/art/default/gltron_traildecal.png
new file mode 100644
index 0000000..ae890d8
--- /dev/null
+++ b/art/default/gltron_traildecal.png
Binary files differ
diff --git a/art/default/gltron_wall_1.png b/art/default/gltron_wall_1.png
new file mode 100644
index 0000000..f4d143d
--- /dev/null
+++ b/art/default/gltron_wall_1.png
Binary files differ
diff --git a/art/default/gltron_wall_2.png b/art/default/gltron_wall_2.png
new file mode 100644
index 0000000..01c5f86
--- /dev/null
+++ b/art/default/gltron_wall_2.png
Binary files differ
diff --git a/art/default/gltron_wall_3.png b/art/default/gltron_wall_3.png
new file mode 100644
index 0000000..4303e15
--- /dev/null
+++ b/art/default/gltron_wall_3.png
Binary files differ
diff --git a/art/default/gltron_wall_4.png b/art/default/gltron_wall_4.png
new file mode 100644
index 0000000..12c2bb7
--- /dev/null
+++ b/art/default/gltron_wall_4.png
Binary files differ
diff --git a/art/default/skybox0.png b/art/default/skybox0.png
new file mode 100644
index 0000000..e915a94
--- /dev/null
+++ b/art/default/skybox0.png
Binary files differ
diff --git a/art/default/skybox1.png b/art/default/skybox1.png
new file mode 100644
index 0000000..e915a94
--- /dev/null
+++ b/art/default/skybox1.png
Binary files differ
diff --git a/art/default/skybox2.png b/art/default/skybox2.png
new file mode 100644
index 0000000..e915a94
--- /dev/null
+++ b/art/default/skybox2.png
Binary files differ
diff --git a/art/default/skybox3.png b/art/default/skybox3.png
new file mode 100644
index 0000000..e915a94
--- /dev/null
+++ b/art/default/skybox3.png
Binary files differ
diff --git a/art/default/skybox4.png b/art/default/skybox4.png
new file mode 100644
index 0000000..e915a94
--- /dev/null
+++ b/art/default/skybox4.png
Binary files differ
diff --git a/art/default/skybox5.png b/art/default/skybox5.png
new file mode 100644
index 0000000..e915a94
--- /dev/null
+++ b/art/default/skybox5.png
Binary files differ
diff --git a/art/default/test.bitmap.png b/art/default/test.bitmap.png
new file mode 100644
index 0000000..62adeb9
--- /dev/null
+++ b/art/default/test.bitmap.png
Binary files differ
diff --git a/art/default/xenotron.0.png b/art/default/xenotron.0.png
new file mode 100644
index 0000000..7d9f145
--- /dev/null
+++ b/art/default/xenotron.0.png
Binary files differ
diff --git a/art/default/xenotron.1.png b/art/default/xenotron.1.png
new file mode 100644
index 0000000..56aa0cc
--- /dev/null
+++ b/art/default/xenotron.1.png
Binary files differ
diff --git a/config.guess b/config.guess
new file mode 100755
index 0000000..6ead80a
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,1327 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+
+timestamp='2001-08-21'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# Please send patches to <config-patches@gnu.org>.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script.
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int dummy(){}" > $dummy.c ;
+ for c in cc gcc c89 ; do
+ ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
+ if test $? = 0 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ rm -f $dummy.c $dummy.o $dummy.rel ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "${UNAME_MACHINE}" in
+ i?86)
+ test -z "$VENDOR" && VENDOR=pc
+ ;;
+ *)
+ test -z "$VENDOR" && VENDOR=unknown
+ ;;
+esac
+test -f /etc/SuSE-release && VENDOR=suse
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # Netbsd (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ # Determine the machine/vendor (is the vendor relevant).
+ case "${UNAME_MACHINE}" in
+ amiga) machine=m68k-unknown ;;
+ arm32) machine=arm-unknown ;;
+ atari*) machine=m68k-atari ;;
+ sun3*) machine=m68k-sun ;;
+ mac68k) machine=m68k-apple ;;
+ macppc) machine=powerpc-apple ;;
+ hp3[0-9][05]) machine=m68k-hp ;;
+ ibmrt|romp-ibm) machine=romp-ibm ;;
+ *) machine=${UNAME_MACHINE}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE}" in
+ i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ eval $set_cc_for_build
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ case `./$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ 2-1307)
+ UNAME_MACHINE="alphaev68"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit 0;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:NetBSD:*)
+ echo `uname -p`-unknown-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ eval $set_cc_for_build
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ eval $set_cc_for_build
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ case "${HPUX_REV}" in
+ 11.[0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ esac ;;
+ esac
+ fi ;;
+ esac
+ if [ "${HP_ARCH}" = "" ]; then
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ eval $set_cc_for_build
+ (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+ if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+ rm -f $dummy.c $dummy
+ fi ;;
+ esac
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ eval $set_cc_for_build
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ hppa*:OpenBSD:*:*)
+ echo hppa-unknown-openbsd
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3D:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit 0 ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux
+ exit 0 ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux
+ exit 0 ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux
+ exit 0 ;;
+ mips:Linux:*:*)
+ case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
+ big) echo mips-${VENDOR}-linux && exit 0 ;;
+ little) echo mipsel-${VENDOR}-linux && exit 0 ;;
+ esac
+ case `sed -n '/^system type/s/^.*: \([^ ]*\).*/\1/p' < /proc/cpuinfo` in
+ SGI|sgi) echo mips-${VENDOR}-linux-gnu && exit 0 ;;
+ esac
+ ;;
+ ppc:Linux:*:*|ppc64:Linux:*:*)
+ echo powerpc-${VENDOR}-linux
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit 0 ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC}
+ exit 0 ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-${VENDOR}-linux ;;
+ PA8*) echo hppa2.0-${VENDOR}-linux ;;
+ *) echo hppa-${VENDOR}-linux ;;
+ esac
+ exit 0 ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-${VENDOR}-linux
+ exit 0 ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit 0 ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux
+ exit 0 ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux
+ exit 0 ;;
+ x86_64:Linux:*:*)
+ echo x86_64-${VENDOR}-linux
+ exit 0 ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ ld_supported_targets=`cd /; ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-${VENDOR}-linuxaout"
+ exit 0 ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff"
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linuxoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld"
+ exit 0 ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ cat >$dummy.c <<EOF
+#include <features.h>
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linuxlibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linuxlibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-${VENDOR}-linuxaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ eval $set_cc_for_build
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ if test "${UNAME_MACHINE}" = "x86pc"; then
+ UNAME_MACHINE=pc
+ fi
+ echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-[KW]:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit 0 ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit 0 ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit 0 ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit 0 ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit 0 ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+eval $set_cc_for_build
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.sub b/config.sub
new file mode 100755
index 0000000..83f4b01
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,1410 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+
+timestamp='2001-08-13'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit 0;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | c4x | clipper \
+ | d10v | d30v | dsp16xx \
+ | fr30 \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | m32r | m68000 | m68k | m88k | mcore \
+ | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el | mips64vr4300 \
+ | mips64vr4300el | mips64vr5000 | mips64vr5000el \
+ | mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | ns16k | ns32k \
+ | openrisc \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | s390 | s390x \
+ | sh | sh[34] | sh[34]eb | shbe | shle \
+ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic80 | tron \
+ | v850 \
+ | we32k \
+ | x86 | xscale \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alphapca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armv*-* \
+ | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c54x-* \
+ | clipper-* | cray2-* | cydra-* \
+ | d10v-* | d30v-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | m32r-* \
+ | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | mcore-* \
+ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
+ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \
+ | mipsle-* | mipstx39-* | mipstx39el-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | s390-* | s390x-* \
+ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
+ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \
+ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \
+ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
+ | v850-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [cjt]90)
+ basic_machine=${basic_machine}-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mipsel*-linux*)
+ basic_machine=mipsel-unknown
+ ;;
+ mips*-linux*)
+ basic_machine=mips-unknown
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ mmix*)
+ basic_machine=mmix-knuth
+ os=-mmixware
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexgen)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i686-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc64) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sparclite-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=t3e-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ windows32)
+ basic_machine=i386-pc
+ os=-windows32-msvcrt
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ mips)
+ case $os in
+ linux*)
+ basic_machine=mips-unknown
+ ;;
+ *)
+ basic_machine=mips-mips
+ ;;
+ esac
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh3 | sh4 | sh3eb | sh4eb)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ c4x*)
+ basic_machine=c4x-none
+ os=-coff
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto*)
+ os=-nto-qnx
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
new file mode 100755
index 0000000..226d00e
--- /dev/null
+++ b/configure
@@ -0,0 +1,5169 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by Autoconf 2.52.
+#
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# Name of the executable.
+as_me=`echo "$0" |sed 's,.*[\\/],,'`
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+as_executable_p="test -f"
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+# NLS nuisances.
+$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; }
+$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; }
+$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; }
+$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; }
+$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; }
+$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; }
+$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; }
+$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; }
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+cross_compiling=no
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+ac_unique_file="src/gltron.c"
+ac_default_prefix="/usr/local"
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_prev=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_option in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: should be removed in autoconf 3.0.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
+fi
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<EOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+EOF
+
+ cat <<EOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+EOF
+
+ cat <<\EOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+EOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\EOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors
+ --enable-warn Enable compiler warnings [default=on]
+ --enable-debug Enable debugging [default=off]
+ --enable-profile Enable profiling [default=off]
+ --enable-optimize=[level]
+ Enable optimization [default=s]
+ --disable-sdltest Do not try to compile and run a test SDL program
+ --enable-localdata Use local data directory [default=no]
+ --disable-sound Don't compile in sound [default=off]
+ --enable-network Experimental network mode [default=off]
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)
+ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)
+ --with-snapshot-dir=[path]
+ Snapshot directory [default=~]
+ --with-preferences-dir=[path]
+ Preferences directory [default=~]
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+EOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue
+ cd $ac_subdir
+ # A "../" for each directory in /$ac_subdir.
+ ac_dots=`echo $ac_subdir |
+ sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'`
+
+ case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_sub_srcdir=$srcdir ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_sub_srcdir=$srcdir/$ac_subdir ;;
+ *) # Relative path.
+ ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;;
+ esac
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_sub_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_sub_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_sub_srcdir/configure; then
+ echo
+ $SHELL $ac_sub_srcdir/configure --help=recursive
+ elif test -f $ac_sub_srcdir/configure.ac ||
+ test -f $ac_sub_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\EOF
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+EOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<EOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.52. Invocation command line was
+
+ $ $0 $@
+
+EOF
+{
+cat <<_ASUNAME
+## ---------- ##
+## Platform. ##
+## ---------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+PATH = $PATH
+
+_ASUNAME
+} >&5
+
+cat >&5 <<EOF
+## ------------ ##
+## Core tests. ##
+## ------------ ##
+
+EOF
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell meta-characters.
+ac_configure_args=
+ac_sep=
+for ac_arg
+do
+ case $ac_arg in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ ac_sep=" " ;;
+ *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg"
+ ac_sep=" " ;;
+ esac
+ # Get rid of the leading space.
+done
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ echo >&5
+ echo "## ----------------- ##" >&5
+ echo "## Cache variables. ##" >&5
+ echo "## ----------------- ##" >&5
+ echo >&5
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} >&5
+ sed "/^$/d" confdefs.h >conftest.log
+ if test -s conftest.log; then
+ echo >&5
+ echo "## ------------ ##" >&5
+ echo "## confdefs.h. ##" >&5
+ echo "## ------------ ##" >&5
+ echo >&5
+ cat conftest.log >&5
+ fi
+ (echo; echo) >&5
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal" >&5
+ echo "$as_me: exit $exit_status" >&5
+ rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:865: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ cat "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:876: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:884: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:900: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:904: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:910: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:912: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:914: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status. It doesn't matter if
+ # we pass some twice (in addition to the command line arguments).
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"`
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val"
+ ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:933: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:935: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+echo "#! $SHELL" >conftest.sh
+echo "exit 0" >>conftest.sh
+chmod +x conftest.sh
+if { (echo "$as_me:955: PATH=\".;.\"; conftest.sh") >&5
+ (PATH=".;."; conftest.sh) 2>&5
+ ac_status=$?
+ echo "$as_me:958: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ ac_path_separator=';'
+else
+ ac_path_separator=:
+fi
+PATH_SEPARATOR="$ac_path_separator"
+rm -f conftest.sh
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:984: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:994: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+echo "$as_me:998: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+ ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+ { { echo "$as_me:1007: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+ { { echo "$as_me:1011: error: $ac_config_sub $ac_cv_build_alias failed." >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:1016: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+test -z "$build_alias" &&
+ build_alias=$ac_cv_build
+
+echo "$as_me:1026: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+ ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+ { { echo "$as_me:1035: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:1040: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+test -z "$host_alias" &&
+ host_alias=$ac_cv_host
+
+echo "$as_me:1050: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6
+if test "${ac_cv_target+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_target_alias=$target_alias
+test "x$ac_cv_target_alias" = "x" &&
+ ac_cv_target_alias=$ac_cv_host_alias
+ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
+ { { echo "$as_me:1059: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:1064: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6
+target=$ac_cv_target
+target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+test -z "$target_alias" &&
+ target_alias=$ac_cv_target
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:1092: checking for a BSD compatible install" >&5
+echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ for ac_dir in $PATH; do
+ IFS=$ac_save_IFS
+ # Account for people who put trailing slashes in PATH elements.
+ case $ac_dir/ in
+ / | ./ | .// | /cC/* \
+ | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \
+ | /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if $as_executable_p "$ac_dir/$ac_prog"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:1141: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:1152: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { { echo "$as_me:1176: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { echo "$as_me:1189: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+echo "$as_me:1195: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $. echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ am_backtick='`'
+ { echo "$as_me:1220: WARNING: ${am_backtick}missing' script is too old or missing" >&5
+echo "$as_me: WARNING: ${am_backtick}missing' script is too old or missing" >&2;}
+fi
+
+for ac_prog in mawk gawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:1228: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_AWK="$ac_prog"
+echo "$as_me:1243: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ echo "$as_me:1251: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+ echo "$as_me:1254: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$AWK" && break
+done
+
+echo "$as_me:1261: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$as_me:1281: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ SET_MAKE=
+else
+ echo "$as_me:1285: result: no" >&5
+echo "${ECHO_T}no" >&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+rm -f .deps 2>/dev/null
+mkdir .deps 2>/dev/null
+if test -d .deps; then
+ DEPDIR=.deps
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ DEPDIR=_deps
+fi
+rmdir .deps 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:1321: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# Define the identity of the package.
+PACKAGE=gltron
+VERSION=0.70
+
+cat >>confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >>confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
+# the ones we care about.
+
+# Autoconf 2.50 always computes EXEEXT. However we need to be
+# compatible with 2.13, for now. So we always define EXEEXT, but we
+# don't compute it.
+
+# Similar for OBJEXT -- only we only use OBJEXT if the user actually
+# requests that it be used. This is a bit dumb.
+: ${OBJEXT=o}
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal"}
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake"}
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:1378: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_CC="${ac_tool_prefix}gcc"
+echo "$as_me:1393: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:1401: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:1404: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:1413: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_CC="gcc"
+echo "$as_me:1428: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:1436: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:1439: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:1452: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_CC="${ac_tool_prefix}cc"
+echo "$as_me:1467: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:1475: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:1478: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:1487: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_CC="cc"
+echo "$as_me:1502: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:1510: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:1513: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:1526: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+fi
+ac_cv_prog_CC="cc"
+echo "$as_me:1546: found $ac_dir/$ac_word" >&5
+break
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" ${1+"$@"}
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:1568: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:1571: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:1582: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+echo "$as_me:1597: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:1605: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:1608: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:1621: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_CC="$ac_prog"
+echo "$as_me:1636: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:1644: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:1647: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+test -z "$CC" && { { echo "$as_me:1659: error: no acceptable cc found in \$PATH" >&5
+echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:1664:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:1667: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:1670: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:1672: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:1675: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:1677: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:1680: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 1684 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:1700: checking for C compiler default output" >&5
+echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:1703: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:1706: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+for ac_file in `ls a.exe conftest.exe 2>/dev/null;
+ ls a.out conftest 2>/dev/null;
+ ls a.* conftest.* 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ a.out ) # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:1729: error: C compiler cannot create executables" >&5
+echo "$as_me: error: C compiler cannot create executables" >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:1735: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:1740: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:1746: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1749: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:1756: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:1764: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:1771: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:1773: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:1776: checking for executable suffix" >&5
+echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6
+if { (eval echo "$as_me:1778: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:1781: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:1797: error: cannot compute EXEEXT: cannot compile and link" >&5
+echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:1803: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:1809: checking for object suffix" >&5
+echo $ECHO_N "checking for object suffix... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1815 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:1827: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1830: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:1842: error: cannot compute OBJEXT: cannot compile" >&5
+echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:1849: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:1853: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1859 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1874: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1877: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:1880: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1883: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_compiler_gnu=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:1895: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:1901: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1907 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1919: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1922: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:1925: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1928: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:1938: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1965: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1968: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:1971: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1974: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ ''\
+ '#include <stdlib.h>' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1986 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1999: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2002: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2005: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2008: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2018 "configure"
+#include "confdefs.h"
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2030: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2033: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2036: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2039: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_config_commands="$ac_config_commands default-1"
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+doit:
+ @echo done
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:2074: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include='#'
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote='"'
+ _am_result=BSD
+ fi
+fi
+
+echo "$as_me:2101: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+depcc="$CC" am_compiler_list=
+
+echo "$as_me:2107: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ echo '#include "conftest.h"' > conftest.c
+ echo 'int i;' > conftest.h
+ echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=conftest.c object=conftest.o \
+ depfile=conftest.Po tmpdepfile=conftest.TPo \
+ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
+ grep conftest.h conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:2169: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type"
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:2183: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+echo "$as_me:2198: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ echo "$as_me:2206: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
+else
+ echo "$as_me:2209: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:2222: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_CXX="$ac_prog"
+echo "$as_me:2237: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ echo "$as_me:2245: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
+else
+ echo "$as_me:2248: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CXX" && break
+done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
+
+ CXX=$ac_ct_CXX
+fi
+
+# Provide some information about the compiler.
+echo "$as_me:2260:" \
+ "checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:2263: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:2266: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:2268: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:2271: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:2273: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:2276: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+echo "$as_me:2279: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2285 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2300: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2303: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2306: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2309: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_compiler_gnu=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:2321: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-g"
+echo "$as_me:2327: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2333 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2345: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2348: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2351: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2354: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cxx_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:2364: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+for ac_declaration in \
+ ''\
+ '#include <stdlib.h>' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2391 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2404: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2407: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2410: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2413: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2423 "configure"
+#include "confdefs.h"
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2435: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2438: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2441: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2444: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX" am_compiler_list=
+
+echo "$as_me:2468: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+
+ am_cv_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ echo '#include "conftest.h"' > conftest.c
+ echo 'int i;' > conftest.h
+ echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=conftest.c object=conftest.o \
+ depfile=conftest.Po tmpdepfile=conftest.TPo \
+ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
+ grep conftest.h conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ am_cv_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:2530: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6
+CXXDEPMODE="depmode=$am_cv_CXX_dependencies_compiler_type"
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:2539: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2560 "configure"
+#include "confdefs.h"
+#include <assert.h>
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:2565: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:2571: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2594 "configure"
+#include "confdefs.h"
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:2598: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:2604: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:2641: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2651 "configure"
+#include "confdefs.h"
+#include <assert.h>
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:2656: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:2662: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2685 "configure"
+#include "confdefs.h"
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:2689: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:2695: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:2723: error: C preprocessor \"$CPP\" fails sanity check" >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:2737: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+echo "$as_me:2752: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ echo "$as_me:2760: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:2763: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:2772: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_RANLIB="ranlib"
+echo "$as_me:2787: found $ac_dir/$ac_word" >&5
+break
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:2796: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:2799: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+CFLAGS="-DSEPARATOR=\"'/'\""
+
+# Check whether --enable-warn or --disable-warn was given.
+if test "${enable_warn+set}" = set; then
+ enableval="$enable_warn"
+ enable_warn=$enableval
+else
+ enable_warn=yes
+fi;
+if test "x$enable_warn" = xyes; then
+ CFLAGS="$CFLAGS -Wall -Werror"
+fi
+
+# Check whether --enable-debug or --disable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval="$enable_debug"
+ enable_debug=$enableval
+else
+ enable_debug=off
+fi;
+if test "x$enable_debug" = xyes; then
+ CFLAGS="$CFLAGS -g3"
+ CXXFLAGS="$CXXFLAGS -g3"
+fi
+
+# Check whether --enable-profile or --disable-profile was given.
+if test "${enable_profile+set}" = set; then
+ enableval="$enable_profile"
+ enable_profile=$enableval
+else
+ enable_profile=off
+fi;
+if test "x$enable_profile" = xyes; then
+ if test "x$GCC" = xyes; then
+ CFLAGS="$CFLAGS -pg"
+ else
+ CFLAGS="$CFLAGS -p"
+ fi
+fi
+
+# Check whether --enable-optimize or --disable-optimize was given.
+if test "${enable_optimize+set}" = set; then
+ enableval="$enable_optimize"
+ enable_optmize=$enableval
+else
+ enable_optimize=s
+fi;
+if test "x$enable_optimize" ; then
+ CFLAGS="$CFLAGS -O$enable_optimize"
+ CXXFLAGS="$CXXFLAGS -O$enable_optimize"
+fi
+
+# Check whether --with-sdl-prefix or --without-sdl-prefix was given.
+if test "${with_sdl_prefix+set}" = set; then
+ withval="$with_sdl_prefix"
+ sdl_prefix="$withval"
+else
+ sdl_prefix=""
+fi;
+
+# Check whether --with-sdl-exec-prefix or --without-sdl-exec-prefix was given.
+if test "${with_sdl_exec_prefix+set}" = set; then
+ withval="$with_sdl_exec_prefix"
+ sdl_exec_prefix="$withval"
+else
+ sdl_exec_prefix=""
+fi;
+# Check whether --enable-sdltest or --disable-sdltest was given.
+if test "${enable_sdltest+set}" = set; then
+ enableval="$enable_sdltest"
+
+else
+ enable_sdltest=yes
+fi;
+
+ if test x$sdl_exec_prefix != x ; then
+ sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
+ if test x${SDL_CONFIG+set} != xset ; then
+ SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
+ fi
+ fi
+ if test x$sdl_prefix != x ; then
+ sdl_args="$sdl_args --prefix=$sdl_prefix"
+ if test x${SDL_CONFIG+set} != xset ; then
+ SDL_CONFIG=$sdl_prefix/bin/sdl-config
+ fi
+ fi
+
+ PATH="$prefix/bin:$prefix/usr/bin:$PATH"
+ # Extract the first word of "sdl-config", so it can be a program name with args.
+set dummy sdl-config; ac_word=$2
+echo "$as_me:2899: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_SDL_CONFIG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $SDL_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ if $as_executable_p "$ac_dir/$ac_word"; then
+ ac_cv_path_SDL_CONFIG="$ac_dir/$ac_word"
+ echo "$as_me:2916: found $ac_dir/$ac_word" >&5
+ break
+fi
+done
+
+ test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no"
+ ;;
+esac
+fi
+SDL_CONFIG=$ac_cv_path_SDL_CONFIG
+
+if test -n "$SDL_CONFIG"; then
+ echo "$as_me:2928: result: $SDL_CONFIG" >&5
+echo "${ECHO_T}$SDL_CONFIG" >&6
+else
+ echo "$as_me:2931: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ min_sdl_version=1.1.0
+ echo "$as_me:2936: checking for SDL - version >= $min_sdl_version" >&5
+echo $ECHO_N "checking for SDL - version >= $min_sdl_version... $ECHO_C" >&6
+ no_sdl=""
+ if test "$SDL_CONFIG" = "no" ; then
+ no_sdl=yes
+ else
+ SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
+ SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
+
+ sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+ sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+ sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+ if test "x$enable_sdltest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $SDL_CFLAGS"
+ LIBS="$LIBS $SDL_LIBS"
+ rm -f conf.sdltest
+ if test "$cross_compiling" = yes; then
+ echo $ac_n "cross compiling; assumed OK... $ac_c"
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2961 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "SDL.h"
+
+char*
+my_strdup (char *str)
+{
+ char *new_str;
+
+ if (str)
+ {
+ new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
+ strcpy (new_str, str);
+ }
+ else
+ new_str = NULL;
+
+ return new_str;
+}
+
+int main (int argc, char *argv[])
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ /* This hangs on some systems (?)
+ system ("touch conf.sdltest");
+ */
+ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = my_strdup("$min_sdl_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ printf("%s, bad version string\n", "$min_sdl_version");
+ exit(1);
+ }
+
+ if (($sdl_major_version > major) ||
+ (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
+ (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
+ printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
+ printf("*** best to upgrade to the required version.\n");
+ printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
+ printf("*** to point to the correct copy of sdl-config, and remove the file\n");
+ printf("*** config.cache before re-running configure\n");
+ return 1;
+ }
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:3022: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3025: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:3027: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3030: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+no_sdl=yes
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_sdl" = x ; then
+ echo "$as_me:3046: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ CFLAGS="$CFLAGS $SDL_CFLAGS"; CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"; LIBS="$LIBS $SDL_LIBS"
+ else
+ echo "$as_me:3050: result: no" >&5
+echo "${ECHO_T}no" >&6
+ if test "$SDL_CONFIG" = "no" ; then
+ echo "*** The sdl-config script installed by SDL could not be found"
+ echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the SDL_CONFIG environment variable to the"
+ echo "*** full path to sdl-config."
+ else
+ if test -f conf.sdltest ; then
+ :
+ else
+ echo "*** Could not run SDL test program, checking why..."
+ CFLAGS="$CFLAGS $SDL_CFLAGS"
+ LIBS="$LIBS $SDL_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3065 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#include "SDL.h"
+
+int main(int argc, char *argv[])
+{ return 0; }
+#undef main
+#define main K_and_R_C_main
+
+int
+main ()
+{
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3085: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3088: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3091: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3094: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding SDL or finding the wrong"
+ echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means SDL was incorrectly installed"
+ echo "*** or that you have moved SDL since it was installed. In the latter case, you"
+ echo "*** may want to edit the sdl-config script: $SDL_CONFIG"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ SDL_CFLAGS=""
+ SDL_LIBS=""
+ { { echo "$as_me:3120: error: SDL is not installed" >&5
+echo "$as_me: error: SDL is not installed" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ rm -f conf.sdltest
+
+echo "$as_me:3127: checking for main in -lGL" >&5
+echo $ECHO_N "checking for main in -lGL... $ECHO_C" >&6
+if test "${ac_cv_lib_GL_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lGL $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3135 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3147: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3150: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3153: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3156: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_GL_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_GL_main=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3167: result: $ac_cv_lib_GL_main" >&5
+echo "${ECHO_T}$ac_cv_lib_GL_main" >&6
+if test $ac_cv_lib_GL_main = yes; then
+ cat >>confdefs.h <<EOF
+#define HAVE_LIBGL 1
+EOF
+
+ LIBS="-lGL $LIBS"
+
+else
+ { { echo "$as_me:3177: error: OpenGL is not installed" >&5
+echo "$as_me: error: OpenGL is not installed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+echo "$as_me:3182: checking for gzopen in -lz" >&5
+echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6
+if test "${ac_cv_lib_z_gzopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3190 "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gzopen ();
+int
+main ()
+{
+gzopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3209: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3212: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3215: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3218: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_z_gzopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_z_gzopen=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3229: result: $ac_cv_lib_z_gzopen" >&5
+echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6
+if test $ac_cv_lib_z_gzopen = yes; then
+ cat >>confdefs.h <<EOF
+#define HAVE_LIBZ 1
+EOF
+
+ LIBS="-lz $LIBS"
+
+else
+ { { echo "$as_me:3239: error: libz is not installed" >&5
+echo "$as_me: error: libz is not installed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+echo "$as_me:3244: checking for png_read_info in -lpng" >&5
+echo $ECHO_N "checking for png_read_info in -lpng... $ECHO_C" >&6
+if test "${ac_cv_lib_png_png_read_info+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpng $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3252 "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char png_read_info ();
+int
+main ()
+{
+png_read_info ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3271: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3274: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3277: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3280: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_png_png_read_info=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_png_png_read_info=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3291: result: $ac_cv_lib_png_png_read_info" >&5
+echo "${ECHO_T}$ac_cv_lib_png_png_read_info" >&6
+if test $ac_cv_lib_png_png_read_info = yes; then
+ cat >>confdefs.h <<EOF
+#define HAVE_LIBPNG 1
+EOF
+
+ LIBS="-lpng $LIBS"
+
+else
+ { { echo "$as_me:3301: error: libpng is not installed" >&5
+echo "$as_me: error: libpng is not installed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# Check whether --enable-localdata or --disable-localdata was given.
+if test "${enable_localdata+set}" = set; then
+ enableval="$enable_localdata"
+ CPPFLAGSA="$CPPFLAGSA -DLOCAL_DATA"
+else
+ CPPFLAGSA="$CPPFLAGSA -DDATA_DIR=\\\"\$(datadir)/\$(PACKAGE)\\\""
+fi;
+
+# Check whether --with-snapshot-dir or --without-snapshot-dir was given.
+if test "${with_snapshot_dir+set}" = set; then
+ withval="$with_snapshot_dir"
+ CPPFLAGSA="$CPPFLAGSA -DSNAP_DIR=\\\"$withval\\\""
+else
+ CPPFLAGSA="$CPPFLAGSA -DSNAP_DIR=\\\"~\\\""
+fi;
+
+# Check whether --with-preferences-dir or --without-preferences-dir was given.
+if test "${with_preferences_dir+set}" = set; then
+ withval="$with_preferences_dir"
+ CPPFLAGSA="$CPPFLAGSA -DPREF_DIR=\\\"$withval\\\""
+else
+ CPPFLAGSA="$CPPFLAGSA -DPREF_DIR=\\\"~\\\""
+fi;
+
+# Check whether --enable-sound or --disable-sound was given.
+if test "${enable_sound+set}" = set; then
+ enableval="$enable_sound"
+ use_sound=no
+else
+ use_sound=yes
+fi;
+if test "x$use_sound" = xyes; then
+
+echo "$as_me:3339: checking for main in -lsmpeg" >&5
+echo $ECHO_N "checking for main in -lsmpeg... $ECHO_C" >&6
+if test "${ac_cv_lib_smpeg_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsmpeg $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3347 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3359: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3362: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3365: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3368: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_smpeg_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_smpeg_main=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3379: result: $ac_cv_lib_smpeg_main" >&5
+echo "${ECHO_T}$ac_cv_lib_smpeg_main" >&6
+if test $ac_cv_lib_smpeg_main = yes; then
+ cat >>confdefs.h <<EOF
+#define HAVE_LIBSMPEG 1
+EOF
+
+ LIBS="-lsmpeg $LIBS"
+
+else
+ { echo "$as_me:3389: WARNING: smpeg not found - music playback may not work correctly" >&5
+echo "$as_me: WARNING: smpeg not found - music playback may not work correctly" >&2;}
+fi
+
+echo "$as_me:3393: checking for main in -logg" >&5
+echo $ECHO_N "checking for main in -logg... $ECHO_C" >&6
+if test "${ac_cv_lib_ogg_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-logg $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3401 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3413: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3416: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3419: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3422: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_ogg_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_ogg_main=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3433: result: $ac_cv_lib_ogg_main" >&5
+echo "${ECHO_T}$ac_cv_lib_ogg_main" >&6
+if test $ac_cv_lib_ogg_main = yes; then
+ cat >>confdefs.h <<EOF
+#define HAVE_LIBOGG 1
+EOF
+
+ LIBS="-logg $LIBS"
+
+else
+ { echo "$as_me:3443: WARNING: ogg not found - music playback may not work correctly" >&5
+echo "$as_me: WARNING: ogg not found - music playback may not work correctly" >&2;}
+fi
+
+echo "$as_me:3447: checking for main in -lvorbis" >&5
+echo $ECHO_N "checking for main in -lvorbis... $ECHO_C" >&6
+if test "${ac_cv_lib_vorbis_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lvorbis $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3455 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3467: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3470: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3473: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3476: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_vorbis_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_vorbis_main=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3487: result: $ac_cv_lib_vorbis_main" >&5
+echo "${ECHO_T}$ac_cv_lib_vorbis_main" >&6
+if test $ac_cv_lib_vorbis_main = yes; then
+ cat >>confdefs.h <<EOF
+#define HAVE_LIBVORBIS 1
+EOF
+
+ LIBS="-lvorbis $LIBS"
+
+else
+ { echo "$as_me:3497: WARNING: vorbis not found - music playback may not work correctly" >&5
+echo "$as_me: WARNING: vorbis not found - music playback may not work correctly" >&2;}
+fi
+
+echo "$as_me:3501: checking for main in -lvorbisfile" >&5
+echo $ECHO_N "checking for main in -lvorbisfile... $ECHO_C" >&6
+if test "${ac_cv_lib_vorbisfile_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lvorbisfile $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3509 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3521: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3524: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3527: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3530: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_vorbisfile_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_vorbisfile_main=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3541: result: $ac_cv_lib_vorbisfile_main" >&5
+echo "${ECHO_T}$ac_cv_lib_vorbisfile_main" >&6
+if test $ac_cv_lib_vorbisfile_main = yes; then
+ cat >>confdefs.h <<EOF
+#define HAVE_LIBVORBISFILE 1
+EOF
+
+ LIBS="-lvorbisfile $LIBS"
+
+else
+ { echo "$as_me:3551: WARNING: vorbisfile not found - music playback may not work correctly" >&5
+echo "$as_me: WARNING: vorbisfile not found - music playback may not work correctly" >&2;}
+fi
+
+echo "$as_me:3555: checking for main in -lsmpeg" >&5
+echo $ECHO_N "checking for main in -lsmpeg... $ECHO_C" >&6
+if test "${ac_cv_lib_smpeg_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsmpeg $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3563 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3575: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3578: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3581: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3584: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_smpeg_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_smpeg_main=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3595: result: $ac_cv_lib_smpeg_main" >&5
+echo "${ECHO_T}$ac_cv_lib_smpeg_main" >&6
+if test $ac_cv_lib_smpeg_main = yes; then
+ cat >>confdefs.h <<EOF
+#define HAVE_LIBSMPEG 1
+EOF
+
+ LIBS="-lsmpeg $LIBS"
+
+else
+ { echo "$as_me:3605: WARNING: smpeg not found - music playback may not work correctly" >&5
+echo "$as_me: WARNING: smpeg not found - music playback may not work correctly" >&2;}
+fi
+
+echo "$as_me:3609: checking for main in -lmikmod" >&5
+echo $ECHO_N "checking for main in -lmikmod... $ECHO_C" >&6
+if test "${ac_cv_lib_mikmod_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmikmod $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3617 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3629: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3632: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3635: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3638: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_mikmod_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_mikmod_main=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3649: result: $ac_cv_lib_mikmod_main" >&5
+echo "${ECHO_T}$ac_cv_lib_mikmod_main" >&6
+if test $ac_cv_lib_mikmod_main = yes; then
+ cat >>confdefs.h <<EOF
+#define HAVE_LIBMIKMOD 1
+EOF
+
+ LIBS="-lmikmod $LIBS"
+
+else
+ { echo "$as_me:3659: WARNING: mikmod not found - music playback may not work correctly" >&5
+echo "$as_me: WARNING: mikmod not found - music playback may not work correctly" >&2;}
+fi
+
+ echo "$as_me:3663: checking for Sound_Init in -lSDL_sound" >&5
+echo $ECHO_N "checking for Sound_Init in -lSDL_sound... $ECHO_C" >&6
+if test "${ac_cv_lib_SDL_sound_Sound_Init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lSDL_sound $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3671 "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char Sound_Init ();
+int
+main ()
+{
+Sound_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3690: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3693: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3696: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3699: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_SDL_sound_Sound_Init=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_SDL_sound_Sound_Init=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3710: result: $ac_cv_lib_SDL_sound_Sound_Init" >&5
+echo "${ECHO_T}$ac_cv_lib_SDL_sound_Sound_Init" >&6
+if test $ac_cv_lib_SDL_sound_Sound_Init = yes; then
+ LIBS="-lSDL_sound $LIBS";
+ SOUND_OBJS="sound.o sound_glue.o Source.o Source3D.o SourceMusic.o SourceSample.o SoundSystem.o SourceCopy.o SourceEngine.o"
+else
+ { echo "$as_me:3716: WARNING: SDL_sound not found - disabling sound" >&5
+echo "$as_me: WARNING: SDL_sound not found - disabling sound" >&2;};
+ SOUND_OBJS="sound_stubs.o sound_glue_stubs.o"
+fi
+
+else
+ SOUND_OBJS="sound_stubs.o sound_glue_stubs.o"
+
+fi
+
+# Check whether --enable-network or --disable-network was given.
+if test "${enable_network+set}" = set; then
+ enableval="$enable_network"
+ enable_network=$enableval
+else
+ enable_network=off
+fi;
+if test "x$enable_network" = xyes; then
+ echo "$as_me:3734: checking for SDLNet_Init in -lSDL_net" >&5
+echo $ECHO_N "checking for SDLNet_Init in -lSDL_net... $ECHO_C" >&6
+if test "${ac_cv_lib_SDL_net_SDLNet_Init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lSDL_net $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3742 "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char SDLNet_Init ();
+int
+main ()
+{
+SDLNet_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3761: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3764: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3767: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3770: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_SDL_net_SDLNet_Init=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_SDL_net_SDLNet_Init=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:3781: result: $ac_cv_lib_SDL_net_SDLNet_Init" >&5
+echo "${ECHO_T}$ac_cv_lib_SDL_net_SDLNet_Init" >&6
+if test $ac_cv_lib_SDL_net_SDLNet_Init = yes; then
+ CFLAGS="$CFLAGS -DNETWORK";
+ LIBS="$LIBS -lSDL_net";
+ NETWORK_OBJS="network.o system_net.o"
+else
+ { echo "$as_me:3788: WARNING: SDL_net not found - disabling network" >&5
+echo "$as_me: WARNING: SDL_net not found - disabling network" >&2;}
+fi
+
+fi
+
+echo "$as_me:3794: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3800 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+_ACEOF
+if { (eval echo "$as_me:3808: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:3814: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3836 "configure"
+#include "confdefs.h"
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3854 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3875 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:3901: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3904: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:3906: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3909: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_header_stdc=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:3922: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+for ac_header in unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:3935: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3941 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:3945: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:3951: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:3970: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+
+fi
+done
+
+for ac_header in GL/gl.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:3983: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3989 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:3993: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:3999: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:4018: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+ have_gl_h=true
+else
+ have_gl_h=false
+fi
+done
+
+$have_gl_h || {
+
+for ac_header in /usr/X11R6/include/GL/gl.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:4035: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4041 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:4045: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:4051: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:4070: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+ includes_in_x=1 have_gl_h=true
+else
+ have_gl_h=false
+fi
+done
+
+}
+$have_gl_h || {
+
+for ac_header in /usr/local/include/GL/gl.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:4088: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4094 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:4098: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:4104: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:4123: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+ includes_in_local=1 have_gl_h=true
+else
+ have_gl_h=false
+fi
+done
+
+}
+$have_gl_h || {
+ { { echo "$as_me:4137: error: cant find GL headers" >&5
+echo "$as_me: error: cant find GL headers" >&2;}
+ { (exit 1); exit 1; }; }
+}
+
+echo "$as_me:4142: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line 4150 "configure"
+#include "confdefs.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4199: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:4202: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:4205: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4208: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:4225: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:4228: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+echo "$as_me:4233: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4239 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4297: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:4300: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:4303: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4306: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_c_const=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:4316: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+for ac_func in strstr mkstemp
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:4329: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4335 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+char (*f) ();
+
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+f = $ac_func;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4366: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:4369: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:4372: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4375: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:4385: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+EOF
+
+fi
+done
+
+CPPFLAGS="$CPPFLAGS $CPPFLAGSA"
+
+ac_config_files="$ac_config_files Makefile lua/Makefile lua/include/Makefile lua/src/Makefile lua/src/lib/Makefile nebu/Makefile nebu/include/Makefile nebu/include/audio/Makefile nebu/include/base/Makefile nebu/include/filesystem/Makefile nebu/include/input/Makefile nebu/include/scripting/Makefile nebu/include/video/Makefile nebu/base/Makefile nebu/filesystem/Makefile nebu/scripting/Makefile nebu/input/Makefile nebu/video/Makefile nebu/audio/Makefile src/Makefile src/include/Makefile src/include/audio/Makefile src/include/base/Makefile src/include/configuration/Makefile src/include/filesystem/Makefile src/include/game/Makefile src/include/input/Makefile src/include/scripting/Makefile src/include/video/Makefile src/base/Makefile src/filesystem/Makefile src/configuration/Makefile src/audio/Makefile src/video/Makefile src/input/Makefile src/game/Makefile art/Makefile art/default/Makefile data/Makefile music/Makefile scripts/Makefile"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overriden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if cmp -s $cache_file confcache; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\EOF
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+t quote
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+EOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output. A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:4507: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+ac_cs_invocation="\$0 \$@"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# Name of the executable.
+as_me=`echo "$0" |sed 's,.*[\\/],,'`
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+as_executable_p="test -f"
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+# NLS nuisances.
+$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; }
+$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; }
+$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; }
+$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; }
+$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; }
+$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; }
+$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; }
+$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; }
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
+
+exec 6>&1
+
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\EOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+EOF
+
+cat >>$CONFIG_STATUS <<EOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.52,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+EOF
+
+cat >>$CONFIG_STATUS <<\EOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ shift
+ set dummy "$ac_option" "$ac_optarg" ${1+"$@"}
+ shift
+ ;;
+ -*);;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_need_defaults=false;;
+ esac
+
+ case $1 in
+ # Handling of the options.
+EOF
+cat >>$CONFIG_STATUS <<EOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion"
+ exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;;
+EOF
+cat >>$CONFIG_STATUS <<\EOF
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:4678: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ shift
+ CONFIG_FILES="$CONFIG_FILES $1"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $1"
+ ac_need_defaults=false;;
+
+ # This is an error.
+ -*) { { echo "$as_me:4697: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+exec 5>>config.log
+cat >&5 << _ACEOF
+
+## ----------------------- ##
+## Running config.status. ##
+## ----------------------- ##
+
+This file was extended by $as_me 2.52, executed with
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ > $ac_cs_invocation
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+
+_ACEOF
+EOF
+
+cat >>$CONFIG_STATUS <<EOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE"
+ac_aux_dir="$ac_aux_dir"
+
+EOF
+
+cat >>$CONFIG_STATUS <<\EOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "lua/Makefile" ) CONFIG_FILES="$CONFIG_FILES lua/Makefile" ;;
+ "lua/include/Makefile" ) CONFIG_FILES="$CONFIG_FILES lua/include/Makefile" ;;
+ "lua/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES lua/src/Makefile" ;;
+ "lua/src/lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lua/src/lib/Makefile" ;;
+ "nebu/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/Makefile" ;;
+ "nebu/include/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/include/Makefile" ;;
+ "nebu/include/audio/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/include/audio/Makefile" ;;
+ "nebu/include/base/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/include/base/Makefile" ;;
+ "nebu/include/filesystem/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/include/filesystem/Makefile" ;;
+ "nebu/include/input/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/include/input/Makefile" ;;
+ "nebu/include/scripting/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/include/scripting/Makefile" ;;
+ "nebu/include/video/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/include/video/Makefile" ;;
+ "nebu/base/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/base/Makefile" ;;
+ "nebu/filesystem/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/filesystem/Makefile" ;;
+ "nebu/scripting/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/scripting/Makefile" ;;
+ "nebu/input/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/input/Makefile" ;;
+ "nebu/video/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/video/Makefile" ;;
+ "nebu/audio/Makefile" ) CONFIG_FILES="$CONFIG_FILES nebu/audio/Makefile" ;;
+ "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "src/include/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/Makefile" ;;
+ "src/include/audio/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/audio/Makefile" ;;
+ "src/include/base/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/base/Makefile" ;;
+ "src/include/configuration/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/configuration/Makefile" ;;
+ "src/include/filesystem/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/filesystem/Makefile" ;;
+ "src/include/game/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/game/Makefile" ;;
+ "src/include/input/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/input/Makefile" ;;
+ "src/include/scripting/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/scripting/Makefile" ;;
+ "src/include/video/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/video/Makefile" ;;
+ "src/base/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/base/Makefile" ;;
+ "src/filesystem/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/filesystem/Makefile" ;;
+ "src/configuration/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/configuration/Makefile" ;;
+ "src/audio/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/audio/Makefile" ;;
+ "src/video/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/video/Makefile" ;;
+ "src/input/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/input/Makefile" ;;
+ "src/game/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/game/Makefile" ;;
+ "art/Makefile" ) CONFIG_FILES="$CONFIG_FILES art/Makefile" ;;
+ "art/default/Makefile" ) CONFIG_FILES="$CONFIG_FILES art/default/Makefile" ;;
+ "data/Makefile" ) CONFIG_FILES="$CONFIG_FILES data/Makefile" ;;
+ "music/Makefile" ) CONFIG_FILES="$CONFIG_FILES music/Makefile" ;;
+ "scripts/Makefile" ) CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
+ "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ *) { { echo "$as_me:4784: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=$TMPDIR/cs$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+ { (exit 1); exit 1; }
+}
+
+EOF
+
+cat >>$CONFIG_STATUS <<EOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@DEFS@,$DEFS,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@target@,$target,;t t
+s,@target_cpu@,$target_cpu,;t t
+s,@target_vendor@,$target_vendor,;t t
+s,@target_os@,$target_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@install_sh@,$install_sh,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
+s,@CXXDEPMODE@,$CXXDEPMODE,;t t
+s,@CPP@,$CPP,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@SDL_CONFIG@,$SDL_CONFIG,;t t
+s,@SDL_CFLAGS@,$SDL_CFLAGS,;t t
+s,@SDL_LIBS@,$SDL_LIBS,;t t
+s,@SOUND_OBJS@,$SOUND_OBJS,;t t
+s,@NETWORK_OBJS@,$NETWORK_OBJS,;t t
+CEOF
+
+EOF
+
+ cat >>$CONFIG_STATUS <<\EOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+EOF
+cat >>$CONFIG_STATUS <<\EOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ { case "$ac_dir" in
+ [\\/]* | ?:[\\/]* ) as_incr_dir=;;
+ *) as_incr_dir=.;;
+esac
+as_dummy="$ac_dir"
+for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
+ case $as_mkdir_dir in
+ # Skip DOS drivespec
+ ?:) as_incr_dir=$as_mkdir_dir ;;
+ *)
+ as_incr_dir=$as_incr_dir/$as_mkdir_dir
+ test -d "$as_incr_dir" || mkdir "$as_incr_dir"
+ ;;
+ esac
+done; }
+
+ ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case $srcdir in
+ .) ac_srcdir=.
+ if test -z "$ac_dots"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* )
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_dots$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_dots$srcdir ;;
+ esac
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_dots$INSTALL ;;
+ esac
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:5032: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated automatically by config.status. */
+ configure_input="Generated automatically from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:5050: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo $f;;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo $f
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo $srcdir/$f
+ else
+ # /dev/null tree
+ { { echo "$as_me:5063: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+EOF
+cat >>$CONFIG_STATUS <<EOF
+ sed "$ac_vpsub
+$extrasub
+EOF
+cat >>$CONFIG_STATUS <<\EOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+EOF
+cat >>$CONFIG_STATUS <<\EOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+
+ case $ac_dest in
+ default-1 )
+test x"$AMDEP_TRUE" != x"" ||
+for mf in $CONFIG_FILES; do
+ case "$mf" in
+ Makefile) dirpart=.;;
+ */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
+ *) continue;;
+ esac
+ grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
+ # Extract the definition of DEP_FILES from the Makefile without
+ # running `make'.
+ DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n -e '/^U = / s///p' < "$mf"`
+ test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+ # We invoke sed twice because it is the simplest approach to
+ # changing $(DEPDIR) to its actual value in the expansion.
+ for file in `sed -n -e '
+ /^DEP_FILES = .*\\\\$/ {
+ s/^DEP_FILES = //
+ :loop
+ s/\\\\$//
+ p
+ n
+ /\\\\$/ b loop
+ p
+ }
+ /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
+ $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+ esac
+done
+EOF
+
+cat >>$CONFIG_STATUS <<\EOF
+
+{ (exit 0); exit 0; }
+EOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..6a90748
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,188 @@
+dnl Process this file with autoconf to produce a configure script.
+
+dnl initialisation
+AC_INIT(src/gltron.c)
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+AM_INIT_AUTOMAKE(gltron, 0.70)
+
+AC_PREFIX_DEFAULT("/usr/local")
+
+dnl AM_MAINTAINER_MODE
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_CPP
+AC_PROG_RANLIB
+
+dnl CFLAGS set-up
+CFLAGS="-DSEPARATOR=\"'/'\""
+dnl CFLAGS="-ansi -pedantic"
+dnl CXXFLAGS=""
+dnl CPPFLAGS=""
+
+AC_ARG_ENABLE(warn,
+AC_HELP_STRING([--enable-warn],[Enable compiler warnings @<:@default=on@:>@]),
+ enable_warn=$enableval, enable_warn=yes)
+if test "x$enable_warn" = xyes; then
+ CFLAGS="$CFLAGS -Wall -Werror"
+fi
+
+AC_ARG_ENABLE(debug,
+AC_HELP_STRING([--enable-debug],[Enable debugging @<:@default=off@:>@]),
+ enable_debug=$enableval, enable_debug=off)
+if test "x$enable_debug" = xyes; then
+ CFLAGS="$CFLAGS -g3"
+ CXXFLAGS="$CXXFLAGS -g3"
+fi
+
+AC_ARG_ENABLE(profile,
+AC_HELP_STRING([--enable-profile],[Enable profiling @<:@default=off@:>@]),
+ enable_profile=$enableval, enable_profile=off)
+if test "x$enable_profile" = xyes; then
+ if test "x$GCC" = xyes; then
+ CFLAGS="$CFLAGS -pg"
+ else
+ CFLAGS="$CFLAGS -p"
+ fi
+fi
+
+AC_ARG_ENABLE(optimize,
+AC_HELP_STRING([--enable-optimize=@<:@level@:>@],[Enable optimization @<:@default=s@:>@]),
+ enable_optmize=$enableval, enable_optimize=s)
+dnl this is always true
+if test "x$enable_optimize" ; then
+ CFLAGS="$CFLAGS -O$enable_optimize"
+ CXXFLAGS="$CXXFLAGS -O$enable_optimize"
+fi
+
+dnl library checks
+AM_PATH_SDL(1.1.0, CFLAGS="$CFLAGS $SDL_CFLAGS"; CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"; LIBS="$LIBS $SDL_LIBS",
+ AC_MSG_ERROR(SDL is not installed))
+AC_CHECK_LIB(GL, main,, AC_MSG_ERROR(OpenGL is not installed))
+dnl AC_CHECK_LIB(opengl32, main,, AC_MSG_ERROR(OpenGL is not installed))
+AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR(libz is not installed))
+AC_CHECK_LIB(png, png_read_info,, AC_MSG_ERROR(libpng is not installed))
+
+dnl local data dir setup
+AC_ARG_ENABLE(localdata,
+AC_HELP_STRING([--enable-localdata],[Use local data directory @<:@default=no@:>@]),
+ CPPFLAGSA="$CPPFLAGSA -DLOCAL_DATA",
+ CPPFLAGSA="$CPPFLAGSA -DDATA_DIR=\\\"\$(datadir)/\$(PACKAGE)\\\"")
+
+dnl snapshot dir setup
+AC_ARG_WITH(snapshot-dir,
+AC_HELP_STRING([--with-snapshot-dir=@<:@path@:>@],[Snapshot directory @<:@default=~@:>@]),
+ CPPFLAGSA="$CPPFLAGSA -DSNAP_DIR=\\\"$withval\\\"",
+ CPPFLAGSA="$CPPFLAGSA -DSNAP_DIR=\\\"~\\\"")
+
+dnl preferences dir setup
+AC_ARG_WITH(preferences-dir,
+AC_HELP_STRING([--with-preferences-dir=@<:@path@:>@],[Preferences directory @<:@default=~@:>@]),
+ CPPFLAGSA="$CPPFLAGSA -DPREF_DIR=\\\"$withval\\\"",
+ CPPFLAGSA="$CPPFLAGSA -DPREF_DIR=\\\"~\\\"")
+
+dnl sound set-up
+AC_ARG_ENABLE(sound,
+AC_HELP_STRING([--disable-sound],[Don't compile in sound @<:@default=off@:>@]),
+ use_sound=no, use_sound=yes)
+if test "x$use_sound" = xyes; then
+ AC_CHECK_LIB(smpeg, main,, AC_MSG_WARN(smpeg not found - music playback may not work correctly))
+ AC_CHECK_LIB(ogg, main,, AC_MSG_WARN(ogg not found - music playback may not work correctly))
+ AC_CHECK_LIB(vorbis, main,, AC_MSG_WARN(vorbis not found - music playback may not work correctly))
+ AC_CHECK_LIB(vorbisfile, main,, AC_MSG_WARN(vorbisfile not found - music playback may not work correctly))
+ AC_CHECK_LIB(smpeg, main,, AC_MSG_WARN(smpeg not found - music playback may not work correctly))
+ AC_CHECK_LIB(mikmod, main,, AC_MSG_WARN(mikmod not found - music playback may not work correctly))
+ AC_CHECK_LIB(SDL_sound, Sound_Init,
+ LIBS="-lSDL_sound $LIBS";
+ SOUND_OBJS="sound.o sound_glue.o Source.o Source3D.o SourceMusic.o SourceSample.o SoundSystem.o SourceCopy.o SourceEngine.o",
+ AC_MSG_WARN(SDL_sound not found - disabling sound);
+ SOUND_OBJS="sound_stubs.o sound_glue_stubs.o")
+
+ AC_SUBST(SOUND_OBJS)
+else
+ SOUND_OBJS="sound_stubs.o sound_glue_stubs.o"
+ AC_SUBST(SOUND_OBJS)
+fi
+
+dnl network set-up
+AC_ARG_ENABLE(network,
+AC_HELP_STRING([--enable-network],[Experimental network mode @<:@default=off@:>@]),
+ enable_network=$enableval, enable_network=off)
+if test "x$enable_network" = xyes; then
+ AC_CHECK_LIB(SDL_net, SDLNet_Init,
+ CFLAGS="$CFLAGS -DNETWORK";
+ LIBS="$LIBS -lSDL_net";
+ NETWORK_OBJS="network.o system_net.o",
+ AC_MSG_WARN(SDL_net not found - disabling network))
+ AC_SUBST(NETWORK_OBJS)
+fi
+
+dnl CXXFLAGS="$CFLAGS"
+
+dnl header checks
+AC_HEADER_STDC
+AC_CHECK_HEADERS(unistd.h)
+
+AC_CHECK_HEADERS(GL/gl.h, have_gl_h=true, have_gl_h=false)
+$have_gl_h || {
+ AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h, includes_in_x=1 have_gl_h=true, have_gl_h=false)
+}
+$have_gl_h || {
+ AC_CHECK_HEADERS(/usr/local/include/GL/gl.h, includes_in_local=1 have_gl_h=true, have_gl_h=false)
+}
+$have_gl_h || {
+ AC_MSG_ERROR(cant find GL headers)
+}
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(strstr mkstemp)
+
+CPPFLAGS="$CPPFLAGS $CPPFLAGSA"
+
+AC_OUTPUT([Makefile \
+ lua/Makefile \
+ lua/include/Makefile \
+ lua/src/Makefile \
+ lua/src/lib/Makefile \
+ nebu/Makefile \
+ nebu/include/Makefile \
+ nebu/include/audio/Makefile \
+ nebu/include/base/Makefile \
+ nebu/include/filesystem/Makefile \
+ nebu/include/input/Makefile \
+ nebu/include/scripting/Makefile \
+ nebu/include/video/Makefile \
+ nebu/base/Makefile \
+ nebu/filesystem/Makefile \
+ nebu/scripting/Makefile \
+ nebu/input/Makefile \
+ nebu/video/Makefile \
+ nebu/audio/Makefile
+ src/Makefile \
+ src/include/Makefile \
+ src/include/audio/Makefile \
+ src/include/base/Makefile \
+ src/include/configuration/Makefile \
+ src/include/filesystem/Makefile \
+ src/include/game/Makefile \
+ src/include/input/Makefile \
+ src/include/scripting/Makefile \
+ src/include/video/Makefile \
+ src/base/Makefile \
+ src/filesystem/Makefile \
+ src/configuration/Makefile \
+ src/audio/Makefile \
+ src/video/Makefile \
+ src/input/Makefile \
+ src/game/Makefile \
+ art/Makefile \
+ art/default/Makefile \
+ data/Makefile \
+ music/Makefile \
+ scripts/Makefile \
+ ])
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 0000000..a6af3c5
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,6 @@
+dist_pkgdata_DATA = babbage.ftx fonts.txt game_crash.ogg game_crash.wav \
+game_engine.ogg game_engine.wav game_recognizer.wav game_recognizer.ogg lightcycle-high.obj lightcycle-low.obj \
+lightcycle-med.obj lightcycle.mtl recognizer.mtl recognizer.obj \
+recognizer_quad.obj test.fbmp xenotron.ftx
+
+pkgdatadir = @datadir@/@PACKAGE@/data
diff --git a/data/Makefile.in b/data/Makefile.in
new file mode 100644
index 0000000..29157cc
--- /dev/null
+++ b/data/Makefile.in
@@ -0,0 +1,225 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+pkgdatadir = @datadir@/@PACKAGE@/data
+
+dist_pkgdata_DATA = babbage.ftx fonts.txt game_crash.ogg game_crash.wav \
+game_engine.ogg game_engine.wav game_recognizer.wav game_recognizer.ogg lightcycle-high.obj lightcycle-low.obj \
+lightcycle-med.obj lightcycle.mtl recognizer.mtl recognizer.obj \
+recognizer_quad.obj test.fbmp xenotron.ftx
+
+subdir = data
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DATA = $(dist_pkgdata_DATA)
+
+DIST_COMMON = $(dist_pkgdata_DATA) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign data/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+ @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
+
+uninstall-dist_pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \
+ rm -f $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
+tags: TAGS
+TAGS:
+
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_pkgdataDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am \
+ install-dist_pkgdataDATA install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ uninstall uninstall-am uninstall-dist_pkgdataDATA \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/data/babbage.ftx b/data/babbage.ftx
new file mode 100644
index 0000000..96180ca
--- /dev/null
+++ b/data/babbage.ftx
@@ -0,0 +1,5 @@
+2 256 32
+32 126
+babbage
+babbage.0.png
+babbage.1.png
diff --git a/data/fonts.txt b/data/fonts.txt
new file mode 100644
index 0000000..06962bf
--- /dev/null
+++ b/data/fonts.txt
@@ -0,0 +1,2 @@
+menu: babbage.ftx
+game: xenotron.ftx
diff --git a/data/game_crash.ogg b/data/game_crash.ogg
new file mode 100644
index 0000000..ba01575
--- /dev/null
+++ b/data/game_crash.ogg
Binary files differ
diff --git a/data/game_crash.wav b/data/game_crash.wav
new file mode 100644
index 0000000..ecb158f
--- /dev/null
+++ b/data/game_crash.wav
Binary files differ
diff --git a/data/game_engine.ogg b/data/game_engine.ogg
new file mode 100644
index 0000000..197ac12
--- /dev/null
+++ b/data/game_engine.ogg
Binary files differ
diff --git a/data/game_engine.wav b/data/game_engine.wav
new file mode 100644
index 0000000..5879781
--- /dev/null
+++ b/data/game_engine.wav
Binary files differ
diff --git a/data/game_recognizer.ogg b/data/game_recognizer.ogg
new file mode 100644
index 0000000..3856ae0
--- /dev/null
+++ b/data/game_recognizer.ogg
Binary files differ
diff --git a/data/game_recognizer.wav b/data/game_recognizer.wav
new file mode 100644
index 0000000..2aaf7c5
--- /dev/null
+++ b/data/game_recognizer.wav
Binary files differ
diff --git a/data/lightcycle-high.obj b/data/lightcycle-high.obj
new file mode 100644
index 0000000..1363c8e
--- /dev/null
+++ b/data/lightcycle-high.obj
@@ -0,0 +1,5394 @@
+mtllib lightcycle.mtl
+
+g default
+v 0.273865 3.451810 1.481210
+v -0.293908 3.451810 1.481210
+v -0.000798 3.451810 1.551250
+v 1.083190 -2.294590 -1.004510
+v 1.174230 -2.294590 -0.550090
+v 1.083190 -2.294590 -0.066475
+v -1.080810 -2.294650 -0.066399
+v -1.171850 -2.294650 -0.550014
+v -1.080810 -2.294650 -1.004430
+v 0.434769 -2.965110 0.879098
+v 0.750321 -2.965170 0.879098
+v 0.434769 -3.398560 0.879098
+v -0.750320 -2.965170 0.879795
+v -0.434768 -2.965110 0.879795
+v -0.434768 -3.398560 0.879795
+v -0.552989 -0.046829 -0.405302
+v -0.489927 -0.138082 -0.407085
+v -0.492252 -0.042175 -0.371121
+v -0.491956 -0.072407 -0.502362
+v -0.555379 -0.062665 -0.468814
+v -0.765426 0.857927 -0.959692
+v -0.854535 0.856904 -0.765733
+v -0.767463 0.853919 -0.533109
+v 0.558915 -0.046950 -0.405302
+v 0.498178 -0.042296 -0.371121
+v 0.496648 -0.137495 -0.406907
+v 0.497881 -0.072529 -0.502362
+v 0.561304 -0.062786 -0.468814
+v 0.771352 0.857806 -0.959692
+v 0.779443 0.852508 -0.532277
+v 0.860461 0.856783 -0.765733
+v -0.544976 2.521220 0.337415
+v -0.608399 2.530960 0.303866
+v -0.543325 2.461850 0.232742
+v 0.546007 2.521160 0.337334
+v 0.546813 2.461540 0.233014
+v 0.609430 2.530900 0.303785
+v 0.252258 3.181190 1.420540
+v 0.141074 2.771630 1.228700
+v 0.257039 2.811790 1.105020
+v 0.449688 3.181190 1.200710
+v 0.293407 2.811790 1.028410
+v 0.508876 3.181190 1.028410
+v 0.548442 3.451810 1.028410
+v 0.486245 3.451810 1.235730
+v -0.497545 3.451810 1.235730
+v -0.546568 3.451810 1.028410
+v -0.510744 3.181190 1.028410
+v -0.461941 3.181190 1.200710
+v -0.273868 3.181190 1.420540
+v -0.269292 2.811790 1.105020
+v -0.162684 2.771630 1.228700
+v -0.295274 2.811790 1.028410
+v -0.000934 3.181190 1.481210
+v 0.548483 2.891820 -0.192291
+v 0.548483 3.135100 0.057695
+v 0.548483 3.451900 0.151337
+v 0.548483 3.451900 1.084660
+v 0.548483 2.822140 -0.521823
+v -0.546186 2.822030 -0.512824
+v -0.546186 2.891820 -0.192291
+v -0.546186 3.451900 1.084660
+v -0.546186 1.825790 1.084660
+v 0.548483 2.903480 -0.829070
+v 0.548483 3.144320 -1.059490
+v -0.546186 3.143510 -1.058950
+v -0.546186 2.903480 -0.829609
+v 0.549202 3.453240 -1.161700
+v 0.548483 3.455560 -1.571460
+v -0.546186 3.453130 -1.571460
+v -0.545467 3.453510 -1.161440
+v 0.548483 1.566400 -1.565410
+v -0.676956 1.426180 -0.923380
+v 0.679253 1.426090 -0.923929
+v 0.679253 1.502690 -0.968153
+v -0.676956 1.502770 -0.967603
+v -0.676956 1.349590 -1.056050
+v -0.676956 1.426180 -1.100270
+v 0.679253 1.426090 -1.100820
+v 0.679253 1.349500 -1.056590
+v -0.676956 1.502770 -1.056050
+v 0.679253 1.502690 -1.056590
+v 0.548278 2.836660 0.592582
+v 0.723279 2.856050 0.525728
+v 0.548111 3.451870 0.903784
+v 0.819480 3.451490 0.794665
+v 0.617091 2.538280 0.278425
+v 0.781827 2.885110 0.407483
+v 0.908592 3.450470 0.600709
+v 0.751699 2.918300 0.284572
+v 0.860883 3.447070 0.402437
+v 0.607041 2.546730 0.240274
+v 0.683428 2.934270 0.220732
+v 0.757213 3.446750 0.300198
+v 0.586818 2.550280 0.219000
+v 0.544504 3.448210 0.236618
+v 0.546683 2.942970 0.181952
+v 0.546304 2.551390 0.206089
+v -0.000934 2.771630 1.263720
+v 0.834473 -2.294590 0.298371
+v 0.788952 -1.774170 0.185737
+v 0.494714 -1.774170 0.394516
+v 0.494714 -2.294590 0.540647
+v 0.664592 -1.063780 -0.121979
+v 0.494714 -1.063780 -0.004720
+v 1.004350 -1.774170 -0.129311
+v 0.788952 -1.063780 -0.300982
+v 1.083190 -1.774170 -0.550090
+v 0.834473 -1.063780 -0.550090
+v 1.004350 -1.774170 -0.941669
+v 0.788952 -1.063780 -0.769997
+v 0.788952 -1.774170 -1.270390
+v 0.664592 -1.063780 -0.962676
+v 0.834473 -2.294590 -1.383020
+v 0.494714 -1.774170 -1.494690
+v 0.494714 -1.063780 -1.095460
+v 0.494714 -2.294590 -1.640820
+v -0.722248 2.856100 0.525809
+v -0.780796 2.885190 0.407563
+v -0.616060 2.538340 0.278506
+v -0.750668 2.918350 0.284653
+v -0.606010 2.546800 0.240352
+v -0.907558 3.450520 0.600787
+v -0.859850 3.447130 0.402518
+v -0.818449 3.451550 0.794746
+v -0.547247 2.836710 0.592660
+v -0.547080 3.451920 0.903862
+v -0.682397 2.934330 0.220812
+v -0.585787 2.550340 0.219081
+v -0.756182 3.446800 0.300278
+v -0.545652 2.943050 0.182033
+v -0.545273 2.551450 0.206170
+v -0.543473 3.448260 0.236699
+v 0.675151 0.262355 -0.690755
+v 0.733698 0.291443 -0.572511
+v 0.568965 -0.055403 -0.443454
+v 0.670262 0.338418 -0.409517
+v 0.500152 0.242978 -0.757607
+v 0.499985 0.858191 -1.068810
+v 0.498558 0.349298 -0.346981
+v 0.496378 0.854533 -0.401650
+v -1.001970 -1.774240 -0.129235
+v -1.080810 -1.774240 -0.550014
+v -1.001970 -1.774240 -0.941594
+v -0.832089 -1.063850 -0.550014
+v -0.786571 -1.063850 -0.769922
+v -0.786571 -1.063850 -0.300907
+v -0.492333 -1.774240 0.394594
+v -0.492333 -1.063850 -0.004645
+v -0.662211 -1.063850 -0.121902
+v -0.786571 -1.774240 0.185815
+v -0.492333 -2.294650 0.540723
+v -0.832089 -2.294650 0.298447
+v -0.786571 -1.774240 -1.270320
+v -0.832089 -2.294650 -1.382950
+v -0.662211 -1.063850 -0.962601
+v -0.492333 -1.063850 -1.095380
+v -0.492333 -1.774240 -1.494620
+v -0.492333 -2.294650 -1.640750
+v 0.555527 -2.965170 1.132750
+v 0.434769 -2.965170 1.158190
+v 0.657899 -2.965170 1.060320
+v 0.726302 -2.965170 0.951910
+v 1.017830 -2.208930 0.879098
+v 1.196560 -1.365100 0.879098
+v 1.138590 -1.365110 1.132750
+v 0.973451 -2.208930 1.060320
+v 1.259350 -0.444873 0.879098
+v 1.196580 -0.384063 1.158190
+v 1.017830 -0.323215 1.441480
+v 0.973451 -1.365110 1.394480
+v 0.750320 -0.284385 1.630760
+v 0.726302 -1.365110 1.569350
+v 0.657899 -2.208930 1.394480
+v 0.434768 -1.365110 1.630760
+v 0.434769 -2.208930 1.441480
+v 0.434768 -0.270147 1.697230
+v 0.434768 -0.444873 0.879098
+v -0.555526 -2.965170 1.133450
+v -0.434768 -2.965170 1.158880
+v -0.657898 -2.965170 1.061010
+v -0.726302 -2.965170 0.952603
+v -1.017830 -0.323216 1.442170
+v -0.973451 -1.365110 1.395170
+v -0.726302 -1.365110 1.570050
+v -0.750323 -0.284385 1.631460
+v -0.434768 -1.365110 1.631460
+v -0.434768 -0.270147 1.697920
+v -1.017830 -2.208930 0.879795
+v -0.973451 -2.208930 1.061010
+v -1.196560 -1.365100 0.879795
+v -1.138590 -1.365110 1.133450
+v -1.259350 -0.444874 0.879795
+v -1.196580 -0.384063 1.158880
+v -0.316211 3.307550 -0.247251
+v -0.316211 3.196870 -0.357936
+v -0.201011 3.156410 -0.334590
+v -0.201011 3.284190 -0.206818
+v -0.316211 3.156360 -0.509137
+v -0.201011 3.109650 -0.509137
+v -0.316211 3.196870 -0.660334
+v -0.201011 3.156410 -0.683679
+v -0.316211 3.307550 -0.771018
+v -0.201011 3.284190 -0.811451
+v -0.316211 3.458740 -0.811532
+v -0.201011 3.458740 -0.858225
+v -0.316211 3.609930 -0.771018
+v -0.201011 3.633280 -0.811451
+v -0.316211 3.720630 -0.660334
+v -0.201011 3.761060 -0.683679
+v -0.316211 3.761140 -0.509137
+v -0.201011 3.807820 -0.509137
+v -0.316211 3.720630 -0.357936
+v -0.201011 3.761060 -0.334590
+v -0.316211 3.609930 -0.247251
+v -0.201011 3.633280 -0.206818
+v -0.299662 4.381530 0.023643
+v -0.299662 3.991530 0.413664
+v -0.400593 3.371470 -0.357976
+v -0.400593 3.307570 -0.421862
+v -0.400593 3.284190 -0.509137
+v -0.400593 3.307570 -0.596407
+v -0.400593 3.371470 -0.660293
+v -0.400593 3.546010 -0.660293
+v -0.400593 3.609900 -0.596407
+v -0.400593 3.633280 -0.509137
+v -0.400593 3.609900 -0.421862
+v -0.400593 3.546010 -0.357976
+v -0.427666 3.430160 -0.459631
+v -0.427666 3.409230 -0.480555
+v -0.427666 3.401580 -0.509137
+v -0.427666 3.409230 -0.537718
+v -0.427666 3.430160 -0.558639
+v -0.427666 3.458740 -0.566300
+v -0.400593 3.458740 -0.683679
+v -0.427666 3.487320 -0.558639
+v -0.427666 3.508250 -0.537718
+v -0.427666 3.515890 -0.509137
+v -0.427666 3.508250 -0.480555
+v -0.427666 3.487320 -0.459631
+v 0.402890 3.371470 -0.357976
+v 0.402890 3.307570 -0.421862
+v 0.429960 3.409230 -0.480555
+v 0.429960 3.430160 -0.459631
+v 0.402890 3.284190 -0.509137
+v 0.429960 3.401580 -0.509137
+v 0.402890 3.307570 -0.596407
+v 0.429960 3.409230 -0.537718
+v 0.402890 3.371470 -0.660293
+v 0.429960 3.430160 -0.558639
+v 0.402890 3.458740 -0.683679
+v 0.429960 3.458740 -0.566300
+v 0.402890 3.546010 -0.660293
+v 0.429960 3.487320 -0.558639
+v 0.402890 3.609900 -0.596407
+v 0.429960 3.508250 -0.537718
+v 0.402890 3.633280 -0.509137
+v 0.429960 3.515890 -0.509137
+v 0.402890 3.609900 -0.421862
+v 0.429960 3.508250 -0.480555
+v 0.402890 3.546010 -0.357976
+v 0.429960 3.487320 -0.459631
+v 0.318508 3.307550 -0.247251
+v 0.318508 3.196870 -0.357936
+v 0.318508 3.156360 -0.509137
+v 0.318508 3.196870 -0.660334
+v 0.318508 3.307550 -0.771018
+v 0.318508 3.609930 -0.771018
+v 0.318508 3.720630 -0.660334
+v 0.318508 3.761140 -0.509137
+v 0.318508 3.720630 -0.357936
+v 0.318508 3.609930 -0.247251
+v 0.203307 3.284190 -0.206818
+v 0.203307 3.156410 -0.334590
+v 0.203307 3.109650 -0.509137
+v 0.203307 3.156410 -0.683679
+v 0.203307 3.284190 -0.811451
+v 0.203307 3.458740 -0.858225
+v 0.318508 3.458740 -0.811532
+v 0.203307 3.633280 -0.811451
+v 0.203307 3.761060 -0.683679
+v 0.203307 3.807820 -0.509137
+v 0.203307 3.761060 -0.334590
+v 0.203307 3.633280 -0.206818
+v 0.301959 4.381530 0.023643
+v 0.301959 3.991530 0.413664
+v -0.345585 4.007550 0.441443
+v -0.345585 4.409330 0.039680
+v -0.299662 3.458740 0.556424
+v -0.345584 3.458740 0.588499
+v -0.131138 4.749900 0.236311
+v -0.131138 4.204180 0.782016
+v 0.001148 4.229370 0.825638
+v 0.001148 4.793510 0.261496
+v 0.133435 4.204180 0.782016
+v 0.133435 4.749900 0.236311
+v 0.347881 4.409330 0.039680
+v 0.347881 4.007550 0.441443
+v 0.347881 3.458740 0.588499
+v 0.301959 3.458740 0.556424
+v -0.299662 4.524290 -0.509137
+v -0.345585 4.556370 -0.509137
+v -0.131138 4.949630 -0.509137
+v 0.001148 5.000000 -0.509137
+v 0.133435 4.949630 -0.509137
+v 0.347881 4.556370 -0.509137
+v 0.301959 4.524290 -0.509137
+v -0.299662 2.535950 -1.041910
+v -0.299662 2.925980 -1.431930
+v -0.345584 2.909920 -1.459710
+v -0.345584 2.508170 -1.057950
+v -0.299662 3.458740 -1.574690
+v -0.345584 3.458740 -1.606760
+v 0.347882 2.508170 -1.057950
+v 0.347881 2.909920 -1.459710
+v 0.301959 2.925980 -1.431930
+v 0.301959 2.535950 -1.041910
+v 0.347881 3.458740 -1.606760
+v 0.301959 3.458740 -1.574690
+v 0.347881 4.007550 -1.459710
+v 0.301959 3.991530 -1.431930
+v 0.347881 4.409330 -1.057950
+v 0.301959 4.381530 -1.041910
+v 0.001148 4.229370 -1.843910
+v 0.001148 4.793510 -1.279770
+v 0.133435 4.749900 -1.254580
+v 0.133435 4.204180 -1.800280
+v -0.131138 4.204180 -1.800280
+v -0.131138 4.749900 -1.254580
+v -0.299662 3.991530 -1.431930
+v -0.345585 4.007550 -1.459710
+v -0.299662 4.381530 -1.041910
+v -0.345585 4.409330 -1.057950
+v 0.875216 -3.546010 -0.357895
+v 0.875216 -3.609900 -0.421781
+v 0.916234 -3.508250 -0.480471
+v 0.916234 -3.487320 -0.459548
+v 0.875216 -3.633280 -0.509053
+v 0.916234 -3.515900 -0.509053
+v 0.875216 -3.609900 -0.596323
+v 0.916234 -3.508250 -0.537634
+v 0.875216 -3.546010 -0.660212
+v 0.916234 -3.487320 -0.558558
+v 0.875216 -3.371470 -0.660212
+v 0.875216 -3.307570 -0.596323
+v 0.916234 -3.409230 -0.537634
+v 0.916234 -3.430160 -0.558558
+v 0.875216 -3.284190 -0.509053
+v 0.916234 -3.401580 -0.509053
+v 0.875216 -3.307570 -0.421781
+v 0.916234 -3.409230 -0.480471
+v 0.875216 -3.371470 -0.357895
+v 0.916234 -3.430160 -0.459548
+v 0.747363 -3.609930 -0.247170
+v 0.747363 -3.720630 -0.357855
+v 0.747363 -3.761140 -0.509053
+v 0.747363 -3.720630 -0.660250
+v 0.747363 -3.609930 -0.770937
+v 0.747363 -3.458740 -0.811448
+v 0.747363 -3.307550 -0.770937
+v 0.875216 -3.458740 -0.683595
+v 0.747363 -3.196840 -0.660250
+v 0.747363 -3.156330 -0.509053
+v 0.747363 -3.196840 -0.357855
+v 0.747363 -3.307550 -0.247170
+v 0.572820 -3.458740 -0.159966
+v 0.747363 -3.458740 -0.206656
+v 0.572820 -3.284190 -0.206734
+v 0.572820 -3.633280 -0.206734
+v 0.572820 -3.761060 -0.334509
+v 0.572820 -3.807820 -0.509053
+v 0.572820 -3.761060 -0.683595
+v 0.572820 -3.633280 -0.811370
+v 0.572820 -3.284190 -0.811370
+v 0.572820 -3.156410 -0.683595
+v 0.572820 -3.109650 -0.509053
+v 0.572820 -3.156410 -0.334509
+v 0.800063 -3.961360 0.361511
+v 0.800063 -4.329300 -0.006434
+v 0.800063 -4.463980 -0.509053
+v 0.800063 -4.329300 -1.011670
+v 0.800063 -3.961360 -1.379620
+v 0.800063 -2.956120 -1.379620
+v 0.800063 -2.588170 -1.011670
+v 0.800063 -2.453490 -0.509053
+v 0.800063 -2.588170 -0.006434
+v 0.800063 -2.956120 0.361511
+v 1.078580 -4.007550 0.441524
+v 1.078580 -4.409330 0.039761
+v 1.078580 -4.556370 -0.509053
+v 1.078580 -4.409330 -1.057870
+v 1.078580 -4.007550 -1.459630
+v 1.078580 -2.909920 -1.459630
+v 1.078580 -2.508140 -1.057870
+v 1.078580 -2.361100 -0.509053
+v 1.078580 -2.508140 0.039761
+v 1.078580 -2.909920 0.441524
+v -0.913936 -3.515900 -0.509053
+v -0.913936 -3.508250 -0.537634
+v -0.872918 -3.609900 -0.596323
+v -0.872918 -3.633280 -0.509053
+v -0.913936 -3.487320 -0.558558
+v -0.872918 -3.546010 -0.660212
+v -0.745065 -3.720630 -0.660250
+v -0.745065 -3.761140 -0.509053
+v -0.745065 -3.609930 -0.770934
+v -0.570522 -3.761060 -0.683595
+v -0.570522 -3.807820 -0.509053
+v -0.570522 -3.633280 -0.811370
+v -0.797765 -4.329300 -1.011670
+v -0.797765 -4.463980 -0.509053
+v -0.797765 -3.961360 -1.379620
+v -1.076280 -4.409330 -1.057870
+v -1.076280 -4.556370 -0.509053
+v -1.076280 -4.007550 -1.459630
+v -0.377029 -4.949630 -0.509053
+v -0.377029 -4.749900 -1.254500
+v 0.001149 -4.793510 -1.279680
+v 0.001149 -5.000000 -0.509053
+v -0.377029 -4.204180 -1.800200
+v 0.001149 -4.229370 -1.843830
+v 0.379327 -4.749900 -1.254500
+v 0.379327 -4.949630 -0.509053
+v 0.379327 -4.204180 -1.800200
+v 0.771511 -2.791400 -1.664910
+v 0.771511 -2.302880 -1.176380
+v 0.771511 -2.124070 -0.509056
+v 0.771511 -2.302880 0.158278
+v 0.771511 -2.791400 0.646801
+v 0.001149 -4.229370 0.825719
+v 0.001149 -4.793510 0.261577
+v 0.379327 -4.749900 0.236392
+v 0.379327 -4.204180 0.782099
+v -0.377029 -4.204180 0.782099
+v -0.377029 -4.749900 0.236392
+v -1.076280 -2.909920 -1.459630
+v -1.076280 -2.508140 -1.057870
+v -0.769213 -2.302880 -1.176380
+v -0.769213 -2.791400 -1.664910
+v -1.076280 -2.361100 -0.509053
+v -0.769213 -2.124070 -0.509056
+v -1.076280 -2.508140 0.039761
+v -0.769213 -2.302880 0.158278
+v -1.076280 -2.909920 0.441524
+v -0.769213 -2.791400 0.646801
+v -0.797765 -3.961360 0.361511
+v -0.797765 -4.329300 -0.006434
+v -1.076280 -4.409330 0.039761
+v -1.076280 -4.007550 0.441524
+v -0.797765 -2.956120 -1.379620
+v -0.797765 -2.588170 -1.011670
+v -0.797765 -2.453490 -0.509053
+v -0.797765 -2.588170 -0.006434
+v -0.797765 -2.956120 0.361511
+v -0.570522 -3.633280 -0.206734
+v -0.570522 -3.761060 -0.334509
+v -0.570522 -3.284190 -0.811370
+v -0.570522 -3.156410 -0.683595
+v -0.570522 -3.109650 -0.509053
+v -0.570522 -3.156410 -0.334509
+v -0.570522 -3.284190 -0.206734
+v -0.745065 -3.458740 -0.206656
+v -0.570522 -3.458740 -0.159966
+v -0.745065 -3.307550 -0.247170
+v -0.745065 -3.609930 -0.247170
+v -0.745065 -3.720630 -0.357855
+v -0.745065 -3.458740 -0.811448
+v -0.570522 -3.458740 -0.858139
+v -0.745065 -3.307550 -0.770937
+v -0.745065 -3.196840 -0.660250
+v -0.745065 -3.156330 -0.509053
+v -0.745065 -3.196840 -0.357855
+v -0.872918 -3.546010 -0.357895
+v -0.872918 -3.609900 -0.421781
+v -0.872918 -3.458740 -0.683595
+v -0.872918 -3.371470 -0.660212
+v -0.872918 -3.307570 -0.596323
+v -0.872918 -3.284190 -0.509053
+v -0.872918 -3.307570 -0.421781
+v -0.872918 -3.371470 -0.357895
+v -0.913936 -3.487320 -0.459548
+v -0.913936 -3.508250 -0.480471
+v -0.913936 -3.430160 -0.558558
+v -0.913936 -3.409230 -0.537634
+v -0.913936 -3.401580 -0.509053
+v -0.913936 -3.409230 -0.480471
+v -0.913936 -3.430160 -0.459548
+v 0.678787 -2.157460 1.583380
+v 0.678787 -1.124810 1.718380
+v 0.570366 -1.142410 1.806670
+v 0.570366 -2.185810 1.668520
+v 0.678925 -0.004852 1.752320
+v 0.571394 0.029453 1.839210
+v -0.576122 -1.142320 1.806380
+v -0.576068 -2.185810 1.668520
+v -0.576162 0.031290 1.839230
+v -0.676490 -1.124750 1.718120
+v -0.676490 -2.157470 1.583260
+v -0.676490 -0.004764 1.752240
+v -0.676489 -3.394600 1.190930
+v -0.576068 -3.436350 1.270410
+v 0.570366 -3.435550 1.270680
+v 0.678788 -3.393800 1.191330
+v 0.678788 -3.414540 0.649185
+v 0.678788 -4.117340 0.793210
+v 0.570366 -4.270450 0.820601
+v -0.576068 -4.270450 0.820601
+v -0.676489 -4.117260 0.793321
+v 0.678787 1.397340 1.509670
+v 0.570365 1.449700 1.591280
+v -0.576068 1.449170 1.591280
+v 0.570365 2.482670 1.157560
+v -0.576068 2.481860 1.157560
+v 0.678787 2.412520 1.086860
+v -0.676490 1.396850 1.509640
+v -0.676490 2.411800 1.086810
+v -0.390239 3.054810 1.114590
+v 0.393454 3.056720 1.117850
+v 0.394025 2.865050 0.797334
+v -0.389665 2.863190 0.794059
+v 0.393454 1.789460 1.687220
+v 0.394025 1.652670 1.352160
+v -0.390238 1.787550 1.683970
+v -0.389665 1.650790 1.348880
+v 0.393454 0.746772 1.948920
+v 0.394025 0.702910 1.594350
+v -0.390238 0.744859 1.945660
+v -0.389665 0.701024 1.591070
+v 0.393454 -0.270583 2.050400
+v 0.394025 -0.270750 1.687430
+v -0.390238 -0.272496 2.047140
+v -0.389665 -0.272636 1.683990
+v 0.393454 -1.790790 1.943920
+v 0.394025 -1.736560 1.567550
+v -0.390238 -1.792700 1.940660
+v -0.389664 -1.738450 1.564280
+v 0.393455 -3.710610 1.388340
+v 0.394026 -3.516190 1.083290
+v 0.394026 -3.038430 1.243490
+v 0.393455 -3.208800 1.591400
+v -0.390238 -3.712530 1.385090
+v -0.390238 -3.210710 1.588150
+v -0.389664 -3.040320 1.240210
+v -0.389664 -3.518080 1.080020
+v -0.389664 -4.198040 0.807570
+v -0.390238 -4.551950 0.870578
+v 0.393455 -4.550040 0.873829
+v 0.394026 -4.198100 0.807540
+v 0.678787 1.492600 0.504637
+v -0.676490 1.492600 0.505176
+v 0.678787 0.970042 -0.110846
+v -0.676490 0.970311 -0.111115
+v 0.678787 -2.156480 -0.109958
+v -0.676490 -2.157020 -0.109958
+v -0.676490 -2.646060 0.507118
+v 0.678788 -2.646330 0.507387
+v -0.676489 -3.413190 0.648916
+v -0.546186 1.566400 -1.565410
+v -0.669225 0.262476 -0.690755
+v -0.563039 -0.055282 -0.443454
+v -0.727773 0.291565 -0.572511
+v -0.658281 0.338200 -0.410347
+v -0.494059 0.858312 -1.068810
+v -0.494226 0.243099 -0.757607
+v -0.492632 0.349419 -0.346981
+v -0.490453 0.854655 -0.401650
+v 0.678787 1.500410 -0.676226
+v -0.676490 1.500680 -0.676495
+v -0.676490 1.307820 -0.738178
+v 0.678787 1.308350 -0.738447
+v -0.546185 -2.809320 -1.565410
+v -0.543761 -2.809320 1.291700
+v -0.546185 -2.265750 1.291700
+v -0.546185 -2.265750 -1.565410
+v -0.495675 -0.368304 -0.567460
+v 0.494302 -0.375000 -0.569196
+v -0.434768 -0.444873 0.879795
+v 0.847058 -2.208930 1.260630
+v -0.657898 -2.208930 1.395170
+v -0.434768 -2.208930 1.442170
+v -0.316211 3.458740 -0.206737
+v -0.201011 3.458740 -0.160047
+v -0.427666 3.458740 -0.451974
+v -0.400593 3.458740 -0.334590
+v 0.402890 3.458740 -0.334590
+v 0.429960 3.458740 -0.451974
+v 0.203307 3.458740 -0.160047
+v 0.318508 3.458740 -0.206737
+v -0.268325 4.126070 0.646720
+v -0.268325 4.614600 0.158198
+v -0.131138 3.458740 0.981761
+v 0.001148 3.458740 1.032130
+v 0.133435 3.458740 0.981761
+v 0.270622 4.126070 0.646720
+v 0.270622 4.614600 0.158198
+v -0.268325 2.302890 -1.176470
+v -0.268325 2.791410 -1.664990
+v -0.131138 2.713300 -1.800280
+v -0.131138 2.167590 -1.254580
+v -0.268325 3.458740 -1.843800
+v -0.131138 3.458740 -2.000030
+v 0.001148 2.688110 -1.843910
+v 0.001148 2.123970 -1.279760
+v 0.001148 3.458740 -2.050400
+v 0.133435 2.713300 -1.800280
+v 0.133435 2.167590 -1.254580
+v 0.133435 3.458740 -2.000030
+v 0.270622 2.791410 -1.664990
+v 0.270622 2.302890 -1.176470
+v 0.270622 3.458740 -1.843800
+v 0.270622 4.126070 -1.664990
+v 0.270622 4.614600 -1.176470
+v -0.268325 4.126070 -1.664990
+v -0.268325 4.614600 -1.176470
+v 1.078580 -3.458740 -1.606680
+v 0.800063 -3.458740 -1.514290
+v -0.769213 -4.614600 -1.176380
+v -0.769213 -4.793400 -0.509053
+v -0.769213 -4.126070 -1.664910
+v 0.771511 -4.126070 -1.664910
+v 0.771511 -4.614600 -1.176380
+v 0.771511 -4.793400 -0.509053
+v 0.771511 -4.126070 0.646801
+v 0.771511 -4.614600 0.158278
+v 0.379327 -2.713290 -1.800200
+v 0.379327 -2.167580 -1.254500
+v 0.001149 -3.458740 -2.050310
+v 0.379327 -3.458740 -1.999940
+v 0.001149 -2.688110 -1.843830
+v 0.001149 -2.123960 -1.279680
+v -0.377029 -3.458740 -1.999940
+v -0.377029 -2.713290 -1.800200
+v -0.377029 -2.167580 -1.254500
+v -0.769213 -4.614600 0.158278
+v -0.769213 -4.126070 0.646801
+v -0.797765 -3.458740 -1.514290
+v -1.076280 -3.458740 -1.606680
+v 0.548483 1.825790 1.084660
+v -0.546186 3.135100 0.057695
+v -0.546186 3.451900 0.151337
+v -0.546186 1.192800 0.339252
+v 0.548483 1.192800 0.339252
+v -0.676956 1.349590 -0.967603
+v 0.679253 1.349500 -0.968153
+v 0.434768 -1.365100 0.879098
+v 0.434769 -2.208990 0.879098
+v -0.847057 -2.208930 1.261320
+v -0.434768 -2.208990 0.879795
+v -0.434768 -1.365100 0.879795
+v -0.299662 2.925980 0.413664
+v -0.299662 2.535950 0.023643
+v -0.299662 2.393190 -0.509137
+v 0.301959 2.925980 0.413664
+v 0.301959 2.535950 0.023643
+v 0.301959 2.393190 -0.509137
+v -0.268325 3.458740 0.825533
+v 0.270622 3.458740 0.825533
+v -0.268325 4.793400 -0.509137
+v 0.270622 4.793400 -0.509137
+v 0.916234 -3.458740 -0.451890
+v 0.875216 -3.458740 -0.334509
+v 0.916234 -3.458740 -0.566216
+v 0.572820 -3.458740 -0.858139
+v 0.800063 -3.458740 0.496190
+v 1.078580 -3.458740 0.588580
+v 0.771511 -3.458740 0.825614
+v 0.379327 -3.458740 0.981841
+v 0.771511 -3.458740 -1.843720
+v -0.769213 -3.458740 0.825614
+v -0.377029 -3.458740 0.981841
+v -0.769213 -3.458740 -1.843720
+v -1.076280 -3.458740 0.588580
+v -0.797765 -3.458740 0.496190
+v -0.872918 -3.458740 -0.334509
+v -0.913936 -3.458740 -0.451890
+v -0.913936 -3.458740 -0.566216
+v 0.548483 -2.265750 -1.565410
+v 0.548483 -2.809320 -1.565410
+v 0.548483 -2.809320 1.291700
+v 0.548483 -2.265750 1.291700
+v 0.834473 -1.063780 -0.550090
+v 0.664592 -1.063780 -0.121979
+v 0.664592 -1.063780 -0.962676
+v -0.832089 -1.063850 -0.550014
+v -0.662211 -1.063850 -0.121902
+v -0.662211 -1.063850 -0.962601
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn -0.707107 0.000000 0.707107
+vn -0.000000 -1.000000 0.000000
+vn -0.408248 -0.816497 0.408248
+vn -0.848288 0.094287 0.521073
+vn -0.000000 -1.000000 0.000000
+vn -0.408248 -0.816497 0.408248
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.754321 -0.068901 0.652880
+vn -0.445037 -0.323865 0.834897
+vn -0.527233 0.115337 0.841857
+vn -0.395397 -0.658416 -0.640429
+vn -0.390421 -0.761869 -0.516843
+vn -0.419048 -0.688095 -0.592388
+vn 0.000916 0.999967 0.008092
+vn 0.009063 0.999914 0.009438
+vn 0.000982 0.999955 0.009400
+vn 0.464512 -0.226171 0.856198
+vn 0.424747 -0.170979 0.889020
+vn 0.445625 -0.321265 0.835588
+vn 0.425020 -0.669655 -0.609032
+vn 0.397857 -0.650766 -0.646694
+vn 0.389595 -0.763709 -0.514746
+vn -0.001396 0.999948 0.010110
+vn -0.001702 0.999921 0.012427
+vn -0.016165 0.999789 0.012699
+vn -0.659913 0.146362 0.736948
+vn -0.391785 -0.670624 0.629895
+vn -0.850572 -0.151956 0.503426
+vn -0.343995 0.184236 0.920720
+vn 0.368844 -0.805765 0.463353
+vn 0.053442 -0.321688 0.945336
+vn 0.573700 -0.352310 0.739423
+vn 0.720911 -0.444686 0.531547
+vn 0.721044 -0.481883 0.497880
+vn 0.721044 -0.481883 0.497880
+vn 0.837571 -0.337150 0.429889
+vn 0.573700 -0.352310 0.739423
+vn 0.837571 -0.337150 0.429889
+vn 0.721044 -0.481883 0.497880
+vn 0.805416 -0.493713 0.327952
+vn 0.805416 -0.493713 0.327952
+vn 0.897518 -0.315285 0.308313
+vn 0.837571 -0.337150 0.429889
+vn 0.941092 -0.150684 0.302720
+vn 0.822020 -0.187372 0.537749
+vn 0.837571 -0.337150 0.429889
+vn 0.837571 -0.337150 0.429889
+vn 0.897518 -0.315285 0.308313
+vn 0.941092 -0.150684 0.302720
+vn 0.822020 -0.187372 0.537749
+vn -0.165814 0.276753 0.946527
+vn 0.573700 -0.352310 0.739423
+vn 0.573700 -0.352310 0.739423
+vn 0.837571 -0.337150 0.429889
+vn 0.822020 -0.187372 0.537749
+vn -0.909818 -0.159491 0.383136
+vn -0.965187 -0.127769 0.228229
+vn -0.910634 -0.322586 0.258233
+vn -0.910634 -0.322586 0.258233
+vn -0.805803 -0.341943 0.483484
+vn -0.909818 -0.159491 0.383136
+vn -0.750937 -0.189443 0.632617
+vn -0.909818 -0.159491 0.383136
+vn -0.805803 -0.341943 0.483484
+vn -0.805803 -0.341943 0.483484
+vn -0.391719 -0.357797 0.847666
+vn -0.750937 -0.189443 0.632617
+vn -0.805803 -0.341943 0.483484
+vn -0.802701 -0.496831 0.329894
+vn -0.556594 -0.493693 0.668184
+vn -0.556594 -0.493693 0.668184
+vn -0.391719 -0.357797 0.847666
+vn -0.805803 -0.341943 0.483484
+vn -0.910634 -0.322586 0.258233
+vn -0.828954 -0.483527 0.281137
+vn -0.802701 -0.496831 0.329894
+vn -0.802701 -0.496831 0.329894
+vn -0.805803 -0.341943 0.483484
+vn -0.910634 -0.322586 0.258233
+vn -0.165814 0.276753 0.946527
+vn -0.297338 0.070244 0.952185
+vn 0.082760 -0.359348 0.929527
+vn 0.082760 -0.359348 0.929527
+vn 0.573700 -0.352310 0.739423
+vn -0.165814 0.276753 0.946527
+vn -0.297338 0.070244 0.952185
+vn -0.226235 -0.229008 0.946770
+vn -0.391719 -0.357797 0.847666
+vn -0.391719 -0.357797 0.847666
+vn 0.082760 -0.359348 0.929527
+vn -0.297338 0.070244 0.952185
+vn -1.000000 0.000000 -0.000000
+vn -1.000000 0.000000 -0.000000
+vn -1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn -0.000468 0.881581 -0.472032
+vn 0.000107 0.999682 0.025207
+vn 0.000022 0.999760 0.021922
+vn 0.000022 0.999760 0.021922
+vn 0.000000 0.880872 -0.473354
+vn -0.000468 0.881581 -0.472032
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 -0.000000 0.000000
+vn 0.000357 0.862030 0.506858
+vn 0.000041 0.515343 0.856984
+vn 0.000007 0.515153 0.857098
+vn 0.000007 0.515153 0.857098
+vn -0.000249 0.862850 0.505460
+vn 0.000357 0.862030 0.506858
+vn 0.000357 0.862030 0.506858
+vn -0.000249 0.862850 0.505460
+vn 0.000022 0.999760 0.021922
+vn 0.000022 0.999760 0.021922
+vn 0.000107 0.999682 0.025207
+vn 0.000357 0.862030 0.506858
+vn -0.000987 0.999997 0.002369
+vn -0.002220 0.999981 0.005665
+vn -0.000987 0.999997 0.002369
+vn -0.000987 0.999997 0.002369
+vn 0.000246 1.000000 -0.000927
+vn -0.000987 0.999997 0.002369
+vn 0.000269 0.314008 0.949420
+vn 0.000303 0.313901 0.949456
+vn 0.000007 0.515153 0.857098
+vn 0.000007 0.515153 0.857098
+vn 0.000041 0.515343 0.856984
+vn 0.000269 0.314008 0.949420
+vn 0.999999 -0.000575 0.000909
+vn 0.999998 -0.000573 0.001786
+vn 1.000000 -0.000230 0.000364
+vn 1.000000 -0.000230 0.000364
+vn 0.999998 -0.000006 -0.001755
+vn 0.999999 -0.000575 0.000909
+vn 0.000382 0.500012 0.866019
+vn 0.000384 0.499991 0.866030
+vn 0.000382 0.500012 0.866019
+vn 0.000382 0.500012 0.866019
+vn 0.000381 0.500032 0.866007
+vn 0.000382 0.500012 0.866019
+vn -0.000381 -0.500049 -0.865997
+vn -0.000384 -0.500006 -0.866022
+vn -0.000381 -0.500049 -0.865997
+vn -0.000381 -0.500049 -0.865997
+vn -0.000378 -0.500091 -0.865973
+vn -0.000381 -0.500049 -0.865997
+vn -0.000317 0.500024 -0.866011
+vn -0.000315 0.500006 -0.866022
+vn -0.000317 0.500024 -0.866011
+vn -0.000317 0.500024 -0.866011
+vn -0.000318 0.500042 -0.866001
+vn -0.000317 0.500024 -0.866011
+vn 0.388275 -0.533900 0.751128
+vn -0.343995 0.184236 0.920720
+vn 0.053442 -0.321688 0.945336
+vn 0.053442 -0.321688 0.945336
+vn 0.348897 -0.489634 0.799080
+vn 0.388275 -0.533900 0.751128
+vn 0.350033 -0.426337 0.834095
+vn 0.388275 -0.533900 0.751128
+vn 0.348897 -0.489634 0.799080
+vn 0.348897 -0.489634 0.799080
+vn 0.335901 -0.432246 0.836860
+vn 0.350033 -0.426337 0.834095
+vn 0.870721 -0.390240 0.299261
+vn 0.868350 -0.495846 -0.010225
+vn 0.904767 -0.423597 0.044305
+vn 0.904767 -0.423597 0.044305
+vn 0.853677 -0.409241 0.322115
+vn 0.870721 -0.390240 0.299261
+vn 0.869700 -0.318678 0.376916
+vn 0.860743 -0.318436 0.397139
+vn 0.870721 -0.390240 0.299261
+vn 0.870721 -0.390240 0.299261
+vn 0.853677 -0.409241 0.322115
+vn 0.869700 -0.318678 0.376916
+vn 0.959193 -0.135293 -0.248283
+vn 0.922172 -0.251029 -0.294251
+vn 0.842752 -0.158568 -0.514417
+vn 0.842752 -0.158568 -0.514417
+vn 0.814623 -0.040776 -0.578555
+vn 0.959193 -0.135293 -0.248283
+vn 0.922172 -0.251029 -0.294251
+vn 0.904767 -0.423597 0.044305
+vn 0.798570 -0.345018 -0.493203
+vn 0.798570 -0.345018 -0.493203
+vn 0.842752 -0.158568 -0.514417
+vn 0.922172 -0.251029 -0.294251
+vn 0.814623 -0.040776 -0.578555
+vn 0.842752 -0.158568 -0.514417
+vn 0.467668 -0.007511 -0.883872
+vn 0.467668 -0.007511 -0.883872
+vn 0.509357 0.059781 -0.858477
+vn 0.814623 -0.040776 -0.578555
+vn 0.842752 -0.158568 -0.514417
+vn 0.798570 -0.345018 -0.493203
+vn 0.563478 -0.143681 -0.813540
+vn 0.563478 -0.143681 -0.813540
+vn 0.467668 -0.007511 -0.883872
+vn 0.842752 -0.158568 -0.514417
+vn 0.281460 0.105563 -0.953749
+vn 0.509357 0.059781 -0.858477
+vn 0.467668 -0.007511 -0.883872
+vn 0.467668 -0.007511 -0.883872
+vn 0.274094 0.022582 -0.961438
+vn 0.281460 0.105563 -0.953749
+vn 0.467668 -0.007511 -0.883872
+vn 0.563478 -0.143681 -0.813540
+vn 0.346237 -0.128948 -0.929243
+vn 0.346237 -0.128948 -0.929243
+vn 0.274094 0.022582 -0.961438
+vn 0.467668 -0.007511 -0.883872
+vn -0.391719 -0.357797 0.847666
+vn -0.556594 -0.493693 0.668184
+vn -0.057018 -0.467356 0.882228
+vn -0.057018 -0.467356 0.882228
+vn 0.082760 -0.359348 0.929527
+vn -0.391719 -0.357797 0.847666
+vn 0.082760 -0.359348 0.929527
+vn -0.057018 -0.467356 0.882228
+vn 0.209831 -0.459380 0.863100
+vn 0.209831 -0.459380 0.863100
+vn 0.573700 -0.352310 0.739423
+vn 0.082760 -0.359348 0.929527
+vn 0.655933 0.214536 0.723689
+vn 0.720236 0.295104 0.627833
+vn 0.546074 0.321198 0.773715
+vn 0.565986 0.222872 0.793718
+vn 0.609777 0.404101 0.681816
+vn 0.609777 0.404101 0.681816
+vn 0.553016 0.498604 0.667508
+vn 0.546074 0.321198 0.773715
+vn 0.879518 0.186437 0.437823
+vn 0.915805 0.261785 0.304581
+vn 0.819488 0.432449 0.376069
+vn 0.983442 0.171805 0.057655
+vn 0.965198 0.252041 -0.069766
+vn 0.942837 0.329236 0.051596
+vn 0.866060 0.270364 -0.420527
+vn 0.859541 0.413243 -0.300699
+vn 0.932390 0.178928 -0.314060
+vn 0.660593 0.305327 -0.685852
+vn 0.716478 0.380032 -0.585009
+vn 0.753287 0.201691 -0.626002
+vn 0.575470 0.314569 -0.754904
+vn 0.584483 0.450862 -0.674613
+vn 0.590680 0.218857 -0.776659
+vn -0.872664 -0.408805 0.267086
+vn -0.857498 -0.378128 0.348878
+vn -0.904780 -0.423574 0.044255
+vn -0.904780 -0.423574 0.044255
+vn -0.863446 -0.504297 -0.012018
+vn -0.872664 -0.408805 0.267086
+vn -0.933198 -0.226312 -0.279148
+vn -0.792292 -0.133218 -0.595421
+vn -0.795941 -0.350374 -0.493676
+vn -0.795941 -0.350374 -0.493676
+vn -0.904780 -0.423574 0.044255
+vn -0.933198 -0.226312 -0.279148
+vn -0.933198 -0.226312 -0.279148
+vn -0.963533 -0.137611 -0.229495
+vn -0.903855 -0.089875 -0.418292
+vn -0.903855 -0.089875 -0.418292
+vn -0.792292 -0.133218 -0.595421
+vn -0.933198 -0.226312 -0.279148
+vn -0.869716 -0.316640 0.378593
+vn -0.857866 -0.327658 0.395862
+vn -0.857498 -0.378128 0.348878
+vn -0.857498 -0.378128 0.348878
+vn -0.872664 -0.408805 0.267086
+vn -0.869716 -0.316640 0.378593
+vn -0.350271 -0.428291 0.832993
+vn -0.354120 -0.522931 0.775334
+vn -0.375915 -0.510275 0.773503
+vn -0.375915 -0.510275 0.773503
+vn -0.337220 -0.424870 0.840100
+vn -0.350271 -0.428291 0.832993
+vn -0.375915 -0.510275 0.773503
+vn -0.354120 -0.522931 0.775334
+vn -0.391785 -0.670624 0.629895
+vn -0.391785 -0.670624 0.629895
+vn -0.659913 0.146362 0.736948
+vn -0.375915 -0.510275 0.773503
+vn -0.792292 -0.133218 -0.595421
+vn -0.423369 -0.011407 -0.905885
+vn -0.563474 -0.143683 -0.813543
+vn -0.563474 -0.143683 -0.813543
+vn -0.795941 -0.350374 -0.493676
+vn -0.792292 -0.133218 -0.595421
+vn -0.792292 -0.133218 -0.595421
+vn -0.903855 -0.089875 -0.418292
+vn -0.572191 0.046097 -0.818824
+vn -0.572191 0.046097 -0.818824
+vn -0.423369 -0.011407 -0.905885
+vn -0.792292 -0.133218 -0.595421
+vn -0.423369 -0.011407 -0.905885
+vn -0.274091 0.022586 -0.961439
+vn -0.345767 -0.132147 -0.928968
+vn -0.345767 -0.132147 -0.928968
+vn -0.563474 -0.143683 -0.813543
+vn -0.423369 -0.011407 -0.905885
+vn -0.281462 0.105567 -0.953748
+vn -0.274091 0.022586 -0.961439
+vn -0.423369 -0.011407 -0.905885
+vn -0.423369 -0.011407 -0.905885
+vn -0.572191 0.046097 -0.818824
+vn -0.281462 0.105567 -0.953748
+vn 0.872671 -0.408797 -0.267077
+vn 0.857499 -0.378126 -0.348878
+vn 0.904783 -0.423566 -0.044258
+vn 0.904783 -0.423566 -0.044258
+vn 0.867974 -0.496501 0.010408
+vn 0.872671 -0.408797 -0.267077
+vn 0.913187 -0.192097 0.359427
+vn 0.899138 -0.176078 0.400683
+vn 0.874858 -0.379655 0.300808
+vn 0.874858 -0.379655 0.300808
+vn 0.904783 -0.423566 -0.044258
+vn 0.913187 -0.192097 0.359427
+vn 0.913187 -0.192097 0.359427
+vn 0.940561 -0.099962 0.324580
+vn 0.929127 -0.101256 0.355627
+vn 0.929127 -0.101256 0.355627
+vn 0.899138 -0.176078 0.400683
+vn 0.913187 -0.192097 0.359427
+vn 0.869719 -0.316637 -0.378590
+vn 0.857873 -0.327650 -0.395853
+vn 0.857499 -0.378126 -0.348878
+vn 0.857499 -0.378126 -0.348878
+vn 0.872671 -0.408797 -0.267077
+vn 0.869719 -0.316637 -0.378590
+vn 0.350254 -0.428292 -0.833000
+vn 0.354095 -0.522927 -0.775347
+vn 0.375903 -0.510268 -0.773514
+vn 0.375903 -0.510268 -0.773514
+vn 0.337207 -0.424872 -0.840104
+vn 0.350254 -0.428292 -0.833000
+vn 0.375903 -0.510268 -0.773514
+vn 0.354095 -0.522927 -0.775347
+vn 0.397857 -0.650766 -0.646694
+vn 0.397857 -0.650766 -0.646694
+vn 0.425020 -0.669655 -0.609032
+vn 0.375903 -0.510268 -0.773514
+vn 0.398048 0.010553 0.917304
+vn 0.343373 0.022160 0.938938
+vn 0.424747 -0.170979 0.889020
+vn 0.424747 -0.170979 0.889020
+vn 0.464512 -0.226171 0.856198
+vn 0.398048 0.010553 0.917304
+vn 0.381577 0.114576 0.917209
+vn 0.343373 0.022160 0.938938
+vn 0.398048 0.010553 0.917304
+vn 0.398048 0.010553 0.917304
+vn 0.416387 0.126561 0.900336
+vn 0.381577 0.114576 0.917209
+vn -0.848288 0.094287 0.521073
+vn -0.890803 0.265942 0.368435
+vn -0.967615 0.252362 -0.005935
+vn -0.982603 0.172140 -0.069707
+vn -0.892694 0.267635 -0.362586
+vn -0.883348 0.185477 -0.430459
+vn -0.942836 0.329239 0.051597
+vn -0.860329 0.411331 -0.301067
+vn -0.819954 0.431559 0.376075
+vn -0.538006 0.353935 0.765036
+vn -0.553029 0.498570 0.667523
+vn -0.609777 0.404103 0.681816
+vn -0.609777 0.404103 0.681816
+vn -0.679284 0.301085 0.669269
+vn -0.538006 0.353935 0.765036
+vn -0.565135 0.222296 0.794485
+vn -0.739072 0.203308 0.642214
+vn -0.700903 0.301029 -0.646619
+vn -0.675682 0.211421 -0.706226
+vn -0.716474 0.380035 -0.585011
+vn -0.585117 0.449199 -0.675173
+vn -0.580837 0.283248 -0.763150
+vn -0.589889 0.218297 -0.777417
+vn 0.112224 -0.208505 0.971561
+vn 0.185006 -0.441095 0.878184
+vn -0.562510 0.539646 0.626390
+vn 0.628880 -0.429097 0.648372
+vn 0.112224 -0.208505 0.971561
+vn 0.674021 -0.565733 0.475017
+vn 0.806355 -0.429611 0.406480
+vn 0.628880 -0.429097 0.648372
+vn 0.674021 -0.565733 0.475017
+vn 0.872359 -0.413032 0.261522
+vn 0.806355 -0.429611 0.406480
+vn 0.674021 -0.565733 0.475017
+vn 0.942934 -0.244816 0.225699
+vn 0.965993 -0.134612 0.220764
+vn 0.933511 -0.136716 0.331460
+vn 0.933511 -0.136716 0.331460
+vn 0.880464 -0.272086 0.388269
+vn 0.942934 -0.244816 0.225699
+vn 0.971682 -0.064883 0.227211
+vn 0.895317 -0.063191 0.440925
+vn 0.933511 -0.136716 0.331460
+vn 0.933511 -0.136716 0.331460
+vn 0.965993 -0.134612 0.220764
+vn 0.971682 -0.064883 0.227211
+vn 0.895317 -0.063191 0.440925
+vn 0.672865 -0.061227 0.737227
+vn 0.760964 -0.137604 0.634034
+vn 0.760964 -0.137604 0.634034
+vn 0.933511 -0.136716 0.331460
+vn 0.895317 -0.063191 0.440925
+vn 0.672865 -0.061227 0.737227
+vn 0.332532 -0.060624 0.941141
+vn 0.456776 -0.139105 0.878639
+vn 0.456776 -0.139105 0.878639
+vn 0.760964 -0.137604 0.634034
+vn 0.672865 -0.061227 0.737227
+vn 0.382728 -0.283149 0.879401
+vn 0.456776 -0.139105 0.878639
+vn 0.203521 -0.137467 0.969372
+vn 0.203521 -0.137467 0.969372
+vn 0.196533 -0.301522 0.932984
+vn 0.382728 -0.283149 0.879401
+vn 0.332532 -0.060624 0.941141
+vn 0.203196 -0.059330 0.977339
+vn 0.203521 -0.137467 0.969372
+vn 0.203521 -0.137467 0.969372
+vn 0.456776 -0.139105 0.878639
+vn 0.332532 -0.060624 0.941141
+vn 0.872359 -0.413032 0.261522
+vn 0.942934 -0.244816 0.225699
+vn 0.880464 -0.272086 0.388269
+vn 0.880464 -0.272086 0.388269
+vn 0.806355 -0.429611 0.406480
+vn 0.872359 -0.413032 0.261522
+vn 0.112224 -0.208505 0.971561
+vn 0.382728 -0.283149 0.879401
+vn 0.196533 -0.301522 0.932984
+vn 0.196533 -0.301522 0.932984
+vn 0.185006 -0.441095 0.878184
+vn 0.112224 -0.208505 0.971561
+vn -0.003722 0.977054 -0.212961
+vn -0.001301 0.977669 -0.210146
+vn -0.001846 0.978119 -0.208037
+vn -0.001846 0.978119 -0.208037
+vn -0.007444 0.976700 -0.214482
+vn -0.003722 0.977054 -0.212961
+vn -0.001846 0.978119 -0.208037
+vn -0.001301 0.977669 -0.210146
+vn 0.000030 0.979157 -0.203106
+vn 0.000030 0.979157 -0.203106
+vn 0.002663 0.980330 -0.197348
+vn -0.001846 0.978119 -0.208037
+vn -0.647413 0.395458 0.651513
+vn -0.188043 -0.409168 0.892872
+vn -0.500383 -0.186140 0.845558
+vn -0.647413 0.395458 0.651513
+vn -0.500383 -0.186140 0.845558
+vn -0.729775 -0.184172 0.658414
+vn -0.647413 0.395458 0.651513
+vn -0.729775 -0.184172 0.658414
+vn -0.866273 -0.187057 0.463228
+vn -0.647413 0.395458 0.651513
+vn -0.866273 -0.187057 0.463228
+vn -0.749475 0.338260 0.569093
+vn -0.672879 -0.061227 0.737214
+vn -0.717794 -0.138636 0.682314
+vn -0.395860 -0.139986 0.907578
+vn -0.395860 -0.139986 0.907578
+vn -0.332531 -0.060622 0.941142
+vn -0.672879 -0.061227 0.737214
+vn -0.332531 -0.060622 0.941142
+vn -0.395860 -0.139986 0.907578
+vn -0.203968 -0.111570 0.972599
+vn -0.203968 -0.111570 0.972599
+vn -0.203165 -0.059321 0.977346
+vn -0.332531 -0.060622 0.941142
+vn -0.924922 -0.284564 0.252076
+vn -0.749475 0.338260 0.569093
+vn -0.866273 -0.187057 0.463228
+vn -0.866273 -0.187057 0.463228
+vn -0.887014 -0.272466 0.372784
+vn -0.924922 -0.284564 0.252076
+vn -0.961462 -0.158112 0.224927
+vn -0.924922 -0.284564 0.252076
+vn -0.887014 -0.272466 0.372784
+vn -0.887014 -0.272466 0.372784
+vn -0.914247 -0.137638 0.381063
+vn -0.961462 -0.158112 0.224927
+vn -0.971681 -0.064882 0.227213
+vn -0.961462 -0.158112 0.224927
+vn -0.914247 -0.137638 0.381063
+vn -0.914247 -0.137638 0.381063
+vn -0.895314 -0.063189 0.440932
+vn -0.971681 -0.064882 0.227213
+vn -0.895314 -0.063189 0.440932
+vn -0.914247 -0.137638 0.381063
+vn -0.717794 -0.138636 0.682314
+vn -0.717794 -0.138636 0.682314
+vn -0.672879 -0.061227 0.737214
+vn -0.895314 -0.063189 0.440932
+vn -0.635871 -0.400458 0.659774
+vn -0.635883 -0.676686 0.371144
+vn -0.374465 -0.758591 0.533212
+vn -0.374465 -0.758591 0.533212
+vn -0.374364 -0.390356 0.841115
+vn -0.635871 -0.400458 0.659774
+vn -0.635883 -0.676686 0.371144
+vn -0.635871 -0.771610 -0.016909
+vn -0.374486 -0.923557 0.082477
+vn -0.374486 -0.923557 0.082477
+vn -0.374465 -0.758591 0.533212
+vn -0.635883 -0.676686 0.371144
+vn -0.635871 -0.771610 -0.016909
+vn -0.635865 -0.659788 -0.400445
+vn -0.374487 -0.841071 -0.390332
+vn -0.374487 -0.841071 -0.390332
+vn -0.374486 -0.923557 0.082477
+vn -0.635871 -0.771610 -0.016909
+vn -0.635865 -0.659788 -0.400445
+vn -0.635848 -0.371168 -0.676707
+vn -0.374406 -0.533232 -0.758606
+vn -0.374406 -0.533232 -0.758606
+vn -0.374487 -0.841071 -0.390332
+vn -0.635865 -0.659788 -0.400445
+vn -0.635848 -0.371168 -0.676707
+vn -0.635850 0.016919 -0.771627
+vn -0.374357 -0.082495 -0.923608
+vn -0.374357 -0.082495 -0.923608
+vn -0.374406 -0.533232 -0.758606
+vn -0.635848 -0.371168 -0.676707
+vn -0.635850 0.016919 -0.771627
+vn -0.635837 0.400454 -0.659808
+vn -0.374347 0.390370 -0.841116
+vn -0.374347 0.390370 -0.841116
+vn -0.374357 -0.082495 -0.923608
+vn -0.635850 0.016919 -0.771627
+vn -0.635837 0.400454 -0.659808
+vn -0.635834 0.676714 -0.371178
+vn -0.374325 0.758622 -0.533267
+vn -0.374325 0.758622 -0.533267
+vn -0.374347 0.390370 -0.841116
+vn -0.635837 0.400454 -0.659808
+vn -0.635834 0.676714 -0.371178
+vn -0.635828 0.771645 0.016912
+vn -0.374277 0.923640 -0.082491
+vn -0.374277 0.923640 -0.082491
+vn -0.374325 0.758622 -0.533267
+vn -0.635834 0.676714 -0.371178
+vn -0.635828 0.771645 0.016912
+vn -0.635850 0.659785 0.400473
+vn -0.374299 0.841143 0.390358
+vn -0.374299 0.841143 0.390358
+vn -0.374277 0.923640 -0.082491
+vn -0.635828 0.771645 0.016912
+vn -0.635850 0.659785 0.400473
+vn -0.711778 0.351190 0.608307
+vn -0.375614 0.463375 0.802619
+vn -0.375614 0.463375 0.802619
+vn -0.374299 0.841143 0.390358
+vn -0.635850 0.659785 0.400473
+vn -0.990580 -0.112030 -0.078748
+vn -0.990580 -0.124212 -0.057646
+vn -0.990580 -0.078748 -0.112029
+vn -0.990580 -0.078748 -0.112029
+vn -0.990580 -0.057648 -0.124209
+vn -0.990580 -0.112030 -0.078748
+vn -0.919306 -0.209306 0.333267
+vn -0.919301 -0.347909 0.183970
+vn -0.635883 -0.676686 0.371144
+vn -0.635883 -0.676686 0.371144
+vn -0.635871 -0.400458 0.659774
+vn -0.919306 -0.209306 0.333267
+vn -0.919301 -0.347909 0.183970
+vn -0.919298 -0.393289 -0.014653
+vn -0.635871 -0.771610 -0.016909
+vn -0.635871 -0.771610 -0.016909
+vn -0.635883 -0.676686 0.371144
+vn -0.919301 -0.347909 0.183970
+vn -0.919298 -0.393289 -0.014653
+vn -0.919307 -0.333264 -0.209309
+vn -0.635865 -0.659788 -0.400445
+vn -0.635865 -0.659788 -0.400445
+vn -0.635871 -0.771610 -0.016909
+vn -0.919298 -0.393289 -0.014653
+vn -0.919307 -0.333264 -0.209309
+vn -0.919310 -0.183937 -0.347902
+vn -0.635848 -0.371168 -0.676707
+vn -0.635848 -0.371168 -0.676707
+vn -0.635865 -0.659788 -0.400445
+vn -0.919307 -0.333264 -0.209309
+vn -0.919312 0.209302 -0.333254
+vn -0.919317 0.347877 -0.183952
+vn -0.635834 0.676714 -0.371178
+vn -0.635834 0.676714 -0.371178
+vn -0.635837 0.400454 -0.659808
+vn -0.919312 0.209302 -0.333254
+vn -0.919317 0.347877 -0.183952
+vn -0.919318 0.393243 0.014657
+vn -0.635828 0.771645 0.016912
+vn -0.635828 0.771645 0.016912
+vn -0.635834 0.676714 -0.371178
+vn -0.919317 0.347877 -0.183952
+vn -0.919318 0.393243 0.014657
+vn -0.919316 0.333254 0.209284
+vn -0.635850 0.659785 0.400473
+vn -0.635850 0.659785 0.400473
+vn -0.635828 0.771645 0.016912
+vn -0.919318 0.393243 0.014657
+vn -0.919316 0.333254 0.209284
+vn -0.941313 0.168761 0.292318
+vn -0.711778 0.351190 0.608307
+vn -0.711778 0.351190 0.608307
+vn -0.635850 0.659785 0.400473
+vn -0.919316 0.333254 0.209284
+vn -0.993545 -0.065225 0.092812
+vn -0.993546 -0.102889 0.047744
+vn -0.919301 -0.347909 0.183970
+vn -0.919301 -0.347909 0.183970
+vn -0.919306 -0.209306 0.333267
+vn -0.993545 -0.065225 0.092812
+vn -0.993546 -0.102889 0.047744
+vn -0.993545 -0.112987 -0.010091
+vn -0.919298 -0.393289 -0.014653
+vn -0.919298 -0.393289 -0.014653
+vn -0.919301 -0.347909 0.183970
+vn -0.993546 -0.102889 0.047744
+vn -0.993545 -0.112987 -0.010091
+vn -0.985454 -0.139028 -0.097729
+vn -0.919307 -0.333264 -0.209309
+vn -0.919307 -0.333264 -0.209309
+vn -0.919298 -0.393289 -0.014653
+vn -0.993545 -0.112987 -0.010091
+vn -0.985454 -0.139028 -0.097729
+vn -0.990693 -0.057297 -0.123470
+vn -0.919310 -0.183937 -0.347902
+vn -0.919310 -0.183937 -0.347902
+vn -0.919307 -0.333264 -0.209309
+vn -0.985454 -0.139028 -0.097729
+vn -0.990693 -0.057297 -0.123470
+vn -0.993545 0.010092 -0.112988
+vn -0.919313 0.014636 -0.393256
+vn -0.919313 0.014636 -0.393256
+vn -0.919310 -0.183937 -0.347902
+vn -0.990693 -0.057297 -0.123470
+vn -0.993545 0.010092 -0.112988
+vn -0.993544 0.065233 -0.092813
+vn -0.919312 0.209302 -0.333254
+vn -0.919312 0.209302 -0.333254
+vn -0.919313 0.014636 -0.393256
+vn -0.993545 0.010092 -0.112988
+vn -0.993544 0.065233 -0.092813
+vn -0.993546 0.102893 -0.047737
+vn -0.919317 0.347877 -0.183952
+vn -0.919317 0.347877 -0.183952
+vn -0.919312 0.209302 -0.333254
+vn -0.993544 0.065233 -0.092813
+vn -0.993546 0.102893 -0.047737
+vn -0.990692 0.135582 0.012110
+vn -0.919318 0.393243 0.014657
+vn -0.919318 0.393243 0.014657
+vn -0.919317 0.347877 -0.183952
+vn -0.993546 0.102893 -0.047737
+vn -0.990692 0.135582 0.012110
+vn -0.990694 0.111365 0.078253
+vn -0.919316 0.333254 0.209284
+vn -0.919316 0.333254 0.209284
+vn -0.919318 0.393243 0.014657
+vn -0.990692 0.135582 0.012110
+vn -0.990694 0.111365 0.078253
+vn -0.988595 0.075286 0.130428
+vn -0.941313 0.168761 0.292318
+vn -0.941313 0.168761 0.292318
+vn -0.919316 0.333254 0.209284
+vn -0.990694 0.111365 0.078253
+vn 0.919316 -0.183932 0.347890
+vn 0.919312 -0.333255 0.209302
+vn 0.993547 -0.092790 0.065223
+vn 0.993547 -0.092790 0.065223
+vn 0.993547 -0.047744 0.102887
+vn 0.919316 -0.183932 0.347890
+vn 0.919312 -0.333255 0.209302
+vn 0.919303 -0.393279 0.014649
+vn 0.990696 -0.135556 0.012105
+vn 0.990696 -0.135556 0.012105
+vn 0.993547 -0.092790 0.065223
+vn 0.919312 -0.333255 0.209302
+vn 0.919303 -0.393279 0.014649
+vn 0.919305 -0.347898 -0.183969
+vn 0.990697 -0.123441 -0.057286
+vn 0.990697 -0.123441 -0.057286
+vn 0.990696 -0.135556 0.012105
+vn 0.919303 -0.393279 0.014649
+vn 0.919305 -0.347898 -0.183969
+vn 0.919310 -0.209306 -0.333256
+vn 0.985455 -0.097713 -0.139034
+vn 0.985455 -0.097713 -0.139034
+vn 0.990697 -0.123441 -0.057286
+vn 0.919305 -0.347898 -0.183969
+vn 0.919310 -0.209306 -0.333256
+vn 0.919318 -0.014637 -0.393244
+vn 0.995265 -0.008647 -0.096813
+vn 0.995265 -0.008647 -0.096813
+vn 0.985455 -0.097713 -0.139034
+vn 0.919310 -0.209306 -0.333256
+vn 0.919318 -0.014637 -0.393244
+vn 0.919315 0.183940 -0.347888
+vn 0.993546 0.047747 -0.102891
+vn 0.993546 0.047747 -0.102891
+vn 0.995265 -0.008647 -0.096813
+vn 0.919318 -0.014637 -0.393244
+vn 0.919315 0.183940 -0.347888
+vn 0.919320 0.333243 -0.209282
+vn 0.993547 0.092802 -0.065213
+vn 0.993547 0.092802 -0.065213
+vn 0.993546 0.047747 -0.102891
+vn 0.919315 0.183940 -0.347888
+vn 0.919320 0.333243 -0.209282
+vn 0.919323 0.393231 -0.014663
+vn 0.993545 0.112985 -0.010093
+vn 0.993545 0.112985 -0.010093
+vn 0.993547 0.092802 -0.065213
+vn 0.919320 0.333243 -0.209282
+vn 0.919323 0.393231 -0.014663
+vn 0.919322 0.347869 0.183940
+vn 0.985459 0.154136 0.071505
+vn 0.985459 0.154136 0.071505
+vn 0.993545 0.112985 -0.010093
+vn 0.919323 0.393231 -0.014663
+vn 0.919322 0.347869 0.183940
+vn 0.894128 0.223900 0.387819
+vn 0.988597 0.075286 0.130412
+vn 0.988597 0.075286 0.130412
+vn 0.985459 0.154136 0.071505
+vn 0.919322 0.347869 0.183940
+vn 0.635844 -0.371168 0.676710
+vn 0.635864 -0.659790 0.400442
+vn 0.919312 -0.333255 0.209302
+vn 0.919312 -0.333255 0.209302
+vn 0.919316 -0.183932 0.347890
+vn 0.635844 -0.371168 0.676710
+vn 0.635864 -0.659790 0.400442
+vn 0.635870 -0.771611 0.016903
+vn 0.919303 -0.393279 0.014649
+vn 0.919303 -0.393279 0.014649
+vn 0.919312 -0.333255 0.209302
+vn 0.635864 -0.659790 0.400442
+vn 0.635870 -0.771611 0.016903
+vn 0.635882 -0.676686 -0.371149
+vn 0.919305 -0.347898 -0.183969
+vn 0.919305 -0.347898 -0.183969
+vn 0.919303 -0.393279 0.014649
+vn 0.635870 -0.771611 0.016903
+vn 0.635882 -0.676686 -0.371149
+vn 0.635869 -0.400458 -0.659776
+vn 0.919310 -0.209306 -0.333256
+vn 0.919310 -0.209306 -0.333256
+vn 0.919305 -0.347898 -0.183969
+vn 0.635882 -0.676686 -0.371149
+vn 0.635844 0.371156 -0.676717
+vn 0.635848 0.659784 -0.400478
+vn 0.919320 0.333243 -0.209282
+vn 0.919320 0.333243 -0.209282
+vn 0.919315 0.183940 -0.347888
+vn 0.635844 0.371156 -0.676717
+vn 0.635848 0.659784 -0.400478
+vn 0.635827 0.771646 -0.016918
+vn 0.919323 0.393231 -0.014663
+vn 0.919323 0.393231 -0.014663
+vn 0.919320 0.333243 -0.209282
+vn 0.635848 0.659784 -0.400478
+vn 0.635827 0.771646 -0.016918
+vn 0.635833 0.676717 0.371175
+vn 0.919322 0.347869 0.183940
+vn 0.919322 0.347869 0.183940
+vn 0.919323 0.393231 -0.014663
+vn 0.635827 0.771646 -0.016918
+vn 0.635833 0.676717 0.371175
+vn 0.552770 0.416654 0.721696
+vn 0.894128 0.223900 0.387819
+vn 0.894128 0.223900 0.387819
+vn 0.919322 0.347869 0.183940
+vn 0.635833 0.676717 0.371175
+vn 0.374405 -0.533230 0.758609
+vn 0.374487 -0.841073 0.390328
+vn 0.635864 -0.659790 0.400442
+vn 0.635864 -0.659790 0.400442
+vn 0.635844 -0.371168 0.676710
+vn 0.374405 -0.533230 0.758609
+vn 0.374487 -0.841073 0.390328
+vn 0.374483 -0.923558 -0.082484
+vn 0.635870 -0.771611 0.016903
+vn 0.635870 -0.771611 0.016903
+vn 0.635864 -0.659790 0.400442
+vn 0.374487 -0.841073 0.390328
+vn 0.374483 -0.923558 -0.082484
+vn 0.374460 -0.758591 -0.533216
+vn 0.635882 -0.676686 -0.371149
+vn 0.635882 -0.676686 -0.371149
+vn 0.635870 -0.771611 0.016903
+vn 0.374483 -0.923558 -0.082484
+vn 0.374460 -0.758591 -0.533216
+vn 0.374368 -0.390360 -0.841111
+vn 0.635869 -0.400458 -0.659776
+vn 0.635869 -0.400458 -0.659776
+vn 0.635882 -0.676686 -0.371149
+vn 0.374460 -0.758591 -0.533216
+vn 0.374368 -0.390360 -0.841111
+vn 0.374349 0.082504 -0.923610
+vn 0.635851 -0.016917 -0.771626
+vn 0.635851 -0.016917 -0.771626
+vn 0.635869 -0.400458 -0.659776
+vn 0.374368 -0.390360 -0.841111
+vn 0.374349 0.082504 -0.923610
+vn 0.374330 0.533233 -0.758643
+vn 0.635844 0.371156 -0.676717
+vn 0.635844 0.371156 -0.676717
+vn 0.635851 -0.016917 -0.771626
+vn 0.374349 0.082504 -0.923610
+vn 0.374330 0.533233 -0.758643
+vn 0.374294 0.841143 -0.390363
+vn 0.635848 0.659784 -0.400478
+vn 0.635848 0.659784 -0.400478
+vn 0.635844 0.371156 -0.676717
+vn 0.374330 0.533233 -0.758643
+vn 0.374294 0.841143 -0.390363
+vn 0.374275 0.923642 0.082485
+vn 0.635827 0.771646 -0.016918
+vn 0.635827 0.771646 -0.016918
+vn 0.635848 0.659784 -0.400478
+vn 0.374294 0.841143 -0.390363
+vn 0.374275 0.923642 0.082485
+vn 0.374324 0.758624 0.533265
+vn 0.635833 0.676717 0.371175
+vn 0.635833 0.676717 0.371175
+vn 0.635827 0.771646 -0.016918
+vn 0.374275 0.923642 0.082485
+vn 0.374324 0.758624 0.533265
+vn 0.375622 0.463380 0.802613
+vn 0.552770 0.416654 0.721696
+vn 0.552770 0.416654 0.721696
+vn 0.635833 0.676717 0.371175
+vn 0.374324 0.758624 0.533265
+vn 0.990579 -0.112031 -0.078748
+vn 0.990580 -0.057648 -0.124210
+vn 0.990580 -0.078748 -0.112030
+vn 0.990580 -0.078748 -0.112030
+vn 0.990580 -0.124213 -0.057647
+vn 0.990579 -0.112031 -0.078748
+vn -0.571184 -0.671513 -0.472038
+vn -0.571023 -0.345609 -0.744639
+vn -0.571083 -0.472062 -0.671582
+vn -0.571083 -0.472062 -0.671582
+vn -0.571257 -0.744501 -0.345521
+vn -0.571184 -0.671513 -0.472038
+vn -0.571023 -0.345609 -0.744639
+vn -0.559283 -0.214554 -0.800730
+vn -0.559259 -0.214561 -0.800745
+vn -0.559259 -0.214561 -0.800745
+vn -0.571083 -0.472062 -0.671582
+vn -0.571023 -0.345609 -0.744639
+vn -0.571889 0.704307 0.420587
+vn -0.571901 0.399645 0.716389
+vn -0.354603 0.537690 0.764948
+vn -0.354603 0.537690 0.764948
+vn -0.354567 0.848143 0.393619
+vn -0.571889 0.704307 0.420587
+vn 0.354575 0.764955 0.537699
+vn 0.354618 0.393618 0.848122
+vn 0.571894 0.420587 0.704303
+vn 0.571894 0.420587 0.704303
+vn 0.571883 0.716398 0.399655
+vn 0.354575 0.764955 0.537699
+vn 0.571196 -0.671510 -0.472026
+vn 0.571028 -0.345595 -0.744642
+vn 0.571095 -0.472055 -0.671576
+vn 0.571095 -0.472055 -0.671576
+vn 0.571262 -0.744503 -0.345507
+vn 0.571196 -0.671510 -0.472026
+vn 0.571028 -0.345595 -0.744642
+vn 0.559283 -0.214559 -0.800729
+vn 0.559263 -0.214560 -0.800743
+vn 0.559263 -0.214560 -0.800743
+vn 0.571095 -0.472055 -0.671576
+vn 0.571028 -0.345595 -0.744642
+vn -0.571212 -0.817550 -0.073004
+vn -0.571184 -0.671513 -0.472038
+vn -0.571257 -0.744501 -0.345521
+vn -0.571257 -0.744501 -0.345521
+vn -0.571212 -0.817549 0.073014
+vn -0.571212 -0.817550 -0.073004
+vn -0.571892 0.820240 0.012091
+vn -0.571889 0.704307 0.420587
+vn -0.354567 0.848143 0.393619
+vn -0.354567 0.848143 0.393619
+vn -0.354588 0.931316 -0.083179
+vn -0.571892 0.820240 0.012091
+vn 0.354585 0.931317 0.083178
+vn 0.354575 0.764955 0.537699
+vn 0.571883 0.716398 0.399655
+vn 0.571883 0.716398 0.399655
+vn 0.571893 0.820239 -0.012092
+vn 0.354585 0.931317 0.083178
+vn 0.571217 -0.817545 -0.073013
+vn 0.571196 -0.671510 -0.472026
+vn 0.571262 -0.744503 -0.345507
+vn 0.571262 -0.744503 -0.345507
+vn 0.571223 -0.817542 0.073006
+vn 0.571217 -0.817545 -0.073013
+vn -0.559414 0.586112 0.586112
+vn -0.571174 0.345531 0.744560
+vn -0.571210 0.472008 0.671511
+vn -0.571210 0.472008 0.671511
+vn -0.559326 0.586162 0.586147
+vn -0.559414 0.586112 0.586112
+vn -0.571174 0.345531 0.744560
+vn -0.571037 -0.073026 0.817670
+vn -0.571082 0.073024 0.817639
+vn -0.571082 0.073024 0.817639
+vn -0.571210 0.472008 0.671511
+vn -0.571174 0.345531 0.744560
+vn 0.559407 0.586116 0.586116
+vn 0.571175 0.345537 0.744555
+vn 0.571205 0.472016 0.671510
+vn 0.571205 0.472016 0.671510
+vn 0.559315 0.586152 0.586167
+vn 0.559407 0.586116 0.586116
+vn 0.571175 0.345537 0.744555
+vn 0.571039 -0.073031 0.817668
+vn 0.571083 0.073023 0.817638
+vn 0.571083 0.073023 0.817638
+vn 0.571205 0.472016 0.671510
+vn 0.571175 0.345537 0.744555
+vn 0.571039 -0.073031 0.817668
+vn 0.571106 -0.472049 0.671572
+vn 0.571015 -0.345605 0.744647
+vn 0.571015 -0.345605 0.744647
+vn 0.571083 0.073023 0.817638
+vn 0.571039 -0.073031 0.817668
+vn 0.571106 -0.472049 0.671572
+vn 0.571275 -0.744488 0.345517
+vn 0.571206 -0.671499 0.472031
+vn 0.571206 -0.671499 0.472031
+vn 0.571015 -0.345605 0.744647
+vn 0.571106 -0.472049 0.671572
+vn 0.571275 -0.744488 0.345517
+vn 0.571217 -0.817545 -0.073013
+vn 0.571223 -0.817542 0.073006
+vn 0.571223 -0.817542 0.073006
+vn 0.571206 -0.671499 0.472031
+vn 0.571275 -0.744488 0.345517
+vn 0.354639 0.537681 -0.764938
+vn 0.354578 0.848139 -0.393618
+vn 0.571898 0.704302 -0.420585
+vn 0.571898 0.704302 -0.420585
+vn 0.571909 0.399643 -0.716384
+vn 0.354639 0.537681 -0.764938
+vn 0.354578 0.848139 -0.393618
+vn 0.354585 0.931317 0.083178
+vn 0.571893 0.820239 -0.012092
+vn 0.571893 0.820239 -0.012092
+vn 0.571898 0.704302 -0.420585
+vn 0.354578 0.848139 -0.393618
+vn -0.571906 0.420583 -0.704297
+vn -0.571884 0.716396 -0.399656
+vn -0.354598 0.764948 -0.537695
+vn -0.354598 0.764948 -0.537695
+vn -0.354649 0.393613 -0.848112
+vn -0.571906 0.420583 -0.704297
+vn -0.571884 0.716396 -0.399656
+vn -0.571892 0.820240 0.012091
+vn -0.354588 0.931316 -0.083179
+vn -0.354588 0.931316 -0.083179
+vn -0.354598 0.764948 -0.537695
+vn -0.571884 0.716396 -0.399656
+vn -0.571037 -0.073026 0.817670
+vn -0.571100 -0.472052 0.671574
+vn -0.571009 -0.345595 0.744656
+vn -0.571009 -0.345595 0.744656
+vn -0.571082 0.073024 0.817639
+vn -0.571037 -0.073026 0.817670
+vn -0.571100 -0.472052 0.671574
+vn -0.571264 -0.744501 0.345507
+vn -0.571201 -0.671507 0.472026
+vn -0.571201 -0.671507 0.472026
+vn -0.571009 -0.345595 0.744656
+vn -0.571100 -0.472052 0.671574
+vn -0.571264 -0.744501 0.345507
+vn -0.571212 -0.817550 -0.073004
+vn -0.571212 -0.817549 0.073014
+vn -0.571212 -0.817549 0.073014
+vn -0.571201 -0.671507 0.472026
+vn -0.571264 -0.744501 0.345507
+vn 0.847543 -0.250540 0.467868
+vn 0.847549 -0.450909 0.279894
+vn 0.985852 -0.137134 0.096386
+vn 0.985852 -0.137134 0.096386
+vn 0.985851 -0.070557 0.152049
+vn 0.847543 -0.250540 0.467868
+vn 0.847549 -0.450909 0.279894
+vn 0.847551 -0.530442 0.016963
+vn 0.979568 -0.200315 0.017889
+vn 0.979568 -0.200315 0.017889
+vn 0.985852 -0.137134 0.096386
+vn 0.847549 -0.450909 0.279894
+vn 0.847551 -0.530442 0.016963
+vn 0.847553 -0.467850 -0.250542
+vn 0.979572 -0.182413 -0.084647
+vn 0.979572 -0.182413 -0.084647
+vn 0.979568 -0.200315 0.017889
+vn 0.847551 -0.530442 0.016963
+vn 0.847553 -0.467850 -0.250542
+vn 0.847547 -0.279896 -0.450913
+vn 0.968051 -0.144189 -0.205151
+vn 0.968051 -0.144189 -0.205151
+vn 0.979572 -0.182413 -0.084647
+vn 0.847553 -0.467850 -0.250542
+vn 0.847545 0.250523 -0.467873
+vn 0.847557 0.450889 -0.279903
+vn 0.985853 0.137127 -0.096386
+vn 0.985853 0.137127 -0.096386
+vn 0.985851 0.070557 -0.152049
+vn 0.847545 0.250523 -0.467873
+vn 0.847557 0.450889 -0.279903
+vn 0.847558 0.530431 -0.016966
+vn 0.985852 0.166953 -0.014911
+vn 0.985852 0.166953 -0.014911
+vn 0.985853 0.137127 -0.096386
+vn 0.847557 0.450889 -0.279903
+vn 0.847558 0.530431 -0.016966
+vn 0.847559 0.467833 0.250552
+vn 0.968059 0.227428 0.105538
+vn 0.968059 0.227428 0.105538
+vn 0.985852 0.166953 -0.014911
+vn 0.847558 0.530431 -0.016966
+vn 0.847559 0.467833 0.250552
+vn 0.804826 0.296732 0.514010
+vn 0.974949 0.111202 0.192636
+vn 0.974949 0.111202 0.192636
+vn 0.968059 0.227428 0.105538
+vn 0.847559 0.467833 0.250552
+vn 0.501504 -0.422652 0.754890
+vn 0.501512 -0.743471 0.442420
+vn 0.847549 -0.450909 0.279894
+vn 0.847549 -0.450909 0.279894
+vn 0.847543 -0.250540 0.467868
+vn 0.501504 -0.422652 0.754890
+vn 0.501512 -0.743471 0.442420
+vn 0.501494 -0.865086 0.011397
+vn 0.847551 -0.530442 0.016963
+vn 0.847551 -0.530442 0.016963
+vn 0.847549 -0.450909 0.279894
+vn 0.501512 -0.743471 0.442420
+vn 0.501494 -0.865086 0.011397
+vn 0.501496 -0.754883 -0.422675
+vn 0.847553 -0.467850 -0.250542
+vn 0.847553 -0.467850 -0.250542
+vn 0.847551 -0.530442 0.016963
+vn 0.501494 -0.865086 0.011397
+vn 0.501496 -0.754883 -0.422675
+vn 0.501497 -0.442395 -0.743496
+vn 0.847547 -0.279896 -0.450913
+vn 0.847547 -0.279896 -0.450913
+vn 0.847553 -0.467850 -0.250542
+vn 0.501496 -0.754883 -0.422675
+vn 0.501503 -0.011401 -0.865081
+vn 0.501508 0.422630 -0.754900
+vn 0.847545 0.250523 -0.467873
+vn 0.847545 0.250523 -0.467873
+vn 0.847546 -0.016951 -0.530451
+vn 0.501503 -0.011401 -0.865081
+vn 0.501508 0.422630 -0.754900
+vn 0.501517 0.743464 -0.442428
+vn 0.847557 0.450889 -0.279903
+vn 0.847557 0.450889 -0.279903
+vn 0.847545 0.250523 -0.467873
+vn 0.501508 0.422630 -0.754900
+vn 0.501517 0.743464 -0.442428
+vn 0.501493 0.865086 -0.011399
+vn 0.847558 0.530431 -0.016966
+vn 0.847558 0.530431 -0.016966
+vn 0.847557 0.450889 -0.279903
+vn 0.501517 0.743464 -0.442428
+vn 0.501493 0.865086 -0.011399
+vn 0.501498 0.754868 0.422698
+vn 0.847559 0.467833 0.250552
+vn 0.847559 0.467833 0.250552
+vn 0.847558 0.530431 -0.016966
+vn 0.501493 0.865086 -0.011399
+vn 0.501498 0.754868 0.422698
+vn 0.422312 0.453196 0.785026
+vn 0.804826 0.296732 0.514010
+vn 0.804826 0.296732 0.514010
+vn 0.847559 0.467833 0.250552
+vn 0.501498 0.754868 0.422698
+vn 0.258423 -0.000004 0.966032
+vn 0.576377 -0.000000 0.817184
+vn 0.422312 0.453196 0.785026
+vn 0.422312 0.453196 0.785026
+vn 0.258457 0.482996 0.836609
+vn 0.258423 -0.000004 0.966032
+vn 0.258423 -0.000004 0.966032
+vn 0.257464 -0.555652 0.790546
+vn 0.501504 -0.422652 0.754890
+vn 0.501504 -0.422652 0.754890
+vn 0.576377 -0.000000 0.817184
+vn 0.258423 -0.000004 0.966032
+vn 0.257464 -0.555652 0.790546
+vn 0.257428 -0.876509 0.406771
+vn 0.501512 -0.743471 0.442420
+vn 0.501512 -0.743471 0.442420
+vn 0.501504 -0.422652 0.754890
+vn 0.257464 -0.555652 0.790546
+vn 0.257428 -0.876509 0.406771
+vn 0.257412 -0.962471 -0.085958
+vn 0.501494 -0.865086 0.011397
+vn 0.501494 -0.865086 0.011397
+vn 0.501512 -0.743471 0.442420
+vn 0.257428 -0.876509 0.406771
+vn 0.257412 -0.962471 -0.085958
+vn 0.257447 -0.790528 -0.555686
+vn 0.501496 -0.754883 -0.422675
+vn 0.501496 -0.754883 -0.422675
+vn 0.501494 -0.865086 0.011397
+vn 0.257412 -0.962471 -0.085958
+vn 0.257447 -0.790528 -0.555686
+vn 0.257461 -0.406778 -0.876496
+vn 0.501497 -0.442395 -0.743496
+vn 0.501497 -0.442395 -0.743496
+vn 0.501496 -0.754883 -0.422675
+vn 0.257447 -0.790528 -0.555686
+vn 0.257471 0.555638 -0.790554
+vn 0.257427 0.876509 -0.406772
+vn 0.501517 0.743464 -0.442428
+vn 0.501517 0.743464 -0.442428
+vn 0.501508 0.422630 -0.754900
+vn 0.257471 0.555638 -0.790554
+vn 0.257427 0.876509 -0.406772
+vn 0.257413 0.962471 0.085956
+vn 0.501493 0.865086 -0.011399
+vn 0.501493 0.865086 -0.011399
+vn 0.501517 0.743464 -0.442428
+vn 0.257427 0.876509 -0.406772
+vn 0.257413 0.962471 0.085956
+vn 0.257465 0.790515 0.555696
+vn 0.501498 0.754868 0.422698
+vn 0.501498 0.754868 0.422698
+vn 0.501493 0.865086 -0.011399
+vn 0.257413 0.962471 0.085956
+vn 0.257465 0.790515 0.555696
+vn 0.258457 0.482996 0.836609
+vn 0.422312 0.453196 0.785026
+vn 0.422312 0.453196 0.785026
+vn 0.501498 0.754868 0.422698
+vn 0.257465 0.790515 0.555696
+vn 0.944532 0.188860 -0.268683
+vn 0.944532 0.297903 -0.138251
+vn 0.944532 0.268685 -0.188857
+vn 0.944532 0.268685 -0.188857
+vn 0.944533 0.138254 -0.297899
+vn 0.944532 0.188860 -0.268683
+vn 0.944532 0.297903 -0.138251
+vn 0.944533 0.327115 0.029212
+vn 0.944532 0.327118 -0.029218
+vn 0.944532 0.327118 -0.029218
+vn 0.944532 0.268685 -0.188857
+vn 0.944532 0.297903 -0.138251
+vn 0.944533 0.327115 0.029212
+vn 0.944532 0.268683 0.188863
+vn 0.944533 0.297899 0.138254
+vn 0.944533 0.297899 0.138254
+vn 0.944532 0.327118 -0.029218
+vn 0.944533 0.327115 0.029212
+vn 0.944532 0.268683 0.188863
+vn 0.944533 0.138256 0.297897
+vn 0.944532 0.188861 0.268682
+vn 0.944532 0.188861 0.268682
+vn 0.944533 0.297899 0.138254
+vn 0.944532 0.268683 0.188863
+vn 0.944532 -0.188858 0.268685
+vn 0.944532 -0.297902 0.138252
+vn 0.944532 -0.268685 0.188858
+vn 0.944532 -0.268685 0.188858
+vn 0.944532 -0.138252 0.297901
+vn 0.944532 -0.188858 0.268685
+vn 0.944532 -0.297902 0.138252
+vn 0.944533 -0.327115 -0.029211
+vn 0.944532 -0.327117 0.029219
+vn 0.944532 -0.327117 0.029219
+vn 0.944532 -0.268685 0.188858
+vn 0.944532 -0.297902 0.138252
+vn 0.944533 -0.327115 -0.029211
+vn 0.944532 -0.268682 -0.188865
+vn 0.944533 -0.297898 -0.138253
+vn 0.944533 -0.297898 -0.138253
+vn 0.944532 -0.327117 0.029219
+vn 0.944533 -0.327115 -0.029211
+vn 0.944532 -0.268682 -0.188865
+vn 0.944935 -0.163628 -0.283414
+vn 0.944935 -0.163626 -0.283414
+vn 0.944935 -0.163626 -0.283414
+vn 0.944533 -0.297898 -0.138253
+vn 0.944532 -0.268682 -0.188865
+vn 0.313734 0.546024 -0.776807
+vn 0.313758 0.861268 -0.399717
+vn 0.313753 0.776795 -0.546030
+vn 0.313753 0.776795 -0.546030
+vn 0.313721 0.399726 -0.861277
+vn 0.313734 0.546024 -0.776807
+vn 0.313758 0.861268 -0.399717
+vn 0.313744 0.945743 0.084471
+vn 0.313744 0.945744 -0.084461
+vn 0.313744 0.945744 -0.084461
+vn 0.313753 0.776795 -0.546030
+vn 0.313758 0.861268 -0.399717
+vn 0.313744 0.945743 0.084471
+vn 0.314906 0.821964 0.474562
+vn 0.314873 0.821974 0.474566
+vn 0.314873 0.821974 0.474566
+vn 0.313744 0.945744 -0.084461
+vn 0.313744 0.945743 0.084471
+vn 0.314856 0.474563 0.821983
+vn 0.314837 0.474574 0.821984
+vn 0.314873 0.821974 0.474566
+vn 0.314873 0.821974 0.474566
+vn 0.314906 0.821964 0.474562
+vn 0.314856 0.474563 0.821983
+vn 0.313743 -0.546015 0.776810
+vn 0.313763 -0.861266 0.399716
+vn 0.313764 -0.776790 0.546031
+vn 0.313764 -0.776790 0.546031
+vn 0.313727 -0.399713 0.861281
+vn 0.313743 -0.546015 0.776810
+vn 0.313763 -0.861266 0.399716
+vn 0.313742 -0.945743 -0.084472
+vn 0.313745 -0.945743 0.084461
+vn 0.313745 -0.945743 0.084461
+vn 0.313764 -0.776790 0.546031
+vn 0.313763 -0.861266 0.399716
+vn 0.313742 -0.945743 -0.084472
+vn 0.313762 -0.776796 -0.546024
+vn 0.313756 -0.861270 -0.399713
+vn 0.313756 -0.861270 -0.399713
+vn 0.313745 -0.945743 0.084461
+vn 0.313742 -0.945743 -0.084472
+vn 0.313762 -0.776796 -0.546024
+vn 0.313732 -0.399715 -0.861278
+vn 0.313745 -0.546018 -0.776807
+vn 0.313745 -0.546018 -0.776807
+vn 0.313756 -0.861270 -0.399713
+vn 0.313762 -0.776796 -0.546024
+vn -0.985850 -0.166966 -0.014912
+vn -0.968054 -0.205143 -0.144183
+vn -0.847548 -0.450912 -0.279894
+vn -0.847548 -0.450912 -0.279894
+vn -0.847552 -0.530442 -0.016965
+vn -0.985850 -0.166966 -0.014912
+vn -0.968054 -0.205143 -0.144183
+vn -0.979570 -0.084649 -0.182418
+vn -0.847543 -0.250540 -0.467868
+vn -0.847543 -0.250540 -0.467868
+vn -0.847548 -0.450912 -0.279894
+vn -0.968054 -0.205143 -0.144183
+vn -0.847552 -0.530442 -0.016965
+vn -0.847548 -0.450912 -0.279894
+vn -0.501512 -0.743470 -0.442422
+vn -0.501512 -0.743470 -0.442422
+vn -0.501493 -0.865086 -0.011399
+vn -0.847552 -0.530442 -0.016965
+vn -0.847548 -0.450912 -0.279894
+vn -0.847543 -0.250540 -0.467868
+vn -0.501502 -0.422655 -0.754890
+vn -0.501502 -0.422655 -0.754890
+vn -0.501512 -0.743470 -0.442422
+vn -0.847548 -0.450912 -0.279894
+vn -0.501493 -0.865086 -0.011399
+vn -0.501512 -0.743470 -0.442422
+vn -0.257426 -0.876509 -0.406772
+vn -0.257426 -0.876509 -0.406772
+vn -0.257412 -0.962471 0.085956
+vn -0.501493 -0.865086 -0.011399
+vn -0.501512 -0.743470 -0.442422
+vn -0.501502 -0.422655 -0.754890
+vn -0.257463 -0.555652 -0.790547
+vn -0.257463 -0.555652 -0.790547
+vn -0.257426 -0.876509 -0.406772
+vn -0.501512 -0.743470 -0.442422
+vn -0.944532 0.327117 0.029219
+vn -0.944533 0.268685 0.188856
+vn -0.944532 0.297903 0.138251
+vn -0.944532 0.297903 0.138251
+vn -0.944533 0.327115 -0.029211
+vn -0.944532 0.327117 0.029219
+vn -0.944533 0.268685 0.188856
+vn -0.944533 0.138252 0.297900
+vn -0.944533 0.188858 0.268682
+vn -0.944533 0.188858 0.268682
+vn -0.944532 0.297903 0.138251
+vn -0.944533 0.268685 0.188856
+vn -0.313748 0.945742 0.084462
+vn -0.313758 0.776794 0.546029
+vn -0.313765 0.861266 0.399716
+vn -0.313765 0.861266 0.399716
+vn -0.313744 0.945743 -0.084472
+vn -0.313748 0.945742 0.084462
+vn -0.313758 0.776794 0.546029
+vn -0.313719 0.399720 0.861280
+vn -0.313734 0.546022 0.776808
+vn -0.313734 0.546022 0.776808
+vn -0.313765 0.861266 0.399716
+vn -0.313758 0.776794 0.546029
+vn -0.253207 -0.967409 -0.002630
+vn -0.253209 -0.836488 -0.485977
+vn 0.000004 -0.866027 -0.499998
+vn 0.000004 -0.866027 -0.499998
+vn -0.000001 -1.000000 -0.000000
+vn -0.253207 -0.967409 -0.002630
+vn -0.253209 -0.836488 -0.485977
+vn -0.253215 -0.481421 -0.839116
+vn 0.000005 -0.499997 -0.866027
+vn 0.000005 -0.499997 -0.866027
+vn 0.000004 -0.866027 -0.499998
+vn -0.253209 -0.836488 -0.485977
+vn -0.000001 -1.000000 -0.000000
+vn 0.000004 -0.866027 -0.499998
+vn 0.253202 -0.839114 -0.481431
+vn 0.253202 -0.839114 -0.481431
+vn 0.253208 -0.967408 0.002630
+vn -0.000001 -1.000000 -0.000000
+vn 0.000004 -0.866027 -0.499998
+vn 0.000005 -0.499997 -0.866027
+vn 0.253205 -0.485976 -0.836490
+vn 0.253205 -0.485976 -0.836490
+vn 0.253202 -0.839114 -0.481431
+vn 0.000004 -0.866027 -0.499998
+vn 0.609521 0.455887 -0.648576
+vn 0.494350 0.365937 -0.788485
+vn 0.514692 0.661554 -0.545378
+vn 0.514692 0.661554 -0.545378
+vn 0.609508 0.719109 -0.333741
+vn 0.609521 0.455887 -0.648576
+vn 0.609508 0.719109 -0.333741
+vn 0.514692 0.661554 -0.545378
+vn 0.609513 0.789633 -0.070522
+vn 0.609513 0.789633 -0.070522
+vn 0.609512 0.789633 0.070528
+vn 0.609508 0.719109 -0.333741
+vn 0.609512 0.789633 0.070528
+vn 0.609513 0.789633 -0.070522
+vn 0.609509 0.719112 0.333732
+vn 0.609509 0.719112 0.333732
+vn 0.609514 0.648580 0.455891
+vn 0.609512 0.789633 0.070528
+vn 0.609514 0.648580 0.455891
+vn 0.609509 0.719112 0.333732
+vn 0.609522 0.455887 0.648575
+vn 0.609522 0.455887 0.648575
+vn 0.609529 0.333728 0.719097
+vn 0.609514 0.648580 0.455891
+vn 0.042838 -0.706456 0.706460
+vn -0.000001 -0.866026 0.499999
+vn 0.253206 -0.836489 0.485977
+vn 0.253206 -0.836489 0.485977
+vn 0.309938 -0.582026 0.751787
+vn 0.042838 -0.706456 0.706460
+vn -0.000001 -0.866026 0.499999
+vn -0.000001 -1.000000 -0.000000
+vn 0.253208 -0.967408 0.002630
+vn 0.253208 -0.967408 0.002630
+vn 0.253206 -0.836489 0.485977
+vn -0.000001 -0.866026 0.499999
+vn -0.276655 -0.528532 0.802568
+vn -0.253204 -0.839114 0.481430
+vn -0.000001 -0.866026 0.499999
+vn -0.000001 -0.866026 0.499999
+vn 0.042838 -0.706456 0.706460
+vn -0.276655 -0.528532 0.802568
+vn -0.253204 -0.839114 0.481430
+vn -0.253207 -0.967409 -0.002630
+vn -0.000001 -1.000000 -0.000000
+vn -0.000001 -1.000000 -0.000000
+vn -0.000001 -0.866026 0.499999
+vn -0.253204 -0.839114 0.481430
+vn -0.609523 0.455886 -0.648575
+vn -0.609510 0.719107 -0.333740
+vn -0.551475 0.657999 -0.512750
+vn -0.551475 0.657999 -0.512750
+vn -0.495833 0.439294 -0.749114
+vn -0.609523 0.455886 -0.648575
+vn -0.609510 0.719107 -0.333740
+vn -0.609515 0.789631 0.070528
+vn -0.609516 0.789631 -0.070522
+vn -0.609516 0.789631 -0.070522
+vn -0.551475 0.657999 -0.512750
+vn -0.609510 0.719107 -0.333740
+vn -0.609515 0.789631 0.070528
+vn -0.609516 0.648578 0.455890
+vn -0.609511 0.719110 0.333732
+vn -0.609511 0.719110 0.333732
+vn -0.609516 0.789631 -0.070522
+vn -0.609515 0.789631 0.070528
+vn -0.609516 0.648578 0.455890
+vn -0.611054 0.395787 0.685541
+vn -0.611048 0.395794 0.685542
+vn -0.611048 0.395794 0.685542
+vn -0.609511 0.719110 0.333732
+vn -0.609516 0.648578 0.455890
+vn -0.313737 0.546023 -0.776806
+vn -0.313758 0.861272 -0.399709
+vn -0.313756 0.776799 -0.546022
+vn -0.313756 0.776799 -0.546022
+vn -0.313723 0.399718 -0.861280
+vn -0.313737 0.546023 -0.776806
+vn -0.313758 0.861272 -0.399709
+vn -0.313748 0.945742 0.084462
+vn -0.313744 0.945743 -0.084472
+vn -0.313744 0.945743 -0.084472
+vn -0.313756 0.776799 -0.546022
+vn -0.313758 0.861272 -0.399709
+vn -0.313746 -0.546014 0.776809
+vn -0.313763 -0.861270 0.399709
+vn -0.313767 -0.776795 0.546021
+vn -0.313767 -0.776795 0.546021
+vn -0.313729 -0.399706 0.861283
+vn -0.313746 -0.546014 0.776809
+vn -0.313763 -0.861270 0.399709
+vn -0.313746 -0.945743 -0.084461
+vn -0.313745 -0.945742 0.084471
+vn -0.313745 -0.945742 0.084471
+vn -0.313767 -0.776795 0.546021
+vn -0.313763 -0.861270 0.399709
+vn -0.313746 -0.945743 -0.084461
+vn -0.313763 -0.776790 -0.546031
+vn -0.313760 -0.861268 -0.399716
+vn -0.313760 -0.861268 -0.399716
+vn -0.313745 -0.945742 0.084471
+vn -0.313746 -0.945743 -0.084461
+vn -0.313763 -0.776790 -0.546031
+vn -0.314863 -0.474567 -0.821978
+vn -0.314867 -0.474562 -0.821979
+vn -0.314867 -0.474562 -0.821979
+vn -0.313760 -0.861268 -0.399716
+vn -0.313763 -0.776790 -0.546031
+vn -0.944532 0.188860 -0.268684
+vn -0.944533 0.297898 -0.138253
+vn -0.944532 0.268683 -0.188863
+vn -0.944532 0.268683 -0.188863
+vn -0.944533 0.138256 -0.297898
+vn -0.944532 0.188860 -0.268684
+vn -0.944533 0.297898 -0.138253
+vn -0.944532 0.327117 0.029219
+vn -0.944533 0.327115 -0.029211
+vn -0.944533 0.327115 -0.029211
+vn -0.944532 0.268683 -0.188863
+vn -0.944533 0.297898 -0.138253
+vn -0.944532 -0.188859 0.268685
+vn -0.944533 -0.297899 0.138254
+vn -0.944532 -0.268683 0.188864
+vn -0.944532 -0.268683 0.188864
+vn -0.944532 -0.138253 0.297900
+vn -0.944532 -0.188859 0.268685
+vn -0.944533 -0.297899 0.138254
+vn -0.944532 -0.327118 -0.029218
+vn -0.944533 -0.327115 0.029212
+vn -0.944533 -0.327115 0.029212
+vn -0.944532 -0.268683 0.188864
+vn -0.944533 -0.297899 0.138254
+vn -0.944532 -0.327118 -0.029218
+vn -0.944532 -0.268685 -0.188859
+vn -0.944532 -0.297902 -0.138253
+vn -0.944532 -0.297902 -0.138253
+vn -0.944533 -0.327115 0.029212
+vn -0.944532 -0.327118 -0.029218
+vn -0.944532 -0.268685 -0.188859
+vn -0.944935 -0.163624 -0.283416
+vn -0.944935 -0.163626 -0.283415
+vn -0.944935 -0.163626 -0.283415
+vn -0.944532 -0.297902 -0.138253
+vn -0.944532 -0.268685 -0.188859
+vn -0.422313 -0.000003 0.906450
+vn -0.258413 -0.000007 0.966035
+vn -0.258431 0.482987 0.836622
+vn -0.258431 0.482987 0.836622
+vn -0.576382 0.408556 0.707718
+vn -0.422313 -0.000003 0.906450
+vn -0.422313 -0.000003 0.906450
+vn -0.501501 -0.442400 0.743491
+vn -0.257469 -0.406781 0.876492
+vn -0.257469 -0.406781 0.876492
+vn -0.258413 -0.000007 0.966035
+vn -0.422313 -0.000003 0.906450
+vn -0.501501 -0.442400 0.743491
+vn -0.501496 -0.754880 0.422679
+vn -0.257452 -0.790525 0.555687
+vn -0.257452 -0.790525 0.555687
+vn -0.257469 -0.406781 0.876492
+vn -0.501501 -0.442400 0.743491
+vn -0.501496 -0.754880 0.422679
+vn -0.501493 -0.865086 -0.011399
+vn -0.257412 -0.962471 0.085956
+vn -0.257412 -0.962471 0.085956
+vn -0.257452 -0.790525 0.555687
+vn -0.501496 -0.754880 0.422679
+vn -0.501502 -0.422655 -0.754890
+vn -0.501504 0.011393 -0.865080
+vn -0.257464 -0.085973 -0.962456
+vn -0.257464 -0.085973 -0.962456
+vn -0.257463 -0.555652 -0.790547
+vn -0.501502 -0.422655 -0.754890
+vn -0.501504 0.442382 -0.743500
+vn -0.501498 0.754871 -0.422694
+vn -0.257460 0.790517 -0.555696
+vn -0.257460 0.790517 -0.555696
+vn -0.257479 0.406771 -0.876494
+vn -0.501504 0.442382 -0.743500
+vn -0.501498 0.754871 -0.422694
+vn -0.501494 0.865086 0.011397
+vn -0.257412 0.962471 -0.085958
+vn -0.257412 0.962471 -0.085958
+vn -0.257460 0.790517 -0.555696
+vn -0.501498 0.754871 -0.422694
+vn -0.501494 0.865086 0.011397
+vn -0.501519 0.743462 0.442429
+vn -0.257429 0.876509 0.406770
+vn -0.257429 0.876509 0.406770
+vn -0.257412 0.962471 -0.085958
+vn -0.501494 0.865086 0.011397
+vn -0.501519 0.743462 0.442429
+vn -0.576382 0.408556 0.707718
+vn -0.258431 0.482987 0.836622
+vn -0.258431 0.482987 0.836622
+vn -0.257429 0.876509 0.406770
+vn -0.501519 0.743462 0.442429
+vn -0.847546 -0.279898 0.450914
+vn -0.847553 -0.467847 0.250545
+vn -0.501496 -0.754880 0.422679
+vn -0.501496 -0.754880 0.422679
+vn -0.501501 -0.442400 0.743491
+vn -0.847546 -0.279898 0.450914
+vn -0.847553 -0.467847 0.250545
+vn -0.847552 -0.530442 -0.016965
+vn -0.501493 -0.865086 -0.011399
+vn -0.501493 -0.865086 -0.011399
+vn -0.501496 -0.754880 0.422679
+vn -0.847553 -0.467847 0.250545
+vn -0.847543 -0.250540 -0.467868
+vn -0.847546 0.016951 -0.530451
+vn -0.501504 0.011393 -0.865080
+vn -0.501504 0.011393 -0.865080
+vn -0.501502 -0.422655 -0.754890
+vn -0.847543 -0.250540 -0.467868
+vn -0.847545 0.279881 -0.450925
+vn -0.847559 0.467835 -0.250549
+vn -0.501498 0.754871 -0.422694
+vn -0.501498 0.754871 -0.422694
+vn -0.501504 0.442382 -0.743500
+vn -0.847545 0.279881 -0.450925
+vn -0.847559 0.467835 -0.250549
+vn -0.847558 0.530431 0.016963
+vn -0.501494 0.865086 0.011397
+vn -0.501494 0.865086 0.011397
+vn -0.501498 0.754871 -0.422694
+vn -0.847559 0.467835 -0.250549
+vn -0.847558 0.530431 0.016963
+vn -0.847558 0.450886 0.279905
+vn -0.501519 0.743462 0.442429
+vn -0.501519 0.743462 0.442429
+vn -0.501494 0.865086 0.011397
+vn -0.847558 0.530431 0.016963
+vn -0.847558 0.450886 0.279905
+vn -0.885418 0.232376 0.402537
+vn -0.576382 0.408556 0.707718
+vn -0.576382 0.408556 0.707718
+vn -0.501519 0.743462 0.442429
+vn -0.847558 0.450886 0.279905
+vn -0.985850 -0.096387 0.137144
+vn -0.985852 -0.152044 0.070555
+vn -0.847553 -0.467847 0.250545
+vn -0.847553 -0.467847 0.250545
+vn -0.847546 -0.279898 0.450914
+vn -0.985850 -0.096387 0.137144
+vn -0.985852 -0.152044 0.070555
+vn -0.985850 -0.166966 -0.014912
+vn -0.847552 -0.530442 -0.016965
+vn -0.847552 -0.530442 -0.016965
+vn -0.847553 -0.467847 0.250545
+vn -0.985852 -0.152044 0.070555
+vn -0.985851 0.096382 -0.137141
+vn -0.985854 0.152034 -0.070550
+vn -0.847559 0.467835 -0.250549
+vn -0.847559 0.467835 -0.250549
+vn -0.847545 0.279881 -0.450925
+vn -0.985851 0.096382 -0.137141
+vn -0.985854 0.152034 -0.070550
+vn -0.979572 0.200298 0.017888
+vn -0.847558 0.530431 0.016963
+vn -0.847558 0.530431 0.016963
+vn -0.847559 0.467835 -0.250549
+vn -0.985854 0.152034 -0.070550
+vn -0.979572 0.200298 0.017888
+vn -0.979573 0.164513 0.115639
+vn -0.847558 0.450886 0.279905
+vn -0.847558 0.450886 0.279905
+vn -0.847558 0.530431 0.016963
+vn -0.979572 0.200298 0.017888
+vn -0.979573 0.164513 0.115639
+vn -0.974949 0.111197 0.192637
+vn -0.885418 0.232376 0.402537
+vn -0.885418 0.232376 0.402537
+vn -0.847558 0.450886 0.279905
+vn -0.979573 0.164513 0.115639
+vn 0.635886 -0.167840 0.753311
+vn 0.632162 -0.048570 0.773313
+vn 0.634498 -0.074622 0.769314
+vn 0.634498 -0.074622 0.769314
+vn 0.635636 -0.168166 0.753450
+vn 0.635886 -0.167840 0.753311
+vn 0.632162 -0.048570 0.773313
+vn 0.637837 0.053263 0.768328
+vn 0.637312 0.054487 0.768677
+vn 0.637312 0.054487 0.768677
+vn 0.634498 -0.074622 0.769314
+vn 0.632162 -0.048570 0.773313
+vn -0.000069 -0.218081 0.975931
+vn -0.000258 -0.079615 0.996826
+vn -0.000136 -0.079599 0.996827
+vn -0.000136 -0.079599 0.996827
+vn -0.000000 -0.218015 0.975945
+vn -0.000069 -0.218081 0.975931
+vn 0.000003 0.038918 0.999242
+vn 0.000062 0.105891 0.994378
+vn -0.000136 -0.079599 0.996827
+vn -0.000136 -0.079599 0.996827
+vn -0.000258 -0.079615 0.996826
+vn 0.000003 0.038918 0.999242
+vn -0.660298 -0.059808 0.748618
+vn -0.663773 -0.183793 0.725000
+vn -0.665801 -0.140612 0.732760
+vn -0.665801 -0.140612 0.732760
+vn -0.665034 -0.059360 0.744450
+vn -0.660298 -0.059808 0.748618
+vn -0.660298 -0.059808 0.748618
+vn -0.665034 -0.059360 0.744450
+vn -0.665143 0.052740 0.744851
+vn -0.665143 0.052740 0.744851
+vn -0.664726 0.051479 0.745311
+vn -0.660298 -0.059808 0.748618
+vn -0.663773 -0.183793 0.725000
+vn -0.665341 -0.293954 0.686231
+vn -0.673683 -0.289338 0.680026
+vn -0.673683 -0.289338 0.680026
+vn -0.665801 -0.140612 0.732760
+vn -0.663773 -0.183793 0.725000
+vn -0.000069 -0.218081 0.975931
+vn -0.000000 -0.218015 0.975945
+vn 0.000037 -0.361843 0.932239
+vn 0.000037 -0.361843 0.932239
+vn 0.000037 -0.419120 0.907931
+vn -0.000069 -0.218081 0.975931
+vn 0.635886 -0.167840 0.753311
+vn 0.635636 -0.168166 0.753450
+vn 0.636855 -0.278577 0.718896
+vn 0.636855 -0.278577 0.718896
+vn 0.647848 -0.320198 0.691207
+vn 0.635886 -0.167840 0.753311
+vn 1.000000 -0.000123 0.000749
+vn 1.000000 -0.000042 0.000091
+vn 1.000000 -0.000059 0.000305
+vn 1.000000 -0.000059 0.000305
+vn 0.999999 -0.000160 0.001225
+vn 1.000000 -0.000123 0.000749
+vn 1.000000 0.000002 -0.000069
+vn 1.000000 -0.000059 0.000305
+vn 1.000000 -0.000042 0.000091
+vn 1.000000 -0.000042 0.000091
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 0.000002 -0.000069
+vn 0.647848 -0.320198 0.691207
+vn 0.636855 -0.278577 0.718896
+vn 0.653707 -0.361903 0.664600
+vn 0.653707 -0.361903 0.664600
+vn 0.669832 -0.357950 0.650536
+vn 0.647848 -0.320198 0.691207
+vn 0.000037 -0.419120 0.907931
+vn 0.000037 -0.361843 0.932239
+vn 0.000062 -0.474589 0.880208
+vn 0.000062 -0.474589 0.880208
+vn -0.000000 -0.474523 0.880243
+vn 0.000037 -0.419120 0.907931
+vn -0.680196 -0.350698 0.643695
+vn -0.693722 -0.341867 0.633938
+vn -0.673683 -0.289338 0.680026
+vn -0.673683 -0.289338 0.680026
+vn -0.665341 -0.293954 0.686231
+vn -0.680196 -0.350698 0.643695
+vn 0.650694 0.212380 0.729035
+vn 0.651099 0.212601 0.728609
+vn 0.637312 0.054487 0.768677
+vn 0.637312 0.054487 0.768677
+vn 0.637837 0.053263 0.768328
+vn 0.650694 0.212380 0.729035
+vn -0.000060 0.281420 0.959585
+vn -0.000130 0.281514 0.959557
+vn 0.000062 0.105891 0.994378
+vn 0.000062 0.105891 0.994378
+vn 0.000003 0.038918 0.999242
+vn -0.000060 0.281420 0.959585
+vn -0.000060 0.281420 0.959585
+vn -0.000273 0.387136 0.922023
+vn -0.000226 0.387180 0.922004
+vn -0.000226 0.387180 0.922004
+vn -0.000130 0.281514 0.959557
+vn -0.000060 0.281420 0.959585
+vn 0.650694 0.212380 0.729035
+vn 0.647965 0.292843 0.703124
+vn 0.654527 0.291677 0.697509
+vn 0.654527 0.291677 0.697509
+vn 0.651099 0.212601 0.728609
+vn 0.650694 0.212380 0.729035
+vn -0.678882 0.205267 0.704972
+vn -0.664726 0.051479 0.745311
+vn -0.665143 0.052740 0.744851
+vn -0.665143 0.052740 0.744851
+vn -0.679557 0.205346 0.704298
+vn -0.678882 0.205267 0.704972
+vn -0.678882 0.205267 0.704972
+vn -0.679557 0.205346 0.704298
+vn -0.682904 0.281892 0.673928
+vn -0.682904 0.281892 0.673928
+vn -0.676515 0.283204 0.679796
+vn -0.678882 0.205267 0.704972
+vn 0.000075 0.858283 -0.513177
+vn 0.000043 0.858248 -0.513235
+vn 0.000075 0.858283 -0.513177
+vn 0.000075 0.858283 -0.513177
+vn 0.000107 0.858317 -0.513119
+vn 0.000075 0.858283 -0.513177
+vn 0.999999 0.000559 0.001462
+vn 0.999999 0.000481 0.001514
+vn 0.999999 0.000644 0.001420
+vn 0.999999 0.000644 0.001420
+vn 0.999999 0.000631 0.001404
+vn 0.999999 0.000559 0.001462
+vn -0.999999 -0.000561 -0.001468
+vn -0.999999 -0.000635 -0.001411
+vn -0.999999 -0.000647 -0.001426
+vn -0.999999 -0.000647 -0.001426
+vn -0.999999 -0.000483 -0.001520
+vn -0.999999 -0.000561 -0.001468
+vn 0.999999 0.000315 0.001566
+vn 0.999999 0.000236 0.001575
+vn 0.999999 0.000481 0.001514
+vn 0.999999 0.000481 0.001514
+vn 0.999999 0.000559 0.001462
+vn 0.999999 0.000315 0.001566
+vn -0.999999 -0.000316 -0.001571
+vn -0.999999 -0.000561 -0.001468
+vn -0.999999 -0.000483 -0.001520
+vn -0.999999 -0.000483 -0.001520
+vn -0.999999 -0.000237 -0.001580
+vn -0.999999 -0.000316 -0.001571
+vn 0.999999 0.000155 0.001582
+vn 0.999999 0.000150 0.001573
+vn 0.999999 0.000236 0.001575
+vn 0.999999 0.000236 0.001575
+vn 0.999999 0.000315 0.001566
+vn 0.999999 0.000155 0.001582
+vn -0.999999 -0.000155 -0.001587
+vn -0.999999 -0.000316 -0.001571
+vn -0.999999 -0.000237 -0.001580
+vn -0.999999 -0.000237 -0.001580
+vn -0.999999 -0.000151 -0.001578
+vn -0.999999 -0.000155 -0.001587
+vn 0.999999 -0.000199 0.001513
+vn 0.999999 -0.000283 0.001476
+vn 0.999999 -0.000116 0.001536
+vn 0.999999 -0.000116 0.001536
+vn 0.999999 -0.000110 0.001573
+vn 0.999999 -0.000199 0.001513
+vn -0.999999 0.000200 -0.001519
+vn -0.999999 0.000110 -0.001578
+vn -0.999999 0.000116 -0.001543
+vn -0.999999 0.000116 -0.001543
+vn -0.999999 0.000285 -0.001483
+vn -0.999999 0.000200 -0.001519
+vn 0.999998 -0.000729 0.001606
+vn 0.999999 -0.000559 0.001515
+vn 0.999999 -0.000536 0.001456
+vn 0.999999 -0.000536 0.001456
+vn 0.999999 -0.000554 0.001370
+vn 0.999998 -0.000729 0.001606
+vn -0.999998 0.000734 -0.001619
+vn -0.999999 0.000557 -0.001377
+vn -0.999999 0.000538 -0.001464
+vn -0.999999 0.000538 -0.001464
+vn -0.999999 0.000560 -0.001525
+vn -0.999998 0.000734 -0.001619
+vn -0.999998 0.000734 -0.001619
+vn -0.999999 0.000560 -0.001525
+vn -0.999998 0.000929 -0.001775
+vn -0.999998 0.000929 -0.001775
+vn -0.999997 0.001257 -0.002051
+vn -0.999998 0.000734 -0.001619
+vn 0.999998 -0.000729 0.001606
+vn 0.999997 -0.001241 0.002025
+vn 0.999998 -0.000921 0.001757
+vn 0.999998 -0.000921 0.001757
+vn 0.999999 -0.000559 0.001515
+vn 0.999998 -0.000729 0.001606
+vn 0.002238 -0.180193 -0.983629
+vn -0.000051 -0.175278 -0.984519
+vn 0.002238 -0.180193 -0.983629
+vn 0.002238 -0.180193 -0.983629
+vn 0.004528 -0.185104 -0.982709
+vn 0.002238 -0.180193 -0.983629
+vn -0.000295 0.534751 -0.845010
+vn -0.000336 0.534707 -0.845038
+vn -0.000363 0.626487 -0.779432
+vn -0.000363 0.626487 -0.779432
+vn -0.000304 0.626140 -0.779710
+vn -0.000295 0.534751 -0.845010
+vn -0.000011 -0.762599 0.646872
+vn 0.000257 -0.762307 0.647215
+vn -0.000011 -0.762599 0.646872
+vn -0.000011 -0.762599 0.646872
+vn -0.000280 -0.762890 0.646528
+vn -0.000011 -0.762599 0.646872
+vn 0.000099 -0.000327 -1.000000
+vn 0.000000 -0.000284 -1.000000
+vn 0.000099 -0.000327 -1.000000
+vn 0.000099 -0.000327 -1.000000
+vn 0.000198 -0.000370 -1.000000
+vn 0.000099 -0.000327 -1.000000
+vn 0.000140 -0.783539 -0.621343
+vn 0.000312 -0.783723 -0.621110
+vn 0.000140 -0.783539 -0.621343
+vn 0.000140 -0.783539 -0.621343
+vn -0.000033 -0.783355 -0.621575
+vn 0.000140 -0.783539 -0.621343
+vn 0.000100 0.000567 1.000000
+vn -0.000198 0.000664 1.000000
+vn 0.000100 0.000567 1.000000
+vn 0.000100 0.000567 1.000000
+vn 0.000398 0.000469 1.000000
+vn 0.000100 0.000567 1.000000
+vn 0.000019 -0.191248 -0.981542
+vn 0.000159 -0.181763 -0.983342
+vn 0.000087 -0.181640 -0.983365
+vn 0.000087 -0.181640 -0.983365
+vn 0.000004 -0.191146 -0.981562
+vn 0.000019 -0.191248 -0.981542
+vn -1.000000 0.000229 -0.000361
+vn -0.999999 0.000381 -0.001186
+vn -0.999999 0.000574 -0.000903
+vn -0.999999 0.000574 -0.000903
+vn -0.999998 0.000006 0.001754
+vn -1.000000 0.000229 -0.000361
+vn -0.664024 -0.483565 -0.570295
+vn -0.873120 -0.290925 0.391183
+vn -0.904786 -0.423561 -0.044249
+vn -0.904786 -0.423561 -0.044249
+vn -0.853715 -0.409217 -0.322042
+vn -0.664024 -0.483565 -0.570295
+vn -0.906996 -0.183115 0.379246
+vn -0.904786 -0.423561 -0.044249
+vn -0.754321 -0.068901 0.652880
+vn -0.754321 -0.068901 0.652880
+vn -0.603162 -0.049281 0.796095
+vn -0.906996 -0.183115 0.379246
+vn -0.906996 -0.183115 0.379246
+vn -0.603162 -0.049281 0.796095
+vn -0.756654 0.217919 0.616430
+vn -0.756654 0.217919 0.616430
+vn -0.933101 -0.090247 0.348105
+vn -0.906996 -0.183115 0.379246
+vn -0.664024 -0.483565 -0.570295
+vn -0.853715 -0.409217 -0.322042
+vn -0.869719 -0.318669 -0.376881
+vn -0.869719 -0.318669 -0.376881
+vn -0.860752 -0.318427 -0.397128
+vn -0.664024 -0.483565 -0.570295
+vn -0.664024 -0.483565 -0.570295
+vn -0.335894 -0.432240 -0.836866
+vn -0.350013 -0.426336 -0.834103
+vn -0.350013 -0.426336 -0.834103
+vn -0.355807 -0.508774 -0.783933
+vn -0.664024 -0.483565 -0.570295
+vn -0.664024 -0.483565 -0.570295
+vn -0.355807 -0.508774 -0.783933
+vn -0.395397 -0.658416 -0.640429
+vn -0.395397 -0.658416 -0.640429
+vn -0.419048 -0.688095 -0.592388
+vn -0.664024 -0.483565 -0.570295
+vn -0.603162 -0.049281 0.796095
+vn -0.754321 -0.068901 0.652880
+vn -0.527233 0.115337 0.841857
+vn -0.527233 0.115337 0.841857
+vn -0.358498 0.022042 0.933270
+vn -0.603162 -0.049281 0.796095
+vn -0.603162 -0.049281 0.796095
+vn -0.358498 0.022042 0.933270
+vn -0.393856 0.112626 0.912246
+vn -0.393856 0.112626 0.912246
+vn -0.756654 0.217919 0.616430
+vn -0.603162 -0.049281 0.796095
+vn 0.000100 0.999977 0.006726
+vn 0.000198 0.999978 0.006614
+vn 0.000100 0.999977 0.006726
+vn 0.000100 0.999977 0.006726
+vn 0.000003 0.999977 0.006838
+vn 0.000100 0.999977 0.006726
+vn -0.000030 0.306414 -0.951898
+vn 0.000250 0.304631 -0.952470
+vn -0.000030 0.306414 -0.951898
+vn -0.000030 0.306414 -0.951898
+vn -0.000309 0.308197 -0.951323
+vn -0.000030 0.306414 -0.951898
+vn 0.000085 -0.880404 -0.474224
+vn -0.000081 -0.880553 -0.473947
+vn 0.000085 -0.880404 -0.474224
+vn 0.000085 -0.880404 -0.474224
+vn 0.000250 -0.880255 -0.474501
+vn 0.000085 -0.880404 -0.474224
+vn -0.999997 -0.002230 0.000424
+vn -0.999990 -0.004459 0.000848
+vn -0.999999 -0.001115 0.000212
+vn -0.999999 -0.001115 0.000212
+vn -1.000000 -0.000000 0.000000
+vn -0.999997 -0.002230 0.000424
+vn 0.000019 -0.191248 -0.981542
+vn 0.000004 -0.191146 -0.981562
+vn -0.000063 -0.192585 -0.981280
+vn -0.000063 -0.192585 -0.981280
+vn -0.000061 -0.184106 -0.982906
+vn 0.000019 -0.191248 -0.981542
+vn 1.000000 0.000013 -0.000070
+vn 1.000000 -0.000059 0.000305
+vn 1.000000 0.000002 -0.000069
+vn 1.000000 0.000002 -0.000069
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000013 -0.000070
+vn -0.873120 -0.290925 0.391183
+vn -0.809035 -0.562434 0.170677
+vn -0.754321 -0.068901 0.652880
+vn -0.754321 -0.068901 0.652880
+vn -0.118434 -0.962411 0.244415
+vn -0.873120 -0.290925 0.391183
+vn 0.000916 0.999967 0.008092
+vn 0.000982 0.999955 0.009400
+vn -0.003158 0.999968 0.007419
+vn -0.003158 0.999968 0.007419
+vn 0.000784 0.999985 0.005477
+vn 0.000916 0.999967 0.008092
+vn 0.118425 -0.962412 0.244414
+vn 0.118425 -0.962412 0.244414
+vn -0.605565 0.333937 0.722341
+vn 0.874858 -0.379655 0.300808
+vn 0.810531 -0.560415 0.170217
+vn 0.867974 -0.496501 0.010408
+vn -0.001396 0.999948 0.010110
+vn -0.000784 0.999985 0.005479
+vn 0.005988 0.999943 0.008816
+vn 0.005988 0.999943 0.008816
+vn -0.001702 0.999921 0.012427
+vn -0.001396 0.999948 0.010110
+vn -0.860329 0.411331 -0.301067
+vn -0.631964 0.523631 -0.571342
+vn -0.646196 0.488040 -0.586727
+vn -0.819954 0.431559 0.376075
+vn -0.900284 0.435165 -0.010921
+vn 0.819488 0.432449 0.376069
+vn 0.582743 0.570477 0.578763
+vn 0.712414 0.497493 0.494941
+vn 0.859541 0.413243 -0.300699
+vn 0.896680 0.442545 -0.010920
+vn 0.584483 0.450862 -0.674613
+vn 0.644013 0.493272 -0.584748
+vn -0.077055 -0.972195 -0.221134
+vn -0.036029 -0.979683 -0.197292
+vn -0.036029 -0.979683 -0.197292
+vn -0.345767 -0.132147 -0.928968
+vn -0.458030 -0.261883 -0.849486
+vn -0.795941 -0.350374 -0.493676
+vn -0.117904 -0.962463 -0.244466
+vn -0.117904 -0.962463 -0.244466
+vn -0.077055 -0.972195 -0.221134
+vn -0.795941 -0.350374 -0.493676
+vn -0.850572 -0.151956 0.503426
+vn -0.863446 -0.504297 -0.012018
+vn 0.000095 0.999950 -0.009979
+vn 0.000841 0.999985 -0.005481
+vn -0.004637 0.999956 -0.008180
+vn -0.004637 0.999956 -0.008180
+vn -0.008649 0.999905 -0.010694
+vn 0.000095 0.999950 -0.009979
+vn 0.000095 0.999950 -0.009979
+vn -0.008649 0.999905 -0.010694
+vn 0.004826 0.999919 -0.011777
+vn 0.004826 0.999919 -0.011777
+vn 0.016835 0.999773 -0.013043
+vn 0.000095 0.999950 -0.009979
+vn 0.798570 -0.345018 -0.493203
+vn 0.459803 -0.252519 -0.851361
+vn 0.346237 -0.128948 -0.929243
+vn 0.036235 -0.979551 -0.197905
+vn 0.036235 -0.979551 -0.197905
+vn 0.077360 -0.972115 -0.221377
+vn 0.868350 -0.495846 -0.010225
+vn 0.811440 -0.559195 -0.169902
+vn 0.798570 -0.345018 -0.493203
+vn 0.077360 -0.972115 -0.221377
+vn 0.118307 -0.962446 -0.244339
+vn 0.118307 -0.962446 -0.244339
+vn 0.004652 0.999956 -0.008170
+vn -0.000804 0.999985 -0.005481
+vn 0.000638 0.999965 -0.008332
+vn 0.000638 0.999965 -0.008332
+vn 0.006946 0.999882 -0.013672
+vn 0.004652 0.999956 -0.008170
+vn 0.005364 0.999872 -0.015079
+vn 0.018117 0.999605 -0.021500
+vn 0.006946 0.999882 -0.013672
+vn 0.006946 0.999882 -0.013672
+vn 0.000638 0.999965 -0.008332
+vn 0.005364 0.999872 -0.015079
+vn -0.000363 0.626487 -0.779432
+vn -0.000502 0.710919 -0.703274
+vn -0.000427 0.710257 -0.703943
+vn -0.000427 0.710257 -0.703943
+vn -0.000304 0.626140 -0.779710
+vn -0.000363 0.626487 -0.779432
+vn -0.000061 -0.184106 -0.982906
+vn -0.000063 -0.192585 -0.981280
+vn -0.000046 -0.175681 -0.984447
+vn -0.000046 -0.175681 -0.984447
+vn -0.000000 -0.175321 -0.984511
+vn -0.000061 -0.184106 -0.982906
+vn 0.003736 0.977052 -0.212969
+vn 0.007474 0.976696 -0.214497
+vn 0.001850 0.978119 -0.208036
+vn 0.001850 0.978119 -0.208036
+vn 0.001300 0.977669 -0.210148
+vn 0.003736 0.977052 -0.212969
+vn 0.001850 0.978119 -0.208036
+vn -0.002673 0.980334 -0.197328
+vn -0.000036 0.979159 -0.203097
+vn -0.000036 0.979159 -0.203097
+vn 0.001300 0.977669 -0.210148
+vn 0.001850 0.978119 -0.208036
+vn 0.880464 -0.272086 0.388269
+vn 0.933511 -0.136716 0.331460
+vn 0.760964 -0.137604 0.634034
+vn 0.760964 -0.137604 0.634034
+vn 0.696291 -0.277814 0.661814
+vn 0.880464 -0.272086 0.388269
+vn 0.696291 -0.277814 0.661814
+vn 0.760964 -0.137604 0.634034
+vn 0.456776 -0.139105 0.878639
+vn 0.456776 -0.139105 0.878639
+vn 0.382728 -0.283149 0.879401
+vn 0.696291 -0.277814 0.661814
+vn 0.806355 -0.429611 0.406480
+vn 0.880464 -0.272086 0.388269
+vn 0.696291 -0.277814 0.661814
+vn 0.696291 -0.277814 0.661814
+vn 0.628880 -0.429097 0.648372
+vn 0.806355 -0.429611 0.406480
+vn 0.628880 -0.429097 0.648372
+vn 0.696291 -0.277814 0.661814
+vn 0.382728 -0.283149 0.879401
+vn 0.382728 -0.283149 0.879401
+vn 0.112224 -0.208505 0.971561
+vn 0.628880 -0.429097 0.648372
+vn -0.385052 -0.283448 0.878289
+vn -0.500383 -0.186140 0.845558
+vn -0.188043 -0.409168 0.892872
+vn -0.188043 -0.409168 0.892872
+vn -0.199130 -0.258182 0.945351
+vn -0.385052 -0.283448 0.878289
+vn -0.552780 0.000003 0.833327
+vn -0.635871 -0.400458 0.659774
+vn -0.374364 -0.390356 0.841115
+vn -0.374364 -0.390356 0.841115
+vn -0.375617 0.000007 0.926775
+vn -0.552780 0.000003 0.833327
+vn -0.993596 0.000000 0.112994
+vn -0.894127 0.000000 0.447813
+vn -0.941313 0.168761 0.292318
+vn -0.941313 0.168761 0.292318
+vn -0.988595 0.075286 0.130428
+vn -0.993596 0.000000 0.112994
+vn -0.993596 0.000000 0.112994
+vn -0.993545 -0.065225 0.092812
+vn -0.919306 -0.209306 0.333267
+vn -0.919306 -0.209306 0.333267
+vn -0.894127 0.000000 0.447813
+vn -0.993596 0.000000 0.112994
+vn 0.941321 0.000000 0.337514
+vn 0.995911 0.000000 0.090344
+vn 0.988597 0.075286 0.130412
+vn 0.988597 0.075286 0.130412
+vn 0.894128 0.223900 0.387819
+vn 0.941321 0.000000 0.337514
+vn 0.941321 0.000000 0.337514
+vn 0.919316 -0.183932 0.347890
+vn 0.993547 -0.047744 0.102887
+vn 0.993547 -0.047744 0.102887
+vn 0.995911 0.000000 0.090344
+vn 0.941321 0.000000 0.337514
+vn 0.375619 0.000004 0.926774
+vn 0.374405 -0.533230 0.758609
+vn 0.635844 -0.371168 0.676710
+vn 0.635844 -0.371168 0.676710
+vn 0.711779 0.000000 0.702403
+vn 0.375619 0.000004 0.926774
+vn -0.950405 0.254446 0.178853
+vn -0.950406 0.130926 0.282110
+vn -0.869389 0.233353 0.435557
+vn -0.869389 0.233353 0.435557
+vn -0.869389 0.419868 0.260524
+vn -0.950405 0.254446 0.178853
+vn -0.869389 0.419868 0.260524
+vn -0.869389 0.233353 0.435557
+vn -0.571901 0.399645 0.716389
+vn -0.571901 0.399645 0.716389
+vn -0.571889 0.704307 0.420587
+vn -0.869389 0.419868 0.260524
+vn -0.571901 0.399645 0.716389
+vn -0.624264 0.202197 0.754593
+vn -0.345186 0.242915 0.906553
+vn -0.345186 0.242915 0.906553
+vn -0.354603 0.537690 0.764948
+vn -0.571901 0.399645 0.716389
+vn 0.354618 0.393618 0.848122
+vn 0.345178 0.242914 0.906557
+vn 0.489242 0.225733 0.842429
+vn 0.489242 0.225733 0.842429
+vn 0.571894 0.420587 0.704303
+vn 0.354618 0.393618 0.848122
+vn 0.571883 0.716398 0.399655
+vn 0.571894 0.420587 0.704303
+vn 0.868652 0.284895 0.405313
+vn 0.868652 0.284895 0.405313
+vn 0.868654 0.449383 0.208554
+vn 0.571883 0.716398 0.399655
+vn 0.950406 0.254443 0.178851
+vn 0.868654 0.449383 0.208554
+vn 0.868652 0.284895 0.405313
+vn 0.868652 0.284895 0.405313
+vn 0.950407 0.130925 0.282108
+vn 0.950406 0.254443 0.178851
+vn -0.824631 -0.399988 -0.399991
+vn -0.869388 -0.233356 -0.435556
+vn -0.571909 -0.399646 -0.716382
+vn -0.571909 -0.399646 -0.716382
+vn -0.489249 -0.616697 -0.616700
+vn -0.824631 -0.399988 -0.399991
+vn -0.869388 -0.233356 -0.435556
+vn -0.869392 0.015691 -0.493874
+vn -0.571908 0.012087 -0.820229
+vn -0.571908 0.012087 -0.820229
+vn -0.571909 -0.399646 -0.716382
+vn -0.869388 -0.233356 -0.435556
+vn -0.489249 -0.616697 -0.616700
+vn -0.571909 -0.399646 -0.716382
+vn -0.354639 -0.537686 -0.764935
+vn -0.354639 -0.537686 -0.764935
+vn -0.345155 -0.663658 -0.663646
+vn -0.489249 -0.616697 -0.616700
+vn -0.571909 -0.399646 -0.716382
+vn -0.571908 0.012087 -0.820229
+vn -0.354628 -0.083183 -0.931300
+vn -0.354628 -0.083183 -0.931300
+vn -0.354639 -0.537686 -0.764935
+vn -0.571909 -0.399646 -0.716382
+vn 0.345198 -0.663641 -0.663641
+vn 0.354649 -0.393615 -0.848110
+vn 0.571906 -0.420586 -0.704294
+vn 0.571906 -0.420586 -0.704294
+vn 0.624252 -0.552404 -0.552412
+vn 0.345198 -0.663641 -0.663641
+vn 0.354649 -0.393615 -0.848110
+vn 0.354628 0.083183 -0.931300
+vn 0.571908 -0.012087 -0.820229
+vn 0.571908 -0.012087 -0.820229
+vn 0.571906 -0.420586 -0.704294
+vn 0.354649 -0.393615 -0.848110
+vn 0.624252 -0.552404 -0.552412
+vn 0.571906 -0.420586 -0.704294
+vn 0.868649 -0.284900 -0.405315
+vn 0.868649 -0.284900 -0.405315
+vn 0.861982 -0.358460 -0.358460
+vn 0.624252 -0.552404 -0.552412
+vn 0.571906 -0.420586 -0.704294
+vn 0.571908 -0.012087 -0.820229
+vn 0.868654 -0.044075 -0.493455
+vn 0.868654 -0.044075 -0.493455
+vn 0.868649 -0.284900 -0.405315
+vn 0.571906 -0.420586 -0.704294
+vn 0.571908 -0.012087 -0.820229
+vn 0.571909 0.399643 -0.716384
+vn 0.868651 0.208561 -0.449385
+vn 0.868651 0.208561 -0.449385
+vn 0.868654 -0.044075 -0.493455
+vn 0.571908 -0.012087 -0.820229
+vn 0.950407 0.178846 -0.254441
+vn 0.868651 0.208561 -0.449385
+vn 0.868652 0.405310 -0.284901
+vn 0.868652 0.405310 -0.284901
+vn 0.950405 0.282113 -0.130927
+vn 0.950407 0.178846 -0.254441
+vn 0.571909 0.399643 -0.716384
+vn 0.571898 0.704302 -0.420585
+vn 0.868652 0.405310 -0.284901
+vn 0.868652 0.405310 -0.284901
+vn 0.868651 0.208561 -0.449385
+vn 0.571909 0.399643 -0.716384
+vn 0.354628 0.083183 -0.931300
+vn 0.354639 0.537681 -0.764938
+vn 0.571909 0.399643 -0.716384
+vn 0.571909 0.399643 -0.716384
+vn 0.571908 -0.012087 -0.820229
+vn 0.354628 0.083183 -0.931300
+vn -0.571908 0.012087 -0.820229
+vn -0.571906 0.420583 -0.704297
+vn -0.354649 0.393613 -0.848112
+vn -0.354649 0.393613 -0.848112
+vn -0.354628 -0.083183 -0.931300
+vn -0.571908 0.012087 -0.820229
+vn -0.869392 0.015691 -0.493874
+vn -0.869388 0.260524 -0.419872
+vn -0.571906 0.420583 -0.704297
+vn -0.571906 0.420583 -0.704297
+vn -0.571908 0.012087 -0.820229
+vn -0.869392 0.015691 -0.493874
+vn -0.869388 0.260524 -0.419872
+vn -0.869391 0.435553 -0.233350
+vn -0.571884 0.716396 -0.399656
+vn -0.571884 0.716396 -0.399656
+vn -0.571906 0.420583 -0.704297
+vn -0.869388 0.260524 -0.419872
+vn -0.950406 0.178847 -0.254445
+vn -0.950404 0.282116 -0.130929
+vn -0.869391 0.435553 -0.233350
+vn -0.869391 0.435553 -0.233350
+vn -0.869388 0.260524 -0.419872
+vn -0.950406 0.178847 -0.254445
+vn 0.314856 0.474563 0.821983
+vn 0.313724 -0.084465 0.945750
+vn 0.313721 0.084469 0.945750
+vn 0.313721 0.084469 0.945750
+vn 0.314837 0.474574 0.821984
+vn 0.314856 0.474563 0.821983
+vn -0.609519 -0.789628 -0.070523
+vn -0.609524 -0.648572 -0.455889
+vn -0.495825 -0.749119 -0.439293
+vn -0.495825 -0.749119 -0.439293
+vn -0.495828 -0.868401 -0.005885
+vn -0.609519 -0.789628 -0.070523
+vn -0.609524 -0.648572 -0.455889
+vn -0.609538 -0.333723 -0.719092
+vn -0.495823 -0.429103 -0.755003
+vn -0.495823 -0.429103 -0.755003
+vn -0.495825 -0.749119 -0.439293
+vn -0.609524 -0.648572 -0.455889
+vn -0.495825 -0.749119 -0.439293
+vn -0.495823 -0.429103 -0.755003
+vn -0.253215 -0.481421 -0.839116
+vn -0.253215 -0.481421 -0.839116
+vn -0.253209 -0.836488 -0.485977
+vn -0.495825 -0.749119 -0.439293
+vn 0.253202 -0.839114 -0.481431
+vn 0.253205 -0.485976 -0.836490
+vn 0.470717 -0.483754 -0.737840
+vn 0.470717 -0.483754 -0.737840
+vn 0.512772 -0.760719 -0.397958
+vn 0.253202 -0.839114 -0.481431
+vn 0.609517 -0.789630 -0.070523
+vn 0.494350 -0.865817 0.077326
+vn 0.512772 -0.760719 -0.397958
+vn 0.512772 -0.760719 -0.397958
+vn 0.611033 -0.685550 -0.395803
+vn 0.609517 -0.789630 -0.070523
+vn 0.611050 -0.395792 -0.685542
+vn 0.611033 -0.685550 -0.395803
+vn 0.512772 -0.760719 -0.397958
+vn 0.512772 -0.760719 -0.397958
+vn 0.470717 -0.483754 -0.737840
+vn 0.611050 -0.395792 -0.685542
+vn 0.609525 -0.455884 0.648574
+vn 0.494353 -0.365936 0.788483
+vn 0.494352 -0.711151 0.499881
+vn 0.494352 -0.711151 0.499881
+vn 0.609520 -0.719103 0.333731
+vn 0.609525 -0.455884 0.648574
+vn 0.253211 0.481425 -0.839115
+vn 0.206084 0.691924 -0.691932
+vn 0.514692 0.661554 -0.545378
+vn 0.514692 0.661554 -0.545378
+vn 0.494350 0.365937 -0.788485
+vn 0.253211 0.481425 -0.839115
+vn 0.000005 -0.499997 -0.866027
+vn -0.000001 -0.000001 -1.000000
+vn 0.253206 -0.002627 -0.967409
+vn 0.253206 -0.002627 -0.967409
+vn 0.253205 -0.485976 -0.836490
+vn 0.000005 -0.499997 -0.866027
+vn -0.000001 -0.000001 -1.000000
+vn -0.000002 0.499995 -0.866028
+vn 0.253211 0.481425 -0.839115
+vn 0.253211 0.481425 -0.839115
+vn 0.253206 -0.002627 -0.967409
+vn -0.000001 -0.000001 -1.000000
+vn -0.000002 0.499995 -0.866028
+vn -0.042847 0.706455 -0.706459
+vn 0.206084 0.691924 -0.691932
+vn 0.206084 0.691924 -0.691932
+vn 0.253211 0.481425 -0.839115
+vn -0.000002 0.499995 -0.866028
+vn -0.253215 -0.481421 -0.839116
+vn -0.253205 0.002624 -0.967409
+vn -0.000001 -0.000001 -1.000000
+vn -0.000001 -0.000001 -1.000000
+vn 0.000005 -0.499997 -0.866027
+vn -0.253215 -0.481421 -0.839116
+vn -0.253205 0.002624 -0.967409
+vn -0.253204 0.485976 -0.836490
+vn -0.000002 0.499995 -0.866028
+vn -0.000002 0.499995 -0.866028
+vn -0.000001 -0.000001 -1.000000
+vn -0.253205 0.002624 -0.967409
+vn -0.253204 0.485976 -0.836490
+vn -0.283741 0.678043 -0.678047
+vn -0.042847 0.706455 -0.706459
+vn -0.042847 0.706455 -0.706459
+vn -0.000002 0.499995 -0.866028
+vn -0.253204 0.485976 -0.836490
+vn -0.495833 0.439294 -0.749114
+vn -0.551475 0.657999 -0.512750
+vn -0.283741 0.678043 -0.678047
+vn -0.283741 0.678043 -0.678047
+vn -0.253204 0.485976 -0.836490
+vn -0.495833 0.439294 -0.749114
+vn -0.609527 -0.455884 0.648573
+vn -0.609522 -0.719101 0.333731
+vn -0.495831 -0.754999 0.429102
+vn -0.495831 -0.754999 0.429102
+vn -0.495831 -0.439293 0.749115
+vn -0.609527 -0.455884 0.648573
+vn -0.313719 0.399720 0.861280
+vn -0.313726 -0.084468 0.945749
+vn -0.313723 0.084469 0.945750
+vn -0.313723 0.084469 0.945750
+vn -0.313734 0.546022 0.776808
+vn -0.313719 0.399720 0.861280
+vn -0.004747 0.355586 0.934631
+vn -0.004692 0.299929 0.953950
+vn -0.004787 0.409826 0.912151
+vn -0.004787 0.409826 0.912151
+vn -0.004793 0.409829 0.912150
+vn -0.004747 0.355586 0.934631
+vn -0.004553 0.195837 0.980626
+vn -0.004475 0.147666 0.989027
+vn -0.004692 0.299929 0.953950
+vn -0.004692 0.299929 0.953950
+vn -0.004747 0.355586 0.934631
+vn -0.004553 0.195837 0.980626
+vn -0.003443 -0.241254 0.970456
+vn -0.003437 -0.241257 0.970455
+vn -0.003634 -0.184745 0.982780
+vn -0.003634 -0.184745 0.982780
+vn -0.003815 -0.127425 0.991841
+vn -0.003443 -0.241254 0.970456
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn -0.000468 0.881581 -0.472032
+vn 0.000000 0.880872 -0.473354
+vn 0.000000 0.589268 -0.807938
+vn 0.000000 0.589268 -0.807938
+vn 0.000000 0.440579 -0.897714
+vn -0.000468 0.881581 -0.472032
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.440579 -0.897714
+vn 0.000000 0.589268 -0.807938
+vn 0.000000 0.283463 -0.958983
+vn 0.000000 0.283463 -0.958983
+vn 0.000000 0.283463 -0.958983
+vn 0.000000 0.440579 -0.897714
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -0.999999 0.000381 -0.001186
+vn -0.999999 0.000381 -0.001186
+vn -1.000000 0.000229 -0.000361
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 -0.000230 0.000364
+vn 1.000000 -0.000230 0.000364
+vn 0.999998 -0.000573 0.001786
+vn 1.000000 0.000000 -0.000000
+vn 0.000002 -0.002136 -0.999998
+vn -0.000000 -0.001069 -0.999999
+vn 0.000004 -0.003205 -0.999995
+vn 0.000004 -0.003205 -0.999995
+vn 0.000007 -0.003202 -0.999995
+vn 0.000002 -0.002136 -0.999998
+vn 0.000318 -0.500036 0.866005
+vn 0.000318 -0.500032 0.866007
+vn 0.000318 -0.500036 0.866005
+vn 0.000318 -0.500036 0.866005
+vn 0.000317 -0.500040 0.866002
+vn 0.000318 -0.500036 0.866005
+vn -0.000066 -1.000000 0.000000
+vn -0.000066 -1.000000 0.000000
+vn -0.000066 -1.000000 0.000000
+vn -0.000066 -1.000000 0.000000
+vn -0.000066 -1.000000 0.000000
+vn -0.000066 -1.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 0.000059 1.000000 0.000000
+vn 0.000059 1.000000 0.000000
+vn 0.000059 1.000000 0.000000
+vn 0.000059 1.000000 0.000000
+vn 0.000059 1.000000 0.000000
+vn 0.000059 1.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.707107 0.000000 0.707107
+vn -0.408248 -0.816497 0.408248
+vn -0.408248 -0.816497 0.408248
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.848288 0.094287 0.521073
+vn -0.408248 -0.816497 0.408248
+vn -0.408248 -0.816497 0.408248
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.697855 -0.278214 0.659996
+vn -0.729775 -0.184172 0.658414
+vn -0.500383 -0.186140 0.845558
+vn -0.500383 -0.186140 0.845558
+vn -0.385052 -0.283448 0.878289
+vn -0.697855 -0.278214 0.659996
+vn -0.717794 -0.138636 0.682314
+vn -0.697855 -0.278214 0.659996
+vn -0.385052 -0.283448 0.878289
+vn -0.385052 -0.283448 0.878289
+vn -0.395860 -0.139986 0.907578
+vn -0.717794 -0.138636 0.682314
+vn -0.395860 -0.139986 0.907578
+vn -0.385052 -0.283448 0.878289
+vn -0.199130 -0.258182 0.945351
+vn -0.199130 -0.258182 0.945351
+vn -0.203968 -0.111570 0.972599
+vn -0.395860 -0.139986 0.907578
+vn -0.887014 -0.272466 0.372784
+vn -0.866273 -0.187057 0.463228
+vn -0.729775 -0.184172 0.658414
+vn -0.729775 -0.184172 0.658414
+vn -0.697855 -0.278214 0.659996
+vn -0.887014 -0.272466 0.372784
+vn -0.914247 -0.137638 0.381063
+vn -0.887014 -0.272466 0.372784
+vn -0.697855 -0.278214 0.659996
+vn -0.697855 -0.278214 0.659996
+vn -0.717794 -0.138636 0.682314
+vn -0.914247 -0.137638 0.381063
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.552780 0.000003 0.833327
+vn -0.375617 0.000007 0.926775
+vn -0.375614 0.463375 0.802619
+vn -0.375614 0.463375 0.802619
+vn -0.711778 0.351190 0.608307
+vn -0.552780 0.000003 0.833327
+vn -0.990580 -0.057648 -0.124209
+vn -0.990580 -0.078748 -0.112029
+vn -0.990580 -0.012183 -0.136392
+vn -0.990580 -0.012183 -0.136392
+vn -0.990580 0.012183 -0.136393
+vn -0.990580 -0.057648 -0.124209
+vn -0.990580 0.012183 -0.136393
+vn -0.990580 -0.012183 -0.136392
+vn -0.990580 0.057647 -0.124213
+vn -0.990580 0.057647 -0.124213
+vn -0.990579 0.078747 -0.112032
+vn -0.990580 0.012183 -0.136393
+vn -0.990579 0.078747 -0.112032
+vn -0.990580 0.057647 -0.124213
+vn -0.990653 0.118130 -0.068203
+vn -0.990653 0.118130 -0.068203
+vn -0.990653 0.118131 -0.068204
+vn -0.990579 0.078747 -0.112032
+vn -0.990653 0.136406 0.000000
+vn -0.990653 0.118131 -0.068204
+vn -0.990653 0.118130 -0.068203
+vn -0.990653 0.118130 -0.068203
+vn -0.990653 0.136405 0.000001
+vn -0.990653 0.136406 0.000000
+vn -0.990653 0.136406 0.000000
+vn -0.990653 0.136405 0.000001
+vn -0.990580 0.124213 0.057647
+vn -0.990580 0.124213 0.057647
+vn -0.990579 0.112031 0.078751
+vn -0.990653 0.136406 0.000000
+vn -0.990579 0.112031 0.078751
+vn -0.990580 0.124213 0.057647
+vn -0.990579 0.078748 0.112033
+vn -0.990579 0.078748 0.112033
+vn -0.990580 0.057648 0.124213
+vn -0.990579 0.112031 0.078751
+vn -0.990580 0.057648 0.124213
+vn -0.990579 0.078748 0.112033
+vn -0.990580 0.012182 0.136394
+vn -0.990580 0.012182 0.136394
+vn -0.990580 -0.012183 0.136394
+vn -0.990580 0.057648 0.124213
+vn -0.990580 -0.012183 0.136394
+vn -0.990580 0.012182 0.136394
+vn -0.990580 -0.057647 0.124212
+vn -0.990580 -0.057647 0.124212
+vn -0.990580 -0.078746 0.112029
+vn -0.990580 -0.012183 0.136394
+vn -0.990580 -0.078746 0.112029
+vn -0.990580 -0.057647 0.124212
+vn -0.990580 -0.112030 0.078745
+vn -0.990580 -0.112030 0.078745
+vn -0.990580 -0.124214 0.057645
+vn -0.990580 -0.078746 0.112029
+vn -0.990580 -0.124214 0.057645
+vn -0.990580 -0.112030 0.078745
+vn -0.990580 -0.136395 0.012183
+vn -0.990580 -0.136395 0.012183
+vn -0.990580 -0.136394 -0.012180
+vn -0.990580 -0.124214 0.057645
+vn -0.990580 -0.136394 -0.012180
+vn -0.990580 -0.136395 0.012183
+vn -0.990580 -0.124212 -0.057646
+vn -0.990580 -0.124212 -0.057646
+vn -0.990580 -0.112030 -0.078748
+vn -0.990580 -0.136394 -0.012180
+vn -0.894127 0.000000 0.447813
+vn -0.552780 0.000003 0.833327
+vn -0.711778 0.351190 0.608307
+vn -0.711778 0.351190 0.608307
+vn -0.941313 0.168761 0.292318
+vn -0.894127 0.000000 0.447813
+vn -0.894127 0.000000 0.447813
+vn -0.919306 -0.209306 0.333267
+vn -0.635871 -0.400458 0.659774
+vn -0.635871 -0.400458 0.659774
+vn -0.552780 0.000003 0.833327
+vn -0.894127 0.000000 0.447813
+vn -0.919310 -0.183937 -0.347902
+vn -0.919313 0.014636 -0.393256
+vn -0.635850 0.016919 -0.771627
+vn -0.635850 0.016919 -0.771627
+vn -0.635848 -0.371168 -0.676707
+vn -0.919310 -0.183937 -0.347902
+vn -0.919313 0.014636 -0.393256
+vn -0.919312 0.209302 -0.333254
+vn -0.635837 0.400454 -0.659808
+vn -0.635837 0.400454 -0.659808
+vn -0.635850 0.016919 -0.771627
+vn -0.919313 0.014636 -0.393256
+vn -0.993596 0.000000 0.112994
+vn -0.988595 0.075286 0.130428
+vn -0.990694 0.111365 0.078253
+vn -0.990694 0.111365 0.078253
+vn -0.990692 0.135582 0.012110
+vn -0.993596 0.000000 0.112994
+vn -0.993596 0.000000 0.112994
+vn -0.990692 0.135582 0.012110
+vn -0.993546 0.102893 -0.047737
+vn -0.993546 0.102893 -0.047737
+vn -0.993545 -0.065225 0.092812
+vn -0.993596 0.000000 0.112994
+vn -0.993545 -0.065225 0.092812
+vn -0.993546 0.102893 -0.047737
+vn -0.993544 0.065233 -0.092813
+vn -0.993544 0.065233 -0.092813
+vn -0.993546 -0.102889 0.047744
+vn -0.993545 -0.065225 0.092812
+vn -0.993546 -0.102889 0.047744
+vn -0.993544 0.065233 -0.092813
+vn -0.993545 0.010092 -0.112988
+vn -0.993545 0.010092 -0.112988
+vn -0.993545 -0.112987 -0.010091
+vn -0.993546 -0.102889 0.047744
+vn -0.993545 -0.112987 -0.010091
+vn -0.993545 0.010092 -0.112988
+vn -0.990693 -0.057297 -0.123470
+vn -0.990693 -0.057297 -0.123470
+vn -0.985454 -0.139028 -0.097729
+vn -0.993545 -0.112987 -0.010091
+vn 0.993545 0.112985 -0.010093
+vn 0.985459 0.154136 0.071505
+vn 0.988597 0.075286 0.130412
+vn 0.988597 0.075286 0.130412
+vn 0.995911 0.000000 0.090344
+vn 0.993545 0.112985 -0.010093
+vn 0.993547 0.092802 -0.065213
+vn 0.993545 0.112985 -0.010093
+vn 0.995911 0.000000 0.090344
+vn 0.995911 0.000000 0.090344
+vn 0.993547 -0.047744 0.102887
+vn 0.993547 0.092802 -0.065213
+vn 0.993546 0.047747 -0.102891
+vn 0.993547 0.092802 -0.065213
+vn 0.993547 -0.047744 0.102887
+vn 0.993547 -0.047744 0.102887
+vn 0.993547 -0.092790 0.065223
+vn 0.993546 0.047747 -0.102891
+vn 0.995265 -0.008647 -0.096813
+vn 0.993546 0.047747 -0.102891
+vn 0.993547 -0.092790 0.065223
+vn 0.993547 -0.092790 0.065223
+vn 0.990696 -0.135556 0.012105
+vn 0.995265 -0.008647 -0.096813
+vn 0.990697 -0.123441 -0.057286
+vn 0.985455 -0.097713 -0.139034
+vn 0.995265 -0.008647 -0.096813
+vn 0.995265 -0.008647 -0.096813
+vn 0.990696 -0.135556 0.012105
+vn 0.990697 -0.123441 -0.057286
+vn 0.711779 0.000000 0.702403
+vn 0.941321 0.000000 0.337514
+vn 0.894128 0.223900 0.387819
+vn 0.894128 0.223900 0.387819
+vn 0.552770 0.416654 0.721696
+vn 0.711779 0.000000 0.702403
+vn 0.711779 0.000000 0.702403
+vn 0.635844 -0.371168 0.676710
+vn 0.919316 -0.183932 0.347890
+vn 0.919316 -0.183932 0.347890
+vn 0.941321 0.000000 0.337514
+vn 0.711779 0.000000 0.702403
+vn 0.635869 -0.400458 -0.659776
+vn 0.635851 -0.016917 -0.771626
+vn 0.919318 -0.014637 -0.393244
+vn 0.919318 -0.014637 -0.393244
+vn 0.919310 -0.209306 -0.333256
+vn 0.635869 -0.400458 -0.659776
+vn 0.635851 -0.016917 -0.771626
+vn 0.635844 0.371156 -0.676717
+vn 0.919315 0.183940 -0.347888
+vn 0.919315 0.183940 -0.347888
+vn 0.919318 -0.014637 -0.393244
+vn 0.635851 -0.016917 -0.771626
+vn 0.375619 0.000004 0.926774
+vn 0.711779 0.000000 0.702403
+vn 0.552770 0.416654 0.721696
+vn 0.552770 0.416654 0.721696
+vn 0.375622 0.463380 0.802613
+vn 0.375619 0.000004 0.926774
+vn 0.990580 -0.057648 -0.124210
+vn 0.990580 0.012183 -0.136395
+vn 0.990580 -0.012183 -0.136394
+vn 0.990580 -0.012183 -0.136394
+vn 0.990580 -0.078748 -0.112030
+vn 0.990580 -0.057648 -0.124210
+vn 0.990580 0.012183 -0.136395
+vn 0.990579 0.078748 -0.112033
+vn 0.990579 0.057648 -0.124214
+vn 0.990579 0.057648 -0.124214
+vn 0.990580 -0.012183 -0.136394
+vn 0.990580 0.012183 -0.136395
+vn 0.990579 0.078748 -0.112033
+vn 0.990653 0.118133 -0.068205
+vn 0.990653 0.118132 -0.068203
+vn 0.990653 0.118132 -0.068203
+vn 0.990579 0.057648 -0.124214
+vn 0.990579 0.078748 -0.112033
+vn 0.990653 0.136408 0.000000
+vn 0.990653 0.136407 0.000001
+vn 0.990653 0.118132 -0.068203
+vn 0.990653 0.118132 -0.068203
+vn 0.990653 0.118133 -0.068205
+vn 0.990653 0.136408 0.000000
+vn 0.990653 0.136408 0.000000
+vn 0.990579 0.112032 0.078752
+vn 0.990579 0.124214 0.057648
+vn 0.990579 0.124214 0.057648
+vn 0.990653 0.136407 0.000001
+vn 0.990653 0.136408 0.000000
+vn 0.990579 0.112032 0.078752
+vn 0.990579 0.057649 0.124214
+vn 0.990579 0.078749 0.112034
+vn 0.990579 0.078749 0.112034
+vn 0.990579 0.124214 0.057648
+vn 0.990579 0.112032 0.078752
+vn 0.990579 0.057649 0.124214
+vn 0.990580 -0.012183 0.136395
+vn 0.990580 0.012182 0.136395
+vn 0.990580 0.012182 0.136395
+vn 0.990579 0.078749 0.112034
+vn 0.990579 0.057649 0.124214
+vn 0.990580 -0.012183 0.136395
+vn 0.990580 -0.078747 0.112030
+vn 0.990580 -0.057647 0.124213
+vn 0.990580 -0.057647 0.124213
+vn 0.990580 0.012182 0.136395
+vn 0.990580 -0.012183 0.136395
+vn 0.990580 -0.078747 0.112030
+vn 0.990579 -0.124215 0.057645
+vn 0.990580 -0.112031 0.078746
+vn 0.990580 -0.112031 0.078746
+vn 0.990580 -0.057647 0.124213
+vn 0.990580 -0.078747 0.112030
+vn 0.990579 -0.124215 0.057645
+vn 0.990580 -0.136395 -0.012180
+vn 0.990579 -0.136396 0.012184
+vn 0.990579 -0.136396 0.012184
+vn 0.990580 -0.112031 0.078746
+vn 0.990579 -0.124215 0.057645
+vn 0.990580 -0.136395 -0.012180
+vn 0.990579 -0.112031 -0.078748
+vn 0.990580 -0.124213 -0.057647
+vn 0.990580 -0.124213 -0.057647
+vn 0.990579 -0.136396 0.012184
+vn 0.990580 -0.136395 -0.012180
+vn -0.950406 0.130926 0.282110
+vn -0.947510 0.082751 0.308832
+vn -0.895153 0.115372 0.430571
+vn -0.895153 0.115372 0.430571
+vn -0.869389 0.233353 0.435557
+vn -0.950406 0.130926 0.282110
+vn -0.869389 0.233353 0.435557
+vn -0.895153 0.115372 0.430571
+vn -0.624264 0.202197 0.754593
+vn -0.624264 0.202197 0.754593
+vn -0.571901 0.399645 0.716389
+vn -0.869389 0.233353 0.435557
+vn 0.571894 0.420587 0.704303
+vn 0.489242 0.225733 0.842429
+vn 0.861981 0.131208 0.489666
+vn 0.861981 0.131208 0.489666
+vn 0.868652 0.284895 0.405313
+vn 0.571894 0.420587 0.704303
+vn 0.950407 0.130925 0.282108
+vn 0.868652 0.284895 0.405313
+vn 0.861981 0.131208 0.489666
+vn 0.861981 0.131208 0.489666
+vn 0.947510 0.082753 0.308832
+vn 0.950407 0.130925 0.282108
+vn -0.950403 0.309787 0.027667
+vn -0.950405 0.254446 0.178853
+vn -0.869389 0.419868 0.260524
+vn -0.869389 0.419868 0.260524
+vn -0.869390 0.493877 0.015687
+vn -0.950403 0.309787 0.027667
+vn -0.869390 0.493877 0.015687
+vn -0.869389 0.419868 0.260524
+vn -0.571889 0.704307 0.420587
+vn -0.571889 0.704307 0.420587
+vn -0.571892 0.820240 0.012091
+vn -0.869390 0.493877 0.015687
+vn 0.571893 0.820239 -0.012092
+vn 0.571883 0.716398 0.399655
+vn 0.868654 0.449383 0.208554
+vn 0.868654 0.449383 0.208554
+vn 0.868653 0.493456 -0.044071
+vn 0.571893 0.820239 -0.012092
+vn 0.950404 0.309784 0.027667
+vn 0.868653 0.493456 -0.044071
+vn 0.868654 0.449383 0.208554
+vn 0.868654 0.449383 0.208554
+vn 0.950406 0.254443 0.178851
+vn 0.950404 0.309784 0.027667
+vn -0.947510 -0.226082 -0.226079
+vn -0.950408 -0.130927 -0.282106
+vn -0.869388 -0.233356 -0.435556
+vn -0.869388 -0.233356 -0.435556
+vn -0.824631 -0.399988 -0.399991
+vn -0.947510 -0.226082 -0.226079
+vn -0.950408 -0.130927 -0.282106
+vn -0.950408 0.027668 -0.309772
+vn -0.869392 0.015691 -0.493874
+vn -0.869392 0.015691 -0.493874
+vn -0.869388 -0.233356 -0.435556
+vn -0.950408 -0.130927 -0.282106
+vn 0.947509 -0.226083 -0.226081
+vn 0.861982 -0.358460 -0.358460
+vn 0.868649 -0.284900 -0.405315
+vn 0.868649 -0.284900 -0.405315
+vn 0.950408 -0.130927 -0.282106
+vn 0.947509 -0.226083 -0.226081
+vn 0.950408 -0.130927 -0.282106
+vn 0.868649 -0.284900 -0.405315
+vn 0.868654 -0.044075 -0.493455
+vn 0.868654 -0.044075 -0.493455
+vn 0.950409 0.027668 -0.309770
+vn 0.950408 -0.130927 -0.282106
+vn 0.950409 0.027668 -0.309770
+vn 0.868654 -0.044075 -0.493455
+vn 0.868651 0.208561 -0.449385
+vn 0.868651 0.208561 -0.449385
+vn 0.950407 0.178846 -0.254441
+vn 0.950409 0.027668 -0.309770
+vn 0.950405 0.282113 -0.130927
+vn 0.868652 0.405310 -0.284901
+vn 0.868653 0.493456 -0.044071
+vn 0.868653 0.493456 -0.044071
+vn 0.950404 0.309784 0.027667
+vn 0.950405 0.282113 -0.130927
+vn 0.571898 0.704302 -0.420585
+vn 0.571893 0.820239 -0.012092
+vn 0.868653 0.493456 -0.044071
+vn 0.868653 0.493456 -0.044071
+vn 0.868652 0.405310 -0.284901
+vn 0.571898 0.704302 -0.420585
+vn -0.869391 0.435553 -0.233350
+vn -0.869390 0.493877 0.015687
+vn -0.571892 0.820240 0.012091
+vn -0.571892 0.820240 0.012091
+vn -0.571884 0.716396 -0.399656
+vn -0.869391 0.435553 -0.233350
+vn -0.950408 0.027668 -0.309772
+vn -0.950406 0.178847 -0.254445
+vn -0.869388 0.260524 -0.419872
+vn -0.869388 0.260524 -0.419872
+vn -0.869392 0.015691 -0.493874
+vn -0.950408 0.027668 -0.309772
+vn -0.950404 0.282116 -0.130929
+vn -0.950403 0.309787 0.027667
+vn -0.869390 0.493877 0.015687
+vn -0.869390 0.493877 0.015687
+vn -0.869391 0.435553 -0.233350
+vn -0.950404 0.282116 -0.130929
+vn 0.985852 0.166953 -0.014911
+vn 0.968059 0.227428 0.105538
+vn 0.974949 0.111202 0.192636
+vn 0.974949 0.111202 0.192636
+vn 0.991056 -0.000000 0.133449
+vn 0.985852 0.166953 -0.014911
+vn 0.885421 -0.000000 0.464789
+vn 0.991056 -0.000000 0.133449
+vn 0.974949 0.111202 0.192636
+vn 0.974949 0.111202 0.192636
+vn 0.804826 0.296732 0.514010
+vn 0.885421 -0.000000 0.464789
+vn 0.885421 -0.000000 0.464789
+vn 0.847543 -0.250540 0.467868
+vn 0.985851 -0.070557 0.152049
+vn 0.985851 -0.070557 0.152049
+vn 0.991056 -0.000000 0.133449
+vn 0.885421 -0.000000 0.464789
+vn 0.985853 0.137127 -0.096386
+vn 0.985852 0.166953 -0.014911
+vn 0.991056 -0.000000 0.133449
+vn 0.991056 -0.000000 0.133449
+vn 0.985851 -0.070557 0.152049
+vn 0.985853 0.137127 -0.096386
+vn 0.985851 0.070557 -0.152049
+vn 0.985853 0.137127 -0.096386
+vn 0.985851 -0.070557 0.152049
+vn 0.985851 -0.070557 0.152049
+vn 0.985852 -0.137134 0.096386
+vn 0.985851 0.070557 -0.152049
+vn 0.989636 -0.012774 -0.143028
+vn 0.985851 0.070557 -0.152049
+vn 0.985852 -0.137134 0.096386
+vn 0.985852 -0.137134 0.096386
+vn 0.979568 -0.200315 0.017889
+vn 0.989636 -0.012774 -0.143028
+vn 0.979572 -0.182413 -0.084647
+vn 0.968051 -0.144189 -0.205151
+vn 0.989636 -0.012774 -0.143028
+vn 0.989636 -0.012774 -0.143028
+vn 0.979568 -0.200315 0.017889
+vn 0.979572 -0.182413 -0.084647
+vn 0.847547 -0.279896 -0.450913
+vn 0.847546 -0.016951 -0.530451
+vn 0.989636 -0.012774 -0.143028
+vn 0.989636 -0.012774 -0.143028
+vn 0.968051 -0.144189 -0.205151
+vn 0.847547 -0.279896 -0.450913
+vn 0.847546 -0.016951 -0.530451
+vn 0.847545 0.250523 -0.467873
+vn 0.985851 0.070557 -0.152049
+vn 0.985851 0.070557 -0.152049
+vn 0.989636 -0.012774 -0.143028
+vn 0.847546 -0.016951 -0.530451
+vn 0.576377 -0.000000 0.817184
+vn 0.885421 -0.000000 0.464789
+vn 0.804826 0.296732 0.514010
+vn 0.804826 0.296732 0.514010
+vn 0.422312 0.453196 0.785026
+vn 0.576377 -0.000000 0.817184
+vn 0.576377 -0.000000 0.817184
+vn 0.501504 -0.422652 0.754890
+vn 0.847543 -0.250540 0.467868
+vn 0.847543 -0.250540 0.467868
+vn 0.885421 -0.000000 0.464789
+vn 0.576377 -0.000000 0.817184
+vn 0.501497 -0.442395 -0.743496
+vn 0.501503 -0.011401 -0.865081
+vn 0.847546 -0.016951 -0.530451
+vn 0.847546 -0.016951 -0.530451
+vn 0.847547 -0.279896 -0.450913
+vn 0.501497 -0.442395 -0.743496
+vn 0.257461 -0.406778 -0.876496
+vn 0.257463 0.085958 -0.962457
+vn 0.501503 -0.011401 -0.865081
+vn 0.501503 -0.011401 -0.865081
+vn 0.501497 -0.442395 -0.743496
+vn 0.257461 -0.406778 -0.876496
+vn 0.257463 0.085958 -0.962457
+vn 0.257471 0.555638 -0.790554
+vn 0.501508 0.422630 -0.754900
+vn 0.501508 0.422630 -0.754900
+vn 0.501503 -0.011401 -0.865081
+vn 0.257463 0.085958 -0.962457
+vn 0.944936 0.000001 -0.327255
+vn 0.944936 0.000003 -0.327255
+vn 0.944935 -0.163626 -0.283414
+vn 0.944935 -0.163626 -0.283414
+vn 0.944935 -0.163628 -0.283414
+vn 0.944936 0.000001 -0.327255
+vn 0.944936 0.000001 -0.327255
+vn 0.944532 0.188860 -0.268683
+vn 0.944533 0.138254 -0.297899
+vn 0.944533 0.138254 -0.297899
+vn 0.944936 0.000003 -0.327255
+vn 0.944936 0.000001 -0.327255
+vn 0.944533 0.138256 0.297897
+vn 0.944532 -0.029216 0.327117
+vn 0.944532 0.029217 0.327116
+vn 0.944532 0.029217 0.327116
+vn 0.944532 0.188861 0.268682
+vn 0.944533 0.138256 0.297897
+vn 0.944532 -0.029216 0.327117
+vn 0.944532 -0.188858 0.268685
+vn 0.944532 -0.138252 0.297901
+vn 0.944532 -0.138252 0.297901
+vn 0.944532 0.029217 0.327116
+vn 0.944532 -0.029216 0.327117
+vn 0.313732 -0.399715 -0.861278
+vn 0.313725 0.084474 -0.945749
+vn 0.313728 -0.084471 -0.945748
+vn 0.313728 -0.084471 -0.945748
+vn 0.313745 -0.546018 -0.776807
+vn 0.313732 -0.399715 -0.861278
+vn 0.313725 0.084474 -0.945749
+vn 0.313734 0.546024 -0.776807
+vn 0.313721 0.399726 -0.861277
+vn 0.313721 0.399726 -0.861277
+vn 0.313728 -0.084471 -0.945748
+vn 0.313725 0.084474 -0.945749
+vn 0.313724 -0.084465 0.945750
+vn 0.313743 -0.546015 0.776810
+vn 0.313727 -0.399713 0.861281
+vn 0.313727 -0.399713 0.861281
+vn 0.313721 0.084469 0.945750
+vn 0.313724 -0.084465 0.945750
+vn -0.495828 -0.868401 -0.005885
+vn -0.495825 -0.749119 -0.439293
+vn -0.253209 -0.836488 -0.485977
+vn -0.253209 -0.836488 -0.485977
+vn -0.253207 -0.967409 -0.002630
+vn -0.495828 -0.868401 -0.005885
+vn 0.253208 -0.967408 0.002630
+vn 0.253202 -0.839114 -0.481431
+vn 0.512772 -0.760719 -0.397958
+vn 0.512772 -0.760719 -0.397958
+vn 0.494350 -0.865817 0.077326
+vn 0.253208 -0.967408 0.002630
+vn 0.609529 0.333728 0.719097
+vn 0.609522 0.455887 0.648575
+vn 0.555150 -0.008788 0.831704
+vn 0.555150 -0.008788 0.831704
+vn 0.609528 -0.070528 0.789621
+vn 0.609529 0.333728 0.719097
+vn 0.359112 -0.241557 0.901493
+vn 0.309938 -0.582026 0.751787
+vn 0.494353 -0.365936 0.788483
+vn 0.494353 -0.365936 0.788483
+vn 0.555150 -0.008788 0.831704
+vn 0.359112 -0.241557 0.901493
+vn 0.609528 -0.070528 0.789621
+vn 0.555150 -0.008788 0.831704
+vn 0.494353 -0.365936 0.788483
+vn 0.494353 -0.365936 0.788483
+vn 0.609525 -0.455884 0.648574
+vn 0.609528 -0.070528 0.789621
+vn 0.309938 -0.582026 0.751787
+vn 0.253206 -0.836489 0.485977
+vn 0.494352 -0.711151 0.499881
+vn 0.494352 -0.711151 0.499881
+vn 0.494353 -0.365936 0.788483
+vn 0.309938 -0.582026 0.751787
+vn 0.253206 -0.836489 0.485977
+vn 0.253208 -0.967408 0.002630
+vn 0.494350 -0.865817 0.077326
+vn 0.494350 -0.865817 0.077326
+vn 0.494352 -0.711151 0.499881
+vn 0.253206 -0.836489 0.485977
+vn 0.609520 -0.719103 0.333731
+vn 0.494352 -0.711151 0.499881
+vn 0.494350 -0.865817 0.077326
+vn 0.494350 -0.865817 0.077326
+vn 0.609517 -0.789630 -0.070523
+vn 0.609520 -0.719103 0.333731
+vn 0.611050 -0.395792 -0.685542
+vn 0.470717 -0.483754 -0.737840
+vn 0.494351 -0.077332 -0.865816
+vn 0.494351 -0.077332 -0.865816
+vn 0.609535 0.070523 -0.789616
+vn 0.611050 -0.395792 -0.685542
+vn 0.253205 -0.485976 -0.836490
+vn 0.253206 -0.002627 -0.967409
+vn 0.494351 -0.077332 -0.865816
+vn 0.494351 -0.077332 -0.865816
+vn 0.470717 -0.483754 -0.737840
+vn 0.253205 -0.485976 -0.836490
+vn 0.609535 0.070523 -0.789616
+vn 0.494351 -0.077332 -0.865816
+vn 0.494350 0.365937 -0.788485
+vn 0.494350 0.365937 -0.788485
+vn 0.609521 0.455887 -0.648576
+vn 0.609535 0.070523 -0.789616
+vn 0.253206 -0.002627 -0.967409
+vn 0.253211 0.481425 -0.839115
+vn 0.494350 0.365937 -0.788485
+vn 0.494350 0.365937 -0.788485
+vn 0.494351 -0.077332 -0.865816
+vn 0.253206 -0.002627 -0.967409
+vn -0.492000 -0.124204 0.861690
+vn -0.495831 -0.439293 0.749115
+vn -0.276655 -0.528532 0.802568
+vn -0.276655 -0.528532 0.802568
+vn -0.359111 -0.241557 0.901493
+vn -0.492000 -0.124204 0.861690
+vn -0.495831 -0.439293 0.749115
+vn -0.495831 -0.754999 0.429102
+vn -0.253204 -0.839114 0.481430
+vn -0.253204 -0.839114 0.481430
+vn -0.276655 -0.528532 0.802568
+vn -0.495831 -0.439293 0.749115
+vn -0.495831 -0.754999 0.429102
+vn -0.495828 -0.868401 -0.005885
+vn -0.253207 -0.967409 -0.002630
+vn -0.253207 -0.967409 -0.002630
+vn -0.253204 -0.839114 0.481430
+vn -0.495831 -0.754999 0.429102
+vn -0.495823 -0.429103 -0.755003
+vn -0.495828 0.005883 -0.868401
+vn -0.253205 0.002624 -0.967409
+vn -0.253205 0.002624 -0.967409
+vn -0.253215 -0.481421 -0.839116
+vn -0.495823 -0.429103 -0.755003
+vn -0.495828 0.005883 -0.868401
+vn -0.495833 0.439294 -0.749114
+vn -0.253204 0.485976 -0.836490
+vn -0.253204 0.485976 -0.836490
+vn -0.253205 0.002624 -0.967409
+vn -0.495828 0.005883 -0.868401
+vn -0.611052 -0.000002 0.791590
+vn -0.492000 -0.124204 0.861690
+vn -0.611048 0.395794 0.685542
+vn -0.611048 0.395794 0.685542
+vn -0.611054 0.395787 0.685541
+vn -0.611052 -0.000002 0.791590
+vn -0.611052 -0.000002 0.791590
+vn -0.609527 -0.455884 0.648573
+vn -0.495831 -0.439293 0.749115
+vn -0.495831 -0.439293 0.749115
+vn -0.492000 -0.124204 0.861690
+vn -0.611052 -0.000002 0.791590
+vn -0.609522 -0.719101 0.333731
+vn -0.609519 -0.789628 -0.070523
+vn -0.495828 -0.868401 -0.005885
+vn -0.495828 -0.868401 -0.005885
+vn -0.495831 -0.754999 0.429102
+vn -0.609522 -0.719101 0.333731
+vn -0.609538 -0.333723 -0.719092
+vn -0.609538 0.070523 -0.789614
+vn -0.495828 0.005883 -0.868401
+vn -0.495828 0.005883 -0.868401
+vn -0.495823 -0.429103 -0.755003
+vn -0.609538 -0.333723 -0.719092
+vn -0.609538 0.070523 -0.789614
+vn -0.609523 0.455886 -0.648575
+vn -0.495833 0.439294 -0.749114
+vn -0.495833 0.439294 -0.749114
+vn -0.495828 0.005883 -0.868401
+vn -0.609538 0.070523 -0.789614
+vn -0.314854 0.000001 -0.949140
+vn -0.314852 0.000002 -0.949141
+vn -0.314867 -0.474562 -0.821979
+vn -0.314867 -0.474562 -0.821979
+vn -0.314863 -0.474567 -0.821978
+vn -0.314854 0.000001 -0.949140
+vn -0.314854 0.000001 -0.949140
+vn -0.313737 0.546023 -0.776806
+vn -0.313723 0.399718 -0.861280
+vn -0.313723 0.399718 -0.861280
+vn -0.314852 0.000002 -0.949141
+vn -0.314854 0.000001 -0.949140
+vn -0.313726 -0.084468 0.945749
+vn -0.313746 -0.546014 0.776809
+vn -0.313729 -0.399706 0.861283
+vn -0.313729 -0.399706 0.861283
+vn -0.313723 0.084469 0.945750
+vn -0.313726 -0.084468 0.945749
+vn -0.944936 0.000001 -0.327256
+vn -0.944936 0.000000 -0.327255
+vn -0.944935 -0.163626 -0.283415
+vn -0.944935 -0.163626 -0.283415
+vn -0.944935 -0.163624 -0.283416
+vn -0.944936 0.000001 -0.327256
+vn -0.944936 0.000001 -0.327256
+vn -0.944532 0.188860 -0.268684
+vn -0.944533 0.138256 -0.297898
+vn -0.944533 0.138256 -0.297898
+vn -0.944936 0.000000 -0.327255
+vn -0.944936 0.000001 -0.327256
+vn -0.944533 0.138252 0.297900
+vn -0.944532 -0.029214 0.327117
+vn -0.944532 0.029218 0.327117
+vn -0.944532 0.029218 0.327117
+vn -0.944533 0.188858 0.268682
+vn -0.944533 0.138252 0.297900
+vn -0.944532 -0.029214 0.327117
+vn -0.944532 -0.188859 0.268685
+vn -0.944532 -0.138253 0.297900
+vn -0.944532 -0.138253 0.297900
+vn -0.944532 0.029218 0.327117
+vn -0.944532 -0.029214 0.327117
+vn -0.501504 0.011393 -0.865080
+vn -0.501504 0.442382 -0.743500
+vn -0.257479 0.406771 -0.876494
+vn -0.257479 0.406771 -0.876494
+vn -0.257464 -0.085973 -0.962456
+vn -0.501504 0.011393 -0.865080
+vn -0.804832 -0.000000 0.593503
+vn -0.422313 -0.000003 0.906450
+vn -0.576382 0.408556 0.707718
+vn -0.576382 0.408556 0.707718
+vn -0.885418 0.232376 0.402537
+vn -0.804832 -0.000000 0.593503
+vn -0.804832 -0.000000 0.593503
+vn -0.847546 -0.279898 0.450914
+vn -0.501501 -0.442400 0.743491
+vn -0.501501 -0.442400 0.743491
+vn -0.422313 -0.000003 0.906450
+vn -0.804832 -0.000000 0.593503
+vn -0.847546 0.016951 -0.530451
+vn -0.847545 0.279881 -0.450925
+vn -0.501504 0.442382 -0.743500
+vn -0.501504 0.442382 -0.743500
+vn -0.501504 0.011393 -0.865080
+vn -0.847546 0.016951 -0.530451
+vn -0.985961 -0.000000 0.166975
+vn -0.804832 -0.000000 0.593503
+vn -0.885418 0.232376 0.402537
+vn -0.885418 0.232376 0.402537
+vn -0.974949 0.111197 0.192637
+vn -0.985961 -0.000000 0.166975
+vn -0.985961 -0.000000 0.166975
+vn -0.985850 -0.096387 0.137144
+vn -0.847546 -0.279898 0.450914
+vn -0.847546 -0.279898 0.450914
+vn -0.804832 -0.000000 0.593503
+vn -0.985961 -0.000000 0.166975
+vn -0.979570 -0.084649 -0.182418
+vn -0.985851 0.014911 -0.166957
+vn -0.847546 0.016951 -0.530451
+vn -0.847546 0.016951 -0.530451
+vn -0.847543 -0.250540 -0.467868
+vn -0.979570 -0.084649 -0.182418
+vn -0.985851 0.014911 -0.166957
+vn -0.985851 0.096382 -0.137141
+vn -0.847545 0.279881 -0.450925
+vn -0.847545 0.279881 -0.450925
+vn -0.847546 0.016951 -0.530451
+vn -0.985851 0.014911 -0.166957
+vn -0.985961 -0.000000 0.166975
+vn -0.974949 0.111197 0.192637
+vn -0.979573 0.164513 0.115639
+vn -0.979573 0.164513 0.115639
+vn -0.979572 0.200298 0.017888
+vn -0.985961 -0.000000 0.166975
+vn -0.985961 -0.000000 0.166975
+vn -0.979572 0.200298 0.017888
+vn -0.985854 0.152034 -0.070550
+vn -0.985854 0.152034 -0.070550
+vn -0.985850 -0.096387 0.137144
+vn -0.985961 -0.000000 0.166975
+vn -0.985850 -0.096387 0.137144
+vn -0.985854 0.152034 -0.070550
+vn -0.985851 0.096382 -0.137141
+vn -0.985851 0.096382 -0.137141
+vn -0.985852 -0.152044 0.070555
+vn -0.985850 -0.096387 0.137144
+vn -0.985852 -0.152044 0.070555
+vn -0.985851 0.096382 -0.137141
+vn -0.985851 0.014911 -0.166957
+vn -0.985851 0.014911 -0.166957
+vn -0.985850 -0.166966 -0.014912
+vn -0.985852 -0.152044 0.070555
+vn -0.985850 -0.166966 -0.014912
+vn -0.985851 0.014911 -0.166957
+vn -0.979570 -0.084649 -0.182418
+vn -0.979570 -0.084649 -0.182418
+vn -0.968054 -0.205143 -0.144183
+vn -0.985850 -0.166966 -0.014912
+vn -0.004382 0.099255 0.995052
+vn -0.004381 0.099255 0.995052
+vn -0.004475 0.147666 0.989027
+vn -0.004475 0.147666 0.989027
+vn -0.004553 0.195837 0.980626
+vn -0.004382 0.099255 0.995052
+vn -0.003815 -0.127425 0.991841
+vn -0.003634 -0.184745 0.982780
+vn -0.003979 -0.069871 0.997548
+vn -0.003979 -0.069871 0.997548
+vn -0.003979 -0.069872 0.997548
+vn -0.003815 -0.127425 0.991841
+vn 0.999999 -0.000363 0.001464
+vn 0.999999 -0.000363 0.001463
+vn 0.999999 -0.000283 0.001476
+vn 0.999999 -0.000283 0.001476
+vn 0.999999 -0.000199 0.001513
+vn 0.999999 -0.000363 0.001464
+vn -0.999999 0.000366 -0.001471
+vn -0.999999 0.000200 -0.001519
+vn -0.999999 0.000285 -0.001483
+vn -0.999999 0.000285 -0.001483
+vn -0.999999 0.000366 -0.001471
+vn -0.999999 0.000366 -0.001471
+vn -0.002602 -0.450380 0.892833
+vn -0.002599 -0.450380 0.892833
+vn -0.002928 -0.375103 0.926979
+vn -0.002928 -0.375103 0.926979
+vn -0.002930 -0.375099 0.926980
+vn -0.002602 -0.450380 0.892833
+vn -0.002602 -0.450380 0.892833
+vn -0.002263 -0.522582 0.852586
+vn -0.002259 -0.522579 0.852588
+vn -0.002259 -0.522579 0.852588
+vn -0.002599 -0.450380 0.892833
+vn -0.002602 -0.450380 0.892833
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 -0.000002
+vn -1.000000 0.000000 -0.000002
+vn -1.000000 -0.000000 -0.000001
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 0.000000 -0.000003
+vn -1.000000 -0.000000 -0.000001
+vn -1.000000 0.000000 -0.000002
+vn -1.000000 0.000000 -0.000002
+vn -1.000000 0.000001 -0.000005
+vn -1.000000 0.000000 -0.000003
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 -0.000001
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000001
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn 1.000000 0.000000 -0.000001
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000001
+vn -0.999999 -0.001115 0.000212
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 0.000229 -0.000361
+vn -1.000000 0.000229 -0.000361
+vn -1.000000 -0.000000 0.000000
+vn -0.999999 -0.001115 0.000212
+vn -0.000000 -0.001069 -0.999999
+vn 0.000002 -0.002136 -0.999998
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.000000 -0.001069 -0.999999
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 -0.000230 0.000364
+vn 1.000000 0.000000 -0.000001
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000002
+vn 1.000000 0.000000 -0.000001
+vn 1.000000 0.000013 -0.000070
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 0.000013 -0.000070
+vn -0.715905 0.490013 0.497360
+vn -0.585117 0.449199 -0.675173
+s off
+usemtl Chassis
+f 1//1 2//2 3//3
+f 4//4 5//5 6//6
+f 7//7 8//8 9//9
+usemtl Window
+f 10//10 11//11 12//12
+f 13//13 14//14 15//15
+usemtl Chassis
+f 16//16 17//17 18//18
+f 19//19 17//20 20//21
+f 21//22 22//23 23//24
+f 24//25 25//26 26//27
+f 27//28 28//29 26//30
+f 29//31 30//32 31//33
+f 32//34 33//35 34//36
+f 35//37 36//38 37//39
+f 38//40 39//41 40//42
+f 40//43 41//44 38//45
+f 41//46 40//47 42//48
+f 42//49 43//50 41//51
+f 44//52 45//53 41//54
+f 41//55 43//56 44//57
+f 45//58 1//59 38//60
+f 38//61 41//62 45//63
+f 46//64 47//65 48//66
+f 48//67 49//68 46//69
+f 2//70 46//71 49//72
+f 49//73 50//74 2//75
+f 49//76 51//77 52//78
+f 52//79 50//80 49//81
+f 48//82 53//83 51//84
+f 51//85 49//86 48//87
+f 1//88 3//89 54//90
+f 54//91 38//92 1//93
+f 3//94 2//95 50//96
+f 50//97 54//98 3//99
+f 55//100 56//101 57//102
+f 57//103 58//104 55//105
+f 55//106 59//107 60//108
+f 60//109 61//110 55//111
+f 62//112 61//113 60//114
+f 60//115 63//116 62//117
+f 64//118 65//119 66//120
+f 66//121 67//122 64//123
+f 64//124 67//125 60//126
+f 60//127 59//128 64//129
+f 68//130 69//131 70//132
+f 70//133 71//134 68//135
+f 68//136 71//137 66//138
+f 66//139 65//140 68//141
+f 68//142 65//143 72//144
+f 72//145 69//146 68//147
+usemtl Hull
+f 73//148 74//149 75//150
+f 75//151 76//152 73//153
+f 77//154 78//155 79//156
+f 79//157 80//158 77//159
+f 78//160 81//161 82//162
+f 82//163 79//164 78//165
+usemtl Chassis
+f 83//166 35//167 37//168
+f 37//169 84//170 83//171
+f 85//172 83//173 84//174
+f 84//175 86//176 85//177
+f 84//178 37//179 87//180
+f 87//181 88//182 84//183
+f 89//184 86//185 84//186
+f 84//187 88//188 89//189
+f 89//190 88//191 90//192
+f 90//193 91//194 89//195
+f 88//196 87//197 92//198
+f 92//199 90//200 88//201
+f 91//202 90//203 93//204
+f 93//205 94//206 91//207
+f 90//208 92//209 95//210
+f 95//211 93//212 90//213
+f 96//214 94//215 93//216
+f 93//217 97//218 96//219
+f 93//220 95//221 98//222
+f 98//223 97//224 93//225
+f 50//226 52//227 99//228
+f 99//229 54//230 50//231
+f 54//232 99//233 39//234
+f 39//235 38//236 54//237
+s 80
+f 100//238 101//239 102//240
+f 102//240 103//241 100//238
+f 102//240 101//239 104//242
+s off
+f 104//243 105//244 102//245
+s 80
+f 6//246 106//247 101//239
+f 101//239 100//238 6//246
+f 101//239 106//247 107//248
+f 107//248 104//242 101//239
+f 5//249 108//250 106//247
+f 106//247 6//246 5//249
+f 106//247 108//250 109//251
+f 109//251 107//248 106//247
+f 108//250 110//252 111//253
+f 111//253 109//251 108//250
+f 4//254 110//252 108//250
+f 108//250 5//249 4//254
+f 110//252 112//255 113//256
+f 113//256 111//253 110//252
+f 114//257 112//255 110//252
+f 110//252 4//254 114//257
+f 112//255 115//258 116//259
+f 116//259 113//256 112//255
+f 117//260 115//258 112//255
+f 112//255 114//257 117//260
+s off
+f 118//261 119//262 120//263
+f 120//264 33//265 118//266
+f 119//267 121//268 122//269
+f 122//270 120//271 119//272
+f 119//273 123//274 124//275
+f 124//276 121//277 119//278
+f 125//279 123//280 119//281
+f 119//282 118//283 125//284
+f 125//285 118//286 126//287
+f 126//288 127//289 125//290
+f 126//291 118//292 33//293
+f 33//294 32//295 126//296
+f 121//297 128//298 129//299
+f 129//300 122//301 121//302
+f 121//303 124//304 130//305
+f 130//306 128//307 121//308
+f 128//309 131//310 132//311
+f 132//312 129//313 128//314
+f 133//315 131//316 128//317
+f 128//318 130//319 133//320
+f 134//321 135//322 136//323
+f 136//324 28//325 134//326
+f 135//327 137//328 24//329
+f 24//330 136//331 135//332
+f 135//333 31//334 30//335
+f 30//336 137//337 135//338
+f 29//339 31//340 135//341
+f 135//342 134//343 29//344
+f 29//345 134//346 138//347
+f 138//348 139//349 29//350
+f 138//351 134//352 28//353
+f 28//354 27//355 138//356
+f 137//357 140//358 25//359
+f 25//360 24//361 137//362
+f 141//363 140//364 137//365
+f 137//366 30//367 141//368
+f 7//369 142//370 143//371
+f 143//371 8//372 7//369
+f 8//372 143//371 144//373
+f 144//373 9//374 8//372
+f 143//371 145//375 146//376
+f 146//376 144//373 143//371
+f 142//370 147//377 145//375
+f 145//375 143//371 142//370
+f 148//378 149//379 150//380
+f 150//381 151//382 148//383
+f 152//384 148//383 151//382
+f 151//382 153//385 152//384
+f 151//382 150//381 147//377
+f 147//377 142//370 151//382
+f 153//385 151//382 142//370
+f 142//370 7//369 153//385
+f 9//374 144//373 154//386
+f 154//386 155//387 9//374
+f 144//373 146//376 156//388
+f 156//388 154//386 144//373
+f 154//386 156//388 157//389
+f 157//389 158//390 154//386
+f 155//387 154//386 158//390
+f 158//390 159//391 155//387
+usemtl Window
+f 160//392 161//393 12//394
+f 162//395 160//396 12//397
+f 163//398 162//399 12//400
+f 11//401 163//402 12//403
+f 164//404 165//405 166//406
+f 166//407 167//408 164//409
+f 168//410 169//411 166//412
+f 166//413 165//414 168//415
+f 169//416 170//417 171//418
+f 171//419 166//420 169//421
+f 170//422 172//423 173//424
+f 173//425 171//426 170//427
+f 174//428 173//429 175//430
+f 175//431 176//432 174//433
+f 172//434 177//435 175//436
+f 175//437 173//438 172//439
+f 11//440 164//441 167//442
+f 167//443 163//444 11//445
+f 160//446 174//447 176//448
+f 176//449 161//450 160//451
+f 168//452 178//453 170//454
+f 170//455 169//456 168//457
+f 170//458 178//459 177//460
+f 177//461 172//462 170//463
+f 15//464 180//465 179//466
+f 15//467 179//468 181//469
+f 15//470 181//471 182//472
+f 15//473 182//474 13//475
+f 183//476 184//477 185//478
+f 185//479 186//480 183//481
+f 186//482 185//483 187//484
+f 187//485 188//486 186//487
+f 189//488 13//489 182//490
+f 182//491 190//492 189//493
+f 191//494 189//495 190//496
+f 190//497 192//498 191//499
+f 193//500 191//501 192//502
+f 192//503 194//504 193//505
+f 194//506 192//507 184//508
+f 184//509 183//510 194//511
+usemtl Chassis
+f 195//512 196//513 197//514
+f 197//515 198//516 195//517
+f 196//518 199//519 200//520
+f 200//521 197//522 196//523
+f 199//524 201//525 202//526
+f 202//527 200//528 199//529
+f 201//530 203//531 204//532
+f 204//533 202//534 201//535
+f 203//536 205//537 206//538
+f 206//539 204//540 203//541
+f 205//542 207//543 208//544
+f 208//545 206//546 205//547
+f 207//548 209//549 210//550
+f 210//551 208//552 207//553
+f 209//554 211//555 212//556
+f 212//557 210//558 209//559
+f 211//560 213//561 214//562
+f 214//563 212//564 211//565
+f 213//566 215//567 216//568
+f 216//569 214//570 213//571
+usemtl Rim
+f 217//572 214//573 216//574
+f 216//575 218//576 217//577
+usemtl Chassis
+f 219//578 220//579 196//580
+f 196//581 195//582 219//583
+f 220//584 221//585 199//586
+f 199//587 196//588 220//589
+f 221//590 222//591 201//592
+f 201//593 199//594 221//595
+f 222//596 223//597 203//598
+f 203//599 201//600 222//601
+f 224//602 225//603 209//604
+f 209//605 207//606 224//607
+f 225//608 226//609 211//610
+f 211//611 209//612 225//613
+f 226//614 227//615 213//616
+f 213//617 211//618 226//619
+f 227//620 228//621 215//622
+f 215//623 213//624 227//625
+f 229//626 230//627 220//628
+f 220//629 219//630 229//631
+f 230//632 231//633 221//634
+f 221//635 220//636 230//637
+f 231//638 232//639 222//640
+f 222//641 221//642 231//643
+f 232//644 233//645 223//646
+f 223//647 222//648 232//649
+f 233//650 234//651 235//652
+f 235//653 223//654 233//655
+f 234//656 236//657 224//658
+f 224//659 235//660 234//661
+f 236//662 237//663 225//664
+f 225//665 224//666 236//667
+f 237//668 238//669 226//670
+f 226//671 225//672 237//673
+f 238//674 239//675 227//676
+f 227//677 226//678 238//679
+f 239//680 240//681 228//682
+f 228//683 227//684 239//685
+f 241//686 242//687 243//688
+f 243//689 244//690 241//691
+f 242//692 245//693 246//694
+f 246//695 243//696 242//697
+f 245//698 247//699 248//700
+f 248//701 246//702 245//703
+f 247//704 249//705 250//706
+f 250//707 248//708 247//709
+f 249//710 251//711 252//712
+f 252//713 250//714 249//715
+f 251//716 253//717 254//718
+f 254//719 252//720 251//721
+f 253//722 255//723 256//724
+f 256//725 254//726 253//727
+f 255//728 257//729 258//730
+f 258//731 256//732 255//733
+f 257//734 259//735 260//736
+f 260//737 258//738 257//739
+f 259//740 261//741 262//742
+f 262//743 260//744 259//745
+f 263//746 264//747 242//748
+f 242//749 241//750 263//751
+f 264//752 265//753 245//754
+f 245//755 242//756 264//757
+f 265//758 266//759 247//760
+f 247//761 245//762 265//763
+f 266//764 267//765 249//766
+f 249//767 247//768 266//769
+f 268//770 269//771 255//772
+f 255//773 253//774 268//775
+f 269//776 270//777 257//778
+f 257//779 255//780 269//781
+f 270//782 271//783 259//784
+f 259//785 257//786 270//787
+f 271//788 272//789 261//790
+f 261//791 259//792 271//793
+f 273//794 274//795 264//796
+f 264//797 263//798 273//799
+f 274//800 275//801 265//802
+f 265//803 264//804 274//805
+f 275//806 276//807 266//808
+f 266//809 265//810 275//811
+f 276//812 277//813 267//814
+f 267//815 266//816 276//817
+f 277//818 278//819 279//820
+f 279//821 267//822 277//823
+f 278//824 280//825 268//826
+f 268//827 279//828 278//829
+f 280//830 281//831 269//832
+f 269//833 268//834 280//835
+f 281//836 282//837 270//838
+f 270//839 269//840 281//841
+f 282//842 283//843 271//844
+f 271//845 270//846 282//847
+f 283//848 284//849 272//850
+f 272//851 271//852 283//853
+usemtl Rim
+f 285//854 286//855 284//856
+f 284//857 283//858 285//859
+usemtl Hull
+f 217//860 218//861 287//862
+f 287//863 288//864 217//865
+f 218//866 289//867 290//868
+f 290//869 287//870 218//871
+f 291//872 292//873 293//874
+f 293//875 294//876 291//877
+f 294//878 293//879 295//880
+f 295//881 296//882 294//883
+f 297//884 298//885 286//886
+f 286//887 285//888 297//889
+f 298//890 299//891 300//892
+f 300//893 286//894 298//895
+f 301//896 217//897 288//898
+f 288//899 302//900 301//901
+f 303//902 291//903 294//904
+f 294//905 304//906 303//907
+f 304//908 294//909 296//910
+f 296//911 305//912 304//913
+f 306//914 297//915 285//916
+f 285//917 307//918 306//919
+f 308//920 309//921 310//922
+f 310//923 311//924 308//925
+f 309//926 312//927 313//928
+f 313//929 310//930 309//931
+f 314//932 315//933 316//934
+f 316//935 317//936 314//937
+f 315//938 318//939 319//940
+f 319//941 316//942 315//943
+f 318//944 320//945 321//946
+f 321//947 319//948 318//949
+f 320//950 322//951 323//952
+f 323//953 321//954 320//955
+f 322//956 306//957 307//958
+f 307//959 323//960 322//961
+f 324//962 325//963 326//964
+f 326//965 327//966 324//967
+f 325//968 304//969 305//970
+f 305//971 326//972 325//973
+f 328//974 329//975 325//976
+f 325//977 324//978 328//979
+f 329//980 303//981 304//982
+f 304//983 325//984 329//985
+f 312//986 330//987 331//988
+f 331//989 313//990 312//991
+f 330//992 332//993 333//994
+f 333//995 331//996 330//997
+f 332//998 301//999 302//1000
+f 302//1001 333//1002 332//1003
+usemtl Chassis
+f 334//1004 335//1005 336//1006
+f 336//1007 337//1008 334//1009
+f 335//1010 338//1011 339//1012
+f 339//1013 336//1014 335//1015
+f 338//1016 340//1017 341//1018
+f 341//1019 339//1020 338//1021
+f 340//1022 342//1023 343//1024
+f 343//1025 341//1026 340//1027
+f 344//1028 345//1029 346//1030
+f 346//1031 347//1032 344//1033
+f 345//1034 348//1035 349//1036
+f 349//1037 346//1038 345//1039
+f 348//1040 350//1041 351//1042
+f 351//1043 349//1044 348//1045
+f 350//1046 352//1047 353//1048
+f 353//1049 351//1050 350//1051
+f 354//1052 355//1053 335//1054
+f 335//1055 334//1056 354//1057
+f 355//1058 356//1059 338//1060
+f 338//1061 335//1062 355//1063
+f 356//1064 357//1065 340//1066
+f 340//1067 338//1068 356//1069
+f 357//1070 358//1071 342//1072
+f 342//1073 340//1074 357//1075
+f 359//1076 360//1077 344//1078
+f 344//1079 361//1080 359//1081
+f 360//1082 362//1083 345//1084
+f 345//1085 344//1086 360//1087
+f 362//1088 363//1089 348//1090
+f 348//1091 345//1092 362//1093
+f 363//1094 364//1095 350//1096
+f 350//1097 348//1098 363//1099
+f 364//1100 365//1101 352//1102
+f 352//1103 350//1104 364//1105
+f 366//1106 367//1107 365//1108
+f 365//1109 368//1110 366//1111
+f 366//1112 369//1113 354//1114
+f 354//1115 367//1116 366//1117
+f 369//1118 370//1119 355//1120
+f 355//1121 354//1122 369//1123
+f 370//1124 371//1125 356//1126
+f 356//1127 355//1128 370//1129
+f 371//1130 372//1131 357//1132
+f 357//1133 356//1134 371//1135
+f 372//1136 373//1137 358//1138
+f 358//1139 357//1140 372//1141
+f 374//1142 375//1143 362//1144
+f 362//1145 360//1146 374//1147
+f 375//1148 376//1149 363//1150
+f 363//1151 362//1152 375//1153
+f 376//1154 377//1155 364//1156
+f 364//1157 363//1158 376//1159
+f 377//1160 368//1161 365//1162
+f 365//1163 364//1164 377//1165
+usemtl Rim
+f 378//1166 379//1167 370//1168
+f 370//1169 369//1170 378//1171
+f 379//1172 380//1173 371//1174
+f 371//1175 370//1176 379//1177
+f 380//1178 381//1179 372//1180
+f 372//1181 371//1182 380//1183
+f 381//1184 382//1185 373//1186
+f 373//1187 372//1188 381//1189
+usemtl Spoke
+f 383//1190 384//1191 375//1192
+f 375//1193 374//1194 383//1195
+usemtl Rim
+f 384//1196 385//1197 376//1198
+f 376//1199 375//1200 384//1201
+f 385//1202 386//1203 377//1204
+f 377//1205 376//1206 385//1207
+f 386//1208 387//1209 368//1210
+f 368//1211 377//1212 386//1213
+usemtl Hull
+f 388//1214 389//1215 379//1216
+f 379//1217 378//1218 388//1219
+f 389//1220 390//1221 380//1222
+f 380//1223 379//1224 389//1225
+f 390//1226 391//1227 381//1228
+f 381//1229 380//1230 390//1231
+f 392//1232 382//1233 381//1234
+f 381//1235 391//1236 392//1237
+f 393//1238 394//1239 384//1240
+f 384//1241 383//1242 393//1243
+f 394//1244 395//1245 385//1246
+f 385//1247 384//1248 394//1249
+f 395//1250 396//1251 386//1252
+f 386//1253 385//1254 395//1255
+f 396//1256 397//1257 387//1258
+f 387//1259 386//1260 396//1261
+usemtl Chassis
+f 398//1262 399//1263 400//1264
+f 400//1265 401//1266 398//1267
+f 399//1268 402//1269 403//1270
+f 403//1271 400//1272 399//1273
+f 401//1274 400//1275 404//1276
+f 404//1277 405//1278 401//1279
+f 400//1280 403//1281 406//1282
+f 406//1283 404//1284 400//1285
+f 405//1286 404//1287 407//1288
+f 407//1289 408//1290 405//1291
+f 404//1292 406//1293 409//1294
+f 409//1295 407//1296 404//1297
+usemtl Rim
+f 408//1298 407//1299 410//1300
+f 410//1301 411//1302 408//1303
+f 407//1304 409//1305 412//1306
+f 412//1307 410//1308 407//1309
+usemtl Hull
+f 411//1310 410//1311 413//1312
+f 413//1313 414//1314 411//1315
+f 410//1316 412//1317 415//1318
+f 415//1319 413//1320 410//1321
+f 416//1322 417//1323 418//1324
+f 418//1325 419//1326 416//1327
+f 417//1328 420//1329 421//1330
+f 421//1331 418//1332 417//1333
+f 419//1334 418//1335 422//1336
+f 422//1337 423//1338 419//1339
+f 418//1340 421//1341 424//1342
+f 424//1343 422//1344 418//1345
+f 393//1346 425//1347 426//1348
+f 426//1349 394//1350 393//1351
+f 394//1352 426//1353 427//1354
+f 427//1355 395//1356 394//1357
+f 395//1358 427//1359 428//1360
+f 428//1361 396//1362 395//1363
+f 396//1364 428//1365 429//1366
+f 429//1367 397//1368 396//1369
+f 430//1370 431//1371 432//1372
+f 432//1373 433//1374 430//1375
+f 431//1376 419//1377 423//1378
+f 423//1379 432//1380 431//1381
+f 434//1382 435//1383 431//1384
+f 431//1385 430//1386 434//1387
+f 435//1388 416//1389 419//1390
+f 419//1391 431//1392 435//1393
+f 436//1394 437//1395 438//1396
+f 438//1397 439//1398 436//1399
+f 437//1400 440//1401 441//1402
+f 441//1403 438//1404 437//1405
+f 440//1406 442//1407 443//1408
+f 443//1409 441//1410 440//1411
+f 442//1412 444//1413 445//1414
+f 445//1415 443//1416 442//1417
+f 446//1418 447//1419 448//1420
+f 448//1421 449//1422 446//1423
+f 447//1424 411//1425 414//1426
+f 414//1427 448//1428 447//1429
+f 450//1430 451//1431 437//1432
+f 437//1433 436//1434 450//1435
+f 451//1436 452//1437 440//1438
+f 440//1439 437//1440 451//1441
+f 452//1442 453//1443 442//1444
+f 442//1445 440//1446 452//1447
+f 453//1448 454//1449 444//1450
+f 444//1451 442//1452 453//1453
+usemtl Rim
+f 455//1454 456//1455 447//1456
+f 447//1457 446//1458 455//1459
+f 456//1460 408//1461 411//1462
+f 411//1463 447//1464 456//1465
+usemtl Spoke
+f 457//1466 458//1467 451//1468
+f 451//1469 450//1470 457//1471
+usemtl Rim
+f 458//1472 459//1473 452//1474
+f 452//1475 451//1476 458//1477
+f 459//1478 460//1479 453//1480
+f 453//1481 452//1482 459//1483
+f 460//1484 461//1485 454//1486
+f 454//1487 453//1488 460//1489
+usemtl Chassis
+f 462//1490 463//1491 461//1492
+f 461//1493 464//1494 462//1495
+f 462//1496 465//1497 455//1498
+f 455//1499 463//1500 462//1501
+f 465//1502 466//1503 456//1504
+f 456//1505 455//1506 465//1507
+f 466//1508 405//1509 408//1510
+f 408//1511 456//1512 466//1513
+f 406//1514 467//1515 468//1516
+f 468//1517 409//1518 406//1519
+f 469//1520 470//1521 458//1522
+f 458//1523 457//1524 469//1525
+f 470//1526 471//1527 459//1528
+f 459//1529 458//1530 470//1531
+f 471//1532 472//1533 460//1534
+f 460//1535 459//1536 471//1537
+f 472//1538 464//1539 461//1540
+f 461//1541 460//1542 472//1543
+f 473//1544 474//1545 466//1546
+f 466//1547 465//1548 473//1549
+f 474//1550 401//1551 405//1552
+f 405//1553 466//1554 474//1555
+f 403//1556 475//1557 467//1558
+f 467//1559 406//1560 403//1561
+f 476//1562 477//1563 470//1564
+f 470//1565 469//1566 476//1567
+f 477//1568 478//1569 471//1570
+f 471//1571 470//1572 477//1573
+f 478//1574 479//1575 472//1576
+f 472//1577 471//1578 478//1579
+f 479//1580 480//1581 464//1582
+f 464//1583 472//1584 479//1585
+f 481//1586 482//1587 474//1588
+f 474//1589 473//1590 481//1591
+f 482//1592 398//1593 401//1594
+f 401//1595 474//1596 482//1597
+f 483//1598 484//1599 477//1600
+f 477//1601 476//1602 483//1603
+f 484//1604 485//1605 478//1606
+f 478//1607 477//1608 484//1609
+f 485//1610 486//1611 479//1612
+f 479//1613 478//1614 485//1615
+f 486//1616 487//1617 480//1618
+f 480//1619 479//1620 486//1621
+usemtl Hull
+f 488//1622 489//1623 490//1624
+f 490//1625 491//1626 488//1627
+f 489//1628 492//1629 493//1630
+f 493//1631 490//1632 489//1633
+f 491//1634 490//1635 494//1636
+f 494//1637 495//1638 491//1639
+f 493//1640 496//1641 494//1642
+f 494//1643 490//1644 493//1645
+f 497//1646 498//1647 495//1648
+f 495//1649 494//1650 497//1651
+f 497//1652 494//1653 496//1654
+f 496//1655 499//1656 497//1657
+f 498//1658 500//1659 501//1660
+f 501//1661 495//1662 498//1663
+f 491//1664 495//1665 501//1666
+f 501//1667 502//1668 491//1669
+f 488//1670 491//1671 502//1672
+f 502//1673 503//1674 488//1675
+f 488//1676 503//1677 492//1678
+f 492//1679 489//1680 488//1681
+f 504//1682 492//1683 503//1684
+f 503//1685 505//1686 504//1687
+f 503//1688 502//1689 506//1690
+f 506//1691 505//1692 503//1693
+f 502//1694 501//1695 507//1696
+f 507//1697 506//1698 502//1699
+f 508//1700 507//1701 501//1702
+f 501//1703 500//1704 508//1705
+f 509//1706 510//1707 493//1708
+f 493//1709 492//1710 509//1711
+f 510//1712 511//1713 496//1714
+f 496//1715 493//1716 510//1717
+f 510//1718 512//1719 513//1720
+f 513//1721 511//1722 510//1723
+f 509//1724 514//1725 512//1726
+f 512//1727 510//1728 509//1729
+f 515//1730 499//1731 496//1732
+f 496//1733 511//1734 515//1735
+f 515//1736 511//1737 513//1738
+f 513//1739 516//1740 515//1741
+f 517//1742 518//1743 519//1744
+f 519//1745 520//1746 517//1747
+f 521//1748 522//1749 519//1750
+f 519//1751 518//1752 521//1753
+f 523//1754 517//1755 520//1756
+f 520//1757 524//1758 523//1759
+f 525//1760 526//1761 522//1762
+f 522//1763 521//1764 525//1765
+f 527//1766 523//1767 524//1768
+f 524//1769 528//1770 527//1771
+f 529//1772 530//1773 526//1774
+f 526//1775 525//1776 529//1777
+f 531//1778 527//1779 528//1780
+f 528//1781 532//1782 531//1783
+usemtl Window
+f 533//1784 534//1785 530//1786
+f 530//1787 529//1788 533//1789
+f 535//1790 531//1791 532//1792
+f 532//1793 536//1794 535//1795
+usemtl Hull
+f 537//1796 538//1797 539//1798
+f 539//1799 540//1800 537//1801
+f 541//1802 542//1803 543//1804
+f 543//1805 544//1806 541//1807
+f 541//1808 544//1809 545//1810
+f 545//1811 546//1812 541//1813
+f 537//1814 547//1815 548//1816
+f 548//1817 538//1818 537//1819
+f 546//1820 545//1821 548//1822
+f 548//1823 547//1824 546//1825
+f 549//1826 550//1827 516//1828
+f 516//1829 514//1830 549//1831
+f 551//1832 549//1833 550//1834
+f 550//1835 552//1836 551//1837
+f 551//1838 553//1839 554//1840
+f 554//1841 552//1842 551//1843
+f 555//1844 554//1845 553//1846
+f 553//1847 556//1848 555//1849
+f 555//1850 556//1851 549//1852
+f 549//1853 550//1854 555//1855
+f 557//1856 555//1857 556//1858
+f 556//1859 504//1860 557//1861
+usemtl Chassis
+f 558//1862 66//1863 71//1864
+f 71//1865 70//1866 558//1867
+f 559//1868 20//1869 560//1870
+f 560//1871 561//1872 559//1873
+f 561//1874 560//1875 16//1876
+f 16//1877 562//1878 561//1879
+f 561//1880 562//1881 23//1882
+f 23//1883 22//1884 561//1885
+f 559//1886 561//1887 22//1888
+f 22//1889 21//1890 559//1891
+f 559//1892 21//1893 563//1894
+f 563//1895 564//1896 559//1897
+f 559//1898 564//1899 19//1900
+f 19//1901 20//1902 559//1903
+f 562//1904 16//1905 18//1906
+f 18//1907 565//1908 562//1909
+f 562//1910 565//1911 566//1912
+f 566//1913 23//1914 562//1915
+usemtl Hull
+f 549//1916 567//1917 568//1918
+f 568//1919 550//1920 549//1921
+f 569//1922 568//1923 567//1924
+f 567//1925 570//1926 569//1927
+f 551//1928 552//1929 569//1930
+f 569//1931 570//1932 551//1933
+usemtl Chassis
+f 571//1934 572//1935 573//1936
+f 573//1937 574//1938 571//1939
+usemtl Hull
+f 557//1940 504//1941 505//1942
+f 505//1943 508//1944 557//1945
+f 509//1946 492//1947 504//1948
+f 504//1949 556//1950 509//1951
+usemtl Chassis
+f 20//1952 17//1953 16//1954
+f 16//1955 560//1956 20//1957
+f 21//1958 23//1959 566//1960
+f 566//1961 563//1962 21//1963
+f 28//1964 136//1965 24//1966
+f 24//1967 26//1968 28//1969
+f 29//1970 139//1971 141//1972
+f 141//1973 30//1974 29//1975
+f 146//1976 575//1977 686//1978
+f 147//1979 575//1977 684//1980
+f 107//1981 576//1982 682//1983
+f 111//1984 576//1982 681//1985
+f 116//1986 576//1982 683//1987
+f 122//1988 129//1989 132//1990
+f 132//1991 34//1992 122//1993
+f 33//1994 120//1995 122//1996
+f 122//1997 34//1998 33//1999
+f 125//2000 127//2001 133//2002
+f 133//2003 130//2004 125//2005
+f 125//2006 130//2007 124//2008
+f 124//2009 123//2010 125//2011
+f 92//2012 36//2013 98//2014
+f 98//2015 95//2016 92//2017
+f 37//2018 36//2019 92//2020
+f 92//2021 87//2022 37//2023
+f 96//2024 85//2025 86//2026
+f 86//2027 94//2028 96//2029
+f 89//2030 91//2031 94//2032
+f 94//2033 86//2034 89//2035
+usemtl Hull
+f 516//2036 513//2037 512//2038
+f 512//2039 514//2040 516//2041
+f 508//2042 505//2043 506//2044
+f 506//2045 507//2046 508//2047
+usemtl Window
+f 193//2048 194//2049 183//2050
+f 183//2051 577//2052 193//2053
+f 183//2054 186//2055 188//2056
+f 188//2057 577//2058 183//2059
+f 167//2060 166//2061 171//2062
+f 171//2063 578//2064 167//2065
+f 578//2066 171//2067 173//2068
+f 173//2069 174//2070 578//2071
+f 163//2072 167//2073 578//2074
+f 578//2075 162//2076 163//2077
+f 162//2078 578//2079 174//2080
+f 174//2081 160//2082 162//2083
+f 579//2084 179//2085 180//2086
+f 180//2087 580//2088 579//2089
+usemtl Chassis
+f 581//2090 195//2091 198//2092
+f 198//2093 582//2094 581//2095
+f 583//2096 584//2097 228//2098
+f 228//2099 240//2100 583//2101
+f 583//2102 229//2103 219//2104
+f 219//2105 584//2106 583//2107
+f 585//2108 586//2109 262//2110
+f 262//2111 261//2112 585//2113
+f 585//2114 241//2115 244//2116
+f 244//2117 586//2118 585//2119
+f 587//2120 273//2121 263//2122
+f 263//2123 588//2124 587//2125
+usemtl Hull
+f 288//2126 287//2127 589//2128
+f 589//2129 590//2130 288//2131
+f 590//2132 589//2133 292//2134
+f 292//2135 291//2136 590//2137
+f 292//2138 591//2139 592//2140
+f 592//2141 293//2142 292//2143
+f 293//2144 592//2145 593//2146
+f 593//2147 295//2148 293//2149
+f 296//2150 295//2151 594//2152
+f 594//2153 595//2154 296//2155
+f 297//2156 595//2157 594//2158
+f 594//2159 298//2160 297//2161
+f 596//2162 597//2163 598//2164
+f 598//2165 599//2166 596//2167
+f 597//2168 600//2169 601//2170
+f 601//2171 598//2172 597//2173
+f 599//2174 598//2175 602//2176
+f 602//2177 603//2178 599//2179
+f 598//2180 601//2181 604//2182
+f 604//2183 602//2184 598//2185
+f 603//2186 602//2187 605//2188
+f 605//2189 606//2190 603//2191
+f 602//2192 604//2193 607//2194
+f 607//2195 605//2196 602//2197
+f 606//2198 605//2199 608//2200
+f 608//2201 609//2202 606//2203
+f 605//2204 607//2205 610//2206
+f 610//2207 608//2208 605//2209
+f 607//2210 327//2211 611//2212
+f 611//2213 610//2214 607//2215
+f 320//2216 611//2217 612//2218
+f 612//2219 322//2220 320//2221
+f 327//2222 326//2223 612//2224
+f 612//2225 611//2226 327//2227
+f 604//2228 324//2229 327//2230
+f 327//2231 607//2232 604//2233
+f 601//2234 328//2235 324//2236
+f 324//2237 604//2238 601//2239
+f 600//2240 613//2241 328//2242
+f 328//2243 601//2244 600//2245
+f 613//2246 614//2247 329//2248
+f 329//2249 328//2250 613//2251
+f 331//2252 333//2253 614//2254
+f 614//2255 613//2256 331//2257
+f 392//2258 615//2259 616//2260
+f 616//2261 382//2262 392//2263
+f 414//2264 413//2265 617//2266
+f 617//2267 618//2268 414//2269
+f 413//2270 415//2271 619//2272
+f 619//2273 617//2274 413//2275
+f 617//2276 619//2277 420//2278
+f 420//2279 417//2280 617//2281
+f 422//2282 424//2283 620//2284
+f 620//2285 621//2286 422//2287
+f 390//2288 622//2289 621//2290
+f 621//2291 391//2292 390//2293
+f 392//2294 391//2295 621//2296
+f 621//2297 620//2298 392//2299
+f 388//2300 623//2301 624//2302
+f 624//2303 389//2304 388//2305
+f 625//2306 626//2307 426//2308
+f 426//2309 425//2310 625//2311
+f 421//2312 627//2313 628//2314
+f 628//2315 424//2316 421//2317
+f 627//2318 629//2319 625//2320
+f 625//2321 628//2322 627//2323
+f 629//2324 630//2325 626//2326
+f 626//2327 625//2328 629//2329
+f 420//2330 631//2331 627//2332
+f 627//2333 421//2334 420//2335
+f 631//2336 632//2337 629//2338
+f 629//2339 627//2340 631//2341
+f 632//2342 633//2343 630//2344
+f 630//2345 629//2346 632//2347
+f 439//2348 438//2349 633//2350
+f 633//2351 632//2352 439//2353
+f 449//2354 448//2355 634//2356
+f 634//2357 635//2358 449//2359
+f 412//2360 636//2361 637//2362
+f 637//2363 415//2364 412//2365
+f 523//2366 521//2367 518//2368
+f 518//2369 517//2370 523//2371
+f 527//2372 525//2373 521//2374
+f 521//2375 523//2376 527//2377
+usemtl Window
+f 542//2378 540//2379 533//2380
+f 533//2381 535//2382 542//2383
+usemtl Chassis
+f 45//2384 46//2385 2//2386
+f 2//2387 1//2388 45//2389
+f 44//2390 47//2391 46//2392
+f 46//2393 45//2394 44//2395
+f 55//2396 58//2397 638//2398
+f 638//2399 59//2400 55//2401
+f 55//2402 61//2403 639//2404
+f 639//2405 56//2406 55//2407
+f 639//2408 61//2409 62//2410
+f 62//2411 640//2412 639//2413
+f 57//2414 640//2415 62//2416
+f 62//2417 58//2418 57//2419
+f 62//2420 63//2421 638//2422
+f 638//2423 58//2424 62//2425
+f 56//2426 639//2427 640//2428
+f 640//2429 57//2430 56//2431
+f 641//2432 67//2433 66//2434
+f 66//2435 558//2436 641//2437
+f 63//2438 60//2439 67//2440
+f 67//2441 641//2442 63//2443
+f 64//2444 59//2445 638//2446
+f 638//2447 642//2448 64//2449
+f 64//2450 642//2451 72//2452
+f 72//2453 65//2454 64//2455
+f 72//2456 558//2457 70//2458
+f 70//2459 69//2460 72//2461
+usemtl Hull
+f 73//2462 643//2463 644//2464
+f 644//2465 74//2466 73//2467
+f 643//2468 77//2469 80//2470
+f 80//2471 644//2472 643//2473
+f 74//2474 644//2475 80//2476
+f 80//2477 75//2478 74//2479
+f 80//2480 79//2481 82//2482
+f 82//2483 75//2484 80//2485
+f 81//2486 76//2487 75//2488
+f 75//2489 82//2490 81//2491
+f 73//2492 76//2493 77//2494
+f 77//2495 643//2496 73//2497
+f 77//2498 76//2499 81//2500
+f 81//2501 78//2502 77//2503
+usemtl Chassis
+f 117//2504 114//2505 100//2506
+f 100//2507 103//2508 117//2509
+f 114//2510 4//2511 6//2512
+f 6//2513 100//2514 114//2515
+f 152//2516 153//2517 155//2518
+f 155//2519 159//2520 152//2521
+f 153//2522 7//2523 9//2524
+f 9//2525 155//2526 153//2527
+usemtl Window
+f 168//2528 165//2529 645//2530
+f 645//2531 178//2532 168//2533
+f 646//2534 645//2535 165//2536
+f 165//2537 164//2538 646//2539
+f 10//2540 646//2541 164//2542
+f 164//2543 11//2544 10//2545
+f 647//2546 181//2547 179//2548
+f 179//2549 579//2550 647//2551
+f 184//2552 647//2553 579//2554
+f 579//2555 185//2556 184//2557
+f 185//2558 579//2559 580//2560
+f 580//2561 187//2562 185//2563
+f 190//2564 182//2565 181//2566
+f 181//2567 647//2568 190//2569
+f 192//2570 190//2571 647//2572
+f 647//2573 184//2574 192//2575
+f 189//2576 648//2577 14//2578
+f 14//2579 13//2580 189//2581
+f 191//2582 649//2583 648//2584
+f 648//2585 189//2586 191//2587
+f 193//2588 577//2589 649//2590
+f 649//2591 191//2592 193//2593
+usemtl Chassis
+f 581//2594 582//2595 216//2596
+f 216//2597 215//2598 581//2599
+usemtl Rim
+f 218//2600 216//2601 582//2602
+f 582//2603 289//2604 218//2605
+f 289//2606 582//2607 198//2608
+f 198//2609 650//2610 289//2611
+f 650//2612 198//2613 197//2614
+f 197//2615 651//2616 650//2617
+f 652//2618 651//2619 197//2620
+f 197//2621 200//2622 652//2623
+f 652//2624 200//2625 202//2626
+f 202//2627 308//2628 652//2629
+f 308//2630 202//2631 204//2632
+f 204//2633 309//2634 308//2635
+f 309//2636 204//2637 206//2638
+f 206//2639 312//2640 309//2641
+f 312//2642 206//2643 208//2644
+f 208//2645 330//2646 312//2647
+usemtl Spoke
+f 330//2648 208//2649 210//2650
+f 210//2651 332//2652 330//2653
+usemtl Rim
+f 332//2654 210//2655 212//2656
+f 212//2657 301//2658 332//2659
+f 301//2660 212//2661 214//2662
+f 214//2663 217//2664 301//2665
+usemtl Chassis
+f 584//2666 581//2667 215//2668
+f 215//2669 228//2670 584//2671
+f 584//2672 219//2673 195//2674
+f 195//2675 581//2676 584//2677
+f 223//2678 235//2679 205//2680
+f 205//2681 203//2682 223//2683
+f 235//2684 224//2685 207//2686
+f 207//2687 205//2688 235//2689
+f 583//2690 240//2691 239//2692
+f 239//2693 238//2694 583//2695
+f 583//2696 238//2697 237//2698
+f 237//2699 229//2700 583//2701
+f 229//2702 237//2703 236//2704
+f 236//2705 230//2706 229//2707
+f 230//2708 236//2709 234//2710
+f 234//2711 231//2712 230//2713
+f 231//2714 234//2715 233//2716
+f 233//2717 232//2718 231//2719
+f 258//2720 260//2721 262//2722
+f 262//2723 586//2724 258//2725
+f 256//2726 258//2727 586//2728
+f 586//2729 244//2730 256//2731
+f 254//2732 256//2733 244//2734
+f 244//2735 243//2736 254//2737
+f 252//2738 254//2739 243//2740
+f 243//2741 246//2742 252//2743
+f 248//2744 250//2745 252//2746
+f 252//2747 246//2748 248//2749
+f 588//2750 585//2751 261//2752
+f 261//2753 272//2754 588//2755
+f 588//2756 263//2757 241//2758
+f 241//2759 585//2760 588//2761
+f 267//2762 279//2763 251//2764
+f 251//2765 249//2766 267//2767
+f 279//2768 268//2769 253//2770
+f 253//2771 251//2772 279//2773
+f 587//2774 588//2775 272//2776
+f 272//2777 284//2778 587//2779
+usemtl Rim
+f 286//2780 300//2781 587//2782
+f 587//2783 284//2784 286//2785
+f 300//2786 653//2787 273//2788
+f 273//2789 587//2790 300//2791
+f 653//2792 654//2793 274//2794
+f 274//2795 273//2796 653//2797
+f 655//2798 275//2799 274//2800
+f 274//2801 654//2802 655//2803
+f 655//2804 317//2805 276//2806
+f 276//2807 275//2808 655//2809
+f 317//2810 316//2811 277//2812
+f 277//2813 276//2814 317//2815
+f 316//2816 319//2817 278//2818
+f 278//2819 277//2820 316//2821
+f 319//2822 321//2823 280//2824
+f 280//2825 278//2826 319//2827
+usemtl Spoke
+f 321//2828 323//2829 281//2830
+f 281//2831 280//2832 321//2833
+usemtl Rim
+f 323//2834 307//2835 282//2836
+f 282//2837 281//2838 323//2839
+f 307//2840 285//2841 283//2842
+f 283//2843 282//2844 307//2845
+usemtl Hull
+f 287//2846 290//2847 656//2848
+f 656//2849 589//2850 287//2851
+f 589//2852 656//2853 591//2854
+f 591//2855 292//2856 589//2857
+f 295//2858 593//2859 657//2860
+f 657//2861 594//2862 295//2863
+f 298//2864 594//2865 657//2866
+f 657//2867 299//2868 298//2869
+f 302//2870 288//2871 590//2872
+f 590//2873 658//2874 302//2875
+f 658//2876 590//2877 291//2878
+f 291//2879 303//2880 658//2881
+f 305//2882 296//2883 595//2884
+f 595//2885 659//2886 305//2887
+f 306//2888 659//2889 595//2890
+f 595//2891 297//2892 306//2893
+f 311//2894 310//2895 597//2896
+f 597//2897 596//2898 311//2899
+f 310//2900 313//2901 600//2902
+f 600//2903 597//2904 310//2905
+f 314//2906 609//2907 608//2908
+f 608//2909 315//2910 314//2911
+f 315//2912 608//2913 610//2914
+f 610//2915 318//2916 315//2917
+f 318//2918 610//2919 611//2920
+f 611//2921 320//2922 318//2923
+f 322//2924 612//2925 659//2926
+f 659//2927 306//2928 322//2929
+f 326//2930 305//2931 659//2932
+f 659//2933 612//2934 326//2935
+f 614//2936 658//2937 303//2938
+f 303//2939 329//2940 614//2941
+f 313//2942 331//2943 613//2944
+f 613//2945 600//2946 313//2947
+f 333//2948 302//2949 658//2950
+f 658//2951 614//2952 333//2953
+usemtl Chassis
+f 349//2954 351//2955 353//2956
+f 353//2957 660//2958 349//2959
+f 661//2960 660//2961 353//2962
+f 353//2963 352//2964 661//2965
+f 661//2966 334//2967 337//2968
+f 337//2969 660//2970 661//2971
+f 346//2972 349//2973 660//2974
+f 660//2975 337//2976 346//2977
+f 347//2978 346//2979 337//2980
+f 337//2981 336//2982 347//2983
+f 662//2984 347//2985 336//2986
+f 336//2987 339//2988 662//2989
+f 341//2990 343//2991 662//2992
+f 662//2993 339//2994 341//2995
+f 342//2996 361//2997 662//2998
+f 662//2999 343//3000 342//3001
+f 361//3002 344//3003 347//3004
+f 347//3005 662//3006 361//3007
+f 367//3008 661//3009 352//3010
+f 352//3011 365//3012 367//3013
+f 367//3014 354//3015 334//3016
+f 334//3017 661//3018 367//3019
+f 358//3020 359//3021 361//3022
+f 361//3023 342//3024 358//3025
+f 373//3026 663//3027 359//3028
+f 359//3029 358//3030 373//3031
+f 663//3032 374//3033 360//3034
+f 360//3035 359//3036 663//3037
+usemtl Rim
+f 664//3038 366//3039 368//3040
+f 368//3041 387//3042 664//3043
+f 664//3044 378//3045 369//3046
+f 369//3047 366//3048 664//3049
+f 382//3050 616//3051 663//3052
+f 663//3053 373//3054 382//3055
+f 616//3056 383//3057 374//3058
+f 374//3059 663//3060 616//3061
+usemtl Hull
+f 397//3062 665//3063 664//3064
+f 664//3065 387//3066 397//3067
+f 665//3068 388//3069 378//3070
+f 378//3071 664//3072 665//3073
+f 615//3074 393//3075 383//3076
+f 383//3077 616//3078 615//3079
+f 618//3080 617//3081 417//3082
+f 417//3083 416//3084 618//3085
+f 423//3086 422//3087 621//3088
+f 621//3089 622//3090 423//3091
+f 397//3092 429//3093 666//3094
+f 666//3095 665//3096 397//3097
+f 667//3098 433//3099 623//3100
+f 623//3101 666//3102 667//3103
+f 665//3104 666//3105 623//3106
+f 623//3107 388//3108 665//3109
+f 433//3110 432//3111 624//3112
+f 624//3113 623//3114 433//3115
+f 432//3116 423//3117 622//3118
+f 622//3119 624//3120 432//3121
+f 389//3122 624//3123 622//3124
+f 622//3125 390//3126 389//3127
+f 392//3128 620//3129 668//3130
+f 668//3131 615//3132 392//3133
+f 424//3134 628//3135 668//3136
+f 668//3137 620//3138 424//3139
+f 615//3140 668//3141 425//3142
+f 425//3143 393//3144 615//3145
+f 628//3146 625//3147 425//3148
+f 425//3149 668//3150 628//3151
+f 669//3152 635//3153 434//3154
+f 434//3155 670//3156 669//3157
+f 635//3158 634//3159 435//3160
+f 435//3161 434//3162 635//3163
+f 634//3164 618//3165 416//3166
+f 416//3167 435//3168 634//3169
+f 619//3170 671//3171 631//3172
+f 631//3173 420//3174 619//3175
+f 671//3176 439//3177 632//3178
+f 632//3179 631//3180 671//3181
+f 672//3182 669//3183 445//3184
+f 445//3185 444//3186 672//3187
+f 672//3188 449//3189 635//3190
+f 635//3191 669//3192 672//3193
+f 448//3194 414//3195 618//3196
+f 618//3197 634//3198 448//3199
+f 415//3200 637//3201 671//3202
+f 671//3203 619//3204 415//3205
+f 637//3206 436//3207 439//3208
+f 439//3209 671//3210 637//3211
+f 673//3212 672//3213 444//3214
+f 444//3215 454//3216 673//3217
+f 673//3218 446//3219 449//3220
+f 449//3221 672//3222 673//3223
+f 636//3224 450//3225 436//3226
+f 436//3227 637//3228 636//3229
+usemtl Rim
+f 463//3230 673//3231 454//3232
+f 454//3233 461//3234 463//3235
+f 463//3236 455//3237 446//3238
+f 446//3239 673//3240 463//3241
+f 409//3242 468//3243 636//3244
+f 636//3245 412//3246 409//3247
+f 468//3248 457//3249 450//3250
+f 450//3251 636//3252 468//3253
+usemtl Chassis
+f 467//3254 469//3255 457//3256
+f 457//3257 468//3258 467//3259
+f 674//3260 462//3261 464//3262
+f 464//3263 480//3264 674//3265
+f 674//3266 473//3267 465//3268
+f 465//3269 462//3270 674//3271
+f 475//3272 476//3273 469//3274
+f 469//3275 467//3276 475//3277
+f 675//3278 674//3279 480//3280
+f 480//3281 487//3282 675//3283
+f 675//3284 481//3285 473//3286
+f 473//3287 674//3288 675//3289
+f 402//3290 676//3291 475//3292
+f 475//3293 403//3294 402//3295
+f 676//3296 483//3297 476//3298
+f 476//3299 475//3300 676//3301
+f 675//3302 487//3303 486//3304
+f 486//3305 485//3306 675//3307
+f 675//3308 485//3309 484//3310
+f 484//3311 481//3312 675//3313
+f 481//3314 484//3315 483//3316
+f 483//3317 482//3318 481//3319
+f 482//3320 483//3321 676//3322
+f 676//3323 398//3324 482//3325
+f 398//3326 676//3327 402//3328
+f 402//3329 399//3330 398//3331
+usemtl Hull
+f 531//3332 529//3333 525//3334
+f 525//3335 527//3336 531//3337
+usemtl Window
+f 535//3338 533//3339 529//3340
+f 529//3341 531//3342 535//3343
+f 540//3344 539//3345 534//3346
+f 534//3347 533//3348 540//3349
+f 542//3350 535//3351 536//3352
+f 536//3353 543//3354 542//3355
+usemtl Hull
+f 541//3356 537//3357 540//3358
+f 540//3359 542//3360 541//3361
+f 541//3362 546//3363 547//3364
+f 547//3365 537//3366 541//3367
+f 557//3368 508//3369 500//3370
+f 500//3371 499//3372 557//3373
+f 497//3374 499//3375 500//3376
+f 500//3377 498//3378 497//3379
+f 557//3380 499//3381 515//3382
+f 515//3383 555//3384 557//3385
+f 555//3386 515//3387 516//3388
+f 516//3389 550//3390 555//3391
+f 555//3392 550//3393 552//3394
+f 552//3395 554//3396 555//3397
+f 552//3398 550//3399 568//3400
+f 568//3401 569//3402 552//3403
+f 551//3404 570//3405 567//3406
+f 567//3407 549//3408 551//3409
+usemtl Chassis
+f 573//3410 641//3411 558//3412
+f 558//3413 574//3414 573//3415
+f 558//3416 72//3417 677//3418
+f 677//3419 574//3420 558//3421
+f 571//3422 574//3423 677//3424
+f 677//3425 678//3426 571//3427
+f 679//3428 678//3429 677//3430
+f 677//3431 680//3432 679//3433
+f 642//3434 680//3435 677//3436
+f 677//3436 72//3437 642//3434
+usemtl Hull
+f 551//3438 549//3439 556//3440
+f 556//3441 553//3442 551//3443
+f 509//3444 556//3445 549//3446
+f 549//3447 514//3448 509//3449
+usemtl Chassis
+f 681//1985 576//1982 107//1981
+f 683//1987 576//1982 111//1984
+f 684//1980 575//1977 146//1976
+f 685//3450 575//1977 147//1979
+f 686//1978 575//1977 157//3451
diff --git a/data/lightcycle-low.obj b/data/lightcycle-low.obj
new file mode 100644
index 0000000..9ca02ae
--- /dev/null
+++ b/data/lightcycle-low.obj
@@ -0,0 +1,418 @@
+#
+# Wavefront OBJ generated by GLM library
+#
+# GLM library
+# Nate Robins
+# ndr@pobox.com
+# http://www.pobox.com/~ndr
+#
+
+mtllib lightcycle.mtl
+
+# 91 vertices
+v -0.675745 -4.181760 0.828977
+v -0.675746 -0.260560 1.854730
+v 0.677798 -2.070860 -0.100226
+v 0.669888 -0.260560 1.854730
+v 0.669888 -4.181760 0.828977
+v 0.203011 3.536160 -0.847399
+v 0.203011 3.851470 -0.511977
+v 0.203011 3.207430 -0.525406
+v 0.203011 3.536160 -0.150241
+v -0.200718 3.536160 -0.150241
+v -0.200718 3.851470 -0.511977
+v -0.200718 3.207430 -0.538833
+v -0.200718 3.536160 -0.847399
+v 1.257510 -0.361758 0.887388
+v 0.610035 -0.187286 1.704330
+v 0.610035 -3.311140 0.887388
+v -1.257510 -0.361758 0.888085
+v -0.602038 -3.311140 0.888085
+v -0.602039 -0.187286 1.705020
+v 0.571984 -3.371230 -0.150160
+v 0.571984 -3.692720 -0.507515
+v 0.571984 -3.054550 -0.512684
+v 0.571984 -3.371230 -0.847315
+v -0.569690 -3.371230 -0.150160
+v -0.569690 -3.054550 -0.512684
+v -0.569690 -3.692720 -0.507515
+v -0.569690 -3.371230 -0.847315
+v -0.675746 2.560710 1.165440
+v -0.675504 1.051360 -0.101380
+v 0.669887 2.561520 1.165440
+v 0.677798 1.051100 -0.101111
+v 0.301519 2.480440 -0.547424
+v 0.301519 3.536160 0.565185
+v 0.301519 3.536160 -1.562820
+v 0.301519 4.538160 -0.493712
+v 0.002783 3.536160 -1.987540
+v 0.002783 5.000000 -0.491226
+v 0.002783 3.536160 0.989902
+v -0.299225 3.536160 -1.562820
+v -0.299225 4.538160 -0.493712
+v -0.299225 3.536160 0.565185
+v -0.299225 2.480440 -0.533995
+v 0.002783 1.978340 -0.547779
+v -0.545389 1.646580 -1.553560
+v -0.545389 3.002350 -0.509387
+v -0.544671 3.530940 -1.150170
+v -0.545389 3.530570 -1.559590
+v 0.548401 3.530670 -1.150440
+v 0.547683 3.532990 -1.559590
+v 0.547683 3.002350 -0.508849
+v -1.074710 -3.371230 0.597294
+v -1.074710 -4.529150 -0.143543
+v 0.011553 -5.000000 -0.143341
+v 0.011553 -3.371230 0.989982
+v 1.077010 -3.371230 0.597294
+v 1.077010 -4.529150 -0.143543
+v 1.077010 -2.298130 -0.853935
+v 0.011553 -1.807680 -0.867211
+v -1.074710 -2.298130 -0.853935
+v 1.077010 -3.840490 -1.664290
+v 0.011553 -3.840490 -2.056980
+v -1.074710 -3.840490 -1.664290
+v -0.545389 3.529330 0.160689
+v 0.547683 3.529330 0.160689
+v 0.547683 1.646580 -1.553560
+v -0.389670 3.132820 1.122540
+v 0.392881 3.134730 1.125790
+v 0.393451 2.943360 0.805744
+v -0.389097 2.941480 0.802474
+v 0.392881 -0.187721 2.056980
+v 0.393451 -0.187888 1.694550
+v -0.389669 -0.189631 2.053730
+v -0.389096 -0.189771 1.691110
+v 0.392881 -3.121660 1.598650
+v 0.393451 -2.951540 1.251250
+v -0.389669 -3.123570 1.595410
+v -0.389096 -2.953420 1.247980
+v 0.392881 -4.460940 0.882128
+v 0.393451 -4.109510 0.815935
+v -0.389669 -4.462850 0.878881
+v -0.389096 -4.109460 0.815965
+v -0.545389 -2.722760 -1.553560
+v -0.542968 -2.722760 1.299390
+v -0.545389 1.273530 0.348329
+v 0.547683 1.273530 0.348329
+v 0.547683 -2.722760 1.299390
+v 0.549168 -2.723830 -1.553400
+v -0.545389 1.905600 1.092650
+v -0.545389 3.529330 1.092650
+v 0.547683 3.529330 1.092650
+v 0.547683 1.905600 1.092650
+
+# 161 normals
+vn -1.000000 0.000043 -0.000164
+vn -0.695529 0.228198 0.681296
+vn 0.999989 -0.000698 0.004692
+vn 0.999989 -0.000071 0.004740
+vn 0.999985 -0.001397 0.005339
+vn 1.000000 0.000000 0.000000
+vn -0.727607 0.485071 0.485071
+vn -1.000000 -0.000000 -0.000000
+vn -0.762493 0.457496 0.457496
+vn -0.816497 0.408248 0.408248
+vn 0.755312 -0.165813 0.634042
+vn -0.650458 0.433360 0.623782
+vn -0.751311 -0.166972 0.638477
+vn -0.689812 0.328116 0.645368
+vn -0.870411 0.348168 0.348085
+vn -1.000000 -0.000013 -0.000146
+vn -1.000000 -0.000000 -0.000191
+vn -0.000037 -0.008133 0.999967
+vn -0.000143 0.237274 0.971443
+vn -0.000071 0.237306 0.971435
+vn 0.999990 0.000592 0.004441
+vn 0.999988 0.001182 0.004837
+vn 0.990735 0.135771 0.003072
+vn 0.990950 0.134093 0.006023
+vn 0.991671 -0.000341 -0.128797
+vn 0.990653 -0.000193 -0.136404
+vn 0.989251 -0.053024 0.136276
+vn 0.990060 0.038876 0.135166
+vn 0.988948 -0.142679 -0.040308
+vn 0.988451 -0.142925 0.050369
+vn 0.718758 0.502329 -0.480679
+vn 0.739721 0.481013 -0.470574
+vn 0.697080 0.523144 -0.490306
+vn 0.728037 0.492626 0.476741
+vn 0.706889 0.503081 0.497209
+vn 0.748475 0.481689 0.455807
+vn -0.722445 0.499236 -0.478369
+vn -0.743007 0.488333 -0.457681
+vn -0.701182 0.509654 -0.498594
+vn -0.716825 0.501381 0.484540
+vn -0.694993 0.522259 0.494196
+vn -0.737935 0.479999 0.474397
+vn -0.989280 -0.052461 0.136279
+vn -0.989474 0.041017 0.138778
+vn -0.988451 -0.142924 0.050369
+vn -0.988948 -0.142678 -0.040308
+vn -0.991921 -0.001821 -0.126842
+vn -0.990653 -0.001044 -0.136403
+vn -0.990692 0.135907 0.007691
+vn -0.990815 0.134357 0.015289
+vn -0.734282 -0.467560 -0.492156
+vn -0.709626 -0.491743 -0.504598
+vn -0.757948 -0.442747 -0.479052
+vn 0.740924 -0.460565 -0.488786
+vn 0.722193 -0.469473 -0.507969
+vn 0.759063 -0.451290 -0.469212
+vn -1.000000 0.000107 0.000214
+vn -1.000000 0.000176 -0.000228
+vn -1.000000 0.000267 0.000534
+vn -0.999998 0.000006 0.001754
+vn -0.000984 0.999997 0.002385
+vn -0.002214 0.999981 0.005674
+vn 0.000247 1.000000 -0.000905
+vn 0.000017 0.771683 0.636008
+vn 0.000348 0.771406 0.636343
+vn -0.000313 0.771959 0.635672
+vn -0.256207 -0.536497 0.804070
+vn -0.227626 -0.524786 0.820235
+vn 0.002409 -0.555019 0.831834
+vn 0.002659 -0.571153 0.820840
+vn 0.260864 -0.535801 0.803036
+vn 0.231834 -0.524251 0.819399
+vn 0.270297 0.756003 0.596153
+vn -0.082418 0.775548 0.625886
+vn 0.107381 0.774012 0.623999
+vn 0.214051 0.785420 0.580773
+vn -0.281550 0.752851 0.594933
+vn -0.335186 0.757543 0.560159
+vn 0.261686 0.468109 -0.844034
+vn 0.002771 0.505124 -0.863042
+vn 0.002409 0.485013 -0.874503
+vn 0.219633 0.453754 -0.863637
+vn -0.257025 0.468725 -0.845124
+vn -0.215624 0.454170 -0.864428
+vn -0.249256 -0.857477 -0.450116
+vn -0.147496 -0.900986 -0.408006
+vn -0.105259 -0.870728 -0.480367
+vn 0.074871 -0.872314 -0.483180
+vn 0.282281 -0.847936 -0.448689
+vn 0.373382 -0.845068 -0.382683
+vn -0.613902 -0.614155 -0.495921
+vn -0.660614 -0.603626 -0.446346
+vn -0.564274 -0.621767 -0.543140
+vn -0.826467 0.357975 -0.434519
+vn -0.863654 0.374751 -0.337140
+vn -0.780066 0.337209 -0.527055
+vn 0.613898 -0.614158 -0.495923
+vn 0.660610 -0.603629 -0.446349
+vn 0.564270 -0.621769 -0.543142
+vn 0.774472 0.417297 -0.475454
+vn 0.831994 0.298993 -0.467322
+vn 0.703497 0.528353 -0.475326
+vn 0.620156 -0.494198 0.609241
+vn 0.791443 -0.284296 0.541104
+vn 0.400472 -0.665533 0.629832
+vn -0.782366 -0.365083 0.504597
+vn -0.840669 -0.393338 0.372237
+vn -0.707072 -0.328899 0.625998
+vn -0.828812 0.471259 0.301639
+vn -0.872628 0.354766 0.335650
+vn -0.771197 0.579907 0.262607
+vn 0.828809 0.471263 0.301642
+vn 0.872626 0.354769 0.335653
+vn 0.771194 0.579911 0.262609
+vn 0.000152 0.785917 -0.618331
+vn 0.000304 0.786038 -0.618178
+vn 0.000000 0.785797 -0.618485
+vn 1.000000 -0.000267 -0.000535
+vn 1.000000 -0.000105 0.000137
+vn 1.000000 -0.000048 -0.000251
+vn 0.999998 -0.000006 -0.001755
+vn 0.000060 0.858295 -0.513157
+vn 0.000037 0.858270 -0.513198
+vn 0.000082 0.858319 -0.513116
+vn 0.999999 0.000437 0.001549
+vn 0.999999 0.000446 0.001573
+vn 0.999999 0.000428 0.001526
+vn -0.999999 -0.000439 -0.001557
+vn -0.999999 -0.000430 -0.001533
+vn -0.999999 -0.000449 -0.001580
+vn 0.999999 -0.000245 0.001547
+vn 0.999999 -0.000244 0.001521
+vn 0.999999 -0.000246 0.001573
+vn -0.999999 0.000246 -0.001555
+vn -0.999999 0.000247 -0.001580
+vn -0.999999 0.000245 -0.001529
+vn 0.999997 -0.000888 0.002087
+vn 0.999995 -0.001081 0.002875
+vn 0.999999 -0.000695 0.001300
+vn -0.999997 0.000899 -0.002123
+vn -0.999999 0.000699 -0.001307
+vn -0.999995 0.001098 -0.002939
+vn 0.002240 -0.180194 -0.983629
+vn -0.000049 -0.175279 -0.984519
+vn 0.004529 -0.185104 -0.982709
+vn -1.000000 -0.000202 0.000424
+vn -1.000000 -0.000404 0.000849
+vn -1.000000 -0.000135 0.000283
+vn 1.000000 0.000116 0.000147
+vn 1.000000 0.000124 0.000520
+vn 1.000000 0.000232 0.000294
+vn -0.003720 -0.154342 0.988010
+vn -0.003714 -0.154344 0.988010
+vn -0.003726 -0.154340 0.988011
+vn 0.000000 -0.253076 0.967446
+vn -0.429191 0.320573 0.844410
+vn 0.000000 1.000000 0.000000
+vn -0.004658 0.269870 0.962886
+vn -0.002503 -0.471736 0.881736
+vn -0.002507 -0.471734 0.881737
+vn -0.002499 -0.471738 0.881735
+
+# 126 faces (triangles)
+g default
+
+usemtl Hull
+f 1//1 1//1 2//2
+f 3//3 4//4 5//5
+usemtl Chassis
+f 6//6 7//6 8//6
+f 9//6 8//6 7//6
+f 10//7 11//8 12//9
+f 12//9 11//8 13//10
+usemtl Window
+f 14//11 15//11 16//11
+f 17//12 18//13 19//14
+usemtl Chassis
+f 20//6 21//6 22//6
+f 21//6 23//6 22//6
+f 24//7 25//8 26//9
+f 26//9 25//8 27//10
+usemtl Hull
+f 1//15 2//2 28//16
+f 28//16 29//17 1//15
+f 4//18 30//19 28//20
+f 28//20 2//2 4//18
+f 31//21 30//22 4//4
+f 4//4 3//3 31//21
+usemtl Window
+f 32//23 8//24 9//25
+f 9//25 33//26 32//23
+f 32//23 34//27 6//28
+f 6//28 8//24 32//23
+f 34//27 35//29 7//30
+f 7//30 6//28 34//27
+f 35//29 33//26 9//25
+f 9//25 7//30 35//29
+usemtl Hull
+f 36//31 37//32 35//31
+f 35//31 34//33 36//31
+f 37//34 38//35 33//34
+f 33//34 35//36 37//34
+f 39//37 40//38 37//37
+f 37//37 36//39 39//37
+f 40//40 41//41 38//40
+f 38//40 37//42 40//40
+usemtl Window
+f 39//43 13//44 11//45
+f 11//45 40//46 39//43
+f 40//46 11//45 10//47
+f 10//47 41//48 40//46
+f 42//49 41//48 10//47
+f 10//47 12//50 42//49
+f 42//49 12//50 13//44
+f 13//44 39//43 42//49
+usemtl Hull
+f 42//51 39//52 36//51
+f 36//51 43//53 42//51
+f 43//54 36//55 34//54
+f 34//54 32//56 43//54
+usemtl Chassis
+f 44//57 45//58 46//59
+f 46//59 47//60 44//57
+f 48//61 49//62 47//61
+f 47//61 46//63 48//61
+f 48//64 46//65 45//64
+f 45//64 50//66 48//64
+usemtl Hull
+f 51//67 52//68 53//69
+f 53//69 54//70 51//67
+f 55//71 54//70 53//69
+f 53//69 56//72 55//71
+f 57//73 58//74 54//75
+f 54//75 55//76 57//73
+f 51//77 54//75 58//74
+f 58//74 59//78 51//77
+f 60//79 61//80 58//81
+f 58//81 57//82 60//79
+f 62//83 59//84 58//81
+f 58//81 61//80 62//83
+f 52//85 62//86 61//87
+f 61//87 53//88 52//85
+f 60//89 56//90 53//88
+f 53//88 61//87 60//89
+usemtl Window
+f 24//91 51//92 59//91
+f 59//91 25//93 24//91
+f 24//94 26//95 52//94
+f 52//94 51//96 24//94
+f 57//97 55//98 20//97
+f 20//97 22//99 57//97
+f 55//100 56//101 21//100
+f 21//100 20//102 55//100
+f 60//103 57//104 22//103
+f 22//103 23//105 60//103
+f 27//106 25//107 59//106
+f 59//106 62//108 27//106
+f 26//109 27//110 62//109
+f 62//109 52//111 26//109
+f 60//112 23//113 21//112
+f 21//112 56//114 60//112
+usemtl Chassis
+f 50//115 45//116 63//115
+f 63//115 64//117 50//115
+f 48//118 50//119 65//120
+f 65//120 49//121 48//118
+usemtl Hull
+f 66//122 67//123 68//122
+f 68//122 69//124 66//122
+f 70//125 71//126 68//125
+f 68//125 67//127 70//125
+f 72//128 66//129 69//128
+f 69//128 73//130 72//128
+usemtl Window
+f 74//131 75//132 71//131
+f 71//131 70//133 74//131
+f 76//134 72//135 73//134
+f 73//134 77//136 76//134
+usemtl Hull
+f 78//137 79//138 75//137
+f 75//137 74//139 78//137
+f 80//140 76//141 77//140
+f 77//140 81//142 80//140
+f 80//143 81//144 79//143
+f 79//143 78//145 80//143
+usemtl Chassis
+f 82//146 83//147 84//148
+f 84//148 44//57 82//146
+f 85//149 86//150 87//151
+f 87//151 65//120 85//149
+usemtl Window
+f 76//152 74//153 70//152
+f 70//152 72//154 76//152
+usemtl Hull
+f 4//18 2//2 1//155
+f 1//155 5//156 4//18
+usemtl Chassis
+f 88//8 45//58 44//57
+f 44//57 84//148 88//8
+f 64//157 63//157 89//157
+f 89//157 90//157 64//157
+f 88//8 89//8 63//8
+f 63//8 45//58 88//8
+f 50//119 64//6 90//6
+f 90//6 91//6 50//119
+f 85//149 65//120 50//119
+f 50//119 91//6 85//149
+usemtl Hull
+f 72//158 70//158 67//158
+f 67//158 66//158 72//158
+f 80//159 78//160 74//159
+f 74//159 76//161 80//159
+
diff --git a/data/lightcycle-med.obj b/data/lightcycle-med.obj
new file mode 100644
index 0000000..932bf5f
--- /dev/null
+++ b/data/lightcycle-med.obj
@@ -0,0 +1,2066 @@
+mtllib lightcycle.mtl
+
+g default
+v 0.573174 3.629760 0.222566
+v 0.576971 3.633620 0.924858
+v 0.956433 3.632150 0.605824
+v -0.572089 3.629820 0.222651
+v -0.955344 3.632200 0.605909
+v -0.575885 3.633680 0.924943
+v 0.520762 -1.119790 -0.031480
+v 0.830493 -1.119790 -0.343341
+v 0.520328 -0.519352 -0.622885
+v 0.830493 -1.119790 -0.837051
+v 0.520762 -1.119790 -1.179650
+v -0.827986 -1.119860 -0.836972
+v -0.521774 -0.520112 -0.626004
+v -0.518256 -1.119860 -1.179570
+v -0.827986 -1.119860 -0.343262
+v -0.518256 -1.119860 -0.031401
+v 0.598923 -0.058320 -0.493314
+v 0.524409 -0.044523 -0.417172
+v 0.522798 -0.144734 -0.454843
+v 0.524097 -0.076347 -0.555324
+v -0.592685 -0.058192 -0.493314
+v -0.515724 -0.145353 -0.455031
+v -0.518171 -0.044395 -0.417172
+v -0.517859 -0.076220 -0.555324
+v 0.715018 1.420550 -1.138740
+v 0.715018 1.581810 -1.138740
+v 0.715018 1.581810 -1.045640
+v 0.715018 1.420550 -1.045640
+v -0.712600 1.420650 -1.045060
+v -0.712600 1.581900 -1.045060
+v -0.712600 1.420650 -1.138160
+v -0.712600 1.581900 -1.138160
+v 0.577320 3.633560 1.056050
+v -0.575347 3.633560 1.056050
+v -0.000840 3.633560 1.606420
+v -0.899529 0.902023 -0.832563
+v -0.516277 0.899655 -0.449309
+v -0.520073 0.903506 -1.151600
+v 0.526311 0.903378 -1.151600
+v 0.522514 0.899528 -0.449309
+v 0.905767 0.901895 -0.832563
+v 0.214012 3.457120 -0.244219
+v 0.214012 3.322610 -0.746188
+v 0.452599 3.588740 -0.592542
+v 0.452599 3.610770 -0.510344
+v 0.214012 3.640850 -0.929925
+v 0.214012 3.959100 -0.746191
+v 0.452599 3.692970 -0.592542
+v 0.452599 3.640850 -0.622627
+v -0.450184 3.640850 -0.622627
+v -0.450184 3.692970 -0.592542
+v -0.211594 3.959100 -0.746191
+v -0.211594 3.640850 -0.929925
+v -0.450184 3.610770 -0.510344
+v -0.450184 3.588740 -0.592542
+v -0.211594 3.322610 -0.746188
+v -0.211594 3.457120 -0.244219
+v -1.325660 -0.468298 0.899609
+v -1.071430 -0.340234 1.491590
+v -0.457660 -0.284371 1.760810
+v -0.457660 -0.468297 0.899609
+v -1.071430 -2.325240 0.899609
+v -0.891658 -2.325240 1.301220
+v -0.457660 -2.325240 1.491590
+v 0.707462 0.031004 1.909540
+v 0.706189 2.613390 1.192000
+v -0.712364 2.612540 1.192000
+v -0.712481 0.032937 1.909560
+v 0.578119 3.635070 -1.249380
+v 0.577362 3.309880 -1.141790
+v 0.577362 1.648880 -1.674350
+v 0.577362 3.637510 -1.680710
+v -0.574187 3.635350 -1.249100
+v -0.574944 3.309020 -1.141220
+v 0.577362 3.056360 -0.899234
+v -0.574944 3.056360 -0.899804
+v -0.574944 1.648880 -1.674350
+v -0.574944 3.634950 -1.680710
+v -0.574944 2.970620 -0.566337
+v 0.577362 2.970730 -0.575810
+v 0.577362 3.044080 -0.228927
+v -0.574944 3.044080 -0.228927
+v -0.574944 3.633650 1.115260
+v -0.574944 1.921920 1.115260
+v 0.822993 3.037020 0.402424
+v 0.575468 3.097930 0.165022
+v 0.649583 2.671930 0.266574
+v 0.575068 2.685730 0.190430
+v 0.574757 2.653900 0.328584
+v 0.575604 2.591150 0.218772
+v 0.577147 2.986020 0.597273
+v -0.574383 3.098010 0.165104
+v -0.821907 3.037110 0.402509
+v -0.576061 2.986070 0.597355
+v -0.648497 2.672000 0.266659
+v -0.573671 2.653970 0.328670
+v -0.573983 2.685790 0.190515
+v -0.571933 2.591480 0.218486
+v 1.140230 -2.415400 -0.096486
+v 1.057230 -1.867590 -0.162631
+v 0.520762 -1.867590 0.388777
+v 0.520762 -2.415400 0.542603
+v 1.057230 -1.867590 -1.017760
+v 0.520762 -1.867590 -1.599900
+v 0.520762 -2.415400 -1.753730
+v 1.140230 -2.415400 -1.083910
+v -1.137720 -2.415470 -1.083830
+v -1.054730 -1.867660 -1.017680
+v -0.518256 -1.867660 -1.599820
+v -0.518256 -2.415470 -1.753650
+v -0.518256 -1.867660 0.388859
+v -1.054730 -1.867660 -0.162550
+v -0.518256 -2.415470 0.542683
+v -1.137720 -2.415470 -0.096406
+v -0.000983 2.917570 1.303750
+v 0.308856 2.959850 1.056050
+v -0.310821 2.959850 1.056050
+v 0.772330 0.306789 -0.629165
+v 0.524808 0.367690 -0.391761
+v 0.526487 0.255771 -0.824008
+v -0.766092 0.306917 -0.629165
+v -0.518571 0.367818 -0.391761
+v -0.520249 0.255899 -0.824008
+v 0.140461 5.000000 0.222243
+v 0.140461 3.640850 1.006940
+v 0.317858 3.640850 0.559210
+v 0.317858 4.612230 -0.001623
+v 0.214012 3.640850 -0.194985
+v 0.452599 3.640850 -0.502283
+v 0.452599 3.692970 -0.532369
+v 0.214012 3.959100 -0.378719
+v 0.714528 1.021120 -0.143193
+v -0.712109 1.021400 -0.143477
+v -0.712109 1.376680 -0.803557
+v 0.714528 1.377240 -0.803840
+v 0.714528 -2.270020 -0.142259
+v -0.712109 -2.270590 -0.142259
+v 0.714528 1.571190 0.504697
+v -0.712109 1.571190 0.505264
+v -0.712109 -2.785380 0.507308
+v 0.714528 -2.785670 0.507592
+v 0.706189 -2.300900 1.729860
+v -0.712364 -2.300900 1.729860
+v 0.714528 1.579410 -0.738342
+v -0.712109 1.579690 -0.738626
+v 0.706189 -4.495300 0.837298
+v -0.712364 -4.495300 0.837298
+v -0.574944 -2.957240 -1.674350
+v -0.572392 -2.957240 1.333200
+v -0.574944 -2.385050 1.333200
+v -0.574944 -2.385050 -1.674350
+v 0.414171 -4.789610 0.893328
+v 0.414772 -4.419140 0.823549
+v 0.414772 -3.198420 1.282450
+v 0.414171 -3.377750 1.648680
+v -0.410785 -4.791630 0.889906
+v -0.410182 -4.419080 0.823580
+v -0.410785 -3.379770 1.645260
+v -0.410182 -3.200400 1.279000
+v -0.410786 -0.286843 2.128420
+v -0.410786 3.215650 1.146770
+v -0.410182 3.013940 0.809358
+v -0.410182 -0.286991 1.746150
+v 0.414171 -0.284830 2.131840
+v 0.414772 -0.285006 1.749770
+v 0.414772 3.015900 0.812803
+v 0.414171 3.217670 1.150200
+v 1.135370 -3.640850 -1.717790
+v 0.842189 -3.640850 -1.620540
+v 0.842189 -4.557250 -1.091450
+v 1.135370 -4.641490 -1.140080
+v 1.135370 -2.640210 -1.140080
+v 0.842189 -2.724450 -1.091450
+v 0.399299 -2.281710 -1.347060
+v 0.399299 -2.305490 0.202052
+v 1.135370 -2.640210 0.015344
+v 0.399299 -3.640850 1.007030
+v 1.135370 -3.640850 0.593059
+v 0.842189 -3.640850 0.495805
+v 0.842189 -2.724450 -0.033283
+v 1.135370 -4.641490 0.015344
+v 0.842189 -4.557250 -0.033283
+v -0.962058 -3.692970 -0.592454
+v -0.962058 -3.640850 -0.622539
+v -0.600562 -3.640850 -0.929834
+v -0.600562 -3.959100 -0.746100
+v -0.962058 -3.610770 -0.614478
+v -0.600562 -3.355270 -0.790732
+v -0.962058 -3.588740 -0.532281
+v -0.600562 -3.322610 -0.378634
+v -0.839770 -2.724450 -1.091450
+v -0.839770 -3.640850 -1.620540
+v -0.839770 -2.724450 -0.033283
+v -0.839770 -3.640850 0.495805
+v -1.132950 -3.640850 0.593059
+v -1.132950 -2.640210 0.015344
+v -0.839770 -4.557250 -0.033283
+v -1.132950 -4.641490 0.015344
+v -0.839770 -4.557250 -1.091450
+v -1.132950 -3.640850 -1.717790
+v -1.132950 -4.641490 -1.140080
+v -1.132950 -2.640210 -1.140080
+v -0.396881 -3.640850 1.007030
+v -0.396881 -2.305490 0.202052
+v -0.396881 -2.281710 -1.347060
+v 0.602980 -3.959100 -0.746100
+v 0.602980 -3.640850 -0.929834
+v 0.964477 -3.640850 -0.622539
+v 0.964477 -3.692970 -0.592454
+v 0.602980 -3.355270 -0.790732
+v 0.602980 -3.322610 -0.378634
+v 0.602980 -3.640850 -0.194900
+v 0.964477 -3.640850 -0.502195
+v 0.964477 -3.588740 -0.532281
+v 0.602980 -3.959100 -0.378634
+v 0.964477 -3.692970 -0.532281
+v 0.964477 -3.610770 -0.614478
+v 1.325660 -0.468297 0.898874
+v 0.457660 -0.468297 0.898874
+v 0.457660 -0.284371 1.760080
+v 1.071430 -0.340234 1.490860
+v 0.891658 -2.325240 1.300490
+v 1.071430 -2.325240 0.898874
+v 0.457660 -2.325240 1.490860
+v 0.577362 3.300180 0.034222
+v 0.577362 3.633650 0.132795
+v 0.577362 3.633650 1.115260
+v -0.457660 -3.577510 0.899609
+v 0.457661 -3.577510 0.898874
+v 0.140461 3.640850 -2.131840
+v 0.140461 5.000000 -1.347150
+v 0.317858 4.612230 -1.123280
+v 0.317858 3.640850 -1.684110
+v -0.315440 3.640850 -1.684110
+v -0.315440 4.612230 -1.123280
+v -0.138043 5.000000 -1.347150
+v -0.138043 3.640850 -2.131840
+v -0.450184 3.640850 -0.502283
+v -0.211594 3.640850 -0.194985
+v -0.211594 3.959100 -0.378719
+v -0.450184 3.692970 -0.532369
+v -0.962058 -3.640850 -0.502195
+v -0.962058 -3.692970 -0.532281
+v -0.600562 -3.959100 -0.378634
+v -0.600562 -3.640850 -0.194900
+v 0.317858 3.080040 0.408931
+v 0.317858 2.669470 -1.123280
+v -0.138043 5.000000 0.222243
+v -0.315440 4.612230 -0.001623
+v -0.315440 3.640850 0.559210
+v -0.315440 3.080040 0.408931
+v -0.315440 2.669470 -1.123280
+v 0.577362 1.255610 0.330603
+v -0.574944 1.255610 0.330603
+v 0.577362 1.921920 1.115260
+v -0.138043 3.640850 1.006940
+v 0.577363 -2.957240 1.333200
+v 0.577363 -2.957240 -1.674350
+v 0.577363 -2.385050 -1.674350
+v 0.577363 -2.385050 1.333200
+v -0.574944 3.300180 0.034222
+v -0.574944 3.633650 0.132795
+v 0.399300 -5.000000 -1.347060
+v 0.399299 -3.640850 -2.131760
+v 0.399300 -5.000000 0.222328
+v -0.396881 -5.000000 0.222328
+v -0.396881 -5.000000 -1.347060
+v -0.396881 -3.640850 -2.131760
+v -0.138043 2.281720 -1.347150
+v 0.140461 2.281720 -1.347150
+vn -0.000743 0.999985 -0.005492
+vn -0.000743 0.999985 -0.005492
+vn -0.000743 0.999985 -0.005492
+vn 0.000718 0.999985 -0.005492
+vn 0.000718 0.999985 -0.005492
+vn 0.000718 0.999985 -0.005492
+vn 0.625342 0.472460 0.621071
+vn 0.640959 0.435546 0.632037
+vn 0.582743 0.570477 0.578763
+vn 0.926572 0.376118 0.000000
+vn 0.937603 0.347708 0.000000
+vn 0.888463 0.458948 0.000000
+vn 0.663704 0.446610 -0.600030
+vn 0.672304 0.416744 -0.611826
+vn 0.629779 0.528402 -0.569359
+vn -0.664629 0.444103 -0.600866
+vn -0.631966 0.523635 -0.571336
+vn -0.672877 0.415054 -0.612345
+vn -0.927460 0.373922 0.000000
+vn -0.890631 0.454727 0.000000
+vn -0.938148 0.346235 0.000000
+vn -0.595900 0.540059 0.594339
+vn -0.582777 0.570411 0.578794
+vn -0.602443 0.527301 0.599180
+vn 0.687853 -0.174024 0.704680
+vn 0.688418 -0.131265 0.713338
+vn 0.662389 -0.272918 0.697679
+vn 0.591628 -0.598810 -0.539818
+vn 0.594001 -0.570891 -0.566787
+vn 0.551741 -0.692780 -0.464368
+vn -0.647689 0.392907 0.652781
+vn -0.661032 -0.277461 0.697175
+vn -0.691881 0.136840 0.708926
+vn -0.592769 -0.574790 -0.564129
+vn -0.552189 -0.691885 -0.465169
+vn -0.588582 -0.607244 -0.533690
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn -0.599914 0.000000 0.800065
+vn -1.000000 0.000000 0.000000
+vn -0.811111 0.324440 0.486660
+vn -0.811111 0.324440 0.486660
+vn -1.000000 0.000000 0.000000
+vn -0.816497 0.408248 0.408248
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000699 0.999985 0.005480
+vn 0.000699 0.999985 0.005480
+vn 0.000699 0.999985 0.005480
+vn -0.000698 0.999985 0.005478
+vn -0.000698 0.999985 0.005478
+vn -0.000698 0.999985 0.005478
+vn 0.673354 -0.714121 0.191377
+vn 0.673342 -0.714136 0.191363
+vn 0.673354 -0.714121 0.191377
+vn 0.673354 -0.714121 0.191377
+vn 0.673366 -0.714107 0.191390
+vn 0.673354 -0.714121 0.191377
+vn 0.744592 0.333728 -0.578108
+vn 0.744582 0.333755 -0.578105
+vn 0.744592 0.333728 -0.578108
+vn 0.744592 0.333728 -0.578108
+vn 0.744602 0.333700 -0.578111
+vn 0.744592 0.333728 -0.578108
+vn -0.744573 0.333738 -0.578126
+vn -0.744563 0.333722 -0.578149
+vn -0.744573 0.333738 -0.578126
+vn -0.744573 0.333738 -0.578126
+vn -0.744583 0.333754 -0.578104
+vn -0.744573 0.333738 -0.578126
+vn -0.673333 -0.714140 0.191382
+vn -0.673321 -0.714146 0.191401
+vn -0.673333 -0.714140 0.191382
+vn -0.673333 -0.714140 0.191382
+vn -0.673344 -0.714134 0.191363
+vn -0.673333 -0.714140 0.191382
+vn 0.002331 0.977460 -0.211106
+vn 0.004663 0.976965 -0.213351
+vn 0.002331 0.977460 -0.211106
+vn 0.002331 0.977460 -0.211106
+vn -0.000001 0.977946 -0.208859
+vn 0.002331 0.977460 -0.211106
+vn -0.903985 -0.122696 0.409581
+vn -0.799352 -0.228167 0.555856
+vn -0.903985 -0.122696 0.409581
+vn -0.903985 -0.122696 0.409581
+vn -0.902264 -0.121393 0.413744
+vn -0.903985 -0.122696 0.409581
+vn -0.394098 -0.121856 0.910954
+vn -0.398634 -0.123259 0.908790
+vn -0.490719 -0.192101 0.849878
+vn -0.490719 -0.192101 0.849878
+vn -0.389551 -0.120450 0.913095
+vn -0.394098 -0.121856 0.910954
+vn 0.000043 0.155041 0.987908
+vn -0.000160 0.267717 0.963498
+vn 0.000109 0.267854 0.963459
+vn 0.000109 0.267854 0.963459
+vn 0.000097 0.038651 0.999253
+vn 0.000043 0.155041 0.987908
+vn 0.999999 -0.000576 0.000909
+vn 0.999998 -0.000573 0.001787
+vn 1.000000 -0.000230 0.000364
+vn 1.000000 -0.000230 0.000364
+vn 0.999998 -0.000006 -0.001755
+vn 0.999999 -0.000576 0.000909
+vn 0.000271 0.313993 0.949425
+vn 0.000307 0.313878 0.949463
+vn 0.000007 0.515151 0.857099
+vn 0.000007 0.515151 0.857099
+vn 0.000039 0.515343 0.856984
+vn 0.000271 0.313993 0.949425
+vn 0.000357 0.862030 0.506857
+vn 0.000039 0.515343 0.856984
+vn 0.000007 0.515151 0.857099
+vn 0.000007 0.515151 0.857099
+vn -0.000250 0.862853 0.505454
+vn 0.000357 0.862030 0.506857
+vn -1.000000 0.000230 -0.000361
+vn -0.999999 0.000381 -0.001187
+vn -0.999999 0.000574 -0.000903
+vn -0.999999 0.000574 -0.000903
+vn -0.999998 0.000006 0.001754
+vn -1.000000 0.000230 -0.000361
+vn 0.000357 0.862030 0.506857
+vn -0.000250 0.862853 0.505454
+vn 0.000024 0.999759 0.021930
+vn 0.000024 0.999759 0.021930
+vn 0.000112 0.999682 0.025216
+vn 0.000357 0.862030 0.506857
+vn -0.000467 0.881578 -0.472039
+vn 0.000112 0.999682 0.025216
+vn 0.000024 0.999759 0.021930
+vn 0.000024 0.999759 0.021930
+vn 0.000000 0.880871 -0.473357
+vn -0.000467 0.881578 -0.472039
+vn 1.000000 -0.000001 0.000000
+vn 1.000000 -0.000001 0.000000
+vn 1.000000 -0.000001 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 -0.000000 -0.000000
+vn 0.702281 0.081388 -0.707232
+vn 0.704408 0.082984 -0.704928
+vn 0.700899 0.011030 -0.713176
+vn 0.700899 0.011030 -0.713176
+vn 0.694295 0.017206 -0.719485
+vn 0.702281 0.081388 -0.707232
+vn 0.700899 0.011030 -0.713176
+vn 0.706112 -0.073321 -0.704293
+vn 0.696019 -0.059397 -0.715562
+vn 0.696019 -0.059397 -0.715562
+vn 0.694295 0.017206 -0.719485
+vn 0.700899 0.011030 -0.713176
+vn 0.999969 0.006812 0.003820
+vn 0.999969 0.006812 0.003820
+vn 0.999969 0.006812 0.003820
+vn 0.048781 -0.973335 -0.224140
+vn 0.048781 -0.973335 -0.224140
+vn 0.048781 -0.973335 -0.224140
+vn 0.616527 -0.455030 0.642528
+vn 0.621990 -0.495190 0.606560
+vn 0.609092 -0.504148 0.612243
+vn 0.609092 -0.504148 0.612243
+vn 0.607610 -0.415188 0.677073
+vn 0.616527 -0.455030 0.642528
+vn 0.610395 -0.364234 0.703386
+vn 0.616527 -0.455030 0.642528
+vn 0.607610 -0.415188 0.677073
+vn 0.607610 -0.415188 0.677073
+vn 0.595417 -0.376139 0.709928
+vn 0.610395 -0.364234 0.703386
+vn -0.702286 0.081394 -0.707227
+vn -0.694300 0.017208 -0.719480
+vn -0.700905 0.011032 -0.713169
+vn -0.700905 0.011032 -0.713169
+vn -0.704413 0.082990 -0.704922
+vn -0.702286 0.081394 -0.707227
+vn -0.675829 0.082684 0.732406
+vn -0.595409 -0.376159 0.709924
+vn -0.607634 -0.415185 0.677055
+vn -0.607634 -0.415185 0.677055
+vn -0.616553 -0.455024 0.642507
+vn -0.675829 0.082684 0.732406
+vn -0.616553 -0.455024 0.642507
+vn -0.607634 -0.415185 0.677055
+vn -0.609116 -0.504146 0.612221
+vn -0.609116 -0.504146 0.612221
+vn -0.621991 -0.495204 0.606548
+vn -0.616553 -0.455024 0.642507
+vn -0.048838 -0.973348 -0.224072
+vn -0.048838 -0.973348 -0.224072
+vn -0.048838 -0.973348 -0.224072
+vn -0.999740 -0.022606 -0.002949
+vn -0.999740 -0.022606 -0.002949
+vn -0.999740 -0.022606 -0.002949
+vn -0.700905 0.011032 -0.713169
+vn -0.694300 0.017208 -0.719480
+vn -0.696027 -0.059400 -0.715555
+vn -0.696027 -0.059400 -0.715555
+vn -0.706121 -0.073324 -0.704285
+vn -0.700905 0.011032 -0.713169
+vn 0.704251 0.190559 0.683899
+vn 0.688965 0.275729 0.670299
+vn 0.687040 0.278466 0.671143
+vn 0.687040 0.278466 0.671143
+vn 0.704711 0.191809 0.683075
+vn 0.704251 0.190559 0.683899
+vn 0.687040 0.278466 0.671143
+vn 0.688965 0.275729 0.670299
+vn 0.640959 0.435546 0.632037
+vn 0.640959 0.435546 0.632037
+vn 0.625342 0.472460 0.621071
+vn 0.687040 0.278466 0.671143
+vn 0.708345 0.274442 -0.650330
+vn 0.707541 0.272475 -0.652030
+vn 0.672304 0.416744 -0.611826
+vn 0.672304 0.416744 -0.611826
+vn 0.663704 0.446610 -0.600030
+vn 0.708345 0.274442 -0.650330
+vn 0.721616 0.188328 -0.666185
+vn 0.707541 0.272475 -0.652030
+vn 0.708345 0.274442 -0.650330
+vn 0.708345 0.274442 -0.650330
+vn 0.720830 0.189714 -0.666643
+vn 0.721616 0.188328 -0.666185
+vn -0.721590 0.188506 -0.666163
+vn -0.702755 0.303219 -0.643579
+vn -0.712532 0.245132 -0.657425
+vn -0.712532 0.245132 -0.657425
+vn -0.721174 0.187288 -0.666957
+vn -0.721590 0.188506 -0.666163
+vn -0.702755 0.303219 -0.643579
+vn -0.664629 0.444103 -0.600866
+vn -0.672877 0.415054 -0.612345
+vn -0.672877 0.415054 -0.612345
+vn -0.712532 0.245132 -0.657425
+vn -0.702755 0.303219 -0.643579
+vn -0.679692 0.307884 0.665752
+vn -0.595900 0.540059 0.594339
+vn -0.602443 0.527301 0.599180
+vn -0.602443 0.527301 0.599180
+vn -0.694780 0.248012 0.675108
+vn -0.679692 0.307884 0.665752
+vn -0.704225 0.190745 0.683874
+vn -0.679692 0.307884 0.665752
+vn -0.694780 0.248012 0.675108
+vn -0.694780 0.248012 0.675108
+vn -0.705059 0.189329 0.683408
+vn -0.704225 0.190745 0.683874
+vn 0.642677 -0.271201 0.716531
+vn 0.659250 -0.292887 0.692537
+vn 0.642677 -0.271201 0.716531
+vn 0.642677 -0.271201 0.716531
+vn 0.625255 -0.249155 0.739579
+vn 0.642677 -0.271201 0.716531
+vn -0.681198 0.128774 0.720685
+vn -0.667586 -0.262122 0.696865
+vn -0.644017 -0.283982 0.710349
+vn -0.644017 -0.283982 0.710349
+vn -0.619666 -0.305497 0.722970
+vn -0.681198 0.128774 0.720685
+vn 0.700903 0.011034 0.713172
+vn 0.694302 0.017207 0.719478
+vn 0.688418 -0.131265 0.713338
+vn 0.688418 -0.131265 0.713338
+vn 0.687853 -0.174024 0.704680
+vn 0.700903 0.011034 0.713172
+vn 0.616534 -0.455022 -0.642526
+vn 0.607620 -0.415184 -0.677067
+vn 0.594001 -0.570891 -0.566787
+vn 0.594001 -0.570891 -0.566787
+vn 0.591628 -0.598810 -0.539818
+vn 0.616534 -0.455022 -0.642526
+vn -0.700904 0.011034 0.713171
+vn -0.647689 0.392907 0.652781
+vn -0.691881 0.136840 0.708926
+vn -0.691881 0.136840 0.708926
+vn -0.694303 0.017206 0.719477
+vn -0.700904 0.011034 0.713171
+vn -0.611277 -0.439211 -0.658357
+vn -0.613687 -0.431178 -0.661418
+vn -0.592769 -0.574790 -0.564129
+vn -0.592769 -0.574790 -0.564129
+vn -0.588582 -0.607244 -0.533690
+vn -0.611277 -0.439211 -0.658357
+vn 0.927362 0.282840 0.244951
+vn 0.909349 0.208015 0.360297
+vn 0.909352 0.208014 0.360291
+vn 0.909352 0.208014 0.360291
+vn 0.927365 0.353545 0.122473
+vn 0.927362 0.282840 0.244951
+vn 0.786773 0.088571 0.610855
+vn 0.786775 0.088557 0.610854
+vn 0.744591 0.333732 0.578107
+vn 0.744591 0.333732 0.578107
+vn 0.744583 0.333755 0.578104
+vn 0.786773 0.088571 0.610855
+vn 0.000086 -0.880405 -0.474223
+vn -0.000078 -0.880553 -0.473947
+vn 0.000086 -0.880405 -0.474223
+vn 0.000086 -0.880405 -0.474223
+vn 0.000251 -0.880256 -0.474499
+vn 0.000086 -0.880405 -0.474223
+vn 0.000100 -0.000327 -1.000000
+vn 0.000000 -0.000284 -1.000000
+vn 0.000100 -0.000327 -1.000000
+vn 0.000100 -0.000327 -1.000000
+vn 0.000199 -0.000370 -1.000000
+vn 0.000100 -0.000327 -1.000000
+vn -0.000011 -0.762599 0.646871
+vn 0.000257 -0.762309 0.647214
+vn -0.000011 -0.762599 0.646871
+vn -0.000011 -0.762599 0.646871
+vn -0.000278 -0.762890 0.646528
+vn -0.000011 -0.762599 0.646871
+vn 0.000099 0.000567 1.000000
+vn -0.000199 0.000664 1.000000
+vn 0.000099 0.000567 1.000000
+vn 0.000099 0.000567 1.000000
+vn 0.000397 0.000469 1.000000
+vn 0.000099 0.000567 1.000000
+vn -0.000189 -0.301605 -0.953433
+vn -0.000000 -0.301668 -0.953413
+vn -0.000189 -0.301605 -0.953433
+vn -0.000189 -0.301605 -0.953433
+vn -0.000379 -0.301541 -0.953453
+vn -0.000189 -0.301605 -0.953433
+vn 0.000099 0.999977 0.006723
+vn 0.000195 0.999978 0.006613
+vn 0.000099 0.999977 0.006723
+vn 0.000099 0.999977 0.006723
+vn 0.000003 0.999977 0.006833
+vn 0.000099 0.999977 0.006723
+vn 0.999977 0.000111 0.006741
+vn 0.999993 -0.001036 0.003532
+vn 0.999899 -0.000597 0.014176
+vn 0.999899 -0.000597 0.014176
+vn 0.999964 0.000006 0.008458
+vn 0.999977 0.000111 0.006741
+vn -1.000000 0.000025 -0.000114
+vn -1.000000 0.000101 -0.000249
+vn -1.000000 0.000024 -0.000251
+vn -1.000000 0.000024 -0.000251
+vn -1.000000 -0.000014 -0.000163
+vn -1.000000 0.000025 -0.000114
+vn -0.999997 -0.002230 0.000424
+vn -0.999990 -0.004460 0.000849
+vn -0.999999 -0.001115 0.000212
+vn -0.999999 -0.001115 0.000212
+vn -1.000000 -0.000000 0.000000
+vn -0.999997 -0.002230 0.000424
+vn 0.000139 -0.783537 -0.621345
+vn 0.000313 -0.783723 -0.621110
+vn 0.000139 -0.783537 -0.621345
+vn 0.000139 -0.783537 -0.621345
+vn -0.000035 -0.783350 -0.621580
+vn 0.000139 -0.783537 -0.621345
+vn -0.000030 0.306422 -0.951896
+vn 0.000249 0.304639 -0.952468
+vn -0.000030 0.306422 -0.951896
+vn -0.000030 0.306422 -0.951896
+vn -0.000310 0.308204 -0.951320
+vn -0.000030 0.306422 -0.951896
+vn -0.611277 -0.439211 -0.658357
+vn -0.595416 -0.376148 -0.709924
+vn -0.610400 -0.364238 -0.703380
+vn -0.610400 -0.364238 -0.703380
+vn -0.613687 -0.431178 -0.661418
+vn -0.611277 -0.439211 -0.658357
+vn -0.700904 0.011034 0.713171
+vn -0.694303 0.017206 0.719477
+vn -0.702287 0.081390 0.707226
+vn -0.702287 0.081390 0.707226
+vn -0.620937 0.478256 0.621054
+vn -0.700904 0.011034 0.713171
+vn -0.000989 0.999997 0.002367
+vn -0.002222 0.999982 0.005661
+vn -0.000989 0.999997 0.002367
+vn -0.000989 0.999997 0.002367
+vn 0.000243 1.000000 -0.000927
+vn -0.000989 0.999997 0.002367
+vn 0.000078 -0.189427 -0.981895
+vn 0.000157 -0.189364 -0.981907
+vn 0.000078 -0.189427 -0.981895
+vn 0.000078 -0.189427 -0.981895
+vn -0.000000 -0.189489 -0.981883
+vn 0.000078 -0.189427 -0.981895
+vn 0.999997 -0.000888 0.002088
+vn 0.999995 -0.001081 0.002875
+vn 0.999997 -0.000888 0.002088
+vn 0.999997 -0.000888 0.002088
+vn 0.999999 -0.000696 0.001300
+vn 0.999997 -0.000888 0.002088
+vn 0.002240 -0.180192 -0.983629
+vn -0.000050 -0.175276 -0.984519
+vn 0.002240 -0.180192 -0.983629
+vn 0.002240 -0.180192 -0.983629
+vn 0.004530 -0.185103 -0.982709
+vn 0.002240 -0.180192 -0.983629
+vn -0.999997 0.000897 -0.002119
+vn -0.999999 0.000698 -0.001305
+vn -0.999997 0.000897 -0.002119
+vn -0.999997 0.000897 -0.002119
+vn -0.999995 0.001096 -0.002933
+vn -0.999997 0.000897 -0.002119
+vn -0.999999 -0.000439 -0.001557
+vn -0.999999 -0.000430 -0.001533
+vn -0.999999 -0.000439 -0.001557
+vn -0.999999 -0.000439 -0.001557
+vn -0.999999 -0.000448 -0.001580
+vn -0.999999 -0.000439 -0.001557
+vn -0.999999 0.000246 -0.001553
+vn -0.999999 0.000246 -0.001580
+vn -0.999999 0.000246 -0.001553
+vn -0.999999 0.000246 -0.001553
+vn -0.999999 0.000245 -0.001527
+vn -0.999999 0.000246 -0.001553
+vn 0.999999 0.000437 0.001549
+vn 0.999999 0.000447 0.001573
+vn 0.999999 0.000437 0.001549
+vn 0.999999 0.000437 0.001549
+vn 0.999999 0.000428 0.001526
+vn 0.999999 0.000437 0.001549
+vn 0.999999 -0.000245 0.001547
+vn 0.999999 -0.000244 0.001522
+vn 0.999999 -0.000245 0.001547
+vn 0.999999 -0.000245 0.001547
+vn 0.999999 -0.000246 0.001573
+vn 0.999999 -0.000245 0.001547
+vn 0.000068 0.858280 -0.513181
+vn 0.000032 0.858242 -0.513246
+vn 0.000068 0.858280 -0.513181
+vn 0.000068 0.858280 -0.513181
+vn 0.000103 0.858319 -0.513116
+vn 0.000068 0.858280 -0.513181
+vn 0.276120 0.480561 0.832358
+vn 0.276099 0.480569 0.832360
+vn 0.276120 0.480561 0.832358
+vn 0.276120 0.480561 0.832358
+vn 0.276140 0.480553 0.832355
+vn 0.276120 0.480561 0.832358
+vn 0.276120 -0.480561 0.832358
+vn 0.276140 -0.480553 0.832355
+vn 0.276120 -0.480561 0.832358
+vn 0.276120 -0.480561 0.832358
+vn 0.276099 -0.480569 0.832360
+vn 0.276120 -0.480561 0.832358
+vn 0.424355 0.905469 0.006912
+vn 0.222955 0.974714 0.014962
+vn 0.217367 0.976023 0.011403
+vn 0.217367 0.976023 0.011403
+vn 0.413949 0.910300 0.000000
+vn 0.424355 0.905469 0.006912
+vn 0.424942 0.460043 0.779606
+vn 0.210670 0.504682 0.837206
+vn 0.217679 0.500158 0.838128
+vn 0.217679 0.500158 0.838128
+vn 0.437882 0.449514 0.778586
+vn 0.424942 0.460043 0.779606
+vn 0.276123 -0.480561 -0.832356
+vn 0.276111 -0.480560 -0.832361
+vn 0.276123 -0.480561 -0.832356
+vn 0.276123 -0.480561 -0.832356
+vn 0.276134 -0.480563 -0.832352
+vn 0.276123 -0.480561 -0.832356
+vn 0.276122 0.480561 -0.832357
+vn 0.276133 0.480557 -0.832355
+vn 0.276122 0.480561 -0.832357
+vn 0.276122 0.480561 -0.832357
+vn 0.276110 0.480566 -0.832358
+vn 0.276122 0.480561 -0.832357
+vn -0.592861 -0.402613 -0.697437
+vn -0.592873 -0.402582 -0.697445
+vn -0.592861 -0.402613 -0.697437
+vn -0.592861 -0.402613 -0.697437
+vn -0.592850 -0.402644 -0.697429
+vn -0.592861 -0.402613 -0.697437
+vn -0.579401 0.283342 -0.764207
+vn -0.547283 0.216647 -0.808421
+vn -0.579401 0.283342 -0.764207
+vn -0.579401 0.283342 -0.764207
+vn -0.607210 0.347931 -0.714311
+vn -0.579401 0.283342 -0.764207
+vn -0.558077 0.817334 -0.143232
+vn -0.515165 0.827873 -0.221884
+vn -0.558077 0.817334 -0.143232
+vn -0.558077 0.817334 -0.143232
+vn -0.596448 0.800143 -0.063414
+vn -0.558077 0.817334 -0.143232
+vn -0.938657 -0.059429 0.339692
+vn -0.941089 -0.311026 0.132716
+vn -0.942176 -0.242620 0.231169
+vn -0.942176 -0.242620 0.231169
+vn -0.943068 0.062854 0.326608
+vn -0.938657 -0.059429 0.339692
+vn -0.941089 -0.311026 0.132716
+vn -0.944792 -0.292057 -0.148560
+vn -0.946228 -0.283369 -0.156057
+vn -0.946228 -0.283369 -0.156057
+vn -0.942176 -0.242620 0.231169
+vn -0.941089 -0.311026 0.132716
+vn -0.276123 -0.480561 -0.832356
+vn -0.276112 -0.480560 -0.832361
+vn -0.276123 -0.480561 -0.832356
+vn -0.276123 -0.480561 -0.832356
+vn -0.276135 -0.480562 -0.832352
+vn -0.276123 -0.480561 -0.832356
+vn -0.276123 0.480561 -0.832356
+vn -0.276135 0.480562 -0.832352
+vn -0.276123 0.480561 -0.832356
+vn -0.276123 0.480561 -0.832356
+vn -0.276112 0.480560 -0.832361
+vn -0.276123 0.480561 -0.832356
+vn -0.276121 0.480560 0.832358
+vn -0.276100 0.480569 0.832360
+vn -0.276121 0.480560 0.832358
+vn -0.276121 0.480560 0.832358
+vn -0.276141 0.480552 0.832355
+vn -0.276121 0.480560 0.832358
+vn -0.276123 -0.480560 0.832357
+vn -0.276143 -0.480563 0.832349
+vn -0.276123 -0.480560 0.832357
+vn -0.276123 -0.480560 0.832357
+vn -0.276102 -0.480558 0.832365
+vn -0.276123 -0.480560 0.832357
+vn -0.421090 0.460858 0.781213
+vn -0.222555 0.503321 0.834948
+vn -0.215604 0.500339 0.838556
+vn -0.215604 0.500339 0.838556
+vn -0.408117 0.456462 0.790622
+vn -0.421090 0.460858 0.781213
+vn -0.424356 0.905469 0.006912
+vn -0.413950 0.910300 0.000000
+vn -0.289033 0.957268 0.009935
+vn -0.289033 0.957268 0.009935
+vn -0.148207 0.988840 0.015179
+vn -0.424356 0.905469 0.006912
+vn 0.592844 -0.402620 -0.697448
+vn 0.592855 -0.402642 -0.697425
+vn 0.592844 -0.402620 -0.697448
+vn 0.592844 -0.402620 -0.697448
+vn 0.592832 -0.402597 -0.697471
+vn 0.592844 -0.402620 -0.697448
+vn 0.942184 -0.055334 0.330497
+vn 0.944062 -0.306537 0.121578
+vn 0.944512 -0.233903 0.230622
+vn 0.944512 -0.233903 0.230622
+vn 0.942465 0.072251 0.326404
+vn 0.942184 -0.055334 0.330497
+vn 0.944062 -0.306537 0.121578
+vn 0.944935 -0.283415 -0.163629
+vn 0.948164 -0.276399 -0.156807
+vn 0.948164 -0.276399 -0.156807
+vn 0.944512 -0.233903 0.230622
+vn 0.944062 -0.306537 0.121578
+vn 0.592852 0.402656 0.697420
+vn 0.592850 0.402659 0.697420
+vn 0.592852 0.402656 0.697420
+vn 0.592852 0.402656 0.697420
+vn 0.592853 0.402652 0.697421
+vn 0.592852 0.402656 0.697420
+vn 0.592859 -0.402619 0.697435
+vn 0.592850 -0.402644 0.697429
+vn 0.592859 -0.402619 0.697435
+vn 0.592859 -0.402619 0.697435
+vn 0.592869 -0.402594 0.697442
+vn 0.592859 -0.402619 0.697435
+vn 0.618647 0.276224 -0.735511
+vn 0.598890 0.350685 -0.719966
+vn 0.618647 0.276224 -0.735511
+vn 0.618647 0.276224 -0.735511
+vn 0.634583 0.200056 -0.746513
+vn 0.618647 0.276224 -0.735511
+vn 0.558076 0.817334 -0.143232
+vn 0.515164 0.827873 -0.221884
+vn 0.558076 0.817334 -0.143232
+vn 0.558076 0.817334 -0.143232
+vn 0.596447 0.800144 -0.063414
+vn 0.558076 0.817334 -0.143232
+vn -0.744580 -0.333764 -0.578102
+vn -0.744582 -0.333760 -0.578102
+vn -0.744580 -0.333764 -0.578102
+vn -0.744580 -0.333764 -0.578102
+vn -0.744578 -0.333769 -0.578102
+vn -0.744580 -0.333764 -0.578102
+vn 0.744582 -0.333763 -0.578100
+vn 0.744583 -0.333766 -0.578097
+vn 0.744582 -0.333763 -0.578100
+vn 0.744582 -0.333763 -0.578100
+vn 0.744580 -0.333761 -0.578104
+vn 0.744582 -0.333763 -0.578100
+vn -0.002331 0.977461 -0.211103
+vn -0.000000 0.977946 -0.208858
+vn -0.002331 0.977461 -0.211103
+vn -0.002331 0.977461 -0.211103
+vn -0.004661 0.976966 -0.213346
+vn -0.002331 0.977461 -0.211103
+vn 0.903987 -0.122696 0.409578
+vn 0.902265 -0.121393 0.413741
+vn 0.903987 -0.122696 0.409578
+vn 0.903987 -0.122696 0.409578
+vn 0.799355 -0.228167 0.555852
+vn 0.903987 -0.122696 0.409578
+vn 0.394098 -0.121856 0.910954
+vn 0.389551 -0.120450 0.913095
+vn 0.490720 -0.192101 0.849877
+vn 0.490720 -0.192101 0.849877
+vn 0.398634 -0.123259 0.908790
+vn 0.394098 -0.121856 0.910954
+vn 0.610400 -0.364238 -0.703380
+vn 0.595417 -0.376147 -0.709924
+vn 0.607620 -0.415184 -0.677067
+vn 0.607620 -0.415184 -0.677067
+vn 0.616534 -0.455022 -0.642526
+vn 0.610400 -0.364238 -0.703380
+vn 0.700903 0.011034 0.713172
+vn 0.704412 0.082986 0.704923
+vn 0.702286 0.081391 0.707227
+vn 0.702286 0.081391 0.707227
+vn 0.694302 0.017207 0.719478
+vn 0.700903 0.011034 0.713172
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn -0.000023 -0.229526 0.973303
+vn 0.000043 0.155041 0.987908
+vn 0.000097 0.038651 0.999253
+vn 0.000097 0.038651 0.999253
+vn -0.000000 -0.229513 0.973306
+vn -0.000023 -0.229526 0.973303
+vn -1.000000 -0.000014 -0.000163
+vn -1.000000 0.000024 -0.000251
+vn -1.000000 -0.000034 -0.000302
+vn -1.000000 -0.000034 -0.000302
+vn -1.000000 -0.000041 -0.000310
+vn -1.000000 -0.000014 -0.000163
+vn 0.999977 0.000111 0.006741
+vn 0.999964 0.002719 0.008010
+vn 0.999981 0.000929 0.006048
+vn 0.999981 0.000929 0.006048
+vn 0.999993 -0.001036 0.003532
+vn 0.999977 0.000111 0.006741
+vn -0.799352 -0.228167 0.555856
+vn -0.657213 -0.322117 0.681404
+vn -0.490719 -0.192101 0.849878
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn 0.490720 -0.192101 0.849877
+vn 0.657216 -0.322118 0.681401
+vn 0.799355 -0.228167 0.555852
+vn 0.927360 0.070710 -0.367429
+vn 0.927366 0.353544 -0.122474
+vn 0.927362 0.282839 -0.244952
+vn 0.927362 0.282839 -0.244952
+vn 0.927359 -0.070711 -0.367430
+vn 0.927360 0.070710 -0.367429
+vn -0.927360 0.070708 -0.367428
+vn -0.927366 0.353544 -0.122473
+vn -0.927363 0.282838 -0.244950
+vn -0.927363 0.282838 -0.244950
+vn -0.927359 -0.070713 -0.367431
+vn -0.927360 0.070708 -0.367428
+vn -0.786765 0.088575 0.610865
+vn -0.786769 0.088585 0.610857
+vn -0.744575 0.333741 0.578122
+vn -0.744575 0.333741 0.578122
+vn -0.744567 0.333728 0.578140
+vn -0.786765 0.088575 0.610865
+vn -0.004657 0.269868 0.962886
+vn -0.004650 0.269867 0.962886
+vn -0.004657 0.269868 0.962886
+vn -0.004657 0.269868 0.962886
+vn -0.004664 0.269870 0.962885
+vn -0.004657 0.269868 0.962886
+vn -0.592847 -0.402624 0.697443
+vn -0.592837 -0.402606 0.697462
+vn -0.592847 -0.402624 0.697443
+vn -0.592847 -0.402624 0.697443
+vn -0.592856 -0.402642 0.697425
+vn -0.592847 -0.402624 0.697443
+vn -0.944935 -0.000001 -0.327258
+vn -0.943065 0.314284 -0.108873
+vn -0.943066 0.251426 -0.217742
+vn -0.943066 0.251426 -0.217742
+vn -0.944936 -0.000000 -0.327254
+vn -0.944935 -0.000001 -0.327258
+vn -0.943067 0.251424 0.217740
+vn -0.938657 -0.059429 0.339692
+vn -0.943068 0.062854 0.326608
+vn -0.943068 0.062854 0.326608
+vn -0.943065 0.314286 0.108870
+vn -0.943067 0.251424 0.217740
+vn 0.943065 0.251427 0.217743
+vn 0.942184 -0.055334 0.330497
+vn 0.942465 0.072251 0.326404
+vn 0.942465 0.072251 0.326404
+vn 0.943065 0.314286 0.108874
+vn 0.943065 0.251427 0.217743
+vn 0.944935 -0.000001 -0.327257
+vn 0.943065 0.314287 -0.108871
+vn 0.943066 0.251426 -0.217741
+vn 0.943066 0.251426 -0.217741
+vn 0.944936 -0.000003 -0.327256
+vn 0.944935 -0.000001 -0.327257
+vn 0.990652 -0.001821 -0.136404
+vn 0.989439 0.110987 -0.093238
+vn 0.989438 0.110988 -0.093238
+vn 0.989438 0.110988 -0.093238
+vn 0.989851 -0.040223 -0.136296
+vn 0.990652 -0.001821 -0.136404
+vn 0.990251 0.132327 0.043505
+vn 0.990251 0.132327 0.043505
+vn 0.989438 0.110988 -0.093238
+vn 0.989438 0.110988 -0.093238
+vn 0.989439 0.110987 -0.093238
+vn 0.990251 0.132327 0.043505
+vn 0.786773 0.088571 0.610855
+vn 0.779424 -0.162161 0.605146
+vn 0.779423 -0.162166 0.605146
+vn 0.779423 -0.162166 0.605146
+vn 0.786775 0.088557 0.610854
+vn 0.786773 0.088571 0.610855
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 0.744586 0.667526 0.000000
+vn 0.744586 0.667526 0.000000
+vn 0.744586 0.667526 0.000000
+vn 0.744586 0.667526 0.000000
+vn 0.744586 0.667526 0.000000
+vn 0.744586 0.667526 0.000000
+vn 0.990312 -0.026241 0.136360
+vn 0.990312 -0.131214 0.045453
+vn 0.990312 -0.104970 0.090907
+vn 0.990312 -0.104970 0.090907
+vn 0.990312 0.026244 0.136359
+vn 0.990312 -0.026241 0.136360
+vn 0.990312 -0.131214 0.045453
+vn 0.990312 -0.104970 -0.090907
+vn 0.990312 -0.131213 -0.045454
+vn 0.990312 -0.131213 -0.045454
+vn 0.990312 -0.104970 0.090907
+vn 0.990312 -0.131214 0.045453
+vn 0.927366 0.353544 -0.122474
+vn 0.927362 0.282840 0.244951
+vn 0.927365 0.353545 0.122473
+vn 0.927365 0.353545 0.122473
+vn 0.927362 0.282839 -0.244952
+vn 0.927366 0.353544 -0.122474
+vn 0.000000 0.499992 -0.866030
+vn 0.000000 0.499992 -0.866030
+vn 0.000000 0.499992 -0.866030
+vn 0.000000 0.499992 -0.866030
+vn 0.000000 0.499992 -0.866030
+vn 0.000000 0.499992 -0.866030
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn -0.927366 0.353544 -0.122473
+vn -0.927362 0.282840 0.244952
+vn -0.927365 0.353544 0.122474
+vn -0.927365 0.353544 0.122474
+vn -0.927363 0.282838 -0.244950
+vn -0.927366 0.353544 -0.122473
+vn -0.990312 -0.026241 0.136360
+vn -0.990312 0.026244 0.136359
+vn -0.990312 -0.104970 0.090906
+vn -0.990312 -0.104970 0.090906
+vn -0.990312 -0.131214 0.045453
+vn -0.990312 -0.026241 0.136360
+vn -0.990312 -0.131214 0.045453
+vn -0.990312 -0.104970 0.090906
+vn -0.990312 -0.131213 -0.045454
+vn -0.990312 -0.131213 -0.045454
+vn -0.990312 -0.104970 -0.090907
+vn -0.990312 -0.131214 0.045453
+vn -0.744582 0.667531 0.000000
+vn -0.744582 0.667531 0.000000
+vn -0.744582 0.667531 0.000000
+vn -0.744582 0.667531 0.000000
+vn -0.744582 0.667531 0.000000
+vn -0.744582 0.667531 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -0.786765 0.088575 0.610865
+vn -0.779422 -0.162171 0.605147
+vn -0.779421 -0.162167 0.605149
+vn -0.779421 -0.162167 0.605149
+vn -0.786769 0.088585 0.610857
+vn -0.786765 0.088575 0.610865
+vn -0.990652 -0.001821 -0.136404
+vn -0.989851 -0.040224 -0.136296
+vn -0.989438 0.110988 -0.093238
+vn -0.989438 0.110988 -0.093238
+vn -0.989439 0.110987 -0.093238
+vn -0.990652 -0.001821 -0.136404
+vn -0.990251 0.132327 0.043505
+vn -0.989439 0.110987 -0.093238
+vn -0.989438 0.110988 -0.093238
+vn -0.989438 0.110988 -0.093238
+vn -0.990251 0.132327 0.043505
+vn -0.990251 0.132327 0.043505
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 -0.000000
+vn -0.000331 0.550533 -0.834813
+vn -0.000332 0.550532 -0.834814
+vn -0.000331 0.550533 -0.834813
+vn -0.000331 0.550533 -0.834813
+vn -0.000330 0.550534 -0.834813
+vn -0.000331 0.550533 -0.834813
+vn 0.000002 -0.002133 -0.999998
+vn -0.000000 -0.001067 -0.999999
+vn 0.000004 -0.003200 -0.999995
+vn 0.000004 -0.003200 -0.999995
+vn 0.000007 -0.003198 -0.999995
+vn 0.000002 -0.002133 -0.999998
+vn 1.000000 -0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 -0.000230 0.000364
+vn 1.000000 -0.000230 0.000364
+vn 0.999998 -0.000573 0.001787
+vn 1.000000 -0.000000 -0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -0.999999 0.000381 -0.001187
+vn -0.999999 0.000381 -0.001187
+vn -1.000000 0.000230 -0.000361
+vn -1.000000 -0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 -0.000000 -0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 0.000000 0.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 0.000000 1.000000
+vn 0.988716 0.149803 0.000000
+vn 0.975375 0.220553 0.000000
+vn 0.975375 0.220553 0.000000
+vn 0.975375 0.220553 0.000000
+vn 0.988716 0.149803 0.000000
+vn 0.988716 0.149803 0.000000
+vn 0.975375 0.220553 0.000000
+vn 0.975375 0.220553 0.000000
+vn 0.937603 0.347708 0.000000
+vn 0.937603 0.347708 0.000000
+vn 0.926572 0.376118 0.000000
+vn 0.975375 0.220553 0.000000
+vn -0.988719 0.149785 0.000000
+vn -0.969791 0.243936 0.000000
+vn -0.980397 0.197034 0.000000
+vn -0.980397 0.197034 0.000000
+vn -0.988719 0.149785 0.000000
+vn -0.988719 0.149785 0.000000
+vn -0.969791 0.243936 0.000000
+vn -0.927460 0.373922 0.000000
+vn -0.938148 0.346235 0.000000
+vn -0.938148 0.346235 0.000000
+vn -0.980397 0.197034 0.000000
+vn -0.969791 0.243936 0.000000
+vn -0.599914 0.000000 0.800065
+vn -0.534458 0.267274 0.801822
+vn -0.408110 0.408276 0.816552
+vn -0.408110 0.408276 0.816552
+vn 0.000406 -0.000000 1.000000
+vn -0.599914 0.000000 0.800065
+vn -0.599914 0.000000 0.800065
+vn -0.811111 0.324440 0.486660
+vn -0.707132 0.000000 0.707082
+vn -0.707132 0.000000 0.707082
+vn -0.534458 0.267274 0.801822
+vn -0.599914 0.000000 0.800065
+vn -0.000406 0.000000 -1.000000
+vn -0.000406 0.000000 -1.000000
+vn -0.000406 0.000000 -1.000000
+vn -0.000406 0.000000 -1.000000
+vn -0.000406 0.000000 -1.000000
+vn -0.000406 0.000000 -1.000000
+vn 0.000063 1.000000 0.000000
+vn 0.000063 1.000000 0.000000
+vn 0.000063 1.000000 0.000000
+vn 0.000063 1.000000 0.000000
+vn 0.000063 1.000000 0.000000
+vn 0.000063 1.000000 0.000000
+vn -0.990312 -0.104970 -0.090907
+vn -0.990312 -0.131213 -0.045454
+vn -0.989851 -0.040224 -0.136296
+vn -0.989851 -0.040224 -0.136296
+vn -0.990652 -0.001821 -0.136404
+vn -0.990312 -0.104970 -0.090907
+vn -0.927362 0.282840 0.244952
+vn -0.909348 0.208020 0.360297
+vn -0.909351 0.208015 0.360293
+vn -0.909351 0.208015 0.360293
+vn -0.927365 0.353544 0.122474
+vn -0.927362 0.282840 0.244952
+vn 0.000000 0.499996 0.866028
+vn 0.000000 0.499996 0.866028
+vn 0.000000 0.499996 0.866028
+vn 0.000000 0.499996 0.866028
+vn 0.000000 0.499996 0.866028
+vn 0.000000 0.499996 0.866028
+vn 0.990312 -0.104970 -0.090907
+vn 0.990652 -0.001821 -0.136404
+vn 0.989851 -0.040223 -0.136296
+vn 0.989851 -0.040223 -0.136296
+vn 0.990312 -0.131213 -0.045454
+vn 0.990312 -0.104970 -0.090907
+vn 1.000000 0.000000 -0.000000
+vn 0.999977 0.000111 0.006741
+vn 0.999964 0.000006 0.008458
+vn 0.999964 0.000006 0.008458
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 0.000000 -0.000000
+vn -1.000000 0.000025 -0.000114
+vn -1.000000 -0.000014 -0.000163
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 0.000025 -0.000114
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 0.000000 0.000000
+vn 1.000000 -0.000230 0.000364
+vn 1.000000 0.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.999999 -0.001115 0.000212
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 0.000230 -0.000361
+vn -1.000000 0.000230 -0.000361
+vn -1.000000 -0.000000 0.000000
+vn -0.999999 -0.001115 0.000212
+vn -0.000000 -0.001067 -0.999999
+vn 0.000002 -0.002133 -0.999998
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.000000 -0.001067 -0.999999
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -0.000467 0.881578 -0.472039
+vn 0.000000 0.880871 -0.473357
+vn 0.000000 0.589260 -0.807944
+vn 0.000000 0.589260 -0.807944
+vn 0.000000 0.440579 -0.897714
+vn -0.000467 0.881578 -0.472039
+vn 0.000000 0.440579 -0.897714
+vn 0.000000 0.589260 -0.807944
+vn 0.000000 0.283473 -0.958980
+vn 0.000000 0.283473 -0.958980
+vn 0.000000 0.283473 -0.958980
+vn 0.000000 0.440579 -0.897714
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -1.000000 -0.000014 -0.000163
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -0.002501 -0.471734 0.881737
+vn -0.002502 -0.471734 0.881737
+vn -0.002501 -0.471734 0.881737
+vn -0.002501 -0.471734 0.881737
+vn -0.002500 -0.471735 0.881737
+vn -0.002501 -0.471734 0.881737
+vn -0.003719 -0.154342 0.988011
+vn -0.003718 -0.154342 0.988011
+vn -0.003719 -0.154342 0.988011
+vn -0.003719 -0.154342 0.988011
+vn -0.003719 -0.154342 0.988010
+vn -0.003719 -0.154342 0.988011
+vn 0.437878 -0.449513 -0.778589
+vn 0.437876 -0.449512 -0.778591
+vn 0.298698 -0.477170 -0.826492
+vn 0.298698 -0.477170 -0.826492
+vn 0.149350 -0.494389 -0.856314
+vn 0.437878 -0.449513 -0.778589
+vn 0.437875 0.449515 -0.778589
+vn 0.224685 0.487216 -0.843882
+vn 0.224682 0.487215 -0.843884
+vn 0.224682 0.487215 -0.843884
+vn 0.437870 0.449513 -0.778593
+vn 0.437875 0.449515 -0.778589
+vn 0.276157 -0.961113 0.000000
+vn 0.276157 -0.961113 0.000000
+vn 0.276157 -0.961113 0.000000
+vn 0.276157 -0.961113 0.000000
+vn 0.276157 -0.961113 0.000000
+vn 0.276157 -0.961113 0.000000
+vn 0.437881 -0.449514 0.778587
+vn 0.149350 -0.494390 0.856313
+vn 0.298700 -0.477171 0.826490
+vn 0.298700 -0.477171 0.826490
+vn 0.437880 -0.449514 0.778587
+vn 0.437881 -0.449514 0.778587
+vn 0.437882 -0.899032 0.000000
+vn 0.224686 -0.974431 0.000000
+vn 0.224686 -0.974431 0.000000
+vn 0.224686 -0.974431 0.000000
+vn 0.437882 -0.899032 0.000000
+vn 0.437882 -0.899032 0.000000
+vn 0.276157 0.961113 0.000000
+vn 0.276157 0.961113 0.000000
+vn 0.276157 0.961113 0.000000
+vn 0.276157 0.961113 0.000000
+vn 0.276157 0.961113 0.000000
+vn 0.276157 0.961113 0.000000
+vn -0.592854 0.402655 0.697419
+vn -0.592853 0.402652 0.697421
+vn -0.592854 0.402655 0.697419
+vn -0.592854 0.402655 0.697419
+vn -0.592856 0.402657 0.697416
+vn -0.592854 0.402655 0.697419
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -1.000000 0.000000 0.000000
+vn -0.592859 -0.805306 0.000000
+vn -0.592859 -0.805306 0.000000
+vn -0.592859 -0.805306 0.000000
+vn -0.592859 -0.805306 0.000000
+vn -0.592859 -0.805306 0.000000
+vn -0.592859 -0.805306 0.000000
+vn -0.944935 -0.000001 -0.327258
+vn -0.944936 -0.000000 -0.327254
+vn -0.946228 -0.283369 -0.156057
+vn -0.946228 -0.283369 -0.156057
+vn -0.944792 -0.292057 -0.148560
+vn -0.944935 -0.000001 -0.327258
+vn -0.943065 0.314284 -0.108873
+vn -0.943067 0.251424 0.217740
+vn -0.943065 0.314286 0.108870
+vn -0.943065 0.314286 0.108870
+vn -0.943066 0.251426 -0.217742
+vn -0.943065 0.314284 -0.108873
+vn -0.276158 0.961112 0.000000
+vn -0.276158 0.961112 0.000000
+vn -0.276158 0.961112 0.000000
+vn -0.276158 0.961112 0.000000
+vn -0.276158 0.961112 0.000000
+vn -0.276158 0.961112 0.000000
+vn -0.276158 -0.961112 0.000000
+vn -0.276158 -0.961112 0.000000
+vn -0.276158 -0.961112 0.000000
+vn -0.276158 -0.961112 0.000000
+vn -0.276158 -0.961112 0.000000
+vn -0.276158 -0.961112 0.000000
+vn -0.437882 -0.449514 0.778586
+vn -0.437881 -0.449514 0.778587
+vn -0.224686 -0.487214 0.843883
+vn -0.224686 -0.487214 0.843883
+vn -0.224686 -0.487214 0.843883
+vn -0.437882 -0.449514 0.778586
+vn -0.437883 -0.899032 0.000000
+vn -0.437883 -0.899032 0.000000
+vn -0.298701 -0.954347 0.000000
+vn -0.298701 -0.954347 0.000000
+vn -0.149350 -0.988784 0.000000
+vn -0.437883 -0.899032 0.000000
+vn -0.437880 -0.449513 -0.778588
+vn -0.437883 -0.449510 -0.778588
+vn -0.298699 -0.477170 -0.826491
+vn -0.298699 -0.477170 -0.826491
+vn -0.149348 -0.494390 -0.856314
+vn -0.437880 -0.449513 -0.778588
+vn -0.437876 0.449515 -0.778589
+vn -0.437872 0.449513 -0.778593
+vn -0.298696 0.477172 -0.826491
+vn -0.298696 0.477172 -0.826491
+vn -0.149350 0.494392 -0.856312
+vn -0.437876 0.449515 -0.778589
+vn -0.149350 -0.988784 0.000000
+vn -0.298701 -0.954347 0.000000
+vn 0.224686 -0.974431 0.000000
+vn 0.224686 -0.974431 0.000000
+vn 0.224686 -0.974431 0.000000
+vn -0.149350 -0.988784 0.000000
+vn -0.149348 -0.494390 -0.856314
+vn -0.298699 -0.477170 -0.826491
+vn 0.149350 -0.494389 -0.856314
+vn 0.149350 -0.494389 -0.856314
+vn 0.298698 -0.477170 -0.826492
+vn -0.149348 -0.494390 -0.856314
+vn 0.943065 0.314287 -0.108871
+vn 0.943065 0.251427 0.217743
+vn 0.943065 0.314286 0.108874
+vn 0.943065 0.314286 0.108874
+vn 0.943066 0.251426 -0.217741
+vn 0.943065 0.314287 -0.108871
+vn 0.592858 -0.805307 0.000000
+vn 0.592858 -0.805307 0.000000
+vn 0.592858 -0.805307 0.000000
+vn 0.592858 -0.805307 0.000000
+vn 0.592858 -0.805307 0.000000
+vn 0.592858 -0.805307 0.000000
+vn 0.944935 -0.000001 -0.327257
+vn 0.944936 -0.000003 -0.327256
+vn 0.948164 -0.276399 -0.156807
+vn 0.948164 -0.276399 -0.156807
+vn 0.944935 -0.283415 -0.163629
+vn 0.944935 -0.000001 -0.327257
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn -0.909350 -0.208016 -0.360295
+vn -0.927360 0.070708 -0.367428
+vn -0.927359 -0.070713 -0.367431
+vn -0.927359 -0.070713 -0.367431
+vn -0.909351 -0.208014 -0.360293
+vn -0.909350 -0.208016 -0.360295
+vn -0.990251 0.132327 0.043505
+vn -0.990251 0.132327 0.043505
+vn -0.990312 0.026244 0.136359
+vn -0.990312 0.026244 0.136359
+vn -0.990312 -0.026241 0.136360
+vn -0.990251 0.132327 0.043505
+vn -0.000000 -0.499998 -0.866027
+vn -0.000000 -0.499998 -0.866027
+vn -0.000000 -0.499998 -0.866027
+vn -0.000000 -0.499998 -0.866027
+vn -0.000000 -0.499998 -0.866027
+vn -0.000000 -0.499998 -0.866027
+vn 0.909350 -0.208016 -0.360294
+vn 0.927360 0.070710 -0.367429
+vn 0.927359 -0.070711 -0.367430
+vn 0.927359 -0.070711 -0.367430
+vn 0.909352 -0.208015 -0.360291
+vn 0.909350 -0.208016 -0.360294
+vn 0.990251 0.132327 0.043505
+vn 0.990312 -0.026241 0.136360
+vn 0.990312 0.026244 0.136359
+vn 0.990312 0.026244 0.136359
+vn 0.990251 0.132327 0.043505
+vn 0.990251 0.132327 0.043505
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn -0.149350 0.494392 -0.856312
+vn -0.298696 0.477172 -0.826491
+vn 0.224682 0.487215 -0.843884
+vn 0.224682 0.487215 -0.843884
+vn 0.224685 0.487216 -0.843882
+vn -0.149350 0.494392 -0.856312
+vn -0.148207 0.988840 0.015179
+vn -0.289033 0.957268 0.009935
+vn 0.217367 0.976023 0.011403
+vn 0.217367 0.976023 0.011403
+vn 0.222955 0.974714 0.014962
+vn -0.148207 0.988840 0.015179
+vn -0.224686 -0.487214 0.843883
+vn 0.298700 -0.477171 0.826490
+vn 0.149350 -0.494390 0.856313
+vn 0.149350 -0.494390 0.856313
+vn -0.224686 -0.487214 0.843883
+vn -0.224686 -0.487214 0.843883
+vn 0.217679 0.500158 0.838128
+vn 0.210670 0.504682 0.837206
+vn -0.215604 0.500339 0.838556
+vn -0.215604 0.500339 0.838556
+vn -0.222555 0.503321 0.834948
+vn 0.217679 0.500158 0.838128
+vn -0.000023 -0.229526 0.973303
+vn -0.000000 -0.229513 0.973306
+vn -0.000000 -0.376771 0.926306
+vn -0.000000 -0.376771 0.926306
+vn -0.000000 -0.376771 0.926306
+vn -0.000023 -0.229526 0.973303
+vn 1.000000 0.000000 -0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 1.000000 -0.000000 0.000000
+vn 0.999977 0.000111 0.006741
+vn 1.000000 0.000000 -0.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.000000 -1.000000
+vn -1.000000 -0.000000 -0.000001
+vn -1.000000 -0.000000 -0.000000
+vn -1.000000 -0.000000 -0.000001
+vn -1.000000 -0.000000 -0.000001
+vn -1.000000 0.000000 -0.000002
+vn -1.000000 -0.000000 -0.000001
+s off
+usemtl Chassis
+f 1//1 2//2 3//3
+f 4//4 5//5 6//6
+f 7//7 8//8 9//9
+f 8//10 10//11 9//12
+f 10//13 11//14 9//15
+f 12//16 13//17 14//18
+f 15//19 13//20 12//21
+f 16//22 13//23 15//24
+f 17//25 18//26 19//27
+f 20//28 17//29 19//30
+f 21//31 22//32 23//33
+f 24//34 22//35 21//36
+usemtl Hull
+f 25//37 26//38 27//39
+f 28//40 25//41 27//42
+f 29//43 30//44 31//45
+f 31//46 30//47 32//48
+usemtl Chassis
+f 33//49 34//50 35//51
+f 36//52 37//53 38//54
+f 39//55 40//56 41//57
+f 42//58 43//59 44//60
+f 44//61 45//62 42//63
+f 46//64 47//65 48//66
+f 48//67 49//68 46//69
+f 50//70 51//71 52//72
+f 52//73 53//74 50//75
+f 54//76 55//77 56//78
+f 56//79 57//80 54//81
+usemtl Window
+f 58//82 59//83 60//84
+f 60//85 61//86 58//87
+f 58//88 62//89 63//90
+f 63//91 59//92 58//93
+f 59//94 63//95 64//96
+f 64//97 60//98 59//99
+usemtl Hull
+f 65//100 66//101 67//102
+f 67//103 68//104 65//105
+usemtl Chassis
+f 69//106 70//107 71//108
+f 71//109 72//110 69//111
+f 69//112 73//113 74//114
+f 74//115 70//116 69//117
+f 75//118 70//119 74//120
+f 74//121 76//122 75//123
+f 77//124 74//125 73//126
+f 73//127 78//128 77//129
+f 75//130 76//131 79//132
+f 79//133 80//134 75//135
+f 81//136 80//137 79//138
+f 79//139 82//140 81//141
+f 83//142 82//143 79//144
+f 79//145 84//146 83//147
+f 1//148 3//149 85//150
+f 85//151 86//152 1//153
+f 85//154 87//155 88//156
+f 88//157 86//158 85//159
+f 89//160 90//161 88//162
+f 88//163 87//164 89//165
+f 91//166 89//167 87//168
+f 87//169 85//170 91//171
+f 2//172 91//173 85//174
+f 85//175 3//176 2//177
+f 4//178 92//179 93//180
+f 93//181 5//182 4//183
+f 6//184 5//185 93//186
+f 93//187 94//188 6//189
+f 94//190 93//191 95//192
+f 95//193 96//194 94//195
+f 96//196 95//197 97//198
+f 97//199 98//200 96//201
+f 93//202 92//203 97//204
+f 97//205 95//206 93//207
+f 99//208 100//209 101//210
+f 101//211 102//212 99//213
+f 101//214 100//215 8//216
+f 8//217 7//218 101//219
+f 103//220 104//221 11//222
+f 11//223 10//224 103//225
+f 105//226 104//227 103//228
+f 103//229 106//230 105//231
+f 107//232 108//233 109//234
+f 109//235 110//236 107//237
+f 108//238 12//239 14//240
+f 14//241 109//242 108//243
+f 111//244 16//245 15//246
+f 15//247 112//248 111//249
+f 113//250 111//251 112//252
+f 112//253 114//254 113//255
+f 33//256 35//257 115//258
+f 115//259 116//260 33//261
+f 35//262 34//263 117//264
+f 117//265 115//266 35//267
+f 118//268 119//269 18//270
+f 18//271 17//272 118//273
+f 120//274 118//275 17//276
+f 17//277 20//278 120//279
+f 121//280 21//281 23//282
+f 23//283 122//284 121//285
+f 121//286 123//287 24//288
+f 24//289 21//290 121//291
+usemtl Hull
+f 124//292 125//293 126//294
+f 126//295 127//296 124//297
+usemtl Chassis
+f 128//298 129//299 130//300
+f 130//301 131//302 128//303
+usemtl Hull
+f 132//304 133//305 134//306
+f 134//307 135//308 132//309
+f 132//310 136//311 137//312
+f 137//313 133//314 132//315
+f 132//316 138//317 139//318
+f 139//319 133//320 132//321
+f 140//322 141//323 138//324
+f 138//325 139//326 140//327
+f 138//328 142//329 143//330
+f 143//331 139//332 138//333
+f 138//334 144//335 145//336
+f 145//337 139//338 138//339
+f 138//340 142//341 146//342
+f 146//343 141//344 138//345
+f 140//346 147//347 143//348
+f 143//349 139//350 140//351
+usemtl Chassis
+f 148//352 149//353 150//354
+f 150//355 151//356 148//357
+usemtl Hull
+f 140//358 137//359 136//360
+f 136//361 141//362 140//363
+f 134//364 145//365 144//366
+f 144//367 135//368 134//369
+usemtl Chassis
+f 121//370 36//371 38//372
+f 38//373 123//374 121//375
+f 121//376 122//377 37//378
+f 37//379 36//380 121//381
+f 69//382 72//383 78//384
+f 78//385 73//386 69//387
+usemtl Hull
+f 140//388 141//389 146//390
+f 146//391 147//392 140//393
+f 152//394 153//395 154//396
+f 154//397 155//398 152//399
+f 156//400 157//401 153//402
+f 153//403 152//404 156//405
+f 156//406 158//407 159//408
+f 159//409 157//410 156//411
+f 160//412 161//413 162//414
+f 162//415 163//416 160//417
+usemtl Window
+f 158//418 160//419 163//420
+f 163//421 159//422 158//423
+usemtl Hull
+f 164//424 165//425 166//426
+f 166//427 167//428 164//429
+usemtl Window
+f 155//430 154//431 165//432
+f 165//433 164//434 155//435
+usemtl Hull
+f 161//436 167//437 166//438
+f 166//439 162//440 161//441
+f 168//442 169//443 170//444
+f 170//445 171//446 168//447
+f 168//448 172//449 173//450
+f 173//451 169//452 168//453
+f 172//454 174//455 175//456
+f 175//457 176//458 172//459
+f 176//460 175//461 177//462
+f 177//463 178//464 176//465
+f 176//466 178//467 179//468
+f 179//469 180//470 176//471
+f 178//472 181//473 182//474
+f 182//475 179//476 178//477
+usemtl Chassis
+f 183//478 184//479 185//480
+f 185//481 186//482 183//483
+f 184//484 187//485 188//486
+f 188//487 185//488 184//489
+f 187//490 189//491 190//492
+f 190//493 188//494 187//495
+usemtl Spoke
+f 185//496 188//497 191//498
+f 191//499 192//500 185//501
+usemtl Rim
+f 188//502 190//503 193//504
+f 193//505 191//506 188//507
+usemtl Hull
+f 194//508 195//509 196//510
+f 196//511 193//512 194//513
+f 194//514 197//515 198//516
+f 198//517 195//518 194//519
+f 199//520 192//521 200//522
+f 200//523 201//524 199//525
+f 192//526 191//527 202//528
+f 202//529 200//530 192//531
+f 195//532 203//533 204//534
+f 204//535 196//536 195//537
+f 202//538 196//539 204//540
+f 204//541 205//542 202//543
+usemtl Chassis
+f 206//544 207//545 208//546
+f 208//547 209//548 206//549
+usemtl Spoke
+f 169//550 173//551 210//552
+f 210//553 207//554 169//555
+usemtl Rim
+f 173//556 180//557 211//558
+f 211//559 210//560 173//561
+usemtl Chassis
+f 212//562 213//563 214//564
+f 214//565 211//566 212//567
+f 212//568 215//569 216//570
+f 216//571 213//572 212//573
+f 207//574 210//575 217//576
+f 217//577 208//578 207//579
+f 211//580 214//581 217//582
+f 217//583 210//584 211//585
+f 55//586 50//587 53//588
+f 53//589 56//590 55//591
+f 43//592 46//593 49//594
+f 49//595 44//596 43//597
+usemtl Window
+f 218//598 219//599 220//600
+f 220//601 221//602 218//603
+f 218//604 221//605 222//606
+f 222//607 223//608 218//609
+f 221//610 220//611 224//612
+f 224//613 222//614 221//615
+usemtl Chassis
+f 39//616 41//617 118//618
+f 118//619 120//620 39//621
+f 118//622 41//623 40//624
+f 40//625 119//626 118//627
+f 81//628 225//629 226//630
+f 226//631 227//632 81//633
+usemtl Hull
+f 142//634 65//635 68//636
+f 68//637 143//638 142//639
+f 139//640 143//641 68//642
+f 68//643 67//644 139//645
+f 138//646 66//647 65//648
+f 65//649 142//650 138//651
+usemtl Window
+f 62//652 228//653 64//654
+f 64//655 63//656 62//657
+f 223//658 222//659 224//660
+f 224//661 229//662 223//663
+usemtl Hull
+f 230//664 231//665 232//666
+f 232//667 233//668 230//669
+f 234//670 235//671 236//672
+f 236//673 237//674 234//675
+usemtl Chassis
+f 238//676 239//677 240//678
+f 240//679 241//680 238//681
+usemtl Hull
+f 160//682 164//683 167//684
+f 167//685 161//686 160//687
+usemtl Chassis
+f 242//688 243//689 244//690
+f 244//691 245//692 242//693
+usemtl Rim
+f 245//694 244//695 197//696
+f 197//697 194//698 245//699
+f 186//700 185//701 192//702
+f 192//703 199//704 186//705
+f 170//706 169//707 207//708
+f 207//709 206//710 170//711
+f 179//712 182//713 215//714
+f 215//715 212//716 179//717
+f 126//718 246//719 42//720
+f 42//721 128//722 126//723
+f 247//724 43//725 42//726
+f 42//727 246//728 247//729
+usemtl Chassis
+f 128//730 42//731 45//732
+f 45//733 129//734 128//735
+f 44//736 49//737 48//738
+f 48//739 45//740 44//741
+f 48//742 130//743 129//744
+f 129//745 45//746 48//747
+f 47//748 131//749 130//750
+f 130//751 48//752 47//753
+usemtl Spoke
+f 233//754 232//755 47//756
+f 47//757 46//758 233//759
+usemtl Rim
+f 232//760 127//761 131//762
+f 131//763 47//764 232//765
+usemtl Hull
+f 231//766 124//767 127//768
+f 127//769 232//770 231//771
+f 237//772 236//773 231//774
+f 231//775 230//776 237//777
+f 236//778 248//779 124//780
+f 124//781 231//782 236//783
+f 235//784 249//785 248//786
+f 248//787 236//788 235//789
+usemtl Spoke
+f 234//790 53//791 52//792
+f 52//793 235//794 234//795
+usemtl Rim
+f 235//796 52//797 240//798
+f 240//799 249//800 235//801
+usemtl Chassis
+f 51//802 241//803 240//804
+f 240//805 52//806 51//807
+f 238//808 241//809 51//810
+f 51//811 54//812 238//813
+f 54//814 51//815 50//816
+f 50//817 55//818 54//819
+f 238//820 54//821 57//822
+f 57//823 239//824 238//825
+usemtl Rim
+f 250//826 239//827 57//828
+f 57//829 251//830 250//831
+f 252//832 251//833 57//834
+f 57//835 56//836 252//837
+usemtl Window
+f 58//838 61//839 228//840
+f 228//841 62//842 58//843
+f 60//844 64//845 228//846
+f 228//847 61//848 60//849
+usemtl Hull
+f 138//850 139//851 67//852
+f 67//853 66//854 138//855
+usemtl Chassis
+f 71//856 77//857 78//858
+f 78//859 72//860 71//861
+f 75//862 253//863 71//864
+f 71//865 70//866 75//867
+f 254//868 76//869 74//870
+f 74//871 77//872 254//873
+f 81//874 227//875 255//876
+f 255//877 80//878 81//879
+f 75//880 80//881 255//882
+f 255//883 253//884 75//885
+f 84//886 79//887 76//888
+f 76//889 254//890 84//891
+f 83//892 84//893 255//894
+f 255//895 227//896 83//897
+f 106//898 103//899 100//900
+f 100//901 99//902 106//903
+f 100//904 103//905 10//906
+f 10//907 8//908 100//909
+f 114//910 112//911 108//912
+f 108//913 107//914 114//915
+f 112//916 15//917 12//918
+f 12//919 108//920 112//921
+usemtl Hull
+f 29//922 28//923 27//924
+f 27//925 30//926 29//927
+f 29//928 31//929 25//930
+f 25//931 28//932 29//933
+f 31//934 32//935 26//936
+f 26//937 25//938 31//939
+f 32//940 30//941 27//942
+f 27//943 26//944 32//945
+usemtl Rim
+f 249//946 240//947 239//948
+f 239//949 250//950 249//951
+usemtl Hull
+f 249//952 250//953 256//954
+f 256//955 248//956 249//957
+f 248//958 256//959 125//960
+f 125//961 124//962 248//963
+usemtl Rim
+f 127//964 126//965 128//966
+f 128//967 131//968 127//969
+usemtl Hull
+f 132//970 138//971 141//972
+f 141//973 136//974 132//975
+f 140//976 139//977 133//978
+f 133//979 137//980 140//981
+usemtl Chassis
+f 257//982 258//983 259//984
+f 259//985 260//986 257//987
+f 253//988 260//989 259//990
+f 259//991 71//992 253//993
+f 148//994 151//995 259//996
+f 259//997 258//998 148//999
+f 150//1000 254//1001 77//1002
+f 77//1003 151//1004 150//1005
+f 77//1006 71//1007 259//1008
+f 259//1009 151//1010 77//1011
+f 261//1012 82//1013 83//1014
+f 83//1015 262//1016 261//1017
+f 81//1018 82//1019 261//1020
+f 261//1021 225//1022 81//1023
+f 225//1024 261//1025 262//1026
+f 262//1027 226//1028 225//1029
+f 226//1030 262//1031 83//1032
+f 83//1033 227//1034 226//1035
+usemtl Hull
+f 133//1036 139//1037 145//1038
+f 145//1039 134//1040 133//1041
+f 156//1042 152//1043 155//1044
+f 155//1045 158//1046 156//1047
+usemtl Window
+f 158//1048 155//1049 164//1050
+f 164//1051 160//1052 158//1053
+usemtl Hull
+f 168//1054 171//1055 263//1056
+f 263//1057 264//1058 168//1059
+f 168//1060 264//1061 174//1062
+f 174//1063 172//1064 168//1065
+f 172//1066 176//1067 180//1068
+f 180//1069 173//1070 172//1071
+f 178//1072 177//1073 265//1074
+f 265//1075 181//1076 178//1077
+f 181//1078 265//1079 263//1080
+f 263//1081 171//1082 181//1083
+f 181//1084 171//1085 170//1086
+f 170//1087 182//1088 181//1089
+usemtl Chassis
+f 242//1090 245//1091 190//1092
+f 190//1093 189//1094 242//1095
+f 242//1096 189//1097 187//1098
+f 187//1099 243//1100 242//1101
+f 183//1102 243//1103 187//1104
+f 187//1105 184//1106 183//1107
+f 183//1108 186//1109 244//1110
+f 244//1111 243//1112 183//1113
+usemtl Rim
+f 245//1114 194//1115 193//1116
+f 193//1117 190//1118 245//1119
+f 244//1120 186//1121 199//1122
+f 199//1123 197//1124 244//1125
+usemtl Hull
+f 197//1126 199//1127 201//1128
+f 201//1129 198//1130 197//1131
+f 191//1132 193//1133 196//1134
+f 196//1135 202//1136 191//1137
+f 195//1138 198//1139 266//1140
+f 266//1141 203//1142 195//1143
+f 198//1144 201//1145 267//1146
+f 267//1147 266//1148 198//1149
+f 201//1150 200//1151 268//1152
+f 268//1153 267//1154 201//1155
+f 200//1156 202//1157 205//1158
+f 205//1159 268//1160 200//1161
+f 266//1162 267//1163 263//1164
+f 263//1165 265//1166 266//1167
+f 267//1168 268//1169 264//1170
+f 264//1171 263//1172 267//1173
+usemtl Rim
+f 182//1174 170//1175 206//1176
+f 206//1177 215//1178 182//1179
+usemtl Chassis
+f 215//1180 206//1181 209//1182
+f 209//1183 216//1184 215//1185
+usemtl Rim
+f 179//1186 212//1187 211//1188
+f 211//1189 180//1190 179//1191
+usemtl Chassis
+f 217//1192 214//1193 213//1194
+f 213//1195 216//1196 217//1197
+f 209//1198 208//1199 217//1200
+f 217//1201 216//1202 209//1203
+usemtl Hull
+f 252//1204 234//1205 237//1206
+f 237//1207 269//1208 252//1209
+usemtl Rim
+f 252//1210 56//1211 53//1212
+f 53//1213 234//1214 252//1215
+usemtl Hull
+f 269//1216 237//1217 230//1218
+f 230//1219 270//1220 269//1221
+f 270//1222 230//1223 233//1224
+f 233//1225 247//1226 270//1227
+usemtl Rim
+f 247//1228 233//1229 46//1230
+f 46//1231 43//1232 247//1233
+usemtl Chassis
+f 113//1234 114//1235 107//1236
+f 107//1237 110//1238 113//1239
+f 105//1240 106//1241 99//1242
+f 99//1243 102//1244 105//1245
+usemtl Hull
+f 268//1246 205//1247 174//1248
+f 174//1249 264//1250 268//1251
+f 205//1252 204//1253 175//1254
+f 175//1255 174//1256 205//1257
+f 266//1258 265//1259 177//1260
+f 177//1261 203//1262 266//1263
+f 177//1264 175//1265 204//1266
+f 204//1267 203//1268 177//1269
+f 142//1270 143//1271 147//1272
+f 147//1273 146//1274 142//1275
+f 132//1276 135//1277 144//1278
+f 144//1279 138//1280 132//1281
+usemtl Window
+f 218//1282 223//1283 229//1284
+f 229//1285 219//1286 218//1287
+f 220//1288 219//1289 229//1290
+f 229//1291 224//1292 220//1293
diff --git a/data/lightcycle.mtl b/data/lightcycle.mtl
new file mode 100644
index 0000000..a2c830a
--- /dev/null
+++ b/data/lightcycle.mtl
@@ -0,0 +1,44 @@
+newmtl Hull
+Ka 0.0813 0.0813 0.0813
+Kd 0.7813 0.7813 0.7813
+Ks 0.6813 0.6813 0.6813
+Ns 5.0000
+Ni 1.0000
+illum 2
+
+newmtl Window
+Ka 0.0000 0.0000 0.0000
+Kd 0.0000 0.0000 0.0000
+Ks 1.0 1.0 1.0
+Ns 30.0000
+Ni 1.0000
+illum 2
+
+newmtl Rim
+Ka 0.0000 0.0000 0.0000
+Kd 0.0000 0.0000 0.0000
+Ks 0.0 0.0 0.0
+Ns 0.0000
+Ni 1.0000
+illum 2
+
+newmtl Spoke
+Ka 0.0 0.0 0.0
+Kd 0.0 0.0 0.0
+Ks 0.0 0.0 0.0
+Ns 30.0
+Ni 1.0
+illum 20
+
+newmtl Chassis
+Ka 0.2000 0.2000 0.2000
+Kd 0.5000 0.5000 0.5000
+Ks 0.3000 0.3000 0.3000
+Ns 3.0000
+Ni 1.0000
+illum 2
+
+
+
+
+
diff --git a/data/recognizer.mtl b/data/recognizer.mtl
new file mode 100644
index 0000000..9fc3cf0
--- /dev/null
+++ b/data/recognizer.mtl
@@ -0,0 +1,11 @@
+#
+# Wavefront material file
+# Converted by 3D Exploration 1.3.00 BETA
+# XDimension Software
+# http://www.xdsoft.com/explorer/
+#
+newmtl Hull
+ Ka 0.2 0.290196 0.215686
+ Kd 0.14902 0.458824 0.164706
+ Ks 0.898039 0.898039 0.898039
+ illum 0
diff --git a/data/recognizer.obj b/data/recognizer.obj
new file mode 100644
index 0000000..4408435
--- /dev/null
+++ b/data/recognizer.obj
@@ -0,0 +1,813 @@
+#
+# Wavefront OBJ file
+# Converted by the 3D Exploration 1.7
+# XDimension Software, LLC
+# http://www.xdsoft.com/explorer/
+#
+# object Middle Bar
+mtllib recognizer.mtl
+g Middle_Bar
+v -140.483 5 32.6104
+v 139.517 5 32.6104
+v -140.483 5 42.6104
+v 139.517 5 42.6104
+v -140.483 -52.488 32.6104
+v 139.517 -52.488 32.6104
+v -140.483 -55 42.6104
+v 139.517 -55 42.6104
+# 8 verticies
+vn 0 1 9.53674e-08
+vn 0 -0.969869 -0.243628
+vn 0 0 -1
+vn 1 0 0
+vn 0 -6.35783e-08 1
+vn -1 0 0
+# 6 normals
+usemtl Hull
+f 1//1 3//1 4//1
+f 4//1 2//1 1//1
+f 5//2 6//2 8//2
+f 8//2 7//2 5//2
+f 1//3 2//3 6//3
+f 6//3 5//3 1//3
+f 2//4 4//4 8//4
+f 8//4 6//4 2//4
+f 4//5 3//5 7//5
+f 7//5 8//5 4//5
+f 3//6 1//6 5//6
+f 5//6 7//6 3//6
+# object Shoulder01
+g Shoulder01
+v -150.491 5 90.6522
+v -10.4913 5 90.6522
+v -150.491 5 100.652
+v -10.4913 5 100.652
+v -150.491 -55 90.6522
+v -10.4913 -55 90.6522
+v -150.491 -55 100.652
+v -10.4913 -55 100.652
+# 8 verticies
+vn 0 1 9.53674e-08
+vn 0 -1 0
+vn 0 1.27157e-07 -1
+vn 1 0 0
+vn 0 -1.27157e-07 1
+vn -1 0 0
+# 6 normals
+f 9//7 11//7 12//7
+f 12//7 10//7 9//7
+f 13//8 14//8 16//8
+f 16//8 15//8 13//8
+f 9//9 10//9 14//9
+f 14//9 13//9 9//9
+f 10//10 12//10 16//10
+f 16//10 14//10 10//10
+f 12//11 11//11 15//11
+f 15//11 16//11 12//11
+f 11//12 9//12 13//12
+f 13//12 15//12 11//12
+# object Shoulder02
+g Shoulder02
+v 9.56645 5 90.6522
+v 149.566 5 90.6522
+v 9.56645 5 100.652
+v 149.566 5 100.652
+v 9.56645 -55 90.6522
+v 149.566 -55 90.6522
+v 9.56645 -55 100.652
+v 149.566 -55 100.652
+# 8 verticies
+vn 0 1 9.53674e-08
+vn 0 -1 0
+vn 0 1.27157e-07 -1
+vn 1 0 0
+vn 0 -1.27157e-07 1
+vn -1 0 0
+# 6 normals
+f 17//13 19//13 20//13
+f 20//13 18//13 17//13
+f 21//14 22//14 24//14
+f 24//14 23//14 21//14
+f 17//15 18//15 22//15
+f 22//15 21//15 17//15
+f 18//16 20//16 24//16
+f 24//16 22//16 18//16
+f 20//17 19//17 23//17
+f 23//17 24//17 20//17
+f 19//18 17//18 21//18
+f 21//18 23//18 19//18
+# object Chest01
+g Chest01
+v -27.9831 3.17897 67.8053
+v 27.0169 3.17897 67.8053
+v -39.7688 3.17897 88.366
+v 38.8026 3.17897 88.366
+v -27.9831 -52.2233 67.8052
+v 27.0169 -52.2233 67.8052
+v -39.7688 -50.0614 88.366
+v 38.8026 -50.0614 88.366
+# 8 verticies
+vn 0 1 -3.47874e-08
+vn 0 -0.994518 0.10457
+vn 0 1.37709e-07 -1
+vn 0.867575 1.32036e-07 -0.497307
+vn 0.867575 1.95589e-07 -0.497306
+vn 0.867575 6.84837e-08 -0.497307
+vn 0 -1.43301e-07 1
+vn -0.867575 7.7119e-09 -0.497306
+vn -0.867575 6.84837e-08 -0.497307
+vn -0.867575 -5.30599e-08 -0.497306
+# 10 normals
+f 25//19 27//19 28//19
+f 28//19 26//19 25//19
+f 29//20 30//20 32//20
+f 32//20 31//20 29//20
+f 25//21 26//21 30//21
+f 30//21 29//21 25//21
+f 26//22 28//23 32//22
+f 32//22 30//24 26//22
+f 28//25 27//25 31//25
+f 31//25 32//25 28//25
+f 27//26 25//27 29//26
+f 29//26 31//28 27//26
+# object LegA01
+g LegA01
+v -138.604 -2.5 44.6729
+v -111.604 -2.5 44.6729
+v -138.604 -2.5 89.0729
+v -111.604 -2.5 89.0729
+v -138.604 -47.5 44.6729
+v -111.604 -47.5 44.6729
+v -138.604 -47.5 89.0729
+v -111.604 -47.5 89.0729
+# 8 verticies
+vn 0 1 4.29583e-08
+vn 0 -1 8.59166e-08
+vn 0 8.4771e-08 -1
+vn 1 0 0
+vn 0 -1.69542e-07 1
+vn -1 0 0
+# 6 normals
+f 33//29 35//29 36//29
+f 36//29 34//29 33//29
+f 37//30 38//30 40//30
+f 40//30 39//30 37//30
+f 33//31 34//31 38//31
+f 38//31 37//31 33//31
+f 34//32 36//32 40//32
+f 40//32 38//32 34//32
+f 36//33 35//33 39//33
+f 39//33 40//33 36//33
+f 35//34 33//34 37//34
+f 37//34 39//34 35//34
+# object LegB01
+g LegB01
+v 110.638 -2.5 44.6729
+v 137.638 -2.5 44.6729
+v 110.638 -2.5 89.0729
+v 137.638 -2.5 89.0729
+v 110.638 -47.5 44.6729
+v 137.638 -47.5 44.6729
+v 110.638 -47.5 89.0729
+v 137.638 -47.5 89.0729
+# 8 verticies
+vn 0 1 4.29583e-08
+vn 0 -1 8.59166e-08
+vn 0 8.4771e-08 -1
+vn 1 0 0
+vn 0 -1.69542e-07 1
+vn -1 0 0
+# 6 normals
+f 41//35 43//35 44//35
+f 44//35 42//35 41//35
+f 45//36 46//36 48//36
+f 48//36 47//36 45//36
+f 41//37 42//37 46//37
+f 46//37 45//37 41//37
+f 42//38 44//38 48//38
+f 48//38 46//38 42//38
+f 44//39 43//39 47//39
+f 47//39 48//39 44//39
+f 43//40 41//40 45//40
+f 45//40 47//40 43//40
+# object Bar02
+g Bar02
+v 79.3256 -7.83574e-06 63.0187
+v 106.326 -7.83574e-06 63.0187
+v 79.3256 -7.42305e-06 73.0187
+v 106.326 -7.42305e-06 73.0187
+v 79.3256 -50 63.0187
+v 106.326 -50 63.0187
+v 79.3256 -50 73.0187
+v 106.326 -50 73.0187
+# 8 verticies
+vn 0 1 -4.12693e-08
+vn 0 -1 3.8147e-07
+vn 0 7.62939e-08 -1
+vn 1 0 0
+vn 0 0 1
+vn -1 0 0
+# 6 normals
+f 49//41 51//41 52//41
+f 52//41 50//41 49//41
+f 53//42 54//42 56//42
+f 56//42 55//42 53//42
+f 49//43 50//43 54//43
+f 54//43 53//43 49//43
+f 50//44 52//44 56//44
+f 56//44 54//44 50//44
+f 52//45 51//45 55//45
+f 55//45 56//45 52//45
+f 51//46 49//46 53//46
+f 53//46 55//46 51//46
+# object Bar01
+g Bar01
+v -107.292 -7.83574e-06 63.0187
+v -80.2918 -7.83574e-06 63.0187
+v -107.292 -7.42305e-06 73.0187
+v -80.2918 -7.42305e-06 73.0187
+v -107.292 -50 63.0187
+v -80.2918 -50 63.0187
+v -107.292 -50 73.0187
+v -80.2918 -50 73.0187
+# 8 verticies
+vn 0 1 -4.12693e-08
+vn 0 -1 3.8147e-07
+vn 0 7.62939e-08 -1
+vn 1 0 0
+vn 0 0 1
+vn -1 0 0
+# 6 normals
+f 57//47 59//47 60//47
+f 60//47 58//47 57//47
+f 61//48 62//48 64//48
+f 64//48 63//48 61//48
+f 57//49 58//49 62//49
+f 62//49 61//49 57//49
+f 58//50 60//50 64//50
+f 64//50 62//50 58//50
+f 60//51 59//51 63//51
+f 63//51 64//51 60//51
+f 59//52 57//52 61//52
+f 61//52 63//52 59//52
+# object LegA02
+g LegA02
+v -138.604 -2.5 -108.936
+v -75.413 -2.5 -108.936
+v -138.604 -2.5 -90.182
+v -111.604 -2.5 -90.182
+v -138.604 -2.5 31.0636
+v -111.604 -2.5 31.0636
+v -138.604 -47.5 -108.936
+v -75.413 -47.5 -108.936
+v -138.604 -47.5 -90.182
+v -111.604 -47.5 -90.182
+v -138.604 -47.5 31.0636
+v -111.604 -47.5 31.0636
+# 12 verticies
+vn 0 1 1.52553e-07
+vn 0 1 6.52712e-08
+vn 0 1 1.08912e-07
+vn 0 1 2.16305e-08
+vn 0 -1 2.03404e-07
+vn 0 -1 1.25115e-07
+vn 0 -1 4.68262e-08
+vn 0 -1 -3.14625e-08
+vn 0 0 -1
+vn 0.460093 0 0.887871
+vn 1 0 0
+vn 0 -4.23855e-08 1
+vn -1 0 0
+# 13 normals
+f 65//53 67//54 68//55
+f 68//55 66//53 65//53
+f 67//54 69//56 70//56
+f 70//56 68//55 67//54
+f 71//57 72//57 74//58
+f 74//58 73//59 71//57
+f 73//59 74//58 76//60
+f 76//60 75//60 73//59
+f 65//61 66//61 72//61
+f 72//61 71//61 65//61
+f 66//62 68//62 74//62
+f 74//62 72//62 66//62
+f 68//63 70//63 76//63
+f 76//63 74//63 68//63
+f 70//64 69//64 75//64
+f 75//64 76//64 70//64
+f 69//65 67//65 73//65
+f 73//65 75//65 69//65
+f 67//65 65//65 71//65
+f 71//65 73//65 67//65
+# object Lower Midd
+g Lower_Midd
+v -31.9831 2.44438 23.265
+v 31.0169 2.44438 23.265
+v -37.9831 2.44438 30.6854
+v 37.0169 2.44438 30.6854
+v -31.9831 -49.7811 23.2649
+v 31.0169 -49.7811 23.2649
+v -37.9831 -52.4122 30.6854
+v 37.0169 -52.4122 30.6854
+# 8 verticies
+vn 0 1 0
+vn 0 -0.942507 -0.334187
+vn 0 3.65214e-08 -1
+vn 0.777605 3.33431e-08 -0.628754
+vn 0.777605 4.37232e-08 -0.628754
+vn 0.777604 2.2963e-08 -0.628754
+vn 0 -6.95395e-08 1
+vn -0.777605 3.33431e-08 -0.628754
+vn -0.777605 2.2963e-08 -0.628754
+vn -0.777604 4.37232e-08 -0.628754
+# 10 normals
+f 77//66 79//66 80//66
+f 80//66 78//66 77//66
+f 81//67 82//67 84//67
+f 84//67 83//67 81//67
+f 77//68 78//68 82//68
+f 82//68 81//68 77//68
+f 78//69 80//70 84//69
+f 84//69 82//71 78//69
+f 80//72 79//72 83//72
+f 83//72 84//72 80//72
+f 79//73 77//74 81//73
+f 81//73 83//75 79//73
+# object Head
+g Head
+v -26.0768 4.99999 104.591
+v 25.1107 4.99999 104.591
+v -20.8268 0.818023 119.111
+v 19.8607 0.818023 119.111
+v -26.0768 -55 104.591
+v 25.1107 -55 104.591
+v -20.8268 -44.5524 119.111
+v 19.8607 -44.5524 119.111
+# 8 verticies
+vn 0 0.960938 0.276762
+vn 0 -0.811715 0.584054
+vn 0 0 -1
+vn 0.940417 -1.97673e-08 0.340025
+vn 0.940417 -3.95346e-08 0.340025
+vn 0.940417 0 0.340025
+vn 0 0 1
+vn -0.940417 1.97673e-08 0.340025
+vn -0.940417 0 0.340025
+vn -0.940417 3.95346e-08 0.340025
+# 10 normals
+f 85//76 87//76 88//76
+f 88//76 86//76 85//76
+f 89//77 90//77 92//77
+f 92//77 91//77 89//77
+f 85//78 86//78 90//78
+f 90//78 89//78 85//78
+f 86//79 88//80 92//79
+f 92//79 90//81 86//79
+f 88//82 87//82 91//82
+f 91//82 92//82 88//82
+f 87//83 85//84 89//83
+f 89//83 91//85 87//83
+# object Chest02
+g Chest02
+v 9.50792 3.17897 66.114
+v 9.50792 3.17897 52.5693
+v 65.8137 3.17897 52.5693
+v 81.2614 3.17896 88.9498
+v 42.0824 3.17896 88.9498
+v 29.1534 3.17897 66.114
+v 9.50793 -52.4011 66.114
+v 9.50793 -53.8253 52.5693
+v 65.8137 -53.8253 52.5693
+v 81.2614 -50 88.9498
+v 42.0825 -50 88.9498
+v 29.1534 -52.4011 66.114
+# 12 verticies
+vn -1 -1.69442e-07 9.0208e-09
+vn -1 -1.67299e-07 5.88969e-15
+vn -1 -1.71586e-07 1.80416e-08
+vn 0 0 -1
+vn 0.920458 1.32055e-07 -0.390841
+vn 0.920458 2.6411e-07 -0.390841
+vn 0.920458 0 -0.390841
+vn 0 0 1
+vn -0.870205 -1.87175e-07 0.49269
+vn -0.870205 -1.87083e-07 0.49269
+vn -0.870205 -1.87268e-07 0.49269
+vn 0 -1.37268e-07 1
+vn 2.37897e-08 1 7.8056e-08
+vn 3.56845e-08 1 1.34686e-07
+vn 0 1 1.11409e-07
+vn 2.37897e-08 1 2.91848e-08
+vn 0 1 -3.52046e-08
+vn 6.79452e-08 -0.994518 0.10457
+vn 0 -0.994518 0.10457
+vn 1.01918e-07 -0.994518 0.10457
+vn 6.79452e-08 -0.994518 0.10457
+vn 0 -0.994518 0.10457
+# 22 normals
+f 93//86 94//87 100//86
+f 93//86 100//86 99//88
+f 94//89 95//89 101//89
+f 94//89 101//89 100//89
+f 95//90 96//91 102//90
+f 95//90 102//90 101//92
+f 96//93 97//93 103//93
+f 96//93 103//93 102//93
+f 97//94 98//95 104//94
+f 97//94 104//94 103//96
+f 98//97 93//97 99//97
+f 98//97 99//97 104//97
+f 95//98 97//99 96//100
+f 95//98 98//101 97//99
+f 94//102 98//101 95//98
+f 94//102 93//102 98//101
+f 101//103 102//104 103//105
+f 101//103 103//105 104//106
+f 100//107 101//103 104//106
+f 100//107 104//106 99//107
+# object Upper Midd
+g Upper_Midd
+v -61.7065 3.17897 44.7497
+v 60.7403 3.17897 44.7497
+v -64.9831 3.17897 50.8321
+v 64.0169 3.17897 50.8321
+v -61.7065 -54.6475 44.7497
+v 60.7403 -54.6475 44.7497
+v -64.9831 -54.008 50.8321
+v 64.0169 -54.008 50.8321
+# 8 verticies
+vn 0 1 0
+vn 0 -0.994518 0.104569
+vn 0 0 -1
+vn 0.880381 1.58182e-08 -0.474268
+vn 0.880381 3.16364e-08 -0.474268
+vn 0.88038 0 -0.474268
+vn 0 -6.67058e-08 1
+vn -0.880381 1.58182e-08 -0.474268
+vn -0.880381 0 -0.474268
+vn -0.88038 3.16364e-08 -0.474268
+# 10 normals
+f 105//108 107//108 108//108
+f 108//108 106//108 105//108
+f 109//109 110//109 112//109
+f 112//109 111//109 109//109
+f 105//110 106//110 110//110
+f 110//110 109//110 105//110
+f 106//111 108//112 112//111
+f 112//111 110//113 106//111
+f 108//114 107//114 111//114
+f 111//114 112//114 108//114
+f 107//115 105//116 109//115
+f 109//115 111//117 107//115
+# object Head01
+g Head01
+v 19.2607 2.00002 118.603
+v -20.2269 2.00001 118.603
+v -11.1143 -6.31388 145.091
+v 10.1482 -6.31388 145.091
+v 15.3119 -46.6 114.103
+v -16.2781 -46.6 114.103
+v -16.2781 -3.39998 114.103
+v 15.3119 -3.39998 114.103
+v -20.2268 -52 118.603
+v -11.1143 -26.7259 145.091
+v -10.0512 -27.0406 149.972
+v 9.08504 -27.0406 149.972
+v 9.08503 -8.66976 149.972
+v -10.0512 -8.66976 149.972
+v 10.1482 -26.7259 145.091
+v 19.2607 -52 118.603
+v 12.2744 -30.1023 147.813
+v -13.2406 -30.1024 147.813
+v -13.2406 -5.60795 147.813
+v 12.2744 -5.60794 147.813
+v 12.1079 -42.3555 128.711
+v 9.58973 -32.7047 138.825
+v 9.93852 -34.8278 136.6
+v -13.0741 -42.3555 128.711
+v -10.5559 -32.7047 138.825
+v -13.0551 -42.2632 128.807
+v -13.0741 -42.4313 128.711
+v 12.1079 -42.4313 128.711
+v 9.58974 -37.1741 137.868
+v -10.5559 -37.1741 137.868
+# 30 verticies
+vn -1.71999e-07 0.954108 0.299464
+vn -1.72822e-07 0.954108 0.299464
+vn -1.7868e-07 0.992766 0.120065
+vn -1.81468e-07 0.997549 -0.0699663
+vn -1.20756e-07 8.83031e-08 -1
+vn -2.41513e-07 -4.26527e-14 -1
+vn -3.19895e-14 1.76606e-07 -1
+vn -0.945609 -1.78141e-07 0.325306
+vn -0.945609 -1.7672e-07 0.325306
+vn -0.945609 -1.79561e-07 0.325306
+vn -0.293234 -5.13759e-08 0.956041
+vn 0.293234 6.089e-08 0.956041
+vn 0.293234 5.32787e-08 0.956041
+vn -0.293234 -4.56675e-08 0.956041
+vn 0.945609 1.4888e-07 0.325306
+vn 0.945609 1.2104e-07 0.325306
+vn 0.945609 1.7672e-07 0.325306
+vn 4.63837e-08 -0.640184 -0.768222
+vn 1.2369e-07 -0.640183 -0.768222
+vn -3.09227e-08 -0.640184 -0.768222
+vn -1.1596e-07 0.640185 -0.768221
+vn -0.751644 -7.2877e-08 -0.659569
+vn -0.751645 -1.3009e-08 -0.659568
+vn -0.751644 -1.32745e-07 -0.659569
+vn 0.751645 2.37581e-07 -0.659568
+vn 0.751645 2.25932e-07 -0.659568
+vn 0.751644 2.49229e-07 -0.659568
+vn 7.50588e-08 -0.627548 -0.778578
+vn 5.62941e-08 -0.627548 -0.778578
+vn 9.38235e-08 -0.627548 -0.778578
+vn -1.7728e-07 0.967966 -0.251083
+vn -1.80898e-07 0.967966 -0.251083
+vn -0.788013 -1.50336e-07 -0.615659
+vn -0.788013 -1.47268e-07 -0.615659
+vn -0.788013 -1.53404e-07 -0.615659
+vn 0.788013 1.34995e-07 -0.615659
+vn 0.788013 1.47268e-07 -0.615659
+vn 0.788013 1.22723e-07 -0.615659
+vn 1.00538e-07 -0.576393 0.817173
+vn 8.61753e-08 -0.576393 0.817173
+vn 1.149e-07 -0.576393 0.817173
+vn 0.560687 1.01873e-07 0.828028
+vn 0.560687 8.73199e-08 0.828028
+vn -1.11309e-07 0.576391 0.817174
+vn -1.07719e-07 0.576391 0.817174
+vn -1.149e-07 0.576391 0.817174
+vn -0.560687 -9.8235e-08 0.828028
+vn -0.560687 -1.0915e-07 0.828028
+vn 6.22973e-08 -0.723497 0.690327
+vn -1.17426e-06 -0.723497 0.690327
+vn -7.03585e-07 -0.723497 0.690327
+vn 1.95224e-07 -0.723497 0.690327
+vn -8.38773e-05 -0.723492 0.690332
+vn -3.04282e-07 -0.540835 0.841129
+vn -2.37337e-06 -0.723497 0.690327
+vn -0.000140798 -0.723489 0.690336
+vn 1.07309e-06 -0.574707 0.818359
+vn -0.000209962 -0.723485 0.69034
+vn 6.56878e-08 -0.867253 0.497868
+vn 1.31376e-07 -0.867253 0.497868
+vn 0 -0.867253 0.497868
+vn 0 0 -1
+vn 0.964211 0 0.265138
+vn 0.964211 3.06608e-07 0.265138
+vn 0.970348 -0.0137885 0.241319
+vn 0.980307 -0.0413331 0.193105
+vn 0.97313 -0.0206848 0.229327
+vn 0 -0.209306 0.97785
+vn 1.98166e-08 -0.209306 0.97785
+vn -0.952257 -0.0639002 0.298534
+vn -0.952254 -0.0639105 0.298543
+vn -0.963611 -0.0426831 0.263879
+vn -0.968654 -0.0320246 0.246339
+vn -0.981172 0 0.193138
+# 74 normals
+f 113//118 114//119 115//120
+f 115//120 116//121 113//118
+f 117//122 118//123 119//122
+f 119//122 120//124 117//122
+f 121//125 122//126 115//125
+f 115//125 114//127 121//125
+f 123//128 124//129 125//130
+f 125//130 126//131 123//128
+f 127//132 128//133 113//132
+f 113//132 116//134 127//132
+f 128//135 121//136 118//135
+f 118//135 117//137 128//135
+f 114//138 113//138 120//138
+f 120//138 119//138 114//138
+f 121//139 114//140 119//139
+f 119//139 118//141 121//139
+f 113//142 128//143 117//142
+f 117//142 120//144 113//142
+f 122//145 127//146 129//145
+f 129//145 130//147 122//145
+f 116//121 115//120 131//148
+f 131//148 132//149 116//121
+f 115//150 122//151 130//150
+f 130//150 131//152 115//150
+f 127//153 116//154 132//153
+f 132//153 129//155 127//153
+f 130//156 129//157 124//156
+f 124//156 123//158 130//156
+f 129//159 132//160 125//130
+f 125//130 124//129 129//159
+f 132//161 131//162 126//161
+f 126//161 125//163 132//161
+f 131//164 130//165 123//128
+f 123//128 126//131 131//164
+f 128//166 127//167 133//168
+f 128//166 133//168 121//169
+f 127//167 122//170 134//171
+f 135//172 127//167 134//171
+f 127//167 135//172 133//168
+f 122//170 121//169 136//173
+f 136//173 121//169 133//168
+f 134//171 122//170 137//174
+f 122//170 136//173 138//175
+f 137//174 122//170 138//175
+f 139//176 140//177 141//176
+f 141//176 142//178 139//176
+f 133//179 140//179 139//179
+f 140//180 133//181 141//182
+f 134//183 141//182 135//184
+f 141//185 134//171 142//186
+f 133//181 135//184 141//182
+f 133//179 139//179 136//179
+f 137//174 142//186 134//171
+f 142//187 137//188 139//189
+f 139//189 138//190 136//191
+f 138//190 139//189 137//188
+# object Head02
+g Head02
+v -81.7331 4.99999 104.591
+v -26.4755 4.99999 104.591
+v -13.6081 -6.46815 144.624
+v -11.9564 -6.46815 144.624
+v -81.7331 -55 104.591
+v -26.4755 -55 104.591
+v -13.6081 -26.6205 144.624
+v -11.9564 -26.6205 144.624
+# 8 verticies
+vn 0 0.961333 0.27539
+vn 0 -0.815805 0.578326
+vn 0 0 -1
+vn 0.940083 0 -0.340947
+vn 0 0 1
+vn -0.348607 0 0.937269
+vn -0.174303 0 0.984692
+vn -0.506639 0 0.862158
+# 8 normals
+f 143//192 145//192 146//192
+f 146//192 144//192 143//192
+f 147//193 148//193 150//193
+f 150//193 149//193 147//193
+f 143//194 144//194 148//194
+f 148//194 147//194 143//194
+f 144//195 146//195 150//195
+f 150//195 148//195 144//195
+f 146//196 145//197 149//198
+f 149//198 150//196 146//196
+f 145//197 143//199 147//199
+f 147//199 149//198 145//197
+# object Chest03
+g Chest03
+v -66.7799 3.17895 52.5693
+v -10.4741 3.17895 52.5693
+v -10.4741 3.17895 66.114
+v -30.1196 3.17895 66.114
+v -43.0486 3.17895 88.9498
+v -82.2276 3.17895 88.9498
+v -66.7799 -53.7851 52.5693
+v -10.4741 -53.7851 52.5693
+v -10.4741 -52.3759 66.114
+v -30.1196 -52.3759 66.114
+v -43.0486 -50 88.9498
+v -82.2276 -50 88.9498
+# 12 verticies
+vn 0 1.33934e-07 -1
+vn 1 0 0
+vn 0 -1.37331e-07 1
+vn 0.870206 -3.38307e-08 0.492689
+vn 0.870205 0 0.492689
+vn 0.870206 -6.76614e-08 0.492689
+vn 0 0 1
+vn -0.920459 2.61733e-08 -0.39084
+vn -0.920459 5.23466e-08 -0.39084
+vn -0.920459 0 -0.39084
+vn -1.00186e-09 1 3.99743e-08
+vn -6.6791e-10 1 3.83844e-08
+vn 0 1 3.93208e-08
+vn -6.6791e-10 1 3.70123e-08
+vn 0 1 3.52045e-08
+vn -5.11222e-08 -0.994631 0.103482
+vn 0 -0.994631 0.103482
+vn -3.40815e-08 -0.994631 0.103482
+vn -3.40815e-08 -0.994631 0.103482
+vn 0 -0.994631 0.103482
+# 20 normals
+f 151//200 152//200 158//200
+f 151//200 158//200 157//200
+f 152//201 153//201 159//201
+f 152//201 159//201 158//201
+f 153//202 154//202 160//202
+f 153//202 160//202 159//202
+f 154//203 155//204 161//203
+f 154//203 161//203 160//205
+f 155//206 156//206 162//206
+f 155//206 162//206 161//206
+f 156//207 151//208 157//207
+f 156//207 157//207 162//209
+f 155//210 151//211 156//212
+f 154//213 151//211 155//210
+f 154//213 152//214 151//211
+f 153//214 152//214 154//213
+f 161//215 162//216 157//217
+f 160//218 161//215 157//217
+f 160//218 157//217 158//219
+f 159//219 160//218 158//219
+# object LegB02
+g LegB02
+v 137.638 -47.5 -108.936
+v 74.4468 -47.5 -108.936
+v 137.638 -47.5 -90.182
+v 110.638 -47.5 -90.182
+v 137.638 -47.5 31.0636
+v 110.638 -47.5 31.0636
+v 137.638 -2.49998 -108.936
+v 74.4468 -2.49999 -108.936
+v 137.638 -2.49997 -90.182
+v 110.638 -2.49998 -90.182
+v 137.638 -2.49998 31.0636
+v 110.638 -2.49998 31.0636
+# 12 verticies
+vn 1.61194e-07 -1 2.86615e-08
+vn 1.8838e-07 -1 -1.04875e-08
+vn 1.54557e-07 -1 8.62018e-09
+vn 1.81102e-07 -1 5.73231e-08
+vn 2.8257e-07 -1 0
+vn 2.11928e-07 -1 -1.57313e-08
+vn -1.85156e-07 1 -1.77574e-07
+vn -1.84875e-07 1 -1.77169e-07
+vn -1.85249e-07 1 -1.09206e-07
+vn -1.85437e-07 1 -4.09729e-08
+vn -1.85437e-07 1 2.75297e-08
+vn -1.85437e-07 1 2.75297e-08
+vn -1.20735e-07 -1.02348e-14 -1
+vn -1.20735e-07 -2.04696e-14 -1
+vn -1.20735e-07 0 -1
+vn -0.460093 -1.53271e-07 0.887871
+vn -0.460093 -2.28537e-07 0.887871
+vn -0.460093 -7.80051e-08 0.887871
+vn -1 -2.54313e-07 3.14625e-08
+vn -1 -3.39084e-07 6.29251e-08
+vn -1 -1.69542e-07 -4.66745e-15
+vn 0 0 1
+vn 1 0 0
+# 23 normals
+f 163//220 165//221 166//222
+f 166//222 164//223 163//220
+f 165//221 167//224 168//225
+f 168//225 166//222 165//221
+f 169//226 170//227 172//228
+f 172//228 171//229 169//226
+f 171//229 172//228 174//230
+f 174//230 173//231 171//229
+f 163//232 164//233 170//232
+f 170//232 169//234 163//232
+f 164//235 166//236 172//235
+f 172//235 170//237 164//235
+f 166//238 168//239 174//238
+f 174//238 172//240 166//238
+f 168//241 167//241 173//241
+f 173//241 174//241 168//241
+f 167//242 165//242 171//242
+f 171//242 173//242 167//242
+f 165//242 163//242 169//242
+f 169//242 171//242 165//242
+# object Head04
+g Head04
+v 80.7669 -55 104.591
+v 25.5093 -55 104.591
+v 12.6419 -26.6205 144.624
+v 10.9902 -26.6205 144.624
+v 80.7669 5.00002 104.591
+v 25.5093 5.00001 104.591
+v 12.6419 -6.46814 144.624
+v 10.9902 -6.46814 144.624
+# 8 verticies
+vn 8.44784e-08 -0.815806 0.578326
+vn 0 -0.815806 0.578326
+vn 1.68957e-07 -0.815805 0.578326
+vn -6.80931e-08 0.961333 0.27539
+vn -1.36186e-07 0.961333 0.27539
+vn 0 0.961332 0.27539
+vn -6.90348e-08 -6.35783e-08 -1
+vn 0 0 -1
+vn -1.3807e-07 -1.27157e-07 -1
+vn -0.940083 -1.78629e-07 -0.340947
+vn -0.940083 -1.77951e-07 -0.340947
+vn -0.940083 -1.79307e-07 -0.340947
+vn 0 0 1
+vn 0.348607 1.15039e-07 0.937269
+vn 0.174303 3.29944e-08 0.984692
+vn 0.506639 2.38474e-07 0.862158
+vn 0.506639 1.67189e-07 0.862158
+# 17 normals
+f 175//243 177//244 178//243
+f 178//243 176//245 175//243
+f 179//246 180//247 182//246
+f 182//246 181//248 179//246
+f 175//249 176//250 180//249
+f 180//249 179//251 175//249
+f 176//252 178//253 182//252
+f 182//252 180//254 176//252
+f 178//255 177//256 181//257
+f 181//257 182//255 178//255
+f 177//256 175//258 179//259
+f 179//259 181//257 177//256
diff --git a/data/recognizer_quad.obj b/data/recognizer_quad.obj
new file mode 100644
index 0000000..b316fc0
--- /dev/null
+++ b/data/recognizer_quad.obj
@@ -0,0 +1,663 @@
+#
+# Wavefront OBJ file
+# Converted by the 3D Exploration 1.7
+# XDimension Software, LLC
+# http://www.xdsoft.com/explorer/
+#
+# object Middle Bar
+mtllib recognizer.mtl
+g Middle_Bar
+v -140.483 5 32.6104
+v 139.517 5 32.6104
+v -140.483 5 42.6104
+v 139.517 5 42.6104
+v -140.483 -52.488 32.6104
+v 139.517 -52.488 32.6104
+v -140.483 -55 42.6104
+v 139.517 -55 42.6104
+# 8 verticies
+vn 0 1 9.53674e-08
+vn 0 -0.969869 -0.243628
+vn 0 0 -1
+vn 1 0 0
+vn 0 -6.35783e-08 1
+vn -1 0 0
+# 6 normals
+usemtl Hull
+f 1//1 3//1 4//1 2//1
+f 5//2 6//2 8//2 7//2
+f 1//3 2//3 6//3 5//3
+f 2//4 4//4 8//4 6//4
+f 4//5 3//5 7//5 8//5
+f 3//6 1//6 5//6 7//6
+# object Shoulder01
+g Shoulder01
+v -150.491 5 90.6522
+v -10.4913 5 90.6522
+v -150.491 5 100.652
+v -10.4913 5 100.652
+v -150.491 -55 90.6522
+v -10.4913 -55 90.6522
+v -150.491 -55 100.652
+v -10.4913 -55 100.652
+# 8 verticies
+vn 0 1 9.53674e-08
+vn 0 -1 0
+vn 0 1.27157e-07 -1
+vn 1 0 0
+vn 0 -1.27157e-07 1
+vn -1 0 0
+# 6 normals
+f 9//7 11//7 12//7 10//7
+f 13//8 14//8 16//8 15//8
+f 9//9 10//9 14//9 13//9
+f 10//10 12//10 16//10 14//10
+f 12//11 11//11 15//11 16//11
+f 11//12 9//12 13//12 15//12
+# object Shoulder02
+g Shoulder02
+v 9.56645 5 90.6522
+v 149.566 5 90.6522
+v 9.56645 5 100.652
+v 149.566 5 100.652
+v 9.56645 -55 90.6522
+v 149.566 -55 90.6522
+v 9.56645 -55 100.652
+v 149.566 -55 100.652
+# 8 verticies
+vn 0 1 9.53674e-08
+vn 0 -1 0
+vn 0 1.27157e-07 -1
+vn 1 0 0
+vn 0 -1.27157e-07 1
+vn -1 0 0
+# 6 normals
+f 17//13 19//13 20//13 18//13
+f 21//14 22//14 24//14 23//14
+f 17//15 18//15 22//15 21//15
+f 18//16 20//16 24//16 22//16
+f 20//17 19//17 23//17 24//17
+f 19//18 17//18 21//18 23//18
+# object Chest01
+g Chest01
+v -27.9831 3.17897 67.8053
+v 27.0169 3.17897 67.8053
+v -39.7688 3.17897 88.366
+v 38.8026 3.17897 88.366
+v -27.9831 -52.2233 67.8052
+v 27.0169 -52.2233 67.8052
+v -39.7688 -50.0614 88.366
+v 38.8026 -50.0614 88.366
+# 8 verticies
+vn 0 1 -3.47874e-08
+vn 0 -0.994518 0.10457
+vn 0 1.37709e-07 -1
+vn 0.867575 1.32036e-07 -0.497307
+vn 0.867575 1.95589e-07 -0.497306
+vn 0.867575 6.84837e-08 -0.497307
+vn 0 -1.43301e-07 1
+vn -0.867575 7.7119e-09 -0.497306
+vn -0.867575 6.84837e-08 -0.497307
+vn -0.867575 -5.30599e-08 -0.497306
+# 10 normals
+f 25//19 27//19 28//19 26//19
+f 29//20 30//20 32//20 31//20
+f 25//21 26//21 30//21 29//21
+f 26//22 28//23 32//22 30//24
+f 28//25 27//25 31//25 32//25
+f 27//26 25//27 29//26 31//28
+# object LegA01
+g LegA01
+v -138.604 -2.5 44.6729
+v -111.604 -2.5 44.6729
+v -138.604 -2.5 89.0729
+v -111.604 -2.5 89.0729
+v -138.604 -47.5 44.6729
+v -111.604 -47.5 44.6729
+v -138.604 -47.5 89.0729
+v -111.604 -47.5 89.0729
+# 8 verticies
+vn 0 1 4.29583e-08
+vn 0 -1 8.59166e-08
+vn 0 8.4771e-08 -1
+vn 1 0 0
+vn 0 -1.69542e-07 1
+vn -1 0 0
+# 6 normals
+f 33//29 35//29 36//29 34//29
+f 37//30 38//30 40//30 39//30
+f 33//31 34//31 38//31 37//31
+f 34//32 36//32 40//32 38//32
+f 36//33 35//33 39//33 40//33
+f 35//34 33//34 37//34 39//34
+# object LegB01
+g LegB01
+v 110.638 -2.5 44.6729
+v 137.638 -2.5 44.6729
+v 110.638 -2.5 89.0729
+v 137.638 -2.5 89.0729
+v 110.638 -47.5 44.6729
+v 137.638 -47.5 44.6729
+v 110.638 -47.5 89.0729
+v 137.638 -47.5 89.0729
+# 8 verticies
+vn 0 1 4.29583e-08
+vn 0 -1 8.59166e-08
+vn 0 8.4771e-08 -1
+vn 1 0 0
+vn 0 -1.69542e-07 1
+vn -1 0 0
+# 6 normals
+f 41//35 43//35 44//35 42//35
+f 45//36 46//36 48//36 47//36
+f 41//37 42//37 46//37 45//37
+f 42//38 44//38 48//38 46//38
+f 44//39 43//39 47//39 48//39
+f 43//40 41//40 45//40 47//40
+# object Bar02
+g Bar02
+v 79.3256 -7.83574e-06 63.0187
+v 106.326 -7.83574e-06 63.0187
+v 79.3256 -7.42305e-06 73.0187
+v 106.326 -7.42305e-06 73.0187
+v 79.3256 -50 63.0187
+v 106.326 -50 63.0187
+v 79.3256 -50 73.0187
+v 106.326 -50 73.0187
+# 8 verticies
+vn 0 1 -4.12693e-08
+vn 0 -1 3.8147e-07
+vn 0 7.62939e-08 -1
+vn 1 0 0
+vn 0 0 1
+vn -1 0 0
+# 6 normals
+f 49//41 51//41 52//41 50//41
+f 53//42 54//42 56//42 55//42
+f 49//43 50//43 54//43 53//43
+f 50//44 52//44 56//44 54//44
+f 52//45 51//45 55//45 56//45
+f 51//46 49//46 53//46 55//46
+# object Bar01
+g Bar01
+v -107.292 -7.83574e-06 63.0187
+v -80.2918 -7.83574e-06 63.0187
+v -107.292 -7.42305e-06 73.0187
+v -80.2918 -7.42305e-06 73.0187
+v -107.292 -50 63.0187
+v -80.2918 -50 63.0187
+v -107.292 -50 73.0187
+v -80.2918 -50 73.0187
+# 8 verticies
+vn 0 1 -4.12693e-08
+vn 0 -1 3.8147e-07
+vn 0 7.62939e-08 -1
+vn 1 0 0
+vn 0 0 1
+vn -1 0 0
+# 6 normals
+f 57//47 59//47 60//47 58//47
+f 61//48 62//48 64//48 63//48
+f 57//49 58//49 62//49 61//49
+f 58//50 60//50 64//50 62//50
+f 60//51 59//51 63//51 64//51
+f 59//52 57//52 61//52 63//52
+# object LegA02
+g LegA02
+v -138.604 -2.5 -108.936
+v -75.413 -2.5 -108.936
+v -138.604 -2.5 -90.182
+v -111.604 -2.5 -90.182
+v -138.604 -2.5 31.0636
+v -111.604 -2.5 31.0636
+v -138.604 -47.5 -108.936
+v -75.413 -47.5 -108.936
+v -138.604 -47.5 -90.182
+v -111.604 -47.5 -90.182
+v -138.604 -47.5 31.0636
+v -111.604 -47.5 31.0636
+# 12 verticies
+vn 0 1 1.52553e-07
+vn 0 1 6.52712e-08
+vn 0 1 1.08912e-07
+vn 0 1 2.16305e-08
+vn 0 -1 2.03404e-07
+vn 0 -1 1.25115e-07
+vn 0 -1 4.68262e-08
+vn 0 -1 -3.14625e-08
+vn 0 0 -1
+vn 0.460093 0 0.887871
+vn 1 0 0
+vn 0 -4.23855e-08 1
+vn -1 0 0
+# 13 normals
+f 65//53 67//54 68//55 66//53
+f 67//54 69//56 70//56 68//55
+f 71//57 72//57 74//58 73//59
+f 73//59 74//58 76//60 75//60
+f 65//61 66//61 72//61 71//61
+f 66//62 68//62 74//62 72//62
+f 68//63 70//63 76//63 74//63
+f 70//64 69//64 75//64 76//64
+f 69//65 67//65 73//65 75//65
+f 67//65 65//65 71//65 73//65
+# object Lower Midd
+g Lower_Midd
+v -31.9831 2.44438 23.265
+v 31.0169 2.44438 23.265
+v -37.9831 2.44438 30.6854
+v 37.0169 2.44438 30.6854
+v -31.9831 -49.7811 23.2649
+v 31.0169 -49.7811 23.2649
+v -37.9831 -52.4122 30.6854
+v 37.0169 -52.4122 30.6854
+# 8 verticies
+vn 0 1 0
+vn 0 -0.942507 -0.334187
+vn 0 3.65214e-08 -1
+vn 0.777605 3.33431e-08 -0.628754
+vn 0.777605 4.37232e-08 -0.628754
+vn 0.777604 2.2963e-08 -0.628754
+vn 0 -6.95395e-08 1
+vn -0.777605 3.33431e-08 -0.628754
+vn -0.777605 2.2963e-08 -0.628754
+vn -0.777604 4.37232e-08 -0.628754
+# 10 normals
+f 77//66 79//66 80//66 78//66
+f 81//67 82//67 84//67 83//67
+f 77//68 78//68 82//68 81//68
+f 78//69 80//70 84//69 82//71
+f 80//72 79//72 83//72 84//72
+f 79//73 77//74 81//73 83//75
+# object Head
+g Head
+v -26.0768 4.99999 104.591
+v 25.1107 4.99999 104.591
+v -20.8268 0.818023 119.111
+v 19.8607 0.818023 119.111
+v -26.0768 -55 104.591
+v 25.1107 -55 104.591
+v -20.8268 -44.5524 119.111
+v 19.8607 -44.5524 119.111
+# 8 verticies
+vn 0 0.960938 0.276762
+vn 0 -0.811715 0.584054
+vn 0 0 -1
+vn 0.940417 -1.97673e-08 0.340025
+vn 0.940417 -3.95346e-08 0.340025
+vn 0.940417 0 0.340025
+vn 0 0 1
+vn -0.940417 1.97673e-08 0.340025
+vn -0.940417 0 0.340025
+vn -0.940417 3.95346e-08 0.340025
+# 10 normals
+f 85//76 87//76 88//76 86//76
+f 89//77 90//77 92//77 91//77
+f 85//78 86//78 90//78 89//78
+f 86//79 88//80 92//79 90//81
+f 88//82 87//82 91//82 92//82
+f 87//83 85//84 89//83 91//85
+# object Chest02
+g Chest02
+v 9.50792 3.17897 66.114
+v 9.50792 3.17897 52.5693
+v 65.8137 3.17897 52.5693
+v 81.2614 3.17896 88.9498
+v 42.0824 3.17896 88.9498
+v 29.1534 3.17897 66.114
+v 9.50793 -52.4011 66.114
+v 9.50793 -53.8253 52.5693
+v 65.8137 -53.8253 52.5693
+v 81.2614 -50 88.9498
+v 42.0825 -50 88.9498
+v 29.1534 -52.4011 66.114
+# 12 verticies
+vn -1 -1.69442e-07 9.0208e-09
+vn -1 -1.67299e-07 5.88969e-15
+vn -1 -1.71586e-07 1.80416e-08
+vn 0 0 -1
+vn 0.920458 1.32055e-07 -0.390841
+vn 0.920458 2.6411e-07 -0.390841
+vn 0.920458 0 -0.390841
+vn 0 0 1
+vn -0.870205 -1.87175e-07 0.49269
+vn -0.870205 -1.87083e-07 0.49269
+vn -0.870205 -1.87268e-07 0.49269
+vn 0 -1.37268e-07 1
+vn 2.37897e-08 1 7.8056e-08
+vn 3.56845e-08 1 1.34686e-07
+vn 0 1 1.11409e-07
+vn 2.37897e-08 1 2.91848e-08
+vn 0 1 -3.52046e-08
+vn 6.79452e-08 -0.994518 0.10457
+vn 0 -0.994518 0.10457
+vn 1.01918e-07 -0.994518 0.10457
+vn 6.79452e-08 -0.994518 0.10457
+vn 0 -0.994518 0.10457
+# 22 normals
+f 93//86 94//87 100//86 99//88
+f 94//89 95//89 101//89 100//89
+f 95//90 96//91 102//90 101//92
+f 96//93 97//93 103//93 102//93
+f 97//94 98//95 104//94 103//96
+f 98//97 93//97 99//97 104//97
+#f 95//98 97//99 96//100 98//101
+#f 94//102 98//101 95//98 93//102
+#f 101//103 102//104 103//105 104//106
+#f 100//107 101//103 104//106 99//107
+# object Upper Midd
+g Upper_Midd
+v -61.7065 3.17897 44.7497
+v 60.7403 3.17897 44.7497
+v -64.9831 3.17897 50.8321
+v 64.0169 3.17897 50.8321
+v -61.7065 -54.6475 44.7497
+v 60.7403 -54.6475 44.7497
+v -64.9831 -54.008 50.8321
+v 64.0169 -54.008 50.8321
+# 8 verticies
+vn 0 1 0
+vn 0 -0.994518 0.104569
+vn 0 0 -1
+vn 0.880381 1.58182e-08 -0.474268
+vn 0.880381 3.16364e-08 -0.474268
+vn 0.88038 0 -0.474268
+vn 0 -6.67058e-08 1
+vn -0.880381 1.58182e-08 -0.474268
+vn -0.880381 0 -0.474268
+vn -0.88038 3.16364e-08 -0.474268
+# 10 normals
+f 105//108 107//108 108//108 106//108
+f 109//109 110//109 112//109 111//109
+f 105//110 106//110 110//110 109//110
+f 106//111 108//112 112//111 110//113
+f 108//114 107//114 111//114 112//114
+f 107//115 105//116 109//115 111//117
+# object Head01
+g Head01
+v 19.2607 2.00002 118.603
+v -20.2269 2.00001 118.603
+v -11.1143 -6.31388 145.091
+v 10.1482 -6.31388 145.091
+v 15.3119 -46.6 114.103
+v -16.2781 -46.6 114.103
+v -16.2781 -3.39998 114.103
+v 15.3119 -3.39998 114.103
+v -20.2268 -52 118.603
+v -11.1143 -26.7259 145.091
+v -10.0512 -27.0406 149.972
+v 9.08504 -27.0406 149.972
+v 9.08503 -8.66976 149.972
+v -10.0512 -8.66976 149.972
+v 10.1482 -26.7259 145.091
+v 19.2607 -52 118.603
+v 12.2744 -30.1023 147.813
+v -13.2406 -30.1024 147.813
+v -13.2406 -5.60795 147.813
+v 12.2744 -5.60794 147.813
+v 12.1079 -42.3555 128.711
+v 9.58973 -32.7047 138.825
+v 9.93852 -34.8278 136.6
+v -13.0741 -42.3555 128.711
+v -10.5559 -32.7047 138.825
+v -13.0551 -42.2632 128.807
+v -13.0741 -42.4313 128.711
+v 12.1079 -42.4313 128.711
+v 9.58974 -37.1741 137.868
+v -10.5559 -37.1741 137.868
+# 30 verticies
+vn -1.71999e-07 0.954108 0.299464
+vn -1.72822e-07 0.954108 0.299464
+vn -1.7868e-07 0.992766 0.120065
+vn -1.81468e-07 0.997549 -0.0699663
+vn -1.20756e-07 8.83031e-08 -1
+vn -2.41513e-07 -4.26527e-14 -1
+vn -3.19895e-14 1.76606e-07 -1
+vn -0.945609 -1.78141e-07 0.325306
+vn -0.945609 -1.7672e-07 0.325306
+vn -0.945609 -1.79561e-07 0.325306
+vn -0.293234 -5.13759e-08 0.956041
+vn 0.293234 6.089e-08 0.956041
+vn 0.293234 5.32787e-08 0.956041
+vn -0.293234 -4.56675e-08 0.956041
+vn 0.945609 1.4888e-07 0.325306
+vn 0.945609 1.2104e-07 0.325306
+vn 0.945609 1.7672e-07 0.325306
+vn 4.63837e-08 -0.640184 -0.768222
+vn 1.2369e-07 -0.640183 -0.768222
+vn -3.09227e-08 -0.640184 -0.768222
+vn -1.1596e-07 0.640185 -0.768221
+vn -0.751644 -7.2877e-08 -0.659569
+vn -0.751645 -1.3009e-08 -0.659568
+vn -0.751644 -1.32745e-07 -0.659569
+vn 0.751645 2.37581e-07 -0.659568
+vn 0.751645 2.25932e-07 -0.659568
+vn 0.751644 2.49229e-07 -0.659568
+vn 7.50588e-08 -0.627548 -0.778578
+vn 5.62941e-08 -0.627548 -0.778578
+vn 9.38235e-08 -0.627548 -0.778578
+vn -1.7728e-07 0.967966 -0.251083
+vn -1.80898e-07 0.967966 -0.251083
+vn -0.788013 -1.50336e-07 -0.615659
+vn -0.788013 -1.47268e-07 -0.615659
+vn -0.788013 -1.53404e-07 -0.615659
+vn 0.788013 1.34995e-07 -0.615659
+vn 0.788013 1.47268e-07 -0.615659
+vn 0.788013 1.22723e-07 -0.615659
+vn 1.00538e-07 -0.576393 0.817173
+vn 8.61753e-08 -0.576393 0.817173
+vn 1.149e-07 -0.576393 0.817173
+vn 0.560687 1.01873e-07 0.828028
+vn 0.560687 8.73199e-08 0.828028
+vn -1.11309e-07 0.576391 0.817174
+vn -1.07719e-07 0.576391 0.817174
+vn -1.149e-07 0.576391 0.817174
+vn -0.560687 -9.8235e-08 0.828028
+vn -0.560687 -1.0915e-07 0.828028
+vn 6.22973e-08 -0.723497 0.690327
+vn -1.17426e-06 -0.723497 0.690327
+vn -7.03585e-07 -0.723497 0.690327
+vn 1.95224e-07 -0.723497 0.690327
+vn -8.38773e-05 -0.723492 0.690332
+vn -3.04282e-07 -0.540835 0.841129
+vn -2.37337e-06 -0.723497 0.690327
+vn -0.000140798 -0.723489 0.690336
+vn 1.07309e-06 -0.574707 0.818359
+vn -0.000209962 -0.723485 0.69034
+vn 6.56878e-08 -0.867253 0.497868
+vn 1.31376e-07 -0.867253 0.497868
+vn 0 -0.867253 0.497868
+vn 0 0 -1
+vn 0.964211 0 0.265138
+vn 0.964211 3.06608e-07 0.265138
+vn 0.970348 -0.0137885 0.241319
+vn 0.980307 -0.0413331 0.193105
+vn 0.97313 -0.0206848 0.229327
+vn 0 -0.209306 0.97785
+vn 1.98166e-08 -0.209306 0.97785
+vn -0.952257 -0.0639002 0.298534
+vn -0.952254 -0.0639105 0.298543
+vn -0.963611 -0.0426831 0.263879
+vn -0.968654 -0.0320246 0.246339
+vn -0.981172 0 0.193138
+# 23 normals
+f 113//118 114//119 115//120 116//121
+f 117//122 118//123 119//122 120//124
+f 121//125 122//126 115//125 114//127
+f 123//128 124//129 125//130 126//131
+f 127//132 128//133 113//132 116//134
+f 128//135 121//136 118//135 117//137
+f 114//138 113//138 120//138 119//138
+f 121//139 114//140 119//139 118//141
+f 113//142 128//143 117//142 120//144
+f 122//145 127//146 129//145 130//147
+f 116//121 115//120 131//148 132//149
+f 115//150 122//151 130//150 131//152
+f 127//153 116//154 132//153 129//155
+f 130//156 129//157 124//156 123//158
+f 129//159 132//160 125//130 124//129
+f 132//161 131//162 126//161 125//163
+f 131//164 130//165 123//128 126//131
+f 128//166 133//168 136//173 121//169
+f 127//167 122//170 137//174 134//171
+f 139//176 140//177 141//176 142//178
+f 141//185 134//171 137//174 142//186
+
+f 133//181 134//183 141//182 133//181
+f 142//187 137//188 139//189 142//187
+# object Head02
+g Head02
+v -81.7331 4.99999 104.591
+v -26.4755 4.99999 104.591
+v -13.6081 -6.46815 144.624
+v -11.9564 -6.46815 144.624
+v -81.7331 -55 104.591
+v -26.4755 -55 104.591
+v -13.6081 -26.6205 144.624
+v -11.9564 -26.6205 144.624
+# 8 verticies
+vn 0 0.961333 0.27539
+vn 0 -0.815805 0.578326
+vn 0 0 -1
+vn 0.940083 0 -0.340947
+vn 0 0 1
+vn -0.348607 0 0.937269
+vn -0.174303 0 0.984692
+vn -0.506639 0 0.862158
+# 8 normals
+f 143//192 145//192 146//192 144//192
+f 147//193 148//193 150//193 149//193
+f 143//194 144//194 148//194 147//194
+f 144//195 146//195 150//195 148//195
+f 146//196 145//197 149//198 150//196
+f 145//197 143//199 147//199 149//198
+# object Chest03
+g Chest03
+v -66.7799 3.17895 52.5693
+v -10.4741 3.17895 52.5693
+v -10.4741 3.17895 66.114
+v -30.1196 3.17895 66.114
+v -43.0486 3.17895 88.9498
+v -82.2276 3.17895 88.9498
+v -66.7799 -53.7851 52.5693
+v -10.4741 -53.7851 52.5693
+v -10.4741 -52.3759 66.114
+v -30.1196 -52.3759 66.114
+v -43.0486 -50 88.9498
+v -82.2276 -50 88.9498
+# 12 verticies
+vn 0 1.33934e-07 -1
+vn 1 0 0
+vn 0 -1.37331e-07 1
+vn 0.870206 -3.38307e-08 0.492689
+vn 0.870205 0 0.492689
+vn 0.870206 -6.76614e-08 0.492689
+vn 0 0 1
+vn -0.920459 2.61733e-08 -0.39084
+vn -0.920459 5.23466e-08 -0.39084
+vn -0.920459 0 -0.39084
+vn -1.00186e-09 1 3.99743e-08
+vn -6.6791e-10 1 3.83844e-08
+vn 0 1 3.93208e-08
+vn -6.6791e-10 1 3.70123e-08
+vn 0 1 3.52045e-08
+vn -5.11222e-08 -0.994631 0.103482
+vn 0 -0.994631 0.103482
+vn -3.40815e-08 -0.994631 0.103482
+vn -3.40815e-08 -0.994631 0.103482
+vn 0 -0.994631 0.103482
+# 20 normals
+f 151//200 152//200 158//200 157//200
+f 152//201 153//201 159//201 158//201
+f 153//202 154//202 160//202 159//202
+f 154//203 155//204 161//203 160//205
+f 155//206 156//206 162//206 161//206
+f 156//207 151//208 157//207 162//209
+#f 155//210 151//211 156//212 154//213
+#f 154//213 152//214 151//211 153//214
+#f 161//215 162//216 157//217 160//218
+#f 160//218 157//217 158//219 159//219
+# object LegB02
+g LegB02
+v 137.638 -47.5 -108.936
+v 74.4468 -47.5 -108.936
+v 137.638 -47.5 -90.182
+v 110.638 -47.5 -90.182
+v 137.638 -47.5 31.0636
+v 110.638 -47.5 31.0636
+v 137.638 -2.49998 -108.936
+v 74.4468 -2.49999 -108.936
+v 137.638 -2.49997 -90.182
+v 110.638 -2.49998 -90.182
+v 137.638 -2.49998 31.0636
+v 110.638 -2.49998 31.0636
+# 12 verticies
+vn 1.61194e-07 -1 2.86615e-08
+vn 1.8838e-07 -1 -1.04875e-08
+vn 1.54557e-07 -1 8.62018e-09
+vn 1.81102e-07 -1 5.73231e-08
+vn 2.8257e-07 -1 0
+vn 2.11928e-07 -1 -1.57313e-08
+vn -1.85156e-07 1 -1.77574e-07
+vn -1.84875e-07 1 -1.77169e-07
+vn -1.85249e-07 1 -1.09206e-07
+vn -1.85437e-07 1 -4.09729e-08
+vn -1.85437e-07 1 2.75297e-08
+vn -1.85437e-07 1 2.75297e-08
+vn -1.20735e-07 -1.02348e-14 -1
+vn -1.20735e-07 -2.04696e-14 -1
+vn -1.20735e-07 0 -1
+vn -0.460093 -1.53271e-07 0.887871
+vn -0.460093 -2.28537e-07 0.887871
+vn -0.460093 -7.80051e-08 0.887871
+vn -1 -2.54313e-07 3.14625e-08
+vn -1 -3.39084e-07 6.29251e-08
+vn -1 -1.69542e-07 -4.66745e-15
+vn 0 0 1
+vn 1 0 0
+# 23 normals
+f 163//220 165//221 166//222 164//223
+f 165//221 167//224 168//225 166//222
+f 169//226 170//227 172//228 171//229
+f 171//229 172//228 174//230 173//231
+f 163//232 164//233 170//232 169//234
+f 164//235 166//236 172//235 170//237
+f 166//238 168//239 174//238 172//240
+f 168//241 167//241 173//241 174//241
+f 167//242 165//242 171//242 173//242
+f 165//242 163//242 169//242 171//242
+# object Head04
+g Head04
+v 80.7669 -55 104.591
+v 25.5093 -55 104.591
+v 12.6419 -26.6205 144.624
+v 10.9902 -26.6205 144.624
+v 80.7669 5.00002 104.591
+v 25.5093 5.00001 104.591
+v 12.6419 -6.46814 144.624
+v 10.9902 -6.46814 144.624
+# 8 verticies
+vn 8.44784e-08 -0.815806 0.578326
+vn 0 -0.815806 0.578326
+vn 1.68957e-07 -0.815805 0.578326
+vn -6.80931e-08 0.961333 0.27539
+vn -1.36186e-07 0.961333 0.27539
+vn 0 0.961332 0.27539
+vn -6.90348e-08 -6.35783e-08 -1
+vn 0 0 -1
+vn -1.3807e-07 -1.27157e-07 -1
+vn -0.940083 -1.78629e-07 -0.340947
+vn -0.940083 -1.77951e-07 -0.340947
+vn -0.940083 -1.79307e-07 -0.340947
+vn 0 0 1
+vn 0.348607 1.15039e-07 0.937269
+vn 0.174303 3.29944e-08 0.984692
+vn 0.506639 2.38474e-07 0.862158
+vn 0.506639 1.67189e-07 0.862158
+# 17 normals
+f 175//243 177//244 178//243 176//245
+f 179//246 180//247 182//246 181//248
+f 175//249 176//250 180//249 179//251
+f 176//252 178//253 182//252 180//254
+f 178//255 177//256 181//257 182//255
+f 177//256 175//258 179//259 181//257
diff --git a/data/test.fbmp b/data/test.fbmp
new file mode 100644
index 0000000..a2289d8
--- /dev/null
+++ b/data/test.fbmp
@@ -0,0 +1,3 @@
+256 16
+32 126
+test.bitmap.png
diff --git a/data/xenotron.ftx b/data/xenotron.ftx
new file mode 100644
index 0000000..364844b
--- /dev/null
+++ b/data/xenotron.ftx
@@ -0,0 +1,5 @@
+2 256 32
+32 126
+xenotron
+xenotron.0.png
+xenotron.1.png
diff --git a/depcomp b/depcomp
new file mode 100755
index 0000000..6589965
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,411 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. This file always lives in the current directory.
+ # Also, the AIX compiler puts `$object:' at the start of each line;
+ # $object doesn't have directory information.
+ stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ outname="$stripped.o"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+tru64)
+ # The Tru64 AIX compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+
+ tmpdepfile1="$object.d"
+ tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
+ if test "$libtool" = yes; then
+ "$@" -Wc,-MD
+ else
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile1"; then
+ tmpdepfile="$tmpdepfile1"
+ else
+ tmpdepfile="$tmpdepfile2"
+ fi
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a space and a tab in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the proprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ test -z "$dashmflag" && dashmflag=-M
+ ( IFS=" "
+ case " $* " in
+ *" --mode=compile "*) # this is libtool, let us make it quiet
+ for arg
+ do # cycle over the arguments
+ case "$arg" in
+ "--mode=compile")
+ # insert --quiet before "--mode=compile"
+ set fnord "$@" --quiet
+ shift # fnord
+ ;;
+ esac
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # "$arg"
+ done
+ ;;
+ esac
+ "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ ) &
+ proc=$!
+ "$@"
+ stat=$?
+ wait "$proc"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ # X makedepend
+ (
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in no)
+ set ""; shift
+ cleared=yes
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift;;
+ -*)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ ) &
+ proc=$!
+ "$@"
+ stat=$?
+ wait "$proc"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tail +3 "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the proprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ ( IFS=" "
+ case " $* " in
+ *" --mode=compile "*)
+ for arg
+ do # cycle over the arguments
+ case $arg in
+ "--mode=compile")
+ # insert --quiet before "--mode=compile"
+ set fnord "$@" --quiet
+ shift # fnord
+ ;;
+ esac
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # "$arg"
+ done
+ ;;
+ esac
+ "$@" -E |
+ sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ ) &
+ proc=$!
+ "$@"
+ stat=$?
+ wait "$proc"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the proprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ ( IFS=" "
+ case " $* " in
+ *" --mode=compile "*)
+ for arg
+ do # cycle over the arguments
+ case $arg in
+ "--mode=compile")
+ # insert --quiet before "--mode=compile"
+ set fnord "$@" --quiet
+ shift # fnord
+ ;;
+ esac
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # "$arg"
+ done
+ ;;
+ esac
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ ) &
+ proc=$!
+ "$@"
+ stat=$?
+ wait "$proc"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/install-sh b/install-sh
new file mode 100755
index 0000000..e9de238
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/lua/Makefile.am b/lua/Makefile.am
new file mode 100644
index 0000000..4a1fd19
--- /dev/null
+++ b/lua/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS=src include
diff --git a/lua/Makefile.in b/lua/Makefile.in
new file mode 100644
index 0000000..181749c
--- /dev/null
+++ b/lua/Makefile.in
@@ -0,0 +1,315 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+SUBDIRS = src include
+subdir = lua
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
+ uninstall-info-recursive all-recursive install-data-recursive \
+ install-exec-recursive installdirs-recursive install-recursive \
+ uninstall-recursive check-recursive installcheck-recursive
+DIST_COMMON = README Makefile.am Makefile.in
+DIST_SUBDIRS = $(SUBDIRS)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign lua/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
+ clean-generic clean-recursive distclean distclean-generic \
+ distclean-recursive distclean-tags distdir dvi dvi-am \
+ dvi-recursive info info-am info-recursive install install-am \
+ install-data install-data-am install-data-recursive \
+ install-exec install-exec-am install-exec-recursive \
+ install-info install-info-am install-info-recursive install-man \
+ install-recursive install-strip installcheck installcheck-am \
+ installdirs installdirs-am installdirs-recursive \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-recursive tags tags-recursive uninstall \
+ uninstall-am uninstall-info-am uninstall-info-recursive \
+ uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lua/README b/lua/README
new file mode 100644
index 0000000..81f767a
--- /dev/null
+++ b/lua/README
@@ -0,0 +1,72 @@
+This is Lua 4.0.
+See HISTORY for a summary of changes since the last version.
+
+* What is Lua?
+ ------------
+ Lua is a powerful, light-weight programming language designed for extending
+ applications. Lua is also frequently used as a general-purpose, stand-alone
+ language.
+
+ Lua combines simple procedural syntax (similar to Pascal) with powerful
+ data description constructs based on associative arrays and extensible
+ semantics. Lua is dynamically typed, interpreted from bytecodes, and has
+ automatic memory management, making it ideal for configuration, scripting,
+ and rapid prototyping.
+
+ Lua is a language engine that you can embed into your application.
+ This means that, besides syntax and semantics, Lua has an API that
+ allows the application to exchange data with Lua programs and also to
+ extend Lua with C functions. In this sense, Lua can be regarded as a
+ language framework for building domain-specific languages.
+
+ Lua is implemented as a small library of C functions, written in ANSI C,
+ and compiles unmodified in all known platforms. The implementation goals
+ are simplicity, efficiency, portability, and low embedding cost.
+ The result is a fast language engine with small footprint, making it
+ ideal in embedded systems too.
+
+ Lua was awarded the first prize (technological category) in the
+ Second Compaq Award for Research and Development in Computer Science in 1997.
+ This award was a joint venture of Compaq Computer in Brazil, the Brazilian
+ Ministry of Science and Technology, and the Brazilian Academy of Sciences.
+
+ Lua has been used in many different projects around the world.
+ For a short list, see http://www.tecgraf.puc-rio.br/lua/uses.html .
+
+* Availability
+ ------------
+ Lua is freely available for both academic and commercial purposes and
+ can be downloaded from the sites below. See COPYRIGHT for details.
+
+ Home page: http://www.tecgraf.puc-rio.br/lua/
+ http://csg.uwaterloo.ca/~lhf/lua/
+ In Brazil: ftp://ftp.tecgraf.puc-rio.br/pub/lua/
+ In Canada: ftp://csg.uwaterloo.ca/pub/lhf/lua/
+ In the US: ftp://ftp.freesoftware.com/pub/languages/lua/
+ In Germany: ftp://ftp.uni-trier.de/pub/languages/lua/
+ In Germany: ftp://ftp.gwdg.de/pub/languages/lua/
+ In Greece: ftp://ftp.ntua.gr/pub/lang/lua/
+ In Japan: ftp://ftp.u-aizu.ac.jp/pub/lang/lua/
+ In Denmark: ftp://ftp.ucore.com/lua/dist
+
+* Installation
+ ------------
+ See INSTALL.
+
+* Contacting the authors
+ ----------------------
+ Lua was designed and implemented by Waldemar Celes, Roberto Ierusalimschy
+ and Luiz Henrique de Figueiredo.
+ They can be contacted by email at lua@tecgraf.puc-rio.br.
+
+ Send your comments, questions, and bug reports to lua@tecgraf.puc-rio.br.
+ For reporting bugs, try also the mailing list: lua-l@tecgraf.puc-rio.br.
+ For more information about this list, including instructions on how to
+ subscribe, see http://www.tecgraf.puc-rio.br/lua/lua-l.html .
+
+ Lua is developed at TeCGraf, the Computer Graphics Technology Group
+ of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro in Brazil).
+ TeCGraf is a laboratory of the Department of Computer Science.
+ Dozens of industrial products developed by TeCGraf use Lua.
+
+(end of README)
diff --git a/lua/include/Makefile.am b/lua/include/Makefile.am
new file mode 100644
index 0000000..f742824
--- /dev/null
+++ b/lua/include/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS=lauxlib.h lua.h luadebug.h lualib.h
diff --git a/lua/include/Makefile.in b/lua/include/Makefile.in
new file mode 100644
index 0000000..e43cd7e
--- /dev/null
+++ b/lua/include/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = lauxlib.h lua.h luadebug.h lualib.h
+subdir = lua/include
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign lua/include/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lua/include/lauxlib.h b/lua/include/lauxlib.h
new file mode 100644
index 0000000..9998bdf
--- /dev/null
+++ b/lua/include/lauxlib.h
@@ -0,0 +1,100 @@
+/*
+** $Id: lauxlib.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lauxlib_h
+#define lauxlib_h
+
+
+#include <stddef.h>
+#include <stdio.h>
+
+#include "lua.h"
+
+
+#ifndef LUALIB_API
+#define LUALIB_API extern
+#endif
+
+
+struct luaL_reg {
+ const char *name;
+ lua_CFunction func;
+};
+
+
+LUALIB_API void luaL_openlib (lua_State *L, const struct luaL_reg *l, int n);
+LUALIB_API void luaL_argerror (lua_State *L, int numarg, const char *extramsg);
+LUALIB_API const char *luaL_check_lstr (lua_State *L, int numArg, size_t *len);
+LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg, const char *def, size_t *len);
+LUALIB_API double luaL_check_number (lua_State *L, int numArg);
+LUALIB_API double luaL_opt_number (lua_State *L, int numArg, double def);
+
+LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg);
+LUALIB_API void luaL_checktype (lua_State *L, int narg, int t);
+LUALIB_API void luaL_checkany (lua_State *L, int narg);
+
+LUALIB_API void luaL_verror (lua_State *L, const char *fmt, ...);
+LUALIB_API int luaL_findstring (const char *name, const char *const list[]);
+
+
+
+/*
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define luaL_arg_check(L, cond,numarg,extramsg) if (!(cond)) \
+ luaL_argerror(L, numarg,extramsg)
+#define luaL_check_string(L,n) (luaL_check_lstr(L, (n), NULL))
+#define luaL_opt_string(L,n,d) (luaL_opt_lstr(L, (n), (d), NULL))
+#define luaL_check_int(L,n) ((int)luaL_check_number(L, n))
+#define luaL_check_long(L,n) ((long)luaL_check_number(L, n))
+#define luaL_opt_int(L,n,d) ((int)luaL_opt_number(L, n,d))
+#define luaL_opt_long(L,n,d) ((long)luaL_opt_number(L, n,d))
+#define luaL_openl(L,a) luaL_openlib(L, a, (sizeof(a)/sizeof(a[0])))
+
+
+/*
+** {======================================================
+** Generic Buffer manipulation
+** =======================================================
+*/
+
+
+#ifndef LUAL_BUFFERSIZE
+#define LUAL_BUFFERSIZE BUFSIZ
+#endif
+
+
+typedef struct luaL_Buffer {
+ char *p; /* current position in buffer */
+ int level;
+ lua_State *L;
+ char buffer[LUAL_BUFFERSIZE];
+} luaL_Buffer;
+
+#define luaL_putchar(B,c) \
+ ((void)((B)->p < &(B)->buffer[LUAL_BUFFERSIZE] || luaL_prepbuffer(B)), \
+ (*(B)->p++ = (char)(c)))
+
+#define luaL_addsize(B,n) ((B)->p += (n))
+
+LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B);
+LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B);
+LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
+LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s);
+LUALIB_API void luaL_addvalue (luaL_Buffer *B);
+LUALIB_API void luaL_pushresult (luaL_Buffer *B);
+
+
+/* }====================================================== */
+
+
+#endif
+
+
diff --git a/lua/include/lua.h b/lua/include/lua.h
new file mode 100644
index 0000000..895550c
--- /dev/null
+++ b/lua/include/lua.h
@@ -0,0 +1,248 @@
+/*
+** $Id: lua.h,v 1.2 2002/07/12 07:49:04 jcatki Exp $
+** Lua - An Extensible Extension Language
+** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
+** e-mail: lua@tecgraf.puc-rio.br
+** www: http://www.tecgraf.puc-rio.br/lua/
+** See Copyright Notice at the end of this file
+*/
+
+
+#ifndef lua_h
+#define lua_h
+
+
+/* definition of `size_t' */
+#include <stddef.h>
+
+
+/* mark for all API functions */
+#ifndef LUA_API
+#define LUA_API extern
+#endif
+
+
+#define LUA_VERSION "Lua 4.0.1"
+#define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio"
+#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
+
+
+/* name of global variable with error handler */
+#define LUA_ERRORMESSAGE "_ERRORMESSAGE"
+
+
+/* pre-defined references */
+#define LUA_NOREF (-2)
+#define LUA_REFNIL (-1)
+#define LUA_REFREGISTRY 0
+
+/* pre-defined tags */
+#define LUA_ANYTAG (-1)
+#define LUA_NOTAG (-2)
+
+
+/* option for multiple returns in lua_call */
+#define LUA_MULTRET (-1)
+
+
+/* minimum stack available for a C function */
+#define LUA_MINSTACK 20
+
+
+/* error codes for lua_do* */
+#define LUA_ERRRUN 1
+#define LUA_ERRFILE 2
+#define LUA_ERRSYNTAX 3
+#define LUA_ERRMEM 4
+#define LUA_ERRERR 5
+
+
+typedef struct lua_State lua_State;
+
+typedef int (*lua_CFunction) (lua_State *L);
+
+/*
+** types returned by `lua_type'
+*/
+#define LUA_TNONE (-1)
+
+#define LUA_TUSERDATA 0
+#define LUA_TNIL 1
+#define LUA_TNUMBER 2
+#define LUA_TSTRING 3
+#define LUA_TTABLE 4
+#define LUA_TFUNCTION 5
+
+
+
+/*
+** state manipulation
+*/
+LUA_API lua_State *lua_open (int stacksize);
+LUA_API void lua_close (lua_State *L);
+
+
+/*
+** basic stack manipulation
+*/
+LUA_API int lua_gettop (lua_State *L);
+LUA_API void lua_settop (lua_State *L, int index);
+LUA_API void lua_pushvalue (lua_State *L, int index);
+LUA_API void lua_remove (lua_State *L, int index);
+LUA_API void lua_insert (lua_State *L, int index);
+LUA_API int lua_stackspace (lua_State *L);
+
+
+/*
+** access functions (stack -> C)
+*/
+
+LUA_API int lua_type (lua_State *L, int index);
+LUA_API const char *lua_typename (lua_State *L, int t);
+LUA_API int lua_isnumber (lua_State *L, int index);
+LUA_API int lua_isstring (lua_State *L, int index);
+LUA_API int lua_iscfunction (lua_State *L, int index);
+LUA_API int lua_tag (lua_State *L, int index);
+
+LUA_API int lua_equal (lua_State *L, int index1, int index2);
+LUA_API int lua_lessthan (lua_State *L, int index1, int index2);
+
+LUA_API double lua_tonumber (lua_State *L, int index);
+LUA_API const char *lua_tostring (lua_State *L, int index);
+LUA_API size_t lua_strlen (lua_State *L, int index);
+LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index);
+LUA_API void *lua_touserdata (lua_State *L, int index);
+LUA_API const void *lua_topointer (lua_State *L, int index);
+
+
+/*
+** push functions (C -> stack)
+*/
+LUA_API void lua_pushnil (lua_State *L);
+LUA_API void lua_pushnumber (lua_State *L, double n);
+LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len);
+LUA_API void lua_pushstring (lua_State *L, const char *s);
+LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
+LUA_API void lua_pushusertag (lua_State *L, void *u, int tag);
+
+
+/*
+** get functions (Lua -> stack)
+*/
+LUA_API void lua_getglobal (lua_State *L, const char *name);
+LUA_API void lua_gettable (lua_State *L, int index);
+LUA_API void lua_rawget (lua_State *L, int index);
+LUA_API void lua_rawgeti (lua_State *L, int index, int n);
+LUA_API void lua_getglobals (lua_State *L);
+LUA_API void lua_gettagmethod (lua_State *L, int tag, const char *event);
+LUA_API int lua_getref (lua_State *L, int ref);
+LUA_API void lua_newtable (lua_State *L);
+
+
+/*
+** set functions (stack -> Lua)
+*/
+LUA_API void lua_setglobal (lua_State *L, const char *name);
+LUA_API void lua_settable (lua_State *L, int index);
+LUA_API void lua_rawset (lua_State *L, int index);
+LUA_API void lua_rawseti (lua_State *L, int index, int n);
+LUA_API void lua_setglobals (lua_State *L);
+LUA_API void lua_settagmethod (lua_State *L, int tag, const char *event);
+LUA_API int lua_ref (lua_State *L, int lock);
+
+
+/*
+** "do" functions (run Lua code)
+*/
+LUA_API int lua_call (lua_State *L, int nargs, int nresults);
+LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults);
+LUA_API int lua_dofile (lua_State *L, const char *filename);
+LUA_API int lua_dostring (lua_State *L, const char *str);
+LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, const char *name);
+
+/*
+** Garbage-collection functions
+*/
+LUA_API int lua_getgcthreshold (lua_State *L);
+LUA_API int lua_getgccount (lua_State *L);
+LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold);
+
+/*
+** miscellaneous functions
+*/
+LUA_API int lua_newtag (lua_State *L);
+LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom);
+LUA_API void lua_settag (lua_State *L, int tag);
+
+LUA_API void lua_error (lua_State *L, const char *s);
+
+LUA_API void lua_unref (lua_State *L, int ref);
+
+LUA_API int lua_next (lua_State *L, int index);
+LUA_API int lua_getn (lua_State *L, int index);
+
+LUA_API void lua_concat (lua_State *L, int n);
+
+LUA_API void *lua_newuserdata (lua_State *L, size_t size);
+
+
+/*
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define lua_pop(L,n) lua_settop(L, -(n)-1)
+
+#define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n))
+#define lua_pushuserdata(L,u) lua_pushusertag(L, u, 0)
+#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0)
+#define lua_clonetag(L,t) lua_copytagmethods(L, lua_newtag(L), (t))
+
+#define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION)
+#define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE)
+#define lua_isuserdata(L,n) (lua_type(L,n) == LUA_TUSERDATA)
+#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)
+#define lua_isnull(L,n) (lua_type(L,n) == LUA_TNONE)
+
+#define lua_getregistry(L) lua_getref(L, LUA_REFREGISTRY)
+
+#endif
+
+
+
+/******************************************************************************
+* Copyright (C) 1994-2000 TeCGraf, PUC-Rio. All rights reserved.
+*
+* Permission is hereby granted, without written agreement and without license
+* or royalty fees, to use, copy, modify, and distribute this software and its
+* documentation for any purpose, including commercial applications, subject to
+* the following conditions:
+*
+* - The above copyright notice and this permission notice shall appear in all
+* copies or substantial portions of this software.
+*
+* - The origin of this software must not be misrepresented; you must not
+* claim that you wrote the original software. If you use this software in a
+* product, an acknowledgment in the product documentation would be greatly
+* appreciated (but it is not required).
+*
+* - Altered source versions must be plainly marked as such, and must not be
+* misrepresented as being the original software.
+*
+* The authors specifically disclaim any warranties, including, but not limited
+* to, the implied warranties of merchantability and fitness for a particular
+* purpose. The software provided hereunder is on an "as is" basis, and the
+* authors have no obligation to provide maintenance, support, updates,
+* enhancements, or modifications. In no event shall TeCGraf, PUC-Rio, or the
+* authors be held liable to any party for direct, indirect, special,
+* incidental, or consequential damages arising out of the use of this software
+* and its documentation.
+*
+* The Lua language and this implementation have been entirely designed and
+* written by Waldemar Celes Filho, Roberto Ierusalimschy and
+* Luiz Henrique de Figueiredo at TeCGraf, PUC-Rio.
+*
+* This implementation contains no third-party code.
+******************************************************************************/
+
diff --git a/lua/include/luadebug.h b/lua/include/luadebug.h
new file mode 100644
index 0000000..387e06c
--- /dev/null
+++ b/lua/include/luadebug.h
@@ -0,0 +1,46 @@
+/*
+** $Id: luadebug.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Debugging API
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef luadebug_h
+#define luadebug_h
+
+
+#include "lua.h"
+
+typedef struct lua_Debug lua_Debug; /* activation record */
+typedef struct lua_Localvar lua_Localvar;
+
+typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
+
+
+LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
+LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
+LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
+
+LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func);
+LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);
+
+
+#define LUA_IDSIZE 60
+
+struct lua_Debug {
+ const char *event; /* `call', `return' */
+ int currentline; /* (l) */
+ const char *name; /* (n) */
+ const char *namewhat; /* (n) `global', `tag method', `local', `field' */
+ int nups; /* (u) number of upvalues */
+ int linedefined; /* (S) */
+ const char *what; /* (S) `Lua' function, `C' function, Lua `main' */
+ const char *source; /* (S) */
+ char short_src[LUA_IDSIZE]; /* (S) */
+ /* private part */
+ struct lua_TObject *_func; /* active function */
+};
+
+
+#endif
diff --git a/lua/include/lualib.h b/lua/include/lualib.h
new file mode 100644
index 0000000..a80c51a
--- /dev/null
+++ b/lua/include/lualib.h
@@ -0,0 +1,34 @@
+/*
+** $Id: lualib.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Lua standard libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lualib_h
+#define lualib_h
+
+#include "lua.h"
+
+
+#ifndef LUALIB_API
+#define LUALIB_API extern
+#endif
+
+
+#define LUA_ALERT "_ALERT"
+
+LUALIB_API void lua_baselibopen (lua_State *L);
+LUALIB_API void lua_iolibopen (lua_State *L);
+LUALIB_API void lua_strlibopen (lua_State *L);
+LUALIB_API void lua_mathlibopen (lua_State *L);
+LUALIB_API void lua_dblibopen (lua_State *L);
+
+
+
+/* Auxiliary functions (private) */
+
+const char *luaI_classend (lua_State *L, const char *p);
+int luaI_singlematch (int c, const char *p, const char *ep);
+
+#endif
diff --git a/lua/src/Makefile.am b/lua/src/Makefile.am
new file mode 100644
index 0000000..ff410a5
--- /dev/null
+++ b/lua/src/Makefile.am
@@ -0,0 +1,16 @@
+SUBDIRS=lib
+
+noinst_LIBRARIES=liblua.a
+
+DEFS=
+AM_CPPFLAGS=
+AM_CFLAGS=-ansi -pedantic -Wall -I$(srcdir) -I$(top_srcdir)/lua/include
+LDFLAGS=
+LIBS=-lm
+
+liblua_a_SOURCES=lapi.c lcode.c ldebug.c ldo.c lfunc.c lgc.c llex.c lmem.c \
+ lobject.c lparser.c lstate.c lstring.c ltable.c ltests.c ltm.c lundump.c \
+ lvm.c lzio.c
+noinst_HEADERS=lapi.h lcode.h ldebug.h ldo.h lfunc.h lgc.h llex.h llimits.h lmem.h \
+ lobject.h lopcodes.h lparser.h lstate.h lstring.h ltable.h ltm.h \
+ lundump.h lvm.h lzio.h
diff --git a/lua/src/Makefile.in b/lua/src/Makefile.in
new file mode 100644
index 0000000..22ee463
--- /dev/null
+++ b/lua/src/Makefile.in
@@ -0,0 +1,417 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+SUBDIRS = lib
+
+noinst_LIBRARIES = liblua.a
+
+DEFS =
+AM_CPPFLAGS =
+AM_CFLAGS = -ansi -pedantic -Wall -I$(srcdir) -I$(top_srcdir)/lua/include
+LDFLAGS =
+LIBS = -lm
+
+liblua_a_SOURCES = lapi.c lcode.c ldebug.c ldo.c lfunc.c lgc.c llex.c lmem.c \
+ lobject.c lparser.c lstate.c lstring.c ltable.c ltests.c ltm.c lundump.c \
+ lvm.c lzio.c
+
+noinst_HEADERS = lapi.h lcode.h ldebug.h ldo.h lfunc.h lgc.h llex.h llimits.h lmem.h \
+ lobject.h lopcodes.h lparser.h lstate.h lstring.h ltable.h ltm.h \
+ lundump.h lvm.h lzio.h
+
+subdir = lua/src
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+liblua_a_AR = $(AR) cru
+liblua_a_LIBADD =
+am_liblua_a_OBJECTS = lapi.$(OBJEXT) lcode.$(OBJEXT) ldebug.$(OBJEXT) \
+ ldo.$(OBJEXT) lfunc.$(OBJEXT) lgc.$(OBJEXT) llex.$(OBJEXT) \
+ lmem.$(OBJEXT) lobject.$(OBJEXT) lparser.$(OBJEXT) \
+ lstate.$(OBJEXT) lstring.$(OBJEXT) ltable.$(OBJEXT) \
+ ltests.$(OBJEXT) ltm.$(OBJEXT) lundump.$(OBJEXT) lvm.$(OBJEXT) \
+ lzio.$(OBJEXT)
+liblua_a_OBJECTS = $(am_liblua_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/lapi.Po $(DEPDIR)/lcode.Po \
+@AMDEP_TRUE@ $(DEPDIR)/ldebug.Po $(DEPDIR)/ldo.Po \
+@AMDEP_TRUE@ $(DEPDIR)/lfunc.Po $(DEPDIR)/lgc.Po \
+@AMDEP_TRUE@ $(DEPDIR)/llex.Po $(DEPDIR)/lmem.Po \
+@AMDEP_TRUE@ $(DEPDIR)/lobject.Po $(DEPDIR)/lparser.Po \
+@AMDEP_TRUE@ $(DEPDIR)/lstate.Po $(DEPDIR)/lstring.Po \
+@AMDEP_TRUE@ $(DEPDIR)/ltable.Po $(DEPDIR)/ltests.Po \
+@AMDEP_TRUE@ $(DEPDIR)/ltm.Po $(DEPDIR)/lundump.Po \
+@AMDEP_TRUE@ $(DEPDIR)/lvm.Po $(DEPDIR)/lzio.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(liblua_a_SOURCES)
+HEADERS = $(noinst_HEADERS)
+
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
+ uninstall-info-recursive all-recursive install-data-recursive \
+ install-exec-recursive installdirs-recursive install-recursive \
+ uninstall-recursive check-recursive installcheck-recursive
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+DIST_SUBDIRS = $(SUBDIRS)
+SOURCES = $(liblua_a_SOURCES)
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign lua/src/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+liblua.a: $(liblua_a_OBJECTS) $(liblua_a_DEPENDENCIES)
+ -rm -f liblua.a
+ $(liblua_a_AR) liblua.a $(liblua_a_OBJECTS) $(liblua_a_LIBADD)
+ $(RANLIB) liblua.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lapi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lcode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ldebug.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ldo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lfunc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lgc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/llex.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lmem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lobject.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lparser.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lstate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lstring.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ltable.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ltests.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ltm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lundump.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lvm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lzio.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-recursive
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
+ clean-generic clean-noinstLIBRARIES clean-recursive distclean \
+ distclean-compile distclean-depend distclean-generic \
+ distclean-recursive distclean-tags distdir dvi dvi-am \
+ dvi-recursive info info-am info-recursive install install-am \
+ install-data install-data-am install-data-recursive \
+ install-exec install-exec-am install-exec-recursive \
+ install-info install-info-am install-info-recursive install-man \
+ install-recursive install-strip installcheck installcheck-am \
+ installdirs installdirs-am installdirs-recursive \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-recursive tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am \
+ uninstall-info-recursive uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lua/src/lapi.c b/lua/src/lapi.c
new file mode 100644
index 0000000..9cb7199
--- /dev/null
+++ b/lua/src/lapi.c
@@ -0,0 +1,494 @@
+/*
+** $Id: lapi.c,v 1.2 2002/07/12 07:49:04 jcatki Exp $
+** Lua API
+** See Copyright Notice in lua.h
+*/
+
+
+#include <string.h>
+
+#include "lua.h"
+
+#include "lapi.h"
+#include "ldo.h"
+#include "lfunc.h"
+#include "lgc.h"
+#include "lmem.h"
+#include "lobject.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+#include "ltm.h"
+#include "lvm.h"
+
+
+const char lua_ident[] = "$Lua: " LUA_VERSION " " LUA_COPYRIGHT " $\n"
+ "$Authors: " LUA_AUTHORS " $";
+
+
+
+#define Index(L,i) ((i) >= 0 ? (L->Cbase+((i)-1)) : (L->top+(i)))
+
+#define api_incr_top(L) incr_top
+
+
+
+
+TObject *luaA_index (lua_State *L, int index) {
+ return Index(L, index);
+}
+
+
+static TObject *luaA_indexAcceptable (lua_State *L, int index) {
+ if (index >= 0) {
+ TObject *o = L->Cbase+(index-1);
+ if (o >= L->top) return NULL;
+ else return o;
+ }
+ else return L->top+index;
+}
+
+
+void luaA_pushobject (lua_State *L, const TObject *o) {
+ *L->top = *o;
+ incr_top;
+}
+
+LUA_API int lua_stackspace (lua_State *L) {
+ return (L->stack_last - L->top);
+}
+
+
+
+/*
+** basic stack manipulation
+*/
+
+
+LUA_API int lua_gettop (lua_State *L) {
+ return (L->top - L->Cbase);
+}
+
+
+LUA_API void lua_settop (lua_State *L, int index) {
+ if (index >= 0)
+ luaD_adjusttop(L, L->Cbase, index);
+ else
+ L->top = L->top+index+1; /* index is negative */
+}
+
+
+LUA_API void lua_remove (lua_State *L, int index) {
+ StkId p = luaA_index(L, index);
+ while (++p < L->top) *(p-1) = *p;
+ L->top--;
+}
+
+
+LUA_API void lua_insert (lua_State *L, int index) {
+ StkId p = luaA_index(L, index);
+ StkId q;
+ for (q = L->top; q>p; q--)
+ *q = *(q-1);
+ *p = *L->top;
+}
+
+
+LUA_API void lua_pushvalue (lua_State *L, int index) {
+ *L->top = *luaA_index(L, index);
+ api_incr_top(L);
+}
+
+
+
+/*
+** access functions (stack -> C)
+*/
+
+
+LUA_API int lua_type (lua_State *L, int index) {
+ StkId o = luaA_indexAcceptable(L, index);
+ return (o == NULL) ? LUA_TNONE : ttype(o);
+}
+
+LUA_API const char *lua_typename (lua_State *L, int t) {
+ UNUSED(L);
+ return (t == LUA_TNONE) ? "no value" : luaO_typenames[t];
+}
+
+
+LUA_API int lua_iscfunction (lua_State *L, int index) {
+ StkId o = luaA_indexAcceptable(L, index);
+ return (o == NULL) ? 0 : iscfunction(o);
+}
+
+LUA_API int lua_isnumber (lua_State *L, int index) {
+ TObject *o = luaA_indexAcceptable(L, index);
+ return (o == NULL) ? 0 : (tonumber(o) == 0);
+}
+
+LUA_API int lua_isstring (lua_State *L, int index) {
+ int t = lua_type(L, index);
+ return (t == LUA_TSTRING || t == LUA_TNUMBER);
+}
+
+
+LUA_API int lua_tag (lua_State *L, int index) {
+ StkId o = luaA_indexAcceptable(L, index);
+ return (o == NULL) ? LUA_NOTAG : luaT_tag(o);
+}
+
+LUA_API int lua_equal (lua_State *L, int index1, int index2) {
+ StkId o1 = luaA_indexAcceptable(L, index1);
+ StkId o2 = luaA_indexAcceptable(L, index2);
+ if (o1 == NULL || o2 == NULL) return 0; /* index out-of-range */
+ else return luaO_equalObj(o1, o2);
+}
+
+LUA_API int lua_lessthan (lua_State *L, int index1, int index2) {
+ StkId o1 = luaA_indexAcceptable(L, index1);
+ StkId o2 = luaA_indexAcceptable(L, index2);
+ if (o1 == NULL || o2 == NULL) return 0; /* index out-of-range */
+ else return luaV_lessthan(L, o1, o2, L->top);
+}
+
+
+
+LUA_API double lua_tonumber (lua_State *L, int index) {
+ StkId o = luaA_indexAcceptable(L, index);
+ return (o == NULL || tonumber(o)) ? 0 : nvalue(o);
+}
+
+LUA_API const char *lua_tostring (lua_State *L, int index) {
+ StkId o = luaA_indexAcceptable(L, index);
+ return (o == NULL || tostring(L, o)) ? NULL : svalue(o);
+}
+
+LUA_API size_t lua_strlen (lua_State *L, int index) {
+ StkId o = luaA_indexAcceptable(L, index);
+ return (o == NULL || tostring(L, o)) ? 0 : tsvalue(o)->len;
+}
+
+LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index) {
+ StkId o = luaA_indexAcceptable(L, index);
+ return (o == NULL || !iscfunction(o)) ? NULL : clvalue(o)->f.c;
+}
+
+LUA_API void *lua_touserdata (lua_State *L, int index) {
+ StkId o = luaA_indexAcceptable(L, index);
+ return (o == NULL || ttype(o) != LUA_TUSERDATA) ? NULL :
+ tsvalue(o)->u.d.value;
+}
+
+LUA_API const void *lua_topointer (lua_State *L, int index) {
+ StkId o = luaA_indexAcceptable(L, index);
+ if (o == NULL) return NULL;
+ switch (ttype(o)) {
+ case LUA_TTABLE:
+ return hvalue(o);
+ case LUA_TFUNCTION:
+ return clvalue(o);
+ default: return NULL;
+ }
+}
+
+
+
+/*
+** push functions (C -> stack)
+*/
+
+
+LUA_API void lua_pushnil (lua_State *L) {
+ ttype(L->top) = LUA_TNIL;
+ api_incr_top(L);
+}
+
+
+LUA_API void lua_pushnumber (lua_State *L, double n) {
+ nvalue(L->top) = n;
+ ttype(L->top) = LUA_TNUMBER;
+ api_incr_top(L);
+}
+
+
+LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
+ tsvalue(L->top) = luaS_newlstr(L, s, len);
+ ttype(L->top) = LUA_TSTRING;
+ api_incr_top(L);
+}
+
+
+LUA_API void lua_pushstring (lua_State *L, const char *s) {
+ if (s == NULL)
+ lua_pushnil(L);
+ else
+ lua_pushlstring(L, s, strlen(s));
+}
+
+
+LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
+ luaV_Cclosure(L, fn, n);
+}
+
+
+LUA_API void lua_pushusertag (lua_State *L, void *u, int tag) {
+ /* ORDER LUA_T */
+ if (!(tag == LUA_ANYTAG || tag == LUA_TUSERDATA || validtag(tag)))
+ luaO_verror(L, "invalid tag for a userdata (%d)", tag);
+ tsvalue(L->top) = luaS_createudata(L, u, tag);
+ ttype(L->top) = LUA_TUSERDATA;
+ api_incr_top(L);
+}
+
+
+
+/*
+** get functions (Lua -> stack)
+*/
+
+
+LUA_API void lua_getglobal (lua_State *L, const char *name) {
+ StkId top = L->top;
+ *top = *luaV_getglobal(L, luaS_new(L, name));
+ L->top = top;
+ api_incr_top(L);
+}
+
+
+LUA_API void lua_gettable (lua_State *L, int index) {
+ StkId t = Index(L, index);
+ StkId top = L->top;
+ *(top-1) = *luaV_gettable(L, t);
+ L->top = top; /* tag method may change top */
+}
+
+
+LUA_API void lua_rawget (lua_State *L, int index) {
+ StkId t = Index(L, index);
+ LUA_ASSERT(ttype(t) == LUA_TTABLE, "table expected");
+ *(L->top - 1) = *luaH_get(L, hvalue(t), L->top - 1);
+}
+
+
+LUA_API void lua_rawgeti (lua_State *L, int index, int n) {
+ StkId o = Index(L, index);
+ LUA_ASSERT(ttype(o) == LUA_TTABLE, "table expected");
+ *L->top = *luaH_getnum(hvalue(o), n);
+ api_incr_top(L);
+}
+
+
+LUA_API void lua_getglobals (lua_State *L) {
+ hvalue(L->top) = L->gt;
+ ttype(L->top) = LUA_TTABLE;
+ api_incr_top(L);
+}
+
+
+LUA_API int lua_getref (lua_State *L, int ref) {
+ if (ref == LUA_REFNIL)
+ ttype(L->top) = LUA_TNIL;
+ else if (0 <= ref && ref < L->refSize &&
+ (L->refArray[ref].st == LOCK || L->refArray[ref].st == HOLD))
+ *L->top = L->refArray[ref].o;
+ else
+ return 0;
+ api_incr_top(L);
+ return 1;
+}
+
+
+LUA_API void lua_newtable (lua_State *L) {
+ hvalue(L->top) = luaH_new(L, 0);
+ ttype(L->top) = LUA_TTABLE;
+ api_incr_top(L);
+}
+
+
+
+/*
+** set functions (stack -> Lua)
+*/
+
+
+LUA_API void lua_setglobal (lua_State *L, const char *name) {
+ StkId top = L->top;
+ luaV_setglobal(L, luaS_new(L, name));
+ L->top = top-1; /* remove element from the top */
+}
+
+
+LUA_API void lua_settable (lua_State *L, int index) {
+ StkId t = Index(L, index);
+ StkId top = L->top;
+ luaV_settable(L, t, top-2);
+ L->top = top-2; /* pop index and value */
+}
+
+
+LUA_API void lua_rawset (lua_State *L, int index) {
+ StkId t = Index(L, index);
+ LUA_ASSERT(ttype(t) == LUA_TTABLE, "table expected");
+ *luaH_set(L, hvalue(t), L->top-2) = *(L->top-1);
+ L->top -= 2;
+}
+
+
+LUA_API void lua_rawseti (lua_State *L, int index, int n) {
+ StkId o = Index(L, index);
+ LUA_ASSERT(ttype(o) == LUA_TTABLE, "table expected");
+ *luaH_setint(L, hvalue(o), n) = *(L->top-1);
+ L->top--;
+}
+
+
+LUA_API void lua_setglobals (lua_State *L) {
+ StkId newtable = --L->top;
+ LUA_ASSERT(ttype(newtable) == LUA_TTABLE, "table expected");
+ L->gt = hvalue(newtable);
+}
+
+
+LUA_API int lua_ref (lua_State *L, int lock) {
+ int ref;
+ if (ttype(L->top-1) == LUA_TNIL)
+ ref = LUA_REFNIL;
+ else {
+ if (L->refFree != NONEXT) { /* is there a free place? */
+ ref = L->refFree;
+ L->refFree = L->refArray[ref].st;
+ }
+ else { /* no more free places */
+ luaM_growvector(L, L->refArray, L->refSize, 1, struct Ref,
+ "reference table overflow", MAX_INT);
+ L->nblocks += sizeof(struct Ref);
+ ref = L->refSize++;
+ }
+ L->refArray[ref].o = *(L->top-1);
+ L->refArray[ref].st = lock ? LOCK : HOLD;
+ }
+ L->top--;
+ return ref;
+}
+
+
+/*
+** "do" functions (run Lua code)
+** (most of them are in ldo.c)
+*/
+
+LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults) {
+ luaD_call(L, L->top-(nargs+1), nresults);
+}
+
+
+/*
+** Garbage-collection functions
+*/
+
+/* GC values are expressed in Kbytes: #bytes/2^10 */
+#define GCscale(x) ((int)((x)>>10))
+#define GCunscale(x) ((unsigned long)(x)<<10)
+
+LUA_API int lua_getgcthreshold (lua_State *L) {
+ return GCscale(L->GCthreshold);
+}
+
+LUA_API int lua_getgccount (lua_State *L) {
+ return GCscale(L->nblocks);
+}
+
+LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold) {
+ if (newthreshold > GCscale(ULONG_MAX))
+ L->GCthreshold = ULONG_MAX;
+ else
+ L->GCthreshold = GCunscale(newthreshold);
+ luaC_checkGC(L);
+}
+
+
+/*
+** miscellaneous functions
+*/
+
+LUA_API void lua_settag (lua_State *L, int tag) {
+ luaT_realtag(L, tag);
+ switch (ttype(L->top-1)) {
+ case LUA_TTABLE:
+ hvalue(L->top-1)->htag = tag;
+ break;
+ case LUA_TUSERDATA:
+ tsvalue(L->top-1)->u.d.tag = tag;
+ break;
+ default:
+ luaO_verror(L, "cannot change the tag of a %.20s",
+ luaO_typename(L->top-1));
+ }
+}
+
+
+LUA_API void lua_unref (lua_State *L, int ref) {
+ if (ref >= 0) {
+ LUA_ASSERT(ref < L->refSize && L->refArray[ref].st < 0, "invalid ref");
+ L->refArray[ref].st = L->refFree;
+ L->refFree = ref;
+ }
+}
+
+
+LUA_API int lua_next (lua_State *L, int index) {
+ StkId t = luaA_index(L, index);
+ Node *n;
+ LUA_ASSERT(ttype(t) == LUA_TTABLE, "table expected");
+ n = luaH_next(L, hvalue(t), luaA_index(L, -1));
+ if (n) {
+ *(L->top-1) = *key(n);
+ *L->top = *val(n);
+ api_incr_top(L);
+ return 1;
+ }
+ else { /* no more elements */
+ L->top -= 1; /* remove key */
+ return 0;
+ }
+}
+
+
+LUA_API int lua_getn (lua_State *L, int index) {
+ Hash *h = hvalue(luaA_index(L, index));
+ const TObject *value = luaH_getstr(h, luaS_new(L, "n")); /* value = h.n */
+ if (ttype(value) == LUA_TNUMBER)
+ return (int)nvalue(value);
+ else {
+ Number max = 0;
+ int i = h->size;
+ Node *n = h->node;
+ while (i--) {
+ if (ttype(key(n)) == LUA_TNUMBER &&
+ ttype(val(n)) != LUA_TNIL &&
+ nvalue(key(n)) > max)
+ max = nvalue(key(n));
+ n++;
+ }
+ return (int)max;
+ }
+}
+
+
+LUA_API void lua_concat (lua_State *L, int n) {
+ StkId top = L->top;
+ luaV_strconc(L, n, top);
+ L->top = top-(n-1);
+ luaC_checkGC(L);
+}
+
+
+LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
+ TString *ts = luaS_newudata(L, (size==0) ? 1 : size, NULL);
+ tsvalue(L->top) = ts;
+ ttype(L->top) = LUA_TUSERDATA;
+ api_incr_top(L);
+ return ts->u.d.value;
+}
+
diff --git a/lua/src/lapi.h b/lua/src/lapi.h
new file mode 100644
index 0000000..b8b807d
--- /dev/null
+++ b/lua/src/lapi.h
@@ -0,0 +1,17 @@
+/*
+** $Id: lapi.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Auxiliary functions from Lua API
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lapi_h
+#define lapi_h
+
+
+#include "lobject.h"
+
+
+TObject *luaA_index (lua_State *L, int index);
+void luaA_pushobject (lua_State *L, const TObject *o);
+
+#endif
diff --git a/lua/src/lcode.c b/lua/src/lcode.c
new file mode 100644
index 0000000..02c2864
--- /dev/null
+++ b/lua/src/lcode.c
@@ -0,0 +1,701 @@
+/*
+** $Id: lcode.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Code generator for Lua
+** See Copyright Notice in lua.h
+*/
+
+
+#include "stdlib.h"
+
+#include "lua.h"
+
+#include "lcode.h"
+#include "ldo.h"
+#include "llex.h"
+#include "lmem.h"
+#include "lobject.h"
+#include "lopcodes.h"
+#include "lparser.h"
+
+
+void luaK_error (LexState *ls, const char *msg) {
+ luaX_error(ls, msg, ls->t.token);
+}
+
+
+/*
+** Returns the the previous instruction, for optimizations.
+** If there is a jump target between this and the current instruction,
+** returns a dummy instruction to avoid wrong optimizations.
+*/
+static Instruction previous_instruction (FuncState *fs) {
+ if (fs->pc > fs->lasttarget) /* no jumps to current position? */
+ return fs->f->code[fs->pc-1]; /* returns previous instruction */
+ else
+ return CREATE_0(OP_END); /* no optimizations after an `END' */
+}
+
+
+int luaK_jump (FuncState *fs) {
+ int j = luaK_code1(fs, OP_JMP, NO_JUMP);
+ if (j == fs->lasttarget) { /* possible jumps to this jump? */
+ luaK_concat(fs, &j, fs->jlt); /* keep them on hold */
+ fs->jlt = NO_JUMP;
+ }
+ return j;
+}
+
+
+static void luaK_fixjump (FuncState *fs, int pc, int dest) {
+ Instruction *jmp = &fs->f->code[pc];
+ if (dest == NO_JUMP)
+ SETARG_S(*jmp, NO_JUMP); /* point to itself to represent end of list */
+ else { /* jump is relative to position following jump instruction */
+ int offset = dest-(pc+1);
+ if (abs(offset) > MAXARG_S)
+ luaK_error(fs->ls, "control structure too long");
+ SETARG_S(*jmp, offset);
+ }
+}
+
+
+static int luaK_getjump (FuncState *fs, int pc) {
+ int offset = GETARG_S(fs->f->code[pc]);
+ if (offset == NO_JUMP) /* point to itself represents end of list */
+ return NO_JUMP; /* end of list */
+ else
+ return (pc+1)+offset; /* turn offset into absolute position */
+}
+
+
+/*
+** returns current `pc' and marks it as a jump target (to avoid wrong
+** optimizations with consecutive instructions not in the same basic block).
+** discharge list of jumps to last target.
+*/
+int luaK_getlabel (FuncState *fs) {
+ if (fs->pc != fs->lasttarget) {
+ int lasttarget = fs->lasttarget;
+ fs->lasttarget = fs->pc;
+ luaK_patchlist(fs, fs->jlt, lasttarget); /* discharge old list `jlt' */
+ fs->jlt = NO_JUMP; /* nobody jumps to this new label (yet) */
+ }
+ return fs->pc;
+}
+
+
+void luaK_deltastack (FuncState *fs, int delta) {
+ fs->stacklevel += delta;
+ if (fs->stacklevel > fs->f->maxstacksize) {
+ if (fs->stacklevel > MAXSTACK)
+ luaK_error(fs->ls, "function or expression too complex");
+ fs->f->maxstacksize = fs->stacklevel;
+ }
+}
+
+
+void luaK_kstr (LexState *ls, int c) {
+ luaK_code1(ls->fs, OP_PUSHSTRING, c);
+}
+
+
+static int number_constant (FuncState *fs, Number r) {
+ /* check whether `r' has appeared within the last LOOKBACKNUMS entries */
+ Proto *f = fs->f;
+ int c = f->nknum;
+ int lim = c < LOOKBACKNUMS ? 0 : c-LOOKBACKNUMS;
+ while (--c >= lim)
+ if (f->knum[c] == r) return c;
+ /* not found; create a new entry */
+ luaM_growvector(fs->L, f->knum, f->nknum, 1, Number,
+ "constant table overflow", MAXARG_U);
+ c = f->nknum++;
+ f->knum[c] = r;
+ return c;
+}
+
+
+void luaK_number (FuncState *fs, Number f) {
+ if (f <= (Number)MAXARG_S && (Number)(int)f == f)
+ luaK_code1(fs, OP_PUSHINT, (int)f); /* f has a short integer value */
+ else
+ luaK_code1(fs, OP_PUSHNUM, number_constant(fs, f));
+}
+
+
+void luaK_adjuststack (FuncState *fs, int n) {
+ if (n > 0)
+ luaK_code1(fs, OP_POP, n);
+ else
+ luaK_code1(fs, OP_PUSHNIL, -n);
+}
+
+
+int luaK_lastisopen (FuncState *fs) {
+ /* check whether last instruction is an open function call */
+ Instruction i = previous_instruction(fs);
+ if (GET_OPCODE(i) == OP_CALL && GETARG_B(i) == MULT_RET)
+ return 1;
+ else return 0;
+}
+
+
+void luaK_setcallreturns (FuncState *fs, int nresults) {
+ if (luaK_lastisopen(fs)) { /* expression is an open function call? */
+ SETARG_B(fs->f->code[fs->pc-1], nresults); /* set number of results */
+ luaK_deltastack(fs, nresults); /* push results */
+ }
+}
+
+
+static int discharge (FuncState *fs, expdesc *var) {
+ switch (var->k) {
+ case VLOCAL:
+ luaK_code1(fs, OP_GETLOCAL, var->u.index);
+ break;
+ case VGLOBAL:
+ luaK_code1(fs, OP_GETGLOBAL, var->u.index);
+ break;
+ case VINDEXED:
+ luaK_code0(fs, OP_GETTABLE);
+ break;
+ case VEXP:
+ return 0; /* nothing to do */
+ }
+ var->k = VEXP;
+ var->u.l.t = var->u.l.f = NO_JUMP;
+ return 1;
+}
+
+
+static void discharge1 (FuncState *fs, expdesc *var) {
+ discharge(fs, var);
+ /* if it has jumps then it is already discharged */
+ if (var->u.l.t == NO_JUMP && var->u.l.f == NO_JUMP)
+ luaK_setcallreturns(fs, 1); /* call must return 1 value */
+}
+
+
+void luaK_storevar (LexState *ls, const expdesc *var) {
+ FuncState *fs = ls->fs;
+ switch (var->k) {
+ case VLOCAL:
+ luaK_code1(fs, OP_SETLOCAL, var->u.index);
+ break;
+ case VGLOBAL:
+ luaK_code1(fs, OP_SETGLOBAL, var->u.index);
+ break;
+ case VINDEXED: /* table is at top-3; pop 3 elements after operation */
+ luaK_code2(fs, OP_SETTABLE, 3, 3);
+ break;
+ default:
+ LUA_INTERNALERROR("invalid var kind to store");
+ }
+}
+
+
+static OpCode invertjump (OpCode op) {
+ switch (op) {
+ case OP_JMPNE: return OP_JMPEQ;
+ case OP_JMPEQ: return OP_JMPNE;
+ case OP_JMPLT: return OP_JMPGE;
+ case OP_JMPLE: return OP_JMPGT;
+ case OP_JMPGT: return OP_JMPLE;
+ case OP_JMPGE: return OP_JMPLT;
+ case OP_JMPT: case OP_JMPONT: return OP_JMPF;
+ case OP_JMPF: case OP_JMPONF: return OP_JMPT;
+ default:
+ LUA_INTERNALERROR("invalid jump instruction");
+ return OP_END; /* to avoid warnings */
+ }
+}
+
+
+static void luaK_patchlistaux (FuncState *fs, int list, int target,
+ OpCode special, int special_target) {
+ Instruction *code = fs->f->code;
+ while (list != NO_JUMP) {
+ int next = luaK_getjump(fs, list);
+ Instruction *i = &code[list];
+ OpCode op = GET_OPCODE(*i);
+ if (op == special) /* this `op' already has a value */
+ luaK_fixjump(fs, list, special_target);
+ else {
+ luaK_fixjump(fs, list, target); /* do the patch */
+ if (op == OP_JMPONT) /* remove eventual values */
+ SET_OPCODE(*i, OP_JMPT);
+ else if (op == OP_JMPONF)
+ SET_OPCODE(*i, OP_JMPF);
+ }
+ list = next;
+ }
+}
+
+
+void luaK_patchlist (FuncState *fs, int list, int target) {
+ if (target == fs->lasttarget) /* same target that list `jlt'? */
+ luaK_concat(fs, &fs->jlt, list); /* delay fixing */
+ else
+ luaK_patchlistaux(fs, list, target, OP_END, 0);
+}
+
+
+static int need_value (FuncState *fs, int list, OpCode hasvalue) {
+ /* check whether list has a jump without a value */
+ for (; list != NO_JUMP; list = luaK_getjump(fs, list))
+ if (GET_OPCODE(fs->f->code[list]) != hasvalue) return 1;
+ return 0; /* not found */
+}
+
+
+void luaK_concat (FuncState *fs, int *l1, int l2) {
+ if (*l1 == NO_JUMP)
+ *l1 = l2;
+ else {
+ int list = *l1;
+ for (;;) { /* traverse `l1' */
+ int next = luaK_getjump(fs, list);
+ if (next == NO_JUMP) { /* end of list? */
+ luaK_fixjump(fs, list, l2);
+ return;
+ }
+ list = next;
+ }
+ }
+}
+
+
+static void luaK_testgo (FuncState *fs, expdesc *v, int invert, OpCode jump) {
+ int prevpos; /* position of last instruction */
+ Instruction *previous;
+ int *golist, *exitlist;
+ if (!invert) {
+ golist = &v->u.l.f; /* go if false */
+ exitlist = &v->u.l.t; /* exit if true */
+ }
+ else {
+ golist = &v->u.l.t; /* go if true */
+ exitlist = &v->u.l.f; /* exit if false */
+ }
+ discharge1(fs, v);
+ prevpos = fs->pc-1;
+ previous = &fs->f->code[prevpos];
+ LUA_ASSERT(*previous==previous_instruction(fs), "no jump allowed here");
+ if (!ISJUMP(GET_OPCODE(*previous)))
+ prevpos = luaK_code1(fs, jump, NO_JUMP);
+ else { /* last instruction is already a jump */
+ if (invert)
+ SET_OPCODE(*previous, invertjump(GET_OPCODE(*previous)));
+ }
+ luaK_concat(fs, exitlist, prevpos); /* insert last jump in `exitlist' */
+ luaK_patchlist(fs, *golist, luaK_getlabel(fs));
+ *golist = NO_JUMP;
+}
+
+
+void luaK_goiftrue (FuncState *fs, expdesc *v, int keepvalue) {
+ luaK_testgo(fs, v, 1, keepvalue ? OP_JMPONF : OP_JMPF);
+}
+
+
+static void luaK_goiffalse (FuncState *fs, expdesc *v, int keepvalue) {
+ luaK_testgo(fs, v, 0, keepvalue ? OP_JMPONT : OP_JMPT);
+}
+
+
+static int code_label (FuncState *fs, OpCode op, int arg) {
+ luaK_getlabel(fs); /* those instructions may be jump targets */
+ return luaK_code1(fs, op, arg);
+}
+
+
+void luaK_tostack (LexState *ls, expdesc *v, int onlyone) {
+ FuncState *fs = ls->fs;
+ if (!discharge(fs, v)) { /* `v' is an expression? */
+ OpCode previous = GET_OPCODE(fs->f->code[fs->pc-1]);
+ if (!ISJUMP(previous) && v->u.l.f == NO_JUMP && v->u.l.t == NO_JUMP) {
+ /* expression has no jumps */
+ if (onlyone)
+ luaK_setcallreturns(fs, 1); /* call must return 1 value */
+ }
+ else { /* expression has jumps */
+ int final; /* position after whole expression */
+ int j = NO_JUMP; /* eventual jump over values */
+ int p_nil = NO_JUMP; /* position of an eventual PUSHNIL */
+ int p_1 = NO_JUMP; /* position of an eventual PUSHINT */
+ if (ISJUMP(previous) || need_value(fs, v->u.l.f, OP_JMPONF)
+ || need_value(fs, v->u.l.t, OP_JMPONT)) {
+ /* expression needs values */
+ if (ISJUMP(previous))
+ luaK_concat(fs, &v->u.l.t, fs->pc-1); /* put `previous' in t. list */
+ else {
+ j = code_label(fs, OP_JMP, NO_JUMP); /* to jump over both pushes */
+ /* correct stack for compiler and symbolic execution */
+ luaK_adjuststack(fs, 1);
+ }
+ p_nil = code_label(fs, OP_PUSHNILJMP, 0);
+ p_1 = code_label(fs, OP_PUSHINT, 1);
+ luaK_patchlist(fs, j, luaK_getlabel(fs));
+ }
+ final = luaK_getlabel(fs);
+ luaK_patchlistaux(fs, v->u.l.f, p_nil, OP_JMPONF, final);
+ luaK_patchlistaux(fs, v->u.l.t, p_1, OP_JMPONT, final);
+ v->u.l.f = v->u.l.t = NO_JUMP;
+ }
+ }
+}
+
+
+void luaK_prefix (LexState *ls, UnOpr op, expdesc *v) {
+ FuncState *fs = ls->fs;
+ if (op == OPR_MINUS) {
+ luaK_tostack(ls, v, 1);
+ luaK_code0(fs, OP_MINUS);
+ }
+ else { /* op == NOT */
+ Instruction *previous;
+ discharge1(fs, v);
+ previous = &fs->f->code[fs->pc-1];
+ if (ISJUMP(GET_OPCODE(*previous)))
+ SET_OPCODE(*previous, invertjump(GET_OPCODE(*previous)));
+ else
+ luaK_code0(fs, OP_NOT);
+ /* interchange true and false lists */
+ { int temp = v->u.l.f; v->u.l.f = v->u.l.t; v->u.l.t = temp; }
+ }
+}
+
+
+void luaK_infix (LexState *ls, BinOpr op, expdesc *v) {
+ FuncState *fs = ls->fs;
+ switch (op) {
+ case OPR_AND:
+ luaK_goiftrue(fs, v, 1);
+ break;
+ case OPR_OR:
+ luaK_goiffalse(fs, v, 1);
+ break;
+ default:
+ luaK_tostack(ls, v, 1); /* all other binary operators need a value */
+ }
+}
+
+
+
+static const struct {
+ OpCode opcode; /* opcode for each binary operator */
+ int arg; /* default argument for the opcode */
+} codes[] = { /* ORDER OPR */
+ {OP_ADD, 0}, {OP_SUB, 0}, {OP_MULT, 0}, {OP_DIV, 0},
+ {OP_POW, 0}, {OP_CONCAT, 2},
+ {OP_JMPNE, NO_JUMP}, {OP_JMPEQ, NO_JUMP},
+ {OP_JMPLT, NO_JUMP}, {OP_JMPLE, NO_JUMP},
+ {OP_JMPGT, NO_JUMP}, {OP_JMPGE, NO_JUMP}
+};
+
+
+void luaK_posfix (LexState *ls, BinOpr op, expdesc *v1, expdesc *v2) {
+ FuncState *fs = ls->fs;
+ switch (op) {
+ case OPR_AND: {
+ LUA_ASSERT(v1->u.l.t == NO_JUMP, "list must be closed");
+ discharge1(fs, v2);
+ v1->u.l.t = v2->u.l.t;
+ luaK_concat(fs, &v1->u.l.f, v2->u.l.f);
+ break;
+ }
+ case OPR_OR: {
+ LUA_ASSERT(v1->u.l.f == NO_JUMP, "list must be closed");
+ discharge1(fs, v2);
+ v1->u.l.f = v2->u.l.f;
+ luaK_concat(fs, &v1->u.l.t, v2->u.l.t);
+ break;
+ }
+ default: {
+ luaK_tostack(ls, v2, 1); /* `v2' must be a value */
+ luaK_code1(fs, codes[op].opcode, codes[op].arg);
+ }
+ }
+}
+
+
+static void codelineinfo (FuncState *fs) {
+ Proto *f = fs->f;
+ LexState *ls = fs->ls;
+ if (ls->lastline > fs->lastline) {
+ luaM_growvector(fs->L, f->lineinfo, f->nlineinfo, 2, int,
+ "line info overflow", MAX_INT);
+ if (ls->lastline > fs->lastline+1)
+ f->lineinfo[f->nlineinfo++] = -(ls->lastline - (fs->lastline+1));
+ f->lineinfo[f->nlineinfo++] = fs->pc;
+ fs->lastline = ls->lastline;
+ }
+}
+
+
+int luaK_code0 (FuncState *fs, OpCode o) {
+ return luaK_code2(fs, o, 0, 0);
+}
+
+
+int luaK_code1 (FuncState *fs, OpCode o, int arg1) {
+ return luaK_code2(fs, o, arg1, 0);
+}
+
+
+int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) {
+ Instruction i = previous_instruction(fs);
+ int delta = luaK_opproperties[o].push - luaK_opproperties[o].pop;
+ int optm = 0; /* 1 when there is an optimization */
+ switch (o) {
+ case OP_CLOSURE: {
+ delta = -arg2+1;
+ break;
+ }
+ case OP_SETTABLE: {
+ delta = -arg2;
+ break;
+ }
+ case OP_SETLIST: {
+ if (arg2 == 0) return NO_JUMP; /* nothing to do */
+ delta = -arg2;
+ break;
+ }
+ case OP_SETMAP: {
+ if (arg1 == 0) return NO_JUMP; /* nothing to do */
+ delta = -2*arg1;
+ break;
+ }
+ case OP_RETURN: {
+ if (GET_OPCODE(i) == OP_CALL && GETARG_B(i) == MULT_RET) {
+ SET_OPCODE(i, OP_TAILCALL);
+ SETARG_B(i, arg1);
+ optm = 1;
+ }
+ break;
+ }
+ case OP_PUSHNIL: {
+ if (arg1 == 0) return NO_JUMP; /* nothing to do */
+ delta = arg1;
+ switch(GET_OPCODE(i)) {
+ case OP_PUSHNIL: SETARG_U(i, GETARG_U(i)+arg1); optm = 1; break;
+ default: break;
+ }
+ break;
+ }
+ case OP_POP: {
+ if (arg1 == 0) return NO_JUMP; /* nothing to do */
+ delta = -arg1;
+ switch(GET_OPCODE(i)) {
+ case OP_SETTABLE: SETARG_B(i, GETARG_B(i)+arg1); optm = 1; break;
+ default: break;
+ }
+ break;
+ }
+ case OP_GETTABLE: {
+ switch(GET_OPCODE(i)) {
+ case OP_PUSHSTRING: /* `t.x' */
+ SET_OPCODE(i, OP_GETDOTTED);
+ optm = 1;
+ break;
+ case OP_GETLOCAL: /* `t[i]' */
+ SET_OPCODE(i, OP_GETINDEXED);
+ optm = 1;
+ break;
+ default: break;
+ }
+ break;
+ }
+ case OP_ADD: {
+ switch(GET_OPCODE(i)) {
+ case OP_PUSHINT: SET_OPCODE(i, OP_ADDI); optm = 1; break; /* `a+k' */
+ default: break;
+ }
+ break;
+ }
+ case OP_SUB: {
+ switch(GET_OPCODE(i)) {
+ case OP_PUSHINT: /* `a-k' */
+ i = CREATE_S(OP_ADDI, -GETARG_S(i));
+ optm = 1;
+ break;
+ default: break;
+ }
+ break;
+ }
+ case OP_CONCAT: {
+ delta = -arg1+1;
+ switch(GET_OPCODE(i)) {
+ case OP_CONCAT: /* `a..b..c' */
+ SETARG_U(i, GETARG_U(i)+1);
+ optm = 1;
+ break;
+ default: break;
+ }
+ break;
+ }
+ case OP_MINUS: {
+ switch(GET_OPCODE(i)) {
+ case OP_PUSHINT: /* `-k' */
+ SETARG_S(i, -GETARG_S(i));
+ optm = 1;
+ break;
+ case OP_PUSHNUM: /* `-k' */
+ SET_OPCODE(i, OP_PUSHNEGNUM);
+ optm = 1;
+ break;
+ default: break;
+ }
+ break;
+ }
+ case OP_JMPNE: {
+ if (i == CREATE_U(OP_PUSHNIL, 1)) { /* `a~=nil' */
+ i = CREATE_S(OP_JMPT, NO_JUMP);
+ optm = 1;
+ }
+ break;
+ }
+ case OP_JMPEQ: {
+ if (i == CREATE_U(OP_PUSHNIL, 1)) { /* `a==nil' */
+ i = CREATE_0(OP_NOT);
+ delta = -1; /* just undo effect of previous PUSHNIL */
+ optm = 1;
+ }
+ break;
+ }
+ case OP_JMPT:
+ case OP_JMPONT: {
+ switch (GET_OPCODE(i)) {
+ case OP_NOT: {
+ i = CREATE_S(OP_JMPF, NO_JUMP);
+ optm = 1;
+ break;
+ }
+ case OP_PUSHINT: {
+ if (o == OP_JMPT) { /* JMPONT must keep original integer value */
+ i = CREATE_S(OP_JMP, NO_JUMP);
+ optm = 1;
+ }
+ break;
+ }
+ case OP_PUSHNIL: {
+ if (GETARG_U(i) == 1) {
+ fs->pc--; /* erase previous instruction */
+ luaK_deltastack(fs, -1); /* correct stack */
+ return NO_JUMP;
+ }
+ break;
+ }
+ default: break;
+ }
+ break;
+ }
+ case OP_JMPF:
+ case OP_JMPONF: {
+ switch (GET_OPCODE(i)) {
+ case OP_NOT: {
+ i = CREATE_S(OP_JMPT, NO_JUMP);
+ optm = 1;
+ break;
+ }
+ case OP_PUSHINT: { /* `while 1 do ...' */
+ fs->pc--; /* erase previous instruction */
+ luaK_deltastack(fs, -1); /* correct stack */
+ return NO_JUMP;
+ }
+ case OP_PUSHNIL: { /* `repeat ... until nil' */
+ if (GETARG_U(i) == 1) {
+ i = CREATE_S(OP_JMP, NO_JUMP);
+ optm = 1;
+ }
+ break;
+ }
+ default: break;
+ }
+ break;
+ }
+ case OP_GETDOTTED:
+ case OP_GETINDEXED:
+ case OP_TAILCALL:
+ case OP_ADDI: {
+ LUA_INTERNALERROR("instruction used only for optimizations");
+ break;
+ }
+ default: {
+ LUA_ASSERT(delta != VD, "invalid delta");
+ break;
+ }
+ }
+ luaK_deltastack(fs, delta);
+ if (optm) { /* optimize: put instruction in place of last one */
+ fs->f->code[fs->pc-1] = i; /* change previous instruction */
+ return fs->pc-1; /* do not generate new instruction */
+ }
+ /* else build new instruction */
+ switch ((enum Mode)luaK_opproperties[o].mode) {
+ case iO: i = CREATE_0(o); break;
+ case iU: i = CREATE_U(o, arg1); break;
+ case iS: i = CREATE_S(o, arg1); break;
+ case iAB: i = CREATE_AB(o, arg1, arg2); break;
+ }
+ codelineinfo(fs);
+ /* put new instruction in code array */
+ luaM_growvector(fs->L, fs->f->code, fs->pc, 1, Instruction,
+ "code size overflow", MAX_INT);
+ fs->f->code[fs->pc] = i;
+ return fs->pc++;
+}
+
+
+const struct OpProperties luaK_opproperties[NUM_OPCODES] = {
+ {iO, 0, 0}, /* OP_END */
+ {iU, 0, 0}, /* OP_RETURN */
+ {iAB, 0, 0}, /* OP_CALL */
+ {iAB, 0, 0}, /* OP_TAILCALL */
+ {iU, VD, 0}, /* OP_PUSHNIL */
+ {iU, VD, 0}, /* OP_POP */
+ {iS, 1, 0}, /* OP_PUSHINT */
+ {iU, 1, 0}, /* OP_PUSHSTRING */
+ {iU, 1, 0}, /* OP_PUSHNUM */
+ {iU, 1, 0}, /* OP_PUSHNEGNUM */
+ {iU, 1, 0}, /* OP_PUSHUPVALUE */
+ {iU, 1, 0}, /* OP_GETLOCAL */
+ {iU, 1, 0}, /* OP_GETGLOBAL */
+ {iO, 1, 2}, /* OP_GETTABLE */
+ {iU, 1, 1}, /* OP_GETDOTTED */
+ {iU, 1, 1}, /* OP_GETINDEXED */
+ {iU, 2, 1}, /* OP_PUSHSELF */
+ {iU, 1, 0}, /* OP_CREATETABLE */
+ {iU, 0, 1}, /* OP_SETLOCAL */
+ {iU, 0, 1}, /* OP_SETGLOBAL */
+ {iAB, VD, 0}, /* OP_SETTABLE */
+ {iAB, VD, 0}, /* OP_SETLIST */
+ {iU, VD, 0}, /* OP_SETMAP */
+ {iO, 1, 2}, /* OP_ADD */
+ {iS, 1, 1}, /* OP_ADDI */
+ {iO, 1, 2}, /* OP_SUB */
+ {iO, 1, 2}, /* OP_MULT */
+ {iO, 1, 2}, /* OP_DIV */
+ {iO, 1, 2}, /* OP_POW */
+ {iU, VD, 0}, /* OP_CONCAT */
+ {iO, 1, 1}, /* OP_MINUS */
+ {iO, 1, 1}, /* OP_NOT */
+ {iS, 0, 2}, /* OP_JMPNE */
+ {iS, 0, 2}, /* OP_JMPEQ */
+ {iS, 0, 2}, /* OP_JMPLT */
+ {iS, 0, 2}, /* OP_JMPLE */
+ {iS, 0, 2}, /* OP_JMPGT */
+ {iS, 0, 2}, /* OP_JMPGE */
+ {iS, 0, 1}, /* OP_JMPT */
+ {iS, 0, 1}, /* OP_JMPF */
+ {iS, 0, 1}, /* OP_JMPONT */
+ {iS, 0, 1}, /* OP_JMPONF */
+ {iS, 0, 0}, /* OP_JMP */
+ {iO, 0, 0}, /* OP_PUSHNILJMP */
+ {iS, 0, 0}, /* OP_FORPREP */
+ {iS, 0, 3}, /* OP_FORLOOP */
+ {iS, 2, 0}, /* OP_LFORPREP */
+ {iS, 0, 3}, /* OP_LFORLOOP */
+ {iAB, VD, 0} /* OP_CLOSURE */
+};
+
diff --git a/lua/src/lcode.h b/lua/src/lcode.h
new file mode 100644
index 0000000..2691779
--- /dev/null
+++ b/lua/src/lcode.h
@@ -0,0 +1,70 @@
+/*
+** $Id: lcode.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Code generator for Lua
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lcode_h
+#define lcode_h
+
+#include "llex.h"
+#include "lobject.h"
+#include "lopcodes.h"
+#include "lparser.h"
+
+
+/*
+** Marks the end of a patch list. It is an invalid value both as an absolute
+** address, and as a list link (would link an element to itself).
+*/
+#define NO_JUMP (-1)
+
+
+/*
+** grep "ORDER OPR" if you change these enums
+*/
+typedef enum BinOpr {
+ OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW,
+ OPR_CONCAT,
+ OPR_NE, OPR_EQ, OPR_LT, OPR_LE, OPR_GT, OPR_GE,
+ OPR_AND, OPR_OR,
+ OPR_NOBINOPR
+} BinOpr;
+
+typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_NOUNOPR } UnOpr;
+
+
+enum Mode {iO, iU, iS, iAB}; /* instruction format */
+
+#define VD 100 /* flag for variable delta */
+
+extern const struct OpProperties {
+ char mode;
+ unsigned char push;
+ unsigned char pop;
+} luaK_opproperties[];
+
+
+void luaK_error (LexState *ls, const char *msg);
+int luaK_code0 (FuncState *fs, OpCode o);
+int luaK_code1 (FuncState *fs, OpCode o, int arg1);
+int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2);
+int luaK_jump (FuncState *fs);
+void luaK_patchlist (FuncState *fs, int list, int target);
+void luaK_concat (FuncState *fs, int *l1, int l2);
+void luaK_goiftrue (FuncState *fs, expdesc *v, int keepvalue);
+int luaK_getlabel (FuncState *fs);
+void luaK_deltastack (FuncState *fs, int delta);
+void luaK_kstr (LexState *ls, int c);
+void luaK_number (FuncState *fs, Number f);
+void luaK_adjuststack (FuncState *fs, int n);
+int luaK_lastisopen (FuncState *fs);
+void luaK_setcallreturns (FuncState *fs, int nresults);
+void luaK_tostack (LexState *ls, expdesc *v, int onlyone);
+void luaK_storevar (LexState *ls, const expdesc *var);
+void luaK_prefix (LexState *ls, UnOpr op, expdesc *v);
+void luaK_infix (LexState *ls, BinOpr op, expdesc *v);
+void luaK_posfix (LexState *ls, BinOpr op, expdesc *v1, expdesc *v2);
+
+
+#endif
diff --git a/lua/src/ldebug.c b/lua/src/ldebug.c
new file mode 100644
index 0000000..0b9589a
--- /dev/null
+++ b/lua/src/ldebug.c
@@ -0,0 +1,466 @@
+/*
+** $Id: ldebug.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Debug Interface
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdlib.h>
+
+#include "lua.h"
+
+#include "lapi.h"
+#include "lcode.h"
+#include "ldebug.h"
+#include "ldo.h"
+#include "lfunc.h"
+#include "lobject.h"
+#include "lopcodes.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+#include "ltm.h"
+#include "luadebug.h"
+
+
+
+static const char *getfuncname (lua_State *L, StkId f, const char **name);
+
+
+static void setnormalized (TObject *d, const TObject *s) {
+ if (ttype(s) == LUA_TMARK) {
+ clvalue(d) = infovalue(s)->func;
+ ttype(d) = LUA_TFUNCTION;
+ }
+ else *d = *s;
+}
+
+
+static int isLmark (StkId o) {
+ return (o && ttype(o) == LUA_TMARK && !infovalue(o)->func->isC);
+}
+
+
+LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func) {
+ lua_Hook oldhook = L->callhook;
+ L->callhook = func;
+ return oldhook;
+}
+
+
+LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func) {
+ lua_Hook oldhook = L->linehook;
+ L->linehook = func;
+ return oldhook;
+}
+
+
+static StkId aux_stackedfunction (lua_State *L, int level, StkId top) {
+ int i;
+ for (i = (top-1) - L->stack; i>=0; i--) {
+ if (is_T_MARK(L->stack[i].ttype)) {
+ if (level == 0)
+ return L->stack+i;
+ level--;
+ }
+ }
+ return NULL;
+}
+
+
+LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
+ StkId f = aux_stackedfunction(L, level, L->top);
+ if (f == NULL) return 0; /* there is no such level */
+ else {
+ ar->_func = f;
+ return 1;
+ }
+}
+
+
+static int nups (StkId f) {
+ switch (ttype(f)) {
+ case LUA_TFUNCTION:
+ return clvalue(f)->nupvalues;
+ case LUA_TMARK:
+ return infovalue(f)->func->nupvalues;
+ default:
+ return 0;
+ }
+}
+
+
+int luaG_getline (int *lineinfo, int pc, int refline, int *prefi) {
+ int refi;
+ if (lineinfo == NULL || pc == -1)
+ return -1; /* no line info or function is not active */
+ refi = prefi ? *prefi : 0;
+ if (lineinfo[refi] < 0)
+ refline += -lineinfo[refi++];
+ LUA_ASSERT(lineinfo[refi] >= 0, "invalid line info");
+ while (lineinfo[refi] > pc) {
+ refline--;
+ refi--;
+ if (lineinfo[refi] < 0)
+ refline -= -lineinfo[refi--];
+ LUA_ASSERT(lineinfo[refi] >= 0, "invalid line info");
+ }
+ for (;;) {
+ int nextline = refline + 1;
+ int nextref = refi + 1;
+ if (lineinfo[nextref] < 0)
+ nextline += -lineinfo[nextref++];
+ LUA_ASSERT(lineinfo[nextref] >= 0, "invalid line info");
+ if (lineinfo[nextref] > pc)
+ break;
+ refline = nextline;
+ refi = nextref;
+ }
+ if (prefi) *prefi = refi;
+ return refline;
+}
+
+
+static int currentpc (StkId f) {
+ CallInfo *ci = infovalue(f);
+ LUA_ASSERT(isLmark(f), "function has no pc");
+ if (ci->pc)
+ return (*ci->pc - ci->func->f.l->code) - 1;
+ else
+ return -1; /* function is not active */
+}
+
+
+static int currentline (StkId f) {
+ if (!isLmark(f))
+ return -1; /* only active lua functions have current-line information */
+ else {
+ CallInfo *ci = infovalue(f);
+ int *lineinfo = ci->func->f.l->lineinfo;
+ return luaG_getline(lineinfo, currentpc(f), 1, NULL);
+ }
+}
+
+
+
+static Proto *getluaproto (StkId f) {
+ return (isLmark(f) ? infovalue(f)->func->f.l : NULL);
+}
+
+
+LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
+ const char *name;
+ StkId f = ar->_func;
+ Proto *fp = getluaproto(f);
+ if (!fp) return NULL; /* `f' is not a Lua function? */
+ name = luaF_getlocalname(fp, n, currentpc(f));
+ if (!name) return NULL;
+ luaA_pushobject(L, (f+1)+(n-1)); /* push value */
+ return name;
+}
+
+
+LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
+ const char *name;
+ StkId f = ar->_func;
+ Proto *fp = getluaproto(f);
+ L->top--; /* pop new value */
+ if (!fp) return NULL; /* `f' is not a Lua function? */
+ name = luaF_getlocalname(fp, n, currentpc(f));
+ if (!name || name[0] == '(') return NULL; /* `(' starts private locals */
+ *((f+1)+(n-1)) = *L->top;
+ return name;
+}
+
+
+static void infoLproto (lua_Debug *ar, Proto *f) {
+ ar->source = f->source->str;
+ ar->linedefined = f->lineDefined;
+ ar->what = "Lua";
+}
+
+
+static void funcinfo (lua_State *L, lua_Debug *ar, StkId func) {
+ Closure *cl = NULL;
+ switch (ttype(func)) {
+ case LUA_TFUNCTION:
+ cl = clvalue(func);
+ break;
+ case LUA_TMARK:
+ cl = infovalue(func)->func;
+ break;
+ default:
+ lua_error(L, "value for `lua_getinfo' is not a function");
+ }
+ if (cl->isC) {
+ ar->source = "=C";
+ ar->linedefined = -1;
+ ar->what = "C";
+ }
+ else
+ infoLproto(ar, cl->f.l);
+ luaO_chunkid(ar->short_src, ar->source, sizeof(ar->short_src));
+ if (ar->linedefined == 0)
+ ar->what = "main";
+}
+
+
+static const char *travtagmethods (lua_State *L, const TObject *o) {
+ if (ttype(o) == LUA_TFUNCTION) {
+ int e;
+ for (e=0; e<TM_N; e++) {
+ int t;
+ for (t=0; t<=L->last_tag; t++)
+ if (clvalue(o) == luaT_gettm(L, t, e))
+ return luaT_eventname[e];
+ }
+ }
+ return NULL;
+}
+
+
+static const char *travglobals (lua_State *L, const TObject *o) {
+ Hash *g = L->gt;
+ int i;
+ for (i=0; i<g->size; i++) {
+ if (luaO_equalObj(o, val(node(g, i))) &&
+ ttype(key(node(g, i))) == LUA_TSTRING)
+ return tsvalue(key(node(g, i)))->str;
+ }
+ return NULL;
+}
+
+
+static void getname (lua_State *L, StkId f, lua_Debug *ar) {
+ TObject o;
+ setnormalized(&o, f);
+ /* try to find a name for given function */
+ if ((ar->name = travglobals(L, &o)) != NULL)
+ ar->namewhat = "global";
+ /* not found: try tag methods */
+ else if ((ar->name = travtagmethods(L, &o)) != NULL)
+ ar->namewhat = "tag-method";
+ else ar->namewhat = ""; /* not found at all */
+}
+
+
+LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
+ StkId func;
+ int isactive = (*what != '>');
+ if (isactive)
+ func = ar->_func;
+ else {
+ what++; /* skip the '>' */
+ func = L->top - 1;
+ }
+ for (; *what; what++) {
+ switch (*what) {
+ case 'S': {
+ funcinfo(L, ar, func);
+ break;
+ }
+ case 'l': {
+ ar->currentline = currentline(func);
+ break;
+ }
+ case 'u': {
+ ar->nups = nups(func);
+ break;
+ }
+ case 'n': {
+ ar->namewhat = (isactive) ? getfuncname(L, func, &ar->name) : NULL;
+ if (ar->namewhat == NULL)
+ getname(L, func, ar);
+ break;
+ }
+ case 'f': {
+ setnormalized(L->top, func);
+ incr_top; /* push function */
+ break;
+ }
+ default: return 0; /* invalid option */
+ }
+ }
+ if (!isactive) L->top--; /* pop function */
+ return 1;
+}
+
+
+/*
+** {======================================================
+** Symbolic Execution
+** =======================================================
+*/
+
+
+static int pushpc (int *stack, int pc, int top, int n) {
+ while (n--)
+ stack[top++] = pc-1;
+ return top;
+}
+
+
+static Instruction luaG_symbexec (const Proto *pt, int lastpc, int stackpos) {
+ int stack[MAXSTACK]; /* stores last instruction that changed a stack entry */
+ const Instruction *code = pt->code;
+ int top = pt->numparams;
+ int pc = 0;
+ if (pt->is_vararg) /* varargs? */
+ top++; /* `arg' */
+ while (pc < lastpc) {
+ const Instruction i = code[pc++];
+ LUA_ASSERT(0 <= top && top <= pt->maxstacksize, "wrong stack");
+ switch (GET_OPCODE(i)) {
+ case OP_RETURN: {
+ LUA_ASSERT(top >= GETARG_U(i), "wrong stack");
+ top = GETARG_U(i);
+ break;
+ }
+ case OP_TAILCALL: {
+ LUA_ASSERT(top >= GETARG_A(i), "wrong stack");
+ top = GETARG_B(i);
+ break;
+ }
+ case OP_CALL: {
+ int nresults = GETARG_B(i);
+ if (nresults == MULT_RET) nresults = 1;
+ LUA_ASSERT(top >= GETARG_A(i), "wrong stack");
+ top = pushpc(stack, pc, GETARG_A(i), nresults);
+ break;
+ }
+ case OP_PUSHNIL: {
+ top = pushpc(stack, pc, top, GETARG_U(i));
+ break;
+ }
+ case OP_POP: {
+ top -= GETARG_U(i);
+ break;
+ }
+ case OP_SETTABLE:
+ case OP_SETLIST: {
+ top -= GETARG_B(i);
+ break;
+ }
+ case OP_SETMAP: {
+ top -= 2*GETARG_U(i);
+ break;
+ }
+ case OP_CONCAT: {
+ top -= GETARG_U(i);
+ stack[top++] = pc-1;
+ break;
+ }
+ case OP_CLOSURE: {
+ top -= GETARG_B(i);
+ stack[top++] = pc-1;
+ break;
+ }
+ case OP_JMPONT:
+ case OP_JMPONF: {
+ int newpc = pc + GETARG_S(i);
+ /* jump is forward and do not skip `lastpc'? */
+ if (pc < newpc && newpc <= lastpc) {
+ stack[top-1] = pc-1; /* value comes from `and'/`or' */
+ pc = newpc; /* do the jump */
+ }
+ else
+ top--; /* do not jump; pop value */
+ break;
+ }
+ default: {
+ OpCode op = GET_OPCODE(i);
+ LUA_ASSERT(luaK_opproperties[op].push != VD,
+ "invalid opcode for default");
+ top -= luaK_opproperties[op].pop;
+ LUA_ASSERT(top >= 0, "wrong stack");
+ top = pushpc(stack, pc, top, luaK_opproperties[op].push);
+ }
+ }
+ }
+ return code[stack[stackpos]];
+}
+
+
+static const char *getobjname (lua_State *L, StkId obj, const char **name) {
+ StkId func = aux_stackedfunction(L, 0, obj);
+ if (!isLmark(func))
+ return NULL; /* not an active Lua function */
+ else {
+ Proto *p = infovalue(func)->func->f.l;
+ int pc = currentpc(func);
+ int stackpos = obj - (func+1); /* func+1 == function base */
+ Instruction i = luaG_symbexec(p, pc, stackpos);
+ LUA_ASSERT(pc != -1, "function must be active");
+ switch (GET_OPCODE(i)) {
+ case OP_GETGLOBAL: {
+ *name = p->kstr[GETARG_U(i)]->str;
+ return "global";
+ }
+ case OP_GETLOCAL: {
+ *name = luaF_getlocalname(p, GETARG_U(i)+1, pc);
+ LUA_ASSERT(*name, "local must exist");
+ return "local";
+ }
+ case OP_PUSHSELF:
+ case OP_GETDOTTED: {
+ *name = p->kstr[GETARG_U(i)]->str;
+ return "field";
+ }
+ default:
+ return NULL; /* no useful name found */
+ }
+ }
+}
+
+
+static const char *getfuncname (lua_State *L, StkId f, const char **name) {
+ StkId func = aux_stackedfunction(L, 0, f); /* calling function */
+ if (!isLmark(func))
+ return NULL; /* not an active Lua function */
+ else {
+ Proto *p = infovalue(func)->func->f.l;
+ int pc = currentpc(func);
+ Instruction i;
+ if (pc == -1) return NULL; /* function is not activated */
+ i = p->code[pc];
+ switch (GET_OPCODE(i)) {
+ case OP_CALL: case OP_TAILCALL:
+ return getobjname(L, (func+1)+GETARG_A(i), name);
+ default:
+ return NULL; /* no useful name found */
+ }
+ }
+}
+
+
+/* }====================================================== */
+
+
+void luaG_typeerror (lua_State *L, StkId o, const char *op) {
+ const char *name;
+ const char *kind = getobjname(L, o, &name);
+ const char *t = luaO_typename(o);
+ if (kind)
+ luaO_verror(L, "attempt to %.30s %.20s `%.40s' (a %.10s value)",
+ op, kind, name, t);
+ else
+ luaO_verror(L, "attempt to %.30s a %.10s value", op, t);
+}
+
+
+void luaG_binerror (lua_State *L, StkId p1, int t, const char *op) {
+ if (ttype(p1) == t) p1++;
+ LUA_ASSERT(ttype(p1) != t, "must be an error");
+ luaG_typeerror(L, p1, op);
+}
+
+
+void luaG_ordererror (lua_State *L, StkId top) {
+ const char *t1 = luaO_typename(top-2);
+ const char *t2 = luaO_typename(top-1);
+ if (t1[2] == t2[2])
+ luaO_verror(L, "attempt to compare two %.10s values", t1);
+ else
+ luaO_verror(L, "attempt to compare %.10s with %.10s", t1, t2);
+}
+
diff --git a/lua/src/ldebug.h b/lua/src/ldebug.h
new file mode 100644
index 0000000..7216a6d
--- /dev/null
+++ b/lua/src/ldebug.h
@@ -0,0 +1,21 @@
+/*
+** $Id: ldebug.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Auxiliary functions from Debug Interface module
+** See Copyright Notice in lua.h
+*/
+
+#ifndef ldebug_h
+#define ldebug_h
+
+
+#include "lstate.h"
+#include "luadebug.h"
+
+
+void luaG_typeerror (lua_State *L, StkId o, const char *op);
+void luaG_binerror (lua_State *L, StkId p1, int t, const char *op);
+int luaG_getline (int *lineinfo, int pc, int refline, int *refi);
+void luaG_ordererror (lua_State *L, StkId top);
+
+
+#endif
diff --git a/lua/src/ldo.c b/lua/src/ldo.c
new file mode 100644
index 0000000..5156fe6
--- /dev/null
+++ b/lua/src/ldo.c
@@ -0,0 +1,388 @@
+/*
+** $Id: ldo.c,v 1.2 2002/07/12 07:49:04 jcatki Exp $
+** Stack and Call structure of Lua
+** See Copyright Notice in lua.h
+*/
+
+
+#include <setjmp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "ldebug.h"
+#include "ldo.h"
+#include "lgc.h"
+#include "lmem.h"
+#include "lobject.h"
+#include "lparser.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+#include "ltm.h"
+#include "lundump.h"
+#include "lvm.h"
+#include "lzio.h"
+
+
+/* space to handle stack overflow errors */
+#define EXTRA_STACK (2*LUA_MINSTACK)
+
+
+void luaD_init (lua_State *L, int stacksize) {
+ L->stack = luaM_newvector(L, stacksize+EXTRA_STACK, TObject);
+ L->nblocks += stacksize*sizeof(TObject);
+ L->stack_last = L->stack+(stacksize-1);
+ L->stacksize = stacksize;
+ L->Cbase = L->top = L->stack;
+}
+
+
+void luaD_checkstack (lua_State *L, int n) {
+ if (L->stack_last - L->top <= n) { /* stack overflow? */
+ if (L->stack_last-L->stack > (L->stacksize-1)) {
+ /* overflow while handling overflow */
+ luaD_breakrun(L, LUA_ERRERR); /* break run without error message */
+ }
+ else {
+ L->stack_last += EXTRA_STACK; /* to be used by error message */
+ lua_error(L, "stack overflow");
+ }
+ }
+}
+
+
+static void restore_stack_limit (lua_State *L) {
+ if (L->top - L->stack < L->stacksize - 1)
+ L->stack_last = L->stack + (L->stacksize-1);
+}
+
+
+/*
+** Adjust stack. Set top to base+extra, pushing NILs if needed.
+** (we cannot add base+extra unless we are sure it fits in the stack;
+** otherwise the result of such operation on pointers is undefined)
+*/
+void luaD_adjusttop (lua_State *L, StkId base, int extra) {
+ int diff = extra-(L->top-base);
+ if (diff <= 0)
+ L->top = base+extra;
+ else {
+ luaD_checkstack(L, diff);
+ while (diff--)
+ ttype(L->top++) = LUA_TNIL;
+ }
+}
+
+
+/*
+** Open a hole inside the stack at `pos'
+*/
+static void luaD_openstack (lua_State *L, StkId pos) {
+ int i = L->top-pos;
+ while (i--) pos[i+1] = pos[i];
+ incr_top;
+}
+
+
+static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) {
+ StkId old_Cbase = L->Cbase;
+ StkId old_top = L->Cbase = L->top;
+ luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
+ L->allowhooks = 0; /* cannot call hooks inside a hook */
+ (*hook)(L, ar);
+ LUA_ASSERT(L->allowhooks == 0, "invalid allow");
+ L->allowhooks = 1;
+ L->top = old_top;
+ L->Cbase = old_Cbase;
+}
+
+
+void luaD_lineHook (lua_State *L, StkId func, int line, lua_Hook linehook) {
+ if (L->allowhooks) {
+ lua_Debug ar;
+ ar._func = func;
+ ar.event = "line";
+ ar.currentline = line;
+ dohook(L, &ar, linehook);
+ }
+}
+
+
+static void luaD_callHook (lua_State *L, StkId func, lua_Hook callhook,
+ const char *event) {
+ if (L->allowhooks) {
+ lua_Debug ar;
+ ar._func = func;
+ ar.event = event;
+ infovalue(func)->pc = NULL; /* function is not active */
+ dohook(L, &ar, callhook);
+ }
+}
+
+
+static StkId callCclosure (lua_State *L, const struct Closure *cl, StkId base) {
+ int nup = cl->nupvalues; /* number of upvalues */
+ StkId old_Cbase = L->Cbase;
+ int n;
+ L->Cbase = base; /* new base for C function */
+ luaD_checkstack(L, nup+LUA_MINSTACK); /* ensure minimum stack size */
+ for (n=0; n<nup; n++) /* copy upvalues as extra arguments */
+ *(L->top++) = cl->upvalue[n];
+ n = (*cl->f.c)(L); /* do the actual call */
+ L->Cbase = old_Cbase; /* restore old C base */
+ return L->top - n; /* return index of first result */
+}
+
+
+void luaD_callTM (lua_State *L, Closure *f, int nParams, int nResults) {
+ StkId base = L->top - nParams;
+ luaD_openstack(L, base);
+ clvalue(base) = f;
+ ttype(base) = LUA_TFUNCTION;
+ luaD_call(L, base, nResults);
+}
+
+
+/*
+** Call a function (C or Lua). The function to be called is at *func.
+** The arguments are on the stack, right after the function.
+** When returns, the results are on the stack, starting at the original
+** function position.
+** The number of results is nResults, unless nResults=LUA_MULTRET.
+*/
+void luaD_call (lua_State *L, StkId func, int nResults) {
+ lua_Hook callhook;
+ StkId firstResult;
+ CallInfo ci;
+ Closure *cl;
+ if (ttype(func) != LUA_TFUNCTION) {
+ /* `func' is not a function; check the `function' tag method */
+ Closure *tm = luaT_gettmbyObj(L, func, TM_FUNCTION);
+ if (tm == NULL)
+ luaG_typeerror(L, func, "call");
+ luaD_openstack(L, func);
+ clvalue(func) = tm; /* tag method is the new function to be called */
+ ttype(func) = LUA_TFUNCTION;
+ }
+ cl = clvalue(func);
+ ci.func = cl;
+ infovalue(func) = &ci;
+ ttype(func) = LUA_TMARK;
+ callhook = L->callhook;
+ if (callhook)
+ luaD_callHook(L, func, callhook, "call");
+ firstResult = (cl->isC ? callCclosure(L, cl, func+1) :
+ luaV_execute(L, cl, func+1));
+ if (callhook) /* same hook that was active at entry */
+ luaD_callHook(L, func, callhook, "return");
+ LUA_ASSERT(ttype(func) == LUA_TMARK, "invalid tag");
+ /* move results to `func' (to erase parameters and function) */
+ if (nResults == LUA_MULTRET) {
+ while (firstResult < L->top) /* copy all results */
+ *func++ = *firstResult++;
+ L->top = func;
+ }
+ else { /* copy at most `nResults' */
+ for (; nResults > 0 && firstResult < L->top; nResults--)
+ *func++ = *firstResult++;
+ L->top = func;
+ for (; nResults > 0; nResults--) { /* if there are not enough results */
+ ttype(L->top) = LUA_TNIL; /* adjust the stack */
+ incr_top; /* must check stack space */
+ }
+ }
+ luaC_checkGC(L);
+}
+
+
+/*
+** Execute a protected call.
+*/
+struct CallS { /* data to `f_call' */
+ StkId func;
+ int nresults;
+};
+
+static void f_call (lua_State *L, void *ud) {
+ struct CallS *c = (struct CallS *)ud;
+ luaD_call(L, c->func, c->nresults);
+}
+
+
+LUA_API int lua_call (lua_State *L, int nargs, int nresults) {
+ StkId func = L->top - (nargs+1); /* function to be called */
+ struct CallS c;
+ int status;
+ c.func = func; c.nresults = nresults;
+ status = luaD_runprotected(L, f_call, &c);
+ if (status != 0) /* an error occurred? */
+ L->top = func; /* remove parameters from the stack */
+ return status;
+}
+
+
+/*
+** Execute a protected parser.
+*/
+struct ParserS { /* data to `f_parser' */
+ ZIO *z;
+ int bin;
+};
+
+static void f_parser (lua_State *L, void *ud) {
+ struct ParserS *p = (struct ParserS *)ud;
+ Proto *tf = p->bin ? luaU_undump(L, p->z) : luaY_parser(L, p->z);
+ luaV_Lclosure(L, tf, 0);
+}
+
+
+static int protectedparser (lua_State *L, ZIO *z, int bin) {
+ struct ParserS p;
+ unsigned long old_blocks;
+ int status;
+ p.z = z; p.bin = bin;
+ /* before parsing, give a (good) chance to GC */
+ if (L->nblocks/8 >= L->GCthreshold/10)
+ luaC_collectgarbage(L);
+ old_blocks = L->nblocks;
+ status = luaD_runprotected(L, f_parser, &p);
+ if (status == 0) {
+ /* add new memory to threshold (as it probably will stay) */
+ L->GCthreshold += (L->nblocks - old_blocks);
+ }
+ else if (status == LUA_ERRRUN) /* an error occurred: correct error code */
+ status = LUA_ERRSYNTAX;
+ return status;
+}
+
+
+static int parse_file (lua_State *L, const char *filename) {
+ ZIO z;
+ int status;
+ int bin; /* flag for file mode */
+ int c; /* look ahead char */
+ FILE *f = (filename == NULL) ? stdin : fopen(filename, "r");
+ if (f == NULL) return LUA_ERRFILE; /* unable to open file */
+ c = fgetc(f);
+ ungetc(c, f);
+ bin = (c == ID_CHUNK);
+ if (bin && f != stdin) {
+ f = freopen(filename, "rb", f); /* set binary mode */
+ if (f == NULL) return LUA_ERRFILE; /* unable to reopen file */
+ }
+ lua_pushstring(L, "@");
+ lua_pushstring(L, (filename == NULL) ? "(stdin)" : filename);
+ lua_concat(L, 2);
+ c = lua_gettop(L);
+ filename = lua_tostring(L, c); /* filename = '@'..filename */
+ luaZ_Fopen(&z, f, filename);
+ status = protectedparser(L, &z, bin);
+ lua_remove(L, c); /* remove `filename' from the stack */
+ if (f != stdin)
+ fclose(f);
+ return status;
+}
+
+
+LUA_API int lua_dofile (lua_State *L, const char *filename) {
+ int status = parse_file(L, filename);
+ if (status == 0) /* parse OK? */
+ status = lua_call(L, 0, LUA_MULTRET); /* call main */
+ return status;
+}
+
+
+static int parse_buffer (lua_State *L, const char *buff, size_t size,
+ const char *name) {
+ ZIO z;
+ if (!name) name = "?";
+ luaZ_mopen(&z, buff, size, name);
+ return protectedparser(L, &z, buff[0]==ID_CHUNK);
+}
+
+
+LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, const char *name) {
+ int status = parse_buffer(L, buff, size, name);
+ if (status == 0) /* parse OK? */
+ status = lua_call(L, 0, LUA_MULTRET); /* call main */
+ return status;
+}
+
+
+LUA_API int lua_dostring (lua_State *L, const char *str) {
+ return lua_dobuffer(L, str, strlen(str), str);
+}
+
+
+/*
+** {======================================================
+** Error-recover functions (based on long jumps)
+** =======================================================
+*/
+
+/* chain list of long jump buffers */
+struct lua_longjmp {
+ jmp_buf b;
+ struct lua_longjmp *previous;
+ volatile int status; /* error code */
+};
+
+
+static void message (lua_State *L, const char *s) {
+ const TObject *em = luaH_getglobal(L, LUA_ERRORMESSAGE);
+ if (ttype(em) == LUA_TFUNCTION) {
+ *L->top = *em;
+ incr_top;
+ lua_pushstring(L, s);
+ luaD_call(L, L->top-2, 0);
+ }
+}
+
+
+/*
+** Reports an error, and jumps up to the available recovery label
+*/
+LUA_API void lua_error (lua_State *L, const char *s) {
+ if (s) message(L, s);
+ luaD_breakrun(L, LUA_ERRRUN);
+}
+
+
+void luaD_breakrun (lua_State *L, int errcode) {
+ if (L->errorJmp) {
+ L->errorJmp->status = errcode;
+ longjmp(L->errorJmp->b, 1);
+ }
+ else {
+ if (errcode != LUA_ERRMEM)
+ message(L, "unable to recover; exiting\n");
+ exit(EXIT_FAILURE);
+ }
+}
+
+
+int luaD_runprotected (lua_State *L, void (*f)(lua_State *, void *), void *ud) {
+ StkId oldCbase = L->Cbase;
+ StkId oldtop = L->top;
+ struct lua_longjmp lj;
+ int allowhooks = L->allowhooks;
+ lj.status = 0;
+ lj.previous = L->errorJmp; /* chain new error handler */
+ L->errorJmp = &lj;
+ if (setjmp(lj.b) == 0)
+ (*f)(L, ud);
+ else { /* an error occurred: restore the state */
+ L->allowhooks = allowhooks;
+ L->Cbase = oldCbase;
+ L->top = oldtop;
+ restore_stack_limit(L);
+ }
+ L->errorJmp = lj.previous; /* restore old error handler */
+ return lj.status;
+}
+
+/* }====================================================== */
+
diff --git a/lua/src/ldo.h b/lua/src/ldo.h
new file mode 100644
index 0000000..0262f9c
--- /dev/null
+++ b/lua/src/ldo.h
@@ -0,0 +1,33 @@
+/*
+** $Id: ldo.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Stack and Call structure of Lua
+** See Copyright Notice in lua.h
+*/
+
+#ifndef ldo_h
+#define ldo_h
+
+
+#include "lobject.h"
+#include "lstate.h"
+
+
+/*
+** macro to increment stack top.
+** There must be always an empty slot at the L->stack.top
+*/
+#define incr_top {if (L->top == L->stack_last) luaD_checkstack(L, 1); L->top++;}
+
+
+void luaD_init (lua_State *L, int stacksize);
+void luaD_adjusttop (lua_State *L, StkId base, int extra);
+void luaD_lineHook (lua_State *L, StkId func, int line, lua_Hook linehook);
+void luaD_call (lua_State *L, StkId func, int nResults);
+void luaD_callTM (lua_State *L, Closure *f, int nParams, int nResults);
+void luaD_checkstack (lua_State *L, int n);
+
+void luaD_breakrun (lua_State *L, int errcode);
+int luaD_runprotected (lua_State *L, void (*f)(lua_State *, void *), void *ud);
+
+
+#endif
diff --git a/lua/src/lfunc.c b/lua/src/lfunc.c
new file mode 100644
index 0000000..a6827da
--- /dev/null
+++ b/lua/src/lfunc.c
@@ -0,0 +1,109 @@
+/*
+** $Id: lfunc.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Auxiliary functions to manipulate prototypes and closures
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdlib.h>
+
+#include "lua.h"
+
+#include "lfunc.h"
+#include "lmem.h"
+#include "lstate.h"
+
+
+#define sizeclosure(n) ((int)sizeof(Closure) + (int)sizeof(TObject)*((n)-1))
+
+
+Closure *luaF_newclosure (lua_State *L, int nelems) {
+ int size = sizeclosure(nelems);
+ Closure *c = (Closure *)luaM_malloc(L, size);
+ c->next = L->rootcl;
+ L->rootcl = c;
+ c->mark = c;
+ c->nupvalues = nelems;
+ L->nblocks += size;
+ return c;
+}
+
+
+Proto *luaF_newproto (lua_State *L) {
+ Proto *f = luaM_new(L, Proto);
+ f->knum = NULL;
+ f->nknum = 0;
+ f->kstr = NULL;
+ f->nkstr = 0;
+ f->kproto = NULL;
+ f->nkproto = 0;
+ f->code = NULL;
+ f->ncode = 0;
+ f->numparams = 0;
+ f->is_vararg = 0;
+ f->maxstacksize = 0;
+ f->marked = 0;
+ f->lineinfo = NULL;
+ f->nlineinfo = 0;
+ f->nlocvars = 0;
+ f->locvars = NULL;
+ f->lineDefined = 0;
+ f->source = NULL;
+ f->next = L->rootproto; /* chain in list of protos */
+ L->rootproto = f;
+ return f;
+}
+
+
+static size_t protosize (Proto *f) {
+ return sizeof(Proto)
+ + f->nknum*sizeof(Number)
+ + f->nkstr*sizeof(TString *)
+ + f->nkproto*sizeof(Proto *)
+ + f->ncode*sizeof(Instruction)
+ + f->nlocvars*sizeof(struct LocVar)
+ + f->nlineinfo*sizeof(int);
+}
+
+
+void luaF_protook (lua_State *L, Proto *f, int pc) {
+ f->ncode = pc; /* signal that proto was properly created */
+ L->nblocks += protosize(f);
+}
+
+
+void luaF_freeproto (lua_State *L, Proto *f) {
+ if (f->ncode > 0) /* function was properly created? */
+ L->nblocks -= protosize(f);
+ luaM_free(L, f->code);
+ luaM_free(L, f->locvars);
+ luaM_free(L, f->kstr);
+ luaM_free(L, f->knum);
+ luaM_free(L, f->kproto);
+ luaM_free(L, f->lineinfo);
+ luaM_free(L, f);
+}
+
+
+void luaF_freeclosure (lua_State *L, Closure *c) {
+ L->nblocks -= sizeclosure(c->nupvalues);
+ luaM_free(L, c);
+}
+
+
+/*
+** Look for n-th local variable at line `line' in function `func'.
+** Returns NULL if not found.
+*/
+const char *luaF_getlocalname (const Proto *f, int local_number, int pc) {
+ int i;
+ for (i = 0; i<f->nlocvars && f->locvars[i].startpc <= pc; i++) {
+ if (pc < f->locvars[i].endpc) { /* is variable active? */
+ local_number--;
+ if (local_number == 0)
+ return f->locvars[i].varname->str;
+ }
+ }
+ return NULL; /* not found */
+}
+
diff --git a/lua/src/lfunc.h b/lua/src/lfunc.h
new file mode 100644
index 0000000..748ec8b
--- /dev/null
+++ b/lua/src/lfunc.h
@@ -0,0 +1,24 @@
+/*
+** $Id: lfunc.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Auxiliary functions to manipulate prototypes and closures
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lfunc_h
+#define lfunc_h
+
+
+#include "lobject.h"
+
+
+
+Proto *luaF_newproto (lua_State *L);
+void luaF_protook (lua_State *L, Proto *f, int pc);
+Closure *luaF_newclosure (lua_State *L, int nelems);
+void luaF_freeproto (lua_State *L, Proto *f);
+void luaF_freeclosure (lua_State *L, Closure *c);
+
+const char *luaF_getlocalname (const Proto *func, int local_number, int pc);
+
+
+#endif
diff --git a/lua/src/lgc.c b/lua/src/lgc.c
new file mode 100644
index 0000000..2f78dad
--- /dev/null
+++ b/lua/src/lgc.c
@@ -0,0 +1,353 @@
+/*
+** $Id: lgc.c,v 1.2 2002/07/12 07:49:04 jcatki Exp $
+** Garbage Collector
+** See Copyright Notice in lua.h
+*/
+
+#include "lua.h"
+
+#include "ldo.h"
+#include "lfunc.h"
+#include "lgc.h"
+#include "lmem.h"
+#include "lobject.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+#include "ltm.h"
+
+
+typedef struct GCState {
+ Hash *tmark; /* list of marked tables to be visited */
+ Closure *cmark; /* list of marked closures to be visited */
+} GCState;
+
+
+
+static void markobject (GCState *st, TObject *o);
+
+
+/* mark a string; marks larger than 1 cannot be changed */
+#define strmark(s) {if ((s)->marked == 0) (s)->marked = 1;}
+
+
+
+static void protomark (Proto *f) {
+ if (!f->marked) {
+ int i;
+ f->marked = 1;
+ strmark(f->source);
+ for (i=0; i<f->nkstr; i++)
+ strmark(f->kstr[i]);
+ for (i=0; i<f->nkproto; i++)
+ protomark(f->kproto[i]);
+ for (i=0; i<f->nlocvars; i++) /* mark local-variable names */
+ strmark(f->locvars[i].varname);
+ }
+}
+
+
+static void markstack (lua_State *L, GCState *st) {
+ StkId o;
+ for (o=L->stack; o<L->top; o++)
+ markobject(st, o);
+}
+
+
+static void marklock (lua_State *L, GCState *st) {
+ int i;
+ for (i=0; i<L->refSize; i++) {
+ if (L->refArray[i].st == LOCK)
+ markobject(st, &L->refArray[i].o);
+ }
+}
+
+
+static void markclosure (GCState *st, Closure *cl) {
+ if (!ismarked(cl)) {
+ if (!cl->isC)
+ protomark(cl->f.l);
+ cl->mark = st->cmark; /* chain it for later traversal */
+ st->cmark = cl;
+ }
+}
+
+
+static void marktagmethods (lua_State *L, GCState *st) {
+ int e;
+ for (e=0; e<TM_N; e++) {
+ int t;
+ for (t=0; t<=L->last_tag; t++) {
+ Closure *cl = luaT_gettm(L, t, e);
+ if (cl) markclosure(st, cl);
+ }
+ }
+}
+
+
+static void markobject (GCState *st, TObject *o) {
+ switch (ttype(o)) {
+ case LUA_TUSERDATA: case LUA_TSTRING:
+ strmark(tsvalue(o));
+ break;
+ case LUA_TMARK:
+ markclosure(st, infovalue(o)->func);
+ break;
+ case LUA_TFUNCTION:
+ markclosure(st, clvalue(o));
+ break;
+ case LUA_TTABLE: {
+ if (!ismarked(hvalue(o))) {
+ hvalue(o)->mark = st->tmark; /* chain it in list of marked */
+ st->tmark = hvalue(o);
+ }
+ break;
+ }
+ default: break; /* numbers, etc */
+ }
+}
+
+
+static void markall (lua_State *L) {
+ GCState st;
+ st.cmark = NULL;
+ st.tmark = L->gt; /* put table of globals in mark list */
+ L->gt->mark = NULL;
+ marktagmethods(L, &st); /* mark tag methods */
+ markstack(L, &st); /* mark stack objects */
+ marklock(L, &st); /* mark locked objects */
+ for (;;) { /* mark tables and closures */
+ if (st.cmark) {
+ int i;
+ Closure *f = st.cmark; /* get first closure from list */
+ st.cmark = f->mark; /* remove it from list */
+ for (i=0; i<f->nupvalues; i++) /* mark its upvalues */
+ markobject(&st, &f->upvalue[i]);
+ }
+ else if (st.tmark) {
+ int i;
+ Hash *h = st.tmark; /* get first table from list */
+ st.tmark = h->mark; /* remove it from list */
+ for (i=0; i<h->size; i++) {
+ Node *n = node(h, i);
+ if (ttype(key(n)) != LUA_TNIL) {
+ if (ttype(val(n)) == LUA_TNIL)
+ luaH_remove(h, key(n)); /* dead element; try to remove it */
+ markobject(&st, &n->key);
+ markobject(&st, &n->val);
+ }
+ }
+ }
+ else break; /* nothing else to mark */
+ }
+}
+
+
+static int hasmark (const TObject *o) {
+ /* valid only for locked objects */
+ switch (o->ttype) {
+ case LUA_TSTRING: case LUA_TUSERDATA:
+ return tsvalue(o)->marked;
+ case LUA_TTABLE:
+ return ismarked(hvalue(o));
+ case LUA_TFUNCTION:
+ return ismarked(clvalue(o));
+ default: /* number */
+ return 1;
+ }
+}
+
+
+/* macro for internal debugging; check if a link of free refs is valid */
+#define VALIDLINK(L, st,n) (NONEXT <= (st) && (st) < (n))
+
+static void invalidaterefs (lua_State *L) {
+ int n = L->refSize;
+ int i;
+ for (i=0; i<n; i++) {
+ struct Ref *r = &L->refArray[i];
+ if (r->st == HOLD && !hasmark(&r->o))
+ r->st = COLLECTED;
+ LUA_ASSERT((r->st == LOCK && hasmark(&r->o)) ||
+ (r->st == HOLD && hasmark(&r->o)) ||
+ r->st == COLLECTED ||
+ r->st == NONEXT ||
+ (r->st < n && VALIDLINK(L, L->refArray[r->st].st, n)),
+ "inconsistent ref table");
+ }
+ LUA_ASSERT(VALIDLINK(L, L->refFree, n), "inconsistent ref table");
+}
+
+
+
+static void collectproto (lua_State *L) {
+ Proto **p = &L->rootproto;
+ Proto *next;
+ while ((next = *p) != NULL) {
+ if (next->marked) {
+ next->marked = 0;
+ p = &next->next;
+ }
+ else {
+ *p = next->next;
+ luaF_freeproto(L, next);
+ }
+ }
+}
+
+
+static void collectclosure (lua_State *L) {
+ Closure **p = &L->rootcl;
+ Closure *next;
+ while ((next = *p) != NULL) {
+ if (ismarked(next)) {
+ next->mark = next; /* unmark */
+ p = &next->next;
+ }
+ else {
+ *p = next->next;
+ luaF_freeclosure(L, next);
+ }
+ }
+}
+
+
+static void collecttable (lua_State *L) {
+ Hash **p = &L->roottable;
+ Hash *next;
+ while ((next = *p) != NULL) {
+ if (ismarked(next)) {
+ next->mark = next; /* unmark */
+ p = &next->next;
+ }
+ else {
+ *p = next->next;
+ luaH_free(L, next);
+ }
+ }
+}
+
+
+static void checktab (lua_State *L, stringtable *tb) {
+ if (tb->nuse < (lint32)(tb->size/4) && tb->size > 10)
+ luaS_resize(L, tb, tb->size/2); /* table is too big */
+}
+
+
+static void collectstrings (lua_State *L, int all) {
+ int i;
+ for (i=0; i<L->strt.size; i++) { /* for each list */
+ TString **p = &L->strt.hash[i];
+ TString *next;
+ while ((next = *p) != NULL) {
+ if (next->marked && !all) { /* preserve? */
+ if (next->marked < FIXMARK) /* does not change FIXMARKs */
+ next->marked = 0;
+ p = &next->nexthash;
+ }
+ else { /* collect */
+ *p = next->nexthash;
+ L->strt.nuse--;
+ L->nblocks -= sizestring(next->len);
+ luaM_free(L, next);
+ }
+ }
+ }
+ checktab(L, &L->strt);
+}
+
+
+static void collectudata (lua_State *L, int all) {
+ int i;
+ for (i=0; i<L->udt.size; i++) { /* for each list */
+ TString **p = &L->udt.hash[i];
+ TString *next;
+ while ((next = *p) != NULL) {
+ LUA_ASSERT(next->marked <= 1, "udata cannot be fixed");
+ if (next->marked && !all) { /* preserve? */
+ next->marked = 0;
+ p = &next->nexthash;
+ }
+ else { /* collect */
+ int tag = next->u.d.tag;
+ *p = next->nexthash;
+ next->nexthash = L->TMtable[tag].collected; /* chain udata */
+ L->TMtable[tag].collected = next;
+ L->nblocks -= sizestring(next->len);
+ L->udt.nuse--;
+ }
+ }
+ }
+ checktab(L, &L->udt);
+}
+
+
+#define MINBUFFER 256
+static void checkMbuffer (lua_State *L) {
+ if (L->Mbuffsize > MINBUFFER*2) { /* is buffer too big? */
+ size_t newsize = L->Mbuffsize/2; /* still larger than MINBUFFER */
+ L->nblocks += (newsize - L->Mbuffsize)*sizeof(char);
+ L->Mbuffsize = newsize;
+ luaM_reallocvector(L, L->Mbuffer, newsize, char);
+ }
+}
+
+
+static void callgcTM (lua_State *L, const TObject *o) {
+ Closure *tm = luaT_gettmbyObj(L, o, TM_GC);
+ if (tm != NULL) {
+ int oldah = L->allowhooks;
+ L->allowhooks = 0; /* stop debug hooks during GC tag methods */
+ luaD_checkstack(L, 2);
+ clvalue(L->top) = tm;
+ ttype(L->top) = LUA_TFUNCTION;
+ *(L->top+1) = *o;
+ L->top += 2;
+ luaD_call(L, L->top-2, 0);
+ L->allowhooks = oldah; /* restore hooks */
+ }
+}
+
+
+static void callgcTMudata (lua_State *L) {
+ int tag;
+ TObject o;
+ ttype(&o) = LUA_TUSERDATA;
+ L->GCthreshold = 2*L->nblocks; /* avoid GC during tag methods */
+ for (tag=L->last_tag; tag>=0; tag--) { /* for each tag (in reverse order) */
+ TString *udata;
+ while ((udata = L->TMtable[tag].collected) != NULL) {
+ L->TMtable[tag].collected = udata->nexthash; /* remove it from list */
+ tsvalue(&o) = udata;
+ callgcTM(L, &o);
+ luaM_free(L, udata);
+ }
+ }
+}
+
+
+void luaC_collect (lua_State *L, int all) {
+ collectudata(L, all);
+ callgcTMudata(L);
+ collectstrings(L, all);
+ collecttable(L);
+ collectproto(L);
+ collectclosure(L);
+}
+
+
+void luaC_collectgarbage (lua_State *L) {
+ markall(L);
+ invalidaterefs(L); /* check unlocked references */
+ luaC_collect(L, 0);
+ checkMbuffer(L);
+ L->GCthreshold = 2*L->nblocks; /* set new threshold */
+ callgcTM(L, &luaO_nilobject);
+}
+
+
+void luaC_checkGC (lua_State *L) {
+ if (L->nblocks >= L->GCthreshold)
+ luaC_collectgarbage(L);
+}
+
diff --git a/lua/src/lgc.h b/lua/src/lgc.h
new file mode 100644
index 0000000..f26effd
--- /dev/null
+++ b/lua/src/lgc.h
@@ -0,0 +1,19 @@
+/*
+** $Id: lgc.h,v 1.2 2002/07/12 07:49:04 jcatki Exp $
+** Garbage Collector
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lgc_h
+#define lgc_h
+
+
+#include "lobject.h"
+
+
+void luaC_collect (lua_State *L, int all);
+void luaC_collectgarbage (lua_State *L);
+void luaC_checkGC (lua_State *L);
+
+
+#endif
diff --git a/lua/src/lib/Makefile.am b/lua/src/lib/Makefile.am
new file mode 100644
index 0000000..2cb47af
--- /dev/null
+++ b/lua/src/lib/Makefile.am
@@ -0,0 +1,11 @@
+noinst_LIBRARIES=liblualib.a
+
+DEFS=
+CPPFLAGS=
+CFLAGS=-ansi -pedantic -Wall -I$(srcdir)/.. -I$(top_srcdir)/lua/include
+LDFLAGS=
+LIBS=-lm
+
+liblualib_a_SOURCES=lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c lstrlib.c
+
+EXTRA_DIST=README
diff --git a/lua/src/lib/Makefile.in b/lua/src/lib/Makefile.in
new file mode 100644
index 0000000..e2f256f
--- /dev/null
+++ b/lua/src/lib/Makefile.in
@@ -0,0 +1,299 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = liblualib.a
+
+DEFS =
+CPPFLAGS =
+CFLAGS = -ansi -pedantic -Wall -I$(srcdir)/.. -I$(top_srcdir)/lua/include
+LDFLAGS =
+LIBS = -lm
+
+liblualib_a_SOURCES = lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c lstrlib.c
+
+EXTRA_DIST = README
+subdir = lua/src/lib
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+liblualib_a_AR = $(AR) cru
+liblualib_a_LIBADD =
+am_liblualib_a_OBJECTS = lauxlib.$(OBJEXT) lbaselib.$(OBJEXT) \
+ ldblib.$(OBJEXT) liolib.$(OBJEXT) lmathlib.$(OBJEXT) \
+ lstrlib.$(OBJEXT)
+liblualib_a_OBJECTS = $(am_liblualib_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/lauxlib.Po $(DEPDIR)/lbaselib.Po \
+@AMDEP_TRUE@ $(DEPDIR)/ldblib.Po $(DEPDIR)/liolib.Po \
+@AMDEP_TRUE@ $(DEPDIR)/lmathlib.Po $(DEPDIR)/lstrlib.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(liblualib_a_SOURCES)
+DIST_COMMON = README Makefile.am Makefile.in
+SOURCES = $(liblualib_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign lua/src/lib/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+liblualib.a: $(liblualib_a_OBJECTS) $(liblualib_a_DEPENDENCIES)
+ -rm -f liblualib.a
+ $(liblualib_a_AR) liblualib.a $(liblualib_a_OBJECTS) $(liblualib_a_LIBADD)
+ $(RANLIB) liblualib.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lauxlib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lbaselib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ldblib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/liolib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lmathlib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lstrlib.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lua/src/lib/README b/lua/src/lib/README
new file mode 100644
index 0000000..c04a12e
--- /dev/null
+++ b/lua/src/lib/README
@@ -0,0 +1,6 @@
+This is the standard Lua library.
+It is implemented entirely on top of the official Lua API as declared in lua.h,
+using lauxlib.c, which contains several useful functions for writing libraries.
+We encourage developers to use lauxlib.c in their own libraries.
+The code of the standard library can be read as an example of how to export
+C functions to Lua.
diff --git a/lua/src/lib/lauxlib.c b/lua/src/lib/lauxlib.c
new file mode 100644
index 0000000..68365a4
--- /dev/null
+++ b/lua/src/lib/lauxlib.c
@@ -0,0 +1,216 @@
+/*
+** $Id: lauxlib.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+/* This file uses only the official API of Lua.
+** Any function declared here could be written as an application function.
+** With care, these functions can be used by other libraries.
+*/
+
+#include "lua.h"
+
+#include "lauxlib.h"
+#include "luadebug.h"
+
+
+
+LUALIB_API int luaL_findstring (const char *name, const char *const list[]) {
+ int i;
+ for (i=0; list[i]; i++)
+ if (strcmp(list[i], name) == 0)
+ return i;
+ return -1; /* name not found */
+}
+
+LUALIB_API void luaL_argerror (lua_State *L, int narg, const char *extramsg) {
+ lua_Debug ar;
+ lua_getstack(L, 0, &ar);
+ lua_getinfo(L, "n", &ar);
+ if (ar.name == NULL)
+ ar.name = "?";
+ luaL_verror(L, "bad argument #%d to `%.50s' (%.100s)",
+ narg, ar.name, extramsg);
+}
+
+
+static void type_error (lua_State *L, int narg, int t) {
+ char buff[50];
+ sprintf(buff, "%.8s expected, got %.8s", lua_typename(L, t),
+ lua_typename(L, lua_type(L, narg)));
+ luaL_argerror(L, narg, buff);
+}
+
+
+LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) {
+ if (space > lua_stackspace(L))
+ luaL_verror(L, "stack overflow (%.30s)", mes);
+}
+
+
+LUALIB_API void luaL_checktype(lua_State *L, int narg, int t) {
+ if (lua_type(L, narg) != t)
+ type_error(L, narg, t);
+}
+
+
+LUALIB_API void luaL_checkany (lua_State *L, int narg) {
+ if (lua_type(L, narg) == LUA_TNONE)
+ luaL_argerror(L, narg, "value expected");
+}
+
+
+LUALIB_API const char *luaL_check_lstr (lua_State *L, int narg, size_t *len) {
+ const char *s = lua_tostring(L, narg);
+ if (!s) type_error(L, narg, LUA_TSTRING);
+ if (len) *len = lua_strlen(L, narg);
+ return s;
+}
+
+
+LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, size_t *len) {
+ if (lua_isnull(L, narg)) {
+ if (len)
+ *len = (def ? strlen(def) : 0);
+ return def;
+ }
+ else return luaL_check_lstr(L, narg, len);
+}
+
+
+LUALIB_API double luaL_check_number (lua_State *L, int narg) {
+ double d = lua_tonumber(L, narg);
+ if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
+ type_error(L, narg, LUA_TNUMBER);
+ return d;
+}
+
+
+LUALIB_API double luaL_opt_number (lua_State *L, int narg, double def) {
+ if (lua_isnull(L, narg)) return def;
+ else return luaL_check_number(L, narg);
+}
+
+
+LUALIB_API void luaL_openlib (lua_State *L, const struct luaL_reg *l, int n) {
+ int i;
+ for (i=0; i<n; i++)
+ lua_register(L, l[i].name, l[i].func);
+}
+
+
+LUALIB_API void luaL_verror (lua_State *L, const char *fmt, ...) {
+ char buff[500];
+ va_list argp;
+ va_start(argp, fmt);
+ vsprintf(buff, fmt, argp);
+ va_end(argp);
+ lua_error(L, buff);
+}
+
+
+/*
+** {======================================================
+** Generic Buffer manipulation
+** =======================================================
+*/
+
+
+#define buffempty(B) ((B)->p == (B)->buffer)
+#define bufflen(B) ((B)->p - (B)->buffer)
+#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B)))
+
+#define LIMIT (LUA_MINSTACK/2)
+
+
+static int emptybuffer (luaL_Buffer *B) {
+ size_t l = bufflen(B);
+ if (l == 0) return 0; /* put nothing on stack */
+ else {
+ lua_pushlstring(B->L, B->buffer, l);
+ B->p = B->buffer;
+ B->level++;
+ return 1;
+ }
+}
+
+
+static void adjuststack (luaL_Buffer *B) {
+ if (B->level > 1) {
+ lua_State *L = B->L;
+ int toget = 1; /* number of levels to concat */
+ size_t toplen = lua_strlen(L, -1);
+ do {
+ size_t l = lua_strlen(L, -(toget+1));
+ if (B->level - toget + 1 >= LIMIT || toplen > l) {
+ toplen += l;
+ toget++;
+ }
+ else break;
+ } while (toget < B->level);
+ if (toget >= 2) {
+ lua_concat(L, toget);
+ B->level = B->level - toget + 1;
+ }
+ }
+}
+
+
+LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) {
+ if (emptybuffer(B))
+ adjuststack(B);
+ return B->buffer;
+}
+
+
+LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {
+ while (l--)
+ luaL_putchar(B, *s++);
+}
+
+
+LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
+ luaL_addlstring(B, s, strlen(s));
+}
+
+
+LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
+ emptybuffer(B);
+ if (B->level == 0)
+ lua_pushlstring(B->L, NULL, 0);
+ else if (B->level > 1)
+ lua_concat(B->L, B->level);
+ B->level = 1;
+}
+
+
+LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
+ lua_State *L = B->L;
+ size_t vl = lua_strlen(L, -1);
+ if (vl <= bufffree(B)) { /* fit into buffer? */
+ memcpy(B->p, lua_tostring(L, -1), vl); /* put it there */
+ B->p += vl;
+ lua_pop(L, 1); /* remove from stack */
+ }
+ else {
+ if (emptybuffer(B))
+ lua_insert(L, -2); /* put buffer before new value */
+ B->level++; /* add new value into B stack */
+ adjuststack(B);
+ }
+}
+
+
+LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
+ B->L = L;
+ B->p = B->buffer;
+ B->level = 0;
+}
+
+/* }====================================================== */
diff --git a/lua/src/lib/lbaselib.c b/lua/src/lib/lbaselib.c
new file mode 100644
index 0000000..d84eaef
--- /dev/null
+++ b/lua/src/lib/lbaselib.c
@@ -0,0 +1,651 @@
+/*
+** $Id: lbaselib.c,v 1.2 2002/07/12 07:49:04 jcatki Exp $
+** Basic library
+** See Copyright Notice in lua.h
+*/
+
+
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "lauxlib.h"
+#include "luadebug.h"
+#include "lualib.h"
+
+
+
+/*
+** If your system does not support `stderr', redefine this function, or
+** redefine _ERRORMESSAGE so that it won't need _ALERT.
+*/
+static int luaB__ALERT (lua_State *L) {
+ fputs(luaL_check_string(L, 1), stderr);
+ return 0;
+}
+
+
+/*
+** Basic implementation of _ERRORMESSAGE.
+** The library `liolib' redefines _ERRORMESSAGE for better error information.
+*/
+static int luaB__ERRORMESSAGE (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TSTRING);
+ lua_getglobal(L, LUA_ALERT);
+ if (lua_isfunction(L, -1)) { /* avoid error loop if _ALERT is not defined */
+ lua_Debug ar;
+ lua_pushstring(L, "error: ");
+ lua_pushvalue(L, 1);
+ if (lua_getstack(L, 1, &ar)) {
+ lua_getinfo(L, "Sl", &ar);
+ if (ar.source && ar.currentline > 0) {
+ char buff[100];
+ sprintf(buff, "\n <%.70s: line %d>", ar.short_src, ar.currentline);
+ lua_pushstring(L, buff);
+ lua_concat(L, 2);
+ }
+ }
+ lua_pushstring(L, "\n");
+ lua_concat(L, 3);
+ lua_rawcall(L, 1, 0);
+ }
+ return 0;
+}
+
+
+/*
+** If your system does not support `stdout', you can just remove this function.
+** If you need, you can define your own `print' function, following this
+** model but changing `fputs' to put the strings at a proper place
+** (a console window or a log file, for instance).
+*/
+static int luaB_print (lua_State *L) {
+ int n = lua_gettop(L); /* number of arguments */
+ int i;
+ lua_getglobal(L, "tostring");
+ for (i=1; i<=n; i++) {
+ const char *s;
+ lua_pushvalue(L, -1); /* function to be called */
+ lua_pushvalue(L, i); /* value to print */
+ lua_rawcall(L, 1, 1);
+ s = lua_tostring(L, -1); /* get result */
+ if (s == NULL)
+ lua_error(L, "`tostring' must return a string to `print'");
+ if (i>1) fputs("\t", stdout);
+ fputs(s, stdout);
+ lua_pop(L, 1); /* pop result */
+ }
+ fputs("\n", stdout);
+ return 0;
+}
+
+
+static int luaB_tonumber (lua_State *L) {
+ int base = luaL_opt_int(L, 2, 10);
+ if (base == 10) { /* standard conversion */
+ luaL_checkany(L, 1);
+ if (lua_isnumber(L, 1)) {
+ lua_pushnumber(L, lua_tonumber(L, 1));
+ return 1;
+ }
+ }
+ else {
+ const char *s1 = luaL_check_string(L, 1);
+ char *s2;
+ unsigned long n;
+ luaL_arg_check(L, 2 <= base && base <= 36, 2, "base out of range");
+ n = strtoul(s1, &s2, base);
+ if (s1 != s2) { /* at least one valid digit? */
+ while (isspace((unsigned char)*s2)) s2++; /* skip trailing spaces */
+ if (*s2 == '\0') { /* no invalid trailing characters? */
+ lua_pushnumber(L, n);
+ return 1;
+ }
+ }
+ }
+ lua_pushnil(L); /* else not a number */
+ return 1;
+}
+
+
+static int luaB_error (lua_State *L) {
+ lua_error(L, luaL_opt_string(L, 1, NULL));
+ return 0; /* to avoid warnings */
+}
+
+static int luaB_setglobal (lua_State *L) {
+ luaL_checkany(L, 2);
+ lua_setglobal(L, luaL_check_string(L, 1));
+ return 0;
+}
+
+static int luaB_getglobal (lua_State *L) {
+ lua_getglobal(L, luaL_check_string(L, 1));
+ return 1;
+}
+
+static int luaB_tag (lua_State *L) {
+ luaL_checkany(L, 1);
+ lua_pushnumber(L, lua_tag(L, 1));
+ return 1;
+}
+
+static int luaB_settag (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ lua_pushvalue(L, 1); /* push table */
+ lua_settag(L, luaL_check_int(L, 2));
+ return 1; /* return table */
+}
+
+static int luaB_newtag (lua_State *L) {
+ lua_pushnumber(L, lua_newtag(L));
+ return 1;
+}
+
+static int luaB_copytagmethods (lua_State *L) {
+ lua_pushnumber(L, lua_copytagmethods(L, luaL_check_int(L, 1),
+ luaL_check_int(L, 2)));
+ return 1;
+}
+
+static int luaB_globals (lua_State *L) {
+ lua_getglobals(L); /* value to be returned */
+ if (!lua_isnull(L, 1)) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ lua_pushvalue(L, 1); /* new table of globals */
+ lua_setglobals(L);
+ }
+ return 1;
+}
+
+static int luaB_rawget (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ luaL_checkany(L, 2);
+ lua_rawget(L, 1);
+ return 1;
+}
+
+static int luaB_rawset (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ luaL_checkany(L, 2);
+ luaL_checkany(L, 3);
+ lua_rawset(L, 1);
+ return 1;
+}
+
+static int luaB_settagmethod (lua_State *L) {
+ int tag = luaL_check_int(L, 1);
+ const char *event = luaL_check_string(L, 2);
+ luaL_arg_check(L, lua_isfunction(L, 3) || lua_isnil(L, 3), 3,
+ "function or nil expected");
+ if (strcmp(event, "gc") == 0)
+ lua_error(L, "deprecated use: cannot set the `gc' tag method from Lua");
+ lua_gettagmethod(L, tag, event);
+ lua_pushvalue(L, 3);
+ lua_settagmethod(L, tag, event);
+ return 1;
+}
+
+
+static int luaB_gettagmethod (lua_State *L) {
+ int tag = luaL_check_int(L, 1);
+ const char *event = luaL_check_string(L, 2);
+ if (strcmp(event, "gc") == 0)
+ lua_error(L, "deprecated use: cannot get the `gc' tag method from Lua");
+ lua_gettagmethod(L, tag, event);
+ return 1;
+}
+
+
+static int luaB_gcinfo (lua_State *L) {
+ lua_pushnumber(L, lua_getgccount(L));
+ lua_pushnumber(L, lua_getgcthreshold(L));
+ return 2;
+}
+
+
+static int luaB_collectgarbage (lua_State *L) {
+ lua_setgcthreshold(L, luaL_opt_int(L, 1, 0));
+ return 0;
+}
+
+
+static int luaB_type (lua_State *L) {
+ luaL_checkany(L, 1);
+ lua_pushstring(L, lua_typename(L, lua_type(L, 1)));
+ return 1;
+}
+
+
+static int luaB_next (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ lua_settop(L, 2); /* create a 2nd argument if there isn't one */
+ if (lua_next(L, 1))
+ return 2;
+ else {
+ lua_pushnil(L);
+ return 1;
+ }
+}
+
+
+static int passresults (lua_State *L, int status, int oldtop) {
+ static const char *const errornames[] =
+ {"ok", "run-time error", "file error", "syntax error",
+ "memory error", "error in error handling"};
+ if (status == 0) {
+ int nresults = lua_gettop(L) - oldtop;
+ if (nresults > 0)
+ return nresults; /* results are already on the stack */
+ else {
+ lua_pushuserdata(L, NULL); /* at least one result to signal no errors */
+ return 1;
+ }
+ }
+ else { /* error */
+ lua_pushnil(L);
+ lua_pushstring(L, errornames[status]); /* error code */
+ return 2;
+ }
+}
+
+static int luaB_dostring (lua_State *L) {
+ int oldtop = lua_gettop(L);
+ size_t l;
+ const char *s = luaL_check_lstr(L, 1, &l);
+ if (*s == '\33') /* binary files start with ESC... */
+ lua_error(L, "`dostring' cannot run pre-compiled code");
+ return passresults(L, lua_dobuffer(L, s, l, luaL_opt_string(L, 2, s)), oldtop);
+}
+
+
+static int luaB_dofile (lua_State *L) {
+ int oldtop = lua_gettop(L);
+ const char *fname = luaL_opt_string(L, 1, NULL);
+ return passresults(L, lua_dofile(L, fname), oldtop);
+}
+
+
+static int luaB_call (lua_State *L) {
+ int oldtop;
+ const char *options = luaL_opt_string(L, 3, "");
+ int err = 0; /* index of old error method */
+ int i, status;
+ int n;
+ luaL_checktype(L, 2, LUA_TTABLE);
+ n = lua_getn(L, 2);
+ if (!lua_isnull(L, 4)) { /* set new error method */
+ lua_getglobal(L, LUA_ERRORMESSAGE);
+ err = lua_gettop(L); /* get index */
+ lua_pushvalue(L, 4);
+ lua_setglobal(L, LUA_ERRORMESSAGE);
+ }
+ oldtop = lua_gettop(L); /* top before function-call preparation */
+ /* push function */
+ lua_pushvalue(L, 1);
+ luaL_checkstack(L, n, "too many arguments");
+ for (i=0; i<n; i++) /* push arg[1...n] */
+ lua_rawgeti(L, 2, i+1);
+ status = lua_call(L, n, LUA_MULTRET);
+ if (err != 0) { /* restore old error method */
+ lua_pushvalue(L, err);
+ lua_setglobal(L, LUA_ERRORMESSAGE);
+ }
+ if (status != 0) { /* error in call? */
+ if (strchr(options, 'x'))
+ lua_pushnil(L); /* return nil to signal the error */
+ else
+ lua_error(L, NULL); /* propagate error without additional messages */
+ return 1;
+ }
+ if (strchr(options, 'p')) /* pack results? */
+ lua_error(L, "deprecated option `p' in `call'");
+ return lua_gettop(L) - oldtop; /* results are already on the stack */
+}
+
+
+static int luaB_tostring (lua_State *L) {
+ char buff[64];
+ switch (lua_type(L, 1)) {
+ case LUA_TNUMBER:
+ lua_pushstring(L, lua_tostring(L, 1));
+ return 1;
+ case LUA_TSTRING:
+ lua_pushvalue(L, 1);
+ return 1;
+ case LUA_TTABLE:
+ sprintf(buff, "table: %p", lua_topointer(L, 1));
+ break;
+ case LUA_TFUNCTION:
+ sprintf(buff, "function: %p", lua_topointer(L, 1));
+ break;
+ case LUA_TUSERDATA:
+ sprintf(buff, "userdata(%d): %p", lua_tag(L, 1), lua_touserdata(L, 1));
+ break;
+ case LUA_TNIL:
+ lua_pushstring(L, "nil");
+ return 1;
+ default:
+ luaL_argerror(L, 1, "value expected");
+ }
+ lua_pushstring(L, buff);
+ return 1;
+}
+
+
+static int luaB_foreachi (lua_State *L) {
+ int n, i;
+ luaL_checktype(L, 1, LUA_TTABLE);
+ luaL_checktype(L, 2, LUA_TFUNCTION);
+ n = lua_getn(L, 1);
+ for (i=1; i<=n; i++) {
+ lua_pushvalue(L, 2); /* function */
+ lua_pushnumber(L, i); /* 1st argument */
+ lua_rawgeti(L, 1, i); /* 2nd argument */
+ lua_rawcall(L, 2, 1);
+ if (!lua_isnil(L, -1))
+ return 1;
+ lua_pop(L, 1); /* remove nil result */
+ }
+ return 0;
+}
+
+
+static int luaB_foreach (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ luaL_checktype(L, 2, LUA_TFUNCTION);
+ lua_pushnil(L); /* first index */
+ for (;;) {
+ if (lua_next(L, 1) == 0)
+ return 0;
+ lua_pushvalue(L, 2); /* function */
+ lua_pushvalue(L, -3); /* key */
+ lua_pushvalue(L, -3); /* value */
+ lua_rawcall(L, 2, 1);
+ if (!lua_isnil(L, -1))
+ return 1;
+ lua_pop(L, 2); /* remove value and result */
+ }
+}
+
+
+static int luaB_assert (lua_State *L) {
+ luaL_checkany(L, 1);
+ if (lua_isnil(L, 1))
+ luaL_verror(L, "assertion failed! %.90s", luaL_opt_string(L, 2, ""));
+ return 0;
+}
+
+
+static int luaB_getn (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ lua_pushnumber(L, lua_getn(L, 1));
+ return 1;
+}
+
+
+static int luaB_tinsert (lua_State *L) {
+ int v = lua_gettop(L); /* last argument: to be inserted */
+ int n, pos;
+ luaL_checktype(L, 1, LUA_TTABLE);
+ n = lua_getn(L, 1);
+ if (v == 2) /* called with only 2 arguments */
+ pos = n+1;
+ else
+ pos = luaL_check_int(L, 2); /* 2nd argument is the position */
+ lua_pushstring(L, "n");
+ lua_pushnumber(L, n+1);
+ lua_rawset(L, 1); /* t.n = n+1 */
+ for (; n>=pos; n--) {
+ lua_rawgeti(L, 1, n);
+ lua_rawseti(L, 1, n+1); /* t[n+1] = t[n] */
+ }
+ lua_pushvalue(L, v);
+ lua_rawseti(L, 1, pos); /* t[pos] = v */
+ return 0;
+}
+
+
+static int luaB_tremove (lua_State *L) {
+ int pos, n;
+ luaL_checktype(L, 1, LUA_TTABLE);
+ n = lua_getn(L, 1);
+ pos = luaL_opt_int(L, 2, n);
+ if (n <= 0) return 0; /* table is "empty" */
+ lua_rawgeti(L, 1, pos); /* result = t[pos] */
+ for ( ;pos<n; pos++) {
+ lua_rawgeti(L, 1, pos+1);
+ lua_rawseti(L, 1, pos); /* a[pos] = a[pos+1] */
+ }
+ lua_pushstring(L, "n");
+ lua_pushnumber(L, n-1);
+ lua_rawset(L, 1); /* t.n = n-1 */
+ lua_pushnil(L);
+ lua_rawseti(L, 1, n); /* t[n] = nil */
+ return 1;
+}
+
+
+
+
+/*
+** {======================================================
+** Quicksort
+** (based on `Algorithms in MODULA-3', Robert Sedgewick;
+** Addison-Wesley, 1993.)
+*/
+
+
+static void set2 (lua_State *L, int i, int j) {
+ lua_rawseti(L, 1, i);
+ lua_rawseti(L, 1, j);
+}
+
+static int sort_comp (lua_State *L, int a, int b) {
+ /* WARNING: the caller (auxsort) must ensure stack space */
+ if (!lua_isnil(L, 2)) { /* function? */
+ int res;
+ lua_pushvalue(L, 2);
+ lua_pushvalue(L, a-1); /* -1 to compensate function */
+ lua_pushvalue(L, b-2); /* -2 to compensate function and `a' */
+ lua_rawcall(L, 2, 1);
+ res = !lua_isnil(L, -1);
+ lua_pop(L, 1);
+ return res;
+ }
+ else /* a < b? */
+ return lua_lessthan(L, a, b);
+}
+
+static void auxsort (lua_State *L, int l, int u) {
+ while (l < u) { /* for tail recursion */
+ int i, j;
+ /* sort elements a[l], a[(l+u)/2] and a[u] */
+ lua_rawgeti(L, 1, l);
+ lua_rawgeti(L, 1, u);
+ if (sort_comp(L, -1, -2)) /* a[u] < a[l]? */
+ set2(L, l, u); /* swap a[l] - a[u] */
+ else
+ lua_pop(L, 2);
+ if (u-l == 1) break; /* only 2 elements */
+ i = (l+u)/2;
+ lua_rawgeti(L, 1, i);
+ lua_rawgeti(L, 1, l);
+ if (sort_comp(L, -2, -1)) /* a[i]<a[l]? */
+ set2(L, i, l);
+ else {
+ lua_pop(L, 1); /* remove a[l] */
+ lua_rawgeti(L, 1, u);
+ if (sort_comp(L, -1, -2)) /* a[u]<a[i]? */
+ set2(L, i, u);
+ else
+ lua_pop(L, 2);
+ }
+ if (u-l == 2) break; /* only 3 elements */
+ lua_rawgeti(L, 1, i); /* Pivot */
+ lua_pushvalue(L, -1);
+ lua_rawgeti(L, 1, u-1);
+ set2(L, i, u-1);
+ /* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */
+ i = l; j = u-1;
+ for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */
+ /* repeat ++i until a[i] >= P */
+ while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
+ if (i>u) lua_error(L, "invalid order function for sorting");
+ lua_pop(L, 1); /* remove a[i] */
+ }
+ /* repeat --j until a[j] <= P */
+ while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {
+ if (j<l) lua_error(L, "invalid order function for sorting");
+ lua_pop(L, 1); /* remove a[j] */
+ }
+ if (j<i) {
+ lua_pop(L, 3); /* pop pivot, a[i], a[j] */
+ break;
+ }
+ set2(L, i, j);
+ }
+ lua_rawgeti(L, 1, u-1);
+ lua_rawgeti(L, 1, i);
+ set2(L, u-1, i); /* swap pivot (a[u-1]) with a[i] */
+ /* a[l..i-1] <= a[i] == P <= a[i+1..u] */
+ /* adjust so that smaller "half" is in [j..i] and larger one in [l..u] */
+ if (i-l < u-i) {
+ j=l; i=i-1; l=i+2;
+ }
+ else {
+ j=i+1; i=u; u=j-2;
+ }
+ auxsort(L, j, i); /* call recursively the smaller one */
+ } /* repeat the routine for the larger one */
+}
+
+static int luaB_sort (lua_State *L) {
+ int n;
+ luaL_checktype(L, 1, LUA_TTABLE);
+ n = lua_getn(L, 1);
+ if (!lua_isnull(L, 2)) /* is there a 2nd argument? */
+ luaL_checktype(L, 2, LUA_TFUNCTION);
+ lua_settop(L, 2); /* make sure there is two arguments */
+ auxsort(L, 1, n);
+ return 0;
+}
+
+/* }====================================================== */
+
+
+
+/*
+** {======================================================
+** Deprecated functions to manipulate global environment.
+** =======================================================
+*/
+
+
+#define num_deprecated 4
+
+static const struct luaL_reg deprecated_names [num_deprecated] = {
+ {"foreachvar", luaB_foreach},
+ {"nextvar", luaB_next},
+ {"rawgetglobal", luaB_rawget},
+ {"rawsetglobal", luaB_rawset}
+};
+
+
+#ifdef LUA_DEPRECATEDFUNCS
+
+/*
+** call corresponding function inserting `globals' as first argument
+*/
+static int deprecated_func (lua_State *L) {
+ lua_insert(L, 1); /* upvalue is the function to be called */
+ lua_getglobals(L);
+ lua_insert(L, 2); /* table of globals is 1o argument */
+ lua_rawcall(L, lua_gettop(L)-1, LUA_MULTRET);
+ return lua_gettop(L); /* return all results */
+}
+
+
+static void deprecated_funcs (lua_State *L) {
+ int i;
+ for (i=0; i<num_deprecated; i++) {
+ lua_pushcfunction(L, deprecated_names[i].func);
+ lua_pushcclosure(L, deprecated_func, 1);
+ lua_setglobal(L, deprecated_names[i].name);
+ }
+}
+
+
+#else
+
+/*
+** gives an explicit error in any attempt to call a deprecated function
+*/
+static int deprecated_func (lua_State *L) {
+ luaL_verror(L, "function `%.20s' is deprecated", lua_tostring(L, -1));
+ return 0; /* to avoid warnings */
+}
+
+
+static void deprecated_funcs (lua_State *L) {
+ int i;
+ for (i=0; i<num_deprecated; i++) {
+ lua_pushstring(L, deprecated_names[i].name);
+ lua_pushcclosure(L, deprecated_func, 1);
+ lua_setglobal(L, deprecated_names[i].name);
+ }
+}
+
+#endif
+
+/* }====================================================== */
+
+static const struct luaL_reg base_funcs[] = {
+ {LUA_ALERT, luaB__ALERT},
+ {LUA_ERRORMESSAGE, luaB__ERRORMESSAGE},
+ {"call", luaB_call},
+ {"collectgarbage", luaB_collectgarbage},
+ {"copytagmethods", luaB_copytagmethods},
+ {"dofile", luaB_dofile},
+ {"dostring", luaB_dostring},
+ {"error", luaB_error},
+ {"foreach", luaB_foreach},
+ {"foreachi", luaB_foreachi},
+ {"gcinfo", luaB_gcinfo},
+ {"getglobal", luaB_getglobal},
+ {"gettagmethod", luaB_gettagmethod},
+ {"globals", luaB_globals},
+ {"newtag", luaB_newtag},
+ {"next", luaB_next},
+ {"print", luaB_print},
+ {"rawget", luaB_rawget},
+ {"rawset", luaB_rawset},
+ {"rawgettable", luaB_rawget}, /* for compatibility */
+ {"rawsettable", luaB_rawset}, /* for compatibility */
+ {"setglobal", luaB_setglobal},
+ {"settag", luaB_settag},
+ {"settagmethod", luaB_settagmethod},
+ {"tag", luaB_tag},
+ {"tonumber", luaB_tonumber},
+ {"tostring", luaB_tostring},
+ {"type", luaB_type},
+ {"assert", luaB_assert},
+ {"getn", luaB_getn},
+ {"sort", luaB_sort},
+ {"tinsert", luaB_tinsert},
+ {"tremove", luaB_tremove}
+};
+
+
+
+LUALIB_API void lua_baselibopen (lua_State *L) {
+ luaL_openl(L, base_funcs);
+ lua_pushstring(L, LUA_VERSION);
+ lua_setglobal(L, "_VERSION");
+ deprecated_funcs(L);
+}
+
diff --git a/lua/src/lib/ldblib.c b/lua/src/lib/ldblib.c
new file mode 100644
index 0000000..e60b096
--- /dev/null
+++ b/lua/src/lib/ldblib.c
@@ -0,0 +1,188 @@
+/*
+** $Id: ldblib.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Interface from Lua to its debug API
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "lauxlib.h"
+#include "luadebug.h"
+#include "lualib.h"
+
+
+
+static void settabss (lua_State *L, const char *i, const char *v) {
+ lua_pushstring(L, i);
+ lua_pushstring(L, v);
+ lua_settable(L, -3);
+}
+
+
+static void settabsi (lua_State *L, const char *i, int v) {
+ lua_pushstring(L, i);
+ lua_pushnumber(L, v);
+ lua_settable(L, -3);
+}
+
+
+static int getinfo (lua_State *L) {
+ lua_Debug ar;
+ const char *options = luaL_opt_string(L, 2, "flnSu");
+ char buff[20];
+ if (lua_isnumber(L, 1)) {
+ if (!lua_getstack(L, (int)lua_tonumber(L, 1), &ar)) {
+ lua_pushnil(L); /* level out of range */
+ return 1;
+ }
+ }
+ else if (lua_isfunction(L, 1)) {
+ lua_pushvalue(L, 1);
+ sprintf(buff, ">%.10s", options);
+ options = buff;
+ }
+ else
+ luaL_argerror(L, 1, "function or level expected");
+ if (!lua_getinfo(L, options, &ar))
+ luaL_argerror(L, 2, "invalid option");
+ lua_newtable(L);
+ for (; *options; options++) {
+ switch (*options) {
+ case 'S':
+ settabss(L, "source", ar.source);
+ if (ar.source)
+ settabss(L, "short_src", ar.short_src);
+ settabsi(L, "linedefined", ar.linedefined);
+ settabss(L, "what", ar.what);
+ break;
+ case 'l':
+ settabsi(L, "currentline", ar.currentline);
+ break;
+ case 'u':
+ settabsi(L, "nups", ar.nups);
+ break;
+ case 'n':
+ settabss(L, "name", ar.name);
+ settabss(L, "namewhat", ar.namewhat);
+ break;
+ case 'f':
+ lua_pushstring(L, "func");
+ lua_pushvalue(L, -3);
+ lua_settable(L, -3);
+ break;
+ }
+ }
+ return 1; /* return table */
+}
+
+
+static int getlocal (lua_State *L) {
+ lua_Debug ar;
+ const char *name;
+ if (!lua_getstack(L, luaL_check_int(L, 1), &ar)) /* level out of range? */
+ luaL_argerror(L, 1, "level out of range");
+ name = lua_getlocal(L, &ar, luaL_check_int(L, 2));
+ if (name) {
+ lua_pushstring(L, name);
+ lua_pushvalue(L, -2);
+ return 2;
+ }
+ else {
+ lua_pushnil(L);
+ return 1;
+ }
+}
+
+
+static int setlocal (lua_State *L) {
+ lua_Debug ar;
+ if (!lua_getstack(L, luaL_check_int(L, 1), &ar)) /* level out of range? */
+ luaL_argerror(L, 1, "level out of range");
+ luaL_checkany(L, 3);
+ lua_pushstring(L, lua_setlocal(L, &ar, luaL_check_int(L, 2)));
+ return 1;
+}
+
+
+
+/* dummy variables (to define unique addresses) */
+static char key1, key2;
+#define KEY_CALLHOOK (&key1)
+#define KEY_LINEHOOK (&key2)
+
+
+static void hookf (lua_State *L, void *key) {
+ lua_getregistry(L);
+ lua_pushuserdata(L, key);
+ lua_gettable(L, -2);
+ if (lua_isfunction(L, -1)) {
+ lua_pushvalue(L, 1);
+ lua_rawcall(L, 1, 0);
+ }
+ else
+ lua_pop(L, 1); /* pop result from gettable */
+ lua_pop(L, 1); /* pop table */
+}
+
+
+static void callf (lua_State *L, lua_Debug *ar) {
+ lua_pushstring(L, ar->event);
+ hookf(L, KEY_CALLHOOK);
+}
+
+
+static void linef (lua_State *L, lua_Debug *ar) {
+ lua_pushnumber(L, ar->currentline);
+ hookf(L, KEY_LINEHOOK);
+}
+
+
+static void sethook (lua_State *L, void *key, lua_Hook hook,
+ lua_Hook (*sethookf)(lua_State * L, lua_Hook h)) {
+ lua_settop(L, 1);
+ if (lua_isnil(L, 1))
+ (*sethookf)(L, NULL);
+ else if (lua_isfunction(L, 1))
+ (*sethookf)(L, hook);
+ else
+ luaL_argerror(L, 1, "function expected");
+ lua_getregistry(L);
+ lua_pushuserdata(L, key);
+ lua_pushvalue(L, -1); /* dup key */
+ lua_gettable(L, -3); /* get old value */
+ lua_pushvalue(L, -2); /* key (again) */
+ lua_pushvalue(L, 1);
+ lua_settable(L, -5); /* set new value */
+}
+
+
+static int setcallhook (lua_State *L) {
+ sethook(L, KEY_CALLHOOK, callf, lua_setcallhook);
+ return 1;
+}
+
+
+static int setlinehook (lua_State *L) {
+ sethook(L, KEY_LINEHOOK, linef, lua_setlinehook);
+ return 1;
+}
+
+
+static const struct luaL_reg dblib[] = {
+ {"getlocal", getlocal},
+ {"getinfo", getinfo},
+ {"setcallhook", setcallhook},
+ {"setlinehook", setlinehook},
+ {"setlocal", setlocal}
+};
+
+
+LUALIB_API void lua_dblibopen (lua_State *L) {
+ luaL_openl(L, dblib);
+}
+
diff --git a/lua/src/lib/liolib.c b/lua/src/lib/liolib.c
new file mode 100644
index 0000000..a6dc43e
--- /dev/null
+++ b/lua/src/lib/liolib.c
@@ -0,0 +1,747 @@
+/*
+** $Id: liolib.c,v 1.6 2003/06/30 19:15:26 ahowe Exp $
+** Standard I/O (and system) library
+** This file modified from it's original form.
+** See Copyright Notice in lua.h
+*/
+
+
+#include <ctype.h>
+#include <stdio.h>
+#define __USE_MISC /* for mkstemp() */
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <assert.h>
+
+#ifndef macintosh
+#ifndef WIN32
+# include <unistd.h> /* for close() */
+#endif
+#endif
+
+#ifdef WIN32
+# define close _close
+#endif
+
+#include "lua.h"
+
+#include "lauxlib.h"
+#include "luadebug.h"
+#include "lualib.h"
+
+
+#ifndef OLD_ANSI
+#include <errno.h>
+#include <locale.h>
+#define realloc(b,s) ((b) == NULL ? malloc(s) : (realloc)(b, s))
+#define free(b) if (b) (free)(b)
+#else
+/* no support for locale and for strerror: fake them */
+#define setlocale(a,b) ((void)a, strcmp((b),"C")==0?"C":NULL)
+#define LC_ALL 0
+#define LC_COLLATE 0
+#define LC_CTYPE 0
+#define LC_MONETARY 0
+#define LC_NUMERIC 0
+#define LC_TIME 0
+#define strerror(e) "generic I/O error"
+#define errno (-1)
+#endif
+
+
+
+#ifdef POPEN
+/* FILE *popen();
+int pclose(); */
+#define CLOSEFILE(L, f) ((pclose(f) == -1) ? fclose(f) : 0)
+#else
+/* no support for popen */
+#define popen(x,y) NULL /* that is, popen always fails */
+#define CLOSEFILE(L, f) (fclose(f))
+#endif
+
+
+#define INFILE 0
+#define OUTFILE 1
+
+typedef struct IOCtrl {
+ int ref[2]; /* ref for strings _INPUT/_OUTPUT */
+ int iotag; /* tag for file handles */
+ int closedtag; /* tag for closed handles */
+} IOCtrl;
+
+
+
+static const char *const filenames[] = {"_INPUT", "_OUTPUT"};
+
+
+static int pushresult (lua_State *L, int i) {
+ if (i) {
+ lua_pushuserdata(L, NULL);
+ return 1;
+ }
+ else {
+ lua_pushnil(L);
+ lua_pushstring(L, strerror(errno));
+ lua_pushnumber(L, errno);
+ return 3;;
+ }
+}
+
+
+/*
+** {======================================================
+** FILE Operations
+** =======================================================
+*/
+
+
+static FILE *gethandle (lua_State *L, IOCtrl *ctrl, int f) {
+ void *p = lua_touserdata(L, f);
+ if (p != NULL) { /* is `f' a userdata ? */
+ int ftag = lua_tag(L, f);
+ if (ftag == ctrl->iotag) /* does it have the correct tag? */
+ return (FILE *)p;
+ else if (ftag == ctrl->closedtag)
+ lua_error(L, "cannot access a closed file");
+ /* else go through */
+ }
+ return NULL;
+}
+
+
+static FILE *getnonullfile (lua_State *L, IOCtrl *ctrl, int arg) {
+ FILE *f = gethandle(L, ctrl, arg);
+ luaL_arg_check(L, f, arg, "invalid file handle");
+ return f;
+}
+
+
+static FILE *getfilebyref (lua_State *L, IOCtrl *ctrl, int inout) {
+ FILE *f;
+ lua_getglobals(L);
+ lua_getref(L, ctrl->ref[inout]);
+ lua_rawget(L, -2);
+ f = gethandle(L, ctrl, -1);
+ if (f == NULL)
+ luaL_verror(L, "global variable `%.10s' is not a file handle",
+ filenames[inout]);
+ return f;
+}
+
+
+static void setfilebyname (lua_State *L, IOCtrl *ctrl, FILE *f,
+ const char *name) {
+ lua_pushusertag(L, f, ctrl->iotag);
+ lua_setglobal(L, name);
+}
+
+
+#define setfile(L,ctrl,f,inout) (setfilebyname(L,ctrl,f,filenames[inout]))
+
+
+static int setreturn (lua_State *L, IOCtrl *ctrl, FILE *f, int inout) {
+ if (f == NULL)
+ return pushresult(L, 0);
+ else {
+ setfile(L, ctrl, f, inout);
+ lua_pushusertag(L, f, ctrl->iotag);
+ return 1;
+ }
+}
+
+
+static int closefile (lua_State *L, IOCtrl *ctrl, FILE *f) {
+ if (f == stdin || f == stdout || f == stderr)
+ return 1;
+ else {
+ lua_pushusertag(L, f, ctrl->iotag);
+ lua_settag(L, ctrl->closedtag);
+ return (CLOSEFILE(L, f) == 0);
+ }
+}
+
+
+static int io_close (lua_State *L) {
+ IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
+ lua_pop(L, 1); /* remove upvalue */
+ return pushresult(L, closefile(L, ctrl, getnonullfile(L, ctrl, 1)));
+}
+
+
+static int file_collect (lua_State *L) {
+ IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
+ FILE *f = getnonullfile(L, ctrl, 1);
+ if (f != stdin && f != stdout && f != stderr)
+ CLOSEFILE(L, f);
+ return 0;
+}
+
+
+static int io_open (lua_State *L) {
+ IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
+ FILE *f;
+ lua_pop(L, 1); /* remove upvalue */
+ f = fopen(luaL_check_string(L, 1), luaL_check_string(L, 2));
+ if (f) {
+ lua_pushusertag(L, f, ctrl->iotag);
+ return 1;
+ }
+ else
+ return pushresult(L, 0);
+}
+
+
+
+static int io_fromto (lua_State *L, int inout, const char *mode) {
+ IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
+ FILE *current;
+ lua_pop(L, 1); /* remove upvalue */
+ if (lua_isnull(L, 1)) {
+ closefile(L, ctrl, getfilebyref(L, ctrl, inout));
+ current = (inout == 0) ? stdin : stdout;
+ }
+ else if (lua_tag(L, 1) == ctrl->iotag) /* deprecated option */
+ current = (FILE *)lua_touserdata(L, 1);
+ else {
+ const char *s = luaL_check_string(L, 1);
+ current = (*s == '|') ? popen(s+1, mode) : fopen(s, mode);
+ }
+ return setreturn(L, ctrl, current, inout);
+}
+
+
+static int io_readfrom (lua_State *L) {
+ return io_fromto(L, INFILE, "r");
+}
+
+
+static int io_writeto (lua_State *L) {
+ return io_fromto(L, OUTFILE, "w");
+}
+
+
+static int io_appendto (lua_State *L) {
+ IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
+ FILE *current;
+ lua_pop(L, 1); /* remove upvalue */
+ current = fopen(luaL_check_string(L, 1), "a");
+ return setreturn(L, ctrl, current, OUTFILE);
+}
+
+
+
+/*
+** {======================================================
+** READ
+** =======================================================
+*/
+
+
+
+#ifdef LUA_COMPAT_READPATTERN
+
+/*
+** We cannot lookahead without need, because this can lock stdin.
+** This flag signals when we need to read a next char.
+*/
+#define NEED_OTHER (EOF-1) /* just some flag different from EOF */
+
+
+static int read_pattern (lua_State *L, FILE *f, const char *p) {
+ int inskip = 0; /* {skip} level */
+ int c = NEED_OTHER;
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ while (*p != '\0') {
+ switch (*p) {
+ case '{':
+ inskip++;
+ p++;
+ continue;
+ case '}':
+ if (!inskip) lua_error(L, "unbalanced braces in read pattern");
+ inskip--;
+ p++;
+ continue;
+ default: {
+ const char *ep = luaI_classend(L, p); /* get what is next */
+ int m; /* match result */
+ if (c == NEED_OTHER) c = getc(f);
+ m = (c==EOF) ? 0 : luaI_singlematch(c, p, ep);
+ if (m) {
+ if (!inskip) luaL_putchar(&b, c);
+ c = NEED_OTHER;
+ }
+ switch (*ep) {
+ case '+': /* repetition (1 or more) */
+ if (!m) goto break_while; /* pattern fails? */
+ /* else go through */
+ case '*': /* repetition (0 or more) */
+ while (m) { /* reads the same item until it fails */
+ c = getc(f);
+ m = (c==EOF) ? 0 : luaI_singlematch(c, p, ep);
+ if (m && !inskip) luaL_putchar(&b, c);
+ }
+ /* go through to continue reading the pattern */
+ case '?': /* optional */
+ p = ep+1; /* continues reading the pattern */
+ continue;
+ default:
+ if (!m) goto break_while; /* pattern fails? */
+ p = ep; /* else continues reading the pattern */
+ }
+ }
+ }
+ } break_while:
+ if (c != NEED_OTHER) ungetc(c, f);
+ luaL_pushresult(&b); /* close buffer */
+ return (*p == '\0');
+}
+
+#else
+
+#define read_pattern(L, f, p) (lua_error(L, "read patterns are deprecated"), 0)
+
+#endif
+
+
+static int read_number (lua_State *L, FILE *f) {
+ double d;
+ if (fscanf(f, "%lf", &d) == 1) {
+ lua_pushnumber(L, d);
+ return 1;
+ }
+ else return 0; /* read fails */
+}
+
+
+static int read_word (lua_State *L, FILE *f) {
+ int c;
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ do { c = fgetc(f); } while (isspace(c)); /* skip spaces */
+ while (c != EOF && !isspace(c)) {
+ luaL_putchar(&b, c);
+ c = fgetc(f);
+ }
+ ungetc(c, f);
+ luaL_pushresult(&b); /* close buffer */
+ return (lua_strlen(L, -1) > 0);
+}
+
+
+static int read_line (lua_State *L, FILE *f) {
+ int n = 0;
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ for (;;) {
+ char *p = luaL_prepbuffer(&b);
+ if (!fgets(p, LUAL_BUFFERSIZE, f)) /* read fails? */
+ break;
+ n = strlen(p);
+ if (p[n-1] != '\n')
+ luaL_addsize(&b, n);
+ else {
+ luaL_addsize(&b, n-1); /* do not add the `\n' */
+ break;
+ }
+ }
+ luaL_pushresult(&b); /* close buffer */
+ return (n > 0); /* read something? */
+}
+
+
+static void read_file (lua_State *L, FILE *f) {
+ size_t len = 0;
+ size_t size = BUFSIZ;
+ char *buffer = NULL;
+ for (;;) {
+ char *newbuffer = (char *)realloc(buffer, size);
+ if (newbuffer == NULL) {
+ free(buffer);
+ lua_error(L, "not enough memory to read a file");
+ }
+ buffer = newbuffer;
+ len += fread(buffer+len, sizeof(char), size-len, f);
+ if (len < size) break; /* did not read all it could */
+ size *= 2;
+ }
+ lua_pushlstring(L, buffer, len);
+ free(buffer);
+}
+
+
+static int read_chars (lua_State *L, FILE *f, size_t n) {
+ char *buffer;
+ size_t n1;
+ char statbuff[BUFSIZ];
+ if (n <= BUFSIZ)
+ buffer = statbuff;
+ else {
+ buffer = (char *)malloc(n);
+ if (buffer == NULL)
+ lua_error(L, "not enough memory to read a file");
+ }
+ n1 = fread(buffer, sizeof(char), n, f);
+ lua_pushlstring(L, buffer, n1);
+ if (buffer != statbuff) free(buffer);
+ return (n1 > 0 || n == 0);
+}
+
+
+static int io_read (lua_State *L) {
+ IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
+ int lastarg = lua_gettop(L) - 1;
+ int firstarg = 1;
+ FILE *f = gethandle(L, ctrl, firstarg);
+ int n;
+ if (f) firstarg++;
+ else f = getfilebyref(L, ctrl, INFILE); /* get _INPUT */
+ lua_pop(L, 1);
+ if (firstarg > lastarg) { /* no arguments? */
+ lua_settop(L, 0); /* erase upvalue and other eventual garbage */
+ firstarg = lastarg = 1; /* correct indices */
+ lua_pushstring(L, "*l"); /* push default argument */
+ }
+ else /* ensure stack space for all results and for auxlib's buffer */
+ luaL_checkstack(L, lastarg-firstarg+1+LUA_MINSTACK, "too many arguments");
+ for (n = firstarg; n<=lastarg; n++) {
+ int success;
+ if (lua_isnumber(L, n))
+ success = read_chars(L, f, (size_t)lua_tonumber(L, n));
+ else {
+ const char *p = luaL_check_string(L, n);
+ if (p[0] != '*')
+ success = read_pattern(L, f, p); /* deprecated! */
+ else {
+ switch (p[1]) {
+ case 'n': /* number */
+ if (!read_number(L, f)) goto endloop; /* read fails */
+ continue; /* number is already pushed; avoid the "pushstring" */
+ case 'l': /* line */
+ success = read_line(L, f);
+ break;
+ case 'a': /* file */
+ read_file(L, f);
+ success = 1; /* always success */
+ break;
+ case 'w': /* word */
+ success = read_word(L, f);
+ break;
+ default:
+ luaL_argerror(L, n, "invalid format");
+ success = 0; /* to avoid warnings */
+ }
+ }
+ }
+ if (!success) {
+ lua_pop(L, 1); /* remove last result */
+ break; /* read fails */
+ }
+ } endloop:
+ return n - firstarg;
+}
+
+/* }====================================================== */
+
+
+static int io_write (lua_State *L) {
+ int lastarg = lua_gettop(L) - 1;
+ IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
+ int arg = 1;
+ int status = 1;
+ FILE *f = gethandle(L, ctrl, arg);
+ if (f) arg++;
+ else f = getfilebyref(L, ctrl, OUTFILE); /* get _OUTPUT */
+ for (; arg <= lastarg; arg++) {
+ if (lua_type(L, arg) == LUA_TNUMBER) { /* LUA_NUMBER */
+ /* optimization: could be done exactly as for strings */
+ status = status && fprintf(f, "%.16g", lua_tonumber(L, arg)) > 0;
+ }
+ else {
+ size_t l;
+ const char *s = luaL_check_lstr(L, arg, &l);
+ status = status && (fwrite(s, sizeof(char), l, f) == l);
+ }
+ }
+ pushresult(L, status);
+ return 1;
+}
+
+
+static int io_seek (lua_State *L) {
+ static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END};
+ static const char *const modenames[] = {"set", "cur", "end", NULL};
+ IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
+ FILE *f;
+ int op;
+ long offset;
+ lua_pop(L, 1); /* remove upvalue */
+ f = getnonullfile(L, ctrl, 1);
+ op = luaL_findstring(luaL_opt_string(L, 2, "cur"), modenames);
+ offset = luaL_opt_long(L, 3, 0);
+ luaL_arg_check(L, op != -1, 2, "invalid mode");
+ op = fseek(f, offset, mode[op]);
+ if (op)
+ return pushresult(L, 0); /* error */
+ else {
+ lua_pushnumber(L, ftell(f));
+ return 1;
+ }
+}
+
+
+static int io_flush (lua_State *L) {
+ IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
+ FILE *f;
+ lua_pop(L, 1); /* remove upvalue */
+ f = gethandle(L, ctrl, 1);
+ luaL_arg_check(L, f || lua_isnull(L, 1), 1, "invalid file handle");
+ return pushresult(L, fflush(f) == 0);
+}
+
+/* }====================================================== */
+
+
+/*
+** {======================================================
+** Other O.S. Operations
+** =======================================================
+*/
+
+static int io_execute (lua_State *L) {
+ lua_pushnumber(L, system(luaL_check_string(L, 1)));
+ return 1;
+}
+
+
+static int io_remove (lua_State *L) {
+ return pushresult(L, remove(luaL_check_string(L, 1)) == 0);
+}
+
+
+static int io_rename (lua_State *L) {
+ return pushresult(L, rename(luaL_check_string(L, 1),
+ luaL_check_string(L, 2)) == 0);
+}
+
+
+static int io_tmpname (lua_State *L) {
+
+/* #ifdef macintosh */
+#if 1
+
+ /* mkstemp unavailable on Mac OS 9 */
+ assert (0);
+
+#else
+
+ static char tmpfname[16];
+ int fid;
+ strcpy(tmpfname,"/tmp/lua.XXXXXX");
+ if((fid=mkstemp(tmpfname)))
+ close(fid);
+ lua_pushstring(L, tmpfname);
+#endif
+
+ return 1;
+}
+
+
+
+static int io_getenv (lua_State *L) {
+ lua_pushstring(L, getenv(luaL_check_string(L, 1))); /* if NULL push nil */
+ return 1;
+}
+
+
+static int io_clock (lua_State *L) {
+ lua_pushnumber(L, ((double)clock())/CLOCKS_PER_SEC);
+ return 1;
+}
+
+
+static int io_date (lua_State *L) {
+ char b[256];
+ const char *s = luaL_opt_string(L, 1, "%c");
+ struct tm *stm;
+ time_t t;
+ time(&t); stm = localtime(&t);
+ if (strftime(b, sizeof(b), s, stm))
+ lua_pushstring(L, b);
+ else
+ lua_error(L, "invalid `date' format");
+ return 1;
+}
+
+
+static int setloc (lua_State *L) {
+ static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY,
+ LC_NUMERIC, LC_TIME};
+ static const char *const catnames[] = {"all", "collate", "ctype", "monetary",
+ "numeric", "time", NULL};
+ int op = luaL_findstring(luaL_opt_string(L, 2, "all"), catnames);
+ luaL_arg_check(L, op != -1, 2, "invalid option");
+ lua_pushstring(L, setlocale(cat[op], luaL_check_string(L, 1)));
+ return 1;
+}
+
+
+static int io_exit (lua_State *L) {
+ exit(luaL_opt_int(L, 1, EXIT_SUCCESS));
+ return 0; /* to avoid warnings */
+}
+
+/* }====================================================== */
+
+
+
+static int io_debug (lua_State *L) {
+ for (;;) {
+ char buffer[250];
+ fprintf(stderr, "lua_debug> ");
+ if (fgets(buffer, sizeof(buffer), stdin) == 0 ||
+ strcmp(buffer, "cont\n") == 0)
+ return 0;
+ lua_dostring(L, buffer);
+ lua_settop(L, 0); /* remove eventual returns */
+ }
+}
+
+
+#define LEVELS1 12 /* size of the first part of the stack */
+#define LEVELS2 10 /* size of the second part of the stack */
+
+static int errorfb (lua_State *L) {
+ int level = 1; /* skip level 0 (it's this function) */
+ int firstpart = 1; /* still before eventual `...' */
+ lua_Debug ar;
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ luaL_addstring(&b, "error: ");
+ luaL_addstring(&b, luaL_check_string(L, 1));
+ luaL_addstring(&b, "\n");
+ while (lua_getstack(L, level++, &ar)) {
+ char buff[120]; /* enough to fit following `sprintf's */
+ if (level == 2)
+ luaL_addstring(&b, "stack traceback:\n");
+ else if (level > LEVELS1 && firstpart) {
+ /* no more than `LEVELS2' more levels? */
+ if (!lua_getstack(L, level+LEVELS2, &ar))
+ level--; /* keep going */
+ else {
+ luaL_addstring(&b, " ...\n"); /* too many levels */
+ while (lua_getstack(L, level+LEVELS2, &ar)) /* find last levels */
+ level++;
+ }
+ firstpart = 0;
+ continue;
+ }
+ sprintf(buff, "%4d: ", level-1);
+ luaL_addstring(&b, buff);
+ lua_getinfo(L, "Snl", &ar);
+ switch (*ar.namewhat) {
+ case 'g': case 'l': /* global, local */
+ sprintf(buff, "function `%.50s'", ar.name);
+ break;
+ case 'f': /* field */
+ sprintf(buff, "method `%.50s'", ar.name);
+ break;
+ case 't': /* tag method */
+ sprintf(buff, "`%.50s' tag method", ar.name);
+ break;
+ default: {
+ if (*ar.what == 'm') /* main? */
+ sprintf(buff, "main of %.70s", ar.short_src);
+ else if (*ar.what == 'C') /* C function? */
+ sprintf(buff, "%.70s", ar.short_src);
+ else
+ sprintf(buff, "function <%d:%.70s>", ar.linedefined, ar.short_src);
+ ar.source = NULL; /* do not print source again */
+ }
+ }
+ luaL_addstring(&b, buff);
+ if (ar.currentline > 0) {
+ sprintf(buff, " at line %d", ar.currentline);
+ luaL_addstring(&b, buff);
+ }
+ if (ar.source) {
+ sprintf(buff, " [%.70s]", ar.short_src);
+ luaL_addstring(&b, buff);
+ }
+ luaL_addstring(&b, "\n");
+ }
+ luaL_pushresult(&b);
+ lua_getglobal(L, LUA_ALERT);
+ if (lua_isfunction(L, -1)) { /* avoid loop if _ALERT is not defined */
+ lua_pushvalue(L, -2); /* error message */
+ lua_rawcall(L, 1, 0);
+ }
+ return 0;
+}
+
+
+
+static const struct luaL_reg iolib[] = {
+ {LUA_ERRORMESSAGE, errorfb},
+ {"clock", io_clock},
+ {"date", io_date},
+ {"debug", io_debug},
+ {"execute", io_execute},
+ {"exit", io_exit},
+ {"getenv", io_getenv},
+ {"remove", io_remove},
+ {"rename", io_rename},
+ {"setlocale", setloc},
+ {"tmpname", io_tmpname}
+};
+
+
+static const struct luaL_reg iolibtag[] = {
+ {"appendto", io_appendto},
+ {"closefile", io_close},
+ {"flush", io_flush},
+ {"openfile", io_open},
+ {"read", io_read},
+ {"readfrom", io_readfrom},
+ {"seek", io_seek},
+ {"write", io_write},
+ {"writeto", io_writeto}
+};
+
+
+static void openwithcontrol (lua_State *L) {
+ IOCtrl *ctrl = (IOCtrl *)lua_newuserdata(L, sizeof(IOCtrl));
+ unsigned int i;
+ ctrl->iotag = lua_newtag(L);
+ ctrl->closedtag = lua_newtag(L);
+ for (i=0; i<sizeof(iolibtag)/sizeof(iolibtag[0]); i++) {
+ /* put `ctrl' as upvalue for these functions */
+ lua_pushvalue(L, -1);
+ lua_pushcclosure(L, iolibtag[i].func, 1);
+ lua_setglobal(L, iolibtag[i].name);
+ }
+ /* create references to variable names */
+ lua_pushstring(L, filenames[INFILE]);
+ ctrl->ref[INFILE] = lua_ref(L, 1);
+ lua_pushstring(L, filenames[OUTFILE]);
+ ctrl->ref[OUTFILE] = lua_ref(L, 1);
+ /* predefined file handles */
+ setfile(L, ctrl, stdin, INFILE);
+ setfile(L, ctrl, stdout, OUTFILE);
+ setfilebyname(L, ctrl, stdin, "_STDIN");
+ setfilebyname(L, ctrl, stdout, "_STDOUT");
+ setfilebyname(L, ctrl, stderr, "_STDERR");
+ /* close files when collected */
+ lua_pushcclosure(L, file_collect, 1); /* pops `ctrl' from stack */
+ lua_settagmethod(L, ctrl->iotag, "gc");
+}
+
+
+LUALIB_API void lua_iolibopen (lua_State *L) {
+ luaL_openl(L, iolib);
+ openwithcontrol(L);
+}
+
diff --git a/lua/src/lib/lmathlib.c b/lua/src/lib/lmathlib.c
new file mode 100644
index 0000000..ab2f6b0
--- /dev/null
+++ b/lua/src/lib/lmathlib.c
@@ -0,0 +1,238 @@
+/*
+** $Id: lmathlib.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Standard mathematical library
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdlib.h>
+#include <math.h>
+
+#include "lua.h"
+
+#include "lauxlib.h"
+#include "lualib.h"
+
+
+#undef PI
+#define PI (3.14159265358979323846)
+#define RADIANS_PER_DEGREE (PI/180.0)
+
+
+
+/*
+** If you want Lua to operate in radians (instead of degrees),
+** define RADIANS
+*/
+#ifdef RADIANS
+#define FROMRAD(a) (a)
+#define TORAD(a) (a)
+#else
+#define FROMRAD(a) ((a)/RADIANS_PER_DEGREE)
+#define TORAD(a) ((a)*RADIANS_PER_DEGREE)
+#endif
+
+
+static int math_abs (lua_State *L) {
+ lua_pushnumber(L, fabs(luaL_check_number(L, 1)));
+ return 1;
+}
+
+static int math_sin (lua_State *L) {
+ lua_pushnumber(L, sin(TORAD(luaL_check_number(L, 1))));
+ return 1;
+}
+
+static int math_cos (lua_State *L) {
+ lua_pushnumber(L, cos(TORAD(luaL_check_number(L, 1))));
+ return 1;
+}
+
+static int math_tan (lua_State *L) {
+ lua_pushnumber(L, tan(TORAD(luaL_check_number(L, 1))));
+ return 1;
+}
+
+static int math_asin (lua_State *L) {
+ lua_pushnumber(L, FROMRAD(asin(luaL_check_number(L, 1))));
+ return 1;
+}
+
+static int math_acos (lua_State *L) {
+ lua_pushnumber(L, FROMRAD(acos(luaL_check_number(L, 1))));
+ return 1;
+}
+
+static int math_atan (lua_State *L) {
+ lua_pushnumber(L, FROMRAD(atan(luaL_check_number(L, 1))));
+ return 1;
+}
+
+static int math_atan2 (lua_State *L) {
+ lua_pushnumber(L, FROMRAD(atan2(luaL_check_number(L, 1), luaL_check_number(L, 2))));
+ return 1;
+}
+
+static int math_ceil (lua_State *L) {
+ lua_pushnumber(L, ceil(luaL_check_number(L, 1)));
+ return 1;
+}
+
+static int math_floor (lua_State *L) {
+ lua_pushnumber(L, floor(luaL_check_number(L, 1)));
+ return 1;
+}
+
+static int math_mod (lua_State *L) {
+ lua_pushnumber(L, fmod(luaL_check_number(L, 1), luaL_check_number(L, 2)));
+ return 1;
+}
+
+static int math_sqrt (lua_State *L) {
+ lua_pushnumber(L, sqrt(luaL_check_number(L, 1)));
+ return 1;
+}
+
+static int math_pow (lua_State *L) {
+ lua_pushnumber(L, pow(luaL_check_number(L, 1), luaL_check_number(L, 2)));
+ return 1;
+}
+
+static int math_log (lua_State *L) {
+ lua_pushnumber(L, log(luaL_check_number(L, 1)));
+ return 1;
+}
+
+static int math_log10 (lua_State *L) {
+ lua_pushnumber(L, log10(luaL_check_number(L, 1)));
+ return 1;
+}
+
+static int math_exp (lua_State *L) {
+ lua_pushnumber(L, exp(luaL_check_number(L, 1)));
+ return 1;
+}
+
+static int math_deg (lua_State *L) {
+ lua_pushnumber(L, luaL_check_number(L, 1)/RADIANS_PER_DEGREE);
+ return 1;
+}
+
+static int math_rad (lua_State *L) {
+ lua_pushnumber(L, luaL_check_number(L, 1)*RADIANS_PER_DEGREE);
+ return 1;
+}
+
+static int math_frexp (lua_State *L) {
+ int e;
+ lua_pushnumber(L, frexp(luaL_check_number(L, 1), &e));
+ lua_pushnumber(L, e);
+ return 2;
+}
+
+static int math_ldexp (lua_State *L) {
+ lua_pushnumber(L, ldexp(luaL_check_number(L, 1), luaL_check_int(L, 2)));
+ return 1;
+}
+
+
+
+static int math_min (lua_State *L) {
+ int n = lua_gettop(L); /* number of arguments */
+ double dmin = luaL_check_number(L, 1);
+ int i;
+ for (i=2; i<=n; i++) {
+ double d = luaL_check_number(L, i);
+ if (d < dmin)
+ dmin = d;
+ }
+ lua_pushnumber(L, dmin);
+ return 1;
+}
+
+
+static int math_max (lua_State *L) {
+ int n = lua_gettop(L); /* number of arguments */
+ double dmax = luaL_check_number(L, 1);
+ int i;
+ for (i=2; i<=n; i++) {
+ double d = luaL_check_number(L, i);
+ if (d > dmax)
+ dmax = d;
+ }
+ lua_pushnumber(L, dmax);
+ return 1;
+}
+
+
+static int math_random (lua_State *L) {
+ /* the '%' avoids the (rare) case of r==1, and is needed also because on
+ some systems (SunOS!) "rand()" may return a value larger than RAND_MAX */
+ double r = (double)(rand()%RAND_MAX) / (double)RAND_MAX;
+ switch (lua_gettop(L)) { /* check number of arguments */
+ case 0: { /* no arguments */
+ lua_pushnumber(L, r); /* Number between 0 and 1 */
+ break;
+ }
+ case 1: { /* only upper limit */
+ int u = luaL_check_int(L, 1);
+ luaL_arg_check(L, 1<=u, 1, "interval is empty");
+ lua_pushnumber(L, (int)(r*u)+1); /* integer between 1 and `u' */
+ break;
+ }
+ case 2: { /* lower and upper limits */
+ int l = luaL_check_int(L, 1);
+ int u = luaL_check_int(L, 2);
+ luaL_arg_check(L, l<=u, 2, "interval is empty");
+ lua_pushnumber(L, (int)(r*(u-l+1))+l); /* integer between `l' and `u' */
+ break;
+ }
+ default: lua_error(L, "wrong number of arguments");
+ }
+ return 1;
+}
+
+
+static int math_randomseed (lua_State *L) {
+ srand(luaL_check_int(L, 1));
+ return 0;
+}
+
+
+static const struct luaL_reg mathlib[] = {
+{"abs", math_abs},
+{"sin", math_sin},
+{"cos", math_cos},
+{"tan", math_tan},
+{"asin", math_asin},
+{"acos", math_acos},
+{"atan", math_atan},
+{"atan2", math_atan2},
+{"ceil", math_ceil},
+{"floor", math_floor},
+{"mod", math_mod},
+{"frexp", math_frexp},
+{"ldexp", math_ldexp},
+{"sqrt", math_sqrt},
+{"min", math_min},
+{"max", math_max},
+{"log", math_log},
+{"log10", math_log10},
+{"exp", math_exp},
+{"deg", math_deg},
+{"rad", math_rad},
+{"random", math_random},
+{"randomseed", math_randomseed}
+};
+
+/*
+** Open math library
+*/
+LUALIB_API void lua_mathlibopen (lua_State *L) {
+ luaL_openl(L, mathlib);
+ lua_pushcfunction(L, math_pow);
+ lua_settagmethod(L, LUA_TNUMBER, "pow");
+ lua_pushnumber(L, PI);
+ lua_setglobal(L, "PI");
+}
+
diff --git a/lua/src/lib/lstrlib.c b/lua/src/lib/lstrlib.c
new file mode 100644
index 0000000..9f1840d
--- /dev/null
+++ b/lua/src/lib/lstrlib.c
@@ -0,0 +1,621 @@
+/*
+** $Id: lstrlib.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Standard library for string operations and pattern-matching
+** See Copyright Notice in lua.h
+*/
+
+
+#include <ctype.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "lauxlib.h"
+#include "lualib.h"
+
+
+
+static int str_len (lua_State *L) {
+ size_t l;
+ luaL_check_lstr(L, 1, &l);
+ lua_pushnumber(L, l);
+ return 1;
+}
+
+
+static long posrelat (long pos, size_t len) {
+ /* relative string position: negative means back from end */
+ return (pos>=0) ? pos : (long)len+pos+1;
+}
+
+
+static int str_sub (lua_State *L) {
+ size_t l;
+ const char *s = luaL_check_lstr(L, 1, &l);
+ long start = posrelat(luaL_check_long(L, 2), l);
+ long end = posrelat(luaL_opt_long(L, 3, -1), l);
+ if (start < 1) start = 1;
+ if (end > (long)l) end = l;
+ if (start <= end)
+ lua_pushlstring(L, s+start-1, end-start+1);
+ else lua_pushstring(L, "");
+ return 1;
+}
+
+
+static int str_lower (lua_State *L) {
+ size_t l;
+ size_t i;
+ luaL_Buffer b;
+ const char *s = luaL_check_lstr(L, 1, &l);
+ luaL_buffinit(L, &b);
+ for (i=0; i<l; i++)
+ luaL_putchar(&b, tolower((unsigned char)(s[i])));
+ luaL_pushresult(&b);
+ return 1;
+}
+
+
+static int str_upper (lua_State *L) {
+ size_t l;
+ size_t i;
+ luaL_Buffer b;
+ const char *s = luaL_check_lstr(L, 1, &l);
+ luaL_buffinit(L, &b);
+ for (i=0; i<l; i++)
+ luaL_putchar(&b, toupper((unsigned char)(s[i])));
+ luaL_pushresult(&b);
+ return 1;
+}
+
+static int str_rep (lua_State *L) {
+ size_t l;
+ luaL_Buffer b;
+ const char *s = luaL_check_lstr(L, 1, &l);
+ int n = luaL_check_int(L, 2);
+ luaL_buffinit(L, &b);
+ while (n-- > 0)
+ luaL_addlstring(&b, s, l);
+ luaL_pushresult(&b);
+ return 1;
+}
+
+
+static int str_byte (lua_State *L) {
+ size_t l;
+ const char *s = luaL_check_lstr(L, 1, &l);
+ long pos = posrelat(luaL_opt_long(L, 2, 1), l);
+ luaL_arg_check(L, 0<pos && (size_t)pos<=l, 2, "out of range");
+ lua_pushnumber(L, (unsigned char)s[pos-1]);
+ return 1;
+}
+
+
+static int str_char (lua_State *L) {
+ int n = lua_gettop(L); /* number of arguments */
+ int i;
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ for (i=1; i<=n; i++) {
+ int c = luaL_check_int(L, i);
+ luaL_arg_check(L, (unsigned char)c == c, i, "invalid value");
+ luaL_putchar(&b, (unsigned char)c);
+ }
+ luaL_pushresult(&b);
+ return 1;
+}
+
+
+
+/*
+** {======================================================
+** PATTERN MATCHING
+** =======================================================
+*/
+
+#ifndef MAX_CAPTURES
+#define MAX_CAPTURES 32 /* arbitrary limit */
+#endif
+
+
+struct Capture {
+ const char *src_end; /* end ('\0') of source string */
+ int level; /* total number of captures (finished or unfinished) */
+ struct {
+ const char *init;
+ long len; /* -1 signals unfinished capture */
+ } capture[MAX_CAPTURES];
+};
+
+
+#define ESC '%'
+#define SPECIALS "^$*+?.([%-"
+
+
+static int check_capture (lua_State *L, int l, struct Capture *cap) {
+ l -= '1';
+ if (!(0 <= l && l < cap->level && cap->capture[l].len != -1))
+ lua_error(L, "invalid capture index");
+ return l;
+}
+
+
+static int capture_to_close (lua_State *L, struct Capture *cap) {
+ int level = cap->level;
+ for (level--; level>=0; level--)
+ if (cap->capture[level].len == -1) return level;
+ lua_error(L, "invalid pattern capture");
+ return 0; /* to avoid warnings */
+}
+
+
+const char *luaI_classend (lua_State *L, const char *p) {
+ switch (*p++) {
+ case ESC:
+ if (*p == '\0') lua_error(L, "malformed pattern (ends with `%')");
+ return p+1;
+ case '[':
+ if (*p == '^') p++;
+ do { /* look for a ']' */
+ if (*p == '\0') lua_error(L, "malformed pattern (missing `]')");
+ if (*(p++) == ESC && *p != '\0') p++; /* skip escapes (e.g. '%]') */
+ } while (*p != ']');
+ return p+1;
+ default:
+ return p;
+ }
+}
+
+
+static int match_class (int c, int cl) {
+ int res;
+ switch (tolower(cl)) {
+ case 'a' : res = isalpha(c); break;
+ case 'c' : res = iscntrl(c); break;
+ case 'd' : res = isdigit(c); break;
+ case 'l' : res = islower(c); break;
+ case 'p' : res = ispunct(c); break;
+ case 's' : res = isspace(c); break;
+ case 'u' : res = isupper(c); break;
+ case 'w' : res = isalnum(c); break;
+ case 'x' : res = isxdigit(c); break;
+ case 'z' : res = (c == '\0'); break;
+ default: return (cl == c);
+ }
+ return (islower(cl) ? res : !res);
+}
+
+
+
+static int matchbracketclass (int c, const char *p, const char *endclass) {
+ int sig = 1;
+ if (*(p+1) == '^') {
+ sig = 0;
+ p++; /* skip the '^' */
+ }
+ while (++p < endclass) {
+ if (*p == ESC) {
+ p++;
+ if (match_class(c, (unsigned char)*p))
+ return sig;
+ }
+ else if ((*(p+1) == '-') && (p+2 < endclass)) {
+ p+=2;
+ if ((int)(unsigned char)*(p-2) <= c && c <= (int)(unsigned char)*p)
+ return sig;
+ }
+ else if ((int)(unsigned char)*p == c) return sig;
+ }
+ return !sig;
+}
+
+
+
+int luaI_singlematch (int c, const char *p, const char *ep) {
+ switch (*p) {
+ case '.': /* matches any char */
+ return 1;
+ case ESC:
+ return match_class(c, (unsigned char)*(p+1));
+ case '[':
+ return matchbracketclass(c, p, ep-1);
+ default:
+ return ((unsigned char)*p == c);
+ }
+}
+
+
+static const char *match (lua_State *L, const char *s, const char *p,
+ struct Capture *cap);
+
+
+static const char *matchbalance (lua_State *L, const char *s, const char *p,
+ struct Capture *cap) {
+ if (*p == 0 || *(p+1) == 0)
+ lua_error(L, "unbalanced pattern");
+ if (*s != *p) return NULL;
+ else {
+ int b = *p;
+ int e = *(p+1);
+ int cont = 1;
+ while (++s < cap->src_end) {
+ if (*s == e) {
+ if (--cont == 0) return s+1;
+ }
+ else if (*s == b) cont++;
+ }
+ }
+ return NULL; /* string ends out of balance */
+}
+
+
+static const char *max_expand (lua_State *L, const char *s, const char *p,
+ const char *ep, struct Capture *cap) {
+ long i = 0; /* counts maximum expand for item */
+ while ((s+i)<cap->src_end && luaI_singlematch((unsigned char)*(s+i), p, ep))
+ i++;
+ /* keeps trying to match with the maximum repetitions */
+ while (i>=0) {
+ const char *res = match(L, (s+i), ep+1, cap);
+ if (res) return res;
+ i--; /* else didn't match; reduce 1 repetition to try again */
+ }
+ return NULL;
+}
+
+
+static const char *min_expand (lua_State *L, const char *s, const char *p,
+ const char *ep, struct Capture *cap) {
+ for (;;) {
+ const char *res = match(L, s, ep+1, cap);
+ if (res != NULL)
+ return res;
+ else if (s<cap->src_end && luaI_singlematch((unsigned char)*s, p, ep))
+ s++; /* try with one more repetition */
+ else return NULL;
+ }
+}
+
+
+static const char *start_capture (lua_State *L, const char *s, const char *p,
+ struct Capture *cap) {
+ const char *res;
+ int level = cap->level;
+ if (level >= MAX_CAPTURES) lua_error(L, "too many captures");
+ cap->capture[level].init = s;
+ cap->capture[level].len = -1;
+ cap->level = level+1;
+ if ((res=match(L, s, p+1, cap)) == NULL) /* match failed? */
+ cap->level--; /* undo capture */
+ return res;
+}
+
+
+static const char *end_capture (lua_State *L, const char *s, const char *p,
+ struct Capture *cap) {
+ int l = capture_to_close(L, cap);
+ const char *res;
+ cap->capture[l].len = s - cap->capture[l].init; /* close capture */
+ if ((res = match(L, s, p+1, cap)) == NULL) /* match failed? */
+ cap->capture[l].len = -1; /* undo capture */
+ return res;
+}
+
+
+static const char *match_capture (lua_State *L, const char *s, int level,
+ struct Capture *cap) {
+ int l = check_capture(L, level, cap);
+ size_t len = cap->capture[l].len;
+ if ((size_t)(cap->src_end-s) >= len &&
+ memcmp(cap->capture[l].init, s, len) == 0)
+ return s+len;
+ else return NULL;
+}
+
+
+static const char *match (lua_State *L, const char *s, const char *p,
+ struct Capture *cap) {
+ init: /* using goto's to optimize tail recursion */
+ switch (*p) {
+ case '(': /* start capture */
+ return start_capture(L, s, p, cap);
+ case ')': /* end capture */
+ return end_capture(L, s, p, cap);
+ case ESC: /* may be %[0-9] or %b */
+ if (isdigit((unsigned char)(*(p+1)))) { /* capture? */
+ s = match_capture(L, s, *(p+1), cap);
+ if (s == NULL) return NULL;
+ p+=2; goto init; /* else return match(L, s, p+2, cap) */
+ }
+ else if (*(p+1) == 'b') { /* balanced string? */
+ s = matchbalance(L, s, p+2, cap);
+ if (s == NULL) return NULL;
+ p+=4; goto init; /* else return match(L, s, p+4, cap); */
+ }
+ else goto dflt; /* case default */
+ case '\0': /* end of pattern */
+ return s; /* match succeeded */
+ case '$':
+ if (*(p+1) == '\0') /* is the '$' the last char in pattern? */
+ return (s == cap->src_end) ? s : NULL; /* check end of string */
+ else goto dflt;
+ default: dflt: { /* it is a pattern item */
+ const char *ep = luaI_classend(L, p); /* points to what is next */
+ int m = s<cap->src_end && luaI_singlematch((unsigned char)*s, p, ep);
+ switch (*ep) {
+ case '?': { /* optional */
+ const char *res;
+ if (m && ((res=match(L, s+1, ep+1, cap)) != NULL))
+ return res;
+ p=ep+1; goto init; /* else return match(L, s, ep+1, cap); */
+ }
+ case '*': /* 0 or more repetitions */
+ return max_expand(L, s, p, ep, cap);
+ case '+': /* 1 or more repetitions */
+ return (m ? max_expand(L, s+1, p, ep, cap) : NULL);
+ case '-': /* 0 or more repetitions (minimum) */
+ return min_expand(L, s, p, ep, cap);
+ default:
+ if (!m) return NULL;
+ s++; p=ep; goto init; /* else return match(L, s+1, ep, cap); */
+ }
+ }
+ }
+}
+
+
+
+static const char *lmemfind (const char *s1, size_t l1,
+ const char *s2, size_t l2) {
+ if (l2 == 0) return s1; /* empty strings are everywhere */
+ else if (l2 > l1) return NULL; /* avoids a negative `l1' */
+ else {
+ const char *init; /* to search for a `*s2' inside `s1' */
+ l2--; /* 1st char will be checked by `memchr' */
+ l1 = l1-l2; /* `s2' cannot be found after that */
+ while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) {
+ init++; /* 1st char is already checked */
+ if (memcmp(init, s2+1, l2) == 0)
+ return init-1;
+ else { /* correct `l1' and `s1' to try again */
+ l1 -= init-s1;
+ s1 = init;
+ }
+ }
+ return NULL; /* not found */
+ }
+}
+
+
+static int push_captures (lua_State *L, struct Capture *cap) {
+ int i;
+ luaL_checkstack(L, cap->level, "too many captures");
+ for (i=0; i<cap->level; i++) {
+ int l = cap->capture[i].len;
+ if (l == -1) lua_error(L, "unfinished capture");
+ lua_pushlstring(L, cap->capture[i].init, l);
+ }
+ return cap->level; /* number of strings pushed */
+}
+
+
+static int str_find (lua_State *L) {
+ size_t l1, l2;
+ const char *s = luaL_check_lstr(L, 1, &l1);
+ const char *p = luaL_check_lstr(L, 2, &l2);
+ long init = posrelat(luaL_opt_long(L, 3, 1), l1) - 1;
+ struct Capture cap;
+ luaL_arg_check(L, 0 <= init && (size_t)init <= l1, 3, "out of range");
+ if (lua_gettop(L) > 3 || /* extra argument? */
+ strpbrk(p, SPECIALS) == NULL) { /* or no special characters? */
+ const char *s2 = lmemfind(s+init, l1-init, p, l2);
+ if (s2) {
+ lua_pushnumber(L, s2-s+1);
+ lua_pushnumber(L, s2-s+l2);
+ return 2;
+ }
+ }
+ else {
+ int anchor = (*p == '^') ? (p++, 1) : 0;
+ const char *s1=s+init;
+ cap.src_end = s+l1;
+ do {
+ const char *res;
+ cap.level = 0;
+ if ((res=match(L, s1, p, &cap)) != NULL) {
+ lua_pushnumber(L, s1-s+1); /* start */
+ lua_pushnumber(L, res-s); /* end */
+ return push_captures(L, &cap) + 2;
+ }
+ } while (s1++<cap.src_end && !anchor);
+ }
+ lua_pushnil(L); /* not found */
+ return 1;
+}
+
+
+static void add_s (lua_State *L, luaL_Buffer *b, struct Capture *cap) {
+ if (lua_isstring(L, 3)) {
+ const char *news = lua_tostring(L, 3);
+ size_t l = lua_strlen(L, 3);
+ size_t i;
+ for (i=0; i<l; i++) {
+ if (news[i] != ESC)
+ luaL_putchar(b, news[i]);
+ else {
+ i++; /* skip ESC */
+ if (!isdigit((unsigned char)news[i]))
+ luaL_putchar(b, news[i]);
+ else {
+ int level = check_capture(L, news[i], cap);
+ luaL_addlstring(b, cap->capture[level].init, cap->capture[level].len);
+ }
+ }
+ }
+ }
+ else { /* is a function */
+ int n;
+ lua_pushvalue(L, 3);
+ n = push_captures(L, cap);
+ lua_rawcall(L, n, 1);
+ if (lua_isstring(L, -1))
+ luaL_addvalue(b); /* add return to accumulated result */
+ else
+ lua_pop(L, 1); /* function result is not a string: pop it */
+ }
+}
+
+
+static int str_gsub (lua_State *L) {
+ size_t srcl;
+ const char *src = luaL_check_lstr(L, 1, &srcl);
+ const char *p = luaL_check_string(L, 2);
+ int max_s = luaL_opt_int(L, 4, srcl+1);
+ int anchor = (*p == '^') ? (p++, 1) : 0;
+ int n = 0;
+ struct Capture cap;
+ luaL_Buffer b;
+ luaL_arg_check(L,
+ lua_gettop(L) >= 3 && (lua_isstring(L, 3) || lua_isfunction(L, 3)),
+ 3, "string or function expected");
+ luaL_buffinit(L, &b);
+ cap.src_end = src+srcl;
+ while (n < max_s) {
+ const char *e;
+ cap.level = 0;
+ e = match(L, src, p, &cap);
+ if (e) {
+ n++;
+ add_s(L, &b, &cap);
+ }
+ if (e && e>src) /* non empty match? */
+ src = e; /* skip it */
+ else if (src < cap.src_end)
+ luaL_putchar(&b, *src++);
+ else break;
+ if (anchor) break;
+ }
+ luaL_addlstring(&b, src, cap.src_end-src);
+ luaL_pushresult(&b);
+ lua_pushnumber(L, n); /* number of substitutions */
+ return 2;
+}
+
+/* }====================================================== */
+
+
+static void luaI_addquoted (lua_State *L, luaL_Buffer *b, int arg) {
+ size_t l;
+ const char *s = luaL_check_lstr(L, arg, &l);
+ luaL_putchar(b, '"');
+ while (l--) {
+ switch (*s) {
+ case '"': case '\\': case '\n':
+ luaL_putchar(b, '\\');
+ luaL_putchar(b, *s);
+ break;
+ case '\0': luaL_addlstring(b, "\\000", 4); break;
+ default: luaL_putchar(b, *s);
+ }
+ s++;
+ }
+ luaL_putchar(b, '"');
+}
+
+/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */
+#define MAX_ITEM 512
+/* maximum size of each format specification (such as '%-099.99d') */
+#define MAX_FORMAT 20
+
+static int str_format (lua_State *L) {
+ int arg = 1;
+ const char *strfrmt = luaL_check_string(L, arg);
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ while (*strfrmt) {
+ if (*strfrmt != '%')
+ luaL_putchar(&b, *strfrmt++);
+ else if (*++strfrmt == '%')
+ luaL_putchar(&b, *strfrmt++); /* %% */
+ else { /* format item */
+ struct Capture cap;
+ char form[MAX_FORMAT]; /* to store the format ('%...') */
+ char buff[MAX_ITEM]; /* to store the formatted item */
+ const char *initf = strfrmt;
+ form[0] = '%';
+ if (isdigit((unsigned char)*initf) && *(initf+1) == '$') {
+ arg = *initf - '0';
+ initf += 2; /* skip the 'n$' */
+ }
+ arg++;
+ cap.src_end = strfrmt+strlen(strfrmt)+1;
+ cap.level = 0;
+ strfrmt = match(L, initf, "[-+ #0]*(%d*)%.?(%d*)", &cap);
+ if (cap.capture[0].len > 2 || cap.capture[1].len > 2 || /* < 100? */
+ strfrmt-initf > MAX_FORMAT-2)
+ lua_error(L, "invalid format (width or precision too long)");
+ strncpy(form+1, initf, strfrmt-initf+1); /* +1 to include conversion */
+ form[strfrmt-initf+2] = 0;
+ switch (*strfrmt++) {
+ case 'c': case 'd': case 'i':
+ sprintf(buff, form, luaL_check_int(L, arg));
+ break;
+ case 'o': case 'u': case 'x': case 'X':
+ sprintf(buff, form, (unsigned int)luaL_check_number(L, arg));
+ break;
+ case 'e': case 'E': case 'f': case 'g': case 'G':
+ sprintf(buff, form, luaL_check_number(L, arg));
+ break;
+ case 'q':
+ luaI_addquoted(L, &b, arg);
+ continue; /* skip the "addsize" at the end */
+ case 's': {
+ size_t l;
+ const char *s = luaL_check_lstr(L, arg, &l);
+ if (cap.capture[1].len == 0 && l >= 100) {
+ /* no precision and string is too long to be formatted;
+ keep original string */
+ lua_pushvalue(L, arg);
+ luaL_addvalue(&b);
+ continue; /* skip the "addsize" at the end */
+ }
+ else {
+ sprintf(buff, form, s);
+ break;
+ }
+ }
+ default: /* also treat cases 'pnLlh' */
+ lua_error(L, "invalid option in `format'");
+ }
+ luaL_addlstring(&b, buff, strlen(buff));
+ }
+ }
+ luaL_pushresult(&b);
+ return 1;
+}
+
+
+static const struct luaL_reg strlib[] = {
+{"strlen", str_len},
+{"strsub", str_sub},
+{"strlower", str_lower},
+{"strupper", str_upper},
+{"strchar", str_char},
+{"strrep", str_rep},
+{"ascii", str_byte}, /* for compatibility with 3.0 and earlier */
+{"strbyte", str_byte},
+{"format", str_format},
+{"strfind", str_find},
+{"gsub", str_gsub}
+};
+
+
+/*
+** Open string library
+*/
+LUALIB_API void lua_strlibopen (lua_State *L) {
+ luaL_openl(L, strlib);
+}
diff --git a/lua/src/llex.c b/lua/src/llex.c
new file mode 100644
index 0000000..c05aca0
--- /dev/null
+++ b/lua/src/llex.c
@@ -0,0 +1,380 @@
+/*
+** $Id: llex.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Lexical Analyzer
+** See Copyright Notice in lua.h
+*/
+
+
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "llex.h"
+#include "lmem.h"
+#include "lobject.h"
+#include "lparser.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+#include "luadebug.h"
+#include "lzio.h"
+
+
+
+#define next(LS) (LS->current = zgetc(LS->z))
+
+
+
+/* ORDER RESERVED */
+static const char *const token2string [] = {
+ "and", "break", "do", "else", "elseif", "end", "for",
+ "function", "if", "local", "nil", "not", "or", "repeat", "return", "then",
+ "until", "while", "", "..", "...", "==", ">=", "<=", "~=", "", "", "<eof>"};
+
+
+void luaX_init (lua_State *L) {
+ int i;
+ for (i=0; i<NUM_RESERVED; i++) {
+ TString *ts = luaS_new(L, token2string[i]);
+ ts->marked = (unsigned char)(RESERVEDMARK+i); /* reserved word */
+ }
+}
+
+
+#define MAXSRC 80
+
+
+void luaX_checklimit (LexState *ls, int val, int limit, const char *msg) {
+ if (val > limit) {
+ char buff[100];
+ sprintf(buff, "too many %.50s (limit=%d)", msg, limit);
+ luaX_error(ls, buff, ls->t.token);
+ }
+}
+
+
+void luaX_syntaxerror (LexState *ls, const char *s, const char *token) {
+ char buff[MAXSRC];
+ luaO_chunkid(buff, ls->source->str, sizeof(buff));
+ luaO_verror(ls->L, "%.99s;\n last token read: `%.30s' at line %d in %.80s",
+ s, token, ls->linenumber, buff);
+}
+
+
+void luaX_error (LexState *ls, const char *s, int token) {
+ char buff[TOKEN_LEN];
+ luaX_token2str(token, buff);
+ if (buff[0] == '\0')
+ luaX_syntaxerror(ls, s, ls->L->Mbuffer);
+ else
+ luaX_syntaxerror(ls, s, buff);
+}
+
+
+void luaX_token2str (int token, char *s) {
+ if (token < 256) {
+ s[0] = (char)token;
+ s[1] = '\0';
+ }
+ else
+ strcpy(s, token2string[token-FIRST_RESERVED]);
+}
+
+
+static void luaX_invalidchar (LexState *ls, int c) {
+ char buff[8];
+ sprintf(buff, "0x%02X", c);
+ luaX_syntaxerror(ls, "invalid control char", buff);
+}
+
+
+static void inclinenumber (LexState *LS) {
+ next(LS); /* skip '\n' */
+ ++LS->linenumber;
+ luaX_checklimit(LS, LS->linenumber, MAX_INT, "lines in a chunk");
+}
+
+
+void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source) {
+ LS->L = L;
+ LS->lookahead.token = TK_EOS; /* no look-ahead token */
+ LS->z = z;
+ LS->fs = NULL;
+ LS->linenumber = 1;
+ LS->lastline = 1;
+ LS->source = source;
+ next(LS); /* read first char */
+ if (LS->current == '#') {
+ do { /* skip first line */
+ next(LS);
+ } while (LS->current != '\n' && LS->current != EOZ);
+ }
+}
+
+
+
+/*
+** =======================================================
+** LEXICAL ANALYZER
+** =======================================================
+*/
+
+
+/* use Mbuffer to store names, literal strings and numbers */
+
+#define EXTRABUFF 128
+#define checkbuffer(L, n, len) if ((len)+(n) > L->Mbuffsize) \
+ luaO_openspace(L, (len)+(n)+EXTRABUFF)
+
+#define save(L, c, l) (L->Mbuffer[l++] = (char)c)
+#define save_and_next(L, LS, l) (save(L, LS->current, l), next(LS))
+
+
+static const char *readname (LexState *LS) {
+ lua_State *L = LS->L;
+ size_t l = 0;
+ checkbuffer(L, 10, l);
+ do {
+ checkbuffer(L, 10, l);
+ save_and_next(L, LS, l);
+ } while (isalnum(LS->current) || LS->current == '_');
+ save(L, '\0', l);
+ return L->Mbuffer;
+}
+
+
+/* LUA_NUMBER */
+static void read_number (LexState *LS, int comma, SemInfo *seminfo) {
+ lua_State *L = LS->L;
+ size_t l = 0;
+ checkbuffer(L, 10, l);
+ if (comma) save(L, '.', l);
+ while (isdigit(LS->current)) {
+ checkbuffer(L, 10, l);
+ save_and_next(L, LS, l);
+ }
+ if (LS->current == '.') {
+ save_and_next(L, LS, l);
+ if (LS->current == '.') {
+ save_and_next(L, LS, l);
+ save(L, '\0', l);
+ luaX_error(LS, "ambiguous syntax"
+ " (decimal point x string concatenation)", TK_NUMBER);
+ }
+ }
+ while (isdigit(LS->current)) {
+ checkbuffer(L, 10, l);
+ save_and_next(L, LS, l);
+ }
+ if (LS->current == 'e' || LS->current == 'E') {
+ save_and_next(L, LS, l); /* read 'E' */
+ if (LS->current == '+' || LS->current == '-')
+ save_and_next(L, LS, l); /* optional exponent sign */
+ while (isdigit(LS->current)) {
+ checkbuffer(L, 10, l);
+ save_and_next(L, LS, l);
+ }
+ }
+ save(L, '\0', l);
+ if (!luaO_str2d(L->Mbuffer, &seminfo->r))
+ luaX_error(LS, "malformed number", TK_NUMBER);
+}
+
+
+static void read_long_string (LexState *LS, SemInfo *seminfo) {
+ lua_State *L = LS->L;
+ int cont = 0;
+ size_t l = 0;
+ checkbuffer(L, 10, l);
+ save(L, '[', l); /* save first '[' */
+ save_and_next(L, LS, l); /* pass the second '[' */
+ for (;;) {
+ checkbuffer(L, 10, l);
+ switch (LS->current) {
+ case EOZ:
+ save(L, '\0', l);
+ luaX_error(LS, "unfinished long string", TK_STRING);
+ break; /* to avoid warnings */
+ case '[':
+ save_and_next(L, LS, l);
+ if (LS->current == '[') {
+ cont++;
+ save_and_next(L, LS, l);
+ }
+ continue;
+ case ']':
+ save_and_next(L, LS, l);
+ if (LS->current == ']') {
+ if (cont == 0) goto endloop;
+ cont--;
+ save_and_next(L, LS, l);
+ }
+ continue;
+ case '\n':
+ save(L, '\n', l);
+ inclinenumber(LS);
+ continue;
+ default:
+ save_and_next(L, LS, l);
+ }
+ } endloop:
+ save_and_next(L, LS, l); /* skip the second ']' */
+ save(L, '\0', l);
+ seminfo->ts = luaS_newlstr(L, L->Mbuffer+2, l-5);
+}
+
+
+static void read_string (LexState *LS, int del, SemInfo *seminfo) {
+ lua_State *L = LS->L;
+ size_t l = 0;
+ checkbuffer(L, 10, l);
+ save_and_next(L, LS, l);
+ while (LS->current != del) {
+ checkbuffer(L, 10, l);
+ switch (LS->current) {
+ case EOZ: case '\n':
+ save(L, '\0', l);
+ luaX_error(LS, "unfinished string", TK_STRING);
+ break; /* to avoid warnings */
+ case '\\':
+ next(LS); /* do not save the '\' */
+ switch (LS->current) {
+ case 'a': save(L, '\a', l); next(LS); break;
+ case 'b': save(L, '\b', l); next(LS); break;
+ case 'f': save(L, '\f', l); next(LS); break;
+ case 'n': save(L, '\n', l); next(LS); break;
+ case 'r': save(L, '\r', l); next(LS); break;
+ case 't': save(L, '\t', l); next(LS); break;
+ case 'v': save(L, '\v', l); next(LS); break;
+ case '\n': save(L, '\n', l); inclinenumber(LS); break;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9': {
+ int c = 0;
+ int i = 0;
+ do {
+ c = 10*c + (LS->current-'0');
+ next(LS);
+ } while (++i<3 && isdigit(LS->current));
+ if (c != (unsigned char)c) {
+ save(L, '\0', l);
+ luaX_error(LS, "escape sequence too large", TK_STRING);
+ }
+ save(L, c, l);
+ break;
+ }
+ default: /* handles \\, \", \', and \? */
+ save_and_next(L, LS, l);
+ }
+ break;
+ default:
+ save_and_next(L, LS, l);
+ }
+ }
+ save_and_next(L, LS, l); /* skip delimiter */
+ save(L, '\0', l);
+ seminfo->ts = luaS_newlstr(L, L->Mbuffer+1, l-3);
+}
+
+
+int luaX_lex (LexState *LS, SemInfo *seminfo) {
+ for (;;) {
+ switch (LS->current) {
+
+ case ' ': case '\t': case '\r': /* `\r' to avoid problems with DOS */
+ next(LS);
+ continue;
+
+ case '\n':
+ inclinenumber(LS);
+ continue;
+
+ case '$':
+ luaX_error(LS, "unexpected `$' (pragmas are no longer supported)", '$');
+ break;
+
+ case '-':
+ next(LS);
+ if (LS->current != '-') return '-';
+ do { next(LS); } while (LS->current != '\n' && LS->current != EOZ);
+ continue;
+
+ case '[':
+ next(LS);
+ if (LS->current != '[') return '[';
+ else {
+ read_long_string(LS, seminfo);
+ return TK_STRING;
+ }
+
+ case '=':
+ next(LS);
+ if (LS->current != '=') return '=';
+ else { next(LS); return TK_EQ; }
+
+ case '<':
+ next(LS);
+ if (LS->current != '=') return '<';
+ else { next(LS); return TK_LE; }
+
+ case '>':
+ next(LS);
+ if (LS->current != '=') return '>';
+ else { next(LS); return TK_GE; }
+
+ case '~':
+ next(LS);
+ if (LS->current != '=') return '~';
+ else { next(LS); return TK_NE; }
+
+ case '"':
+ case '\'':
+ read_string(LS, LS->current, seminfo);
+ return TK_STRING;
+
+ case '.':
+ next(LS);
+ if (LS->current == '.') {
+ next(LS);
+ if (LS->current == '.') {
+ next(LS);
+ return TK_DOTS; /* ... */
+ }
+ else return TK_CONCAT; /* .. */
+ }
+ else if (!isdigit(LS->current)) return '.';
+ else {
+ read_number(LS, 1, seminfo);
+ return TK_NUMBER;
+ }
+
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ read_number(LS, 0, seminfo);
+ return TK_NUMBER;
+
+ case EOZ:
+ return TK_EOS;
+
+ case '_': goto tname;
+
+ default:
+ if (!isalpha(LS->current)) {
+ int c = LS->current;
+ if (iscntrl(c))
+ luaX_invalidchar(LS, c);
+ next(LS);
+ return c;
+ }
+ tname: { /* identifier or reserved word */
+ TString *ts = luaS_new(LS->L, readname(LS));
+ if (ts->marked >= RESERVEDMARK) /* reserved word? */
+ return ts->marked-RESERVEDMARK+FIRST_RESERVED;
+ seminfo->ts = ts;
+ return TK_NAME;
+ }
+ }
+ }
+}
+
diff --git a/lua/src/llex.h b/lua/src/llex.h
new file mode 100644
index 0000000..f0991fe
--- /dev/null
+++ b/lua/src/llex.h
@@ -0,0 +1,72 @@
+/*
+** $Id: llex.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Lexical Analyzer
+** See Copyright Notice in lua.h
+*/
+
+#ifndef llex_h
+#define llex_h
+
+#include "lobject.h"
+#include "lzio.h"
+
+
+#define FIRST_RESERVED 257
+
+/* maximum length of a reserved word (+1 for final 0) */
+#define TOKEN_LEN 15
+
+
+/*
+* WARNING: if you change the order of this enumeration,
+* grep "ORDER RESERVED"
+*/
+enum RESERVED {
+ /* terminal symbols denoted by reserved words */
+ TK_AND = FIRST_RESERVED, TK_BREAK,
+ TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FOR, TK_FUNCTION, TK_IF, TK_LOCAL,
+ TK_NIL, TK_NOT, TK_OR, TK_REPEAT, TK_RETURN, TK_THEN, TK_UNTIL, TK_WHILE,
+ /* other terminal symbols */
+ TK_NAME, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
+ TK_STRING, TK_EOS
+};
+
+/* number of reserved words */
+#define NUM_RESERVED ((int)(TK_WHILE-FIRST_RESERVED+1))
+
+
+typedef union {
+ Number r;
+ TString *ts;
+} SemInfo; /* semantics information */
+
+
+typedef struct Token {
+ int token;
+ SemInfo seminfo;
+} Token;
+
+
+typedef struct LexState {
+ int current; /* current character */
+ Token t; /* current token */
+ Token lookahead; /* look ahead token */
+ struct FuncState *fs; /* `FuncState' is private to the parser */
+ struct lua_State *L;
+ struct zio *z; /* input stream */
+ int linenumber; /* input line counter */
+ int lastline; /* line of last token `consumed' */
+ TString *source; /* current source name */
+} LexState;
+
+
+void luaX_init (lua_State *L);
+void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source);
+int luaX_lex (LexState *LS, SemInfo *seminfo);
+void luaX_checklimit (LexState *ls, int val, int limit, const char *msg);
+void luaX_syntaxerror (LexState *ls, const char *s, const char *token);
+void luaX_error (LexState *ls, const char *s, int token);
+void luaX_token2str (int token, char *s);
+
+
+#endif
diff --git a/lua/src/llimits.h b/lua/src/llimits.h
new file mode 100644
index 0000000..11be2f7
--- /dev/null
+++ b/lua/src/llimits.h
@@ -0,0 +1,204 @@
+/*
+** $Id: llimits.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Limits, basic types, and some other "installation-dependent" definitions
+** See Copyright Notice in lua.h
+*/
+
+#ifndef llimits_h
+#define llimits_h
+
+
+#include <limits.h>
+#include <stddef.h>
+
+
+
+/*
+** try to find number of bits in an integer
+*/
+#ifndef BITS_INT
+/* avoid overflows in comparison */
+#if INT_MAX-20 < 32760
+#define BITS_INT 16
+#else
+#if INT_MAX > 2147483640L
+/* machine has at least 32 bits */
+#define BITS_INT 32
+#else
+#error "you must define BITS_INT with number of bits in an integer"
+#endif
+#endif
+#endif
+
+
+/*
+** Define the type `number' of Lua
+** GREP LUA_NUMBER to change that
+*/
+#ifndef LUA_NUM_TYPE
+#define LUA_NUM_TYPE double
+#endif
+
+typedef LUA_NUM_TYPE Number;
+
+/* function to convert a Number to a string */
+#define NUMBER_FMT "%.16g" /* LUA_NUMBER */
+#define lua_number2str(s,n) sprintf((s), NUMBER_FMT, (n))
+
+/* function to convert a string to a Number */
+#define lua_str2number(s,p) strtod((s), (p))
+
+
+
+typedef unsigned long lint32; /* unsigned int with at least 32 bits */
+
+
+#define MAX_SIZET ((size_t)(~(size_t)0)-2)
+
+
+#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
+
+/*
+** conversion of pointer to int (for hashing only)
+** (the shift removes bits that are usually 0 because of alignment)
+*/
+#define IntPoint(p) (((unsigned long)(p)) >> 3)
+
+
+
+#define MINPOWER2 4 /* minimum size for "growing" vectors */
+
+
+
+#ifndef DEFAULT_STACK_SIZE
+#define DEFAULT_STACK_SIZE 1024
+#endif
+
+
+
+/* type to ensure maximum alignment */
+union L_Umaxalign { double d; char *s; long l; };
+
+
+
+/*
+** type for virtual-machine instructions
+** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
+** For a very small machine, you may change that to 2 bytes (and adjust
+** the following limits accordingly)
+*/
+typedef unsigned long Instruction;
+
+
+/*
+** size and position of opcode arguments.
+** For an instruction with 2 bytes, size is 16, and size_b can be 5
+** (accordingly, size_u will be 10, and size_a will be 5)
+*/
+#define SIZE_INSTRUCTION 32
+#define SIZE_B 9
+
+#define SIZE_OP 6
+#define SIZE_U (SIZE_INSTRUCTION-SIZE_OP)
+#define POS_U SIZE_OP
+#define POS_B SIZE_OP
+#define SIZE_A (SIZE_INSTRUCTION-(SIZE_OP+SIZE_B))
+#define POS_A (SIZE_OP+SIZE_B)
+
+
+/*
+** limits for opcode arguments.
+** we use (signed) int to manipulate most arguments,
+** so they must fit in BITS_INT-1 bits (-1 for sign)
+*/
+#if SIZE_U < BITS_INT-1
+#define MAXARG_U ((1<<SIZE_U)-1)
+#define MAXARG_S (MAXARG_U>>1) /* `S' is signed */
+#else
+#define MAXARG_U MAX_INT
+#define MAXARG_S MAX_INT
+#endif
+
+#if SIZE_A < BITS_INT-1
+#define MAXARG_A ((1<<SIZE_A)-1)
+#else
+#define MAXARG_A MAX_INT
+#endif
+
+#if SIZE_B < BITS_INT-1
+#define MAXARG_B ((1<<SIZE_B)-1)
+#else
+#define MAXARG_B MAX_INT
+#endif
+
+
+/* maximum stack size in a function */
+#ifndef MAXSTACK
+#define MAXSTACK 250
+#endif
+
+#if MAXSTACK > MAXARG_B
+#undef MAXSTACK
+#define MAXSTACK MAXARG_B
+#endif
+
+
+/* maximum number of local variables */
+#ifndef MAXLOCALS
+#define MAXLOCALS 200 /* arbitrary limit (<MAXSTACK) */
+#endif
+#if MAXLOCALS>=MAXSTACK
+#undef MAXLOCALS
+#define MAXLOCALS (MAXSTACK-1)
+#endif
+
+
+/* maximum number of upvalues */
+#ifndef MAXUPVALUES
+#define MAXUPVALUES 32 /* arbitrary limit (<=MAXARG_B) */
+#endif
+#if MAXUPVALUES>MAXARG_B
+#undef MAXUPVALUES
+#define MAXUPVALUES MAXARG_B
+#endif
+
+
+/* maximum number of variables in the left side of an assignment */
+#ifndef MAXVARSLH
+#define MAXVARSLH 100 /* arbitrary limit (<MULT_RET) */
+#endif
+#if MAXVARSLH>=MULT_RET
+#undef MAXVARSLH
+#define MAXVARSLH (MULT_RET-1)
+#endif
+
+
+/* maximum number of parameters in a function */
+#ifndef MAXPARAMS
+#define MAXPARAMS 100 /* arbitrary limit (<MAXLOCALS) */
+#endif
+#if MAXPARAMS>=MAXLOCALS
+#undef MAXPARAMS
+#define MAXPARAMS (MAXLOCALS-1)
+#endif
+
+
+/* number of list items to accumulate before a SETLIST instruction */
+#define LFIELDS_PER_FLUSH 64
+#if LFIELDS_PER_FLUSH>(MAXSTACK/4)
+#undef LFIELDS_PER_FLUSH
+#define LFIELDS_PER_FLUSH (MAXSTACK/4)
+#endif
+
+/* number of record items to accumulate before a SETMAP instruction */
+/* (each item counts 2 elements on the stack: an index and a value) */
+#define RFIELDS_PER_FLUSH (LFIELDS_PER_FLUSH/2)
+
+
+/* maximum lookback to find a real constant (for code generation) */
+#ifndef LOOKBACKNUMS
+#define LOOKBACKNUMS 20 /* arbitrary constant */
+#endif
+
+
+#endif
diff --git a/lua/src/lmem.c b/lua/src/lmem.c
new file mode 100644
index 0000000..0ccbdc1
--- /dev/null
+++ b/lua/src/lmem.c
@@ -0,0 +1,150 @@
+/*
+** $Id: lmem.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Interface to Memory Manager
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdlib.h>
+
+#include "lua.h"
+
+#include "ldo.h"
+#include "lmem.h"
+#include "lobject.h"
+#include "lstate.h"
+
+
+
+
+#ifdef LUA_DEBUG
+/*
+** {======================================================================
+** Controlled version for realloc.
+** =======================================================================
+*/
+
+
+#include <assert.h>
+#include <limits.h>
+#include <string.h>
+
+#define realloc(b, s) debug_realloc(b, s)
+#define malloc(b) debug_realloc(NULL, b)
+#define free(b) debug_realloc(b, 0)
+
+
+/* ensures maximum alignment for HEADER */
+#define HEADER (sizeof(union L_Umaxalign))
+
+#define MARKSIZE 16
+#define MARK 0x55 /* 01010101 (a nice pattern) */
+
+
+#define blocksize(b) ((unsigned long *)((char *)(b) - HEADER))
+
+unsigned long memdebug_numblocks = 0;
+unsigned long memdebug_total = 0;
+unsigned long memdebug_maxmem = 0;
+unsigned long memdebug_memlimit = LONG_MAX;
+
+
+static void *checkblock (void *block) {
+ unsigned long *b = blocksize(block);
+ unsigned long size = *b;
+ int i;
+ for (i=0;i<MARKSIZE;i++)
+ assert(*(((char *)b)+HEADER+size+i) == MARK+i); /* corrupted block? */
+ memdebug_numblocks--;
+ memdebug_total -= size;
+ return b;
+}
+
+
+static void freeblock (void *block) {
+ if (block) {
+ size_t size = *blocksize(block);
+ block = checkblock(block);
+ memset(block, -1, size+HEADER+MARKSIZE); /* erase block */
+ (free)(block); /* free original block */
+ }
+}
+
+
+static void *debug_realloc (void *block, size_t size) {
+ if (size == 0) {
+ freeblock(block);
+ return NULL;
+ }
+ else if (memdebug_total+size > memdebug_memlimit)
+ return NULL; /* to test memory allocation errors */
+ else {
+ size_t realsize = HEADER+size+MARKSIZE;
+ char *newblock = (char *)(malloc)(realsize); /* alloc a new block */
+ int i;
+ if (realsize < size) return NULL; /* overflow! */
+ if (newblock == NULL) return NULL;
+ if (block) {
+ size_t oldsize = *blocksize(block);
+ if (oldsize > size) oldsize = size;
+ memcpy(newblock+HEADER, block, oldsize);
+ freeblock(block); /* erase (and check) old copy */
+ }
+ memdebug_total += size;
+ if (memdebug_total > memdebug_maxmem) memdebug_maxmem = memdebug_total;
+ memdebug_numblocks++;
+ *(unsigned long *)newblock = size;
+ for (i=0;i<MARKSIZE;i++)
+ *(newblock+HEADER+size+i) = (char)(MARK+i);
+ return newblock+HEADER;
+ }
+}
+
+
+/* }====================================================================== */
+#endif
+
+
+
+/*
+** Real ISO (ANSI) systems do not need these tests;
+** but some systems (Sun OS) are not that ISO...
+*/
+#ifdef OLD_ANSI
+#define realloc(b,s) ((b) == NULL ? malloc(s) : (realloc)(b, s))
+#define free(b) if (b) (free)(b)
+#endif
+
+
+void *luaM_growaux (lua_State *L, void *block, size_t nelems,
+ int inc, size_t size, const char *errormsg, size_t limit) {
+ size_t newn = nelems+inc;
+ if (nelems >= limit-inc) lua_error(L, errormsg);
+ if ((newn ^ nelems) <= nelems || /* still the same power-of-2 limit? */
+ (nelems > 0 && newn < MINPOWER2)) /* or block already is MINPOWER2? */
+ return block; /* do not need to reallocate */
+ else /* it crossed a power-of-2 boundary; grow to next power */
+ return luaM_realloc(L, block, luaO_power2(newn)*size);
+}
+
+
+/*
+** generic allocation routine.
+*/
+void *luaM_realloc (lua_State *L, void *block, lint32 size) {
+ if (size == 0) {
+ free(block); /* block may be NULL; that is OK for free */
+ return NULL;
+ }
+ else if (size >= MAX_SIZET)
+ lua_error(L, "memory allocation error: block too big");
+ block = realloc(block, size);
+ if (block == NULL) {
+ if (L)
+ luaD_breakrun(L, LUA_ERRMEM); /* break run without error message */
+ else return NULL; /* error before creating state! */
+ }
+ return block;
+}
+
+
diff --git a/lua/src/lmem.h b/lua/src/lmem.h
new file mode 100644
index 0000000..ea20291
--- /dev/null
+++ b/lua/src/lmem.h
@@ -0,0 +1,42 @@
+/*
+** $Id: lmem.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Interface to Memory Manager
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lmem_h
+#define lmem_h
+
+
+#include <stddef.h>
+
+#include "llimits.h"
+#include "lua.h"
+
+void *luaM_realloc (lua_State *L, void *oldblock, lint32 size);
+void *luaM_growaux (lua_State *L, void *block, size_t nelems,
+ int inc, size_t size, const char *errormsg,
+ size_t limit);
+
+#define luaM_free(L, b) luaM_realloc(L, (b), 0)
+#define luaM_malloc(L, t) luaM_realloc(L, NULL, (t))
+#define luaM_new(L, t) ((t *)luaM_malloc(L, sizeof(t)))
+#define luaM_newvector(L, n,t) ((t *)luaM_malloc(L, (n)*(lint32)sizeof(t)))
+
+#define luaM_growvector(L, v,nelems,inc,t,e,l) \
+ ((v)=(t *)luaM_growaux(L, v,nelems,inc,sizeof(t),e,l))
+
+#define luaM_reallocvector(L, v,n,t) \
+ ((v)=(t *)luaM_realloc(L, v,(n)*(lint32)sizeof(t)))
+
+
+#ifdef LUA_DEBUG
+extern unsigned long memdebug_numblocks;
+extern unsigned long memdebug_total;
+extern unsigned long memdebug_maxmem;
+extern unsigned long memdebug_memlimit;
+#endif
+
+
+#endif
+
diff --git a/lua/src/lobject.c b/lua/src/lobject.c
new file mode 100644
index 0000000..e57a246
--- /dev/null
+++ b/lua/src/lobject.c
@@ -0,0 +1,125 @@
+/*
+** $Id: lobject.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Some generic functions over Lua objects
+** See Copyright Notice in lua.h
+*/
+
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "lmem.h"
+#include "lobject.h"
+#include "lstate.h"
+
+
+
+const TObject luaO_nilobject = {LUA_TNIL, {NULL}};
+
+
+const char *const luaO_typenames[] = {
+ "userdata", "nil", "number", "string", "table", "function"
+};
+
+
+
+/*
+** returns smaller power of 2 larger than `n' (minimum is MINPOWER2)
+*/
+lint32 luaO_power2 (lint32 n) {
+ lint32 p = MINPOWER2;
+ while (p<=n) p<<=1;
+ return p;
+}
+
+
+int luaO_equalObj (const TObject *t1, const TObject *t2) {
+ if (ttype(t1) != ttype(t2)) return 0;
+ switch (ttype(t1)) {
+ case LUA_TNUMBER:
+ return nvalue(t1) == nvalue(t2);
+ case LUA_TSTRING: case LUA_TUSERDATA:
+ return tsvalue(t1) == tsvalue(t2);
+ case LUA_TTABLE:
+ return hvalue(t1) == hvalue(t2);
+ case LUA_TFUNCTION:
+ return clvalue(t1) == clvalue(t2);
+ default:
+ LUA_ASSERT(ttype(t1) == LUA_TNIL, "invalid type");
+ return 1; /* LUA_TNIL */
+ }
+}
+
+
+char *luaO_openspace (lua_State *L, size_t n) {
+ if (n > L->Mbuffsize) {
+ luaM_reallocvector(L, L->Mbuffer, n, char);
+ L->nblocks += (n - L->Mbuffsize)*sizeof(char);
+ L->Mbuffsize = n;
+ }
+ return L->Mbuffer;
+}
+
+
+int luaO_str2d (const char *s, Number *result) { /* LUA_NUMBER */
+ char *endptr;
+ Number res = lua_str2number(s, &endptr);
+ if (endptr == s) return 0; /* no conversion */
+ while (isspace((unsigned char)*endptr)) endptr++;
+ if (*endptr != '\0') return 0; /* invalid trailing characters? */
+ *result = res;
+ return 1;
+}
+
+
+/* maximum length of a string format for `luaO_verror' */
+#define MAX_VERROR 280
+
+/* this function needs to handle only '%d' and '%.XXs' formats */
+void luaO_verror (lua_State *L, const char *fmt, ...) {
+ va_list argp;
+ char buff[MAX_VERROR]; /* to hold formatted message */
+ va_start(argp, fmt);
+ vsprintf(buff, fmt, argp);
+ va_end(argp);
+ lua_error(L, buff);
+}
+
+
+void luaO_chunkid (char *out, const char *source, int bufflen) {
+ if (*source == '=') {
+ strncpy(out, source+1, bufflen); /* remove first char */
+ out[bufflen-1] = '\0'; /* ensures null termination */
+ }
+ else {
+ if (*source == '@') {
+ int l;
+ source++; /* skip the `@' */
+ bufflen -= sizeof("file `...%s'");
+ l = strlen(source);
+ if (l>bufflen) {
+ source += (l-bufflen); /* get last part of file name */
+ sprintf(out, "file `...%.99s'", source);
+ }
+ else
+ sprintf(out, "file `%.99s'", source);
+ }
+ else {
+ int len = strcspn(source, "\n"); /* stop at first newline */
+ bufflen -= sizeof("string \"%.*s...\"");
+ if (len > bufflen) len = bufflen;
+ if (source[len] != '\0') { /* must truncate? */
+ strcpy(out, "string \"");
+ out += strlen(out);
+ strncpy(out, source, len);
+ strcpy(out+len, "...\"");
+ }
+ else
+ sprintf(out, "string \"%.99s\"", source);
+ }
+ }
+}
diff --git a/lua/src/lobject.h b/lua/src/lobject.h
new file mode 100644
index 0000000..c2607d1
--- /dev/null
+++ b/lua/src/lobject.h
@@ -0,0 +1,204 @@
+/*
+** $Id: lobject.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Type definitions for Lua objects
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lobject_h
+#define lobject_h
+
+
+#include "llimits.h"
+#include "lua.h"
+
+
+#ifdef LUA_DEBUG
+#undef NDEBUG
+#include <assert.h>
+#define LUA_INTERNALERROR(s) assert(((void)s,0))
+#define LUA_ASSERT(c,s) assert(((void)s,(c)))
+#else
+#define LUA_INTERNALERROR(s) /* empty */
+#define LUA_ASSERT(c,s) /* empty */
+#endif
+
+
+#ifdef LUA_DEBUG
+/* to avoid warnings, and make sure value is really unused */
+#define UNUSED(x) (x=0, (void)(x))
+#else
+#define UNUSED(x) ((void)(x)) /* to avoid warnings */
+#endif
+
+
+/* mark for closures active in the stack */
+#define LUA_TMARK 6
+
+
+/* tags for values visible from Lua == first user-created tag */
+#define NUM_TAGS 6
+
+
+/* check whether `t' is a mark */
+#define is_T_MARK(t) ((t) == LUA_TMARK)
+
+
+typedef union {
+ struct TString *ts; /* LUA_TSTRING, LUA_TUSERDATA */
+ struct Closure *cl; /* LUA_TFUNCTION */
+ struct Hash *a; /* LUA_TTABLE */
+ struct CallInfo *i; /* LUA_TLMARK */
+ Number n; /* LUA_TNUMBER */
+} Value;
+
+
+/* Macros to access values */
+#define ttype(o) ((o)->ttype)
+#define nvalue(o) ((o)->value.n)
+#define tsvalue(o) ((o)->value.ts)
+#define clvalue(o) ((o)->value.cl)
+#define hvalue(o) ((o)->value.a)
+#define infovalue(o) ((o)->value.i)
+#define svalue(o) (tsvalue(o)->str)
+
+
+typedef struct lua_TObject {
+ int ttype;
+ Value value;
+} TObject;
+
+
+/*
+** String headers for string table
+*/
+
+/*
+** most `malloc' libraries allocate memory in blocks of 8 bytes. TSPACK
+** tries to make sizeof(TString) a multiple of this granularity, to reduce
+** waste of space.
+*/
+#define TSPACK ((int)sizeof(int))
+
+typedef struct TString {
+ union {
+ struct { /* for strings */
+ unsigned long hash;
+ int constindex; /* hint to reuse constants */
+ } s;
+ struct { /* for userdata */
+ int tag;
+ void *value;
+ } d;
+ } u;
+ size_t len;
+ struct TString *nexthash; /* chain for hash table */
+ int marked;
+ char str[TSPACK]; /* variable length string!! must be the last field! */
+} TString;
+
+
+/*
+** Function Prototypes
+*/
+typedef struct Proto {
+ Number *knum; /* Number numbers used by the function */
+ int nknum; /* size of `knum' */
+ struct TString **kstr; /* strings used by the function */
+ int nkstr; /* size of `kstr' */
+ struct Proto **kproto; /* functions defined inside the function */
+ int nkproto; /* size of `kproto' */
+ Instruction *code;
+ int ncode; /* size of `code'; when 0 means an incomplete `Proto' */
+ short numparams;
+ short is_vararg;
+ short maxstacksize;
+ short marked;
+ struct Proto *next;
+ /* debug information */
+ int *lineinfo; /* map from opcodes to source lines */
+ int nlineinfo; /* size of `lineinfo' */
+ int nlocvars;
+ struct LocVar *locvars; /* information about local variables */
+ int lineDefined;
+ TString *source;
+} Proto;
+
+
+typedef struct LocVar {
+ TString *varname;
+ int startpc; /* first point where variable is active */
+ int endpc; /* first point where variable is dead */
+} LocVar;
+
+
+/*
+** Closures
+*/
+typedef struct Closure {
+ union {
+ lua_CFunction c; /* C functions */
+ struct Proto *l; /* Lua functions */
+ } f;
+ struct Closure *next;
+ struct Closure *mark; /* marked closures (point to itself when not marked) */
+ short isC; /* 0 for Lua functions, 1 for C functions */
+ short nupvalues;
+ TObject upvalue[1];
+} Closure;
+
+
+#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->isC)
+
+
+typedef struct Node {
+ TObject key;
+ TObject val;
+ struct Node *next; /* for chaining */
+} Node;
+
+typedef struct Hash {
+ Node *node;
+ int htag;
+ int size;
+ Node *firstfree; /* this position is free; all positions after it are full */
+ struct Hash *next;
+ struct Hash *mark; /* marked tables (point to itself when not marked) */
+} Hash;
+
+
+/* unmarked tables and closures are represented by pointing `mark' to
+** themselves
+*/
+#define ismarked(x) ((x)->mark != (x))
+
+
+/*
+** informations about a call (for debugging)
+*/
+typedef struct CallInfo {
+ struct Closure *func; /* function being called */
+ const Instruction **pc; /* current pc of called function */
+ int lastpc; /* last pc traced */
+ int line; /* current line */
+ int refi; /* current index in `lineinfo' */
+} CallInfo;
+
+
+extern const TObject luaO_nilobject;
+extern const char *const luaO_typenames[];
+
+
+#define luaO_typename(o) (luaO_typenames[ttype(o)])
+
+
+lint32 luaO_power2 (lint32 n);
+char *luaO_openspace (lua_State *L, size_t n);
+
+int luaO_equalObj (const TObject *t1, const TObject *t2);
+int luaO_str2d (const char *s, Number *result);
+
+void luaO_verror (lua_State *L, const char *fmt, ...);
+void luaO_chunkid (char *out, const char *source, int len);
+
+
+#endif
diff --git a/lua/src/lopcodes.h b/lua/src/lopcodes.h
new file mode 100644
index 0000000..718d40b
--- /dev/null
+++ b/lua/src/lopcodes.h
@@ -0,0 +1,168 @@
+/*
+** $Id: lopcodes.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Opcodes for Lua virtual machine
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lopcodes_h
+#define lopcodes_h
+
+#include "llimits.h"
+
+
+/*===========================================================================
+ We assume that instructions are unsigned numbers.
+ All instructions have an opcode in the first 6 bits. Moreover,
+ an instruction can have 0, 1, or 2 arguments. Instructions can
+ have the following types:
+ type 0: no arguments
+ type 1: 1 unsigned argument in the higher bits (called `U')
+ type 2: 1 signed argument in the higher bits (`S')
+ type 3: 1st unsigned argument in the higher bits (`A')
+ 2nd unsigned argument in the middle bits (`B')
+
+ A signed argument is represented in excess K; that is, the number
+ value is the unsigned value minus K. K is exactly the maximum value
+ for that argument (so that -max is represented by 0, and +max is
+ represented by 2*max), which is half the maximum for the corresponding
+ unsigned argument.
+
+ The size of each argument is defined in `llimits.h'. The usual is an
+ instruction with 32 bits, U arguments with 26 bits (32-6), B arguments
+ with 9 bits, and A arguments with 17 bits (32-6-9). For small
+ installations, the instruction size can be 16, so U has 10 bits,
+ and A and B have 5 bits each.
+===========================================================================*/
+
+
+
+
+/* creates a mask with `n' 1 bits at position `p' */
+#define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p)
+
+/* creates a mask with `n' 0 bits at position `p' */
+#define MASK0(n,p) (~MASK1(n,p))
+
+/*
+** the following macros help to manipulate instructions
+*/
+
+#define CREATE_0(o) ((Instruction)(o))
+#define GET_OPCODE(i) ((OpCode)((i)&MASK1(SIZE_OP,0)))
+#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,0)) | (Instruction)(o)))
+
+#define CREATE_U(o,u) ((Instruction)(o) | ((Instruction)(u)<<POS_U))
+#define GETARG_U(i) ((int)((i)>>POS_U))
+#define SETARG_U(i,u) ((i) = (((i)&MASK0(SIZE_U,POS_U)) | \
+ ((Instruction)(u)<<POS_U)))
+
+#define CREATE_S(o,s) CREATE_U((o),(s)+MAXARG_S)
+#define GETARG_S(i) (GETARG_U(i)-MAXARG_S)
+#define SETARG_S(i,s) SETARG_U((i),(s)+MAXARG_S)
+
+
+#define CREATE_AB(o,a,b) ((Instruction)(o) | ((Instruction)(a)<<POS_A) \
+ | ((Instruction)(b)<<POS_B))
+#define GETARG_A(i) ((int)((i)>>POS_A))
+#define SETARG_A(i,a) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \
+ ((Instruction)(a)<<POS_A)))
+#define GETARG_B(i) ((int)(((i)>>POS_B) & MASK1(SIZE_B,0)))
+#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \
+ ((Instruction)(b)<<POS_B)))
+
+
+/*
+** K = U argument used as index to `kstr'
+** J = S argument used as jump offset (relative to pc of next instruction)
+** L = unsigned argument used as index of local variable
+** N = U argument used as index to `knum'
+*/
+
+typedef enum {
+/*----------------------------------------------------------------------
+name args stack before stack after side effects
+------------------------------------------------------------------------*/
+OP_END,/* - - (return) no results */
+OP_RETURN,/* U v_n-v_x(at u) (return) returns v_x-v_n */
+
+OP_CALL,/* A B v_n-v_1 f(at a) r_b-r_1 f(v1,...,v_n) */
+OP_TAILCALL,/* A B v_n-v_1 f(at a) (return) f(v1,...,v_n) */
+
+OP_PUSHNIL,/* U - nil_1-nil_u */
+OP_POP,/* U a_u-a_1 - */
+
+OP_PUSHINT,/* S - (Number)s */
+OP_PUSHSTRING,/* K - KSTR[k] */
+OP_PUSHNUM,/* N - KNUM[n] */
+OP_PUSHNEGNUM,/* N - -KNUM[n] */
+
+OP_PUSHUPVALUE,/* U - Closure[u] */
+
+OP_GETLOCAL,/* L - LOC[l] */
+OP_GETGLOBAL,/* K - VAR[KSTR[k]] */
+
+OP_GETTABLE,/* - i t t[i] */
+OP_GETDOTTED,/* K t t[KSTR[k]] */
+OP_GETINDEXED,/* L t t[LOC[l]] */
+OP_PUSHSELF,/* K t t t[KSTR[k]] */
+
+OP_CREATETABLE,/* U - newarray(size = u) */
+
+OP_SETLOCAL,/* L x - LOC[l]=x */
+OP_SETGLOBAL,/* K x - VAR[KSTR[k]]=x */
+OP_SETTABLE,/* A B v a_a-a_1 i t (pops b values) t[i]=v */
+
+OP_SETLIST,/* A B v_b-v_1 t t t[i+a*FPF]=v_i */
+OP_SETMAP,/* U v_u k_u - v_1 k_1 t t t[k_i]=v_i */
+
+OP_ADD,/* - y x x+y */
+OP_ADDI,/* S x x+s */
+OP_SUB,/* - y x x-y */
+OP_MULT,/* - y x x*y */
+OP_DIV,/* - y x x/y */
+OP_POW,/* - y x x^y */
+OP_CONCAT,/* U v_u-v_1 v1..-..v_u */
+OP_MINUS,/* - x -x */
+OP_NOT,/* - x (x==nil)? 1 : nil */
+
+OP_JMPNE,/* J y x - (x~=y)? PC+=s */
+OP_JMPEQ,/* J y x - (x==y)? PC+=s */
+OP_JMPLT,/* J y x - (x<y)? PC+=s */
+OP_JMPLE,/* J y x - (x<y)? PC+=s */
+OP_JMPGT,/* J y x - (x>y)? PC+=s */
+OP_JMPGE,/* J y x - (x>=y)? PC+=s */
+
+OP_JMPT,/* J x - (x~=nil)? PC+=s */
+OP_JMPF,/* J x - (x==nil)? PC+=s */
+OP_JMPONT,/* J x (x~=nil)? x : - (x~=nil)? PC+=s */
+OP_JMPONF,/* J x (x==nil)? x : - (x==nil)? PC+=s */
+OP_JMP,/* J - - PC+=s */
+
+OP_PUSHNILJMP,/* - - nil PC++; */
+
+OP_FORPREP,/* J */
+OP_FORLOOP,/* J */
+
+OP_LFORPREP,/* J */
+OP_LFORLOOP,/* J */
+
+OP_CLOSURE/* A B v_b-v_1 closure(KPROTO[a], v_1-v_b) */
+
+} OpCode;
+
+#define NUM_OPCODES ((int)OP_CLOSURE+1)
+
+
+#define ISJUMP(o) (OP_JMPNE <= (o) && (o) <= OP_JMP)
+
+
+
+/* special code to fit a LUA_MULTRET inside an argB */
+#define MULT_RET 255 /* (<=MAXARG_B) */
+#if MULT_RET>MAXARG_B
+#undef MULT_RET
+#define MULT_RET MAXARG_B
+#endif
+
+
+#endif
diff --git a/lua/src/lparser.c b/lua/src/lparser.c
new file mode 100644
index 0000000..b4fadfd
--- /dev/null
+++ b/lua/src/lparser.c
@@ -0,0 +1,1124 @@
+/*
+** $Id: lparser.c,v 1.2 2002/07/12 07:49:04 jcatki Exp $
+** LL(1) Parser and code generator for Lua
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdio.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "lcode.h"
+#include "lfunc.h"
+#include "llex.h"
+#include "lmem.h"
+#include "lobject.h"
+#include "lopcodes.h"
+#include "lparser.h"
+#include "lstate.h"
+#include "lstring.h"
+
+
+/*
+** Constructors descriptor:
+** `n' indicates number of elements, and `k' signals whether
+** it is a list constructor (k = 0) or a record constructor (k = 1)
+** or empty (k = ';' or '}')
+*/
+typedef struct Constdesc {
+ int n;
+ int k;
+} Constdesc;
+
+
+typedef struct Breaklabel {
+ struct Breaklabel *previous; /* chain */
+ int breaklist;
+ int stacklevel;
+} Breaklabel;
+
+
+
+
+/*
+** prototypes for recursive non-terminal functions
+*/
+static void body (LexState *ls, int needself, int line);
+static void chunk (LexState *ls);
+static void constructor (LexState *ls);
+static void expr (LexState *ls, expdesc *v);
+static void exp1 (LexState *ls);
+
+
+
+static void next (LexState *ls) {
+ ls->lastline = ls->linenumber;
+ if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */
+ ls->t = ls->lookahead; /* use this one */
+ ls->lookahead.token = TK_EOS; /* and discharge it */
+ }
+ else
+ ls->t.token = luaX_lex(ls, &ls->t.seminfo); /* read next token */
+}
+
+
+static void lookahead (LexState *ls) {
+ LUA_ASSERT(ls->lookahead.token == TK_EOS, "two look-aheads");
+ ls->lookahead.token = luaX_lex(ls, &ls->lookahead.seminfo);
+}
+
+
+static void error_expected (LexState *ls, int token) {
+ char buff[100], t[TOKEN_LEN];
+ luaX_token2str(token, t);
+ sprintf(buff, "`%.20s' expected", t);
+ luaK_error(ls, buff);
+}
+
+
+static void check (LexState *ls, int c) {
+ if (ls->t.token != c)
+ error_expected(ls, c);
+ next(ls);
+}
+
+
+static void check_condition (LexState *ls, int c, const char *msg) {
+ if (!c) luaK_error(ls, msg);
+}
+
+
+static int optional (LexState *ls, int c) {
+ if (ls->t.token == c) {
+ next(ls);
+ return 1;
+ }
+ else return 0;
+}
+
+
+static void check_match (LexState *ls, int what, int who, int where) {
+ if (ls->t.token != what) {
+ if (where == ls->linenumber)
+ error_expected(ls, what);
+ else {
+ char buff[100];
+ char t_what[TOKEN_LEN], t_who[TOKEN_LEN];
+ luaX_token2str(what, t_what);
+ luaX_token2str(who, t_who);
+ sprintf(buff, "`%.20s' expected (to close `%.20s' at line %d)",
+ t_what, t_who, where);
+ luaK_error(ls, buff);
+ }
+ }
+ next(ls);
+}
+
+
+static int string_constant (FuncState *fs, TString *s) {
+ Proto *f = fs->f;
+ int c = s->u.s.constindex;
+ if (c >= f->nkstr || f->kstr[c] != s) {
+ luaM_growvector(fs->L, f->kstr, f->nkstr, 1, TString *,
+ "constant table overflow", MAXARG_U);
+ c = f->nkstr++;
+ f->kstr[c] = s;
+ s->u.s.constindex = c; /* hint for next time */
+ }
+ return c;
+}
+
+
+static void code_string (LexState *ls, TString *s) {
+ luaK_kstr(ls, string_constant(ls->fs, s));
+}
+
+
+static TString *str_checkname (LexState *ls) {
+ TString *ts;
+ check_condition(ls, (ls->t.token == TK_NAME), "<name> expected");
+ ts = ls->t.seminfo.ts;
+ next(ls);
+ return ts;
+}
+
+
+static int checkname (LexState *ls) {
+ return string_constant(ls->fs, str_checkname(ls));
+}
+
+
+static int luaI_registerlocalvar (LexState *ls, TString *varname) {
+ Proto *f = ls->fs->f;
+ luaM_growvector(ls->L, f->locvars, f->nlocvars, 1, LocVar, "", MAX_INT);
+ f->locvars[f->nlocvars].varname = varname;
+ return f->nlocvars++;
+}
+
+
+static void new_localvar (LexState *ls, TString *name, int n) {
+ FuncState *fs = ls->fs;
+ luaX_checklimit(ls, fs->nactloc+n+1, MAXLOCALS, "local variables");
+ fs->actloc[fs->nactloc+n] = luaI_registerlocalvar(ls, name);
+}
+
+
+static void adjustlocalvars (LexState *ls, int nvars) {
+ FuncState *fs = ls->fs;
+ while (nvars--)
+ fs->f->locvars[fs->actloc[fs->nactloc++]].startpc = fs->pc;
+}
+
+
+static void removelocalvars (LexState *ls, int nvars) {
+ FuncState *fs = ls->fs;
+ while (nvars--)
+ fs->f->locvars[fs->actloc[--fs->nactloc]].endpc = fs->pc;
+}
+
+
+static void new_localvarstr (LexState *ls, const char *name, int n) {
+ new_localvar(ls, luaS_newfixed(ls->L, name), n);
+}
+
+
+static int search_local (LexState *ls, TString *n, expdesc *var) {
+ FuncState *fs;
+ int level = 0;
+ for (fs=ls->fs; fs; fs=fs->prev) {
+ int i;
+ for (i=fs->nactloc-1; i >= 0; i--) {
+ if (n == fs->f->locvars[fs->actloc[i]].varname) {
+ var->k = VLOCAL;
+ var->u.index = i;
+ return level;
+ }
+ }
+ level++; /* `var' not found; check outer level */
+ }
+ var->k = VGLOBAL; /* not found in any level; must be global */
+ return -1;
+}
+
+
+static void singlevar (LexState *ls, TString *n, expdesc *var) {
+ int level = search_local(ls, n, var);
+ if (level >= 1) /* neither local (0) nor global (-1)? */
+ luaX_syntaxerror(ls, "cannot access a variable in outer scope", n->str);
+ else if (level == -1) /* global? */
+ var->u.index = string_constant(ls->fs, n);
+}
+
+
+static int indexupvalue (LexState *ls, expdesc *v) {
+ FuncState *fs = ls->fs;
+ int i;
+ for (i=0; i<fs->nupvalues; i++) {
+ if (fs->upvalues[i].k == v->k && fs->upvalues[i].u.index == v->u.index)
+ return i;
+ }
+ /* new one */
+ luaX_checklimit(ls, fs->nupvalues+1, MAXUPVALUES, "upvalues");
+ fs->upvalues[fs->nupvalues] = *v;
+ return fs->nupvalues++;
+}
+
+
+static void pushupvalue (LexState *ls, TString *n) {
+ FuncState *fs = ls->fs;
+ expdesc v;
+ int level = search_local(ls, n, &v);
+ if (level == -1) { /* global? */
+ if (fs->prev == NULL)
+ luaX_syntaxerror(ls, "cannot access upvalue in main", n->str);
+ v.u.index = string_constant(fs->prev, n);
+ }
+ else if (level != 1)
+ luaX_syntaxerror(ls,
+ "upvalue must be global or local to immediately outer scope", n->str);
+ luaK_code1(fs, OP_PUSHUPVALUE, indexupvalue(ls, &v));
+}
+
+
+static void adjust_mult_assign (LexState *ls, int nvars, int nexps) {
+ FuncState *fs = ls->fs;
+ int diff = nexps - nvars;
+ if (nexps > 0 && luaK_lastisopen(fs)) { /* list ends in a function call */
+ diff--; /* do not count function call itself */
+ if (diff <= 0) { /* more variables than values? */
+ luaK_setcallreturns(fs, -diff); /* function call provide extra values */
+ diff = 0; /* no more difference */
+ }
+ else /* more values than variables */
+ luaK_setcallreturns(fs, 0); /* call should provide no value */
+ }
+ /* push or pop eventual difference between list lengths */
+ luaK_adjuststack(fs, diff);
+}
+
+
+static void code_params (LexState *ls, int nparams, int dots) {
+ FuncState *fs = ls->fs;
+ adjustlocalvars(ls, nparams);
+ luaX_checklimit(ls, fs->nactloc, MAXPARAMS, "parameters");
+ fs->f->numparams = fs->nactloc; /* `self' could be there already */
+ fs->f->is_vararg = dots;
+ if (dots) {
+ new_localvarstr(ls, "arg", 0);
+ adjustlocalvars(ls, 1);
+ }
+ luaK_deltastack(fs, fs->nactloc); /* count parameters in the stack */
+}
+
+
+static void enterbreak (FuncState *fs, Breaklabel *bl) {
+ bl->stacklevel = fs->stacklevel;
+ bl->breaklist = NO_JUMP;
+ bl->previous = fs->bl;
+ fs->bl = bl;
+}
+
+
+static void leavebreak (FuncState *fs, Breaklabel *bl) {
+ fs->bl = bl->previous;
+ LUA_ASSERT(bl->stacklevel == fs->stacklevel, "wrong levels");
+ luaK_patchlist(fs, bl->breaklist, luaK_getlabel(fs));
+}
+
+
+static void pushclosure (LexState *ls, FuncState *func) {
+ FuncState *fs = ls->fs;
+ Proto *f = fs->f;
+ int i;
+ for (i=0; i<func->nupvalues; i++)
+ luaK_tostack(ls, &func->upvalues[i], 1);
+ luaM_growvector(ls->L, f->kproto, f->nkproto, 1, Proto *,
+ "constant table overflow", MAXARG_A);
+ f->kproto[f->nkproto++] = func->f;
+ luaK_code2(fs, OP_CLOSURE, f->nkproto-1, func->nupvalues);
+}
+
+
+static void open_func (LexState *ls, FuncState *fs) {
+ Proto *f = luaF_newproto(ls->L);
+ fs->prev = ls->fs; /* linked list of funcstates */
+ fs->ls = ls;
+ fs->L = ls->L;
+ ls->fs = fs;
+ fs->stacklevel = 0;
+ fs->nactloc = 0;
+ fs->nupvalues = 0;
+ fs->bl = NULL;
+ fs->f = f;
+ f->source = ls->source;
+ fs->pc = 0;
+ fs->lasttarget = 0;
+ fs->lastline = 0;
+ fs->jlt = NO_JUMP;
+ f->code = NULL;
+ f->maxstacksize = 0;
+ f->numparams = 0; /* default for main chunk */
+ f->is_vararg = 0; /* default for main chunk */
+}
+
+
+static void close_func (LexState *ls) {
+ lua_State *L = ls->L;
+ FuncState *fs = ls->fs;
+ Proto *f = fs->f;
+ luaK_code0(fs, OP_END);
+ luaK_getlabel(fs); /* close eventual list of pending jumps */
+ luaM_reallocvector(L, f->code, fs->pc, Instruction);
+ luaM_reallocvector(L, f->kstr, f->nkstr, TString *);
+ luaM_reallocvector(L, f->knum, f->nknum, Number);
+ luaM_reallocvector(L, f->kproto, f->nkproto, Proto *);
+ removelocalvars(ls, fs->nactloc);
+ luaM_reallocvector(L, f->locvars, f->nlocvars, LocVar);
+ luaM_reallocvector(L, f->lineinfo, f->nlineinfo+1, int);
+ f->lineinfo[f->nlineinfo++] = MAX_INT; /* end flag */
+ luaF_protook(L, f, fs->pc); /* proto is ok now */
+ ls->fs = fs->prev;
+ LUA_ASSERT(fs->bl == NULL, "wrong list end");
+}
+
+
+Proto *luaY_parser (lua_State *L, ZIO *z) {
+ struct LexState lexstate;
+ struct FuncState funcstate;
+ luaX_setinput(L, &lexstate, z, luaS_new(L, zname(z)));
+ open_func(&lexstate, &funcstate);
+ next(&lexstate); /* read first token */
+ chunk(&lexstate);
+ check_condition(&lexstate, (lexstate.t.token == TK_EOS), "<eof> expected");
+ close_func(&lexstate);
+ LUA_ASSERT(funcstate.prev == NULL, "wrong list end");
+ LUA_ASSERT(funcstate.nupvalues == 0, "no upvalues in main");
+ return funcstate.f;
+}
+
+
+
+/*============================================================*/
+/* GRAMMAR RULES */
+/*============================================================*/
+
+
+static int explist1 (LexState *ls) {
+ /* explist1 -> expr { ',' expr } */
+ int n = 1; /* at least one expression */
+ expdesc v;
+ expr(ls, &v);
+ while (ls->t.token == ',') {
+ luaK_tostack(ls, &v, 1); /* gets only 1 value from previous expression */
+ next(ls); /* skip comma */
+ expr(ls, &v);
+ n++;
+ }
+ luaK_tostack(ls, &v, 0); /* keep open number of values of last expression */
+ return n;
+}
+
+
+static void funcargs (LexState *ls, int slf) {
+ FuncState *fs = ls->fs;
+ int slevel = fs->stacklevel - slf - 1; /* where is func in the stack */
+ switch (ls->t.token) {
+ case '(': { /* funcargs -> '(' [ explist1 ] ')' */
+ int line = ls->linenumber;
+ int nargs = 0;
+ next(ls);
+ if (ls->t.token != ')') /* arg list not empty? */
+ nargs = explist1(ls);
+ check_match(ls, ')', '(', line);
+#ifdef LUA_COMPAT_ARGRET
+ if (nargs > 0) /* arg list is not empty? */
+ luaK_setcallreturns(fs, 1); /* last call returns only 1 value */
+#else
+ UNUSED(nargs); /* to avoid warnings */
+#endif
+ break;
+ }
+ case '{': { /* funcargs -> constructor */
+ constructor(ls);
+ break;
+ }
+ case TK_STRING: { /* funcargs -> STRING */
+ code_string(ls, ls->t.seminfo.ts); /* must use `seminfo' before `next' */
+ next(ls);
+ break;
+ }
+ default: {
+ luaK_error(ls, "function arguments expected");
+ break;
+ }
+ }
+ fs->stacklevel = slevel; /* call will remove function and arguments */
+ luaK_code2(fs, OP_CALL, slevel, MULT_RET);
+}
+
+
+static void var_or_func_tail (LexState *ls, expdesc *v) {
+ for (;;) {
+ switch (ls->t.token) {
+ case '.': { /* var_or_func_tail -> '.' NAME */
+ next(ls);
+ luaK_tostack(ls, v, 1); /* `v' must be on stack */
+ luaK_kstr(ls, checkname(ls));
+ v->k = VINDEXED;
+ break;
+ }
+ case '[': { /* var_or_func_tail -> '[' exp1 ']' */
+ next(ls);
+ luaK_tostack(ls, v, 1); /* `v' must be on stack */
+ v->k = VINDEXED;
+ exp1(ls);
+ check(ls, ']');
+ break;
+ }
+ case ':': { /* var_or_func_tail -> ':' NAME funcargs */
+ int name;
+ next(ls);
+ name = checkname(ls);
+ luaK_tostack(ls, v, 1); /* `v' must be on stack */
+ luaK_code1(ls->fs, OP_PUSHSELF, name);
+ funcargs(ls, 1);
+ v->k = VEXP;
+ v->u.l.t = v->u.l.f = NO_JUMP;
+ break;
+ }
+ case '(': case TK_STRING: case '{': { /* var_or_func_tail -> funcargs */
+ luaK_tostack(ls, v, 1); /* `v' must be on stack */
+ funcargs(ls, 0);
+ v->k = VEXP;
+ v->u.l.t = v->u.l.f = NO_JUMP;
+ break;
+ }
+ default: return; /* should be follow... */
+ }
+ }
+}
+
+
+static void var_or_func (LexState *ls, expdesc *v) {
+ /* var_or_func -> ['%'] NAME var_or_func_tail */
+ if (optional(ls, '%')) { /* upvalue? */
+ pushupvalue(ls, str_checkname(ls));
+ v->k = VEXP;
+ v->u.l.t = v->u.l.f = NO_JUMP;
+ }
+ else /* variable name */
+ singlevar(ls, str_checkname(ls), v);
+ var_or_func_tail(ls, v);
+}
+
+
+
+/*
+** {======================================================================
+** Rules for Constructors
+** =======================================================================
+*/
+
+
+static void recfield (LexState *ls) {
+ /* recfield -> (NAME | '['exp1']') = exp1 */
+ switch (ls->t.token) {
+ case TK_NAME: {
+ luaK_kstr(ls, checkname(ls));
+ break;
+ }
+ case '[': {
+ next(ls);
+ exp1(ls);
+ check(ls, ']');
+ break;
+ }
+ default: luaK_error(ls, "<name> or `[' expected");
+ }
+ check(ls, '=');
+ exp1(ls);
+}
+
+
+static int recfields (LexState *ls) {
+ /* recfields -> recfield { ',' recfield } [','] */
+ FuncState *fs = ls->fs;
+ int n = 1; /* at least one element */
+ recfield(ls);
+ while (ls->t.token == ',') {
+ next(ls);
+ if (ls->t.token == ';' || ls->t.token == '}')
+ break;
+ recfield(ls);
+ n++;
+ if (n%RFIELDS_PER_FLUSH == 0)
+ luaK_code1(fs, OP_SETMAP, RFIELDS_PER_FLUSH);
+ }
+ luaK_code1(fs, OP_SETMAP, n%RFIELDS_PER_FLUSH);
+ return n;
+}
+
+
+static int listfields (LexState *ls) {
+ /* listfields -> exp1 { ',' exp1 } [','] */
+ FuncState *fs = ls->fs;
+ int n = 1; /* at least one element */
+ exp1(ls);
+ while (ls->t.token == ',') {
+ next(ls);
+ if (ls->t.token == ';' || ls->t.token == '}')
+ break;
+ exp1(ls);
+ n++;
+ luaX_checklimit(ls, n/LFIELDS_PER_FLUSH, MAXARG_A,
+ "`item groups' in a list initializer");
+ if (n%LFIELDS_PER_FLUSH == 0)
+ luaK_code2(fs, OP_SETLIST, n/LFIELDS_PER_FLUSH - 1, LFIELDS_PER_FLUSH);
+ }
+ luaK_code2(fs, OP_SETLIST, n/LFIELDS_PER_FLUSH, n%LFIELDS_PER_FLUSH);
+ return n;
+}
+
+
+
+static void constructor_part (LexState *ls, Constdesc *cd) {
+ switch (ls->t.token) {
+ case ';': case '}': { /* constructor_part -> empty */
+ cd->n = 0;
+ cd->k = ls->t.token;
+ break;
+ }
+ case TK_NAME: { /* may be listfields or recfields */
+ lookahead(ls);
+ if (ls->lookahead.token != '=') /* expression? */
+ goto case_default;
+ /* else go through to recfields */
+ }
+ case '[': { /* constructor_part -> recfields */
+ cd->n = recfields(ls);
+ cd->k = 1; /* record */
+ break;
+ }
+ default: { /* constructor_part -> listfields */
+ case_default:
+ cd->n = listfields(ls);
+ cd->k = 0; /* list */
+ break;
+ }
+ }
+}
+
+
+static void constructor (LexState *ls) {
+ /* constructor -> '{' constructor_part [';' constructor_part] '}' */
+ FuncState *fs = ls->fs;
+ int line = ls->linenumber;
+ int pc = luaK_code1(fs, OP_CREATETABLE, 0);
+ int nelems;
+ Constdesc cd;
+ check(ls, '{');
+ constructor_part(ls, &cd);
+ nelems = cd.n;
+ if (optional(ls, ';')) {
+ Constdesc other_cd;
+ constructor_part(ls, &other_cd);
+ check_condition(ls, (cd.k != other_cd.k), "invalid constructor syntax");
+ nelems += other_cd.n;
+ }
+ check_match(ls, '}', '{', line);
+ luaX_checklimit(ls, nelems, MAXARG_U, "elements in a table constructor");
+ SETARG_U(fs->f->code[pc], nelems); /* set initial table size */
+}
+
+/* }====================================================================== */
+
+
+
+
+/*
+** {======================================================================
+** Expression parsing
+** =======================================================================
+*/
+
+
+static void simpleexp (LexState *ls, expdesc *v) {
+ FuncState *fs = ls->fs;
+ switch (ls->t.token) {
+ case TK_NUMBER: { /* simpleexp -> NUMBER */
+ Number r = ls->t.seminfo.r;
+ next(ls);
+ luaK_number(fs, r);
+ break;
+ }
+ case TK_STRING: { /* simpleexp -> STRING */
+ code_string(ls, ls->t.seminfo.ts); /* must use `seminfo' before `next' */
+ next(ls);
+ break;
+ }
+ case TK_NIL: { /* simpleexp -> NIL */
+ luaK_adjuststack(fs, -1);
+ next(ls);
+ break;
+ }
+ case '{': { /* simpleexp -> constructor */
+ constructor(ls);
+ break;
+ }
+ case TK_FUNCTION: { /* simpleexp -> FUNCTION body */
+ next(ls);
+ body(ls, 0, ls->linenumber);
+ break;
+ }
+ case '(': { /* simpleexp -> '(' expr ')' */
+ next(ls);
+ expr(ls, v);
+ check(ls, ')');
+ return;
+ }
+ case TK_NAME: case '%': {
+ var_or_func(ls, v);
+ return;
+ }
+ default: {
+ luaK_error(ls, "<expression> expected");
+ return;
+ }
+ }
+ v->k = VEXP;
+ v->u.l.t = v->u.l.f = NO_JUMP;
+}
+
+
+static void exp1 (LexState *ls) {
+ expdesc v;
+ expr(ls, &v);
+ luaK_tostack(ls, &v, 1);
+}
+
+
+static UnOpr getunopr (int op) {
+ switch (op) {
+ case TK_NOT: return OPR_NOT;
+ case '-': return OPR_MINUS;
+ default: return OPR_NOUNOPR;
+ }
+}
+
+
+static BinOpr getbinopr (int op) {
+ switch (op) {
+ case '+': return OPR_ADD;
+ case '-': return OPR_SUB;
+ case '*': return OPR_MULT;
+ case '/': return OPR_DIV;
+ case '^': return OPR_POW;
+ case TK_CONCAT: return OPR_CONCAT;
+ case TK_NE: return OPR_NE;
+ case TK_EQ: return OPR_EQ;
+ case '<': return OPR_LT;
+ case TK_LE: return OPR_LE;
+ case '>': return OPR_GT;
+ case TK_GE: return OPR_GE;
+ case TK_AND: return OPR_AND;
+ case TK_OR: return OPR_OR;
+ default: return OPR_NOBINOPR;
+ }
+}
+
+
+static const struct {
+ char left; /* left priority for each binary operator */
+ char right; /* right priority */
+} priority[] = { /* ORDER OPR */
+ {5, 5}, {5, 5}, {6, 6}, {6, 6}, /* arithmetic */
+ {9, 8}, {4, 3}, /* power and concat (right associative) */
+ {2, 2}, {2, 2}, /* equality */
+ {2, 2}, {2, 2}, {2, 2}, {2, 2}, /* order */
+ {1, 1}, {1, 1} /* logical */
+};
+
+#define UNARY_PRIORITY 7 /* priority for unary operators */
+
+
+/*
+** subexpr -> (simplexep | unop subexpr) { binop subexpr }
+** where `binop' is any binary operator with a priority higher than `limit'
+*/
+static BinOpr subexpr (LexState *ls, expdesc *v, int limit) {
+ BinOpr op;
+ UnOpr uop = getunopr(ls->t.token);
+ if (uop != OPR_NOUNOPR) {
+ next(ls);
+ subexpr(ls, v, UNARY_PRIORITY);
+ luaK_prefix(ls, uop, v);
+ }
+ else simpleexp(ls, v);
+ /* expand while operators have priorities higher than `limit' */
+ op = getbinopr(ls->t.token);
+ while (op != OPR_NOBINOPR && priority[op].left > limit) {
+ expdesc v2;
+ BinOpr nextop;
+ next(ls);
+ luaK_infix(ls, op, v);
+ /* read sub-expression with higher priority */
+ nextop = subexpr(ls, &v2, priority[op].right);
+ luaK_posfix(ls, op, v, &v2);
+ op = nextop;
+ }
+ return op; /* return first untreated operator */
+}
+
+
+static void expr (LexState *ls, expdesc *v) {
+ subexpr(ls, v, -1);
+}
+
+/* }==================================================================== */
+
+
+/*
+** {======================================================================
+** Rules for Statements
+** =======================================================================
+*/
+
+
+static int block_follow (int token) {
+ switch (token) {
+ case TK_ELSE: case TK_ELSEIF: case TK_END:
+ case TK_UNTIL: case TK_EOS:
+ return 1;
+ default: return 0;
+ }
+}
+
+
+static void block (LexState *ls) {
+ /* block -> chunk */
+ FuncState *fs = ls->fs;
+ int nactloc = fs->nactloc;
+ chunk(ls);
+ luaK_adjuststack(fs, fs->nactloc - nactloc); /* remove local variables */
+ removelocalvars(ls, fs->nactloc - nactloc);
+}
+
+
+static int assignment (LexState *ls, expdesc *v, int nvars) {
+ int left = 0; /* number of values left in the stack after assignment */
+ luaX_checklimit(ls, nvars, MAXVARSLH, "variables in a multiple assignment");
+ if (ls->t.token == ',') { /* assignment -> ',' NAME assignment */
+ expdesc nv;
+ next(ls);
+ var_or_func(ls, &nv);
+ check_condition(ls, (nv.k != VEXP), "syntax error");
+ left = assignment(ls, &nv, nvars+1);
+ }
+ else { /* assignment -> '=' explist1 */
+ int nexps;
+ check(ls, '=');
+ nexps = explist1(ls);
+ adjust_mult_assign(ls, nvars, nexps);
+ }
+ if (v->k != VINDEXED)
+ luaK_storevar(ls, v);
+ else { /* there may be garbage between table-index and value */
+ luaK_code2(ls->fs, OP_SETTABLE, left+nvars+2, 1);
+ left += 2;
+ }
+ return left;
+}
+
+
+static void cond (LexState *ls, expdesc *v) {
+ /* cond -> exp */
+ expr(ls, v); /* read condition */
+ luaK_goiftrue(ls->fs, v, 0);
+}
+
+
+static void whilestat (LexState *ls, int line) {
+ /* whilestat -> WHILE cond DO block END */
+ FuncState *fs = ls->fs;
+ int while_init = luaK_getlabel(fs);
+ expdesc v;
+ Breaklabel bl;
+ enterbreak(fs, &bl);
+ next(ls);
+ cond(ls, &v);
+ check(ls, TK_DO);
+ block(ls);
+ luaK_patchlist(fs, luaK_jump(fs), while_init);
+ luaK_patchlist(fs, v.u.l.f, luaK_getlabel(fs));
+ check_match(ls, TK_END, TK_WHILE, line);
+ leavebreak(fs, &bl);
+}
+
+
+static void repeatstat (LexState *ls, int line) {
+ /* repeatstat -> REPEAT block UNTIL cond */
+ FuncState *fs = ls->fs;
+ int repeat_init = luaK_getlabel(fs);
+ expdesc v;
+ Breaklabel bl;
+ enterbreak(fs, &bl);
+ next(ls);
+ block(ls);
+ check_match(ls, TK_UNTIL, TK_REPEAT, line);
+ cond(ls, &v);
+ luaK_patchlist(fs, v.u.l.f, repeat_init);
+ leavebreak(fs, &bl);
+}
+
+
+static void forbody (LexState *ls, int nvar, OpCode prepfor, OpCode loopfor) {
+ /* forbody -> DO block END */
+ FuncState *fs = ls->fs;
+ int prep = luaK_code1(fs, prepfor, NO_JUMP);
+ int blockinit = luaK_getlabel(fs);
+ check(ls, TK_DO);
+ adjustlocalvars(ls, nvar); /* scope for control variables */
+ block(ls);
+ luaK_patchlist(fs, luaK_code1(fs, loopfor, NO_JUMP), blockinit);
+ luaK_patchlist(fs, prep, luaK_getlabel(fs));
+ removelocalvars(ls, nvar);
+}
+
+
+static void fornum (LexState *ls, TString *varname) {
+ /* fornum -> NAME = exp1,exp1[,exp1] forbody */
+ FuncState *fs = ls->fs;
+ check(ls, '=');
+ exp1(ls); /* initial value */
+ check(ls, ',');
+ exp1(ls); /* limit */
+ if (optional(ls, ','))
+ exp1(ls); /* optional step */
+ else
+ luaK_code1(fs, OP_PUSHINT, 1); /* default step */
+ new_localvar(ls, varname, 0);
+ new_localvarstr(ls, "(limit)", 1);
+ new_localvarstr(ls, "(step)", 2);
+ forbody(ls, 3, OP_FORPREP, OP_FORLOOP);
+}
+
+
+static void forlist (LexState *ls, TString *indexname) {
+ /* forlist -> NAME,NAME IN exp1 forbody */
+ TString *valname;
+ check(ls, ',');
+ valname = str_checkname(ls);
+ /* next test is dirty, but avoids `in' being a reserved word */
+ check_condition(ls,
+ (ls->t.token == TK_NAME && ls->t.seminfo.ts == luaS_new(ls->L, "in")),
+ "`in' expected");
+ next(ls); /* skip `in' */
+ exp1(ls); /* table */
+ new_localvarstr(ls, "(table)", 0);
+ new_localvar(ls, indexname, 1);
+ new_localvar(ls, valname, 2);
+ forbody(ls, 3, OP_LFORPREP, OP_LFORLOOP);
+}
+
+
+static void forstat (LexState *ls, int line) {
+ /* forstat -> fornum | forlist */
+ FuncState *fs = ls->fs;
+ TString *varname;
+ Breaklabel bl;
+ enterbreak(fs, &bl);
+ next(ls); /* skip `for' */
+ varname = str_checkname(ls); /* first variable name */
+ switch (ls->t.token) {
+ case '=': fornum(ls, varname); break;
+ case ',': forlist(ls, varname); break;
+ default: luaK_error(ls, "`=' or `,' expected");
+ }
+ check_match(ls, TK_END, TK_FOR, line);
+ leavebreak(fs, &bl);
+}
+
+
+static void test_then_block (LexState *ls, expdesc *v) {
+ /* test_then_block -> [IF | ELSEIF] cond THEN block */
+ next(ls); /* skip IF or ELSEIF */
+ cond(ls, v);
+ check(ls, TK_THEN);
+ block(ls); /* `then' part */
+}
+
+
+static void ifstat (LexState *ls, int line) {
+ /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */
+ FuncState *fs = ls->fs;
+ expdesc v;
+ int escapelist = NO_JUMP;
+ test_then_block(ls, &v); /* IF cond THEN block */
+ while (ls->t.token == TK_ELSEIF) {
+ luaK_concat(fs, &escapelist, luaK_jump(fs));
+ luaK_patchlist(fs, v.u.l.f, luaK_getlabel(fs));
+ test_then_block(ls, &v); /* ELSEIF cond THEN block */
+ }
+ if (ls->t.token == TK_ELSE) {
+ luaK_concat(fs, &escapelist, luaK_jump(fs));
+ luaK_patchlist(fs, v.u.l.f, luaK_getlabel(fs));
+ next(ls); /* skip ELSE */
+ block(ls); /* `else' part */
+ }
+ else
+ luaK_concat(fs, &escapelist, v.u.l.f);
+ luaK_patchlist(fs, escapelist, luaK_getlabel(fs));
+ check_match(ls, TK_END, TK_IF, line);
+}
+
+
+static void localstat (LexState *ls) {
+ /* stat -> LOCAL NAME {',' NAME} ['=' explist1] */
+ int nvars = 0;
+ int nexps;
+ do {
+ next(ls); /* skip LOCAL or ',' */
+ new_localvar(ls, str_checkname(ls), nvars++);
+ } while (ls->t.token == ',');
+ if (optional(ls, '='))
+ nexps = explist1(ls);
+ else
+ nexps = 0;
+ adjust_mult_assign(ls, nvars, nexps);
+ adjustlocalvars(ls, nvars);
+}
+
+
+static int funcname (LexState *ls, expdesc *v) {
+ /* funcname -> NAME [':' NAME | '.' NAME] */
+ int needself = 0;
+ singlevar(ls, str_checkname(ls), v);
+ if (ls->t.token == ':' || ls->t.token == '.') {
+ needself = (ls->t.token == ':');
+ next(ls);
+ luaK_tostack(ls, v, 1);
+ luaK_kstr(ls, checkname(ls));
+ v->k = VINDEXED;
+ }
+ return needself;
+}
+
+
+static void funcstat (LexState *ls, int line) {
+ /* funcstat -> FUNCTION funcname body */
+ int needself;
+ expdesc v;
+ next(ls); /* skip FUNCTION */
+ needself = funcname(ls, &v);
+ body(ls, needself, line);
+ luaK_storevar(ls, &v);
+}
+
+
+static void namestat (LexState *ls) {
+ /* stat -> func | ['%'] NAME assignment */
+ FuncState *fs = ls->fs;
+ expdesc v;
+ var_or_func(ls, &v);
+ if (v.k == VEXP) { /* stat -> func */
+ check_condition(ls, luaK_lastisopen(fs), "syntax error"); /* an upvalue? */
+ luaK_setcallreturns(fs, 0); /* call statement uses no results */
+ }
+ else { /* stat -> ['%'] NAME assignment */
+ int left = assignment(ls, &v, 1);
+ luaK_adjuststack(fs, left); /* remove eventual garbage left on stack */
+ }
+}
+
+
+static void retstat (LexState *ls) {
+ /* stat -> RETURN explist */
+ FuncState *fs = ls->fs;
+ next(ls); /* skip RETURN */
+ if (!block_follow(ls->t.token) && ls->t.token != ';')
+ explist1(ls); /* optional return values */
+ luaK_code1(fs, OP_RETURN, ls->fs->nactloc);
+ fs->stacklevel = fs->nactloc; /* removes all temp values */
+}
+
+
+static void breakstat (LexState *ls) {
+ /* stat -> BREAK [NAME] */
+ FuncState *fs = ls->fs;
+ int currentlevel = fs->stacklevel;
+ Breaklabel *bl = fs->bl;
+ if (!bl)
+ luaK_error(ls, "no loop to break");
+ next(ls); /* skip BREAK */
+ luaK_adjuststack(fs, currentlevel - bl->stacklevel);
+ luaK_concat(fs, &bl->breaklist, luaK_jump(fs));
+ /* correct stack for compiler and symbolic execution */
+ luaK_adjuststack(fs, bl->stacklevel - currentlevel);
+}
+
+
+static int stat (LexState *ls) {
+ int line = ls->linenumber; /* may be needed for error messages */
+ switch (ls->t.token) {
+ case TK_IF: { /* stat -> ifstat */
+ ifstat(ls, line);
+ return 0;
+ }
+ case TK_WHILE: { /* stat -> whilestat */
+ whilestat(ls, line);
+ return 0;
+ }
+ case TK_DO: { /* stat -> DO block END */
+ next(ls); /* skip DO */
+ block(ls);
+ check_match(ls, TK_END, TK_DO, line);
+ return 0;
+ }
+ case TK_FOR: { /* stat -> forstat */
+ forstat(ls, line);
+ return 0;
+ }
+ case TK_REPEAT: { /* stat -> repeatstat */
+ repeatstat(ls, line);
+ return 0;
+ }
+ case TK_FUNCTION: { /* stat -> funcstat */
+ funcstat(ls, line);
+ return 0;
+ }
+ case TK_LOCAL: { /* stat -> localstat */
+ localstat(ls);
+ return 0;
+ }
+ case TK_NAME: case '%': { /* stat -> namestat */
+ namestat(ls);
+ return 0;
+ }
+ case TK_RETURN: { /* stat -> retstat */
+ retstat(ls);
+ return 1; /* must be last statement */
+ }
+ case TK_BREAK: { /* stat -> breakstat */
+ breakstat(ls);
+ return 1; /* must be last statement */
+ }
+ default: {
+ luaK_error(ls, "<statement> expected");
+ return 0; /* to avoid warnings */
+ }
+ }
+}
+
+
+static void parlist (LexState *ls) {
+ /* parlist -> [ param { ',' param } ] */
+ int nparams = 0;
+ int dots = 0;
+ if (ls->t.token != ')') { /* is `parlist' not empty? */
+ do {
+ switch (ls->t.token) {
+ case TK_DOTS: next(ls); dots = 1; break;
+ case TK_NAME: new_localvar(ls, str_checkname(ls), nparams++); break;
+ default: luaK_error(ls, "<name> or `...' expected");
+ }
+ } while (!dots && optional(ls, ','));
+ }
+ code_params(ls, nparams, dots);
+}
+
+
+static void body (LexState *ls, int needself, int line) {
+ /* body -> '(' parlist ')' chunk END */
+ FuncState new_fs;
+ open_func(ls, &new_fs);
+ new_fs.f->lineDefined = line;
+ check(ls, '(');
+ if (needself) {
+ new_localvarstr(ls, "self", 0);
+ adjustlocalvars(ls, 1);
+ }
+ parlist(ls);
+ check(ls, ')');
+ chunk(ls);
+ check_match(ls, TK_END, TK_FUNCTION, line);
+ close_func(ls);
+ pushclosure(ls, &new_fs);
+}
+
+
+/* }====================================================================== */
+
+
+static void chunk (LexState *ls) {
+ /* chunk -> { stat [';'] } */
+ int islast = 0;
+ while (!islast && !block_follow(ls->t.token)) {
+ islast = stat(ls);
+ optional(ls, ';');
+ LUA_ASSERT(ls->fs->stacklevel == ls->fs->nactloc,
+ "stack size != # local vars");
+ }
+}
+
diff --git a/lua/src/lparser.h b/lua/src/lparser.h
new file mode 100644
index 0000000..b5eafb4
--- /dev/null
+++ b/lua/src/lparser.h
@@ -0,0 +1,60 @@
+/*
+** $Id: lparser.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** LL(1) Parser and code generator for Lua
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lparser_h
+#define lparser_h
+
+#include "lobject.h"
+#include "lzio.h"
+
+
+/*
+** Expression descriptor
+*/
+
+typedef enum {
+ VGLOBAL,
+ VLOCAL,
+ VINDEXED,
+ VEXP
+} expkind;
+
+typedef struct expdesc {
+ expkind k;
+ union {
+ int index; /* VGLOBAL: `kstr' index of global name; VLOCAL: stack index */
+ struct {
+ int t; /* patch list of `exit when true' */
+ int f; /* patch list of `exit when false' */
+ } l;
+ } u;
+} expdesc;
+
+
+
+/* state needed to generate code for a given function */
+typedef struct FuncState {
+ Proto *f; /* current function header */
+ struct FuncState *prev; /* enclosing function */
+ struct LexState *ls; /* lexical state */
+ struct lua_State *L; /* copy of the Lua state */
+ int pc; /* next position to code */
+ int lasttarget; /* `pc' of last `jump target' */
+ int jlt; /* list of jumps to `lasttarget' */
+ short stacklevel; /* number of values on activation register */
+ short nactloc; /* number of active local variables */
+ short nupvalues; /* number of upvalues */
+ int lastline; /* line where last `lineinfo' was generated */
+ struct Breaklabel *bl; /* chain of breakable blocks */
+ expdesc upvalues[MAXUPVALUES]; /* upvalues */
+ int actloc[MAXLOCALS]; /* local-variable stack (indices to locvars) */
+} FuncState;
+
+
+Proto *luaY_parser (lua_State *L, ZIO *z);
+
+
+#endif
diff --git a/lua/src/lstate.c b/lua/src/lstate.c
new file mode 100644
index 0000000..97ceb95
--- /dev/null
+++ b/lua/src/lstate.c
@@ -0,0 +1,121 @@
+/*
+** $Id: lstate.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Global State
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdio.h>
+
+#include "lua.h"
+
+#include "ldo.h"
+#include "lgc.h"
+#include "llex.h"
+#include "lmem.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+#include "ltm.h"
+
+
+#ifdef LUA_DEBUG
+static lua_State *lua_state = NULL;
+void luaB_opentests (lua_State *L);
+#endif
+
+
+/*
+** built-in implementation for ERRORMESSAGE. In a "correct" environment
+** ERRORMESSAGE should have an external definition, and so this function
+** would not be used.
+*/
+static int errormessage (lua_State *L) {
+ const char *s = lua_tostring(L, 1);
+ if (s == NULL) s = "(no message)";
+ fprintf(stderr, "error: %s\n", s);
+ return 0;
+}
+
+
+/*
+** open parts that may cause memory-allocation errors
+*/
+static void f_luaopen (lua_State *L, void *ud) {
+ int stacksize = *(int *)ud;
+ if (stacksize == 0)
+ stacksize = DEFAULT_STACK_SIZE;
+ else
+ stacksize += LUA_MINSTACK;
+ L->gt = luaH_new(L, 10); /* table of globals */
+ luaD_init(L, stacksize);
+ luaS_init(L);
+ luaX_init(L);
+ luaT_init(L);
+ lua_newtable(L);
+ lua_ref(L, 1); /* create registry */
+ lua_register(L, LUA_ERRORMESSAGE, errormessage);
+#ifdef LUA_DEBUG
+ luaB_opentests(L);
+ if (lua_state == NULL) lua_state = L; /* keep first state to be opened */
+#endif
+ LUA_ASSERT(lua_gettop(L) == 0, "wrong API stack");
+}
+
+
+LUA_API lua_State *lua_open (int stacksize) {
+ lua_State *L = luaM_new(NULL, lua_State);
+ if (L == NULL) return NULL; /* memory allocation error */
+ L->stack = NULL;
+ L->strt.size = L->udt.size = 0;
+ L->strt.nuse = L->udt.nuse = 0;
+ L->strt.hash = NULL;
+ L->udt.hash = NULL;
+ L->Mbuffer = NULL;
+ L->Mbuffsize = 0;
+ L->rootproto = NULL;
+ L->rootcl = NULL;
+ L->roottable = NULL;
+ L->TMtable = NULL;
+ L->last_tag = -1;
+ L->refArray = NULL;
+ L->refSize = 0;
+ L->refFree = NONEXT;
+ L->nblocks = sizeof(lua_State);
+ L->GCthreshold = MAX_INT; /* to avoid GC during pre-definitions */
+ L->callhook = NULL;
+ L->linehook = NULL;
+ L->allowhooks = 1;
+ L->errorJmp = NULL;
+ if (luaD_runprotected(L, f_luaopen, &stacksize) != 0) {
+ /* memory allocation error: free partial state */
+ lua_close(L);
+ return NULL;
+ }
+ L->GCthreshold = 2*L->nblocks;
+ return L;
+}
+
+
+LUA_API void lua_close (lua_State *L) {
+ LUA_ASSERT(L != lua_state || lua_gettop(L) == 0, "garbage in C stack");
+ luaC_collect(L, 1); /* collect all elements */
+ LUA_ASSERT(L->rootproto == NULL, "list should be empty");
+ LUA_ASSERT(L->rootcl == NULL, "list should be empty");
+ LUA_ASSERT(L->roottable == NULL, "list should be empty");
+ luaS_freeall(L);
+ if (L->stack)
+ L->nblocks -= (L->stack_last - L->stack + 1)*sizeof(TObject);
+ luaM_free(L, L->stack);
+ L->nblocks -= (L->last_tag+1)*sizeof(struct TM);
+ luaM_free(L, L->TMtable);
+ L->nblocks -= (L->refSize)*sizeof(struct Ref);
+ luaM_free(L, L->refArray);
+ L->nblocks -= (L->Mbuffsize)*sizeof(char);
+ luaM_free(L, L->Mbuffer);
+ LUA_ASSERT(L->nblocks == sizeof(lua_State), "wrong count for nblocks");
+ luaM_free(L, L);
+ LUA_ASSERT(L != lua_state || memdebug_numblocks == 0, "memory leak!");
+ LUA_ASSERT(L != lua_state || memdebug_total == 0,"memory leak!");
+}
+
diff --git a/lua/src/lstate.h b/lua/src/lstate.h
new file mode 100644
index 0000000..4bb42e7
--- /dev/null
+++ b/lua/src/lstate.h
@@ -0,0 +1,77 @@
+/*
+** $Id: lstate.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Global State
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lstate_h
+#define lstate_h
+
+#include "lobject.h"
+#include "lua.h"
+#include "luadebug.h"
+
+
+
+typedef TObject *StkId; /* index to stack elements */
+
+
+/*
+** marks for Reference array
+*/
+#define NONEXT -1 /* to end the free list */
+#define HOLD -2
+#define COLLECTED -3
+#define LOCK -4
+
+
+struct Ref {
+ TObject o;
+ int st; /* can be LOCK, HOLD, COLLECTED, or next (for free list) */
+};
+
+
+struct lua_longjmp; /* defined in ldo.c */
+struct TM; /* defined in ltm.h */
+
+
+typedef struct stringtable {
+ int size;
+ lint32 nuse; /* number of elements */
+ TString **hash;
+} stringtable;
+
+
+
+struct lua_State {
+ /* thread-specific state */
+ StkId top; /* first free slot in the stack */
+ StkId stack; /* stack base */
+ StkId stack_last; /* last free slot in the stack */
+ int stacksize;
+ StkId Cbase; /* base for current C function */
+ struct lua_longjmp *errorJmp; /* current error recover point */
+ char *Mbuffer; /* global buffer */
+ size_t Mbuffsize; /* size of Mbuffer */
+ /* global state */
+ Proto *rootproto; /* list of all prototypes */
+ Closure *rootcl; /* list of all closures */
+ Hash *roottable; /* list of all tables */
+ stringtable strt; /* hash table for strings */
+ stringtable udt; /* hash table for udata */
+ Hash *gt; /* table for globals */
+ struct TM *TMtable; /* table for tag methods */
+ int last_tag; /* last used tag in TMtable */
+ struct Ref *refArray; /* locked objects */
+ int refSize; /* size of refArray */
+ int refFree; /* list of free positions in refArray */
+ unsigned long GCthreshold;
+ unsigned long nblocks; /* number of `bytes' currently allocated */
+ lua_Hook callhook;
+ lua_Hook linehook;
+ int allowhooks;
+};
+
+
+#endif
+
diff --git a/lua/src/lstring.c b/lua/src/lstring.c
new file mode 100644
index 0000000..7b8cda9
--- /dev/null
+++ b/lua/src/lstring.c
@@ -0,0 +1,155 @@
+/*
+** $Id: lstring.c,v 1.2 2002/07/12 07:49:04 jcatki Exp $
+** String table (keeps all strings handled by Lua)
+** See Copyright Notice in lua.h
+*/
+
+
+#include <string.h>
+
+#include "lua.h"
+
+#include "lmem.h"
+#include "lobject.h"
+#include "lstate.h"
+#include "lstring.h"
+
+
+/*
+** type equivalent to TString, but with maximum alignment requirements
+*/
+union L_UTString {
+ TString ts;
+ union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
+};
+
+
+
+void luaS_init (lua_State *L) {
+ L->strt.hash = luaM_newvector(L, 1, TString *);
+ L->udt.hash = luaM_newvector(L, 1, TString *);
+ L->nblocks += 2*sizeof(TString *);
+ L->strt.size = L->udt.size = 1;
+ L->strt.nuse = L->udt.nuse = 0;
+ L->strt.hash[0] = L->udt.hash[0] = NULL;
+}
+
+
+void luaS_freeall (lua_State *L) {
+ LUA_ASSERT(L->strt.nuse==0, "non-empty string table");
+ L->nblocks -= (L->strt.size + L->udt.size)*sizeof(TString *);
+ luaM_free(L, L->strt.hash);
+ LUA_ASSERT(L->udt.nuse==0, "non-empty udata table");
+ luaM_free(L, L->udt.hash);
+}
+
+
+static unsigned long hash_s (const char *s, size_t l) {
+ unsigned long h = l; /* seed */
+ size_t step = (l>>5)|1; /* if string is too long, don't hash all its chars */
+ for (; l>=step; l-=step)
+ h = h ^ ((h<<5)+(h>>2)+(unsigned char)*(s++));
+ return h;
+}
+
+
+void luaS_resize (lua_State *L, stringtable *tb, int newsize) {
+ TString **newhash = luaM_newvector(L, newsize, TString *);
+ int i;
+ for (i=0; i<newsize; i++) newhash[i] = NULL;
+ /* rehash */
+ for (i=0; i<tb->size; i++) {
+ TString *p = tb->hash[i];
+ while (p) { /* for each node in the list */
+ TString *next = p->nexthash; /* save next */
+ unsigned long h = (tb == &L->strt) ? p->u.s.hash : IntPoint(p->u.d.value);
+ int h1 = h&(newsize-1); /* new position */
+ LUA_ASSERT(h%newsize == (h&(newsize-1)),
+ "a&(x-1) == a%x, for x power of 2");
+ p->nexthash = newhash[h1]; /* chain it in new position */
+ newhash[h1] = p;
+ p = next;
+ }
+ }
+ luaM_free(L, tb->hash);
+ L->nblocks += (newsize - tb->size)*sizeof(TString *);
+ tb->size = newsize;
+ tb->hash = newhash;
+}
+
+
+static void newentry (lua_State *L, stringtable *tb, TString *ts, int h) {
+ ts->nexthash = tb->hash[h]; /* chain new entry */
+ tb->hash[h] = ts;
+ tb->nuse++;
+ if (tb->nuse > (lint32)tb->size && tb->size < MAX_INT/2) /* too crowded? */
+ luaS_resize(L, tb, tb->size*2);
+}
+
+
+
+TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
+ unsigned long h = hash_s(str, l);
+ int h1 = h & (L->strt.size-1);
+ TString *ts;
+ for (ts = L->strt.hash[h1]; ts; ts = ts->nexthash) {
+ if (ts->len == l && (memcmp(str, ts->str, l) == 0))
+ return ts;
+ }
+ /* not found */
+ ts = (TString *)luaM_malloc(L, sizestring(l));
+ ts->marked = 0;
+ ts->nexthash = NULL;
+ ts->len = l;
+ ts->u.s.hash = h;
+ ts->u.s.constindex = 0;
+ memcpy(ts->str, str, l);
+ ts->str[l] = 0; /* ending 0 */
+ L->nblocks += sizestring(l);
+ newentry(L, &L->strt, ts, h1); /* insert it on table */
+ return ts;
+}
+
+
+TString *luaS_newudata (lua_State *L, size_t s, void *udata) {
+ union L_UTString *uts = (union L_UTString *)luaM_malloc(L,
+ (lint32)sizeof(union L_UTString)+s);
+ TString *ts = &uts->ts;
+ ts->marked = 0;
+ ts->nexthash = NULL;
+ ts->len = s;
+ ts->u.d.tag = 0;
+ ts->u.d.value = (s > 0) ? uts+1 : udata;
+ L->nblocks += sizestring(s);
+ /* insert it on table */
+ newentry(L, &L->udt, ts, IntPoint(ts->u.d.value) & (L->udt.size-1));
+ return ts;
+}
+
+
+TString *luaS_createudata (lua_State *L, void *udata, int tag) {
+ int h1 = IntPoint(udata) & (L->udt.size-1);
+ TString *ts;
+ for (ts = L->udt.hash[h1]; ts; ts = ts->nexthash) {
+ if (udata == ts->u.d.value && (tag == ts->u.d.tag || tag == LUA_ANYTAG))
+ return ts;
+ }
+ /* not found */
+ ts = luaS_newudata(L, 0, udata);
+ if (tag != LUA_ANYTAG)
+ ts->u.d.tag = tag;
+ return ts;
+}
+
+
+TString *luaS_new (lua_State *L, const char *str) {
+ return luaS_newlstr(L, str, strlen(str));
+}
+
+
+TString *luaS_newfixed (lua_State *L, const char *str) {
+ TString *ts = luaS_new(L, str);
+ if (ts->marked == 0) ts->marked = FIXMARK; /* avoid GC */
+ return ts;
+}
+
diff --git a/lua/src/lstring.h b/lua/src/lstring.h
new file mode 100644
index 0000000..f83c36e
--- /dev/null
+++ b/lua/src/lstring.h
@@ -0,0 +1,37 @@
+/*
+** $Id: lstring.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** String table (keep all strings handled by Lua)
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lstring_h
+#define lstring_h
+
+
+#include "lobject.h"
+#include "lstate.h"
+
+
+/*
+** any TString with mark>=FIXMARK is never collected.
+** Marks>=RESERVEDMARK are used to identify reserved words.
+*/
+#define FIXMARK 2
+#define RESERVEDMARK 3
+
+
+#define sizestring(l) ((long)sizeof(TString) + \
+ ((long)(l+1)-TSPACK)*(long)sizeof(char))
+
+
+void luaS_init (lua_State *L);
+void luaS_resize (lua_State *L, stringtable *tb, int newsize);
+TString *luaS_newudata (lua_State *L, size_t s, void *udata);
+TString *luaS_createudata (lua_State *L, void *udata, int tag);
+void luaS_freeall (lua_State *L);
+TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
+TString *luaS_new (lua_State *L, const char *str);
+TString *luaS_newfixed (lua_State *L, const char *str);
+
+
+#endif
diff --git a/lua/src/ltable.c b/lua/src/ltable.c
new file mode 100644
index 0000000..7cb5d35
--- /dev/null
+++ b/lua/src/ltable.c
@@ -0,0 +1,303 @@
+/*
+** $Id: ltable.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Lua tables (hash)
+** See Copyright Notice in lua.h
+*/
+
+
+/*
+** Implementation of tables (aka arrays, objects, or hash tables);
+** uses a mix of chained scatter table with Brent's variation.
+** A main invariant of these tables is that, if an element is not
+** in its main position (i.e. the `original' position that its hash gives
+** to it), then the colliding element is in its own main position.
+** In other words, there are collisions only when two elements have the
+** same main position (i.e. the same hash values for that table size).
+** Because of that, the load factor of these tables can be 100% without
+** performance penalties.
+*/
+
+
+#include "lua.h"
+
+#include "lmem.h"
+#include "lobject.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+
+
+#define gcsize(L, n) (sizeof(Hash)+(n)*sizeof(Node))
+
+
+
+#define TagDefault LUA_TTABLE
+
+
+
+/*
+** returns the `main' position of an element in a table (that is, the index
+** of its hash value)
+*/
+Node *luaH_mainposition (const Hash *t, const TObject *key) {
+ unsigned long h;
+ switch (ttype(key)) {
+ case LUA_TNUMBER:
+ h = (unsigned long)(long)nvalue(key);
+ break;
+ case LUA_TSTRING:
+ h = tsvalue(key)->u.s.hash;
+ break;
+ case LUA_TUSERDATA:
+ h = IntPoint(tsvalue(key));
+ break;
+ case LUA_TTABLE:
+ h = IntPoint(hvalue(key));
+ break;
+ case LUA_TFUNCTION:
+ h = IntPoint(clvalue(key));
+ break;
+ default:
+ return NULL; /* invalid key */
+ }
+ LUA_ASSERT(h%(unsigned int)t->size == (h&((unsigned int)t->size-1)),
+ "a&(x-1) == a%x, for x power of 2");
+ return &t->node[h&(t->size-1)];
+}
+
+
+static const TObject *luaH_getany (lua_State *L, const Hash *t,
+ const TObject *key) {
+ Node *n = luaH_mainposition(t, key);
+ if (!n)
+ lua_error(L, "table index is nil");
+ else do {
+ if (luaO_equalObj(key, &n->key))
+ return &n->val;
+ n = n->next;
+ } while (n);
+ return &luaO_nilobject; /* key not found */
+}
+
+
+/* specialized version for numbers */
+const TObject *luaH_getnum (const Hash *t, Number key) {
+ Node *n = &t->node[(unsigned long)(long)key&(t->size-1)];
+ do {
+ if (ttype(&n->key) == LUA_TNUMBER && nvalue(&n->key) == key)
+ return &n->val;
+ n = n->next;
+ } while (n);
+ return &luaO_nilobject; /* key not found */
+}
+
+
+/* specialized version for strings */
+const TObject *luaH_getstr (const Hash *t, TString *key) {
+ Node *n = &t->node[key->u.s.hash&(t->size-1)];
+ do {
+ if (ttype(&n->key) == LUA_TSTRING && tsvalue(&n->key) == key)
+ return &n->val;
+ n = n->next;
+ } while (n);
+ return &luaO_nilobject; /* key not found */
+}
+
+
+const TObject *luaH_get (lua_State *L, const Hash *t, const TObject *key) {
+ switch (ttype(key)) {
+ case LUA_TNUMBER: return luaH_getnum(t, nvalue(key));
+ case LUA_TSTRING: return luaH_getstr(t, tsvalue(key));
+ default: return luaH_getany(L, t, key);
+ }
+}
+
+
+Node *luaH_next (lua_State *L, const Hash *t, const TObject *key) {
+ int i;
+ if (ttype(key) == LUA_TNIL)
+ i = 0; /* first iteration */
+ else {
+ const TObject *v = luaH_get(L, t, key);
+ if (v == &luaO_nilobject)
+ lua_error(L, "invalid key for `next'");
+ i = (int)(((const char *)v -
+ (const char *)(&t->node[0].val)) / sizeof(Node)) + 1;
+ }
+ for (; i<t->size; i++) {
+ Node *n = node(t, i);
+ if (ttype(val(n)) != LUA_TNIL)
+ return n;
+ }
+ return NULL; /* no more elements */
+}
+
+
+/*
+** try to remove a key without value from a table. To avoid problems with
+** hash, change `key' for a number with the same hash.
+*/
+void luaH_remove (Hash *t, TObject *key) {
+ if (ttype(key) == LUA_TNUMBER ||
+ (ttype(key) == LUA_TSTRING && tsvalue(key)->len <= 30))
+ return; /* do not remove numbers nor small strings */
+ else {
+ /* try to find a number `n' with the same hash as `key' */
+ Node *mp = luaH_mainposition(t, key);
+ int n = mp - &t->node[0];
+ /* make sure `n' is not in `t' */
+ while (luaH_getnum(t, n) != &luaO_nilobject) {
+ if (n >= MAX_INT - t->size)
+ return; /* give up; (to avoid overflow) */
+ n += t->size;
+ }
+ ttype(key) = LUA_TNUMBER;
+ nvalue(key) = n;
+ LUA_ASSERT(luaH_mainposition(t, key) == mp, "cannot change hash");
+ }
+}
+
+
+static void setnodevector (lua_State *L, Hash *t, lint32 size) {
+ int i;
+ if (size > MAX_INT)
+ lua_error(L, "table overflow");
+ t->node = luaM_newvector(L, size, Node);
+ for (i=0; i<(int)size; i++) {
+ ttype(&t->node[i].key) = ttype(&t->node[i].val) = LUA_TNIL;
+ t->node[i].next = NULL;
+ }
+ L->nblocks += gcsize(L, size) - gcsize(L, t->size);
+ t->size = size;
+ t->firstfree = &t->node[size-1]; /* first free position to be used */
+}
+
+
+Hash *luaH_new (lua_State *L, int size) {
+ Hash *t = luaM_new(L, Hash);
+ t->htag = TagDefault;
+ t->next = L->roottable;
+ L->roottable = t;
+ t->mark = t;
+ t->size = 0;
+ L->nblocks += gcsize(L, 0);
+ t->node = NULL;
+ setnodevector(L, t, luaO_power2(size));
+ return t;
+}
+
+
+void luaH_free (lua_State *L, Hash *t) {
+ L->nblocks -= gcsize(L, t->size);
+ luaM_free(L, t->node);
+ luaM_free(L, t);
+}
+
+
+static int numuse (const Hash *t) {
+ Node *v = t->node;
+ int size = t->size;
+ int realuse = 0;
+ int i;
+ for (i=0; i<size; i++) {
+ if (ttype(&v[i].val) != LUA_TNIL)
+ realuse++;
+ }
+ return realuse;
+}
+
+
+static void rehash (lua_State *L, Hash *t) {
+ int oldsize = t->size;
+ Node *nold = t->node;
+ int nelems = numuse(t);
+ int i;
+ LUA_ASSERT(nelems<=oldsize, "wrong count");
+ if (nelems >= oldsize-oldsize/4) /* using more than 3/4? */
+ setnodevector(L, t, (lint32)oldsize*2);
+ else if (nelems <= oldsize/4 && /* less than 1/4? */
+ oldsize > MINPOWER2)
+ setnodevector(L, t, oldsize/2);
+ else
+ setnodevector(L, t, oldsize);
+ for (i=0; i<oldsize; i++) {
+ Node *old = nold+i;
+ if (ttype(&old->val) != LUA_TNIL)
+ *luaH_set(L, t, &old->key) = old->val;
+ }
+ luaM_free(L, nold); /* free old array */
+}
+
+
+/*
+** inserts a key into a hash table; first, check whether key is
+** already present; if not, check whether key's main position is free;
+** if not, check whether colliding node is in its main position or not;
+** if it is not, move colliding node to an empty place and put new key
+** in its main position; otherwise (colliding node is in its main position),
+** new key goes to an empty position.
+*/
+TObject *luaH_set (lua_State *L, Hash *t, const TObject *key) {
+ Node *mp = luaH_mainposition(t, key);
+ Node *n = mp;
+ if (!mp)
+ lua_error(L, "table index is nil");
+ do { /* check whether `key' is somewhere in the chain */
+ if (luaO_equalObj(key, &n->key))
+ return &n->val; /* that's all */
+ else n = n->next;
+ } while (n);
+ /* `key' not found; must insert it */
+ if (ttype(&mp->key) != LUA_TNIL) { /* main position is not free? */
+ Node *othern; /* main position of colliding node */
+ n = t->firstfree; /* get a free place */
+ /* is colliding node out of its main position? (can only happens if
+ its position is after "firstfree") */
+ if (mp > n && (othern=luaH_mainposition(t, &mp->key)) != mp) {
+ /* yes; move colliding node into free position */
+ while (othern->next != mp) othern = othern->next; /* find previous */
+ othern->next = n; /* redo the chain with `n' in place of `mp' */
+ *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */
+ mp->next = NULL; /* now `mp' is free */
+ }
+ else { /* colliding node is in its own main position */
+ /* new node will go into free position */
+ n->next = mp->next; /* chain new position */
+ mp->next = n;
+ mp = n;
+ }
+ }
+ mp->key = *key;
+ for (;;) { /* correct `firstfree' */
+ if (ttype(&t->firstfree->key) == LUA_TNIL)
+ return &mp->val; /* OK; table still has a free place */
+ else if (t->firstfree == t->node) break; /* cannot decrement from here */
+ else (t->firstfree)--;
+ }
+ rehash(L, t); /* no more free places */
+ return luaH_set(L, t, key); /* `rehash' invalidates this insertion */
+}
+
+
+TObject *luaH_setint (lua_State *L, Hash *t, int key) {
+ TObject index;
+ ttype(&index) = LUA_TNUMBER;
+ nvalue(&index) = key;
+ return luaH_set(L, t, &index);
+}
+
+
+void luaH_setstrnum (lua_State *L, Hash *t, TString *key, Number val) {
+ TObject *value, index;
+ ttype(&index) = LUA_TSTRING;
+ tsvalue(&index) = key;
+ value = luaH_set(L, t, &index);
+ ttype(value) = LUA_TNUMBER;
+ nvalue(value) = val;
+}
+
+
+const TObject *luaH_getglobal (lua_State *L, const char *name) {
+ return luaH_getstr(L->gt, luaS_new(L, name));
+}
+
diff --git a/lua/src/ltable.h b/lua/src/ltable.h
new file mode 100644
index 0000000..2e57533
--- /dev/null
+++ b/lua/src/ltable.h
@@ -0,0 +1,34 @@
+/*
+** $Id: ltable.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Lua tables (hash)
+** See Copyright Notice in lua.h
+*/
+
+#ifndef ltable_h
+#define ltable_h
+
+#include "lobject.h"
+
+
+#define node(t,i) (&(t)->node[i])
+#define key(n) (&(n)->key)
+#define val(n) (&(n)->val)
+
+Hash *luaH_new (lua_State *L, int nhash);
+void luaH_free (lua_State *L, Hash *t);
+const TObject *luaH_get (lua_State *L, const Hash *t, const TObject *key);
+const TObject *luaH_getnum (const Hash *t, Number key);
+const TObject *luaH_getstr (const Hash *t, TString *key);
+void luaH_remove (Hash *t, TObject *key);
+TObject *luaH_set (lua_State *L, Hash *t, const TObject *key);
+Node * luaH_next (lua_State *L, const Hash *t, const TObject *r);
+TObject *luaH_setint (lua_State *L, Hash *t, int key);
+void luaH_setstrnum (lua_State *L, Hash *t, TString *key, Number val);
+unsigned long luaH_hash (lua_State *L, const TObject *key);
+const TObject *luaH_getglobal (lua_State *L, const char *name);
+
+/* exported only for debugging */
+Node *luaH_mainposition (const Hash *t, const TObject *key);
+
+
+#endif
diff --git a/lua/src/ltests.c b/lua/src/ltests.c
new file mode 100644
index 0000000..7a69a39
--- /dev/null
+++ b/lua/src/ltests.c
@@ -0,0 +1,543 @@
+/*
+** $Id: ltests.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Internal Module for Debugging of the Lua Implementation
+** See Copyright Notice in lua.h
+*/
+
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#include "lua.h"
+
+#include "lapi.h"
+#include "lauxlib.h"
+#include "lcode.h"
+#include "ldebug.h"
+#include "ldo.h"
+#include "lfunc.h"
+#include "lmem.h"
+#include "lopcodes.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+#include "luadebug.h"
+#include "lualib.h"
+
+
+void luaB_opentests (lua_State *L);
+
+
+/*
+** The whole module only makes sense with LUA_DEBUG on
+*/
+#ifdef LUA_DEBUG
+
+
+
+static void setnameval (lua_State *L, const char *name, int val) {
+ lua_pushstring(L, name);
+ lua_pushnumber(L, val);
+ lua_settable(L, -3);
+}
+
+
+/*
+** {======================================================
+** Disassembler
+** =======================================================
+*/
+
+
+static const char *const instrname[NUM_OPCODES] = {
+ "END", "RETURN", "CALL", "TAILCALL", "PUSHNIL", "POP", "PUSHINT",
+ "PUSHSTRING", "PUSHNUM", "PUSHNEGNUM", "PUSHUPVALUE", "GETLOCAL",
+ "GETGLOBAL", "GETTABLE", "GETDOTTED", "GETINDEXED", "PUSHSELF",
+ "CREATETABLE", "SETLOCAL", "SETGLOBAL", "SETTABLE", "SETLIST", "SETMAP",
+ "ADD", "ADDI", "SUB", "MULT", "DIV", "POW", "CONCAT", "MINUS", "NOT",
+ "JMPNE", "JMPEQ", "JMPLT", "JMPLE", "JMPGT", "JMPGE", "JMPT", "JMPF",
+ "JMPONT", "JMPONF", "JMP", "PUSHNILJMP", "FORPREP", "FORLOOP", "LFORPREP",
+ "LFORLOOP", "CLOSURE"
+};
+
+
+static int pushop (lua_State *L, Proto *p, int pc) {
+ char buff[100];
+ Instruction i = p->code[pc];
+ OpCode o = GET_OPCODE(i);
+ const char *name = instrname[o];
+ sprintf(buff, "%5d - ", luaG_getline(p->lineinfo, pc, 1, NULL));
+ switch ((enum Mode)luaK_opproperties[o].mode) {
+ case iO:
+ sprintf(buff+8, "%-12s", name);
+ break;
+ case iU:
+ sprintf(buff+8, "%-12s%4u", name, GETARG_U(i));
+ break;
+ case iS:
+ sprintf(buff+8, "%-12s%4d", name, GETARG_S(i));
+ break;
+ case iAB:
+ sprintf(buff+8, "%-12s%4d %4d", name, GETARG_A(i), GETARG_B(i));
+ break;
+ }
+ lua_pushstring(L, buff);
+ return (o != OP_END);
+}
+
+
+static int listcode (lua_State *L) {
+ int pc;
+ Proto *p;
+ int res;
+ luaL_arg_check(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1),
+ 1, "Lua function expected");
+ p = clvalue(luaA_index(L, 1))->f.l;
+ lua_newtable(L);
+ setnameval(L, "maxstack", p->maxstacksize);
+ setnameval(L, "numparams", p->numparams);
+ pc = 0;
+ do {
+ lua_pushnumber(L, pc+1);
+ res = pushop(L, p, pc++);
+ lua_settable(L, -3);
+ } while (res);
+ return 1;
+}
+
+
+static int liststrings (lua_State *L) {
+ Proto *p;
+ int i;
+ luaL_arg_check(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1),
+ 1, "Lua function expected");
+ p = clvalue(luaA_index(L, 1))->f.l;
+ lua_newtable(L);
+ for (i=0; i<p->nkstr; i++) {
+ lua_pushnumber(L, i+1);
+ lua_pushstring(L, p->kstr[i]->str);
+ lua_settable(L, -3);
+ }
+ return 1;
+}
+
+
+static int listlocals (lua_State *L) {
+ Proto *p;
+ int pc = luaL_check_int(L, 2) - 1;
+ int i = 0;
+ const char *name;
+ luaL_arg_check(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1),
+ 1, "Lua function expected");
+ p = clvalue(luaA_index(L, 1))->f.l;
+ while ((name = luaF_getlocalname(p, ++i, pc)) != NULL)
+ lua_pushstring(L, name);
+ return i-1;
+}
+
+/* }====================================================== */
+
+
+
+static int get_limits (lua_State *L) {
+ lua_newtable(L);
+ setnameval(L, "BITS_INT", BITS_INT);
+ setnameval(L, "LFPF", LFIELDS_PER_FLUSH);
+ setnameval(L, "MAXARG_A", MAXARG_A);
+ setnameval(L, "MAXARG_B", MAXARG_B);
+ setnameval(L, "MAXARG_S", MAXARG_S);
+ setnameval(L, "MAXARG_U", MAXARG_U);
+ setnameval(L, "MAXLOCALS", MAXLOCALS);
+ setnameval(L, "MAXPARAMS", MAXPARAMS);
+ setnameval(L, "MAXSTACK", MAXSTACK);
+ setnameval(L, "MAXUPVALUES", MAXUPVALUES);
+ setnameval(L, "MAXVARSLH", MAXVARSLH);
+ setnameval(L, "RFPF", RFIELDS_PER_FLUSH);
+ setnameval(L, "SIZE_A", SIZE_A);
+ setnameval(L, "SIZE_B", SIZE_B);
+ setnameval(L, "SIZE_OP", SIZE_OP);
+ setnameval(L, "SIZE_U", SIZE_U);
+ return 1;
+}
+
+
+static int mem_query (lua_State *L) {
+ if (lua_isnull(L, 1)) {
+ lua_pushnumber(L, memdebug_total);
+ lua_pushnumber(L, memdebug_numblocks);
+ lua_pushnumber(L, memdebug_maxmem);
+ return 3;
+ }
+ else {
+ memdebug_memlimit = luaL_check_int(L, 1);
+ return 0;
+ }
+}
+
+
+static int hash_query (lua_State *L) {
+ if (lua_isnull(L, 2)) {
+ luaL_arg_check(L, lua_tag(L, 1) == LUA_TSTRING, 1, "string expected");
+ lua_pushnumber(L, tsvalue(luaA_index(L, 1))->u.s.hash);
+ }
+ else {
+ Hash *t;
+ luaL_checktype(L, 2, LUA_TTABLE);
+ t = hvalue(luaA_index(L, 2));
+ lua_pushnumber(L, luaH_mainposition(t, luaA_index(L, 1)) - t->node);
+ }
+ return 1;
+}
+
+
+static int table_query (lua_State *L) {
+ const Hash *t;
+ int i = luaL_opt_int(L, 2, -1);
+ luaL_checktype(L, 1, LUA_TTABLE);
+ t = hvalue(luaA_index(L, 1));
+ if (i == -1) {
+ lua_pushnumber(L, t->size);
+ lua_pushnumber(L, t->firstfree - t->node);
+ return 2;
+ }
+ else if (i < t->size) {
+ luaA_pushobject(L, &t->node[i].key);
+ luaA_pushobject(L, &t->node[i].val);
+ if (t->node[i].next) {
+ lua_pushnumber(L, t->node[i].next - t->node);
+ return 3;
+ }
+ else
+ return 2;
+ }
+ return 0;
+}
+
+
+static int string_query (lua_State *L) {
+ stringtable *tb = (*luaL_check_string(L, 1) == 's') ? &L->strt : &L->udt;
+ int s = luaL_opt_int(L, 2, 0) - 1;
+ if (s==-1) {
+ lua_pushnumber(L ,tb->nuse);
+ lua_pushnumber(L ,tb->size);
+ return 2;
+ }
+ else if (s < tb->size) {
+ TString *ts;
+ int n = 0;
+ for (ts = tb->hash[s]; ts; ts = ts->nexthash) {
+ ttype(L->top) = LUA_TSTRING;
+ tsvalue(L->top) = ts;
+ incr_top;
+ n++;
+ }
+ return n;
+ }
+ return 0;
+}
+
+
+static int tref (lua_State *L) {
+ luaL_checkany(L, 1);
+ lua_pushvalue(L, 1);
+ lua_pushnumber(L, lua_ref(L, luaL_opt_int(L, 2, 1)));
+ return 1;
+}
+
+static int getref (lua_State *L) {
+ if (lua_getref(L, luaL_check_int(L, 1)))
+ return 1;
+ else
+ return 0;
+}
+
+static int unref (lua_State *L) {
+ lua_unref(L, luaL_check_int(L, 1));
+ return 0;
+}
+
+static int newuserdata (lua_State *L) {
+ if (lua_isnumber(L, 2))
+ lua_pushusertag(L, (void *)luaL_check_int(L, 1), luaL_check_int(L, 2));
+ else
+ lua_newuserdata(L, luaL_check_int(L, 1));
+ return 1;
+}
+
+static int udataval (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TUSERDATA);
+ lua_pushnumber(L, (int)lua_touserdata(L, 1));
+ return 1;
+}
+
+static int newstate (lua_State *L) {
+ lua_State *L1 = lua_open(luaL_check_int(L, 1));
+ if (L1)
+ lua_pushuserdata(L, L1);
+ else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int loadlib (lua_State *L) {
+ lua_State *L1 = (lua_State *)lua_touserdata(L, 1);
+ switch (*luaL_check_string(L, 2)) {
+ case 'm': lua_mathlibopen(L1); break;
+ case 's': lua_strlibopen(L1); break;
+ case 'i': lua_iolibopen(L1); break;
+ case 'd': lua_dblibopen(L1); break;
+ case 'b': lua_baselibopen(L1); break;
+ default: luaL_argerror(L, 2, "invalid option");
+ }
+ return 0;
+}
+
+static int closestate (lua_State *L) {
+ luaL_checktype(L, 1, LUA_TUSERDATA);
+ lua_close((lua_State *)lua_touserdata(L, 1));
+ return 0;
+}
+
+static int doremote (lua_State *L) {
+ lua_State *L1;
+ const char *code = luaL_check_string(L, 2);
+ int status;
+ luaL_checktype(L, 1, LUA_TUSERDATA);
+ L1 = (lua_State *)lua_touserdata(L, 1);
+ status = lua_dostring(L1, code);
+ if (status != 0) {
+ lua_pushnil(L);
+ lua_pushnumber(L, status);
+ return 2;
+ }
+ else {
+ int i = 0;
+ while (!lua_isnull(L1, ++i))
+ lua_pushstring(L, lua_tostring(L1, i));
+ return i-1;
+ }
+}
+
+static int settagmethod (lua_State *L) {
+ int tag = luaL_check_int(L, 1);
+ const char *event = luaL_check_string(L, 2);
+ luaL_checkany(L, 3);
+ lua_gettagmethod(L, tag, event);
+ lua_pushvalue(L, 3);
+ lua_settagmethod(L, tag, event);
+ return 1;
+}
+
+static int pushbool (lua_State *L, int b) {
+ if (b) lua_pushnumber(L, 1);
+ else lua_pushnil(L);
+ return 1;
+}
+
+static int equal (lua_State *L) {
+ return pushbool(L, lua_equal(L, 1, 2));
+}
+
+
+
+/*
+** {======================================================
+** function to test the API with C. It interprets a kind of "assembler"
+** language with calls to the API, so the test can be driven by Lua code
+** =======================================================
+*/
+
+static const char *const delimits = " \t\n,;";
+
+static void skip (const char **pc) {
+ while (**pc != '\0' && strchr(delimits, **pc)) (*pc)++;
+}
+
+static int getnum (lua_State *L, const char **pc) {
+ int res = 0;
+ int sig = 1;
+ skip(pc);
+ if (**pc == '.') {
+ res = (int)lua_tonumber(L, -1);
+ lua_pop(L, 1);
+ (*pc)++;
+ return res;
+ }
+ else if (**pc == '-') {
+ sig = -1;
+ (*pc)++;
+ }
+ while (isdigit(**pc)) res = res*10 + (*(*pc)++) - '0';
+ return sig*res;
+}
+
+static const char *getname (char *buff, const char **pc) {
+ int i = 0;
+ skip(pc);
+ while (**pc != '\0' && !strchr(delimits, **pc))
+ buff[i++] = *(*pc)++;
+ buff[i] = '\0';
+ return buff;
+}
+
+
+#define EQ(s1) (strcmp(s1, inst) == 0)
+
+#define getnum ((getnum)(L, &pc))
+#define getname ((getname)(buff, &pc))
+
+
+static int testC (lua_State *L) {
+ char buff[30];
+ const char *pc = luaL_check_string(L, 1);
+ for (;;) {
+ const char *inst = getname;
+ if EQ("") return 0;
+ else if EQ("isnumber") {
+ lua_pushnumber(L, lua_isnumber(L, getnum));
+ }
+ else if EQ("isstring") {
+ lua_pushnumber(L, lua_isstring(L, getnum));
+ }
+ else if EQ("istable") {
+ lua_pushnumber(L, lua_istable(L, getnum));
+ }
+ else if EQ("iscfunction") {
+ lua_pushnumber(L, lua_iscfunction(L, getnum));
+ }
+ else if EQ("isfunction") {
+ lua_pushnumber(L, lua_isfunction(L, getnum));
+ }
+ else if EQ("isuserdata") {
+ lua_pushnumber(L, lua_isuserdata(L, getnum));
+ }
+ else if EQ("isnil") {
+ lua_pushnumber(L, lua_isnil(L, getnum));
+ }
+ else if EQ("isnull") {
+ lua_pushnumber(L, lua_isnull(L, getnum));
+ }
+ else if EQ("tonumber") {
+ lua_pushnumber(L, lua_tonumber(L, getnum));
+ }
+ else if EQ("tostring") {
+ lua_pushstring(L, lua_tostring(L, getnum));
+ }
+ else if EQ("tonumber") {
+ lua_pushnumber(L, lua_tonumber(L, getnum));
+ }
+ else if EQ("strlen") {
+ lua_pushnumber(L, lua_strlen(L, getnum));
+ }
+ else if EQ("tocfunction") {
+ lua_pushcfunction(L, lua_tocfunction(L, getnum));
+ }
+ else if EQ("return") {
+ return getnum;
+ }
+ else if EQ("gettop") {
+ lua_pushnumber(L, lua_gettop(L));
+ }
+ else if EQ("settop") {
+ lua_settop(L, getnum);
+ }
+ else if EQ("pop") {
+ lua_pop(L, getnum);
+ }
+ else if EQ("pushnum") {
+ lua_pushnumber(L, getnum);
+ }
+ else if EQ("pushvalue") {
+ lua_pushvalue(L, getnum);
+ }
+ else if EQ("remove") {
+ lua_remove(L, getnum);
+ }
+ else if EQ("insert") {
+ lua_insert(L, getnum);
+ }
+ else if EQ("gettable") {
+ lua_gettable(L, getnum);
+ }
+ else if EQ("settable") {
+ lua_settable(L, getnum);
+ }
+ else if EQ("next") {
+ lua_next(L, -2);
+ }
+ else if EQ("concat") {
+ lua_concat(L, getnum);
+ }
+ else if EQ("rawcall") {
+ int narg = getnum;
+ int nres = getnum;
+ lua_rawcall(L, narg, nres);
+ }
+ else if EQ("call") {
+ int narg = getnum;
+ int nres = getnum;
+ lua_call(L, narg, nres);
+ }
+ else if EQ("dostring") {
+ lua_dostring(L, luaL_check_string(L, getnum));
+ }
+ else if EQ("settagmethod") {
+ int tag = getnum;
+ const char *event = getname;
+ lua_settagmethod(L, tag, event);
+ }
+ else if EQ("gettagmethod") {
+ int tag = getnum;
+ const char *event = getname;
+ lua_gettagmethod(L, tag, event);
+ }
+ else if EQ("type") {
+ lua_pushstring(L, lua_typename(L, lua_type(L, getnum)));
+ }
+ else luaL_verror(L, "unknown instruction %.30s", buff);
+ }
+ return 0;
+}
+
+/* }====================================================== */
+
+
+
+static const struct luaL_reg tests_funcs[] = {
+ {"hash", hash_query},
+ {"limits", get_limits},
+ {"listcode", listcode},
+ {"liststrings", liststrings},
+ {"listlocals", listlocals},
+ {"loadlib", loadlib},
+ {"querystr", string_query},
+ {"querytab", table_query},
+ {"testC", testC},
+ {"ref", tref},
+ {"getref", getref},
+ {"unref", unref},
+ {"newuserdata", newuserdata},
+ {"udataval", udataval},
+ {"newstate", newstate},
+ {"closestate", closestate},
+ {"doremote", doremote},
+ {"settagmethod", settagmethod},
+ {"equal", equal},
+ {"totalmem", mem_query}
+};
+
+
+void luaB_opentests (lua_State *L) {
+ lua_newtable(L);
+ lua_getglobals(L);
+ lua_pushvalue(L, -2);
+ lua_setglobals(L);
+ luaL_openl(L, tests_funcs); /* open functions inside new table */
+ lua_setglobals(L); /* restore old table of globals */
+ lua_setglobal(L, "T"); /* set new table as global T */
+}
+
+#endif
diff --git a/lua/src/ltm.c b/lua/src/ltm.c
new file mode 100644
index 0000000..34c3613
--- /dev/null
+++ b/lua/src/ltm.c
@@ -0,0 +1,163 @@
+/*
+** $Id: ltm.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Tag methods
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdio.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "ldo.h"
+#include "lmem.h"
+#include "lobject.h"
+#include "lstate.h"
+#include "ltm.h"
+
+
+const char *const luaT_eventname[] = { /* ORDER TM */
+ "gettable", "settable", "index", "getglobal", "setglobal", "add", "sub",
+ "mul", "div", "pow", "unm", "lt", "concat", "gc", "function",
+ "le", "gt", "ge", /* deprecated options!! */
+ NULL
+};
+
+
+static int findevent (const char *name) {
+ int i;
+ for (i=0; luaT_eventname[i]; i++)
+ if (strcmp(luaT_eventname[i], name) == 0)
+ return i;
+ return -1; /* name not found */
+}
+
+
+static int luaI_checkevent (lua_State *L, const char *name, int t) {
+ int e = findevent(name);
+ if (e >= TM_N)
+ luaO_verror(L, "event `%.50s' is deprecated", name);
+ if (e == TM_GC && t == LUA_TTABLE)
+ luaO_verror(L, "event `gc' for tables is deprecated");
+ if (e < 0)
+ luaO_verror(L, "`%.50s' is not a valid event name", name);
+ return e;
+}
+
+
+
+/* events in LUA_TNIL are all allowed, since this is used as a
+* 'placeholder' for "default" fallbacks
+*/
+/* ORDER LUA_T, ORDER TM */
+static const char luaT_validevents[NUM_TAGS][TM_N] = {
+ {1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* LUA_TUSERDATA */
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* LUA_TNIL */
+ {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, /* LUA_TNUMBER */
+ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, /* LUA_TSTRING */
+ {0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, /* LUA_TTABLE */
+ {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0} /* LUA_TFUNCTION */
+};
+
+int luaT_validevent (int t, int e) { /* ORDER LUA_T */
+ return (t >= NUM_TAGS) ? 1 : luaT_validevents[t][e];
+}
+
+
+static void init_entry (lua_State *L, int tag) {
+ int i;
+ for (i=0; i<TM_N; i++)
+ luaT_gettm(L, tag, i) = NULL;
+ L->TMtable[tag].collected = NULL;
+}
+
+
+void luaT_init (lua_State *L) {
+ int t;
+ luaM_growvector(L, L->TMtable, 0, NUM_TAGS, struct TM, "", MAX_INT);
+ L->nblocks += NUM_TAGS*sizeof(struct TM);
+ L->last_tag = NUM_TAGS-1;
+ for (t=0; t<=L->last_tag; t++)
+ init_entry(L, t);
+}
+
+
+LUA_API int lua_newtag (lua_State *L) {
+ luaM_growvector(L, L->TMtable, L->last_tag, 1, struct TM,
+ "tag table overflow", MAX_INT);
+ L->nblocks += sizeof(struct TM);
+ L->last_tag++;
+ init_entry(L, L->last_tag);
+ return L->last_tag;
+}
+
+
+static void checktag (lua_State *L, int tag) {
+ if (!(0 <= tag && tag <= L->last_tag))
+ luaO_verror(L, "%d is not a valid tag", tag);
+}
+
+void luaT_realtag (lua_State *L, int tag) {
+ if (!validtag(tag))
+ luaO_verror(L, "tag %d was not created by `newtag'", tag);
+}
+
+
+LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom) {
+ int e;
+ checktag(L, tagto);
+ checktag(L, tagfrom);
+ for (e=0; e<TM_N; e++) {
+ if (luaT_validevent(tagto, e))
+ luaT_gettm(L, tagto, e) = luaT_gettm(L, tagfrom, e);
+ }
+ return tagto;
+}
+
+
+int luaT_tag (const TObject *o) {
+ int t = ttype(o);
+ switch (t) {
+ case LUA_TUSERDATA: return tsvalue(o)->u.d.tag;
+ case LUA_TTABLE: return hvalue(o)->htag;
+ default: return t;
+ }
+}
+
+
+LUA_API void lua_gettagmethod (lua_State *L, int t, const char *event) {
+ int e;
+ e = luaI_checkevent(L, event, t);
+ checktag(L, t);
+ if (luaT_validevent(t, e) && luaT_gettm(L, t, e)) {
+ clvalue(L->top) = luaT_gettm(L, t, e);
+ ttype(L->top) = LUA_TFUNCTION;
+ }
+ else
+ ttype(L->top) = LUA_TNIL;
+ incr_top;
+}
+
+
+LUA_API void lua_settagmethod (lua_State *L, int t, const char *event) {
+ int e = luaI_checkevent(L, event, t);
+ checktag(L, t);
+ if (!luaT_validevent(t, e))
+ luaO_verror(L, "cannot change `%.20s' tag method for type `%.20s'%.20s",
+ luaT_eventname[e], luaO_typenames[t],
+ (t == LUA_TTABLE || t == LUA_TUSERDATA) ?
+ " with default tag" : "");
+ switch (ttype(L->top - 1)) {
+ case LUA_TNIL:
+ luaT_gettm(L, t, e) = NULL;
+ break;
+ case LUA_TFUNCTION:
+ luaT_gettm(L, t, e) = clvalue(L->top - 1);
+ break;
+ default:
+ lua_error(L, "tag method must be a function (or nil)");
+ }
+ L->top--;
+}
+
diff --git a/lua/src/ltm.h b/lua/src/ltm.h
new file mode 100644
index 0000000..bdb2814
--- /dev/null
+++ b/lua/src/ltm.h
@@ -0,0 +1,59 @@
+/*
+** $Id: ltm.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Tag methods
+** See Copyright Notice in lua.h
+*/
+
+#ifndef ltm_h
+#define ltm_h
+
+
+#include "lobject.h"
+#include "lstate.h"
+
+/*
+* WARNING: if you change the order of this enumeration,
+* grep "ORDER TM"
+*/
+typedef enum {
+ TM_GETTABLE = 0,
+ TM_SETTABLE,
+ TM_INDEX,
+ TM_GETGLOBAL,
+ TM_SETGLOBAL,
+ TM_ADD,
+ TM_SUB,
+ TM_MUL,
+ TM_DIV,
+ TM_POW,
+ TM_UNM,
+ TM_LT,
+ TM_CONCAT,
+ TM_GC,
+ TM_FUNCTION,
+ TM_N /* number of elements in the enum */
+} TMS;
+
+
+struct TM {
+ Closure *method[TM_N];
+ TString *collected; /* list of garbage-collected udata with this tag */
+};
+
+
+#define luaT_gettm(L,tag,event) (L->TMtable[tag].method[event])
+#define luaT_gettmbyObj(L,o,e) (luaT_gettm((L),luaT_tag(o),(e)))
+
+
+#define validtag(t) (NUM_TAGS <= (t) && (t) <= L->last_tag)
+
+extern const char *const luaT_eventname[];
+
+
+void luaT_init (lua_State *L);
+void luaT_realtag (lua_State *L, int tag);
+int luaT_tag (const TObject *o);
+int luaT_validevent (int t, int e); /* used by compatibility module */
+
+
+#endif
diff --git a/lua/src/lundump.c b/lua/src/lundump.c
new file mode 100644
index 0000000..aba26a2
--- /dev/null
+++ b/lua/src/lundump.c
@@ -0,0 +1,244 @@
+/*
+** $Id: lundump.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** load bytecodes from files
+** See Copyright Notice in lua.h
+*/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "lfunc.h"
+#include "lmem.h"
+#include "lopcodes.h"
+#include "lstring.h"
+#include "lundump.h"
+
+#define LoadByte ezgetc
+
+static const char* ZNAME (ZIO* Z)
+{
+ const char* s=zname(Z);
+ return (*s=='@') ? s+1 : s;
+}
+
+static void unexpectedEOZ (lua_State* L, ZIO* Z)
+{
+ luaO_verror(L,"unexpected end of file in `%.99s'",ZNAME(Z));
+}
+
+static int ezgetc (lua_State* L, ZIO* Z)
+{
+ int c=zgetc(Z);
+ if (c==EOZ) unexpectedEOZ(L,Z);
+ return c;
+}
+
+static void ezread (lua_State* L, ZIO* Z, void* b, int n)
+{
+ int r=zread(Z,b,n);
+ if (r!=0) unexpectedEOZ(L,Z);
+}
+
+static void LoadBlock (lua_State* L, void* b, size_t size, ZIO* Z, int swap)
+{
+ if (swap)
+ {
+ char *p=(char *) b+size-1;
+ int n=size;
+ while (n--) *p--=(char)ezgetc(L,Z);
+ }
+ else
+ ezread(L,Z,b,size);
+}
+
+static void LoadVector (lua_State* L, void* b, int m, size_t size, ZIO* Z, int swap)
+{
+ if (swap)
+ {
+ char *q=(char *) b;
+ while (m--)
+ {
+ char *p=q+size-1;
+ int n=size;
+ while (n--) *p--=(char)ezgetc(L,Z);
+ q+=size;
+ }
+ }
+ else
+ ezread(L,Z,b,m*size);
+}
+
+static int LoadInt (lua_State* L, ZIO* Z, int swap)
+{
+ int x;
+ LoadBlock(L,&x,sizeof(x),Z,swap);
+ return x;
+}
+
+static size_t LoadSize (lua_State* L, ZIO* Z, int swap)
+{
+ size_t x;
+ LoadBlock(L,&x,sizeof(x),Z,swap);
+ return x;
+}
+
+static Number LoadNumber (lua_State* L, ZIO* Z, int swap)
+{
+ Number x;
+ LoadBlock(L,&x,sizeof(x),Z,swap);
+ return x;
+}
+
+static TString* LoadString (lua_State* L, ZIO* Z, int swap)
+{
+ size_t size=LoadSize(L,Z,swap);
+ if (size==0)
+ return NULL;
+ else
+ {
+ char* s=luaO_openspace(L,size);
+ LoadBlock(L,s,size,Z,0);
+ return luaS_newlstr(L,s,size-1); /* remove trailing '\0' */
+ }
+}
+
+static void LoadCode (lua_State* L, Proto* tf, ZIO* Z, int swap)
+{
+ int size=LoadInt(L,Z,swap);
+ tf->code=luaM_newvector(L,size,Instruction);
+ LoadVector(L,tf->code,size,sizeof(*tf->code),Z,swap);
+ if (tf->code[size-1]!=OP_END) luaO_verror(L,"bad code in `%.99s'",ZNAME(Z));
+ luaF_protook(L,tf,size);
+}
+
+static void LoadLocals (lua_State* L, Proto* tf, ZIO* Z, int swap)
+{
+ int i,n;
+ tf->nlocvars=n=LoadInt(L,Z,swap);
+ tf->locvars=luaM_newvector(L,n,LocVar);
+ for (i=0; i<n; i++)
+ {
+ tf->locvars[i].varname=LoadString(L,Z,swap);
+ tf->locvars[i].startpc=LoadInt(L,Z,swap);
+ tf->locvars[i].endpc=LoadInt(L,Z,swap);
+ }
+}
+
+static void LoadLines (lua_State* L, Proto* tf, ZIO* Z, int swap)
+{
+ int n;
+ tf->nlineinfo=n=LoadInt(L,Z,swap);
+ tf->lineinfo=luaM_newvector(L,n,int);
+ LoadVector(L,tf->lineinfo,n,sizeof(*tf->lineinfo),Z,swap);
+}
+
+static Proto* LoadFunction (lua_State* L, ZIO* Z, int swap);
+
+static void LoadConstants (lua_State* L, Proto* tf, ZIO* Z, int swap)
+{
+ int i,n;
+ tf->nkstr=n=LoadInt(L,Z,swap);
+ tf->kstr=luaM_newvector(L,n,TString*);
+ for (i=0; i<n; i++)
+ tf->kstr[i]=LoadString(L,Z,swap);
+ tf->nknum=n=LoadInt(L,Z,swap);
+ tf->knum=luaM_newvector(L,n,Number);
+ LoadVector(L,tf->knum,n,sizeof(*tf->knum),Z,swap);
+ tf->nkproto=n=LoadInt(L,Z,swap);
+ tf->kproto=luaM_newvector(L,n,Proto*);
+ for (i=0; i<n; i++)
+ tf->kproto[i]=LoadFunction(L,Z,swap);
+}
+
+static Proto* LoadFunction (lua_State* L, ZIO* Z, int swap)
+{
+ Proto* tf=luaF_newproto(L);
+ tf->source=LoadString(L,Z,swap);
+ tf->lineDefined=LoadInt(L,Z,swap);
+ tf->numparams=LoadInt(L,Z,swap);
+ tf->is_vararg=LoadByte(L,Z);
+ tf->maxstacksize=LoadInt(L,Z,swap);
+ LoadLocals(L,tf,Z,swap);
+ LoadLines(L,tf,Z,swap);
+ LoadConstants(L,tf,Z,swap);
+ LoadCode(L,tf,Z,swap);
+ return tf;
+}
+
+static void LoadSignature (lua_State* L, ZIO* Z)
+{
+ const char* s=SIGNATURE;
+ while (*s!=0 && ezgetc(L,Z)==*s)
+ ++s;
+ if (*s!=0) luaO_verror(L,"bad signature in `%.99s'",ZNAME(Z));
+}
+
+static void TestSize (lua_State* L, int s, const char* what, ZIO* Z)
+{
+ int r=ezgetc(L,Z);
+ if (r!=s)
+ luaO_verror(L,"virtual machine mismatch in `%.99s':\n"
+ " %.20s is %d but read %d",ZNAME(Z),what,s,r);
+}
+
+#define TESTSIZE(s) TestSize(L,s,#s,Z)
+#define V(v) v/16,v%16
+
+static int LoadHeader (lua_State* L, ZIO* Z)
+{
+ int version,swap;
+ Number f=0,tf=TEST_NUMBER;
+ LoadSignature(L,Z);
+ version=ezgetc(L,Z);
+ if (version>VERSION)
+ luaO_verror(L,"`%.99s' too new:\n"
+ " read version %d.%d; expected at most %d.%d",
+ ZNAME(Z),V(version),V(VERSION));
+ if (version<VERSION0) /* check last major change */
+ luaO_verror(L,"`%.99s' too old:\n"
+ " read version %d.%d; expected at least %d.%d",
+ ZNAME(Z),V(version),V(VERSION));
+ swap=(luaU_endianess()!=ezgetc(L,Z)); /* need to swap bytes? */
+ TESTSIZE(sizeof(int));
+ TESTSIZE(sizeof(size_t));
+ TESTSIZE(sizeof(Instruction));
+ TESTSIZE(SIZE_INSTRUCTION);
+ TESTSIZE(SIZE_OP);
+ TESTSIZE(SIZE_B);
+ TESTSIZE(sizeof(Number));
+ f=LoadNumber(L,Z,swap);
+ if ((long)f!=(long)tf) /* disregard errors in last bit of fraction */
+ luaO_verror(L,"unknown number format in `%.99s':\n"
+ " read " NUMBER_FMT "; expected " NUMBER_FMT, ZNAME(Z),f,tf);
+ return swap;
+}
+
+static Proto* LoadChunk (lua_State* L, ZIO* Z)
+{
+ return LoadFunction(L,Z,LoadHeader(L,Z));
+}
+
+/*
+** load one chunk from a file or buffer
+** return main if ok and NULL at EOF
+*/
+Proto* luaU_undump (lua_State* L, ZIO* Z)
+{
+ Proto* tf=NULL;
+ int c=zgetc(Z);
+ if (c==ID_CHUNK)
+ tf=LoadChunk(L,Z);
+ c=zgetc(Z);
+ if (c!=EOZ)
+ luaO_verror(L,"`%.99s' apparently contains more than one chunk",ZNAME(Z));
+ return tf;
+}
+
+/*
+** find byte order
+*/
+int luaU_endianess (void)
+{
+ int x=1;
+ return *(char*)&x;
+}
diff --git a/lua/src/lundump.h b/lua/src/lundump.h
new file mode 100644
index 0000000..573afdf
--- /dev/null
+++ b/lua/src/lundump.h
@@ -0,0 +1,35 @@
+/*
+** $Id: lundump.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** load pre-compiled Lua chunks
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lundump_h
+#define lundump_h
+
+#include "lobject.h"
+#include "lzio.h"
+
+/* load one chunk */
+Proto* luaU_undump (lua_State* L, ZIO* Z);
+
+/* find byte order */
+int luaU_endianess (void);
+
+/* definitions for headers of binary files */
+#define VERSION 0x40 /* last format change was in 4.0 */
+#define VERSION0 0x40 /* last major change was in 4.0 */
+#define ID_CHUNK 27 /* binary files start with ESC... */
+#define SIGNATURE "Lua" /* ...followed by this signature */
+
+/* formats for error messages */
+#define SOURCE_FMT "<%d:%.99s>"
+#define SOURCE tf->lineDefined,tf->source->str
+#define IN_FMT " in %p " SOURCE_FMT
+#define IN tf,SOURCE
+
+/* a multiple of PI for testing native format */
+/* multiplying by 1E8 gives non-trivial integer values */
+#define TEST_NUMBER 3.14159265358979323846E8
+
+#endif
diff --git a/lua/src/lvm.c b/lua/src/lvm.c
new file mode 100644
index 0000000..fb736f6
--- /dev/null
+++ b/lua/src/lvm.c
@@ -0,0 +1,710 @@
+/*
+** $Id: lvm.c,v 1.2 2002/07/12 07:49:04 jcatki Exp $
+** Lua virtual machine
+** See Copyright Notice in lua.h
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "lapi.h"
+#include "ldebug.h"
+#include "ldo.h"
+#include "lfunc.h"
+#include "lgc.h"
+#include "lobject.h"
+#include "lopcodes.h"
+#include "lstate.h"
+#include "lstring.h"
+#include "ltable.h"
+#include "ltm.h"
+#include "lvm.h"
+
+
+#ifdef OLD_ANSI
+#define strcoll(a,b) strcmp(a,b)
+#endif
+
+
+
+/*
+** Extra stack size to run a function:
+** TAG_LINE(1), NAME(1), TM calls(3) (plus some extra...)
+*/
+#define EXTRA_STACK 8
+
+
+
+int luaV_tonumber (TObject *obj) {
+ if (ttype(obj) != LUA_TSTRING)
+ return 1;
+ else {
+ if (!luaO_str2d(svalue(obj), &nvalue(obj)))
+ return 2;
+ ttype(obj) = LUA_TNUMBER;
+ return 0;
+ }
+}
+
+
+int luaV_tostring (lua_State *L, TObject *obj) { /* LUA_NUMBER */
+ if (ttype(obj) != LUA_TNUMBER)
+ return 1;
+ else {
+ char s[32]; /* 16 digits, sign, point and \0 (+ some extra...) */
+ lua_number2str(s, nvalue(obj)); /* convert `s' to number */
+ tsvalue(obj) = luaS_new(L, s);
+ ttype(obj) = LUA_TSTRING;
+ return 0;
+ }
+}
+
+
+static void traceexec (lua_State *L, StkId base, StkId top, lua_Hook linehook) {
+ CallInfo *ci = infovalue(base-1);
+ int *lineinfo = ci->func->f.l->lineinfo;
+ int pc = (*ci->pc - ci->func->f.l->code) - 1;
+ int newline;
+ if (pc == 0) { /* may be first time? */
+ ci->line = 1;
+ ci->refi = 0;
+ ci->lastpc = pc+1; /* make sure it will call linehook */
+ }
+ newline = luaG_getline(lineinfo, pc, ci->line, &ci->refi);
+ /* calls linehook when enters a new line or jumps back (loop) */
+ if (newline != ci->line || pc <= ci->lastpc) {
+ ci->line = newline;
+ L->top = top;
+ luaD_lineHook(L, base-1, newline, linehook);
+ }
+ ci->lastpc = pc;
+}
+
+
+static Closure *luaV_closure (lua_State *L, int nelems) {
+ Closure *c = luaF_newclosure(L, nelems);
+ L->top -= nelems;
+ while (nelems--)
+ c->upvalue[nelems] = *(L->top+nelems);
+ clvalue(L->top) = c;
+ ttype(L->top) = LUA_TFUNCTION;
+ incr_top;
+ return c;
+}
+
+
+void luaV_Cclosure (lua_State *L, lua_CFunction c, int nelems) {
+ Closure *cl = luaV_closure(L, nelems);
+ cl->f.c = c;
+ cl->isC = 1;
+}
+
+
+void luaV_Lclosure (lua_State *L, Proto *l, int nelems) {
+ Closure *cl = luaV_closure(L, nelems);
+ cl->f.l = l;
+ cl->isC = 0;
+}
+
+
+/*
+** Function to index a table.
+** Receives the table at `t' and the key at top.
+*/
+const TObject *luaV_gettable (lua_State *L, StkId t) {
+ Closure *tm;
+ int tg;
+ if (ttype(t) == LUA_TTABLE && /* `t' is a table? */
+ ((tg = hvalue(t)->htag) == LUA_TTABLE || /* with default tag? */
+ luaT_gettm(L, tg, TM_GETTABLE) == NULL)) { /* or no TM? */
+ /* do a primitive get */
+ const TObject *h = luaH_get(L, hvalue(t), L->top-1);
+ /* result is no nil or there is no `index' tag method? */
+ if (ttype(h) != LUA_TNIL || ((tm=luaT_gettm(L, tg, TM_INDEX)) == NULL))
+ return h; /* return result */
+ /* else call `index' tag method */
+ }
+ else { /* try a `gettable' tag method */
+ tm = luaT_gettmbyObj(L, t, TM_GETTABLE);
+ }
+ if (tm != NULL) { /* is there a tag method? */
+ luaD_checkstack(L, 2);
+ *(L->top+1) = *(L->top-1); /* key */
+ *L->top = *t; /* table */
+ clvalue(L->top-1) = tm; /* tag method */
+ ttype(L->top-1) = LUA_TFUNCTION;
+ L->top += 2;
+ luaD_call(L, L->top - 3, 1);
+ return L->top - 1; /* call result */
+ }
+ else { /* no tag method */
+ luaG_typeerror(L, t, "index");
+ return NULL; /* to avoid warnings */
+ }
+}
+
+
+/*
+** Receives table at `t', key at `key' and value at top.
+*/
+void luaV_settable (lua_State *L, StkId t, StkId key) {
+ int tg;
+ if (ttype(t) == LUA_TTABLE && /* `t' is a table? */
+ ((tg = hvalue(t)->htag) == LUA_TTABLE || /* with default tag? */
+ luaT_gettm(L, tg, TM_SETTABLE) == NULL)) /* or no TM? */
+ *luaH_set(L, hvalue(t), key) = *(L->top-1); /* do a primitive set */
+ else { /* try a `settable' tag method */
+ Closure *tm = luaT_gettmbyObj(L, t, TM_SETTABLE);
+ if (tm != NULL) {
+ luaD_checkstack(L, 3);
+ *(L->top+2) = *(L->top-1);
+ *(L->top+1) = *key;
+ *(L->top) = *t;
+ clvalue(L->top-1) = tm;
+ ttype(L->top-1) = LUA_TFUNCTION;
+ L->top += 3;
+ luaD_call(L, L->top - 4, 0); /* call `settable' tag method */
+ }
+ else /* no tag method... */
+ luaG_typeerror(L, t, "index");
+ }
+}
+
+
+const TObject *luaV_getglobal (lua_State *L, TString *s) {
+ const TObject *value = luaH_getstr(L->gt, s);
+ Closure *tm = luaT_gettmbyObj(L, value, TM_GETGLOBAL);
+ if (tm == NULL) /* is there a tag method? */
+ return value; /* default behavior */
+ else { /* tag method */
+ luaD_checkstack(L, 3);
+ clvalue(L->top) = tm;
+ ttype(L->top) = LUA_TFUNCTION;
+ tsvalue(L->top+1) = s; /* global name */
+ ttype(L->top+1) = LUA_TSTRING;
+ *(L->top+2) = *value;
+ L->top += 3;
+ luaD_call(L, L->top - 3, 1);
+ return L->top - 1;
+ }
+}
+
+
+void luaV_setglobal (lua_State *L, TString *s) {
+ const TObject *oldvalue = luaH_getstr(L->gt, s);
+ Closure *tm = luaT_gettmbyObj(L, oldvalue, TM_SETGLOBAL);
+ if (tm == NULL) { /* is there a tag method? */
+ if (oldvalue != &luaO_nilobject) {
+ /* cast to remove `const' is OK, because `oldvalue' != luaO_nilobject */
+ *(TObject *)oldvalue = *(L->top - 1);
+ }
+ else {
+ TObject key;
+ ttype(&key) = LUA_TSTRING;
+ tsvalue(&key) = s;
+ *luaH_set(L, L->gt, &key) = *(L->top - 1);
+ }
+ }
+ else {
+ luaD_checkstack(L, 3);
+ *(L->top+2) = *(L->top-1); /* new value */
+ *(L->top+1) = *oldvalue;
+ ttype(L->top) = LUA_TSTRING;
+ tsvalue(L->top) = s;
+ clvalue(L->top-1) = tm;
+ ttype(L->top-1) = LUA_TFUNCTION;
+ L->top += 3;
+ luaD_call(L, L->top - 4, 0);
+ }
+}
+
+
+static int call_binTM (lua_State *L, StkId top, TMS event) {
+ /* try first operand */
+ Closure *tm = luaT_gettmbyObj(L, top-2, event);
+ L->top = top;
+ if (tm == NULL) {
+ tm = luaT_gettmbyObj(L, top-1, event); /* try second operand */
+ if (tm == NULL) {
+ tm = luaT_gettm(L, 0, event); /* try a `global' method */
+ if (tm == NULL)
+ return 0; /* error */
+ }
+ }
+ lua_pushstring(L, luaT_eventname[event]);
+ luaD_callTM(L, tm, 3, 1);
+ return 1;
+}
+
+
+static void call_arith (lua_State *L, StkId top, TMS event) {
+ if (!call_binTM(L, top, event))
+ luaG_binerror(L, top-2, LUA_TNUMBER, "perform arithmetic on");
+}
+
+
+static int luaV_strcomp (const TString *ls, const TString *rs) {
+ const char *l = ls->str;
+ size_t ll = ls->len;
+ const char *r = rs->str;
+ size_t lr = rs->len;
+ for (;;) {
+ int temp = strcoll(l, r);
+ if (temp != 0) return temp;
+ else { /* strings are equal up to a '\0' */
+ size_t len = strlen(l); /* index of first '\0' in both strings */
+ if (len == ll) /* l is finished? */
+ return (len == lr) ? 0 : -1; /* l is equal or smaller than r */
+ else if (len == lr) /* r is finished? */
+ return 1; /* l is greater than r (because l is not finished) */
+ /* both strings longer than `len'; go on comparing (after the '\0') */
+ len++;
+ l += len; ll -= len; r += len; lr -= len;
+ }
+ }
+}
+
+
+int luaV_lessthan (lua_State *L, const TObject *l, const TObject *r, StkId top) {
+ if (ttype(l) == LUA_TNUMBER && ttype(r) == LUA_TNUMBER)
+ return (nvalue(l) < nvalue(r));
+ else if (ttype(l) == LUA_TSTRING && ttype(r) == LUA_TSTRING)
+ return (luaV_strcomp(tsvalue(l), tsvalue(r)) < 0);
+ else { /* call TM */
+ luaD_checkstack(L, 2);
+ *top++ = *l;
+ *top++ = *r;
+ if (!call_binTM(L, top, TM_LT))
+ luaG_ordererror(L, top-2);
+ L->top--;
+ return (ttype(L->top) != LUA_TNIL);
+ }
+}
+
+
+void luaV_strconc (lua_State *L, int total, StkId top) {
+ do {
+ int n = 2; /* number of elements handled in this pass (at least 2) */
+ if (tostring(L, top-2) || tostring(L, top-1)) {
+ if (!call_binTM(L, top, TM_CONCAT))
+ luaG_binerror(L, top-2, LUA_TSTRING, "concat");
+ }
+ else if (tsvalue(top-1)->len > 0) { /* if len=0, do nothing */
+ /* at least two string values; get as many as possible */
+ lint32 tl = (lint32)tsvalue(top-1)->len +
+ (lint32)tsvalue(top-2)->len;
+ char *buffer;
+ int i;
+ while (n < total && !tostring(L, top-n-1)) { /* collect total length */
+ tl += tsvalue(top-n-1)->len;
+ n++;
+ }
+ if (tl > MAX_SIZET) lua_error(L, "string size overflow");
+ buffer = luaO_openspace(L, tl);
+ tl = 0;
+ for (i=n; i>0; i--) { /* concat all strings */
+ size_t l = tsvalue(top-i)->len;
+ memcpy(buffer+tl, tsvalue(top-i)->str, l);
+ tl += l;
+ }
+ tsvalue(top-n) = luaS_newlstr(L, buffer, tl);
+ }
+ total -= n-1; /* got `n' strings to create 1 new */
+ top -= n-1;
+ } while (total > 1); /* repeat until only 1 result left */
+}
+
+
+static void luaV_pack (lua_State *L, StkId firstelem) {
+ int i;
+ Hash *htab = luaH_new(L, 0);
+ for (i=0; firstelem+i<L->top; i++)
+ *luaH_setint(L, htab, i+1) = *(firstelem+i);
+ /* store counter in field `n' */
+ luaH_setstrnum(L, htab, luaS_new(L, "n"), i);
+ L->top = firstelem; /* remove elements from the stack */
+ ttype(L->top) = LUA_TTABLE;
+ hvalue(L->top) = htab;
+ incr_top;
+}
+
+
+static void adjust_varargs (lua_State *L, StkId base, int nfixargs) {
+ int nvararg = (L->top-base) - nfixargs;
+ if (nvararg < 0)
+ luaD_adjusttop(L, base, nfixargs);
+ luaV_pack(L, base+nfixargs);
+}
+
+
+
+#define dojump(pc, i) { int d = GETARG_S(i); pc += d; }
+
+/*
+** Executes the given Lua function. Parameters are between [base,top).
+** Returns n such that the the results are between [n,top).
+*/
+StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
+ const Proto *const tf = cl->f.l;
+ StkId top; /* keep top local, for performance */
+ const Instruction *pc = tf->code;
+ TString **const kstr = tf->kstr;
+ const lua_Hook linehook = L->linehook;
+ infovalue(base-1)->pc = &pc;
+ luaD_checkstack(L, tf->maxstacksize+EXTRA_STACK);
+ if (tf->is_vararg) /* varargs? */
+ adjust_varargs(L, base, tf->numparams);
+ else
+ luaD_adjusttop(L, base, tf->numparams);
+ top = L->top;
+ /* main loop of interpreter */
+ for (;;) {
+ const Instruction i = *pc++;
+ if (linehook)
+ traceexec(L, base, top, linehook);
+ switch (GET_OPCODE(i)) {
+ case OP_END: {
+ L->top = top;
+ return top;
+ }
+ case OP_RETURN: {
+ L->top = top;
+ return base+GETARG_U(i);
+ }
+ case OP_CALL: {
+ int nres = GETARG_B(i);
+ if (nres == MULT_RET) nres = LUA_MULTRET;
+ L->top = top;
+ luaD_call(L, base+GETARG_A(i), nres);
+ top = L->top;
+ break;
+ }
+ case OP_TAILCALL: {
+ L->top = top;
+ luaD_call(L, base+GETARG_A(i), LUA_MULTRET);
+ return base+GETARG_B(i);
+ }
+ case OP_PUSHNIL: {
+ int n = GETARG_U(i);
+ LUA_ASSERT(n>0, "invalid argument");
+ do {
+ ttype(top++) = LUA_TNIL;
+ } while (--n > 0);
+ break;
+ }
+ case OP_POP: {
+ top -= GETARG_U(i);
+ break;
+ }
+ case OP_PUSHINT: {
+ ttype(top) = LUA_TNUMBER;
+ nvalue(top) = (Number)GETARG_S(i);
+ top++;
+ break;
+ }
+ case OP_PUSHSTRING: {
+ ttype(top) = LUA_TSTRING;
+ tsvalue(top) = kstr[GETARG_U(i)];
+ top++;
+ break;
+ }
+ case OP_PUSHNUM: {
+ ttype(top) = LUA_TNUMBER;
+ nvalue(top) = tf->knum[GETARG_U(i)];
+ top++;
+ break;
+ }
+ case OP_PUSHNEGNUM: {
+ ttype(top) = LUA_TNUMBER;
+ nvalue(top) = -tf->knum[GETARG_U(i)];
+ top++;
+ break;
+ }
+ case OP_PUSHUPVALUE: {
+ *top++ = cl->upvalue[GETARG_U(i)];
+ break;
+ }
+ case OP_GETLOCAL: {
+ *top++ = *(base+GETARG_U(i));
+ break;
+ }
+ case OP_GETGLOBAL: {
+ L->top = top;
+ *top = *luaV_getglobal(L, kstr[GETARG_U(i)]);
+ top++;
+ break;
+ }
+ case OP_GETTABLE: {
+ L->top = top;
+ top--;
+ *(top-1) = *luaV_gettable(L, top-1);
+ break;
+ }
+ case OP_GETDOTTED: {
+ ttype(top) = LUA_TSTRING;
+ tsvalue(top) = kstr[GETARG_U(i)];
+ L->top = top+1;
+ *(top-1) = *luaV_gettable(L, top-1);
+ break;
+ }
+ case OP_GETINDEXED: {
+ *top = *(base+GETARG_U(i));
+ L->top = top+1;
+ *(top-1) = *luaV_gettable(L, top-1);
+ break;
+ }
+ case OP_PUSHSELF: {
+ TObject receiver;
+ receiver = *(top-1);
+ ttype(top) = LUA_TSTRING;
+ tsvalue(top++) = kstr[GETARG_U(i)];
+ L->top = top;
+ *(top-2) = *luaV_gettable(L, top-2);
+ *(top-1) = receiver;
+ break;
+ }
+ case OP_CREATETABLE: {
+ L->top = top;
+ luaC_checkGC(L);
+ hvalue(top) = luaH_new(L, GETARG_U(i));
+ ttype(top) = LUA_TTABLE;
+ top++;
+ break;
+ }
+ case OP_SETLOCAL: {
+ *(base+GETARG_U(i)) = *(--top);
+ break;
+ }
+ case OP_SETGLOBAL: {
+ L->top = top;
+ luaV_setglobal(L, kstr[GETARG_U(i)]);
+ top--;
+ break;
+ }
+ case OP_SETTABLE: {
+ StkId t = top-GETARG_A(i);
+ L->top = top;
+ luaV_settable(L, t, t+1);
+ top -= GETARG_B(i); /* pop values */
+ break;
+ }
+ case OP_SETLIST: {
+ int aux = GETARG_A(i) * LFIELDS_PER_FLUSH;
+ int n = GETARG_B(i);
+ Hash *arr = hvalue(top-n-1);
+ L->top = top-n; /* final value of `top' (in case of errors) */
+ for (; n; n--)
+ *luaH_setint(L, arr, n+aux) = *(--top);
+ break;
+ }
+ case OP_SETMAP: {
+ int n = GETARG_U(i);
+ StkId finaltop = top-2*n;
+ Hash *arr = hvalue(finaltop-1);
+ L->top = finaltop; /* final value of `top' (in case of errors) */
+ for (; n; n--) {
+ top-=2;
+ *luaH_set(L, arr, top) = *(top+1);
+ }
+ break;
+ }
+ case OP_ADD: {
+ if (tonumber(top-2) || tonumber(top-1))
+ call_arith(L, top, TM_ADD);
+ else
+ nvalue(top-2) += nvalue(top-1);
+ top--;
+ break;
+ }
+ case OP_ADDI: {
+ if (tonumber(top-1)) {
+ ttype(top) = LUA_TNUMBER;
+ nvalue(top) = (Number)GETARG_S(i);
+ call_arith(L, top+1, TM_ADD);
+ }
+ else
+ nvalue(top-1) += (Number)GETARG_S(i);
+ break;
+ }
+ case OP_SUB: {
+ if (tonumber(top-2) || tonumber(top-1))
+ call_arith(L, top, TM_SUB);
+ else
+ nvalue(top-2) -= nvalue(top-1);
+ top--;
+ break;
+ }
+ case OP_MULT: {
+ if (tonumber(top-2) || tonumber(top-1))
+ call_arith(L, top, TM_MUL);
+ else
+ nvalue(top-2) *= nvalue(top-1);
+ top--;
+ break;
+ }
+ case OP_DIV: {
+ if (tonumber(top-2) || tonumber(top-1))
+ call_arith(L, top, TM_DIV);
+ else
+ nvalue(top-2) /= nvalue(top-1);
+ top--;
+ break;
+ }
+ case OP_POW: {
+ if (!call_binTM(L, top, TM_POW))
+ lua_error(L, "undefined operation");
+ top--;
+ break;
+ }
+ case OP_CONCAT: {
+ int n = GETARG_U(i);
+ luaV_strconc(L, n, top);
+ top -= n-1;
+ L->top = top;
+ luaC_checkGC(L);
+ break;
+ }
+ case OP_MINUS: {
+ if (tonumber(top-1)) {
+ ttype(top) = LUA_TNIL;
+ call_arith(L, top+1, TM_UNM);
+ }
+ else
+ nvalue(top-1) = -nvalue(top-1);
+ break;
+ }
+ case OP_NOT: {
+ ttype(top-1) =
+ (ttype(top-1) == LUA_TNIL) ? LUA_TNUMBER : LUA_TNIL;
+ nvalue(top-1) = 1;
+ break;
+ }
+ case OP_JMPNE: {
+ top -= 2;
+ if (!luaO_equalObj(top, top+1)) dojump(pc, i);
+ break;
+ }
+ case OP_JMPEQ: {
+ top -= 2;
+ if (luaO_equalObj(top, top+1)) dojump(pc, i);
+ break;
+ }
+ case OP_JMPLT: {
+ top -= 2;
+ if (luaV_lessthan(L, top, top+1, top+2)) dojump(pc, i);
+ break;
+ }
+ case OP_JMPLE: { /* a <= b === !(b<a) */
+ top -= 2;
+ if (!luaV_lessthan(L, top+1, top, top+2)) dojump(pc, i);
+ break;
+ }
+ case OP_JMPGT: { /* a > b === (b<a) */
+ top -= 2;
+ if (luaV_lessthan(L, top+1, top, top+2)) dojump(pc, i);
+ break;
+ }
+ case OP_JMPGE: { /* a >= b === !(a<b) */
+ top -= 2;
+ if (!luaV_lessthan(L, top, top+1, top+2)) dojump(pc, i);
+ break;
+ }
+ case OP_JMPT: {
+ if (ttype(--top) != LUA_TNIL) dojump(pc, i);
+ break;
+ }
+ case OP_JMPF: {
+ if (ttype(--top) == LUA_TNIL) dojump(pc, i);
+ break;
+ }
+ case OP_JMPONT: {
+ if (ttype(top-1) == LUA_TNIL) top--;
+ else dojump(pc, i);
+ break;
+ }
+ case OP_JMPONF: {
+ if (ttype(top-1) != LUA_TNIL) top--;
+ else dojump(pc, i);
+ break;
+ }
+ case OP_JMP: {
+ dojump(pc, i);
+ break;
+ }
+ case OP_PUSHNILJMP: {
+ ttype(top++) = LUA_TNIL;
+ pc++;
+ break;
+ }
+ case OP_FORPREP: {
+ if (tonumber(top-1))
+ lua_error(L, "`for' step must be a number");
+ if (tonumber(top-2))
+ lua_error(L, "`for' limit must be a number");
+ if (tonumber(top-3))
+ lua_error(L, "`for' initial value must be a number");
+ if (nvalue(top-1) > 0 ?
+ nvalue(top-3) > nvalue(top-2) :
+ nvalue(top-3) < nvalue(top-2)) { /* `empty' loop? */
+ top -= 3; /* remove control variables */
+ dojump(pc, i); /* jump to loop end */
+ }
+ break;
+ }
+ case OP_FORLOOP: {
+ LUA_ASSERT(ttype(top-1) == LUA_TNUMBER, "invalid step");
+ LUA_ASSERT(ttype(top-2) == LUA_TNUMBER, "invalid limit");
+ if (ttype(top-3) != LUA_TNUMBER)
+ lua_error(L, "`for' index must be a number");
+ nvalue(top-3) += nvalue(top-1); /* increment index */
+ if (nvalue(top-1) > 0 ?
+ nvalue(top-3) > nvalue(top-2) :
+ nvalue(top-3) < nvalue(top-2))
+ top -= 3; /* end loop: remove control variables */
+ else
+ dojump(pc, i); /* repeat loop */
+ break;
+ }
+ case OP_LFORPREP: {
+ Node *node;
+ if (ttype(top-1) != LUA_TTABLE)
+ lua_error(L, "`for' table must be a table");
+ node = luaH_next(L, hvalue(top-1), &luaO_nilobject);
+ if (node == NULL) { /* `empty' loop? */
+ top--; /* remove table */
+ dojump(pc, i); /* jump to loop end */
+ }
+ else {
+ top += 2; /* index,value */
+ *(top-2) = *key(node);
+ *(top-1) = *val(node);
+ }
+ break;
+ }
+ case OP_LFORLOOP: {
+ Node *node;
+ LUA_ASSERT(ttype(top-3) == LUA_TTABLE, "invalid table");
+ node = luaH_next(L, hvalue(top-3), top-2);
+ if (node == NULL) /* end loop? */
+ top -= 3; /* remove table, key, and value */
+ else {
+ *(top-2) = *key(node);
+ *(top-1) = *val(node);
+ dojump(pc, i); /* repeat loop */
+ }
+ break;
+ }
+ case OP_CLOSURE: {
+ L->top = top;
+ luaV_Lclosure(L, tf->kproto[GETARG_A(i)], GETARG_B(i));
+ top = L->top;
+ luaC_checkGC(L);
+ break;
+ }
+ }
+ }
+}
diff --git a/lua/src/lvm.h b/lua/src/lvm.h
new file mode 100644
index 0000000..759dc96
--- /dev/null
+++ b/lua/src/lvm.h
@@ -0,0 +1,32 @@
+/*
+** $Id: lvm.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Lua virtual machine
+** See Copyright Notice in lua.h
+*/
+
+#ifndef lvm_h
+#define lvm_h
+
+
+#include "ldo.h"
+#include "lobject.h"
+#include "ltm.h"
+
+
+#define tonumber(o) ((ttype(o) != LUA_TNUMBER) && (luaV_tonumber(o) != 0))
+#define tostring(L,o) ((ttype(o) != LUA_TSTRING) && (luaV_tostring(L, o) != 0))
+
+
+int luaV_tonumber (TObject *obj);
+int luaV_tostring (lua_State *L, TObject *obj);
+const TObject *luaV_gettable (lua_State *L, StkId t);
+void luaV_settable (lua_State *L, StkId t, StkId key);
+const TObject *luaV_getglobal (lua_State *L, TString *s);
+void luaV_setglobal (lua_State *L, TString *s);
+StkId luaV_execute (lua_State *L, const Closure *cl, StkId base);
+void luaV_Cclosure (lua_State *L, lua_CFunction c, int nelems);
+void luaV_Lclosure (lua_State *L, Proto *l, int nelems);
+int luaV_lessthan (lua_State *L, const TObject *l, const TObject *r, StkId top);
+void luaV_strconc (lua_State *L, int total, StkId top);
+
+#endif
diff --git a/lua/src/lzio.c b/lua/src/lzio.c
new file mode 100644
index 0000000..6f0e24d
--- /dev/null
+++ b/lua/src/lzio.c
@@ -0,0 +1,84 @@
+/*
+** $Id: lzio.c,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** a generic input stream interface
+** See Copyright Notice in lua.h
+*/
+
+
+
+#include <stdio.h>
+#include <string.h>
+
+#include "lua.h"
+
+#include "lzio.h"
+
+
+
+/* ----------------------------------------------------- memory buffers --- */
+
+static int zmfilbuf (ZIO* z) {
+ (void)z; /* to avoid warnings */
+ return EOZ;
+}
+
+
+ZIO* zmopen (ZIO* z, const char* b, size_t size, const char *name) {
+ if (b==NULL) return NULL;
+ z->n = size;
+ z->p = (const unsigned char *)b;
+ z->filbuf = zmfilbuf;
+ z->u = NULL;
+ z->name = name;
+ return z;
+}
+
+/* ------------------------------------------------------------ strings --- */
+
+ZIO* zsopen (ZIO* z, const char* s, const char *name) {
+ if (s==NULL) return NULL;
+ return zmopen(z, s, strlen(s), name);
+}
+
+/* -------------------------------------------------------------- FILEs --- */
+
+static int zffilbuf (ZIO* z) {
+ size_t n;
+ if (feof((FILE *)z->u)) return EOZ;
+ n = fread(z->buffer, 1, ZBSIZE, (FILE *)z->u);
+ if (n==0) return EOZ;
+ z->n = n-1;
+ z->p = z->buffer;
+ return *(z->p++);
+}
+
+
+ZIO* zFopen (ZIO* z, FILE* f, const char *name) {
+ if (f==NULL) return NULL;
+ z->n = 0;
+ z->p = z->buffer;
+ z->filbuf = zffilbuf;
+ z->u = f;
+ z->name = name;
+ return z;
+}
+
+
+/* --------------------------------------------------------------- read --- */
+size_t zread (ZIO *z, void *b, size_t n) {
+ while (n) {
+ size_t m;
+ if (z->n == 0) {
+ if (z->filbuf(z) == EOZ)
+ return n; /* return number of missing bytes */
+ zungetc(z); /* put result from `filbuf' in the buffer */
+ }
+ m = (n <= z->n) ? n : z->n; /* min. between n and z->n */
+ memcpy(b, z->p, m);
+ z->n -= m;
+ z->p += m;
+ b = (char *)b + m;
+ n -= m;
+ }
+ return 0;
+}
diff --git a/lua/src/lzio.h b/lua/src/lzio.h
new file mode 100644
index 0000000..b695305
--- /dev/null
+++ b/lua/src/lzio.h
@@ -0,0 +1,53 @@
+/*
+** $Id: lzio.h,v 1.1 2002/02/14 10:46:59 jcatki Exp $
+** Buffered streams
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lzio_h
+#define lzio_h
+
+#include <stdio.h>
+
+
+
+/* For Lua only */
+#define zFopen luaZ_Fopen
+#define zsopen luaZ_sopen
+#define zmopen luaZ_mopen
+#define zread luaZ_read
+
+#define EOZ (-1) /* end of stream */
+
+typedef struct zio ZIO;
+
+ZIO* zFopen (ZIO* z, FILE* f, const char *name); /* open FILEs */
+ZIO* zsopen (ZIO* z, const char* s, const char *name); /* string */
+ZIO* zmopen (ZIO* z, const char* b, size_t size, const char *name); /* memory */
+
+size_t zread (ZIO* z, void* b, size_t n); /* read next n bytes */
+
+#define zgetc(z) (((z)->n--)>0 ? ((int)*(z)->p++): (z)->filbuf(z))
+#define zungetc(z) (++(z)->n,--(z)->p)
+#define zname(z) ((z)->name)
+
+
+
+/* --------- Private Part ------------------ */
+
+#ifndef ZBSIZE
+#define ZBSIZE 256 /* buffer size */
+#endif
+
+struct zio {
+ size_t n; /* bytes still unread */
+ const unsigned char* p; /* current position in buffer */
+ int (*filbuf)(ZIO* z);
+ void* u; /* additional data */
+ const char *name;
+ unsigned char buffer[ZBSIZE]; /* buffer */
+};
+
+
+#endif
diff --git a/missing b/missing
new file mode 100755
index 0000000..0a7fb5a
--- /dev/null
+++ b/missing
@@ -0,0 +1,283 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+case "$1" in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing 0.3 - GNU automake"
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+ aclocal)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+ fi
+ if [ -f "$file" ]; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
+ # We have makeinfo, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ fi
+ touch $file
+ ;;
+
+ tar)
+ shift
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ fi
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar ${1+"$@"} && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar ${1+"$@"} && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case "$firstarg" in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" ${1+"$@"} && exit 0
+ ;;
+ esac
+ case "$firstarg" in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" ${1+"$@"} && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequirements for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/mkinstalldirs b/mkinstalldirs
new file mode 100755
index 0000000..4f58503
--- /dev/null
+++ b/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
+
+errstatus=0
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/music/Makefile.am b/music/Makefile.am
new file mode 100644
index 0000000..d0d541b
--- /dev/null
+++ b/music/Makefile.am
@@ -0,0 +1,3 @@
+dist_pkgdata_DATA = song_revenge_of_cats.it
+
+pkgdatadir = @datadir@/@PACKAGE@/music
diff --git a/music/Makefile.in b/music/Makefile.in
new file mode 100644
index 0000000..414a7f6
--- /dev/null
+++ b/music/Makefile.in
@@ -0,0 +1,221 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+pkgdatadir = @datadir@/@PACKAGE@/music
+
+dist_pkgdata_DATA = song_revenge_of_cats.it
+subdir = music
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DATA = $(dist_pkgdata_DATA)
+
+DIST_COMMON = $(dist_pkgdata_DATA) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign music/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+ @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
+
+uninstall-dist_pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \
+ rm -f $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
+tags: TAGS
+TAGS:
+
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_pkgdataDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am \
+ install-dist_pkgdataDATA install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ uninstall uninstall-am uninstall-dist_pkgdataDATA \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/music/song_revenge_of_cats.it b/music/song_revenge_of_cats.it
new file mode 100644
index 0000000..850e163
--- /dev/null
+++ b/music/song_revenge_of_cats.it
Binary files differ
diff --git a/nebu/Makefile.am b/nebu/Makefile.am
new file mode 100644
index 0000000..3156c9d
--- /dev/null
+++ b/nebu/Makefile.am
@@ -0,0 +1,16 @@
+SUBDIRS = include base filesystem scripting audio video input
+
+noinst_LIBRARIES = libNebu.a
+
+libNebu_a_SOURCES =
+
+libNebu_a_LIBADD = \
+ base/libbase.a \
+ filesystem/libfilesystem.a \
+ scripting/libscripting.a \
+ audio/libaudio.a \
+ video/libvideo.a \
+ input/libinput.a
+
+## $(top_srcdir)/lua/src/liblua.a \
+## $(top_srcdir)/lua/src/lib/liblualib.a
diff --git a/nebu/Makefile.in b/nebu/Makefile.in
new file mode 100644
index 0000000..2c1290a
--- /dev/null
+++ b/nebu/Makefile.in
@@ -0,0 +1,365 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+SUBDIRS = include base filesystem scripting audio video input
+
+noinst_LIBRARIES = libNebu.a
+
+libNebu_a_SOURCES =
+
+libNebu_a_LIBADD = \
+ base/libbase.a \
+ filesystem/libfilesystem.a \
+ scripting/libscripting.a \
+ audio/libaudio.a \
+ video/libvideo.a \
+ input/libinput.a
+
+subdir = nebu
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libNebu_a_AR = $(AR) cru
+libNebu_a_DEPENDENCIES = base/libbase.a filesystem/libfilesystem.a \
+ scripting/libscripting.a audio/libaudio.a video/libvideo.a \
+ input/libinput.a
+am_libNebu_a_OBJECTS =
+libNebu_a_OBJECTS = $(am_libNebu_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(libNebu_a_SOURCES)
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
+ uninstall-info-recursive all-recursive install-data-recursive \
+ install-exec-recursive installdirs-recursive install-recursive \
+ uninstall-recursive check-recursive installcheck-recursive
+DIST_COMMON = Makefile.am Makefile.in
+DIST_SUBDIRS = $(SUBDIRS)
+SOURCES = $(libNebu_a_SOURCES)
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libNebu.a: $(libNebu_a_OBJECTS) $(libNebu_a_DEPENDENCIES)
+ -rm -f libNebu.a
+ $(libNebu_a_AR) libNebu.a $(libNebu_a_OBJECTS) $(libNebu_a_LIBADD)
+ $(RANLIB) libNebu.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-recursive
+
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
+ clean-generic clean-noinstLIBRARIES clean-recursive distclean \
+ distclean-compile distclean-generic distclean-recursive \
+ distclean-tags distdir dvi dvi-am dvi-recursive info info-am \
+ info-recursive install install-am install-data install-data-am \
+ install-data-recursive install-exec install-exec-am \
+ install-exec-recursive install-info install-info-am \
+ install-info-recursive install-man install-recursive \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am installdirs-recursive maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-recursive \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am \
+ uninstall-info-recursive uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/audio/Makefile.am b/nebu/audio/Makefile.am
new file mode 100644
index 0000000..30c1d6b
--- /dev/null
+++ b/nebu/audio/Makefile.am
@@ -0,0 +1,9 @@
+noinst_LIBRARIES=libaudio.a
+
+libaudio_a_SOURCES= \
+ SoundSystem.cpp Source.cpp Source3D.cpp SourceCopy.cpp \
+ SourceEngine.cpp \
+ SourceMusic.cpp SourceSample.cpp
+
+AM_CXXFLAGS = \
+ -I$(top_srcdir)/nebu/include
diff --git a/nebu/audio/Makefile.in b/nebu/audio/Makefile.in
new file mode 100644
index 0000000..fda5e9a
--- /dev/null
+++ b/nebu/audio/Makefile.in
@@ -0,0 +1,308 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libaudio.a
+
+libaudio_a_SOURCES = \
+ SoundSystem.cpp Source.cpp Source3D.cpp SourceCopy.cpp \
+ SourceEngine.cpp \
+ SourceMusic.cpp SourceSample.cpp
+
+
+AM_CXXFLAGS = \
+ -I$(top_srcdir)/nebu/include
+
+subdir = nebu/audio
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libaudio_a_AR = $(AR) cru
+libaudio_a_LIBADD =
+am_libaudio_a_OBJECTS = SoundSystem.$(OBJEXT) Source.$(OBJEXT) \
+ Source3D.$(OBJEXT) SourceCopy.$(OBJEXT) SourceEngine.$(OBJEXT) \
+ SourceMusic.$(OBJEXT) SourceSample.$(OBJEXT)
+libaudio_a_OBJECTS = $(am_libaudio_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/SoundSystem.Po $(DEPDIR)/Source.Po \
+@AMDEP_TRUE@ $(DEPDIR)/Source3D.Po $(DEPDIR)/SourceCopy.Po \
+@AMDEP_TRUE@ $(DEPDIR)/SourceEngine.Po $(DEPDIR)/SourceMusic.Po \
+@AMDEP_TRUE@ $(DEPDIR)/SourceSample.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+CXXFLAGS = @CXXFLAGS@
+DIST_SOURCES = $(libaudio_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libaudio_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/audio/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libaudio.a: $(libaudio_a_OBJECTS) $(libaudio_a_DEPENDENCIES)
+ -rm -f libaudio.a
+ $(libaudio_a_AR) libaudio.a $(libaudio_a_OBJECTS) $(libaudio_a_LIBADD)
+ $(RANLIB) libaudio.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/SoundSystem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/Source.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/Source3D.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/SourceCopy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/SourceEngine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/SourceMusic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/SourceSample.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.cpp.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `cygpath -w $<`
+CXXDEPMODE = @CXXDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/audio/SoundSystem.cpp b/nebu/audio/SoundSystem.cpp
new file mode 100644
index 0000000..e57bb91
--- /dev/null
+++ b/nebu/audio/SoundSystem.cpp
@@ -0,0 +1,84 @@
+#include "audio/nebu_SoundSystem.h"
+
+#include <string.h>
+
+namespace Sound {
+ System::System(SDL_AudioSpec *spec) {
+ _spec = spec;
+ _sources.next = NULL;
+
+ _info.format = _spec->format;
+ _info.rate = spec->freq;
+ _info.channels = spec->channels;
+
+ _mix_music = 1; // TODO: add 'master' volume for music and fx
+ _mix_fx = 1;
+
+ _status = 0; // sound system is not initialized
+ }
+
+ void System::Callback(Uint8* data, int len) {
+ // printf("callback got called for %d bytes of data\n", len);
+
+ // ensure silence
+ memset(data, 0, len);
+
+ if(_status == eUninitialized)
+ return;
+
+ List* p;
+ int sources_mixed = 0;
+ for(p = & _sources; p->next != NULL; p = p->next) {
+ Source* s = (Source*) p->data;
+ if(s->IsPlaying()) {
+ // fprintf(stderr, "mixing source\n");
+ if(!(
+ (s->GetType() & eSoundFX && ! _mix_fx ) ||
+ (s->GetType() & eSoundMusic && ! _mix_music) )
+ )
+ {
+ if( s->Mix(data, len) )
+ sources_mixed++;
+ }
+ // fprintf(stderr, "done mixing %d sources\n", sources_mixed);
+ }
+ }
+ }
+
+ void System::AddSource(Source* source) {
+ List* p;
+ for(p = & _sources; p->next != NULL; p = p->next);
+ p->next = new List;
+ p->next->next = NULL;
+ p->data = source;
+ }
+
+ void System::Idle(void) {
+ /* idle processing */
+ List *p;
+ for(p = & _sources; p->next != NULL; p = p->next) {
+ Source *source = (Source*) p->data;
+ // check if source is removable & has stopped playing
+ if(source->IsRemovable() && !source->IsPlaying()) {
+ // get rid of data
+ p->data = p->next->data;
+ List *tmp = p->next;
+ p->next = p->next->next;
+ delete tmp;
+ delete source;
+ if(p->next == NULL)
+ break;
+ } else {
+ source->Idle();
+ }
+ }
+ }
+
+ extern "C" {
+ void c_callback(void *userdata, Uint8 *stream, int len) {
+ // printf("c_callback got called for %d bytes of data\n", len);
+ ((System*)userdata)->Callback(stream, len);
+ }
+ }
+}
+
diff --git a/nebu/audio/Source.cpp b/nebu/audio/Source.cpp
new file mode 100644
index 0000000..e897a96
--- /dev/null
+++ b/nebu/audio/Source.cpp
@@ -0,0 +1,42 @@
+#include "audio/nebu_Source.h"
+
+namespace Sound {
+ Source::Source() {
+ _system = NULL;
+ _isPlaying = 0;
+ _loop = 0;
+ _removable = 0;
+ _volume = 0.5;
+ _type = 0;
+
+ _mutex = SDL_CreateMutex();
+ _sem = SDL_CreateSemaphore(1);
+ }
+
+ Source::~Source() {
+ // fprintf(stderr, "nebu_Source destructor called\n");
+
+ SDL_DestroyMutex(_mutex);
+ SDL_DestroySemaphore(_sem);
+ }
+
+ int Source::Mix(Uint8 *data, int len) { return 0; }
+ void Source::Reset() { }
+ void Source::Start() { _isPlaying = 1; Reset(); }
+ void Source::Stop() { _isPlaying = 0; Reset(); }
+ void Source::Pause() { _isPlaying = 0; }
+ void Source::UnPause() { _isPlaying = 1; }
+ void Source::Idle() { }
+
+ Uint8 Source::IsPlaying() { return _isPlaying; }
+ void Source::SetRemovable() { _removable = 1; }
+ Uint8 Source::IsRemovable() { return _removable; }
+ void Source::SetVolume(float volume) { _volume = volume; }
+ float Source::GetVolume() { return _volume; }
+ void Source::SetLoop(Uint8 loop) { _loop = loop; }
+ Uint8 Source::GetLoop() { return _loop; }
+ void Source::SetType(int type) { _type = type; }
+ int Source::GetType(void) { return _type; }
+ void Source::SetName(char* name) { _name = name; }
+ char* Source::GetName(void) { return _name; }
+}
diff --git a/nebu/audio/Source3D.cpp b/nebu/audio/Source3D.cpp
new file mode 100644
index 0000000..715840e
--- /dev/null
+++ b/nebu/audio/Source3D.cpp
@@ -0,0 +1,199 @@
+#include "audio/nebu_Source3D.h"
+
+#include <assert.h>
+#include <string.h>
+
+Uint8 tmp[65536];
+
+#define USOUND 50
+#define EPSILON 0.1f
+#define SOUND_VOL_THRESHOLD 0.1
+#define VOLSCALE_BASE 1000
+
+#define MAX(x,y) (( (x) > (y) ) ? (x) : (y))
+
+/*!
+ \fn int fxShift(float shift, Uint8 *target, Uint8 *source, int len)
+
+ \param shift Shift of the frequency (new_frequency = shift * old_frequency)
+ \param target Target buffer to mix into; format: Sint16 LR stereo
+ \param source The buffer to mix from
+ \param len The amount of bytes to mix into the target buffer
+
+ \return The amount of samples read from the source
+*/
+
+int fxComputeShiftLen(float shift, int len) {
+ return (int) ( (len - 1) * shift + 1 );
+}
+
+int fxShift(float shift, Uint8 *target, Uint8 *source, int len) {
+ int i, j;
+
+ // amount of samples to mix/write
+ len /= 4;
+
+ for(i = 0; i < len; i++) { // LR pairs
+ for(j = 0; j < 2; j++) { // channels
+ Sint32 result = 0;
+ int pa;
+ float t;
+
+ pa = (int) (i * shift);
+ t = (i * shift) - pa;
+
+ result = (Sint32) (
+ *( (Sint16*) target + j + 2 * i) * 1.0f +
+ *( (Sint16*) source + j + 2 * (pa + 0) ) * (1.0f - t) +
+ *( (Sint16*) source + j + 2 * (pa + 1) ) * (t) );
+
+#define MAX_SINT16 ((1 << 15) - 1)
+#define MIN_SINT16 (- (1 << 15) )
+ if(result > MAX_SINT16) {
+ result = MAX_SINT16;
+ fprintf(stderr, "overflow\n");
+ } else if(result < MIN_SINT16) {
+ result = MIN_SINT16;
+ fprintf(stderr, "underflow\n");
+ }
+
+ *( (Sint16*) target + j + 2 * i ) = (Sint16) result;
+ /* *(Sint16*) (target + 2 * j + 4 * i) += (Sint16)
+ ( *(Sint16*) (source + 2 * j + 4 * (k + 0) ) * ( 1 - l ) +
+ *(Sint16*) (source + 2 * j + 4 * (k + 2) ) * ( l ) ); */
+
+ }
+ }
+ return 4 * fxComputeShiftLen(shift, len);
+}
+
+/*!
+ \fn void fxPan(float pan, float vol, Uint8 *buf, int len)
+
+ \param vol Volume (for distance attenuation), should be between 0 and 1
+ \param pan Panning, -1.0 is left, 1.0 is right, 0.0 is center
+ \param buf The sample to be modified in-place, format: Sint16 LR stereo
+ \param len Number of bytes
+*/
+
+void fxPan(float pan, float vol, Uint8 *buf, int len) {
+ int i;
+
+ float left_vol = - vol * ( -1.0f + pan ) / 2.0f;
+ float right_vol = vol * ( 1.0f + pan ) / 2.0f;
+
+ for(i = 0; i < len; i += 4) {
+ *(Sint16*) (buf + i) = // *= left_vol
+ (Sint16) (left_vol * *(Sint16*) (buf + i) );
+ *(Sint16*) (buf + i + 2) = // *= right_vol
+ (Sint16) (right_vol * *(Sint16*) (buf + i + 2) );
+ }
+}
+
+namespace Sound {
+
+ void Source3D::GetModifiers(float& fPan, float& fVolume, float& fShift) {
+
+ Vector3& vSourceLocation = _location;
+ Vector3& vSourceVelocity = _velocity;
+
+ Listener listener = _system->GetListener();
+ Vector3& vListenerLocation = listener._location;
+ Vector3 vListenerVelocity = listener._velocity;
+ Vector3 vListenerDirection = listener._direction;
+ Vector3 vListenerUp = listener._up;
+
+ if( (vSourceLocation - vListenerLocation).Length() < EPSILON ) {
+ fPan = 0;
+ fVolume = 1.0f;
+ fShift = 1.0f;
+ return;
+ }
+
+ vListenerDirection.Normalize();
+ vListenerUp.Normalize();
+ Vector3 vListenerLeft = vListenerDirection.Cross( vListenerUp );
+ vListenerLeft.Normalize();
+
+ /* panning */
+ Vector3 vTarget = vSourceLocation - vListenerLocation;
+ Vector3 v1 = vListenerLeft * ( vTarget * vListenerLeft );
+ Vector3 v2 = vListenerDirection * (vTarget * vListenerDirection );
+ Vector3 vTargetPlanar = v1 + v2;
+
+ float cosPhi =
+ vTargetPlanar.Normalize() *
+ vListenerDirection;
+
+ fPan = 1 - (float)fabs(cosPhi);
+
+ if( vTargetPlanar * vListenerLeft < 0 )
+ fPan = -fPan;
+
+ /* done panning */
+
+ /* attenuation */
+ // float fallOff = vTarget.Length2();
+ float fallOff = (float)pow(vTarget.Length(), 1.8f);
+ fVolume = (fallOff > VOLSCALE_BASE) ?
+ (VOLSCALE_BASE / fallOff) : (1.0f);
+
+ /* done attenuation */
+
+ /* doppler */
+
+ fShift =
+ (USOUND + ( vListenerVelocity * vTarget ) / vTarget.Length() ) /
+ (USOUND + ( vSourceVelocity * vTarget ) / vTarget.Length() );
+ if(fShift < 0.5) {
+ printf("clamping fShift from %.2f to 0.5\n", fShift);
+ fShift = 0.5f;
+ }
+ if(fShift > 1.5) {
+ printf("clamping fShift from %.2f to 1.5\n", fShift);
+ fShift = 1.5f;
+ }
+
+ /* done doppler */
+ }
+
+ int Source3D::Mix(Uint8 *data, int len) {
+ if(_source->_buffer == NULL) return 0;
+
+ if(_source->IsPlaying()) {
+ int volume = (int)(_source->GetVolume() * SDL_MIX_MAXVOLUME);
+ float pan = 0, shift = 1.0f, vol = 1.0f;
+ int clen, shifted_len;
+
+ GetModifiers(pan, vol, shift);
+ // printf("received: volume: %.4f, panning: %.4f, shift: %.4f\n", vol, pan, shift);
+
+ shifted_len = 4 * fxComputeShiftLen( shift, len / 4 );
+ clen = MAX(len, shifted_len) + 32; // safety distance
+
+ assert(clen < _source->_buffersize);
+
+ if(vol > SOUND_VOL_THRESHOLD) {
+ // copy clen bytes from the buffer to a temporary buffer
+ if(clen <= _source->_buffersize - _position) {
+ memcpy(tmp, _source->_buffer + _position, clen);
+ } else {
+ memcpy(tmp, _source->_buffer + _position,
+ _source->_buffersize - _position);
+ memcpy(tmp + _source->_buffersize - _position, _source->_buffer,
+ clen - (_source->_buffersize - _position));
+ }
+
+ fxPan(pan, vol, tmp, clen);
+ // fxshift mixes the data to the stream
+ _position += fxShift(shift, data, tmp, len);
+
+ if(_position > _source->_buffersize)
+ _position -= _source->_buffersize;
+
+ return 1; // mixed something
+ }
+ }
+ return 0; // didn't mix anything to the stream
+ }
+}
diff --git a/nebu/audio/SourceCopy.cpp b/nebu/audio/SourceCopy.cpp
new file mode 100644
index 0000000..15c7ca1
--- /dev/null
+++ b/nebu/audio/SourceCopy.cpp
@@ -0,0 +1,38 @@
+#include "audio/nebu_SourceCopy.h"
+
+#include <assert.h>
+
+namespace Sound {
+ int SourceCopy::Mix(Uint8 *data, int len) {
+ if(_source->_buffer == NULL) return 0;
+
+ int volume = (int)(_source->GetVolume() * SDL_MIX_MAXVOLUME);
+ // fprintf(stderr, "playing copy sample at %d, position: %d\n", volume, _position);
+ int buffersize = _source->_buffersize;
+ Uint8* buffer = (Uint8*) _source->_buffer;
+
+ assert(len < buffersize);
+
+ if(len < buffersize - _position) {
+ SDL_MixAudio(data, buffer + _position, len, volume);
+ _position += len;
+ } else {
+ SDL_MixAudio(data, buffer + _position, buffersize - _position,
+ volume);
+ len -= buffersize - _position;
+
+ printf("end of sample reached!\n");
+ if(_loop) {
+ if(_loop != 255)
+ _loop--;
+
+ _position = 0;
+ SDL_MixAudio(data, buffer + _position, len, volume);
+ _position += len;
+ } else {
+ _isPlaying = 0;
+ }
+ }
+ return 1;
+ }
+}
diff --git a/nebu/audio/SourceEngine.cpp b/nebu/audio/SourceEngine.cpp
new file mode 100644
index 0000000..1a03dff
--- /dev/null
+++ b/nebu/audio/SourceEngine.cpp
@@ -0,0 +1,14 @@
+#include "audio/nebu_SourceEngine.h"
+
+namespace Sound {
+ void SourceEngine::GetModifiers(float& fPan, float& fVolume, float& fShift) {
+ Source3D::GetModifiers(fPan, fVolume, fShift);
+ fVolume *= _speedShift;
+ fShift *= _pitchShift;
+ }
+}
+
+
+
+
+
diff --git a/nebu/audio/SourceMusic.cpp b/nebu/audio/SourceMusic.cpp
new file mode 100644
index 0000000..c728a41
--- /dev/null
+++ b/nebu/audio/SourceMusic.cpp
@@ -0,0 +1,186 @@
+#include "audio/nebu_SourceMusic.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace Sound {
+ SourceMusic::SourceMusic(System *system) {
+ _system = system;
+
+ _sample = NULL;
+
+ _sample_buffersize = 8192;
+ _buffersize = 20 * _sample_buffersize;
+ _buffer = (Uint8*) malloc( _buffersize );
+ memset(_buffer, 0, _buffersize);
+
+ _decoded = 0;
+ _read = 0;
+
+ _filename = NULL;
+ _rwops = NULL;
+ }
+
+ SourceMusic::~SourceMusic() {
+ // fprintf(stderr, "nebu_SourceMusic destructor called\n");
+#ifndef macintosh
+ SDL_SemWait(_sem);
+#else
+ SDL_LockAudio();
+#endif
+ free(_buffer);
+
+ if(_sample)
+ Sound_FreeSample( _sample );
+ _sample = NULL;
+
+ if(_filename)
+ free(_filename);
+
+#ifndef macintosh
+ SDL_SemPost(_sem);
+#else
+ SDL_UnlockAudio();
+#endif
+ }
+
+ /*!
+ \fn void SourceMusic::CreateSample(void)
+
+ call this function only between semaphores
+ */
+
+ void SourceMusic::CreateSample(void) {
+ _rwops = SDL_RWFromFile(_filename, "rb");
+ char *ext = _filename;
+ for(int i = 0; *(_filename + i); i++)
+ {
+ if(*(_filename + i) == '.')
+ ext = _filename + i + 1;
+ }
+ _sample = Sound_NewSample(_rwops, ext,
+ _system->GetAudioInfo(),
+ _sample_buffersize );
+
+ if(_sample == NULL) {
+ fprintf(stderr, "[error] failed loading sample type %s, from %s: %s\n", ext,
+ _filename, Sound_GetError());
+ return;
+ }
+
+ _read = 0;
+ _decoded = 0;
+ // fprintf(stderr, "created sample\n");
+ }
+
+ void SourceMusic::Load(char *filename) {
+ int n = strlen(filename);
+ _filename = (char*) malloc(n + 1);
+ memcpy(_filename, filename, n + 1);
+ CreateSample();
+ }
+
+ void SourceMusic::CleanUp(void) {
+ _read = 0;
+ _decoded = 0;
+
+ if(_sample != NULL)
+ Sound_FreeSample(_sample);
+ }
+
+ int SourceMusic::Mix(Uint8 *data, int len) {
+ if(_sample == NULL) return 0;
+#ifndef macintosh
+ if( SDL_SemTryWait(_sem) ) {
+ fprintf(stderr, "semaphore locked, skipping mix\n");
+ return 0;
+ }
+#endif
+ // printf("mixing %d bytes\n", len);
+
+ int volume = (int)(_volume * SDL_MIX_MAXVOLUME);
+ // fprintf(stderr, "setting volume to %.3f -> %d\n", _volume, volume);
+ // fprintf(stderr, "entering mixer\n");
+
+ if(len < (_decoded - _read + _buffersize) % _buffersize) {
+ // enough data to mix
+ if(_read + len <= _buffersize) {
+ SDL_MixAudio(data, _buffer + _read, len, volume);
+ _read = (_read + len) % _buffersize;
+ } else {
+ // wrap around in buffer
+ fprintf(stderr, "wrap around in buffer (%d, %d, %d)\n",
+ len, _read, _buffersize);
+
+ SDL_MixAudio(data, _buffer + _read, _buffersize - _read, volume);
+ len -= _buffersize - _read;
+ SDL_MixAudio(data + _buffersize - _read, _buffer, len, volume);
+ _read = len;
+ }
+ } else {
+ // buffer under-run
+ fprintf(stderr, "buffer underrun!\n");
+ // don't do anything
+ }
+
+#ifndef macintosh
+ SDL_SemPost(_sem);
+#endif
+ return 1;
+ }
+
+ void SourceMusic::Idle(void) {
+ if(_sample == NULL)
+ return;
+
+ // printf("idling\n");
+ while( _read == _decoded ||
+ (_read - _decoded + _buffersize) % _buffersize >
+ _sample_buffersize ) {
+ // if(_read == _decoded) printf("_read == _decoded == %d\n", _read);
+ // fill the buffer
+ int count = Sound_Decode(_sample);
+ // printf("adding %d bytes to buffer\n", count);
+ if(count <= _buffersize - _decoded) {
+ memcpy(_buffer + _decoded, _sample->buffer, count);
+ } else {
+ // wrapping around end of buffer (usually doesn't happen when
+ // _buffersize is a multiple of _sample_buffersize)
+ // printf("wrapping around end of buffer\n");
+ memcpy(_buffer + _decoded, _sample->buffer, _buffersize - _decoded);
+ memcpy(_buffer, (Uint8*) _sample->buffer + _buffersize - _decoded,
+ count - (_buffersize - _decoded));
+ }
+ _decoded = (_decoded + count) % _buffersize;
+
+ // check for end of sample, loop
+ if((_sample->flags & SOUND_SAMPLEFLAG_ERROR) ||
+ (_sample->flags & SOUND_SAMPLEFLAG_EOF)) {
+ // some error has occured, maybe end of sample reached
+#ifndef macintosh
+ SDL_SemWait(_sem);
+#else
+ SDL_LockAudio();
+#endif
+ // todo: let playback finish, because there's still data
+ // in the buffer that has to be mixed
+ CleanUp();
+ // fprintf(stderr, "end of sample reached!\n");
+ if(_loop) {
+ // fprintf(stderr, "looping music\n");
+ if(_loop != 255)
+ _loop--;
+ CreateSample();
+ } else {
+ _isPlaying = 0;
+ // todo: notify sound system (maybe load another song?)
+ }
+#ifndef macintosh
+ SDL_SemPost(_sem);
+#else
+ SDL_UnlockAudio();
+#endif
+ }
+ } // buffer has been filled
+ }
+}
diff --git a/nebu/audio/SourceSample.cpp b/nebu/audio/SourceSample.cpp
new file mode 100644
index 0000000..8e8ffb5
--- /dev/null
+++ b/nebu/audio/SourceSample.cpp
@@ -0,0 +1,80 @@
+#include "audio/nebu_SourceSample.h"
+
+#include <assert.h>
+#include <string.h>
+
+namespace Sound {
+ SourceSample::SourceSample(System *system) {
+ _system = system;
+
+ _buffer = NULL;
+ _buffersize = 8192;
+
+ _position = 0;
+ _decoded = 0;
+ }
+
+ SourceSample::~SourceSample() {
+ // fprintf(stderr, "nebu_SourceSample destructor called\n");
+ if(_buffer)
+ delete _buffer;
+ // Source::~Source();
+ }
+
+ void SourceSample::Load(char *filename) {
+#define BUFSIZE 1024 * 1024
+ SDL_RWops *rwops;
+
+ rwops = SDL_RWFromFile(filename, "rb");
+
+ Sound_Sample *sample = Sound_NewSample(rwops, NULL,
+ _system->GetAudioInfo(),
+ _buffersize );
+ if(sample == NULL) {
+ fprintf(stderr, "[error] failed loading sample from '%s': %s\n",
+ filename, Sound_GetError());
+ return;
+ }
+
+ Sound_DecodeAll(sample);
+
+ _buffersize = sample->buffer_size;
+ _buffer = new Uint8[_buffersize];
+ memcpy(_buffer, sample->buffer, _buffersize);
+
+ Sound_FreeSample(sample);
+
+ // fprintf(stderr, "done decoding sample '%s'\n", filename);
+ _position = 0;
+ }
+
+ int SourceSample::Mix(Uint8 *data, int len) {
+ if(_buffer == NULL)
+ return 0;
+
+ int volume = (int)(_volume * SDL_MIX_MAXVOLUME);
+ assert(len < _buffersize);
+
+ if(len < _buffersize - _position) {
+ SDL_MixAudio(data, _buffer + _position, len, volume);
+ _position += len;
+ } else {
+ SDL_MixAudio(data, _buffer + _position, _buffersize - _position,
+ volume);
+ len -= _buffersize - _position;
+
+ // printf("end of sample reached!\n");
+ if(_loop) {
+ if(_loop != 255)
+ _loop--;
+
+ _position = 0;
+ SDL_MixAudio(data, _buffer + _position, len, volume);
+ _position += len;
+ } else {
+ _isPlaying = 0;
+ }
+ }
+ return 1;
+ }
+}
diff --git a/nebu/base/Makefile.am b/nebu/base/Makefile.am
new file mode 100644
index 0000000..4a12b18
--- /dev/null
+++ b/nebu/base/Makefile.am
@@ -0,0 +1,6 @@
+noinst_LIBRARIES=libbase.a
+
+libbase_a_SOURCES = \
+ geom.c vector.c matrix.c random.c util.c system.c
+
+AM_CFLAGS = -I$(top_srcdir)/nebu/include
diff --git a/nebu/base/Makefile.in b/nebu/base/Makefile.in
new file mode 100644
index 0000000..86729f4
--- /dev/null
+++ b/nebu/base/Makefile.in
@@ -0,0 +1,300 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libbase.a
+
+libbase_a_SOURCES = \
+ geom.c vector.c matrix.c random.c util.c system.c
+
+
+AM_CFLAGS = -I$(top_srcdir)/nebu/include
+subdir = nebu/base
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libbase_a_AR = $(AR) cru
+libbase_a_LIBADD =
+am_libbase_a_OBJECTS = geom.$(OBJEXT) vector.$(OBJEXT) matrix.$(OBJEXT) \
+ random.$(OBJEXT) util.$(OBJEXT) system.$(OBJEXT)
+libbase_a_OBJECTS = $(am_libbase_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/geom.Po $(DEPDIR)/matrix.Po \
+@AMDEP_TRUE@ $(DEPDIR)/random.Po $(DEPDIR)/system.Po \
+@AMDEP_TRUE@ $(DEPDIR)/util.Po $(DEPDIR)/vector.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libbase_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libbase_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/base/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libbase.a: $(libbase_a_OBJECTS) $(libbase_a_DEPENDENCIES)
+ -rm -f libbase.a
+ $(libbase_a_AR) libbase.a $(libbase_a_OBJECTS) $(libbase_a_LIBADD)
+ $(RANLIB) libbase.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/geom.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/matrix.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/random.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/system.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/util.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vector.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/base/geom.c b/nebu/base/geom.c
new file mode 100644
index 0000000..6a3f60f
--- /dev/null
+++ b/nebu/base/geom.c
@@ -0,0 +1,118 @@
+/* some geometric routines always needed */
+
+#include <math.h>
+
+float length(float *v) {
+ return (float)sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+}
+
+float length2(float *v) {
+ return (float)sqrt(v[0] * v[0] + v[1] * v[1]);
+}
+
+float length3(float *v) {
+ return length(v);
+}
+
+void normalize(float *v) {
+ float d = length(v);
+ if (d == 0) return;
+ v[0] /= d;
+ v[1] /= d;
+ v[2] /= d;
+}
+
+void crossprod(float *v1, float *v2, float *out) {
+ out[0] = v1[1] * v2[2] - v1[2] * v2[1];
+ out[1] = v1[2] * v2[0] - v1[0] * v2[2];
+ out[2] = v1[0] * v2[1] - v1[1] * v2[0];
+}
+
+void normcrossprod(float *v1, float *v2, float *out) {
+ crossprod(v1, v2, out);
+ normalize(out);
+}
+
+float scalarprod2(float *v1, float *v2) {
+ return v1[0] * v2[0] + v1[1] * v2[1];
+}
+
+float scalarprod(float *v1, float *v2) {
+ return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
+}
+
+void vsub2(float *v1, float *v2, float *out) {
+ out[0] = v1[0] - v2[0];
+ out[1] = v1[1] - v2[1];
+}
+
+void vsub(float *v1, float *v2, float *out) {
+ out[0] = v1[0] - v2[0];
+ out[1] = v1[1] - v2[1];
+ out[2] = v1[2] - v2[2];
+}
+
+void vadd2(float *v1, float *v2, float *out) {
+ out[0] = v1[0] + v2[0];
+ out[1] = v1[1] + v2[1];
+}
+
+void vadd(float *v1, float *v2, float *out) {
+ out[0] = v1[0] + v2[0];
+ out[1] = v1[1] + v2[1];
+ out[2] = v1[2] + v2[2];
+}
+
+void vcopy(float *v1, float *out) {
+ out[0] = v1[0];
+ out[1] = v1[1];
+ out[2] = v1[2];
+}
+
+void vmul(float *v, float f) {
+ v[0] *= f;
+ v[1] *= f;
+ v[2] *= f;
+}
+
+/* 4 entries... */
+
+float length4(float *v) {
+ return (float)sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2] +
+ v[3] * v[3]);
+}
+
+void normalize4(float *v) {
+ float d = length(v);
+ if (d == 0) return;
+ v[0] /= d;
+ v[1] /= d;
+ v[2] /= d;
+ v[3] /= d;
+}
+
+float scalarprod4(float *v1, float *v2) {
+ return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2] +
+ v1[3] * v2[3];
+}
+
+void vsub4(float *v1, float *v2, float *out) {
+ out[0] = v1[0] - v2[0];
+ out[1] = v1[1] - v2[1];
+ out[2] = v1[2] - v2[2];
+ out[3] = v1[3] - v2[3];
+}
+
+void vadd4(float *v1, float *v2, float *out) {
+ out[0] = v1[0] + v2[0];
+ out[1] = v1[1] + v2[1];
+ out[2] = v1[2] + v2[2];
+ out[3] = v1[3] + v2[3];
+}
+
+void vcopy4(float *v1, float *out) {
+ out[0] = v1[0];
+ out[1] = v1[1];
+ out[2] = v1[2];
+ out[3] = v1[3];
+}
diff --git a/nebu/base/matrix.c b/nebu/base/matrix.c
new file mode 100644
index 0000000..59b1347
--- /dev/null
+++ b/nebu/base/matrix.c
@@ -0,0 +1,189 @@
+#include "base/nebu_matrix.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+vec4* vec4Transform(vec4* pOut, const vec4* pV, const matrix *pM) {
+ vec4 tmp;
+ tmp.v[0] = pM->m[0] * pV->v[0] + pM->m[4] * pV->v[1] +
+ pM->m[8] * pV->v[2] + pM->m[12] * pV->v[3];
+ tmp.v[1] = pM->m[1] * pV->v[0] + pM->m[5] * pV->v[1] +
+ pM->m[9] * pV->v[2] + pM->m[13] * pV->v[3];
+ tmp.v[2] = pM->m[2] * pV->v[0] + pM->m[6] * pV->v[1] +
+ pM->m[10] * pV->v[2] + pM->m[14] * pV->v[3];
+ tmp.v[3] = pM->m[3] * pV->v[0] + pM->m[7] * pV->v[1] +
+ pM->m[11] * pV->v[2] + pM->m[15] * pV->v[3];
+ memcpy(pOut, &tmp, sizeof(vec4));
+ return pOut;
+}
+
+matrix* matrixIdentity(matrix *pOut) {
+ memset(pOut, 0, sizeof(matrix));
+ pOut->m[0] = pOut->m[5] = pOut->m[10] = pOut->m[15] = 1;
+ return pOut;
+}
+
+float matrixCofactor(const matrix *pM, int cf_row, int cf_col) {
+ int row, col;
+ float prod[6] = { 1, 1, 1, -1, -1, -1 };
+ int r = 0;
+ float cf;
+ for(row = 0; row < 4; row++) {
+ if(row != cf_row) {
+ int c = 0;
+ for(col = 0; col < 4; col++) {
+ if(col != cf_col) {
+ prod[ ((c - r + 3) % 3) + 0 ] *= pM->m[ row + 4 * col ];
+ prod[ ((c + r + 0) % 3) + 3 ] *= pM->m[ row + 4 * col ];
+ c++;
+ }
+ }
+ r++;
+ }
+ }
+ cf = prod[0] + prod[1] + prod[2] + prod[3] + prod[4] + prod[5];
+ // printf("cf(%d,%d): %.3f\n", cf_row, cf_col, cf);
+ return cf;
+}
+
+float matrixDeterminant(const matrix *pM) {
+ float det =
+ + pM->m[0] * matrixCofactor(pM, 0, 0)
+ - pM->m[4] * matrixCofactor(pM, 0, 1)
+ + pM->m[8] * matrixCofactor(pM, 0, 2)
+ - pM->m[12] * matrixCofactor(pM, 0, 3);
+ return det;
+}
+
+matrix* matrixAdjoint(matrix *pOut, float* pDet, const matrix *pM) {
+ matrix tmp;
+ int col, row;
+ int sign = 1;
+ float det = 0;
+ for(row = 0; row < 4; row++) {
+ for(col = 0; col < 4; col++) {
+ float cf = matrixCofactor(pM, row, col);
+ // tmp.m[row + 4 * col] = sign * cf;
+ // warum hier zeile und spalte tauschen?
+ tmp.m[col + 4 * row] = sign * cf;
+ if(row == 0)
+ det += sign * cf * pM->m[col * 4];
+ sign *= -1;
+ }
+ sign *= -1; // warum hier nochmal wechseln?
+ }
+ if(pDet)
+ *pDet = det;
+
+ memcpy(pOut, &tmp, sizeof(matrix));
+ return pOut;
+}
+
+matrix* matrixInverse(matrix *pOut, float* pDet, const matrix *pM) {
+ matrix adjoint;
+ float det;
+ int i;
+ matrixAdjoint(&adjoint, &det, pM);
+ if(pDet)
+ *pDet = det;
+ if(det == 0)
+ return NULL;
+
+ for(i = 0; i < 16; i++) {
+ pOut->m[i] = adjoint.m[i] / det;
+ }
+
+ return pOut;
+}
+
+matrix* matrixMultiply(matrix *pOut, const matrix *pM1, const matrix *pM2) {
+ int row, col;
+ matrix tmp;
+ for(row = 0; row < 4; row++) {
+ for(col = 0; col < 4; col++) {
+ tmp.m[row + col * 4] =
+ pM1->m[row + 0] * pM2->m[ 0 + col * 4] +
+ pM1->m[row + 4] * pM2->m[ 1 + col * 4] +
+ pM1->m[row + 8] * pM2->m[ 2 + col * 4] +
+ pM1->m[row + 12] * pM2->m[ 3 + col * 4];
+ }
+ }
+
+ memcpy(pOut, &tmp, sizeof(matrix));
+ return pOut;
+}
+
+matrix* matrixTranspose(matrix *pOut, const matrix *pM) {
+ matrix tmp;
+ int i;
+ for(i = 0; i < 16; i++) {
+ tmp.m[i] = pM->m[ i / 4 + (i % 4) * 4 ];
+ }
+ memcpy(pOut, &tmp, sizeof(matrix));
+ return pOut;
+}
+
+void matrixPrint(matrix *m) {
+ int row, col;
+ printf("[ ");
+ for(row = 0; row < 4; row++) {
+ for(col = 0; col < 4; col++) {
+ printf("%.3f ", m->m[row + col * 4]);
+ }
+ printf("; \n");
+ }
+ printf(" ]\n");
+}
+
+matrix* matrixRotationAxis(matrix *pOut, float fAngle, const vec3 *vAxis)
+{
+ float cosa = (float)cos(fAngle);
+ float sina = (float)sin(fAngle);
+ float x = vAxis->v[0], y = vAxis->v[1], z = vAxis->v[2];
+ float *m = pOut->m;
+
+ m[0] = cosa + (1 - cosa) * x * x;
+ m[1] = (1 - cosa) * x * y + sina * z;
+ m[2] = (1 - cosa) * x * z - sina * y;
+ m[3] = 0;
+ m[4] = (1 - cosa) * x * y - z * sina;
+ m[5] = cosa + (1 - cosa) * y * y;
+ m[6] = (1 - cosa) * y * z + x * sina;
+ m[7] = 0;
+ m[8] = (1 - cosa) * x * z + sina * y;
+ m[9] = (1 - cosa) * y * z - sina * x;
+ m[10] = cosa + (1 - cosa) * z * z;
+ m[11] = 0;
+ m[12] = 0;
+ m[13] = 0;
+ m[14] = 0;
+ m[15] = 1;
+
+ return pOut;
+}
+
+matrix* matrixTranslation(matrix *pOut, const vec3 *vTranslation)
+{
+ float *m = pOut->m;
+ matrixIdentity(pOut);
+ m[12] = vTranslation->v[0];
+ m[13] = vTranslation->v[1];
+ m[14] = vTranslation->v[2];
+
+ return pOut;
+}
+
+matrix* matrixScale(matrix *pOut, const vec3 *vScale)
+{
+ float *m = pOut->m;
+ memset(pOut, 0, sizeof(matrix));
+ m[0] = vScale->v[0];
+ m[5] = vScale->v[1];
+ m[10] = vScale->v[2];
+ m[15] = 1;
+
+ return pOut;
+}
diff --git a/nebu/base/random.c b/nebu/base/random.c
new file mode 100644
index 0000000..4315b77
--- /dev/null
+++ b/nebu/base/random.c
@@ -0,0 +1,37 @@
+/* Textbook standard linear congruent pseudo-random number generator
+ (say that ten times quick) */
+
+/* The generator returns numbers in 0..(2**31 - 1) */
+#define PERIOD 2147483647
+#define T_RAND_MAX PERIOD
+/* A is a "magic" constant calculated by IBM in the dawn of computing */
+#define A 48271
+#define Q 44488
+#define R 3399
+
+/* The seed of the generator, hopefully set by the user before rand is
+ called */
+static int seed = 42;
+
+/* Seeds the random number generator with the seed s */
+void tsrand(unsigned int s)
+{
+ seed = s % PERIOD;
+}
+
+/* Calculates a new random number */
+int trand(void)
+{
+ seed = A * (seed % Q) - R * (long)(seed / Q);
+ if(seed < 0)
+ seed += PERIOD;
+
+ return seed;
+}
+
+/* Bonus function, returns a random number in [0..1) */
+double tfrand(void)
+{
+ return (double)trand()/PERIOD;
+}
+
diff --git a/nebu/base/system.c b/nebu/base/system.c
new file mode 100644
index 0000000..07a75e7
--- /dev/null
+++ b/nebu/base/system.c
@@ -0,0 +1,68 @@
+#include "base/nebu_system.h"
+
+#include "SDL.h"
+#include <stdio.h>
+
+Callbacks *current = 0;
+static int return_code = -1;
+static int redisplay = 0;
+
+void SystemExit() {
+ fprintf(stderr, "[system] shutting down SDL now\n");
+ SDL_Quit();
+ fprintf(stderr, "[system] exiting application\n");
+}
+
+unsigned int SystemGetElapsedTime() {
+ /* fprintf(stderr, "%d\n", SDL_GetTicks()); */
+ return SDL_GetTicks();
+}
+
+int SystemMainLoop() {
+ SDL_Event event;
+
+ return_code = -1;
+ while(return_code == -1) {
+ while(SDL_PollEvent(&event) && current) {
+ switch(event.type) {
+ case SDL_KEYDOWN:
+ case SDL_KEYUP:
+ case SDL_JOYAXISMOTION:
+ case SDL_JOYBUTTONDOWN:
+ case SDL_JOYBUTTONUP:
+ case SDL_MOUSEBUTTONUP:
+ case SDL_MOUSEBUTTONDOWN:
+ case SDL_MOUSEMOTION:
+ SystemHandleInput(&event);
+ break;
+ case SDL_QUIT:
+ SystemExit();
+ break;
+ default:
+ /* ignore event */
+ break;
+ }
+ }
+ if(redisplay) {
+ current->display();
+ redisplay = 0;
+ } else
+ current->idle();
+ }
+ if(current->exit)
+ (current->exit)();
+ return return_code;
+}
+
+void SystemRegisterCallbacks(Callbacks *cb) {
+ current = cb;
+}
+
+void SystemExitLoop(int value) {
+ return_code = value;
+}
+
+void SystemPostRedisplay() {
+ redisplay = 1;
+}
+
diff --git a/nebu/base/util.c b/nebu/base/util.c
new file mode 100644
index 0000000..8c5c2ff
--- /dev/null
+++ b/nebu/base/util.c
@@ -0,0 +1,41 @@
+/* small utility functions */
+
+#include <stdlib.h>
+#include "base/nebu_random.h"
+#include "base/nebu_types.h"
+
+void randomPermutation( int N, int *nodes )
+{
+ int i;
+ for(i = 0; i < N; i++)
+ nodes[i] = i;
+
+ for(i = 0; i < N - 1; i++) {
+ int s, t;
+ int tmp;
+ t = N - 1 - i;
+ // s = (int) ((float)( t + 1 ) * trand() / (RAND_MAX + 1.0f));
+ s = trand() % (t + 1);
+ tmp = nodes[t];
+ nodes[t] = nodes[s];
+ nodes[s] = tmp;
+ }
+}
+
+void clamp( float *f, float min, float max )
+{
+ if(*f < min) *f = min;
+ else if(*f > max) *f = max;
+}
+
+void addList(List **l, void* data) {
+ List *p;
+ if(*l == NULL) {
+ *l = (List*) malloc(sizeof(List));
+ (*l)->next = NULL;
+ }
+ for(p = *l; p->next != NULL; p = p->next);
+ p->next = (List*) malloc(sizeof(List));
+ p->next->next = NULL;
+ p->data = data;
+}
diff --git a/nebu/base/vector.c b/nebu/base/vector.c
new file mode 100644
index 0000000..572c479
--- /dev/null
+++ b/nebu/base/vector.c
@@ -0,0 +1,322 @@
+#include "base/nebu_vector.h"
+
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+vec4* vec4Add(vec4 *pOut, const vec4 *pV1, const vec4 *pV2) {
+ pOut->v[0] = pV1->v[0] + pV2->v[0];
+ pOut->v[1] = pV1->v[1] + pV2->v[1];
+ pOut->v[2] = pV1->v[2] + pV2->v[2];
+ pOut->v[3] = pV1->v[3] + pV2->v[3];
+ return pOut;
+}
+
+vec4* vec4Sub(vec4 *pOut, const vec4 *pV1, const vec4 *pV2) {
+ pOut->v[0] = pV1->v[0] - pV2->v[0];
+ pOut->v[1] = pV1->v[1] - pV2->v[1];
+ pOut->v[2] = pV1->v[2] - pV2->v[2];
+ pOut->v[3] = pV1->v[3] - pV2->v[3];
+ return pOut;
+}
+
+vec3* vec3Add(vec3 *pOut, const vec3 *pV1, const vec3 *pV2) {
+ pOut->v[0] = pV1->v[0] + pV2->v[0];
+ pOut->v[1] = pV1->v[1] + pV2->v[1];
+ pOut->v[2] = pV1->v[2] + pV2->v[2];
+ return pOut;
+}
+
+vec3* vec3Sub(vec3 *pOut, const vec3 *pV1, const vec3 *pV2) {
+ pOut->v[0] = pV1->v[0] - pV2->v[0];
+ pOut->v[1] = pV1->v[1] - pV2->v[1];
+ pOut->v[2] = pV1->v[2] - pV2->v[2];
+ return pOut;
+}
+
+vec3* vec3Cross(vec3 *pOut, const vec3 *pV1, const vec3 *pV2) {
+ vec3 tmp;
+ tmp.v[0] = pV1->v[1] * pV2->v[2] - pV1->v[2] * pV2->v[1];
+ tmp.v[1] = pV1->v[2] * pV2->v[0] - pV1->v[0] * pV2->v[2];
+ tmp.v[2] = pV1->v[0] * pV2->v[1] - pV1->v[1] * pV2->v[0];
+ memcpy(pOut, &tmp, sizeof(vec3));
+ return pOut;
+}
+
+float vec3Dot(const vec3 *pV1, const vec3 *pV2) {
+ return pV1->v[0] * pV2->v[0] +
+ pV1->v[1] * pV2->v[1] + pV1->v[2] * pV2->v[2];
+}
+
+float vec4Dot(const vec4 *pV1, const vec4 *pV2) {
+ return
+ pV1->v[0] * pV2->v[0] + pV1->v[1] * pV2->v[1] +
+ pV1->v[2] * pV2->v[2] + pV1->v[3] * pV2->v[3];
+}
+
+float vec3Length(const vec3 *pV) {
+ return (float) sqrt( pV->v[0] * pV->v[0] +
+ pV->v[1] * pV->v[1] + pV->v[2] * pV->v[2] );
+}
+
+float vec3LengthSqr(const vec3 *pV) {
+ return pV->v[0] * pV->v[0] +
+ pV->v[1] * pV->v[1] + pV->v[2] * pV->v[2];
+}
+
+vec3* vec3Normalize(vec3 *pOut, const vec3 *pV) {
+ float fLength = vec3Length(pV);
+ if(fLength != 0) {
+ pOut->v[0] = pV->v[0] / fLength;
+ pOut->v[1] = pV->v[1] / fLength;
+ pOut->v[2] = pV->v[2] / fLength;
+ }
+ return pOut;
+}
+
+void vec4Print(const vec4 *v) {
+ int i;
+ printf("[ ");
+ for(i = 0; i < 4; i++) {
+ printf("%.3f ", v->v[i]);
+ }
+ printf(" ]\n");
+}
+
+void vec3Print(const vec3 *v) {
+ int i;
+ printf("[ ");
+ for(i = 0; i < 3; i++) {
+ printf("%.3f ", v->v[i]);
+ }
+ printf(" ]\n");
+}
+
+vec4* vec4fromVec3(vec4 *pOut, const vec3 *pV) {
+ memcpy(pOut, pV, sizeof(vec3));
+ pOut->v[3] = 1;
+ return pOut;
+}
+
+vec3* vec3fromVec4(vec3 *pOut, const vec4 *pV) {
+ if(pV->v[3] != 0) {
+ pOut->v[0] = pV->v[0] / pV->v[3];
+ pOut->v[1] = pV->v[1] / pV->v[3];
+ pOut->v[2] = pV->v[2] / pV->v[3];
+ return pOut;
+ } else {
+ memset(pOut, 0, sizeof(vec3));
+ return NULL;
+ }
+}
+
+vec3* vec3Copy(vec3 *pOut, const vec3 *pV) {
+ memcpy(pOut, pV, sizeof(vec3));
+ return pOut;
+}
+
+vec3* vec3Scale(vec3 *pOut, const vec3 *pV, float f) {
+ pOut->v[0] = f * pV->v[0];
+ pOut->v[1] = f * pV->v[1];
+ pOut->v[2] = f * pV->v[2];
+ return pOut;
+}
+
+unsigned int uintFromVec3(vec3 *pV) {
+ return
+ ( ( (unsigned int)(pV->v[0] * 127.0f + 128.0f) ) << 16 ) +
+ ( ( (unsigned int)(pV->v[1] * 127.0f + 128.0f) ) << 8 ) +
+ ( ( (unsigned int)(pV->v[2] * 127.0f + 128.0f) ) << 0 );
+}
+
+vec3* vec3Zero(vec3 *pV) {
+ memset(pV, 0, sizeof(vec3));
+ return pV;
+}
+
+vec3* vec3TriNormalDirection(vec3* pOut,
+ const vec3* pV1,
+ const vec3* pV2,
+ const vec3 *pV3) {
+ vec3 v1, v2;
+ vec3Sub(&v1, pV2, pV1);
+ vec3Sub(&v2, pV3, pV1);
+ vec3Cross(pOut, &v1, &v2);
+ return pOut;
+}
+
+vec2* vec2Copy(vec2 *pOut, const vec2 *pV) {
+ memcpy(pOut, pV, sizeof(vec2));
+ return pOut;
+}
+
+vec2* vec2_Orthogonal(vec2 *pOut, const vec2 *pV) {
+ pOut->v[0] = pV->v[1];
+ pOut->v[1] = - pV->v[0];
+ return pOut;
+}
+
+vec2* vec2Add(vec2 *pOut, const vec2 *pV1, const vec2 *pV2) {
+ pOut->v[0] = pV1->v[0] + pV2->v[0];
+ pOut->v[1] = pV1->v[1] + pV2->v[1];
+ return pOut;
+}
+
+vec2* vec2Sub(vec2 *pOut, const vec2 *pV1, const vec2 *pV2) {
+ pOut->v[0] = pV1->v[0] - pV2->v[0];
+ pOut->v[1] = pV1->v[1] - pV2->v[1];
+ return pOut;
+}
+
+vec2* vec2Scale(vec2 *pOut, const vec2 *pV, float fScale) {
+ pOut->v[0] = pV->v[0] * fScale;
+ pOut->v[1] = pV->v[1] * fScale;
+ return pOut;
+}
+
+vec2* vec2Normalize(vec2 *pOut, const vec2 *pV) {
+ return vec2Scale(pOut, pV, 1 / vec2Length(pV));
+}
+
+float vec2Dot(const vec2 *pV1, const vec2 *pV2) {
+ return pV1->v[0] * pV2->v[0] + pV1->v[1] * pV2->v[1];
+}
+
+float vec2Length(const vec2 *pV) {
+ float fLength2 = (pV->v[0] * pV->v[0] + pV->v[1] * pV->v[1]);
+ float l = sqrt(fLength2);
+ return l;
+}
+
+int segment2_findT(float *t, const segment2 *s, const vec2 *v) {
+ float epsilon = 0.001;
+ if( fabs(s->vDirection.v[0]) > fabs(s->vDirection.v[1]) ) {
+ *t = (v->v[0] - s->vStart.v[0]) / s->vDirection.v[0];
+ if( fabs(v->v[1] - (s->vStart.v[1] + *t * s->vDirection.v[1])) >
+ epsilon ) {
+ return 1;
+ }
+ } else {
+ *t = (v->v[1] - s->vStart.v[1]) / s->vDirection.v[1];
+ if( fabs(v->v[0] - (s->vStart.v[0] + *t * s->vDirection.v[0])) >
+ epsilon ) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+vec2* segment2_IntersectParallel(vec2 *pOut, float *t1, float *t2,
+ const segment2 *s1, const segment2 *s2) {
+ // if the lines don't overlap, return NULL
+ // else find t2 for t1 == 0
+ // if t2 in [0,1] return t2, t1 = 0
+ // else find t1 for t2 == 0 and t2 == 1
+ // if t1 < 0 return NULL (no intersection)
+ // else return the smaller t1 and the corresponding t2
+
+ vec2 v; float t;
+
+ // if the lines don't overlap, return NULL
+ // else find t2 for t1 == 0
+ vec2Copy(&v, &s1->vStart);
+ if(segment2_findT(t2, s2, &v)) {
+ // printf("[vector] are not collinear\n");
+ return NULL;
+ }
+
+ // if t2 in [0,1] return t2, t1 = 0
+ if(*t2 >= 0 && *t2 <= 1) {
+ vec2Copy(pOut, &s1->vStart);
+ *t1 = 0;
+ return pOut;
+ }
+ // else find t1 for t2 == 0 and t2 == 1
+ vec2Copy(&v, &s2->vStart);
+ if(segment2_findT(t1, s1, &v))
+ return NULL;
+ // if t1 < 0 return NULL (no intersection)
+ if(*t1 < 0) return NULL;
+ vec2Add(&v, &s2->vStart, &s2->vDirection);
+ if(segment2_findT(&t, s1, &v))
+ return NULL;
+ assert(t >= 0);
+
+ if(*t1 > 1 && t > 1)
+ return NULL;
+ // else return the smaller t1 and the corresponding t2
+ if(t < *t1) {
+ *t1 = t;
+ *t2 = 1;
+ vec2Copy(pOut, &v);
+ } else {
+ *t2 = 0;
+ vec2Copy(pOut, &s2->vStart);
+ }
+ return pOut;
+}
+
+vec2* segment2_IntersectNonParallel(vec2 *pOut, float *t1, float *t2,
+ const segment2 *s1, const segment2 *s2) {
+ vec3 v1, v2;
+ vec3 tmp1, tmp2;
+ vec3 vIntersection;
+
+ // compute the homogenous line coordinates
+ tmp1.v[0] = s1->vStart.v[0];
+ tmp1.v[1] = s1->vStart.v[1];
+ tmp1.v[2] = 1;
+ tmp2.v[0] = s1->vStart.v[0] + s1->vDirection.v[0];
+ tmp2.v[1] = s1->vStart.v[1] + s1->vDirection.v[1];
+ tmp2.v[2] = 1;
+ vec3Cross(&v1, &tmp1, &tmp2);
+
+ tmp1.v[0] = s2->vStart.v[0];
+ tmp1.v[1] = s2->vStart.v[1];
+ tmp1.v[2] = 1;
+ tmp2.v[0] = s2->vStart.v[0] + s2->vDirection.v[0];
+ tmp2.v[1] = s2->vStart.v[1] + s2->vDirection.v[1];
+ tmp2.v[2] = 1;
+ vec3Cross(&v2, &tmp1, &tmp2);
+
+ // compute the intersection in homogenous coordinates and
+ // project back to 2d
+ vec3Cross(&vIntersection, &v1, &v2);
+ pOut->v[0] = vIntersection.v[0] / vIntersection.v[2];
+ pOut->v[1] = vIntersection.v[1] / vIntersection.v[2];
+
+ // compute t1, t2
+ if(fabs(s1->vDirection.v[0]) > fabs(s1->vDirection.v[1]))
+ *t1 = (pOut->v[0] - s1->vStart.v[0]) / s1->vDirection.v[0];
+ else
+ *t1 = (pOut->v[1] - s1->vStart.v[1]) / s1->vDirection.v[1];
+ if(fabs(s2->vDirection.v[0]) > fabs(s2->vDirection.v[1]))
+ *t2 = (pOut->v[0] - s2->vStart.v[0]) / s2->vDirection.v[0];
+ else
+ *t2 = (pOut->v[1] - s2->vStart.v[1]) / s2->vDirection.v[1];
+
+ return pOut;
+}
+
+vec2* segment2_Intersect(vec2 *pOut, float *t1, float *t2,
+ const segment2 *s1, const segment2 *s2) {
+ // check if s1, s2 are parallel
+ vec2 tmp;
+ if( fabs(vec2Dot(&s1->vDirection,
+ vec2_Orthogonal(&tmp, & s2->vDirection) )) < 0.1) {
+ // printf("[vector] lines are parallel\n");
+ pOut = segment2_IntersectParallel(pOut, t1, t2, s1, s2);
+ if(!pOut) {
+ *t1 = 0;
+ *t2 = 0;
+ }
+ } else {
+ pOut = segment2_IntersectNonParallel(pOut, t1, t2, s1, s2);
+ }
+ return pOut;
+}
+
+float segment2_Length(const segment2 *s) {
+ return vec2Length(&s->vDirection);
+}
diff --git a/nebu/filesystem/Makefile.am b/nebu/filesystem/Makefile.am
new file mode 100644
index 0000000..45f2d2c
--- /dev/null
+++ b/nebu/filesystem/Makefile.am
@@ -0,0 +1,7 @@
+noinst_LIBRARIES=libfilesystem.a
+
+libfilesystem_a_SOURCES= \
+ filesystem.c file_io.c directory.c findpath.c
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/nebu/include
diff --git a/nebu/filesystem/Makefile.in b/nebu/filesystem/Makefile.in
new file mode 100644
index 0000000..1fb7d40
--- /dev/null
+++ b/nebu/filesystem/Makefile.in
@@ -0,0 +1,299 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libfilesystem.a
+
+libfilesystem_a_SOURCES = \
+ filesystem.c file_io.c directory.c findpath.c
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/nebu/include
+
+subdir = nebu/filesystem
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libfilesystem_a_AR = $(AR) cru
+libfilesystem_a_LIBADD =
+am_libfilesystem_a_OBJECTS = filesystem.$(OBJEXT) file_io.$(OBJEXT) \
+ directory.$(OBJEXT) findpath.$(OBJEXT)
+libfilesystem_a_OBJECTS = $(am_libfilesystem_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/directory.Po $(DEPDIR)/file_io.Po \
+@AMDEP_TRUE@ $(DEPDIR)/filesystem.Po $(DEPDIR)/findpath.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libfilesystem_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libfilesystem_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/filesystem/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libfilesystem.a: $(libfilesystem_a_OBJECTS) $(libfilesystem_a_DEPENDENCIES)
+ -rm -f libfilesystem.a
+ $(libfilesystem_a_AR) libfilesystem.a $(libfilesystem_a_OBJECTS) $(libfilesystem_a_LIBADD)
+ $(RANLIB) libfilesystem.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/directory.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/file_io.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/filesystem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/findpath.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/filesystem/directory.c b/nebu/filesystem/directory.c
new file mode 100644
index 0000000..e61126d
--- /dev/null
+++ b/nebu/filesystem/directory.c
@@ -0,0 +1,56 @@
+#include "base/nebu_types.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <unistd.h>
+
+List* readDirectoryContents(const char *dirname, const char *prefix) {
+ DIR *dir;
+ struct dirent *entry;
+ List *l, *p;
+
+ l = (List*) malloc(sizeof(List));
+ p = l;
+ p->next = NULL;
+
+ dir = opendir(dirname);
+ if(dir == NULL) {
+ fprintf(stderr, "warning: cannot open directory '%s'\n", dirname);
+ return l;
+ }
+ while((entry = readdir(dir)) != NULL) {
+ char *name;
+ if(prefix == NULL || strstr(entry->d_name, prefix) == entry->d_name) {
+ if(entry->d_name[0] != '.') {
+ name = malloc(strlen(entry->d_name) + 1);
+ memcpy(name, entry->d_name, strlen(entry->d_name) + 1);
+ p->data = name;
+ p->next = (List*) malloc(sizeof(List));
+ p = p->next;
+ p->next = NULL;
+ }
+ }
+ }
+ closedir(dir);
+ return l;
+
+}
+
+void makeDirectory(const char *name) {
+ int result;
+ if(access(name, R_OK)) {
+#ifndef WIN32
+ result = mkdir(name, 0x1ff);
+#else
+ result = mkdir(name);
+#endif
+ if(result)
+ printf("cannot create dir '%s': %s\n", name, strerror(errno));
+ }
+}
diff --git a/nebu/filesystem/file_io.c b/nebu/filesystem/file_io.c
new file mode 100644
index 0000000..4b4fe90
--- /dev/null
+++ b/nebu/filesystem/file_io.c
@@ -0,0 +1,42 @@
+/* this is a small wrapper around the basic file io functions,
+ ie open, close, read, gets */
+
+#include "filesystem/nebu_file_io.h"
+
+#ifdef IO_ZLIB
+
+file_handle file_open(const char *path, const char* mode) {
+ return gzopen(path, mode);
+}
+
+int file_close(file_handle file) {
+ return gzclose(file);
+}
+
+int file_read(file_handle file, void* data, unsigned int size) {
+ return gzread(file, data, size);
+}
+
+char* file_gets(file_handle file, char* data, unsigned int size) {
+ return gzgets(file, data, size);
+}
+
+#else
+
+file_handle file_open(const char *path, const char* mode) {
+ return fopen(path, mode);
+}
+
+int file_close(file_handle file) {
+ return fclose(file);
+}
+
+int file_read(file_handle file, void* data, unsigned int size) {
+ return fread(data, 1, size, file);
+}
+
+char* file_gets(file_handle file, char* data, unsigned int size) {
+ return fgets(data, size, file);
+}
+
+#endif
diff --git a/nebu/filesystem/filesystem.c b/nebu/filesystem/filesystem.c
new file mode 100644
index 0000000..4576087
--- /dev/null
+++ b/nebu/filesystem/filesystem.c
@@ -0,0 +1,16 @@
+#include "filesystem/nebu_filesystem.h"
+
+#include <stdio.h>
+
+void initFilesystem(int argc, const char *argv[]) {
+ dirSetup(argv[0]);
+}
+
+int fileExists(const char *path) {
+ FILE *f;
+ if((f = fopen(path, "r"))) {
+ fclose(f);
+ return 1;
+ }
+ return 0;
+}
diff --git a/nebu/filesystem/findpath.c b/nebu/filesystem/findpath.c
new file mode 100644
index 0000000..c8632a9
--- /dev/null
+++ b/nebu/filesystem/findpath.c
@@ -0,0 +1,106 @@
+/*
+ Loki_Update - A tool for updating Loki products over the Internet
+ Copyright (C) 2000 Loki Software, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ info@lokigames.com
+*/
+
+/* I modified this file a little, removing unneeded features and making the
+ thing compile ( Andreas Umbach <marvin@dataway.ch> ) */
+
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#ifndef macintosh
+#ifndef WIN32
+# include <unistd.h>
+#endif
+#endif
+
+#ifndef PATH_MAX
+#define PATH_MAX 8192
+#endif
+
+#if !defined(WIN32) && !defined(macintosh) && !defined(__APPLE__)
+void goto_installpath(const char *argv0)
+{
+ char temppath[PATH_MAX];
+ char datapath[PATH_MAX];
+ char *home;
+
+ home = getenv("HOME");
+ if ( ! home ) {
+ home = ".";
+ }
+
+ strncpy(temppath, argv0, PATH_MAX);
+ if ( ! strrchr(temppath, '/') ) {
+ char *path;
+ char *last;
+ int found;
+
+ found = 0;
+ path = getenv("PATH");
+ do {
+ /* Initialize our filename variable */
+ temppath[0] = '\0';
+
+ /* Get next entry from path variable */
+ last = strchr(path, ':');
+ if ( ! last )
+ last = path+strlen(path);
+
+ /* Perform tilde expansion */
+ if ( *path == '~' ) {
+ strcpy(temppath, home);
+ ++path;
+ }
+
+ /* Fill in the rest of the filename */
+ if ( last > (path+1) ) {
+ strncat(temppath, path, (last-path));
+ strcat(temppath, "/");
+ }
+ strcat(temppath, "./");
+ strcat(temppath, argv0);
+
+ /* See if it exists, and update path */
+ if (access(temppath, X_OK) == 0) {
+ ++found;
+ }
+ path = last+1;
+
+ } while ( *last && !found );
+
+ } else {
+ /* Increment argv0 to the basename */
+ argv0 = strrchr(argv0, '/')+1;
+ }
+
+ /* Now canonicalize it to a full pathname for the data path */
+ datapath[0] = '\0';
+ if ( realpath(temppath, datapath) ) {
+ /* There should always be '/' in the path */
+ *(strrchr(datapath, '/')) = '\0';
+ }
+ if ( ! *datapath || (chdir(datapath) < 0) ) {
+ fprintf(stderr, "Couldn't change to install directory\n");
+ exit(1); /* OK: critical, installation corrupt */
+ }
+}
+#endif
diff --git a/nebu/include/Makefile.am b/nebu/include/Makefile.am
new file mode 100644
index 0000000..910de28
--- /dev/null
+++ b/nebu/include/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = audio base filesystem input scripting video
+
+noinst_HEADERS = Nebu.h Nebu_audio.h Nebu_base.h Nebu_configuration.h Nebu_filesystem.h Nebu_input.h Nebu_scripting.h Nebu_video.h
diff --git a/nebu/include/Makefile.in b/nebu/include/Makefile.in
new file mode 100644
index 0000000..7f992aa
--- /dev/null
+++ b/nebu/include/Makefile.in
@@ -0,0 +1,319 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+SUBDIRS = audio base filesystem input scripting video
+
+noinst_HEADERS = Nebu.h Nebu_audio.h Nebu_base.h Nebu_configuration.h Nebu_filesystem.h Nebu_input.h Nebu_scripting.h Nebu_video.h
+subdir = nebu/include
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
+ uninstall-info-recursive all-recursive install-data-recursive \
+ install-exec-recursive installdirs-recursive install-recursive \
+ uninstall-recursive check-recursive installcheck-recursive
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+DIST_SUBDIRS = $(SUBDIRS)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/include/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
+ clean-generic clean-recursive distclean distclean-generic \
+ distclean-recursive distclean-tags distdir dvi dvi-am \
+ dvi-recursive info info-am info-recursive install install-am \
+ install-data install-data-am install-data-recursive \
+ install-exec install-exec-am install-exec-recursive \
+ install-info install-info-am install-info-recursive install-man \
+ install-recursive install-strip installcheck installcheck-am \
+ installdirs installdirs-am installdirs-recursive \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-recursive tags tags-recursive uninstall \
+ uninstall-am uninstall-info-am uninstall-info-recursive \
+ uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/include/Nebu.h b/nebu/include/Nebu.h
new file mode 100644
index 0000000..427e25e
--- /dev/null
+++ b/nebu/include/Nebu.h
@@ -0,0 +1,11 @@
+#ifndef _NEBU_H
+#define _NEBU_H
+
+#include "Nebu_base.h"
+#include "Nebu_filesystem.h"
+#include "Nebu_scripting.h"
+#include "Nebu_configuration.h"
+#include "Nebu_video.h"
+#include "Nebu_input.h"
+
+#endif
diff --git a/nebu/include/Nebu_audio.h b/nebu/include/Nebu_audio.h
new file mode 100644
index 0000000..c16e0b5
--- /dev/null
+++ b/nebu/include/Nebu_audio.h
@@ -0,0 +1,13 @@
+#ifndef _AUDIO_H
+#define _AUDIO_H
+
+#include "audio/nebu_Sound.h"
+#include "audio/nebu_SoundSystem.h"
+#include "audio/nebu_Source.h"
+#include "audio/nebu_Source3D.h"
+#include "audio/nebu_SourceCopy.h"
+#include "audio/nebu_SourceEngine.h"
+#include "audio/nebu_SourceMusic.h"
+#include "audio/nebu_SourceSample.h"
+
+#endif
diff --git a/nebu/include/Nebu_base.h b/nebu/include/Nebu_base.h
new file mode 100644
index 0000000..1234e04
--- /dev/null
+++ b/nebu/include/Nebu_base.h
@@ -0,0 +1,13 @@
+#ifndef _BASE_H
+#define _BASE_H
+
+#include "base/nebu_callbacks.h"
+#include "base/nebu_geom.h"
+#include "base/nebu_matrix.h"
+#include "base/nebu_random.h"
+#include "base/nebu_types.h"
+#include "base/nebu_util.h"
+#include "base/nebu_vector.h"
+#include "base/nebu_system.h"
+
+#endif
diff --git a/nebu/include/Nebu_configuration.h b/nebu/include/Nebu_configuration.h
new file mode 100644
index 0000000..01e0338
--- /dev/null
+++ b/nebu/include/Nebu_configuration.h
@@ -0,0 +1,5 @@
+#ifndef _NEBU_CONFIGURATION_H
+#define _NEBU_CONFIGURATION_H
+
+
+#endif
diff --git a/nebu/include/Nebu_filesystem.h b/nebu/include/Nebu_filesystem.h
new file mode 100644
index 0000000..8549c78
--- /dev/null
+++ b/nebu/include/Nebu_filesystem.h
@@ -0,0 +1,7 @@
+#ifndef _NEBU_FILESYSTEM_H
+#define _NEBU_FILESYSTEM_H
+
+#include "filesystem/nebu_file_io.h"
+#include "filesystem/nebu_filesystem.h"
+
+#endif
diff --git a/nebu/include/Nebu_input.h b/nebu/include/Nebu_input.h
new file mode 100644
index 0000000..ebc9f49
--- /dev/null
+++ b/nebu/include/Nebu_input.h
@@ -0,0 +1,7 @@
+#ifndef _NEBU_INPUT_H
+#define _NEBU_INPUT_H
+
+#include "input/nebu_input_system.h"
+#include "input/nebu_system_keynames.h"
+
+#endif
diff --git a/nebu/include/Nebu_scripting.h b/nebu/include/Nebu_scripting.h
new file mode 100644
index 0000000..0c96858
--- /dev/null
+++ b/nebu/include/Nebu_scripting.h
@@ -0,0 +1,6 @@
+#ifndef _NEBU_SCRIPTING_H
+#define _NEBU_SCRIPTING_H
+
+#include "scripting/nebu_scripting.h"
+
+#endif
diff --git a/nebu/include/Nebu_video.h b/nebu/include/Nebu_video.h
new file mode 100644
index 0000000..94427c1
--- /dev/null
+++ b/nebu/include/Nebu_video.h
@@ -0,0 +1,12 @@
+#ifndef _NEBU_VIDEO_H
+#define _NEBU_VIDEO_H
+
+#include "video/nebu_video_types.h"
+#include "video/nebu_console.h"
+#include "video/nebu_light.h"
+#include "video/nebu_png_texture.h"
+#include "video/nebu_quad.h"
+#include "video/nebu_renderer_gl.h"
+#include "video/nebu_video_system.h"
+
+#endif
diff --git a/nebu/include/audio/Makefile.am b/nebu/include/audio/Makefile.am
new file mode 100644
index 0000000..29f3570
--- /dev/null
+++ b/nebu/include/audio/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = nebu_Sound.h nebu_SoundSystem.h nebu_Source.h nebu_Source3D.h nebu_SourceCopy.h nebu_SourceEngine.h nebu_SourceMusic.h nebu_SourceSample.h nebu_audio_system.h
diff --git a/nebu/include/audio/Makefile.in b/nebu/include/audio/Makefile.in
new file mode 100644
index 0000000..4abd643
--- /dev/null
+++ b/nebu/include/audio/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = nebu_Sound.h nebu_SoundSystem.h nebu_Source.h nebu_Source3D.h nebu_SourceCopy.h nebu_SourceEngine.h nebu_SourceMusic.h nebu_SourceSample.h nebu_audio_system.h
+subdir = nebu/include/audio
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/include/audio/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/include/audio/nebu_Sound.h b/nebu/include/audio/nebu_Sound.h
new file mode 100644
index 0000000..5b5797b
--- /dev/null
+++ b/nebu/include/audio/nebu_Sound.h
@@ -0,0 +1,4 @@
+#ifndef NEBU_Sound_H
+#define NEBU_Sound_H
+
+#endif
diff --git a/nebu/include/audio/nebu_SoundSystem.h b/nebu/include/audio/nebu_SoundSystem.h
new file mode 100644
index 0000000..edbd0ec
--- /dev/null
+++ b/nebu/include/audio/nebu_SoundSystem.h
@@ -0,0 +1,56 @@
+#ifndef NEBU_Sound_System_H
+#define NEBU_Sound_System_H
+
+extern "C" {
+ #include "base/nebu_types.h"
+}
+
+#include "audio/nebu_Source.h"
+#include "base/nebu_Vector3.h"
+
+#include "SDL_sound.h"
+
+namespace Sound {
+ extern "C" {
+ void c_callback(void *userdata, Uint8 *stream, int len);
+ }
+
+ class Listener {
+ public:
+ Listener() { };
+ Vector3 _location;
+ Vector3 _velocity;
+ Vector3 _direction;
+ Vector3 _up;
+ };
+
+ enum { eUninitialized, eInitialized };
+
+ class System {
+ public:
+
+ System(SDL_AudioSpec *spec);
+ typedef void(*Audio_Callback)(void *userdata, Uint8* data, int len);
+ Audio_Callback GetCallback() { return c_callback; };
+ void Callback(Uint8* data, int len);
+ void Idle(); /* remove dead sound sources */
+ void AddSource(Source* source);
+ Sound_AudioInfo* GetAudioInfo() { return &_info; };
+ Listener& GetListener() { return _listener; };
+ void SetMixMusic(int value) { _mix_music = value; };
+ void SetMixFX(int value) { _mix_fx = value; };
+ void SetStatus(int eStatus) { _status = eStatus; };
+
+ protected:
+ SDL_AudioSpec *_spec;
+ Sound_AudioInfo _info;
+ Listener _listener;
+ List _sources;
+ int _mix_music;
+ int _mix_fx;
+ int _status;
+ };
+
+}
+
+#endif
diff --git a/nebu/include/audio/nebu_Source.h b/nebu/include/audio/nebu_Source.h
new file mode 100644
index 0000000..f400ccd
--- /dev/null
+++ b/nebu/include/audio/nebu_Source.h
@@ -0,0 +1,59 @@
+#ifndef NEBU_Sound_Source_H
+#define NEBU_Sound_Source_H
+
+#include "nebu_Sound.h"
+
+#include "SDL.h"
+
+namespace Sound {
+ enum {
+ eSoundMusic = 1,
+ eSoundFX = 2
+ };
+
+ class System;
+
+ class Source { // an abstract class, the basic interface for all Sources
+ public:
+ Source();
+ virtual ~Source();
+ virtual void Start();
+ virtual void Stop();
+ virtual void Pause();
+ virtual void UnPause();
+ virtual void Idle();
+ virtual int Mix(Uint8 *data, int len); // abstract
+
+ virtual Uint8 IsPlaying();
+ virtual void SetRemovable(void);
+ virtual Uint8 IsRemovable(void);
+ virtual void SetVolume(float volume);
+ virtual float GetVolume();
+ virtual void SetLoop(Uint8 loop);
+ virtual Uint8 GetLoop();
+ virtual void SetType(int type);
+ virtual int GetType(void);
+ void SetName(char *name);
+ char* GetName(void);
+
+ protected:
+ virtual void Reset();
+
+ System* _system;
+ Uint8 _isPlaying;
+ Uint8 _loop;
+ Uint8 _removable;
+ float _volume;
+ int _type;
+ char* _name;
+
+ SDL_mutex* _mutex;
+ SDL_sem * _sem;
+ };
+}
+
+#endif
+
+
+
+
diff --git a/nebu/include/audio/nebu_Source3D.h b/nebu/include/audio/nebu_Source3D.h
new file mode 100644
index 0000000..8084e00
--- /dev/null
+++ b/nebu/include/audio/nebu_Source3D.h
@@ -0,0 +1,45 @@
+#ifndef NEBU_Sound_Source3D_H
+#define NEBU_Sound_Source3D_H
+
+#include "nebu_Sound.h"
+#include "nebu_SoundSystem.h"
+#include "nebu_SourceSample.h"
+#include "base/nebu_Vector3.h"
+
+#define USOUND 50
+#define EPSILON 0.1f
+#define SOUND_VOL_THRESHOLD 0.1
+#define VOLSCALE_BASE 1000
+
+namespace Sound {
+ class Source3D : public Source {
+ public:
+ Source3D(System *system, SourceSample *source) {
+ _system = system;
+ _source = source;
+
+ _location = Vector3(0,0,0);
+ _velocity = Vector3(0,0,0);
+
+ _position = 0;
+ };
+ Vector3 _location;
+ Vector3 _velocity;
+ SourceSample* _source;
+
+ virtual int Mix(Uint8 *data, int len);
+ virtual void GetModifiers(float &fPan, float &fVolume, float &fShift);
+ // protected:
+ int _position;
+
+ protected:
+ Source3D() {
+ _location = Vector3(0,0,0);
+ _velocity = Vector3(0,0,0);
+
+ _position = 0;
+ };
+ };
+}
+
+#endif
diff --git a/nebu/include/audio/nebu_SourceCopy.h b/nebu/include/audio/nebu_SourceCopy.h
new file mode 100644
index 0000000..97ca88a
--- /dev/null
+++ b/nebu/include/audio/nebu_SourceCopy.h
@@ -0,0 +1,24 @@
+#ifndef NEBU_Sound_SourceCopy_H
+#define NEBU_Sound_SourceCopy_H
+
+#include "audio/nebu_Sound.h"
+#include "audio/nebu_SoundSystem.h"
+#include "audio/nebu_SourceSample.h"
+#include "base/nebu_Vector3.h"
+
+namespace Sound {
+ class SourceCopy : public Source {
+ public:
+ SourceCopy(SourceSample *source) {
+ _source = source;
+
+ _position = 0;
+ };
+ SourceSample* _source;
+ virtual int Mix(Uint8 *data, int len);
+ // protected:
+ int _position;
+ };
+}
+
+#endif
diff --git a/nebu/include/audio/nebu_SourceEngine.h b/nebu/include/audio/nebu_SourceEngine.h
new file mode 100644
index 0000000..5a4a4b0
--- /dev/null
+++ b/nebu/include/audio/nebu_SourceEngine.h
@@ -0,0 +1,24 @@
+#ifndef NEBU_Sound_SourceEngine_H
+#define NEBU_Sound_SourceEngine_H
+
+#include "nebu_Source3D.h"
+
+namespace Sound {
+ class SourceEngine : public Source3D {
+ public:
+ SourceEngine(System *system, SourceSample *source) {
+ _system = system;
+ _source = source;
+
+ _speedShift = 1.0f;
+ _pitchShift = 1.0f;
+ };
+
+ virtual void GetModifiers(float &fPan, float &fVolume, float &fShift);
+
+ float _speedShift;
+ float _pitchShift;
+ };
+}
+
+#endif
diff --git a/nebu/include/audio/nebu_SourceMusic.h b/nebu/include/audio/nebu_SourceMusic.h
new file mode 100644
index 0000000..71695ad
--- /dev/null
+++ b/nebu/include/audio/nebu_SourceMusic.h
@@ -0,0 +1,42 @@
+#ifndef NEBU_Sound_SourceMusic_H
+#define NEBU_Sound_SourceMusic_H
+
+#include "nebu_Sound.h"
+
+#include "nebu_Source.h"
+#include "nebu_SoundSystem.h"
+
+namespace Sound {
+ class SourceMusic : public Source {
+ public:
+ SourceMusic(System *system);
+ virtual ~SourceMusic();
+ void Load(char *filename);
+ virtual int Mix(Uint8 *data, int len);
+ virtual void Idle(void);
+
+ protected:
+ virtual void Reset(void) {
+ if(_sample != NULL) {
+ CleanUp();
+ CreateSample();
+ // fprintf(stderr, "sample resetted\n");
+ };
+ };
+ void CleanUp(void);
+ void CreateSample(void);
+
+ private:
+ Sound_Sample* _sample;
+ int _sample_buffersize;
+
+ Uint8* _buffer;
+ int _buffersize;
+ int _read;
+ int _decoded;
+
+ char *_filename;
+ SDL_RWops *_rwops;
+ };
+}
+#endif
diff --git a/nebu/include/audio/nebu_SourceSample.h b/nebu/include/audio/nebu_SourceSample.h
new file mode 100644
index 0000000..7ed407b
--- /dev/null
+++ b/nebu/include/audio/nebu_SourceSample.h
@@ -0,0 +1,33 @@
+#ifndef NEBU_Sound_SourceSample_H
+#define NEBU_Sound_SourceSample_H
+
+#include "nebu_Sound.h"
+
+#include "nebu_Source.h"
+#include "nebu_SoundSystem.h"
+
+namespace Sound {
+ class SourceSample : public Source {
+ public:
+ SourceSample(System *system);
+ virtual ~SourceSample();
+ void Load(char *filename);
+ virtual int Mix(Uint8 *data, int len);
+
+ Uint8* _buffer;
+ int _buffersize;
+
+ protected:
+ virtual void Reset() { _position = 0; }
+
+ private:
+ int _position;
+ int _decoded;
+ };
+}
+#endif
+
+
+
+
+
diff --git a/nebu/include/audio/nebu_audio_system.h b/nebu/include/audio/nebu_audio_system.h
new file mode 100644
index 0000000..33a527c
--- /dev/null
+++ b/nebu/include/audio/nebu_audio_system.h
@@ -0,0 +1,4 @@
+#ifndef NEBU_AUDIO_SYSTEM_H
+#define NEBU_AUDIO_SYSTEM_H
+
+#endif
diff --git a/nebu/include/base/Makefile.am b/nebu/include/base/Makefile.am
new file mode 100644
index 0000000..70f3abd
--- /dev/null
+++ b/nebu/include/base/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = nebu_Vector3.h nebu_callbacks.h nebu_geom.h nebu_matrix.h nebu_random.h nebu_system.h nebu_types.h nebu_util.h nebu_vector.h
diff --git a/nebu/include/base/Makefile.in b/nebu/include/base/Makefile.in
new file mode 100644
index 0000000..49a36e2
--- /dev/null
+++ b/nebu/include/base/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = nebu_Vector3.h nebu_callbacks.h nebu_geom.h nebu_matrix.h nebu_random.h nebu_system.h nebu_types.h nebu_util.h nebu_vector.h
+subdir = nebu/include/base
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/include/base/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/include/base/nebu_Vector3.h b/nebu/include/base/nebu_Vector3.h
new file mode 100644
index 0000000..cdfe54b
--- /dev/null
+++ b/nebu/include/base/nebu_Vector3.h
@@ -0,0 +1,85 @@
+#ifndef NEBU_Vector3_H
+#define NEBU_Vector3_H
+
+#ifdef DEBUG
+#include "iostream.h"
+#endif
+
+#include "math.h"
+
+class Vector3 {
+ public:
+ Vector3() { };
+ Vector3(float a, float b, float c) {
+ x = a; y = b; z = c;
+ };
+ Vector3(const float *v) {
+ x = v[0]; y = v[1]; z = v[2];
+ };
+ float x, y, z;
+
+ const Vector3 operator+ (const Vector3& v) const {
+ return Vector3(x + v.x, y + v.y, z + v.z);
+ };
+
+ const Vector3 operator- (const Vector3& v) const {
+ return Vector3(x - v.x, y - v.y, z - v.z);
+ };
+
+ float operator* (const Vector3& v) const {
+ return x * v.x + y * v.y + z * v.z;
+ };
+
+ const Vector3 operator* (float f) const {
+ return Vector3(x * f, y * f, z * f);
+ }
+
+ void operator*= (float f) {
+ x *= f; y *= f; z *= f;
+ }
+
+ void operator/= (float f) {
+ x /= f; y /= f; z /= f;
+ }
+
+ float Length() const {
+ return (float) sqrt(*this * *this);
+ }
+
+ float Length2() {
+ return *this * *this;
+ }
+
+ Vector3& Normalize() {
+ float length = Length();
+ if(length != 0)
+ *this /= length;
+ return *this;
+ }
+
+ Vector3 Cross(const Vector3& v) const {
+ return Vector3(y * v.z - z * v.y,
+ z * v.x - x * v.z,
+ x * v.y - y * v.z);
+ }
+
+ #ifdef DEBUG
+ friend ostream&
+ operator<<(ostream& os, const Vector3& v);
+
+ friend Vector3
+ operator*(float f, const Vector3& v);
+ #endif
+};
+
+inline Vector3 operator*(float f, const Vector3& v) {
+ return v * f;
+}
+
+#ifdef DEBUG
+inline ostream& operator<<(ostream& os, const Vector3& v) {
+ os << "(" << v.x << ", " << v.y << ", " << v.z << ")";
+ return os;
+}
+#endif
+#endif
diff --git a/nebu/include/base/nebu_callbacks.h b/nebu/include/base/nebu_callbacks.h
new file mode 100644
index 0000000..88c60ae
--- /dev/null
+++ b/nebu/include/base/nebu_callbacks.h
@@ -0,0 +1,16 @@
+#ifndef NEBU_CALLBACKS_H
+#define NEBU_CALLBACKS_H
+
+typedef struct Callbacks {
+ void (*display)(void);
+ void (*idle)(void);
+ void (*keyboard)(int, int, int, int);
+ void (*init)(void);
+ void (*exit)(void);
+ void (*initGL)(void);
+ void (*mouse)(int, int, int, int);
+ void (*mouseMotion)(int, int);
+ char *name;
+} Callbacks;
+
+#endif
diff --git a/nebu/include/base/nebu_geom.h b/nebu/include/base/nebu_geom.h
new file mode 100644
index 0000000..7dc7ed1
--- /dev/null
+++ b/nebu/include/base/nebu_geom.h
@@ -0,0 +1,49 @@
+#ifndef NEBU_GEOM_H
+#define NEBU_GEOM_H
+
+/* some geometric routines always needed */
+
+/*
+typedef struct {
+ float v[4];
+} vec4;
+
+typedef struct {
+ float v[3];
+} vec3;
+*/
+
+typedef struct {
+ int vertex[3];
+ int normal[3];
+ int material;
+} face;
+
+typedef struct {
+ int vertex[4];
+ int normal[4];
+ int material;
+} quadFace;
+
+float length2(float *v);
+float length3(float *v);
+float length4(float *v);
+float length(float *v);
+void normalize(float *v);
+void normalize4(float *v);
+void crossprod(float *v1, float *v2, float *out);
+void normcrossprod(float *v1, float *v2, float *out);
+float scalarprod(float *v1, float *v2);
+float scalarprod2(float *v1, float *v2);
+float scalarprod4(float *v1, float *v2);
+void vsub(float *v1, float *v2, float *out);
+void vsub2(float *v1, float *v2, float *out);
+void vsub4(float *v1, float *v2, float *out);
+void vadd(float *v1, float *v2, float *out);
+void vadd2(float *v1, float *v2, float *out);
+void vadd4(float *v1, float *v2, float *out);
+void vcopy(float *v1, float *out);
+void vcopy4(float *v1, float *out);
+void vmul(float *v, float f);
+
+#endif
diff --git a/nebu/include/base/nebu_matrix.h b/nebu/include/base/nebu_matrix.h
new file mode 100644
index 0000000..3320874
--- /dev/null
+++ b/nebu/include/base/nebu_matrix.h
@@ -0,0 +1,27 @@
+#ifndef NEBU_MATRIX_H
+#define NEBU_MATRIX_H
+
+#include "nebu_vector.h"
+
+typedef struct {
+ float m[16]; // column order
+} matrix;
+
+vec4* vec4Transform(vec4* pOut, const vec4* pV, const matrix *pM);
+float matrixCofactor(const matrix *pM, int cf_row, int cf_col);
+float matrixDeterminant(const matrix *pM);
+matrix* matrixIdentity(matrix *pOut);
+matrix* matrixInverse(matrix *pOut, float* pDet, const matrix *pM);
+matrix* matrixMultiply(matrix *pOut, const matrix *pM1, const matrix *pM2);
+matrix* matrixTranspose(matrix *pOut, const matrix *pM);
+matrix* matrixAdjoint(matrix *pOut, float* pDet, const matrix *pM);
+
+vec4* vec4Transform(vec4 *pOut, const vec4 *pV, const matrix *pM);
+
+matrix* matrixRotationAxis(matrix *pOut, float fAngle, const vec3 *vAxis);
+matrix* matrixTranslation(matrix *pOut, const vec3 *vTranslation);
+matrix* matrixScale(matrix *pOut, const vec3 *vScale);
+
+void matrixPrint(matrix *m);
+
+#endif
diff --git a/nebu/include/base/nebu_random.h b/nebu/include/base/nebu_random.h
new file mode 100644
index 0000000..b654a7c
--- /dev/null
+++ b/nebu/include/base/nebu_random.h
@@ -0,0 +1,8 @@
+#ifndef NEBU_RANDOM_H
+#define NEBU_RANDOM_H
+
+void tsrand(unsigned int s);
+int trand(void);
+double tfrand(void);
+
+#endif
diff --git a/nebu/include/base/nebu_system.h b/nebu/include/base/nebu_system.h
new file mode 100644
index 0000000..8dcae39
--- /dev/null
+++ b/nebu/include/base/nebu_system.h
@@ -0,0 +1,20 @@
+#ifndef NEBU_SYSTEM_H
+#define NEBU_SYSTEM_H
+
+#include "nebu_callbacks.h"
+#include "SDL.h"
+
+/* system specific functions (basically, an SDL/glut wrapper) */
+extern unsigned int SystemGetElapsedTime();
+
+extern int SystemMainLoop();
+extern void SystemExitLoop(int return_code);
+extern void SystemRegisterCallbacks(Callbacks* callbacks);
+
+extern void SystemExit();
+
+extern void SystemHandleInput(SDL_Event *event);
+
+extern Callbacks* current;
+
+#endif
diff --git a/nebu/include/base/nebu_types.h b/nebu/include/base/nebu_types.h
new file mode 100644
index 0000000..825bde6
--- /dev/null
+++ b/nebu/include/base/nebu_types.h
@@ -0,0 +1,19 @@
+#ifndef NEBU_BASIC_TYPES_H
+#define NEBU_BASIC_TYPES_H
+
+typedef struct List List;
+struct List {
+ void *data;
+ List* next;
+};
+
+typedef struct {
+ unsigned int current;
+ unsigned int lastFrame;
+ unsigned int offset; /* from SystemGetElapsedTime() */
+ unsigned int dt; /* current - lastFrame */
+
+ /* float timeScale; */
+} SystemTime;
+
+#endif
diff --git a/nebu/include/base/nebu_util.h b/nebu/include/base/nebu_util.h
new file mode 100644
index 0000000..774e784
--- /dev/null
+++ b/nebu/include/base/nebu_util.h
@@ -0,0 +1,20 @@
+#ifndef NEBU_UTIL_H
+#define NEBU_UTIL_H
+
+/* small utility macros & functions */
+
+#include "base/nebu_types.h"
+#include <math.h>
+
+#define COS(X) cos( (X) * M_PI/180.0 )
+#define SIN(X) sin( (X) * M_PI/180.0 )
+
+#ifndef M_PI
+#define M_PI 3.141592654
+#endif
+
+void randomPermutation( int N, int *nodes );
+void clamp( float *f, float min, float max );
+void addList(List **l, void* data);
+
+#endif
diff --git a/nebu/include/base/nebu_vector.h b/nebu/include/base/nebu_vector.h
new file mode 100644
index 0000000..3c16c71
--- /dev/null
+++ b/nebu/include/base/nebu_vector.h
@@ -0,0 +1,53 @@
+#ifndef NEBU_VECTOR_H
+#define NEBU_VECTOR_H
+
+typedef struct { float v[2]; } vec2;
+typedef struct { float v[3]; } vec3;
+typedef struct { float v[4]; } vec4;
+
+typedef struct { vec2 vStart, vDirection; } segment2;
+
+vec4* vec4Add(vec4 *pOut, const vec4 *pV1, const vec4 *pV2);
+vec4* vec4Sub(vec4 *pOut, const vec4 *pV1, const vec4 *pV2);
+
+vec3* vec3Add(vec3 *pOut, const vec3 *pV1, const vec3 *pV2);
+vec3* vec3Sub(vec3 *pOut, const vec3 *pV1, const vec3 *pV2);
+vec3* vec3Cross(vec3 *pOut, const vec3 *pV1, const vec3 *pV2);
+
+float vec4Dot(const vec4 *pV1, const vec4 *pV2);
+
+float vec3Dot(const vec3 *pV1, const vec3 *pV2);
+
+float vec3Length(const vec3 *pV);
+float vec3LengthSqr(const vec3 *pV);
+vec3* vec3Normalize(vec3 *pOut, const vec3 *pV);
+
+vec3* vec3fromVec4(vec3 *pOut, const vec4 *pV);
+vec4* vec4fromVec3(vec4 *pOut, const vec3 *pV);
+
+vec3* vec3Copy(vec3 *pOut, const vec3 *pV);
+vec3* vec3Scale(vec3 *pOut, const vec3 *pV, float f);
+void vec4Print(const vec4 *pV);
+void vec3Print(const vec3 *pV);
+vec3* vec3Zero(vec3 *pV);
+vec3* vec3TriNormalDirection(vec3* pOut, const vec3* pV1, const vec3* pV2, const vec3 *pV3);
+
+vec2* vec2Copy(vec2 *pOut, const vec2 *pV);
+
+unsigned int uintFromVec3(vec3 *pV);
+// vec4* vec4Transform(vec4* pOut, const vec4* pV, const matrix16 *pM);
+
+vec2* segment2_Intersect(vec2 *pOut, float *t1, float *t2,
+ const segment2 *s1, const segment2 *s2);
+
+vec2* vec2_Orthogonal(vec2 *pOut, const vec2 *pV);
+
+vec2* vec2Add(vec2 *pOut, const vec2 *pV1, const vec2 *pV2);
+vec2* vec2Sub(vec2 *pOut, const vec2 *pV1, const vec2 *pV2);
+vec2* vec2Scale(vec2 *pOut, const vec2 *pV, float fScale);
+vec2* vec2Normalize(vec2 *pOut, const vec2 *pV);
+float vec2Dot(const vec2 *pV1, const vec2 *pV2);
+
+float vec2Length(const vec2 *pV);
+float segment2_Length(const segment2 *s);
+#endif
diff --git a/nebu/include/filesystem/Makefile.am b/nebu/include/filesystem/Makefile.am
new file mode 100644
index 0000000..a3407a7
--- /dev/null
+++ b/nebu/include/filesystem/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = nebu_file_io.h nebu_filesystem.h
diff --git a/nebu/include/filesystem/Makefile.in b/nebu/include/filesystem/Makefile.in
new file mode 100644
index 0000000..b961b13
--- /dev/null
+++ b/nebu/include/filesystem/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = nebu_file_io.h nebu_filesystem.h
+subdir = nebu/include/filesystem
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/include/filesystem/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/include/filesystem/nebu_file_io.h b/nebu/include/filesystem/nebu_file_io.h
new file mode 100644
index 0000000..bc12d36
--- /dev/null
+++ b/nebu/include/filesystem/nebu_file_io.h
@@ -0,0 +1,20 @@
+#ifndef NEBU_FILE_IO_H
+#define NEBU_FILE_IO_H
+/* this is a small wrapper around the basic file io functions,
+ ie open, close, read, gets */
+
+#ifdef FILE_IO_ZLIB
+#include <zlib.h>
+typedef gzFile file_handle;
+#else
+#include <stdio.h>
+typedef FILE* file_handle;
+#endif
+
+file_handle file_open(const char *path, const char *mode);
+int file_close(file_handle file);
+
+int file_read(file_handle file, void* data, unsigned int size);
+char* file_gets(file_handle file, char* data, unsigned int size);
+
+#endif
diff --git a/nebu/include/filesystem/nebu_filesystem.h b/nebu/include/filesystem/nebu_filesystem.h
new file mode 100644
index 0000000..14759f5
--- /dev/null
+++ b/nebu/include/filesystem/nebu_filesystem.h
@@ -0,0 +1,21 @@
+#ifndef NEBU_FILE_SYSTEM_H
+#define NEBU_FILESYSTEM_H
+
+#include "base/nebu_types.h"
+#include "filesystem/nebu_file_io.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+extern void initFilesystem(int argc, const char *argv[]);
+
+extern List* readDirectoryContents(const char *dirname, const char *prefix);
+
+/* findpath.c, GPL'd code */
+extern void goto_installpath(const char *executable);
+
+extern void dirSetup(const char *executable);
+extern int fileExists(const char *path);
+extern void makeDirectory(const char* name);
+
+#endif
diff --git a/nebu/include/input/Makefile.am b/nebu/include/input/Makefile.am
new file mode 100644
index 0000000..60f7ff2
--- /dev/null
+++ b/nebu/include/input/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = nebu_input_system.h nebu_system_keynames.h
diff --git a/nebu/include/input/Makefile.in b/nebu/include/input/Makefile.in
new file mode 100644
index 0000000..af51aff
--- /dev/null
+++ b/nebu/include/input/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = nebu_input_system.h nebu_system_keynames.h
+subdir = nebu/include/input
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/include/input/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/include/input/nebu_input_system.h b/nebu/include/input/nebu_input_system.h
new file mode 100644
index 0000000..a35d7ec
--- /dev/null
+++ b/nebu/include/input/nebu_input_system.h
@@ -0,0 +1,80 @@
+#ifndef NEBU_INPUT_SYSTEM_H
+#define NEBU_INPUT_SYSTEM_H
+
+#include <SDL.h>
+#include <SDL_types.h>
+
+#define SYSTEM_KEY_DOWN SDLK_DOWN
+#define SYSTEM_KEY_UP SDLK_UP
+#define SYSTEM_KEY_LEFT SDLK_LEFT
+#define SYSTEM_KEY_RIGHT SDLK_RIGHT
+#define SYSTEM_KEY_F1 SDLK_F1
+#define SYSTEM_KEY_F2 SDLK_F2
+#define SYSTEM_KEY_F3 SDLK_F3
+#define SYSTEM_KEY_F4 SDLK_F4
+#define SYSTEM_KEY_F5 SDLK_F5
+#define SYSTEM_KEY_F6 SDLK_F6
+#define SYSTEM_KEY_F7 SDLK_F7
+#define SYSTEM_KEY_F10 SDLK_F10
+#define SYSTEM_KEY_F11 SDLK_F11
+#define SYSTEM_KEY_F12 SDLK_F12
+
+#define SYSTEM_KEY_ENTER SDLK_ENTER
+#define SYSTEM_KEY_RETURN SDLK_RETURN
+
+#define SYSTEM_MOUSEUP SDL_MOUSEBUTTONUP
+#define SYSTEM_MOUSEDOWN SDL_MOUSEBUTTONDOWN
+
+#define SYSTEM_MOUSEPRESSED SDL_PRESSED
+#define SYSTEM_MOUSERELEASED SDL_RELEASED
+
+#define SYSTEM_MOUSEBUTTON_LEFT SDL_BUTTON_LEFT
+#define SYSTEM_MOUSEBUTTON_RIGHT SDL_BUTTON_RIGHT
+
+#define SYSTEM_KEY_TAB SDLK_TAB
+
+#define SYSTEM_JOY_AXIS_MAX 32767
+
+#define SYSTEM_KEYSTATE_DOWN 0
+#define SYSTEM_KEYSTATE_UP 1
+
+enum {
+ SYSTEM_JOY_OFFSET = 32,
+ SYSTEM_CUSTOM_KEYS = 512,
+ SYSTEM_JOY_LEFT = 512,
+ SYSTEM_JOY_RIGHT,
+ SYSTEM_JOY_UP,
+ SYSTEM_JOY_DOWN,
+ SYSTEM_JOY_BUTTON_0,
+ SYSTEM_JOY_BUTTON_1,
+ SYSTEM_JOY_BUTTON_2,
+ SYSTEM_JOY_BUTTON_3,
+ SYSTEM_JOY_BUTTON_4,
+ SYSTEM_JOY_BUTTON_5,
+ SYSTEM_JOY_BUTTON_6,
+ SYSTEM_JOY_BUTTON_7,
+ SYSTEM_JOY_BUTTON_8,
+ SYSTEM_JOY_BUTTON_9,
+ SYSTEM_JOY_BUTTON_10,
+ SYSTEM_JOY_BUTTON_11,
+ SYSTEM_JOY_BUTTON_12,
+ SYSTEM_JOY_BUTTON_13,
+ SYSTEM_JOY_BUTTON_14,
+ SYSTEM_JOY_BUTTON_15,
+ SYSTEM_JOY_BUTTON_16,
+ SYSTEM_JOY_BUTTON_17,
+ SYSTEM_JOY_BUTTON_18,
+ SYSTEM_JOY_BUTTON_19
+};
+
+void SystemGrabInput();
+void SystemUngrabInput();
+
+char* SystemGetKeyName(int key);
+
+void SystemMouse(int buttons, int state, int x, int y);
+void SystemMouseMotion(int x, int y);
+
+void SystemSetJoyThreshold(float f);
+
+#endif
diff --git a/nebu/include/input/nebu_system_keynames.h b/nebu/include/input/nebu_system_keynames.h
new file mode 100644
index 0000000..93b3d02
--- /dev/null
+++ b/nebu/include/input/nebu_system_keynames.h
@@ -0,0 +1,17 @@
+#ifndef NEBU_SYSTEM_KEYNAMES_H
+#define NEBU_SYSTEM_KEYNAMES_H
+
+#define CUSTOM_KEY_COUNT 2 * 24
+
+typedef struct {
+ int key;
+ char *name;
+} keyname;
+
+typedef struct {
+ keyname key[CUSTOM_KEY_COUNT];
+} custom_keynames;
+
+extern custom_keynames custom_keys;
+
+#endif
diff --git a/nebu/include/scripting/Makefile.am b/nebu/include/scripting/Makefile.am
new file mode 100644
index 0000000..e25b6a5
--- /dev/null
+++ b/nebu/include/scripting/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = nebu_scripting.h
diff --git a/nebu/include/scripting/Makefile.in b/nebu/include/scripting/Makefile.in
new file mode 100644
index 0000000..0a91207
--- /dev/null
+++ b/nebu/include/scripting/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = nebu_scripting.h
+subdir = nebu/include/scripting
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/include/scripting/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/include/scripting/nebu_scripting.h b/nebu/include/scripting/nebu_scripting.h
new file mode 100644
index 0000000..867eada
--- /dev/null
+++ b/nebu/include/scripting/nebu_scripting.h
@@ -0,0 +1,27 @@
+#ifndef NEBU_SCRIPTING_H
+#define NEBU_SCRIPTING_H
+
+#include "lua.h"
+
+extern void scripting_Init();
+extern void scripting_Quit();
+extern void Scripting_Idle();
+
+extern int scripting_GetGlobal(const char *global, const char *s, ...);
+extern int scripting_SetFloat(float f, const char *name, const char *global, const char *s, ...);
+
+extern int scripting_IsNilResult();
+extern int scripting_GetIntegerResult(int *i);
+extern int scripting_GetFloatResult(float *f);
+extern void scripting_GetFloatArrayResult(float *f, int n);
+extern int scripting_GetStringResult(char **s);
+extern int scripting_CopyStringResult(char *s, int len);
+
+
+extern void scripting_RunFile(const char *name);
+extern void scripting_Run(const char *command);
+extern void scripting_RunFormat(const char *format, ...);
+extern void scripting_RunGC();
+extern void scripting_Register(const char *name, int(*func) (lua_State *L));
+
+#endif
diff --git a/nebu/include/video/Makefile.am b/nebu/include/video/Makefile.am
new file mode 100644
index 0000000..1cd5012
--- /dev/null
+++ b/nebu/include/video/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = nebu_console.h nebu_extgl.h nebu_light.h nebu_png_texture.h nebu_quad.h nebu_renderer_gl.h nebu_video_system.h nebu_video_types.h
diff --git a/nebu/include/video/Makefile.in b/nebu/include/video/Makefile.in
new file mode 100644
index 0000000..8bcd768
--- /dev/null
+++ b/nebu/include/video/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = nebu_console.h nebu_extgl.h nebu_light.h nebu_png_texture.h nebu_quad.h nebu_renderer_gl.h nebu_video_system.h nebu_video_types.h
+subdir = nebu/include/video
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/include/video/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/include/video/nebu_console.h b/nebu/include/video/nebu_console.h
new file mode 100644
index 0000000..2cbdf30
--- /dev/null
+++ b/nebu/include/video/nebu_console.h
@@ -0,0 +1,17 @@
+#ifndef NEBU_CONSOLE_H
+#define NEBU_CONSOLE_H
+
+typedef enum {
+ TO_CONSOLE = 0x01,
+ TO_STDOUT = 0x02,
+ TO_STDERR = 0x04
+} outloc_e;
+
+void consoleInit();
+void consoleAddLine(char *text);
+void consoleDisplay(void(*func)(char *line, int call), int height);
+void consoleScrollForward(int range);
+void consoleScrollBackward(int range);
+void displayMessage(outloc_e where, const char *fmt_str, ...);
+
+#endif /* CONSOLE_H */
diff --git a/nebu/include/video/nebu_extgl.h b/nebu/include/video/nebu_extgl.h
new file mode 100644
index 0000000..ef235b1
--- /dev/null
+++ b/nebu/include/video/nebu_extgl.h
@@ -0,0 +1,3816 @@
+/* Small parts were taken from glext.h, here's the lisence: */
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: This software was created using the
+** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
+** not been independently verified as being compliant with the OpenGL(R)
+** version 1.2.1 Specification.
+*/
+
+/* Most parts copyright (c) 2001-2002 Lev Povalahev under this lisence: */
+
+/* ----------------------------------------------------------------------------
+Copyright (c) 2002, Lev Povalahev
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * The name of the author may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+------------------------------------------------------------------------------*/
+/*
+ GL_draw_range_elements support added by Benjamin Karaban
+
+ Lev Povalahev contact information:
+
+ levp@gmx.net
+
+ http://www.uni-karlsruhe.de/~uli2/
+*/
+/* These extensions are supported:
+GL_ARB_imaging
+GL_ARB_depth_texture
+GL_ARB_matrix_palette
+GL_ARB_multisample
+GL_ARB_multitexture
+GL_ARB_point_parameters
+GL_ARB_shadow
+GL_ARB_shadow_ambient
+GL_ARB_texture_compression
+GL_ARB_texture_env_add
+GL_ARB_texture_env_dot3
+GL_ARB_texture_env_combine
+GL_ARB_texture_env_crossbar
+GL_ARB_texture_border_clamp
+GL_ARB_texture_cube_map
+GL_ARB_texture_mirrored_repeat
+GL_ARB_transpose_matrix
+GL_ARB_vertex_blend
+GL_ARB_vertex_program
+GL_ARB_window_pos
+GL_EXT_abgr
+GL_EXT_bgra
+GL_EXT_blend_function_separate
+GL_EXT_compiled_vertex_array
+GL_EXT_cull_vertex
+GL_EXT_draw_range_elements
+GL_EXT_fog_coord
+GL_EXT_multi_draw_arrays
+GL_EXT_point_parameters
+GL_EXT_secondary_color
+GL_EXT_separate_specular_color
+GL_EXT_shadow_funcs
+GL_EXT_stencil_two_side
+GL_EXT_stencil_wrap
+GL_EXT_texture_compression_s3tc
+GL_EXT_texture_filter_anisotropic
+GL_EXT_texture_lod_bias
+GL_EXT_vertex_shader
+GL_EXT_vertex_weighting
+GL_ATI_element_array
+GL_ATI_envmap_bumpmap
+GL_ATI_fragment_shader
+GL_ATI_pn_triangles
+GL_ATI_texture_mirror_once
+GL_ATI_vertex_array_object;
+GL_ATI_vertex_streams
+GL_ATIX_point_sprites
+GL_ATIX_texture_env_route
+GL_HP_occlusion_test
+GL_NV_blend_square
+GL_NV_copy_depth_to_color
+GL_NV_depth_clamp
+GL_NV_element_array
+GL_NV_evaluators
+GL_NV_fence
+GL_NV_float_buffer
+GL_NV_fog_distance
+GL_NV_light_max_exponent
+GL_NV_occlusion_query
+GL_NV_packed_depth_stencil
+GL_NV_point_sprite
+GL_NV_primitive_restart
+GL_NV_register_combiners
+GL_NV_register_combiners2
+GL_NV_texgen_reflection
+GL_NV_texture_env_combine4
+GL_NV_texture_rectangle
+GL_NV_texture_shader
+GL_NV_texture_shader2
+GL_NV_texture_shader3
+GL_NV_vertex_array_range
+GL_NV_vertex_array_range2
+GL_NV_vertex_program
+GL_NV_vertex_program1_1
+GL_NV_vertex_program2
+GL_SGIS_generate_mipmap
+GL_SGIX_shadow
+GL_SGIX_depth_texture
+WGL_ARB_buffer_region
+WGL_ARB_extensions_string
+WGL_ARB_make_current_read;
+WGL_ARB_multisample
+WGL_ARB_pbuffer
+WGL_ARB_pixel_format
+WGL_ARB_render_texture
+WGL_EXT_extensions_string
+WGL_EXT_swap_control
+WGL_NV_render_depth_texture
+WGL_NV_render_texture_rectangle
+*/
+#ifndef __EXTGL_H__
+#define __EXTGL_H__
+
+/*-----------------------------------------*/
+/*-----------------------------------------*/
+
+#if defined(_WIN32) && !defined(APIENTRY)
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#endif
+
+#define __glext_h_
+#include <GL/gl.h>
+
+#if defined(_WIN32)
+
+#elif defined(__APPLE__)
+# include <OpenGL/glext.h>
+#else
+# include <GL/glx.h>
+#endif /* _WIN32 */
+
+#include <string.h>
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* OpenGL 1.2 */
+
+#ifndef GL_VERSION_1_2
+#define GL_ARB_imaging 1
+#define GL_VERSION_1_2 1
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_BGR 0x80E0
+#define GL_BGRA 0x80E1
+#define GL_UNSIGNED_BYTE_3_3_2 0x8032
+#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
+#define GL_UNSIGNED_INT_8_8_8_8 0x8035
+#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
+#define GL_UNSIGNED_INT_10_10_10_2 0x8036
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
+#define GL_SINGLE_COLOR 0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_PACK_SKIP_IMAGES 0x806B
+#define GL_PACK_IMAGE_HEIGHT 0x806C
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_PROXY_TEXTURE_3D 0x8070
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_COLOR_TABLE 0x80D0
+#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
+#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
+#define GL_PROXY_COLOR_TABLE 0x80D3
+#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
+#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
+#define GL_COLOR_TABLE_SCALE 0x80D6
+#define GL_COLOR_TABLE_BIAS 0x80D7
+#define GL_COLOR_TABLE_FORMAT 0x80D8
+#define GL_COLOR_TABLE_WIDTH 0x80D9
+#define GL_COLOR_TABLE_RED_SIZE 0x80DA
+#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
+#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
+#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
+#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
+#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
+#define GL_CONVOLUTION_1D 0x8010
+#define GL_CONVOLUTION_2D 0x8011
+#define GL_SEPARABLE_2D 0x8012
+#define GL_CONVOLUTION_BORDER_MODE 0x8013
+#define GL_CONVOLUTION_FILTER_SCALE 0x8014
+#define GL_CONVOLUTION_FILTER_BIAS 0x8015
+#define GL_REDUCE 0x8016
+#define GL_CONVOLUTION_FORMAT 0x8017
+#define GL_CONVOLUTION_WIDTH 0x8018
+#define GL_CONVOLUTION_HEIGHT 0x8019
+#define GL_MAX_CONVOLUTION_WIDTH 0x801A
+#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
+#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
+#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
+#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
+#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
+#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
+#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
+#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
+#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
+#define GL_CONSTANT_BORDER 0x8151
+#define GL_REPLICATE_BORDER 0x8153
+#define GL_CONVOLUTION_BORDER_COLOR 0x8154
+#define GL_COLOR_MATRIX 0x80B1
+#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
+#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
+#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
+#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
+#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
+#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
+#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
+#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
+#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
+#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
+#define GL_HISTOGRAM 0x8024
+#define GL_PROXY_HISTOGRAM 0x8025
+#define GL_HISTOGRAM_WIDTH 0x8026
+#define GL_HISTOGRAM_FORMAT 0x8027
+#define GL_HISTOGRAM_RED_SIZE 0x8028
+#define GL_HISTOGRAM_GREEN_SIZE 0x8029
+#define GL_HISTOGRAM_BLUE_SIZE 0x802A
+#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
+#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
+#define GL_HISTOGRAM_SINK 0x802D
+#define GL_MINMAX 0x802E
+#define GL_MINMAX_FORMAT 0x802F
+#define GL_MINMAX_SINK 0x8030
+#define GL_TABLE_TOO_LARGE 0x8031
+#define GL_BLEND_EQUATION 0x8009
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_FUNC_ADD 0x8006
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_BLEND_COLOR 0x8005
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+
+typedef void (APIENTRY * glColorTablePROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table );
+typedef void (APIENTRY * glColorSubTablePROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data );
+typedef void (APIENTRY * glColorTableParameterivPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRY * glColorTableParameterfvPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * glCopyColorSubTablePROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width );
+typedef void (APIENTRY * glCopyColorTablePROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width );
+typedef void (APIENTRY * glGetColorTablePROC) (GLenum target, GLenum format, GLenum type, GLvoid *table );
+typedef void (APIENTRY * glGetColorTableParameterfvPROC) (GLenum target, GLenum pname, GLfloat *params );
+typedef void (APIENTRY * glGetColorTableParameterivPROC) (GLenum target, GLenum pname, GLint *params );
+typedef void (APIENTRY * glBlendEquationPROC) (GLenum mode );
+typedef void (APIENTRY * glBlendColorPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
+typedef void (APIENTRY * glHistogramPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink );
+typedef void (APIENTRY * glResetHistogramPROC) (GLenum target );
+typedef void (APIENTRY * glGetHistogramPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values );
+typedef void (APIENTRY * glGetHistogramParameterfvPROC) (GLenum target, GLenum pname, GLfloat *params );
+typedef void (APIENTRY * glGetHistogramParameterivPROC) (GLenum target, GLenum pname, GLint *params );
+typedef void (APIENTRY * glMinmaxPROC) (GLenum target, GLenum internalformat, GLboolean sink );
+typedef void (APIENTRY * glResetMinmaxPROC) (GLenum target );
+typedef void (APIENTRY * glGetMinmaxPROC) (GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values );
+typedef void (APIENTRY * glGetMinmaxParameterfvPROC) (GLenum target, GLenum pname, GLfloat *params );
+typedef void (APIENTRY * glGetMinmaxParameterivPROC) (GLenum target, GLenum pname, GLint *params );
+typedef void (APIENTRY * glConvolutionFilter1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image );
+typedef void (APIENTRY * glConvolutionFilter2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image );
+typedef void (APIENTRY * glConvolutionParameterfPROC) (GLenum target, GLenum pname, GLfloat params );
+typedef void (APIENTRY * glConvolutionParameterfvPROC) (GLenum target, GLenum pname, const GLfloat *params );
+typedef void (APIENTRY * glConvolutionParameteriPROC) (GLenum target, GLenum pname, GLint params );
+typedef void (APIENTRY * glConvolutionParameterivPROC) (GLenum target, GLenum pname, const GLint *params );
+typedef void (APIENTRY * glCopyConvolutionFilter1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width );
+typedef void (APIENTRY * glCopyConvolutionFilter2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRY * glGetConvolutionFilterPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image );
+typedef void (APIENTRY * glGetConvolutionParameterfvPROC) (GLenum target, GLenum pname, GLfloat *params );
+typedef void (APIENTRY * glGetConvolutionParameterivPROC) (GLenum target, GLenum pname, GLint *params );
+typedef void (APIENTRY * glSeparableFilter2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column );
+typedef void (APIENTRY * glGetSeparableFilterPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
+typedef void (APIENTRY * glDrawRangeElementsPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
+typedef void (APIENTRY * glTexImage3DPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
+typedef void (APIENTRY * glTexSubImage3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRY * glCopyTexSubImage3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
+
+extern glBlendColorPROC glBlendColor;
+extern glBlendEquationPROC glBlendEquation;
+extern glColorTablePROC glColorTable;
+extern glColorTableParameterfvPROC glColorTableParameterfv;
+extern glColorTableParameterivPROC glColorTableParameteriv;
+extern glCopyColorTablePROC glCopyColorTable;
+extern glGetColorTablePROC glGetColorTable;
+extern glGetColorTableParameterfvPROC glGetColorTableParameterfv;
+extern glGetColorTableParameterivPROC glGetColorTableParameteriv;
+extern glColorSubTablePROC glColorSubTable;
+extern glCopyColorSubTablePROC glCopyColorSubTable;
+extern glConvolutionFilter1DPROC glConvolutionFilter1D;
+extern glConvolutionFilter2DPROC glConvolutionFilter2D;
+extern glConvolutionParameterfPROC glConvolutionParameterf;
+extern glConvolutionParameterfvPROC glConvolutionParameterfv;
+extern glConvolutionParameteriPROC glConvolutionParameteri;
+extern glConvolutionParameterivPROC glConvolutionParameteriv;
+extern glCopyConvolutionFilter1DPROC glCopyConvolutionFilter1D;
+extern glCopyConvolutionFilter2DPROC glCopyConvolutionFilter2D;
+extern glGetConvolutionFilterPROC glGetConvolutionFilter;
+extern glGetConvolutionParameterfvPROC glGetConvolutionParameterfv;
+extern glGetConvolutionParameterivPROC glGetConvolutionParameteriv;
+extern glGetSeparableFilterPROC glGetSeparableFilter;
+extern glSeparableFilter2DPROC glSeparableFilter2D;
+extern glGetHistogramPROC glGetHistogram;
+extern glGetHistogramParameterfvPROC glGetHistogramParameterfv;
+extern glGetHistogramParameterivPROC glGetHistogramParameteriv;
+extern glGetMinmaxPROC glGetMinmax;
+extern glGetMinmaxParameterfvPROC glGetMinmaxParameterfv;
+extern glGetMinmaxParameterivPROC glGetMinmaxParameteriv;
+extern glHistogramPROC glHistogram;
+extern glMinmaxPROC glMinmax;
+extern glResetHistogramPROC glResetHistogram;
+extern glResetMinmaxPROC glResetMinmax;
+extern glDrawRangeElementsPROC glDrawRangeElements;
+extern glTexImage3DPROC glTexImage3D;
+extern glTexSubImage3DPROC glTexSubImage3D;
+extern glCopyTexSubImage3DPROC glCopyTexSubImage3D;
+
+#endif /* GL_VERSION_1_2 */
+
+/* OpenGL 1.3 */
+
+#ifndef GL_VERSION_1_3
+#define GL_VERSION_1_3 1
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+
+#define GL_NORMAL_MAP 0x8511
+#define GL_REFLECTION_MAP 0x8512
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+
+#define GL_COMPRESSED_ALPHA 0x84E9
+#define GL_COMPRESSED_LUMINANCE 0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
+#define GL_COMPRESSED_INTENSITY 0x84EC
+#define GL_COMPRESSED_RGB 0x84ED
+#define GL_COMPRESSED_RGBA 0x84EE
+#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
+#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+#define GL_MULTISAMPLE 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_MULTISAMPLE_BIT 0x20000000
+
+#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
+
+#define GL_COMBINE 0x8570
+#define GL_COMBINE_RGB 0x8571
+#define GL_COMBINE_ALPHA 0x8572
+#define GL_SOURCE0_RGB 0x8580
+#define GL_SOURCE1_RGB 0x8581
+#define GL_SOURCE2_RGB 0x8582
+#define GL_SOURCE0_ALPHA 0x8588
+#define GL_SOURCE1_ALPHA 0x8589
+#define GL_SOURCE2_ALPHA 0x858A
+#define GL_OPERAND0_RGB 0x8590
+#define GL_OPERAND1_RGB 0x8591
+#define GL_OPERAND2_RGB 0x8592
+#define GL_OPERAND0_ALPHA 0x8598
+#define GL_OPERAND1_ALPHA 0x8599
+#define GL_OPERAND2_ALPHA 0x859A
+#define GL_RGB_SCALE 0x8573
+#define GL_ADD_SIGNED 0x8574
+#define GL_INTERPOLATE 0x8575
+#define GL_SUBTRACT 0x84E7
+#define GL_CONSTANT 0x8576
+#define GL_PRIMARY_COLOR 0x8577
+#define GL_PREVIOUS 0x8578
+#define GL_DOT3_RGB 0x86AE
+#define GL_DOT3_RGBA 0x86AF
+#define GL_CLAMP_TO_BORDER 0x812D
+
+typedef void (APIENTRY * glActiveTexturePROC) (GLenum texture );
+typedef void (APIENTRY * glClientActiveTexturePROC) (GLenum texture );
+typedef void (APIENTRY * glCompressedTexImage1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexImage2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexImage3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexSubImage1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexSubImage2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexSubImage3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glGetCompressedTexImagePROC) (GLenum target, GLint lod, GLvoid *img );
+typedef void (APIENTRY * glMultiTexCoord1dPROC) (GLenum target, GLdouble s );
+typedef void (APIENTRY * glMultiTexCoord1dvPROC) (GLenum target, const GLdouble *v );
+typedef void (APIENTRY * glMultiTexCoord1fPROC) (GLenum target, GLfloat s );
+typedef void (APIENTRY * glMultiTexCoord1fvPROC) (GLenum target, const GLfloat *v );
+typedef void (APIENTRY * glMultiTexCoord1iPROC) (GLenum target, GLint s );
+typedef void (APIENTRY * glMultiTexCoord1ivPROC) (GLenum target, const GLint *v );
+typedef void (APIENTRY * glMultiTexCoord1sPROC) (GLenum target, GLshort s );
+typedef void (APIENTRY * glMultiTexCoord1svPROC) (GLenum target, const GLshort *v );
+typedef void (APIENTRY * glMultiTexCoord2dPROC) (GLenum target, GLdouble s, GLdouble t );
+typedef void (APIENTRY * glMultiTexCoord2dvPROC) (GLenum target, const GLdouble *v );
+typedef void (APIENTRY * glMultiTexCoord2fPROC) (GLenum target, GLfloat s, GLfloat t );
+typedef void (APIENTRY * glMultiTexCoord2fvPROC) (GLenum target, const GLfloat *v );
+typedef void (APIENTRY * glMultiTexCoord2iPROC) (GLenum target, GLint s, GLint t );
+typedef void (APIENTRY * glMultiTexCoord2ivPROC) (GLenum target, const GLint *v );
+typedef void (APIENTRY * glMultiTexCoord2sPROC) (GLenum target, GLshort s, GLshort t );
+typedef void (APIENTRY * glMultiTexCoord2svPROC) (GLenum target, const GLshort *v );
+typedef void (APIENTRY * glMultiTexCoord3dPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r );
+typedef void (APIENTRY * glMultiTexCoord3dvPROC) (GLenum target, const GLdouble *v );
+typedef void (APIENTRY * glMultiTexCoord3fPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r );
+typedef void (APIENTRY * glMultiTexCoord3fvPROC) (GLenum target, const GLfloat *v );
+typedef void (APIENTRY * glMultiTexCoord3iPROC) (GLenum target, GLint s, GLint t, GLint r );
+typedef void (APIENTRY * glMultiTexCoord3ivPROC) (GLenum target, const GLint *v );
+typedef void (APIENTRY * glMultiTexCoord3sPROC) (GLenum target, GLshort s, GLshort t, GLshort r );
+typedef void (APIENTRY * glMultiTexCoord3svPROC) (GLenum target, const GLshort *v );
+typedef void (APIENTRY * glMultiTexCoord4dPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
+typedef void (APIENTRY * glMultiTexCoord4dvPROC) (GLenum target, const GLdouble *v );
+typedef void (APIENTRY * glMultiTexCoord4fPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
+typedef void (APIENTRY * glMultiTexCoord4fvPROC) (GLenum target, const GLfloat *v );
+typedef void (APIENTRY * glMultiTexCoord4iPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q );
+typedef void (APIENTRY * glMultiTexCoord4ivPROC) (GLenum target, const GLint *v );
+typedef void (APIENTRY * glMultiTexCoord4sPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q );
+typedef void (APIENTRY * glMultiTexCoord4svPROC) (GLenum target, const GLshort *v );
+typedef void (APIENTRY * glLoadTransposeMatrixdPROC) (const GLdouble m[16] );
+typedef void (APIENTRY * glLoadTransposeMatrixfPROC) (const GLfloat m[16] );
+typedef void (APIENTRY * glMultTransposeMatrixdPROC) (const GLdouble m[16] );
+typedef void (APIENTRY * glMultTransposeMatrixfPROC) (const GLfloat m[16] );
+typedef void (APIENTRY * glSampleCoveragePROC) (GLclampf value, GLboolean invert );
+
+extern glActiveTexturePROC glActiveTexture;
+extern glClientActiveTexturePROC glClientActiveTexture;
+extern glMultiTexCoord1dPROC glMultiTexCoord1d;
+extern glMultiTexCoord1dvPROC glMultiTexCoord1dv;
+extern glMultiTexCoord1fPROC glMultiTexCoord1f;
+extern glMultiTexCoord1fvPROC glMultiTexCoord1fv;
+extern glMultiTexCoord1iPROC glMultiTexCoord1i;
+extern glMultiTexCoord1ivPROC glMultiTexCoord1iv;
+extern glMultiTexCoord1sPROC glMultiTexCoord1s;
+extern glMultiTexCoord1svPROC glMultiTexCoord1sv;
+extern glMultiTexCoord2dPROC glMultiTexCoord2d;
+extern glMultiTexCoord2dvPROC glMultiTexCoord2dv;
+extern glMultiTexCoord2fPROC glMultiTexCoord2f;
+extern glMultiTexCoord2fvPROC glMultiTexCoord2fv;
+extern glMultiTexCoord2iPROC glMultiTexCoord2i;
+extern glMultiTexCoord2ivPROC glMultiTexCoord2iv;
+extern glMultiTexCoord2sPROC glMultiTexCoord2s;
+extern glMultiTexCoord2svPROC glMultiTexCoord2sv;
+extern glMultiTexCoord3dPROC glMultiTexCoord3d;
+extern glMultiTexCoord3dvPROC glMultiTexCoord3dv;
+extern glMultiTexCoord3fPROC glMultiTexCoord3f;
+extern glMultiTexCoord3fvPROC glMultiTexCoord3fv;
+extern glMultiTexCoord3iPROC glMultiTexCoord3i;
+extern glMultiTexCoord3ivPROC glMultiTexCoord3iv;
+extern glMultiTexCoord3sPROC glMultiTexCoord3s;
+extern glMultiTexCoord3svPROC glMultiTexCoord3sv;
+extern glMultiTexCoord4dPROC glMultiTexCoord4d;
+extern glMultiTexCoord4dvPROC glMultiTexCoord4dv;
+extern glMultiTexCoord4fPROC glMultiTexCoord4f;
+extern glMultiTexCoord4fvPROC glMultiTexCoord4fv;
+extern glMultiTexCoord4iPROC glMultiTexCoord4i;
+extern glMultiTexCoord4ivPROC glMultiTexCoord4iv;
+extern glMultiTexCoord4sPROC glMultiTexCoord4s;
+extern glMultiTexCoord4svPROC glMultiTexCoord4sv;
+extern glLoadTransposeMatrixfPROC glLoadTransposeMatrixf;
+extern glLoadTransposeMatrixdPROC glLoadTransposeMatrixd;
+extern glMultTransposeMatrixfPROC glMultTransposeMatrixf;
+extern glMultTransposeMatrixdPROC glMultTransposeMatrixd;
+extern glCompressedTexImage3DPROC glCompressedTexImage3D;
+extern glCompressedTexImage2DPROC glCompressedTexImage2D;
+extern glCompressedTexImage1DPROC glCompressedTexImage1D;
+extern glCompressedTexSubImage3DPROC glCompressedTexSubImage3D;
+extern glCompressedTexSubImage2DPROC glCompressedTexSubImage2D;
+extern glCompressedTexSubImage1DPROC glCompressedTexSubImage1D;
+extern glGetCompressedTexImagePROC glGetCompressedTexImage;
+extern glSampleCoveragePROC glSampleCoverage;
+
+#endif /* GL_VERSION_1_3 */
+
+/* OpenGL 1.4 */
+
+#ifndef GL_VERSION_1_4
+#define GL_VERSION_1_4
+
+#ifndef GL_VERSION_1_2
+#define GL_BLEND_EQUATION 0x8009
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_FUNC_ADD 0x8006
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_BLEND_COLOR 0x8005
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#endif /* GL_VERSION_1_2 */
+
+#define GL_GENERATE_MIPMAP 0x8191
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_DEPTH_COMPONENT32 0x81A7
+#define GL_TEXTURE_DEPTH_SIZE 0x884A
+#define GL_DEPTH_TEXTURE_MODE 0x884B
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#define GL_COMPARE_R_TO_TEXTURE 0x884E
+#define GL_FOG_COORDINATE_SOURCE 0x8450
+#define GL_FOG_COORDINATE 0x8451
+#define GL_FRAGMENT_DEPTH 0x8452
+#define GL_CURRENT_FOG_COORDINATE 0x8453
+#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454
+#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455
+#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456
+#define GL_FOG_COORDINATE_ARRAY 0x8457
+#define GL_POINT_SIZE_MIN 0x8126
+#define GL_POINT_SIZE_MAX 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
+#define GL_POINT_DISTANCE_ATTENUATION 0x8129
+#define GL_COLOR_SUM 0x8458
+#define GL_CURRENT_SECONDARY_COLOR 0x8459
+#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A
+#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B
+#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
+#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
+#define GL_SECONDARY_COLOR_ARRAY 0x845E
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+#define GL_TEXTURE_FILTER_CONTROL 0x8500
+#define GL_TEXTURE_LOD_BIAS 0x8501
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_GL_MIRRORED_REPEAT 0x8370
+
+#ifndef GL_VERSION_1_2
+typedef void (APIENTRY * glBlendEquationPROC) (GLenum mode );
+typedef void (APIENTRY * glBlendColorPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
+#endif /* GL_VERSION_1_2 */
+typedef void (APIENTRY * glFogCoordfPROC) (GLfloat coord);
+typedef void (APIENTRY * glFogCoordfvPROC) (const GLfloat *coord);
+typedef void (APIENTRY * glFogCoorddPROC) (GLdouble coord);
+typedef void (APIENTRY * glFogCoorddvPROC) (const GLdouble *coord);
+typedef void (APIENTRY * glFogCoordPointerPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRY * glMultiDrawArraysPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (APIENTRY * glMultiDrawElementsPROC) (GLenum mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount);
+typedef void (APIENTRY * glPointParameterfPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * glPointParameterfvPROC) (GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glSecondaryColor3bPROC) (GLbyte red, GLbyte green, GLbyte blue);
+typedef void (APIENTRY * glSecondaryColor3bvPROC) (const GLbyte *v);
+typedef void (APIENTRY * glSecondaryColor3dPROC) (GLdouble red, GLdouble green, GLdouble blue);
+typedef void (APIENTRY * glSecondaryColor3dvPROC) (const GLdouble *v);
+typedef void (APIENTRY * glSecondaryColor3fPROC) (GLfloat red, GLfloat green, GLfloat blue);
+typedef void (APIENTRY * glSecondaryColor3fvPROC) (const GLfloat *v);
+typedef void (APIENTRY * glSecondaryColor3iPROC) (GLint red, GLint green, GLint blue);
+typedef void (APIENTRY * glSecondaryColor3ivPROC) (const GLint *v);
+typedef void (APIENTRY * glSecondaryColor3sPROC) (GLshort red, GLshort green, GLshort blue);
+typedef void (APIENTRY * glSecondaryColor3svPROC) (const GLshort *v);
+typedef void (APIENTRY * glSecondaryColor3ubPROC) (GLubyte red, GLubyte green, GLubyte blue);
+typedef void (APIENTRY * glSecondaryColor3ubvPROC) (const GLubyte *v);
+typedef void (APIENTRY * glSecondaryColor3uiPROC) (GLuint red, GLuint green, GLuint blue);
+typedef void (APIENTRY * glSecondaryColor3uivPROC) (const GLuint *v);
+typedef void (APIENTRY * glSecondaryColor3usPROC) (GLushort red, GLushort green, GLushort blue);
+typedef void (APIENTRY * glSecondaryColor3usvPROC) (const GLushort *v);
+typedef void (APIENTRY * glSecondaryColorPointerPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
+typedef void (APIENTRY * glBlendFuncSeparatePROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (APIENTRY * glWindowPos2dPROC) (GLdouble x, GLdouble y);
+typedef void (APIENTRY * glWindowPos2fPROC) (GLfloat x, GLfloat y);
+typedef void (APIENTRY * glWindowPos2iPROC) (GLint x, GLint y);
+typedef void (APIENTRY * glWindowPos2sPROC) (GLshort x, GLshort y);
+typedef void (APIENTRY * glWindowPos2dvPROC) (const GLdouble *p);
+typedef void (APIENTRY * glWindowPos2fvPROC) (const GLfloat *p);
+typedef void (APIENTRY * glWindowPos2ivPROC) (const GLint *p);
+typedef void (APIENTRY * glWindowPos2svPROC) (const GLshort *p);
+typedef void (APIENTRY * glWindowPos3dPROC) (GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRY * glWindowPos3fPROC) (GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * glWindowPos3iPROC) (GLint x, GLint y, GLint z);
+typedef void (APIENTRY * glWindowPos3sPROC) (GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRY * glWindowPos3dvPROC) (const GLdouble *p);
+typedef void (APIENTRY * glWindowPos3fvPROC) (const GLfloat *p);
+typedef void (APIENTRY * glWindowPos3ivPROC) (const GLint *p);
+typedef void (APIENTRY * glWindowPos3svPROC) (const GLshort *p);
+
+#ifndef GL_VERSION_1_2
+extern glBlendColorPROC glBlendColor;
+extern glBlendEquationPROC glBlendEquation;
+#endif /* GL_VERSION_1_2 */
+extern glFogCoordfPROC glFogCoordf;
+extern glFogCoordfvPROC glFogCoordfv;
+extern glFogCoorddPROC glFogCoordd;
+extern glFogCoorddvPROC glFogCoorddv;
+extern glFogCoordPointerPROC glFogCoordPointer;
+extern glMultiDrawArraysPROC glMultiDrawArrays;
+extern glMultiDrawElementsPROC glMultiDrawElements;
+extern glPointParameterfPROC glPointParameterf;
+extern glPointParameterfvPROC glPointParameterfv;
+extern glSecondaryColor3bPROC glSecondaryColor3b;
+extern glSecondaryColor3bvPROC glSecondaryColor3bv;
+extern glSecondaryColor3dPROC glSecondaryColor3d;
+extern glSecondaryColor3dvPROC glSecondaryColor3dv;
+extern glSecondaryColor3fPROC glSecondaryColor3f;
+extern glSecondaryColor3fvPROC glSecondaryColor3fv;
+extern glSecondaryColor3iPROC glSecondaryColor3i;
+extern glSecondaryColor3ivPROC glSecondaryColor3iv;
+extern glSecondaryColor3sPROC glSecondaryColor3s;
+extern glSecondaryColor3svPROC glSecondaryColor3sv;
+extern glSecondaryColor3ubPROC glSecondaryColor3ub;
+extern glSecondaryColor3ubvPROC glSecondaryColor3ubv;
+extern glSecondaryColor3uiPROC glSecondaryColor3ui;
+extern glSecondaryColor3uivPROC glSecondaryColor3uiv;
+extern glSecondaryColor3usPROC glSecondaryColor3us;
+extern glSecondaryColor3usvPROC glSecondaryColor3usv;
+extern glSecondaryColorPointerPROC glSecondaryColorPointer;
+extern glBlendFuncSeparatePROC glBlendFuncSeparate;
+extern glWindowPos2dPROC glWindowPos2d;
+extern glWindowPos2fPROC glWindowPos2f;
+extern glWindowPos2iPROC glWindowPos2i;
+extern glWindowPos2sPROC glWindowPos2s;
+extern glWindowPos2dvPROC glWindowPos2dv;
+extern glWindowPos2fvPROC glWindowPos2fv;
+extern glWindowPos2ivPROC glWindowPos2iv;
+extern glWindowPos2svPROC glWindowPos2sv;
+extern glWindowPos3dPROC glWindowPos3d;
+extern glWindowPos3fPROC glWindowPos3f;
+extern glWindowPos3iPROC glWindowPos3i;
+extern glWindowPos3sPROC glWindowPos3s;
+extern glWindowPos3dvPROC glWindowPos3dv;
+extern glWindowPos3fvPROC glWindowPos3fv;
+extern glWindowPos3ivPROC glWindowPos3iv;
+extern glWindowPos3svPROC glWindowPos3sv;
+
+#endif /* GL_VERSION_1_4 */
+
+/*-------------------------------------------------------------------*/
+/*------------EXTENSIONS---------------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_MULTITEXTURE---------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_multitexture
+#define GL_ARB_multitexture 1
+#define GL_TEXTURE0_ARB 0x84C0
+#define GL_TEXTURE1_ARB 0x84C1
+#define GL_TEXTURE2_ARB 0x84C2
+#define GL_TEXTURE3_ARB 0x84C3
+#define GL_TEXTURE4_ARB 0x84C4
+#define GL_TEXTURE5_ARB 0x84C5
+#define GL_TEXTURE6_ARB 0x84C6
+#define GL_TEXTURE7_ARB 0x84C7
+#define GL_TEXTURE8_ARB 0x84C8
+#define GL_TEXTURE9_ARB 0x84C9
+#define GL_TEXTURE10_ARB 0x84CA
+#define GL_TEXTURE11_ARB 0x84CB
+#define GL_TEXTURE12_ARB 0x84CC
+#define GL_TEXTURE13_ARB 0x84CD
+#define GL_TEXTURE14_ARB 0x84CE
+#define GL_TEXTURE15_ARB 0x84CF
+#define GL_TEXTURE16_ARB 0x84D0
+#define GL_TEXTURE17_ARB 0x84D1
+#define GL_TEXTURE18_ARB 0x84D2
+#define GL_TEXTURE19_ARB 0x84D3
+#define GL_TEXTURE20_ARB 0x84D4
+#define GL_TEXTURE21_ARB 0x84D5
+#define GL_TEXTURE22_ARB 0x84D6
+#define GL_TEXTURE23_ARB 0x84D7
+#define GL_TEXTURE24_ARB 0x84D8
+#define GL_TEXTURE25_ARB 0x84D9
+#define GL_TEXTURE26_ARB 0x84DA
+#define GL_TEXTURE27_ARB 0x84DB
+#define GL_TEXTURE28_ARB 0x84DC
+#define GL_TEXTURE29_ARB 0x84DD
+#define GL_TEXTURE30_ARB 0x84DE
+#define GL_TEXTURE31_ARB 0x84DF
+#define GL_ACTIVE_TEXTURE_ARB 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
+#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
+
+typedef void (APIENTRY * glActiveTextureARBPROC) (GLenum texture );
+typedef void (APIENTRY * glClientActiveTextureARBPROC) (GLenum texture );
+typedef void (APIENTRY * glMultiTexCoord1dARBPROC) (GLenum target, GLdouble s );
+typedef void (APIENTRY * glMultiTexCoord1dvARBPROC) (GLenum target, const GLdouble *v );
+typedef void (APIENTRY * glMultiTexCoord1fARBPROC) (GLenum target, GLfloat s );
+typedef void (APIENTRY * glMultiTexCoord1fvARBPROC) (GLenum target, const GLfloat *v );
+typedef void (APIENTRY * glMultiTexCoord1iARBPROC) (GLenum target, GLint s );
+typedef void (APIENTRY * glMultiTexCoord1ivARBPROC) (GLenum target, const GLint *v );
+typedef void (APIENTRY * glMultiTexCoord1sARBPROC) (GLenum target, GLshort s );
+typedef void (APIENTRY * glMultiTexCoord1svARBPROC) (GLenum target, const GLshort *v );
+typedef void (APIENTRY * glMultiTexCoord2dARBPROC) (GLenum target, GLdouble s, GLdouble t );
+typedef void (APIENTRY * glMultiTexCoord2dvARBPROC) (GLenum target, const GLdouble *v );
+typedef void (APIENTRY * glMultiTexCoord2fARBPROC) (GLenum target, GLfloat s, GLfloat t );
+typedef void (APIENTRY * glMultiTexCoord2fvARBPROC) (GLenum target, const GLfloat *v );
+typedef void (APIENTRY * glMultiTexCoord2iARBPROC) (GLenum target, GLint s, GLint t );
+typedef void (APIENTRY * glMultiTexCoord2ivARBPROC) (GLenum target, const GLint *v );
+typedef void (APIENTRY * glMultiTexCoord2sARBPROC) (GLenum target, GLshort s, GLshort t );
+typedef void (APIENTRY * glMultiTexCoord2svARBPROC) (GLenum target, const GLshort *v );
+typedef void (APIENTRY * glMultiTexCoord3dARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r );
+typedef void (APIENTRY * glMultiTexCoord3dvARBPROC) (GLenum target, const GLdouble *v );
+typedef void (APIENTRY * glMultiTexCoord3fARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r );
+typedef void (APIENTRY * glMultiTexCoord3fvARBPROC) (GLenum target, const GLfloat *v );
+typedef void (APIENTRY * glMultiTexCoord3iARBPROC) (GLenum target, GLint s, GLint t, GLint r );
+typedef void (APIENTRY * glMultiTexCoord3ivARBPROC) (GLenum target, const GLint *v );
+typedef void (APIENTRY * glMultiTexCoord3sARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r );
+typedef void (APIENTRY * glMultiTexCoord3svARBPROC) (GLenum target, const GLshort *v );
+typedef void (APIENTRY * glMultiTexCoord4dARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
+typedef void (APIENTRY * glMultiTexCoord4dvARBPROC) (GLenum target, const GLdouble *v );
+typedef void (APIENTRY * glMultiTexCoord4fARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
+typedef void (APIENTRY * glMultiTexCoord4fvARBPROC) (GLenum target, const GLfloat *v );
+typedef void (APIENTRY * glMultiTexCoord4iARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q );
+typedef void (APIENTRY * glMultiTexCoord4ivARBPROC) (GLenum target, const GLint *v );
+typedef void (APIENTRY * glMultiTexCoord4sARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q );
+typedef void (APIENTRY * glMultiTexCoord4svARBPROC) (GLenum target, const GLshort *v );
+
+extern glActiveTextureARBPROC glActiveTextureARB;
+extern glClientActiveTextureARBPROC glClientActiveTextureARB;
+extern glMultiTexCoord1dARBPROC glMultiTexCoord1dARB;
+extern glMultiTexCoord1dvARBPROC glMultiTexCoord1dvARB;
+extern glMultiTexCoord1fARBPROC glMultiTexCoord1fARB;
+extern glMultiTexCoord1fvARBPROC glMultiTexCoord1fvARB;
+extern glMultiTexCoord1iARBPROC glMultiTexCoord1iARB;
+extern glMultiTexCoord1ivARBPROC glMultiTexCoord1ivARB;
+extern glMultiTexCoord1sARBPROC glMultiTexCoord1sARB;
+extern glMultiTexCoord1svARBPROC glMultiTexCoord1svARB;
+extern glMultiTexCoord2dARBPROC glMultiTexCoord2dARB;
+extern glMultiTexCoord2dvARBPROC glMultiTexCoord2dvARB;
+extern glMultiTexCoord2fARBPROC glMultiTexCoord2fARB;
+extern glMultiTexCoord2fvARBPROC glMultiTexCoord2fvARB;
+extern glMultiTexCoord2iARBPROC glMultiTexCoord2iARB;
+extern glMultiTexCoord2ivARBPROC glMultiTexCoord2ivARB;
+extern glMultiTexCoord2sARBPROC glMultiTexCoord2sARB;
+extern glMultiTexCoord2svARBPROC glMultiTexCoord2svARB;
+extern glMultiTexCoord3dARBPROC glMultiTexCoord3dARB;
+extern glMultiTexCoord3dvARBPROC glMultiTexCoord3dvARB;
+extern glMultiTexCoord3fARBPROC glMultiTexCoord3fARB;
+extern glMultiTexCoord3fvARBPROC glMultiTexCoord3fvARB;
+extern glMultiTexCoord3iARBPROC glMultiTexCoord3iARB;
+extern glMultiTexCoord3ivARBPROC glMultiTexCoord3ivARB;
+extern glMultiTexCoord3sARBPROC glMultiTexCoord3sARB;
+extern glMultiTexCoord3svARBPROC glMultiTexCoord3svARB;
+extern glMultiTexCoord4dARBPROC glMultiTexCoord4dARB;
+extern glMultiTexCoord4dvARBPROC glMultiTexCoord4dvARB;
+extern glMultiTexCoord4fARBPROC glMultiTexCoord4fARB;
+extern glMultiTexCoord4fvARBPROC glMultiTexCoord4fvARB;
+extern glMultiTexCoord4iARBPROC glMultiTexCoord4iARB;
+extern glMultiTexCoord4ivARBPROC glMultiTexCoord4ivARB;
+extern glMultiTexCoord4sARBPROC glMultiTexCoord4sARB;
+extern glMultiTexCoord4svARBPROC glMultiTexCoord4svARB;
+
+#endif /* GL_ARB_multitexture */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_TRANSPOSE_MATRIX-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_transpose_matrix
+#define GL_ARB_transpose_matrix 1
+
+#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6
+
+typedef void (APIENTRY * glLoadTransposeMatrixdARBPROC) (const GLdouble m[16] );
+typedef void (APIENTRY * glLoadTransposeMatrixfARBPROC) (const GLfloat m[16] );
+typedef void (APIENTRY * glMultTransposeMatrixdARBPROC) (const GLdouble m[16] );
+typedef void (APIENTRY * glMultTransposeMatrixfARBPROC) (const GLfloat m[16] );
+
+extern glLoadTransposeMatrixfARBPROC glLoadTransposeMatrixfARB;
+extern glLoadTransposeMatrixdARBPROC glLoadTransposeMatrixdARB;
+extern glMultTransposeMatrixfARBPROC glMultTransposeMatrixfARB;
+extern glMultTransposeMatrixdARBPROC glMultTransposeMatrixdARB;
+
+#endif /* GL_ARB_transpose_matrix */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_TEXTURE_COMPRESSION--------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_texture_compression
+#define GL_ARB_texture_compression 1
+
+#define GL_COMPRESSED_ALPHA_ARB 0x84E9
+#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
+#define GL_COMPRESSED_INTENSITY_ARB 0x84EC
+#define GL_COMPRESSED_RGB_ARB 0x84ED
+#define GL_COMPRESSED_RGBA_ARB 0x84EE
+#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF
+#define GL_TEXTURE_IMAGE_SIZE_ARB 0x86A0
+#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
+
+typedef void (APIENTRY * glCompressedTexImage1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexImage2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexImage3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexSubImage1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexSubImage2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glCompressedTexSubImage3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
+typedef void (APIENTRY * glGetCompressedTexImageARBPROC) (GLenum target, GLint lod, GLvoid *img );
+
+extern glCompressedTexImage3DARBPROC glCompressedTexImage3DARB;
+extern glCompressedTexImage2DARBPROC glCompressedTexImage2DARB;
+extern glCompressedTexImage1DARBPROC glCompressedTexImage1DARB;
+extern glCompressedTexSubImage3DARBPROC glCompressedTexSubImage3DARB;
+extern glCompressedTexSubImage2DARBPROC glCompressedTexSubImage2DARB;
+extern glCompressedTexSubImage1DARBPROC glCompressedTexSubImage1DARB;
+extern glGetCompressedTexImageARBPROC glGetCompressedTexImageARB;
+
+#endif /* GL_ARB_texture_compression */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_CUBE_MAP-------------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_texture_cube_map
+#define GL_ARB_texture_cube_map 1
+
+#define GL_NORMAL_MAP_ARB 0x8511
+#define GL_REFLECTION_MAP_ARB 0x8512
+#define GL_TEXTURE_CUBE_MAP_ARB 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
+
+#endif /* GL_ARB_texture_cube_map */
+
+/*-------------------------------------------------------------------*/
+/*------------SGIX_SHADOW--------------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_SGIX_shadow
+#define GL_SGIX_shadow 1
+
+#define GL_TEXTURE_COMPARE_SGIX 0x819A
+#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B
+#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C
+#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D
+
+#endif /* GL_SGIX_shadow */
+
+/*-------------------------------------------------------------------*/
+/*------------SGIX_DEPTH_TEXTURE-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_SGIX_depth_texture
+#define GL_SGIX_depth_texture 1
+
+#define GL_DEPTH_COMPONENT16_SGIX 0x81A5
+#define GL_DEPTH_COMPONENT24_SGIX 0x81A6
+#define GL_DEPTH_COMPONENT32_SGIX 0x81A7
+
+#endif /* GL_SGIX_depth_texture */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_COMPILED_VERTEX_ARRAY------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_compiled_vertex_array
+#define GL_EXT_compiled_vertex_array 1
+
+#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8
+#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9
+
+typedef void (APIENTRY * glLockArraysEXTPROC) (GLint first, GLsizei count);
+typedef void (APIENTRY * glUnlockArraysEXTPROC) ();
+
+extern glLockArraysEXTPROC glLockArraysEXT;
+extern glUnlockArraysEXTPROC glUnlockArraysEXT;
+
+#endif /* GL_EXT_compiled_vertex_array */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_TEXTURE_ENV_COMBINE--------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_texture_env_combine
+#define GL_ARB_texture_env_combine 1
+
+#define GL_COMBINE_ARB 0x8570
+#define GL_COMBINE_RGB_ARB 0x8571
+#define GL_COMBINE_ALPHA_ARB 0x8572
+#define GL_RGB_SCALE_ARB 0x8573
+#define GL_ADD_SIGNED_ARB 0x8574
+#define GL_INTERPOLATE_ARB 0x8575
+#define GL_CONSTANT_ARB 0x8576
+#define GL_PRIMARY_COLOR_ARB 0x8577
+#define GL_PREVIOUS_ARB 0x8578
+#define GL_SOURCE0_RGB_ARB 0x8580
+#define GL_SOURCE1_RGB_ARB 0x8581
+#define GL_SOURCE2_RGB_ARB 0x8582
+#define GL_SOURCE0_ALPHA_ARB 0x8588
+#define GL_SOURCE1_ALPHA_ARB 0x8589
+#define GL_SOURCE2_ALPHA_ARB 0x858A
+#define GL_OPERAND0_RGB_ARB 0x8590
+#define GL_OPERAND1_RGB_ARB 0x8591
+#define GL_OPERAND2_RGB_ARB 0x8592
+#define GL_OPERAND0_ALPHA_ARB 0x8598
+#define GL_OPERAND1_ALPHA_ARB 0x8599
+#define GL_OPERAND2_ALPHA_ARB 0x859A
+
+#endif /* GL_ARB_texture_env_combine */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_TEXTURE_ENV_DOT3-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_texture_env_dot3
+#define GL_ARB_texture_env_dot3 1
+
+#define GL_DOT3_RGB_ARB 0x86AE
+#define GL_DOT3_RGBA_ARB 0x86AF
+
+#endif /* GL_ARB_texture_env_dot3 */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_TEXTURE_BORDER_CLAMP-------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_texture_border_clamp
+#define GL_ARB_texture_border_clamp 1
+
+#define GL_CLAMP_TO_BORDER_ARB 0x812D
+
+#endif /* GL_ARB_texture_border_clamp */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_TEXTURE_ENV_ADD------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_texture_env_add
+#define GL_ARB_texture_env_add 1
+
+
+#endif /* GL_ARB_texture_env_add */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_SECONDARY_COLOR------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_secondary_color
+#define GL_EXT_secondary_color 1
+
+#define GL_COLOR_SUM_EXT 0x8458
+#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459
+#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A
+#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B
+#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C
+#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D
+#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E
+
+typedef void (APIENTRY * glSecondaryColor3bEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
+typedef void (APIENTRY * glSecondaryColor3bvEXTPROC) (const GLbyte *v);
+typedef void (APIENTRY * glSecondaryColor3dEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
+typedef void (APIENTRY * glSecondaryColor3dvEXTPROC) (const GLdouble *v);
+typedef void (APIENTRY * glSecondaryColor3fEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
+typedef void (APIENTRY * glSecondaryColor3fvEXTPROC) (const GLfloat *v);
+typedef void (APIENTRY * glSecondaryColor3iEXTPROC) (GLint red, GLint green, GLint blue);
+typedef void (APIENTRY * glSecondaryColor3ivEXTPROC) (const GLint *v);
+typedef void (APIENTRY * glSecondaryColor3sEXTPROC) (GLshort red, GLshort green, GLshort blue);
+typedef void (APIENTRY * glSecondaryColor3svEXTPROC) (const GLshort *v);
+typedef void (APIENTRY * glSecondaryColor3ubEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
+typedef void (APIENTRY * glSecondaryColor3ubvEXTPROC) (const GLubyte *v);
+typedef void (APIENTRY * glSecondaryColor3uiEXTPROC) (GLuint red, GLuint green, GLuint blue);
+typedef void (APIENTRY * glSecondaryColor3uivEXTPROC) (const GLuint *v);
+typedef void (APIENTRY * glSecondaryColor3usEXTPROC) (GLushort red, GLushort green, GLushort blue);
+typedef void (APIENTRY * glSecondaryColor3usvEXTPROC) (const GLushort *v);
+typedef void (APIENTRY * glSecondaryColorPointerEXTPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
+
+extern glSecondaryColor3bEXTPROC glSecondaryColor3bEXT;
+extern glSecondaryColor3bvEXTPROC glSecondaryColor3bvEXT;
+extern glSecondaryColor3dEXTPROC glSecondaryColor3dEXT;
+extern glSecondaryColor3dvEXTPROC glSecondaryColor3dvEXT;
+extern glSecondaryColor3fEXTPROC glSecondaryColor3fEXT;
+extern glSecondaryColor3fvEXTPROC glSecondaryColor3fvEXT;
+extern glSecondaryColor3iEXTPROC glSecondaryColor3iEXT;
+extern glSecondaryColor3ivEXTPROC glSecondaryColor3ivEXT;
+extern glSecondaryColor3sEXTPROC glSecondaryColor3sEXT;
+extern glSecondaryColor3svEXTPROC glSecondaryColor3svEXT;
+extern glSecondaryColor3ubEXTPROC glSecondaryColor3ubEXT;
+extern glSecondaryColor3ubvEXTPROC glSecondaryColor3ubvEXT;
+extern glSecondaryColor3uiEXTPROC glSecondaryColor3uiEXT;
+extern glSecondaryColor3uivEXTPROC glSecondaryColor3uivEXT;
+extern glSecondaryColor3usEXTPROC glSecondaryColor3usEXT;
+extern glSecondaryColor3usvEXTPROC glSecondaryColor3usvEXT;
+extern glSecondaryColorPointerEXTPROC glSecondaryColorPointerEXT;
+
+#endif /* GL_EXT_secondary_color */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_FOG_COORD------------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_fog_coord
+#define GL_EXT_fog_coord 1
+
+#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450
+#define GL_FOG_COORDINATE_EXT 0x8451
+#define GL_FRAGMENT_DEPTH_EXT 0x8452
+#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453
+#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454
+#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455
+#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456
+#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457
+
+typedef void (APIENTRY * glFogCoordfEXTPROC) (GLfloat coord);
+typedef void (APIENTRY * glFogCoordfvEXTPROC) (const GLfloat *coord);
+typedef void (APIENTRY * glFogCoorddEXTPROC) (GLdouble coord);
+typedef void (APIENTRY * glFogCoorddvEXTPROC) (const GLdouble *coord);
+typedef void (APIENTRY * glFogCoordPointerEXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+
+extern glFogCoordfEXTPROC glFogCoordfEXT;
+extern glFogCoordfvEXTPROC glFogCoordfvEXT;
+extern glFogCoorddEXTPROC glFogCoorddEXT;
+extern glFogCoorddvEXTPROC glFogCoorddvEXT;
+extern glFogCoordPointerEXTPROC glFogCoordPointerEXT;
+
+#endif /* GL_EXT_fog_coord */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_VERTEX_ARRAY_RANGE----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_vertex_array_range
+#define GL_NV_vertex_array_range 1
+
+#define GL_VERTEX_ARRAY_RANGE_NV 0x851D
+#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E
+#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F
+#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520
+#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521
+
+typedef void (APIENTRY * glFlushVertexArrayRangeNVPROC) (void);
+typedef void (APIENTRY * glVertexArrayRangeNVPROC) (GLsizei size, const GLvoid *pointer);
+
+extern glFlushVertexArrayRangeNVPROC glFlushVertexArrayRangeNV;
+extern glVertexArrayRangeNVPROC glVertexArrayRangeNV;
+
+#ifdef _WIN32
+
+typedef void * (APIENTRY * wglAllocateMemoryNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);
+typedef void (APIENTRY * wglFreeMemoryNVPROC) (void *pointer);
+
+extern wglAllocateMemoryNVPROC wglAllocateMemoryNV;
+extern wglFreeMemoryNVPROC wglFreeMemoryNV;
+
+#endif /* WIN32 */
+
+#endif /* GL_NV_vertex_array_range */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_VERTEX_ARRAY_RANGE2---------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_vertex_array_range2
+#define GL_NV_vertex_array_range2 1
+
+#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533
+
+#endif /* GL_NV_vertex_array_range2 */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_POINT_PARAMETERS-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_point_parameters
+#define GL_EXT_point_parameters 1
+
+#define GL_POINT_SIZE_MIN_EXT 0x8126
+#define GL_POINT_SIZE_MAX_EXT 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
+#define GL_DISTANCE_ATTENUATION_EXT 0x8129
+
+typedef void (APIENTRY * glPointParameterfEXTPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * glPointParameterfvEXTPROC) (GLenum pname, const GLfloat *params);
+
+extern glPointParameterfEXTPROC glPointParameterfEXT;
+extern glPointParameterfvEXTPROC glPointParameterfvEXT;
+
+#endif /* GL_EXT_point_parameters */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_REGISTER_COMBINERS----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_register_combiners
+#define GL_NV_register_combiners 1
+
+#define GL_REGISTER_COMBINERS_NV 0x8522
+#define GL_COMBINER0_NV 0x8550
+#define GL_COMBINER1_NV 0x8551
+#define GL_COMBINER2_NV 0x8552
+#define GL_COMBINER3_NV 0x8553
+#define GL_COMBINER4_NV 0x8554
+#define GL_COMBINER5_NV 0x8555
+#define GL_COMBINER6_NV 0x8556
+#define GL_COMBINER7_NV 0x8557
+#define GL_VARIABLE_A_NV 0x8523
+#define GL_VARIABLE_B_NV 0x8524
+#define GL_VARIABLE_C_NV 0x8525
+#define GL_VARIABLE_D_NV 0x8526
+#define GL_VARIABLE_E_NV 0x8527
+#define GL_VARIABLE_F_NV 0x8528
+#define GL_VARIABLE_G_NV 0x8529
+#define GL_CONSTANT_COLOR0_NV 0x852A
+#define GL_CONSTANT_COLOR1_NV 0x852B
+#define GL_PRIMARY_COLOR_NV 0x852C
+#define GL_SECONDARY_COLOR_NV 0x852D
+#define GL_SPARE0_NV 0x852E
+#define GL_SPARE1_NV 0x852F
+#define GL_UNSIGNED_IDENTITY_NV 0x8536
+#define GL_UNSIGNED_INVERT_NV 0x8537
+#define GL_EXPAND_NORMAL_NV 0x8538
+#define GL_EXPAND_NEGATE_NV 0x8539
+#define GL_HALF_BIAS_NORMAL_NV 0x853A
+#define GL_HALF_BIAS_NEGATE_NV 0x853B
+#define GL_SIGNED_IDENTITY_NV 0x853C
+#define GL_SIGNED_NEGATE_NV 0x853D
+#define GL_E_TIMES_F_NV 0x8531
+#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532
+#define GL_SCALE_BY_TWO_NV 0x853E
+#define GL_SCALE_BY_FOUR_NV 0x853F
+#define GL_SCALE_BY_ONE_HALF_NV 0x8540
+#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541
+#define GL_DISCARD_NV 0x8530
+#define GL_COMBINER_INPUT_NV 0x8542
+#define GL_COMBINER_MAPPING_NV 0x8543
+#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544
+#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545
+#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546
+#define GL_COMBINER_MUX_SUM_NV 0x8547
+#define GL_COMBINER_SCALE_NV 0x8548
+#define GL_COMBINER_BIAS_NV 0x8549
+#define GL_COMBINER_AB_OUTPUT_NV 0x854A
+#define GL_COMBINER_CD_OUTPUT_NV 0x854B
+#define GL_COMBINER_SUM_OUTPUT_NV 0x854C
+#define GL_NUM_GENERAL_COMBINERS_NV 0x854E
+#define GL_COLOR_SUM_CLAMP_NV 0x854F
+#define GL_MAX_GENERAL_COMBINERS_NV 0x854D
+
+typedef void (APIENTRY * glCombinerParameterfvNVPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * glCombinerParameterfNVPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * glCombinerParameterivNVPROC) (GLenum pname, const GLint *params);
+typedef void (APIENTRY * glCombinerParameteriNVPROC) (GLenum pname, GLint param);
+typedef void (APIENTRY * glCombinerInputNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+typedef void (APIENTRY * glCombinerOutputNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
+typedef void (APIENTRY * glFinalCombinerInputNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+typedef void (APIENTRY * glGetCombinerInputParameterfvNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetCombinerInputParameterivNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetCombinerOutputParameterfvNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetCombinerOutputParameterivNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetFinalCombinerInputParameterfvNVPROC) (GLenum variable, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetFinalCombinerInputParameterivNVPROC) (GLenum variable, GLenum pname, GLint *params);
+
+extern glCombinerParameterfvNVPROC glCombinerParameterfvNV;
+extern glCombinerParameterfNVPROC glCombinerParameterfNV;
+extern glCombinerParameterivNVPROC glCombinerParameterivNV;
+extern glCombinerParameteriNVPROC glCombinerParameteriNV;
+extern glCombinerInputNVPROC glCombinerInputNV;
+extern glCombinerOutputNVPROC glCombinerOutputNV;
+extern glFinalCombinerInputNVPROC glFinalCombinerInputNV;
+extern glGetCombinerInputParameterfvNVPROC glGetCombinerInputParameterfvNV;
+extern glGetCombinerInputParameterivNVPROC glGetCombinerInputParameterivNV;
+extern glGetCombinerOutputParameterfvNVPROC glGetCombinerOutputParameterfvNV;
+extern glGetCombinerOutputParameterivNVPROC glGetCombinerOutputParameterivNV;
+extern glGetFinalCombinerInputParameterfvNVPROC glGetFinalCombinerInputParameterfvNV;
+extern glGetFinalCombinerInputParameterivNVPROC glGetFinalCombinerInputParameterivNV;
+
+#endif /* GL_NV_register_combiners */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_MULTISAMPLE----------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_multisample
+#define GL_ARB_multisample 1
+
+#define GL_MULTISAMPLE_ARB 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F
+#define GL_SAMPLE_COVERAGE_ARB 0x80A0
+#define GL_SAMPLE_BUFFERS_ARB 0x80A8
+#define GL_SAMPLES_ARB 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB
+#define GL_MULTISAMPLE_BIT_ARB 0x20000000
+
+typedef void (APIENTRY * glSampleCoverageARBPROC) (GLclampf value, GLboolean invert );
+
+extern glSampleCoverageARBPROC glSampleCoverageARB;
+
+#endif /* GL_ARB_multisample */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_TEXTURE_SHADER--------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_texture_shader
+#define GL_NV_texture_shader 1
+
+#define GL_TEXTURE_SHADER_NV 0x86DE
+#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9
+#define GL_SHADER_OPERATION_NV 0x86DF
+#define GL_CULL_MODES_NV 0x86E0
+#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1
+#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2
+#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3
+#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4
+#define GL_CONST_EYE_NV 0x86E5
+#define GL_SHADER_CONSISTENT_NV 0x86DD
+#define GL_PASS_THROUGH_NV 0x86E6
+#define GL_CULL_FRAGMENT_NV 0x86E7
+#define GL_OFFSET_TEXTURE_2D_NV 0x86E8
+#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C
+#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D
+#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9
+#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA
+#define GL_DOT_PRODUCT_NV 0x86EC
+#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED
+#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE
+#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E
+#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0
+#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1
+#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2
+#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3
+#define GL_HILO_NV 0x86F4
+#define GL_DSDT_NV 0x86F5
+#define GL_DSDT_MAG_NV 0x86F6
+#define GL_DSDT_MAG_VIB_NV 0x86F7
+#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA
+#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB
+#define GL_SIGNED_RGBA_NV 0x86FB
+#define GL_SIGNED_RGBA8_NV 0x86FC
+#define GL_SIGNED_RGB_NV 0x86FE
+#define GL_SIGNED_RGB8_NV 0x86FF
+#define GL_SIGNED_LUMINANCE_NV 0x8701
+#define GL_SIGNED_LUMINANCE8_NV 0x8702
+#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703
+#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704
+#define GL_SIGNED_ALPHA_NV 0x8705
+#define GL_SIGNED_ALPHA8_NV 0x8706
+#define GL_SIGNED_INTENSITY_NV 0x8707
+#define GL_SIGNED_INTENSITY8_NV 0x8708
+#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C
+#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
+#define GL_HILO16_NV 0x86F8
+#define GL_SIGNED_HILO_NV 0x86F9
+#define GL_SIGNED_HILO16_NV 0x86FA
+#define GL_DSDT8_NV 0x8709
+#define GL_DSDT8_MAG8_NV 0x870A
+#define GL_DSDT_MAG_INTENSITY_NV 0x86DC
+#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B
+#define GL_HI_SCALE_NV 0x870E
+#define GL_LO_SCALE_NV 0x870F
+#define GL_DS_SCALE_NV 0x8710
+#define GL_DT_SCALE_NV 0x8711
+#define GL_MAGNITUDE_SCALE_NV 0x8712
+#define GL_VIBRANCE_SCALE_NV 0x8713
+#define GL_HI_BIAS_NV 0x8714
+#define GL_LO_BIAS_NV 0x8715
+#define GL_DS_BIAS_NV 0x8716
+#define GL_DT_BIAS_NV 0x8717
+#define GL_MAGNITUDE_BIAS_NV 0x8718
+#define GL_VIBRANCE_BIAS_NV 0x8719
+#define GL_TEXTURE_BORDER_VALUES_NV 0x871A
+#define GL_TEXTURE_HI_SIZE_NV 0x871B
+#define GL_TEXTURE_LO_SIZE_NV 0x871C
+#define GL_TEXTURE_DS_SIZE_NV 0x871D
+#define GL_TEXTURE_DT_SIZE_NV 0x871E
+#define GL_TEXTURE_MAG_SIZE_NV 0x871F
+
+#endif /* GL_NV_texture_shader */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_NV_TEXTURE_RECTANGLE--------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_texture_rectangle
+#define GL_NV_texture_rectangle 1
+
+#define GL_TEXTURE_RECTANGLE_NV 0x84F5
+#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6
+#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8
+
+#endif /* GL_NV_texture_recrangle */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_TEXTURE_ENV_COMBINE4--------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_texture_env_combine4
+#define GL_NV_texture_env_combine4 1
+
+#define GL_COMBINE4_NV 0x8503
+#define GL_SOURCE3_RGB_NV 0x8583
+#define GL_SOURCE3_ALPHA_NV 0x858B
+#define GL_OPERAND3_RGB_NV 0x8593
+#define GL_OPERAND3_ALPHA_NV 0x859B
+
+#endif /* GL_NV_texture_env_combine */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_FOG_DISTANCE----------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_fog_distance
+#define GL_NV_fog_distance 1
+
+#define GL_FOG_DISTANCE_MODE_NV 0x855A
+#define GL_EYE_RADIAL_NV 0x855B
+#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C
+
+#endif /* GL_NV_fog_distance */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_TEXTURE_FILTER_ANISOTROPIC-------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+
+#endif /* GL_EXT_texture_filter_anisotropic */
+
+/*-------------------------------------------------------------------*/
+/*------------SGIS_GENERATE_MIPMAP-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_SGIS_generate_mipmap
+#define GL_SGIS_generate_mipmap 1
+
+#define GL_GENERATE_MIPMAP_SGIS 0x8191
+#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
+
+#endif /* GL_SGIS_generate_mipmap */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_TEXGEN_REFLECTION-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_texgen_reflection
+#define GL_NV_texgen_reflection 1
+
+#define GL_NORMAL_MAP_NV 0x8511
+#define GL_REFLECTION_MAP_NV 0x8512
+
+#endif /* GL_NV_texgen_reflection */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_VERTEX_WEIGHTING-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_vertex_weighting
+#define GL_EXT_vertex_weighting 1
+
+#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3 /* alias to GL_MODELVIEW_STACK_DEPTH */
+#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502
+#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6 /* alias to GL_MODELVIEW_MATRIX */
+#define GL_MODELVIEW1_MATRIX_EXT 0x8506
+#define GL_VERTEX_WEIGHTING_EXT 0x8509
+#define GL_MODELVIEW0_EXT 0x1700 /* alias to GL_MODELVIEW */
+#define GL_MODELVIEW1_EXT 0x850A
+#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B
+#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C
+#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D
+#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E
+#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F
+#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510
+
+typedef void (APIENTRY * glVertexWeightfEXTPROC) (GLfloat weight);
+typedef void (APIENTRY * glVertexWeightfvEXTPROC) (const GLfloat *weight);
+typedef void (APIENTRY * glVertexWeightPointerEXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
+
+extern glVertexWeightfEXTPROC glVertexWeightfEXT;
+extern glVertexWeightfvEXTPROC glVertexWeightfvEXT;
+extern glVertexWeightPointerEXTPROC glVertexWeightPointerEXT;
+
+#endif /* GL_EXT_vertex_weighting */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_VERTEX_PROGRAM--------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_vertex_program
+#define GL_NV_vertex_program 1
+
+#define GL_VERTEX_PROGRAM_NV 0x8620
+#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642
+#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643
+#define GL_VERTEX_STATE_PROGRAM_NV 0x8621
+#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623
+#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624
+#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625
+#define GL_CURRENT_ATTRIB_NV 0x8626
+#define GL_PROGRAM_PARAMETER_NV 0x8644
+#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645
+#define GL_PROGRAM_TARGET_NV 0x8646
+#define GL_PROGRAM_LENGTH_NV 0x8627
+#define GL_PROGRAM_RESIDENT_NV 0x8647
+#define GL_PROGRAM_STRING_NV 0x8628
+#define GL_TRACK_MATRIX_NV 0x8648
+#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649
+#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E
+#define GL_MAX_TRACK_MATRICES_NV 0x862F
+#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640
+#define GL_CURRENT_MATRIX_NV 0x8641
+#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A
+#define GL_PROGRAM_ERROR_POSITION_NV 0x864B
+#define GL_MODELVIEW_PROJECTION_NV 0x8629
+#define GL_MATRIX0_NV 0x8630
+#define GL_MATRIX1_NV 0x8631
+#define GL_MATRIX2_NV 0x8632
+#define GL_MATRIX3_NV 0x8633
+#define GL_MATRIX4_NV 0x8634
+#define GL_MATRIX5_NV 0x8635
+#define GL_MATRIX6_NV 0x8636
+#define GL_MATRIX7_NV 0x8637
+#define GL_IDENTITY_NV 0x862A
+#define GL_INVERSE_NV 0x862B
+#define GL_TRANSPOSE_NV 0x862C
+#define GL_INVERSE_TRANSPOSE_NV 0x862D
+#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650
+#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651
+#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652
+#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653
+#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654
+#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655
+#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656
+#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657
+#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658
+#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659
+#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A
+#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B
+#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C
+#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D
+#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E
+#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F
+#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660
+#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661
+#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662
+#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663
+#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664
+#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665
+#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666
+#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667
+#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668
+#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669
+#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A
+#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B
+#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C
+#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D
+#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E
+#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F
+#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670
+#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671
+#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672
+#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673
+#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674
+#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675
+#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676
+#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677
+#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678
+#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679
+#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A
+#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B
+#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C
+#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D
+#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E
+#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F
+
+typedef void (APIENTRY * glBindProgramNVPROC) (GLenum target, GLuint id);
+typedef void (APIENTRY * glDeleteProgramsNVPROC) (GLsizei n, const GLuint *ids);
+typedef void (APIENTRY * glExecuteProgramNVPROC) (GLenum target, GLuint id, const GLfloat *params);
+typedef void (APIENTRY * glGenProgramsNVPROC) (GLsizei n, GLuint *ids);
+typedef GLboolean (APIENTRY * glAreProgramsResidentNVPROC) (GLsizei n, const GLuint *ids, GLboolean *residences);
+typedef void (APIENTRY * glRequestResidentProgramsNVPROC) (GLsizei n, GLuint *ids);
+typedef void (APIENTRY * glGetProgramParameterfvNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetProgramParameterdvNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRY * glGetProgramivNVPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetProgramStringNVPROC) (GLuint id, GLenum pname, GLubyte *program);
+typedef void (APIENTRY * glGetTrackMatrixivNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetVertexAttribdvNVPROC) (GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRY * glGetVertexAttribfvNVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetVertexAttribivNVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetVertexAttribPointervNVPROC) (GLuint index, GLenum pname, GLvoid **pointer);
+typedef GLboolean (APIENTRY * glIsProgramNVPROC) (GLuint id);
+typedef void (APIENTRY * glLoadProgramNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
+typedef void (APIENTRY * glProgramParameter4fNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * glProgramParameter4dNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * glProgramParameter4dvNVPROC) (GLenum target, GLuint index, const GLdouble *params);
+typedef void (APIENTRY * glProgramParameter4fvNVPROC) (GLenum target, GLuint index, const GLfloat *params);
+typedef void (APIENTRY * glProgramParameters4dvNVPROC) (GLenum target, GLuint index, GLuint num, const GLdouble *params);
+typedef void (APIENTRY * glProgramParameters4fvNVPROC) (GLenum target, GLuint index, GLuint num, const GLfloat *params);
+typedef void (APIENTRY * glTrackMatrixNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
+typedef void (APIENTRY * glVertexAttribPointerNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRY * glVertexAttrib1sNVPROC) (GLuint index, GLshort x);
+typedef void (APIENTRY * glVertexAttrib1fNVPROC) (GLuint index, GLfloat x);
+typedef void (APIENTRY * glVertexAttrib1dNVPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRY * glVertexAttrib2sNVPROC) (GLuint index, GLshort x, GLshort y);
+typedef void (APIENTRY * glVertexAttrib2fNVPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (APIENTRY * glVertexAttrib2dNVPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRY * glVertexAttrib3sNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRY * glVertexAttrib3fNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * glVertexAttrib3dNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRY * glVertexAttrib4sNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRY * glVertexAttrib4fNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * glVertexAttrib4dNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * glVertexAttrib4ubNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+typedef void (APIENTRY * glVertexAttrib1svNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * glVertexAttrib1fvNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttrib1dvNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttrib2svNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * glVertexAttrib2fvNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttrib2dvNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttrib3svNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * glVertexAttrib3fvNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttrib3dvNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttrib4svNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * glVertexAttrib4fvNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttrib4dvNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttrib4ubvNVPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRY * glVertexAttribs1svNVPROC) (GLuint index, GLsizei n, const GLshort *v);
+typedef void (APIENTRY * glVertexAttribs1fvNVPROC) (GLuint index, GLsizei n, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttribs1dvNVPROC) (GLuint index, GLsizei n, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttribs2svNVPROC) (GLuint index, GLsizei n, const GLshort *v);
+typedef void (APIENTRY * glVertexAttribs2fvNVPROC) (GLuint index, GLsizei n, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttribs2dvNVPROC) (GLuint index, GLsizei n, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttribs3svNVPROC) (GLuint index, GLsizei n, const GLshort *v);
+typedef void (APIENTRY * glVertexAttribs3fvNVPROC) (GLuint index, GLsizei n, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttribs3dvNVPROC) (GLuint index, GLsizei n, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttribs4svNVPROC) (GLuint index, GLsizei n, const GLshort *v);
+typedef void (APIENTRY * glVertexAttribs4fvNVPROC) (GLuint index, GLsizei n, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttribs4dvNVPROC) (GLuint index, GLsizei n, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttribs4ubvNVPROC) (GLuint index, GLsizei n, const GLubyte *v);
+
+extern glBindProgramNVPROC glBindProgramNV;
+extern glDeleteProgramsNVPROC glDeleteProgramsNV;
+extern glExecuteProgramNVPROC glExecuteProgramNV;
+extern glGenProgramsNVPROC glGenProgramsNV;
+extern glAreProgramsResidentNVPROC glAreProgramsResidentNV;
+extern glRequestResidentProgramsNVPROC glRequestResidentProgramsNV;
+extern glGetProgramParameterfvNVPROC glGetProgramParameterfvNV;
+extern glGetProgramParameterdvNVPROC glGetProgramParameterdvNV;
+extern glGetProgramivNVPROC glGetProgramivNV;
+extern glGetProgramStringNVPROC glGetProgramStringNV;
+extern glGetTrackMatrixivNVPROC glGetTrackMatrixivNV;
+extern glGetVertexAttribdvNVPROC glGetVertexAttribdvNV;
+extern glGetVertexAttribfvNVPROC glGetVertexAttribfvNV;
+extern glGetVertexAttribivNVPROC glGetVertexAttribivNV;
+extern glGetVertexAttribPointervNVPROC glGetVertexAttribPointervNV;
+extern glIsProgramNVPROC glIsProgramNV;
+extern glLoadProgramNVPROC glLoadProgramNV;
+extern glProgramParameter4fNVPROC glProgramParameter4fNV;
+extern glProgramParameter4dNVPROC glProgramParameter4dNV;
+extern glProgramParameter4dvNVPROC glProgramParameter4dvNV;
+extern glProgramParameter4fvNVPROC glProgramParameter4fvNV;
+extern glProgramParameters4dvNVPROC glProgramParameters4dvNV;
+extern glProgramParameters4fvNVPROC glProgramParameters4fvNV;
+extern glTrackMatrixNVPROC glTrackMatrixNV;
+extern glVertexAttribPointerNVPROC glVertexAttribPointerNV;
+extern glVertexAttrib1sNVPROC glVertexAttrib1sNV;
+extern glVertexAttrib1fNVPROC glVertexAttrib1fNV;
+extern glVertexAttrib1dNVPROC glVertexAttrib1dNV;
+extern glVertexAttrib2sNVPROC glVertexAttrib2sNV;
+extern glVertexAttrib2fNVPROC glVertexAttrib2fNV;
+extern glVertexAttrib2dNVPROC glVertexAttrib2dNV;
+extern glVertexAttrib3sNVPROC glVertexAttrib3sNV;
+extern glVertexAttrib3fNVPROC glVertexAttrib3fNV;
+extern glVertexAttrib3dNVPROC glVertexAttrib3dNV;
+extern glVertexAttrib4sNVPROC glVertexAttrib4sNV;
+extern glVertexAttrib4fNVPROC glVertexAttrib4fNV;
+extern glVertexAttrib4dNVPROC glVertexAttrib4dNV;
+extern glVertexAttrib4ubNVPROC glVertexAttrib4ubNV;
+extern glVertexAttrib1svNVPROC glVertexAttrib1svNV;
+extern glVertexAttrib1fvNVPROC glVertexAttrib1fvNV;
+extern glVertexAttrib1dvNVPROC glVertexAttrib1dvNV;
+extern glVertexAttrib2svNVPROC glVertexAttrib2svNV;
+extern glVertexAttrib2fvNVPROC glVertexAttrib2fvNV;
+extern glVertexAttrib2dvNVPROC glVertexAttrib2dvNV;
+extern glVertexAttrib3svNVPROC glVertexAttrib3svNV;
+extern glVertexAttrib3fvNVPROC glVertexAttrib3fvNV;
+extern glVertexAttrib3dvNVPROC glVertexAttrib3dvNV;
+extern glVertexAttrib4svNVPROC glVertexAttrib4svNV;
+extern glVertexAttrib4fvNVPROC glVertexAttrib4fvNV;
+extern glVertexAttrib4dvNVPROC glVertexAttrib4dvNV;
+extern glVertexAttrib4ubvNVPROC glVertexAttrib4ubvNV;
+extern glVertexAttribs1svNVPROC glVertexAttribs1svNV;
+extern glVertexAttribs1fvNVPROC glVertexAttribs1fvNV;
+extern glVertexAttribs1dvNVPROC glVertexAttribs1dvNV;
+extern glVertexAttribs2svNVPROC glVertexAttribs2svNV;
+extern glVertexAttribs2fvNVPROC glVertexAttribs2fvNV;
+extern glVertexAttribs2dvNVPROC glVertexAttribs2dvNV;
+extern glVertexAttribs3svNVPROC glVertexAttribs3svNV;
+extern glVertexAttribs3fvNVPROC glVertexAttribs3fvNV;
+extern glVertexAttribs3dvNVPROC glVertexAttribs3dvNV;
+extern glVertexAttribs4svNVPROC glVertexAttribs4svNV;
+extern glVertexAttribs4fvNVPROC glVertexAttribs4fvNV;
+extern glVertexAttribs4dvNVPROC glVertexAttribs4dvNV;
+extern glVertexAttribs4ubvNVPROC glVertexAttribs4ubvNV;
+
+#endif /* GL_NV_vertex_program */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_FENCE-----------------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+
+typedef void (APIENTRY * glGenFencesNVPROC) (GLsizei n, GLuint *fences);
+typedef void (APIENTRY * glDeleteFencesNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (APIENTRY * glSetFenceNVPROC) (GLuint fence, GLenum condition);
+typedef GLboolean (APIENTRY * glTestFenceNVPROC) (GLuint fence);
+typedef void (APIENTRY * glFinishFenceNVPROC) (GLuint fence);
+typedef GLboolean (APIENTRY * glIsFenceNVPROC) (GLuint fence);
+typedef void (APIENTRY * glGetFenceivNVPROC) (GLuint fence, GLenum pname, GLint *params);
+
+extern glGenFencesNVPROC glGenFencesNV;
+extern glDeleteFencesNVPROC glDeleteFencesNV;
+extern glSetFenceNVPROC glSetFenceNV;
+extern glTestFenceNVPROC glTestFenceNV;
+extern glFinishFenceNVPROC glFinishFenceNV;
+extern glIsFenceNVPROC glIsFenceNV;
+extern glGetFenceivNVPROC glGetFenceivNV;
+
+#endif /* GL_NV_fence */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_TEXTURE_SHADER2-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_texture_shader2
+#define GL_NV_texture_shader2
+
+#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF
+#define GL_HILO_NV 0x86F4
+#define GL_DSDT_NV 0x86F5
+#define GL_DSDT_MAG_NV 0x86F6
+#define GL_DSDT_MAG_VIB_NV 0x86F7
+#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA
+#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB
+#define GL_SIGNED_RGBA_NV 0x86FB
+#define GL_SIGNED_RGBA8_NV 0x86FC
+#define GL_SIGNED_RGB_NV 0x86FE
+#define GL_SIGNED_RGB8_NV 0x86FF
+#define GL_SIGNED_LUMINANCE_NV 0x8701
+#define GL_SIGNED_LUMINANCE8_NV 0x8702
+#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703
+#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704
+#define GL_SIGNED_ALPHA_NV 0x8705
+#define GL_SIGNED_ALPHA8_NV 0x8706
+#define GL_SIGNED_INTENSITY_NV 0x8707
+#define GL_SIGNED_INTENSITY8_NV 0x8708
+#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C
+#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
+#define GL_HILO16_NV 0x86F8
+#define GL_SIGNED_HILO_NV 0x86F9
+#define GL_SIGNED_HILO16_NV 0x86FA
+#define GL_DSDT8_NV 0x8709
+#define GL_DSDT8_MAG8_NV 0x870A
+#define GL_DSDT_MAG_INTENSITY_NV 0x86DC
+#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B
+
+#endif /* GL_NV_texture_shader2 */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_BLEND_SQUARE----------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_blend_square
+#define GL_NV_blend_square 1
+
+#endif /* GL_NV_blend_square */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_LIGHT_MAX_EXPONENT----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_light_max_exponent
+#define GL_NV_light_max_exponent 1
+
+#define GL_MAX_SHININESS_NV 0x8504
+#define GL_MAX_SPOT_EXPONENT_NV 0x8505
+
+#endif /* GL_NV_light_max_exponent */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_PACKED_DEPTH_STENCIL--------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_packed_depth_stencil
+#define GL_NV_packed_depth_stencil 1
+
+#define GL_DEPTH_STENCIL_NV 0x84F9
+#define GL_UNSIGNED_INT_24_8_NV 0x84FA
+
+#endif /* GL_NV_packed_depth_stencil */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_REGISTER_COMBINERS2---------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_register_combiners2
+#define GL_NV_register_combiners2
+
+#define GL_PER_STAGE_CONSTANTS_NV 0x8535
+
+typedef void (APIENTRY * glCombinerStageParameterfvNVPROC) (GLenum stage, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * glGetCombinerStageParameterfvNVPROC) (GLenum stage, GLenum pname, GLfloat *params);
+
+extern glCombinerStageParameterfvNVPROC glCombinerStageParameterfvNV;
+extern glGetCombinerStageParameterfvNVPROC glGetCombinerStageParameterfvNV;
+
+#endif /* GL_NV_register_combiners2 */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_ABGR-----------------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_abgr
+#define GL_EXT_abgr 1
+
+#define GL_ABGR_EXT 0x8000
+
+#endif /* GL_EXT_abgr */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_STENCIL_WRAP---------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_stencil_wrap
+#define GL_EXT_stencil_wrap 1
+
+#define GL_INCR_WRAP_EXT 0x8507
+#define GL_DECR_WRAP_EXT 0x8508
+
+#endif /* GL_EXT_stencil_wrap */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_TEXTURE_LOD_BIAS-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_texture_lod_bias
+#define GL_EXT_texture_lod_bias 1
+
+#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
+#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
+#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
+
+#endif /* GL_EXT_texture_lod_bias */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_EVALUATORS------------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_evaluators
+#define GL_NV_evaluators 1
+
+#define GL_EVAL_2D_NV 0x86C0
+#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1
+#define GL_MAP_TESSELLATION_NV 0x86C2
+#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3
+#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4
+#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5
+#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6
+#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7
+#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8
+#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9
+#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA
+#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB
+#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC
+#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD
+#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE
+#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF
+#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0
+#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1
+#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2
+#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3
+#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4
+#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5
+#define GL_MAX_MAP_TESSELLATION_NV 0x86D6
+#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7
+
+typedef void (APIENTRY * glMapControlPointsNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points);
+typedef void (APIENTRY * glMapParameterivNVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRY * glMapParameterfvNVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRY * glGetMapControlPointsNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points);
+typedef void (APIENTRY * glGetMapParameterivNVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetMapParameterfvNVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetMapAttribParameterivNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetMapAttribParameterfvNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glEvalMapsNVPROC) (GLenum target, GLenum mode);
+
+extern glMapControlPointsNVPROC glMapControlPointsNV;
+extern glMapParameterivNVPROC glMapParameterivNV;
+extern glMapParameterfvNVPROC glMapParameterfvNV;
+extern glGetMapControlPointsNVPROC glGetMapControlPointsNV;
+extern glGetMapParameterivNVPROC glGetMapParameterivNV;
+extern glGetMapParameterfvNVPROC glGetMapParameterfvNV;
+extern glGetMapAttribParameterivNVPROC glGetMapAttribParameterivNV;
+extern glGetMapAttribParameterfvNVPROC glGetMapAttribParameterfvNV;
+extern glEvalMapsNVPROC glEvalMapsNV;
+
+#endif /* GL_NV_evaluators */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_COPY_DEPTH_TO_COLOR---------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_copy_depth_to_color
+#define GL_NV_copy_depth_to_color 1
+
+#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E
+#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F
+
+#endif /* GL_NV_copy_depth_to_color */
+
+/*-------------------------------------------------------------------*/
+/*------------ATI_PN_TRIANGLES---------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATI_pn_triangles
+#define GL_ATI_pn_triangles 1
+
+#define GL_PN_TRIANGLES_ATI 0x87F0
+#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1
+#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2
+#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3
+#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4
+#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5
+#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6
+#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7
+#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8
+
+typedef void (APIENTRY * glPNTrianglesiATIPROC) (GLenum pname, GLint param);
+typedef void (APIENTRY * glPNTrianglesfATIPROC) (GLenum pname, GLfloat param);
+
+extern glPNTrianglesiATIPROC glPNTrianglesiATI;
+extern glPNTrianglesfATIPROC glPNTrianglesfATI;
+
+#endif /* GL_ATI_pn_triangles */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_POINT_PARAMETERS-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_point_parameters
+#define GL_ARB_point_parameters 1
+
+#define GL_POINT_SIZE_MIN_ARB 0x8126
+#define GL_POINT_SIZE_MAX_ARB 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128
+#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129
+
+typedef void (APIENTRY * glPointParameterfARBPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * glPointParameterfvARBPROC) (GLenum pname, GLfloat *params);
+
+extern glPointParameterfARBPROC glPointParameterfARB;
+extern glPointParameterfvARBPROC glPointParameterfvARB;
+
+#endif /* GL_ARB_point_parameters */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_TEXTURE_ENV_CROSSBAR-------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_texture_env_crossbar
+#define GL_ARB_texture_env_crossbar 1
+
+#endif
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_VERTEX_BLEND---------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_vertex_blend
+#define GL_ARB_vertex_blend 1
+
+#define GL_MAX_VERTEX_UNITS_ARB 0x86A4
+#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5
+#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6
+#define GL_VERTEX_BLEND_ARB 0x86A7
+#define GL_CURRENT_WEIGHT_ARB 0x86A8
+#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9
+#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA
+#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB
+#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC
+#define GL_WEIGHT_ARRAY_ARB 0x86AD
+#define GL_MODELVIEW0_ARB 0x1700
+#define GL_MODELVIEW1_ARB 0x850A
+#define GL_MODELVIEW2_ARB 0x8722
+#define GL_MODELVIEW3_ARB 0x8723
+#define GL_MODELVIEW4_ARB 0x8724
+#define GL_MODELVIEW5_ARB 0x8725
+#define GL_MODELVIEW6_ARB 0x8726
+#define GL_MODELVIEW7_ARB 0x8727
+#define GL_MODELVIEW8_ARB 0x8728
+#define GL_MODELVIEW9_ARB 0x8729
+#define GL_MODELVIEW10_ARB 0x872A
+#define GL_MODELVIEW11_ARB 0x872B
+#define GL_MODELVIEW12_ARB 0x872C
+#define GL_MODELVIEW13_ARB 0x872D
+#define GL_MODELVIEW14_ARB 0x872E
+#define GL_MODELVIEW15_ARB 0x872F
+#define GL_MODELVIEW16_ARB 0x8730
+#define GL_MODELVIEW17_ARB 0x8731
+#define GL_MODELVIEW18_ARB 0x8732
+#define GL_MODELVIEW19_ARB 0x8733
+#define GL_MODELVIEW20_ARB 0x8734
+#define GL_MODELVIEW21_ARB 0x8735
+#define GL_MODELVIEW22_ARB 0x8736
+#define GL_MODELVIEW23_ARB 0x8737
+#define GL_MODELVIEW24_ARB 0x8738
+#define GL_MODELVIEW25_ARB 0x8739
+#define GL_MODELVIEW26_ARB 0x873A
+#define GL_MODELVIEW27_ARB 0x873B
+#define GL_MODELVIEW28_ARB 0x873C
+#define GL_MODELVIEW29_ARB 0x873D
+#define GL_MODELVIEW30_ARB 0x873E
+#define GL_MODELVIEW31_ARB 0x873F
+
+typedef void (APIENTRY * glWeightbvARBPROC) (GLint size, GLbyte *weights);
+typedef void (APIENTRY * glWeightsvARBPROC) (GLint size, GLshort *weights);
+typedef void (APIENTRY * glWeightivARBPROC) (GLint size, GLint *weights);
+typedef void (APIENTRY * glWeightfvARBPROC) (GLint size, GLfloat *weights);
+typedef void (APIENTRY * glWeightdvARBPROC) (GLint size, GLdouble *weights);
+typedef void (APIENTRY * glWeightubvARBPROC) (GLint size, GLubyte *weights);
+typedef void (APIENTRY * glWeightusvARBPROC) (GLint size, GLushort *weights);
+typedef void (APIENTRY * glWeightuivARBPROC) (GLint size, GLuint *weights);
+typedef void (APIENTRY * glWeightPointerARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
+typedef void (APIENTRY * glVertexBlendARBPROC) (GLint count);
+
+extern glWeightbvARBPROC glWeightbvARB;
+extern glWeightsvARBPROC glWeightsvARB;
+extern glWeightivARBPROC glWeightivARB;
+extern glWeightfvARBPROC glWeightfvARB;
+extern glWeightdvARBPROC glWeightdvARB;
+extern glWeightubvARBPROC glWeightubvARB;
+extern glWeightusvARBPROC glWeightusvARB;
+extern glWeightuivARBPROC glWeightuivARB;
+extern glWeightPointerARBPROC glWeightPointerARB;
+extern glVertexBlendARBPROC glVertexBlendARB;
+
+#endif /* GL_ARB_vertex_blend */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_MULTI_DRAW_ARRAYS----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+
+typedef void (APIENTRY * glMultiDrawArraysEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (APIENTRY * glMultiDrawElementsEXTPROC) (GLenum mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount);
+
+extern glMultiDrawArraysEXTPROC glMultiDrawArraysEXT;
+extern glMultiDrawElementsEXTPROC glMultiDrawElementsEXT;
+
+#endif /* GL_EXT_multi_draw_arrays */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_MATRIX_PALETTE-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_matrix_palette
+#define GL_ARB_matrix_palette 1
+
+#define GL_MATRIX_PALETTE_ARB 0x8840
+#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841
+#define GL_MAX_PALETTE_MATRICES_ARB 0x8842
+#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843
+#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844
+#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845
+#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846
+#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847
+#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848
+#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849
+
+typedef void (APIENTRY * glCurrentPaletteMatrixARBPROC) (GLint index);
+typedef void (APIENTRY * glMatrixIndexubvARBPROC) (GLint size, GLubyte *indices);
+typedef void (APIENTRY * glMatrixIndexusvARBPROC) (GLint size, GLushort *indices);
+typedef void (APIENTRY * glMatrixIndexuivARBPROC) (GLint size, GLuint *indices);
+typedef void (APIENTRY * glMatrixIndexPointerARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
+
+extern glCurrentPaletteMatrixARBPROC glCurrentPaletteMatrixARB;
+extern glMatrixIndexubvARBPROC glMatrixIndexubvARB;
+extern glMatrixIndexusvARBPROC glMatrixIndexusvARB;
+extern glMatrixIndexuivARBPROC glMatrixIndexuivARB;
+extern glMatrixIndexPointerARBPROC glMatrixIndexPointerARB;
+
+#endif /* GL_ARB_matrix_palette */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_VERTEX_SHADER--------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_vertex_shader
+#define GL_EXT_vertex_shader 1
+
+#define GL_VERTEX_SHADER_EXT 0x8780
+#define GL_VERTEX_SHADER_BINDING_EXT 0x8781
+#define GL_OP_INDEX_EXT 0x8782
+#define GL_OP_NEGATE_EXT 0x8783
+#define GL_OP_DOT3_EXT 0x8784
+#define GL_OP_DOT4_EXT 0x8785
+#define GL_OP_MUL_EXT 0x8786
+#define GL_OP_ADD_EXT 0x8787
+#define GL_OP_MADD_EXT 0x8788
+#define GL_OP_FRAC_EXT 0x8789
+#define GL_OP_MAX_EXT 0x878A
+#define GL_OP_MIN_EXT 0x878B
+#define GL_OP_SET_GE_EXT 0x878C
+#define GL_OP_SET_LT_EXT 0x878D
+#define GL_OP_CLAMP_EXT 0x878E
+#define GL_OP_FLOOR_EXT 0x878F
+#define GL_OP_ROUND_EXT 0x8790
+#define GL_OP_EXP_BASE_2_EXT 0x8791
+#define GL_OP_LOG_BASE_2_EXT 0x8792
+#define GL_OP_POWER_EXT 0x8793
+#define GL_OP_RECIP_EXT 0x8794
+#define GL_OP_RECIP_SQRT_EXT 0x8795
+#define GL_OP_SUB_EXT 0x8796
+#define GL_OP_CROSS_PRODUCT_EXT 0x8797
+#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798
+#define GL_OP_MOV_EXT 0x8799
+#define GL_OUTPUT_VERTEX_EXT 0x879A
+#define GL_OUTPUT_COLOR0_EXT 0x879B
+#define GL_OUTPUT_COLOR1_EXT 0x879C
+#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D
+#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E
+#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F
+#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0
+#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1
+#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2
+#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3
+#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4
+#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5
+#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6
+#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7
+#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8
+#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9
+#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA
+#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB
+#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC
+#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD
+#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE
+#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF
+#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0
+#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1
+#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2
+#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3
+#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4
+#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5
+#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6
+#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7
+#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8
+#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9
+#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA
+#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB
+#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC
+#define GL_OUTPUT_FOG_EXT 0x87BD
+#define GL_SCALAR_EXT 0x87BE
+#define GL_VECTOR_EXT 0x87BF
+#define GL_MATRIX_EXT 0x87C0
+#define GL_VARIANT_EXT 0x87C1
+#define GL_INVARIANT_EXT 0x87C2
+#define GL_LOCAL_CONSTANT_EXT 0x87C3
+#define GL_LOCAL_EXT 0x87C4
+#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5
+#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6
+#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7
+#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8
+#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CC
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CD
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE
+#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF
+#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0
+#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1
+#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2
+#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3
+#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4
+#define GL_X_EXT 0x87D5
+#define GL_Y_EXT 0x87D6
+#define GL_Z_EXT 0x87D7
+#define GL_W_EXT 0x87D8
+#define GL_NEGATIVE_X_EXT 0x87D9
+#define GL_NEGATIVE_Y_EXT 0x87DA
+#define GL_NEGATIVE_Z_EXT 0x87DB
+#define GL_NEGATIVE_W_EXT 0x87DC
+#define GL_ZERO_EXT 0x87DD
+#define GL_ONE_EXT 0x87DE
+#define GL_NEGATIVE_ONE_EXT 0x87DF
+#define GL_NORMALIZED_RANGE_EXT 0x87E0
+#define GL_FULL_RANGE_EXT 0x87E1
+#define GL_CURRENT_VERTEX_EXT 0x87E2
+#define GL_MVP_MATRIX_EXT 0x87E3
+#define GL_VARIANT_VALUE_EXT 0x87E4
+#define GL_VARIANT_DATATYPE_EXT 0x87E5
+#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6
+#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7
+#define GL_VARIANT_ARRAY_EXT 0x87E8
+#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9
+#define GL_INVARIANT_VALUE_EXT 0x87EA
+#define GL_INVARIANT_DATATYPE_EXT 0x87EB
+#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC
+#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED
+
+typedef void (APIENTRY * glBeginVertexShaderEXTPROC) ();
+typedef void (APIENTRY * glEndVertexShaderEXTPROC) ();
+typedef void (APIENTRY * glBindVertexShaderEXTPROC) (GLuint id);
+typedef GLuint (APIENTRY * glGenVertexShadersEXTPROC) (GLuint range);
+typedef void (APIENTRY * glDeleteVertexShaderEXTPROC) (GLuint id);
+typedef void (APIENTRY * glShaderOp1EXTPROC) (GLenum op, GLuint res, GLuint arg1);
+typedef void (APIENTRY * glShaderOp2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
+typedef void (APIENTRY * glShaderOp3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
+typedef void (APIENTRY * glSwizzleEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
+typedef void (APIENTRY * glWriteMaskEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
+typedef void (APIENTRY * glInsertComponentEXTPROC) (GLuint res, GLuint src, GLuint num);
+typedef void (APIENTRY * glExtractComponentEXTPROC) (GLuint res, GLuint src, GLuint num);
+typedef GLuint (APIENTRY * glGenSymbolsEXTPROC) (GLenum dataType, GLenum storageType, GLenum range, GLuint components);
+typedef void (APIENTRY * glSetInvariantEXTPROC) (GLuint id, GLenum type, GLvoid *addr);
+typedef void (APIENTRY * glSetLocalConstantEXTPROC) (GLuint id, GLenum type, GLvoid *addr);
+typedef void (APIENTRY * glVariantbvEXTPROC) (GLuint id, GLbyte *addr);
+typedef void (APIENTRY * glVariantsvEXTPROC) (GLuint id, GLshort *addr);
+typedef void (APIENTRY * glVariantivEXTPROC) (GLuint id, GLint *addr);
+typedef void (APIENTRY * glVariantfvEXTPROC) (GLuint id, GLfloat *addr);
+typedef void (APIENTRY * glVariantdvEXTPROC) (GLuint id, GLdouble *addr);
+typedef void (APIENTRY * glVariantubvEXTPROC) (GLuint id, GLubyte *addr);
+typedef void (APIENTRY * glVariantusvEXTPROC) (GLuint id, GLushort *addr);
+typedef void (APIENTRY * glVariantuivEXTPROC) (GLuint id, GLuint *addr);
+typedef void (APIENTRY * glVariantPointerEXTPROC) (GLuint id, GLenum type, GLuint stride, GLvoid *addr);
+typedef void (APIENTRY * glEnableVariantClientStateEXTPROC) (GLuint id);
+typedef void (APIENTRY * glDisableVariantClientStateEXTPROC) (GLuint id);
+typedef GLuint (APIENTRY * glBindLightParameterEXTPROC) (GLenum light, GLenum value);
+typedef GLuint (APIENTRY * glBindMaterialParameterEXTPROC) (GLenum face, GLenum value);
+typedef GLuint (APIENTRY * glBindTexGenParameterEXTPROC) (GLenum unit, GLenum coord, GLenum value);
+typedef GLuint (APIENTRY * glBindTextureUnitParameterEXTPROC) (GLenum unit, GLenum value);
+typedef GLuint (APIENTRY * glBindParameterEXTPROC) (GLenum value);
+typedef GLboolean (APIENTRY * glIsVariantEnabledEXTPROC) (GLuint id, GLenum cap);
+typedef void (APIENTRY * glGetVariantBooleanvEXTPROC) (GLuint id, GLenum value, GLboolean *data);
+typedef void (APIENTRY * glGetVariantIntegervEXTPROC) (GLuint id, GLenum value, GLint *data);
+typedef void (APIENTRY * glGetVariantFloatvEXTPROC) (GLuint id, GLenum value, GLfloat *data);
+typedef void (APIENTRY * glGetVariantPointervEXTPROC) (GLuint id, GLenum value, GLvoid **data);
+typedef void (APIENTRY * glGetInvariantBooleanvEXTPROC) (GLuint id, GLenum value, GLboolean *data);
+typedef void (APIENTRY * glGetInvariantIntegervEXTPROC) (GLuint id, GLenum value, GLint *data);
+typedef void (APIENTRY * glGetInvariantFloatvEXTPROC) (GLuint id, GLenum value, GLfloat *data);
+typedef void (APIENTRY * glGetLocalConstantBooleanvEXTPROC) (GLuint id, GLenum value, GLboolean *data);
+typedef void (APIENTRY * glGetLocalConstantIntegervEXTPROC) (GLuint id, GLenum value, GLint *data);
+typedef void (APIENTRY * glGetLocalConstantFloatvEXTPROC) (GLuint id, GLenum value, GLfloat *data);
+
+extern glBeginVertexShaderEXTPROC glBeginVertexShaderEXT;
+extern glEndVertexShaderEXTPROC glEndVertexShaderEXT;
+extern glBindVertexShaderEXTPROC glBindVertexShaderEXT;
+extern glGenVertexShadersEXTPROC glGenVertexShadersEXT;
+extern glDeleteVertexShaderEXTPROC glDeleteVertexShaderEXT;
+extern glShaderOp1EXTPROC glShaderOp1EXT;
+extern glShaderOp2EXTPROC glShaderOp2EXT;
+extern glShaderOp3EXTPROC glShaderOp3EXT;
+extern glSwizzleEXTPROC glSwizzleEXT;
+extern glWriteMaskEXTPROC glWriteMaskEXT;
+extern glInsertComponentEXTPROC glInsertComponentEXT;
+extern glExtractComponentEXTPROC glExtractComponentEXT;
+extern glGenSymbolsEXTPROC glGenSymbolsEXT;
+extern glSetInvariantEXTPROC glSetInvariantEXT;
+extern glSetLocalConstantEXTPROC glSetLocalConstantEXT;
+extern glVariantbvEXTPROC glVariantbvEXT;
+extern glVariantsvEXTPROC glVariantsvEXT;
+extern glVariantivEXTPROC glVariantivEXT;
+extern glVariantfvEXTPROC glVariantfvEXT;
+extern glVariantdvEXTPROC glVariantdvEXT;
+extern glVariantubvEXTPROC glVariantubvEXT;
+extern glVariantusvEXTPROC glVariantusvEXT;
+extern glVariantuivEXTPROC glVariantuivEXT;
+extern glVariantPointerEXTPROC glVariantPointerEXT;
+extern glEnableVariantClientStateEXTPROC glEnableVariantClientStateEXT;
+extern glDisableVariantClientStateEXTPROC glDisableVariantClientStateEXT;
+extern glBindLightParameterEXTPROC glBindLightParameterEXT;
+extern glBindMaterialParameterEXTPROC glBindMaterialParameterEXT;
+extern glBindTexGenParameterEXTPROC glBindTexGenParameterEXT;
+extern glBindTextureUnitParameterEXTPROC glBindTextureUnitParameterEXT;
+extern glBindParameterEXTPROC glBindParameterEXT;
+extern glIsVariantEnabledEXTPROC glIsVariantEnabledEXT;
+extern glGetVariantBooleanvEXTPROC glGetVariantBooleanvEXT;
+extern glGetVariantIntegervEXTPROC glGetVariantIntegervEXT;
+extern glGetVariantFloatvEXTPROC glGetVariantFloatvEXT;
+extern glGetVariantPointervEXTPROC glGetVariantPointervEXT;
+extern glGetInvariantBooleanvEXTPROC glGetInvariantBooleanvEXT;
+extern glGetInvariantIntegervEXTPROC glGetInvariantIntegervEXT;
+extern glGetInvariantFloatvEXTPROC glGetInvariantFloatvEXT;
+extern glGetLocalConstantBooleanvEXTPROC glGetLocalConstantBooleanvEXT;
+extern glGetLocalConstantIntegervEXTPROC glGetLocalConstantIntegervEXT;
+extern glGetLocalConstantFloatvEXTPROC glGetLocalConstantFloatvEXT;
+
+#endif /* GL_EXT_vertex_shader */
+
+/*-------------------------------------------------------------------*/
+/*------------ATI_ENVMAP_BUMPMAP-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATI_envmap_bumpmap
+#define GL_ATI_envmap_bumpmap 1
+
+#define GL_BUMP_ROT_MATRIX_ATI 0x8775
+#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776
+#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777
+#define GL_BUMP_TEX_UNITS_ATI 0x8778
+#define GL_DUDV_ATI 0x8779
+#define GL_DU8DV8_ATI 0x877A
+#define GL_BUMP_ENVMAP_ATI 0x877B
+#define GL_BUMP_TARGET_ATI 0x877C
+
+typedef void (APIENTRY * glTexBumpParameterivATIPROC) (GLenum pname, GLint *param);
+typedef void (APIENTRY * glTexBumpParameterfvATIPROC) (GLenum pname, GLfloat *param);
+typedef void (APIENTRY * glGetTexBumpParameterivATIPROC) (GLenum pname, GLint *param);
+typedef void (APIENTRY * glGetTexBumpParameterfvATIPROC) (GLenum pname, GLfloat *param);
+
+extern glTexBumpParameterivATIPROC glTexBumpParameterivATI;
+extern glTexBumpParameterfvATIPROC glTexBumpParameterfvATI;
+extern glGetTexBumpParameterivATIPROC glGetTexBumpParameterivATI;
+extern glGetTexBumpParameterfvATIPROC glGetTexBumpParameterfvATI;
+
+#endif /* GL_ATI_envmap_bumpmap */
+
+/*-------------------------------------------------------------------*/
+/*------------ATI_FRAGMENT_SHADER------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATI_fragment_shader
+#define GL_ATI_fragment_shader 1
+
+#define GL_FRAGMENT_SHADER_ATI 0x8920
+#define GL_REG_0_ATI 0x8921
+#define GL_REG_1_ATI 0x8922
+#define GL_REG_2_ATI 0x8923
+#define GL_REG_3_ATI 0x8924
+#define GL_REG_4_ATI 0x8925
+#define GL_REG_5_ATI 0x8926
+#define GL_REG_6_ATI 0x8927
+#define GL_REG_7_ATI 0x8928
+#define GL_REG_8_ATI 0x8929
+#define GL_REG_9_ATI 0x892A
+#define GL_REG_10_ATI 0x892B
+#define GL_REG_11_ATI 0x892C
+#define GL_REG_12_ATI 0x892D
+#define GL_REG_13_ATI 0x892E
+#define GL_REG_14_ATI 0x892F
+#define GL_REG_15_ATI 0x8930
+#define GL_REG_16_ATI 0x8931
+#define GL_REG_17_ATI 0x8932
+#define GL_REG_18_ATI 0x8933
+#define GL_REG_19_ATI 0x8934
+#define GL_REG_20_ATI 0x8935
+#define GL_REG_21_ATI 0x8936
+#define GL_REG_22_ATI 0x8937
+#define GL_REG_23_ATI 0x8938
+#define GL_REG_24_ATI 0x8939
+#define GL_REG_25_ATI 0x893A
+#define GL_REG_26_ATI 0x893B
+#define GL_REG_27_ATI 0x893C
+#define GL_REG_28_ATI 0x893D
+#define GL_REG_29_ATI 0x893E
+#define GL_REG_30_ATI 0x893F
+#define GL_REG_31_ATI 0x8940
+#define GL_CON_0_ATI 0x8941
+#define GL_CON_1_ATI 0x8942
+#define GL_CON_2_ATI 0x8943
+#define GL_CON_3_ATI 0x8944
+#define GL_CON_4_ATI 0x8945
+#define GL_CON_5_ATI 0x8946
+#define GL_CON_6_ATI 0x8947
+#define GL_CON_7_ATI 0x8948
+#define GL_CON_8_ATI 0x8949
+#define GL_CON_9_ATI 0x894A
+#define GL_CON_10_ATI 0x894B
+#define GL_CON_11_ATI 0x894C
+#define GL_CON_12_ATI 0x894D
+#define GL_CON_13_ATI 0x894E
+#define GL_CON_14_ATI 0x894F
+#define GL_CON_15_ATI 0x8950
+#define GL_CON_16_ATI 0x8951
+#define GL_CON_17_ATI 0x8952
+#define GL_CON_18_ATI 0x8953
+#define GL_CON_19_ATI 0x8954
+#define GL_CON_20_ATI 0x8955
+#define GL_CON_21_ATI 0x8956
+#define GL_CON_22_ATI 0x8957
+#define GL_CON_23_ATI 0x8958
+#define GL_CON_24_ATI 0x8959
+#define GL_CON_25_ATI 0x895A
+#define GL_CON_26_ATI 0x895B
+#define GL_CON_27_ATI 0x895C
+#define GL_CON_28_ATI 0x895D
+#define GL_CON_29_ATI 0x895E
+#define GL_CON_30_ATI 0x895F
+#define GL_CON_31_ATI 0x8960
+#define GL_MOV_ATI 0x8961
+#define GL_ADD_ATI 0x8963
+#define GL_MUL_ATI 0x8964
+#define GL_SUB_ATI 0x8965
+#define GL_DOT3_ATI 0x8966
+#define GL_DOT4_ATI 0x8967
+#define GL_MAD_ATI 0x8968
+#define GL_LERP_ATI 0x8969
+#define GL_CND_ATI 0x896A
+#define GL_CND0_ATI 0x896B
+#define GL_DOT2_ADD_ATI 0x896C
+#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D
+#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
+#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F
+#define GL_NUM_PASSES_ATI 0x8970
+#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971
+#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972
+#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973
+#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974
+#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975
+#define GL_SWIZZLE_STR_ATI 0x8976
+#define GL_SWIZZLE_STQ_ATI 0x8977
+#define GL_SWIZZLE_STR_DR_ATI 0x8978
+#define GL_SWIZZLE_STQ_DQ_ATI 0x8979
+#define GL_SWIZZLE_STRQ_ATI 0x897A
+#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B
+#define GL_RED_BIT_ATI 0x00000001
+#define GL_GREEN_BIT_ATI 0x00000002
+#define GL_BLUE_BIT_ATI 0x00000004
+#define GL_2X_BIT_ATI 0x00000001
+#define GL_4X_BIT_ATI 0x00000002
+#define GL_8X_BIT_ATI 0x00000004
+#define GL_HALF_BIT_ATI 0x00000008
+#define GL_QUARTER_BIT_ATI 0x00000010
+#define GL_EIGHTH_BIT_ATI 0x00000020
+#define GL_SATURATE_BIT_ATI 0x00000040
+#define GL_COMP_BIT_ATI 0x00000002
+#define GL_NEGATE_BIT_ATI 0x00000004
+#define GL_BIAS_BIT_ATI 0x00000008
+
+typedef GLuint (APIENTRY * glGenFragmentShadersATIPROC) (GLuint range);
+typedef void (APIENTRY * glBindFragmentShaderATIPROC) (GLuint id);
+typedef void (APIENTRY * glDeleteFragmentShaderATIPROC) (GLuint id);
+typedef void (APIENTRY * glBeginFragmentShaderATIPROC) (GLvoid);
+typedef void (APIENTRY * glEndFragmentShaderATIPROC) (GLvoid);
+typedef void (APIENTRY * glPassTexCoordATIPROC) (GLuint dst, GLuint coord, GLenum swizzle);
+typedef void (APIENTRY * glSampleMapATIPROC) (GLuint dst, GLuint interp, GLenum swizzle);
+typedef void (APIENTRY * glColorFragmentOp1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
+typedef void (APIENTRY * glColorFragmentOp2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
+typedef void (APIENTRY * glColorFragmentOp3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
+typedef void (APIENTRY * glAlphaFragmentOp1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
+typedef void (APIENTRY * glAlphaFragmentOp2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
+typedef void (APIENTRY * glAlphaFragmentOp3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
+typedef void (APIENTRY * glSetFragmentShaderConstantATIPROC) (GLuint dst, const GLfloat *value);
+
+extern glGenFragmentShadersATIPROC glGenFragmentShadersATI;
+extern glBindFragmentShaderATIPROC glBindFragmentShaderATI;
+extern glDeleteFragmentShaderATIPROC glDeleteFragmentShaderATI;
+extern glBeginFragmentShaderATIPROC glBeginFragmentShaderATI;
+extern glEndFragmentShaderATIPROC glEndFragmentShaderATI;
+extern glPassTexCoordATIPROC glPassTexCoordATI;
+extern glSampleMapATIPROC glSampleMapATI;
+extern glColorFragmentOp1ATIPROC glColorFragmentOp1ATI;
+extern glColorFragmentOp2ATIPROC glColorFragmentOp2ATI;
+extern glColorFragmentOp3ATIPROC glColorFragmentOp3ATI;
+extern glAlphaFragmentOp1ATIPROC glAlphaFragmentOp1ATI;
+extern glAlphaFragmentOp2ATIPROC glAlphaFragmentOp2ATI;
+extern glAlphaFragmentOp3ATIPROC glAlphaFragmentOp3ATI;
+extern glSetFragmentShaderConstantATIPROC glSetFragmentShaderConstantATI;
+
+#endif /* GL_ATI_fragment_shader */
+
+/*-------------------------------------------------------------------*/
+/*------------ATI_TEXTURE_MIRROR_ONCE--------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATI_texture_mirror_once
+#define GL_ATI_texture_mirror_once 1
+
+#define GL_MIRROR_CLAMP_ATI 0x8742
+#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743
+
+#endif
+
+/*-------------------------------------------------------------------*/
+/*------------ATI_ELEMENT_ARRAY--------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATI_element_array
+#define GL_ATI_element_array 1
+
+#define GL_ELEMENT_ARRAY_ATI 0x8768
+#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769
+#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A
+
+typedef void (APIENTRY * glElementPointerATIPROC) (GLenum type, const GLvoid *pointer);
+typedef void (APIENTRY * glDrawElementArrayATIPROC) (GLenum mode, GLsizei count);
+typedef void (APIENTRY * glDrawRangeElementArrayATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count);
+
+extern glElementPointerATIPROC glElementPointerATI;
+extern glDrawElementArrayATIPROC glDrawElementArrayATI;
+extern glDrawRangeElementArrayATIPROC glDrawRangeElementArrayATI;
+
+#endif /* GL_ATI_element_array */
+
+/*-------------------------------------------------------------------*/
+/*------------ATI_VERTEX_STREAMS-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATI_vertex_streams
+#define GL_ATI_vertex_streams 1
+
+#define GL_MAX_VERTEX_STREAMS_ATI 0x876B
+#define GL_VERTEX_SOURCE_ATI 0x876C
+#define GL_VERTEX_STREAM0_ATI 0x876D
+#define GL_VERTEX_STREAM1_ATI 0x876E
+#define GL_VERTEX_STREAM2_ATI 0x876F
+#define GL_VERTEX_STREAM3_ATI 0x8770
+#define GL_VERTEX_STREAM4_ATI 0x8771
+#define GL_VERTEX_STREAM5_ATI 0x8772
+#define GL_VERTEX_STREAM6_ATI 0x8773
+#define GL_VERTEX_STREAM7_ATI 0x8774
+
+typedef void (APIENTRY * glClientActiveVertexStreamATIPROC) (GLenum stream);
+typedef void (APIENTRY * glVertexBlendEnviATIPROC) (GLenum pname, GLint param);
+typedef void (APIENTRY * glVertexBlendEnvfATIPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * glVertexStream2sATIPROC) (GLenum stream, GLshort x, GLshort y);
+typedef void (APIENTRY * glVertexStream2svATIPROC) (GLenum stream, const GLshort *v);
+typedef void (APIENTRY * glVertexStream2iATIPROC) (GLenum stream, GLint x, GLint y);
+typedef void (APIENTRY * glVertexStream2ivATIPROC) (GLenum stream, const GLint *v);
+typedef void (APIENTRY * glVertexStream2fATIPROC) (GLenum stream, GLfloat x, GLfloat y);
+typedef void (APIENTRY * glVertexStream2fvATIPROC) (GLenum stream, const GLfloat *v);
+typedef void (APIENTRY * glVertexStream2dATIPROC) (GLenum stream, GLdouble x, GLdouble y);
+typedef void (APIENTRY * glVertexStream2dvATIPROC) (GLenum stream, const GLdouble *v);
+typedef void (APIENTRY * glVertexStream3sATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRY * glVertexStream3svATIPROC) (GLenum stream, const GLshort *v);
+typedef void (APIENTRY * glVertexStream3iATIPROC) (GLenum stream, GLint x, GLint y, GLint z);
+typedef void (APIENTRY * glVertexStream3ivATIPROC) (GLenum stream, const GLint *v);
+typedef void (APIENTRY * glVertexStream3fATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * glVertexStream3fvATIPROC) (GLenum stream, const GLfloat *v);
+typedef void (APIENTRY * glVertexStream3dATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRY * glVertexStream3dvATIPROC) (GLenum stream, const GLdouble *v);
+typedef void (APIENTRY * glVertexStream4sATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRY * glVertexStream4svATIPROC) (GLenum stream, const GLshort *v);
+typedef void (APIENTRY * glVertexStream4iATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRY * glVertexStream4ivATIPROC) (GLenum stream, const GLint *v);
+typedef void (APIENTRY * glVertexStream4fATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * glVertexStream4fvATIPROC) (GLenum stream, const GLfloat *v);
+typedef void (APIENTRY * glVertexStream4dATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * glVertexStream4dvATIPROC) (GLenum stream, const GLdouble *v);
+typedef void (APIENTRY * glNormalStream3bATIPROC) (GLenum stream, GLbyte x, GLbyte y, GLbyte z);
+typedef void (APIENTRY * glNormalStream3bvATIPROC) (GLenum stream, const GLbyte *v);
+typedef void (APIENTRY * glNormalStream3sATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRY * glNormalStream3svATIPROC) (GLenum stream, const GLshort *v);
+typedef void (APIENTRY * glNormalStream3iATIPROC) (GLenum stream, GLint x, GLint y, GLint z);
+typedef void (APIENTRY * glNormalStream3ivATIPROC) (GLenum stream, const GLint *v);
+typedef void (APIENTRY * glNormalStream3fATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * glNormalStream3fvATIPROC) (GLenum stream, const GLfloat *v);
+typedef void (APIENTRY * glNormalStream3dATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRY * glNormalStream3dvATIPROC) (GLenum stream, const GLdouble *v);
+
+
+extern glClientActiveVertexStreamATIPROC glClientActiveVertexStreamATI;
+extern glVertexBlendEnviATIPROC glVertexBlendEnviATI;
+extern glVertexBlendEnvfATIPROC glVertexBlendEnvfATI;
+extern glVertexStream2sATIPROC glVertexStream2sATI;
+extern glVertexStream2svATIPROC glVertexStream2svATI;
+extern glVertexStream2iATIPROC glVertexStream2iATI;
+extern glVertexStream2ivATIPROC glVertexStream2ivATI;
+extern glVertexStream2fATIPROC glVertexStream2fATI;
+extern glVertexStream2fvATIPROC glVertexStream2fvATI;
+extern glVertexStream2dATIPROC glVertexStream2dATI;
+extern glVertexStream2dvATIPROC glVertexStream2dvATI;
+extern glVertexStream3sATIPROC glVertexStream3sATI;
+extern glVertexStream3svATIPROC glVertexStream3svATI;
+extern glVertexStream3iATIPROC glVertexStream3iATI;
+extern glVertexStream3ivATIPROC glVertexStream3ivATI;
+extern glVertexStream3fATIPROC glVertexStream3fATI;
+extern glVertexStream3fvATIPROC glVertexStream3fvATI;
+extern glVertexStream3dATIPROC glVertexStream3dATI;
+extern glVertexStream3dvATIPROC glVertexStream3dvATI;
+extern glVertexStream4sATIPROC glVertexStream4sATI;
+extern glVertexStream4svATIPROC glVertexStream4svATI;
+extern glVertexStream4iATIPROC glVertexStream4iATI;
+extern glVertexStream4ivATIPROC glVertexStream4ivATI;
+extern glVertexStream4fATIPROC glVertexStream4fATI;
+extern glVertexStream4fvATIPROC glVertexStream4fvATI;
+extern glVertexStream4dATIPROC glVertexStream4dATI;
+extern glVertexStream4dvATIPROC glVertexStream4dvATI;
+extern glNormalStream3bATIPROC glNormalStream3bATI;
+extern glNormalStream3bvATIPROC glNormalStream3bvATI;
+extern glNormalStream3sATIPROC glNormalStream3sATI;
+extern glNormalStream3svATIPROC glNormalStream3svATI;
+extern glNormalStream3iATIPROC glNormalStream3iATI;
+extern glNormalStream3ivATIPROC glNormalStream3ivATI;
+extern glNormalStream3fATIPROC glNormalStream3fATI;
+extern glNormalStream3fvATIPROC glNormalStream3fvATI;
+extern glNormalStream3dATIPROC glNormalStream3dATI;
+extern glNormalStream3dvATIPROC glNormalStream3dvATI;
+
+#endif /* GL_ATI_vertex_streams */
+
+/*-------------------------------------------------------------------*/
+/*------------ATI_VERTEX_ARRAY_OBJECT--------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATI_vertex_array_object
+#define GL_ATI_vertex_array_object 1
+
+#define GL_STATIC_ATI 0x8760
+#define GL_DYNAMIC_ATI 0x8761
+#define GL_PRESERVE_ATI 0x8762
+#define GL_DISCARD_ATI 0x8763
+#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764
+#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765
+#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766
+#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767
+
+typedef GLuint (APIENTRY * glNewObjectBufferATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage);
+typedef GLboolean (APIENTRY * glIsObjectBufferATIPROC) (GLuint buffer);
+typedef void (APIENTRY * glUpdateObjectBufferATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve);
+typedef void (APIENTRY * glGetObjectBufferfvATIPROC) (GLuint buffer, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetObjectBufferivATIPROC) (GLuint buffer, GLenum pname, GLint *params);
+typedef void (APIENTRY * glFreeObjectBufferATIPROC) (GLuint buffer);
+typedef void (APIENTRY * glArrayObjectATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
+typedef void (APIENTRY * glGetArrayObjectfvATIPROC) (GLenum array, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetArrayObjectivATIPROC) (GLenum array, GLenum pname, GLint *params);
+typedef void (APIENTRY * glVariantArrayObjectATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
+typedef void (APIENTRY * glGetVariantArrayObjectfvATIPROC) (GLuint id, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetVariantArrayObjectivATIPROC) (GLuint id, GLenum pname, GLint *params);
+
+extern glNewObjectBufferATIPROC glNewObjectBufferATI;
+extern glIsObjectBufferATIPROC glIsObjectBufferATI;
+extern glUpdateObjectBufferATIPROC glUpdateObjectBufferATI;
+extern glGetObjectBufferfvATIPROC glGetObjectBufferfvATI;
+extern glGetObjectBufferivATIPROC glGetObjectBufferivATI;
+extern glFreeObjectBufferATIPROC glFreeObjectBufferATI;
+extern glArrayObjectATIPROC glArrayObjectATI;
+extern glGetArrayObjectfvATIPROC glGetArrayObjectfvATI;
+extern glGetArrayObjectivATIPROC glGetArrayObjectivATI;
+extern glVariantArrayObjectATIPROC glVariantArrayObjectATI;
+extern glGetVariantArrayObjectfvATIPROC glGetVariantArrayObjectfvATI;
+extern glGetVariantArrayObjectivATIPROC glGetVariantArrayObjectivATI;
+
+#endif /* GL_ATI_vertex_array_object */
+
+/*-------------------------------------------------------------------*/
+/*------------HP_OCCLUSION_TEST--------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_HP_occlusion_test
+#define GL_HP_occlusion_test 1
+
+#define GL_OCCLUSION_TEST_HP 0x8165;
+#define GL_OCCLUSION_TEST_RESULT_HP 0x8166;
+
+#endif /* GL_HP_occlusion_test */
+
+/*-------------------------------------------------------------------*/
+/*------------ATIX_POINT_SPRITES-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATIX_point_sprites
+#define GL_ATIX_point_sprites 1
+
+#define GL_TEXTURE_POINT_MODE_ATIX 0x60b0
+#define GL_TEXTURE_POINT_ONE_COORD_ATIX 0x60b1
+#define GL_TEXTURE_POINT_SPRITE_ATIX 0x60b2
+#define GL_POINT_SPRITE_CULL_MODE_ATIX 0x60b3
+#define GL_POINT_SPRITE_CULL_CENTER_ATIX 0x60b4
+#define GL_POINT_SPRITE_CULL_CLIP_ATIX 0x60b5
+
+#endif /* GL_ATIX_point_sprites */
+
+/*-------------------------------------------------------------------*/
+/*------------ATIX_TEXTURE_ENV_ROUTE---------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATIX_texture_env_route
+#define GL_ATIX_texture_env_route 1
+
+#define GL_SECONDARY_COLOR_ATIX 0x8747
+#define GL_TEXTURE_OUTPUT_RGB_ATIX 0x8748
+#define GL_TEXTURE_OUTPUT_ALPHA_ATIX 0x8749
+
+#endif /* GL_ATIX_texture_env_route */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_DEPTH_CLAMP-----------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_depth_clamp
+#define GL_NV_depth_clamp 1
+
+#define GL_DEPTH_CLAMP_NV 0x864F
+
+#endif /* GL_NV_depth_clamp */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_OCCLUSION_QUERY-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_occlusion_query
+#define GL_NV_occlusion_query 1
+
+#ifndef GL_HP_occlusion_test
+#define GL_OCCLUSION_TEST_HP 0x8165
+#define GL_OCCLUSION_TEST_RESULT_HP 0x8166
+#endif /* GL_HP_occlusion_test */
+#define GL_PIXEL_COUNTER_BITS_NV 0x8864
+#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865
+#define GL_PIXEL_COUNT_NV 0x8866
+#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867
+
+typedef void (APIENTRY * glGenOcclusionQueriesNVPROC) (GLsizei n, GLuint *ids);
+typedef void (APIENTRY * glDeleteOcclusionQueriesNVPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (APIENTRY * glIsOcclusionQueryNVPROC) (GLuint id);
+typedef void (APIENTRY * glBeginOcclusionQueryNVPROC) (GLuint id);
+typedef void (APIENTRY * glEndOcclusionQueryNVPROC) (void);
+typedef void (APIENTRY * glGetOcclusionQueryivNVPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetOcclusionQueryuivNVPROC) (GLuint id, GLenum pname, GLuint *params);
+
+extern glGenOcclusionQueriesNVPROC glGenOcclusionQueriesNV;
+extern glDeleteOcclusionQueriesNVPROC glDeleteOcclusionQueriesNV;
+extern glIsOcclusionQueryNVPROC glIsOcclusionQueryNV;
+extern glBeginOcclusionQueryNVPROC glBeginOcclusionQueryNV;
+extern glEndOcclusionQueryNVPROC glEndOcclusionQueryNV;
+extern glGetOcclusionQueryivNVPROC glGetOcclusionQueryivNV;
+extern glGetOcclusionQueryuivNVPROC glGetOcclusionQueryuivNV;
+
+#endif /* GL_NV_occlusion_query */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_POINT_SPRITE----------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_point_sprite
+#define GL_NV_point_sprite 1
+
+#define GL_POINT_SPRITE_NV 0x8861
+#define GL_COORD_REPLACE_NV 0x8862
+#define GL_POINT_SPRITE_R_MODE_NV 0x8863
+
+typedef void (APIENTRY * glPointParameteriNVPROC) (GLenum pname, GLint param);
+typedef void (APIENTRY * glPointParameterivNVPROC) (GLenum pname, const GLint *params);
+
+extern glPointParameteriNVPROC glPointParameteriNV;
+extern glPointParameterivNVPROC glPointParameterivNV;
+
+#endif /* GL_NV_point_sprite */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_TEXTURE_SHADER3-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_texture_shader3
+#define GL_NV_texture_shader3 1
+
+#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850
+#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851
+#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852
+#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853
+#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854
+#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855
+#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856
+#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857
+#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858
+#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859
+#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A
+#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B
+#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C
+#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D
+#define GL_HILO8_NV 0x885E
+#define GL_SIGNED_HILO8_NV 0x885F
+#define GL_FORCE_BLUE_TO_ONE_NV 0x8860
+
+#endif /* GL_NV_texture_shader3 */
+
+/*-------------------------------------------------------------------*/
+/*------------NV_VERTEX_PROGRAM1_1-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_vertex_program1_1
+#define GL_NV_vertex_program1_1
+
+#endif /* GL_NV_vertex_program1_1 */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_TEXTURE_MIRRORED_REPEAT----------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_texture_mirrored_repeat
+#define GL_ARB_texture_mirrored_repeat 1
+
+#define GL_GL_MIRRORED_REPEAT_ARB 0x8370
+
+#endif /* GL_ARB_texture_mirrored_repeat */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_SHADOW---------------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_shadow
+#define GL_ARB_shadow 1
+
+#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
+#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
+#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
+
+#endif /* GL_ARB_shadow */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_SHADOW_AMBIENT-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_shadow_ambient
+#define GL_ARB_shadow_ambient 1
+
+#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
+
+#endif /* GL_ARB_shadow_ambient */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_DEPTH_TEXTURE--------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_depth_texture
+#define GL_ARB_depth_texture 1
+
+#define GL_DEPTH_COMPONENT16_ARB 0x81A5
+#define GL_DEPTH_COMPONENT24_ARB 0x81A6
+#define GL_DEPTH_COMPONENT32_ARB 0x81A7
+#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A
+#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
+
+#endif /* GL_ARB_depth_texture */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_WINDOW_POS-----------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_window_pos
+#define GL_ARB_window_pos 1
+
+typedef void (APIENTRY * glWindowPos2dARBPROC) (GLdouble x, GLdouble y);
+typedef void (APIENTRY * glWindowPos2fARBPROC) (GLfloat x, GLfloat y);
+typedef void (APIENTRY * glWindowPos2iARBPROC) (GLint x, GLint y);
+typedef void (APIENTRY * glWindowPos2sARBPROC) (GLshort x, GLshort y);
+typedef void (APIENTRY * glWindowPos2dvARBPROC) (const GLdouble *p);
+typedef void (APIENTRY * glWindowPos2fvARBPROC) (const GLfloat *p);
+typedef void (APIENTRY * glWindowPos2ivARBPROC) (const GLint *p);
+typedef void (APIENTRY * glWindowPos2svARBPROC) (const GLshort *p);
+typedef void (APIENTRY * glWindowPos3dARBPROC) (GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRY * glWindowPos3fARBPROC) (GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * glWindowPos3iARBPROC) (GLint x, GLint y, GLint z);
+typedef void (APIENTRY * glWindowPos3sARBPROC) (GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRY * glWindowPos3dvARBPROC) (const GLdouble *p);
+typedef void (APIENTRY * glWindowPos3fvARBPROC) (const GLfloat *p);
+typedef void (APIENTRY * glWindowPos3ivARBPROC) (const GLint *p);
+typedef void (APIENTRY * glWindowPos3svARBPROC) (const GLshort *p);
+
+extern glWindowPos2dARBPROC glWindowPos2dARB;
+extern glWindowPos2fARBPROC glWindowPos2fARB;
+extern glWindowPos2iARBPROC glWindowPos2iARB;
+extern glWindowPos2sARBPROC glWindowPos2sARB;
+extern glWindowPos2dvARBPROC glWindowPos2dvARB;
+extern glWindowPos2fvARBPROC glWindowPos2fvARB;
+extern glWindowPos2ivARBPROC glWindowPos2ivARB;
+extern glWindowPos2svARBPROC glWindowPos2svARB;
+extern glWindowPos3dARBPROC glWindowPos3dARB;
+extern glWindowPos3fARBPROC glWindowPos3fARB;
+extern glWindowPos3iARBPROC glWindowPos3iARB;
+extern glWindowPos3sARBPROC glWindowPos3sARB;
+extern glWindowPos3dvARBPROC glWindowPos3dvARB;
+extern glWindowPos3fvARBPROC glWindowPos3fvARB;
+extern glWindowPos3ivARBPROC glWindowPos3ivARB;
+extern glWindowPos3svARBPROC glWindowPos3svARB;
+
+#endif /* GL_ARB_window_pos */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_SHADOW_FUNCS---------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_shadow_funcs
+#define GL_EXT_shadow_funcs 1
+
+#endif /* GL_EXT_shadow_funcs */
+
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_draw_range_elements--------------------------------*/
+/*-------------------------------------------------------------------*/
+
+
+#ifndef GL_EXT_draw_range_elements
+#define GL_EXT_draw_range_elements 1
+
+typedef void (APIENTRY * glDrawRangeElementsEXTPROC) ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+
+extern glDrawRangeElementsEXTPROC glDrawRangeElementsEXT;
+
+#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8
+#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9
+
+#endif
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_texture_compression_s3tc---------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_EXT_texture_compression_s3tc 1
+
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
+
+#endif /* GL_EXT_texture_compression_s3tc */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_stencil_two_side-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_stencil_two_side
+#define GL_EXT_stencil_two_side 1
+
+typedef void (APIENTRY * glActiveStencilFaceEXTPROC) (GLenum face);
+
+extern glActiveStencilFaceEXTPROC glActiveStencilFaceEXT;
+
+#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
+#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911
+
+#endif /* GL_EXT_stencil_two_side */
+
+/*-------------------------------------------------------------------*/
+/*------------ARB_vertex_program-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ARB_vertex_program
+#define GL_ARB_vertex_program 1
+
+typedef void (APIENTRY * glVertexAttrib1sARBPROC) (GLuint index, GLshort x);
+typedef void (APIENTRY * glVertexAttrib1fARBPROC) (GLuint index, GLfloat x);
+typedef void (APIENTRY * glVertexAttrib1dARBPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRY * glVertexAttrib2sARBPROC) (GLuint index, GLshort x, GLshort y);
+typedef void (APIENTRY * glVertexAttrib2fARBPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (APIENTRY * glVertexAttrib2dARBPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRY * glVertexAttrib3sARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRY * glVertexAttrib3fARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRY * glVertexAttrib3dARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRY * glVertexAttrib4sARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRY * glVertexAttrib4fARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * glVertexAttrib4dARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * glVertexAttrib4NubARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+typedef void (APIENTRY * glVertexAttrib1svARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * glVertexAttrib1fvARBPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttrib1dvARBPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttrib2svARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * glVertexAttrib2fvARBPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttrib2dvARBPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttrib3svARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * glVertexAttrib3fvARBPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttrib3dvARBPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttrib4bvARBPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRY * glVertexAttrib4svARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * glVertexAttrib4ivARBPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRY * glVertexAttrib4ubvARBPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRY * glVertexAttrib4usvARBPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRY * glVertexAttrib4uivARBPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRY * glVertexAttrib4fvARBPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRY * glVertexAttrib4dvARBPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRY * glVertexAttrib4NbvARBPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRY * glVertexAttrib4NsvARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRY * glVertexAttrib4NivARBPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRY * glVertexAttrib4NubvARBPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRY * glVertexAttrib4NusvARBPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRY * glVertexAttrib4NuivARBPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRY * glVertexAttribPointerARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRY * glEnableVertexAttribArrayARBPROC) (GLuint index);
+typedef void (APIENTRY * glDisableVertexAttribArrayARBPROC) (GLuint index);
+typedef void (APIENTRY * glProgramStringARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
+typedef void (APIENTRY * glBindProgramARBPROC) (GLenum target, GLuint program);
+typedef void (APIENTRY * glDeleteProgramsARBPROC) (GLsizei n, const GLuint *programs);
+typedef void (APIENTRY * glGenProgramsARBPROC) (GLsizei n, GLuint *programs);
+typedef void (APIENTRY * glProgramEnvParameter4dARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * glProgramEnvParameter4dvARBPROC) (GLenum target, GLuint index, const GLdouble *params);
+typedef void (APIENTRY * glProgramEnvParameter4fARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * glProgramEnvParameter4fvARBPROC) (GLenum target, GLuint index, const GLfloat *params);
+typedef void (APIENTRY * glProgramLocalParameter4dARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * glProgramLocalParameter4dvARBPROC) (GLenum target, GLuint index, const GLdouble *params);
+typedef void (APIENTRY * glProgramLocalParameter4fARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * glProgramLocalParameter4fvARBPROC) (GLenum target, GLuint index, const GLfloat *params);
+typedef void (APIENTRY * glGetProgramEnvParameterdvARBPROC) (GLenum target, GLuint index, GLdouble *params);
+typedef void (APIENTRY * glGetProgramEnvParameterfvARBPROC) (GLenum target, GLuint index, GLfloat *params);
+typedef void (APIENTRY * glGetProgramLocalParameterdvARBPROC) (GLenum target, GLuint index, GLdouble *params);
+typedef void (APIENTRY * glGetProgramLocalParameterfvARBPROC) (GLenum target, GLuint index, GLfloat *params);
+typedef void (APIENTRY * glGetProgramivARBPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetProgramStringARBPROC) (GLenum target, GLenum pname, GLvoid *string);
+typedef void (APIENTRY * glGetVertexAttribdvARBPROC) (GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRY * glGetVertexAttribfvARBPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glGetVertexAttribivARBPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRY * glGetVertexAttribPointervARBPROC) (GLuint index, GLenum pname, GLvoid **pointer);
+typedef GLboolean (APIENTRY * glIsProgramARBPROC) (GLuint program);
+
+extern glVertexAttrib1sARBPROC glVertexAttrib1sARB;
+extern glVertexAttrib1fARBPROC glVertexAttrib1fARB;
+extern glVertexAttrib1dARBPROC glVertexAttrib1dARB;
+extern glVertexAttrib2sARBPROC glVertexAttrib2sARB;
+extern glVertexAttrib2fARBPROC glVertexAttrib2fARB;
+extern glVertexAttrib2dARBPROC glVertexAttrib2dARB;
+extern glVertexAttrib3sARBPROC glVertexAttrib3sARB;
+extern glVertexAttrib3fARBPROC glVertexAttrib3fARB;
+extern glVertexAttrib3dARBPROC glVertexAttrib3dARB;
+extern glVertexAttrib4sARBPROC glVertexAttrib4sARB;
+extern glVertexAttrib4fARBPROC glVertexAttrib4fARB;
+extern glVertexAttrib4dARBPROC glVertexAttrib4dARB;
+extern glVertexAttrib4NubARBPROC glVertexAttrib4NubARB;
+extern glVertexAttrib1svARBPROC glVertexAttrib1svARB;
+extern glVertexAttrib1fvARBPROC glVertexAttrib1fvARB;
+extern glVertexAttrib1dvARBPROC glVertexAttrib1dvARB;
+extern glVertexAttrib2svARBPROC glVertexAttrib2svARB;
+extern glVertexAttrib2fvARBPROC glVertexAttrib2fvARB;
+extern glVertexAttrib2dvARBPROC glVertexAttrib2dvARB;
+extern glVertexAttrib3svARBPROC glVertexAttrib3svARB;
+extern glVertexAttrib3fvARBPROC glVertexAttrib3fvARB;
+extern glVertexAttrib3dvARBPROC glVertexAttrib3dvARB;
+extern glVertexAttrib4bvARBPROC glVertexAttrib4bvARB;
+extern glVertexAttrib4svARBPROC glVertexAttrib4svARB;
+extern glVertexAttrib4ivARBPROC glVertexAttrib4ivARB;
+extern glVertexAttrib4ubvARBPROC glVertexAttrib4ubvARB;
+extern glVertexAttrib4usvARBPROC glVertexAttrib4usvARB;
+extern glVertexAttrib4uivARBPROC glVertexAttrib4uivARB;
+extern glVertexAttrib4fvARBPROC glVertexAttrib4fvARB;
+extern glVertexAttrib4dvARBPROC glVertexAttrib4dvARB;
+extern glVertexAttrib4NbvARBPROC glVertexAttrib4NbvARB;
+extern glVertexAttrib4NsvARBPROC glVertexAttrib4NsvARB;
+extern glVertexAttrib4NivARBPROC glVertexAttrib4NivARB;
+extern glVertexAttrib4NubvARBPROC glVertexAttrib4NubvARB;
+extern glVertexAttrib4NusvARBPROC glVertexAttrib4NusvARB;
+extern glVertexAttrib4NuivARBPROC glVertexAttrib4NuivARB;
+extern glVertexAttribPointerARBPROC glVertexAttribPointerARB;
+extern glEnableVertexAttribArrayARBPROC glEnableVertexAttribArrayARB;
+extern glDisableVertexAttribArrayARBPROC glDisableVertexAttribArrayARB;
+extern glProgramStringARBPROC glProgramStringARB;
+extern glBindProgramARBPROC glBindProgramARB;
+extern glDeleteProgramsARBPROC glDeleteProgramsARB;
+extern glGenProgramsARBPROC glGenProgramsARB;
+extern glProgramEnvParameter4dARBPROC glProgramEnvParameter4dARB;
+extern glProgramEnvParameter4dvARBPROC glProgramEnvParameter4dvARB;
+extern glProgramEnvParameter4fARBPROC glProgramEnvParameter4fARB;
+extern glProgramEnvParameter4fvARBPROC glProgramEnvParameter4fvARB;
+extern glProgramLocalParameter4dARBPROC glProgramLocalParameter4dARB;
+extern glProgramLocalParameter4dvARBPROC glProgramLocalParameter4dvARB;
+extern glProgramLocalParameter4fARBPROC glProgramLocalParameter4fARB;
+extern glProgramLocalParameter4fvARBPROC glProgramLocalParameter4fvARB;
+extern glGetProgramEnvParameterdvARBPROC glGetProgramEnvParameterdvARB;
+extern glGetProgramEnvParameterfvARBPROC glGetProgramEnvParameterfvARB;
+extern glGetProgramLocalParameterdvARBPROC glGetProgramLocalParameterdvARB;
+extern glGetProgramLocalParameterfvARBPROC glGetProgramLocalParameterfvARB;
+extern glGetProgramivARBPROC glGetProgramivARB;
+extern glGetProgramStringARBPROC glGetProgramStringARB;
+extern glGetVertexAttribdvARBPROC glGetVertexAttribdvARB;
+extern glGetVertexAttribfvARBPROC glGetVertexAttribfvARB;
+extern glGetVertexAttribivARBPROC glGetVertexAttribivARB;
+extern glGetVertexAttribPointervARBPROC glGetVertexAttribPointervARB;
+extern glIsProgramARBPROC glIsProgramARB;
+
+#define GL_VERTEX_PROGRAM_ARB 0x8620
+#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
+#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
+#define GL_COLOR_SUM_ARB 0x8458
+#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
+#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
+#define GL_PROGRAM_LENGTH_ARB 0x8627
+#define GL_PROGRAM_FORMAT_ARB 0x8876
+#define GL_PROGRAM_BINDING_ARB 0x8677
+#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0
+#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1
+#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
+#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
+#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4
+#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5
+#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
+#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
+#define GL_PROGRAM_PARAMETERS_ARB 0x88A8
+#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9
+#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA
+#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
+#define GL_PROGRAM_ATTRIBS_ARB 0x88AC
+#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD
+#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE
+#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
+#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0
+#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
+#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
+#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
+#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
+#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
+#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
+#define GL_PROGRAM_STRING_ARB 0x8628
+#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B
+#define GL_CURRENT_MATRIX_ARB 0x8641
+#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7
+#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
+#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
+#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F
+#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
+#define GL_PROGRAM_ERROR_STRING_ARB 0x8874
+#define GL_MATRIX0_ARB 0x88C0
+#define GL_MATRIX1_ARB 0x88C1
+#define GL_MATRIX2_ARB 0x88C2
+#define GL_MATRIX3_ARB 0x88C3
+#define GL_MATRIX4_ARB 0x88C4
+#define GL_MATRIX5_ARB 0x88C5
+#define GL_MATRIX6_ARB 0x88C6
+#define GL_MATRIX7_ARB 0x88C7
+#define GL_MATRIX8_ARB 0x88C8
+#define GL_MATRIX9_ARB 0x88C9
+#define GL_MATRIX10_ARB 0x88CA
+#define GL_MATRIX11_ARB 0x88CB
+#define GL_MATRIX12_ARB 0x88CC
+#define GL_MATRIX13_ARB 0x88CD
+#define GL_MATRIX14_ARB 0x88CE
+#define GL_MATRIX15_ARB 0x88CF
+#define GL_MATRIX16_ARB 0x88D0
+#define GL_MATRIX17_ARB 0x88D1
+#define GL_MATRIX18_ARB 0x88D2
+#define GL_MATRIX19_ARB 0x88D3
+#define GL_MATRIX20_ARB 0x88D4
+#define GL_MATRIX21_ARB 0x88D5
+#define GL_MATRIX22_ARB 0x88D6
+#define GL_MATRIX23_ARB 0x88D7
+#define GL_MATRIX24_ARB 0x88D8
+#define GL_MATRIX25_ARB 0x88D9
+#define GL_MATRIX26_ARB 0x88DA
+#define GL_MATRIX27_ARB 0x88DB
+#define GL_MATRIX28_ARB 0x88DC
+#define GL_MATRIX29_ARB 0x88DD
+#define GL_MATRIX30_ARB 0x88DE
+#define GL_MATRIX31_ARB 0x88DF
+
+#endif /* GL_ARB_vertex_program */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_EXT_BGRA--------------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_bgra
+#define GL_EXT_bgra 1
+
+#define GL_BGR_EXT 0x80E0
+#define GL_BGRA_EXT 0x80E1
+
+#endif /* GL_EXT_bgra */
+
+/*-------------------------------------------------------------------*/
+/*------------EXT_CULL_VERTEX----------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_cull_vertex
+#define GL_EXT_cull_vertex 1
+
+#define GL_CULL_VERTEX_EXT 0x81AA
+#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB
+#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC
+
+typedef void (APIENTRY * glCullParameterfvEXTPROC) (GLenum pname, GLfloat *params);
+typedef void (APIENTRY * glCullParameterdvEXTPROC) (GLenum pname, GLdouble *params);
+
+extern glCullParameterfvEXTPROC glCullParameterfvEXT;
+extern glCullParameterdvEXTPROC glCullParameterdvEXT;
+
+
+#endif /* GL_EXT_cull_vertex */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_ATI_POINT_CULL_MODE---------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_ATI_point_cull_mode
+#define GL_ATI_point_cull_mode 1
+
+#define GL_POINT_CULL_MODE_ATI 0x60b3
+#define GL_POINT_CULL_CENTER_ATI 0x60b4
+#define GL_POINT_CLIP_ATI 0x60b5
+
+#endif /* GL_ATI_point_cull_mode */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_BLEND_FUNC_SEPARATE---------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_blend_func_separate
+#define GL_EXT_blend_func_separate 1
+
+#define GL_BLEND_DST_RGB_EXT 0x80C8
+#define GL_BLEND_SRC_RGB_EXT 0x80C9
+#define GL_BLEND_DST_ALPHA_EXT 0x80CA
+#define GL_BLEND_SRC_ALPHA_EXT 0x80CB
+
+typedef void (APIENTRY * glBlendFuncSeparateEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+
+extern glBlendFuncSeparateEXTPROC glBlendFuncSeparateEXT;
+
+#endif /* GL_EXT_blend_func_separate */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_EXT_SEPARATE_SPECULAR_COLOR-------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_EXT_separate_specular_color
+#define GL_EXT_separate_specular_color 1
+
+#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8
+#define GL_SINGLE_COLOR_EXT 0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA
+
+#endif /* GL_EXT_separate_specular_color */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_NV_ELEMENT_ARRAY------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_element_array
+#define GL_NV_element_array 1
+
+#define GL_ELEMENT_ARRAY_TYPE_NV 0x8769
+#define GL_ELEMENT_ARRAY_POINTER_NV 0x876A
+
+typedef void (APIENTRY * glElementPointerNVPROC) (GLenum type, const GLvoid *pointer);
+typedef void (APIENTRY * glDrawElementArrayNVPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (APIENTRY * glDrawRangeElementArrayNVPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
+typedef void (APIENTRY * glMultiDrawElementArrayNVPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+typedef void (APIENTRY * glMultiDrawRangeElementArrayNVPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
+
+extern glElementPointerNVPROC glElementPointerNV;
+extern glDrawElementArrayNVPROC glDrawElementArrayNV;
+extern glDrawRangeElementArrayNVPROC glDrawRangeElementArrayNV;
+extern glMultiDrawElementArrayNVPROC glMultiDrawElementArrayNV;
+extern glMultiDrawRangeElementArrayNVPROC glMultiDrawRangeElementArrayNV;
+
+#endif /* GL_NV_element_array */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_NV_FLOAT_BUFFER-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_float_buffer
+#define GL_NV_float_buffer 1
+
+#define GL_FLOAT_R_NV 0x8880
+#define GL_FLOAT_RG_NV 0x8881
+#define GL_FLOAT_RGB_NV 0x8882
+#define GL_FLOAT_RGBA_NV 0x8883
+#define GL_FLOAT_R32_NV 0x8885
+#define GL_FLOAT_R16_NV 0x8884
+#define GL_FLOAT_R32_NV 0x8885
+#define GL_FLOAT_RG16_NV 0x8886
+#define GL_FLOAT_RG32_NV 0x8887
+#define GL_FLOAT_RGB16_NV 0x8888
+#define GL_FLOAT_RGB32_NV 0x8889
+#define GL_FLOAT_RGBA16_NV 0x888A
+#define GL_FLOAT_RGBA32_NV 0x888B
+#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C
+#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D
+#define GL_FLOAT_RGBA_MODE_NV 0x888E
+
+#ifdef _WIN32
+#define GL_WGL_FLOAT_COMPONENTS_NV 0x20B0
+#define GL_WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
+#define GL_WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
+#define GL_WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
+#define GL_WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
+#define GL_WGL_TEXTURE_FLOAT_R_NV 0x20B5
+#define GL_WGL_TEXTURE_FLOAT_RG_NV 0x20B6
+#define GL_WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
+#define GL_WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
+#endif /* _WIN32 */
+
+#endif /* GL_NV_float_buffer */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_NV_FRAGMENT_PROGRAM---------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_fragment_program
+#define GL_NV_fragment_program 1
+
+#define GL_FRAGMENT_PROGRAM_NV 0x8870
+#define GL_MAX_TEXTURE_COORDS_NV 0x8871
+#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872
+#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873
+#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868
+#define GL_PROGRAM_ERROR_STRING_NV 0x8874
+
+typedef void (APIENTRY * glProgramNamedParameter4fNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * glProgramNamedParameter4dNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * glProgramNamedParameter4fvNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat v[]);
+typedef void (APIENTRY * glProgramNamedParameter4dvNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble v[]);
+typedef void (APIENTRY * glGetProgramNamedParameterfvNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
+typedef void (APIENTRY * glGetProgramNamedParameterdvNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
+
+#ifndef GL_ARB_vertex_program
+typedef void (APIENTRY * glProgramLocalParameter4dARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRY * glProgramLocalParameter4dvARBPROC) (GLenum target, GLuint index, const GLdouble *params);
+typedef void (APIENTRY * glProgramLocalParameter4fARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRY * glProgramLocalParameter4fvARBPROC) (GLenum target, GLuint index, const GLfloat *params);
+typedef void (APIENTRY * glGetProgramLocalParameterdvARBPROC) (GLenum target, GLuint index, GLdouble *params);
+typedef void (APIENTRY * glGetProgramLocalParameterfvARBPROC) (GLenum target, GLuint index, GLfloat *params);
+#endif /* GL_ARB_vertex_program */
+
+extern glProgramNamedParameter4fNVPROC glProgramNamedParameter4fNV;
+extern glProgramNamedParameter4dNVPROC glProgramNamedParameter4dNV;
+extern glProgramNamedParameter4fvNVPROC glProgramNamedParameter4fvNV;
+extern glProgramNamedParameter4dvNVPROC glProgramNamedParameter4dvNV;
+extern glGetProgramNamedParameterfvNVPROC glGetProgramNamedParameterfvNV;
+extern glGetProgramNamedParameterdvNVPROC glGetProgramNamedParameterdvNV;
+
+#ifndef GL_ARB_vertex_program
+extern glProgramLocalParameter4dARBPROC glProgramLocalParameter4dARB;
+extern glProgramLocalParameter4dvARBPROC glProgramLocalParameter4dvARB;
+extern glProgramLocalParameter4fARBPROC glProgramLocalParameter4fARB;
+extern glProgramLocalParameter4fvARBPROC glProgramLocalParameter4fvARB;
+extern glGetProgramLocalParameterdvARBPROC glGetProgramLocalParameterdvARB;
+extern glGetProgramLocalParameterfvARBPROC glGetProgramLocalParameterfvARB;
+#endif /* GL_ARB_vertex_program */
+
+#endif /* GL_NV_fragment_program */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_NV_PRIMITIVE_RESTART--------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_primitive_restart
+#define GL_NV_primitive_restart 1
+
+#define GL_PRIMITIVE_RESTART_NV 0x8558
+#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559
+
+typedef void (APIENTRY * glPrimitiveRestartNVPROC) ();
+typedef void (APIENTRY * glPrimitiveRestartIndexNVPROC) (GLuint index);
+
+extern glPrimitiveRestartNVPROC glPrimitiveRestartNV;
+extern glPrimitiveRestartIndexNVPROC glPrimitiveRestartIndexNV;
+
+#endif /* GL_NV_primitive_restart */
+
+/*-------------------------------------------------------------------*/
+/*------------GL_NV_VERTEX_PROGRAM2----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef GL_NV_vertex_program2
+#define GL_NV_vertex_program2 1
+
+#endif /* GL_NV_vertex_program2 */
+
+/*-------------------------------------------------------------------*/
+/*------------END GL EXTENSIONS--------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------*/
+/*------------WGL EXTENSIONS HERE------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifdef _WIN32
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_EXT_EXTENSION_STRING-------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_EXT_extensions_string
+#define WGL_EXT_extensions_string 1
+
+typedef const char* (APIENTRY * wglGetExtensionsStringEXTPROC) ();
+
+extern wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT;
+
+#endif /* WGL_EXT_extensions_string */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_ARB_BUFFER_REGION----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_ARB_buffer_region
+#define WGL_ARB_buffer_region 1
+
+
+#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
+#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
+#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
+#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
+
+typedef HANDLE (APIENTRY * wglCreateBufferRegionARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
+typedef VOID (APIENTRY * wglDeleteBufferRegionARBPROC) (HANDLE hRegion);
+typedef BOOL (APIENTRY * wglSaveBufferRegionARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
+typedef BOOL (APIENTRY * wglRestoreBufferRegionARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
+
+extern wglCreateBufferRegionARBPROC wglCreateBufferRegionARB;
+extern wglDeleteBufferRegionARBPROC wglDeleteBufferRegionARB;
+extern wglSaveBufferRegionARBPROC wglSaveBufferRegionARB;
+extern wglRestoreBufferRegionARBPROC wglRestoreBufferRegionARB;
+
+#endif /* WGL_ARB_buffer_region */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_ARB_EXTENSION_STRING-------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_ARB_extensions_string
+#define WGL_ARB_extensions_string 1
+
+typedef const char* (APIENTRY * wglGetExtensionsStringARBPROC) (HDC hdc);
+
+extern wglGetExtensionsStringARBPROC wglGetExtensionsStringARB;
+
+#endif /* WGL_ARB_extensions_string */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_ARB_PBUFFER----------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_ARB_pbuffer
+#define WGL_ARB_pbuffer 1
+
+#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
+#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
+#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
+#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
+#define WGL_PBUFFER_LARGEST_ARB 0x2033
+#define WGL_PBUFFER_WIDTH_ARB 0x2034
+#define WGL_PBUFFER_HEIGHT_ARB 0x2035
+#define WGL_PBUFFER_LOST_ARB 0x2036
+
+DECLARE_HANDLE(HPBUFFERARB);
+
+typedef HPBUFFERARB (APIENTRY * wglCreatePbufferARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (APIENTRY * wglGetPbufferDCARBPROC) (HPBUFFERARB hPbuffer);
+typedef int (APIENTRY * wglReleasePbufferDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
+typedef BOOL (APIENTRY * wglDestroyPbufferARBPROC) (HPBUFFERARB hPbuffer);
+typedef BOOL (APIENTRY * wglQueryPbufferARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
+
+extern wglCreatePbufferARBPROC wglCreatePbufferARB;
+extern wglGetPbufferDCARBPROC wglGetPbufferDCARB;
+extern wglReleasePbufferDCARBPROC wglReleasePbufferDCARB;
+extern wglDestroyPbufferARBPROC wglDestroyPbufferARB;
+extern wglQueryPbufferARBPROC wglQueryPbufferARB;
+
+#endif /* WGL_ARB_pbuffer */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_ARB_PIXEL_FORMAT-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_ARB_pixel_format 1
+
+#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
+#define WGL_DRAW_TO_WINDOW_ARB 0x2001
+#define WGL_DRAW_TO_BITMAP_ARB 0x2002
+#define WGL_ACCELERATION_ARB 0x2003
+#define WGL_NEED_PALETTE_ARB 0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
+#define WGL_SWAP_METHOD_ARB 0x2007
+#define WGL_NUMBER_OVERLAYS_ARB 0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
+#define WGL_TRANSPARENT_ARB 0x200A
+#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
+#define WGL_SHARE_DEPTH_ARB 0x200C
+#define WGL_SHARE_STENCIL_ARB 0x200D
+#define WGL_SHARE_ACCUM_ARB 0x200E
+#define WGL_SUPPORT_GDI_ARB 0x200F
+#define WGL_SUPPORT_OPENGL_ARB 0x2010
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
+#define WGL_STEREO_ARB 0x2012
+#define WGL_PIXEL_TYPE_ARB 0x2013
+#define WGL_COLOR_BITS_ARB 0x2014
+#define WGL_RED_BITS_ARB 0x2015
+#define WGL_RED_SHIFT_ARB 0x2016
+#define WGL_GREEN_BITS_ARB 0x2017
+#define WGL_GREEN_SHIFT_ARB 0x2018
+#define WGL_BLUE_BITS_ARB 0x2019
+#define WGL_BLUE_SHIFT_ARB 0x201A
+#define WGL_ALPHA_BITS_ARB 0x201B
+#define WGL_ALPHA_SHIFT_ARB 0x201C
+#define WGL_ACCUM_BITS_ARB 0x201D
+#define WGL_ACCUM_RED_BITS_ARB 0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
+#define WGL_DEPTH_BITS_ARB 0x2022
+#define WGL_STENCIL_BITS_ARB 0x2023
+#define WGL_AUX_BUFFERS_ARB 0x2024
+#define WGL_NO_ACCELERATION_ARB 0x2025
+#define WGL_GENERIC_ACCELERATION_ARB 0x2026
+#define WGL_FULL_ACCELERATION_ARB 0x2027
+#define WGL_SWAP_EXCHANGE_ARB 0x2028
+#define WGL_SWAP_COPY_ARB 0x2029
+#define WGL_SWAP_UNDEFINED_ARB 0x202A
+#define WGL_TYPE_RGBA_ARB 0x202B
+#define WGL_TYPE_COLORINDEX_ARB 0x202C
+
+typedef BOOL (APIENTRY * wglGetPixelFormatAttribivARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
+typedef BOOL (APIENTRY * wglGetPixelFormatAttribfvARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
+typedef BOOL (APIENTRY * wglChoosePixelFormatARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+
+extern wglGetPixelFormatAttribivARBPROC wglGetPixelFormatAttribivARB;
+extern wglGetPixelFormatAttribfvARBPROC wglGetPixelFormatAttribfvARB;
+extern wglChoosePixelFormatARBPROC wglChoosePixelFormatARB;
+
+#endif /* WGL_ARB_pixel_format */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_ARB_RENDER_TEXTURE---------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_ARB_render_texture
+#define WGL_ARB_render_texture 1
+
+#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
+#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
+#define WGL_TEXTURE_FORMAT_ARB 0x2072
+#define WGL_TEXTURE_TARGET_ARB 0x2073
+#define WGL_MIPMAP_TEXTURE_ARB 0x2074
+#define WGL_TEXTURE_RGB_ARB 0x2075
+#define WGL_TEXTURE_RGBA_ARB 0x2076
+#define WGL_NO_TEXTURE_ARB 0x2077
+#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
+#define WGL_TEXTURE_1D_ARB 0x2079
+#define WGL_TEXTURE_2D_ARB 0x207A
+#define WGL_NO_TEXTURE_ARB 0x2077
+#define WGL_MIPMAP_LEVEL_ARB 0x207B
+#define WGL_CUBE_MAP_FACE_ARB 0x207C
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
+#define WGL_FRONT_LEFT_ARB 0x2083
+#define WGL_FRONT_RIGHT_ARB 0x2084
+#define WGL_BACK_LEFT_ARB 0x2085
+#define WGL_BACK_RIGHT_ARB 0x2086
+#define WGL_AUX0_ARB 0x2087
+#define WGL_AUX1_ARB 0x2088
+#define WGL_AUX2_ARB 0x2089
+#define WGL_AUX3_ARB 0x208A
+#define WGL_AUX4_ARB 0x208B
+#define WGL_AUX5_ARB 0x208C
+#define WGL_AUX6_ARB 0x208D
+#define WGL_AUX7_ARB 0x208E
+#define WGL_AUX8_ARB 0x208F
+#define WGL_AUX9_ARB 0x2090
+
+typedef BOOL (APIENTRY * wglBindTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (APIENTRY * wglReleaseTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (APIENTRY * wglSetPbufferAttribARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
+
+extern wglBindTexImageARBPROC wglBindTexImageARB;
+extern wglReleaseTexImageARBPROC wglReleaseTexImageARB;
+extern wglSetPbufferAttribARBPROC wglSetPbufferAttribARB;
+
+#endif /*WGL_ARB_render_texture */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_EXT_SWAP_CONTROL-----------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_EXT_swap_control
+#define WGL_EXT_swap_control 1
+
+typedef BOOL (APIENTRY * wglSwapIntervalEXTPROC) (int interval);
+typedef int (APIENTRY * wglGetSwapIntervalEXTPROC) (void);
+
+extern wglSwapIntervalEXTPROC wglSwapIntervalEXT;
+extern wglGetSwapIntervalEXTPROC wglGetSwapIntervalEXT;
+
+#endif /* WGL_EXT_swap_control */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_ARB_MAKE_CURRENT_READ------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_ARB_make_current_read
+#define WGL_ARB_make_current_read 1
+
+#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
+#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
+
+typedef BOOL (APIENTRY * wglMakeContextCurrentARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+typedef HDC (APIENTRY * wglGetCurrentReadDCARBPROC) (void);
+
+extern wglMakeContextCurrentARBPROC wglMakeContextCurrentARB;
+extern wglGetCurrentReadDCARBPROC wglGetCurrentReadDCARB;
+
+#endif /* WGL_ARB_make_current_read */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_ARB_MULTISAMPLE------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_ARB_multisample
+#define WGL_ARB_multisample 1
+
+#define WGL_SAMPLE_BUFFERS_ARB 0x2041
+#define WGL_SAMPLES_ARB 0x2042
+
+#endif /* WGL_ARB_multisample */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_NV_RENDER_DEPTH_TEXTURE----------------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_NV_render_depth_texture
+#define WGL_NV_render_depth_texture 1
+
+#define GL_WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
+#define GL_WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
+#define GL_WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
+#define GL_WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
+#define GL_WGL_NO_TEXTURE_ARB 0x2077
+#define GL_WGL_DEPTH_COMPONENT_NV 0x20A7
+
+#endif /* WGL_NV_render_depth_texture */
+
+/*-------------------------------------------------------------------*/
+/*------------WGL_NV_RENDER_TEXTURE_RECTANGLE-----------------------*/
+/*-------------------------------------------------------------------*/
+
+#ifndef WGL_NV_render_texture_rectangle
+#define WGL_NV_render_texture_rectangle 1
+
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
+#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
+
+#endif /* WGL_NV_render_texture_rectangle */
+
+/*-------------------------------------------------------------------*/
+/*------------END WGL EXTENSIONS-------------------------------------*/
+/*-------------------------------------------------------------------*/
+
+#endif /* WIN32 */
+
+/* helper stuff */
+
+/* I use int here because C does not know bool */
+
+#ifdef _WIN32
+
+struct WGLExtensionTypes
+{
+ int ARB_buffer_region;
+ int ARB_extensions_string;
+ int ARB_make_current_read;
+ int ARB_multisample;
+ int ARB_pbuffer;
+ int ARB_pixel_format;
+ int ARB_render_texture;
+ int EXT_extensions_string;
+ int EXT_swap_control;
+ int NV_render_depth_texture;
+ int NV_render_texture_rectangle;
+};
+
+#endif /* WIN32 */
+
+struct ExtensionTypes
+{
+#ifdef _WIN32 /* WGL extensions */
+ struct WGLExtensionTypes wgl;
+#endif /* WIN32 */
+ int ARB_imaging;
+ int ARB_depth_texture;
+ int ARB_matrix_palette;
+ int ARB_multisample;
+ int ARB_multitexture;
+ int ARB_point_parameters;
+ int ARB_shadow;
+ int ARB_shadow_ambient;
+ int ARB_texture_border_clamp;
+ int ARB_texture_compression;
+ int ARB_texture_cube_map;
+ int ARB_texture_env_add;
+ int ARB_texture_env_dot3;
+ int ARB_texture_env_combine;
+ int ARB_texture_env_crossbar;
+ int ARB_texture_mirrored_repeat;
+ int ARB_transpose_matrix;
+ int ARB_vertex_blend;
+ int ARB_vertex_program;
+ int ARB_window_pos;
+ int EXT_abgr;
+ int EXT_bgra;
+ int EXT_blend_func_separate;
+ int EXT_compiled_vertex_array;
+ int EXT_cull_vertex;
+ int EXT_fog_coord;
+ int EXT_multi_draw_arrays;
+ int EXT_point_parameters;
+ int EXT_secondary_color;
+ int EXT_separate_specular_color;
+ int EXT_shadow_funcs;
+ int EXT_stencil_two_side;
+ int EXT_stencil_wrap;
+ int EXT_texture_compression_s3tc;
+ int EXT_texture_filter_anisotropic;
+ int EXT_texture_lod_bias;
+ int EXT_vertex_shader;
+ int EXT_vertex_weighting;
+ int EXT_draw_range_elements;
+ int ATI_element_array;
+ int ATI_envmap_bumpmap;
+ int ATI_fragment_shader;
+ int ATI_pn_triangles;
+ int ATI_point_cull_mode;
+ int ATI_texture_mirror_once;
+ int ATI_vertex_array_object;
+ int ATI_vertex_streams;
+ int ATIX_point_sprites;
+ int ATIX_texture_env_route;
+ int HP_occlusion_test;
+ int NV_blend_square;
+ int NV_copy_depth_to_color;
+ int NV_depth_clamp;
+ int NV_element_array;
+ int NV_evaluators;
+ int NV_fence;
+ int NV_float_buffer;
+ int NV_fog_distance;
+ int NV_fragment_program;
+ int NV_light_max_exponent;
+ int NV_occlusion_query;
+ int NV_packed_depth_stencil;
+ int NV_point_sprite;
+ int NV_primitive_restart;
+ int NV_register_combiners;
+ int NV_register_combiners2;
+ int NV_texgen_reflection;
+ int NV_texture_env_combine4;
+ int NV_texture_rectangle;
+ int NV_texture_shader;
+ int NV_texture_shader2;
+ int NV_texture_shader3;
+ int NV_vertex_array_range;
+ int NV_vertex_array_range2;
+ int NV_vertex_program;
+ int NV_vertex_program1_1;
+ int NV_vertex_program2;
+ int SGIS_generate_mipmap;
+ int SGIX_shadow;
+ int SGIX_depth_texture;
+ int OpenGL12;
+ int OpenGL13;
+ int OpenGL14;
+};
+
+extern struct ExtensionTypes extgl_Extensions;
+
+extern struct ExtensionTypes SupportedExtensions; /* deprecated, please do not use */
+
+/* initializes everything, call this right after the rc is created. the function returns 0 if successful */
+int extgl_Initialize();
+
+int glInitialize(); /* deprecated, please do not use */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __EXTGL_H__ */
diff --git a/nebu/include/video/nebu_light.h b/nebu/include/video/nebu_light.h
new file mode 100644
index 0000000..be335a1
--- /dev/null
+++ b/nebu/include/video/nebu_light.h
@@ -0,0 +1,15 @@
+#ifndef NEBU_LIGHT_H
+#define NEBU_LIGHT_H
+
+void light4fv(float *f);
+void setColor3fv(float *f);
+void setColor4fv(float *f);
+void setEye3fv(float *f);
+void setFactor3fv(float *f);
+void setLight3fv(float *f);
+void setLight4fv(float *f);
+void setNormal3fv(float *f);
+void setVertex3f(float a, float b, float c);
+void setVertex3fv(float *f);
+
+#endif
diff --git a/nebu/include/video/nebu_png_texture.h b/nebu/include/video/nebu_png_texture.h
new file mode 100644
index 0000000..3bcbb9d
--- /dev/null
+++ b/nebu/include/video/nebu_png_texture.h
@@ -0,0 +1,16 @@
+#ifndef NEBU_PNG_TEXTURE_H
+#define NEBU_PNG_TEXTURE_H
+
+typedef struct {
+ int width;
+ int height;
+ int channels;
+ unsigned char *data;
+} png_texture;
+
+extern png_texture* load_png_texture(char *filename);
+extern void unload_png_texture(png_texture *tex);
+extern png_texture* mipmap_png_texture(png_texture *source, int level,
+ int clamp_u, int clamp_v);
+#endif
+
diff --git a/nebu/include/video/nebu_quad.h b/nebu/include/video/nebu_quad.h
new file mode 100644
index 0000000..f80bcc4
--- /dev/null
+++ b/nebu/include/video/nebu_quad.h
@@ -0,0 +1,90 @@
+#ifndef NEBU_QUAD_H
+#define NEBU_QUAD_H
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/*
+ this file holds datastructures for quads
+ they can be stored in Quad's and QuadBuffers for later processing
+ and rendering
+*/
+
+/* fixme: this is all very obsolete, use vertex buffers instead */
+
+typedef struct Vertex {
+ float v[3];
+ float color[4];
+ float uv[2];
+} Vertex;
+
+typedef struct Quad {
+ Vertex vertex[4];
+ int type;
+ int texture_id;
+} Quad;
+
+typedef struct Tris {
+ Vertex vertex[3];
+ int type;
+ int texture_id;
+} Tris;
+
+typedef struct QuadBuffer {
+ Quad *quads;
+ int size;
+ int current;
+} QuadBuffer;
+
+typedef struct QuadBufInfo {
+ QuadBuffer *qbuf;
+ int *qIndex;
+ int size;
+ int *qFlags;
+} QuadBufInfo;
+
+typedef struct TrisBuffer {
+ Tris *quads;
+ int size;
+ int current;
+} TrisBuffer;
+
+typedef struct TrisBufInfo {
+ TrisBuffer *qbuf;
+ int *qIndex;
+ int size;
+ int *qFlags;
+} TrisBufInfo;
+
+enum {
+ QUAD_COLOR = 1,
+ QUAD_TEXTURE = 2,
+ QUAD_TEX_MODULATE = 4,
+ QUAD_TEX_DECAL = 8,
+ QUAD_ALPHA_TEST = 16
+};
+
+/* quad.c */
+
+extern void q_setColor4fv( Quad *q, int index, float color[4] );
+extern void q_setColor3f( Quad *q, int index, float r, float g, float b);
+extern void q_setColor4f( Quad *q, int index, float r, float g, float b, float a);
+extern void q_setTexCoord2f( Quad *q, int index, float u, float v );
+extern void q_setVertex3f( Quad *q, int index, float x, float y, float z);
+extern void q_setType(Quad *q, int type);
+extern QuadBuffer* createQuadBuffer(int size);
+extern void freeQuadBuffer(QuadBuffer* q );
+extern Quad* getNextQuad(QuadBuffer* q);
+extern int getCurrentQuad(QuadBuffer* q);
+extern int getQuadBufferSize(QuadBuffer *q);
+extern void renderQuadAt(QuadBuffer *q, int *index, int i);
+
+/* quadbuf.c */
+extern int* getSortedQuads(QuadBuffer *q, float eye[3]);
+extern Quad* getQuadAt(QuadBuffer *q, int index);
+
+/* extern renderer_ lib must provide this */
+extern void renderQuad(Quad* q);
+#endif
+
diff --git a/nebu/include/video/nebu_renderer_gl.h b/nebu/include/video/nebu_renderer_gl.h
new file mode 100644
index 0000000..64bf0a4
--- /dev/null
+++ b/nebu/include/video/nebu_renderer_gl.h
@@ -0,0 +1,39 @@
+#ifndef NEBU_RENDERER_GL_H
+#define NEBU_RENDERER_GL_H
+
+#include "SDL_opengl.h"
+#include <stdio.h>
+#include "video/nebu_quad.h"
+
+#define POLY_COUNT
+
+#define RENDERER_TYPE_ALL 255
+#define RENDERER_TYPE_COLOR 1
+#define RENDERER_TYPE_NORMAL 2
+#define RENDERER_TYPE_TEXTURE_COORD 4
+#define RENDERER_TYPE_TEXTURE 8
+#define RENDERER_TYPE_TEXTURE_MODE 16
+
+extern void initRenderer();
+extern void printRendererInfo();
+extern void renderQuad(Quad *q);
+extern void renderTris(Tris *q);
+extern void clearState();
+
+typedef struct GLstate {
+ int tex_id; /* current texture */
+ int tex_env_mode; /* current texture env mode */
+ int binds; /* texture bind changes - used for statistics only */
+ int mod_changes; /* mode changes - used for statistics only */
+ int type_mask; /* which modes to change */
+} GLstate;
+
+typedef struct Renderer {
+ /* shows capabilities of the renderer */
+ int ext_filter_anisotropic;
+} Renderer;
+
+extern Renderer renderer;
+extern GLstate *state;
+
+#endif
diff --git a/nebu/include/video/nebu_video_system.h b/nebu/include/video/nebu_video_system.h
new file mode 100644
index 0000000..ade5f85
--- /dev/null
+++ b/nebu/include/video/nebu_video_system.h
@@ -0,0 +1,27 @@
+#ifndef NEBU_VIDEO_SYSTEM_H
+#define NEBU_VIDEO_SYSTEM_H
+
+#define SYSTEM_RGBA 1
+#define SYSTEM_DOUBLE 2
+#define SYSTEM_DEPTH 4
+#define SYSTEM_FULLSCREEN 8
+#define SYSTEM_32_BIT 16
+#define SYSTEM_STENCIL 32
+
+extern void SystemPostRedisplay();
+
+extern void SystemSwapBuffers();
+extern void SystemWarpPointer(int x, int y);
+extern void SystemHidePointer();
+extern void SystemUnhidePointer();
+
+extern void SystemSetGamma(float r, float g, float b);
+extern void SystemInitWindow(int x, int y, int w, int h);
+extern void SystemInitDisplayMode(int flags, unsigned char fullscreen);
+extern int SystemCreateWindow(char *name);
+extern void SystemDestroyWindow(int id);
+extern void SystemReshapeFunc(void(*reshape)(int, int));
+
+extern int SystemWriteBMP(char *filename, int x, int y, unsigned char *pixels);
+
+#endif
diff --git a/nebu/include/video/nebu_video_types.h b/nebu/include/video/nebu_video_types.h
new file mode 100644
index 0000000..dece5ee
--- /dev/null
+++ b/nebu/include/video/nebu_video_types.h
@@ -0,0 +1,15 @@
+#ifndef NEBU_VIDEO_TYPES_H
+#define NEBU_VIDEO_TYPES_H
+
+typedef struct {
+ int win_id; /* only the root visual has an id */
+ int h, w; /* window dimension */
+ int vp_x, vp_y; /* viewport position */
+ int vp_h, vp_w; /* viewport dimension */
+
+ int onScreen;
+
+ unsigned int *textures; /* texture IDs */
+} Visual;
+
+#endif
diff --git a/nebu/input/Makefile.am b/nebu/input/Makefile.am
new file mode 100644
index 0000000..f15445f
--- /dev/null
+++ b/nebu/input/Makefile.am
@@ -0,0 +1,8 @@
+noinst_LIBRARIES=libinput.a
+
+libinput_a_SOURCES= \
+ system_keynames.c input_system.c
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include
diff --git a/nebu/input/Makefile.in b/nebu/input/Makefile.in
new file mode 100644
index 0000000..c4e910a
--- /dev/null
+++ b/nebu/input/Makefile.in
@@ -0,0 +1,297 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libinput.a
+
+libinput_a_SOURCES = \
+ system_keynames.c input_system.c
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include
+
+subdir = nebu/input
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libinput_a_AR = $(AR) cru
+libinput_a_LIBADD =
+am_libinput_a_OBJECTS = system_keynames.$(OBJEXT) input_system.$(OBJEXT)
+libinput_a_OBJECTS = $(am_libinput_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/input_system.Po \
+@AMDEP_TRUE@ $(DEPDIR)/system_keynames.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libinput_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libinput_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/input/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libinput.a: $(libinput_a_OBJECTS) $(libinput_a_DEPENDENCIES)
+ -rm -f libinput.a
+ $(libinput_a_AR) libinput.a $(libinput_a_OBJECTS) $(libinput_a_LIBADD)
+ $(RANLIB) libinput.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/input_system.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/system_keynames.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/input/input_system.c b/nebu/input/input_system.c
new file mode 100644
index 0000000..5b934e2
--- /dev/null
+++ b/nebu/input/input_system.c
@@ -0,0 +1,167 @@
+#include "input/nebu_input_system.h"
+#include "input/nebu_system_keynames.h"
+#include "base/nebu_system.h"
+#include "scripting/nebu_scripting.h"
+
+#include "SDL.h"
+#include <stdlib.h>
+
+static float joystick_threshold = 0;
+
+void SystemGrabInput() {
+ SDL_WM_GrabInput(SDL_GRAB_ON);
+}
+
+void SystemUngrabInput() {
+ SDL_WM_GrabInput(SDL_GRAB_OFF);
+}
+
+void SystemWarpPointer(int x, int y) {
+ SDL_WarpMouse(x, y);
+}
+
+void SystemHidePointer() {
+ SDL_ShowCursor(SDL_DISABLE);
+}
+
+void SystemUnhidePointer() {
+ SDL_ShowCursor(SDL_ENABLE);
+}
+
+void SystemMouse(int buttons, int state, int x, int y) {
+ if(current)
+ if(current->mouse != NULL)
+ current->mouse(buttons, state, x, y);
+}
+
+void SystemMouseMotion(int x, int y) {
+ if(current)
+ if(current->mouseMotion != NULL)
+ current->mouseMotion(x, y);
+}
+
+extern char* SystemGetKeyName(int key) {
+ if(key < SYSTEM_CUSTOM_KEYS)
+ return SDL_GetKeyName(key);
+ else {
+ int i;
+
+ for(i = 0; i < CUSTOM_KEY_COUNT; i++) {
+ if(custom_keys.key[i].key == key)
+ return custom_keys.key[i].name;
+ }
+ return "unknown custom key";
+ }
+}
+
+void SystemHandleInput(SDL_Event *event) {
+ char *keyname;
+ int key, state;
+ // int skip_axis_event = 0;
+ static int joy_axis_state[2] = { 0, 0 };
+ static int joy_lastaxis[2] = { 0, 0 };
+
+ switch(event->type) {
+ case SDL_KEYDOWN:
+ case SDL_KEYUP:
+ if(event->type == SDL_KEYDOWN) {
+ state = SYSTEM_KEYSTATE_DOWN;
+ } else {
+ state = SYSTEM_KEYSTATE_UP;
+ }
+
+ keyname = SDL_GetKeyName(event->key.keysym.sym);
+ key = 0;
+ switch(event->key.keysym.sym) {
+ case SDLK_SPACE: key = ' '; break;
+ case SDLK_ESCAPE: key = 27; break;
+ case SDLK_RETURN: key = 13; break;
+ default:
+ if(keyname[1] == 0) key = keyname[0];
+ break;
+ }
+ /* check: is that translation necessary? */
+ if(key)
+ current->keyboard(state, key, 0, 0);
+ else
+ current->keyboard(state, event->key.keysym.sym, 0, 0);
+ break;
+ case SDL_JOYAXISMOTION:
+ if( abs(event->jaxis.value) <= joystick_threshold * SYSTEM_JOY_AXIS_MAX) {
+ // axis returned to origin, only generate event if it was set before
+ if(joy_axis_state[event->jaxis.which] & (1 << event->jaxis.axis)) {
+ joy_axis_state[event->jaxis.which] &= ~
+ (1 << event->jaxis.axis); // clear axis
+ key = SYSTEM_JOY_LEFT + event->jaxis.which * SYSTEM_JOY_OFFSET;
+ if(event->jaxis.axis == 1) {
+ key += 2;
+ }
+ if(joy_lastaxis[event->jaxis.which] & (1 << event->jaxis.axis)) {
+ key++;
+ }
+ current->keyboard(SYSTEM_KEYSTATE_UP, key, 0, 0);
+ } else {
+ // do nothing
+ }
+ } else {
+ // axis set, only generate event if it wasn't set before
+ if(! (joy_axis_state[event->jaxis.which] & (1 << event->jaxis.axis)) ) {
+ joy_axis_state[event->jaxis.which] |= (1 << event->jaxis.axis);
+ key = SYSTEM_JOY_LEFT + event->jaxis.which * SYSTEM_JOY_OFFSET;
+ if(event->jaxis.axis == 1) {
+ key += 2;
+ }
+ if(event->jaxis.value > 0) {
+ key++;
+ joy_lastaxis[event->jaxis.which] |= (1 << event->jaxis.axis);
+ } else {
+ joy_lastaxis[event->jaxis.which] &= ~(1 << event->jaxis.axis);
+ }
+ current->keyboard(SYSTEM_KEYSTATE_DOWN, key, 0, 0);
+ } else {
+ // do nothing
+ }
+ }
+ break;
+
+#if 0
+ if (abs(event->jaxis.value) <= joystick_threshold * SYSTEM_JOY_AXIS_MAX) {
+ skip_axis_event &= ~(1 << event->jaxis.axis);
+ break;
+ }
+ if(skip_axis_event & (1 << event->jaxis.axis))
+ break;
+ skip_axis_event |= 1 << event->jaxis.axis;
+ key = SYSTEM_JOY_LEFT + event->jaxis.which * SYSTEM_JOY_OFFSET;
+ if(event->jaxis.axis == 1)
+ key += 2;
+ if(event->jaxis.value > 0)
+ key++;
+ current->keyboard(SYSTEM_KEYSTATE_DOWN, key, 0, 0);
+ break;
+#endif
+ case SDL_JOYBUTTONDOWN:
+ case SDL_JOYBUTTONUP:
+ if(event->type == SDL_JOYBUTTONDOWN)
+ state = SYSTEM_KEYSTATE_DOWN;
+ else
+ state = SYSTEM_KEYSTATE_UP;
+
+ key = SYSTEM_JOY_BUTTON_0 + event->jbutton.button +
+ SYSTEM_JOY_OFFSET * event->jbutton.which;
+ current->keyboard(state, key, 0, 0);
+ break;
+ case SDL_MOUSEBUTTONDOWN:
+ case SDL_MOUSEBUTTONUP:
+ SystemMouse(event->button.button, event->button.state,
+ event->button.x, event->button.y);
+ break;
+ case SDL_MOUSEMOTION:
+ SystemMouseMotion(event->motion.x, event->motion.y);
+ break;
+ }
+}
+
+void SystemSetJoyThreshold(float f) {
+ joystick_threshold = f;
+}
diff --git a/nebu/input/system_keynames.c b/nebu/input/system_keynames.c
new file mode 100644
index 0000000..4f58d75
--- /dev/null
+++ b/nebu/input/system_keynames.c
@@ -0,0 +1,55 @@
+#include "input/nebu_system_keynames.h"
+#include "input/nebu_input_system.h"
+
+custom_keynames custom_keys = {
+ {
+ { SYSTEM_JOY_LEFT, "joy0 left" },
+ { SYSTEM_JOY_RIGHT, "joy0 right" },
+ { SYSTEM_JOY_UP, "joy0 up" },
+ { SYSTEM_JOY_DOWN, "joy0 down" },
+ { SYSTEM_JOY_BUTTON_0, "joy0 button 0" },
+ { SYSTEM_JOY_BUTTON_1, "joy0 button 1" },
+ { SYSTEM_JOY_BUTTON_2, "joy0 button 2" },
+ { SYSTEM_JOY_BUTTON_3, "joy0 button 3" },
+ { SYSTEM_JOY_BUTTON_4, "joy0 button 4" },
+ { SYSTEM_JOY_BUTTON_5, "joy0 button 5" },
+ { SYSTEM_JOY_BUTTON_6, "joy0 button 6" },
+ { SYSTEM_JOY_BUTTON_7, "joy0 button 7" },
+ { SYSTEM_JOY_BUTTON_8, "joy0 button 8" },
+ { SYSTEM_JOY_BUTTON_9, "joy0 button 9" },
+ { SYSTEM_JOY_BUTTON_10, "joy0 button 10" },
+ { SYSTEM_JOY_BUTTON_11, "joy0 button 11" },
+ { SYSTEM_JOY_BUTTON_12, "joy0 button 12" },
+ { SYSTEM_JOY_BUTTON_13, "joy0 button 13" },
+ { SYSTEM_JOY_BUTTON_14, "joy0 button 14" },
+ { SYSTEM_JOY_BUTTON_15, "joy0 button 15" },
+ { SYSTEM_JOY_BUTTON_16, "joy0 button 16" },
+ { SYSTEM_JOY_BUTTON_17, "joy0 button 17" },
+ { SYSTEM_JOY_BUTTON_18, "joy0 button 18" },
+ { SYSTEM_JOY_BUTTON_19, "joy0 button 19" },
+ { SYSTEM_JOY_LEFT + SYSTEM_JOY_OFFSET, "joy1 left" },
+ { SYSTEM_JOY_RIGHT + SYSTEM_JOY_OFFSET, "joy1 right" },
+ { SYSTEM_JOY_UP + SYSTEM_JOY_OFFSET, "joy1 up" },
+ { SYSTEM_JOY_DOWN + SYSTEM_JOY_OFFSET, "joy1 down" },
+ { SYSTEM_JOY_BUTTON_0 + SYSTEM_JOY_OFFSET, "joy1 button 0" },
+ { SYSTEM_JOY_BUTTON_1 + SYSTEM_JOY_OFFSET, "joy1 button 1" },
+ { SYSTEM_JOY_BUTTON_2 + SYSTEM_JOY_OFFSET, "joy1 button 2" },
+ { SYSTEM_JOY_BUTTON_3 + SYSTEM_JOY_OFFSET, "joy1 button 3" },
+ { SYSTEM_JOY_BUTTON_4 + SYSTEM_JOY_OFFSET, "joy1 button 4" },
+ { SYSTEM_JOY_BUTTON_5 + SYSTEM_JOY_OFFSET, "joy1 button 5" },
+ { SYSTEM_JOY_BUTTON_6 + SYSTEM_JOY_OFFSET, "joy1 button 6" },
+ { SYSTEM_JOY_BUTTON_7 + SYSTEM_JOY_OFFSET, "joy1 button 7" },
+ { SYSTEM_JOY_BUTTON_8 + SYSTEM_JOY_OFFSET, "joy1 button 8" },
+ { SYSTEM_JOY_BUTTON_9 + SYSTEM_JOY_OFFSET, "joy1 button 9" },
+ { SYSTEM_JOY_BUTTON_10 + SYSTEM_JOY_OFFSET, "joy1 button 10" },
+ { SYSTEM_JOY_BUTTON_11 + SYSTEM_JOY_OFFSET, "joy1 button 11" },
+ { SYSTEM_JOY_BUTTON_12 + SYSTEM_JOY_OFFSET, "joy1 button 12" },
+ { SYSTEM_JOY_BUTTON_13 + SYSTEM_JOY_OFFSET, "joy1 button 13" },
+ { SYSTEM_JOY_BUTTON_14 + SYSTEM_JOY_OFFSET, "joy1 button 14" },
+ { SYSTEM_JOY_BUTTON_15 + SYSTEM_JOY_OFFSET, "joy1 button 15" },
+ { SYSTEM_JOY_BUTTON_16 + SYSTEM_JOY_OFFSET, "joy1 button 16" },
+ { SYSTEM_JOY_BUTTON_17 + SYSTEM_JOY_OFFSET, "joy1 button 17" },
+ { SYSTEM_JOY_BUTTON_18 + SYSTEM_JOY_OFFSET, "joy1 button 18" },
+ { SYSTEM_JOY_BUTTON_19 + SYSTEM_JOY_OFFSET, "joy1 button 19" }
+ }
+};
diff --git a/nebu/scripting/Makefile.am b/nebu/scripting/Makefile.am
new file mode 100644
index 0000000..b4a9e9b
--- /dev/null
+++ b/nebu/scripting/Makefile.am
@@ -0,0 +1,15 @@
+noinst_LIBRARIES=libscripting.a
+
+libscripting_a_SOURCES= \
+ scripting.c
+
+libscripting_a_LIBADD= \
+ $(top_builddir)/lua/src/liblua.a \
+ $(top_builddir)/lua/src/lib/liblualib.a
+ # @top_srcdir@/lua/src/liblua.a \
+ # @top_srcdir@/lua/src/lib/liblualib.a
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/nebu/include/base \
+ -I$(top_srcdir)/nebu/include/scripting \
+ -I$(top_srcdir)/lua/include
diff --git a/nebu/scripting/Makefile.in b/nebu/scripting/Makefile.in
new file mode 100644
index 0000000..0a137e1
--- /dev/null
+++ b/nebu/scripting/Makefile.in
@@ -0,0 +1,304 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libscripting.a
+
+libscripting_a_SOURCES = \
+ scripting.c
+
+
+libscripting_a_LIBADD = \
+ $(top_builddir)/lua/src/liblua.a \
+ $(top_builddir)/lua/src/lib/liblualib.a
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/nebu/include/base \
+ -I$(top_srcdir)/nebu/include/scripting \
+ -I$(top_srcdir)/lua/include
+
+subdir = nebu/scripting
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libscripting_a_AR = $(AR) cru
+libscripting_a_DEPENDENCIES = $(top_builddir)/lua/src/liblua.a \
+ $(top_builddir)/lua/src/lib/liblualib.a
+am_libscripting_a_OBJECTS = scripting.$(OBJEXT)
+libscripting_a_OBJECTS = $(am_libscripting_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/scripting.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libscripting_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libscripting_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/scripting/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libscripting.a: $(libscripting_a_OBJECTS) $(libscripting_a_DEPENDENCIES)
+ -rm -f libscripting.a
+ $(libscripting_a_AR) libscripting.a $(libscripting_a_OBJECTS) $(libscripting_a_LIBADD)
+ $(RANLIB) libscripting.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/scripting.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+ # @top_srcdir@/lua/src/liblua.a \
+ # @top_srcdir@/lua/src/lib/liblualib.a
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/scripting/scripting.c b/nebu/scripting/scripting.c
new file mode 100644
index 0000000..e26bc77
--- /dev/null
+++ b/nebu/scripting/scripting.c
@@ -0,0 +1,200 @@
+#include "nebu_scripting.h"
+
+#include "lua.h"
+#include "lualib.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+// static lua_State *L;
+lua_State *L;
+
+extern void init_c_interface(lua_State *L);
+
+void scripting_Init() {
+ L = lua_open(0);
+ lua_baselibopen(L);
+ lua_strlibopen(L);
+ lua_iolibopen(L);
+
+ // init_c_interface(L);
+}
+
+void scripting_Quit() {
+ lua_close(L);
+}
+
+
+void showStack() {
+ int i;
+ printf("dumping stack with %d elements\n", lua_gettop(L));
+ for(i = 0; i < lua_gettop(L); i++) {
+ int type = lua_type(L, - (i+1));
+ switch(type) {
+ case LUA_TNIL: printf("nil\n"); break;
+ case LUA_TNUMBER: printf("number\n"); break;
+ case LUA_TSTRING: printf("string\n"); break;
+ case LUA_TTABLE: printf("table\n"); break;
+ case LUA_TFUNCTION: printf("function\n"); break;
+ case LUA_TUSERDATA: printf("userdata\n"); break;
+ }
+ }
+}
+
+int scripting_IsNilResult() {
+ int result = lua_isnil(L, -1);
+ lua_pop(L, 1);
+ return result;
+}
+
+int getGlobal(const char *s, va_list ap) {
+ int top = lua_gettop(L);
+ int count = 0;
+ while(s) {
+ lua_pushstring(L, s);
+ lua_gettable(L, -2);
+ count++;
+ s = va_arg(ap, char *);
+ }
+ lua_insert(L, top); /* move result to bottom */
+ lua_pop(L, count); /* restore stack */
+ return 0;
+}
+
+int scripting_GetGlobal(const char *global, const char *s, ...) {
+ lua_getglobal(L, global);
+ if(s) {
+ va_list ap;
+ va_start(ap, s);
+ getGlobal(s, ap);
+ va_end(ap);
+ }
+ return 0;
+}
+
+int scripting_SetFloat(float f, const char *name, const char *global, const char *s, ...) {
+ va_list ap;
+
+ if(global == NULL) {
+ lua_pushnumber(L, f);
+ lua_setglobal(L, global);
+ return 0;
+ }
+
+ lua_getglobal(L, global);
+
+ if(s) {
+ va_start(ap, s);
+ getGlobal(s, ap);
+ va_end(ap);
+ }
+
+ lua_pushstring(L, name);
+ lua_pushnumber(L, f);
+ lua_settable(L, -3);
+ lua_pop(L, 1);
+
+ return 0;
+}
+
+int scripting_GetFloatResult(float *f) {
+ if(lua_isnumber(L, -1)) {
+ *f = lua_tonumber(L, -1);
+ lua_pop(L, 1); /* restore stack */
+ return 0;
+ } else {
+ showStack();
+ return 1;
+ }
+}
+
+int scripting_GetIntegerResult(int *i) {
+ if(lua_isnumber(L, -1)) {
+ *i = (int)lua_tonumber(L, -1);
+ lua_pop(L, 1); /* restore stack */
+ return 0;
+ } else {
+ showStack();
+ return 1;
+ }
+}
+
+void scripting_GetFloatArrayResult(float *f, int n) {
+ int i;
+
+ for(i = 0; i < n; i++) {
+ lua_rawgeti(L, -1, i + 1);
+ if(lua_isnumber(L, -1)) {
+ *(f + i) = (float)lua_tonumber(L, 2);
+ } else {
+ fprintf(stderr, "element %d is not number!\n", i);
+ }
+ lua_pop(L, 1); /* remove number from stack */
+ }
+
+ lua_pop(L, 1); /* remove table from stack */
+}
+
+int scripting_GetStringResult(char **s) {
+ int status;
+ if(lua_isstring(L, -1)) {
+ int size;
+ status = 0;
+ size = lua_strlen(L, -1) + 1;
+ *s = malloc( size );
+ memcpy( *s, lua_tostring(L, -1), size );
+ /* printf("allocated string '%s' of size %d\n", *s, size); */
+ } else
+ status = 1;
+
+ lua_pop(L, 1);
+ return status;
+}
+
+int scripting_CopyStringResult(char *s, int len) {
+ int status;
+ if(lua_isstring(L, -1)) {
+ int size, copy;
+ status = 0;
+ size = lua_strlen(L, -1) + 1;
+ if(size > len) { copy = len; status = 2; }
+ else copy = size;
+ memcpy( s, lua_tostring(L, -1), size );
+ } else
+ status = 1;
+
+ lua_pop(L, 1);
+ return status;
+}
+
+void scripting_RunFile(char *name) {
+ lua_dofile(L, name);
+}
+
+void scripting_Run(char *command) {
+ /* fprintf(stderr, "[command] %s\n", command); */
+ lua_dostring(L, command);
+}
+
+void scripting_RunFormat(char *format, ... ) {
+ char buf[4096];
+ va_list ap;
+ va_start(ap, format);
+ vsprintf(buf, format, ap);
+ va_end(ap);
+ scripting_Run(buf);
+}
+
+void scripting_RunGC() {
+ lua_setgcthreshold(L, 0);
+}
+
+void Scripting_Idle() {
+ scripting_RunGC();
+}
+
+void scripting_Register(const char *name, int(*func) (lua_State *L)) {
+ lua_register(L, name, func);
+}
diff --git a/nebu/video/Makefile.am b/nebu/video/Makefile.am
new file mode 100644
index 0000000..fe747b3
--- /dev/null
+++ b/nebu/video/Makefile.am
@@ -0,0 +1,8 @@
+noinst_LIBRARIES=libvideo.a
+
+libvideo_a_SOURCES= \
+ console.c pixels.c \
+ png_texture.c video_system.c
+
+AM_CFLAGS= \
+ -I$(top_srcdir)/nebu/include
diff --git a/nebu/video/Makefile.in b/nebu/video/Makefile.in
new file mode 100644
index 0000000..a90bdc0
--- /dev/null
+++ b/nebu/video/Makefile.in
@@ -0,0 +1,300 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libvideo.a
+
+libvideo_a_SOURCES = \
+ console.c pixels.c \
+ png_texture.c video_system.c
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/nebu/include
+
+subdir = nebu/video
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libvideo_a_AR = $(AR) cru
+libvideo_a_LIBADD =
+am_libvideo_a_OBJECTS = console.$(OBJEXT) pixels.$(OBJEXT) \
+ png_texture.$(OBJEXT) video_system.$(OBJEXT)
+libvideo_a_OBJECTS = $(am_libvideo_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/console.Po $(DEPDIR)/pixels.Po \
+@AMDEP_TRUE@ $(DEPDIR)/png_texture.Po $(DEPDIR)/video_system.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libvideo_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libvideo_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign nebu/video/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libvideo.a: $(libvideo_a_OBJECTS) $(libvideo_a_DEPENDENCIES)
+ -rm -f libvideo.a
+ $(libvideo_a_AR) libvideo.a $(libvideo_a_OBJECTS) $(libvideo_a_LIBADD)
+ $(RANLIB) libvideo.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/console.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pixels.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/png_texture.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/video_system.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nebu/video/console.c b/nebu/video/console.c
new file mode 100644
index 0000000..40f2e12
--- /dev/null
+++ b/nebu/video/console.c
@@ -0,0 +1,103 @@
+#include "video/nebu_console.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#define CONSOLE_DEPTH 100
+#define CONSOLE_WIDTH 80
+
+static char buffer[CONSOLE_DEPTH][CONSOLE_WIDTH];
+static int position;
+static int offset;
+
+void consoleInit() {
+ int i;
+
+ for(i = 0; i < CONSOLE_DEPTH; i++)
+ buffer[i][0] = '\0';
+
+ position = 0;
+ offset = 0;
+ // fprintf(stderr, "console initialized\n");
+}
+
+void consoleAddLine(char *text) {
+ int i = 0, x=0;
+
+ while(i < CONSOLE_WIDTH - 1 && text[i] != 0) {
+ buffer[position][i] = text[i];
+ i++;
+ }
+ buffer[position][i] = '\0';
+/* fprintf(stderr, "added \"%s\" to console at buffer[%i] with "
+ * " offset of %i\n",
+ * buffer[position], position, offset);
+ */
+
+ position++;
+
+ /* reposition the buffer to avoid overruns - tim */
+ if(position >= 99){
+ for(i=0;i<CONSOLE_DEPTH;i++){
+ strcpy(buffer[x], buffer[i]);
+ buffer[i][0] = '\0';
+ ++x;
+ }
+ position -= 4;
+ }
+}
+
+void consoleDisplay(void(*func)(char *line, int call), int height) {
+ int i;
+ int j = 0;
+ for(i = 0; i < height; i++) {
+ if(*(buffer[ (position + i - height - offset +
+ CONSOLE_DEPTH) % CONSOLE_DEPTH ]) != 0)
+ func(buffer[ (position + i - height - offset +
+ CONSOLE_DEPTH) % CONSOLE_DEPTH ], j++);
+ }
+}
+
+void consoleScrollForward(int range) {
+ offset -= range;
+ if(offset < 0) offset = 0;
+}
+
+void consoleScrollBackward(int range) {
+ offset += range;
+ if(offset > CONSOLE_DEPTH - 1)
+ offset = CONSOLE_DEPTH - 1;
+}
+
+/*
+ displayMessage
+
+ post a message to the console and/or stdout/stderr.
+
+ NOTE: Don't put newlines at the end of the format string,
+ the function will handle adding them when appropriate.
+ */
+void displayMessage(outloc_e where, const char *fmt_str, ...) {
+
+ char message[CONSOLE_WIDTH];
+ va_list ap;
+
+ va_start(ap, fmt_str);
+
+ if (where & TO_CONSOLE) {
+ vsprintf(message, fmt_str, ap);
+ consoleAddLine(message);
+ }
+
+ if (where & TO_STDOUT) {
+ vfprintf(stdout, fmt_str, ap);
+ fputc('\n', stdout);
+ }
+
+ if (where & TO_STDERR) {
+ vfprintf(stderr, fmt_str, ap);
+ fputc('\n', stderr);
+ }
+}
+
diff --git a/nebu/video/pixels.c b/nebu/video/pixels.c
new file mode 100644
index 0000000..b82c170
--- /dev/null
+++ b/nebu/video/pixels.c
@@ -0,0 +1,84 @@
+#include <stdlib.h>
+
+unsigned char *scalePixelBitmap(unsigned char *source, int sw, int sh,
+ int posx, int posy, int width, int height,
+ int dw, int dh, int bytes) {
+ int x, y;
+ unsigned char *data;
+ unsigned char byte;
+ int i;
+
+ int row;
+
+ row = dw / 8;
+ if(dw % 8) row++;
+
+ data = (unsigned char*) malloc( row * dh );
+ for(y = 0; y < dh; y++) {
+ byte = 0;
+ for(x = 0; x < dw; x++) {
+ int sx, sy;
+ sx = posx + ((x * width) / dw);
+ sy = posy + ((y * height) / dh);
+ for(i = 0; (i < bytes) && (i < 3); i++) {
+ if(source[bytes * (sx + sy * sw) + i] != 0) {
+ /* printf("source value: (%d %d, %d): %d\n",
+ sx, sy, i, source[bytes * (sx + sy * sw) + i]); */
+ byte |= (1 << (x % 8) );
+ break;
+ } else {
+ /* printf("source value: (%d %d, %d): %d\n",
+ sx, sy, i, source[bytes * (sx + sy * sw) + i]); */
+ }
+ }
+ if((x % 8) == 7) {
+ data[x / 8 + y * row] = byte;
+ }
+ }
+ if(x % 8)
+ data[x / 8 + y * row] = byte;
+ byte = 0;
+ }
+ return data;
+}
+
+unsigned char *scalePixels(const unsigned char *source, int sw, int sh,
+ int posx, int posy, int width, int height,
+ int dw, int dh, int bytes) {
+ int x, y;
+ unsigned char *data;
+ /*
+ fprintf(stderr, "scaling from (%d,%d-%d,%d) in a (%d, %d)"
+ "to (%d,%d), bytes: %d\n", posx, posy, posx + width, posy + width,
+ sw, sh, dw, dh, bytes);
+ */
+ data = (unsigned char*) malloc( dw * dh * bytes );
+ for(y = 0; y < dh; y++) {
+ for(x = 0; x < dw; x++) {
+ int sx, sy, j;
+ int sx2, sy2;
+
+ sx = posx + ((x * width) / dw);
+ sy = posy + ((y * height) / dh);
+ (sx == sw - 1) ? (sx2 = sx - 1) : (sx2 = sx + 1);
+ (sy == sh - 1) ? (sy2 = sy - 1) : (sy2 = sy + 1);
+ /* printf("%d, %d to %d, %d\n", x, y, sx, sy); */
+ for(j = 0; j < bytes; j++) {
+ data[bytes * (x + y * dw) + j] =
+ (source[bytes * (sx + sy * sw) + j] +
+ source[bytes * (sx2 + sy * sw) + j] +
+ source[bytes * (sx + sy2 * sw) + j] +
+ source[bytes * (sx2 + sy2 * sw) + j]) / 4;
+ }
+ }
+ }
+ return data;
+}
+
+
+
+
+
+
+
+
diff --git a/nebu/video/png_texture.c b/nebu/video/png_texture.c
new file mode 100644
index 0000000..0721523
--- /dev/null
+++ b/nebu/video/png_texture.c
@@ -0,0 +1,157 @@
+#include "video/nebu_png_texture.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#if !defined(WIN32) && !defined(macintosh)
+#include <unistd.h>
+#endif
+
+#define ERR_PREFIX "[load_png_texture] "
+
+#include <png.h>
+
+FILE *f;
+
+void user_read_data(png_structp png_ptr,
+ png_bytep data, png_size_t length) {
+ fread(data, 1, length, f);
+}
+
+png_texture* load_png_texture(char *filename) {
+ unsigned int i;
+ int bpc, color_type, zsize;
+
+ png_texture *tex;
+ /* the following is defined in <png.h> */
+ png_uint_32 x, y;
+ png_structp png_ptr;
+ png_infop info_ptr;
+ png_byte **row_pointers;
+
+ f = fopen(filename, "rb");
+ if(f == NULL) {
+ fprintf(stderr, ERR_PREFIX "can't open file %s\n", filename);
+ return NULL;
+ }
+
+ png_ptr = png_create_read_struct
+ (PNG_LIBPNG_VER_STRING, 0, 0, 0);
+
+ if (!png_ptr)
+ return NULL;
+
+ info_ptr = png_create_info_struct(png_ptr);
+ if (!info_ptr){
+ png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
+ return NULL;
+ }
+
+ /* png_init_io(png_ptr, f);
+ fprintf(stderr, "png, after init io \n"); */
+
+ /* I need to do this, otherwise it crashes on win32 */
+ png_set_read_fn(png_ptr, 0, user_read_data);
+ /* fprintf(stderr, "png, after init user_read_data\n"); */
+
+ png_read_info(png_ptr, info_ptr);
+ /* fprintf(stderr, "png, after read info \n"); */
+ png_get_IHDR(png_ptr, info_ptr, &x, &y, &bpc, &color_type, 0, 0, 0);
+
+ if(color_type != PNG_COLOR_TYPE_RGB &&
+ color_type != PNG_COLOR_TYPE_RGB_ALPHA) {
+ png_destroy_read_struct(&png_ptr, &info_ptr, 0);
+ fprintf(stderr, ERR_PREFIX "wrong png_color_type\n");
+ fclose(f);
+ return NULL;
+ }
+
+ if(bpc != 8) {
+ png_destroy_read_struct(&png_ptr, &info_ptr, 0);
+ fprintf(stderr, ERR_PREFIX "wrong bitdepth: %d\n", bpc);
+ fclose(f);
+ return NULL;
+ }
+
+ switch(color_type) {
+ case PNG_COLOR_TYPE_RGB: zsize = 3; break;
+ case PNG_COLOR_TYPE_RGB_ALPHA: zsize = 4; break;
+ default:
+ fprintf(stderr, "unknown png color type\n");
+ return NULL;
+ }
+
+ tex = (png_texture*) malloc(sizeof(png_texture));
+ tex->data = malloc(x * y * zsize);
+ tex->width = x;
+ tex->height = y;
+ tex->channels = zsize;
+
+ /* get pointers */
+ row_pointers = (png_byte**) malloc(y * sizeof(png_byte*));
+ for(i = 0; i < y; i++)
+ row_pointers[i] = tex->data + (y - i - 1)
+ * zsize * x;
+
+ png_read_image(png_ptr, row_pointers);
+ png_destroy_read_struct(&png_ptr, &info_ptr, 0);
+
+ free(row_pointers);
+ fclose(f);
+ return tex;
+}
+
+void unload_png_texture(png_texture *tex) {
+ free(tex->data);
+ free(tex);
+}
+
+#define TARGET(X, Y, I) (mip->data + I + mip->channels * (X + Y * mip->width))
+#define SOURCE(X, Y, I) (source->data + I + \
+ source->channels * (X + Y * source->width))
+
+png_texture* mipmap_png_texture(png_texture *source, int level,
+ int clamp_u, int clamp_v) {
+ png_texture *mip;
+ int i;
+ int x, y;
+ int fx, fy;
+
+ if(level != 1) return NULL;
+ mip = (png_texture*) malloc(sizeof(png_texture));
+ mip->channels = source->channels;
+ fx = (source->width > 1) ? 2 : 1;
+ fy = (source->height > 1) ? 2 : 1;
+
+ mip->width = source->width / fx;
+ mip->height = source->height / fy;
+ mip->data = (unsigned char*) malloc(mip->width * mip->height *
+ mip->channels);
+
+ /* simple linear filtering */
+ for(i = 0; i < mip->channels; i++) {
+ for(y = 0; y < mip->height; y++) {
+ for(x = 0; x < mip->width; x++) {
+ /*
+ *( TARGET(x, y, i) ) = ( *( SOURCE(x * fx, y * fy, i) ) +
+ *( SOURCE((x + 1) * fx, (y + 1) * fy, i) ) +
+ *( SOURCE((x + 1) * fx, y * fy, i) ) +
+ *( SOURCE(x * fx, (y + 1) * fy, i) ) ) / 4;
+ */
+ int sx, sy, xoff, yoff;
+ sx = fx * x;
+ sy = fy * y;
+ xoff = fx - 1;
+ yoff = fy - 1;
+
+ *( mip->data + i + mip->channels * ( x + y * mip->width ) ) =
+ ( *( source->data + i + source->channels * ( sx + sy * source->width) ) +
+ *( source->data + i + source->channels * ( sx + xoff + sy * source->width) ) +
+ *( source->data + i + source->channels * ( sx + xoff + (sy + yoff) * source->width) ) +
+ *( source->data + i + source->channels * ( sx + (sy + yoff) * source->width) ) ) / 4;
+
+ }
+ }
+ }
+ return mip;
+}
diff --git a/nebu/video/video_system.c b/nebu/video/video_system.c
new file mode 100644
index 0000000..fdfcc56
--- /dev/null
+++ b/nebu/video/video_system.c
@@ -0,0 +1,112 @@
+#include "Nebu_video.h"
+
+#include "SDL.h"
+#include "SDL_opengl.h"
+
+static SDL_Surface *screen;
+static int width, height;
+static int flags;
+static int fullscreen;
+extern int video_initialized;
+
+void SystemSwapBuffers() {
+ SDL_GL_SwapBuffers();
+}
+
+void SystemInitWindow(int x, int y, int w, int h) {
+ width = w;
+ height = h;
+}
+
+void SystemInitDisplayMode(int f, unsigned char full) {
+ int bitdepth, zdepth;
+
+ flags = f;
+ fullscreen = full;
+ if(!video_initialized) {
+ if(SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
+ fprintf(stderr, "[system] can't initialize Video: %s\n", SDL_GetError());
+ exit(1); /* OK: critical, no visual */
+ }
+ }
+ if(flags & SYSTEM_DOUBLE)
+ SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1);
+
+ if(flags & SYSTEM_32_BIT) {
+ zdepth = 24;
+ bitdepth = 32;
+ } else {
+ zdepth = 16;
+ bitdepth = 16;
+ }
+ if(flags & SYSTEM_DEPTH)
+ SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, zdepth);
+ if(flags & SYSTEM_STENCIL)
+ SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8);
+ else
+ SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);
+ video_initialized = 1;
+ /* FIXME: bitdepth value unused */
+}
+
+void SystemSetGamma(float red, float green, float blue) {
+ SDL_SetGamma(red, green, blue);
+}
+
+int SystemCreateWindow(char *name) {
+ int f = SDL_OPENGL;
+ if(fullscreen & SYSTEM_FULLSCREEN)
+ f |= SDL_FULLSCREEN;
+ if( (screen = SDL_SetVideoMode( width, height, 0, f )) == NULL ) {
+ fprintf(stderr, "[system] Couldn't set GL mode: %s\n", SDL_GetError());
+ exit(1); /* OK: critical, no visual */
+ }
+ SDL_WM_SetCaption("GLtron", "");
+ glClearColor(0,0,0,0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ SDL_GL_SwapBuffers();
+ return 1;
+}
+
+void SystemDestroyWindow(int id) {
+ /* quit the video subsytem
+ * otherwise SDL can't create a new context on win32, if the stencil
+ * bits change
+ */
+ /* there used to be some problems (memory leaks, unprober driver unloading)
+ * caused by this, but I can't remember what they where
+ */
+
+ SDL_QuitSubSystem(SDL_INIT_VIDEO);
+ video_initialized = 0;
+}
+
+void SystemReshapeFunc(void(*reshape)(int, int)) {
+}
+
+int SystemWriteBMP(char *filename, int x, int y, unsigned char *pixels) {
+ /* this code is shamelessly stolen from Ray Kelm, but I believe he
+ put it in the public domain */
+ SDL_Surface *temp;
+ int i;
+
+ temp = SDL_CreateRGBSurface(SDL_SWSURFACE, x, y, 24,
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ 0x000000FF, 0x0000FF00, 0x00FF0000, 0
+#else
+ 0x00FF0000, 0x0000FF00, 0x000000FF, 0
+#endif
+ );
+
+ if (temp == NULL)
+ return -1;
+
+ for (i = 0; i < y; i++)
+ memcpy(((char *) temp->pixels) + temp->pitch * i,
+ pixels + 3 * x * (y - i - 1), x * 3);
+
+ SDL_SaveBMP(temp, filename);
+ SDL_FreeSurface(temp);
+ return 0;
+}
+
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
new file mode 100644
index 0000000..d74b0c1
--- /dev/null
+++ b/scripts/Makefile.am
@@ -0,0 +1,3 @@
+dist_pkgdata_DATA = config.lua save.lua menu.lua basics.lua menu_functions.lua audio.lua video.lua joystick.lua main.lua artpack.lua
+
+pkgdatadir = @datadir@/@PACKAGE@/scripts
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
new file mode 100644
index 0000000..79ce55a
--- /dev/null
+++ b/scripts/Makefile.in
@@ -0,0 +1,221 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+pkgdatadir = @datadir@/@PACKAGE@/scripts
+
+dist_pkgdata_DATA = config.lua save.lua menu.lua basics.lua menu_functions.lua audio.lua video.lua joystick.lua main.lua artpack.lua
+subdir = scripts
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DATA = $(dist_pkgdata_DATA)
+
+DIST_COMMON = $(dist_pkgdata_DATA) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign scripts/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+ @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
+
+uninstall-dist_pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \
+ rm -f $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
+tags: TAGS
+TAGS:
+
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_pkgdataDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am \
+ install-dist_pkgdataDATA install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ uninstall uninstall-am uninstall-dist_pkgdataDATA \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/scripts/artpack.lua b/scripts/artpack.lua
new file mode 100644
index 0000000..8e43356
--- /dev/null
+++ b/scripts/artpack.lua
@@ -0,0 +1,30 @@
+-- menu colors
+menu_item = { 1, 1, 1, 1 }
+menu_item_active1 = { .5, 1, 0, 1 }
+menu_item_active2 = { 1, 0, 0, 1 }
+
+-- texture settings
+video.settings.show_floor_texture = 1
+video.settings.show_wall = 1
+video.settings.show_crash_texture = 1
+video.settings.show_skybox = 1
+video.settings.show_decals = 1
+video.settings.stretch_textures = 1
+
+-- lightcycle colors
+model_diffuse_0 = { 1.000, 0.550, 0.140, 1.000 }
+model_diffuse_1 = { 0.750, 0.020, 0.020, 1.000 }
+model_diffuse_2 = { 0.120, 0.520, 0.600, 1.000 }
+model_diffuse_3 = { 0.800, 0.800, 0.800, 1.000 }
+
+model_specular_0 = { 0.500, 0.500, 0.000, 1.000 }
+model_specular_1 = { 0.750, 0.020, 0.020, 1.000 }
+model_specular_2 = { 0.120, 0.520, 0.600, 1.000 }
+model_specular_3 = { 1.000, 1.000, 1.000, 1.000 }
+
+trail_diffuse_0 = { 1.000, 0.850, 0.140, 0.600 }
+trail_diffuse_1 = { 0.750, 0.020, 0.020, 0.600 }
+trail_diffuse_2 = { 0.120, 0.520, 0.600, 0.600 }
+trail_diffuse_3 = { 0.700, 0.700, 0.700, 0.600 }
+
+clear_color = { 0, 0, 0, 0 }
diff --git a/scripts/audio.lua b/scripts/audio.lua
new file mode 100644
index 0000000..f8af761
--- /dev/null
+++ b/scripts/audio.lua
@@ -0,0 +1,64 @@
+function setupSoundTrack()
+ local i,name
+ for i,name in tracks do
+ print("[scripting audio] found track '", name, "'")
+ if name == settings.current_track then
+ current_track_index = i
+ return
+ end
+ end
+ settings.current_track = tracks[1]
+ current_track_index = 1
+end
+
+function nextTrack()
+ if current_track_index < getn(tracks) then
+ current_track_index = current_track_index + 1
+ else
+ current_track_index = 1
+ end
+ settings.current_track = tracks[ current_track_index ]
+ c_reloadTrack()
+end
+
+function previousTrack()
+ if current_track_index > 1 then
+ current_track_index = current_track_index - 1
+ else
+ current_track_index = getn(tracks)
+ end
+ settings.current_track = tracks[ current_track_index ]
+ c_reloadTrack()
+end
+
+function MusicVolumeUp()
+ settings.musicVolume = settings.musicVolume + 0.05
+ if settings.musicVolume > 1.0 then
+ settings.musicVolume = 1.0
+ end
+ c_update_audio_volume()
+end
+
+function MusicVolumeDown()
+ settings.musicVolume = settings.musicVolume - 0.05
+ if settings.musicVolume < 0.0 then
+ settings.musicVolume = 0.0
+ end
+ c_update_audio_volume()
+end
+
+function FXVolumeUp()
+ settings.fxVolume = settings.fxVolume + 0.05
+ if settings.fxVolume > 1.0 then
+ settings.fxVolume = 1.0
+ end
+ c_update_audio_volume()
+end
+
+function FXVolumeDown()
+ settings.fxVolume = settings.fxVolume - 0.05
+ if settings.fxVolume < 0.0 then
+ settings.fxVolume = 0.0
+ end
+ c_update_audio_volume()
+end
diff --git a/scripts/basics.lua b/scripts/basics.lua
new file mode 100644
index 0000000..1893246
--- /dev/null
+++ b/scripts/basics.lua
@@ -0,0 +1,8 @@
+function script_print(...)
+ write("[script] ")
+ for i=1,arg.n do
+ write(arg[i])
+ end
+ write("\n")
+end
+
diff --git a/scripts/config.lua b/scripts/config.lua
new file mode 100644
index 0000000..3c9e6d2
--- /dev/null
+++ b/scripts/config.lua
@@ -0,0 +1,125 @@
+-- global tables
+
+settings = { }
+artpacks = { }
+tracks = { }
+
+-- debugginb
+settings.debug_output = 1
+
+-- game
+-- game rules
+settings.speed = 8.5
+
+settings.booster_on = 1
+settings.booster_min = 1.0
+settings.booster_max = 6.5
+settings.booster_use = 1.0
+settings.booster_decrease = 0.8
+settings.booster_regenerate = 0.4
+
+settings.wall_accel_on = 0
+settings.wall_accel_limit = 20.0
+settings.wall_accel_use = 1.0
+settings.wall_accel_decrease = 0.8
+
+settings.ai_level = 2
+settings.grid_size = 720
+settings.erase_crashed = 1
+settings.map_ratio_w = 0.333
+settings.map_ratio_h = 0.333
+
+settings.ai_player1 = 0
+settings.ai_player2 = 1
+settings.ai_player3 = 1
+settings.ai_player4 = 1
+-- game settings
+settings.fast_finish = 1
+settings.camType = 1
+settings.display_type = 3
+
+-- video
+settings.artpacks = { }
+settings.current_artpack = "classic"
+-- detail settings
+settings.mipmap_filter = 3
+settings.alpha_trails = 0
+settings.show_glow = 1
+settings.show_recognizer = 1
+settings.show_impact = 1
+settings.lod = 1
+
+settings.show_fps = 0
+settings.show_console = 1
+settings.show_ai_status = 1
+settings.show_scores = 1
+
+-- screen options
+settings.width = 800
+settings.height = 600
+settings.windowMode = 1
+
+-- other settings (not available via menu)
+settings.show_gl_logo = 1
+
+settings.fov = 105
+settings.znear = 0.5
+settings.light_cycles = 1
+settings.turn_cycle = 1
+settings.line_spacing = 20
+settings.softwareRendering = 0
+settings.antialias_lines = 1
+settings.bitdepth_32 = 0
+settings.use_stencil = 0
+settings.mouse_warp = 0
+settings.model_backwards = 0
+settings.screenSaver = 0
+
+settings.joy_threshold = 0.10
+
+-- audio
+settings.tracks = { }
+settings.current_track = "revenge_of_cats.it"
+-- music & fx settings
+settings.playEffects = 1
+settings.playMusic = 1
+settings.fxVolume = 0.2
+settings.musicVolume = 0.5
+
+-- keys
+
+settings.keys = {
+ { -- player 1
+ left = 97, -- lower case 'a'
+ right = 115, -- lower case 's'
+ glance_left = 113, -- lower case 'q'
+ glance_right = 119, -- lower case 'w'
+ boost = 101, -- lower case 'd'
+ },
+ { -- player 2
+ left = 106, -- lower case 'j'
+ right = 107, -- lower case 'k'
+ glance_left = 117, -- lower case 'u'
+ glance_right = 105, -- lower case 'i'
+ boost = 108, -- lower case 'l'
+ },
+ { -- player 3
+ left = 276, -- cursor left
+ right = 275, -- cursor right
+ glance_left = 127, -- 'del'
+ glance_right = 279, -- 'end'
+ boost = 274, -- cursor down
+ },
+ { -- player 4
+ left = 260, -- keypad 4
+ right = 262, -- keypad 6
+ glance_left = 263, -- keypad 7
+ glance_right = 265, -- keypad 9
+ boost = 261, -- keypad 5
+ }
+}
+
+-- these tables are not serialized to RCNAME (yet)
+-- some values are set in artpack.lua
+video = {}
+video.settings = {}
diff --git a/scripts/joystick.lua b/scripts/joystick.lua
new file mode 100644
index 0000000..6c492f5
--- /dev/null
+++ b/scripts/joystick.lua
@@ -0,0 +1,13 @@
+function JoyThresholdUp()
+ settings.joy_threshold = settings.joy_threshold + 0.05
+ if settings.joy_threshold > 0.95 then
+ settings.joy_threshold = 0.95
+ end
+end
+
+function JoyThresholdDown()
+ settings.joy_threshold = settings.joy_threshold - 0.05
+ if settings.joy_threshold < 0.0 then
+ settings.joy_threshold = 0.0
+ end
+end
diff --git a/scripts/main.lua b/scripts/main.lua
new file mode 100644
index 0000000..f567e80
--- /dev/null
+++ b/scripts/main.lua
@@ -0,0 +1,62 @@
+-- loop until RETURN_QUIT code is sent
+
+RETURN_GAME_LAUNCH = 0
+RETURN_GAME_END = 1
+RETURN_GAME_PAUSE = 2
+RETURN_GAME_UNPAUSE = 3
+RETURN_GAME_CREDITS = 4
+RETURN_GAME_ESCAPE = 5
+RETURN_GUI_PROMPT = 6
+RETURN_TIMEDEMO = 7
+RETURN_TIMEDEMO_ABORT = 8
+RETURN_CREDITS = 9
+RETURN_QUIT = 10
+RETURN_GUI_ESCAPE = 11
+RETURN_PROMPT_ESCAPE = 12
+RETURN_PAUSE_ESCAPE = 13
+
+-- enable below to run in timedemo-only mode
+if(nil) then
+ SetCallback("timedemo")
+ SystemMainLoop()
+ exit()
+end
+
+callback = "gui"
+
+next_callback = {}
+next_callback[ RETURN_GAME_LAUNCH ] = "pause"
+next_callback[ RETURN_GAME_END ] = "pause"
+next_callback[ RETURN_GAME_PAUSE ] = "pause"
+next_callback[ RETURN_GAME_UNPAUSE ] = "game"
+next_callback[ RETURN_CREDITS ] = "credits"
+next_callback[ RETURN_GAME_CREDITS ] = "credits"
+
+next_callback[ RETURN_GAME_ESCAPE ] = "gui"
+next_callback[ RETURN_GUI_ESCAPE ] = "pause"
+next_callback[ RETURN_PROMPT_ESCAPE ] = "gui"
+next_callback[ RETURN_PAUSE_ESCAPE ] = "gui"
+
+next_callback[ RETURN_GUI_PROMPT ] = "configure"
+next_callback[ RETURN_TIMEDEMO ] = nil
+next_callback[ RETURN_TIMEDEMO_ABORT ] = nil
+next_callback[ RETURN_QUIT ] = nil
+
+
+while 1 do
+ SetCallback(callback)
+ -- write(format("[lua] setting callback '%s'\n", callback))
+
+ status = SystemMainLoop()
+ -- write(format("[lua] system returned (%d)\n", status))
+
+ if(next_callback[ status ]) then
+ callback = next_callback[ status ]
+ else
+ if(status == 10) then
+ write(format("[lua] unhandled callback (%d)\n", status))
+ exit()
+ end
+ end
+end
+
diff --git a/scripts/menu.lua b/scripts/menu.lua
new file mode 100644
index 0000000..e0e166b
--- /dev/null
+++ b/scripts/menu.lua
@@ -0,0 +1,581 @@
+MenuC = {
+ type = {
+ menu = 1,
+ list = 2,
+ slider = 3,
+ key = 4,
+ string = 5, -- not used yet
+ number = 6, -- not used yet
+ action = 7
+ },
+ keys = {
+ player1 = {},
+ player2 = {},
+ player3 = {},
+ player4 = {}
+ }
+}
+
+Menu = {
+ -- menu after startup
+ current = "RootMenu",
+ active = 1,
+ -- Menu definitions
+ RootMenu = { type = MenuC.type.menu, caption = "" },
+ GameMenu = { type = MenuC.type.menu, caption = "Game" },
+ GameRulesMenu = { type = MenuC.type.menu, caption = "Game Rules" },
+ GameSettingsMenu = { type = MenuC.type.menu, caption = "Play Settings" },
+ PlayerConfigMenu = { type = MenuC.type.menu, caption = "Configure Players" },
+ KeyConfigMenu = { type = MenuC.type.menu, caption = "Configure Keys" },
+ JoyConfigMenu = { type = MenuC.type.menu, caption = "Configure Joystick" },
+ Player1_KeyMenu = { type = MenuC.type.menu, caption = "Player 1" },
+ Player2_KeyMenu = { type = MenuC.type.menu, caption = "Player 2" },
+ Player3_KeyMenu = { type = MenuC.type.menu, caption = "Player 3" },
+ Player4_KeyMenu = { type = MenuC.type.menu, caption = "Player 4" },
+ VideoMenu = { type = MenuC.type.menu, caption = "Video" },
+ TextureMenu = { type = MenuC.type.menu, caption = "Texture Options" },
+ DetailsMenu = { type = MenuC.type.menu, caption = "Detail Options" },
+ ScreenMenu = { type = MenuC.type.menu, caption = "Screen Options" },
+ AudioMenu = { type = MenuC.type.menu, caption = "Audio" },
+
+ -- Item definitions
+ -- RootMenu
+ Quit = {
+ type = MenuC.type.action, caption = "Quit",
+ action = function() c_quitGame(); end
+ },
+
+ -- Game
+ StartGame = {
+ type = MenuC.type.action, caption = "Start Game",
+ action = function() Menu.current = "RootMenu"; c_startGame(); end
+ },
+ ResetScores = {
+ type = MenuC.type.action, caption = "Reset Scores",
+ action = function() c_resetScores(); end
+ },
+
+ -- Game Rules
+ GameType = {
+ type = MenuC.type.list, caption = "Game type",
+ labels = { "classic", "booster", "wall accell.", "both" },
+ values = { 0, 1, 2, 3 },
+ read =
+ function()
+ value = 0;
+ if(settings.booster_on == 1) then value = value + 1; end;
+ if(settings.wall_accel_on == 1) then value = value + 2; end;
+ return value;
+ end,
+ store =
+ function (value)
+ if(value >= 2)
+ then settings.wall_accel_on = 1;
+ else settings.wall_accel_on = 0;
+ end;
+ if(value == 1 or value == 3)
+ then settings.booster_on = 1;
+ else settings.booster_on = 0;
+ end;
+ script_print("booster: " .. settings.booster_on);
+ script_print("wall accel: " .. settings.wall_accel_on);
+ end
+ },
+ GameSpeed = {
+ type = MenuC.type.list, caption = "Game speed",
+ labels = { "boring", "normal", "fast", "crazy" },
+ values = { 5.0, 6.5, 8.5, 12.0 },
+ read = function() return settings.speed; end,
+ store = function (value) settings.speed = value; c_resetGame(); end
+ },
+ BotSkill = {
+ type = MenuC.type.list, caption = "Bot Skill",
+ labels = { "dumb", "normal", "strong", "the MCP himself" },
+ values = { 0, 1, 2, 3 },
+ read = function() return settings.ai_level; end,
+ store = function (value) settings.ai_level = value; end
+ },
+ ArenaSize = {
+ type = MenuC.type.list, caption = "Arena Size",
+ labels = { "tiny", "medium", "big", "vast", "extreme" },
+ values = { 160, 240, 480, 720, 1200 },
+ read = function() return settings.grid_size; end,
+ store = function (value) settings.grid_size = value; c_resetGame(); end
+ },
+ EraseDeadPlayers = {
+ type = MenuC.type.list, caption = "Erase dead players",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.erase_crashed; end,
+ store = function(value) settings.erase_crashed = value; c_resetGame(); end
+ },
+
+ -- GameSettings
+ FastFinish = {
+ type = MenuC.type.list, caption = "Fast finish",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.fast_finish; end,
+ store = function(value) settings.fast_finish = value; end
+ },
+ CameraMode = {
+ type = MenuC.type.list, caption = "Camera mode",
+ labels = { "circling", "behind", "cockpit", "mouse" },
+ values = { 0, 1, 2, 3 },
+ read = function() return settings.camType; end,
+ store = function(value) settings.camType = value; c_resetCamera(); end
+ },
+ Viewports = {
+ type = MenuC.type.list, caption = "Viewports",
+ labels = { "single", "split", "4 player", "auto" },
+ values = { 0, 1, 2, 3 },
+ read = function() return settings.display_type; end,
+ store = function(value) settings.display_type = value; end
+ },
+ Map = {
+ type = MenuC.type.list, caption = "2D Map",
+ labels = { "none", "small", "medium", "huge" },
+ values = { 0, 0.333, 0.5, 0.9 },
+ read = function() return settings.map_ratio_w; end,
+ store = function(value)
+ settings.map_ratio_w = value;
+ settings.map_ratio_h = value;
+ end
+ },
+
+ -- Player
+ Player1 = {
+ type = MenuC.type.list, caption = "Player 1",
+ labels = { "Human", "Computer", "None" },
+ values = { 0, 1, 2 },
+ read = function() return settings.ai_player1; end,
+ store = function(value) settings.ai_player1 = value; c_resetGame(); end
+ },
+
+ Player2 = {
+ type = MenuC.type.list, caption = "Player 2",
+ labels = { "Human", "Computer", "None" },
+ values = { 0, 1, 2 },
+ read = function() return settings.ai_player2; end,
+ store = function(value) settings.ai_player2 = value; c_resetGame(); end
+ },
+
+ Player3 = {
+ type = MenuC.type.list, caption = "Player 3",
+ labels = { "Human", "Computer", "None" },
+ values = { 0, 1, 2 },
+ read = function() return settings.ai_player3; end,
+ store = function(value) settings.ai_player3 = value; c_resetGame(); end
+ },
+
+ Player4 = {
+ type = MenuC.type.list, caption = "Player 4",
+ labels = { "Human", "Computer", "None" },
+ values = { 0, 1, 2 },
+ read = function() return settings.ai_player4; end,
+ store = function(value) settings.ai_player4 = value; c_resetGame(); end
+ },
+
+ -- PlayerX_Key
+ Player1_Left = {
+ type = MenuC.type.key, caption = "Turn Left",
+ player = 1, event = "left"
+ },
+ Player1_Right = {
+ type = MenuC.type.key, caption = "Turn Right",
+ player = 1, event = "right"
+ },
+ Player1_GlanceLeft = {
+ type = MenuC.type.key, caption = "Glance Left",
+ player = 1, event = "glance_left"
+ },
+ Player1_GlanceRight = {
+ type = MenuC.type.key, caption = "Glance Right",
+ player = 1, event = "glance_right"
+ },
+ Player1_Booster = {
+ type = MenuC.type.key, caption = "Booster",
+ player = 1, event = "boost"
+ },
+ Player2_Left = {
+ type = MenuC.type.key, caption = "Turn Left",
+ player = 2, event = "left"
+ },
+ Player2_Right = {
+ type = MenuC.type.key, caption = "Turn Right",
+ player = 2, event = "right"
+ },
+ Player2_GlanceLeft = {
+ type = MenuC.type.key, caption = "Glance Left",
+ player = 2, event = "glance_left"
+ },
+ Player2_GlanceRight = {
+ type = MenuC.type.key, caption = "Glance Right",
+ player = 2, event = "glance_right"
+ },
+ Player2_Booster = {
+ type = MenuC.type.key, caption = "Booster",
+ player = 2, event = "boost"
+ },
+ Player3_Left = {
+ type = MenuC.type.key, caption = "Turn Left",
+ player = 3, event = "left"
+ },
+ Player3_Right = {
+ type = MenuC.type.key, caption = "Turn Right",
+ player = 3, event = "right"
+ },
+ Player3_GlanceLeft = {
+ type = MenuC.type.key, caption = "Glance Left",
+ player = 3, event = "glance_left"
+ },
+ Player3_GlanceRight = {
+ type = MenuC.type.key, caption = "Glance Right",
+ player = 3, event = "glance_right"
+ },
+ Player3_Booster = {
+ type = MenuC.type.key, caption = "Booster",
+ player = 3, event = "boost"
+ },
+ Player4_Left = {
+ type = MenuC.type.key, caption = "Turn Left",
+ player = 4, event = "left"
+ },
+ Player4_Right = {
+ type = MenuC.type.key, caption = "Turn Right",
+ player = 4, event = "right"
+ },
+ Player4_GlanceLeft = {
+ type = MenuC.type.key, caption = "Glance Left",
+ player = 4, event = "glance_left"
+ },
+ Player4_GlanceRight = {
+ type = MenuC.type.key, caption = "Glance Right",
+ player = 4, event = "glance_right"
+ },
+ Player4_Booster = {
+ type = MenuC.type.key, caption = "Booster",
+ player = 4, event = "boost"
+ },
+
+ -- Joystick
+ Joy_Threshold = {
+ type = MenuC.type.slider, caption = "Threshold",
+ right = JoyThresholdUp,
+ left = JoyThresholdDown,
+ read = function() return format("%.0f%%", settings.joy_threshold * 100); end
+ },
+
+ -- TODO: fill in the rest of the items
+
+ -- Video
+
+ Artpack = {
+ type = MenuC.type.slider, caption = "Artpack",
+ right = nextArtpack,
+ left = previousArtpack,
+ action = nextArtpack,
+ read = function() return settings.current_artpack; end
+ },
+ -- Details
+ Filtering = {
+ type = MenuC.type.list, caption = "Mipmap filter",
+ labels = { "nearest", "linear", "mipmap", "trilinear" },
+ values = { 0, 1, 2, 3 },
+ read = function() return settings.mipmap_filter; end,
+ store = function(value)
+ settings.mipmap_filter = value
+ c_reloadArtpack()
+ end
+ },
+ AlphaTrails = {
+ type = MenuC.type.list, caption = "Transparent trails",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.alpha_trails; end,
+ store = function(value) settings.alpha_trails = value; end
+ },
+ Halos = {
+ type = MenuC.type.list, caption = "Halos",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.show_glow; end,
+ store = function(value) settings.show_glow = value; end
+ },
+ Lightcycles = {
+ type = MenuC.type.list, caption = "Lightcycles",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.show_model; end,
+ store = function(value) settings.show_model = value; end
+ },
+ Recognizer = {
+ type = MenuC.type.list, caption = "Recognizers",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.show_recognizer; end,
+ store = function(value) settings.show_recognizer = value; end
+ },
+ Lod = {
+ type = MenuC.type.list, caption = "Cycle Detail",
+ labels = { "ugly", "low", "high", "ultra-high" },
+ values = { 3, 2, 1, 0 },
+ read = function() return settings.lod; end,
+ store = function(value) settings.lod = value; end
+ },
+ ShadowStyle = {
+ type = MenuC.type.list, caption = "Shadow Type",
+ labels = { "stencil", "normal" },
+ values = { 1, 0 },
+ read = function() return settings.use_stencil; end,
+ store = function(value) settings.use_stencil = value; c_video_restart(); end
+ },
+ -- Status Display
+ FPS_Counter = {
+ type = MenuC.type.list, caption = "FPS counter",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.show_fps; end,
+ store = function(value) settings.show_fps = value; end
+ },
+ AI_Status = {
+ type = MenuC.type.list, caption = "AI status",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.show_ai_status; end,
+ store = function(value) settings.show_ai_status = value; end
+ },
+ Scores = {
+ type = MenuC.type.list, caption = "Scores",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.show_scores; end,
+ store = function(value) settings.show_scores = value; end
+ },
+
+ -- Screen
+ _320x240 = {
+ type = MenuC.type.action, caption = "320 x 240",
+ action = function() settings.width = 320; settings.height = 240; c_video_restart(); end
+ },
+ _512x384 = {
+ type = MenuC.type.action, caption = "512 x 384",
+ action = function() settings.width = 512; settings.height = 384; c_video_restart(); end
+ },
+ _640x480 = {
+ type = MenuC.type.action, caption = "640 x 480",
+ action = function() settings.width = 640; settings.height = 480; c_video_restart(); end
+ },
+ _800x600 = {
+ type = MenuC.type.action, caption = "800 x 600",
+ action = function() settings.width = 800; settings.height = 600; c_video_restart(); end
+ },
+ _1024x768 = {
+ type = MenuC.type.action, caption = "1024 x 768",
+ action = function() settings.width = 1024; settings.height = 768; c_video_restart(); end
+ },
+ _1280x1024 = {
+ type = MenuC.type.action, caption = "1280 x 1024",
+ action = function() settings.width = 1280; settings.height = 1024; c_video_restart(); end
+ },
+ _1600x1200 = {
+ type = MenuC.type.action, caption = "1600 x 1200",
+ action = function() settings.width = 1600; settings.height = 1200; c_video_restart(); end
+ },
+ WindowMode = {
+ type = MenuC.type.list, caption = "Windowed",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.windowMode; end,
+ store = function(value) settings.windowMode = value; c_video_restart(); end
+ },
+
+ TimeDemo = {
+ type = MenuC.type.action, caption = "Time Demo",
+ action = function() c_timedemo(); end
+ },
+
+ -- Audio
+ Music = {
+ type = MenuC.type.list, caption = "Music",
+ labels = { "off", "on" },
+ read = function() return settings.playMusic; end,
+ values = { 0, 1 },
+ store = function(value) settings.playMusic = value; c_update_settings_cache() ; end
+ },
+ FX = {
+ type = MenuC.type.list, caption = "Sound FX",
+ labels = { "off", "on" },
+ values = { 0, 1 },
+ read = function() return settings.playEffects; end,
+ store = function(value) settings.playEffects = value; end
+ },
+ Music_Volume = {
+ type = MenuC.type.slider, caption = "Music Volume",
+ right = function() MusicVolumeUp(); end,
+ left = function() MusicVolumeDown(); end,
+ read = function() return format("%.0f%%", settings.musicVolume * 100); end
+ },
+ FX_Volume = {
+ type = MenuC.type.slider, caption = "FX Volume",
+ right = function() FXVolumeUp(); end,
+ left = function() FXVolumeDown(); end,
+ read = function() return format("%.0f%%", settings.fxVolume * 100); end
+ },
+ Song = {
+ type = MenuC.type.slider, caption = "Song",
+ right = function() nextTrack(); end,
+ left = function() previousTrack(); end,
+ action = function() nextTrack(); end,
+ read = function()
+ _,_,name = strfind(settings.current_track, "(.*)%..+")
+ if name then
+ return name
+ else
+ return settings.current_track
+ end
+ end
+ }
+}
+
+Menu.SetParent = function ( menu )
+ -- script_print("processing menu '" .. menu .. "'")
+ local _,entry
+ for _,entry in Menu[menu].items do
+ if Menu[entry] == nil then
+ script_print("menu '" .. entry .. "' does not exist")
+ else
+ Menu[entry].parent = menu
+ -- script_print("processing item '" .. entry .. "'")
+ if Menu[entry].type == MenuC.type.menu then
+ Menu.SetParent( entry )
+ end
+ end
+ end
+ end
+
+Menu.SetNames = function ()
+ local name,v
+ for name,v in Menu do
+ if type(v) == "table" then
+ v.name = name
+ end
+ end
+ end
+
+Menu.GotoParent = function ()
+ Menu.current = Menu[Menu.current].parent
+ Menu.active = 1
+ end
+
+Menu.Action = function ()
+ local menu = Menu[Menu.current].items[Menu.active]
+ local type = Menu[ menu ].type
+ script_print("calling action of '" .. menu .. "', type " .. type )
+ MenuAction[ type ]( menu )
+ end
+
+Menu.Left = function ()
+ local menu = Menu[Menu.current].items[Menu.active]
+ local type = Menu[ menu ].type
+ if type == MenuC.type.slider then
+ script_print("calling left of '" .. menu .. "'")
+ Menu[ menu ].left()
+ else
+ -- script_print("calling action of '" .. menu .. "', type " .. type )
+ -- MenuAction[ type ]( menu )
+ end
+ end
+
+Menu.Right = function ()
+ local menu = Menu[Menu.current].items[Menu.active]
+ local type = Menu[ menu ].type
+ if type == MenuC.type.slider then
+ script_print("calling right of '" .. menu .. "'")
+ Menu[ menu ].right()
+ else
+ -- script_print("calling action of '" .. menu .. "', type " .. type )
+ -- MenuAction[ type ]( menu )
+ end
+ end
+
+
+Menu.Next = function ()
+ if Menu.active < getn(Menu[Menu.current].items) then
+ Menu.active = Menu.active + 1
+ else
+ Menu.active = 1
+ end
+ end
+
+Menu.Previous = function ()
+ if Menu.active > 1 then
+ Menu.active = Menu.active - 1
+ else
+ Menu.active = getn(Menu[Menu.current].items)
+ end
+ end
+
+-- Menu entries
+Menu.RootMenu.items = { "GameMenu", "VideoMenu", "AudioMenu", "Quit" }
+
+Menu.GameMenu.items = {
+ "StartGame", "ResetScores", "GameRulesMenu",
+ "GameSettingsMenu", "PlayerConfigMenu", "KeyConfigMenu", "JoyConfigMenu"
+}
+
+Menu.GameRulesMenu.items = {
+ "GameType", "GameSpeed", "BotSkill", "ArenaSize", "EraseDeadPlayers"
+}
+
+Menu.GameSettingsMenu.items = { "FastFinish", "CameraMode", "Viewports", "Map" }
+Menu.PlayerConfigMenu.items = { "Player1", "Player2", "Player3", "Player4" }
+Menu.KeyConfigMenu.items = {
+ "Player1_KeyMenu", "Player2_KeyMenu", "Player3_KeyMenu", "Player4_KeyMenu"
+}
+Menu.JoyConfigMenu.items = { "Joy_Threshold" }
+Menu.Player1_KeyMenu.items = {
+ "Player1_Left", "Player1_Right",
+ "Player1_GlanceLeft", "Player1_GlanceRight",
+ "Player1_Booster",
+}
+Menu.Player2_KeyMenu.items = {
+ "Player2_Left", "Player2_Right",
+ "Player2_GlanceLeft", "Player2_GlanceRight",
+ "Player2_Booster",
+}
+Menu.Player3_KeyMenu.items = {
+ "Player3_Left", "Player3_Right",
+ "Player3_GlanceLeft", "Player3_GlanceRight",
+ "Player3_Booster",
+}
+Menu.Player4_KeyMenu.items = {
+ "Player4_Left", "Player4_Right",
+ "Player4_GlanceLeft", "Player4_GlanceRight",
+ "Player4_Booster",
+}
+
+Menu.VideoMenu.items = {
+ "Artpack", "DetailsMenu",
+ "ScreenMenu" --, "TimeDemo"
+}
+
+Menu.DetailsMenu.items = {
+ "Filtering", "AlphaTrails", "Halos",
+ -- "Lightcycles",
+ "Recognizer", "Lod",
+ "ShadowStyle", "FPS_Counter", "AI_Status", "Scores"
+}
+Menu.ScreenMenu.items = {
+ "_320x240", "_512x384", "_640x480", "_800x600", "_1024x768", "_1280x1024",
+ "_1600x1200", "WindowMode"
+}
+
+Menu.AudioMenu.items = { "Music", "FX", "Music_Volume", "FX_Volume", "Song" }
+
+-- initialization code
+Menu.SetNames()
+Menu.SetParent( "RootMenu" )
+
+
+
diff --git a/scripts/menu_functions.lua b/scripts/menu_functions.lua
new file mode 100644
index 0000000..8d302e9
--- /dev/null
+++ b/scripts/menu_functions.lua
@@ -0,0 +1,91 @@
+GetMenuValue = {}
+MenuAction = {}
+
+GetMenuValue[ MenuC.type.menu ] = function ( menu )
+ -- return "(menu)"
+ return ""
+end
+
+MenuAction[ MenuC.type.menu ] = function ( menu )
+ Menu.current = menu
+ Menu.active = 1
+end
+
+GetMenuValue[ MenuC.type.list ] = function ( menu )
+ local value
+ if Menu[menu].read then value = Menu[menu].read() end
+ if not value then value = "undef" end
+
+ -- script_print(menu .. " --> " .. value )
+ local i
+ for i=1,getn(Menu[menu].values) do
+ if Menu[menu].values[i] == value then return Menu[menu].labels[i] end
+ end
+ return "unknown (" .. value .. ")"
+end
+
+MenuAction[ MenuC.type.list ] = function ( menu )
+ local value
+ if Menu[menu].read then
+ value = Menu[menu].read()
+ else
+ value = "undef"
+ end
+
+ local nValues = getn(Menu[menu].values)
+ local i
+ for i=1,nValues do
+ if Menu[menu].values[i] == value then
+ if i < nValues then
+ value = Menu[menu].values[i + 1]
+ else
+ value = Menu[menu].values[1]
+ end
+ return Menu[menu].store( value )
+ end
+ end
+ return Menu[menu].store( Menu[menu].values[1] )
+end
+
+MenuAction[ MenuC.type.action ] = function ( menu )
+ Menu[menu].action()
+end
+
+GetMenuValue[ MenuC.type.slider ] = function ( menu )
+ return Menu[menu].read()
+end
+
+MenuAction[ MenuC.type.slider ] = function( menu )
+ if Menu[menu].action then
+ Menu[menu].action()
+ end
+end
+
+MenuAction[ MenuC.type.key ] = function ( menu )
+ local player = Menu[menu].player
+ local event = Menu[menu].event
+ configure_player = player
+ configure_event = event
+ c_configureKeyboard()
+end
+
+GetMenuValue[ MenuC.type.key ] = function ( menu )
+ local player = Menu[menu].player
+ local event = Menu[menu].event
+ return c_getKeyName( settings.keys[ player ][ event ] )
+end
+
+GetMenuValue[ MenuC.type.action ] = function ( menu )
+ -- return "(action)"
+ return ""
+end
+
+GetMenuValueWidth = function ( menu )
+ return strlen( GetMenuValue[ Menu[menu].type ]( menu ) )
+end
+
+GetMenuValueString = function ( menu )
+ -- write(format("GetMenuValueString: '%s'\n", menu));
+ return GetMenuValue[ Menu[menu].type ]( menu )
+end
+
diff --git a/scripts/save.lua b/scripts/save.lua
new file mode 100644
index 0000000..2b10a23
--- /dev/null
+++ b/scripts/save.lua
@@ -0,0 +1,33 @@
+-- dump global environment
+
+function savevar (n,v)
+ if v == nil then return end
+ if type(v)=="userdata" or type(v)=="function" then return end
+ -- if type(v)=="userdata" or type(v)=="function" then write("\t-- ") end
+ -- don't print lua constants
+ if strsub(n, 1, 1) == "_" then return end
+ write("settings.", n," = ")
+ if type(v) == "string" then write(format("%q",v))
+ elseif type(v) == "table" then
+ if v.__visited__ ~= nil then
+ write(v.__visited__)
+ else
+ write("{ }\n")
+ v.__visited__ = n
+ for r,f in v do
+ if r ~= "__visited__" then
+ if type(r) == 'string' then
+ savevar(n.."."..r,f)
+ else
+ savevar(n.."["..r.."]",f)
+ end
+ end
+ end
+ end
+ else write(tostring(v)) end
+ write("\n")
+end
+
+function save ()
+ foreach(settings,savevar)
+end
diff --git a/scripts/video.lua b/scripts/video.lua
new file mode 100644
index 0000000..e50ace7
--- /dev/null
+++ b/scripts/video.lua
@@ -0,0 +1,36 @@
+-- very similiar to setupSoundTracks() in audio.lua
+
+function setupArtpacks()
+ local i,name
+ for i,name in artpacks do
+ if name == settings.current_artpack then
+ current_artpack_index = i
+ return
+ end
+ end
+ settings.current_artpack = artpacks[1]
+ current_artpack_index = 1
+end
+
+function nextArtpack()
+ if current_artpack_index < getn(artpacks) then
+ current_artpack_index = current_artpack_index + 1
+ else
+ current_artpack_index = 1
+ end
+ settings.current_artpack = artpacks[ current_artpack_index ]
+ c_reloadArtpack()
+end
+
+function previousArtpack()
+ if current_artpack_index > 1 then
+ current_artpack_index = current_artpack_index - 1
+ else
+ current_artpack_index = getn(artpacks)
+ end
+ settings.current_artpack = artpacks[ current_artpack_index ]
+ c_reloadArtpack()
+end
+
+
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..015da1f
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,21 @@
+SUBDIRS = include filesystem base configuration audio video input game
+
+noinst_LIBRARIES = libGLtron.a
+
+libGLtron_a_SOURCES =
+
+libGLtron_a_LIBADD = \
+ base/libbase.a \
+ filesystem/libfilesystem.a \
+ audio/libaudio.a \
+ video/libvideo.a \
+ input/libinput.a \
+ game/libgame.a
+
+## libNebu_a_LIBADD = \
+## base/libbase.a \
+## filesystem/libfilesystem.a \
+## scripting/libscripting.a \
+## audio/libaudio.a \
+## video/libvideo.a \
+## input/libinput.a
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..d122845
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,365 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+SUBDIRS = include filesystem base configuration audio video input game
+
+noinst_LIBRARIES = libGLtron.a
+
+libGLtron_a_SOURCES =
+
+libGLtron_a_LIBADD = \
+ base/libbase.a \
+ filesystem/libfilesystem.a \
+ audio/libaudio.a \
+ video/libvideo.a \
+ input/libinput.a \
+ game/libgame.a
+
+subdir = src
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libGLtron_a_AR = $(AR) cru
+libGLtron_a_DEPENDENCIES = base/libbase.a filesystem/libfilesystem.a \
+ audio/libaudio.a video/libvideo.a input/libinput.a \
+ game/libgame.a
+am_libGLtron_a_OBJECTS =
+libGLtron_a_OBJECTS = $(am_libGLtron_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(libGLtron_a_SOURCES)
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
+ uninstall-info-recursive all-recursive install-data-recursive \
+ install-exec-recursive installdirs-recursive install-recursive \
+ uninstall-recursive check-recursive installcheck-recursive
+DIST_COMMON = Makefile.am Makefile.in
+DIST_SUBDIRS = $(SUBDIRS)
+SOURCES = $(libGLtron_a_SOURCES)
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libGLtron.a: $(libGLtron_a_OBJECTS) $(libGLtron_a_DEPENDENCIES)
+ -rm -f libGLtron.a
+ $(libGLtron_a_AR) libGLtron.a $(libGLtron_a_OBJECTS) $(libGLtron_a_LIBADD)
+ $(RANLIB) libGLtron.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-recursive
+
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
+ clean-generic clean-noinstLIBRARIES clean-recursive distclean \
+ distclean-compile distclean-generic distclean-recursive \
+ distclean-tags distdir dvi dvi-am dvi-recursive info info-am \
+ info-recursive install install-am install-data install-data-am \
+ install-data-recursive install-exec install-exec-am \
+ install-exec-recursive install-info install-info-am \
+ install-info-recursive install-man install-recursive \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am installdirs-recursive maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-recursive \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am \
+ uninstall-info-recursive uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/audio/Makefile.am b/src/audio/Makefile.am
new file mode 100644
index 0000000..63884d6
--- /dev/null
+++ b/src/audio/Makefile.am
@@ -0,0 +1,15 @@
+noinst_LIBRARIES=libaudio.a
+
+libaudio_a_SOURCES = \
+ sound.c sound_glue.cpp
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
+
+AM_CXXFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
+
diff --git a/src/audio/Makefile.in b/src/audio/Makefile.in
new file mode 100644
index 0000000..7427ea1
--- /dev/null
+++ b/src/audio/Makefile.in
@@ -0,0 +1,322 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libaudio.a
+
+libaudio_a_SOURCES = \
+ sound.c sound_glue.cpp
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
+
+
+AM_CXXFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
+
+subdir = src/audio
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libaudio_a_AR = $(AR) cru
+libaudio_a_LIBADD =
+am_libaudio_a_OBJECTS = sound.$(OBJEXT) sound_glue.$(OBJEXT)
+libaudio_a_OBJECTS = $(am_libaudio_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/sound.Po $(DEPDIR)/sound_glue.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+CXXFLAGS = @CXXFLAGS@
+DIST_SOURCES = $(libaudio_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libaudio_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cpp .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/audio/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libaudio.a: $(libaudio_a_OBJECTS) $(libaudio_a_DEPENDENCIES)
+ -rm -f libaudio.a
+ $(libaudio_a_AR) libaudio.a $(libaudio_a_OBJECTS) $(libaudio_a_LIBADD)
+ $(RANLIB) libaudio.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sound.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sound_glue.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+
+.cpp.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `cygpath -w $<`
+CXXDEPMODE = @CXXDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/audio/sound.c b/src/audio/sound.c
new file mode 100644
index 0000000..6330730
--- /dev/null
+++ b/src/audio/sound.c
@@ -0,0 +1,127 @@
+#include "game/gltron.h"
+#include "filesystem/path.h"
+
+#define NUM_GAME_FX 3
+
+static char *game_fx_names[] = {
+
+#if 1
+ "game_engine.wav",
+ "game_crash.wav",
+ "game_recognizer.wav"
+#else
+ "game_engine.ogg",
+ "game_crash.ogg",
+ "game_recognizer.ogg"
+#endif
+};
+
+void Sound_loadFX(void) {
+ int i;
+ char *path;
+
+
+ for(i = 0; i < NUM_GAME_FX; i++) {
+ path = getPath(PATH_DATA, game_fx_names[i]);
+ if(path) {
+ Audio_LoadSample(path, i);
+ free(path);
+ } else {
+ fprintf(stderr, "[error] can't load sound fx file %s\n",
+ game_fx_names[i]);
+ exit(1); // FIXME: handle missing fx somewhere else
+ }
+ }
+}
+
+void Sound_reloadTrack(void) {
+ char *song;
+ char *path;
+ scripting_GetGlobal("settings", "current_track", NULL);
+ scripting_GetStringResult(&song);
+ fprintf(stderr, "[sound] loading song %s\n", song);
+ path = getPath( PATH_MUSIC, song );
+ free(song);
+ if(path == NULL) {
+ fprintf(stderr, "[sound] can't find song...exiting\n");
+ exit(1); // FIXME: handle missing song somewhere else
+ }
+ Sound_load(path);
+ Sound_play();
+
+ free(path);
+}
+
+void Sound_shutdown(void) {
+ Audio_Quit();
+}
+
+
+void Sound_load(char *name) {
+ Audio_LoadMusic(name);
+}
+
+void Sound_play(void) {
+ Audio_SetMusicVolume(getSettingf("musicVolume"));
+ Audio_PlayMusic();
+ return;
+}
+
+void Sound_stop(void) {
+ Audio_StopMusic();
+}
+
+void Sound_idle(void) {
+ Audio_Idle();
+}
+
+void Sound_setMusicVolume(float volume) {
+ if(volume > 1) volume = 1;
+ if(volume < 0) volume = 0;
+ Audio_SetMusicVolume(volume);
+}
+
+void Sound_setFxVolume(float volume) {
+ if(volume > 1) volume = 1;
+ if(volume < 0) volume = 0;
+ Audio_SetFxVolume(volume);
+}
+
+void Sound_initTracks(void) {
+ const char *music_path;
+ List *soundList;
+ List *p;
+ int i;
+
+ music_path = getDirectory( PATH_MUSIC );
+ soundList = readDirectoryContents(music_path, NULL);
+ if(soundList->next == NULL) {
+ fprintf(stderr, "[sound] no music files found...exiting\n");
+ exit(1); // FIXME: handle missing songs somewhere else
+ }
+
+ i = 1;
+ for(p = soundList; p->next != NULL; p = p->next) {
+
+ // bugfix: filter track list to readable files (and without directories)
+ char *path = getPossiblePath( PATH_MUSIC, (char*)p->data );
+ if( path != NULL && fileExists( path ) ) {
+ scripting_RunFormat("tracks[%d] = \"%s\"", i, (char*) p->data);
+ i++;
+ free( path );
+ }
+ }
+ scripting_Run("setupSoundTrack()");
+}
+
+void Sound_setup(void) {
+ printf("[sound] initializing sound\n");
+
+ Audio_Init();
+ Sound_loadFX();
+ Audio_LoadPlayers();
+ Sound_setFxVolume(getSettingf("fxVolume"));
+ Sound_reloadTrack();
+ Sound_setMusicVolume(getSettingf("musicVolume"));
+ Audio_Start();
+}
diff --git a/src/audio/sound_glue.cpp b/src/audio/sound_glue.cpp
new file mode 100644
index 0000000..9753f09
--- /dev/null
+++ b/src/audio/sound_glue.cpp
@@ -0,0 +1,297 @@
+#include "Nebu_audio.h"
+
+extern "C" {
+#include "game/game.h"
+#include "video/video.h" // 3d sound engine needs to know the camera's location!
+}
+#include "audio/sound_glue.h"
+
+#include "SDL.h"
+#include "SDL_sound.h"
+
+static Sound::System *sound = NULL;
+static Sound::SourceMusic *music = NULL;
+static Sound::SourceSample *sample_crash = NULL;
+static Sound::SourceSample *sample_engine = NULL;
+static Sound::SourceSample *sample_recognizer = NULL;
+
+static Sound::Source3D *players[PLAYERS];
+static Sound::Source3D *recognizerEngine;
+
+#define TURNLENGTH 250.0f
+
+static void output_decoders(void)
+{
+ const Sound_DecoderInfo **rc = Sound_AvailableDecoders();
+ const Sound_DecoderInfo **i;
+ const char **ext;
+
+ printf("Supported sound formats:\n");
+ if (rc == NULL)
+ printf(" * Apparently, NONE!\n");
+ else
+ {
+ for (i = rc; *i != NULL; i++)
+ {
+ printf(" * %s\n", (*i)->description);
+ for (ext = (*i)->extensions; *ext != NULL; ext++)
+ printf(" File extension \"%s\"\n", *ext);
+ printf(" Written by %s.\n %s\n\n", (*i)->author, (*i)->url);
+ } /* for */
+ } /* else */
+
+ printf("\n");
+} /* output_decoders */
+
+extern "C" {
+
+
+ void Audio_EnableEngine(void) {
+ int i;
+ for(i = 0; i < game->players; i++)
+ if( game->player[i].data->speed > 0)
+ Audio_StartEngine(i);
+ sample_engine->Start();
+ if (gSettingsCache.show_recognizer)
+ sample_recognizer->Start();
+ // printf("[audio] turning on engine sound\n");
+ }
+
+ void Audio_DisableEngine(void) {
+ sample_engine->Stop();
+ sample_recognizer->Stop();
+ // printf("[audio] turning off engine sound\n");
+ }
+
+ void Audio_Idle(void) {
+ // iterate over all the players and update the engines
+ if(sample_engine->IsPlaying()) {
+ for(int i = 0; i < PLAYERS; i++) {
+ Player *p;
+ Sound::Source3D *p3d;
+ float x, y;
+ p3d = players[i];
+ p = game->player + i;
+ getPositionFromIndex(&x, &y, i);
+ p3d->_location = Vector3(x, y, 0);
+ float V = p->data->speed;
+
+ int dt = game2->time.current - p->data->turn_time;
+ if(dt < TURN_LENGTH) {
+ float t = (float)dt / TURNLENGTH;
+
+ float vx = (1 - t) * dirsX[p->data->last_dir] +
+ t * dirsX[p->data->dir];
+ float vy = (1 - t) * dirsY[p->data->last_dir] +
+ t * dirsY[p->data->dir];
+ p3d->_velocity = Vector3(V * vx, V * vy, 0);
+ } else {
+ p3d->_velocity = Vector3(V * dirsX[p->data->dir],
+ V * dirsY[p->data->dir],
+ 0);
+ }
+ if(i == 0) {
+ if(p->data->boost_enabled) {
+ ( (Sound::SourceEngine*) p3d )->_speedShift = 1.2f;
+ } else {
+ ( (Sound::SourceEngine*) p3d )->_speedShift = 1.0f;
+ }
+ ( (Sound::SourceEngine*) p3d )->_pitchShift =
+ p->data->speed / getSettingf("speed");
+ }
+
+#if 0
+ if(i == 0) {
+ if( dt < TURNLENGTH ) {
+ float t = (float)dt / TURNLENGTH;
+ float speedShift = ( 1 - t ) * 0.4 + t * 0.3;
+ float pitchShift = ( 1 - t ) * 0.9 + t * 1.0;
+ ( (Sound::SourceEngine*) p3d )->_speedShift = speedShift;
+ ( (Sound::SourceEngine*) p3d )->_pitchShift = pitchShift;
+ } else {
+ ( (Sound::SourceEngine*) p3d )->_speedShift = 0.3;
+ ( (Sound::SourceEngine*) p3d )->_pitchShift = 1.0;
+ }
+ }
+#endif
+ }
+ }
+
+ if(sample_recognizer->IsPlaying()) {
+ if (gSettingsCache.show_recognizer) {
+ vec2 p, v;
+ getRecognizerPositionVelocity(&p, &v);
+ // recognizerEngine->_location = Vector3(p.x, p.y, RECOGNIZER_HEIGHT);
+ recognizerEngine->_location = Vector3(p.v[0], p.v[1], 10.0f);
+ recognizerEngine->_velocity = Vector3(v.v[0], v.v[1], 0);
+ }
+ }
+
+ Sound::Listener& listener = sound->GetListener();
+
+ listener._location = Vector3(game->player[0].camera->cam);
+ Vector3 v1 = Vector3(game->player[0].camera->target);
+ Vector3 v2 = Vector3(game->player[0].camera->cam);
+ listener._direction = v1 - v2;
+
+ // listener._location = players[0]->_location;
+ // listener._direction = players[0]->_velocity;
+ listener._velocity = players[0]->_velocity;
+
+ listener._up = Vector3(0, 0, 1);
+
+ sound->SetMixMusic(gSettingsCache.playMusic);
+ sound->SetMixFX(gSettingsCache.playEffects);
+ sound->Idle();
+ }
+
+ void Audio_CrashPlayer(int player) {
+ Sound::SourceCopy *copy = new Sound::SourceCopy(sample_crash);
+ copy->Start();
+ copy->SetRemovable();
+ copy->SetType(Sound::eSoundFX);
+ sound->AddSource(copy);
+ }
+
+ void Audio_Init(void) {
+ Sound_Init(); // Init SDL_Sound
+ // output_decoders();
+
+ SDL_AudioSpec* spec = new SDL_AudioSpec;
+ spec->freq = 22050;
+ spec->format = AUDIO_S16SYS;
+ spec->channels = 2;
+ spec->samples = 1024;
+
+ sound = new Sound::System(spec);
+
+ spec->userdata = sound;
+ spec->callback = sound->GetCallback();
+
+ SDL_AudioSpec obtained;
+
+ if(SDL_OpenAudio( spec, &obtained ) != 0) {
+ fprintf(stderr, "[error] %s\n", SDL_GetError());
+ sound->SetStatus(Sound::eUninitialized);
+ } else {
+ sound->SetStatus(Sound::eInitialized);
+ /*
+ fprintf(stderr, "[sound] frequency: %d\n", obtained.freq);
+ fprintf(stderr, "[sound] format: %d\n", obtained.format);
+ fprintf(stderr, "[sound] channels: %d\n", obtained.channels);
+ fprintf(stderr, "[sound] silence: %d\n", obtained.silence);
+ fprintf(stderr, "[sound] buffer in samples: %d\n", obtained.samples);
+ fprintf(stderr, "[sound] buffer in bytes: %d\n", obtained.size);
+ */
+ }
+ sound->SetMixMusic(gSettingsCache.playMusic);
+ sound->SetMixFX(gSettingsCache.playEffects);
+ }
+
+ void Audio_Start(void) {
+ SDL_PauseAudio(0);
+ }
+
+ void Audio_Quit(void) {
+ SDL_PauseAudio(1);
+ Sound_Quit();
+ SDL_CloseAudio();
+ }
+
+ void Audio_LoadMusic(char *name) {
+ if(music != NULL) {
+ music->Stop();
+ music->SetRemovable();
+ }
+ music = new Sound::SourceMusic(sound);
+ music->Load(name);
+ music->SetLoop(255);
+ music->SetType(Sound::eSoundMusic);
+
+ char *sname = new char[32];
+ sprintf(sname, "music");
+ music->SetName(sname);
+ sound->AddSource(music);
+ }
+
+ void Audio_PlayMusic(void) {
+ music->Start();
+ }
+
+ void Audio_StopMusic(void) {
+ music->Stop();
+ }
+
+ void Audio_SetMusicVolume(float volume) {
+ music->SetVolume(volume);
+ }
+
+ void Audio_SetFxVolume(float volume) {
+ sample_engine->SetVolume(volume);
+ sample_crash->SetVolume(volume);
+ if(volume > 0.8f)
+ sample_recognizer->SetVolume(volume);
+ else
+ sample_recognizer->SetVolume(volume * 1.25f);
+ }
+
+ void Audio_StartEngine(int iPlayer) {
+ players[iPlayer]->Start();
+ }
+
+ void Audio_StopEngine(int iPlayer) {
+ players[iPlayer]->Stop();
+ }
+
+ void Audio_LoadPlayers(void) {
+ for(int i = 0; i < PLAYERS; i++) {
+ if(i != 0) {
+ players[i] = new Sound::Source3D(sound, sample_engine);
+ players[i]->SetType(Sound::eSoundFX);
+ sound->AddSource(players[i]);
+
+ char *name = new char[32];
+ sprintf(name, "player %d", i);
+ players[i]->SetName(name);
+
+ } else {
+ players[i] = new Sound::SourceEngine(sound, sample_engine);
+ players[i]->SetType(Sound::eSoundFX);
+ sound->AddSource(players[i]);
+
+ char *name = new char[32];
+ sprintf(name, "player %d", i);
+ players[i]->SetName(name);
+ }
+ }
+ recognizerEngine = new Sound::Source3D(sound, sample_recognizer);
+ recognizerEngine->SetType(Sound::eSoundFX);
+ recognizerEngine->Start();
+ sound->AddSource(recognizerEngine);
+
+ char *name = new char[32];
+ sprintf(name, "recognizer");
+ recognizerEngine->SetName(name);
+
+ }
+
+ void Audio_LoadSample(char *name, int number) {
+ switch(number) {
+ case 0:
+ sample_engine = new Sound::SourceSample(sound);
+ sample_engine->Load(name);
+ break;
+ case 1:
+ sample_crash = new Sound::SourceSample(sound);
+ sample_crash->Load(name);
+ break;
+ case 2:
+ sample_recognizer = new Sound::SourceSample(sound);
+ sample_recognizer->Load(name);
+ break;
+ default:
+ /* programmer error, but non-critical */
+ fprintf(stderr, "[error] unkown sample %d: '%s'\n", number, name);
+ }
+ }
+}
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
new file mode 100644
index 0000000..4d22999
--- /dev/null
+++ b/src/base/Makefile.am
@@ -0,0 +1,9 @@
+noinst_LIBRARIES=libbase.a
+
+libbase_a_SOURCES = \
+ util.c
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
diff --git a/src/base/Makefile.in b/src/base/Makefile.in
new file mode 100644
index 0000000..86fd79b
--- /dev/null
+++ b/src/base/Makefile.in
@@ -0,0 +1,296 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libbase.a
+
+libbase_a_SOURCES = \
+ util.c
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
+
+subdir = src/base
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libbase_a_AR = $(AR) cru
+libbase_a_LIBADD =
+am_libbase_a_OBJECTS = util.$(OBJEXT)
+libbase_a_OBJECTS = $(am_libbase_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/util.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libbase_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libbase_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/base/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libbase.a: $(libbase_a_OBJECTS) $(libbase_a_DEPENDENCIES)
+ -rm -f libbase.a
+ $(libbase_a_AR) libbase.a $(libbase_a_OBJECTS) $(libbase_a_LIBADD)
+ $(RANLIB) libbase.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/util.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/base/util.c b/src/base/util.c
new file mode 100644
index 0000000..0ebec6e
--- /dev/null
+++ b/src/base/util.c
@@ -0,0 +1,12 @@
+#include "filesystem/path.h"
+#include "Nebu_scripting.h"
+
+#include <stdlib.h>
+
+void runScript(int ePath, const char *name) {
+ char *s;
+ s = getPath(ePath, name);
+ scripting_RunFile(s);
+ free(s);
+}
+
diff --git a/src/configuration/Makefile.am b/src/configuration/Makefile.am
new file mode 100644
index 0000000..c5c3667
--- /dev/null
+++ b/src/configuration/Makefile.am
@@ -0,0 +1,9 @@
+noinst_LIBRARIES=libconfiguration.a
+
+libconfiguration_a_SOURCES = \
+ settings.c
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
diff --git a/src/configuration/Makefile.in b/src/configuration/Makefile.in
new file mode 100644
index 0000000..4edfc65
--- /dev/null
+++ b/src/configuration/Makefile.in
@@ -0,0 +1,296 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libconfiguration.a
+
+libconfiguration_a_SOURCES = \
+ settings.c
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
+
+subdir = src/configuration
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libconfiguration_a_AR = $(AR) cru
+libconfiguration_a_LIBADD =
+am_libconfiguration_a_OBJECTS = settings.$(OBJEXT)
+libconfiguration_a_OBJECTS = $(am_libconfiguration_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/settings.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libconfiguration_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libconfiguration_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/configuration/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libconfiguration.a: $(libconfiguration_a_OBJECTS) $(libconfiguration_a_DEPENDENCIES)
+ -rm -f libconfiguration.a
+ $(libconfiguration_a_AR) libconfiguration.a $(libconfiguration_a_OBJECTS) $(libconfiguration_a_LIBADD)
+ $(RANLIB) libconfiguration.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/settings.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/configuration/settings.c b/src/configuration/settings.c
new file mode 100644
index 0000000..67602a9
--- /dev/null
+++ b/src/configuration/settings.c
@@ -0,0 +1,145 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "base/util.h"
+#include "game/gltron.h"
+#include "filesystem/path.h"
+
+#define BUFSIZE 100
+#define MAX_VAR_NAME_LEN 64
+
+void checkSettings(void) {
+ /* sanity check: speed, grid_size */
+ if(getSettingf("speed") <= 0) {
+ fprintf(stderr, "[gltron] sanity check failed: speed = %.2ff\n",
+ getSettingf("speed"));
+ setSettingf("speed", 6.0);
+ fprintf(stderr, "[gltron] reset speed: speed = %.2f\n",
+ getSettingf("speed"));
+ }
+ if(getSettingi("grid_size") % 8) {
+ fprintf(stderr, "[gltron] sanity check failed: grid_size %% 8 != 0: "
+ "grid_size = %d\n", getSettingi("grid_size"));
+ setSettingi("grid_size", 240);
+ fprintf(stderr, "[gltron] reset grid_size: grid_size = %d\n",
+ getSettingi("grid_size"));
+ }
+}
+
+void saveSettings(void) {
+ char *script;
+ script = getPath(PATH_SCRIPTS, "save.lua");
+ scripting_RunFile(script);
+ free(script);
+
+#ifdef WIN32
+ scripting_RunFormat("writeto(\"%s\")", "gltron.ini");
+#else
+ {
+ char *path = getPossiblePath(PATH_PREFERENCES, RC_NAME);
+ if(path == NULL)
+ return;
+ scripting_RunFormat("writeto(\"%s\")", path);
+ free(path);
+ }
+#endif
+
+ scripting_Run("save()");
+ scripting_Run("write \"save_completed = 1\\n\"");
+ scripting_Run("writeto()"); // select stdout again
+}
+
+int getSettingi(const char *name) {
+ return (int) getSettingf(name);
+}
+
+int getVideoSettingi(const char *name) {
+ return (int) getVideoSettingf(name);
+}
+
+float getSettingf(const char *name) {
+ float value;
+ if( scripting_GetGlobal("settings", name, NULL) ) {
+ /* does not exit, return default */
+ fprintf(stderr, "error accessing setting '%s'!\n", name);
+ assert(0);
+ return 0;
+ }
+ if( scripting_GetFloatResult(&value) ) {
+ fprintf(stderr, "error reading setting '%s'!\n", name);
+ assert(0);
+ return 0;
+ }
+ return value;
+}
+
+float getVideoSettingf(const char *name) {
+ float value;
+ if( scripting_GetGlobal("video", "settings", name, NULL) ) {
+ /* does not exit, return default */
+ fprintf(stderr, "error accessing setting '%s'!\n", name);
+ assert(0);
+ return 0;
+ }
+ if( scripting_GetFloatResult(&value) ) {
+ fprintf(stderr, "error reading setting '%s'!\n", name);
+ assert(0);
+ return 0;
+ }
+ return value;
+}
+
+int isSetting(const char *name) {
+ scripting_GetGlobal("settings", name, NULL);
+ return ! scripting_IsNilResult();
+}
+
+void setSettingf(const char *name, float f) {
+ scripting_SetFloat( f, name, "settings", NULL );
+}
+
+void setSettingi(const char *name, int i) {
+ setSettingf(name, (float)i);
+}
+
+void updateSettingsCache(void) {
+ /* cache lua settings that don't change during play */
+ gSettingsCache.use_stencil = getSettingi("use_stencil");
+ gSettingsCache.show_scores = getSettingi("show_scores");
+ gSettingsCache.show_ai_status = getSettingi("show_ai_status");
+ gSettingsCache.ai_level = getSettingi("ai_level");
+ gSettingsCache.show_fps = getSettingi("show_fps");
+ gSettingsCache.show_console = getSettingi("show_console");
+ gSettingsCache.softwareRendering = getSettingi("softwareRendering");
+ gSettingsCache.line_spacing = getSettingi("line_spacing");
+ gSettingsCache.alpha_trails = getSettingi("alpha_trails");
+ gSettingsCache.antialias_lines = getSettingi("antialias_lines");
+ gSettingsCache.turn_cycle = getSettingi("turn_cycle");
+ gSettingsCache.light_cycles = getSettingi("light_cycles");
+ gSettingsCache.lod = getSettingi("lod");
+ gSettingsCache.fov = getSettingi("fov");
+
+ gSettingsCache.show_floor_texture = getVideoSettingi("show_floor_texture");
+ gSettingsCache.show_skybox = getVideoSettingi("show_skybox");
+ gSettingsCache.show_wall = getVideoSettingi("show_wall");
+ gSettingsCache.stretch_textures = getVideoSettingi("stretch_textures");
+ gSettingsCache.show_decals = getVideoSettingi("show_decals");
+
+ gSettingsCache.show_impact = getSettingi("show_impact");
+ gSettingsCache.show_glow = getSettingi("show_glow");
+ gSettingsCache.show_recognizer = getSettingi("show_recognizer");
+
+ gSettingsCache.fast_finish = getSettingi("fast_finish");
+ gSettingsCache.fov = getSettingf("fov");
+ gSettingsCache.znear = getSettingf("znear");
+ gSettingsCache.camType = getSettingi("camType");
+ gSettingsCache.playEffects = getSettingi("playEffects");
+ gSettingsCache.playMusic = getSettingi("playMusic");
+ gSettingsCache.map_ratio_w = getSettingf("map_ratio_w");
+ gSettingsCache.map_ratio_h = getSettingf("map_ratio_h");
+
+ scripting_GetGlobal("clear_color", NULL);
+ scripting_GetFloatArrayResult(gSettingsCache.clear_color, 4);
+}
diff --git a/src/filesystem/Makefile.am b/src/filesystem/Makefile.am
new file mode 100644
index 0000000..ce92bc4
--- /dev/null
+++ b/src/filesystem/Makefile.am
@@ -0,0 +1,8 @@
+noinst_LIBRARIES=libfilesystem.a
+
+libfilesystem_a_SOURCES = \
+ path.c dirsetup.c
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
diff --git a/src/filesystem/Makefile.in b/src/filesystem/Makefile.in
new file mode 100644
index 0000000..cf9e020
--- /dev/null
+++ b/src/filesystem/Makefile.in
@@ -0,0 +1,296 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libfilesystem.a
+
+libfilesystem_a_SOURCES = \
+ path.c dirsetup.c
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
+
+subdir = src/filesystem
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libfilesystem_a_AR = $(AR) cru
+libfilesystem_a_LIBADD =
+am_libfilesystem_a_OBJECTS = path.$(OBJEXT) dirsetup.$(OBJEXT)
+libfilesystem_a_OBJECTS = $(am_libfilesystem_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/dirsetup.Po $(DEPDIR)/path.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libfilesystem_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libfilesystem_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/filesystem/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libfilesystem.a: $(libfilesystem_a_OBJECTS) $(libfilesystem_a_DEPENDENCIES)
+ -rm -f libfilesystem.a
+ $(libfilesystem_a_AR) libfilesystem.a $(libfilesystem_a_OBJECTS) $(libfilesystem_a_LIBADD)
+ $(RANLIB) libfilesystem.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dirsetup.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/path.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/filesystem/dirsetup.c b/src/filesystem/dirsetup.c
new file mode 100644
index 0000000..321f040
--- /dev/null
+++ b/src/filesystem/dirsetup.c
@@ -0,0 +1,17 @@
+#include "filesystem/path.h"
+#include "filesystem/dirsetup.h"
+#include "Nebu_filesystem.h"
+
+#include "stdlib.h"
+
+const char* getHome() {
+ return getenv("HOME");
+}
+
+void dirSetup(const char *executable) {
+#ifdef LOCAL_DATA
+ goto_installpath(executable);
+#endif
+ initDirectories();
+}
+
diff --git a/src/filesystem/path.c b/src/filesystem/path.c
new file mode 100644
index 0000000..e98a8f6
--- /dev/null
+++ b/src/filesystem/path.c
@@ -0,0 +1,125 @@
+#include "filesystem/path.h"
+#include "filesystem/dirsetup.h"
+
+#include "Nebu_filesystem.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+// #include <unistd.h>
+#include <limits.h>
+
+#ifndef PATH_MAX
+// #warning PATH_MAX "is not defined in limits.h!"
+#define PATH_MAX 255
+#endif
+
+static char preferences_dir[PATH_MAX];
+static char snapshots_dir[PATH_MAX];
+static char data_dir[PATH_MAX];
+static char art_dir[PATH_MAX];
+static char music_dir[PATH_MAX];
+static char scripts_dir[PATH_MAX];
+
+void initDirectories(void) {
+ if(PREF_DIR[0] != '~')
+ sprintf(preferences_dir, PREF_DIR);
+ else
+ sprintf(preferences_dir, "%s%s", getHome(), PREF_DIR + 1);
+
+ if(SNAP_DIR[0] != '~')
+ sprintf(snapshots_dir, SNAP_DIR);
+ else
+ sprintf(snapshots_dir, "%s%s", getHome(), SNAP_DIR + 1);
+
+#ifdef LOCAL_DATA
+ #ifdef macintosh
+ sprintf(data_dir, ":data");
+ sprintf(art_dir, ":art");
+ sprintf(scripts_dir, ":scripts");
+ sprintf(music_dir, ":music");
+ #else
+ sprintf(data_dir, "data");
+ sprintf(art_dir, "art");
+ sprintf(scripts_dir, "scripts");
+ sprintf(music_dir, "music");
+ #endif
+
+#else
+ sprintf(data_dir, "%s%c%s", DATA_DIR, SEPARATOR, "data");
+ sprintf(art_dir, "%s%c%s", DATA_DIR, SEPARATOR, "art");
+ sprintf(scripts_dir, "%s%c%s", DATA_DIR, SEPARATOR, "scripts");
+ sprintf(music_dir, "%s%c%s", DATA_DIR, SEPARATOR, "music");
+#endif
+
+ /*
+ printf("directories:\n"
+ "\tprefs: %s\n"
+ "\tsnaps: %s\n"
+ "\tdata: %s\n"
+ "\tart: %s\n"
+ "\tscripts: %s\n"
+ "\tmusic: %s\n",
+ preferences_dir, snapshots_dir,
+ data_dir, art_dir, scripts_dir,
+ music_dir);
+ */
+
+ makeDirectory(preferences_dir);
+ makeDirectory(snapshots_dir);
+}
+
+char* getPath( int eLocation, const char *filename) {
+ char *path = getPossiblePath( eLocation, filename );
+ if( fileExists(path) )
+ return path;
+
+
+ fprintf(stderr, "*** failed to locate file '%s' at '%s' (type %d)\n",
+ filename, path, eLocation);
+ assert(0);
+
+ free(path);
+ return NULL;
+}
+
+char* getPossiblePath( int eLocation, const char *filename ) {
+ char *path = malloc( PATH_MAX );
+ sprintf(path, "%s%c%s", getDirectory( eLocation ), SEPARATOR, filename);
+ return path;
+}
+
+const char* getDirectory( int eLocation ) {
+ switch( eLocation ) {
+ case PATH_PREFERENCES: return preferences_dir; break;
+ case PATH_SNAPSHOTS: return snapshots_dir; break;
+ case PATH_DATA: return data_dir; break;
+ case PATH_SCRIPTS: return scripts_dir; break;
+ case PATH_MUSIC: return music_dir; break;
+ case PATH_ART: return art_dir; break;
+ default:
+ fprintf(stderr, "invalid path type\n");
+ assert(0);
+ }
+ return NULL;
+}
+char *getArtPath(const char *artpack, const char *filename ) {
+ char *path = malloc( PATH_MAX );
+ sprintf(path, "%s%c%s%c%s",
+ art_dir, SEPARATOR, artpack, SEPARATOR, filename);
+ if( fileExists(path) )
+ return path;
+
+ sprintf(path, "%s%c%s%c%s",
+ art_dir, SEPARATOR, "default", SEPARATOR, filename);
+ if( fileExists(path) )
+ return path;
+
+ fprintf(stderr, "*** failed to locate art file '%s', giving up\n", filename);
+ assert(0);
+
+ free(path);
+ return NULL;
+}
diff --git a/src/game/Makefile.am b/src/game/Makefile.am
new file mode 100644
index 0000000..976786c
--- /dev/null
+++ b/src/game/Makefile.am
@@ -0,0 +1,12 @@
+noinst_LIBRARIES=libgame.a
+
+libgame_a_SOURCES = \
+ camera.c computer.c computer_utilities.c credits.c \
+ engine.c event.c game.c globals.c gui.c \
+ init.c init_sdl.c menu.c pause.c \
+ timedemo.c switchCallbacks.c scripting_interface.c
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include \
+ -I$(top_srcdir)/lua/include
diff --git a/src/game/Makefile.in b/src/game/Makefile.in
new file mode 100644
index 0000000..32a3db9
--- /dev/null
+++ b/src/game/Makefile.in
@@ -0,0 +1,327 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libgame.a
+
+libgame_a_SOURCES = \
+ camera.c computer.c computer_utilities.c credits.c \
+ engine.c event.c game.c globals.c gui.c \
+ init.c init_sdl.c menu.c pause.c \
+ timedemo.c switchCallbacks.c scripting_interface.c
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include \
+ -I$(top_srcdir)/lua/include
+
+subdir = src/game
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libgame_a_AR = $(AR) cru
+libgame_a_LIBADD =
+am_libgame_a_OBJECTS = camera.$(OBJEXT) computer.$(OBJEXT) \
+ computer_utilities.$(OBJEXT) credits.$(OBJEXT) engine.$(OBJEXT) \
+ event.$(OBJEXT) game.$(OBJEXT) globals.$(OBJEXT) gui.$(OBJEXT) \
+ init.$(OBJEXT) init_sdl.$(OBJEXT) menu.$(OBJEXT) \
+ pause.$(OBJEXT) timedemo.$(OBJEXT) switchCallbacks.$(OBJEXT) \
+ scripting_interface.$(OBJEXT)
+libgame_a_OBJECTS = $(am_libgame_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/camera.Po $(DEPDIR)/computer.Po \
+@AMDEP_TRUE@ $(DEPDIR)/computer_utilities.Po \
+@AMDEP_TRUE@ $(DEPDIR)/credits.Po $(DEPDIR)/engine.Po \
+@AMDEP_TRUE@ $(DEPDIR)/event.Po $(DEPDIR)/game.Po \
+@AMDEP_TRUE@ $(DEPDIR)/globals.Po $(DEPDIR)/gui.Po \
+@AMDEP_TRUE@ $(DEPDIR)/init.Po $(DEPDIR)/init_sdl.Po \
+@AMDEP_TRUE@ $(DEPDIR)/menu.Po $(DEPDIR)/pause.Po \
+@AMDEP_TRUE@ $(DEPDIR)/scripting_interface.Po \
+@AMDEP_TRUE@ $(DEPDIR)/switchCallbacks.Po $(DEPDIR)/timedemo.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libgame_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libgame_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/game/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libgame.a: $(libgame_a_OBJECTS) $(libgame_a_DEPENDENCIES)
+ -rm -f libgame.a
+ $(libgame_a_AR) libgame.a $(libgame_a_OBJECTS) $(libgame_a_LIBADD)
+ $(RANLIB) libgame.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/camera.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/computer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/computer_utilities.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/credits.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/engine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/event.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/game.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/globals.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/gui.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/init.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/init_sdl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/menu.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pause.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/scripting_interface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/switchCallbacks.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/timedemo.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/game/camera.c b/src/game/camera.c
new file mode 100644
index 0000000..135c16d
--- /dev/null
+++ b/src/game/camera.c
@@ -0,0 +1,281 @@
+#include "video/video.h"
+#include "input/input.h"
+
+static void writeCamDefaults(Camera *cam, int type) {
+ cam_defaults[cam->type.type][type] = cam->movement[type];
+}
+
+#define CLAMP_R_MIN 6
+#define CLAMP_R_MAX 45
+#define CLAMP_CHI_MIN PI / 8
+#define CLAMP_CHI_MAX 3 * PI / 8
+
+static void clampCam(Camera *cam) {
+ if(cam->type.freedom[CAM_FREE_R]) {
+ if(cam->movement[CAM_R] < CLAMP_R_MIN)
+ cam->movement[CAM_R] = CLAMP_R_MIN;
+ if(cam->movement[CAM_R] > CLAMP_R_MAX)
+ cam->movement[CAM_R] = CLAMP_R_MAX;
+ }
+
+ if(cam->type.freedom[CAM_FREE_CHI]) {
+ if(cam->movement[CAM_CHI] < CLAMP_CHI_MIN)
+ cam->movement[CAM_CHI] = CLAMP_CHI_MIN;
+ if(cam->movement[CAM_CHI] > CLAMP_CHI_MAX)
+ cam->movement[CAM_CHI] = CLAMP_CHI_MAX;
+ }
+}
+
+static void initCircleCamera(Camera *cam) {
+ cam->movement[CAM_R] = cam_defaults[CAM_CIRCLE][CAM_R];
+ cam->movement[CAM_CHI] = cam_defaults[CAM_CIRCLE][CAM_CHI];
+ cam->movement[CAM_PHI] = cam_defaults[CAM_CIRCLE][CAM_PHI];
+ cam->movement[CAM_PHI_OFFSET] = 0;
+
+ cam->type.interpolated_cam = 0;
+ cam->type.interpolated_target = 0;
+ cam->type.coupled = 0;
+ cam->type.freedom[CAM_FREE_R] = 1;
+ cam->type.freedom[CAM_FREE_PHI] = 0;
+ cam->type.freedom[CAM_FREE_CHI] = 1;
+}
+
+
+static void initFollowCamera(Camera *cam) {
+ cam->movement[CAM_R] = cam_defaults[CAM_FOLLOW][CAM_R];
+ cam->movement[CAM_CHI] = cam_defaults[CAM_FOLLOW][CAM_CHI];
+ cam->movement[CAM_PHI] = cam_defaults[CAM_FOLLOW][CAM_PHI];
+ cam->movement[CAM_PHI_OFFSET] = 0;
+
+ cam->type.interpolated_cam = 1;
+ cam->type.interpolated_target = 0;
+ cam->type.coupled = 1;
+ cam->type.freedom[CAM_FREE_R] = 1;
+ cam->type.freedom[CAM_FREE_PHI] = 1;
+ cam->type.freedom[CAM_FREE_CHI] = 1;
+}
+
+static void initCockpitCamera(Camera *cam) {
+ cam->movement[CAM_R] = cam_defaults[CAM_COCKPIT][CAM_R];
+ cam->movement[CAM_CHI] = cam_defaults[CAM_COCKPIT][CAM_CHI];
+ cam->movement[CAM_PHI] = PI; // cam_defaults ignored
+ cam->movement[CAM_PHI_OFFSET] = 0;
+
+ cam->type.interpolated_cam = 0;
+ cam->type.interpolated_target = 1;
+ cam->type.coupled = 1;
+ cam->type.freedom[CAM_FREE_R] = 0;
+ cam->type.freedom[CAM_FREE_PHI] = 1;
+ cam->type.freedom[CAM_FREE_CHI] = 0;
+}
+
+
+static void initFreeCamera(Camera *cam) {
+ cam->movement[CAM_R] = cam_defaults[CAM_FREE][CAM_R];
+ cam->movement[CAM_CHI] = cam_defaults[CAM_FREE][CAM_CHI];
+ cam->movement[CAM_PHI] = cam_defaults[CAM_FREE][CAM_PHI];
+ cam->movement[CAM_PHI_OFFSET] = 0;
+
+ cam->type.interpolated_cam = 0;
+ cam->type.interpolated_target = 0;
+ cam->type.coupled = 0;
+ cam->type.freedom[CAM_FREE_R] = 1;
+ cam->type.freedom[CAM_FREE_PHI] = 1;
+ cam->type.freedom[CAM_FREE_CHI] = 1;
+}
+
+void initCamera(Camera *cam, Data *data, int type) {
+ float x,y;
+
+ getPositionFromData(&x, &y, data);
+
+ cam->type.type = type;
+
+ switch(cam->type.type) {
+ case CAM_TYPE_CIRCLING: initCircleCamera(cam); break;
+ case CAM_TYPE_FOLLOW: initFollowCamera(cam); break;
+ case CAM_TYPE_COCKPIT: initCockpitCamera(cam); break;
+ case CAM_TYPE_MOUSE: initFreeCamera(cam); break;
+ }
+ cam->target[0] = x;
+ cam->target[1] = y;
+ cam->target[2] = 0;
+
+ cam->cam[0] = x + CAM_CIRCLE_DIST;
+ cam->cam[1] = y;
+ cam->cam[2] = CAM_CIRCLE_Z;
+}
+
+/* place user into recognizer */
+void observerCamera(PlayerVisual *pV, Player *player) {
+ Camera *cam;
+ vec2 p, v;
+ getRecognizerPositionVelocity(&p, &v);
+
+ cam = player->camera;
+ cam->cam[0] = p.v[0];
+ cam->cam[1] = p.v[1];
+ cam->cam[2] = RECOGNIZER_HEIGHT;
+ cam->target[0] = p.v[0] + v.v[0];
+ cam->target[1] = p.v[1] + v.v[1];
+ cam->target[2] = RECOGNIZER_HEIGHT - 2;
+}
+
+void playerCamera(PlayerVisual *pV, Player *p) {
+ float dest[3];
+ float tdest[3];
+ float phi, chi, r;
+ float x, y;
+ Camera *cam;
+ Data *data;
+ /* first, process all movement commands */
+ /* that means, check for mouse input mainly */
+
+ /* dt hack: the time since the last frame is not necessarily the game
+ time, since the game maybe hasn't started yet, or was paused */
+ static int last=0;
+ int dt;
+
+ if(game2->time.dt == 0) {
+ dt = SystemGetElapsedTime() - last;
+ last = SystemGetElapsedTime();
+ } else {
+ dt = game2->time.dt;
+ }
+
+ cam = p->camera;
+ data = p->data;
+ getPositionFromData(&x, &y, data);
+
+ if(cam->type.freedom[CAM_FREE_R]) {
+ if(gInput.mouse1 == 1)
+ cam->movement[CAM_R] += (cam->movement[CAM_R]-CLAMP_R_MIN+1) * dt / 300.0f;
+ if(gInput.mouse2 == 1)
+ cam->movement[CAM_R] -= (cam->movement[CAM_R]-CLAMP_R_MIN+1) * dt / 300.0f;
+ writeCamDefaults(cam, CAM_R);
+ }
+
+ if(cam->type.freedom[CAM_FREE_PHI]) {
+ cam->movement[CAM_PHI] += - gInput.mousex * MOUSE_CX;
+ writeCamDefaults(cam, CAM_CHI);
+ }
+ if(cam->type.freedom[CAM_FREE_CHI]) {
+ cam->movement[CAM_CHI] += gInput.mousey * MOUSE_CY;
+ writeCamDefaults(cam, CAM_PHI);
+ }
+ /* done with mouse movement, now clamp the camera to legal values */
+ clampCam(cam);
+
+ phi = cam->movement[CAM_PHI] + cam->movement[CAM_PHI_OFFSET];
+ chi = cam->movement[CAM_CHI];
+ r = cam->movement[CAM_R];
+
+ /* if the cam is coupled to player movement, change the phi accordingly */
+ if(cam->type.coupled) {
+ int time = game2->time.current - p->data->turn_time;
+ if(time < TURN_LENGTH) {
+ int dir, ldir;
+ dir = p->data->dir;
+ ldir = p->data->last_dir;
+ if(dir == 1 && ldir == 2)
+ dir = 4;
+ if(dir == 2 && ldir == 1)
+ ldir = 4;
+ phi += ((TURN_LENGTH - time) * camAngles[ldir] +
+ time * camAngles[dir]) / TURN_LENGTH;
+ }
+ else
+ phi += camAngles[p->data->dir];
+ }
+
+ /* position the camera */
+ dest[0] = x + r * cosf(phi) * sinf(chi);
+ dest[1] = y + r * sinf(phi) * sinf(chi);
+ dest[2] = r * cosf(chi);
+
+ /* ok, now let's calculate the new camera destination coordinates */
+ /* also, perform some camera dependant movement */
+ switch(cam->type.type) {
+ case CAM_TYPE_CIRCLING: /* Andi-cam */
+ cam->movement[CAM_PHI] += CAM_SPEED * game2->time.dt;
+ tdest[0] = x;
+ tdest[1] = y;
+ tdest[2] = B_HEIGHT;
+ break;
+ case CAM_TYPE_FOLLOW: /* Mike-cam */
+ tdest[0] = x;
+ tdest[1] = y;
+ tdest[2] = B_HEIGHT;
+ break;
+ case CAM_TYPE_COCKPIT: /* 1st person */
+ tdest[0] = x + 4.0f * dirsX[ p->data->dir ] + 2.0f * cosf(phi);
+ tdest[1] = y + 4.0f * dirsY[ p->data->dir ] + 2.0f * sinf(phi);
+ tdest[2] = CAM_COCKPIT_Z;
+ dest[0] = x + 4.0f * dirsX[ p->data->dir ] + 0.1f * cosf(phi);
+ dest[1] = y + 4.0f * dirsY[ p->data->dir ] + 0.1f * sinf(phi);
+ dest[2] = CAM_COCKPIT_Z + 0.1f;
+ break;
+ case CAM_TYPE_MOUSE: /* mouse camera */
+ tdest[0] = x;
+ tdest[1] = y;
+ tdest[2] = B_HEIGHT;
+ break;
+ }
+ memcpy(cam->cam, dest, sizeof(cam->cam));
+ memcpy(cam->target, tdest, sizeof(cam->target));
+}
+
+void doCameraMovement(void) {
+ int i;
+ Player *p;
+ PlayerVisual *pV;
+
+ for(i = 0; i < game->players; i++) {
+ p = game->player + i;
+ pV = gPlayerVisuals + i;
+
+
+ if(p->data->speed == SPEED_GONE)
+ observerCamera(pV, p);
+ else
+ playerCamera(pV, p);
+ }
+
+ /* mouse events consumed */
+ gInput.mousex = 0;
+ gInput.mousey = 0;
+}
+
+void nextCameraType(void) {
+ int i;
+ int current_cam_type = getSettingi("camType");
+ int new_cam_type = (current_cam_type + 1) % CAM_COUNT;
+
+ setSettingi("camType", new_cam_type);
+
+ /* update the cached setting */
+ gSettingsCache.camType = new_cam_type;
+
+ for (i = 0; i < game->players; i++) {
+ if (game->player[i].ai->active == AI_HUMAN) {
+ initCamera(game->player[i].camera, game->player[i].data, new_cam_type);
+ }
+ }
+
+ if (getSettingi("debug_output")) {
+ switch (new_cam_type) {
+ case 0 :
+ displayMessage(TO_CONSOLE, "[camera] Circling Camera");
+ break;
+ case 1 :
+ displayMessage(TO_CONSOLE, "[camera] Behind Camera");
+ break;
+ case 2 :
+ displayMessage(TO_CONSOLE, "[camera] Cockpit Camera");
+ break;
+ case 3 :
+ displayMessage(TO_CONSOLE, "[camera] Mouse Camera");
+ break;
+ }
+ }
+}
diff --git a/src/game/computer.c b/src/game/computer.c
new file mode 100644
index 0000000..a641725
--- /dev/null
+++ b/src/game/computer.c
@@ -0,0 +1,169 @@
+#include "game/game.h"
+#include "game/ai.h"
+#include "video/video.h"
+
+#define LEFT(x) ((x + 3) % 4)
+#define RIGHT(x) ((x + 1) % 4)
+
+#define OPP_MAX_DIST (0.2f * game2->rules.grid_size)
+#define SAVE_T_DIFF 0.500f
+#define SAVE_SPEED_DIFF 1.0f
+#define HOPELESS_T 0.80f
+
+AI_Parameters ai_params = {
+ // minTurnTime, time to pass between turns, in milliseconds
+ { 600, 400, 200, 100 },
+ // maxSegLength
+ { 0.6f, 0.3f, 0.3f, 0.3f },
+ // critical
+ { 0.2f, 0.08037f, 0.08037f, 0.08037f },
+ // spiral, turns until a spiral is detected
+ { 10, 10, 10, 10 },
+ // rlDelta
+ { 0, 10, 20, 30 }
+};
+
+// play as if nothing concerned us
+void doComputerSimple(int player, int target, AI_Distances *distances) {
+ AI *ai;
+ Data *data;
+ Player *me, *him;
+ int level;
+
+ me = &(game->player[ player ]);
+ him = &(game->player[ target ]);
+ if(me->ai == NULL) {
+ printf("This player has no AI data!\n");
+ return;
+ }
+ data = me->data;
+ ai = me->ai;
+ level = gSettingsCache.ai_level;
+
+ // turn off booster
+ data->boost_enabled = 0;
+
+ /* avoid too short turns */
+ if(game2->time.current - ai->lasttime < ai_params.minTurnTime[level])
+ return;
+
+ // ai_getDistances(player, &front, &left, &right, &backleft);
+
+ /* first, check if we are in danger, or if we should consider
+ turning once in a while
+ */
+
+ if(distances->front > ai_params.critical[level] * game2->rules.grid_size &&
+ segment2_Length(data->trails + data->trailOffset) <
+ ai_params.maxSegLength[level] * game2->rules.grid_size)
+ return;
+
+ // printf("%.2f, %.2f, %.2f\n", distances->front,
+ // distances->left, distances->right);
+ /* decide where to turn */
+ if(distances->front > distances->right &&
+ distances->front > distances->left) {
+ return; /* no way out */
+ } else if(distances->left > ai_params.rlDelta[level] &&
+ abs(distances->right - distances->left) <
+ ai_params.rlDelta[level] &&
+ distances->backleft > distances->left &&
+ ai->tdiff < ai_params.spiral[level]) {
+ createEvent(player, EVENT_TURN_LEFT);
+ ai->tdiff++;
+ } else if(distances->right > distances->left &&
+ ai->tdiff > - ai_params.spiral[level] ) {
+ createEvent(player, EVENT_TURN_RIGHT);
+ ai->tdiff--;
+ // printf("turn right\n");
+ } else if(distances->right < distances->left &&
+ ai->tdiff < ai_params.spiral[level] ) {
+ createEvent(player, EVENT_TURN_LEFT);
+ ai->tdiff++;
+ // printf("turn left\n");
+ } else {
+ printf("tdiff decision\n");
+ if(ai->tdiff > 0) {
+ createEvent(player, EVENT_TURN_RIGHT);
+ ai->tdiff--;
+ // printf("turn right\n");
+ } else {
+ createEvent(player, EVENT_TURN_LEFT);
+ ai->tdiff++;
+ // printf("turn left\n");
+ }
+ }
+ ai->lasttime = game2->time.current;
+}
+
+// play against the other player, either cut him off, or take evasive action
+void doComputerActive(int player, int target, AI_Distances *distances) {
+ Data *data = game->player[player].data;
+ AI *ai = game->player[player].ai;
+
+ AI_Configuration config;
+
+ if(game2->time.current - ai->lasttime < 200)
+ return;
+
+ ai_getConfig(player, target, &config);
+
+ // who's going to reach the intersection point first?
+ // printf("active, location %d (direction: %d)\n",
+ // config.location, data->dir);
+
+ switch(config.location) {
+ case 0: case 7:
+ case 1: case 6:
+ if(config.t_player < config.t_opponent) {
+ // printf("I'm ahead: %.2f, %.2f\n", config.t_player, config.t_opponent);
+ if(config.t_player - config.t_opponent < SAVE_T_DIFF)
+ data->boost_enabled = 1;
+ if(game->player[player].data->speed -
+ game->player[target].data->speed < SAVE_SPEED_DIFF)
+ data->boost_enabled = 1;
+ // aggressive
+ ai_aggressive(player, target, config.location, distances);
+ } else {
+ // printf("I'm behind: %.2f, %.2f\n",
+ // config.t_player, config.t_opponent);
+ // check speed, adjust or evasive
+ if(config.t_opponent < HOPELESS_T) {
+ // evasive
+ ai_evasive(player, target, config.location, distances);
+ } else if(config.t_opponent - config.t_player < SAVE_T_DIFF) {
+ data->boost_enabled = 1;
+ // aggressive
+ ai_aggressive(player, target, config.location, distances);
+ } else {
+ // evasive
+ ai_evasive(player, target, config.location, distances);
+ }
+ }
+ break;
+ case 2: case 4:
+ case 3: case 5:
+ doComputerSimple(player, target, distances);
+ break;
+ }
+}
+
+void doComputer(int player, int target) {
+ float d;
+ int opponent;
+ AI_Distances distances;
+
+ ai_getDistances(player, &distances);
+ ai_getClosestOpponent(player, &opponent, &d);
+ if(opponent == -1 || d > OPP_MAX_DIST || distances.front < d ||
+ game->player[opponent].ai == NULL ||
+ game->player[opponent].ai->active == 1 ||
+ gSettingsCache.ai_level == 0 /* dumb setting */) {
+ // only fight humans
+ // printf("inactive, closest opponent: %d, distance %.2f, front %.2f\n",
+ // opponent, d, distances.front);
+ doComputerSimple(player, target, &distances);
+ } else {
+ doComputerActive(player, opponent, &distances);
+ }
+}
diff --git a/src/game/computer_utilities.c b/src/game/computer_utilities.c
new file mode 100644
index 0000000..d191b3b
--- /dev/null
+++ b/src/game/computer_utilities.c
@@ -0,0 +1,313 @@
+#include "game/game.h"
+#include "game/ai.h"
+#include <math.h>
+#include <float.h>
+
+#ifndef FLT_MAX
+#define FLT_MAX 10000.0f
+#endif
+
+void ai_getClosestOpponent(int player, int* opponent, float *distance) {
+ int i;
+ vec2 v_player;
+ vec2 v_opponent;
+
+ *opponent = -1;
+ *distance = FLT_MAX;
+
+ getPositionFromIndex(v_player.v + 0, v_player.v + 1, player);
+
+ for(i = 0; i < game->players; i++) {
+ if(i == player)
+ continue;
+ if(game->player[i].data->speed > 0) {
+ vec2 diff;
+ float d;
+
+ getPositionFromIndex(v_opponent.v + 0, v_opponent.v + 1, i);
+ vec2Sub(&diff, &v_player, &v_opponent);
+ // use manhattan distance instead of euclidean distance
+ d = fabs(diff.v[0]) + fabs(diff.v[1]);
+ // d = vec2Length(&diff);
+ if(d < *distance) {
+ *opponent = i;
+ *distance = d;
+ }
+ }
+ }
+}
+
+void ai_getDistances(int player, AI_Distances *distances) {
+ enum { eFront = 0, eLeft, eRight, eBackleft, eMax };
+ segment2 segments[eMax];
+ vec2 v, vPos;
+ Data *data = game->player[player].data;
+ int dirLeft = (data->dir + 3) % 4;
+ int dirRight = (data->dir + 1) % 4;
+ int i, j;
+ float *front = &distances->front;
+ float *right = &distances->right;
+ float *left = &distances->left;
+ float *backleft = &distances->backleft;
+
+ getPositionFromIndex(vPos.v + 0, vPos.v + 1, player);
+
+ for(i = 0; i < eMax; i++) {
+ vec2Copy(&segments[i].vStart, &vPos);
+ }
+
+ segments[eFront].vDirection.v[0] = dirsX[data->dir];
+ segments[eFront].vDirection.v[1] = dirsY[data->dir];
+ segments[eLeft].vDirection.v[0] = dirsX[dirLeft];
+ segments[eLeft].vDirection.v[1] = dirsY[dirLeft];
+ segments[eRight].vDirection.v[0] = dirsX[dirRight];
+ segments[eRight].vDirection.v[1] = dirsY[dirRight];
+ segments[eBackleft].vDirection.v[0] = dirsX[dirLeft] - dirsX[data->dir];
+ segments[eBackleft].vDirection.v[1] = dirsY[dirLeft] - dirsY[data->dir];
+ vec2Normalize(&segments[eBackleft].vDirection,
+ &segments[eBackleft].vDirection);
+ *front = FLT_MAX;
+ *left = FLT_MAX;
+ *right = FLT_MAX;
+ *backleft = FLT_MAX;
+
+ // loop over all segment
+ for(i = 0; i < game->players; i++) {
+ segment2 *wall = game->player[i].data->trails;
+ if(game->player[i].data->trail_height < TRAIL_HEIGHT)
+ continue;
+
+ for(j = 0; j < game->player[i].data->trailOffset + 1; j++) {
+ float t1, t2;
+ if(i == player && j == game->player[i].data->trailOffset)
+ break;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eFront, wall) &&
+ t1 > 0 && t1 < *front && t2 >= 0 && t2 <= 1)
+ *front = t1;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eLeft, wall) &&
+ t1 > 0 && t1 < *left && t2 >= 0 && t2 <= 1)
+ *left = t1;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eRight, wall) &&
+ t1 > 0 && t1 < *right && t2 >= 0 && t2 <= 1)
+ *right = t1;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eBackleft, wall) &&
+ t1 > 0 && t1 < *backleft && t2 >= 0 && t2 <= 1)
+ *backleft = t1;
+ wall++;
+ }
+ }
+ for(i = 0; i < 4; i++) {
+ float t1, t2;
+ segment2* wall = walls + i;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eFront, wall) &&
+ t1 > 0 && t1 < *front && t2 >= 0 && t2 <= 1)
+ *front = t1;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eLeft, wall) &&
+ t1 > 0 && t1 < *left && t2 >= 0 && t2 <= 1)
+ *left = t1;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eRight, wall) &&
+ t1 > 0 && t1 < *right && t2 >= 0 && t2 <= 1)
+ *right = t1;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eBackleft, wall) &&
+ t1 > 0 && t1 < *backleft && t2 >= 0 && t2 <= 1)
+ *backleft = t1;
+ }
+
+ // update debug render segments
+ {
+ AI *ai = game->player[player].ai;
+ vec2Copy(&ai->front.vStart, &vPos);
+ vec2Copy(&ai->left.vStart, &vPos);
+ vec2Copy(&ai->right.vStart, &vPos);
+ vec2Copy(&ai->backleft.vStart, &vPos);
+
+ ai->front.vDirection.v[0] = *front * dirsX[data->dir];
+ ai->front.vDirection.v[1] = *front * dirsY[data->dir];
+ ai->left.vDirection.v[0] = *left * dirsX[dirLeft];
+ ai->left.vDirection.v[1] = *left * dirsY[dirLeft];
+ ai->right.vDirection.v[0] = *right * dirsX[dirRight];
+ ai->right.vDirection.v[1] = *right * dirsY[dirRight];
+ ai->backleft.vDirection.v[0] = dirsX[dirLeft] - dirsX[data->dir];
+ ai->backleft.vDirection.v[1] = dirsY[dirLeft] - dirsY[data->dir];
+ vec2Normalize(&ai->backleft.vDirection,
+ &ai->backleft.vDirection);
+ vec2Scale(&ai->backleft.vDirection,
+ &ai->backleft.vDirection,
+ *backleft);
+ }
+
+ // printf("%.2f, %.2f, %.2f\n", *front, *right, *left);
+ return;
+}
+
+void ai_getConfig(int player, int target,
+ AI_Configuration *config) {
+
+ Data *data;
+
+ getPositionFromIndex(config->player.vStart.v + 0,
+ config->player.vStart.v + 1,
+ player);
+ getPositionFromIndex(config->opponent.vStart.v + 0,
+ config->opponent.vStart.v + 1,
+ target);
+
+ data = game->player[player].data;
+ config->player.vDirection.v[0] = dirsX[ data->dir ] * data->speed;
+ config->player.vDirection.v[1] = dirsY[ data->dir ] * data->speed;
+
+ data = game->player[target].data;
+ config->opponent.vDirection.v[0] = dirsX[ data->dir ] * data->speed;
+ config->opponent.vDirection.v[1] = dirsY[ data->dir ] * data->speed;
+
+ // compute sector
+ {
+ vec2 diff;
+ vec3 v1, v2, v3;
+ vec3 up = { { 0, 0, 1 } };
+ float cosphi;
+ float phi;
+ int i;
+
+ vec2Sub(&diff, &config->player.vStart, &config->opponent.vStart);
+ v1.v[0] = diff.v[0];
+ v1.v[1] = diff.v[1];
+ v1.v[2] = 0;
+
+ v2.v[0] = config->opponent.vDirection.v[0];
+ v2.v[1] = config->opponent.vDirection.v[1];
+ v2.v[2] = 0;
+
+ vec3Normalize(&v1, &v1);
+ vec3Normalize(&v2, &v2);
+
+ vec3Cross(&v3, &v1, &v2);
+ vec3Normalize(&v3, &v3);
+
+ cosphi = vec3Dot(&v1, &v2);
+ clamp(&cosphi, -1, 1);
+ phi = acos(cosphi);
+ if(vec3Dot(&v3, &up) > 0)
+ phi = 2 * M_PI - phi;
+
+ for(i = 0; i < 8; i++) {
+ phi -= M_PI / 4;
+ if(phi < 0) {
+ config->location = i;
+ break;
+ }
+ }
+ }
+ // compute intersection
+ {
+ segment2 seg1;
+ segment2 seg2;
+ seg1.vStart = config->opponent.vStart;
+ seg1.vDirection = config->opponent.vDirection;
+ seg2.vStart = config->player.vStart;
+ vec2_Orthogonal( &seg2.vDirection, &config->opponent.vDirection );
+ vec2Normalize( &seg2.vDirection, &seg2.vDirection );
+ vec2Scale( &seg2.vDirection,
+ &seg2.vDirection,
+ vec2Length( &config->player.vDirection )
+ );
+
+ segment2_Intersect( &config->intersection,
+ &config->t_opponent, &config->t_player,
+ &seg1, &seg2 );
+ if(config->t_player < 0)
+ config->t_player *= -1;
+ }
+
+}
+
+void ai_left(int player, AI_Distances *distances) {
+ // printf("trying left turn...");
+ AI *ai = game->player[player].ai;
+ Data *data = game->player[player].data;
+ int level = gSettingsCache.ai_level;
+
+ float save_distance =
+ (ai_params.minTurnTime[level] * data->speed / 1000.0f) + 20;
+
+ if(distances->left > save_distance) {
+ createEvent(player, EVENT_TURN_LEFT);
+ ai->tdiff++;
+ ai->lasttime = game2->time.current;
+ // printf("succeeded\n");
+ } else {
+ // printf("failed\n");
+ }
+}
+
+void ai_right(int player, AI_Distances *distances) {
+ // printf("trying right turn...");
+ AI *ai = game->player[player].ai;
+ Data *data = game->player[player].data;
+ int level = gSettingsCache.ai_level;
+
+ float save_distance =
+ (ai_params.minTurnTime[level] * data->speed / 1000.0f) + 20;
+
+ if(distances->right > save_distance) {
+ createEvent(player, EVENT_TURN_RIGHT);
+ ai->tdiff--;
+ ai->lasttime = game2->time.current;
+ // printf("succeeded\n");
+ } else {
+ // printf("failed\n");
+ }
+}
+
+int agressive_action[8][4] = {
+ { 2, 0, 2, 2 },
+ { 0, 1, 1, 2 },
+ { 0, 1, 1, 2 },
+ { 0, 1, 1, 2 },
+ { 0, 2, 2, 1 },
+ { 0, 2, 2, 1 },
+ { 0, 2, 2, 1 },
+ { 1, 1, 1, 0 }
+};
+
+int evasive_action[8][4] = {
+ { 1, 1, 2, 2 },
+ { 1, 1, 2, 0 },
+ { 1, 1, 2, 0 },
+ { 1, 1, 2, 0 },
+ { 2, 0, 1, 1 },
+ { 2, 0, 1, 1 },
+ { 2, 0, 1, 1 },
+ { 2, 2, 1, 1 }
+};
+
+
+void ai_action(int action, int player, AI_Distances *distances) {
+ switch(action) {
+ case 0: break;
+ case 1: ai_left(player, distances); break;
+ case 2: ai_right(player, distances); break;
+ }
+}
+
+void ai_aggressive(int player, int target, int location,
+ AI_Distances *distances) {
+ int dirdiff = (4 +
+ game->player[player].data->dir -
+ game->player[target].data->dir) % 4;
+
+ // printf("aggressive mode (%d, %d)\n", player, target, location, dirdiff);
+
+ ai_action(agressive_action[location][dirdiff], player, distances);
+}
+
+void ai_evasive(int player, int target, int location,
+ AI_Distances *distances) {
+ int dirdiff = (4 +
+ game->player[player].data->dir -
+ game->player[target].data->dir) % 4;
+ // printf("evasive mode (%d,%d,%d)\n", player, target, location);
+
+ ai_action(evasive_action[location][dirdiff], player, distances);
+}
+
diff --git a/src/game/credits.c b/src/game/credits.c
new file mode 100644
index 0000000..e94832b
--- /dev/null
+++ b/src/game/credits.c
@@ -0,0 +1,87 @@
+#include "game/gltron.h"
+
+static int coffset;
+
+char *credits[] = {
+ "",
+ " GLtron is written by " "\x03" "4" "Andreas Umbach",
+ "",
+ " Contributors:",
+ " Programming: Darrell Walisser Nicolas Deniaud",
+ " Todd Kirby Andy Howe Jon Atkins",
+ " Art: Nicolas Zimmermann",
+ " Charles Babbage Tracy Brown"
+ " Tyler Esselstrom Allen Bond",
+ " Music: Peter Hajba",
+ " Sound: Damon Law",
+ "",
+ "Additional Thanks to:",
+ "Xavier Bouchoux Mike Field Steve Baker",
+ "Jean-Bruno Richard Andrey Zahkhatov",
+ "Bjonar Henden Shaul Kedem Jonas Gustavsson",
+ "Mattias Engdegard Ray Kelm Thomas Flynn",
+ "Martin Fierz Joseph Valenzuela Ryan Gordon",
+ "Sam Lantinga Patrick McCarthy",
+ "",
+ "Thanks to my sponsors:",
+ " 3dfx: Voodoo5 5500 graphics card",
+ " Right Hemisphere: 3D exploration software",
+ NULL
+};
+
+void mouseCredits (int buttons, int state, int x, int y)
+{
+ if ( state == SYSTEM_MOUSEPRESSED ) {
+ SystemExit();
+ exit(0);
+ }
+}
+
+void keyCredits(int state, int k, int x, int y)
+{
+ if(state == SYSTEM_KEYSTATE_UP)
+ return;
+ SystemExit();
+ exit(0);
+}
+
+void idleCredits(void) {
+ scripting_RunGC();
+ SystemPostRedisplay();
+}
+
+void drawCredits(void) {
+ int time;
+ int x, y;
+ int h;
+ int i;
+ float colors[][3] = { { 1.0, 0.0, 0.0 }, { 1.0, 1.0, 1.0 } };
+ time = SystemGetElapsedTime() - coffset;
+
+ glClearColor(.0, .0, .0, .0);
+ glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ rasonly(gScreen);
+ h = gScreen->vp_h / (24 * 3 / 2);
+ for(i = 0; i < time / 250; i++) {
+ glColor3fv(colors[i % 2]);
+ if(credits[i] == NULL)
+ break;
+ x = 10;
+ y = gScreen->vp_h - 3 * h * (i + 1) / 2;
+ drawText(gameFtx, x, y, h, credits[i]);
+ }
+}
+void displayCredits(void) {
+ drawCredits();
+ SystemSwapBuffers();
+}
+
+void initCredits(void) {
+ coffset = SystemGetElapsedTime();
+}
+
+Callbacks creditsCallbacks = {
+ displayCredits, idleCredits, keyCredits, initCredits,
+ NULL, NULL, mouseCredits, NULL, "credits"
+};
diff --git a/src/game/engine.c b/src/game/engine.c
new file mode 100644
index 0000000..27b3059
--- /dev/null
+++ b/src/game/engine.c
@@ -0,0 +1,221 @@
+#include "game/game.h"
+#include "video/video.h"
+#include "audio/audio.h"
+#include "Nebu_base.h"
+
+#include <math.h>
+
+void getPositionFromIndex(float *x, float *y, int player) {
+ getPositionFromData(x, y, game->player[player].data);
+}
+
+void getPositionFromData(float *x, float *y, Data *data) {
+ vec2 v;
+ vec2Add(&v,
+ &data->trails[data->trailOffset].vStart,
+ &data->trails[data->trailOffset].vDirection);
+ *x = v.v[0];
+ *y = v.v[1];
+}
+
+void initGameStructures(void) { /* called only once */
+ int i;
+
+ /* initialize some global variables */
+ game2 = &main_game2;
+ game = &main_game;
+ game->pauseflag = PAUSE_NO_GAME;
+
+ game->winner = -1;
+
+ game->players = PLAYERS;
+ game->player = (Player *) malloc(MAX_PLAYERS * sizeof(Player));
+
+ for(i = 0; i < game->players; i++) {
+ Player *p = game->player + i;
+
+ p->ai = (AI*) malloc(sizeof(AI));
+ p->data = (Data*) malloc(sizeof(Data));
+ p->data->trails = (segment2*) malloc(MAX_TRAIL * sizeof(segment2));
+ p->data->trailOffset = 0;
+ p->camera = (Camera*) malloc(sizeof(Camera));
+ }
+
+ game2->events.next = NULL;
+ game2->mode = GAME_SINGLE;
+}
+
+void resetPlayerData(void) {
+ int i;
+ Data *data;
+ AI *ai;
+ int not_playing = 0;
+
+ int *startIndex;
+ startIndex = malloc( game->players * sizeof(int) );
+ randomPermutation(game->players, startIndex);
+
+ for(i = 0; i < game->players; i++) {
+ float startpos[][2] = {
+ { 0.5, 0.25 }, { 0.75, 0.5 }, { 0.5, 0.75 }, { 0.25, 0.5 }
+ };
+ float x, y;
+
+ data = game->player[i].data;
+ ai = game->player[i].ai;
+ /* init ai */
+
+ switch(i) {
+ case 0: ai->active = getSettingi("ai_player1"); break;
+ case 1: ai->active = getSettingi("ai_player2"); break;
+ case 2: ai->active = getSettingi("ai_player3"); break;
+ case 3: ai->active = getSettingi("ai_player4"); break;
+ default:
+ fprintf(stderr, "[error] player index #%d not caught!\n", i);
+ ai->active = AI_NONE;
+ }
+ ai->tdiff = 0;
+
+ /* arrange players in circle around center */
+
+ /* randomize position on the grid */
+ x = startpos[ startIndex[i] ][0] * getSettingi("grid_size");
+ y = startpos[ startIndex[i] ][1] * getSettingi("grid_size");
+ /* randomize starting direction */
+ data->dir = trand() & 3;
+ /* data->dir = startdir[i]; */
+ data->last_dir = data->dir;
+
+ /* if player is playing... */
+ if(ai->active != AI_NONE) {
+ data->speed = getSettingf("speed");
+ data->booster = getSettingf("booster_max");
+ data->boost_enabled = 0;
+ data->trail_height = TRAIL_HEIGHT;
+ } else {
+ data->speed = SPEED_GONE;
+ data->trail_height = 0;
+ not_playing++;
+ }
+ // data->trail = data->trails;
+ data->trailOffset = 0;
+
+ data->trails[ data->trailOffset ].vStart.v[0] = x;
+ data->trails[ data->trailOffset ].vStart.v[1] = y;
+
+ data->trails[ data->trailOffset ].vDirection.v[0] = 0;
+ data->trails[ data->trailOffset ].vDirection.v[1] = 0;
+
+ {
+ int camType;
+ Camera *cam = game->player[i].camera;
+ camType = (game->player[i].ai->active == AI_COMPUTER) ?
+ CAM_CIRCLE : gSettingsCache.camType;
+ initCamera(cam, data, camType);
+ }
+ }
+
+ free(startIndex);
+
+ game->running = game->players - not_playing; /* not everyone is alive */
+ /* printf("starting game with %d players\n", game->running); */
+ game->winner = -1;
+}
+
+void initData(void) {
+ /* lasttime = SystemGetElapsedTime(); */
+ game->pauseflag = PAUSE_GAME_RUNNING;
+
+ game2->rules.speed = getSettingf("speed");
+ game2->rules.eraseCrashed = getSettingi("erase_crashed");
+ game2->rules.grid_size = getSettingi("grid_size");
+
+ game2->grid.width = game2->rules.grid_size;
+ game2->grid.height = game2->rules.grid_size;
+
+ /* time management */
+ game2->time.lastFrame = 0;
+ game2->time.current = 0;
+ game2->time.offset = SystemGetElapsedTime();
+ /* TODO: fix that */
+ game2->players = game->players;
+ /* event management */
+ game2->events.next = NULL;
+ /* TODO: free any old events that might have gotten left */
+
+ resetVideoData();
+ resetPlayerData();
+
+ initWalls();
+}
+
+void Time_Idle(void) {
+ game2->time.lastFrame = game2->time.current;
+ game2->time.current = SystemGetElapsedTime() - game2->time.offset;
+ game2->time.dt = game2->time.current - game2->time.lastFrame;
+ /* fprintf(stderr, "dt: %d\n", game2->time.dt); */
+}
+
+void resetScores(void) {
+ int i;
+ for(i = 0; i < game->players; i++)
+ game->player[i].data->score = 0;
+}
+
+void doCrashPlayer(GameEvent *e) {
+ int j;
+
+ Audio_CrashPlayer(e->player);
+ Audio_StopEngine(e->player);
+
+ for(j = 0; j < game->players; j++)
+ if(j != e->player && PLAYER_IS_ACTIVE(&(game->player[j])))
+ game->player[j].data->score++;
+
+ game->player[e->player].data->speed = SPEED_CRASHED;
+}
+
+void newTrail(Data* data) {
+ segment2 *s;
+ float x, y;
+
+ getPositionFromData(&x, &y, data);
+
+ data->trailOffset++;
+ s = data->trails + data->trailOffset;
+
+ s->vStart.v[0] = x;
+ s->vStart.v[1] = y;
+ s->vDirection.v[0] = 0;
+ s->vDirection.v[1] = 0;
+
+}
+
+void doTurn(GameEvent *e, int direction) {
+ Data *data = game->player[e->player].data;
+ newTrail(data);
+ data->last_dir = data->dir;
+ data->dir = (data->dir + direction) % 4;
+ data->turn_time = game2->time.current;
+}
+
+void initWalls(void) {
+ float raw[4][4] = {
+ { 0.0f, 0.0f, 1.0f, 0.0f },
+ { 1.0f, 0.0f, 0.0f, 1.0f },
+ { 1.0f, 1.0f, -1.0f, 0.0f },
+ { 0.0f, 1.0f, 0.0f, -1.0f }
+ };
+
+ float width = game2->rules.grid_size;
+ float height = game2->rules.grid_size;
+
+ int j;
+
+ for(j = 0; j < 4; j++) {
+ walls[j].vStart.v[0] = raw[j][0] * width;
+ walls[j].vStart.v[1] = raw[j][1] * height;
+ walls[j].vDirection.v[0] = raw[j][2] * width;
+ walls[j].vDirection.v[1] = raw[j][3] * height;
+ }
+}
diff --git a/src/game/event.c b/src/game/event.c
new file mode 100644
index 0000000..8cfff3b
--- /dev/null
+++ b/src/game/event.c
@@ -0,0 +1,445 @@
+#include <math.h>
+#include <float.h>
+
+#include "video/video.h"
+#include "game/game.h"
+#include "audio/audio.h"
+#include "Nebu_scripting.h"
+
+/*! \fn int processEvent(GameEvent* e)
+ handle events, e.g.
+ left/right/crash/stop
+
+ frees e
+*/
+
+int processEvent(GameEvent* e) {
+ int value = 0;
+
+#ifdef RECORD
+ if(game2->mode == GAME_SINGLE_RECORD) {
+ writeEvent(e);
+ }
+#endif
+ switch(e->type) {
+ case EVENT_TURN_LEFT:
+ doTurn(e, TURN_LEFT);
+ break;
+ case EVENT_TURN_RIGHT:
+ doTurn(e, TURN_RIGHT);
+ break;
+ case EVENT_CRASH:
+ displayMessage(TO_CONSOLE, "player %d crashed", e->player + 1);
+ doCrashPlayer(e);
+ break;
+ case EVENT_STOP:
+ // displayMessage(TO_STDOUT, "game stopped");
+#ifdef RECORD
+ if(game2->mode == GAME_SINGLE_RECORD) {
+ stopRecording();
+ game2->mode = GAME_SINGLE;
+ } else if(game2->mode == GAME_PLAY) {
+ stopPlaying();
+ game2->mode = GAME_SINGLE;
+ }
+#endif
+ if(e->player<PLAYERS && game->player[e->player].ai->active != AI_NONE) {
+ game->winner = e->player;
+ displayMessage(TO_CONSOLE, "winner: %d", game->winner + 1);
+ } else {
+ game->winner = -2;
+ displayMessage(TO_CONSOLE, "everyone died! no one wins!");
+ }
+ SystemExitLoop(RETURN_GAME_END);
+ game->pauseflag = PAUSE_GAME_FINISHED;
+ value = 1;
+ break;
+ }
+ free(e);
+ return value;
+}
+
+int crashTestPlayers(int i, const segment2 *movement) {
+ int j, k;
+ int crash = 0;
+ Data *data = game->player[i].data;
+ segment2 *current = data->trails + data->trailOffset;
+ // debug: only test player0 against himself
+ // j = 0;
+ // if(i == 0) {
+ for(j = 0; j < game->players; j++) {
+ int crash = 0;
+
+ if(game->player[j].data->trail_height < TRAIL_HEIGHT)
+ continue;
+
+ for(k = 0; k < game->player[j].data->trailOffset + 1; k++) {
+ segment2 *wall;
+ vec2 v;
+ float t1, t2;
+
+ if(j == i && k >= game->player[j].data->trailOffset - 1)
+ break;
+
+ wall = game->player[j].data->trails + k;
+
+ if(segment2_Intersect(&v, &t1, &t2, movement, wall)) {
+#if 0
+ printf("(%.2f, %.2f), (%.2f, %.2f), %.2f, %.2f\n",
+ data->posx, data->posy,
+ v.v[0], v.v[1],
+ t1, t2);
+#endif
+ if(t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {
+ current->vDirection.v[0] = v.v[0] - current->vStart.v[0];
+ current->vDirection.v[1] = v.v[1] - current->vStart.v[1];
+ createEvent(i, EVENT_CRASH);
+ crash = 1;
+ break;
+ }
+ }
+ }
+ if(crash)
+ break;
+ }
+ return crash;
+}
+
+int crashTestWalls(int i, const segment2 *movement) {
+ int j;
+ vec2 v;
+ float t1, t2;
+ int crash = 0;
+
+ Data *data = game->player[i].data;
+ segment2 *current = data->trails + data->trailOffset;
+
+ for(j = 0; j < 4; j++) {
+ if(segment2_Intersect(&v, &t1, &t2, current, walls + j)) {
+ if(t1 >= 0 && t1 < 1 && t2 >= 0 && t2 < 1) {
+ current->vDirection.v[0] = v.v[0] - current->vStart.v[0];
+ current->vDirection.v[1] = v.v[1] - current->vStart.v[1];
+ createEvent(i, EVENT_CRASH);
+ crash = 1;
+ break;
+ }
+ }
+ }
+ return crash;
+}
+
+int applyBooster(int player, int dt) {
+ Data *data = game->player[player].data;
+ if(data->booster > 0 && data->boost_enabled) {
+ float boost = getSettingf("booster_use") * dt / 1000.0f;
+ if(boost > data->booster) {
+ boost = data->booster;
+ data->boost_enabled = 0;
+ }
+ data->speed += boost;
+ data->booster -= boost;
+ return 1;
+ }
+ else {
+ float booster_max = getSettingf("booster_max");
+ if(data->booster < booster_max) {
+ data->booster += getSettingf("booster_regenerate") * dt / 1000.0f;
+ if(data->booster > booster_max)
+ data->booster = booster_max;
+ }
+ return 0;
+ }
+}
+
+void applyDecceleration(int player, int dt, float factor) {
+ Data *data = game->player[player].data;
+ if(data->speed > game2->rules.speed) {
+ float decrease = factor * dt / 1000.0f;
+ data->speed -= decrease;
+ if(data->speed < game2->rules.speed)
+ data->speed = game2->rules.speed;
+ }
+}
+
+int applyWallAcceleration(int player, int dt) {
+ // find distance to enemy walls left & right
+ enum { eLeft, eRight, eMax };
+ segment2 segments[eMax];
+
+ Data *data = game->player[player].data;
+ int dirLeft = (data->dir + 3) % 4;
+ int dirRight = (data->dir + 1) % 4;
+
+ float left, right;
+
+ float x, y;
+ vec2 vPos;
+
+ int i, j;
+
+ getPositionFromIndex(&x, &y, player);
+ vPos.v[0] = x;
+ vPos.v[1] = y;
+
+ for(i = 0; i < eMax; i++) {
+ vec2Copy(&segments[i].vStart, &vPos);
+ }
+
+ segments[eLeft].vDirection.v[0] = dirsX[dirLeft];
+ segments[eLeft].vDirection.v[1] = dirsY[dirLeft];
+ segments[eRight].vDirection.v[0] = dirsX[dirRight];
+ segments[eRight].vDirection.v[1] = dirsY[dirRight];
+
+ left = FLT_MAX;
+ right = FLT_MAX;
+
+ for(i = 0; i < game->players; i++) {
+ segment2 *wall = game->player[i].data->trails;
+
+ if(i == player)
+ continue;
+ if(game->player[i].data->trail_height < TRAIL_HEIGHT)
+ continue;
+
+ for(j = 0; j < game->player[i].data->trailOffset + 1; j++) {
+ float t1, t2;
+ vec2 v;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eLeft, wall) &&
+ t1 > 0 && t1 < left && t2 >= 0 && t2 <= 1)
+ left = t1;
+ if(segment2_Intersect(&v, &t1, &t2, segments + eRight, wall) &&
+ t1 > 0 && t1 < right && t2 >= 0 && t2 <= 1)
+ right = t1;
+ wall++;
+ }
+ }
+
+ {
+ float accell_limit = getSettingf("wall_accel_limit");
+ if(left < accell_limit || right < accell_limit) {
+ float boost = getSettingf("wall_accel_use") * dt / 1000.0f;
+ data->speed += boost;
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+}
+
+/*! \fn static list* doMovement(int mode, int dt)
+ do physics, create CRASH and STOP events
+*/
+
+List* doMovement(int mode, int dt) {
+ int i;
+ List *l = NULL;
+
+ for(i = 0; i < game->players; i++) {
+ Data *data = game->player[i].data;
+ PlayerVisual *pV = gPlayerVisuals + i;
+ if(data->speed > 0) { /* still alive */
+ float fs;
+ float t;
+
+ // speed boost:
+ float deccel = 0;
+ if(getSettingf("wall_accel_on") == 1) {
+ if(!applyWallAcceleration(i, dt)) {
+ deccel = getSettingf("wall_accel_decrease");
+ }
+ else {
+ deccel = -1; // forbid deacceleration for booster
+ }
+ }
+ if(getSettingf("booster_on") == 1) {
+ if(!applyBooster(i, dt) && deccel != -1) {
+ float d = getSettingf("booster_decrease");
+ deccel = d > deccel ? d : deccel;
+ } else {
+ deccel = -1;
+ }
+ }
+ if(deccel > 0)
+ applyDecceleration(i, dt, deccel);
+
+ // if(i == 0)
+ // printf("speed: %.2f, boost: %.2f\n", data->speed, data->booster);
+
+ fs = 1.0f - SPEED_OZ_FACTOR + SPEED_OZ_FACTOR *
+ cosf(i * PI / 4.0f +
+ (game2->time.current % SPEED_OZ_FREQ) *
+ 2.0f * PI / SPEED_OZ_FREQ);
+
+ t = dt / 100.0f * data->speed * fs;
+
+ {
+ segment2 *current = data->trails + data->trailOffset;
+ segment2 movement;
+ int crash = 0;
+ float x, y;
+
+ getPositionFromData(&x, &y, data);
+ movement.vStart.v[0] = x;
+ movement.vStart.v[1] = y;
+ movement.vDirection.v[0] = t * dirsX[data->dir];
+ movement.vDirection.v[1] = t * dirsY[data->dir];
+
+ current->vDirection.v[0] += t * dirsX[data->dir];
+ current->vDirection.v[1] += t * dirsY[data->dir];
+
+ crash = crash || crashTestPlayers(i, &movement);
+ crash = crash || crashTestWalls(i, &movement);
+ }
+ } else { /* already crashed */
+ if(game2->rules.eraseCrashed == 1 && data->trail_height > 0)
+ data->trail_height -= (dt * TRAIL_HEIGHT) / 1000.0f;
+ if(pV->exp_radius < EXP_RADIUS_MAX)
+ pV->exp_radius += dt * EXP_RADIUS_DELTA;
+ else if (data->speed == SPEED_CRASHED) {
+ int winner = -1;
+
+ data->speed = SPEED_GONE;
+ game->running--;
+ if(game->running <= 1) { /* all dead, find survivor */
+ int i, maxSpeed = SPEED_GONE;
+ /* create winner event */
+ for(i = 0; i < game->players; i++) {
+ if(game->player[i].data->speed >= maxSpeed) {
+ winner = i;
+ maxSpeed = game->player[i].data->speed;
+ }
+ }
+ if(mode) {
+ createEvent(winner, EVENT_STOP);
+ /* a stop event is the last event that happens */
+ return l;
+ }
+ }
+ }
+ }
+ }
+ return l;
+}
+
+/*! \fn void idleGame( void )
+ game loop:
+ run ai, process events, do physics, process events again,
+ do camera movement
+*/
+
+void Game_Idle(void) {
+ List *l;
+ List *p;
+ int i;
+ int dt;
+ int t;
+
+ switch(game2->mode) {
+ case GAME_SINGLE:
+#ifdef RECORD
+ case GAME_SINGLE_RECORD:
+#endif
+ /* check for fast finish */
+
+ if (gSettingsCache.fast_finish == 1) {
+ int factors[4] = { 4, 6, 12, 25 };
+ int threshold[4] = { 0, 300, 600, 800 };
+ int factor = 1;
+ for(i = 0; i < 4; i++) {
+ if(game2->rules.grid_size > threshold[i])
+ factor = factors[i];
+ }
+ for (i = 0; i < game->players; i++) {
+ if (game->player[i].ai->active != AI_COMPUTER &&
+ gPlayerVisuals[i].exp_radius < EXP_RADIUS_MAX) {
+ factor = 1;
+ }
+ }
+ dt = game2->time.dt * factor;
+ } else {
+ dt = game2->time.dt;
+ }
+
+ while(dt > 0) {
+ if(dt > PHYSICS_RATE) t = PHYSICS_RATE;
+ else t = dt;
+
+ /* run AI */
+ for(i = 0; i < game->players; i++)
+ if(game->player[i].ai != NULL)
+ if(game->player[i].ai->active == AI_COMPUTER &&
+ PLAYER_IS_ACTIVE(&game->player[i])) {
+ doComputer(i, 0);
+ }
+
+ /* process any outstanding events (turns, etc) */
+ for(p = &(game2->events); p->next != NULL; p = p->next) {
+ if(processEvent((GameEvent*) p->data)) return;
+ }
+
+ /* free events */
+ p = game2->events.next;
+ while(p != NULL) {
+ l = p;
+ p = p->next;
+ free(l);
+ }
+ game2->events.next = NULL;
+
+ l = doMovement(1, t); /* this can generate new events */
+ if(l != NULL) {
+ for(p = l; p->next != NULL; p = p->next) {
+ if(processEvent((GameEvent*) p->data));
+ }
+
+ }
+ /* free list */
+ p = l;
+ while(p != NULL) {
+ l = p;
+ p = p->next;
+ free(l);
+ }
+ dt -= PHYSICS_RATE;
+ }
+ break;
+#ifdef RECORD
+ case GAME_PLAY_NETWORK:
+ /* fall through to GAME_PLAY */
+ case GAME_PLAY:
+ getEvents();
+ l = doMovement(0, game2->time.dt); /* this won't generate new events */
+ if(l != NULL) {
+ fprintf(stderr, "something is seriously wrong - ignoring events\n");
+ }
+ break;
+#endif /* RECORD */
+ }
+
+ doCameraMovement();
+ doRecognizerMovement();
+}
+
+/*! \fn void createEvent(int player, event_type_e eventType)
+ helper function to create an event struct and insert it into the
+ global event queue
+*/
+
+void createEvent(int player, event_type_e eventType) {
+ GameEvent *e;
+ List *p = &(game2->events);
+
+ /* move to the end of the event list */
+ while (p->next)
+ p = p->next;
+
+ /* TODO: handle failed malloc */
+ e = (GameEvent*) malloc(sizeof(GameEvent));
+ p->data = e;
+ p->next = (List*) malloc(sizeof(List));
+ p->next->next = NULL;
+ e->type = eventType;
+ getPositionFromIndex(&e->x, &e->y, player);
+ e->player = player;
+ e->timestamp = game2->time.current;
+}
diff --git a/src/game/game.c b/src/game/game.c
new file mode 100644
index 0000000..fdc32df
--- /dev/null
+++ b/src/game/game.c
@@ -0,0 +1,88 @@
+#include "game/gltron.h"
+#include "game/timesystem.h"
+
+void GameMode_Idle(void) {
+ Sound_idle();
+ Time_Idle();
+ if(game2->time.dt == 0)
+ return;
+ Game_Idle();
+ Video_Idle();
+ Input_Idle();
+ Scripting_Idle();
+ SystemPostRedisplay();
+}
+
+void enterGame(void) { /* called when game mode is entered */
+ updateSettingsCache();
+
+ SystemHidePointer();
+ SystemWarpPointer(MOUSE_ORIG_X, MOUSE_ORIG_Y);
+ game2->time.offset = SystemGetElapsedTime() - game2->time.current;
+ Audio_EnableEngine();
+
+ // disable booster and cam offset
+ {
+ int i;
+ for(i = 0; i < game->players; i++) {
+ game->player[i].data->boost_enabled = 0;
+ game->player[i].camera->movement[CAM_PHI_OFFSET] = 0;
+ }
+ }
+
+ /* reset pause flag */
+ if (game->pauseflag != PAUSE_GAME_FINISHED) {
+ game->pauseflag = PAUSE_GAME_RUNNING;
+ }
+
+ /* fprintf(stderr, "init game\n"); */
+}
+
+void exitGame(void) {
+ Audio_DisableEngine();
+ /* fprintf(stderr, "exit game\n"); */
+}
+
+void gameMouseMotion(int x, int y) {
+ if(x != MOUSE_ORIG_X || y != MOUSE_ORIG_Y) {
+ gInput.mousex += x - MOUSE_ORIG_X;
+ gInput.mousey += y - MOUSE_ORIG_Y;
+ /* fprintf(stderr, "Mouse: dx: %d\tdy: %d\n",
+ x - MOUSE_ORIG_Y, y - MOUSE_ORIG_Y); */
+ /*
+ cam_phi += - (x - MOUSE_ORIG_X) * MOUSE_CX;
+ cam_chi += (y - MOUSE_ORIG_Y) * MOUSE_CY;
+ if(cam_chi < CAM_CHI_MIN) cam_chi = CAM_CHI_MIN;
+ if(cam_chi > CAM_CHI_MAX) cam_chi = CAM_CHI_MAX;
+ */
+ SystemWarpPointer(MOUSE_ORIG_X, MOUSE_ORIG_Y);
+ }
+}
+
+void gameMouse(int buttons, int state, int x, int y) {
+ if(state == SYSTEM_MOUSEPRESSED) {
+ if(buttons == SYSTEM_MOUSEBUTTON_LEFT) gInput.mouse1 = 1;
+ if(buttons == SYSTEM_MOUSEBUTTON_RIGHT) gInput.mouse2 = 1;
+ } else if(state == SYSTEM_MOUSERELEASED) {
+ if(buttons == SYSTEM_MOUSEBUTTON_LEFT) gInput.mouse1 = 0;
+ if(buttons == SYSTEM_MOUSEBUTTON_RIGHT) gInput.mouse2 = 0;
+ }
+
+ /*
+ if(getSettingi("camType") == CAM_TYPE_MOUSE)
+ if(state == SYSTEM_MOUSEPRESSED) {
+ if(buttons == SYSTEM_MOUSEBUTTON_LEFT) {
+ cam_r -= CAM_DR;
+ if(cam_r < CAM_R_MIN) cam_r = CAM_R_MIN;
+ } else if(buttons == SYSTEM_MOUSEBUTTON_RIGHT) {
+ cam_r += CAM_DR;
+ if(cam_r > CAM_R_MAX) cam_r = CAM_R_MAX;
+ }
+ }
+ */
+ /* fprintf(stderr, "new cam_r: %.2f\n", cam_r); */
+}
+
+Callbacks gameCallbacks = {
+ displayGame, GameMode_Idle, keyGame, enterGame, exitGame, initGLGame, gameMouse, gameMouseMotion, "game"
+};
diff --git a/src/game/globals.c b/src/game/globals.c
new file mode 100644
index 0000000..1867d58
--- /dev/null
+++ b/src/game/globals.c
@@ -0,0 +1,138 @@
+#include "game/game.h"
+#include "video/video.h"
+#include "input/input.h"
+
+/* globals */
+Game main_game;
+Game *game;
+Game2 main_game2;
+Game2 *game2;
+Visual *gScreen;
+int gViewportType;
+PlayerVisual *gPlayerVisuals;
+Input gInput;
+
+SettingsCache gSettingsCache;
+
+int viewport_content[4]; /* max. 4 individual viewports on the screen */
+
+/* TexFont *txf = NULL; */
+FontTex *guiFtx = NULL;
+FontTex *gameFtx = NULL;
+int fontID = 6;
+
+Mesh* recognizer_quad;
+float rec_outline_color[] = {0.8f, 0.0, 0.0};
+float rec_spec_color[] = {0.05f, 0.14f, 0.05f, 0.50f};
+
+Mesh* recognizer;
+Mesh* lightcycle[LC_LOD];
+char *lc_lod_names[] = {
+ "lightcycle-high.obj",
+ "lightcycle-med.obj",
+ "lightcycle-low.obj"
+};
+
+float camAngle = 0;
+float cam_phi = 0;
+float cam_chi = PI / 6.0f;
+float cam_r_mouse = CAM_CIRCLE_DIST;
+float cam_r_follow = CAM_FOLLOW_DIST;
+float cam_r_circle = CAM_CIRCLE_DIST;
+
+unsigned char* debugtex = NULL;
+int ogl_debugtex;
+int colwidth;
+segment2 walls[4];
+
+int dirsX[] = { 0, -1, 0, 1 };
+int dirsY[] = { -1, 0, 1, 0 };
+float camAngles[] = { PI / 2, 0, 3 * PI / 2, PI, 2 * PI };
+
+float cam_defaults[][3] = {
+ { CAM_CIRCLE_DIST, PI / 3, 0 }, /* circle */
+ { CAM_FOLLOW_DIST, PI / 4, PI / 72 }, /* follow */
+ { CAM_COCKPIT_Z, PI / 8, 0 }, /* cockpit */
+ { CAM_CIRCLE_DIST, PI / 3, 0 } /* free */
+};
+
+/* int lasttime;
+ double dt; */
+/* milliseconds since last frame */
+
+int polycount; /* poly count - how much do we draw each frame? */
+
+unsigned char debugcolors[6][4] = {
+ { 0, 0, 0, 0 },
+ { 255, 0, 0, 255 },
+ { 0, 255, 255, 255 },
+ { 0, 255, 0, 255 },
+ { 0, 0, 255, 255 },
+ { 255, 255, 255, 255 }
+};
+
+int vps = 4;
+int vp_max[] = { 1, 2, 4, 1 }; /* windows in this display setting */
+
+/* currently, the screen is partitioned into 32 units horizontally,
+ and 24 units vertically */
+
+/* these arrays have four members, for the four different visuals:
+ single, split, quad, unused */
+
+/* the offset of the view, in virtual units */
+float vp_x[4][4] = { { 0 }, { 1, 1 }, { 1, 16, 1, 16 }, { 10 } };
+float vp_y[4][4] = { { 0 }, { 0.5f, 12.5f }, { 1, 1, 12.5f, 12.5f }, { 4.5 } } ;
+
+/* the width/height of the view, in virtual units */
+float vp_w[4][4] = { { 32 }, { 30, 30 }, { 14, 14, 14, 14 }, { 20 } };
+float vp_h[4][4] = { { 24 }, { 11.5f, 11.5f }, { 10.5f, 10.5f, 10.5f, 10.5f }, { 15 } };
+
+#ifdef DEPTH_SORT
+int quadBufSize = 100;
+Quad *quadBuf;
+int *quadBufIndex;
+#endif
+
+int game_textures = TEX_COUNT + 5; /* 11 + 6 + debug texture */
+int n_textures = 11;
+
+#ifndef GL_VERSION_1_2
+# define GL_CLAMP_TO_EDGE GL_CLAMP
+#endif
+
+TextureInfo textures[] = {
+ { 1, "gltron_floor", GL_DONT_CARE, GL_REPEAT, GL_REPEAT, TEX_FLOOR, 64 },
+ { 1, "gltron", GL_RGB, GL_REPEAT, GL_REPEAT, TEX_GUI, 1 },
+ { 1, "gltron_logo", GL_RGBA,
+ GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, TEX_LOGO, 1 },
+ { 1, "gltron_wall_1", GL_DONT_CARE,
+ GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL1, 1 },
+ { 1, "gltron_wall_2", GL_DONT_CARE,
+ GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL2, 1 },
+ { 1, "gltron_wall_3", GL_DONT_CARE,
+ GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL3, 1 },
+ { 1, "gltron_wall_4", GL_DONT_CARE,
+ GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL4, 1 },
+ { 1, "gltron_trail", GL_RGBA,
+ GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, TEX_TRAIL, 1 },
+ { 1, "gltron_traildecal", GL_RGBA,
+ GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_DECAL, 1 },
+ { 6, "skybox", GL_RGB,
+ GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, TEX_SKYBOX, 1 },
+ { 1, "gltron_impact", GL_RGBA, GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_IMPACT, 1 },
+
+};
+
+float shadow_color[] = { 0, 0, 0, .8f };
+
+#define LX 2.0f
+#define LY 2.0f
+float shadow_matrix[] = { LX * LY, 0, 0, 0,
+ 0, LX * LY, 0, 0,
+ -LY, -LX, 0, 0,
+ 0, 0, 0, LX * LY };
+#undef LX
+#undef LY
+
+
diff --git a/src/game/gui.c b/src/game/gui.c
new file mode 100644
index 0000000..bd0d2b9
--- /dev/null
+++ b/src/game/gui.c
@@ -0,0 +1,256 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "game/gltron.h"
+
+/* FIXME: "ignored playMenuFX" */
+void playMenuFX(int foo) { }
+
+void guiProjection(int x, int y) {
+ checkGLError("gui.c guiProj - start");
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ /*glOrtho(0, 0, x, y, -1, 1); */
+ checkGLError("gui.c guiProj - proj");
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glViewport(gScreen->vp_x, gScreen->vp_y,
+ x, y);
+ checkGLError("gui.c guiProj - end");
+}
+
+void drawGuiBackground(void) {
+ checkGLError("gui background start");
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ rasonly(gScreen);
+
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, gScreen->textures[TEX_GUI]);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+
+ glColor3f(1.0, 1.0, 1.0);
+ glBegin(GL_QUADS);
+
+ glTexCoord2f(0.0, 0.0);
+ glVertex2f(0, 0);
+
+ glTexCoord2f(1.0, 0.0);
+ glVertex2i(gScreen->vp_w, 0);
+
+ glTexCoord2f(1.0, .75);
+ glVertex2i(gScreen->vp_w, gScreen->vp_h);
+
+ glTexCoord2f(0.0, .75);
+ glVertex2i(0, gScreen->vp_h);
+
+ glEnd();
+}
+
+void drawGuiLogo(void) {
+ float pos[] = { 512 - 10 - 320, 384 - 80 };
+ float size[] = { 320, 80 };
+ float glpos = 64;
+ float glsize = 32;
+
+ checkGLError("gui logo start");
+
+ rasonly(gScreen);
+
+ pos[0] *= gScreen->vp_w / 512.0f;
+ pos[1] *= gScreen->vp_h / 384.0f;
+ size[0] *= gScreen->vp_w / 512.0f;
+ size[1] *= gScreen->vp_h / 384.0f;
+ glpos *= gScreen->vp_w / 512.0f;
+ glsize *= gScreen->vp_w / 512.0f;
+
+ glEnable(GL_TEXTURE_2D);
+
+ glBindTexture(GL_TEXTURE_2D, gScreen->textures[TEX_LOGO]);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glColor3f(1.0, 1.0, 1.0);
+ glBegin(GL_QUADS);
+
+ {
+ // float texy = 1.0f - 256.0f / 320.0f;
+ float texy = 0.0f;
+ glTexCoord2f(0.0, texy);
+ glVertex2f(pos[0], pos[1]);
+
+ glTexCoord2f(1.0, texy);
+ glVertex2f(pos[0] + size[0], pos[1]);
+
+ glTexCoord2f(1.0, 1.0);
+ glVertex2f(pos[0] + size[0], pos[1] + size[1]);
+
+ glTexCoord2f(0.0, 1.0);
+ glVertex2f(pos[0], pos[1] + size[1]);
+ }
+
+ glEnd();
+
+ glDisable(GL_BLEND);
+
+ checkGLError("gui background end");
+}
+
+void displayGui(void) {
+ drawGuiBackground();
+ drawGuiLogo();
+ drawMenu(gScreen);
+
+ SystemSwapBuffers();
+}
+
+void displayConfigure(void) {
+ char message[] = "Press a key for this action!";
+ drawGuiBackground();
+ drawGuiLogo();
+ drawMenu(gScreen);
+
+ rasonly(gScreen);
+ glColor3f(1.0, 1.0, 1.0);
+ drawText(guiFtx, gScreen->vp_w / 6, 20,
+ gScreen->vp_w / (6.0f / 4.0f * strlen(message)), message);
+ SystemSwapBuffers();
+}
+
+void idleGui(void) {
+ Sound_idle();
+ scripting_RunGC();
+ SDL_Delay(10);
+ Video_Idle();
+ Input_Idle();
+ SystemPostRedisplay(); /* animate menu */
+}
+
+void keyboardConfigure(int state, int key, int x, int y) {
+ if(state == SYSTEM_KEYSTATE_DOWN) {
+ scripting_RunFormat("settings.keys[ configure_player ][ configure_event ]"
+ "= %d", key);
+ SystemExitLoop(RETURN_PROMPT_ESCAPE);
+ }
+}
+
+void keyboardGui(int state, int key, int x, int y) {
+ char *pMenuName;
+
+ if(state == SYSTEM_KEYSTATE_UP)
+ return;
+
+ scripting_Run("return Menu.current");
+ scripting_GetStringResult(&pMenuName);
+
+ switch(key) {
+ case 27:
+ if(strcmp(pMenuName, "RootMenu")) {
+ // not in the root menu -> go up one menu
+ scripting_Run("Menu.GotoParent()");
+ } else {
+ // is a game already in process? then resume
+ if(game->pauseflag != PAUSE_NO_GAME)
+ SystemExitLoop(RETURN_GUI_ESCAPE);
+ }
+ break;
+ case ' ':
+ case SYSTEM_KEY_RETURN:
+ case SYSTEM_JOY_BUTTON_0:
+ case SYSTEM_JOY_BUTTON_1:
+ case SYSTEM_JOY_BUTTON_2:
+ case SYSTEM_JOY_BUTTON_3:
+ case SYSTEM_JOY_BUTTON_4:
+ case SYSTEM_JOY_BUTTON_5:
+ case SYSTEM_JOY_BUTTON_6:
+ case SYSTEM_JOY_BUTTON_7:
+ case SYSTEM_JOY_BUTTON_8:
+ case SYSTEM_JOY_BUTTON_9:
+ case SYSTEM_JOY_BUTTON_0 + SYSTEM_JOY_OFFSET:
+ case SYSTEM_JOY_BUTTON_1 + SYSTEM_JOY_OFFSET:
+ case SYSTEM_JOY_BUTTON_2 + SYSTEM_JOY_OFFSET:
+ case SYSTEM_JOY_BUTTON_3 + SYSTEM_JOY_OFFSET:
+ case SYSTEM_JOY_BUTTON_4 + SYSTEM_JOY_OFFSET:
+ case SYSTEM_JOY_BUTTON_5 + SYSTEM_JOY_OFFSET:
+ case SYSTEM_JOY_BUTTON_6 + SYSTEM_JOY_OFFSET:
+ case SYSTEM_JOY_BUTTON_7 + SYSTEM_JOY_OFFSET:
+ case SYSTEM_JOY_BUTTON_8 + SYSTEM_JOY_OFFSET:
+ case SYSTEM_JOY_BUTTON_9 + SYSTEM_JOY_OFFSET:
+ scripting_Run("Menu.Action()");
+ break;
+ case SYSTEM_KEY_UP:
+ case SYSTEM_JOY_UP:
+ case SYSTEM_JOY_UP + SYSTEM_JOY_OFFSET:
+ scripting_Run("Menu.Previous()");
+ break;
+ case SYSTEM_KEY_DOWN:
+ case SYSTEM_JOY_DOWN:
+ case SYSTEM_JOY_DOWN + SYSTEM_JOY_OFFSET:
+ scripting_Run("Menu.Next()");
+ break;
+ case SYSTEM_KEY_RIGHT:
+ case SYSTEM_JOY_RIGHT:
+ case SYSTEM_JOY_RIGHT + SYSTEM_JOY_OFFSET:
+ scripting_Run("Menu.Right()");
+ break;
+ case SYSTEM_KEY_LEFT:
+ case SYSTEM_JOY_LEFT:
+ case SYSTEM_JOY_LEFT + SYSTEM_JOY_OFFSET:
+ scripting_Run("Menu.Left()");
+ break;
+ case SYSTEM_KEY_F11: doBmpScreenShot(gScreen); break;
+ case SYSTEM_KEY_F12: doPngScreenShot(gScreen); break;
+ default:
+ // printf("got key %d\n", key);
+ break;
+ }
+ free(pMenuName);
+}
+
+void initGui(void) {
+ SystemUnhidePointer();
+
+ updateSettingsCache();
+}
+
+void exitGui(void) {
+ glShadeModel( GL_SMOOTH );
+}
+
+void initGLGui(void) {
+ glShadeModel(GL_FLAT);
+ glDisable(GL_BLEND);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_DEPTH_TEST);
+}
+
+void guiMouse(int buttons, int state, int x, int y) {
+ fprintf(stderr, "Mouse buttons: %d, State %d, Position (%d, %d)\n",
+ buttons, state, x, y);
+
+ /* fprintf(stderr, "testing for state == %d\n", SYSTEM_MOUSEPRESSED); */
+ if (state == SYSTEM_MOUSEPRESSED) {
+ if(getSettingi("playEffects"))
+ playMenuFX(fx_action);
+ }
+}
+
+void guiMouseMotion(int mx, int my) {
+ /* TODO: add mouse cursor, highlighted areas, etc. */
+}
+
+Callbacks configureCallbacks = {
+ displayConfigure, idleGui, keyboardConfigure, initGui, exitGui, initGLGui,
+ NULL, NULL, "configure"
+};
+
+Callbacks guiCallbacks = {
+ displayGui, idleGui, keyboardGui, initGui, exitGui, initGLGui,
+ guiMouse, guiMouseMotion, "gui"
+};
+
diff --git a/src/game/init.c b/src/game/init.c
new file mode 100644
index 0000000..2598ad1
--- /dev/null
+++ b/src/game/init.c
@@ -0,0 +1,112 @@
+#include "filesystem/path.h"
+#include "game/init.h"
+#include "game/gltron.h"
+#include "base/util.h"
+#include "scripting/scripting.h"
+
+void initSubsystems(int argc, const char *argv[]) {
+ initFilesystem(argc, argv);
+ initScripting();
+ init_c_interface();
+ initConfiguration(argc, argv);
+ initGame();
+ initVideo();
+ initAudio();
+ initInput();
+}
+
+void initScripting(void) {
+ scripting_Init();
+
+ /* load basic scripting services */
+ runScript(PATH_SCRIPTS, "basics.lua");
+ runScript(PATH_SCRIPTS, "joystick.lua");
+}
+
+void initConfiguration(int argc, const char *argv[])
+{
+ /* load some more defaults from config file */
+ runScript(PATH_SCRIPTS, "config.lua");
+ runScript(PATH_SCRIPTS, "artpack.lua");
+
+ /* go for .gltronrc (or whatever is defined in RC_NAME) */
+ {
+ char *path;
+ path = getPossiblePath(PATH_PREFERENCES, RC_NAME);
+ if (path != NULL) {
+ if (fileExists(path)) {
+ printf("[status] loading settings from %s\n", path);
+ scripting_RunFile(path);
+ } else {
+ printf("[error] cannot load %s from %s\n", RC_NAME, path);
+ }
+ free(path);
+ }
+ else {
+ printf("[fatal] can't get valid pref path for %s\n", RC_NAME);
+ exit(1); // something is seriously wrong
+ }
+ }
+
+ if(!isSetting("version") || getSettingf("version") < 0.70f) {
+ /* load some more defaults from config file */
+ runScript(PATH_SCRIPTS, "config.lua");
+ runScript(PATH_SCRIPTS, "artpack.lua");
+ printf("[warning] old config file found, overriding using defaults\n");
+ }
+ // check if config is valid
+ scripting_GetGlobal("save_completed", NULL);
+ if(scripting_IsNilResult()) {
+ runScript(PATH_SCRIPTS, "config.lua");
+ runScript(PATH_SCRIPTS, "artpack.lua");
+ printf("[warning] defunct config file found, overriding using defaults\n");
+ }
+
+ setSettingf("version", 0.70f);
+
+ /* parse any comandline switches overrinding the loaded settings */
+ parse_args(argc, argv);
+
+ /* sanity check some settings */
+ checkSettings();
+
+ /* intialize the settings cache, remember to do that everytime you
+ change something */
+ updateSettingsCache();
+}
+
+void initVideo(void) {
+ videoInit();
+ runScript(PATH_SCRIPTS, "video.lua");
+
+ initVideoData();
+
+ consoleInit();
+ initArtpacks();
+ runScript(PATH_SCRIPTS, "menu.lua");
+ runScript(PATH_SCRIPTS, "menu_functions.lua");
+ setupDisplay(gScreen);
+}
+
+void initAudio(void) {
+ audioInit();
+ runScript(PATH_SCRIPTS, "audio.lua");
+ /* probe for artpacks & songs */
+ Sound_initTracks();
+ Sound_setup();
+}
+
+void initGame(void) {
+ /* initialize the rest of the game's datastructures */
+ initGameStructures();
+ resetScores();
+}
+
+void initInput(void) {
+ inputInit();
+
+ gInput.mouse1 = 0;
+ gInput.mouse2 = 0;
+ gInput.mousex = 0;
+ gInput.mousey = 0;
+}
diff --git a/src/game/init_sdl.c b/src/game/init_sdl.c
new file mode 100644
index 0000000..bb787e5
--- /dev/null
+++ b/src/game/init_sdl.c
@@ -0,0 +1,47 @@
+#include "game/init.h"
+
+#include "SDL.h"
+#include <stdlib.h>
+
+int video_initialized = 0;
+
+void audioInit(void) {
+ if(SDL_Init(SDL_INIT_AUDIO) < 0 ){
+ fprintf(stderr, "Couldn't initialize SDL audio: %s\n", SDL_GetError());
+ /* FIXME: disable sound system */
+ }
+}
+
+void videoInit(void) {
+ if(SDL_Init(SDL_INIT_VIDEO) < 0 ) {
+ fprintf(stderr, "Couldn't initialize SDL video: %s\n", SDL_GetError());
+ exit(1); /* OK: critical, no visual */
+ }
+ else video_initialized = 1;
+}
+
+void inputInit(void) {
+ /* keyboard */
+ SDL_EnableKeyRepeat(0, 0); /* turn keyrepeat off */
+
+ /* joystick */
+ if(SDL_Init(SDL_INIT_JOYSTICK) >= 0) {
+ int i;
+ SDL_Joystick *joy;
+ int joysticks = SDL_NumJoysticks();
+
+ /* FIXME: why only two joysticks? */
+ /* joystick, currently at most 2 */
+ if(joysticks > 2)
+ joysticks = 2;
+
+ for(i = 0; i < joysticks; i++) {
+ joy = SDL_JoystickOpen(i);
+ }
+ if(i)
+ SDL_JoystickEventState(SDL_ENABLE);
+ } else {
+ const char *s = SDL_GetError();
+ fprintf(stderr, "[init] couldn't initialize joysticks: %s\n", s);
+ }
+}
diff --git a/src/game/menu.c b/src/game/menu.c
new file mode 100644
index 0000000..c2b3d5e
--- /dev/null
+++ b/src/game/menu.c
@@ -0,0 +1,137 @@
+#include "video/video.h"
+#include "Nebu_scripting.h"
+
+#include <string.h>
+
+void drawMenu(Visual *d) {
+ /* draw Menu pCurrent */
+
+ int i;
+ int x, y, size, lineheight;
+ int hsize, vsize;
+ int max_label = 0;
+ int max_data = 0;
+ int nEntries;
+ char pMenuName[200];
+ int iActiveItem;
+
+ rasonly(d);
+
+#define MENU_TEXT_START_X 0.08
+#define MENU_TEXT_START_Y 0.40
+
+#define MENU_WIDTH 0.80
+#define MENU_HEIGHT 0.40
+
+#define MENU_TEXT_LINEHEIGHT 1.5
+
+ x = (int) (d->vp_w * MENU_TEXT_START_X);
+ y = (int) (d->vp_h * MENU_TEXT_START_Y);
+
+ /* obtain menu name */
+ scripting_Run("return Menu.current");
+ scripting_CopyStringResult(pMenuName, 200);
+ /* obtain some information about the active menu */
+ scripting_RunFormat("return getn( Menu.%s.items )", pMenuName);
+ scripting_GetIntegerResult(&nEntries);
+
+ /* new stuff: calculate menu dimensions */
+ for(i = 0; i < nEntries; i++) {
+ int len_label = 0;
+ int len_data = 0;
+
+ scripting_RunFormat("return strlen( Menu[Menu.%s.items[%d]].caption )",
+ pMenuName, i + 1);
+ scripting_GetIntegerResult(&len_label);
+ len_label += 2; /* add ': ' */
+ scripting_RunFormat("return GetMenuValueWidth( Menu.%s.items[%d] )",
+ pMenuName, i + 1);
+ scripting_GetIntegerResult(&len_data);
+
+ if(len_label > max_label) max_label = len_label;
+ if(len_data > max_data) max_data = len_data;
+ }
+
+ /* adjust size so menu fits into MENU_WIDTH/HEIGHT */
+
+ hsize = (int) ((float)d->vp_w * MENU_WIDTH / (float) (max_label + max_data));
+ vsize = (int) ((float)d->vp_h * MENU_HEIGHT /
+ ( (float)nEntries * MENU_TEXT_LINEHEIGHT));
+
+ size = (hsize < vsize) ? hsize : vsize;
+
+ lineheight = (int)( (float) size * MENU_TEXT_LINEHEIGHT);
+
+ /* printf("%d %d %d %d %d\n", x, y, size, maxw, pCurrent->nEntries); */
+ /* draw the entries */
+
+ scripting_Run("return Menu.active");
+ scripting_GetIntegerResult(&iActiveItem);
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ for(i = 0; i < nEntries; i++) {
+ if(i == iActiveItem - 1) {
+ float color[4];
+ float active1[4];
+ float active2[4];
+ int j;
+ float t;
+ int time = SystemGetElapsedTime() & 4095;
+ t = sinf( time * PI / 2048.0 ) / 2.0f + 0.5f;
+
+ scripting_GetGlobal("menu_item_active1", NULL);
+ scripting_GetFloatArrayResult(active1, 4);
+ scripting_GetGlobal("menu_item_active2", NULL);
+ scripting_GetFloatArrayResult(active2, 4);
+
+ for(j = 0; j < 4; j++) {
+ color[j] = t * active1[j] + (1 - t) * active2[j];
+ }
+ glColor4fv(color);
+ /* fprintf(stderr, "%.2f: %.2f %.2f %.2f\n",
+ t, color[0], color[1], color[2]); */
+ } else {
+ float color[4];
+ scripting_GetGlobal("menu_item", NULL);
+ scripting_GetFloatArrayResult(color, 4);
+ glColor4fv(color);
+ }
+
+ {
+ char line_label[100];
+ char line_data[100];
+ scripting_RunFormat("return "
+ "GetMenuValueString( Menu.%s.items[%d] )",
+ pMenuName, i + 1);
+ scripting_CopyStringResult(line_data, sizeof(line_data));
+
+ if(line_data[0] != 0)
+ scripting_RunFormat("return "
+ "Menu[Menu.%s.items[%d]].caption .. ': '",
+ pMenuName, i + 1);
+ else
+ scripting_RunFormat("return "
+ "Menu[Menu.%s.items[%d]].caption",
+ pMenuName, i + 1);
+
+ scripting_CopyStringResult(line_label, sizeof(line_label));
+
+ drawText(guiFtx, x, y, size, line_label);
+ drawText(guiFtx, x + max_label * size, y, size, line_data);
+ }
+
+ /*
+ if(i == pCurrent->iHighlight)
+ drawSoftwareHighlight(x, y, size, ((Menu*)*(pCurrent->pEntries + i))->display.szCaption);
+ */
+ y -= lineheight;
+ }
+
+ glDisable(GL_BLEND);
+}
+
+
+
+
+
diff --git a/src/game/pause.c b/src/game/pause.c
new file mode 100644
index 0000000..6aae8dc
--- /dev/null
+++ b/src/game/pause.c
@@ -0,0 +1,117 @@
+#include "game/gltron.h"
+
+/* very brief - just the pause mode */
+
+void idlePause(void) {
+ Sound_idle();
+ game2->time.dt = 0;
+ doCameraMovement();
+
+ scripting_RunGC();
+ SystemPostRedisplay();
+}
+
+void displayPause(void) {
+ drawGame();
+ drawPause(gScreen);
+
+ SystemSwapBuffers();
+}
+
+void keyboardPause(int state, int key, int x, int y) {
+ if(state == SYSTEM_KEYSTATE_UP)
+ return;
+
+ switch(key) {
+ case 27:
+ SystemExitLoop(RETURN_PAUSE_ESCAPE);
+ break;
+ case SYSTEM_KEY_F1: changeDisplay(0); break;
+ case SYSTEM_KEY_F2: changeDisplay(1); break;
+ case SYSTEM_KEY_F3: changeDisplay(2); break;
+ case SYSTEM_KEY_F4: changeDisplay(3); break;
+
+ case SYSTEM_KEY_F5: saveSettings(); break;
+
+ case SYSTEM_KEY_F10: nextCameraType(); break;
+
+ case SYSTEM_KEY_F11: doBmpScreenShot(gScreen); break;
+ case SYSTEM_KEY_F12: doPngScreenShot(gScreen); break;
+
+ case SYSTEM_KEY_UP: consoleScrollBackward(1); break;
+ case SYSTEM_KEY_DOWN: consoleScrollForward(1); break;
+
+ case SYSTEM_KEY_TAB:
+ // SystemExitLoop(RETURN_MENU_PROMPT);
+ break;
+
+ default:
+ if(game->pauseflag == PAUSE_GAME_FINISHED)
+ initData();
+ /* lasttime = SystemGetElapsedTime(); */
+ SystemExitLoop(RETURN_GAME_UNPAUSE);
+ break;
+ }
+}
+
+void initPause(void) {
+ SystemHidePointer();
+ SystemWarpPointer(MOUSE_ORIG_X, MOUSE_ORIG_Y);
+
+ /* disable game sound effects */
+ Audio_DisableEngine();
+
+ /*
+ * TODO: Provide an option to disable game music here.
+ * Game should be totally silent in pause mode. (Nice when
+ * the boss is walking by, phone call, etc...)
+ */
+
+ /* set pause flag to suspended */
+ if (game->pauseflag != PAUSE_GAME_FINISHED) {
+ game->pauseflag = PAUSE_GAME_SUSPENDED;
+ }
+
+ updateSettingsCache();
+}
+
+void exitPause(void) {
+/* sound effects are re-enabled in enterGame() */
+// Audio_EnableEngine();
+}
+
+void initPauseGL(void) {
+ initGLGame();
+}
+
+Callbacks pauseCallbacks = {
+ displayPause, idlePause, keyboardPause,
+ initPause, exitPause, initPauseGL, gameMouse, gameMouseMotion, "pause"
+};
+
+void keyboardPrompt(int state, int key, int x, int y) {
+ if(state == SYSTEM_KEYSTATE_UP)
+ return;
+
+ switch(key) {
+ case 27:
+ case SYSTEM_KEY_TAB:
+ SystemExitLoop(RETURN_PAUSE_ESCAPE);
+ break;
+ case SYSTEM_KEY_RETURN:
+ /* promptEvaluate(); */
+ break;
+ }
+}
+
+void initPrompt(void) { }
+void exitPrompt(void) { }
+
+Callbacks promptCallbacks = {
+ displayPause, idlePause, keyboardPrompt,
+ initPrompt, exitPrompt, NULL, NULL, NULL, "prompt"
+};
+
+
+
+
diff --git a/src/game/scripting_interface.c b/src/game/scripting_interface.c
new file mode 100644
index 0000000..4da0509
--- /dev/null
+++ b/src/game/scripting_interface.c
@@ -0,0 +1,136 @@
+#include "game/gltron.h"
+#include "base/switchCallbacks.h"
+#include "scripting/nebu_scripting.h"
+
+#include "audio/audio.h"
+
+#include "lua.h"
+#include "lualib.h"
+
+int c_quitGame(lua_State *L) {
+ saveSettings();
+ SystemExitLoop(RETURN_CREDITS);
+ return 0;
+}
+
+int c_resetGame(lua_State *L) {
+ initData();
+ return 0;
+}
+
+int c_resetScores(lua_State *L) {
+ resetScores();
+ return 0;
+}
+
+int c_resetCamera(lua_State *L) {
+ int i;
+ int camType;
+ Camera *cam;
+ Data *data;
+
+ for(i = 0; i < game->players; i++) {
+ cam = game->player[i].camera;
+ data = game->player[i].data;
+
+ camType = (game->player[i].ai->active == AI_COMPUTER) ?
+ 0 : getSettingi("camType");
+ initCamera(cam, data, camType);
+ }
+ return 0;
+}
+
+int c_video_restart(lua_State *L) {
+ initGameScreen();
+ shutdownDisplay( gScreen );
+ setupDisplay( gScreen );
+ updateCallbacks();
+ changeDisplay(-1);
+ return 0;
+}
+
+int c_update_settings_cache(lua_State *L) {
+ updateSettingsCache();
+ return 0;
+}
+
+int c_update_audio_volume(lua_State *L) {
+ Sound_setMusicVolume(getSettingf("musicVolume"));
+ Sound_setFxVolume(getSettingf("fxVolume"));
+ return 0;
+}
+
+int c_startGame(lua_State *L) {
+ game2->mode = GAME_SINGLE;
+ initData();
+ changeDisplay(-1);
+ SystemExitLoop(RETURN_GAME_LAUNCH);
+ return 0;
+}
+
+int c_reloadTrack(lua_State *L) {
+ Sound_reloadTrack();
+ return 0;
+}
+
+int c_reloadArtpack(lua_State *L) {
+ reloadArt();
+ return 0;
+}
+
+int c_configureKeyboard(lua_State *L) {
+ SystemExitLoop(RETURN_GUI_PROMPT);
+ return 0;
+}
+
+int c_getKeyName(lua_State *L) {
+ int top = lua_gettop(L);
+ if(lua_isnumber(L, top)) {
+ lua_pushstring(L, SystemGetKeyName( (int) lua_tonumber(L, top) ));
+ } else {
+ lua_pushstring(L, "error");
+ }
+ return 1;
+}
+
+int c_timedemo(lua_State *L) {
+ SystemExitLoop(RETURN_TIMEDEMO);
+ return 0;
+}
+
+int c_SetCallback(lua_State *L) {
+ const char *name;
+ int top = lua_gettop(L);
+ if(lua_isstring(L, top)) {
+ name = lua_tostring(L, top);
+ setCallback(name);
+ // printf("enabling callback-set '%s'\n", name);
+ }
+ return 0;
+}
+
+int c_SystemMainLoop(lua_State *L) {
+ int value = SystemMainLoop();
+ lua_pushnumber(L, value);
+
+ return 1;
+}
+
+void init_c_interface(void) {
+ scripting_Register("c_quitGame", c_quitGame);
+ scripting_Register("c_resetGame", c_resetGame);
+ scripting_Register("c_resetScores", c_resetScores);
+ scripting_Register("c_resetCamera", c_resetCamera);
+ scripting_Register("c_video_restart", c_video_restart);
+ scripting_Register("c_update_settings_cache", c_update_settings_cache);
+ scripting_Register("c_update_audio_volume", c_update_audio_volume);
+ scripting_Register("c_startGame", c_startGame);
+ scripting_Register("c_reloadTrack", c_reloadTrack);
+ scripting_Register("c_reloadArtpack", c_reloadArtpack);
+ scripting_Register("c_configureKeyboard", c_configureKeyboard);
+ scripting_Register("c_getKeyName", c_getKeyName);
+ scripting_Register("c_timedemo", c_timedemo);
+
+ scripting_Register("SystemMainLoop", c_SystemMainLoop);
+ scripting_Register("SetCallback", c_SetCallback);
+}
diff --git a/src/game/switchCallbacks.c b/src/game/switchCallbacks.c
new file mode 100644
index 0000000..235e40a
--- /dev/null
+++ b/src/game/switchCallbacks.c
@@ -0,0 +1,73 @@
+#include "base/switchCallbacks.h"
+#include <string.h>
+#include <stdlib.h>
+
+Callbacks *last_callback = NULL;
+Callbacks *current_callback = NULL;
+
+void exitCallback(Callbacks *cb) {
+ if(cb != NULL)
+ if(cb->exit != NULL)
+ (cb->exit)(); /* give them the chance to quit */
+}
+
+void initCallback(Callbacks *cb) {
+ if(cb->init != NULL)
+ (cb->init)();
+ if(cb->initGL != NULL)
+ (cb->initGL)();
+}
+
+
+void switchCallbacks(Callbacks *new) {
+ // if(current_callback)
+ // fprintf(stderr, "callbacks: exiting %s\n", current_callback->name);
+ exitCallback(current_callback);
+ SystemRegisterCallbacks(new);
+ // fprintf(stderr, "callbacks: initializing %s\n", new->name);
+ initCallback(new);
+
+ last_callback = current_callback;
+ current_callback = new;
+}
+
+void updateCallbacks(void) {
+ /* called when the window is recreated */
+ exitCallback(current_callback);
+ SystemRegisterCallbacks(current_callback);
+ initCallback(current_callback);
+}
+
+void restoreCallbacks(void) {
+ if(last_callback == NULL) {
+ fprintf(stderr, "fatal: no last callback present, exiting\n");
+ exit(1); // OK: programmer error, critical
+ }
+
+ exitCallback(last_callback);
+ current_callback = last_callback;
+ SystemRegisterCallbacks(current_callback);
+ initCallback(current_callback);
+}
+
+#define N_CALLBACKS 7
+Callbacks *callbackList[N_CALLBACKS] = {
+ &gameCallbacks, &guiCallbacks, &pauseCallbacks, &configureCallbacks,
+ &promptCallbacks, &creditsCallbacks, &timedemoCallbacks
+};
+
+void setCallback(const char *name) {
+ int i;
+
+ for(i = 0; i < N_CALLBACKS; i++) {
+ if(strcmp( callbackList[i]->name, name ) == 0)
+ break;
+ }
+ if(i == N_CALLBACKS) {
+ fprintf(stderr, "fatal: no callback named '%s' found\n", name);
+ exit(1); // OK: programmer error, critical
+ }
+ switchCallbacks(callbackList[i]);
+}
+
+
diff --git a/src/game/timedemo.c b/src/game/timedemo.c
new file mode 100644
index 0000000..38b9d05
--- /dev/null
+++ b/src/game/timedemo.c
@@ -0,0 +1,152 @@
+#include "game/gltron.h"
+
+static int startTime = 0;
+static int frames = 0;
+
+void idleTimedemo(void) {
+ int t;
+ int i, j;
+
+ List *p, *l;
+
+ Sound_idle();
+
+ game2->time.current += 20;
+
+ for(j = 0; j < 2; j++) { // run display at a theoretical 50 Hz
+ t = 10; // run game physics at 100 Hz
+
+ game2->time.dt = 10;
+
+ for(i = 0; i < game->players; i++) {
+ if(game->player[i].ai != NULL) {
+ if(game->player[i].ai->active == AI_COMPUTER &&
+ PLAYER_IS_ACTIVE(&game->player[i])) {
+ doComputer(i, 0);
+ }
+ }
+ }
+
+ /* process any outstanding events generated by the AI (turns, etc) */
+ for(p = &(game2->events); p->next != NULL; p = p->next) {
+ if(processEvent((GameEvent*) p->data))
+ return;
+ }
+
+ /* free events */
+ p = game2->events.next;
+ while(p != NULL) {
+ l = p;
+ p = p->next;
+ free(l);
+ }
+ game2->events.next = NULL;
+
+ l = doMovement(1, t); /* this can generate new events */
+ if(l != NULL) {
+ for(p = l; p->next != NULL; p = p->next) {
+ if(processEvent((GameEvent*) p->data));
+ }
+
+ }
+ /* free list */
+ p = l;
+ while(p != NULL) {
+ l = p;
+ p = p->next;
+ free(l);
+ }
+ }
+
+ game2->time.dt = 20;
+ doCameraMovement();
+ doRecognizerMovement();
+ scripting_RunGC();
+ SystemPostRedisplay();
+ frames++;
+ game2->time.lastFrame += 20;
+}
+
+void keyTimedemo(int state, int key, int x, int y) {
+ if(state == SYSTEM_KEYSTATE_UP)
+ return;
+
+ if(key == 27)
+ SystemExitLoop(RETURN_TIMEDEMO_ABORT);
+}
+
+struct {
+ float speed;
+ int eraseCrashed, grid_size;
+} saveRules;
+
+extern int c_resetCamera();
+
+void initTimedemo(void) {
+ int i = 0;
+
+ printf("-- initializing timedemo\n");
+
+ frames = 0;
+ startTime = SystemGetElapsedTime();
+
+ tsrand(12313);
+
+ resetRecognizer();
+
+ updateSettingsCache();
+
+ // overwrite AI skills & rules in settingsCache
+ gSettingsCache.ai_level = 2;
+ gSettingsCache.show_ai_status = 0;
+ gSettingsCache.show_fps = 0;
+ gSettingsCache.camType = CAM_CIRCLE;
+ gSettingsCache.show_console = 0;
+
+ saveRules.speed = getSettingf("speed");
+ saveRules.eraseCrashed = getSettingi("erase_crashed");
+ saveRules.grid_size = getSettingi("grid_size");
+
+ setSettingf("speed", 12);
+ setSettingi("erase_crashed", 1);
+ setSettingi("grid_size", 200);
+
+ game2->mode = GAME_SINGLE;
+ initData();
+ changeDisplay(-1);
+
+ for(i = 0; i < game->players; i++) {
+ game->player[i].ai->active = AI_COMPUTER;
+ // set all camera phi values to 0
+ game->player[i].camera->movement[CAM_PHI] = PI / 18;
+ game->player[i].camera->movement[CAM_CHI] = PI / 3;
+ }
+
+ SystemHidePointer();
+ SystemWarpPointer(MOUSE_ORIG_X, MOUSE_ORIG_Y);
+ game2->time.offset = SystemGetElapsedTime() - game2->time.current;
+}
+
+void exitTimedemo(void) {
+ int dt = SystemGetElapsedTime() - startTime;
+ if(dt) {
+ displayMessage(TO_STDERR | TO_CONSOLE,
+ "timedemo FPS: %.2f\n",
+ (float) frames / dt * 1000.0f);
+ // displayMessage(TO_STDERR | TO_CONSOLE, "timedemo FPS: %.2f (%d frames in %f seconds)\n", (float) frames / dt * 1000.0f, frames, dt / 1000.0f);
+ }
+ else {
+ // displayMessage(TO_STDERR | TO_CONSOLE, "dt: %d, frames: %d\n", dt, frames);
+ // actually, this would be a good reason to abort with a fatal error
+ }
+
+ setSettingf("speed", saveRules.speed);
+ setSettingi("eraseCrashed", saveRules.eraseCrashed);
+ setSettingi("grid_size", saveRules.grid_size);
+}
+
+Callbacks timedemoCallbacks = {
+ displayGame, idleTimedemo, keyTimedemo, initTimedemo, exitTimedemo,
+ initGLGame, NULL /* mouse button */, NULL /* mouse motion */, "timedemo"
+};
+
diff --git a/src/gltron.c b/src/gltron.c
new file mode 100644
index 0000000..09185c5
--- /dev/null
+++ b/src/gltron.c
@@ -0,0 +1,23 @@
+/*
+ gltron
+ Copyright (C) 1999 by Andreas Umbach <marvin@dataway.ch>
+*/
+#include "SDL.h"
+
+#include "game/init.h"
+#include "filesystem/path.h"
+#include "base/util.h"
+#include "SDL.h"
+
+int main(int argc, char *argv[] ) {
+ initSubsystems(argc, argv);
+ runScript(PATH_SCRIPTS, "main.lua");
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
new file mode 100644
index 0000000..81a64f5
--- /dev/null
+++ b/src/include/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = audio base configuration filesystem game input scripting video
diff --git a/src/include/Makefile.in b/src/include/Makefile.in
new file mode 100644
index 0000000..8628dde
--- /dev/null
+++ b/src/include/Makefile.in
@@ -0,0 +1,315 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+SUBDIRS = audio base configuration filesystem game input scripting video
+subdir = src/include
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
+ uninstall-info-recursive all-recursive install-data-recursive \
+ install-exec-recursive installdirs-recursive install-recursive \
+ uninstall-recursive check-recursive installcheck-recursive
+DIST_COMMON = Makefile.am Makefile.in
+DIST_SUBDIRS = $(SUBDIRS)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/include/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
+ clean-generic clean-recursive distclean distclean-generic \
+ distclean-recursive distclean-tags distdir dvi dvi-am \
+ dvi-recursive info info-am info-recursive install install-am \
+ install-data install-data-am install-data-recursive \
+ install-exec install-exec-am install-exec-recursive \
+ install-info install-info-am install-info-recursive install-man \
+ install-recursive install-strip installcheck installcheck-am \
+ installdirs installdirs-am installdirs-recursive \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-recursive tags tags-recursive uninstall \
+ uninstall-am uninstall-info-am uninstall-info-recursive \
+ uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/include/audio/Makefile.am b/src/include/audio/Makefile.am
new file mode 100644
index 0000000..16bbb78
--- /dev/null
+++ b/src/include/audio/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = audio.h sound_glue.h
diff --git a/src/include/audio/Makefile.in b/src/include/audio/Makefile.in
new file mode 100644
index 0000000..7e162b4
--- /dev/null
+++ b/src/include/audio/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = audio.h sound_glue.h
+subdir = src/include/audio
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/include/audio/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/include/audio/audio.h b/src/include/audio/audio.h
new file mode 100644
index 0000000..56b745f
--- /dev/null
+++ b/src/include/audio/audio.h
@@ -0,0 +1,34 @@
+#ifndef AUDIO_H
+#define AUDIO_H
+
+#include "sound_glue.h"
+
+#define SONG_PREFIX "song_"
+
+/* menu sound enumerations */
+enum {
+ fx_action,
+ fx_highlight
+};
+
+#include "SDL.h"
+#include "SDL_sound.h"
+
+#include <zlib.h>
+#include <assert.h>
+#include <stdlib.h>
+
+extern void Sound_loadFX(void);
+extern void Sound_init(void);
+extern void Sound_shutdown(void);
+extern void Sound_load(char *name);
+extern void Sound_play(void);
+extern void Sound_stop(void);
+extern void Sound_idle(void);
+extern void Sound_setMusicVolume(float volume);
+extern void Sound_setFxVolume(float volume);
+extern void Sound_reloadTrack(void);
+extern void Sound_initTracks(void);
+extern void Sound_setup(void);
+
+#endif
diff --git a/src/include/audio/sound_glue.h b/src/include/audio/sound_glue.h
new file mode 100644
index 0000000..bfd5b38
--- /dev/null
+++ b/src/include/audio/sound_glue.h
@@ -0,0 +1,31 @@
+#ifndef SOUND_GLUE_H
+#define SOUND_GLUE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void Audio_EnableEngine(void);
+void Audio_DisableEngine(void);
+void Audio_Idle(void);
+void Audio_CrashPlayer(int player);
+void Audio_LoadPlayers(void);
+void Audio_Init(void);
+void Audio_Start(void);
+void Audio_Quit(void);
+
+void Audio_LoadPlayers(void);
+void Audio_LoadSample(char *name, int number);
+void Audio_LoadMusic(char *name);
+void Audio_PlayMusic(void);
+void Audio_StopMusic(void);
+void Audio_SetMusicVolume(float volume);
+void Audio_SetFxVolume(float volume);
+
+void Audio_StartEngine(int player);
+void Audio_StopEngine(int player);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/include/base/Makefile.am b/src/include/base/Makefile.am
new file mode 100644
index 0000000..1e1cbeb
--- /dev/null
+++ b/src/include/base/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = switchCallbacks.h util.h
diff --git a/src/include/base/Makefile.in b/src/include/base/Makefile.in
new file mode 100644
index 0000000..601773e
--- /dev/null
+++ b/src/include/base/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = switchCallbacks.h util.h
+subdir = src/include/base
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/include/base/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/include/base/switchCallbacks.h b/src/include/base/switchCallbacks.h
new file mode 100644
index 0000000..5f19d6e
--- /dev/null
+++ b/src/include/base/switchCallbacks.h
@@ -0,0 +1,20 @@
+#ifndef SWITCHCALLBACKS_H
+#define SWITCHCALLBACKS_H
+
+#include "Nebu_base.h"
+
+extern Callbacks gameCallbacks;
+extern Callbacks guiCallbacks;
+extern Callbacks pauseCallbacks;
+extern Callbacks configureCallbacks;
+extern Callbacks promptCallbacks;
+extern Callbacks creditsCallbacks;
+extern Callbacks timedemoCallbacks;
+
+extern void restoreCallbacks(void);
+extern void switchCallbacks(Callbacks* callbacks);
+extern void updateCallbacks(void);
+
+extern void setCallback(const char *name);
+
+#endif
diff --git a/src/include/base/util.h b/src/include/base/util.h
new file mode 100644
index 0000000..43044d0
--- /dev/null
+++ b/src/include/base/util.h
@@ -0,0 +1,6 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+void runScript(int ePath, const char *name);
+
+#endif
diff --git a/src/include/configuration/Makefile.am b/src/include/configuration/Makefile.am
new file mode 100644
index 0000000..74484dd
--- /dev/null
+++ b/src/include/configuration/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = configuration.h settings.h
diff --git a/src/include/configuration/Makefile.in b/src/include/configuration/Makefile.in
new file mode 100644
index 0000000..6dcb3c2
--- /dev/null
+++ b/src/include/configuration/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = configuration.h settings.h
+subdir = src/include/configuration
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/include/configuration/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/include/configuration/configuration.h b/src/include/configuration/configuration.h
new file mode 100644
index 0000000..58045a0
--- /dev/null
+++ b/src/include/configuration/configuration.h
@@ -0,0 +1,12 @@
+#ifndef CONFIGURATION_H
+#define CONFIGURATION_H
+
+extern void parse_args(int argc, const char *argv[]);
+extern void updateSettingsCache(void);
+extern void initColors(void);
+extern void checkSettings(void);
+extern void saveSettings(void);
+
+#include "settings.h"
+
+#endif
diff --git a/src/include/configuration/settings.h b/src/include/configuration/settings.h
new file mode 100644
index 0000000..34bab03
--- /dev/null
+++ b/src/include/configuration/settings.h
@@ -0,0 +1,51 @@
+#ifndef SETTINGS_H
+#define SETTINGS_H
+
+/*
+ * SettingsCache - A Structure for storing lua settings during play to
+ * avoid the overhead of fetching from lua repeatedly. Values should be
+ * considered and const as they are never written back out to lua.
+ */
+typedef struct SettingsCache {
+ int use_stencil;
+ int show_scores;
+ int show_ai_status;
+ int ai_level;
+ int show_fps;
+ int show_console;
+ int softwareRendering;
+ int show_floor_texture;
+ int line_spacing;
+ int antialias_lines;
+ int show_decals;
+ int alpha_trails;
+ int turn_cycle;
+ int light_cycles;
+ int lod;
+ float fov;
+ int stretch_textures;
+ int show_skybox;
+ int show_recognizer;
+ int show_impact;
+ int show_glow;
+ int show_wall;
+ int fast_finish;
+ int playMusic;
+ int playEffects;
+ int camType;
+ float znear;
+ float clear_color[4];
+ float map_ratio_w, map_ratio_h;
+} SettingsCache;
+
+
+extern int isSetting(const char *name);
+extern float getSettingf(const char *name);
+extern int getSettingi(const char *name);
+extern float getVideoSettingf(const char *name);
+extern int getVideoSettingi(const char *name);
+
+extern void setSettingf(const char *name, float f);
+extern void setSettingi(const char *name, int i);
+
+#endif
diff --git a/src/include/filesystem/Makefile.am b/src/include/filesystem/Makefile.am
new file mode 100644
index 0000000..8ee1232
--- /dev/null
+++ b/src/include/filesystem/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = dirsetup.h path.h
diff --git a/src/include/filesystem/Makefile.in b/src/include/filesystem/Makefile.in
new file mode 100644
index 0000000..6fc1b8c
--- /dev/null
+++ b/src/include/filesystem/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = dirsetup.h path.h
+subdir = src/include/filesystem
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/include/filesystem/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/include/filesystem/dirsetup.h b/src/include/filesystem/dirsetup.h
new file mode 100644
index 0000000..19b1c9d
--- /dev/null
+++ b/src/include/filesystem/dirsetup.h
@@ -0,0 +1,9 @@
+#ifndef DIRSETUP_H
+#define DIRESTUP_H
+
+#include "path.h"
+
+void dirSetup(const char *executable);
+const char* getHome(void);
+
+#endif
diff --git a/src/include/filesystem/path.h b/src/include/filesystem/path.h
new file mode 100644
index 0000000..b3649e2
--- /dev/null
+++ b/src/include/filesystem/path.h
@@ -0,0 +1,19 @@
+#ifndef PATH_H
+#define PATH_H
+
+extern const char* getDirectory(int eLocation);
+extern char* getPath(int eLocation, const char *filename);
+extern char* getPossiblePath(int eLocation, const char *filename);
+extern char* getArtPath(const char *artpack, const char *filename);
+extern void initDirectories(void);
+
+enum {
+ PATH_PREFERENCES = 0,
+ PATH_SNAPSHOTS, /* demos, screenshots */
+ PATH_DATA,
+ PATH_SCRIPTS,
+ PATH_MUSIC,
+ PATH_ART
+};
+
+#endif
diff --git a/src/include/game/Makefile.am b/src/include/game/Makefile.am
new file mode 100644
index 0000000..7b0dfd5
--- /dev/null
+++ b/src/include/game/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = camera.h client_data.h data.h engine.h event.h game.h game_data.h gltron.h init.h menu.h timedemo.h timesystem.h ai.h
diff --git a/src/include/game/Makefile.in b/src/include/game/Makefile.in
new file mode 100644
index 0000000..75c95bb
--- /dev/null
+++ b/src/include/game/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = camera.h client_data.h data.h engine.h event.h game.h game_data.h gltron.h init.h menu.h timedemo.h timesystem.h ai.h
+subdir = src/include/game
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/include/game/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/include/game/ai.h b/src/include/game/ai.h
new file mode 100644
index 0000000..d9bc80d
--- /dev/null
+++ b/src/include/game/ai.h
@@ -0,0 +1,29 @@
+typedef struct {
+ int location;
+ segment2 player;
+ segment2 opponent;
+ vec2 intersection;
+ float t_player, t_opponent;
+} AI_Configuration;
+
+typedef struct {
+ float front, left, right, backleft;
+} AI_Distances;
+
+typedef struct {
+ int minTurnTime[4];
+ float maxSegLength[4];
+ float critical[4];
+ int spiral[4];
+ int rlDelta[4];
+} AI_Parameters;
+
+extern AI_Parameters ai_params;
+
+void ai_getDistances(int player, AI_Distances *distances);
+void ai_getClosestOpponent(int player, int* opponent, float *distance);
+void ai_getConfig(int player, int opponent, AI_Configuration *config);
+void ai_aggressive(int player, int opponent, int location,
+ AI_Distances *distances);
+void ai_evasive(int player, int opponent, int location,
+ AI_Distances *distances);
diff --git a/src/include/game/camera.h b/src/include/game/camera.h
new file mode 100644
index 0000000..e9ef20b
--- /dev/null
+++ b/src/include/game/camera.h
@@ -0,0 +1,39 @@
+#ifndef CAMERA_H
+#define CAMERA_H
+
+typedef struct {
+ int interpolated_cam;
+ int interpolated_target;
+ int coupled;
+ int freedom[3];
+ int type;
+} CameraType;
+
+typedef struct {
+ float cam[3];
+ float target[3];
+ float movement[4]; /* indices CAM_R, CAM_CHI, CAM_PHI, CAM_PHI_OFFSET */
+ CameraType type;
+} Camera;
+
+enum {
+ CAM_FREE_R = 0,
+ CAM_FREE_PHI,
+ CAM_FREE_CHI
+};
+
+enum { CAM_CIRCLE = 0,
+ CAM_FOLLOW,
+ CAM_COCKPIT,
+ CAM_FREE
+};
+
+enum { CAM_R = 0, CAM_CHI, CAM_PHI, CAM_PHI_OFFSET };
+
+extern char *cam_names[];
+extern float cam_defaults[][3];
+
+void nextCameraType(void);
+void doCameraMovement(void);
+
+#endif
diff --git a/src/include/game/client_data.h b/src/include/game/client_data.h
new file mode 100644
index 0000000..c0f2f4d
--- /dev/null
+++ b/src/include/game/client_data.h
@@ -0,0 +1,6 @@
+#ifndef CLIENT_DATA_H
+#define CLIENT_DATA_H
+
+
+
+#endif
diff --git a/src/include/game/data.h b/src/include/game/data.h
new file mode 100644
index 0000000..3a3c346
--- /dev/null
+++ b/src/include/game/data.h
@@ -0,0 +1,22 @@
+#ifndef DATA_H
+#define DATA_H
+
+#include "basic_types.h"
+#include "game_data.h"
+#include "client_data.h"
+
+/* general data structures */
+
+#define PLAYER_IS_ACTIVE(x) ((x)->data->speed > 0)
+
+enum {
+ GAME_SINGLE = 1,
+#ifdef RECORD
+ GAME_SINGLE_RECORD = 2,
+ GAME_PLAY = 4,
+ GAME_PLAY_NETWORK = 8,
+ GAME_NETWORK_RECORD
+#endif
+};
+
+#endif
diff --git a/src/include/game/engine.h b/src/include/game/engine.h
new file mode 100644
index 0000000..5796973
--- /dev/null
+++ b/src/include/game/engine.h
@@ -0,0 +1,12 @@
+#ifndef ENGINE_H
+#define ENGINE_H
+
+#include "event.h"
+
+extern void doLeftTurn(GameEvent *e);
+extern void doRightTurn(GameEvent *e);
+extern void doCrashPlayer(GameEvent *e);
+extern int getCol(int x, int y);
+extern void initData(void);
+
+#endif
diff --git a/src/include/game/event.h b/src/include/game/event.h
new file mode 100644
index 0000000..a935b60
--- /dev/null
+++ b/src/include/game/event.h
@@ -0,0 +1,22 @@
+#ifndef EVENT_H
+#define EVENT_H
+
+typedef enum {
+ EVENT_TURN_LEFT = 1,
+ EVENT_TURN_RIGHT = 2,
+ EVENT_CRASH = 4,
+ EVENT_STOP = 8
+} event_type_e;
+
+typedef struct GameEvent {
+ int type; /* what */
+ int player; /* who */
+ float x; /* where */
+ float y;
+ unsigned int timestamp;
+} GameEvent;
+
+extern void createEvent(int player, event_type_e eventType);
+extern int processEvent(GameEvent *e);
+
+#endif /* EVENT_H */
diff --git a/src/include/game/game.h b/src/include/game/game.h
new file mode 100644
index 0000000..0dbd539
--- /dev/null
+++ b/src/include/game/game.h
@@ -0,0 +1,117 @@
+#ifndef GAME_H
+#define GAME_H
+
+#include "game_data.h"
+#include "engine.h"
+#include "event.h"
+
+#include "Nebu_base.h"
+
+/* use enums, not magic */
+enum {
+ TURN_LEFT = 3,
+ TURN_RIGHT = 1
+};
+
+enum {
+ AI_HUMAN = 0,
+ AI_COMPUTER = 1,
+ AI_NONE = 2
+};
+
+enum {
+ RETURN_GAME_LAUNCH = 0,
+ RETURN_GAME_END,
+ RETURN_GAME_PAUSE,
+ RETURN_GAME_UNPAUSE,
+ RETURN_GAME_CREDITS,
+ RETURN_GAME_ESCAPE,
+ RETURN_GUI_PROMPT,
+ RETURN_TIMEDEMO,
+ RETURN_TIMEDEMO_ABORT,
+ RETURN_CREDITS,
+ RETURN_QUIT,
+ RETURN_GUI_ESCAPE,
+ RETURN_PROMPT_ESCAPE,
+ RETURN_PAUSE_ESCAPE
+};
+
+/* physics recomputed every 10ms */
+#define PHYSICS_RATE 20
+
+
+#define PLAYERS 4
+#define MAX_PLAYERS 4
+#define MAX_TRAIL 1000
+
+
+/* these must be < 0 */
+#define SPEED_CRASHED -1
+#define SPEED_GONE -2
+
+#define TRAIL_HEIGHT 3.5f
+
+/* game options */
+#define SPEED_OZ_FREQ 1200
+#define SPEED_OZ_FACTOR 0.09f
+
+#define TURN_LENGTH 200
+
+#define FAST_FINISH 40
+
+enum {
+ PAUSE_NO_GAME = 0,
+ PAUSE_GAME_RUNNING,
+ PAUSE_GAME_FINISHED,
+ PAUSE_GAME_SUSPENDED,
+ PAUSE_DEMO_NEW,
+ PAUSE_DEMO_RUNNING,
+};
+
+extern Game main_game;
+extern Game *game;
+extern Game2 main_game2;
+extern Game2 *game2;
+
+extern SettingsCache gSettingsCache;
+
+extern segment2 walls[];
+
+extern int dirsX[];
+extern int dirsY[];
+
+extern float default_speeds[];
+extern int default_arena_sizes[];
+
+/* ai -> computer.c */
+
+extern void initGameAI(int level);
+extern void doComputer(int player, int target);
+
+extern void resetScores(void);
+
+extern void doTurn(GameEvent* e, int direction);
+
+extern List* doMovement(int mode, int dt);
+extern void writePosition(int player);
+
+extern void initGameStructures(void);
+extern void initClientData(void);
+
+extern void Game_Idle(void);
+extern void enterGame(void);
+extern void exitGame(void);
+
+extern void gameMouseMotion(int x, int y);
+extern void gameMouse(int buttons, int state, int x, int y);
+extern void resetVideoData(void);
+extern void resetPlayerData(void);
+
+extern void doCameraMovement(void);
+extern void initCamera(Camera *cam, Data *data, int type);
+
+extern void initWalls(void);
+
+extern void getPositionFromIndex(float *x, float *y, int player);
+extern void getPositionFromData(float *x, float *y, Data *data);
+#endif
diff --git a/src/include/game/game_data.h b/src/include/game/game_data.h
new file mode 100644
index 0000000..88e035d
--- /dev/null
+++ b/src/include/game/game_data.h
@@ -0,0 +1,93 @@
+#ifndef GAME_DATA_H
+#define GAME_DATA_H
+
+#include "Nebu_base.h"
+#include "Nebu_filesystem.h"
+
+#include "configuration/configuration.h"
+#include "game/camera.h"
+
+
+#define PLAYER_IS_ACTIVE(x) ((x)->data->speed > 0)
+
+enum {
+ GAME_SINGLE = 1
+#ifdef RECORD
+ ,
+ GAME_SINGLE_RECORD = 2,
+ GAME_PLAY = 4,
+ GAME_PLAY_NETWORK = 8,
+ GAME_NETWORK_RECORD
+#endif
+};
+
+typedef struct Grid {
+ int width, height;
+ unsigned char *data;
+} Grid;
+
+/*
+ this struct contains all the necessary parameters to define a game round
+ (except number of players)
+ any change forces a restart of the round
+*/
+
+typedef struct RuleSet {
+ int eraseCrashed;
+ float speed;
+ int grid_size;
+} RuleSet;
+
+
+typedef struct Game2 {
+ Grid grid;
+ RuleSet rules;
+ int mode;
+ int players;
+ int *startPositions;
+ SystemTime time;
+ List events;
+ FILE *record;
+ FILE *play;
+ // Input input;
+} Game2;
+
+typedef struct Data {
+ int dir;
+
+ int score;
+ float speed; /* set to -1 when dead */
+ float booster;
+ int boost_enabled;
+ float trail_height;
+
+ int last_dir;
+ unsigned int turn_time; /* for cycle animation */
+
+ segment2 *trails;
+ int trailOffset;
+} Data;
+
+typedef struct AI {
+ int active;
+ int tdiff;
+ long lasttime;
+ segment2 left, right, front, backleft;
+} AI;
+
+typedef struct Player {
+ Camera *camera;
+ Data *data;
+ AI *ai;
+} Player;
+
+typedef struct Game {
+ Player *player;
+ int players; /* number of players - currently limited to 4 somewhere */
+ int winner; /* who won this round */
+ int pauseflag; /* if the game is finished: the PAUSE_GAME_FINISHED flag
+ is set */
+ int running; /* the amount of players that are still alive */
+} Game;
+
+#endif
diff --git a/src/include/game/gltron.h b/src/include/game/gltron.h
new file mode 100644
index 0000000..c66d31f
--- /dev/null
+++ b/src/include/game/gltron.h
@@ -0,0 +1,43 @@
+#ifndef GLTRON_H
+#define GLTRON_H
+
+/*
+ gltron
+ Copyright (C) 1999 by Andreas Umbach <marvin@dataway.ch>
+*/
+
+#define RC_NAME ".gltronrc"
+
+/* Win32 port maintained by Andreas Umbach <marvin@dataway.ch> */
+#ifdef WIN32
+#include <windows.h>
+
+#undef RC_NAME
+#define RC_NAME "gltron.ini"
+
+#endif /* WIN32 */
+
+/* MacOS port maintained by Darrell Walisser <walisser@mac.com> */
+
+#ifdef macintosh /* os9/classic */
+#include <string.h>
+#undef RC_NAME
+#define RC_NAME "gltronPrefs.txt"
+#endif
+
+#ifdef __APPLE__ /* osx */
+#undef RC_NAME
+#define RC_NAME "gltronPrefs.txt"
+#endif
+
+/* the engine */
+#include "Nebu.h"
+
+/* subsystems */
+#include "game/game.h"
+#include "configuration/configuration.h"
+#include "video/video.h"
+#include "audio/audio.h"
+#include "input/input.h"
+
+#endif /* GLTRON_H */
diff --git a/src/include/game/init.h b/src/include/game/init.h
new file mode 100644
index 0000000..33b17ed
--- /dev/null
+++ b/src/include/game/init.h
@@ -0,0 +1,17 @@
+#ifndef INIT_H
+#define INIT_H
+
+extern void initSubsystems(int argc, const char *argv[]);
+extern void initScripting(void);
+extern void initConfiguration(int argc, const char *argv[]);
+extern void initVideo(void);
+extern void initAudio(void);
+extern void initInput(void);
+extern void initGame(void);
+
+/* platform stuff */
+
+extern void videoInit(void);
+extern void audioInit(void);
+extern void inputInit(void);
+#endif
diff --git a/src/include/game/menu.h b/src/include/game/menu.h
new file mode 100644
index 0000000..0ca2bbe
--- /dev/null
+++ b/src/include/game/menu.h
@@ -0,0 +1,35 @@
+#ifndef MENU_H
+#define MENU_H
+
+extern float menu_fgColor[4];
+extern float menu_hlColor1[4];
+extern float menu_hlColor2[4];
+
+typedef struct {
+ /* FontTex *font; */
+ float fgColor[4]; /* entries */
+ float hlColor1[4]; /* the highlighted one */
+ float hlColor2[4];
+ char szCaption[64];
+} mDisplay;
+
+typedef struct Menu {
+ int nEntries;
+ int iHighlight;
+ mDisplay display;
+ char szName[64];
+ char szCapFormat[64];
+ struct Menu** pEntries;
+ struct Menu* parent;
+ void* param; /* reserved to bind parameters at runtime */
+} Menu;
+
+typedef struct {
+ void* data;
+ void* next;
+} node;
+
+/* fixme: this variable is a hack */
+extern int menutime;
+
+#endif
diff --git a/src/include/game/timedemo.h b/src/include/game/timedemo.h
new file mode 100644
index 0000000..d46d608
--- /dev/null
+++ b/src/include/game/timedemo.h
@@ -0,0 +1,3 @@
+#ifndef TIMEDEMO_H
+
+#endif
diff --git a/src/include/game/timesystem.h b/src/include/game/timesystem.h
new file mode 100644
index 0000000..ea1f0fb
--- /dev/null
+++ b/src/include/game/timesystem.h
@@ -0,0 +1,6 @@
+#ifndef TIMESYSTEM_H
+#define TIMESYSTEM_H
+
+void Time_Idle(void);
+
+#endif
diff --git a/src/include/input/Makefile.am b/src/include/input/Makefile.am
new file mode 100644
index 0000000..5818a34
--- /dev/null
+++ b/src/include/input/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = input.h
diff --git a/src/include/input/Makefile.in b/src/include/input/Makefile.in
new file mode 100644
index 0000000..52cb24b
--- /dev/null
+++ b/src/include/input/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = input.h
+subdir = src/include/input
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/include/input/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/include/input/input.h b/src/include/input/input.h
new file mode 100644
index 0000000..b9f1261
--- /dev/null
+++ b/src/include/input/input.h
@@ -0,0 +1,22 @@
+#ifndef INPUT_H
+#define INPUT_H
+
+typedef struct {
+ int mouse1;
+ int mouse2;
+ int mousex;
+ int mousey;
+} Input;
+
+
+#define MOUSE_ORIG_X 100
+#define MOUSE_ORIG_Y 100
+#define MOUSE_CX 0.003f
+#define MOUSE_CY 0.003f
+
+void keyGame(int state, int key, int x, int y);
+void Input_Idle();
+
+extern int joy_threshold;
+extern Input gInput;
+#endif
diff --git a/src/include/scripting/Makefile.am b/src/include/scripting/Makefile.am
new file mode 100644
index 0000000..07476a2
--- /dev/null
+++ b/src/include/scripting/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = scripting.h
diff --git a/src/include/scripting/Makefile.in b/src/include/scripting/Makefile.in
new file mode 100644
index 0000000..f96e7db
--- /dev/null
+++ b/src/include/scripting/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = scripting.h
+subdir = src/include/scripting
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/include/scripting/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/include/scripting/scripting.h b/src/include/scripting/scripting.h
new file mode 100644
index 0000000..be75a87
--- /dev/null
+++ b/src/include/scripting/scripting.h
@@ -0,0 +1,6 @@
+#ifndef SCRIPTING_H
+#define SCRIPTING_H
+
+extern void init_c_interface(void);
+
+#endif
diff --git a/src/include/video/Makefile.am b/src/include/video/Makefile.am
new file mode 100644
index 0000000..21756c6
--- /dev/null
+++ b/src/include/video/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = explosion.h fonttex.h graphics_fx.h graphics_hud.h graphics_lights.h graphics_utility.h graphics_world.h model.h recognizer.h skybox.h texture.h trail_geometry.h video.h
diff --git a/src/include/video/Makefile.in b/src/include/video/Makefile.in
new file mode 100644
index 0000000..3383843
--- /dev/null
+++ b/src/include/video/Makefile.in
@@ -0,0 +1,230 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_HEADERS = explosion.h fonttex.h graphics_fx.h graphics_hud.h graphics_lights.h graphics_utility.h graphics_world.h model.h recognizer.h skybox.h texture.h trail_geometry.h video.h
+subdir = src/include/video
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/include/video/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/include/video/explosion.h b/src/include/video/explosion.h
new file mode 100644
index 0000000..fb65ff2
--- /dev/null
+++ b/src/include/video/explosion.h
@@ -0,0 +1,7 @@
+
+#ifndef EXPLOSION_H
+#define EXPLOSION_H
+
+void drawExplosion(float *spire_radius);
+
+#endif /* EXPLOSION_H */
diff --git a/src/include/video/fonttex.h b/src/include/video/fonttex.h
new file mode 100644
index 0000000..f8ebbee
--- /dev/null
+++ b/src/include/video/fonttex.h
@@ -0,0 +1,21 @@
+#ifndef FONTTEX_H
+#define FONTTEX_H
+
+typedef struct {
+ int nTextures;
+
+ int texwidth; /* texture width */
+ int width; /* character width */
+
+ int lower; /* lowest ascii character (normally: 32) */
+ int upper; /* highest ascii character (normally: 126) */
+
+ int *texID;
+
+ char *fontname;
+ char *bitmapname;
+ int bitmapTexwidth;
+ int bitmapWidth; /* character width */
+} FontTex;
+
+#endif
diff --git a/src/include/video/graphics_fx.h b/src/include/video/graphics_fx.h
new file mode 100644
index 0000000..d196856
--- /dev/null
+++ b/src/include/video/graphics_fx.h
@@ -0,0 +1,11 @@
+#ifndef GRAPHICS_FX_H
+#define GRAPHICS_FX_H
+
+#include "video.h"
+#include "game/game.h"
+
+extern void drawImpact(PlayerVisual *pV);
+extern void drawGlow(Camera *pCam, Player *pTarget, PlayerVisual *pV,
+ Visual *d, float dim);
+
+#endif
diff --git a/src/include/video/graphics_hud.h b/src/include/video/graphics_hud.h
new file mode 100644
index 0000000..bf52930
--- /dev/null
+++ b/src/include/video/graphics_hud.h
@@ -0,0 +1,16 @@
+#ifndef GRAPHICS_HUD_H
+#define GRAPHICS_HUD_H
+
+#include "video.h"
+#include "game/game.h"
+
+extern void drawAI(Visual *d);
+extern void drawPause(Visual *d);
+
+extern void drawScore(Player *p, Visual *d);
+extern void drawFPS(Visual *d);
+
+extern void drawConsoleLines(char *line, int call);
+extern void drawConsole(Visual *d);
+
+#endif
diff --git a/src/include/video/graphics_lights.h b/src/include/video/graphics_lights.h
new file mode 100644
index 0000000..ec4cf43
--- /dev/null
+++ b/src/include/video/graphics_lights.h
@@ -0,0 +1,12 @@
+#ifndef GRAPHICS_LIGHTS_H
+#define GRAPHICS_LIGHTS_H
+
+extern void setupLights(int type);
+
+enum {
+ eCycles = 0,
+ eRecognizer,
+ eWorld
+};
+
+#endif
diff --git a/src/include/video/graphics_utility.h b/src/include/video/graphics_utility.h
new file mode 100644
index 0000000..4c58638
--- /dev/null
+++ b/src/include/video/graphics_utility.h
@@ -0,0 +1,12 @@
+#ifndef GRAPHICS_UTILITY_H
+#define GRAPHICS_UTILITY_H
+
+#include "video.h"
+
+extern void checkGLError(const char *where);
+extern void rasonly(Visual *d);
+extern void doPerspective(float fov, float ratio, float znear, float zfar);
+extern void doLookAt(float *cam, float *target, float *up);
+extern void drawText(FontTex* ftx, int x, int y, int size, const char *text);
+
+#endif
diff --git a/src/include/video/graphics_world.h b/src/include/video/graphics_world.h
new file mode 100644
index 0000000..ac9e438
--- /dev/null
+++ b/src/include/video/graphics_world.h
@@ -0,0 +1,9 @@
+#ifndef GRAPHICS_WORLD_H
+#define GRAPHICS_WORLD_H
+
+void drawWalls(void);
+int drawFloorTextured(int grid_size, GLuint texture);
+void drawFloorGrid(int grid_size, int line_spacing,
+ float line_color[4], float square_color[4]);
+
+#endif
diff --git a/src/include/video/model.h b/src/include/video/model.h
new file mode 100644
index 0000000..53d5dad
--- /dev/null
+++ b/src/include/video/model.h
@@ -0,0 +1,73 @@
+#ifndef MODEL_H
+#define MODEL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_VERTICES 30000
+#define MAX_FACES 20000
+#define MAX_NORMALS 30000
+#define MAX_MATERIALS 200
+
+#define BUF_SIZE 120
+
+#define NO_SDL_GLEXT
+#include "SDL_opengl.h"
+// #include <GL/gl.h>
+
+#include "Nebu_base.h"
+#include "Nebu_filesystem.h"
+
+typedef struct {
+ float ambient[4];
+ float diffuse[4];
+ float specular[4];
+ float shininess;
+ char *name;
+ char *map_diffuse;
+} Material;
+
+typedef struct {
+ vec3 vMin;
+ vec3 vSize;
+ float fRadius;
+} BoundingBox;
+
+typedef struct {
+ GLfloat *pVertices;
+ GLfloat *pNormals;
+ GLshort **ppIndices;
+ int nVertices, nNormals, nMaterials;
+ Material* pMaterials;
+ int *pnFaces;
+ BoundingBox BBox;
+} Mesh;
+
+typedef enum {
+ TRI_MESH,
+ QUAD_MESH
+} MeshType;
+
+extern Mesh* readMeshFromFile(const char* filename, MeshType type);
+extern void drawModel(Mesh* pMesh, MeshType type);
+extern void drawModelExplosion(Mesh *pMesh, float fRadius);
+
+typedef enum {
+ eAmbient = 0,
+ eDiffuse,
+ eSpecular
+} ColorType;
+
+extern void SetMaterialColor(Mesh *pMesh, char *name, ColorType eType,
+ float pColor[4]);
+
+extern void computeBBox(Mesh* pMesh);
+
+extern int polycount;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* MODEL_H */
diff --git a/src/include/video/recognizer.h b/src/include/video/recognizer.h
new file mode 100644
index 0000000..988c73f
--- /dev/null
+++ b/src/include/video/recognizer.h
@@ -0,0 +1,12 @@
+#ifndef RECOGNIZER_H
+#define RECOGNIZER_H
+
+#include "Nebu_base.h"
+
+extern void resetRecognizer(void);
+extern void doRecognizerMovement(void);
+extern void drawRecognizer(void);
+extern void drawRecognizerShadow(void);
+extern void getRecognizerPositionVelocity(vec2 *p, vec2 *v);
+
+#endif
diff --git a/src/include/video/skybox.h b/src/include/video/skybox.h
new file mode 100644
index 0000000..8ddc16b
--- /dev/null
+++ b/src/include/video/skybox.h
@@ -0,0 +1,10 @@
+#ifndef SKYBOX_H
+#define SKYBOX_H
+
+void enableSkyboxTexture(void);
+void disableSkyboxTexture(void);
+void drawSkybox(int grid_size);
+
+#endif /* SKYBOX_H */
+
+
diff --git a/src/include/video/texture.h b/src/include/video/texture.h
new file mode 100644
index 0000000..b84bf4b
--- /dev/null
+++ b/src/include/video/texture.h
@@ -0,0 +1,32 @@
+#ifndef TEXTURE_H
+#define TEXTURE_H
+
+typedef struct {
+ int count;
+ char name[48];
+ int type;
+ int wrap_s;
+ int wrap_t;
+ int id;
+ float anisotropy;
+} TextureInfo;
+
+enum {
+ TEX_FLOOR = 0,
+ TEX_GUI,
+ TEX_LOGO,
+ TEX_WALL1,
+ TEX_WALL2,
+ TEX_WALL3,
+ TEX_WALL4,
+ TEX_IMPACT,
+ TEX_TRAIL,
+ TEX_DECAL,
+ TEX_DEBUG,
+ TEX_SKYBOX,
+ /* insert all texture tokens before TEX_COUNT */
+ TEX_COUNT
+};
+
+#endif
+
diff --git a/src/include/video/trail_geometry.h b/src/include/video/trail_geometry.h
new file mode 100644
index 0000000..e6c747b
--- /dev/null
+++ b/src/include/video/trail_geometry.h
@@ -0,0 +1,31 @@
+#ifndef TRAIL_GEOMETRY_H
+#define TRAIL_GEOMETRY_H
+
+#include "video.h"
+#include "game/game.h"
+
+typedef struct {
+ vec3* pVertices; // each vertex consists of three floats
+ vec3* pNormals; // each normal consists of three float
+ vec2* pTexCoords; // each texcoord consists of three float
+ unsigned short *pIndices; // each triangle consists of three 16bit indices
+ unsigned char *pColors; // each vertex color consists of 4 bytes
+ unsigned int iSize;
+ unsigned int iUsed;
+} TrailMesh;
+
+void storeVertex(TrailMesh *pMesh, int offset,
+ segment2 *s, float t, float fFloor, float fTop,
+ float fSegLength, float fTotalLength);
+void storeIndices(TrailMesh *pMesh, int indexOffset, int vertexOffset);
+void trailGeometry(Player *pPlayer, PlayerVisual *pV,
+ TrailMesh *pMesh,
+ int *pVertexOffset, int *pIndexOffset);
+void bowGeometry(Player *pPlayer, PlayerVisual *pV,
+ TrailMesh *pMesh,
+ int *pVertexOffset, int *pIndexOffset);
+void trailRender(TrailMesh *pMesh);
+void trailStatesNormal(Player *pPlayer, int texture);
+void trailStatesShadowed(void);
+void trailStatesRestore(void);
+#endif
diff --git a/src/include/video/video.h b/src/include/video/video.h
new file mode 100644
index 0000000..a151f84
--- /dev/null
+++ b/src/include/video/video.h
@@ -0,0 +1,280 @@
+#ifndef VIDEO_H
+#define VIDEO_H
+
+#include "game/camera.h"
+#include "video/fonttex.h"
+#include "video/model.h"
+
+#include "Nebu_video.h"
+
+/* dropped support for anything else than libpng */
+#include <png.h>
+typedef png_texture texture;
+#define LOAD_TEX(x) load_png_texture(x)
+#define TEX_SUFFIX ".png"
+
+typedef struct {
+ char *path;
+ /* char *name; currently ignored */
+} Artpack;
+
+typedef struct {
+ Visual display;
+
+ float pColorDiffuse[4];
+ float pColorSpecular[4];
+ float pColorAlpha[4];
+
+ // unsigned int turn_time; /* for cycle animation */
+ unsigned int spoke_time; /* for cycle wheel animation */
+ int spoke_state; /* showing spoke or not */
+
+ /* explosion stuff */
+ float impact_radius;
+ float exp_radius; /* explosion of the cycle model */
+} PlayerVisual;
+
+enum { VP_SINGLE = 0, VP_SPLIT = 1, VP_FOURWAY = 2 }; // Viewport Type;
+
+#include "recognizer.h"
+
+/* rendering stuff */
+#include "explosion.h"
+
+#include "graphics_utility.h"
+#include "graphics_fx.h"
+#include "graphics_hud.h"
+#include "graphics_lights.h"
+#include "graphics_world.h"
+#include "trail_geometry.h"
+
+/* resource management */
+#include "texture.h"
+
+extern int game_textures;
+extern int n_textures;
+extern TextureInfo textures[];
+
+/* artpack stuff */
+
+extern void initArtpacks(void);
+extern void loadArt(void);
+extern void reloadArt(void);
+
+/* graphics libs */
+// #include "extgl.h"
+// #include <GL/gl.h>
+#define NO_SDL_GLEXT
+#include "SDL_opengl.h"
+// #include <GL/glext.h>
+
+enum {
+ NEAREST = 0,
+ LINEAR,
+ MIPMAP,
+ TRILINEAR
+};
+
+#define PI ((float) M_PI)
+#ifdef WIN32
+#define floorf (float)floor
+#define fabsf (float)fabs
+#define sqrtf (float)sqrt
+#define cosf (float) cos
+#define sinf (float) sin
+#define acosf (float) acos
+#define tanf (float) tan
+#endif
+
+#define B_HEIGHT 0
+#define CYCLE_HEIGHT 8
+#define RECOGNIZER_HEIGHT 50
+#define WALL_H 12
+
+/* global constants */
+
+#define CAM_TYPE_CIRCLING 0
+#define CAM_TYPE_FOLLOW 1
+#define CAM_TYPE_COCKPIT 2
+#define CAM_TYPE_MOUSE 3
+
+#define CAM_COUNT 4
+#define CAM_CIRCLE_DIST 17
+#define CAM_CIRCLE_Z 8.0f
+
+#define CAM_FOLLOW_DIST 18
+#define CAM_FOLLOW_Z 6.0f
+#define CAM_FOLLOW_SPEED 0.05f
+#define CAM_FOLLOW_SPEED_FACTOR 1.0f / 82.0f
+#define CAM_SPEED 0.000349f
+
+#define CAM_COCKPIT_Z 4
+
+#define CAM_R_MIN 2.0
+#define CAM_R_MAX 100
+#define CAM_CHI_MIN PI / 6
+#define CAM_CHI_MAX PI / 2 - PI / 6
+
+#define CAM_DR 6.4f
+
+#define EXP_RADIUS_MAX 30
+#define EXP_RADIUS_DELTA 0.01f
+
+/* trail definitions */
+#define DECAL_WIDTH 20.0f
+#define BOW_LENGTH 6
+
+#define BOW_DIST3 2
+#define BOW_DIST2 0.85f
+#define BOW_DIST1 0.4f
+
+
+extern int gl_error;
+
+
+extern int viewport_content[4];
+
+
+extern float camAngle;
+extern float cam_phi;
+extern float cam_chi;
+extern float cam_r_mouse;
+extern float cam_r_follow;
+extern float cam_r_circle;
+
+#ifdef DEPTH_SORT
+extern int quadBufSize;
+extern Quad* quadBuf;
+extern int* quadBufIndex;
+#endif
+
+#define LC_LOD 3
+extern char *lc_lod_names[];
+extern Mesh *recognizer;
+extern Mesh *recognizer_quad;
+extern float rec_outline_color[3];
+extern float rec_spec_color[4];
+
+extern Mesh *lightcycle[];
+
+/* extern TexFont *txf; */
+extern FontTex *gameFtx;
+extern FontTex *guiFtx;
+extern int fontID;
+#define MAX_FONTS 17
+
+extern float camAngles[];
+
+extern int polycount;
+
+extern float colors_trail_diffuse[][4];
+extern float colors_model_diffuse[][4];
+extern float colors_model_specular[][4];
+extern int vps;
+extern int vp_max[];
+extern float vp_x[4][4];
+extern float vp_y[4][4];
+extern float vp_w[4][4];
+extern float vp_h[4][4];
+extern unsigned char debugcolors[6][4];
+
+extern float shadow_color[4];
+extern float shadow_matrix[16];
+
+
+/* pixel stuff */
+extern unsigned char* loadPixels(const char *filename, Visual *d);
+extern unsigned char* scalePixels(const unsigned char *source,
+ int sw, int sh,
+ int x, int y, int w, int h,
+ int dw, int dh, int bytes);
+
+/* font stuff ->fonts.c */
+extern void initFonts(void);
+extern void deleteFonts(void);
+extern void draw( void );
+
+/* FontTex stuff */
+extern texture* loadTextureData(const char *filename);
+extern void freeTextureData(texture *tex);
+extern FontTex *ftxLoadFont(const char *filename);
+extern void ftxUnloadFont(FontTex *ftx);
+extern void loadTexture(const char *filename, int format);
+
+/* It's not necessary to bind the texture explicitly. */
+/* (and we don't know which texture to bind) */
+
+/* ftxRenderString will take care of that */
+/* extern void ftxBindFontTexture(fontTex *ftx); */
+
+extern void ftxRenderString(FontTex *ftx, const char *string, int len);
+
+/* extern void ftxGetStringWidth(fontTex *ftx, */
+/* const char *string, int len, int *width); */
+/* can't get max_ascent, max_descent yet */
+
+extern void doTrail(segment2 *t, int value);
+
+extern void initDisplay(Visual *d, int type, int p, int onScreen);
+extern void changeDisplay(int view);
+extern void updateDisplay(int vpType);
+/* vp types defined in data.h */
+
+extern void drawGame(void);
+extern void displayGame(void);
+extern void initGLGame(void);
+
+extern void shutdownDisplay(Visual *d);
+extern void setupDisplay(Visual *d);
+
+extern void initFonts(void);
+extern void initTexture(Visual*);
+extern void deleteTextures(Visual*);
+
+/* texture loading -> load_texture.c */
+/* uses sgi_texture.c or sdl_texture.c */
+extern void loadTexture(const char *filename, int format);
+
+/* screenshot.c */
+extern void doBmpScreenShot(Visual *display);
+extern void doPngScreenShot(Visual *display);
+
+/* probably common graphics stuff -> graphics.c */
+
+extern void rasonly(Visual *d);
+
+extern int hsv2rgb(float, float, float, float*, float*, float*);
+extern void colorDisc(void);
+
+/* gltron game graphics -> gamegraphics.c */
+extern void rebuildDebugTex(void);
+extern void drawDebugLines(Visual *d);
+extern void drawDebugTex(Visual *d);
+/* extern void drawHelp(Visual *d); */
+extern void drawPlayers(Player *p, PlayerVisual *pV);
+extern void drawCam(Player *p, PlayerVisual *pV);
+
+extern void draw2D( Visual *d );
+
+/* trail.c */
+extern void drawTrailLines(Player *p, PlayerVisual *pV);
+extern void drawTrailShadow(Player *p, PlayerVisual *pV);
+extern float getSegmentUV(segment2 *line);
+extern float getSegmentEndUV(segment2 *line, Data *data);
+extern float getSegmentEndX(Data *data, int type);
+extern float getSegmentEndY(Data *data, int type);
+
+extern void drawMenu(Visual *d);
+
+extern void initVideoData(void);
+extern void initGameScreen(void);
+
+extern void Video_Idle(void);
+
+extern Visual *gScreen;
+extern int gViewportType;
+extern int video_initialized;
+
+extern PlayerVisual *gPlayerVisuals;
+
+#endif
diff --git a/src/input/Makefile.am b/src/input/Makefile.am
new file mode 100644
index 0000000..9505e19
--- /dev/null
+++ b/src/input/Makefile.am
@@ -0,0 +1,9 @@
+noinst_LIBRARIES=libinput.a
+
+libinput_a_SOURCES = \
+ input.c
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
diff --git a/src/input/Makefile.in b/src/input/Makefile.in
new file mode 100644
index 0000000..0003226
--- /dev/null
+++ b/src/input/Makefile.in
@@ -0,0 +1,296 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libinput.a
+
+libinput_a_SOURCES = \
+ input.c
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
+
+subdir = src/input
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libinput_a_AR = $(AR) cru
+libinput_a_LIBADD =
+am_libinput_a_OBJECTS = input.$(OBJEXT)
+libinput_a_OBJECTS = $(am_libinput_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/input.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libinput_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libinput_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/input/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libinput.a: $(libinput_a_OBJECTS) $(libinput_a_DEPENDENCIES)
+ -rm -f libinput.a
+ $(libinput_a_AR) libinput.a $(libinput_a_OBJECTS) $(libinput_a_LIBADD)
+ $(RANLIB) libinput.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/input.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/input/input.c b/src/input/input.c
new file mode 100644
index 0000000..39acfa2
--- /dev/null
+++ b/src/input/input.c
@@ -0,0 +1,207 @@
+#include "video/video.h"
+#include "game/game.h"
+
+#include "Nebu_input.h"
+#include "Nebu_scripting.h"
+
+/* I hear people are reading this file because they couldn't find the
+ manual! Go to http://www.gltron.org/ */
+
+int reserved_keys[] = {
+ 'q', 27, ' ',
+ SYSTEM_KEY_F1,
+ SYSTEM_KEY_F2,
+ SYSTEM_KEY_F3,
+ SYSTEM_KEY_F4,
+ SYSTEM_KEY_F5,
+ SYSTEM_KEY_F10,
+ SYSTEM_KEY_F11,
+ SYSTEM_KEY_F12,
+ SYSTEM_KEY_UP,
+ SYSTEM_KEY_DOWN
+};
+
+void keyGame(int state, int k, int x, int y)
+{
+ int i;
+
+ if(state == SYSTEM_KEYSTATE_DOWN) {
+ switch (k) {
+ /* case 'q': SystemExit(); return; */
+ case 27:
+ SystemExitLoop(RETURN_GAME_ESCAPE);
+ return;
+ case ' ':
+ SystemExitLoop(RETURN_GAME_PAUSE);
+ return;
+ case SYSTEM_KEY_F1: changeDisplay(0); return;
+ case SYSTEM_KEY_F2: changeDisplay(1); return;
+ case SYSTEM_KEY_F3: changeDisplay(2); return;
+ case SYSTEM_KEY_F4: changeDisplay(3); return;
+
+ case SYSTEM_KEY_F5: saveSettings(); return;
+
+ case SYSTEM_KEY_F10: nextCameraType(); return;
+ case SYSTEM_KEY_F11: doBmpScreenShot(gScreen); return;
+ case SYSTEM_KEY_F12: doPngScreenShot(gScreen); return;
+
+ case SYSTEM_KEY_UP: consoleScrollBackward(1); return;
+ case SYSTEM_KEY_DOWN: consoleScrollForward(1); return;
+ /* toggle lighting
+ case SYSTEM_KEY_F6:
+ setSettingi("light_cycles", !game->settings->light_cycles);
+ return;
+ */
+ }
+ }
+ for( i = 0; i < game->players; i++) {
+ if(PLAYER_IS_ACTIVE(&game->player[i]) &&
+ !game->player[i].ai->active) {
+ int key;
+ if(state == SYSTEM_KEYSTATE_DOWN) {
+ scripting_RunFormat("return settings.keys[%d].left", i + 1);
+ scripting_GetIntegerResult( &key );
+ if(key == k) {
+ createEvent(i, EVENT_TURN_LEFT);
+ return;
+ }
+ scripting_RunFormat("return settings.keys[%d].right", i + 1);
+ scripting_GetIntegerResult( &key );
+ if(key == k) {
+ createEvent(i, EVENT_TURN_RIGHT);
+ return;
+ }
+ }
+ // deal with glance keys
+ scripting_RunFormat("return settings.keys[%d].glance_left", i + 1);
+ scripting_GetIntegerResult( &key );
+ if(key == k) {
+ if(state == SYSTEM_KEYSTATE_DOWN) {
+ printf("glance left down\n");
+ game->player[i].camera->movement[CAM_PHI_OFFSET] = PI / 2.0f;
+ } else {
+ printf("glance left up\n");
+ game->player[i].camera->movement[CAM_PHI_OFFSET] = 0;
+ }
+ return;
+ }
+ // deal with glance keys
+ scripting_RunFormat("return settings.keys[%d].glance_right", i + 1);
+ scripting_GetIntegerResult( &key );
+ if(key == k) {
+ if(state == SYSTEM_KEYSTATE_DOWN) {
+ printf("glance right down\n");
+ game->player[i].camera->movement[CAM_PHI_OFFSET] = - PI / 2.0f;
+ } else {
+ printf("glance right up\n");
+ game->player[i].camera->movement[CAM_PHI_OFFSET] = 0;
+ }
+ return;
+ }
+ // boost
+ scripting_RunFormat("return settings.keys[%d].boost", i + 1);
+ scripting_GetIntegerResult( &key );
+ if(key == k) {
+ if(state == SYSTEM_KEYSTATE_DOWN) {
+ printf("boost down\n");
+ if(game->player[i].data->booster > getSettingf("booster_min"))
+ game->player[i].data->boost_enabled = 1;
+ } else {
+ printf("boost up\n");
+ game->player[i].data->boost_enabled = 0;
+ }
+ return;
+ }
+ }
+ }
+ if(state == SYSTEM_KEYSTATE_DOWN) {
+ displayMessage(TO_STDERR, "key '%s' (%d) is not bound",
+ SystemGetKeyName(k), k);
+ }
+}
+
+void parse_args(int argc, const char *argv[]) {
+ int i;
+ while(argc--) {
+ if(argv[argc][0] == '-') {
+ i = 0;
+ while(argv[argc][++i] != 0) {
+ switch(argv[argc][i]) {
+ case 'x': setSettingi("show_crash_texture", 0); break;
+ case 'F': setSettingi("show_fps", 0); break;
+ case 't': setSettingi("show_floor_texture", 0); break;
+ case 'c': setSettingi("show_ai_status", 0); break;
+ case 'g': setSettingi("show_glow", 0); break;
+ case 'w': setSettingi("show_wall", 0); break;
+ case 'C': setSettingi("show_ai_status", 1); break;
+ case 'i': setSettingi("windowMode", 1); break;
+ case 'O': setSettingi("softwareRendering", 1); break;
+ case '1': /* default is 4 */
+ setSettingi("width", 320);
+ setSettingi("height", 240);
+ break;
+ case '2':
+ setSettingi("width", 512);
+ setSettingi("height", 384);
+ break;
+ case '3':
+ setSettingi("width", 640);
+ setSettingi("height", 480);
+ break;
+ case '4':
+ setSettingi("width", 800);
+ setSettingi("height", 600);
+ break;
+ case '5':
+ setSettingi("width", 1024);
+ setSettingi("height", 768);
+ break;
+ case '6':
+ setSettingi("width", 1280);
+ setSettingi("height", 1024);
+ break;
+ case '7':
+ setSettingi("width", 1600);
+ setSettingi("height", 1200);
+ break;
+ case 's':
+ setSettingi("playMusic", 0);
+ setSettingi("playEffects", 0);
+ break;
+ case 'h':
+ default:
+ printf("Usage: %s [-FftwbghcCsk1234simo]\n\n", argv[0]);
+ printf("Options:\n\n");
+ printf("-F\tdon't display FPS counter\n");
+ printf("-t\tdon't display floor texture, use lines instead"
+ "(huge speed gain)\n");
+ printf("-w\tdon't display walls (speed gain)\n");
+ printf("-x\tdon't show crash texture (speed gain)\n");
+ printf("-g\tdon't show glows (small speed gain)\n");
+ printf("-c\tdon't show ai status\n");
+ printf("-C\tshow ai status (default: on)\n");
+
+ printf("-1\tSet resolution to 320x240\n");
+ printf("-2\tSet resolution to 512x384\n");
+ printf("-3\tSet resolution to 640x480\n");
+ printf("-4\tSet resolution to 800x600 (default)\n");
+ printf("-5\tSet resolution to 1024x768\n");
+ printf("-6\tSet resolution to 1280x1024\n");
+ printf("-7\tSet resolution to 1600x1200\n");
+
+ printf("-s\tDon't play sound\n");
+ /* printf("-v\tStart in demo/screensaver mode\n"); */
+ printf("-i\tforce startup in a window\n");
+ printf("-O\tenable software rendering optimization (only if "
+ "you don't have a 3d card!)\n");
+ printf("-h\tthis help\n");
+ exit(0); /* OK: end of program */
+ }
+ }
+ }
+ }
+}
+
+void Input_Idle(void) {
+ SystemSetJoyThreshold( getSettingf("joy_threshold") );
+}
diff --git a/src/video/Makefile.am b/src/video/Makefile.am
new file mode 100644
index 0000000..27886e3
--- /dev/null
+++ b/src/video/Makefile.am
@@ -0,0 +1,14 @@
+noinst_LIBRARIES=libvideo.a
+
+libvideo_a_SOURCES = \
+ artpack.c explosion.c fonts.c fonttex.c gamegraphics.c \
+ graphics_fx.c graphics_hud.c graphics_lights.c \
+ graphics_utility.c graphics_world.c \
+ load_texture.c material.c model.c recognizer.c \
+ screenshot.c skybox.c texture.c trail.c trail_geometry.c \
+ trail_render.c video.c visuals_2d.c
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
diff --git a/src/video/Makefile.in b/src/video/Makefile.in
new file mode 100644
index 0000000..00b2a5e
--- /dev/null
+++ b/src/video/Makefile.in
@@ -0,0 +1,343 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+EXEEXT = @EXEEXT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+NETWORK_OBJS = @NETWORK_OBJS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SOUND_OBJS = @SOUND_OBJS@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+noinst_LIBRARIES = libvideo.a
+
+libvideo_a_SOURCES = \
+ artpack.c explosion.c fonts.c fonttex.c gamegraphics.c \
+ graphics_fx.c graphics_hud.c graphics_lights.c \
+ graphics_utility.c graphics_world.c \
+ load_texture.c material.c model.c recognizer.c \
+ screenshot.c skybox.c texture.c trail.c trail_geometry.c \
+ trail_render.c video.c visuals_2d.c
+
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/lua/include \
+ -I$(top_srcdir)/nebu/include \
+ -I$(top_srcdir)/src/include
+
+subdir = src/video
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libvideo_a_AR = $(AR) cru
+libvideo_a_LIBADD =
+am_libvideo_a_OBJECTS = artpack.$(OBJEXT) explosion.$(OBJEXT) \
+ fonts.$(OBJEXT) fonttex.$(OBJEXT) gamegraphics.$(OBJEXT) \
+ graphics_fx.$(OBJEXT) graphics_hud.$(OBJEXT) \
+ graphics_lights.$(OBJEXT) graphics_utility.$(OBJEXT) \
+ graphics_world.$(OBJEXT) load_texture.$(OBJEXT) \
+ material.$(OBJEXT) model.$(OBJEXT) recognizer.$(OBJEXT) \
+ screenshot.$(OBJEXT) skybox.$(OBJEXT) texture.$(OBJEXT) \
+ trail.$(OBJEXT) trail_geometry.$(OBJEXT) trail_render.$(OBJEXT) \
+ video.$(OBJEXT) visuals_2d.$(OBJEXT)
+libvideo_a_OBJECTS = $(am_libvideo_a_OBJECTS)
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/artpack.Po $(DEPDIR)/explosion.Po \
+@AMDEP_TRUE@ $(DEPDIR)/fonts.Po $(DEPDIR)/fonttex.Po \
+@AMDEP_TRUE@ $(DEPDIR)/gamegraphics.Po $(DEPDIR)/graphics_fx.Po \
+@AMDEP_TRUE@ $(DEPDIR)/graphics_hud.Po \
+@AMDEP_TRUE@ $(DEPDIR)/graphics_lights.Po \
+@AMDEP_TRUE@ $(DEPDIR)/graphics_utility.Po \
+@AMDEP_TRUE@ $(DEPDIR)/graphics_world.Po \
+@AMDEP_TRUE@ $(DEPDIR)/load_texture.Po $(DEPDIR)/material.Po \
+@AMDEP_TRUE@ $(DEPDIR)/model.Po $(DEPDIR)/recognizer.Po \
+@AMDEP_TRUE@ $(DEPDIR)/screenshot.Po $(DEPDIR)/skybox.Po \
+@AMDEP_TRUE@ $(DEPDIR)/texture.Po $(DEPDIR)/trail.Po \
+@AMDEP_TRUE@ $(DEPDIR)/trail_geometry.Po \
+@AMDEP_TRUE@ $(DEPDIR)/trail_render.Po $(DEPDIR)/video.Po \
+@AMDEP_TRUE@ $(DEPDIR)/visuals_2d.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(libvideo_a_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in compile
+SOURCES = $(libvideo_a_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/video/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+
+AR = ar
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libvideo.a: $(libvideo_a_OBJECTS) $(libvideo_a_DEPENDENCIES)
+ -rm -f libvideo.a
+ $(libvideo_a_AR) libvideo.a $(libvideo_a_OBJECTS) $(libvideo_a_LIBADD)
+ $(RANLIB) libvideo.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/artpack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/explosion.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fonts.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fonttex.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/gamegraphics.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/graphics_fx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/graphics_hud.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/graphics_lights.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/graphics_utility.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/graphics_world.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/load_texture.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/material.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/model.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/recognizer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/screenshot.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/skybox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/texture.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/trail.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/trail_geometry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/trail_render.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/video.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/visuals_2d.Po@am__quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/video/artpack.c b/src/video/artpack.c
new file mode 100644
index 0000000..4b2239e
--- /dev/null
+++ b/src/video/artpack.c
@@ -0,0 +1,59 @@
+#include "video/video.h"
+#include "filesystem/path.h"
+#include "base/util.h"
+
+#include "Nebu_scripting.h"
+#include "Nebu_filesystem.h"
+
+void initArtpacks(void) {
+ const char *art_path;
+ List *artList;
+ List *p;
+ int i;
+
+ art_path = getDirectory( PATH_ART );
+ artList = readDirectoryContents(art_path, NULL);
+ if(artList->next == NULL) {
+ fprintf(stderr, "[fatal] no art files found...exiting\n");
+ exit(1); /* OK: critical, installation corrupt */
+ }
+
+ i = 1;
+ for(p = artList; p->next != NULL; p = p->next) {
+ if(strncmp((char*)p->data, "Makefile", 8)) {
+ scripting_RunFormat("artpacks[%d] = \"%s\"", i, (char*) p->data);
+ i++;
+ }
+ }
+ scripting_Run("setupArtpacks()");
+}
+
+void loadArt(void) {
+ char *path;
+ char *artpack;
+
+ runScript(PATH_SCRIPTS, "artpack.lua"); // load default art settings
+
+ scripting_GetGlobal("settings", "current_artpack", NULL);
+ scripting_GetStringResult(&artpack);
+ fprintf(stderr, "[status] loading artpack '%s'\n", artpack);
+
+ path = getArtPath(artpack, "artpack.lua");
+ free(artpack);
+
+ if(path != NULL) {
+ scripting_RunFile(path);
+ free(path);
+ }
+
+ initTexture(gScreen);
+ initFonts();
+}
+
+void reloadArt(void) {
+ printf("[status] reloading art\n");
+ deleteTextures(gScreen);
+ loadArt();
+}
+
+
diff --git a/src/video/compile b/src/video/compile
new file mode 100644
index 0000000..30845b2
--- /dev/null
+++ b/src/video/compile
@@ -0,0 +1,102 @@
+cd /home/andreas/GLtron/gltron/src/video/
+make -k
+source='recognizer.c' object='recognizer.o' libtool=no \
+depfile='.deps/recognizer.Po' tmpdepfile='.deps/recognizer.TPo' \
+depmode=gcc /bin/sh ../../depcomp \
+gcc -DPACKAGE=\"gltron\" -DVERSION=\"0.63alpha1\" -DHAVE_LIBGL=1 -DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBSMPEG=1 -DHAVE_LIBOGG=1 -DHAVE_LIBVORBIS=1 -DHAVE_LIBVORBISFILE=1 -DHAVE_LIBSMPEG=1 -DHAVE_LIBMIKMOD=1 -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DHAVE_GL_GL_H=1 -Dconst= -DHAVE_STRSTR=1 -DHAVE_MKSTEMP=1 -I. -I. -DLOCAL_DATA -DSNAP_DIR=\"~\" -DPREF_DIR=\"~\" -I../../lua/include -I../../nebu/include -I../../src/include -DSEPARATOR="'/'" -Wall -Werror -Os -I/usr/local/include/SDL -D_REENTRANT -c `test -f recognizer.c || echo './'`recognizer.c
+recognizer.c: In function `drawRecognizer':
+recognizer.c:83: `Point' undeclared (first use in this function)
+recognizer.c:83: (Each undeclared identifier is reported only once
+recognizer.c:83: for each function it appears in.)
+recognizer.c:83: parse error before `p'
+recognizer.c:88: `p' undeclared (first use in this function)
+recognizer.c:88: `v' undeclared (first use in this function)
+make: *** [recognizer.o] Error 1
+source='trail.c' object='trail.o' libtool=no \
+depfile='.deps/trail.Po' tmpdepfile='.deps/trail.TPo' \
+depmode=gcc /bin/sh ../../depcomp \
+gcc -DPACKAGE=\"gltron\" -DVERSION=\"0.63alpha1\" -DHAVE_LIBGL=1 -DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBSMPEG=1 -DHAVE_LIBOGG=1 -DHAVE_LIBVORBIS=1 -DHAVE_LIBVORBISFILE=1 -DHAVE_LIBSMPEG=1 -DHAVE_LIBMIKMOD=1 -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DHAVE_GL_GL_H=1 -Dconst= -DHAVE_STRSTR=1 -DHAVE_MKSTEMP=1 -I. -I. -DLOCAL_DATA -DSNAP_DIR=\"~\" -DPREF_DIR=\"~\" -I../../lua/include -I../../nebu/include -I../../src/include -DSEPARATOR="'/'" -Wall -Werror -Os -I/usr/local/include/SDL -D_REENTRANT -c `test -f trail.c || echo './'`trail.c
+trail.c: In function `getSegmentEndX':
+trail.c:39: `line' undeclared (first use in this function)
+trail.c:39: (Each undeclared identifier is reported only once
+trail.c:39: for each function it appears in.)
+cc1: warnings being treated as errors
+trail.c:35: warning: unused variable `s'
+trail.c:34: warning: `tlength' might be used uninitialized in this function
+trail.c: In function `getSegmentEndY':
+trail.c:47: `Line' undeclared (first use in this function)
+trail.c:47: `line' undeclared (first use in this function)
+trail.c:46: warning: `tlength' might be used uninitialized in this function
+trail.c: At top level:
+trail.c:58: parse error before `*'
+trail.c: In function `getSegmentEndUV':
+trail.c:58: number of arguments doesn't match prototype
+../../src/include/video/video.h:263: prototype declaration
+trail.c:60: `data' undeclared (first use in this function)
+trail.c:60: `line' undeclared (first use in this function)
+trail.c:59: warning: `tlength' might be used uninitialized in this function
+trail.c: At top level:
+trail.c:67: parse error before `*'
+trail.c: In function `getSegmentUV':
+trail.c:67: number of arguments doesn't match prototype
+../../src/include/video/video.h:262: prototype declaration
+trail.c:69: `line' undeclared (first use in this function)
+trail.c:68: warning: `tlength' might be used uninitialized in this function
+trail.c: In function `drawTrailLines':
+trail.c:80: `Line' undeclared (first use in this function)
+trail.c:80: `line' undeclared (first use in this function)
+trail.c:80: warning: statement with no effect
+trail.c:81: parse error before `float'
+trail.c:91: `data' undeclared (first use in this function)
+trail.c:92: `cam' undeclared (first use in this function)
+trail.c:94: `height' undeclared (first use in this function)
+trail.c:116: `dist' undeclared (first use in this function)
+trail.c:117: `alpha' undeclared (first use in this function)
+trail.c:119: `trail_top' undeclared (first use in this function)
+trail.c:121: `normal' undeclared (first use in this function)
+make: *** [trail.o] Error 1
+source='trail_geometry.c' object='trail_geometry.o' libtool=no \
+depfile='.deps/trail_geometry.Po' tmpdepfile='.deps/trail_geometry.TPo' \
+depmode=gcc /bin/sh ../../depcomp \
+gcc -DPACKAGE=\"gltron\" -DVERSION=\"0.63alpha1\" -DHAVE_LIBGL=1 -DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBSMPEG=1 -DHAVE_LIBOGG=1 -DHAVE_LIBVORBIS=1 -DHAVE_LIBVORBISFILE=1 -DHAVE_LIBSMPEG=1 -DHAVE_LIBMIKMOD=1 -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DHAVE_GL_GL_H=1 -Dconst= -DHAVE_STRSTR=1 -DHAVE_MKSTEMP=1 -I. -I. -DLOCAL_DATA -DSNAP_DIR=\"~\" -DPREF_DIR=\"~\" -I../../lua/include -I../../nebu/include -I../../src/include -DSEPARATOR="'/'" -Wall -Werror -Os -I/usr/local/include/SDL -D_REENTRANT -c `test -f trail_geometry.c || echo './'`trail_geometry.c
+trail_geometry.c:41: parse error before `Line'
+trail_geometry.c: In function `storeVertex':
+trail_geometry.c:43: number of arguments doesn't match prototype
+../../src/include/video/trail_geometry.h:19: prototype declaration
+trail_geometry.c:44: `pMesh' undeclared (first use in this function)
+trail_geometry.c:44: (Each undeclared identifier is reported only once
+trail_geometry.c:44: for each function it appears in.)
+trail_geometry.c:44: `offset' undeclared (first use in this function)
+trail_geometry.c:59: `line' undeclared (first use in this function)
+trail_geometry.c:66: `fTotalLength' undeclared (first use in this function)
+trail_geometry.c:68: `t' undeclared (first use in this function)
+trail_geometry.c:70: `fFloor' undeclared (first use in this function)
+trail_geometry.c:71: `fSegLength' undeclared (first use in this function)
+trail_geometry.c:78: `fTop' undeclared (first use in this function)
+trail_geometry.c: At top level:
+trail_geometry.c:106: parse error before `*'
+trail_geometry.c: In function `cmpdir':
+trail_geometry.c:106: number of arguments doesn't match prototype
+trail_geometry.c:9: prototype declaration
+trail_geometry.c:107: `line1' undeclared (first use in this function)
+trail_geometry.c:107: `line2' undeclared (first use in this function)
+trail_geometry.c: In function `trailGeometry':
+trail_geometry.c:123: structure has no member named `ex'
+trail_geometry.c:123: structure has no member named `sx'
+trail_geometry.c:124: structure has no member named `ey'
+trail_geometry.c:124: structure has no member named `sy'
+trail_geometry.c:146: `Line' undeclared (first use in this function)
+trail_geometry.c:146: parse error before `line'
+trail_geometry.c:147: `line' undeclared (first use in this function)
+trail_geometry.c:147: structure has no member named `sx'
+trail_geometry.c:148: structure has no member named `sy'
+cc1: warnings being treated as errors
+trail_geometry.c:120: warning: `fSegLength' might be used uninitialized in this function
+trail_geometry.c: In function `bowGeometry':
+trail_geometry.c:206: `Line' undeclared (first use in this function)
+trail_geometry.c:206: parse error before `line'
+trail_geometry.c:211: `line' undeclared (first use in this function)
+make: *** [trail_geometry.o] Error 1
+make: Target `all' not remade because of errors.
+
+Compilation exited abnormally with code 2 at Mon Sep 15 19:25:33
diff --git a/src/video/explosion.c b/src/video/explosion.c
new file mode 100644
index 0000000..7922532
--- /dev/null
+++ b/src/video/explosion.c
@@ -0,0 +1,149 @@
+#include "video/video.h"
+#include "video/explosion.h"
+
+#define IMPACT_RADIUS_DELTA 0.025f
+#define IMPACT_MAX_RADIUS 25.0f
+
+/* shockwave behavior constants */
+#define SHOCKWAVE_MIN_RADIUS 0.0f
+#define SHOCKWAVE_MAX_RADIUS 45.0f
+#define SHOCKWAVE_WIDTH 0.2f
+#define SHOCKWAVE_SPACING 6.0f
+#define SHOCKWAVE_SPEED 1.2f /* speed relative to IMPACT_RADIUS_DELTA */
+#define SHOCKWAVE_SEGMENTS 25
+#define NUM_SHOCKWAVES 3
+
+/* draw a single semi-circular shockwave of a given radius */
+static void drawWave(double radius) {
+ int i, j;
+ double angle;
+ double delta_radius = SHOCKWAVE_WIDTH / SHOCKWAVE_SEGMENTS;
+ double delta_angle = (180.0 / SHOCKWAVE_SEGMENTS) * (PI/180);
+ double start_angle = 270.0 * (PI/180);
+
+ for (i = 0; i < SHOCKWAVE_SEGMENTS; i++) {
+ glBegin(GL_QUAD_STRIP);
+ angle = start_angle;
+ for (j = 0; j <= SHOCKWAVE_SEGMENTS; j++) {
+ glVertex2d((radius + delta_radius) * sin(angle),
+ (radius + delta_radius) * cos(angle));
+ glVertex2d(radius * sin(angle), radius * cos(angle));
+ angle += delta_angle;
+ }
+ glEnd();
+ radius += delta_radius;
+ }
+}
+
+static void drawShockwaves(float radius) {
+ int waves;
+
+ glColor3f(1,0,0);
+
+ for(waves = 0; waves < NUM_SHOCKWAVES; waves++) {
+ if (radius > SHOCKWAVE_MIN_RADIUS && radius < SHOCKWAVE_MAX_RADIUS) {
+ drawWave(radius);
+ }
+ radius -= SHOCKWAVE_SPACING;
+ }
+}
+
+/* impact spire behavior constants */
+#define SPIRE_MAX_RADIUS 25
+#define SPIRE_WIDTH 0.40f
+#define NUM_SPIRES 21
+
+static void drawSpires(float radius) {
+ int i;
+ float left[3], right[3];
+ float zunit[3] = {0, 0, 1};
+
+ float vectors[NUM_SPIRES][3] = {
+ { 1.00f, 0.20f, 0.00f },
+ { 0.80f, 0.25f, 0.00f },
+ { 0.90f, 0.50f, 0.00f },
+ { 0.70f, 0.50f, 0.00f },
+ { 0.52f, 0.45f, 0.00f },
+ { 0.65f, 0.75f, 0.00f },
+ { 0.42f, 0.68f, 0.00f },
+ { 0.40f, 1.02f, 0.00f },
+ { 0.20f, 0.90f, 0.00f },
+ { 0.08f, 0.65f, 0.00f },
+ { 0.00f, 1.00f, 0.00f }, /* vertical spire */
+ { -0.08f, 0.65f, 0.00f },
+ { -0.20f, 0.90f, 0.00f },
+ { -0.40f, 1.02f, 0.00f },
+ { -0.42f, 0.68f, 0.00f },
+ { -0.65f, 0.75f, 0.00f },
+ { -0.52f, 0.45f, 0.00f },
+ { -0.70f, 0.50f, 0.00f },
+ { -0.90f, 0.50f, 0.00f },
+ { -0.80f, 0.30f, 0.00f },
+ { -1.00f, 0.20f, 0.00f }
+ };
+
+ glColor3f(1, 1, 1);
+ glVertex3f(0, 0, 0);
+
+ glBlendFunc(GL_ONE, GL_ONE);
+
+ glBegin(GL_TRIANGLES);
+
+ for (i=0; i < NUM_SPIRES; i++) {
+ normcrossprod(vectors[i], zunit, right);
+ normcrossprod(zunit, vectors[i], left);
+
+ vmul(right, SPIRE_WIDTH);
+ vmul(left, SPIRE_WIDTH);
+
+ glColor4f(1,1,1,0.0);
+ glVertex3fv(right);
+ glVertex3f(radius * vectors[i][0], radius * vectors[i][1], 0.0);
+ glVertex3fv(left);
+ }
+
+ glEnd();
+}
+
+#define GLOW_START_OPACITY 1.2f
+#define GLOW_INTENSITY 1.0f
+
+static void drawImpactGlow(float glow_radius) {
+
+ float opacity;
+
+ opacity = GLOW_START_OPACITY - (glow_radius / IMPACT_MAX_RADIUS);
+
+ glPushMatrix();
+ glScalef(glow_radius, glow_radius, 1.0f);
+
+ glBindTexture(GL_TEXTURE_2D, gScreen->textures[TEX_IMPACT]);
+ glEnable(GL_TEXTURE_2D);
+
+ glColor4f(GLOW_INTENSITY, GLOW_INTENSITY, GLOW_INTENSITY, opacity);
+ glDepthMask(0);
+ glBegin(GL_POLYGON);
+ glTexCoord2f(0.0, 0.0); glVertex2f(-1.0, -1.0);
+ glTexCoord2f(1.0, 0.0); glVertex2f(1.0, -1.0);
+ glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 1.0);
+ glTexCoord2f(0.0, 1.0); glVertex2f(-1.0, 1.0);
+ glEnd();
+ glDepthMask(1);
+ glDisable(GL_TEXTURE_2D);
+ glPopMatrix();
+}
+
+void drawExplosion(float *radius) {
+
+ float shockwave_radius = (*radius * SHOCKWAVE_SPEED);
+
+ drawShockwaves(shockwave_radius);
+
+ if (*radius < IMPACT_MAX_RADIUS) {
+ drawImpactGlow(*radius);
+ drawSpires(*radius);
+ }
+
+ *radius += game2->time.dt * IMPACT_RADIUS_DELTA;
+}
+
diff --git a/src/video/fonts.c b/src/video/fonts.c
new file mode 100644
index 0000000..e2b46eb
--- /dev/null
+++ b/src/video/fonts.c
@@ -0,0 +1,58 @@
+#include "video/video.h"
+#include "filesystem/path.h"
+#include "Nebu_filesystem.h"
+
+void initFonts(void) {
+ char *path;
+ file_handle file;
+ char buf[100];
+ char gamefont[100];
+ char guifont[100];
+ char *game = NULL, *gui = NULL;
+
+ if(gameFtx != NULL) ftxUnloadFont(gameFtx);
+ if(guiFtx != NULL) ftxUnloadFont(guiFtx);
+
+ path = getPath(PATH_DATA, "fonts.txt");
+ if(path != NULL) {
+ file = file_open(path, "r");
+ while(file_gets(file, buf, sizeof(buf)) != NULL) {
+ if(sscanf(buf, "game: %s ", gamefont) == 1)
+ game = gamefont;
+ else if(sscanf(buf, "menu: %s ", guifont) == 1)
+ gui = guifont;
+ }
+ file_close(file);
+ free(path);
+ } else {
+ fprintf(stderr, "can't load fonts.txt\n");
+ exit(1); /* OK: critical, installation corrupt */
+ }
+
+ if(game == NULL || gui == NULL) {
+ fprintf(stderr, "incomplete font definition in fonts.txt\n");
+ exit(1); /* OK: critical, installation corrupt */
+ }
+
+ gameFtx = ftxLoadFont(game);
+ guiFtx = ftxLoadFont(gui);
+
+ if(gameFtx == NULL) {
+ fprintf(stderr, "can't load font %s\n", game);
+ exit(1); /* OK: critical, installation corrupt */
+ }
+
+ if(guiFtx == NULL) {
+ fprintf(stderr, "can't load font %s\n", gui);
+ exit(1); /* OK: critical, installation corrupt */
+ }
+}
+
+void deleteFonts(void) {
+ if(gameFtx != NULL)
+ ftxUnloadFont(gameFtx);
+ gameFtx = NULL;
+ if(guiFtx != NULL)
+ ftxUnloadFont(guiFtx);
+ guiFtx = NULL;
+}
diff --git a/src/video/fonttex.c b/src/video/fonttex.c
new file mode 100644
index 0000000..f9413e4
--- /dev/null
+++ b/src/video/fonttex.c
@@ -0,0 +1,202 @@
+#include "video/video.h"
+#include "filesystem/path.h"
+#include "Nebu_filesystem.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+// #include <GL/gl.h>
+#define NO_SDL_GLEXT
+#include "SDL_opengl.h"
+
+#define FTX_ERR "[FontTex error]: "
+
+void getLine(char *buf, int size, file_handle file) {
+ do {
+ file_gets(file, buf, size);
+ } while( buf[0] == '\n' || buf[0] == '#');
+}
+
+FontTex *ftxLoadFont(const char *filename) {
+ char *path;
+ file_handle file;
+ char buf[100];
+
+ int i;
+ int len;
+ FontTex *ftx;
+
+ path = getPath(PATH_DATA, filename);
+ if(path == NULL) {
+ fprintf(stderr, FTX_ERR "can't load font file '%s'\n", filename);
+ return NULL;
+ }
+ file = file_open(path, "r");
+ free(path);
+
+ /* TODO(5): check for EOF errors in the following code */
+
+ /* nTextures, texture width, char width */
+ ftx = (FontTex*) malloc(sizeof(FontTex));
+ getLine(buf, sizeof(buf), file);
+ sscanf(buf, "%d %d %d ", &(ftx->nTextures), &(ftx->texwidth), &(ftx->width));
+ /* lowest character, highest character */
+ getLine(buf, sizeof(buf), file);
+ sscanf(buf, "%d %d ", &(ftx->lower), &(ftx->upper));
+ /* font name */
+ getLine(buf, sizeof(buf), file);
+ len = strlen(buf) + 1;
+
+ ftx->fontname = (char*)malloc(len);
+ memcpy(ftx->fontname, buf, len);
+
+ /* prepare space for texture IDs */
+ ftx->texID = (GLuint*) malloc(ftx->nTextures * sizeof(unsigned int));
+ glGenTextures(ftx->nTextures, ftx->texID);
+
+ /* the individual textures */
+ for(i = 0; i < ftx->nTextures; i++) {
+ char *texname;
+ getLine(buf, sizeof(buf), file);
+ len = strlen(buf) + 1;
+ if(buf[len - 2] == '\n') buf[len - 2] = 0;
+ texname = (char*)malloc(len);
+ memcpy(texname, buf, len);
+ glBindTexture(GL_TEXTURE_2D, ftx->texID[i]);
+ loadTexture(texname, GL_RGBA);
+ free(texname);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ /* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); */
+ /* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); */
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ }
+
+ file_close(file);
+ return ftx;
+}
+
+void ftxUnloadFont(FontTex *ftx) {
+ glDeleteTextures(ftx->nTextures, ftx->texID);
+
+ free(ftx->texID);
+ free(ftx->fontname);
+ free(ftx);
+}
+
+static int color_base = 48;
+static int colors = 8;
+enum {
+ white = 0,
+ black,
+ red,
+ orange,
+ yellow,
+ lt_green,
+ green,
+ blue_green
+};
+
+unsigned char color_codes[][3] = {
+ { 255, 255,255 },
+ { 0, 0, 0 },
+ { 255, 0, 0 },
+ { 255, 128, 0 },
+ { 255, 255, 0 },
+ { 128, 255, 0 },
+ { 0, 255, 0 },
+ { 0, 255, 128 }
+};
+
+/*
+0 48 white 65535 65536 65535 FFFFFF
+1 49 black 0 0 0 000000
+
+2 50 red 65535 0 0 FF0000
+3 51 orange 65535 32768 0 FF8000
+4 52 yellow 65535 65535 0 FFFF00
+5 53 lt green 32768 65535 0 80FF00
+6 54 green 0 65535 0 00FF00
+7 55 blue green 0 65535 32768 00FF80
+8 56 cyan 0 65535 65535 00FFFF
+9 57 lt blue 0 32768 65535 0080FF
+: 58 blue 0 0 65535 0000FF
+; 59 purple 32768 0 65535 8000FF
+< 60 magenta 65535 0 65535 FF00FF
+= 61 purple red 65535 0 32768 FF0080
+
+> 62 lt gray 49152 49152 49152 C0C0C0
+? 63 dk gray 16384 16384 16384 404040
+
+@ 64 - 32768 0 0 800000
+A 65 | 32768 16384 0 804000
+B 66 | 32768 32768 0 808000
+C 67 | darker 16384 32768 0 408000
+D 68 | versions 0 32768 0 008000
+E 69 | of 0 32768 16384 008040
+F 70 | colors 0 32768 32768 008080
+G 71 | 50..61 0 16384 32768 004080
+H 72 | 0 0 32768 000080
+I 73 | 16384 0 32768 400080
+J 74 | 32768 0 32768 800080
+K 75 - 32768 0 16384 800040
+*/
+
+void ftxRenderString(FontTex *ftx, const char *string, int len) {
+ int i;
+ int bound = -1;
+ int index;
+
+ int tex;
+ int w;
+ float cw;
+ float cx, cy;
+
+ w = ftx->texwidth / ftx->width;
+ cw = (float)ftx->width / (float)ftx->texwidth;
+
+ for(i = 0; i < len; i++) {
+ if(string[i] == 3) { /* color code */
+ i++;
+ if(i >= len) return;
+ if(string[i] < color_base && string[i] > color_base + colors) continue;
+ glColor3ubv(color_codes[ string[i] - color_base ]);
+ continue;
+ }
+
+ /* find out which texture it's in */
+ /* TODO(4): find out why the +1 is necessary */
+ index = string[i] - ftx->lower + 1;
+ if(index >= ftx->upper)
+ fprintf(stderr, FTX_ERR " index out of bounds");
+ tex = index / (w *
+w);
+ /* bind texture */
+ if(tex != bound) {
+ glBindTexture(GL_TEXTURE_2D, ftx->texID[tex]);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ bound = tex;
+ }
+ /* find texture coordinates */
+ index = index % (w * w);
+ cx = (float)(index % w) / (float)w;
+ cy = (float)(index / w) / (float)w;
+ /* draw quad */
+ /* fprintf(stderr, FTX_ERR "coords: tex %d (%.2f, %.2f), %.2f\n", */
+ /* bound, cx, cy, cw); */
+
+ glBegin(GL_QUADS);
+ glTexCoord2f(cx, 1 - cy - cw);
+ glVertex2f(i, 0);
+ glTexCoord2f(cx + cw, 1 - cy - cw);
+ glVertex2f(i + 1, 0);
+ glTexCoord2f(cx + cw, 1 - cy);
+ glVertex2f(i + 1, 1);
+ glTexCoord2f(cx, 1 - cy);
+ glVertex2f(i, 1);
+ glEnd();
+ }
+ /* checkGLError("FontTex.c ftxRenderString\n"); */
+}
diff --git a/src/video/gamegraphics.c b/src/video/gamegraphics.c
new file mode 100644
index 0000000..d2108c2
--- /dev/null
+++ b/src/video/gamegraphics.c
@@ -0,0 +1,480 @@
+#include "video/video.h"
+#include "game/game.h"
+
+#include "video/skybox.h"
+#include "video/recognizer.h"
+#include "video/explosion.h"
+
+// static float arena[] = { 1.0, 1.2, 1, 0.0 };
+
+#define MAX_LOD_LEVEL 3
+static int lod_dist[MAX_LOD_LEVEL + 1][LC_LOD + 1] = {
+ { 1000, 1000, 1000 }, /* insane */
+ { 100, 200, 400 }, /* high */
+ { 30, 100, 200 }, /* low */
+ { 10, 30, 150 } /* ugly */
+};
+
+/* spoke colors */
+static float SpokeColor[4] = {1.0, 1.0, 1.0, 1.0};
+static float NoSpokeColor[4] = {0.0, 0.0, 0.0, 1.0};
+
+void drawGame(void) {
+ GLint i;
+
+ polycount = 0;
+
+ glEnable(GL_DEPTH_TEST);
+
+ glClearColor(gSettingsCache.clear_color[0],
+ gSettingsCache.clear_color[1],
+ gSettingsCache.clear_color[2],
+ gSettingsCache.clear_color[3]);
+
+ if(gSettingsCache.use_stencil) {
+ glClearStencil(0);
+ glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
+ } else {
+ glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+ }
+
+ for(i = 0; i < vp_max[gViewportType]; i++) {
+ Player *p = game->player + viewport_content[i];
+ PlayerVisual *pV = gPlayerVisuals + viewport_content[i];
+ Visual *d = & pV->display;
+
+ if(d->onScreen == 1) {
+ glViewport(d->vp_x, d->vp_y, d->vp_w, d->vp_h);
+ drawCam(p, pV);
+ glDisable(GL_DEPTH_TEST);
+ glDepthMask(GL_FALSE);
+ if (gSettingsCache.show_scores)
+ drawScore(p, d);
+ if (gSettingsCache.show_ai_status)
+ if(p->ai->active == AI_COMPUTER)
+ drawAI(d);
+ }
+ glDepthMask(GL_TRUE);
+ glEnable(GL_DEPTH_TEST);
+ }
+
+ if (gSettingsCache.show_fps)
+ drawFPS(gScreen);
+
+ if(gSettingsCache.show_console)
+ drawConsole(gScreen);
+
+ /* printf("%d polys\n", polycount); */
+}
+
+float GetDistance(float *v, float *p, float *d) {
+ float diff[3];
+ float tmp[3];
+ float t;
+ vsub(v, p, diff);
+ t = scalarprod(d, diff) / scalarprod(d, d);
+ vcopy(d, tmp);
+ vmul(tmp, t);
+ vsub(diff, tmp, tmp);
+ return sqrtf( scalarprod(tmp, tmp) );
+}
+
+static float dirangles[] = { 0, -90, -180, 90, 180, -270 };
+
+float getDirAngle(int time, Player *p) {
+ int last_dir;
+ float dirAngle;
+
+ if(time < TURN_LENGTH) {
+ last_dir = p->data->last_dir;
+ if(p->data->dir == 3 && last_dir == 2)
+ last_dir = 4;
+ if(p->data->dir == 2 && last_dir == 3)
+ last_dir = 5;
+ dirAngle = ((TURN_LENGTH - time) * dirangles[last_dir] +
+ time * dirangles[p->data->dir]) / TURN_LENGTH;
+ } else
+ dirAngle = dirangles[p->data->dir];
+
+ return dirAngle;
+}
+
+void doCycleTurnRotation(PlayerVisual *pV, Player *p) {
+ int neigung_dir = -1;
+ int time = game2->time.current - p->data->turn_time;
+ float dirAngle = getDirAngle(time, p);
+
+ glRotatef(dirAngle, 0, 0, 1);
+
+#define neigung 25
+ if(time < TURN_LENGTH && p->data->last_dir != p->data->dir) {
+ float axis = 1.0f;
+ if(p->data->dir < p->data->last_dir && p->data->last_dir != 3)
+ axis = -1.0;
+ else if((p->data->last_dir == 3 && p->data->dir == 2) ||
+ (p->data->last_dir == 0 && p->data->dir == 3))
+ axis = -1.0;
+ glRotated(neigung * sin(PI * time / TURN_LENGTH),
+ 0.0, axis * neigung_dir, 0.0);
+ }
+#undef neigung
+}
+
+void drawCycleShadow(PlayerVisual *pV, Player *p, int lod, int drawTurn) {
+ Mesh *cycle;
+ int turn_time = game2->time.current - p->data->turn_time;
+
+ if(turn_time < TURN_LENGTH && !drawTurn)
+ return;
+
+ if(pV->exp_radius != 0)
+ return;
+
+ cycle = lightcycle[lod];
+
+ /* states */
+
+ glEnable(GL_CULL_FACE);
+
+ if(gSettingsCache.use_stencil) {
+ glEnable(GL_STENCIL_TEST);
+ glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ glStencilFunc(GL_GREATER, 1, 1);
+ glEnable(GL_BLEND);
+ glColor4fv(shadow_color);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ } else {
+ glColor3f(0, 0, 0);
+ glDisable(GL_BLEND);
+ }
+
+ /* transformations */
+
+ glPushMatrix();
+ {
+ float x, y;
+ getPositionFromData(&x, &y, p->data);
+ glTranslatef(x,y, 0.0);
+ }
+ glMultMatrixf(shadow_matrix);
+ if (gSettingsCache.turn_cycle) {
+ doCycleTurnRotation(pV, p);
+ } else if (pV->exp_radius == 0) {
+ glRotatef(dirangles[p->data->dir], 0.0, 0.0, 1.0);
+ }
+ glTranslatef(0, 0, cycle->BBox.vSize.v[2] / 2);
+
+ /* render */
+
+ drawModel(cycle, TRI_MESH);
+
+ /* restore */
+
+ if(gSettingsCache.use_stencil)
+ glDisable(GL_STENCIL_TEST);
+
+ glDisable(GL_BLEND);
+ glDisable(GL_CULL_FACE);
+ glPopMatrix();
+}
+
+void drawCycle(Player *p, PlayerVisual *pV, int lod, int drawTurn) {
+ Mesh *cycle = lightcycle[lod];
+
+ unsigned int spoke_time = game2->time.current - pV->spoke_time;
+ int turn_time = game2->time.current - p->data->turn_time;
+
+ if(turn_time < TURN_LENGTH && !drawTurn)
+ return;
+
+ glPushMatrix();
+ {
+ float x, y;
+ getPositionFromData(&x, &y, p->data);
+ glTranslatef(x, y, 0.0);
+ }
+
+ if (pV->exp_radius == 0 && gSettingsCache.turn_cycle == 0) {
+ glRotatef(dirangles[p->data->dir], 0.0, 0.0, 1.0);
+ }
+
+ if (gSettingsCache.turn_cycle) {
+ doCycleTurnRotation(pV, p);
+ }
+
+ setupLights(eCycles);
+
+ SetMaterialColor(cycle, "Hull", eDiffuse, pV->pColorDiffuse);
+ SetMaterialColor(cycle, "Hull", eSpecular, pV->pColorSpecular);
+
+ if (gSettingsCache.light_cycles) {
+ glEnable(GL_LIGHTING);
+ }
+
+ glEnable(GL_DEPTH_TEST);
+ glDepthMask(GL_TRUE);
+
+ if (pV->exp_radius == 0) {
+ glEnable(GL_NORMALIZE);
+
+ glTranslatef(0, 0, cycle->BBox.vSize.v[2] / 2);
+
+ /* draw spoke animation */
+ if (spoke_time > 140 - (p->data->speed * 10)
+ && game->pauseflag == PAUSE_GAME_RUNNING) {
+ if (pV->spoke_state == 1) {
+ pV->spoke_state = 0;
+ SetMaterialColor(cycle, "Spoke", eSpecular, SpokeColor);
+ SetMaterialColor(cycle, "Spoke", eAmbient, SpokeColor);
+ } else {
+ pV->spoke_state = 1;
+ SetMaterialColor(cycle, "Spoke", eSpecular, NoSpokeColor);
+ SetMaterialColor(cycle, "Spoke", eAmbient, NoSpokeColor);
+ }
+ pV->spoke_time = game2->time.current;
+ }
+
+ glEnable(GL_CULL_FACE);
+ drawModel(cycle, TRI_MESH);
+ glDisable(GL_CULL_FACE);
+
+ } else if(pV->exp_radius < EXP_RADIUS_MAX) {
+
+ glEnable(GL_BLEND);
+
+ if (gSettingsCache.show_impact) {
+ drawImpact(pV);
+ }
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glTranslatef(0, 0, cycle->BBox.vSize.v[2] / 2);
+
+ drawModelExplosion(cycle, pV->exp_radius);
+ }
+ glDisable(GL_BLEND);
+ glDisable(GL_LIGHTING);
+ glPopMatrix();
+}
+
+int playerVisible(Player *eye, Player *target) {
+ float v1[3];
+ float v2[3];
+ float tmp[3];
+ float s;
+ float d;
+ int i;
+ int lod_level;
+ float x, y;
+
+ vsub(eye->camera->target, eye->camera->cam, v1);
+ normalize(v1);
+
+ getPositionFromData(&x, &y, target->data);
+ tmp[0] = x;
+ tmp[1] = y;
+ tmp[2] = 0;
+
+ lod_level = (gSettingsCache.lod > MAX_LOD_LEVEL) ?
+ MAX_LOD_LEVEL : gSettingsCache.lod;
+
+ /* calculate lod */
+ vsub(eye->camera->cam, tmp, v2);
+ d = length(v2);
+ for(i = 0; i < LC_LOD && d >= lod_dist[lod_level][i]; i++);
+ if(i >= LC_LOD)
+ return -1;
+
+ vsub(tmp, eye->camera->cam, v2);
+ normalize(v2);
+ s = scalarprod(v1, v2);
+ /* maybe that's not exactly correct, but I didn't notice anything */
+ d = cosf((gSettingsCache.fov / 2) * 2 * PI / 360.0);
+ /*
+ printf("v1: %.2f %.2f %.2f\nv2: %.2f %.2f %.2f\ns: %.2f d: %.2f\n\n",
+ v1[0], v1[1], v1[2], v2[0], v2[1], v2[2],
+ s, d);
+ */
+ if(s < d-(lightcycle[i]->BBox.fRadius*2))
+ return -1;
+ else
+ return i;
+}
+
+void drawPlayers(Player *p, PlayerVisual *pV) {
+ int i;
+
+ for(i = 0; i < game->players; i++) {
+ int lod;
+ int drawTurn = 1;
+
+ if (gSettingsCache.camType == CAM_TYPE_COCKPIT &&
+ p == &game->player[i])
+ drawTurn = 0;
+
+ lod = playerVisible(p, &(game->player[i]));
+ if (lod >= 0) {
+ drawCycle(game->player + i, gPlayerVisuals + i, lod, drawTurn);
+ }
+ }
+}
+
+void drawCam(Player *p, PlayerVisual* pV) {
+ int i;
+ float up[3] = { 0, 0, 1 };
+ Visual *d = & pV->display;
+
+ glColor3f(0.0, 1.0, 0.0);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ doPerspective(gSettingsCache.fov, d->vp_w / d->vp_h,
+ gSettingsCache.znear, game2->rules.grid_size * 6.5f);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ /* set positions for GL lights in world coordinates */
+ glLightfv(GL_LIGHT1, GL_POSITION, p->camera->cam);
+
+ doLookAt(p->camera->cam, p->camera->target, up);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_BLEND);
+
+ glDepthMask(GL_FALSE);
+ glDisable(GL_DEPTH_TEST);
+
+ /* skybox */
+ if (gSettingsCache.show_skybox) {
+ drawSkybox(game2->rules.grid_size);
+ }
+
+ /* fixme: clear z-buffer handling */
+ /* glDepthMask(GL_TRUE); */
+
+ /* floor */
+ if (gSettingsCache.show_floor_texture) {
+ drawFloorTextured(game2->rules.grid_size,
+ gScreen->textures[TEX_FLOOR]);
+ } else {
+ /* should this be an artpack setting? */
+ float line_color[] = {1.0, 1.0, 1.0};
+
+ drawFloorGrid(game2->rules.grid_size,
+ gSettingsCache.line_spacing,
+ line_color,
+ gSettingsCache.clear_color);
+ }
+
+ /* glDepthMask(GL_FALSE); */
+
+ /* shadows on the floor: cycle, recognizer, trails */
+ if (gSettingsCache.show_recognizer) {
+ drawRecognizerShadow();
+ }
+
+ for(i = 0; i < game->players; i++) {
+ int lod = playerVisible(p, game->player + i);
+ if (lod >= 0) {
+ int drawTurn = 1;
+ if (! gSettingsCache.camType == CAM_TYPE_COCKPIT ||
+ p != &game->player[i])
+ drawTurn = 0;
+ drawCycleShadow(gPlayerVisuals + i, game->player + i, lod, drawTurn);
+ }
+ if (game->player[i].data->trail_height > 0 )
+ drawTrailShadow(game->player + i, gPlayerVisuals + i);
+ }
+
+ glDepthMask(GL_TRUE);
+ glEnable(GL_DEPTH_TEST);
+
+ if (gSettingsCache.show_recognizer &&
+ p->data->speed != SPEED_GONE) {
+ drawRecognizer();
+ }
+
+ if (gSettingsCache.show_wall == 1) {
+ drawWalls();
+ }
+
+ drawPlayers(p, pV);
+
+ setupLights(eWorld);
+
+ glEnable(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(1,1);
+
+ {
+ TrailMesh mesh;
+ mesh.pVertices = (vec3*) malloc(1000 * sizeof(vec3));
+ mesh.pNormals = (vec3*) malloc(1000 * sizeof(vec3));
+ mesh.pColors = (unsigned char*) malloc(1000 * 4 * sizeof(float));
+ mesh.pTexCoords = (vec2*) malloc(1000 * sizeof(vec2));
+ mesh.pIndices = (unsigned short*) malloc(1000 * 2);
+
+ for(i = 0; i < game->players; i++) {
+ if (game->player[i].data->trail_height > 0 ) {
+ int vOffset = 0;
+ int iOffset = 0;
+ mesh.iUsed = 0;
+ trailGeometry(game->player + i, gPlayerVisuals + i,
+ &mesh, &vOffset, &iOffset);
+ bowGeometry(game->player + i, gPlayerVisuals + i,
+ &mesh, &vOffset, &iOffset);
+ trailStatesNormal(game->player + i, gScreen->textures[TEX_DECAL]);
+ trailRender(&mesh);
+ trailStatesRestore();
+ }
+ }
+ free(mesh.pVertices);
+ free(mesh.pNormals);
+ free(mesh.pColors);
+ free(mesh.pTexCoords);
+ free(mesh.pIndices);
+ }
+
+ glDisable(GL_POLYGON_OFFSET_FILL);
+
+ for(i = 0; i < game->players; i++)
+ if (game->player[i].data->trail_height > 0 )
+ drawTrailLines(game->player + i, gPlayerVisuals + i);
+
+ /* transparent stuff */
+ /* draw the glow around the other players: */
+ if (gSettingsCache.show_glow == 1) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ for (i = 0; i < game->players; i++) {
+ if (p != game->player + i && PLAYER_IS_ACTIVE(game->player + i)) {
+ drawGlow(p->camera, game->player + i, gPlayerVisuals + i,
+ d, TRAIL_HEIGHT * 4);
+ }
+
+ glDisable(GL_BLEND);
+ }
+ }
+ /* 2d hack */
+ if(gSettingsCache.map_ratio_w > 0)
+ {
+ Visual d2d;
+ memcpy(&d2d, d, sizeof(Visual));
+ d2d.vp_w *= gSettingsCache.map_ratio_w;
+ d2d.vp_h *= gSettingsCache.map_ratio_h;
+
+ d2d.vp_x += 20;
+ d2d.vp_y += 20;
+
+ glDepthMask(GL_FALSE);
+ glDisable(GL_DEPTH_TEST);
+ draw2D(&d2d);
+ glDepthMask(GL_TRUE);
+ glEnable(GL_DEPTH_TEST);
+ }
+}
+
+void initGLGame(void) {
+ glShadeModel( GL_SMOOTH );
+ glDepthMask(GL_TRUE);
+ glEnable(GL_DEPTH_TEST);
+}
diff --git a/src/video/graphics_fx.c b/src/video/graphics_fx.c
new file mode 100644
index 0000000..db8c0fa
--- /dev/null
+++ b/src/video/graphics_fx.c
@@ -0,0 +1,116 @@
+#include "video/video.h"
+#include "game/game.h"
+
+void drawGlow(Camera *pCam, Player *pTarget, PlayerVisual *pV,
+ Visual *d, float dim) {
+ float mat[4*4];
+ float alpha, dist;
+ float x, y;
+
+ glPushMatrix();
+
+ getPositionFromData(&x, &y, pTarget->data);
+ glTranslatef(x, y, 0);
+
+ glDepthMask(GL_FALSE);
+ glEnable(GL_DEPTH_TEST);
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glEnable(GL_BLEND);
+
+ glGetFloatv(GL_MODELVIEW_MATRIX, mat);
+ mat[0] = mat[5] = mat[10] = 1.0;
+ mat[1] = mat[2] = 0.0;
+ mat[4] = mat[6] = 0.0;
+ mat[8] = mat[9] = 0.0;
+ glLoadMatrixf(mat);
+
+ {
+ vec3 v;
+ v.v[0] = x - pCam->cam[0];
+ v.v[1] = y - pCam->cam[1];
+ v.v[2] = 0 - pCam->cam[2];
+ dist = vec3Length(&v);
+ }
+ {
+ const float fMin = 30;
+ const float fMax = 100;
+ if(dist < fMin) alpha = 0.0f;
+ else if(dist > fMax) alpha = 1.0f;
+ else alpha = (dist - fMin) / (fMax - fMin);
+ // printf("dist: %.2f, alpha: %.2f\n", dist, alpha);
+ }
+ glBegin(GL_TRIANGLE_FAN);
+ glColor4f(pV->pColorDiffuse[0],
+ pV->pColorDiffuse[1],
+ pV->pColorDiffuse[2],
+ alpha);
+
+ glVertex3f(0,TRAIL_HEIGHT/2, 0);
+ glColor4f(0,0,0,0.0);
+ glVertex3d(dim*cos(-0.2*3.1415/5.0),
+ TRAIL_HEIGHT/2+dim*sin(-0.2*3.1415/5.0), 0);
+ glVertex3d(dim*cos(1.0*3.1415/5.0),
+ TRAIL_HEIGHT/2+dim*sin(1.0*3.1415/5.0), 0);
+ glVertex3d(dim*cos(2.0*3.1415/5.0),
+ TRAIL_HEIGHT/2+dim*sin(2.0*3.1415/5.0), 0);
+ glVertex3d(dim*cos(3.0*3.1415/5.0),
+ TRAIL_HEIGHT/2+dim*sin(3.0*3.1415/5.0), 0);
+ glVertex3d(dim*cos(4.0*3.1415/5.0),
+ TRAIL_HEIGHT/2+dim*sin(4.0*3.1415/5.0), 0);
+ glVertex3d(dim*cos(5.2*3.1415/5.0),
+ TRAIL_HEIGHT/2+dim*sin(5.2*3.1415/5.0), 0);
+ glEnd();
+ polycount += 5;
+
+
+ glBegin(GL_TRIANGLES);
+ glColor4f(pV->pColorDiffuse[0],
+ pV->pColorDiffuse[1],
+ pV->pColorDiffuse[2],
+ alpha);
+ glVertex3f(0,TRAIL_HEIGHT/2, 0);
+ glColor4f(0,0,0,0.0);
+ glVertex3f(0,-TRAIL_HEIGHT/4,0);
+ glVertex3d(dim*cos(-0.2f*3.1415/5.0),
+ TRAIL_HEIGHT/2+dim*sin(-0.2*3.1415/5.0), 0);
+
+ glColor4f(pV->pColorDiffuse[0],
+ pV->pColorDiffuse[1],
+ pV->pColorDiffuse[2],
+ alpha);
+ glVertex3f(0,TRAIL_HEIGHT/2, 0);
+ glColor4f(0,0,0,0.0);
+ glVertex3d(dim*cos(5.2*3.1415/5.0),
+ TRAIL_HEIGHT/2+dim*sin(5.2*3.1415/5.0), 0);
+ glVertex3f(0,-TRAIL_HEIGHT/4,0);
+ glEnd();
+ polycount += 3;
+
+ glDepthMask(GL_TRUE);
+ glEnable(GL_DEPTH_TEST);
+
+ glPopMatrix();
+}
+
+void drawImpact(PlayerVisual *pV) {
+
+ glDisable(GL_LIGHTING);
+ glPushMatrix();
+
+ glRotatef(90, 90, 0, 1);
+
+ /*
+ * Drop impact slightly below the floor and move it a tiny bit
+ * back from the impact point so we don't draw behind the
+ * trail/wall that's hit.
+ */
+ glTranslatef(0.0, -0.5, -0.5);
+
+ glColor3f(0.68f, 0, 0);
+
+ drawExplosion(&(pV->impact_radius));
+ glPopMatrix();
+ glEnable(GL_LIGHTING);
+}
+
diff --git a/src/video/graphics_hud.c b/src/video/graphics_hud.c
new file mode 100644
index 0000000..2d1c6c5
--- /dev/null
+++ b/src/video/graphics_hud.c
@@ -0,0 +1,149 @@
+#include "video/video.h"
+#include "game/game.h"
+
+void drawAI(Visual *d) {
+ char ai[] = "computer player";
+
+ rasonly(d);
+ glColor3f(1.0, 1.0, 1.0);
+ drawText(gameFtx, d->vp_w / 4, 10, d->vp_w / (2 * strlen(ai)), ai);
+ /* glRasterPos2i(100, 0); */
+}
+
+void drawPause(Visual *display) {
+ char pause[] = "Game is paused";
+ char winner[] = "Player %d wins!";
+ char nowinner[] = "No one wins!";
+ char buf[100];
+ char *message;
+ static float d = 0;
+ static float lt = 0;
+ float delta;
+ int now;
+
+ now = SystemGetElapsedTime();
+ delta = now - lt;
+ lt = now;
+ delta /= 500.0;
+ d += delta;
+ /* printf("%.5f\n", delta); */
+
+ if (d > 2 * PI) {
+ d -= 2 * PI;
+ }
+
+ if ((game->pauseflag & PAUSE_GAME_FINISHED) && game->winner != -1) {
+ if (game->winner >= -1) {
+
+ float* player_color = gPlayerVisuals[game->winner].pColorAlpha;
+
+ /*
+ make the 'Player wins' message oscillate between
+ white and the winning bike's color
+ */
+ glColor3f((player_color[0] + ((sinf(d) + 1) / 2) * (1 - player_color[0])),
+ (player_color[1] + ((sinf(d) + 1) / 2) * (1 - player_color[1])),
+ (player_color[2] + ((sinf(d) + 1) / 2) * (1 - player_color[2])));
+
+ message = buf;
+ sprintf(message, winner, game->winner + 1);
+ } else {
+ glColor3d(1.0, (sin(d) + 1) / 2, (sin(d) + 1) / 2);
+ message = nowinner;
+ }
+ } else {
+ glColor3d(1.0, (sin(d) + 1) / 2, (sin(d) + 1) / 2);
+ message = pause;
+ }
+
+ rasonly(gScreen);
+ drawText(gameFtx, display->vp_w / 6, 20,
+ display->vp_w / (6.0f / 4.0f * strlen(message)), message);
+}
+
+void drawScore(Player *p, Visual *d) {
+ char tmp[10]; /* hey, they won't reach such a score */
+
+ sprintf(tmp, "%d", p->data->score);
+ rasonly(d);
+ glColor4f(1.0, 1.0, 0.2f, 1.0);
+ drawText(gameFtx, 5, 5, 32, tmp);
+}
+
+
+void drawFPS(Visual *d) {
+#define FPS_HSIZE 20
+ /* draws FPS in upper left corner of Display d */
+ static int fps_h[FPS_HSIZE];
+ static int pos = -FPS_HSIZE;
+ static int fps_min = 0;
+ static int fps_avg = 0;
+
+ char tmp[20];
+ int diff;
+
+ rasonly(d);
+ diff = (game2->time.dt > 0) ? game2->time.dt : 1;
+
+ if(pos < 0) {
+ fps_avg = 1000 / diff;
+ fps_min = 1000 / diff;
+ fps_h[pos + FPS_HSIZE] = 1000 / diff;
+ pos++;
+ } else {
+ fps_h[pos] = 1000 / diff;
+ pos = (pos + 1) % FPS_HSIZE;
+ if(pos % 10 == 0) {
+ int i;
+ int sum = 0;
+ int min = 1000;
+ for(i = 0; i < FPS_HSIZE; i++) {
+ sum += fps_h[i];
+ if(fps_h[i] < min)
+ min = fps_h[i];
+ }
+ fps_min = min;
+ fps_avg = sum / FPS_HSIZE;
+ }
+ }
+
+ sprintf(tmp, "average FPS: %d", fps_avg);
+ glColor4f(1.0, 0.4f, 0.2f, 1.0);
+ drawText(gameFtx, d->vp_w - 180, d->vp_h - 20, 10, tmp);
+ sprintf(tmp, "minimum FPS: %d", fps_min);
+ drawText(gameFtx, d->vp_w - 180, d->vp_h - 35, 10, tmp);
+ sprintf(tmp, "triangles: %d", polycount);
+ drawText(gameFtx, d->vp_w - 180, d->vp_h - 50, 10, tmp);
+}
+
+
+void drawConsoleLines(char *line, int call) {
+#define CONSOLE_SIZE 15
+#define CONSOLE_X_OFF 20
+ int size = CONSOLE_SIZE;
+ int length;
+ /* fprintf(stdout, "%s\n", line); */
+ length = strlen(line);
+ while(length * size > gScreen->vp_w / 2 - CONSOLE_X_OFF)
+ size--;
+
+ if(*line != 0)
+ drawText(gameFtx, CONSOLE_X_OFF, gScreen->vp_h - 20 * (call + 1),
+ size, line);
+}
+
+void drawConsole(Visual *d) {
+ int lines;
+ rasonly(d);
+ glColor3f(1.0, 0.3f, 0.3f);
+
+ if (gSettingsCache.softwareRendering) {
+ lines = 1;
+ } else if (gScreen->vp_h < 600) {
+ lines = 3;
+ } else {
+ lines = 5;
+ }
+
+ consoleDisplay(drawConsoleLines, lines);
+}
diff --git a/src/video/graphics_lights.c b/src/video/graphics_lights.c
new file mode 100644
index 0000000..8d0548e
--- /dev/null
+++ b/src/video/graphics_lights.c
@@ -0,0 +1,70 @@
+#include "video/video.h"
+
+void setupLights(int type) {
+ float white[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ // float gray22[] = { 0.22f, 0.22f, 0.22f, 1.0f };
+ float gray66[] = { 0.66f, 0.66f, 0.66f, 1.0f };
+ float gray10[] = { 0.1f, 0.1f, 0.1f, 1.0f };
+ float black[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+
+ float posWorld0[] = { 1, .8f, 0, 0 };
+ float posWorld1[] = { -1, -.8f, 0, 0 };
+
+ float posCycles0[] = { 0, 0, 0, 1 };
+
+ int i;
+
+ // turn global ambient lighting off
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, black);
+ glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1);
+ glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
+
+ switch(type) {
+ case eWorld:
+ glEnable(GL_LIGHTING);
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ // glLoadIdentity();
+
+ glEnable(GL_LIGHT0);
+ glLightfv(GL_LIGHT0, GL_POSITION, posWorld0);
+ glLightfv(GL_LIGHT0, GL_AMBIENT, gray10);
+ // glLightfv(GL_LIGHT0, GL_AMBIENT, black);
+ glLightfv(GL_LIGHT0, GL_SPECULAR, white);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, white);
+
+ glEnable(GL_LIGHT1);
+ glLightfv(GL_LIGHT1, GL_POSITION, posWorld1);
+ glLightfv(GL_LIGHT1, GL_AMBIENT, black);
+ glLightfv(GL_LIGHT1, GL_SPECULAR, gray66);
+ glLightfv(GL_LIGHT1, GL_DIFFUSE, gray66);
+
+ for(i = 2; i < 8; i++)
+ glDisable(GL_LIGHT0 + i);
+
+ glPopMatrix();
+
+ break;
+ case eCycles:
+ case eRecognizer:
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+
+ glLightfv(GL_LIGHT0, GL_POSITION, posCycles0);
+ glLightfv(GL_LIGHT0, GL_AMBIENT, gray10);
+ glLightfv(GL_LIGHT0, GL_SPECULAR, white);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, white);
+
+ for(i = 1; i < 8; i++)
+ glDisable(GL_LIGHT0 + i);
+
+ glPopMatrix();
+
+ break;
+ }
+}
diff --git a/src/video/graphics_utility.c b/src/video/graphics_utility.c
new file mode 100644
index 0000000..5aa3dea
--- /dev/null
+++ b/src/video/graphics_utility.c
@@ -0,0 +1,71 @@
+#include "video/video.h"
+#include "game/game.h"
+
+void checkGLError(const char *where) {
+ int error;
+ error = glGetError();
+ if(error != GL_NO_ERROR)
+ printf("[glError: %s] - %d\n", where, error);
+}
+
+void rasonly(Visual *d) {
+ /* do rasterising only (in local display d) */
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0.0f, (GLfloat) d->vp_w, 0.0f, (GLfloat) d->vp_h, 0.0f, 1.0f);
+ checkGLError("rasonly");
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glViewport(d->vp_x, d->vp_y, d->vp_w, d->vp_h);
+}
+
+
+void doPerspective(float fov, float ratio, float znear, float zfar) {
+ float top;
+ float left;
+
+ top = tanf( fov * PI / 360.0 ) * znear;
+ left = - top * ratio;
+ glFrustum(left, -left, -top, top, znear, zfar);
+}
+
+void doLookAt(float *cam, float *target, float *up) {
+ float m[16];
+ float x[3], y[3], z[3];
+
+ vsub(cam, target, z);
+ normalize(z);
+ crossprod(up, z, x);
+ crossprod(z, x, y);
+ normalize(x);
+ normalize(y);
+
+#define M(row,col) m[col*4+row]
+ M(0,0) = x[0]; M(0,1) = x[1]; M(0,2) = x[2]; M(0,3) = 0.0;
+ M(1,0) = y[0]; M(1,1) = y[1]; M(1,2) = y[2]; M(1,3) = 0.0;
+ M(2,0) = z[0]; M(2,1) = z[1]; M(2,2) = z[2]; M(2,3) = 0.0;
+ M(3,0) = 0.0; M(3,1) = 0.0; M(3,2) = 0.0; M(3,3) = 1.0;
+#undef M
+ glMultMatrixf( m );
+
+ /* Translate Eye to Origin */
+ glTranslatef( -cam[0], -cam[1], -cam[2]);
+}
+
+void drawText(FontTex* ftx, int x, int y, int size, const char *text) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_TEXTURE_2D);
+
+ glPushMatrix();
+
+ glTranslatef(x, y, 0);
+ glScalef(size, size, size);
+ ftxRenderString(ftx, text, strlen(text));
+
+ glPopMatrix();
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+ polycount += 2 * strlen(text); /* quads are two triangles */
+}
+
diff --git a/src/video/graphics_world.c b/src/video/graphics_world.c
new file mode 100644
index 0000000..d67fb0b
--- /dev/null
+++ b/src/video/graphics_world.c
@@ -0,0 +1,138 @@
+#include "video/video.h"
+#include "game/game.h"
+
+void drawWalls(void) {
+#undef WALL_H
+#define WALL_H 48
+ float t;
+ float h;
+
+ t = game2->rules.grid_size / 240.0f;
+ if (gSettingsCache.stretch_textures) {
+ h = t * WALL_H;
+ t = 1.0;
+ } else h = WALL_H;
+
+ glColor4f(1.0, 1.0, 1.0, 1.0);
+
+ /*
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ */
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_BLEND);
+#define T_TOP 1.0f
+ glBindTexture(GL_TEXTURE_2D, gScreen->textures[TEX_WALL1]);
+ glBegin(GL_QUADS);
+ glTexCoord2f(t, 0.0); glVertex3f(0.0, 0.0, 0.0);
+ glTexCoord2f(t, T_TOP); glVertex3f(0.0, 0.0, h);
+ glTexCoord2f(0.0, T_TOP); glVertex3f(game2->rules.grid_size, 0.0, h);
+ glTexCoord2f(0.0, 0.0); glVertex3f(game2->rules.grid_size, 0.0, 0.0);
+ glEnd();
+
+ glBindTexture(GL_TEXTURE_2D, gScreen->textures[TEX_WALL2]);
+ glBegin(GL_QUADS);
+ glTexCoord2f(t, 0.0); glVertex3f(game2->rules.grid_size, 0.0, 0.0);
+ glTexCoord2f(t, T_TOP); glVertex3f(game2->rules.grid_size, 0.0, h);
+ glTexCoord2f(0.0, T_TOP);
+ glVertex3f(game2->rules.grid_size, game2->rules.grid_size, h);
+ glTexCoord2f(0.0, 0.0);
+ glVertex3f(game2->rules.grid_size, game2->rules.grid_size, 0.0);
+ glEnd();
+
+ glBindTexture(GL_TEXTURE_2D, gScreen->textures[TEX_WALL3]);
+ glBegin (GL_QUADS);
+ glTexCoord2f(t, 0.0);
+ glVertex3f(game2->rules.grid_size, game2->rules.grid_size, 0.0);
+ glTexCoord2f(t, T_TOP);
+ glVertex3f(game2->rules.grid_size, game2->rules.grid_size, h);
+ glTexCoord2f(0.0, T_TOP); glVertex3f(0.0, game2->rules.grid_size, h);
+ glTexCoord2f(0.0, 0.0); glVertex3f(0.0, game2->rules.grid_size, 0.0);
+ glEnd();
+
+ glBindTexture(GL_TEXTURE_2D, gScreen->textures[TEX_WALL4]);
+ glBegin(GL_QUADS);
+ glTexCoord2f(t, 0.0); glVertex3f(0.0, game2->rules.grid_size, 0.0);
+ glTexCoord2f(t, T_TOP); glVertex3f(0.0, game2->rules.grid_size, h);
+ glTexCoord2f(0.0, T_TOP); glVertex3f(0.0, 0.0, h);
+ glTexCoord2f(0.0, 0.0); glVertex3f(0.0, 0.0, 0.0);
+#undef T_TOP
+ glEnd();
+ polycount += 8;
+
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_CULL_FACE);
+}
+
+/*!
+ * drawFloorTextured
+ *
+ * \return number of polygons drawn
+ *
+ * Draws the arena floor covered with a repeating floor texture
+ */
+
+int drawFloorTextured(int grid_size, GLuint texture) {
+ int i, j, l, t;
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, texture);
+
+ /* there are some strange clipping artefacts on some renderers */
+ /* try subdividing things... */
+
+ glColor4f(1.0, 1.0, 1.0, 1.0);
+ l = grid_size / 4;
+ t = l / 12;
+
+ // glBegin(GL_QUADS);
+ for (i = 0; i < grid_size; i += l) {
+ glBegin(GL_QUADS);
+ for (j = 0; j < grid_size; j += l) {
+ glTexCoord2i(0, 0);
+ glVertex2i(i, j);
+ glTexCoord2i(t, 0);
+ glVertex2i(i + l, j);
+ glTexCoord2i(t, t);
+ glVertex2i(i + l, j + l);
+ glTexCoord2i(0, t);
+ glVertex2i(i, j + l);
+ }
+ glEnd();
+ }
+ // glEnd();
+
+ glDisable(GL_TEXTURE_2D);
+ return grid_size * grid_size;
+}
+
+void drawFloorGrid(int grid_size, int line_spacing,
+ float line_color[4], float square_color[4]) {
+ int i, j;
+
+ glColor3fv(line_color);
+
+ glFogfv(GL_FOG_COLOR, square_color);
+ glFogi(GL_FOG_MODE, GL_LINEAR);
+ glFogi(GL_FOG_START, 100);
+ glFogi(GL_FOG_END, 350);
+
+ glEnable(GL_FOG);
+
+ glBegin(GL_LINES);
+ for (i = 0; i < grid_size; i += line_spacing) {
+ for (j = 0; j < grid_size; j += line_spacing) {
+ glVertex3i(i, j, 0);
+ glVertex3i(i + line_spacing, j, 0);
+ glVertex3i(i, j, 0);
+ glVertex3i(i, j + line_spacing, 0);
+ }
+ }
+ glEnd();
+
+ glDisable(GL_FOG);
+}
diff --git a/src/video/load_texture.c b/src/video/load_texture.c
new file mode 100644
index 0000000..8d02b67
--- /dev/null
+++ b/src/video/load_texture.c
@@ -0,0 +1,77 @@
+#include "video/video.h"
+#include "filesystem/path.h"
+
+#include "Nebu_scripting.h"
+
+void freeTextureData(texture *tex) {
+ free(tex->data);
+ free(tex);
+}
+
+texture* loadTextureData(const char *filename) {
+ texture *tex = NULL;
+ char *path;
+ char *artpack;
+
+ scripting_GetGlobal("settings", "current_artpack", NULL);
+ scripting_GetStringResult(&artpack);
+ path = getArtPath(artpack, filename);
+ free(artpack);
+ if(path != NULL) {
+ tex = LOAD_TEX(path);
+ free(path);
+ }
+
+ if(tex == NULL) {
+ fprintf(stderr, "fatal: failed load %s, exiting...\n", filename);
+ exit(1); /* OK: critical, installation corrupt */
+ }
+ return tex;
+}
+
+void loadTexture(const char *filename, int format) {
+ texture *tex;
+ GLint internal;
+ int maxSize;
+
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize);
+
+ tex = loadTextureData(filename);
+ if(tex->channels == 3) internal = GL_RGB;
+ else internal = GL_RGBA;
+ if(format == GL_DONT_CARE) {
+ if(tex->channels == 3) format = GL_RGB;
+ if(tex->channels == 4) format = GL_RGBA;
+ }
+ /* TODO: build mipmaps the proper way, box filters suck */
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ {
+ texture *newtex;
+ int level = 0;
+ while (tex->width > 1 || tex->height > 1) {
+ if(tex->width <= maxSize && tex->height <= maxSize) {
+ glTexImage2D(GL_TEXTURE_2D, level, format,
+ tex->width, tex->height,
+ 0, internal, GL_UNSIGNED_BYTE, tex->data);
+#ifdef PRINTF_VERBOSE
+ printf("uploading level %d, %dx%d texture\n",
+ level, tex->width, tex->height);
+#endif
+ level++;
+ }
+ newtex = mipmap_png_texture(tex, 1, 0, 0);
+ freeTextureData(tex);
+ tex = newtex;
+ }
+ /* upload 1x1 mip level */
+ glTexImage2D(GL_TEXTURE_2D, level, format,
+ tex->width, tex->height,
+ 0, internal, GL_UNSIGNED_BYTE, tex->data);
+#ifdef PRINTF_VERBOSE
+ printf("uploading level %d, %dx%d texture\n",
+ level, tex->width, tex->height);
+#endif
+ freeTextureData(tex);
+ }
+}
diff --git a/src/video/material.c b/src/video/material.c
new file mode 100644
index 0000000..b8874ed
--- /dev/null
+++ b/src/video/material.c
@@ -0,0 +1,155 @@
+#include "video/model.h"
+#include "filesystem/path.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "zlib.h"
+
+void loadDefaultMaterial(Material *pMaterial) {
+ float ambient[] = { 0.2f, 0.2f, 0.2f, 1.0 };
+ float diffuse[] = { 1.0, 1.0, 0.0, 1.0 };
+ float specular[] = { 1.0, 1.0, 1.0, 1.0 };
+ float shininess = 2;
+
+ memcpy( pMaterial->ambient, ambient, sizeof(ambient) );
+ memcpy( pMaterial->diffuse, diffuse, sizeof(diffuse) );
+ memcpy( pMaterial->specular, specular, sizeof(specular) );
+ pMaterial->shininess = shininess;
+ pMaterial->name = NULL;
+ pMaterial->map_diffuse = NULL;
+}
+
+void readMaterialLibraryFromFile(char *filename, Mesh *pMesh) {
+ Material *pMaterials;
+ int iMaterial;
+
+ char buf[BUF_SIZE];
+ char name[BUF_SIZE];
+ char *path;
+ gzFile f;
+
+ int i;
+
+ path = getPath(PATH_DATA, filename);
+ if(path == NULL) {
+ fprintf(stderr, "** could not optain path to file '%s'\n", filename);
+ return;
+ }
+
+ if((f = gzopen(path, "r")) == 0) {
+ fprintf(stderr, "** could not open file '%s'\n", filename);
+ free(path);
+ return;
+ }
+ free(path);
+
+ pMaterials = malloc( MAX_MATERIALS * sizeof( Material ) );
+ iMaterial = -1;
+
+ while( gzgets(f, buf, sizeof(buf)) ) {
+ switch(buf[0]) {
+ case '#': break;
+ case 'n':
+ iMaterial++;
+ loadDefaultMaterial(pMaterials + iMaterial);
+
+ sscanf(buf, "newmtl %s ", name);
+ pMaterials[iMaterial].name = malloc( strlen(name) + 1 );
+ strcpy( pMaterials[iMaterial].name, name );
+
+ break;
+ default:
+ if(sscanf(buf, " Ka %f %f %f ",
+ pMaterials[iMaterial].ambient + 0,
+ pMaterials[iMaterial].ambient + 1,
+ pMaterials[iMaterial].ambient + 2) == 3) {
+ // nothing
+ } else if(sscanf(buf, " Kd %f %f %f ",
+ pMaterials[iMaterial].diffuse + 0,
+ pMaterials[iMaterial].diffuse + 1,
+ pMaterials[iMaterial].diffuse + 2) == 3) {
+ // nothing
+ } else if(sscanf(buf, " Ks %f %f %f ",
+ pMaterials[iMaterial].specular + 0,
+ pMaterials[iMaterial].specular + 1,
+ pMaterials[iMaterial].specular + 2) == 3) {
+ // nothing
+ } else if(sscanf(buf, " Ns %f ",
+ & (pMaterials[iMaterial].shininess) ) == 1 ) {
+ // nothing
+ } else {
+ /* FIXME: "disabled error message" */
+ /* fprintf(stderr, "+++ unparsed material property: %s", buf); */
+ }
+ }
+ }
+
+ pMesh->nMaterials = iMaterial + 1;
+ pMesh->pMaterials = malloc( sizeof(Material) * pMesh->nMaterials );
+ for(i = 0; i < pMesh->nMaterials; i++) {
+ memcpy( pMesh->pMaterials + i, pMaterials + i, sizeof(Material) );
+ }
+
+ free(pMaterials);
+}
+
+void readMaterialLibrary(char *buf, Mesh *pMesh) {
+ char filename[BUF_SIZE];
+ if(sscanf(buf, " mtllib %s ", filename) != 1) {
+ fprintf(stderr, "*** failing parsing filename from %s\n", buf);
+ return;
+ }
+ readMaterialLibraryFromFile(filename, pMesh);
+}
+
+void setMaterial(char *buf, Mesh *pMesh, int *iGroup) {
+ char name[BUF_SIZE];
+ int i;
+
+ if(sscanf(buf, " usemtl %s ", name) == 1) {
+ // search through all materials for the current one
+ for(i = 0; i < pMesh->nMaterials; i++) {
+ if(strstr(pMesh->pMaterials[i].name, name) ==
+ pMesh->pMaterials[i].name) {
+ *iGroup = i;
+ return;
+ }
+ }
+ fprintf(stderr, "*** error: material %s not found\n", name);
+ } else {
+ fprintf(stderr, "*** error: can't parse material line %s\n", buf);
+ }
+}
+
+void SetMaterialColor(Mesh *pMesh, char *name, ColorType eType,
+ float pColor[4]) {
+ int i;
+
+ for(i = 0; i < pMesh->nMaterials; i++) {
+ if(name == NULL || strstr(pMesh->pMaterials[i].name, name) ==
+ pMesh->pMaterials[i].name) {
+ switch(eType) {
+ case eAmbient:
+ memcpy( pMesh->pMaterials[i].ambient, pColor, sizeof(float[4]) );
+ break;
+ case eDiffuse:
+ memcpy( pMesh->pMaterials[i].diffuse, pColor, sizeof(float[4]) );
+ break;
+ case eSpecular:
+ memcpy( pMesh->pMaterials[i].specular, pColor, sizeof(float[4]) );
+ break;
+ }
+ }
+ }
+}
+
+/*
+void copyMaterialColors(Material *pIn, Material *pOut) {
+ memcpy(pOut->ambient, pIn->ambient, sizeof( ambient ));
+ memcpy(pOut->diffuse, pIn->diffuse, sizeof( diffuse ));
+ memcpy(pOut->specular, pIn->specular, sizeof( specular ));
+ pOut->shininess = pIn->shininess;
+}
+*/
+
diff --git a/src/video/model.c b/src/video/model.c
new file mode 100644
index 0000000..675820e
--- /dev/null
+++ b/src/video/model.c
@@ -0,0 +1,391 @@
+// include a few datastructures & constants
+
+#include "video/model.h"
+#include "video/video.h"
+
+#include "math.h"
+#include "stdio.h"
+#include "stdlib.h"
+#include "zlib.h"
+
+extern void readMaterialLibrary(char *buf, Mesh *pMesh);
+extern void setMaterial(char *buf, Mesh *pMesh, int *iGroup);
+
+void readVector(char *buf, vec3 *pVertex ) {
+ if( sscanf(buf, " %f %f %f ",
+ pVertex->v, pVertex->v + 1, pVertex->v + 2) != 3) {
+ fprintf(stderr, "*** failed reading Vector from %s\n", buf);
+ }
+}
+
+void readTriFace(char *buf, face *pFace, int *iFace, int iGroup) {
+ // assumes model in "f %d//%d %d//%d %d//%d\n" format
+ if(
+ sscanf(buf, "f %d//%d %d//%d %d//%d ",
+ pFace[ *iFace ].vertex + 0, pFace[ *iFace ].normal + 0,
+ pFace[ *iFace ].vertex + 1, pFace[ *iFace ].normal + 1,
+ pFace[ *iFace ].vertex + 2, pFace[ *iFace ].normal + 2) == 6) {
+ pFace[ *iFace ].material = iGroup;
+ (*iFace)++;
+ } else {
+ fprintf(stderr, "*** failed parsing face %s\n", buf);
+ }
+}
+
+void readQuadFace(char *buf, quadFace *pFace, int *iFace, int iGroup) {
+// assumes model in "f %d//%d %d//%d %d//%d %d//%d\n" format
+ if(
+ sscanf(buf, "f %d//%d %d//%d %d//%d %d//%d",
+ pFace[ *iFace ].vertex + 0, pFace[ *iFace ].normal + 0,
+ pFace[ *iFace ].vertex + 1, pFace[ *iFace ].normal + 1,
+ pFace[ *iFace ].vertex + 2, pFace[ *iFace ].normal + 2,
+ pFace[ *iFace ].vertex + 3, pFace[ *iFace ].normal + 3) == 8) {
+ pFace[ *iFace ].material = iGroup;
+ (*iFace)++;
+ } else {
+ fprintf(stderr, "*** failed parsing face %s\n", buf);
+ }
+}
+
+Mesh* readMeshFromFile(const char *filename, MeshType iType) {
+ // allocate some buffers
+ // vertices, normals
+
+ vec3 *pVertices = malloc( sizeof(vec3) * MAX_VERTICES );
+ vec3 *pNormals = malloc( sizeof(vec3) * MAX_NORMALS );
+
+ quadFace *pqFaces = NULL;
+ face *pFaces = NULL;
+ int iFaceSize = 0;
+
+ Mesh *pMesh = malloc( sizeof(Mesh) );
+ int iGroup = 0;
+ int iVertex = 0, iNormal = 0, iFace = 0;
+
+ gzFile f;
+ char buf[BUF_SIZE];
+
+ int i, j, k;
+
+
+ switch(iType) {
+ case TRI_MESH:
+ pFaces = malloc( sizeof(face) * MAX_FACES );
+ iFaceSize = 3;
+ break;
+ case QUAD_MESH:
+ pqFaces = malloc( sizeof(quadFace) * MAX_FACES );
+ iFaceSize = 4;
+ break;
+ default:
+ fprintf(stderr, "[fatal]: illegal mesh type\n");
+ exit(1);
+ }
+
+ if((f = gzopen(filename, "r")) == 0) {
+ fprintf(stderr, "*** could not open file '%s'\n", filename);
+ return NULL;
+ }
+
+ while( gzgets(f, buf, sizeof(buf)) ) {
+ switch(buf[0]) {
+ case 'm': // material library
+ readMaterialLibrary(buf, pMesh);
+ break;
+ case 'u': // material name
+ setMaterial(buf, pMesh, &iGroup);
+ break;
+ case 'v': // vertex, normal, texture coordinate
+ switch(buf[1]) {
+ case ' ':
+ readVector(buf + 1, pVertices + iVertex);
+ iVertex++;
+ break;
+ case 'n': // normal
+ readVector(buf + 2, pNormals + iNormal);
+ iNormal++;
+ break;
+ case 't': // texture
+ break; // ignore textures;
+ }
+ break;
+ case 'f': // face (can produce multiple faces)
+ switch(iType) {
+ case TRI_MESH:
+ readTriFace(buf, pFaces, &iFace, iGroup);
+ break;
+ case QUAD_MESH:
+ readQuadFace(buf, pqFaces, &iFace, iGroup);
+ break;
+ }
+ break;
+ }
+ }
+
+ gzclose(f);
+
+ // printf("vertices: %d, normals: %d, faces: %d\n", iVertex, iNormal, iFace);
+
+ // count each material
+ pMesh->pnFaces = malloc( sizeof(int) * pMesh->nMaterials );
+ for(i = 0; i < pMesh->nMaterials; i++) {
+ pMesh->pnFaces[ i ] = 0;
+ }
+
+ switch(iType) {
+ case TRI_MESH:
+ for(i = 0; i < iFace; i++) {
+ pMesh->pnFaces[ pFaces[i].material ] += 1;
+ }
+ break;
+ case QUAD_MESH:
+ for(i = 0; i < iFace; i++) {
+ pMesh->pnFaces[ pqFaces[i].material ] += 1;
+ }
+ break;
+ }
+
+
+ // combine vectors & normals for each vertex, doubling where necessary
+
+ // initialize lookup[ vertex ][ normal ] table
+ {
+ int nVertices = 0;
+ int **lookup = malloc( sizeof(int*) * iVertex );
+
+ for(i = 0; i < iVertex; i++) {
+ lookup[i] = malloc( sizeof(int) * iNormal );
+ for(j = 0; j < iNormal; j++) {
+ lookup[i][j] = -1;
+ }
+ }
+
+ switch(iType) {
+ case TRI_MESH:
+ for(i = 0; i < iFace; i++) {
+ for(j = 0; j < iFaceSize; j++) {
+ int vertex = pFaces[i].vertex[j] - 1;
+ int normal = pFaces[i].normal[j] - 1;
+ if( lookup[ vertex ][ normal ] == -1 ) {
+ lookup[ vertex ][ normal ] = nVertices;
+ nVertices++;
+ }
+ }
+ }
+ break;
+ case QUAD_MESH:
+ for(i = 0; i < iFace; i++) {
+ for(j = 0; j < iFaceSize; j++) {
+ int vertex = pqFaces[i].vertex[j] - 1;
+ int normal = pqFaces[i].normal[j] - 1;
+ if( lookup[ vertex ][ normal ] == -1 ) {
+ lookup[ vertex ][ normal ] = nVertices;
+ nVertices++;
+ }
+ }
+ }
+ break;
+ }
+
+ // now that we know everything, build vertexarray based mesh
+ // copy normals & vertices indexed by lookup-table
+ pMesh->nVertices = nVertices;
+ pMesh->pVertices = malloc( sizeof(GLfloat) * 3 * nVertices );
+ pMesh->pNormals = malloc( sizeof(GLfloat) * 3 * nVertices );
+ for(i = 0; i < iVertex; i++) {
+ for(j = 0; j < iNormal; j++) {
+ int vertex = lookup[ i ][ j ];
+ if(vertex != -1 ) {
+ for(k = 0; k < 3; k++) {
+ *(pMesh->pVertices + 3 * vertex + k) = pVertices[ i ].v[k];
+ *(pMesh->pNormals + 3 * vertex + k) = pNormals[ j ].v[k];
+ }
+ }
+ }
+ }
+
+ // build indices (per Material)
+ {
+ int *face;
+ face = malloc( sizeof(int) * pMesh->nMaterials );
+ pMesh->ppIndices = malloc( sizeof(GLshort*) * pMesh->nMaterials );
+ for(i = 0; i < pMesh->nMaterials; i++) {
+ pMesh->ppIndices[i] =
+ malloc( sizeof(GLshort) * iFaceSize * pMesh->pnFaces[i] );
+ face[i] = 0;
+ }
+ switch(iType) {
+ case TRI_MESH:
+ for(i = 0; i < iFace; i++) {
+ int material = pFaces[i].material;
+ for(j = 0; j < iFaceSize; j++) {
+ int vertex = pFaces[i].vertex[j] - 1;
+ int normal = pFaces[i].normal[j] - 1;
+ pMesh->ppIndices[ material ][ iFaceSize * face[ material ] + j ] =
+ lookup[ vertex ][ normal ];
+ }
+ face[ material ] = face[ material] + 1;
+ }
+ break;
+ case QUAD_MESH:
+ for(i = 0; i < iFace; i++) {
+ int material = pqFaces[i].material;
+ for(j = 0; j < iFaceSize; j++) {
+ int vertex = pqFaces[i].vertex[j] - 1;
+ int normal = pqFaces[i].normal[j] - 1;
+ pMesh->ppIndices[ material ][ iFaceSize * face[ material ] + j ] =
+ lookup[ vertex ][ normal ];
+ }
+ face[ material ] = face[ material] + 1;
+ }
+ break;
+ }
+ free(face);
+ }
+ // printf("[scenegraph] vertices: %d, faces: %d\n", nVertices, iFace);
+
+ free(lookup);
+ free(pVertices);
+ free(pNormals);
+ switch(iType) {
+ case TRI_MESH:
+ free(pFaces);
+ break;
+ case QUAD_MESH:
+ free(pqFaces);
+ break;
+ }
+ }
+ computeBBox(pMesh);
+
+ return pMesh;
+}
+
+void drawModel(Mesh *pMesh, MeshType iType) {
+ int i;
+ int iFaceSize = 0;
+ GLenum primitive = GL_TRIANGLES;
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, pMesh->pVertices);
+ glNormalPointer(GL_FLOAT, 0, pMesh->pNormals);
+
+ switch(iType) {
+ case TRI_MESH:
+ primitive = GL_TRIANGLES;
+ iFaceSize = 3;
+ break;
+ case QUAD_MESH:
+ primitive = GL_QUADS;
+ iFaceSize = 4;
+ break;
+ default:
+ fprintf(stderr, "[fatal]: illegal mesh type\n");
+ exit(1);
+ }
+
+ for(i = 0; i < pMesh->nMaterials; i++) {
+ glMaterialfv(GL_FRONT, GL_AMBIENT,
+ pMesh->pMaterials[i].ambient);
+ glMaterialfv(GL_FRONT, GL_DIFFUSE,
+ pMesh->pMaterials[i].diffuse);
+ glMaterialfv(GL_FRONT, GL_SPECULAR,
+ pMesh->pMaterials[i].specular);
+ glMaterialf(GL_FRONT, GL_SHININESS,
+ pMesh->pMaterials[i].shininess);
+
+ glDrawElements(primitive, iFaceSize * pMesh->pnFaces[i],
+ GL_UNSIGNED_SHORT, pMesh->ppIndices[i]);
+
+ polycount += pMesh->pnFaces[i];
+ }
+
+}
+
+void drawModelExplosion(Mesh *pMesh, float fRadius) {
+ int i, j, k;
+#define EXP_VECTORS 10
+ float vectors[][3] = {
+ { 0.03f, -0.06f, -0.07f },
+ { 0.04f, 0.08f, -0.03f },
+ { 0.10f, -0.04f, -0.07f },
+ { 0.06f, -0.09f, -0.10f },
+ { -0.03f, -0.05f, 0.02f },
+ { 0.07f, 0.08f, -0.00f },
+ { 0.01f, -0.04f, 0.10f },
+ { -0.01f, -0.07f, 0.09f },
+ { 0.01f, -0.01f, -0.09f },
+ { -0.04f, 0.04f, 0.02f }
+ };
+
+ for(i = 0; i < pMesh->nMaterials; i++) {
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT,
+ pMesh->pMaterials[i].ambient);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE,
+ pMesh->pMaterials[i].diffuse);
+ glMaterialfv(GL_FRONT, GL_SPECULAR,
+ pMesh->pMaterials[i].specular);
+ glMaterialf(GL_FRONT, GL_SHININESS,
+ pMesh->pMaterials[i].shininess);
+
+ for(j = 0; j < pMesh->pnFaces[i]; j++) {
+
+ float *normal, *vertex;
+
+ normal = pMesh->pNormals + 3 * pMesh->ppIndices[i][3 * j];
+
+ glPushMatrix();
+ glTranslatef(fRadius * (*(normal + 0) + vectors[j % EXP_VECTORS][0]),
+ fRadius * (*(normal + 1) + vectors[j % EXP_VECTORS][1]),
+ fabsf(fRadius * (*(normal + 2) + vectors[j % EXP_VECTORS][2]) ));
+ glBegin(GL_TRIANGLES);
+ for(k = 0; k < 3; k++) {
+ normal = pMesh->pNormals + 3 * pMesh->ppIndices[i][3 * j + k];
+ vertex = pMesh->pVertices + 3 * pMesh->ppIndices[i][3 * j + k];
+
+ glNormal3fv(normal);
+ glVertex3fv(vertex);
+ }
+ glEnd();
+ glPopMatrix();
+ }
+ polycount += pMesh->pnFaces[i];
+ }
+}
+
+void computeBBox(Mesh *pMesh) {
+ int i, j;
+ vec3 vMin, vMax, vSize;
+
+ vcopy(pMesh->pVertices, vMin.v);
+ vcopy(pMesh->pVertices, vMax.v);
+
+ for(i = 0; i < pMesh->nVertices; i++) {
+ for(j = 0; j < 3; j++) {
+ if(vMin.v[j] > pMesh->pVertices[3 * i + j])
+ vMin.v[j] = pMesh->pVertices[3 * i + j];
+ if(vMax.v[j] < pMesh->pVertices[3 * i + j])
+ vMax.v[j] = pMesh->pVertices[3 * i + j];
+ }
+ /*
+ if(
+ vMin.v[0] <= pMesh->pVertices[3 * i + 0] &&
+ vMin.v[1] <= pMesh->pVertices[3 * i + 1] &&
+ vMin.v[2] <= pMesh->pVertices[3 * i + 2]
+ )
+ vcopy(pMesh->pVertices + 3 * i, vMin.v);
+ if(
+ vMax.v[0] >= pMesh->pVertices[3 * i + 0] &&
+ vMax.v[1] >= pMesh->pVertices[3 * i + 1] &&
+ vMax.v[2] >= pMesh->pVertices[3 * i + 2]
+ )
+ vcopy(pMesh->pVertices + 3 * i, vMax.v);
+ */
+ }
+
+ vsub(vMax.v, vMin.v, vSize.v);
+ vcopy(vMin.v, pMesh->BBox.vMin.v);
+ vcopy(vSize.v, pMesh->BBox.vSize.v);
+ pMesh->BBox.fRadius=length(pMesh->BBox.vSize.v)/10;
+}
diff --git a/src/video/recognizer.c b/src/video/recognizer.c
new file mode 100644
index 0000000..0a26313
--- /dev/null
+++ b/src/video/recognizer.c
@@ -0,0 +1,145 @@
+#include "video/video.h"
+#include <math.h>
+
+static float alpha = 0;
+
+const static float rec_scale_factor = 0.25f;
+
+static float xv[] = { 0.5f, 0.3245f, 0.6f, 0.5f, 0.68f, -0.3f };
+static float yv[] = { 0.8f, 1.0f, 0.0f, 0.2f, 0.2f, 0.0f };
+
+static float x(void) { return xv[0] * sinf(xv[1] * alpha + xv[2]) - xv[3] * sinf(xv[4] * alpha + xv[5]); }
+static float y(void) { return yv[0] * cosf(yv[1] * alpha + yv[2]) - yv[3] * sinf(yv[4] * alpha + yv[5]); }
+
+static float dx(void) { return xv[1] * xv[0] * cosf(xv[1] * alpha + xv[2]) - xv[4] * xv[3] * cosf(xv[4] * alpha + xv[5]); }
+static float dy(void) { return - yv[1] * yv[0] * sinf(yv[1] * alpha + yv[2]) - yv[4] * yv[3] * sinf(yv[4] * alpha + yv[5]); }
+
+float getRecognizerAngle(vec2 *velocity)
+{
+ float dxval = velocity->v[0];
+ float dyval = velocity->v[0];
+
+ float phi = acosf ( dxval / sqrtf( dxval * dxval + dyval * dyval ) );
+ if (dyval < 0) {
+ phi = 2 * PI - phi;
+ }
+ return (phi + PI / 2) * 180 / PI;
+}
+
+void getRecognizerPositionVelocity(vec2 *p, vec2 *v) {
+ float max = recognizer->BBox.vSize.v[0] * rec_scale_factor;
+ float rec_boundry = game2->rules.grid_size - max;
+ p->v[0] = (max + (x() + 1.0f) * rec_boundry) / 2.0f;
+ p->v[1] = (max + (y() + 1.0f) * rec_boundry) / 2.0f;
+ v->v[0] = dx() * game2->rules.grid_size / 100.f;
+ v->v[1] = dy() * game2->rules.grid_size / 100.f;
+}
+
+void drawRecognizerShadow(void) {
+ float dirx;
+ vec2 p, v;
+ /* states */
+
+ glEnable(GL_CULL_FACE);
+ if(gSettingsCache.use_stencil) {
+ glEnable(GL_STENCIL_TEST);
+ glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ glStencilFunc(GL_GREATER, 1, 1);
+ glEnable(GL_BLEND);
+ glColor4fv(shadow_color);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ } else {
+ glColor3f(0, 0, 0);
+ glDisable(GL_BLEND);
+ }
+
+ /* transformations */
+ getRecognizerPositionVelocity(&p, &v);
+ dirx = getRecognizerAngle(&v);
+
+ glPushMatrix();
+ glMultMatrixf(shadow_matrix);
+ glTranslatef( p.v[0], p.v[1], RECOGNIZER_HEIGHT);
+ glRotatef(dirx, 0, 0, 1); /* up */
+ glScalef(rec_scale_factor, rec_scale_factor, rec_scale_factor);
+ glEnable(GL_NORMALIZE);
+
+ /* render */
+
+ drawModel(recognizer, TRI_MESH);
+
+ /* restore */
+
+ if(gSettingsCache.use_stencil)
+ glDisable(GL_STENCIL_TEST);
+
+ glDisable(GL_BLEND);
+ glDisable(GL_CULL_FACE);
+ glPopMatrix();
+}
+
+void drawRecognizer(void) {
+ float dirx;
+ vec2 p, v;
+
+ glPushMatrix();
+
+ /* transformations */
+ getRecognizerPositionVelocity(&p, &v);
+ dirx = getRecognizerAngle(&v);
+
+ glTranslatef( p.v[0], p.v[1], RECOGNIZER_HEIGHT);
+ glRotatef(dirx, 0, 0, 1); /* up */
+
+ glScalef(rec_scale_factor, rec_scale_factor, rec_scale_factor);
+
+ glDisable(GL_LIGHT0);
+ glDisable(GL_LIGHT1);
+ glLightfv(GL_LIGHT2, GL_SPECULAR, rec_spec_color);
+ glEnable(GL_LIGHT2);
+
+ glDisable(GL_BLEND);
+
+ glEnable(GL_CULL_FACE);
+
+ if (gSettingsCache.light_cycles) {
+ glEnable(GL_LIGHTING);
+ }
+
+ glEnable(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(1,1);
+
+ glEnable(GL_NORMALIZE);
+ glColor3f(0.0, 0.0, 0.0);
+ drawModel(recognizer, TRI_MESH);
+
+ glDisable(GL_POLYGON_OFFSET_FILL);
+
+ glDisable(GL_LIGHT2);
+ glEnable(GL_LIGHT1);
+ glDisable(GL_LIGHTING);
+
+ glColor3fv(rec_outline_color);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ glEnable(GL_BLEND);
+ glEnable(GL_LINE_SMOOTH);
+ drawModel(recognizer_quad, QUAD_MESH);
+ glDisable(GL_LINE_SMOOTH);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
+ glDisable(GL_CULL_FACE);
+
+ glPopMatrix();
+}
+
+void doRecognizerMovement(void) {
+ alpha += game2->time.dt / 2000.0f;
+}
+
+void resetRecognizer(void) {
+ alpha = 0;
+}
+
+
+
+
diff --git a/src/video/screenshot.c b/src/video/screenshot.c
new file mode 100644
index 0000000..7dbff38
--- /dev/null
+++ b/src/video/screenshot.c
@@ -0,0 +1,158 @@
+#include "video/video.h"
+#include "filesystem/path.h"
+#include "Nebu_filesystem.h"
+
+#include <png.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef PATH_MAX
+#define PATH_MAX 255
+#endif
+
+#define SCREENSHOT_PREFIX "gltron"
+#define SCREENSHOT_PNG_BITDEPTH 8
+#define SCREENSHOT_BYTES_PER_PIXEL 3
+
+typedef struct {
+ int width;
+ int height;
+ unsigned char *pixmap;
+} screenshot_info_t;
+
+static FILE *fp;
+
+static void user_write_data(png_structp png_ptr,
+ png_bytep data, png_size_t length) {
+ fwrite(data, length, 1, fp);
+}
+
+static void user_flush_data(png_structp png_ptr) {
+ fflush(fp);
+}
+
+static int writePixmapToPng(screenshot_info_t *screenshot, char *fname) {
+ png_structp png_ptr;
+ png_infop info_ptr;
+ png_byte **row_ptrs;
+ int i;
+
+ if (!(fp = fopen(fname, "wb"))) {
+ fprintf(stderr, "can't open %s for writing\n", fname);
+ return -1;
+ }
+
+ if (!(png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
+ NULL, NULL, NULL))) {
+ return -1;
+ }
+
+ if (!(info_ptr = png_create_info_struct(png_ptr))) {
+ png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
+ return -1;
+ }
+
+ png_set_write_fn(png_ptr, 0, user_write_data, user_flush_data);
+ /* png_init_io(png_ptr, fp); */
+
+ png_set_IHDR(png_ptr, info_ptr, screenshot->width, screenshot->height,
+ SCREENSHOT_PNG_BITDEPTH, PNG_COLOR_TYPE_RGB,
+ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
+ PNG_FILTER_TYPE_DEFAULT);
+ png_write_info(png_ptr, info_ptr);
+
+ /* get pointers */
+ if(!(row_ptrs = (png_byte**) malloc(screenshot->height * sizeof(png_byte*)))) {
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+ return -1;
+ }
+
+ for(i = 0; i < screenshot->height; i++) {
+ row_ptrs[i] = screenshot->pixmap + (screenshot->height - i - 1)
+ * SCREENSHOT_BYTES_PER_PIXEL * screenshot->width;
+ }
+
+ png_write_image(png_ptr, row_ptrs);
+ png_write_end(png_ptr, info_ptr);
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+
+ free(row_ptrs);
+ return 0;
+}
+
+/*
+ getNextFilename - find the next free filename in series.
+ */
+static char* getNextFilename(const char *suffix, int *start_at) {
+ char *path = NULL;
+ char fname[PATH_MAX];
+ do {
+ if(path != NULL)
+ free(path);
+
+ (*start_at)++;
+ sprintf(fname, "%s-%s-%d%s", SCREENSHOT_PREFIX, VERSION, *start_at,
+ suffix);
+ path = getPossiblePath( PATH_SNAPSHOTS, fname );
+ } while ( fileExists(path));
+
+ return path;
+}
+
+static int captureScreenToPixmap(screenshot_info_t *img, Visual *display) {
+ img->width = display->w;
+ img->height = display->h;
+ if (!(img->pixmap = malloc(img->width *
+ img->height * SCREENSHOT_BYTES_PER_PIXEL))) {
+ return -1;
+ }
+ glReadPixels(0, 0, img->width, img->height, GL_RGB, GL_UNSIGNED_BYTE,
+ img->pixmap);
+ return 0;
+}
+
+void doPngScreenShot(Visual *display) {
+ screenshot_info_t screenshot;
+ static int last_png_num; /* store last free file index. */
+ char *path;
+ path = getNextFilename(".png", &last_png_num);
+ if(path != NULL) {
+ if (captureScreenToPixmap(&screenshot, display) != 0) {
+ fprintf(stderr, "Error capturing screenshot\n");
+ return;
+ }
+
+ if (writePixmapToPng(&screenshot, path) != 0) {
+ fprintf(stderr, "Error writing screenshot %s\n", path);
+ } else {
+ fprintf(stderr, "Screenshot written to %s\n", path);
+ }
+ free(screenshot.pixmap);
+ free(path);
+ }
+}
+
+void doBmpScreenShot(Visual *display) {
+ screenshot_info_t screenshot;
+ static int last_bmp_num; /* store last free file index. */
+ char *path;
+ path = getNextFilename(".bmp", &last_bmp_num);
+ if(path != NULL) {
+ if (captureScreenToPixmap(&screenshot, display) != 0) {
+ fprintf(stderr, "Error capturing screenshot\n");
+ return;
+ }
+
+ if (SystemWriteBMP(path, screenshot.width, screenshot.height,
+ screenshot.pixmap) != 0) {
+ fprintf(stderr, "Error writing screenshot %s\n", path);
+ } else {
+ fprintf(stderr, "Screenshot written to %s\n", path);
+ }
+
+ free(screenshot.pixmap);
+ free(path);
+ }
+}
+
diff --git a/src/video/skybox.c b/src/video/skybox.c
new file mode 100644
index 0000000..ee01f38
--- /dev/null
+++ b/src/video/skybox.c
@@ -0,0 +1,62 @@
+#include "video/video.h"
+
+void enableSkyboxTexture(void) {
+ glEnable(GL_TEXTURE_2D);
+}
+
+void disableSkyboxTexture(void) {
+ glDisable(GL_TEXTURE_2D);
+}
+
+static void bindSkyboxTexture(int index) {
+ glBindTexture(GL_TEXTURE_2D, gScreen->textures[ TEX_SKYBOX + index ]);
+}
+
+void drawSkybox(int grid_size) {
+ /*
+ matrices are:
+ projection: perspective projection
+ modelview: identity
+ */
+
+ /* these are the values for y == up, x == front */
+ /*
+ float sides[6][4][3] = {
+ { { 1, -1, -1 }, { 1, -1, 1 }, { 1, 1, 1 }, { 1, 1, -1 } }, // front
+ { { 1, 1, -1 }, { 1, 1, 1 }, { -1, 1, 1 }, { -1, 1, -1 } }, // top
+ { { -1, -1, -1 }, { 1, -1, -1 }, { 1, 1, -1 }, { -1, 1, -1 } }, // left
+ { { 1, -1, 1 }, { -1, -1, 1 }, { -1, 1, 1 }, { 1, 1, 1 } }, // right
+ { { -1, -1, -1 }, { 1, -1, -1 }, { 1, -1, 1 }, { -1, -1, 1 } }, // bottom
+ { { -1, -1, 1 }, { -1, -1, -1 }, { -1, 1, -1 }, { -1, 1, a1 } } // back
+ };
+ */
+
+ /* these values are for z == up, x == front */
+ float sides[6][4][3] = {
+ { { 1, 1, -1 }, { 1, -1, -1 }, { 1, -1, 1 }, { 1, 1, 1 } }, /* front */
+ { { 1, 1, 1 }, { -1, 1, 1 }, { -1, -1, 1 }, { 1, -1, 1 } }, /* top */
+ { { -1, 1, -1 }, { 1, 1, -1 }, { 1, 1, 1 }, { -1, 1, 1 } }, /* left */
+ { { 1, -1, -1 }, { -1, -1, -1 }, { -1, -1, 1 }, { 1, -1, 1 } }, /* right */
+ { { -1, 1, -1 }, { -1, -1, -1 }, { 1, -1, -1 }, { 1, 1, -1 } }, /* bottom */
+ { { -1, -1, -1 }, { -1, 1, -1 }, { -1, 1, 1 }, { -1, -1, 1 } } /* back */
+ };
+
+ float uv[4][2] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } };
+ int i, j;
+ float d = grid_size * 3;
+
+ glEnable(GL_TEXTURE_2D);
+ glDepthMask(GL_FALSE);
+ glColor3f(1.0, 1.0, 1.0);
+ for(i = 0; i < 6; i++) {
+ bindSkyboxTexture(i);
+ glBegin(GL_QUADS);
+ for(j = 0; j < 4; j++) {
+ glTexCoord2fv( uv[j] );
+ glVertex3f( sides[i][j][0] * d, sides[i][j][1] * d, sides[i][j][2] * d );
+ }
+ glEnd();
+ }
+ glDisable(GL_TEXTURE_2D);
+ glDepthMask(GL_TRUE);
+}
diff --git a/src/video/texture.c b/src/video/texture.c
new file mode 100644
index 0000000..76903ca
--- /dev/null
+++ b/src/video/texture.c
@@ -0,0 +1,77 @@
+#include "video/video.h"
+
+void initTexture(Visual *d) {
+ GLint min_filter;
+ char texname[120];
+
+ int i, j;
+
+ switch(getSettingi("mipmap_filter")) {
+ case NEAREST:
+ min_filter = GL_NEAREST;
+ break;
+ case LINEAR:
+ min_filter = GL_LINEAR;
+ break;
+ case MIPMAP:
+ min_filter = GL_LINEAR_MIPMAP_NEAREST;
+ break;
+ case TRILINEAR:
+ min_filter = GL_LINEAR_MIPMAP_LINEAR;
+ break;
+ default:
+ min_filter = GL_LINEAR_MIPMAP_LINEAR;
+ }
+ printf("using min_filter: %d (setting: %d)\n", min_filter,
+ getSettingi("mipmap_filter"));
+
+ checkGLError("texture.c initTexture - start");
+ /* todo: move that somewhere else */
+ glGenTextures(game_textures, d->textures);
+ checkGLError("texture.c initTexture - creating textures");
+ for(i = 0; i < n_textures; i++) {
+ for( j = 0; j < textures[i].count; j++) {
+ glBindTexture(GL_TEXTURE_2D, d->textures[ textures[i].id + j ]);
+ /* todo: snprintf would be safer, but win32 doesn't have it */
+ if(textures[i].count == 1) {
+ sprintf(texname, "%s%s", textures[i].name, TEX_SUFFIX);
+ } else {
+ sprintf(texname, "%s%d%s", textures[i].name, j, TEX_SUFFIX);
+ }
+ loadTexture(texname, textures[i].type);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textures[i].wrap_s);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textures[i].wrap_t);
+
+ if(getSettingi("softwareRendering")) {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ } else {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
+
+#ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#endif
+
+#if 0
+ if(renderer.ext_filter_anisotropic) {
+ /* fprintf(stderr, "enabling anisotropic filtering\n"); */
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
+ textures[i].anisotropy);
+ }
+#endif
+ }
+ checkGLError("texture.c initTextures");
+ }
+ }
+}
+
+void deleteTextures(Visual *d) {
+ glDeleteTextures(game_textures, d->textures);
+ checkGLError("texture.c deleted textures");
+}
+
+
+
+
diff --git a/src/video/trail.c b/src/video/trail.c
new file mode 100644
index 0000000..f1b276d
--- /dev/null
+++ b/src/video/trail.c
@@ -0,0 +1,224 @@
+#include "video/video.h"
+#include "game/game.h"
+
+#define TEX_SPLIT (1.0 - BOW_DIST2) / (1 - BOW_DIST1)
+#undef TEX_SPLIT
+
+static float normal1[] = { 1.0, 0.0, 0.0 };
+static float normal2[] = { 0.0, 1.0, 0.0 };
+
+/*
+ getDists returns the minimum distance from (the wall) *line to the
+ specified (eye) point
+ the z component is ignored
+ */
+float getDist(segment2 *s, float* eye) {
+ float n[2];
+ float tmp[2];
+ n[0] = s->vStart.v[0] + s->vDirection.v[1];
+ n[1] = s->vStart.v[1] - s->vDirection.v[0];
+ tmp[0] = eye[0] - s->vStart.v[0];
+ tmp[1] = eye[1] - s->vStart.v[1];
+ if(n[0] == n[1] == 0) return length(tmp);
+ return abs(scalarprod2(n, tmp) / length(n));
+}
+
+/*
+ getSegmentEnd[XY]() returns the end point of the
+ last trail segment line (before the lightcycles bow starts)
+*/
+
+float dists[] = { BOW_DIST2, BOW_DIST3, BOW_DIST1, 0 };
+
+float getSegmentEndX(Data *data, int dist) {
+ float tlength, blength;
+ segment2 *s = data->trails + data->trailOffset;
+
+ if(dirsX[data->dir] == 0)
+ return s->vStart.v[0] + s->vDirection.v[0];
+
+ tlength = segment2_Length(s);
+ blength = (tlength < 2 * BOW_LENGTH) ? tlength / 2 : BOW_LENGTH;
+ return
+ s->vStart.v[0] + s->vDirection.v[0] -
+ dists[dist] * blength * dirsX[ data->dir ];
+}
+
+float getSegmentEndY(Data *data, int dist) {
+ float tlength, blength;
+ segment2 *s = data->trails + data->trailOffset;
+
+ if(dirsY[data->dir] == 0)
+ return s->vStart.v[1] + s->vDirection.v[1];
+
+ tlength = segment2_Length(s);
+ blength = (tlength < 2 * BOW_LENGTH) ? tlength / 2 : BOW_LENGTH;
+ return
+ s->vStart.v[1] + s->vDirection.v[1] -
+ dists[dist] * blength * dirsY[ data->dir ];
+}
+
+/* getSegmentEndUV() calculates the texture coordinates for the last segment */
+float getSegmentEndUV(segment2 *s, Data *data) {
+ float tlength, blength;
+ tlength = segment2_Length(s);
+ blength = (tlength < 2 * BOW_LENGTH) ? tlength / 2 : BOW_LENGTH;
+ return (tlength - 2 * blength) / DECAL_WIDTH;
+}
+
+/* getSegmentUV gets UV coordinates for an ordinary segment */
+float getSegmentUV(segment2 *s) {
+ return segment2_Length(s) / DECAL_WIDTH;
+}
+
+/*
+ drawTrailLines() draws a white line on top of each trail segment
+ the alpha value is reduced with increasing distance to the player
+*/
+
+void drawTrailLines(Player *p, PlayerVisual *pV) {
+ segment2 *s;
+ float height;
+
+ float *normal;
+ float dist;
+ float alpha;
+ Data *data;
+ Camera *cam;
+
+ float trail_top[] = { 1.0, 1.0, 1.0, 1.0 };
+
+ data = p->data;
+ cam = p->camera;
+
+ height = data->trail_height;
+ if(height <= 0) return;
+
+ /*
+ glDepthMask(GL_FALSE);
+ glDisable(GL_DEPTH_TEST);
+ */
+
+ if (gSettingsCache.antialias_lines) {
+ glEnable(GL_LINE_SMOOTH); /* enable line antialiasing */
+ }
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glDisable(GL_LIGHTING);
+
+ glBegin(GL_LINES);
+
+ s = data->trails;
+ while(s != data->trails + data->trailOffset) {
+ /* the current line is not drawn */
+ /* compute distance from line to eye point */
+ dist = getDist(s, cam->cam);
+ alpha = (game2->rules.grid_size - dist / 2) / game2->rules.grid_size;
+ // trail_top[3] = alpha;
+ glColor4fv(trail_top);
+
+ if(s->vDirection.v[1] == 0) normal = normal1;
+ else normal = normal2;
+ glNormal3fv(normal);
+ glVertex3f(s->vStart.v[0],
+ s->vStart.v[1],
+ height);
+ glVertex3f(s->vStart.v[0] + s->vDirection.v[0],
+ s->vStart.v[1] + s->vDirection.v[1],
+ height);
+ s++;
+ polycount++;
+ }
+ glEnd();
+
+ /* compute distance from line to eye point */
+ dist = getDist(s, cam->cam);
+ alpha = (game2->rules.grid_size - dist / 2) / game2->rules.grid_size;
+ // trail_top[3] = alpha;
+ glColor4fv(trail_top);
+
+ glBegin(GL_LINES);
+
+ glVertex3f(s->vStart.v[0],
+ s->vStart.v[1],
+ height);
+ glVertex3f( getSegmentEndX(data, 0),
+ getSegmentEndY(data, 0),
+ height );
+
+ glEnd();
+
+ /* glEnable(GL_LIGHTING); */
+ glDisable(GL_BLEND);
+ glDisable(GL_LINE_SMOOTH); /* disable line antialiasing */
+
+ /*
+ glEnable(GL_DEPTH_TEST);
+ glDepthMask(GL_TRUE);
+ */
+}
+
+/*
+ drawTrailShadow() draws a alpha-blended shadow on the floor for each
+ trail segment.
+ The light source source is (in homogenous coordinates)
+ at (-1,-1,1,0) (I hope that's correct)
+*/
+
+void drawTrailShadow(Player* p, PlayerVisual *pV) {
+ /* states */
+
+ if(gSettingsCache.use_stencil) {
+ glEnable(GL_STENCIL_TEST);
+ glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ glStencilFunc(GL_GREATER, 1, 1);
+ glEnable(GL_BLEND);
+ glColor4fv(shadow_color);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ } else {
+ glColor3f(0, 0, 0);
+ glDisable(GL_BLEND);
+ }
+
+ /* transformation */
+
+ glPushMatrix();
+ glMultMatrixf(shadow_matrix);
+
+ /* geometry */
+ {
+ int vOffset = 0;
+ int iOffset = 0;
+
+ TrailMesh mesh;
+ mesh.pVertices = (vec3*) malloc(1000 * sizeof(vec3));
+ mesh.pNormals = (vec3*) malloc(1000 * sizeof(vec3));
+ mesh.pColors = (unsigned char*) malloc(1000 * 4 * sizeof(float));
+ mesh.pTexCoords = (vec2*) malloc(1000 * sizeof(vec2));
+ mesh.pIndices = (unsigned short*) malloc(1000 * 2);
+ mesh.iUsed = 0;
+
+ trailGeometry(p, pV, &mesh, &vOffset, &iOffset);
+ bowGeometry(p, pV, &mesh, &vOffset, &iOffset);
+ trailStatesShadowed();
+ trailRender(&mesh);
+ // no states restore, because we're drawing shadowed geometry
+
+ free(mesh.pVertices);
+ free(mesh.pNormals);
+ free(mesh.pColors);
+ free(mesh.pTexCoords);
+ free(mesh.pIndices);
+ }
+
+ /* restore */
+
+ if(gSettingsCache.use_stencil)
+ glDisable(GL_STENCIL_TEST);
+
+ glDisable(GL_BLEND);
+
+ glPopMatrix();
+}
+
diff --git a/src/video/trail_geometry.c b/src/video/trail_geometry.c
new file mode 100644
index 0000000..c045822
--- /dev/null
+++ b/src/video/trail_geometry.c
@@ -0,0 +1,235 @@
+#include "video/trail_geometry.h"
+
+#include <math.h>
+
+enum {
+ COLOR_TRAIL, COLOR_BRIGHT, COLOR_CYCLE
+};
+
+int cmpdir(segment2 *line1, segment2 *line2);
+
+void float2ubyte(unsigned char* pubColor, float *pfColor) {
+ pubColor[0] = (unsigned char)(pfColor[0] * 255.0f);
+ pubColor[1] = (unsigned char)(pfColor[1] * 255.0f);
+ pubColor[2] = (unsigned char)(pfColor[2] * 255.0f);
+ pubColor[3] = (unsigned char)(pfColor[3] * 255.0f);
+}
+
+void storeColor(TrailMesh *pMesh, int offset, PlayerVisual *pV, int type) {
+ float color[] = { 0, 0, 0, 1 };
+ float white[] = { 1, 1, 1, 1 };
+
+ switch(type) {
+ case COLOR_TRAIL:
+ if(gSettingsCache.alpha_trails)
+ memcpy(color, pV->pColorAlpha, 4 * sizeof(float));
+ else
+ memcpy(color, pV->pColorAlpha, 3 * sizeof(float));
+ break;
+ case COLOR_BRIGHT:
+ memcpy(color, white, 3 * sizeof(float));
+ break;
+ case COLOR_CYCLE:
+ memcpy(color, pV->pColorDiffuse, 3 * sizeof(float));
+ break;
+ }
+ float2ubyte(pMesh->pColors + 4 * offset, color);
+ float2ubyte(pMesh->pColors + 4 * (offset + 1), color);
+}
+
+void storeVertex(TrailMesh *pMesh, int offset,
+ segment2 *s, float t, /* 0: start, 1: end */
+ float fFloor, float fTop,
+ float fSegLength, float fTotalLength) {
+ vec3 *pVertices = pMesh->pVertices + offset;
+ vec3 *pNormals = pMesh->pNormals + offset;
+ vec2 *pTexCoords = pMesh->pTexCoords + offset;
+ vec3 v;
+ vec2 uv;
+ float fUStart;
+ vec3 pvNormals[] = {
+ { { 1, 0, 0 } },
+ { { -1, 0, 0 } },
+ { { 0, 1, 0 } },
+ { { 0, -1, 0 } }
+ };
+
+
+ int iNormal;
+ if(s->vDirection.v[0] == 0)
+ // iNormal = (line->sx <= line->ex) ? 0 : 1;
+ iNormal = 0;
+ else
+ // iNormal = (line->sy <= line->sy) ? 2 : 3;
+ iNormal = 2;
+
+ fUStart = (fTotalLength / DECAL_WIDTH) - floorf(fTotalLength / DECAL_WIDTH);
+
+ v.v[0] = s->vStart.v[0] + t * s->vDirection.v[0];
+ v.v[1] = s->vStart.v[1] + t * s->vDirection.v[1];
+ v.v[2] = fFloor;
+ uv.v[0] = fUStart + t * fSegLength / DECAL_WIDTH;
+
+ uv.v[1] = 0;
+ vec3Copy(pVertices, &v);
+ vec3Copy(pNormals, pvNormals + iNormal);
+ vec2Copy(pTexCoords, &uv);
+
+ v.v[2] = fTop;
+ uv.v[1] = 1;
+ vec3Copy(pVertices + 1, &v);
+ vec3Copy(pNormals + 1, pvNormals + iNormal);
+ vec2Copy(pTexCoords + 1, &uv);
+}
+
+void storeIndices(TrailMesh *pMesh, int indexOffset, int vertexOffset) {
+ unsigned short ppBase[2][6] = {
+ { 0, 2, 1, 2, 3, 1 },
+ { 0, 1, 2, 1, 3, 2 }
+ };
+ int i;
+ int winding;
+
+ if(pMesh->pVertices[vertexOffset].v[0] ==
+ pMesh->pVertices[vertexOffset + 2].v[0])
+ winding = (pMesh->pVertices[vertexOffset].v[1] <=
+ pMesh->pVertices[vertexOffset + 2].v[1]) ? 0 : 1;
+ else
+ winding = (pMesh->pVertices[vertexOffset].v[0] <
+ pMesh->pVertices[vertexOffset + 2].v[0]) ? 1 : 0;
+
+ for(i = 0; i < 6; i++) {
+ pMesh->pIndices[i + indexOffset] = ppBase[winding][i] + vertexOffset;
+ }
+}
+
+int cmpdir(segment2 *s1, segment2 *s2) {
+ if((s1->vDirection.v[0] == 0 && s2->vDirection.v[0] == 0) ||
+ (s1->vDirection.v[1] == 0 && s2->vDirection.v[1] == 0))
+ return 0;
+ return 1;
+}
+
+void trailGeometry(Player *pPlayer, PlayerVisual* pV,
+ TrailMesh *pMesh,
+ int *pvOffset, int *piOffset) {
+ Data *pData = pPlayer->data;
+ int curVertex = *pvOffset, curIndex = *piOffset;
+ int i;
+ float fTotalLength = 0;
+ float fSegLength;
+ for(i = 0; i < pData->trailOffset; i++) {
+ fSegLength = segment2_Length(pData->trails + i);
+ if(i == 0 || cmpdir(pData->trails + i - 1, pData->trails + i)) {
+ storeVertex(pMesh, curVertex, pData->trails + i, 0,
+ 0, pData->trail_height,
+ fSegLength, fTotalLength);
+ storeColor(pMesh, curVertex, pV, COLOR_TRAIL);
+ curVertex += 2;
+ }
+
+ storeVertex(pMesh, curVertex, pData->trails + i, 1,
+ 0, pData->trail_height,
+ fSegLength, fTotalLength);
+ storeColor(pMesh, curVertex, pV, COLOR_TRAIL);
+ curVertex += 2;
+
+ storeIndices(pMesh, curIndex, curVertex - 4);
+ curIndex += 6;
+
+ fTotalLength += fSegLength;
+
+ }
+ {
+ segment2 s;
+ vec2Copy(&s.vStart, & pData->trails[pData->trailOffset].vStart);
+ s.vDirection.v[0] = getSegmentEndX( pData, 1 ) - s.vStart.v[0];
+ s.vDirection.v[1] = getSegmentEndY( pData, 1 ) - s.vStart.v[1];
+
+ fSegLength = segment2_Length(&s);
+
+ storeVertex(pMesh, curVertex, &s, 0,
+ 0, pData->trail_height,
+ fSegLength, fTotalLength);
+ storeColor(pMesh, curVertex, pV, COLOR_TRAIL);
+ curVertex += 2;
+
+ storeVertex(pMesh, curVertex, &s, 1,
+ 0, pData->trail_height,
+ fSegLength, fTotalLength);
+ storeColor(pMesh, curVertex, pV, COLOR_TRAIL);
+ curVertex += 2;
+
+ storeIndices(pMesh, curIndex, curVertex - 4);
+ curIndex += 6;
+
+ fTotalLength += fSegLength;
+
+ vec2Add(&s.vStart, &s.vStart, &s.vDirection);
+ s.vDirection.v[0] = getSegmentEndX( pData, 0 ) - s.vStart.v[0];
+ s.vDirection.v[1] = getSegmentEndY( pData, 0 ) - s.vStart.v[1];
+ fSegLength = segment2_Length(&s);
+
+ storeVertex(pMesh, curVertex, &s, 0,
+ 0, pData->trail_height,
+ fSegLength, fTotalLength);
+ storeColor(pMesh, curVertex, pV, COLOR_TRAIL);
+ curVertex += 2;
+
+ storeVertex(pMesh, curVertex, &s, 1,
+ 0, pData->trail_height,
+ fSegLength, fTotalLength);
+ storeColor(pMesh, curVertex, pV, COLOR_BRIGHT);
+ curVertex += 2;
+
+ storeIndices(pMesh, curIndex, curVertex - 4);
+ curIndex += 6;
+ }
+
+ pMesh->iUsed += curIndex - *piOffset;
+ *piOffset = curIndex;
+ *pvOffset = curVertex;
+}
+
+void bowGeometry(Player *pPlayer, PlayerVisual *pV,
+ TrailMesh *pMesh, int *pvOffset, int *piOffset) {
+ Data *pData = pPlayer->data;
+ segment2 s;
+ int bdist = PLAYER_IS_ACTIVE(pPlayer) ? 2 : 3;
+ int i;
+ int vOffset = *pvOffset; int iOffset = *piOffset;
+
+ s.vStart.v[0] = getSegmentEndX( pData, 0 );
+ s.vStart.v[1] = getSegmentEndY( pData, 0 );
+ s.vDirection.v[0] = getSegmentEndX( pData, bdist ) - s.vStart.v[0];
+ s.vDirection.v[1] = getSegmentEndY( pData, bdist ) - s.vStart.v[1];
+
+ for(i = 0; i < 10; i++) {
+ float t = i * 1.0f / 10;
+ float fTop = sqrtf(1 - t*t);
+ float fFloor = (t < 0.6f) ? 0 : 0.5f * (t - 0.6f);
+ if(fTop < 0.3f) fTop = 0.3f;
+
+ storeVertex(pMesh, vOffset, &s, t,
+ fFloor * pPlayer->data->trail_height,
+ fTop * pPlayer->data->trail_height,
+ DECAL_WIDTH, 0);
+ storeColor(pMesh, vOffset, pV, COLOR_BRIGHT);
+ vOffset += 2;
+ if(i) {
+ storeIndices(pMesh, iOffset, vOffset - 4);
+ iOffset += 6;
+ }
+ }
+ storeVertex(pMesh, vOffset, &s, 1,
+ 0.2f * pData->trail_height, 0.3f * pData->trail_height,
+ DECAL_WIDTH, 0);
+ storeColor(pMesh, vOffset, pV, COLOR_CYCLE);
+ vOffset += 2;
+ storeIndices(pMesh, iOffset, vOffset - 4);
+
+ pMesh->iUsed += iOffset - *piOffset;
+ *piOffset = iOffset;
+ *pvOffset = vOffset;
+}
+
diff --git a/src/video/trail_render.c b/src/video/trail_render.c
new file mode 100644
index 0000000..60f4188
--- /dev/null
+++ b/src/video/trail_render.c
@@ -0,0 +1,73 @@
+#include "video/trail_geometry.h"
+
+void trailStatesNormal(Player *pPlayer, int texture) {
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glEnableClientState(GL_COLOR_ARRAY);
+
+ // glEnable(GL_CULL_FACE);
+ glDisable(GL_CULL_FACE);
+ glShadeModel(GL_SMOOTH);
+ glEnable(GL_TEXTURE_2D);
+ // glDisable(GL_TEXTURE_2D);
+ // glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ // glDisable(GL_LIGHTING);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
+
+ {
+ float black[] = { 0, 0, 0, 1 };
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black);
+ glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
+ glEnable(GL_COLOR_MATERIAL);
+ }
+
+ if(gSettingsCache.alpha_trails) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+}
+
+void trailStatesShadowed(void) {
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+
+ // glEnable(GL_CULL_FACE);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_TEXTURE_2D);
+ // glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ glDisable(GL_LIGHTING);
+}
+
+void trailStatesRestore(void) {
+ glDisable(GL_COLOR_MATERIAL);
+ glCullFace(GL_BACK);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+ glEnable(GL_LIGHTING);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+}
+
+void trailRender(TrailMesh *pMesh) {
+ if(pMesh->iUsed == 0)
+ return;
+
+ glVertexPointer(3, GL_FLOAT, 0, pMesh->pVertices);
+ glNormalPointer(GL_FLOAT, 0, pMesh->pNormals);
+ glTexCoordPointer(2, GL_FLOAT, 0, pMesh->pTexCoords);
+ glColorPointer(4, GL_UNSIGNED_BYTE, 0, pMesh->pColors);
+
+ checkGLError("texcoord pointer");
+
+ glDrawElements(GL_TRIANGLES, pMesh->iUsed, GL_UNSIGNED_SHORT, pMesh->pIndices);
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+
+ checkGLError("trail");
+}
diff --git a/src/video/video.c b/src/video/video.c
new file mode 100644
index 0000000..fa8b7e4
--- /dev/null
+++ b/src/video/video.c
@@ -0,0 +1,282 @@
+#include "video/video.h"
+#include "game/game.h"
+#include "filesystem/path.h"
+
+#include "Nebu_video.h"
+#include "Nebu_input.h"
+#include "Nebu_scripting.h"
+
+void displayGame(void) {
+ drawGame();
+ SystemSwapBuffers();
+}
+
+int initWindow(void) {
+ int win_id;
+ int flags;
+ unsigned char fullscreen = 0;
+ /* char buf[20]; */
+
+ SystemInitWindow(0, 0, getSettingi("width"), getSettingi("height"));
+
+ if(getSettingi("windowMode") == 0) {
+ fullscreen = SYSTEM_FULLSCREEN;
+ }
+
+ flags = SYSTEM_RGBA | SYSTEM_DOUBLE | SYSTEM_DEPTH;
+ if(getSettingi("bitdepth_32"))
+ flags |= SYSTEM_32_BIT;
+
+ if(getSettingi("use_stencil"))
+ flags |= SYSTEM_STENCIL;
+
+ SystemInitDisplayMode(flags, fullscreen);
+
+ win_id = SystemCreateWindow("gltron");
+
+ if (win_id < 0) {
+ if( getSettingi("use_stencil") ) {
+ flags &= ~SYSTEM_STENCIL;
+ SystemInitDisplayMode(flags, fullscreen);
+ win_id = SystemCreateWindow("gltron");
+ if(win_id >= 0) {
+ setSettingi("use_stencil", 0);
+ goto SKIP;
+ }
+ }
+ printf("[fatal] could not create window...exiting\n");
+ exit(1); /* OK: critical, no visual */
+ }
+
+ SKIP:
+
+ if(getSettingi("windowMode") == 0 || getSettingi("mouse_warp") == 1) {
+ SystemGrabInput();
+ } else {
+ SystemUngrabInput();
+ }
+
+ return win_id;
+}
+
+void reshape(int x, int y) {
+ if(x < getSettingi("height") || x < getSettingi("width"))
+ initGameScreen();
+ if(x > getSettingi("width") )
+ gScreen->vp_x = (x - getSettingi("width")) / 2;
+ if(y > getSettingi("height") )
+ gScreen->vp_y = (y - getSettingi("height")) / 2;
+ changeDisplay(-1);
+}
+
+void shutdownDisplay(Visual *d) {
+ deleteTextures(d);
+ deleteFonts();
+ SystemDestroyWindow(d->win_id);
+ // printf("[video] window destroyed\n");
+}
+
+void setupDisplay(Visual *d) {
+ // fprintf(stderr, "[video] trying to create window\n");
+ d->win_id = initWindow();
+ // fprintf(stderr, "[video] window created\n");
+ // initRenderer();
+ // printRendererInfo();
+ // printf("win_id is %d\n", d->win_id);
+ // fprintf(stderr, "[status] loading art\n");
+ loadArt();
+
+ SystemReshapeFunc(reshape);
+}
+
+static void loadModels(void) {
+ char *path;
+ int i;
+ /* load recognizer model */
+ path = getPath(PATH_DATA, "recognizer.obj");
+ if(path != NULL) {
+ recognizer = readMeshFromFile(path, TRI_MESH);
+ /* old code did normalize & invert normals & rescale to size = 60 */
+ } else {
+ fprintf(stderr, "fatal: could not load %s - exiting...\n", path);
+ exit(1); /* OK: critical, installation corrupt */
+ }
+ free(path);
+
+ /* load recognizer quad model (for recognizer outlines) */
+ path = getPath(PATH_DATA, "recognizer_quad.obj");
+ if(path != NULL) {
+ recognizer_quad = readMeshFromFile(path, QUAD_MESH);
+ /* old code did normalize & invert normals & rescale to size = 60 */
+ } else {
+ fprintf(stderr, "fatal: could not load %s - exiting...\n", path);
+ exit(1); /* OK: critical, installation corrupt */
+ }
+ free(path);
+
+ /* load lightcycle models */
+ for(i = 0; i < LC_LOD; i++) {
+ path = getPath(PATH_DATA, lc_lod_names[i]);
+ if(path != NULL) {
+ lightcycle[i] = readMeshFromFile(path, TRI_MESH);
+ } else {
+ fprintf(stderr, "fatal: could not load model %s - exiting...\n", lc_lod_names[i]);
+ exit(1); /* OK: critical, installation corrupt */
+ }
+ }
+ free(path);
+}
+
+void initVideoData(void) {
+ gScreen = (Visual*) malloc(sizeof(Visual));
+ gViewportType = getSettingi("display_type");
+
+ {
+ Visual *d = gScreen;
+ d->w = getSettingi("width");
+ d->h = getSettingi("height");
+ d->vp_x = 0; d->vp_y = 0;
+ d->vp_w = d->w; d->vp_h = d->h;
+ d->onScreen = -1;
+ d->textures = (unsigned int*) malloc(game_textures * sizeof(unsigned int));
+ }
+
+ gPlayerVisuals = (PlayerVisual*) malloc(MAX_PLAYERS * sizeof(PlayerVisual));
+
+ loadModels();
+
+ changeDisplay(-1);
+}
+
+void initGameScreen(void) {
+ Visual *d;
+ d = gScreen;
+ d->w = getSettingi("width");
+ d->h = getSettingi("height");
+ d->vp_x = 0; d->vp_y = 0;
+ d->vp_w = d->w; d->vp_h = d->h;
+}
+
+
+void resetVideoData(void) {
+ /* for each player */
+
+ int i;
+ for(i = 0; i < game->players; i++) {
+ PlayerVisual *pV = gPlayerVisuals + i;
+ {
+ char name[32];
+ sprintf(name, "model_diffuse_%d", i);
+ scripting_GetGlobal(name, NULL);
+ scripting_GetFloatArrayResult(pV->pColorDiffuse, 4);
+ sprintf(name, "model_specular_%d", i);
+ scripting_GetGlobal(name, NULL);
+ scripting_GetFloatArrayResult(pV->pColorSpecular, 4);
+ sprintf(name, "trail_diffuse_%d", i);
+ scripting_GetGlobal(name, NULL);
+ scripting_GetFloatArrayResult(pV->pColorAlpha, 4);
+ }
+ if(game->player[i].ai->active != AI_NONE) {
+ pV->impact_radius = 0.0;
+ pV->exp_radius = 0;
+ } else {
+ pV->exp_radius = EXP_RADIUS_MAX;
+ }
+
+ }
+}
+
+void initDisplay(Visual *d, int type, int p, int onScreen) {
+ int field;
+ field = gScreen->vp_w / 32;
+ d->h = gScreen->h;
+ d->w = gScreen->w;
+ d->vp_x = gScreen->vp_x + vp_x[type][p] * field;
+ d->vp_y = gScreen->vp_y + vp_y[type][p] * field;
+ d->vp_w = vp_w[type][p] * field;
+ d->vp_h = vp_h[type][p] * field;
+ d->onScreen = onScreen;
+}
+
+static void defaultViewportPositions(void) {
+ viewport_content[0] = 0;
+ viewport_content[1] = 1;
+ viewport_content[2] = 2;
+ viewport_content[3] = 3;
+}
+
+
+/*
+ autoConfigureDisplay - configure viewports so every human player has one
+ */
+static void autoConfigureDisplay(void) {
+ int n_humans = 0;
+ int i;
+ int vp;
+
+ defaultViewportPositions();
+
+ /* loop thru players and find the humans */
+ for (i=0; i < game->players; i++) {
+ if (game->player[i].ai->active == AI_HUMAN) {
+ viewport_content[n_humans] = i;
+ n_humans++;
+ }
+ }
+
+ switch(n_humans) {
+ case 0 :
+ /*
+ Not sure what the default should be for
+ a game without human players. For now
+ just show a single viewport.
+ */
+ /* fall thru */
+ case 1 :
+ vp = VP_SINGLE;
+ break;
+ case 2 :
+ vp = VP_SPLIT;
+ break;
+ default :
+ defaultViewportPositions();
+ vp = VP_FOURWAY;
+ }
+
+ updateDisplay(vp);
+}
+
+void changeDisplay(int view) {
+
+ /* passing -1 to changeDisplay tells it to use the view from settings */
+ if (view == -1) {
+ view = getSettingi("display_type");
+ }
+
+ if (view == 3) {
+ autoConfigureDisplay();
+ } else {
+ defaultViewportPositions();
+ updateDisplay(view);
+ }
+
+ // displayMessage(TO_STDOUT, "set display to %d", view);
+ setSettingi("display_type", view);
+}
+
+void updateDisplay(int vpType) {
+ int i;
+
+ gViewportType = vpType;
+
+ for (i = 0; i < game->players; i++) {
+ gPlayerVisuals[i].display.onScreen = 0;
+ }
+ for (i = 0; i < vp_max[vpType]; i++) {
+ initDisplay(& gPlayerVisuals[ viewport_content[i] ].display,
+ vpType, i, 1);
+ }
+
+}
+
+void Video_Idle(void) { }
diff --git a/src/video/visuals_2d.c b/src/video/visuals_2d.c
new file mode 100644
index 0000000..91b8cdc
--- /dev/null
+++ b/src/video/visuals_2d.c
@@ -0,0 +1,161 @@
+#include "video/video.h"
+#include "game/game.h"
+
+/* draw a 2d map */
+
+void draw2D( Visual *d ) {
+ float width, height;
+ float border_left, border_bottom;
+ int i;
+
+ float aspect = (float)d->vp_w / (float)d->vp_h;
+ if(d->vp_w / game2->grid.width < d->vp_h / game2->grid.height) {
+ // black borders top/bottom
+ width = game2->grid.width + 1.0f;
+ height = width / aspect;
+ border_bottom = (height - game2->grid.height) / 2;
+ border_left = 0;
+ } else {
+ // black borders left/right
+ height = game2->grid.height + 1.0f;
+ width = height * aspect;
+ border_left = (width - game2->grid.width) / 2;
+ border_bottom = 0;
+ }
+
+ /*
+ {
+ static int foo = 0;
+ if(!foo)
+ printf("w,h: (%f,%f), border l/b: (%f,%f)\n",
+ width, height, border_left, border_bottom);
+ foo = 1;
+ }
+ */
+
+ glViewport(d->vp_x, d->vp_y, d->vp_w, d->vp_h);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, width, 0, height, 0, 1);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(border_left, border_bottom, 0);
+
+ {
+ float w = game2->grid.width;
+ float h = game2->grid.height;
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glBegin(GL_QUADS);
+ glColor4f(0.7f, 0.7f, 0.7f, 0.3f);
+ glVertex2f(0, 0);
+ glVertex2f(w, 0);
+ glVertex2f(w, h);
+ glVertex2f(0, h);
+ glEnd();
+ }
+
+ glDisable(GL_LIGHTING);
+ // glDisable(GL_BLEND);
+ glEnable(GL_BLEND);
+ {
+ float w = game2->grid.width;
+ float h = game2->grid.height;
+ glColor3f(1, 1, 1);
+ glBegin(GL_LINE_LOOP);
+ glVertex3f( 0, 0, 0 );
+ glVertex3f( w, 0, 0 );
+ glVertex3f( w, h, 0 );
+ glVertex3f( 0, h, 0 );
+ glEnd();
+ }
+ for(i = 0; i < game->players; i++) {
+ Player *p = &game->player[i];
+ PlayerVisual *pV = gPlayerVisuals + i;
+ segment2* trail;
+ float x, y;
+
+ getPositionFromData(&x, &y, p->data);
+
+ // fixme: check if trails vanish
+ if (p->data->trail_height <= 0) {
+ continue;
+ }
+
+ if (p->data->trail_height < TRAIL_HEIGHT) {
+ /*
+ if player crashed but the trail hasn't disappeared yet, fade
+ the trail on the 2d map as it disappears.
+ */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
+ glColor4f(pV->pColorAlpha[0], pV->pColorAlpha[1], pV->pColorAlpha[2],
+ p->data->trail_height / TRAIL_HEIGHT);
+ } else {
+ glBlendFunc(GL_ONE, GL_ONE);
+ glColor3fv(pV->pColorAlpha);
+ }
+
+ glPointSize(2);
+ glBegin(GL_POINTS);
+ glVertex2f( x, y );
+ glEnd();
+
+ glBegin(GL_LINES);
+ for(trail = p->data->trails; trail != p->data->trails + p->data->trailOffset; trail++)
+ {
+ glVertex2f(trail->vStart.v[0],
+ trail->vStart.v[1]
+ );
+ glVertex2f(trail->vStart.v[0] + trail->vDirection.v[0],
+ trail->vStart.v[1] + trail->vDirection.v[1]
+ );
+ }
+ if(trail != p->data->trails)
+ {
+ trail--;
+ glVertex2f(trail->vStart.v[0] + trail->vDirection.v[0],
+ trail->vStart.v[1] + trail->vDirection.v[1]
+ );
+ glVertex2f( floorf(x), floorf(y));
+ }
+ else
+ {
+ glVertex2f(trail->vStart.v[0],
+ trail->vStart.v[1]
+ );
+ glVertex2f( floorf(x), floorf(y));
+ }
+
+#if 0
+ // draw AI debug lines
+ glColor3f(1,1,1);
+ glVertex2f(p->ai->front.vStart.v[0],
+ p->ai->front.vStart.v[1]);
+ glVertex2f(p->ai->front.vStart.v[0] + p->ai->front.vDirection.v[0],
+ p->ai->front.vStart.v[1] + p->ai->front.vDirection.v[1]);
+ glColor3f(0,1,0);
+ glVertex2f(p->ai->left.vStart.v[0],
+ p->ai->left.vStart.v[1]);
+ glVertex2f(p->ai->left.vStart.v[0] + p->ai->left.vDirection.v[0],
+ p->ai->left.vStart.v[1] + p->ai->left.vDirection.v[1]);
+ glColor3f(0,0,1);
+ glVertex2f(p->ai->right.vStart.v[0],
+ p->ai->right.vStart.v[1]);
+ glVertex2f(p->ai->right.vStart.v[0] + p->ai->right.vDirection.v[0],
+ p->ai->right.vStart.v[1] + p->ai->right.vDirection.v[1]);
+ glColor3f(0,1,1);
+ glVertex2f(p->ai->backleft.vStart.v[0],
+ p->ai->backleft.vStart.v[1]);
+ glVertex2f(p->ai->backleft.vStart.v[0] +
+ p->ai->backleft.vDirection.v[0],
+ p->ai->backleft.vStart.v[1] +
+ p->ai->backleft.vDirection.v[1]);
+#endif
+ glEnd();
+ }
+ glDisable(GL_BLEND);
+}
+