Previous 199869 Revisions Next

r36135 Saturday 28th February, 2015 at 07:04:01 UTC by Robbbert
(MESS) mbee: various things (nw)
[3rdparty/bgfx]README.md
[3rdparty/bgfx/3rdparty/ocornut-imgui]imgui.cpp
[3rdparty/bgfx/examples/23-vectordisplay]vectordisplay.cpp
[3rdparty/bgfx/examples/common/imgui]fs_imgui_latlong.bin.h fs_imgui_latlong.sc imgui.cpp imgui.h ocornut_imgui.cpp
[3rdparty/bgfx/include]bgfx.c99.h bgfx.h
[3rdparty/bgfx/scripts]bgfx.lua example-common.lua genie.lua geometryc.lua makedisttex.lua shaderc.lua texturec.lua
[3rdparty/bgfx/src]bgfx.cpp bgfx_compute.sh bgfx_p.h bgfx_shader.sh config.h glimports.h renderer_d3d11.cpp renderer_d3d9.cpp renderer_gl.cpp renderer_gl.h
[3rdparty/bx/scripts]genie.lua toolchain.lua
[3rdparty/genie]README.md
[3rdparty/genie/src/actions/make]make_cpp.lua
[3rdparty/genie/src/base]api.lua bake.lua
[3rdparty/genie/src/host]scripts.c
[3rdparty/mongoose]mongoose.c
[3rdparty/mongoose/docs]API.md LuaSqlite.md*
[src/emu/video]tms34061.c
[src/mess/drivers]mbee.c
[src/mess/includes]mbee.h
[src/mess/machine]mbee.c
[src/mess/video]mbee.c

trunk/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
r244646r244647
18091809    g.CurrentWindowStack.resize(0);
18101810
18111811    // Create implicit window - we will only render it if the user has added something to it.
1812    ImGui::Begin("Debug", NULL, ImVec2(400,400), -1.0f, ImGuiWindowFlags_NoSavedSettings);
1812    ImGui::Begin("Debug", NULL, ImVec2(400,400));
18131813}
18141814
18151815// NB: behaviour of ImGui after Shutdown() is not tested/guaranteed at the moment. This function is merely here to free heap allocations.
trunk/3rdparty/bgfx/README.md
r244646r244647
6969how it currently looks. 
7070![mac_screenshot](https://raw.githubusercontent.com/emoon/ProDBG/master/data/screens/mac_screenshot.png)
7171
72
7273http://www.dogbytegames.com/ Dogbyte Games is an indie mobile developer studio
73focusing on racing games. 
74![ios](http://www.dogbytegames.com/bgfx/offroadlegends2_bgfx_ipad2.jpg)
74focusing on racing games.
7575
7676Examples
7777--------
trunk/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp
r244646r244647
123123
124124void VectorDisplay::teardown()
125125{
126   for (size_t i = 0; i < m_vertexBuffers.size(); ++i)
127   {
128      bgfx::destroyDynamicVertexBuffer(m_vertexBuffers[i]);
129   }
130
131126   teardownResDependent();
132127
133128   bgfx::destroyProgram(m_drawToScreenShader);
r244646r244647
733728   {
734729      for (size_t i = 0; i < m_vertexBuffers.size(); ++i)
735730      {
736         bgfx::destroyDynamicVertexBuffer(m_vertexBuffers[i]);
731         destroyDynamicVertexBuffer(m_vertexBuffers[i]);
737732      }
738733
739734      m_vertexBuffers.clear();
trunk/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h
r244646r244647
1static const uint8_t fs_imgui_latlong_glsl[649] =
1static const uint8_t fs_imgui_latlong_glsl[646] =
22{
33   0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
44   0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x07, 0x01, 0x00, 0x00, // geLodEnabled....
55   0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor...
6   0x00, 0x01, 0x00, 0x51, 0x02, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...Q...varying h
6   0x00, 0x01, 0x00, 0x4e, 0x02, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...N...varying h
77   0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc
88   0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h
99   0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ighp vec4 u_imag
r244646r244647
2121   0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x5f, //   tmpvar_3 = (v_
2222   0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, // texcoord0.y * 3.
2323   0x31, 0x34, 0x31, 0x35, 0x39, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // 14159);.  result
24   0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, // _1.x = (-(sin(tm
25   0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, 0x74, // pvar_3)) * sin(t
26   0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, // mpvar_2));.  res
27   0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, // ult_1.y = cos(tm
28   0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, // pvar_3);.  resul
29   0x74, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, // t_1.z = (-(sin(t
30   0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, 0x28, // mpvar_3)) * cos(
31   0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, // tmpvar_2));.  lo
32   0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // wp vec4 tmpvar_4
33   0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, // ;.  tmpvar_4.xyz
34   0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, //  = textureCubeLo
35   0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // d    (s_texColor
36   0x2c, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, // , result_1, u_im
37   0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, // ageLodEnabled.x)
38   0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // .xyz;.  tmpvar_4
39   0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, // .w = (0.2 + (0.8
40   0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, //  * u_imageLodEna
41   0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // bled.y));.  gl_F
42   0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva
43   0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,                                           // r_4;.}...
24   0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // _1.x = (sin(tmpv
25   0x61, 0x72, 0x5f, 0x33, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, // ar_3) * cos(tmpv
26   0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // ar_2));.  result
27   0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // _1.y = cos(tmpva
28   0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, // r_3);.  result_1
29   0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // .z = (-(sin(tmpv
30   0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, // ar_3)) * sin(tmp
31   0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, // var_2));.  lowp
32   0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // vec4 tmpvar_4;.
33   0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, //  tmpvar_4.xyz =
34   0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, 0x20, // textureCubeLod
35   0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x72, //   (s_texColor, r
36   0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, // esult_1, u_image
37   0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2e, 0x78, 0x79, // LodEnabled.x).xy
38   0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x77, 0x20, // z;.  tmpvar_4.w
39   0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, // = (0.2 + (0.8 *
40   0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, // u_imageLodEnable
41   0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // d.y));.  gl_Frag
42   0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // Color = tmpvar_4
43   0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,                                                             // ;.}...
4444};
45static const uint8_t fs_imgui_latlong_dx9[537] =
45static const uint8_t fs_imgui_latlong_dx9[553] =
4646{
4747   0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
4848   0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x15, 0x01, 0x00, 0x00, // geLodEnabled....
49   0x01, 0x00, 0xf4, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, 0x42, // ..........0.CTAB
49   0x01, 0x00, 0x04, 0x02, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, 0x42, // ..........0.CTAB
5050   0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, // ................
5151   0x1c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, // ............D...
5252   0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........P.......
r244646r244647
7171   0x01, 0x00, 0x00, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, // ................
7272   0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, 0xa0, // ..............U.
7373   0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x80, // ....%...........
74   0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x05, 0x80, 0x01, 0x00, 0xc5, 0x80, 0x02, 0x00, 0x55, 0x81, // ..............U.
74   0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x55, 0x80, // ..............U.
75   0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x01, 0x00, 0x55, 0x80, 0x02, 0x00, 0x55, 0x81, // ..........U...U.
7576   0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x02, // ................
7677   0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ........_.......
7778   0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, // ................
r244646r244647
8384{
8485   0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
8586   0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x15, 0x00, 0x30, 0x0a, // geLodEnabled..0.
86   0x01, 0x00, 0x30, 0x02, 0x44, 0x58, 0x42, 0x43, 0xbb, 0x3e, 0xd7, 0x3a, 0x63, 0xc9, 0x70, 0x0b, // ..0.DXBC.>.:c.p.
87   0xa5, 0x2c, 0x7d, 0xb2, 0x3c, 0x0c, 0x75, 0x44, 0x01, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, // .,}.<.uD....0...
87   0x01, 0x00, 0x30, 0x02, 0x44, 0x58, 0x42, 0x43, 0x89, 0x11, 0x25, 0xa6, 0xf5, 0x66, 0x12, 0x3f, // ..0.DXBC..%..f.?
88   0xc0, 0x1f, 0x67, 0x9b, 0x6e, 0x4e, 0xac, 0x03, 0x01, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, // ..g.nN......0...
8889   0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, // ....,...........
8990   0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ISGNP...........
9091   0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // 8...............
r244646r244647
100101   0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x30, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X0...p..
101102   0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // ....UU..b...2...
102103   0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ......
103   0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, // h.......8...2...
104   0x00, 0x00, 0x00, 0x00, 0x16, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // .............@..
105   0xdb, 0x0f, 0x49, 0x40, 0xdb, 0x0f, 0xc9, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ..I@...@........
106   0x4d, 0x00, 0x00, 0x06, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, // M...B...........
107   0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, // ........M.......
108   0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, // ............A...
104   0x68, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, // h.......8...2...
105   0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // ....F........@..
106   0xdb, 0x0f, 0xc9, 0x40, 0xdb, 0x0f, 0x49, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@..I@........
107   0x4d, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, // M...B...........
108   0x1a, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x06, // ....A.......M...
109   0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x16, 0x05, 0x10, 0x00, // 2...............
109110   0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x06, 0x00, 0xd0, 0x00, 0x00, 0x62, 0x00, 0x10, 0x00, // ....M.......b...
110   0x01, 0x00, 0x00, 0x00, 0x06, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, // ............8...
111   0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........*.......
112   0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, // :.......8.......
113   0x01, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, // ....:.......*...
114   0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...........
115   0x46, 0x03, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F~......
111   0x02, 0x00, 0x00, 0x00, 0x06, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, // ............8...
112   0x82, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........*.......
113   0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, // ........8.......
114   0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, // ................
115   0x02, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...........
116   0x86, 0x03, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F~......
116117   0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .`........ .....
117118   0xa3, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....6...r ......
118119   0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x82, 0x20, 0x10, 0x00, // F.......2.... ..
trunk/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.sc
r244646r244647
1818   float pi    = 3.14159265;
1919   float twoPi = 2.0*pi;
2020   float phi   = _uv.x * twoPi;
21   float theta = _uv.y * pi;
21   float theta = _uv.y *pi;
2222
2323   vec3 result;
24   result.x = -sin(theta)*sin(phi);
24   result.x = sin(theta)*cos(phi);
2525   result.y = cos(theta);
26   result.z = -sin(theta)*cos(phi);
26   result.z = -sin(theta)*sin(phi);
2727
2828   return result;
2929}
trunk/3rdparty/bgfx/examples/common/imgui/imgui.cpp
r244646r244647
387387      , m_textureHeight(512)
388388      , m_halfTexel(0.0f)
389389      , m_nvg(NULL)
390      , m_view(255)
390      , m_view(31)
391391      , m_viewWidth(0)
392392      , m_viewHeight(0)
393393      , m_currentFontIdx(0)
r244646r244647
20232023         xx = -borderSize;
20242024         yy = -1;
20252025         width = 2*borderSize+1;
2026         height = m_viewHeight+1;
2026         height = m_viewHeight;
20272027         triX = 0;
20282028         triY = (m_viewHeight-triSize)/2;
20292029         orientation = _checked ? TriangleOrientation::Left : TriangleOrientation::Right;
r244646r244647
20332033         xx = m_viewWidth - borderSize;
20342034         yy = -1;
20352035         width = 2*borderSize+1;
2036         height = m_viewHeight+1;
2036         height = m_viewHeight;
20372037         triX = m_viewWidth - triSize - 2;
20382038         triY = (m_viewHeight-width)/2;
20392039         orientation = _checked ? TriangleOrientation::Right : TriangleOrientation::Left;
trunk/3rdparty/bgfx/examples/common/imgui/imgui.h
r244646r244647
136136ImguiFontHandle imguiCreate(const void* _data = NULL, uint32_t _size = 0, float _fontSize = 15.0f);
137137void imguiDestroy();
138138
139void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar = 0, uint8_t _view = 255);
139void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar = 0, uint8_t _view = 31);
140140void imguiEndFrame();
141141
142142void imguiDrawText(int _x, int _y, ImguiTextAlign::Enum _align, const char* _text, uint32_t _argb);
trunk/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp
r244646r244647
8181
8282   void create(const void* _data, uint32_t _size, float _fontSize)
8383   {
84      m_viewId = 255;
84      m_viewId = 31;
8585
8686      ImGuiIO& io = ImGui::GetIO();
8787      io.DisplaySize = ImVec2(1280.0f, 720.0f);
trunk/3rdparty/bgfx/include/bgfx.c99.h
r244646r244647
287287    uint64_t supported;
288288
289289    uint16_t maxTextureSize;    /* < Maximum texture size.             */
290    uint16_t maxViews;          /* < Maximum views.                    */
291290    uint16_t maxDrawCalls;      /* < Maximum draw calls.               */
292291    uint8_t  maxFBAttachments;  /* < Maximum frame buffer attachments. */
293292
r244646r244647
13591358/**
13601359 *
13611360 */
1362BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
1361BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_texture_format_t _format, bgfx_access_t _access);
13631362
13641363/**
13651364 *
13661365 */
1367BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format);
1366BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_texture_format_t _format, bgfx_access_t _access);
13681367
13691368/**
13701369 * Dispatch compute.
trunk/3rdparty/bgfx/include/bgfx.h
r244646r244647
310310      uint64_t supported;
311311
312312      uint16_t maxTextureSize;   ///< Maximum texture size.
313      uint16_t maxViews;         ///< Maximum views.
314313      uint16_t maxDrawCalls;     ///< Maximum draw calls.
315314      uint8_t  maxFBAttachments; ///< Maximum frame buffer attachments.
316315
r244646r244647
10991098   /// view will use these matrices.
11001099   void setViewTransform(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags = BGFX_VIEW_STEREO, const void* _projR = NULL);
11011100
1102   /// Post submit view reordering.
1103   ///
1104   /// @param _id First view id.
1105   /// @param _num Number of views to remap.
1106   /// @param _remap View remap id table. Passing `NULL` will reset view ids
1107   ///   to default state.
1108   ///
1109   void setViewRemap(uint8_t _id = 0, uint8_t _num = UINT8_MAX, const void* _remap = NULL);
1110
11111101   /// Sets debug marker.
11121102   void setMarker(const char* _marker);
11131103
r244646r244647
12831273   void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access);
12841274
12851275   ///
1286   void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format = TextureFormat::Count);
1276   void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access);
12871277
12881278   ///
1289   void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, Access::Enum _access, TextureFormat::Enum _format = TextureFormat::Count);
1279   void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, TextureFormat::Enum _format, Access::Enum _access);
12901280
12911281   /// Dispatch compute.
12921282   void dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX = 1, uint16_t _numY = 1, uint16_t _numZ = 1, uint8_t _flags = BGFX_SUBMIT_EYE_FIRST);
trunk/3rdparty/bgfx/scripts/bgfx.lua
r244646r244647
2929      end
3030
3131      includedirs {
32         path.join(BGFX_DIR, "3rdparty"),
33         path.join(BGFX_DIR, "../bx/include"),
32         BGFX_DIR .. "3rdparty",
33         BGFX_DIR .. "../bx/include",
3434      }
3535
3636      defines {
r244646r244647
6969
7070      configuration { "xcode4 or osx or ios*" }
7171         files {
72            path.join(BGFX_DIR, "src/**.mm"),
72            BGFX_DIR .. "src/**.mm",
7373         }
7474
7575      configuration { "osx" }
r244646r244647
8080      configuration { "not nacl" }
8181         includedirs {
8282            --nacl has GLES2 headers modified...
83            path.join(BGFX_DIR, "3rdparty/khronos"),
83            BGFX_DIR .. "3rdparty/khronos",
8484         }
8585
8686      configuration { "x64", "vs* or mingw*" }
r244646r244647
9191      configuration {}
9292
9393      includedirs {
94         path.join(BGFX_DIR, "include"),
94         BGFX_DIR .. "include",
9595      }
9696
9797      files {
98         path.join(BGFX_DIR, "include/**.h"),
99         path.join(BGFX_DIR, "src/**.cpp"),
100         path.join(BGFX_DIR, "src/**.h"),
98         BGFX_DIR .. "include/**.h",
99         BGFX_DIR .. "src/**.cpp",
100         BGFX_DIR .. "src/**.h",
101101      }
102102
103103      excludes {
104         path.join(BGFX_DIR, "src/**.bin.h"),
104         BGFX_DIR .. "src/**.bin.h",
105105      }
106106
107107      configuration {}
trunk/3rdparty/bgfx/scripts/example-common.lua
r244646r244647
88   kind "StaticLib"
99
1010   includedirs {
11      path.join(BX_DIR, "include"),
12      path.join(BGFX_DIR, "include"),
13      path.join(BGFX_DIR, "3rdparty"),
11      BX_DIR .. "include",
12      BGFX_DIR .. "include",
13      BGFX_DIR .. "3rdparty",
1414   }
1515
1616   files {
17      path.join(BGFX_DIR, "3rdparty/ib-compress/**.cpp"),
18      path.join(BGFX_DIR, "3rdparty/ib-compress/**.h"),
19      path.join(BGFX_DIR, "3rdparty/ocornut-imgui/**.cpp"),
20      path.join(BGFX_DIR, "3rdparty/ocornut-imgui/**.h"),
21      path.join(BGFX_DIR, "examples/common/**.cpp"),
22      path.join(BGFX_DIR, "examples/common/**.h"),
17      BGFX_DIR .. "3rdparty/ib-compress/**.cpp",
18      BGFX_DIR .. "3rdparty/ib-compress/**.h",
19      BGFX_DIR .. "3rdparty/ocornut-imgui/**.cpp",
20      BGFX_DIR .. "3rdparty/ocornut-imgui/**.h",
21      BGFX_DIR .. "examples/common/**.cpp",
22      BGFX_DIR .. "examples/common/**.h",
2323   }
2424
2525   if _OPTIONS["with-sdl"] then
trunk/3rdparty/bgfx/scripts/genie.lua
r244646r244647
4545   language "C++"
4646   startproject "example-00-helloworld"
4747
48BGFX_DIR = path.getabsolute("..")
49local BGFX_BUILD_DIR = path.join(BGFX_DIR, ".build")
50local BGFX_THIRD_PARTY_DIR = path.join(BGFX_DIR, "3rdparty")
51BX_DIR = path.getabsolute(path.join(BGFX_DIR, "../bx"))
48BGFX_DIR = (path.getabsolute("..") .. "/")
49local BGFX_BUILD_DIR = (BGFX_DIR .. ".build/")
50local BGFX_THIRD_PARTY_DIR = (BGFX_DIR .. "3rdparty/")
51BX_DIR = (BGFX_DIR .. "../bx/")
5252
5353defines {
5454   "BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS=1"
5555}
5656
57dofile (path.join(BX_DIR, "scripts/toolchain.lua"))
57dofile (BX_DIR .. "scripts/toolchain.lua")
5858if not toolchain(BGFX_BUILD_DIR, BGFX_THIRD_PARTY_DIR) then
5959   return -- no action specified
6060end
r244646r244647
8080
8181   -- don't output debugdir for winphone builds
8282   if "winphone81" ~= _OPTIONS["vs"] then
83      debugdir (path.join(BGFX_DIR, "examples/runtime"))
83      debugdir (BGFX_DIR .. "examples/runtime/")
8484   end
8585
8686   includedirs {
87      path.join(BX_DIR, "include"),
88      path.join(BGFX_DIR, "include"),
89      path.join(BGFX_DIR, "3rdparty"),
90      path.join(BGFX_DIR, "examples/common"),
87      BX_DIR .. "include",
88      BGFX_DIR .. "include",
89      BGFX_DIR .. "3rdparty",
90      BGFX_DIR .. "examples/common",
9191   }
9292
9393   files {
94      path.join(BGFX_DIR, "examples", _name, "**.cpp"),
95      path.join(BGFX_DIR, "examples", _name, "**.h"),
94      BGFX_DIR .. "examples/" .. _name .. "/**.cpp",
95      BGFX_DIR .. "examples/" .. _name .. "/**.h",
9696   }
9797
9898   links {
r244646r244647
120120      }
121121
122122      configuration { "x32" }
123         libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Win32", _ACTION) }
123         libdirs { "$(OVR_DIR)/LibOVR/Lib/Win32/" .. _ACTION }
124124
125125      configuration { "x64" }
126         libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/x64", _ACTION) }
126         libdirs { "$(OVR_DIR)/LibOVR/Lib/x64/" .. _ACTION }
127127
128128      configuration { "x32", "Debug" }
129129         links { "libovrd" }
r244646r244647
177177         "/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
178178      }
179179      -- WinRT targets need their own output directories are build files stomp over each other
180      targetdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "bin", _name))
181      objdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "obj", _name))
180      targetdir (BGFX_BUILD_DIR .. "arm_" .. _ACTION .. "/bin/" .. _name)
181      objdir (BGFX_BUILD_DIR .. "arm_" .. _ACTION .. "/obj/" .. _name)
182182
183183   configuration { "mingw-clang" }
184184      kind "ConsoleApp"
r244646r244647
236236
237237   configuration { "osx" }
238238      files {
239         path.join(BGFX_DIR, "examples/common/**.mm"),
239         BGFX_DIR .. "examples/common/**.mm",
240240      }
241241      links {
242242         "Cocoa.framework",
r244646r244647
246246   configuration { "ios*" }
247247      kind "ConsoleApp"
248248      files {
249         path.join(BGFX_DIR, "examples/common/**.mm"),
249         BGFX_DIR .. "examples/common/**.mm",
250250      }
251251      linkoptions {
252252         "-framework CoreFoundation",
r244646r244647
259259   configuration { "xcode4", "ios" }
260260      kind "WindowedApp"
261261      files {
262         path.join(BGFX_DIR, "examples/runtime/iOS-Info.plist"),
262         BGFX_DIR .. "examples/runtime/iOS-Info.plist"
263263      }
264264
265265   configuration { "qnx*" }
trunk/3rdparty/bgfx/scripts/geometryc.lua
r244646r244647
88   kind "ConsoleApp"
99
1010   includedirs {
11      path.join(BX_DIR, "include"),
12      path.join(BGFX_DIR, "include"),
13      path.join(BGFX_DIR, "3rdparty"),
14      path.join(BGFX_DIR, "examples/common"),
11      BX_DIR   .. "include",
12      BGFX_DIR .. "include",
13      BGFX_DIR .. "3rdparty",
14      BGFX_DIR .. "examples/common",
1515   }
1616
1717   files {
18      path.join(BGFX_DIR, "3rdparty/forsyth-too/**.cpp"),
19      path.join(BGFX_DIR, "3rdparty/forsyth-too/**.h"),
20      path.join(BGFX_DIR, "3rdparty/ib-compress/**.cpp"),
21      path.join(BGFX_DIR, "3rdparty/ib-compress/**.h"),
22      path.join(BGFX_DIR, "src/vertexdecl.**"),
23      path.join(BGFX_DIR, "tools/geometryc/**.cpp"),
24      path.join(BGFX_DIR, "tools/geometryc/**.h"),
25      path.join(BGFX_DIR, "examples/common/bounds.**"),
18      BGFX_DIR .. "3rdparty/forsyth-too/**.cpp",
19      BGFX_DIR .. "3rdparty/forsyth-too/**.h",
20      BGFX_DIR .. "3rdparty/ib-compress/**.cpp",
21      BGFX_DIR .. "3rdparty/ib-compress/**.h",
22      BGFX_DIR .. "src/vertexdecl.**",
23      BGFX_DIR .. "tools/geometryc/**.cpp",
24      BGFX_DIR .. "tools/geometryc/**.h",
25      BGFX_DIR .. "examples/common/bounds.**",
2626   }
2727
2828   configuration { "osx" }
trunk/3rdparty/bgfx/scripts/makedisttex.lua
r244646r244647
88   kind "ConsoleApp"
99
1010   includedirs {
11      path.join(BX_DIR, "include"),
12      path.join(BGFX_DIR, "3rdparty"),
11      BX_DIR .. "include",
12      BGFX_DIR .. "3rdparty",
1313   }
1414
1515   files {
16      path.join(BGFX_DIR, "3rdparty/edtaa3/**.cpp"),
17      path.join(BGFX_DIR, "3rdparty/edtaa3/**.h"),
18      path.join(BGFX_DIR, "tools/makedisttex.cpp"),
16      BGFX_DIR .. "3rdparty/edtaa3/**.cpp",
17      BGFX_DIR .. "3rdparty/edtaa3/**.h",
18      BGFX_DIR .. "tools/makedisttex.cpp",
1919   }
trunk/3rdparty/bgfx/scripts/shaderc.lua
r244646r244647
77   uuid "f3cd2e90-52a4-11e1-b86c-0800200c9a66"
88   kind "ConsoleApp"
99
10   local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer")
11   local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp")
10   local GLSL_OPTIMIZER = (BGFX_DIR .. "3rdparty/glsl-optimizer/")
11   local FCPP_DIR = (BGFX_DIR .. "3rdparty/fcpp/")
1212
1313   includedirs {
14      path.join(GLSL_OPTIMIZER, "src"),
14      GLSL_OPTIMIZER .. "src",
1515   }
1616
1717   configuration { "vs*" }
1818      includedirs {
19         path.join(GLSL_OPTIMIZER, "src/glsl/msvc"),
19         GLSL_OPTIMIZER .. "src/glsl/msvc",
2020      }
2121
2222      defines { -- glsl-optimizer
r244646r244647
4343
4444   configuration { "windows", "vs*" }
4545      includedirs {
46         path.join(GLSL_OPTIMIZER, "include/c99"),
46         GLSL_OPTIMIZER .. "include/c99",
4747      }
4848
4949   configuration { "windows" }
r244646r244647
6767   }
6868
6969   includedirs {
70      path.join(BX_DIR, "include"),
71      path.join(BGFX_DIR, "include"),
70      BX_DIR   .. "include",
71      BGFX_DIR .. "include",
7272
7373      FCPP_DIR,
7474
75      path.join(GLSL_OPTIMIZER, "include"),
76      path.join(GLSL_OPTIMIZER, "src/mesa"),
77      path.join(GLSL_OPTIMIZER, "src/mapi"),
78      path.join(GLSL_OPTIMIZER, "src/glsl"),
75      GLSL_OPTIMIZER .. "include",
76      GLSL_OPTIMIZER .. "src/mesa",
77      GLSL_OPTIMIZER .. "src/mapi",
78      GLSL_OPTIMIZER .. "src/glsl",
7979   }
8080
8181   files {
82      path.join(BGFX_DIR, "tools/shaderc/**.cpp"),
83      path.join(BGFX_DIR, "tools/shaderc/**.h"),
84      path.join(BGFX_DIR, "src/vertexdecl.**"),
82      BGFX_DIR .. "tools/shaderc/**.cpp",
83      BGFX_DIR .. "tools/shaderc/**.h",
84      BGFX_DIR .. "src/vertexdecl.**",
8585
86      path.join(FCPP_DIR, "**.h"),
87      path.join(FCPP_DIR, "cpp1.c"),
88      path.join(FCPP_DIR, "cpp2.c"),
89      path.join(FCPP_DIR, "cpp3.c"),
90      path.join(FCPP_DIR, "cpp4.c"),
91      path.join(FCPP_DIR, "cpp5.c"),
92      path.join(FCPP_DIR, "cpp6.c"),
93      path.join(FCPP_DIR, "cpp6.c"),
86      FCPP_DIR .. "**.h",
87      FCPP_DIR .. "cpp1.c",
88      FCPP_DIR .. "cpp2.c",
89      FCPP_DIR .. "cpp3.c",
90      FCPP_DIR .. "cpp4.c",
91      FCPP_DIR .. "cpp5.c",
92      FCPP_DIR .. "cpp6.c",
93      FCPP_DIR .. "cpp6.c",
9494
95      path.join(GLSL_OPTIMIZER, "src/mesa/**.c"),
96      path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"),
97      path.join(GLSL_OPTIMIZER, "src/mesa/**.h"),
98      path.join(GLSL_OPTIMIZER, "src/glsl/**.c"),
99      path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"),
100      path.join(GLSL_OPTIMIZER, "src/glsl/**.h"),
101      path.join(GLSL_OPTIMIZER, "src/util/**.c"),
102      path.join(GLSL_OPTIMIZER, "src/util/**.h"),
95      GLSL_OPTIMIZER .. "src/mesa/**.c",
96      GLSL_OPTIMIZER .. "src/glsl/**.cpp",
97      GLSL_OPTIMIZER .. "src/mesa/**.h",
98      GLSL_OPTIMIZER .. "src/glsl/**.c",
99      GLSL_OPTIMIZER .. "src/glsl/**.cpp",
100      GLSL_OPTIMIZER .. "src/glsl/**.h",
101      GLSL_OPTIMIZER .. "src/util/**.c",
102      GLSL_OPTIMIZER .. "src/util/**.h",
103103   }
104104
105105   excludes {
106      path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp.c"),
107      path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/tests/**"),
108      path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.l"),
109      path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.y"),
110      path.join(GLSL_OPTIMIZER, "src/glsl/ir_set_program_inouts.cpp"),
111      path.join(GLSL_OPTIMIZER, "src/glsl/main.cpp"),
112      path.join(GLSL_OPTIMIZER, "src/glsl/builtin_stubs.cpp"),
106      GLSL_OPTIMIZER .. "src/glsl/glcpp/glcpp.c",
107      GLSL_OPTIMIZER .. "src/glsl/glcpp/tests/**",
108      GLSL_OPTIMIZER .. "src/glsl/glcpp/**.l",
109      GLSL_OPTIMIZER .. "src/glsl/glcpp/**.y",
110      GLSL_OPTIMIZER .. "src/glsl/ir_set_program_inouts.cpp",
111      GLSL_OPTIMIZER .. "src/glsl/main.cpp",
112      GLSL_OPTIMIZER .. "src/glsl/builtin_stubs.cpp",
113113   }
114114
115115   strip()
trunk/3rdparty/bgfx/scripts/texturec.lua
r244646r244647
88   kind "ConsoleApp"
99
1010   includedirs {
11      path.join(BX_DIR, "include"),
12      path.join(BGFX_DIR, "include"),
13      path.join(BGFX_DIR, "src"),
11      BX_DIR .. "include",
12      BGFX_DIR .. "include",
13      BGFX_DIR .. "src",
1414   }
1515
1616   files {
17      path.join(BGFX_DIR, "src/image.*"),
18      path.join(BGFX_DIR, "tools/texturec/**.cpp"),
19      path.join(BGFX_DIR, "tools/texturec/**.h"),
17      BGFX_DIR .. "src/image.*",
18      BGFX_DIR .. "tools/texturec/**.cpp",
19      BGFX_DIR .. "tools/texturec/**.h",
2020   }
2121
2222   links {
trunk/3rdparty/bgfx/src/bgfx.cpp
r244646r244647
1919#   define BGFX_CHECK_RENDER_THREAD()
2020#endif // BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS
2121
22#define BGFX_CHECK_HANDLE(_handle, _max) \
23         BX_CHECK(isValid(_handle) \
24            && _handle.idx < _max \
25            , "Invalid handle. %d (< %d " #_max ")" \
26            , _handle.idx \
27            , _max \
28            );
29
3022#if BX_PLATFORM_ANDROID
3123   ::ANativeWindow* g_bgfxAndroidWindow = NULL;
3224
r244646r244647
805797
806798   void Frame::sort()
807799   {
808      for (uint32_t ii = 0, num = m_num; ii < num; ++ii)
809      {
810         m_sortKeys[ii] = SortKey::remapView(m_sortKeys[ii], m_viewRemap);
811      }
812800      bx::radixSort64(m_sortKeys, s_ctx->m_tempKeys, m_sortValues, s_ctx->m_tempValues, m_num);
813801   }
814802
r244646r244647
963951      BX_TRACE("Multithreaded renderer is disabled.");
964952#endif // BGFX_CONFIG_MULTITHREADED
965953
966      for (uint32_t ii = 0; ii < BX_COUNTOF(m_viewRemap); ++ii)
967      {
968         m_viewRemap[ii] = ii;
969      }
970
971954      memset(m_fb, 0xff, sizeof(m_fb) );
972955      memset(m_clear, 0, sizeof(m_clear) );
973956      memset(m_rect, 0, sizeof(m_rect) );
r244646r244647
11731156      freeDynamicBuffers();
11741157      m_submit->m_resolution = m_resolution;
11751158      m_submit->m_debug = m_debug;
1176
1177      memcpy(m_submit->m_viewRemap, m_viewRemap, sizeof(m_viewRemap) );
11781159      memcpy(m_submit->m_fb, m_fb, sizeof(m_fb) );
11791160      memcpy(m_submit->m_clear, m_clear, sizeof(m_clear) );
11801161      memcpy(m_submit->m_rect, m_rect, sizeof(m_rect) );
r244646r244647
19801961      g_caps.supported = 0
19811962         | (BGFX_CONFIG_MULTITHREADED ? BGFX_CAPS_RENDERER_MULTITHREADED : 0)
19821963         ;
1983      g_caps.maxViews     = BGFX_CONFIG_MAX_VIEWS;
19841964      g_caps.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS;
19851965      g_caps.maxFBAttachments = 1;
19861966
r244646r244647
26372617      s_ctx->setClearColor(_index, _rgba);
26382618   }
26392619
2640   bool checkView(uint8_t _id)
2641   {
2642      // workaround GCC 4.9 type-limit check.
2643      const uint32_t id = _id;
2644      return id < BGFX_CONFIG_MAX_VIEWS;
2645   }
2646
26472620   void setViewName(uint8_t _id, const char* _name)
26482621   {
26492622      BGFX_CHECK_MAIN_THREAD();
2650      BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
2623      BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id);
26512624      s_ctx->setViewName(_id, _name);
26522625   }
26532626
26542627   void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
26552628   {
26562629      BGFX_CHECK_MAIN_THREAD();
2657      BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
2630      BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id);
26582631      s_ctx->setViewRect(_id, _x, _y, _width, _height);
26592632   }
26602633
26612634   void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
26622635   {
26632636      BGFX_CHECK_MAIN_THREAD();
2664      BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
2637      BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id);
26652638      s_ctx->setViewScissor(_id, _x, _y, _width, _height);
26662639   }
26672640
26682641   void setViewClear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
26692642   {
26702643      BGFX_CHECK_MAIN_THREAD();
2671      BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
2644      BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id);
26722645      s_ctx->setViewClear(_id, _flags, _rgba, _depth, _stencil);
26732646   }
26742647
26752648   void setViewClear(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7)
26762649   {
26772650      BGFX_CHECK_MAIN_THREAD();
2678      BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
2651      BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id);
26792652      s_ctx->setViewClear(_id, _flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7);
26802653   }
26812654
26822655   void setViewSeq(uint8_t _id, bool _enabled)
26832656   {
26842657      BGFX_CHECK_MAIN_THREAD();
2685      BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
2658      BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id);
26862659      s_ctx->setViewSeq(_id, _enabled);
26872660   }
26882661
26892662   void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle)
26902663   {
26912664      BGFX_CHECK_MAIN_THREAD();
2692      BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
2665      BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id);
26932666      s_ctx->setViewFrameBuffer(_id, _handle);
26942667   }
26952668
26962669   void setViewTransform(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR)
26972670   {
26982671      BGFX_CHECK_MAIN_THREAD();
2699      BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
2672      BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id);
27002673      s_ctx->setViewTransform(_id, _view, _projL, _flags, _projR);
27012674   }
27022675
2703   void setViewRemap(uint8_t _id, uint8_t _num, const void* _remap)
2704   {
2705      BGFX_CHECK_MAIN_THREAD();
2706      BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
2707      s_ctx->setViewRemap(_id, _num, _remap);
2708   }
2709
27102676   void setMarker(const char* _marker)
27112677   {
27122678      BGFX_CHECK_MAIN_THREAD();
r244646r244647
27582724   void setUniform(UniformHandle _handle, const void* _value, uint16_t _num)
27592725   {
27602726      BGFX_CHECK_MAIN_THREAD();
2761      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_UNIFORMS);
27622727      s_ctx->setUniform(_handle, _value, _num);
27632728   }
27642729
27652730   void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
27662731   {
27672732      BGFX_CHECK_MAIN_THREAD();
2768      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS);
27692733      s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
27702734   }
27712735
27722736   void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
27732737   {
27742738      BGFX_CHECK_MAIN_THREAD();
2775      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS);
27762739      s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
27772740   }
27782741
r244646r244647
27972760   void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
27982761   {
27992762      BGFX_CHECK_MAIN_THREAD();
2800      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
28012763      s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices);
28022764   }
28032765
28042766   void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices)
28052767   {
28062768      BGFX_CHECK_MAIN_THREAD();
2807      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
28082769      s_ctx->setVertexBuffer(_handle, _numVertices);
28092770   }
28102771
r244646r244647
28232784   void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num)
28242785   {
28252786      BGFX_CHECK_MAIN_THREAD();
2826      BX_CHECK(NULL != _idb, "_idb can't be NULL");
28272787      s_ctx->setInstanceDataBuffer(_idb, _num);
28282788   }
28292789
28302790   void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num)
28312791   {
28322792      BGFX_CHECK_MAIN_THREAD();
2833      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
28342793      s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num);
28352794   }
28362795
28372796   void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num)
28382797   {
28392798      BGFX_CHECK_MAIN_THREAD();
2840      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
28412799      s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num);
28422800   }
28432801
28442802   void setProgram(ProgramHandle _handle)
28452803   {
28462804      BGFX_CHECK_MAIN_THREAD();
2847      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_PROGRAMS);
28482805      s_ctx->setProgram(_handle);
28492806   }
28502807
r244646r244647
28692826   void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access)
28702827   {
28712828      BGFX_CHECK_MAIN_THREAD();
2872      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS);
28732829      s_ctx->setBuffer(_stage, _handle, _access);
28742830   }
28752831
28762832   void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access)
28772833   {
28782834      BGFX_CHECK_MAIN_THREAD();
2879      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
28802835      s_ctx->setBuffer(_stage, _handle, _access);
28812836   }
28822837
28832838   void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access)
28842839   {
28852840      BGFX_CHECK_MAIN_THREAD();
2886      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS);
28872841      s_ctx->setBuffer(_stage, _handle, _access);
28882842   }
28892843
28902844   void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access)
28912845   {
28922846      BGFX_CHECK_MAIN_THREAD();
2893      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
28942847      s_ctx->setBuffer(_stage, _handle, _access);
28952848   }
28962849
2897   void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format)
2850   void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access)
28982851   {
28992852      BGFX_CHECK_MAIN_THREAD();
2900      s_ctx->setImage(_stage, _sampler, _handle, _mip, _access, _format);
2853      s_ctx->setImage(_stage, _sampler, _handle, _mip, _format, _access);
29012854   }
29022855
2903   void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, Access::Enum _access, TextureFormat::Enum _format)
2856   void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, TextureFormat::Enum _format, Access::Enum _access)
29042857   {
29052858      BGFX_CHECK_MAIN_THREAD();
2906      s_ctx->setImage(_stage, _sampler, _handle, _attachment, _access, _format);
2859      s_ctx->setImage(_stage, _sampler, _handle, _attachment, _format, _access);
29072860   }
29082861
29092862   void dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags)
r244646r244647
35133466   return bgfx::submit(_id, _depth);
35143467}
35153468
3516BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format)
3469BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_texture_format_t _format, bgfx_access_t _access)
35173470{
35183471   union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler };
35193472   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle  = { _handle  };
3520   bgfx::setImage(_stage, sampler.cpp, handle.cpp, _mip, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) );
3473   bgfx::setImage(_stage, sampler.cpp, handle.cpp, _mip, bgfx::TextureFormat::Enum(_format), bgfx::Access::Enum(_access) );
35213474}
35223475
3523BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format)
3476BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_texture_format_t _format, bgfx_access_t _access)
35243477{
35253478   union { bgfx_uniform_handle_t c;      bgfx::UniformHandle cpp;     } sampler = { _sampler };
35263479   union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle  = { _handle };
3527   bgfx::setImage(_stage, sampler.cpp, handle.cpp, _attachment, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) );
3480   bgfx::setImage(_stage, sampler.cpp, handle.cpp, _attachment, bgfx::TextureFormat::Enum(_format), bgfx::Access::Enum(_access) );
35283481}
35293482
35303483BGFX_C_API void bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags)
trunk/3rdparty/bgfx/src/bgfx_compute.sh
r244646r244647
1616vec2  uintBitsToFloat(uint2 _x) { return asfloat(_x); }
1717vec3  uintBitsToFloat(uint3 _x) { return asfloat(_x); }
1818vec4  uintBitsToFloat(uint4 _x) { return asfloat(_x); }
19uint  floatBitsToUint(float _x) { return asuint(_x);  }
20uvec2 floatBitsToUint(vec2  _x) { return asuint(_x);  }
21uvec3 floatBitsToUint(vec3  _x) { return asuint(_x);  }
22uvec4 floatBitsToUint(vec4  _x) { return asuint(_x);  }
23int   floatBitsToInt(float _x)  { return asint(_x);   }
24ivec2 floatBitsToInt(vec2  _x)  { return asint(_x);   }
25ivec3 floatBitsToInt(vec3  _x)  { return asint(_x);   }
26ivec4 floatBitsToInt(vec4  _x)  { return asint(_x);   }
1927
20uint  floatBitsToUint(float _x) { return asuint(_x); }
21uvec2 floatBitsToUint(vec2  _x) { return asuint(_x); }
22uvec3 floatBitsToUint(vec3  _x) { return asuint(_x); }
23uvec4 floatBitsToUint(vec4  _x) { return asuint(_x); }
24
25int   floatBitsToInt(float _x) { return asint(_x); }
26ivec2 floatBitsToInt(vec2  _x) { return asint(_x); }
27ivec3 floatBitsToInt(vec3  _x) { return asint(_x); }
28ivec4 floatBitsToInt(vec4  _x) { return asint(_x); }
29
30uint  bitfieldReverse(uint  _x) { return reversebits(_x); }
31uint2 bitfieldReverse(uint2 _x) { return reversebits(_x); }
32uint3 bitfieldReverse(uint3 _x) { return reversebits(_x); }
33uint4 bitfieldReverse(uint4 _x) { return reversebits(_x); }
34
35uint packHalf2x16(vec2 _x)
36{
37   return (f32tof16(_x.x)<<16) | f32tof16(_x.y);
38}
39
40vec2 unpackHalf2x16(uint _x)
41{
42   return vec2(f16tof32(_x >> 16), f16tof32(_x) );
43}
44
4528#define SHARED groupshared
4629
4730#define IMAGE2D_RO(_name, _reg) Texture2D           _name : register(t[_reg])
r244646r244647
5942   return _image.Load(uint3(_uv.xy, 0) );
6043}
6144
62uint4 imageLoad(Texture2D<uint> _image, ivec2 _uv)
45uint imageLoad(Texture2D<uint> _image, ivec2 _uv)
6346{
64   uint rr = _image.Load(uint3(_uv.xy, 0) );
65   return uint4(rr, rr, rr, rr);
47   return _image.Load(uint3(_uv.xy, 0) );
6648}
6749
68uint4 imageLoad(RWTexture2D<uint> _image, ivec2 _uv)
50uint imageLoad(RWTexture2D<uint> _image, ivec2 _uv)
6951{
70   uint rr = _image[_uv.xy];
71   return uint4(rr, rr, rr, rr);
52   return _image[_uv.xy];
7253}
7354
7455ivec2 imageSize(Texture2D _image)
trunk/3rdparty/bgfx/src/bgfx_p.h
r244646r244647
679679   };
680680
681681#define SORT_KEY_RENDER_DRAW (UINT64_C(1)<<0x2b)
682#define SORT_KEY_VIEW_SHIFT  UINT8_C(0x37)
683#define SORT_KEY_VIEW_MASK   ( (uint64_t(BGFX_CONFIG_MAX_VIEWS-1) )<<SORT_KEY_VIEW_SHIFT)
684682
685   BX_STATIC_ASSERT(BGFX_CONFIG_MAX_VIEWS <= 256);
683   BX_STATIC_ASSERT(BGFX_CONFIG_MAX_VIEWS   <= 32);
686684   BX_STATIC_ASSERT( (BGFX_CONFIG_MAX_PROGRAMS & (BGFX_CONFIG_MAX_PROGRAMS-1) ) == 0); // must be power of 2
687685
688686   struct SortKey
r244646r244647
691689      {
692690         // |               3               2               1               0|
693691         // |fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210|
694         // | vvvvvvvvsssssssssssdttpppppppppdddddddddddddddddddddddddddddddd|
692         // |    vvvvvsssssssssssdttpppppppppdddddddddddddddddddddddddddddddd|
695693         // |        ^          ^^ ^        ^                               ^|
696694         // |        |          || |        |                               ||
697695         // |   view-+      seq-+| +-trans  +-program                 depth-+|
r244646r244647
701699         const uint64_t program = uint64_t(m_program)<<0x20;
702700         const uint64_t trans   = uint64_t(m_trans  )<<0x29;
703701         const uint64_t seq     = uint64_t(m_seq    )<<0x2c;
704         const uint64_t view    = uint64_t(m_view   )<<SORT_KEY_VIEW_SHIFT;
702         const uint64_t view    = uint64_t(m_view   )<<0x37;
705703         const uint64_t key     = depth|program|trans|SORT_KEY_RENDER_DRAW|seq|view;
706704         return key;
707705      }
r244646r244647
710708      {
711709         // |               3               2               1               0|
712710         // |fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210|
713         // | vvvvvvvvsssssssssssdppppppppp                                  |
711         // |    vvvvvsssssssssssdppppppppp                                  |
714712         // |        ^          ^^        ^                                  |
715713         // |        |          ||        |                                  |
716714         // |   view-+      seq-+|        +-program                          |
r244646r244647
718716
719717         const uint64_t program = uint64_t(m_program)<<0x22;
720718         const uint64_t seq     = uint64_t(m_seq    )<<0x2c;
721         const uint64_t view    = uint64_t(m_view   )<<SORT_KEY_VIEW_SHIFT;
719         const uint64_t view    = uint64_t(m_view   )<<0x37;
722720         const uint64_t key     = program|seq|view;
723721         return key;
724722      }
r244646r244647
727725      bool decode(uint64_t _key)
728726      {
729727         m_seq     = (_key>>0x2c)& 0x7ff;
730         m_view    = uint8_t( (_key&SORT_KEY_VIEW_MASK)>>SORT_KEY_VIEW_SHIFT);
728         m_view    = (_key>>0x37)&(BGFX_CONFIG_MAX_VIEWS-1);
731729         if (_key & SORT_KEY_RENDER_DRAW)
732730         {
733731            m_depth   =  _key       & 0xffffffff;
r244646r244647
740738         return true; // compute
741739      }
742740
743      bool decode(uint64_t _key, uint8_t _viewRemap[BGFX_CONFIG_MAX_VIEWS])
744      {
745         bool compute = decode(_key);
746         m_view = _viewRemap[m_view];
747         return compute;
748      }
749
750      static uint64_t remapView(uint64_t _key, uint8_t _viewRemap[BGFX_CONFIG_MAX_VIEWS])
751      {
752         const uint8_t  oldView  = uint8_t( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT);
753         const uint64_t view     = uint64_t(_viewRemap[oldView])        << SORT_KEY_VIEW_SHIFT;
754         const uint64_t key      = (_key & ~SORT_KEY_VIEW_MASK) | view;
755         return key;
756      }
757
758741      void reset()
759742      {
760743         m_depth   = 0;
r244646r244647
13701353
13711354      void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
13721355      {
1356         BX_CHECK(_handle.idx < BGFX_CONFIG_MAX_VERTEX_BUFFERS, "Invalid vertex buffer handle. %d (< %d)", _handle.idx, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
13731357         m_draw.m_startVertex  = _startVertex;
13741358         m_draw.m_numVertices  = _numVertices;
13751359         m_draw.m_vertexBuffer = _handle;
r244646r244647
14101394
14111395      void setProgram(ProgramHandle _handle)
14121396      {
1397         BX_CHECK(isValid(_handle), "Can't set program with invalid handle.");
14131398         m_key.m_program = _handle.idx;
14141399      }
14151400
r244646r244647
14471432         bind.m_un.m_compute.m_mip    = 0;
14481433      }
14491434
1450      void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format)
1435      void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access)
14511436      {
14521437         Binding& bind = m_compute.m_bind[_stage];
14531438         bind.m_idx    = _handle.idx;
r244646r244647
15791564
15801565      SortKey m_key;
15811566
1582      uint8_t m_viewRemap[BGFX_CONFIG_MAX_VIEWS];
15831567      FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS];
15841568      Clear m_clear[BGFX_CONFIG_MAX_VIEWS];
15851569      float m_clearColor[BGFX_CONFIG_MAX_CLEAR_COLOR_PALETTE][4];
r244646r244647
17361720         m_free.push_back(Free(_ptr, _size) );
17371721      }
17381722
1739      uint64_t remove()
1740      {
1741         BX_CHECK(0 == m_used.size(), "");
1742
1743         if (0 < m_free.size() )
1744         {
1745            Free free = m_free.front();
1746            m_free.pop_front();
1747            return free.m_ptr;
1748         }
1749
1750         return 0;
1751      }
1752
17531723      uint64_t alloc(uint32_t _size)
17541724      {
17551725         for (FreeList::iterator it = m_free.begin(), itEnd = m_free.end(); it != itEnd; ++it)
r244646r244647
17881758         }
17891759      }
17901760
1791      bool compact()
1761      void compact()
17921762      {
17931763         m_free.sort();
17941764
r244646r244647
18051775               ++next;
18061776            }
18071777         }
1808
1809         return 0 == m_used.size();
18101778      }
18111779
18121780   private:
r244646r244647
21792147         else
21802148         {
21812149            m_dynIndexBufferAllocator.free(uint64_t(dib.m_handle.idx)<<32 | dib.m_offset);
2182            if (m_dynIndexBufferAllocator.compact() )
2183            {
2184               for (uint64_t ptr = m_dynIndexBufferAllocator.remove(); 0 != ptr; ptr = m_dynIndexBufferAllocator.remove() )
2185               {
2186                  IndexBufferHandle handle = { uint16_t(ptr>>32) };
2187                  destroyIndexBuffer(handle);
2188               }
2189            }
2150            m_dynIndexBufferAllocator.compact();
21902151         }
21912152
21922153         m_dynamicIndexBufferHandle.free(_handle.idx);
r244646r244647
23312292         else
23322293         {
23332294            m_dynVertexBufferAllocator.free(uint64_t(dvb.m_handle.idx)<<32 | dvb.m_offset);
2334            if (m_dynVertexBufferAllocator.compact() )
2335            {
2336               for (uint64_t ptr = m_dynVertexBufferAllocator.remove(); 0 != ptr; ptr = m_dynVertexBufferAllocator.remove() )
2337               {
2338                  VertexBufferHandle handle = { uint16_t(ptr>>32) };
2339                  destroyVertexBuffer(handle);
2340               }
2341            }
2295            m_dynVertexBufferAllocator.compact();
23422296         }
23432297
23442298         m_dynamicVertexBufferHandle.free(_handle.idx);
r244646r244647
27182672
27192673      BGFX_API_FUNC(TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint8_t _skip, TextureInfo* _info) )
27202674      {
2721         TextureInfo ti;
2722         if (NULL == _info)
2675         if (NULL != _info)
27232676         {
2724            _info = &ti;
2677            ImageContainer imageContainer;
2678            if (imageParse(imageContainer, _mem->data, _mem->size) )
2679            {
2680               calcTextureSize(*_info
2681                  , (uint16_t)imageContainer.m_width
2682                  , (uint16_t)imageContainer.m_height
2683                  , (uint16_t)imageContainer.m_depth
2684                  , imageContainer.m_cubeMap
2685                  , imageContainer.m_numMips
2686                  , TextureFormat::Enum(imageContainer.m_format)
2687                  );
2688            }
2689            else
2690            {
2691               _info->format = TextureFormat::Unknown;
2692               _info->storageSize = 0;
2693               _info->width   = 0;
2694               _info->height  = 0;
2695               _info->depth   = 0;
2696               _info->numMips = 0;
2697               _info->bitsPerPixel = 0;
2698               _info->cubeMap = false;
2699            }
27252700         }
27262701
2727         ImageContainer imageContainer;
2728         if (imageParse(imageContainer, _mem->data, _mem->size) )
2729         {
2730            calcTextureSize(*_info
2731               , (uint16_t)imageContainer.m_width
2732               , (uint16_t)imageContainer.m_height
2733               , (uint16_t)imageContainer.m_depth
2734               , imageContainer.m_cubeMap
2735               , imageContainer.m_numMips
2736               , TextureFormat::Enum(imageContainer.m_format)
2737               );
2738         }
2739         else
2740         {
2741            _info->format = TextureFormat::Unknown;
2742            _info->storageSize = 0;
2743            _info->width   = 0;
2744            _info->height  = 0;
2745            _info->depth   = 0;
2746            _info->numMips = 0;
2747            _info->bitsPerPixel = 0;
2748            _info->cubeMap = false;
2749         }
2750
27512702         TextureHandle handle = { m_textureHandle.alloc() };
27522703         BX_WARN(isValid(handle), "Failed to allocate texture handle.");
27532704         if (isValid(handle) )
27542705         {
27552706            TextureRef& ref = m_textureRef[handle.idx];
27562707            ref.m_refCount = 1;
2757            ref.m_format   = uint8_t(_info->format);
27582708
27592709            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateTexture);
27602710            cmdbuf.write(handle);
r244646r244647
30883038         }
30893039      }
30903040
3091      BGFX_API_FUNC(void setViewRemap(uint8_t _id, uint8_t _num, const void* _remap) )
3092      {
3093         const uint32_t num = bx::uint32_min( (BGFX_CONFIG_MAX_VIEWS - _id) + _num, BGFX_CONFIG_MAX_VIEWS) - _id;
3094         if (NULL == _remap)
3095         {
3096            for (uint32_t ii = 0; ii < num; ++ii)
3097            {
3098               uint8_t id = uint8_t(ii+_id);
3099               m_viewRemap[id] = id;
3100            }
3101         }
3102         else
3103         {
3104            memcpy(&m_viewRemap[_id], _remap, num);
3105         }
3106      }
3107
31083041      BGFX_API_FUNC(void setMarker(const char* _marker) )
31093042      {
31103043         m_submit->setMarker(_marker);
r244646r244647
32573190         m_submit->setBuffer(_stage, dvb.m_handle, _access);
32583191      }
32593192
3260      BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) )
3193      BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access) )
32613194      {
3262         _format = TextureFormat::Count == _format ? TextureFormat::Enum(m_textureRef[_handle.idx].m_format) : _format;
3263         m_submit->setImage(_stage, _sampler, _handle, _mip, _access, _format);
3195         m_submit->setImage(_stage, _sampler, _handle, _mip, _format, _access);
32643196      }
32653197
3266      BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, Access::Enum _access, TextureFormat::Enum _format) )
3198      BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, TextureFormat::Enum _format, Access::Enum _access) )
32673199      {
32683200         BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
32693201         TextureHandle textureHandle = BGFX_INVALID_HANDLE;
r244646r244647
32753207            BX_CHECK(isValid(textureHandle), "Frame buffer texture %d is invalid.", _attachment);
32763208         }
32773209
3278         setImage(_stage, _sampler, textureHandle, 0, _access, _format);
3210         setImage(_stage, _sampler, textureHandle, 0, _format, _access);
32793211      }
32803212
32813213      BGFX_API_FUNC(uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags) )
r244646r244647
34053337      struct TextureRef
34063338      {
34073339         int16_t m_refCount;
3408         uint8_t m_format;
34093340      };
34103341
34113342      struct FrameBufferRef
r244646r244647
34273358      FrameBufferRef m_frameBufferRef[BGFX_CONFIG_MAX_FRAME_BUFFERS];
34283359      VertexDeclRef m_declRef;
34293360
3430      uint8_t m_viewRemap[BGFX_CONFIG_MAX_VIEWS];
34313361      FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS];
34323362      Clear m_clear[BGFX_CONFIG_MAX_VIEWS];
34333363
trunk/3rdparty/bgfx/src/bgfx_shader.sh
r244646r244647
189189vec3 vec3_splat(float _x) { return vec3(_x, _x, _x); }
190190vec4 vec4_splat(float _x) { return vec4(_x, _x, _x, _x); }
191191
192uvec2 uvec2_splat(uint _x) { return uvec2(_x, _x); }
193uvec3 uvec3_splat(uint _x) { return uvec3(_x, _x, _x); }
194uvec4 uvec4_splat(uint _x) { return uvec4(_x, _x, _x, _x); }
195
196192vec3 instMul(vec3 _vec, mat3 _mtx) { return mul(_mtx, _vec); }
197193vec3 instMul(mat3 _mtx, vec3 _vec) { return mul(_vec, _mtx); }
198194vec4 instMul(vec4 _vec, mat4 _mtx) { return mul(_mtx, _vec); }
r244646r244647
243239#   define vec2_splat(_x) vec2(_x)
244240#   define vec3_splat(_x) vec3(_x)
245241#   define vec4_splat(_x) vec4(_x)
246#   define uvec2_splat(_x) uvec2(_x)
247#   define uvec3_splat(_x) uvec3(_x)
248#   define uvec4_splat(_x) uvec4(_x)
249242
250243vec3 instMul(vec3 _vec, mat3 _mtx) { return mul(_vec, _mtx); }
251244vec3 instMul(mat3 _mtx, vec3 _vec) { return mul(_mtx, _vec); }
trunk/3rdparty/bgfx/src/config.h
r244646r244647
168168
169169#ifndef BGFX_CONFIG_MAX_VIEWS
170170// Do not change. Must be power of 2.
171#   define BGFX_CONFIG_MAX_VIEWS 256
171#   define BGFX_CONFIG_MAX_VIEWS 32
172172#endif // BGFX_CONFIG_MAX_VIEWS
173173
174174#define BGFX_CONFIG_MAX_VIEW_NAME_RESERVED 5
trunk/3rdparty/bgfx/src/glimports.h
r244646r244647
481481
482482GL_IMPORT      (true,  PFNGLINVALIDATEFRAMEBUFFERPROC,             glInvalidateFramebuffer, glDiscardFramebufferEXT);
483483
484#elif !BGFX_USE_GL_DYNAMIC_LIB
484#else
485485GL_IMPORT______(true,  PFNGLTEXIMAGE3DPROC,                        glTexImage3D);
486486GL_IMPORT______(true,  PFNGLTEXSUBIMAGE3DPROC,                     glTexSubImage3D);
487487GL_IMPORT______(true,  PFNGLCOMPRESSEDTEXIMAGE3DPROC,              glCompressedTexImage3D);
trunk/3rdparty/bgfx/src/renderer_d3d11.cpp
r244646r244647
665665#endif // BX_PLATFORM_WINRT
666666         BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Failed to create swap chain.");
667667
668         DX_CHECK(m_factory->MakeWindowAssociation(g_bgfxHwnd, 0
669            | DXGI_MWA_NO_WINDOW_CHANGES
670            | DXGI_MWA_NO_ALT_ENTER
671            ) );
672
673668         m_numWindows = 1;
674669
675670         if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
r244646r244647
731726         }
732727
733728         // Init reserved part of view name.
734         for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
729         for (uint8_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
735730         {
736731            char name[BGFX_CONFIG_MAX_VIEW_NAME_RESERVED+1];
737732            bx::snprintf(name, sizeof(name), "%3d  ", ii);
r244646r244647
30563051         int32_t numItems = _render->m_num;
30573052         for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
30583053         {
3059            const bool isCompute = key.decode(_render->m_sortKeys[item], _render->m_viewRemap);
3054            const bool isCompute = key.decode(_render->m_sortKeys[item]);
30603055            const bool viewChanged = 0
30613056               || key.m_view != view
30623057               || item == numItems
trunk/3rdparty/bgfx/src/renderer_d3d9.cpp
r244646r244647
570570         }
571571
572572         // Init reserved part of view name.
573         for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
573         for (uint8_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
574574         {
575575            char name[BGFX_CONFIG_MAX_VIEW_NAME_RESERVED+1];
576576            bx::snprintf(name, sizeof(name), "%3d  ", ii);
r244646r244647
28642864      {
28652865         for (uint32_t item = 0, numItems = _render->m_num; item < numItems; ++item)
28662866         {
2867            const bool isCompute = key.decode(_render->m_sortKeys[item], _render->m_viewRemap);
2867            const bool isCompute = key.decode(_render->m_sortKeys[item]);
28682868
28692869            if (isCompute)
28702870            {
trunk/3rdparty/bgfx/src/renderer_gl.cpp
r244646r244647
232232      { GL_DEPTH_COMPONENT32F,                       GL_DEPTH_COMPONENT,                          GL_FLOAT,                        false }, // D16F
233233      { GL_DEPTH_COMPONENT32F,                       GL_DEPTH_COMPONENT,                          GL_FLOAT,                        false }, // D24F
234234      { GL_DEPTH_COMPONENT32F,                       GL_DEPTH_COMPONENT,                          GL_FLOAT,                        false }, // D32F
235      { GL_STENCIL_INDEX8,                           GL_STENCIL_INDEX,                            GL_UNSIGNED_BYTE,                false }, // D0S8
235      { GL_STENCIL_INDEX8,                           GL_DEPTH_STENCIL,                            GL_UNSIGNED_BYTE,                false }, // D0S8
236236   };
237237   BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) );
238238
r244646r244647
430430         OES_texture_npot,
431431         OES_texture_half_float,
432432         OES_texture_half_float_linear,
433         OES_texture_stencil8,
434433         OES_vertex_array_object,
435434         OES_vertex_half_float,
436435         OES_vertex_type_10_10_10_2,
r244646r244647
591590      { "OES_texture_npot",                      false,                             true  },
592591      { "OES_texture_half_float",                false,                             true  },
593592      { "OES_texture_half_float_linear",         false,                             true  },
594      { "OES_texture_stencil8",                  false,                             true  },
595593      { "OES_vertex_array_object",               false,                             !BX_PLATFORM_IOS },
596594      { "OES_vertex_half_float",                 false,                             true  },
597595      { "OES_vertex_type_10_10_10_2",            false,                             true  },
r244646r244647
11671165            }
11681166         }
11691167
1170         if (BX_ENABLED(BX_PLATFORM_EMSCRIPTEN)
1171         ||  !isTextureFormatValid(TextureFormat::R8) )
1168         if (!isTextureFormatValid(TextureFormat::R8) )
11721169         {
11731170            // GL core has to use GL_R8 Issue#208, GLES2 has to use GL_LUMINANCE issue#226
11741171            s_textureFormat[TextureFormat::R8].m_internalFmt = GL_LUMINANCE;
r244646r244647
13881385         }
13891386
13901387         // Init reserved part of view name.
1391         for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
1388         for (uint8_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
13921389         {
13931390            bx::snprintf(s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED+1, "%3d  ", ii);
13941391         }
r244646r244647
25572554         GLSL_TYPE(GL_IMAGE_2D);
25582555         GLSL_TYPE(GL_IMAGE_3D);
25592556         GLSL_TYPE(GL_IMAGE_CUBE);
2560         GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_1D);
2561         GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_2D);
2562         GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_3D);
2563         GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_CUBE);
25642557      }
25652558
25662559#undef GLSL_TYPE
r244646r244647
26432636      case GL_IMAGE_2D:
26442637      case GL_IMAGE_3D:
26452638      case GL_IMAGE_CUBE:
2646      case GL_UNSIGNED_INT_IMAGE_1D:
2647      case GL_UNSIGNED_INT_IMAGE_2D:
2648      case GL_UNSIGNED_INT_IMAGE_3D:
2649      case GL_UNSIGNED_INT_IMAGE_CUBE:
26502639         return UniformType::Uniform1iv;
26512640      };
26522641
r244646r244647
28442833         case GL_IMAGE_2D:
28452834         case GL_IMAGE_3D:
28462835         case GL_IMAGE_CUBE:
2847         case GL_UNSIGNED_INT_IMAGE_1D:
2848         case GL_UNSIGNED_INT_IMAGE_2D:
2849         case GL_UNSIGNED_INT_IMAGE_3D:
2850         case GL_UNSIGNED_INT_IMAGE_CUBE:
28512836            BX_TRACE("Sampler #%d at location %d.", m_numSamplers, loc);
28522837            m_sampler[m_numSamplers] = loc;
28532838            m_numSamplers++;
r244646r244647
42944279         int32_t numItems = _render->m_num;
42954280         for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
42964281         {
4297            const bool isCompute   = key.decode(_render->m_sortKeys[item], _render->m_viewRemap);
4282            const bool isCompute   = key.decode(_render->m_sortKeys[item]);
42984283            const bool viewChanged = 0
42994284               || key.m_view != view
43004285               || item == numItems
trunk/3rdparty/bgfx/src/renderer_gl.h
r244646r244647
167167#   define GL_RGBA32F 0x8814
168168#endif // GL_RGBA32F
169169
170#ifndef GL_STENCIL_INDEX
171#   define GL_STENCIL_INDEX 0x1901
172#endif // GL_STENCIL_INDEX
173
174170#ifndef GL_RED
175171#   define GL_RED 0x1903
176172#endif // GL_RED
r244646r244647
476472#   define GL_IMAGE_CUBE 0x9050
477473#endif // GL_IMAGE_CUBE
478474
479#ifndef GL_UNSIGNED_INT_IMAGE_1D
480#   define GL_UNSIGNED_INT_IMAGE_1D 0x9062
481#endif // GL_UNSIGNED_INT_IMAGE_1D
482
483#ifndef GL_UNSIGNED_INT_IMAGE_2D
484#   define GL_UNSIGNED_INT_IMAGE_2D 0x9063
485#endif // GL_UNSIGNED_INT_IMAGE_2D
486
487#ifndef GL_UNSIGNED_INT_IMAGE_3D
488#   define GL_UNSIGNED_INT_IMAGE_3D 0x9064
489#endif // GL_UNSIGNED_INT_IMAGE_3D
490
491#ifndef GL_UNSIGNED_INT_IMAGE_CUBE
492#   define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
493#endif // GL_UNSIGNED_INT_IMAGE_CUBE
494
495475#ifndef GL_PROGRAM_INPUT
496476#   define GL_PROGRAM_INPUT 0x92E3
497477#endif // GL_PROGRAM_INPUT
r244646r244647
912892      GLint m_attributes[Attrib::Count]; // sparse
913893      GLint m_instanceData[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT];
914894
915       GLint m_sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
895       GLint m_sampler[BGFX_CONFIG_MAX_TEXTURES];
916896       uint8_t m_numSamplers;
917897
918898      ConstantBuffer* m_constantBuffer;
trunk/3rdparty/bx/scripts/genie.lua
r244646r244647
1717
1818   language "C++"
1919
20BX_DIR = path.getabsolute("..")
21local BX_BUILD_DIR = path.join(BX_DIR, ".build")
22local BX_THIRD_PARTY_DIR = path.join(BX_DIR, "3rdparty")
20BX_DIR = (path.getabsolute("..") .. "/")
21local BX_BUILD_DIR = (BX_DIR .. ".build/")
22local BX_THIRD_PARTY_DIR = (BX_DIR .. "3rdparty/")
2323
2424defines {
2525   "BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS=1"
r244646r244647
3939   uuid "8a653da8-23d6-11e3-acb4-887628d43830"
4040   kind "ConsoleApp"
4141
42   debugdir (path.join(BX_DIR, "tests"))
42   debugdir (BX_DIR .. "tests")
4343
4444   removeflags {
4545      "NoExceptions",
4646   }
4747
4848   includedirs {
49      path.join(BX_DIR, "include"),
50      path.join(BX_THIRD_PARTY_DIR, "UnitTest++/src"),
49      BX_DIR .. "include",
50      BX_THIRD_PARTY_DIR .. "UnitTest++/src/",
5151   }
5252
5353   links {
r244646r244647
5555   }
5656
5757   files {
58      path.join(BX_DIR, "tests/**.cpp"),
59      path.join(BX_DIR, "tests/**.H"),
58      BX_DIR .. "tests/**.cpp",
59      BX_DIR .. "tests/**.H",
6060   }
6161
6262   configuration { "vs*" }
trunk/3rdparty/bx/scripts/toolchain.lua
r244646r244647
33-- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
44--
55
6local bxDir = path.getabsolute("..")
6local bxDir = (path.getabsolute("..") .. "/")
77local naclToolchain = ""
88
99function toolchain(_buildDir, _libDir)
r244646r244647
7171   -- Avoid error when invoking genie --help.
7272   if (_ACTION == nil) then return false end
7373
74   location (path.join(_buildDir, "projects", _ACTION))
74   location (_buildDir .. "projects/" .. _ACTION)
7575
7676   if _ACTION == "clean" then
7777      os.rmdir(BUILD_DIR)
r244646r244647
107107         premake.gcc.cc  = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc"
108108         premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
109109         premake.gcc.ar  = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
110         location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
110         location (_buildDir .. "projects/" .. _ACTION .. "-android-arm")
111111      end
112112
113113      if "android-mips" == _OPTIONS["gcc"] then
r244646r244647
119119         premake.gcc.cc  = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-gcc"
120120         premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++"
121121         premake.gcc.ar  = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar"
122         location (path.join(_buildDir, "projects", _ACTION .. "-android-mips"))
122         location (_buildDir .. "projects/" .. _ACTION .. "-android-mips")
123123      end
124124
125125      if "android-x86" == _OPTIONS["gcc"] then
r244646r244647
131131         premake.gcc.cc  = "$(ANDROID_NDK_X86)/bin/i686-linux-android-gcc"
132132         premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++"
133133         premake.gcc.ar  = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
134         location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
134         location (_buildDir .. "projects/" .. _ACTION .. "-android-x86")
135135      end
136136
137137      if "asmjs" == _OPTIONS["gcc"] then
r244646r244647
144144         premake.gcc.cxx  = "$(EMSCRIPTEN)/em++"
145145         premake.gcc.ar   = "$(EMSCRIPTEN)/emar"
146146         premake.gcc.llvm = true
147         location (path.join(_buildDir, "projects", _ACTION .. "-asmjs"))
147         location (_buildDir .. "projects/" .. _ACTION .. "-asmjs")
148148      end
149149
150150      if "freebsd" == _OPTIONS["gcc"] then
151         location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
151         location (_buildDir .. "projects/" .. _ACTION .. "-freebsd")
152152      end
153153
154154      if "ios-arm" == _OPTIONS["gcc"] then
155155         premake.gcc.cc  = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
156156         premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
157157         premake.gcc.ar  = "ar"
158         location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm"))
158         location (_buildDir .. "projects/" .. _ACTION .. "-ios-arm")
159159      end
160160
161161      if "ios-simulator" == _OPTIONS["gcc"] then
162162         premake.gcc.cc  = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
163163         premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
164164         premake.gcc.ar  = "ar"
165         location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
165         location (_buildDir .. "projects/" .. _ACTION .. "-ios-simulator")
166166      end
167167
168168      if "linux-gcc" == _OPTIONS["gcc"] then
169         location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
169         location (_buildDir .. "projects/" .. _ACTION .. "-linux")
170170      end
171171
172172      if "linux-clang" == _OPTIONS["gcc"] then
173173         premake.gcc.cc  = "clang"
174174         premake.gcc.cxx = "clang++"
175175         premake.gcc.ar  = "ar"
176         location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
176         location (_buildDir .. "projects/" .. _ACTION .. "-linux-clang")
177177      end
178178
179179      if "mingw-gcc" == _OPTIONS["gcc"] then
180180         premake.gcc.cc  = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
181181         premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
182182         premake.gcc.ar  = "$(MINGW)/bin/ar"
183         location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
183         location (_buildDir .. "projects/" .. _ACTION .. "-mingw-gcc")
184184      end
185185
186186      if "mingw-clang" == _OPTIONS["gcc"] then
r244646r244647
189189         premake.gcc.ar   = "$(MINGW)/bin/ar"
190190--         premake.gcc.ar   = "$(CLANG)/bin/llvm-ar"
191191--         premake.gcc.llvm = true
192         location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
192         location (_buildDir .. "projects/" .. _ACTION .. "-mingw-clang")
193193      end
194194
195195      if "nacl" == _OPTIONS["gcc"] then
r244646r244647
208208         premake.gcc.cc  = naclToolchain .. "gcc"
209209         premake.gcc.cxx = naclToolchain .. "g++"
210210         premake.gcc.ar  = naclToolchain .. "ar"
211         location (path.join(_buildDir, "projects", _ACTION .. "-nacl"))
211         location (_buildDir .. "projects/" .. _ACTION .. "-nacl")
212212      end
213213
214214      if "nacl-arm" == _OPTIONS["gcc"] then
r244646r244647
227227         premake.gcc.cc  = naclToolchain .. "gcc"
228228         premake.gcc.cxx = naclToolchain .. "g++"
229229         premake.gcc.ar  = naclToolchain .. "ar"
230         location (path.join(_buildDir, "projects", _ACTION .. "-nacl-arm"))
230         location (_buildDir .. "projects/" .. _ACTION .. "-nacl-arm")
231231      end
232232
233233      if "osx" == _OPTIONS["gcc"] then
r244646r244647
237237            premake.gcc.cxx = osxToolchain .. "clang++"
238238            premake.gcc.ar  = osxToolchain .. "ar"
239239         end
240         location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
240         location (_buildDir .. "projects/" .. _ACTION .. "-osx")
241241      end
242242
243243      if "pnacl" == _OPTIONS["gcc"] then
r244646r244647
256256         premake.gcc.cc  = naclToolchain .. "clang"
257257         premake.gcc.cxx = naclToolchain .. "clang++"
258258         premake.gcc.ar  = naclToolchain .. "ar"
259         location (path.join(_buildDir, "projects", _ACTION .. "-pnacl"))
259         location (_buildDir .. "projects/" .. _ACTION .. "-pnacl")
260260      end
261261
262262      if "qnx-arm" == _OPTIONS["gcc"] then
r244646r244647
268268         premake.gcc.cc  = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc"
269269         premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++"
270270         premake.gcc.ar  = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar"
271         location (path.join(_buildDir, "projects", _ACTION .. "-qnx-arm"))
271         location (_buildDir .. "projects/" .. _ACTION .. "-qnx-arm")
272272      end
273273
274274      if "rpi" == _OPTIONS["gcc"] then
275         location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
275         location (_buildDir .. "projects/" .. _ACTION .. "-rpi")
276276      end
277277   elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then
278278
279279      if (_ACTION .. "-clang") == _OPTIONS["vs"] then
280280         premake.vstudio.toolset = ("LLVM-" .. _ACTION)
281         location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
281         location (_buildDir .. "projects/" .. _ACTION .. "-clang")
282282      end
283283
284284      if "winphone8" == _OPTIONS["vs"] then
285285         premake.vstudio.toolset = "v110_wp80"
286         location (path.join(_buildDir, "projects", _ACTION .. "-winphone8"))
286         location (_buildDir .. "projects/" .. _ACTION .. "-winphone8")
287287      end
288288
289289      if "winphone81" == _OPTIONS["vs"] then
290290         premake.vstudio.toolset = "v120_wp81"
291291         platforms { "ARM" }
292         location (path.join(_buildDir, "projects", _ACTION .. "-winphone81"))
292         location (_buildDir .. "projects/" .. _ACTION .. "-winphone81")
293293      end
294294   elseif _ACTION == "xcode4" then
295295
296296      if "osx" == _OPTIONS["xcode"] then
297297         premake.xcode.toolset = "macosx"
298         location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
298         location (_buildDir .. "projects/" .. _ACTION .. "-osx")
299299      end
300300      if "ios" == _OPTIONS["xcode"] then
301301         premake.xcode.toolset = "iphoneos"
302         location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
302         location (_buildDir .. "projects/" .. _ACTION .. "-ios")
303303      end
304304   end
305305
r244646r244647
334334      }
335335
336336   configuration { "vs*" }
337      includedirs { path.join(bxDir, "include/compat/msvc") }
337      includedirs { bxDir .. "include/compat/msvc" }
338338      defines {
339339         "WIN32",
340340         "_WIN32",
r244646r244647
355355      }
356356
357357   configuration { "vs2008" }
358      includedirs { path.join(bxDir .. "include/compat/msvc/pre1600") }
358      includedirs { bxDir .. "include/compat/msvc/pre1600" }
359359
360360   configuration { "x32", "vs*" }
361      targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
362      objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
361      targetdir (_buildDir .. "win32_" .. _ACTION .. "/bin")
362      objdir (_buildDir .. "win32_" .. _ACTION .. "/obj")
363363      libdirs {
364         path.join(_libDir, "lib/win32_" .. _ACTION),
364         _libDir .. "lib/win32_" .. _ACTION,
365365         "$(DXSDK_DIR)/lib/x86",
366366      }
367367
368368   configuration { "x64", "vs*" }
369369      defines { "_WIN64" }
370      targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
371      objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
370      targetdir (_buildDir .. "win64_" .. _ACTION .. "/bin")
371      objdir (_buildDir .. "win64_" .. _ACTION .. "/obj")
372372      libdirs {
373         path.join(_libDir, "lib/win64_" .. _ACTION),
373         _libDir .. "lib/win64_" .. _ACTION,
374374         "$(DXSDK_DIR)/lib/x64",
375375      }
376376
377377   configuration { "ARM", "vs*" }
378      targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
379      objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
378      targetdir (_buildDir .. "arm_" .. _ACTION .. "/bin")
379      objdir (_buildDir .. "arm_" .. _ACTION .. "/obj")
380380
381381   configuration { "vs*-clang" }
382382      buildoptions {
r244646r244647
384384      }
385385
386386   configuration { "x32", "vs*-clang" }
387      targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
388      objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
387      targetdir (_buildDir .. "win32_" .. _ACTION .. "-clang/bin")
388      objdir (_buildDir .. "win32_" .. _ACTION .. "-clang/obj")
389389
390390   configuration { "x64", "vs*-clang" }
391      targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
392      objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
391      targetdir (_buildDir .. "win64_" .. _ACTION .. "-clang/bin")
392      objdir (_buildDir .. "win64_" .. _ACTION .. "-clang/obj")
393393
394394   configuration { "winphone8*" }
395395      removeflags {
r244646r244647
399399
400400   configuration { "mingw-*" }
401401      defines { "WIN32" }
402      includedirs { path.join(bxDir, "include/compat/mingw") }
402      includedirs { bxDir .. "include/compat/mingw" }
403403      buildoptions {
404404         "-std=c++11",
405405         "-Wunused-value",
r244646r244647
416416      }
417417
418418   configuration { "x32", "mingw-gcc" }
419      targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
420      objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
419      targetdir (_buildDir .. "win32_mingw-gcc" .. "/bin")
420      objdir (_buildDir .. "win32_mingw-gcc" .. "/obj")
421421      libdirs {
422         path.join(_libDir, "lib/win32_mingw-gcc"),
422         _libDir .. "lib/win32_mingw-gcc",
423423         "$(DXSDK_DIR)/lib/x86",
424424      }
425425      buildoptions { "-m32" }
426426
427427   configuration { "x64", "mingw-gcc" }
428      targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
429      objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
428      targetdir (_buildDir .. "win64_mingw-gcc" .. "/bin")
429      objdir (_buildDir .. "win64_mingw-gcc" .. "/obj")
430430      libdirs {
431         path.join(_libDir, "lib/win64_mingw-gcc"),
431         _libDir .. "lib/win64_mingw-gcc",
432432         "$(DXSDK_DIR)/lib/x64",
433433         "$(GLES_X64_DIR)",
434434      }
r244646r244647
446446      }
447447
448448   configuration { "x32", "mingw-clang" }
449      targetdir (path.join(_buildDir, "win32_mingw-clang/bin"))
450      objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
449      targetdir (_buildDir .. "win32_mingw-clang" .. "/bin")
450      objdir (_buildDir .. "win32_mingw-clang" .. "/obj")
451451      libdirs {
452         path.join(_libDir, "lib/win32_mingw-clang"),
452         _libDir .. "lib/win32_mingw-clang",
453453         "$(DXSDK_DIR)/lib/x86",
454454      }
455455      buildoptions { "-m32" }
456456
457457   configuration { "x64", "mingw-clang" }
458      targetdir (path.join(_buildDir, "win64_mingw-clang/bin"))
459      objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
458      targetdir (_buildDir .. "win64_mingw-clang" .. "/bin")
459      objdir (_buildDir .. "win64_mingw-clang" .. "/obj")
460460      libdirs {
461         path.join(_libDir, "lib/win64_mingw-clang"),
461         _libDir .. "lib/win64_mingw-clang",
462462         "$(DXSDK_DIR)/lib/x64",
463463         "$(GLES_X64_DIR)",
464464      }
r244646r244647
487487      }
488488
489489   configuration { "linux-gcc", "x32" }
490      targetdir (path.join(_buildDir, "linux32_gcc/bin"))
491      objdir (path.join(_buildDir, "linux32_gcc/obj"))
492      libdirs { path.join(_libDir, "lib/linux32_gcc") }
490      targetdir (_buildDir .. "linux32_gcc" .. "/bin")
491      objdir (_buildDir .. "linux32_gcc" .. "/obj")
492      libdirs { _libDir .. "lib/linux32_gcc" }
493493      buildoptions {
494494         "-m32",
495495      }
496496
497497   configuration { "linux-gcc", "x64" }
498      targetdir (path.join(_buildDir, "linux64_gcc/bin"))
499      objdir (path.join(_buildDir, "linux64_gcc/obj"))
500      libdirs { path.join(_libDir, "lib/linux64_gcc") }
498      targetdir (_buildDir .. "linux64_gcc" .. "/bin")
499      objdir (_buildDir .. "linux64_gcc" .. "/obj")
500      libdirs { _libDir .. "lib/linux64_gcc" }
501501      buildoptions {
502502         "-m64",
503503      }
504504
505505   configuration { "linux-clang", "x32" }
506      targetdir (path.join(_buildDir, "linux32_clang/bin"))
507      objdir (path.join(_buildDir, "linux32_clang/obj"))
508      libdirs { path.join(_libDir, "lib/linux32_clang") }
506      targetdir (_buildDir .. "linux32_clang" .. "/bin")
507      objdir (_buildDir .. "linux32_clang" .. "/obj")
508      libdirs { _libDir .. "lib/linux32_clang" }
509509      buildoptions {
510510         "-m32",
511511      }
512512
513513   configuration { "linux-clang", "x64" }
514      targetdir (path.join(_buildDir, "linux64_clang/bin"))
515      objdir (path.join(_buildDir, "linux64_clang/obj"))
516      libdirs { path.join(_libDir, "lib/linux64_clang") }
514      targetdir (_buildDir .. "linux64_clang" .. "/bin")
515      objdir (_buildDir .. "linux64_clang" .. "/obj")
516      libdirs { _libDir .. "lib/linux64_clang" }
517517      buildoptions {
518518         "-m64",
519519      }
r244646r244647
559559      }
560560
561561   configuration { "android-arm" }
562      targetdir (path.join(_buildDir, "android-arm/bin"))
563      objdir (path.join(_buildDir, "android-arm/obj"))
562      targetdir (_buildDir .. "android-arm" .. "/bin")
563      objdir (_buildDir .. "android-arm" .. "/obj")
564564      libdirs {
565         path.join(_libDir, "lib/android-arm"),
565         _libDir .. "lib/android-arm",
566566         "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a",
567567      }
568568      includedirs {
569569         "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include",
570570      }
571571      buildoptions {
572         "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
572         "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm",
573573         "-mthumb",
574574         "-march=armv7-a",
575575         "-mfloat-abi=softfp",
r244646r244647
578578         "-Wundef",
579579      }
580580      linkoptions {
581         "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
582         path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
583         path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
581         "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm",
582         "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib/crtbegin_so.o",
583         "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib/crtend_so.o",
584584         "-march=armv7-a",
585585         "-Wl,--fix-cortex-a8",
586586      }
587587
588588   configuration { "android-mips" }
589      targetdir (path.join(_buildDir, "android-mips/bin"))
590      objdir (path.join(_buildDir, "android-mips/obj"))
589      targetdir (_buildDir .. "android-mips" .. "/bin")
590      objdir (_buildDir .. "android-mips" .. "/obj")
591591      libdirs {
592         path.join(_libDir, "lib/android-mips"),
592         _libDir .. "lib/android-mips",
593593         "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips",
594594      }
595595      includedirs {
596596         "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include",
597597      }
598598      buildoptions {
599         "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
599         "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips",
600600         "-Wunused-value",
601601         "-Wundef",
602602      }
603603      linkoptions {
604         "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
605         path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtbegin_so.o"),
606         path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtend_so.o"),
604         "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips",
605         "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtbegin_so.o",
606         "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtend_so.o",
607607      }
608608
609609   configuration { "android-x86" }
610      targetdir (path.join(_buildDir, "android-x86/bin"))
611      objdir (path.join(_buildDir, "android-x86/obj"))
610      targetdir (_buildDir .. "android-x86" .. "/bin")
611      objdir (_buildDir .. "android-x86" .. "/obj")
612612      libdirs {
613         path.join(_libDir, "lib/android-x86"),
613         _libDir .. "lib/android-x86",
614614         "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86",
615615      }
616616      includedirs {
617617         "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include",
618618      }
619619      buildoptions {
620         "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
620         "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86",
621621         "-march=i686",
622622         "-mtune=atom",
623623         "-mstackrealign",
r244646r244647
627627         "-Wundef",
628628      }
629629      linkoptions {
630         "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
631         path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
632         path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "/arch-x86/usr/lib/crtend_so.o"),
630         "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86",
631         "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib/crtbegin_so.o",
632         "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib/crtend_so.o",
633633      }
634634
635635   configuration { "asmjs" }
636      targetdir (path.join(_buildDir, "asmjs/bin"))
637      objdir (path.join(_buildDir, "asmjs/obj"))
638      libdirs { path.join(_libDir, "lib/asmjs") }
636      targetdir (_buildDir .. "asmjs" .. "/bin")
637      objdir (_buildDir .. "asmjs" .. "/obj")
638      libdirs { _libDir .. "lib/asmjs" }
639639      buildoptions {
640640         "-isystem$(EMSCRIPTEN)/system/include",
641641         "-isystem$(EMSCRIPTEN)/system/include/libc",
r244646r244647
644644      }
645645
646646   configuration { "freebsd" }
647      targetdir (path.join(_buildDir, "freebsd/bin"))
648      objdir (path.join(_buildDir, "freebsd/obj"))
649      libdirs { path.join(_libDir, "lib/freebsd") }
647      targetdir (_buildDir .. "freebsd" .. "/bin")
648      objdir (_buildDir .. "freebsd" .. "/obj")
649      libdirs { _libDir .. "lib/freebsd" }
650650      includedirs {
651         path.join(bxDir, "include/compat/freebsd"),
651         bxDir .. "include/compat/freebsd",
652652      }
653653
654654   configuration { "nacl or nacl-arm or pnacl" }
r244646r244647
664664      }
665665      includedirs {
666666         "$(NACL_SDK_ROOT)/include",
667         path.join(bxDir, "include/compat/nacl"),
667         bxDir .. "include/compat/nacl",
668668      }
669669
670670   configuration { "nacl" }
r244646r244647
678678      }
679679
680680   configuration { "x32", "nacl" }
681      targetdir (path.join(_buildDir, "nacl-x86/bin"))
682      objdir (path.join(_buildDir, "nacl-x86/obj"))
683      libdirs { path.join(_libDir, "lib/nacl-x86") }
681      targetdir (_buildDir .. "nacl-x86" .. "/bin")
682      objdir (_buildDir .. "nacl-x86" .. "/obj")
683      libdirs { _libDir .. "lib/nacl-x86" }
684684      linkoptions { "-melf32_nacl" }
685685
686686   configuration { "x32", "nacl", "Debug" }
r244646r244647
690690      libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" }
691691
692692   configuration { "x64", "nacl" }
693      targetdir (path.join(_buildDir, "nacl-x64/bin"))
694      objdir (path.join(_buildDir, "nacl-x64/obj"))
695      libdirs { path.join(_libDir, "lib/nacl-x64") }
693      targetdir (_buildDir .. "nacl-x64" .. "/bin")
694      objdir (_buildDir .. "nacl-x64" .. "/obj")
695      libdirs { _libDir .. "lib/nacl-x64" }
696696      linkoptions { "-melf64_nacl" }
697697
698698   configuration { "x64", "nacl", "Debug" }
r244646r244647
705705      buildoptions {
706706         "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
707707      }
708      targetdir (path.join(_buildDir, "nacl-arm/bin"))
709      objdir (path.join(_buildDir, "nacl-arm/obj"))
710      libdirs { path.join(_libDir, "lib/nacl-arm") }
708      targetdir (_buildDir .. "nacl-arm" .. "/bin")
709      objdir (_buildDir .. "nacl-arm" .. "/obj")
710      libdirs { _libDir .. "lib/nacl-arm" }
711711
712712   configuration { "nacl-arm", "Debug" }
713713      libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" }
r244646r244647
716716      libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" }
717717
718718   configuration { "pnacl" }
719      targetdir (path.join(_buildDir, "pnacl/bin"))
720      objdir (path.join(_buildDir, "pnacl/obj"))
721      libdirs { path.join(_libDir, "lib/pnacl") }
719      targetdir (_buildDir .. "pnacl" .. "/bin")
720      objdir (_buildDir .. "pnacl" .. "/obj")
721      libdirs { _libDir .. "lib/pnacl" }
722722
723723   configuration { "pnacl", "Debug" }
724724      libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" }
r244646r244647
727727      libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" }
728728
729729   configuration { "Xbox360" }
730      targetdir (path.join(_buildDir, "xbox360/bin"))
731      objdir (path.join(_buildDir, "xbox360/obj"))
732      includedirs { path.join(bxDir, "include/compat/msvc") }
733      libdirs { path.join(_libDir, "lib/xbox360") }
730      targetdir (_buildDir .. "xbox360" .. "/bin")
731      objdir (_buildDir .. "xbox360" .. "/obj")
732      includedirs { bxDir .. "include/compat/msvc" }
733      libdirs { _libDir .. "lib/xbox360" }
734734      defines {
735735         "NOMINMAX",
736736         "_XBOX",
737737      }
738738
739739   configuration { "osx", "x32" }
740      targetdir (path.join(_buildDir, "osx32_clang/bin"))
741      objdir (path.join(_buildDir, "osx32_clang/obj"))
742      libdirs { path.join(_libDir, "lib/osx32_clang") }
740      targetdir (_buildDir .. "osx32_clang" .. "/bin")
741      objdir (_buildDir .. "osx32_clang" .. "/obj")
742      libdirs { _libDir .. "lib/osx32_clang" }
743743      buildoptions {
744744         "-m32",
745745      }
746746
747747   configuration { "osx", "x64" }
748      targetdir (path.join(_buildDir, "osx64_clang/bin"))
749      objdir (path.join(_buildDir, "osx64_clang/obj"))
750      libdirs { path.join(_libDir, "lib/osx64_clang") }
748      targetdir (_buildDir .. "osx64_clang" .. "/bin")
749      objdir (_buildDir .. "osx64_clang" .. "/obj")
750      libdirs { _libDir .. "lib/osx64_clang" }
751751      buildoptions {
752752         "-m64",
753753      }
r244646r244647
759759         "-Wunused-value",
760760         "-Wundef",
761761      }
762      includedirs { path.join(bxDir, "include/compat/osx") }
762      includedirs { bxDir .. "include/compat/osx" }
763763
764764   configuration { "ios*" }
765765      linkoptions {
r244646r244647
770770         "-Wunused-value",
771771         "-Wundef",
772772      }
773      includedirs { path.join(bxDir, "include/compat/ios") }
773      includedirs { bxDir .. "include/compat/ios" }
774774
775775   configuration { "ios-arm" }
776      targetdir (path.join(_buildDir, "ios-arm/bin"))
777      objdir (path.join(_buildDir, "ios-arm/obj"))
778      libdirs { path.join(_libDir, "lib/ios-arm") }
776      targetdir (_buildDir .. "ios-arm" .. "/bin")
777      objdir (_buildDir .. "ios-arm" .. "/obj")
778      libdirs { _libDir .. "lib/ios-arm" }
779779      linkoptions {
780780         "-miphoneos-version-min=7.0",
781781         "-arch armv7",
r244646r244647
791791      }
792792
793793   configuration { "ios-simulator" }
794      targetdir (path.join(_buildDir, "ios-simulator/bin"))
795      objdir (path.join(_buildDir, "ios-simulator/obj"))
796      libdirs { path.join(_libDir, "lib/ios-simulator") }
794      targetdir (_buildDir .. "ios-simulator" .. "/bin")
795      objdir (_buildDir .. "ios-simulator" .. "/obj")
796      libdirs { _libDir .. "lib/ios-simulator" }
797797      linkoptions {
798798         "-mios-simulator-version-min=7.0",
799799         "-arch i386",
r244646r244647
809809      }
810810
811811   configuration { "qnx-arm" }
812      targetdir (path.join(_buildDir, "qnx-arm/bin"))
813      objdir (path.join(_buildDir, "qnx-arm/obj"))
814      libdirs { path.join(_libDir, "lib/qnx-arm") }
815--      includedirs { path.join(bxDir, "include/compat/qnx") }
812      targetdir (_buildDir .. "qnx-arm" .. "/bin")
813      objdir (_buildDir .. "qnx-arm" .. "/obj")
814      libdirs { _libDir .. "lib/qnx-arm" }
815--      includedirs { bxDir .. "include/compat/qnx" }
816816      buildoptions {
817817         "-std=c++0x",
818818         "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
r244646r244647
821821      }
822822
823823   configuration { "rpi" }
824      targetdir (path.join(_buildDir, "rpi/bin"))
825      objdir (path.join(_buildDir, "rpi/obj"))
824      targetdir (_buildDir .. "rpi" .. "/bin")
825      objdir (_buildDir .. "rpi" .. "/obj")
826826      libdirs {
827         path.join(_libDir, "lib/rpi"),
827         _libDir .. "lib/rpi",
828828         "/opt/vc/lib",
829829      }
830830      defines {
trunk/3rdparty/genie/README.md
r244646r244647
6161 - Added ability to configure Visual Studio toolset from GENie script.
6262 - Added `UnsignedChar` flag to force char to be unsigned.
6363 - Removed vs2002, vs2003, vs2005, Solaris, and Haiku support.
64 - Allow source files in the same project to have the same name. Added
65   `SingleOutputDir` flag to use single output directory (original behaviour).
64 - Allow source files in the same project to have the same name.
6665 - Added WinRT support.
6766 - Added `removeflags`, `removelinks`.
6867 - Added vs2015 support.
6968 - Added `targetsubdir`.
7069 - Added support for solution folders `group`.
71 - Added `options` section (and `ForceCpp` to enforce C++ compile even if
72   extension is for C files)
73 - Added `msgcompile`, `msgresource`, `msglinking` and `msgarchiving` as
74   overrides for make messages.
75 - Added `messageskip` list to disable some of compiler messages.
70 - Added `options` section (and `ForceCpp` to enforce C++ compile even if extension is for C files)
71 - Added `msgcompile`, `msgresource`, `msglinking` and `msgarchiving` as overrides for make messages
72 - Added `messageskip` list to disable some of compiler messages
7673
7774## Why fork?
7875
trunk/3rdparty/genie/src/actions/make/make_cpp.lua
r244646r244647
324324
325325      _p('  ALL_CPPFLAGS  += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), " "))
326326
327      _p('  ALL_CFLAGS    += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)))
328      _p('  ALL_CXXFLAGS  += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)))
327      _p('  ALL_CFLAGS    += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions)))
328      _p('  ALL_CXXFLAGS  += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions_cpp)))
329329
330330      _p('  ALL_RESFLAGS  += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',
331331              make.list(table.join(cc.getdefines(cfg.resdefines),
trunk/3rdparty/genie/src/base/api.lua
r244646r244647
4242         scope = "config",
4343      },
4444
45      buildoptions_c =
46      {
47         kind  = "list",
48         scope = "config",
49      },
50     
5145      buildoptions_cpp =
5246      {
5347         kind  = "list",
r244646r244647
136130               NoNativeWChar = 1,
137131               NoPCH = 1,
138132               NoRTTI = 1,
139               SingleOutputDir = 1,
140133               Optimize = 1,
141134               OptimizeSize = 1,
142135               OptimizeSpeed = 1,
trunk/3rdparty/genie/src/base/bake.lua
r244646r244647
380380                  dir = cfg_dirs[cfg][v]
381381                  if hit_counts[dir] == 1 then break end
382382               end
383               if (cfg.flags.SingleOutputDir) then
384                  cfg.objectsdir = cfg.objdir or cfg.project.objdir or "obj"
385               else
386                  cfg.objectsdir = path.getrelative(cfg.location, dir)
387               end
383               cfg.objectsdir = path.getrelative(cfg.location, dir)
388384            end
389385         end
390386      end     
trunk/3rdparty/genie/src/host/scripts.c
r244646r244647
6969   "m)\ntbl[item] = item\nend\nend\nend\nreturn tbl\nend\nlocal function removevalues(tbl, removes)\nfor i=#tbl,1,-1 do\n            for _, pattern in ipairs(removes) do\n                if pattern == tbl[i] then\n                    table.remove(tbl, i)\n                    break\n                end\n            end\n        end\nend\nlocal function mergeobject(dest, src)\nif not src then \nreturn \nend\nfor fieldname, value in pairs(src) do\nif not nocopy[fieldname] then\nlocal field = premake.fields[fieldname]\nif field then\nif type(value) == \"table\" then\ndest[fieldname] = mergefield(field.kind, dest[fieldname], value)\nif src.removes then\nremoves = src.removes[fieldname]\nif removes then\nremovevalues(dest[fieldname], removes)\nend\nend\nelse\ndest[fieldname] = value\nend\nelse\ndest[fieldname] = value\nend\nend\nend\nend\nlocal function merge(dest, obj, basis, terms, cfgname, pltname)\nlocal key = cfgname or \"\"\npltname = pltname or \"Native\"\nif pltname ~= \"Native\" then\nkey = key .. pltname\nend"
7070   "\nterms.config = (cfgname or \"\"):lower()\nterms.platform = pltname:lower()\nlocal cfg = {}\nmergeobject(cfg, basis[key])\nadjustpaths(obj.location, cfg)\nmergeobject(cfg, obj)\nif (cfg.kind) then \nterms['kind']=cfg.kind:lower()\nend\nfor _, blk in ipairs(obj.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, terms))then\nmergeobject(cfg, blk)\nif (cfg.kind and not cfg.terms.kind) then \ncfg.terms['kind'] = cfg.kind:lower()\nterms['kind'] = cfg.kind:lower()\nend\nend\nend\ncfg.name      = cfgname\ncfg.platform  = pltname\nfor k,v in pairs(terms) do\ncfg.terms[k] =v\nend\ndest[key] = cfg\nend\nlocal function collapse(obj, basis)\nlocal result = {}\nbasis = basis or {}\nlocal sln = obj.solution or obj\nlocal terms = premake.getactiveterms()\nmerge(result, obj, basis, terms)--this adjusts terms\nfor _, cfgname in ipairs(sln.configurations) do\nlocal terms_local = {}\nfor k,v in pairs(terms)do terms_local[k]=v end\nmerge(result, obj, basis, terms_local, cfgname, \"Native\")--terms cam also be adjusted here\nf"
7171   "or _, pltname in ipairs(sln.platforms or {}) do\nif pltname ~= \"Native\" then\nmerge(result, obj, basis,terms_local, cfgname, pltname)--terms also here\nend\nend\nend\nreturn result\nend\nlocal function builduniquedirs()\nlocal num_variations = 4\nlocal cfg_dirs = {}\nlocal hit_counts = {}\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dirs = { }\ndirs[1] = path.getabsolute(path.join(cfg.location, cfg.objdir or cfg.project.objdir or \"obj\"))\ndirs[2] = path.join(dirs[1], iif(cfg.platform == \"Native\", \"\", cfg.platform))\ndirs[3] = path.join(dirs[2], cfg.name)\ndirs[4] = path.join(dirs[3], cfg.project.name)\ncfg_dirs[cfg] = dirs\nlocal start = iif(cfg.name, 2, 1)\nfor v = start, num_variations do\nlocal d = dirs[v]\nhit_counts[d] = (hit_counts[d] or 0) + 1\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dir\nlocal start = iif(cfg.name, "
72   "2, 1)\nfor v = start, num_variations do\ndir = cfg_dirs[cfg][v]\nif hit_counts[dir] == 1 then break end\nend\nif (cfg.flags.SingleOutputDir) then\ncfg.objectsdir = cfg.objdir or cfg.project.objdir or \"obj\"\nelse\ncfg.objectsdir = path.getrelative(cfg.location, dir)\nend\nend\nend\nend\nend\nlocal function buildtargets()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\ncfg.buildtarget = premake.gettarget(cfg, \"build\", pathstyle, namestyle, cfg.system)\ncfg.linktarget  = premake.gettarget(cfg, \"link\",  pathstyle, namestyle, cfg.system)\nif pathstyle == \"windows\" then\ncfg.objectsdir = path.translate(cfg.objectsdir, \"\\\\\")\nend\nend\nend\nend\nend\n  local function getCfgKind(cfg)\n  if(cfg.kind) then\n  return cfg.kind;\n  end\n  \n  if(cfg.project.__configs[\"\"] and cfg.project.__configs[\"\"].kind) then\n  return cfg.project.__configs[\"\"].k"
73   "ind;\n  end\n  \n  return nil\n  end\n  \n  local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage)\n  if(not cfg) then return end\n  \n  local foundUsePrjs = {};\n  for _, useName in ipairs(cfg[searchField]) do\n  local testName = useName:lower();\n  if((not foundList[testName])) then\n  local theProj = nil;\n  local theUseProj = nil;\n  for _, prj in ipairs(cfg.project.solution.projects) do\n  if (prj.name:lower() == testName) then\n  if(prj.usage) then\n  theUseProj = prj;\n  else\n  theProj = prj;\n  end\n  end\n  end\n  \n  --Must connect to a usage project.\n  if(theUseProj) then\n  foundList[testName] = true;\n  local prjEntry = {\n  name = testName,\n  proj = theProj,\n  usageProj = theUseProj,\n  bLinkageOnly = bLinkage,\n  };\n  dstArray[testName] = prjEntry;\n  table.insert(foundUsePrjs, theUseProj);\n  end\n  end\n  end\n  \n  for _, usePrj in ipairs(foundUsePrjs) do\n  --Links can only recurse through static libraries.\n  if((searchField ~= \"links\") or\n  (getCfgKind("
74   "usePrj.__configs[cfgname]) == \"StaticLib\")) then\n  getprojrec(dstArray, foundList, usePrj.__configs[cfgname],\n  cfgname, searchField, bLinkage);\n  end\n  end\n  end\n  \n  --\n  -- This function will recursively get all projects that the given configuration has in its \"uses\"\n  -- field. The return values are a list of tables. Each table in that list contains the following:\n  --name = The lowercase name of the project.\n  --proj = The project. Can be nil if it is usage-only.\n  --usageProj = The usage project. Can't be nil, as using a project that has no\n  -- usage project is not put into the list.\n  --bLinkageOnly = If this is true, then only the linkage information should be copied.\n  -- The recursion will only look at the \"uses\" field on *usage* projects.\n  -- This function will also add projects to the list that are mentioned in the \"links\"\n  -- field of usage projects. These will only copy linker information, but they will recurse.\n  -- through other \"links\" fields.\n  --\n  local func"
75   "tion getprojectsconnections(cfg, cfgname)\n  local dstArray = {};\n  local foundList = {};\n  foundList[cfg.project.name:lower()] = true;\n  \n  --First, follow the uses recursively.\n  getprojrec(dstArray, foundList, cfg, cfgname, \"uses\", false);\n  \n  --Next, go through all of the usage projects and recursively get their links.\n  --But only if they're not already there. Get the links as linkage-only.\n  local linkArray = {};\n  for prjName, prjEntry in pairs(dstArray) do\n  getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname, \n  \"links\", true);\n  end\n  \n  --Copy from linkArray into dstArray.\n  for prjName, prjEntry in pairs(linkArray) do\n  dstArray[prjName] = prjEntry;\n  end\n  \n  return dstArray;\n  end\n  \n  \n  local function isnameofproj(cfg, strName)\n  local sln = cfg.project.solution;\n  local strTest = strName:lower();\n  for prjIx, prj in ipairs(sln.projects) do\n  if (prj.name:lower() == strTest) then\n  return true;\n  end\n  end\n  \n  return false;\n  e"
76   "nd\n  --\n  -- Copies the field from dstCfg to srcCfg.\n  --\n  local function copydependentfield(srcCfg, dstCfg, strSrcField)\n  local srcField = premake.fields[strSrcField];\n  local strDstField = strSrcField;\n  \n  if type(srcCfg[strSrcField]) == \"table\" then\n  --handle paths.\n  if (srcField.kind == \"dirlist\" or srcField.kind == \"filelist\") and\n  (not keeprelative[strSrcField]) then\n  for i,p in ipairs(srcCfg[strSrcField]) do\n  table.insert(dstCfg[strDstField],\n  path.rebase(p, srcCfg.project.location, dstCfg.project.location))\n  end\n  else\n  if(strSrcField == \"links\") then\n  for i,p in ipairs(srcCfg[strSrcField]) do\n  if(not isnameofproj(dstCfg, p)) then\n  table.insert(dstCfg[strDstField], p)\n  else\n  printf(\"Failed to copy '%s' from proj '%s'.\",\n  p, srcCfg.project.name);\n  end\n  end\n  else\n  for i,p in ipairs(srcCfg[strSrcField]) do\n  table.insert(dstCfg[strDstField], p)\n  end\n  end\n  end\n  else\n  if(srcField.kind == \"path\" and (not keeprelative[strSrcField])) then\n"
77   "  dstCfg[strDstField] = path.rebase(srcCfg[strSrcField],\n  prj.location, dstCfg.project.location);\n  else\n  dstCfg[strDstField] = srcCfg[strSrcField];\n  end\n  end\n  end\n  \n  --\n  -- This function will take the list of project entries and apply their usage project data\n  -- to the given configuration. It will copy compiling information for the projects that are\n  -- not listed as linkage-only. It will copy the linking information for projects only if\n  -- the source project is not a static library. It won't copy linking information\n  -- if the project is in this solution; instead it will add that project to the configuration's\n  -- links field, expecting that Premake will handle the rest.\n  --\n  local function copyusagedata(cfg, cfgname, linkToProjs)\n  local myPrj = cfg.project;\n  local bIsStaticLib = (getCfgKind(cfg) == \"StaticLib\");\n  \n  for prjName, prjEntry in pairs(linkToProjs) do\n  local srcPrj = prjEntry.usageProj;\n  local srcCfg = srcPrj.__configs[cfgname];\n  \n  for name, field"
78   " in pairs(premake.fields) do\n  if(srcCfg[name]) then\n  if(field.usagecopy) then\n  if(not prjEntry.bLinkageOnly) then\n  copydependentfield(srcCfg, cfg, name)\n  end\n  elseif(field.linkagecopy) then\n  --Copy the linkage data if we're building a non-static thing\n  --and this is a pure usage project. If it's not pure-usage, then\n  --we will simply put the project's name in the links field later.\n  if((not bIsStaticLib) and (not prjEntry.proj)) then\n  copydependentfield(srcCfg, cfg, name)\n  end\n  end\n  end\n  end\n  \n  if((not bIsStaticLib) and prjEntry.proj) then\n  table.insert(cfg.links, prjEntry.proj.name);\n  end\n  end\n  end\nfunction premake.bake.buildconfigs()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nprj.location = prj.location or sln.location or prj.basedir\nadjustpaths(prj.location, prj)\nfor _, blk in ipairs(prj.blocks) do\nadjustpaths(prj.location, blk)\nend\nend\nsln.location = sln.location or sln.basedir\nend\nfor sln in premake.solution.each() do\n"
79   "local basis = collapse(sln)\nfor _, prj in ipairs(sln.projects) do\nprj.__configs = collapse(prj, basis)\nfor _, cfg in pairs(prj.__configs) do\nbake.postprocess(prj, cfg)\nend\nend\nend\nfor sln in premake.solution.each() do\nfor prjIx, prj in ipairs(sln.projects) do\nif(not prj.usage) then\nfor cfgname, cfg in pairs(prj.__configs) do\nlocal usesPrjs = getprojectsconnections(cfg, cfgname);\ncopyusagedata(cfg, cfgname, usesPrjs)\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nlocal removeList = {};\nfor index, prj in ipairs(sln.projects) do\nif(prj.usage) then\ntable.insert(removeList, 1, index); --Add in reverse order.\nend\nend\nfor _, index in ipairs(removeList) do\ntable.remove(sln.projects, index);\nend\nend\nbuilduniquedirs()\nbuildtargets(cfg)\nend\nfunction premake.bake.postprocess(prj, cfg)\ncfg.project   = prj\ncfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true)\ncfg.longname  = premake.getconfigname(cfg.name, cfg.platform)\ncfg.location = cfg.location or cfg.basedir\nloca"
80   "l platform = premake.platforms[cfg.platform]\nif platform.iscrosscompiler then\ncfg.system = cfg.platform\nelse\ncfg.system = os.get()\nend\nif cfg.kind == \"SharedLib\" and platform.nosharedlibs then\ncfg.kind = \"StaticLib\"\nend\nlocal files = { }\nfor _, fname in ipairs(cfg.files) do\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (fname == exclude)\nif (excluded) then break end\nend\nif (not excluded) then\ntable.insert(files, fname)\nend\nend\ncfg.files = files\nfor name, field in pairs(premake.fields) do\nif field.isflags then\nlocal values = cfg[name]\nfor _, flag in ipairs(values) do values[flag] = true end\nend\nend\ncfg.__fileconfigs = { }\nfor _, fname in ipairs(cfg.files) do\ncfg.terms.required = fname:lower()\nlocal fcfg = {}\nfor _, blk in ipairs(cfg.project.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then\nmergeobject(fcfg, blk)\nend\nend\nfcfg.name = fname\ncfg.__fileconfigs[fname] = fcfg\ntable.insert(cfg.__fileconfigs, fcfg)\nend\nend\n",
72   "2, 1)\nfor v = start, num_variations do\ndir = cfg_dirs[cfg][v]\nif hit_counts[dir] == 1 then break end\nend\ncfg.objectsdir = path.getrelative(cfg.location, dir)\nend\nend\nend\nend\nlocal function buildtargets()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\ncfg.buildtarget = premake.gettarget(cfg, \"build\", pathstyle, namestyle, cfg.system)\ncfg.linktarget  = premake.gettarget(cfg, \"link\",  pathstyle, namestyle, cfg.system)\nif pathstyle == \"windows\" then\ncfg.objectsdir = path.translate(cfg.objectsdir, \"\\\\\")\nend\nend\nend\nend\nend\n  local function getCfgKind(cfg)\n  if(cfg.kind) then\n  return cfg.kind;\n  end\n  \n  if(cfg.project.__configs[\"\"] and cfg.project.__configs[\"\"].kind) then\n  return cfg.project.__configs[\"\"].kind;\n  end\n  \n  return nil\n  end\n  \n  local function getprojrec(dstArray, foundList, cfg, cfgname, searc"
73   "hField, bLinkage)\n  if(not cfg) then return end\n  \n  local foundUsePrjs = {};\n  for _, useName in ipairs(cfg[searchField]) do\n  local testName = useName:lower();\n  if((not foundList[testName])) then\n  local theProj = nil;\n  local theUseProj = nil;\n  for _, prj in ipairs(cfg.project.solution.projects) do\n  if (prj.name:lower() == testName) then\n  if(prj.usage) then\n  theUseProj = prj;\n  else\n  theProj = prj;\n  end\n  end\n  end\n  \n  --Must connect to a usage project.\n  if(theUseProj) then\n  foundList[testName] = true;\n  local prjEntry = {\n  name = testName,\n  proj = theProj,\n  usageProj = theUseProj,\n  bLinkageOnly = bLinkage,\n  };\n  dstArray[testName] = prjEntry;\n  table.insert(foundUsePrjs, theUseProj);\n  end\n  end\n  end\n  \n  for _, usePrj in ipairs(foundUsePrjs) do\n  --Links can only recurse through static libraries.\n  if((searchField ~= \"links\") or\n  (getCfgKind(usePrj.__configs[cfgname]) == \"StaticLib\")) then\n  getprojrec(dstArray, foundList, usePrj.__configs[cfgname"
74   "],\n  cfgname, searchField, bLinkage);\n  end\n  end\n  end\n  \n  --\n  -- This function will recursively get all projects that the given configuration has in its \"uses\"\n  -- field. The return values are a list of tables. Each table in that list contains the following:\n  --name = The lowercase name of the project.\n  --proj = The project. Can be nil if it is usage-only.\n  --usageProj = The usage project. Can't be nil, as using a project that has no\n  -- usage project is not put into the list.\n  --bLinkageOnly = If this is true, then only the linkage information should be copied.\n  -- The recursion will only look at the \"uses\" field on *usage* projects.\n  -- This function will also add projects to the list that are mentioned in the \"links\"\n  -- field of usage projects. These will only copy linker information, but they will recurse.\n  -- through other \"links\" fields.\n  --\n  local function getprojectsconnections(cfg, cfgname)\n  local dstArray = {};\n  local foundList = {};\n  foundList[cfg.pr"
75   "oject.name:lower()] = true;\n  \n  --First, follow the uses recursively.\n  getprojrec(dstArray, foundList, cfg, cfgname, \"uses\", false);\n  \n  --Next, go through all of the usage projects and recursively get their links.\n  --But only if they're not already there. Get the links as linkage-only.\n  local linkArray = {};\n  for prjName, prjEntry in pairs(dstArray) do\n  getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname, \n  \"links\", true);\n  end\n  \n  --Copy from linkArray into dstArray.\n  for prjName, prjEntry in pairs(linkArray) do\n  dstArray[prjName] = prjEntry;\n  end\n  \n  return dstArray;\n  end\n  \n  \n  local function isnameofproj(cfg, strName)\n  local sln = cfg.project.solution;\n  local strTest = strName:lower();\n  for prjIx, prj in ipairs(sln.projects) do\n  if (prj.name:lower() == strTest) then\n  return true;\n  end\n  end\n  \n  return false;\n  end\n  --\n  -- Copies the field from dstCfg to srcCfg.\n  --\n  local function copydependentfield(srcCfg, dstC"
76   "fg, strSrcField)\n  local srcField = premake.fields[strSrcField];\n  local strDstField = strSrcField;\n  \n  if type(srcCfg[strSrcField]) == \"table\" then\n  --handle paths.\n  if (srcField.kind == \"dirlist\" or srcField.kind == \"filelist\") and\n  (not keeprelative[strSrcField]) then\n  for i,p in ipairs(srcCfg[strSrcField]) do\n  table.insert(dstCfg[strDstField],\n  path.rebase(p, srcCfg.project.location, dstCfg.project.location))\n  end\n  else\n  if(strSrcField == \"links\") then\n  for i,p in ipairs(srcCfg[strSrcField]) do\n  if(not isnameofproj(dstCfg, p)) then\n  table.insert(dstCfg[strDstField], p)\n  else\n  printf(\"Failed to copy '%s' from proj '%s'.\",\n  p, srcCfg.project.name);\n  end\n  end\n  else\n  for i,p in ipairs(srcCfg[strSrcField]) do\n  table.insert(dstCfg[strDstField], p)\n  end\n  end\n  end\n  else\n  if(srcField.kind == \"path\" and (not keeprelative[strSrcField])) then\n  dstCfg[strDstField] = path.rebase(srcCfg[strSrcField],\n  prj.location, dstCfg.project.location);\n  else\n "
77   " dstCfg[strDstField] = srcCfg[strSrcField];\n  end\n  end\n  end\n  \n  --\n  -- This function will take the list of project entries and apply their usage project data\n  -- to the given configuration. It will copy compiling information for the projects that are\n  -- not listed as linkage-only. It will copy the linking information for projects only if\n  -- the source project is not a static library. It won't copy linking information\n  -- if the project is in this solution; instead it will add that project to the configuration's\n  -- links field, expecting that Premake will handle the rest.\n  --\n  local function copyusagedata(cfg, cfgname, linkToProjs)\n  local myPrj = cfg.project;\n  local bIsStaticLib = (getCfgKind(cfg) == \"StaticLib\");\n  \n  for prjName, prjEntry in pairs(linkToProjs) do\n  local srcPrj = prjEntry.usageProj;\n  local srcCfg = srcPrj.__configs[cfgname];\n  \n  for name, field in pairs(premake.fields) do\n  if(srcCfg[name]) then\n  if(field.usagecopy) then\n  if(not prjEntry.bLinkageO"
78   "nly) then\n  copydependentfield(srcCfg, cfg, name)\n  end\n  elseif(field.linkagecopy) then\n  --Copy the linkage data if we're building a non-static thing\n  --and this is a pure usage project. If it's not pure-usage, then\n  --we will simply put the project's name in the links field later.\n  if((not bIsStaticLib) and (not prjEntry.proj)) then\n  copydependentfield(srcCfg, cfg, name)\n  end\n  end\n  end\n  end\n  \n  if((not bIsStaticLib) and prjEntry.proj) then\n  table.insert(cfg.links, prjEntry.proj.name);\n  end\n  end\n  end\nfunction premake.bake.buildconfigs()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nprj.location = prj.location or sln.location or prj.basedir\nadjustpaths(prj.location, prj)\nfor _, blk in ipairs(prj.blocks) do\nadjustpaths(prj.location, blk)\nend\nend\nsln.location = sln.location or sln.basedir\nend\nfor sln in premake.solution.each() do\nlocal basis = collapse(sln)\nfor _, prj in ipairs(sln.projects) do\nprj.__configs = collapse(prj, basis)\nfor "
79   "_, cfg in pairs(prj.__configs) do\nbake.postprocess(prj, cfg)\nend\nend\nend\nfor sln in premake.solution.each() do\nfor prjIx, prj in ipairs(sln.projects) do\nif(not prj.usage) then\nfor cfgname, cfg in pairs(prj.__configs) do\nlocal usesPrjs = getprojectsconnections(cfg, cfgname);\ncopyusagedata(cfg, cfgname, usesPrjs)\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nlocal removeList = {};\nfor index, prj in ipairs(sln.projects) do\nif(prj.usage) then\ntable.insert(removeList, 1, index); --Add in reverse order.\nend\nend\nfor _, index in ipairs(removeList) do\ntable.remove(sln.projects, index);\nend\nend\nbuilduniquedirs()\nbuildtargets(cfg)\nend\nfunction premake.bake.postprocess(prj, cfg)\ncfg.project   = prj\ncfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true)\ncfg.longname  = premake.getconfigname(cfg.name, cfg.platform)\ncfg.location = cfg.location or cfg.basedir\nlocal platform = premake.platforms[cfg.platform]\nif platform.iscrosscompiler then\ncfg.system = cfg.platform\nels"
80   "e\ncfg.system = os.get()\nend\nif cfg.kind == \"SharedLib\" and platform.nosharedlibs then\ncfg.kind = \"StaticLib\"\nend\nlocal files = { }\nfor _, fname in ipairs(cfg.files) do\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (fname == exclude)\nif (excluded) then break end\nend\nif (not excluded) then\ntable.insert(files, fname)\nend\nend\ncfg.files = files\nfor name, field in pairs(premake.fields) do\nif field.isflags then\nlocal values = cfg[name]\nfor _, flag in ipairs(values) do values[flag] = true end\nend\nend\ncfg.__fileconfigs = { }\nfor _, fname in ipairs(cfg.files) do\ncfg.terms.required = fname:lower()\nlocal fcfg = {}\nfor _, blk in ipairs(cfg.project.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then\nmergeobject(fcfg, blk)\nend\nend\nfcfg.name = fname\ncfg.__fileconfigs[fname] = fcfg\ntable.insert(cfg.__fileconfigs, fcfg)\nend\nend\n",
8181
8282   /* base/api.lua */
83   "premake.fields =\n{\narchivesplit_size =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nbasedir =\n{\nkind  = \"path\",\nscope = \"container\",\n},\nbuildaction =\n{\nkind  = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n},\nbuildoptions =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nbuildoptions_c =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nbuildoptions_cpp =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nconfigurations =\n{\nkind  = \"list\",\nscope = \"solution\",\n},\ndebugargs =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndebugdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ndebugenvs  =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndefines =\n{\nkind  = \"list\",\nscope = \"config\",\n},\ndeploymentoptions =\n{\nkind  = \"list\",\nscope = \"config\",\nusagecopy = true,\n},\nexcludes =\n{\nkind  = \"filelist\",\nscope = \"config\",\n},\nfiles =\n{\nkind  = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind  = \"list\",\nscope = "
84   "\"config\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_flags = {\nATL = 1,\nDebugEnvsDontMerge = 1,\nDebugEnvsInherit = 1,\nEnableMinimalRebuild = 1,\nEnableSSE = 1,\nEnableSSE2 = 1,\nExtraWarnings = 1,\nFatalWarnings = 1,\nFloatFast = 1,\nFloatStrict = 1,\nManaged = 1,\nMFC = 1,\nNativeWChar = 1,\nNo64BitChecks = 1,\nNoEditAndContinue = 1,\nNoExceptions = 1,\nNoFramePointer = 1,\nNoImportLib = 1,\nNoIncrementalLink = 1,\nNoManifest = 1,\nNoMultiProcessorCompilation = 1,\nNoNativeWChar = 1,\nNoPCH = 1,\nNoRTTI = 1,\nSingleOutputDir = 1,\nOptimize = 1,\nOptimizeSize = 1,\nOptimizeSpeed = 1,\nSEH = 1,\nStaticATL = 1,\nStaticRuntime = 1,\nSymbols = 1,\nUnicode = 1,\nUnsafe = 1,\nUnsignedChar = 1,\nWinMain = 1,\n}\nlocal englishToAmericanSpelling =\n{\noptimise = 'optimize',\noptimisesize = 'optimizesize',\noptimisespeed = 'optimizespeed',\n}\nlocal lowervalue = value:lower()\nlowervalue = englishToAmericanSpelling[lowervalue] or lowervalue\nfor v, _ in pairs(allowed_flags) do\ni"
85   "f v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid flag\"\nend,\n},\nframework =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"1.0\",\n\"1.1\",\n\"2.0\",\n\"3.0\",\n\"3.5\",\n\"4.0\",\n\"4.5\",\n}\n},\nforcedincludes = \n{\nkind  = \"absolutefilelist\",\nscope = \"config\",\n},\nimagepath =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimageoptions =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nimplibdir =\n{\nkind  = \"path\",\nscope = \"config\",\n},\nimplibextension =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nimplibname =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nimplibprefix =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nimplibsuffix =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nincludedirs =\n{\nkind  = \"dirlist\",\nscope = \"config\",\nusagecopy = true,\n},\nkind =\n{\nkind  = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\"\n}\n},\nlanguage =\n{\nkind  = \"string\",\nsco"
86   "pe = \"container\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\"\n}\n},\nlibdirs =\n{\nkind  = \"dirlist\",\nscope = \"config\",\nlinkagecopy = true,\n},\nlinkoptions =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nlinks =\n{\nkind  = \"list\",\nscope = \"config\",\nallowed = function(value)\nif value:find('/', nil, true) then\nvalue = path.getabsolute(value)\nend\nreturn value\nend,\nlinkagecopy = true,\n},\nlocation =\n{\nkind  = \"path\",\nscope = \"container\",\n},\nmakesettings =\n{\nkind = \"list\",\nscope = \"config\",\n},\nmessageskip =\n{\nkind  = \"list\",\nscope = \"solution\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_messages = {\nSkipCreatingMessage = 1,\nSkipBuildingMessage = 1,\nSkipCleaningMessage = 1,\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_messages) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid message to skip\"\nend,\n},\nmsgarchiving =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nmsgcompile =\n{\n"
87   "kind  = \"string\",\nscope = \"config\",\n},\nmsgresource =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nmsglinking =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nobjdir =\n{\nkind  = \"path\",\nscope = \"config\",\n},\noptions =\n{\nkind  = \"list\",\nscope = \"container\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_options = {\nForceCPP = 1,\nArchiveSplit = 1\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_options) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid option\"\nend,\n},\npchheader =\n{\nkind  = \"string\",\nscope = \"config\",\n},\npchsource =\n{\nkind  = \"path\",\nscope = \"config\",\n},\nplatforms =\n{\nkind  = \"list\",\nscope = \"solution\",\nallowed = table.keys(premake.platforms),\n},\npostbuildcommands =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nprebuildcommands =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nprelinkcommands =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nresdefines =\n{\n"
88   "kind  = \"list\",\nscope = \"config\",\n},\nresincludedirs =\n{\nkind  = \"dirlist\",\nscope = \"config\",\n},\nresoptions =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nstartproject =\n{\nkind  = \"string\",\nscope = \"solution\",\n},\ntargetdir =\n{\nkind  = \"path\",\nscope = \"config\",\n},\ntargetsubdir =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntargetextension =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntargetname =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntargetprefix =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntargetsuffix =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntrimpaths =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nuuid =\n{\nkind  = \"string\",\nscope = \"container\",\nallowed = function(value)\nlocal ok = true\nif (#value ~= 36) then ok = false end\nfor i=1,36 do\nlocal ch = value:sub(i,i)\nif (not ch:find(\"[ABCDEFabcdef0123456789-]\")) then ok = false end\nend\nif (value:sub(9,9) ~= \"-\")   then ok = false end\nif (value:sub(14,14) ~= \"-\")"
89   " then ok = false end\nif (value:sub(19,19) ~= \"-\") then ok = false end\nif (value:sub(24,24) ~= \"-\") then ok = false end\nif (not ok) then\nreturn nil, \"invalid UUID\"\nend\nreturn value:upper()\nend\n},\nuses =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nvpaths =\n{\nkind = \"keypath\",\nscope = \"container\",\n},\n}\nfunction premake.checkvalue(value, allowed)\nif (allowed) then\nif (type(allowed) == \"function\") then\nreturn allowed(value)\nelse\nfor _,v in ipairs(allowed) do\nif (value:lower() == v:lower()) then\nreturn v\nend\nend\nreturn nil, \"invalid value '\" .. value .. \"'\"\nend\nelse\nreturn value\nend\nend\nfunction premake.getobject(t)\nlocal container\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\nif t == \"solution\" then\nif type(container) == \"project\" then\ncontainer = container.solution\nend\nif type(container) ~= \"solution\" then\ncontainer = nil\nend\nend\nlocal msg\nif (not conta"
90   "iner) then\nif (t == \"container\") then\nmsg = \"no active solution or project\"\nelseif (t == \"solution\") then\nmsg = \"no active solution\"\nelse\nmsg = \"no active solution, project, or configuration\"\nend\nend\nreturn container, msg\nend\nfunction premake.setarray(obj, fieldname, value, allowed)\nobj[fieldname] = obj[fieldname] or {}\nlocal function add(value, depth)\nif type(value) == \"table\" then\nfor _,v in ipairs(value) do\nadd(v, depth + 1)\nend\nelse\nvalue, err = premake.checkvalue(value, allowed)\nif not value then\nerror(err, depth)\nend\ntable.insert(obj[fieldname], value)\nend\nend\nif value then\nadd(value, 5)\nend\nreturn obj[fieldname]\nend\nlocal function domatchedarray(ctype, fieldname, value, matchfunc)\nlocal result = { }\nfunction makeabsolute(value, depth)\nif (type(value) == \"table\") then\nfor _, item in ipairs(value) do\nmakeabsolute(item, depth + 1)\nend\nelseif type(value) == \"string\" then\nif value:find(\"*\") then\nmakeabsolute(matchfunc(value), depth + 1)\nelse\ntable.i"
91   "nsert(result, path.getabsolute(value))\nend\nelse\nerror(\"Invalid value in list: expected string, got \" .. type(value), depth)\nend\nend\nmakeabsolute(value, 3)\nreturn premake.setarray(ctype, fieldname, result)\nend\nfunction premake.setdirarray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchdirs)\nend\nfunction premake.setfilearray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchfiles)\nend\nfunction premake.setkeyvalue(ctype, fieldname, values)\nlocal container, err = premake.getobject(ctype)\nif not container then\nerror(err, 4)\nend\nif not container[fieldname] then\ncontainer[fieldname] = {}\nend\nif type(values) ~= \"table\" then\nerror(\"invalid value; table expected\", 4)\nend\nlocal field = container[fieldname]\nfor key,value in pairs(values) do\nif not field[key] then\nfield[key] = {}\nend\ntable.insertflat(field[key], value)\nend\nreturn field\nend\nfunction premake.setstring(ctype, fieldname, value, allowed)\nlocal container, err"
92   " = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (value) then\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then\nerror(err, 4)\nend\ncontainer[fieldname] = value\nend\nreturn container[fieldname]\nend\nfunction premake.remove(fieldname, value)\nlocal cfg = premake.CurrentConfiguration\ncfg.removes = cfg.removes or {}\ncfg.removes[fieldname] = premake.setarray(cfg.removes, fieldname, value)\nend\nlocal function accessor(name, value)\nlocal kind    = premake.fields[name].kind\nlocal scope   = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\nif (kind == \"string\" or kind == \"path\") and value then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\nlocal container, err = premake.getobject(scope)\nif (not container) then\nerror(err, 3)\nend\nif kind == \"string\" then\nreturn premake.setstring(scope, name, value, allowed)\nelseif kind == \"path\" then\nif value then value = path.getabsolute(value) end\nreturn "
93   "premake.setstring(scope, name, value)\nelseif kind == \"list\" then\nreturn premake.setarray(container, name, value, allowed)\nelseif kind == \"dirlist\" then\nreturn premake.setdirarray(container, name, value)\nelseif kind == \"filelist\" or kind == \"absolutefilelist\" then\nreturn premake.setfilearray(container, name, value)\nelseif kind == \"keyvalue\" or kind == \"keypath\" then\nreturn premake.setkeyvalue(scope, name, value)\nend\nend\nfor name, info in pairs(premake.fields) do\n_G[name] = function(value)\nreturn accessor(name, value)\nend\nif info.kind == \"list\" or \n   info.kind == \"dirlist\" or \n   info.kind == \"filelist\" or\n   info.kind == \"absolutefilelist\" \nthen\n_G[\"remove\"..name] = function(value)\npremake.remove(name, value)\nend\nend\nend\nfunction configuration(terms)\nif not terms then\nreturn premake.CurrentConfiguration\nend\nlocal container, err = premake.getobject(\"container\")\nif (not container) then\nerror(err, 2)\nend\nlocal cfg = { }\ncfg.terms = table.flatten({terms})\n"
94   "table.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\ncfg.keywords = { }\nfor _, word in ipairs(cfg.terms) do\ntable.insert(cfg.keywords, path.wildcards(word):lower())\nend\nfor name, field in pairs(premake.fields) do\nif (field.kind ~= \"string\" and field.kind ~= \"path\") then\ncfg[name] = { }\nend\nend\nreturn cfg\nend\nlocal function creategroup(name, sln, parent, inpath)\nlocal group = {}\nsetmetatable(group, {\n__type = \"group\"\n})\ntable.insert(sln.groups, group)\nsln.groups[inpath] = group\ngroup.solution = sln\ngroup.name = name\ngroup.uuid = os.uuid(group.name)\ngroup.parent = parent\nreturn group\nend\nlocal function creategroupsfrompath(inpath, sln)\nif inpath == nil then return nil end\ninpath = path.translate(inpath, \"/\")\nlocal groups = string.explode(inpath, \"/\")\nlocal curpath = \"\"\nlocal lastgroup = nil\nfor i, v in ipairs(groups) do\ncurpath = curpath .. \"/\" .. v:lower()\nlocal group = sln.groups[curpath]\nif group == nil then\ngroup = creategroup(v, sln, lastgr"
95   "oup, curpath)\nend\nlastgroup = group\nend\nreturn lastgroup\nend\nlocal function createproject(name, sln, isUsage)\nlocal prj = {}\nsetmetatable(prj, {\n__type = \"project\",\n})\ntable.insert(sln.projects, prj)\nif(isUsage) then\nif(sln.projects[name]) then\nsln.projects[name].usageProj = prj;\nelse\nsln.projects[name] = prj\nend\nelse\nif(sln.projects[name]) then\nprj.usageProj = sln.projects[name];\nend\nsln.projects[name] = prj\nend\nlocal group = creategroupsfrompath(premake.CurrentGroup, sln)\nprj.solution       = sln\nprj.name           = name\nprj.basedir        = os.getcwd()\nprj.uuid           = os.uuid(prj.name)\nprj.blocks         = { }\nprj.usage   = isUsage\nprj.group          = group\nreturn prj;\nend\nfunction usage(name)\nif (not name) then\nif(type(premake.CurrentContainer) ~= \"project\") then return nil end\nif(not premake.CurrentContainer.usage) then return nil end\nreturn premake.CurrentContainer\nend\nlocal sln\nif (type(premake.CurrentContainer) == \"project\") then\nsln = premake.Curr"
96   "entContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\n  -- if this is a new project, or the project in that slot doesn't have a usage, create it\n  if((not sln.projects[name]) or\n  ((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then\n  premake.CurrentContainer = createproject(name, sln, true)\n  else\n  premake.CurrentContainer = iff(sln.projects[name].usage,\n  sln.projects[name], sln.projects[name].usageProj)\n  end\n  -- add an empty, global configuration to the project\n  configuration { }\n  return premake.CurrentContainer\n  end\n  function project(name)\n  if (not name) then\n  --Only return non-usage projects\n  if(type(premake.CurrentContainer) ~= \"project\") then return nil end\n  if(premake.CurrentContainer.usage) then return nil end\n  return premake.CurrentContainer\nend\n  -- identify the parent solution\n  local sln\n  if (type(premake.CurrentContainer) == \"project\") then\n  sln "
97   "= premake.CurrentContainer.solution\n  else\n  sln = premake.CurrentContainer\n  end\n  if (type(sln) ~= \"solution\") then\n  error(\"no active solution\", 2)\n  end\n  -- if this is a new project, or the old project is a usage project, create it\n  if((not sln.projects[name]) or sln.projects[name].usage) then\n  premake.CurrentContainer = createproject(name, sln)\n  else\n  premake.CurrentContainer = sln.projects[name];\n  end\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction solution(name)\nif not name then\nif type(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\npremake.CurrentContainer = premake.solution.get(name)\nif (not premake.CurrentContainer) then\npremake.CurrentContainer = premake.solution.new(name)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction group(name)\nif not name then \nreturn premake.CurrentGroup\nend\npremake.CurrentGroup = name\nreturn premake.CurrentGroup\n"
98   "end\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npremake.option.add(opt)\nend\n",
83   "premake.fields =\n{\narchivesplit_size =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nbasedir =\n{\nkind  = \"path\",\nscope = \"container\",\n},\nbuildaction =\n{\nkind  = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n},\nbuildoptions =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nbuildoptions_cpp =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nconfigurations =\n{\nkind  = \"list\",\nscope = \"solution\",\n},\ndebugargs =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndebugdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ndebugenvs  =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndefines =\n{\nkind  = \"list\",\nscope = \"config\",\n},\ndeploymentoptions =\n{\nkind  = \"list\",\nscope = \"config\",\nusagecopy = true,\n},\nexcludes =\n{\nkind  = \"filelist\",\nscope = \"config\",\n},\nfiles =\n{\nkind  = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind  = \"list\",\nscope = \"config\",\nisflags = true,\nusagecopy = true,\nallowed = functi"
84   "on(value)\nlocal allowed_flags = {\nATL = 1,\nDebugEnvsDontMerge = 1,\nDebugEnvsInherit = 1,\nEnableMinimalRebuild = 1,\nEnableSSE = 1,\nEnableSSE2 = 1,\nExtraWarnings = 1,\nFatalWarnings = 1,\nFloatFast = 1,\nFloatStrict = 1,\nManaged = 1,\nMFC = 1,\nNativeWChar = 1,\nNo64BitChecks = 1,\nNoEditAndContinue = 1,\nNoExceptions = 1,\nNoFramePointer = 1,\nNoImportLib = 1,\nNoIncrementalLink = 1,\nNoManifest = 1,\nNoMultiProcessorCompilation = 1,\nNoNativeWChar = 1,\nNoPCH = 1,\nNoRTTI = 1,\nOptimize = 1,\nOptimizeSize = 1,\nOptimizeSpeed = 1,\nSEH = 1,\nStaticATL = 1,\nStaticRuntime = 1,\nSymbols = 1,\nUnicode = 1,\nUnsafe = 1,\nUnsignedChar = 1,\nWinMain = 1,\n}\nlocal englishToAmericanSpelling =\n{\noptimise = 'optimize',\noptimisesize = 'optimizesize',\noptimisespeed = 'optimizespeed',\n}\nlocal lowervalue = value:lower()\nlowervalue = englishToAmericanSpelling[lowervalue] or lowervalue\nfor v, _ in pairs(allowed_flags) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid flag\"\nend,"
85   "\n},\nframework =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"1.0\",\n\"1.1\",\n\"2.0\",\n\"3.0\",\n\"3.5\",\n\"4.0\",\n\"4.5\",\n}\n},\nforcedincludes = \n{\nkind  = \"absolutefilelist\",\nscope = \"config\",\n},\nimagepath =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimageoptions =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nimplibdir =\n{\nkind  = \"path\",\nscope = \"config\",\n},\nimplibextension =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nimplibname =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nimplibprefix =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nimplibsuffix =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nincludedirs =\n{\nkind  = \"dirlist\",\nscope = \"config\",\nusagecopy = true,\n},\nkind =\n{\nkind  = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\"\n}\n},\nlanguage =\n{\nkind  = \"string\",\nscope = \"container\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\"\n}\n},\nlibdirs =\n{\nkind "
86   " = \"dirlist\",\nscope = \"config\",\nlinkagecopy = true,\n},\nlinkoptions =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nlinks =\n{\nkind  = \"list\",\nscope = \"config\",\nallowed = function(value)\nif value:find('/', nil, true) then\nvalue = path.getabsolute(value)\nend\nreturn value\nend,\nlinkagecopy = true,\n},\nlocation =\n{\nkind  = \"path\",\nscope = \"container\",\n},\nmakesettings =\n{\nkind = \"list\",\nscope = \"config\",\n},\nmessageskip =\n{\nkind  = \"list\",\nscope = \"solution\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_messages = {\nSkipCreatingMessage = 1,\nSkipBuildingMessage = 1,\nSkipCleaningMessage = 1,\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_messages) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid message to skip\"\nend,\n},\nmsgarchiving =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nmsgcompile =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nmsgresource =\n{\nkind  = \"string\",\ns"
87   "cope = \"config\",\n},\nmsglinking =\n{\nkind  = \"string\",\nscope = \"config\",\n},\nobjdir =\n{\nkind  = \"path\",\nscope = \"config\",\n},\noptions =\n{\nkind  = \"list\",\nscope = \"container\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_options = {\nForceCPP = 1,\nArchiveSplit = 1\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_options) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid option\"\nend,\n},\npchheader =\n{\nkind  = \"string\",\nscope = \"config\",\n},\npchsource =\n{\nkind  = \"path\",\nscope = \"config\",\n},\nplatforms =\n{\nkind  = \"list\",\nscope = \"solution\",\nallowed = table.keys(premake.platforms),\n},\npostbuildcommands =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nprebuildcommands =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nprelinkcommands =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nresdefines =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nresincludedirs =\n{\nkind  = \"dirlist\","
88   "\nscope = \"config\",\n},\nresoptions =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nstartproject =\n{\nkind  = \"string\",\nscope = \"solution\",\n},\ntargetdir =\n{\nkind  = \"path\",\nscope = \"config\",\n},\ntargetsubdir =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntargetextension =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntargetname =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntargetprefix =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntargetsuffix =\n{\nkind  = \"string\",\nscope = \"config\",\n},\ntrimpaths =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nuuid =\n{\nkind  = \"string\",\nscope = \"container\",\nallowed = function(value)\nlocal ok = true\nif (#value ~= 36) then ok = false end\nfor i=1,36 do\nlocal ch = value:sub(i,i)\nif (not ch:find(\"[ABCDEFabcdef0123456789-]\")) then ok = false end\nend\nif (value:sub(9,9) ~= \"-\")   then ok = false end\nif (value:sub(14,14) ~= \"-\") then ok = false end\nif (value:sub(19,19) ~= \"-\") then ok = false end\nif (value:s"
89   "ub(24,24) ~= \"-\") then ok = false end\nif (not ok) then\nreturn nil, \"invalid UUID\"\nend\nreturn value:upper()\nend\n},\nuses =\n{\nkind  = \"list\",\nscope = \"config\",\n},\nvpaths =\n{\nkind = \"keypath\",\nscope = \"container\",\n},\n}\nfunction premake.checkvalue(value, allowed)\nif (allowed) then\nif (type(allowed) == \"function\") then\nreturn allowed(value)\nelse\nfor _,v in ipairs(allowed) do\nif (value:lower() == v:lower()) then\nreturn v\nend\nend\nreturn nil, \"invalid value '\" .. value .. \"'\"\nend\nelse\nreturn value\nend\nend\nfunction premake.getobject(t)\nlocal container\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\nif t == \"solution\" then\nif type(container) == \"project\" then\ncontainer = container.solution\nend\nif type(container) ~= \"solution\" then\ncontainer = nil\nend\nend\nlocal msg\nif (not container) then\nif (t == \"container\") then\nmsg = \"no active solution or project\"\nel"
90   "seif (t == \"solution\") then\nmsg = \"no active solution\"\nelse\nmsg = \"no active solution, project, or configuration\"\nend\nend\nreturn container, msg\nend\nfunction premake.setarray(obj, fieldname, value, allowed)\nobj[fieldname] = obj[fieldname] or {}\nlocal function add(value, depth)\nif type(value) == \"table\" then\nfor _,v in ipairs(value) do\nadd(v, depth + 1)\nend\nelse\nvalue, err = premake.checkvalue(value, allowed)\nif not value then\nerror(err, depth)\nend\ntable.insert(obj[fieldname], value)\nend\nend\nif value then\nadd(value, 5)\nend\nreturn obj[fieldname]\nend\nlocal function domatchedarray(ctype, fieldname, value, matchfunc)\nlocal result = { }\nfunction makeabsolute(value, depth)\nif (type(value) == \"table\") then\nfor _, item in ipairs(value) do\nmakeabsolute(item, depth + 1)\nend\nelseif type(value) == \"string\" then\nif value:find(\"*\") then\nmakeabsolute(matchfunc(value), depth + 1)\nelse\ntable.insert(result, path.getabsolute(value))\nend\nelse\nerror(\"Invalid value in list: exp"
91   "ected string, got \" .. type(value), depth)\nend\nend\nmakeabsolute(value, 3)\nreturn premake.setarray(ctype, fieldname, result)\nend\nfunction premake.setdirarray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchdirs)\nend\nfunction premake.setfilearray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchfiles)\nend\nfunction premake.setkeyvalue(ctype, fieldname, values)\nlocal container, err = premake.getobject(ctype)\nif not container then\nerror(err, 4)\nend\nif not container[fieldname] then\ncontainer[fieldname] = {}\nend\nif type(values) ~= \"table\" then\nerror(\"invalid value; table expected\", 4)\nend\nlocal field = container[fieldname]\nfor key,value in pairs(values) do\nif not field[key] then\nfield[key] = {}\nend\ntable.insertflat(field[key], value)\nend\nreturn field\nend\nfunction premake.setstring(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (value) "
92   "then\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then\nerror(err, 4)\nend\ncontainer[fieldname] = value\nend\nreturn container[fieldname]\nend\nfunction premake.remove(fieldname, value)\nlocal cfg = premake.CurrentConfiguration\ncfg.removes = cfg.removes or {}\ncfg.removes[fieldname] = premake.setarray(cfg.removes, fieldname, value)\nend\nlocal function accessor(name, value)\nlocal kind    = premake.fields[name].kind\nlocal scope   = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\nif (kind == \"string\" or kind == \"path\") and value then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\nlocal container, err = premake.getobject(scope)\nif (not container) then\nerror(err, 3)\nend\nif kind == \"string\" then\nreturn premake.setstring(scope, name, value, allowed)\nelseif kind == \"path\" then\nif value then value = path.getabsolute(value) end\nreturn premake.setstring(scope, name, value)\nelseif kind == \"list\" then\nreturn premake.s"
93   "etarray(container, name, value, allowed)\nelseif kind == \"dirlist\" then\nreturn premake.setdirarray(container, name, value)\nelseif kind == \"filelist\" or kind == \"absolutefilelist\" then\nreturn premake.setfilearray(container, name, value)\nelseif kind == \"keyvalue\" or kind == \"keypath\" then\nreturn premake.setkeyvalue(scope, name, value)\nend\nend\nfor name, info in pairs(premake.fields) do\n_G[name] = function(value)\nreturn accessor(name, value)\nend\nif info.kind == \"list\" or \n   info.kind == \"dirlist\" or \n   info.kind == \"filelist\" or\n   info.kind == \"absolutefilelist\" \nthen\n_G[\"remove\"..name] = function(value)\npremake.remove(name, value)\nend\nend\nend\nfunction configuration(terms)\nif not terms then\nreturn premake.CurrentConfiguration\nend\nlocal container, err = premake.getobject(\"container\")\nif (not container) then\nerror(err, 2)\nend\nlocal cfg = { }\ncfg.terms = table.flatten({terms})\ntable.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\ncfg.keywords"
94   " = { }\nfor _, word in ipairs(cfg.terms) do\ntable.insert(cfg.keywords, path.wildcards(word):lower())\nend\nfor name, field in pairs(premake.fields) do\nif (field.kind ~= \"string\" and field.kind ~= \"path\") then\ncfg[name] = { }\nend\nend\nreturn cfg\nend\nlocal function creategroup(name, sln, parent, inpath)\nlocal group = {}\nsetmetatable(group, {\n__type = \"group\"\n})\ntable.insert(sln.groups, group)\nsln.groups[inpath] = group\ngroup.solution = sln\ngroup.name = name\ngroup.uuid = os.uuid(group.name)\ngroup.parent = parent\nreturn group\nend\nlocal function creategroupsfrompath(inpath, sln)\nif inpath == nil then return nil end\ninpath = path.translate(inpath, \"/\")\nlocal groups = string.explode(inpath, \"/\")\nlocal curpath = \"\"\nlocal lastgroup = nil\nfor i, v in ipairs(groups) do\ncurpath = curpath .. \"/\" .. v:lower()\nlocal group = sln.groups[curpath]\nif group == nil then\ngroup = creategroup(v, sln, lastgroup, curpath)\nend\nlastgroup = group\nend\nreturn lastgroup\nend\nlocal function cre"
95   "ateproject(name, sln, isUsage)\nlocal prj = {}\nsetmetatable(prj, {\n__type = \"project\",\n})\ntable.insert(sln.projects, prj)\nif(isUsage) then\nif(sln.projects[name]) then\nsln.projects[name].usageProj = prj;\nelse\nsln.projects[name] = prj\nend\nelse\nif(sln.projects[name]) then\nprj.usageProj = sln.projects[name];\nend\nsln.projects[name] = prj\nend\nlocal group = creategroupsfrompath(premake.CurrentGroup, sln)\nprj.solution       = sln\nprj.name           = name\nprj.basedir        = os.getcwd()\nprj.uuid           = os.uuid(prj.name)\nprj.blocks         = { }\nprj.usage   = isUsage\nprj.group          = group\nreturn prj;\nend\nfunction usage(name)\nif (not name) then\nif(type(premake.CurrentContainer) ~= \"project\") then return nil end\nif(not premake.CurrentContainer.usage) then return nil end\nreturn premake.CurrentContainer\nend\nlocal sln\nif (type(premake.CurrentContainer) == \"project\") then\nsln = premake.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \""
96   "solution\") then\nerror(\"no active solution\", 2)\nend\n  -- if this is a new project, or the project in that slot doesn't have a usage, create it\n  if((not sln.projects[name]) or\n  ((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then\n  premake.CurrentContainer = createproject(name, sln, true)\n  else\n  premake.CurrentContainer = iff(sln.projects[name].usage,\n  sln.projects[name], sln.projects[name].usageProj)\n  end\n  -- add an empty, global configuration to the project\n  configuration { }\n  return premake.CurrentContainer\n  end\n  function project(name)\n  if (not name) then\n  --Only return non-usage projects\n  if(type(premake.CurrentContainer) ~= \"project\") then return nil end\n  if(premake.CurrentContainer.usage) then return nil end\n  return premake.CurrentContainer\nend\n  -- identify the parent solution\n  local sln\n  if (type(premake.CurrentContainer) == \"project\") then\n  sln = premake.CurrentContainer.solution\n  else\n  sln = premake.CurrentContainer\n  end"
97   "\n  if (type(sln) ~= \"solution\") then\n  error(\"no active solution\", 2)\n  end\n  -- if this is a new project, or the old project is a usage project, create it\n  if((not sln.projects[name]) or sln.projects[name].usage) then\n  premake.CurrentContainer = createproject(name, sln)\n  else\n  premake.CurrentContainer = sln.projects[name];\n  end\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction solution(name)\nif not name then\nif type(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\npremake.CurrentContainer = premake.solution.get(name)\nif (not premake.CurrentContainer) then\npremake.CurrentContainer = premake.solution.new(name)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction group(name)\nif not name then \nreturn premake.CurrentGroup\nend\npremake.CurrentGroup = name\nreturn premake.CurrentGroup\nend\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npre"
98   "make.option.add(opt)\nend\n",
9999
100100   /* base/cmdline.lua */
101101   "newoption \n{\ntrigger     = \"cc\",\nvalue       = \"VALUE\",\ndescription = \"Choose a C/C++ compiler set\",\nallowed = {\n{ \"gcc\", \"GNU GCC (gcc/g++)\" },\n{ \"ow\",  \"OpenWatcom\"        },\n}\n}\nnewoption\n{\ntrigger     = \"dotnet\",\nvalue       = \"VALUE\",\ndescription = \"Choose a .NET compiler set\",\nallowed = {\n{ \"msnet\",   \"Microsoft .NET (csc)\" },\n{ \"mono\",    \"Novell Mono (mcs)\"    },\n{ \"pnet\",    \"Portable.NET (cscc)\"  },\n}\n}\nnewoption\n{\ntrigger     = \"file\",\nvalue       = \"FILE\",\ndescription = \"Read FILE as a Premake script; default is 'premake4.lua'\"\n}\nnewoption\n{\ntrigger     = \"help\",\ndescription = \"Display this information\"\n}\nnewoption\n{\ntrigger     = \"os\",\nvalue       = \"VALUE\",\ndescription = \"Generate files for a different operating system\",\nallowed = {\n{ \"bsd\",      \"OpenBSD, NetBSD, or FreeBSD\" },\n{ \"linux\",    \"Linux\" },\n{ \"macosx\",   \"Apple Mac OS X\" },\n{ \"windows\",  \"Microsoft Windows\" },\n}\n}\nnewoption\n{"
r244646r244647
185185   "$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\ncpp.pchrules(prj)\ncpp.fileRules(prj)\n_p('-include $(OBJECTS:%%.o=%%.d)')\n_p('ifneq (,$(PCH))')\n_p('  -include $(OBJDIR)/$(notdir $(PCH)).d')\n_p('endif')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)\n_p('ifndef config')\n_p('  config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p('  SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p('  SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p('  SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('  MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p('  COPY  = $("
186186   "SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p('else')\n_p('  MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p('  COPY  = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p('endif')\n_p('')\n_p('CC  = %s', cc.cc)\n_p('CXX = %s', cc.cxx)\n_p('AR  = %s', cc.ar)\n_p('')\n_p('ifndef RESCOMP')\n_p('  ifdef WINDRES')\n_p('    RESCOMP = $(WINDRES)')\n_p('  else')\n_p('    RESCOMP = windres')\n_p('  endif')\n_p('endif')\n_p('')\nend\nfunction premake.gmake_cpp_config(prj, cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\ncpp.platformtools(cfg, cc)\n_p('  OBJDIR     = %s', _MAKE.esc(cfg.objectsdir))\n_p('  TARGETDIR  = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p('  TARGET     = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p('  DEFINES   +=%s', make.list(cc.getdefines(cfg.defines)))\n_p('  INCLUDES  +=%s', make.list(cc.getincludedirs(cfg.includedirs)))\ncpp.pchconfig(cfg)\ncpp.flags(cfg, cc)\ncpp.linker(cfg, cc)\n_p('  OBJECTS := \\\\')\nfor _, fi"
187187   "le in ipairs(prj.files) do\nif path.iscppfile(file) then\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (exclude == file)\nif (excluded) then break end\nend\nif excluded == false then\n_p('\\t$(OBJDIR)/%s.o \\\\'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n)\nend\nend\nend\n_p('')\n_p('  define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p('  endef')\n_p('  define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p('  endef')\n_p('  define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p('  endef')\nmake.settings(cfg, cc)\n_p('endif')\n_p('')\nend\nfunction cpp.platformtools(cfg, cc)\nlocal platfor"
188   "m = cc.platforms[cfg.platform]\nif platform.cc then\n_p('  CC         = %s', platform.cc)\nend\nif platform.cxx then\n_p('  CXX        = %s', platform.cxx)\nend\nif platform.ar then\n_p('  AR         = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p('  FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\nend\nif #cfg.forcedincludes > 0 then\n_p('  FORCE_INCLUDE += -include %s'\n,premake.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p('  ALL_CPPFLAGS  += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p('  ALL_CFLAGS    += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)))\n_p('  ALL_CXXFLAGS  += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)))\n_p('  ALL_RESFLAGS  += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n        make.list(table.join(cc.getdefines(cfg.resd"
189   "efines),\n                                cc.getincludedirs(cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(cfg, cc)\n_p('  ALL_LDFLAGS   += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p('  LDDEPS    +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p('  LIBS      += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\nif cfg.kind == \"StaticLib\" then\nif cfg.platform:startswith(\"Universal\") then\n_p('  LINKCMD    = libtool -o $(TARGET)')\nelse\nif cc.llvm then\n_p('  LINKCMD    = $(AR) rcs $(TARGET)')\nelse\n_p('  LINKCMD    = $(AR) -rcs $(TARGET)')\nend\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p('  LINKCMD    = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = p"
190   "ath.getabsolute(path.join(cfg.project.location, incdir))\nlocal testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p('  PCH        = %s', _MAKE.esc(pch))\n_p('  GCH        = $(OBJDIR)/$(notdir $(PCH)).gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nlocal cmd = iif(prj.language == \"C\", \"$(CC) -x c-header $(ALL_CFLAGS)\", \"$(CXX) -x c++-header $(ALL_CXXFLAGS)\")\n_p('\\t$(SILENT) %s -MMD -MP $(DEFINES) $(INCLUDES) -o \"$@\" -MF \"$(@:%%.gch=%%.d)\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj)\nfor _, file in ipairs(prj.files or {}) do\nif path.iscppfile(file) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\n_p('')\n"
191   "elseif (path.getextension(file) == \".rc\") then\n_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -MF $(@:%%.%s=%%.d) -c \"$<\"', flags, objext)\nend\n",
188   "m = cc.platforms[cfg.platform]\nif platform.cc then\n_p('  CC         = %s', platform.cc)\nend\nif platform.cxx then\n_p('  CXX        = %s', platform.cxx)\nend\nif platform.ar then\n_p('  AR         = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p('  FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\nend\nif #cfg.forcedincludes > 0 then\n_p('  FORCE_INCLUDE += -include %s'\n,premake.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p('  ALL_CPPFLAGS  += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p('  ALL_CFLAGS    += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions)))\n_p('  ALL_CXXFLAGS  += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions_cpp)))\n_p('  ALL_RESFLAGS  += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n        make.list(table.join(cc.getdefines(cfg.resdefines),\n                                cc.getincludedir"
189   "s(cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(cfg, cc)\n_p('  ALL_LDFLAGS   += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p('  LDDEPS    +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p('  LIBS      += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\nif cfg.kind == \"StaticLib\" then\nif cfg.platform:startswith(\"Universal\") then\n_p('  LINKCMD    = libtool -o $(TARGET)')\nelse\nif cc.llvm then\n_p('  LINKCMD    = $(AR) rcs $(TARGET)')\nelse\n_p('  LINKCMD    = $(AR) -rcs $(TARGET)')\nend\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p('  LINKCMD    = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\n"
190   "local testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p('  PCH        = %s', _MAKE.esc(pch))\n_p('  GCH        = $(OBJDIR)/$(notdir $(PCH)).gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nlocal cmd = iif(prj.language == \"C\", \"$(CC) -x c-header $(ALL_CFLAGS)\", \"$(CXX) -x c++-header $(ALL_CXXFLAGS)\")\n_p('\\t$(SILENT) %s -MMD -MP $(DEFINES) $(INCLUDES) -o \"$@\" -MF \"$(@:%%.gch=%%.d)\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj)\nfor _, file in ipairs(prj.files or {}) do\nif path.iscppfile(file) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\n_p('')\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OB"
191   "JDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -MF $(@:%%.%s=%%.d) -c \"$<\"', flags, objext)\nend\n",
192192
193193   /* actions/make/make_csharp.lua */
194194   "local function getresourcefilename(cfg, fname)\nif path.getextension(fname) == \".resx\" then\n    local name = cfg.buildtarget.basename .. \".\"\n    local dir = path.getdirectory(fname)\n    if dir ~= \".\" then \nname = name .. path.translate(dir, \".\") .. \".\"\nend\nreturn \"$(OBJDIR)/\" .. _MAKE.esc(name .. path.getbasename(fname)) .. \".resources\"\nelse\nreturn fname\nend\nend\nfunction premake.make_csharp(prj)\nlocal csc = premake.dotnet\nlocal cfglibs = { }\nlocal cfgpairs = { }\nlocal anycfg\nfor cfg in premake.eachconfig(prj) do\nanycfg = cfg\ncfglibs[cfg] = premake.getlinks(cfg, \"siblings\", \"fullpath\")\ncfgpairs[cfg] = { }\nfor _, fname in ipairs(cfglibs[cfg]) do\nif path.getdirectory(fname) ~= cfg.buildtarget.directory then\ncfgpairs[cfg][\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)\nend\nend\nend\nlocal sources = {}\nlocal embedded = { }\nlocal copypairs = { }\nfor fcfg in premake.project.eachfile(prj) do\nlocal action = csc.getbuildaction(fcfg)\nif action == \"Co"
trunk/3rdparty/mongoose/docs/API.md
r244646r244647
11# Mongoose API Reference
22
3    struct mg_server *mg_create_server(void *server_param, mg_handler_t handler);
3    struct mg_server *mg_create_server(void *server_param);
44
55Creates web server instance. Returns opaque instance pointer, or NULL if
66there is not enough memory. `server_param`: Could be any pointer, or NULL.
r244646r244647
173173     Mongoose will call a handler repeatedly after each socket write.
174174
175175<!-- -->
176
176     
177177     void mg_send_file(struct mg_connection *, const char *path);
178178
179179Tells Mongoose to serve given file. Mongoose handles file according to
r244646r244647
187187                           const char *data, size_t data_len);
188188
189189Similar to `mg_write()`, but wraps the data into a websocket frame with a
190given websocket `opcode`.
190given websocket `opcode`. 
191191
192192    const char *mg_get_header(const struct mg_connection *, const char *name);
193193
r244646r244647
219219                                 const char *user,
220220                                 const char *password);
221221
222Add, edit or delete the entry in the passwords file.
222Add, edit or delete the entry in the passwords file. 
223223This function allows an application to manipulate .htpasswd files on the
224224fly by adding, deleting and changing user records. This is one of the
225several ways of implementing authentication on the server side.
225several ways of implementing authentication on the server side. 
226226If password is not NULL, entry is added (or modified if already exists).
227If password is NULL, entry is deleted.
227If password is NULL, entry is deleted. 
228228Return: 1 on success, 0 on error.
229229
230
230   
231231    int mg_parse_multipart(const char *buf, int buf_len,
232232                           char *var_name, int var_name_len,
233233                           char *file_name, int file_name_len,
trunk/3rdparty/mongoose/docs/LuaSqlite.md
r0r244647
1# Mongoose Lua Server Pages
2
3Pre-built Windows and Mac mongoose binaries support Lua Server Pages
4functionality.
5That means it is possible to write PHP-like scripts with mongoose
6using Lua programming language instead of PHP. Lua is known
7for it's speed and small size. Mongoose uses Lua version 5.2.3, the
8documentation for it can be found at
9[Lua 5.2 reference manual](http://www.lua.org/manual/5.2/).
10
11To create a Lua Page, make a file that is called `ANY_NAME.lp`. For example,
12`my_page.lp`. It is important to have a file
13name that ends up with `.lp`, cause this is the way mongoose recognises
14Lua Page file. The contents of the file, just like
15with PHP, is HTML with embedded Lua code. Lua code must be enclosed within
16`&lt;?  ?&gt;` blocks, and can appear anywhere on the page.
17
18Mongoose does not send HTTP headers for Lua pages. Therefore,
19every Lua Page must begin with HTTP status line and headers, like this:
20
21    <? mg.write('HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n') ?>
22    <html><body>
23      <span>Today is:</span> <? mg.write(os.date("%A")) ?>
24    </body></html>
25
26Note that this example uses function `mg.write()`, which prints data to the
27web page. Using function `mg.write()` is the way to generate web content from
28inside Lua code. In addition to `mg.write()`, all standard library functions
29are accessible from the Lua code (please check reference manual for details).
30Information about the request is available via the `mg.request_info` object.
31I contains request method, all headers, etcetera. Please refer to
32`struct mg_request_info` definition in
33[mongoose.h](https://github.com/cesanta/mongoose/blob/master/mongoose.h)
34to see what is available via the `mg.request_info` object.
35Check out [prime_numbers.lp](https://github.com/cesanta/mongoose/blob/master/examples/lua/prime_numbers.lp) for some example.
36
37Mongoose exports the following to the Lua Server Page:
38
39    mg.write(str)     -- writes string to the client
40    mg.onerror(msg)   -- error handler, can be overridden
41    mg.request_info   -- a table with request information
42
43Using Lua scripting it is easy to emulate SSI functionality. For example,
44to include the content of another file, one can write:
45
46    <? mg.write(io.open('MY_FILE.TXT'):read('*all')) ?>
47
48To serve a Lua Page, mongoose creates Lua context. That context is used for
49all Lua blocks within the page. That means, all Lua blocks on the same page
50share the same context. If one block defines a variable, for example, that
51variable is visible in all following blocks.
trunk/3rdparty/mongoose/mongoose.c
r244646r244647
124124#include <sys/socket.h>
125125#include <sys/select.h>
126126#define closesocket(x) close(x)
127#ifndef __OS2__
127128#define __cdecl
129#else
130#include <sys/time.h>
131typedef int socklen_t;
132#endif
128133#define INVALID_SOCKET (-1)
129134#define to64(x) strtoll(x, NULL, 10)
130135typedef int sock_t;
r244646r244647
601606
602607// TODO(lsm): use non-blocking resolver
603608static int ns_resolve2(const char *host, struct in_addr *ina) {
604#ifdef NS_ENABLE_GETADDRINFO
605  int rv = 0;
606  struct addrinfo hints, *servinfo, *p;
607  struct sockaddr_in *h = NULL;
608  char *ip = NS_MALLOC(17);
609  memset(ip, '\0', 17);
610
611  memset(&hints, 0, sizeof hints);
612  hints.ai_family = AF_INET;
613  hints.ai_socktype = SOCK_STREAM;
614
615  if((rv = getaddrinfo(host, NULL , NULL, &servinfo)) != 0) {
616    DBG(("getaddrinfo(%s) failed: %s", host, strerror(errno)));
617    return 0;
618  }
619
620  for(p = servinfo; p != NULL; p = p->ai_next) {
621    memcpy(&h, &p->ai_addr, sizeof(struct sockaddr_in *));
622    memcpy(ina, &h->sin_addr, sizeof(ina));
623  }
624
625  freeaddrinfo(servinfo);
626  return 1;
627#else
628609  struct hostent *he;
629610  if ((he = gethostbyname(host)) == NULL) {
630611    DBG(("gethostbyname(%s) failed: %s", host, strerror(errno)));
r244646r244647
633614    return 1;
634615  }
635616  return 0;
636#endif
637617}
638618
639619// Resolve FDQN "host", store IP address in the "ip".
r244646r244647
15791559#define MAP_FAILED NULL
15801560#define MAP_PRIVATE 0
15811561#define PROT_READ 0
1562#elif defined(__OS2__)
1563static void *mmap(void *addr, int64_t len, int prot, int flags, int fd,
1564                  int offset) {
1565  void *p;
1566
1567  int pos = lseek( fd, 0, SEEK_CUR ); /* Get a current position */
1568
1569  if (pos == -1)
1570    return NULL;
1571
1572  /* Seek to offset offset */
1573  if (lseek( fd, offset, SEEK_SET) == -1)
1574    return NULL;
1575
1576  p = malloc(len);
1577
1578  /* Read in a file */
1579  if (!p || read(fd, p, len) == -1) {
1580    free(p);
1581    p = NULL;
1582  }
1583
1584  /* Restore the position */
1585  lseek(fd, pos, SEEK_SET);
1586
1587  return p;
1588}
1589#define munmap(x, y)  free(x)
1590#define MAP_FAILED NULL
1591#define MAP_PRIVATE 0
1592#define PROT_READ 0
15821593#else
15831594#include <sys/mman.h>
15841595#endif
r244646r244647
29983009      copy_len = 4 + data_len;
29993010    } else {
30003011      // 64-bit length field
3012      copy[1] = 127;
30013013      const uint32_t hi = htonl((uint32_t) ((uint64_t) data_len >> 32));
30023014      const uint32_t lo = htonl(data_len & 0xffffffff);
3003      copy[1] = 127;
30043015      memcpy(copy+2,&hi,sizeof(hi));
30053016      memcpy(copy+6,&lo,sizeof(lo));
30063017      memcpy(copy + 10, data, data_len);
trunk/src/emu/video/tms34061.c
r244646r244647
100100   save_pointer(NAME(m_vram), m_vramsize);
101101   save_pointer(NAME(m_latchram), m_vramsize);
102102   save_item(NAME(m_latchdata));
103   save_pointer(NAME(m_shiftreg), m_vramsize);
103104}
104105
105106//-------------------------------------------------
trunk/src/mess/drivers/mbee.c
r244646r244647
8888    3. At the Basic prompt, type in EDASM press enter. At the memory size
8989       prompt press enter. Now, make sure the keyboard works properly.
9090
91    How to use the config switch for PIO B7:
92    - Teleterm: Must use RTC. Anything else makes teleterm go crazy.
93    - 256TC, 128, 128p: Doesn't seem to matter, leave at the default.
94    - Standard: Has no effect, best left at "Tied High"
95    - Other rom-based models: "VS" to make the Telcom clock work, or "Tied high".
96    - 56k: not sure yet, leave as "Tied high" until more is known.
97
98    How to use programs that need functions keys on models that use the old
99    keyboard (for example, to run Simply Write on a 128k model).
100    Press Ctrl+Shift+number, eg for F1 press hold down Ctrl Shift, press 1.
101
91102***************************************************************************
92103
93104    TODO/not working:
r244646r244647
108119      crashes due to a bug in z80pio emulation.
109120
110121    - 256tc: Keyboard ROM U60 needs to be dumped.
111    - 128k: GOLD PAL needs to be dumped for the bankswitching.
112    - 64k: RED PAL needs to be dumped for the bankswitching.
122    - 128k, 64k: PALs need to be dumped for the bankswitching.
113123
114    - Teleterm: keyboard has multiple severe problems. Also, the schematic shows
115                it using the old-style keyboard, however this must be wrong since
116                the computer has function keys, which are only available on the
117                new keyboard.
124    - Teleterm: keyboard has problems. The schematic shows it using the old-style keyboard,
125                however it actually uses the new keyboard with interrupts.
118126
119127    - Mouse: a few programs support the use of a serial mouse which interfaced
120128             directly to the Z80PIO. However there's little info to be found.
r244646r244647
135143
136144static ADDRESS_MAP_START(mbee_mem, AS_PROGRAM, 8, mbee_state)
137145   ADDRESS_MAP_UNMAP_HIGH
138   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot")
139   AM_RANGE(0x1000, 0x3fff) AM_RAM
140   AM_RANGE(0x4000, 0x7fff) AM_WRITENOP    // Needed because quickload to here will crash MESS
146   AM_RANGE(0x0000, 0x3fff) AM_RAM
141147   AM_RANGE(0x8000, 0xefff) AM_ROM
142   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(mbee_low_r, mbee_low_w)
143   AM_RANGE(0xf800, 0xffff) AM_READWRITE(mbee_high_r, mbee_high_w)
148   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w)
149   AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w)
144150ADDRESS_MAP_END
145151
146152static ADDRESS_MAP_START(mbeeic_mem, AS_PROGRAM, 8, mbee_state)
147   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot")
148   AM_RANGE(0x1000, 0x7fff) AM_RAM
153   AM_RANGE(0x0000, 0x7fff) AM_RAM
149154   AM_RANGE(0x8000, 0xbfff) AM_ROM
150155   AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak")
151156   AM_RANGE(0xe000, 0xefff) AM_ROM
152   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(mbee_low_r, mbee_low_w)
153   AM_RANGE(0xf800, 0xffff) AM_READWRITE(mbeeic_high_r, mbeeic_high_w)
157   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w)
158   AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w)
154159ADDRESS_MAP_END
155160
156161static ADDRESS_MAP_START(mbeepc_mem, AS_PROGRAM, 8, mbee_state)
157   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot")
158   AM_RANGE(0x1000, 0x7fff) AM_RAM
162   AM_RANGE(0x0000, 0x7fff) AM_RAM
159163   AM_RANGE(0x8000, 0xbfff) AM_ROM
160164   AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak")
161165   AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom")
162   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(mbee_low_r, mbee_low_w)
163   AM_RANGE(0xf800, 0xffff) AM_READWRITE(mbeeic_high_r, mbeeic_high_w)
166   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w)
167   AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w)
164168ADDRESS_MAP_END
165169
166static ADDRESS_MAP_START(mbeepc85_mem, AS_PROGRAM, 8, mbee_state)
167   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot")
168   AM_RANGE(0x1000, 0x7fff) AM_RAM
169   AM_RANGE(0x8000, 0xbfff) AM_ROM
170   AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak")
171   AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom")
172   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(mbee_low_r, mbee_low_w)
173   AM_RANGE(0xf800, 0xffff) AM_READWRITE(mbeeic_high_r, mbeeic_high_w)
174ADDRESS_MAP_END
175
176170static ADDRESS_MAP_START(mbeeppc_mem, AS_PROGRAM, 8, mbee_state)
177   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot")
178   AM_RANGE(0x1000, 0x7fff) AM_RAM
171   AM_RANGE(0x0000, 0x7fff) AM_RAM
179172   AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("basic")
180173   AM_RANGE(0xa000, 0xbfff) AM_ROM
181174   AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak")
182175   AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom")
183   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(mbeeppc_low_r, mbeeppc_low_w)
184   AM_RANGE(0xf800, 0xffff) AM_READWRITE(mbeeppc_high_r, mbeeppc_high_w)
176   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w)
177   AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w)
185178ADDRESS_MAP_END
186179
187180static ADDRESS_MAP_START(mbee56_mem, AS_PROGRAM, 8, mbee_state)
188   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot")
189   AM_RANGE(0x1000, 0xdfff) AM_RAM
181   AM_RANGE(0x0000, 0xdfff) AM_RAM
190182   AM_RANGE(0xe000, 0xefff) AM_ROM
191   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(mbee_low_r, mbee_low_w)
192   AM_RANGE(0xf800, 0xffff) AM_READWRITE(mbeeic_high_r, mbeeic_high_w)
183   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w)
184   AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w)
193185ADDRESS_MAP_END
194186
195187static ADDRESS_MAP_START(mbee256_mem, AS_PROGRAM, 8, mbee_state)
r244646r244647
212204ADDRESS_MAP_END
213205
214206static ADDRESS_MAP_START(mbeett_mem, AS_PROGRAM, 8, mbee_state)
215   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot")
216   AM_RANGE(0x1000, 0x7fff) AM_RAM
207   AM_RANGE(0x0000, 0x7fff) AM_RAM
217208   AM_RANGE(0x8000, 0x9fff) AM_ROM
218209   AM_RANGE(0xa000, 0xbfff) AM_RAM
219210   AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak")
220211   AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom")
221   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(mbeeppc_low_r, mbeeppc_low_w)
222   AM_RANGE(0xf800, 0xffff) AM_READWRITE(mbeeppc_high_r, mbeeppc_high_w)
212   AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w)
213   AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w)
223214ADDRESS_MAP_END
224215
225216static ADDRESS_MAP_START(mbee_io, AS_IO, 8, mbee_state)
226217   ADDRESS_MAP_GLOBAL_MASK(0xff)
227218   ADDRESS_MAP_UNMAP_HIGH
228219   AM_RANGE(0x00, 0x03) AM_MIRROR(0x10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
229   AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_READWRITE(mbee_0b_r, mbee_0b_w)
220   AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_WRITE(port0b_w)
230221   AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_READWRITE(m6545_status_r, m6545_index_w)
231222   AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_READWRITE(m6545_data_r, m6545_data_w)
232223ADDRESS_MAP_END
r244646r244647
235226   ADDRESS_MAP_GLOBAL_MASK(0xff)
236227   ADDRESS_MAP_UNMAP_HIGH
237228   AM_RANGE(0x00, 0x03) AM_MIRROR(0x10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
238   AM_RANGE(0x08, 0x08) AM_MIRROR(0x10) AM_READWRITE(mbeeic_08_r, mbeeic_08_w)
239   AM_RANGE(0x09, 0x09) AM_MIRROR(0x10) AM_NOP /* Listed as "Colour Wait Off" or "USART 2651" but doesn't appear in the schematics */
240   AM_RANGE(0x0a, 0x0a) AM_MIRROR(0x10) AM_READWRITE(mbeeic_0a_r, mbeeic_0a_w)
241   AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_READWRITE(mbee_0b_r, mbee_0b_w)
229   AM_RANGE(0x08, 0x08) AM_MIRROR(0x10) AM_READWRITE(port08_r, port08_w)
230   AM_RANGE(0x09, 0x09) AM_WRITENOP /* Listed as "Colour Wait Off" or "USART 2651" but doesn't appear in the schematics */
231   AM_RANGE(0x0a, 0x0a) AM_MIRROR(0x10) AM_WRITE(port0a_w)
232   AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_WRITE(port0b_w)
242233   AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_READWRITE(m6545_status_r, m6545_index_w)
243234   AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_READWRITE(m6545_data_r, m6545_data_w)
244235ADDRESS_MAP_END
r244646r244647
246237static ADDRESS_MAP_START(mbeepc_io, AS_IO, 8, mbee_state)
247238   ADDRESS_MAP_UNMAP_HIGH
248239   AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
249   AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(mbeeic_08_r, mbeeic_08_w)
250   AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_low_r, mbeeic_0a_w)
251   AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_READWRITE(mbee_0b_r, mbee_0b_w)
240   AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(port08_r, port08_w)
241   AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP
242   AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_WRITE(port0b_w)
252243   AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff10) AM_READWRITE(m6545_status_r, m6545_index_w)
253244   AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_READWRITE(m6545_data_r, m6545_data_w)
254   AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_high_r, mbeeic_0a_w)
245   AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_low_r, port0a_w)
246   AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_high_r, port0a_w)
255247ADDRESS_MAP_END
256248
257static ADDRESS_MAP_START(mbeepc85_io, AS_IO, 8, mbee_state)
249static ADDRESS_MAP_START(mbeeppc_io, AS_IO, 8, mbee_state)
258250   ADDRESS_MAP_UNMAP_HIGH
259251   AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
260   AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(mbeeic_08_r, mbeeic_08_w)
261   AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_low_r, mbeeic_0a_w)
262   AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_READWRITE(mbee_0b_r, mbee_0b_w)
263   AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff10) AM_READWRITE(m6545_status_r, m6545_index_w)
252   AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(port08_r, port08_w)
253   AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP
254   AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_WRITE(port0b_w)
255   AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_READWRITE(m6545_status_r, m6545_index_w)
264256   AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_READWRITE(m6545_data_r, m6545_data_w)
265   AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_high_r, mbeeic_0a_w)
257   AM_RANGE(0x001c, 0x001c) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w)
258   AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_low_r, port0a_w)
259   AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_high_r, port0a_w)
266260ADDRESS_MAP_END
267261
268static ADDRESS_MAP_START(mbeeppc_io, AS_IO, 8, mbee_state)
262static ADDRESS_MAP_START(mbeett_io, AS_IO, 8, mbee_state)
269263   ADDRESS_MAP_UNMAP_HIGH
270   AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
271   AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(mbeeic_08_r, mbeeic_08_w)
272   AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_low_r, mbeeic_0a_w)
273   AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_READWRITE(mbee_0b_r, mbee_0b_w)
264   AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
265   AM_RANGE(0x0004, 0x0004) AM_MIRROR(0xff00) AM_WRITE(port04_w)
266   AM_RANGE(0x0006, 0x0006) AM_MIRROR(0xff00) AM_WRITE(port06_w)
267   AM_RANGE(0x0007, 0x0007) AM_MIRROR(0xff00) AM_READ(port07_r)
268   AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(port08_r, port08_w)
269   AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_WRITE(port0b_w)
274270   AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_READWRITE(m6545_status_r, m6545_index_w)
275   AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_READWRITE(m6545_data_r, m6545_data_w)
276   AM_RANGE(0x001c, 0x001c) AM_MIRROR(0xff00) AM_READWRITE(mbeeppc_1c_r, mbeeppc_1c_w)
277   AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_high_r, mbeeic_0a_w)
271   AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_READWRITE(m6545_data_r, m6545_data_w)
272   AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(port18_r)
273   AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w)
274   AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xfe00) AM_READ(speed_low_r)
275   AM_RANGE(0x0109, 0x0109) AM_MIRROR(0xfe00) AM_READ(speed_high_r)
276   AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe00) AM_READWRITE(telcom_low_r, port0a_w)
277   AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe00) AM_READWRITE(telcom_high_r, port0a_w)
278   AM_RANGE(0x0068, 0x006f) AM_MIRROR(0xff00) AM_DEVREADWRITE("scc", scc8530_t, reg_r, reg_w)
278279ADDRESS_MAP_END
279280
280281static ADDRESS_MAP_START(mbee56_io, AS_IO, 8, mbee_state)
281282   ADDRESS_MAP_GLOBAL_MASK(0xff)
282283   ADDRESS_MAP_UNMAP_HIGH
283   AM_RANGE(0x00, 0x03) AM_MIRROR(0x10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
284   AM_RANGE(0x08, 0x08) AM_MIRROR(0x10) AM_READWRITE(mbeeic_08_r, mbeeic_08_w)
285   AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_READWRITE(mbee_0b_r, mbee_0b_w)
286   AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_READWRITE(m6545_status_r, m6545_index_w)
287   AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_READWRITE(m6545_data_r, m6545_data_w)
284   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
285   AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r, port08_w)
286   AM_RANGE(0x09, 0x09) AM_WRITENOP
287   AM_RANGE(0x0b, 0x0b) AM_WRITE(port0b_w)
288   AM_RANGE(0x0c, 0x0c) AM_READWRITE(m6545_status_r, m6545_index_w)
289   AM_RANGE(0x0d, 0x0d) AM_READWRITE(m6545_data_r, m6545_data_w)
288290   AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write)
289291   AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w)
290292ADDRESS_MAP_END
r244646r244647
293295   ADDRESS_MAP_GLOBAL_MASK(0xff)
294296   ADDRESS_MAP_UNMAP_HIGH
295297   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
296   AM_RANGE(0x04, 0x04) AM_WRITE(mbee_04_w)
297   AM_RANGE(0x06, 0x06) AM_WRITE(mbee_06_w)
298   AM_RANGE(0x07, 0x07) AM_READ(mbee_07_r)
299   AM_RANGE(0x08, 0x08) AM_READWRITE(mbeeic_08_r, mbeeic_08_w)
300   AM_RANGE(0x0b, 0x0b) AM_READWRITE(mbee_0b_r, mbee_0b_w)
298   AM_RANGE(0x04, 0x04) AM_WRITE(port04_w)
299   AM_RANGE(0x06, 0x06) AM_WRITE(port06_w)
300   AM_RANGE(0x07, 0x07) AM_READ(port07_r)
301   AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r, port08_w)
302   AM_RANGE(0x09, 0x09) AM_WRITENOP
303   AM_RANGE(0x0b, 0x0b) AM_WRITE(port0b_w)
301304   AM_RANGE(0x0c, 0x0c) AM_READWRITE(m6545_status_r, m6545_index_w)
302305   AM_RANGE(0x0d, 0x0d) AM_READWRITE(m6545_data_r, m6545_data_w)
303   AM_RANGE(0x1c, 0x1f) AM_READWRITE(mbeeppc_1c_r, mbee256_1c_w)
306   AM_RANGE(0x1c, 0x1f) AM_READWRITE(port1c_r, port1c_w)
304307   AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write)
305308   AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w)
306309   AM_RANGE(0x50, 0x57) AM_WRITE(mbee128_50_w)
r244646r244647
309312static ADDRESS_MAP_START(mbee256_io, AS_IO, 8, mbee_state)
310313   ADDRESS_MAP_UNMAP_HIGH
311314   AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
312   AM_RANGE(0x0004, 0x0004) AM_MIRROR(0xff00) AM_WRITE(mbee_04_w)
313   AM_RANGE(0x0006, 0x0006) AM_MIRROR(0xff00) AM_WRITE(mbee_06_w)
314   AM_RANGE(0x0007, 0x0007) AM_MIRROR(0xff00) AM_READ(mbee_07_r)
315   AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(mbeeic_08_r, mbeeic_08_w)
316   AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xfd00) AM_READ(mbee256_speed_low_r)
317   AM_RANGE(0x0209, 0x0209) AM_MIRROR(0xfd00) AM_READ(mbee256_speed_high_r)
318   AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_READWRITE(mbee_0b_r, mbee_0b_w)
315   AM_RANGE(0x0004, 0x0004) AM_MIRROR(0xff00) AM_WRITE(port04_w)
316   AM_RANGE(0x0006, 0x0006) AM_MIRROR(0xff00) AM_WRITE(port06_w)
317   AM_RANGE(0x0007, 0x0007) AM_MIRROR(0xff00) AM_READ(port07_r)
318   AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(port08_r, port08_w)
319   AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xfd00) AM_READ(speed_low_r)
320   AM_RANGE(0x0209, 0x0209) AM_MIRROR(0xfd00) AM_READ(speed_high_r)
321   AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP
322   AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_WRITE(port0b_w)
319323   AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_READWRITE(m6545_status_r, m6545_index_w)
320324   AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_READWRITE(m6545_data_r, m6545_data_w)
321325   // AM_RANGE(0x0010, 0x0013) AM_MIRROR(0xff00) Optional SN76489AN audio chip
322   AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(mbee256_18_r)
323   AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(mbeeppc_1c_r, mbee256_1c_w)
326   AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(port18_r)
327   AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w)
324328   AM_RANGE(0x0044, 0x0047) AM_MIRROR(0xff00) AM_DEVREADWRITE("fdc", wd2793_t, read, write)
325329   AM_RANGE(0x0048, 0x004f) AM_MIRROR(0xff00) AM_READWRITE(fdc_status_r, fdc_motor_w)
326330   AM_RANGE(0x0050, 0x0057) AM_MIRROR(0xff00) AM_WRITE(mbee256_50_w)
r244646r244647
329333   // AM_RANGE(0x0068, 0x006f) AM_MIRROR(0xff00) Reserved for 8530 SCC (unused)
330334ADDRESS_MAP_END
331335
332static ADDRESS_MAP_START(mbeett_io, AS_IO, 8, mbee_state)
333   ADDRESS_MAP_UNMAP_HIGH
334   AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt)
335   AM_RANGE(0x0004, 0x0004) AM_MIRROR(0xff00) AM_WRITE(mbee_04_w)
336   AM_RANGE(0x0006, 0x0006) AM_MIRROR(0xff00) AM_WRITE(mbee_06_w)
337   AM_RANGE(0x0007, 0x0007) AM_MIRROR(0xff00) AM_READ(mbee_07_r)
338   AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(mbeeic_08_r, mbeeic_08_w)
339   AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_READWRITE(mbee_0b_r, mbee_0b_w)
340   AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_READWRITE(m6545_status_r, m6545_index_w)
341   AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_READWRITE(m6545_data_r, m6545_data_w)
342   AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(mbee256_18_r)
343   AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(mbeeppc_1c_r,mbee256_1c_w)
344   AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_low_r, mbeeic_0a_w)
345   AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_high_r, mbeeic_0a_w)
346   // AM_RANGE(0x0068, 0x006f) AM_MIRROR(0xff00) 8530 SCC
347ADDRESS_MAP_END
348
349336static INPUT_PORTS_START( mbee )
350337   PORT_START("X.0") /* IN0 KEY ROW 0 [000] */
351338   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') PORT_CHAR('`')
r244646r244647
419406
420407   PORT_START("X.7") /* IN7 KEY ROW 7 [380] */
421408   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
422   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL)
409   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
423410   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
424411   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
425412   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
r244646r244647
444431   PORT_CONFNAME( 0xc0, 0x80, "PIO B7")
445432   PORT_CONFSETTING(    0x00, "VS") // sync pulse to enable telcom clock
446433   PORT_CONFSETTING(    0x40, "RTC") // optional board usually not fitted
447   PORT_CONFSETTING(    0x80, "Not used") // default resistor to vcc
448   PORT_CONFSETTING(    0xc0, "Centronics") // busy line
434   PORT_CONFSETTING(    0x80, "Tied high") // default resistor to vcc
435   PORT_CONFSETTING(    0xc0, "Reserved for net")
449436INPUT_PORTS_END
450437
451438static INPUT_PORTS_START( mbee256 )
r244646r244647
576563   PORT_CONFSETTING(    0x00, DEF_STR(No))
577564   PORT_CONFSETTING(    0x01, DEF_STR(Yes))
578565   // Wire links on motherboard
579   PORT_CONFNAME( 0xc0, 0x80, "PIO B7") // default - do nothing
566   PORT_CONFNAME( 0xc0, 0x40, "PIO B7")
580567   PORT_CONFSETTING(    0x00, "VS") // sync pulse to enable telcom clock
581   PORT_CONFSETTING(    0x40, "RTC") // optional board usually not fitted
582   PORT_CONFSETTING(    0x80, "Not used") // default resistor to vcc
583   PORT_CONFSETTING(    0xc0, "Centronics") // busy line
568   PORT_CONFSETTING(    0x40, "RTC") // RTC IRQ must be used on teleterm
569   PORT_CONFSETTING(    0x80, "Tied high") // default resistor to vcc
570   PORT_CONFSETTING(    0xc0, "Reserved for net")
584571INPUT_PORTS_END
585572
586573static const z80_daisy_config mbee_daisy_chain[] =
r244646r244647
744731   MCFG_CPU_IO_MAP(mbeepc_io)
745732MACHINE_CONFIG_END
746733
747static MACHINE_CONFIG_DERIVED( mbeepc85, mbeeic )
748   MCFG_CPU_MODIFY( "maincpu" )
749   MCFG_CPU_PROGRAM_MAP(mbeepc85_mem)
750   MCFG_CPU_IO_MAP(mbeepc85_io)
751MACHINE_CONFIG_END
752
753static MACHINE_CONFIG_DERIVED( mbeepc85b, mbeepc85 )
734static MACHINE_CONFIG_DERIVED( mbeepc85b, mbeepc )
754735   MCFG_PALETTE_MODIFY("palette")
755736   MCFG_PALETTE_INIT_OWNER(mbee_state, mbeepc85b)
756737MACHINE_CONFIG_END
r244646r244647
764745   MCFG_PALETTE_MODIFY("palette")
765746   MCFG_PALETTE_ENTRIES(16)
766747   MCFG_PALETTE_INIT_OWNER(mbee_state, premium)
748   MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz )
749   MCFG_MC146818_IRQ_HANDLER(WRITELINE(mbee_state, rtc_irq_w))
767750MACHINE_CONFIG_END
768751
769752static MACHINE_CONFIG_DERIVED( mbee56, mbeeic )
r244646r244647
784767   MCFG_CPU_IO_MAP(mbee128_io)
785768   MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128)
786769   MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz )
770   MCFG_MC146818_IRQ_HANDLER(WRITELINE(mbee_state, rtc_irq_w))
787771MACHINE_CONFIG_END
788772
789773static MACHINE_CONFIG_DERIVED( mbee128p, mbeeppc )
r244646r244647
791775   MCFG_CPU_PROGRAM_MAP(mbee256_mem)
792776   MCFG_CPU_IO_MAP(mbee128_io)
793777   MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128)
794   MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz )
795778   MCFG_WD2793x_ADD("fdc", XTAL_4MHz / 4)
796779   MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(mbee_state, fdc_intrq_w))
797780   MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(mbee_state, fdc_drq_w))
r244646r244647
816799   MCFG_CPU_PROGRAM_MAP(mbeett_mem)
817800   MCFG_CPU_IO_MAP(mbeett_io)
818801   MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbeett)
819   MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz )
802   MCFG_DEVICE_REMOVE("quickload")
803   MCFG_DEVICE_REMOVE("quickload2")
804   MCFG_DEVICE_ADD("scc", SCC8530, 4000000) // clock unknown
820805MACHINE_CONFIG_END
821806
822807/* Unused roms:
r244646r244647
11521137COMP( 1982, mbee,     0,        0,      mbee,     mbee,     mbee_state,  mbee,       "Applied Technology",  "Microbee 16 Standard" , 0 )
11531138COMP( 1982, mbeeic,   mbee,     0,      mbeeic,   mbee,     mbee_state,  mbeeic,     "Applied Technology",  "Microbee 32 IC" , 0 )
11541139COMP( 1982, mbeepc,   mbee,     0,      mbeepc,   mbee,     mbee_state,  mbeepc,     "Applied Technology",  "Microbee Personal Communicator" , 0 )
1155COMP( 1985, mbeepc85, mbee,     0,      mbeepc85, mbee,     mbee_state,  mbeepc85,   "Applied Technology",  "Microbee PC85" , 0 )
1140COMP( 1985, mbeepc85, mbee,     0,      mbeepc,  mbee,     mbee_state,  mbeepc85,   "Applied Technology",  "Microbee PC85" , 0 )
11561141COMP( 1985, mbeepc85b,mbee,     0,      mbeepc85b,mbee,     mbee_state,  mbeepc85,   "Applied Technology",  "Microbee PC85 (New version)" , 0 )
1157COMP( 1985, mbeepc85s,mbee,     0,      mbeepc85, mbee,     mbee_state,  mbeepc85,   "Applied Technology",  "Microbee PC85 (Swedish)" , 0 )
1142COMP( 1985, mbeepc85s,mbee,     0,      mbeepc,  mbee,     mbee_state,  mbeepc85,   "Applied Technology",  "Microbee PC85 (Swedish)" , 0 )
11581143COMP( 1986, mbeeppc,  mbee,     0,      mbeeppc,  mbee,     mbee_state,  mbeeppc,    "Applied Technology",  "Microbee Premium PC85" , 0 )
11591144COMP( 1986, mbeett,   mbee,     0,      mbeett,   mbee256,  mbee_state,  mbeett,     "Applied Technology",  "Microbee Teleterm" , GAME_NOT_WORKING )
11601145COMP( 1986, mbee56,   mbee,     0,      mbee56,   mbee,     mbee_state,  mbee56,     "Applied Technology",  "Microbee 56k" , GAME_NOT_WORKING )
trunk/src/mess/includes/mbee.h
r244646r244647
1010#include "emu.h"
1111#include "imagedev/snapquik.h"
1212#include "machine/z80pio.h"
13#include "machine/8530scc.h"
1314#include "imagedev/cassette.h"
1415#include "machine/buffer.h"
1516#include "bus/centronics/ctronics.h"
r244646r244647
2728public:
2829   enum
2930   {
30      TIMER_MBEE_NEWKB,
31      TIMER_MBEE_RTC_IRQ,
32      TIMER_MBEE_BOOT
31      TIMER_MBEE_NEWKB
3332   };
3433
3534   mbee_state(const machine_config &mconfig, device_type type, const char *tag)
r244646r244647
4746      , m_floppy0(*this, "fdc:0")
4847      , m_floppy1(*this, "fdc:1")
4948      , m_rtc(*this, "rtc")
50      , m_boot(*this, "boot")
5149      , m_pak(*this, "pak")
5250      , m_telcom(*this, "telcom")
5351      , m_basic(*this, "basic")
r244646r244647
5856      , m_screen(*this, "screen")
5957   { }
6058
61   DECLARE_WRITE8_MEMBER(mbee_04_w);
62   DECLARE_WRITE8_MEMBER(mbee_06_w);
63   DECLARE_READ8_MEMBER(mbee_07_r);
64   DECLARE_READ8_MEMBER(mbeeic_0a_r);
65   DECLARE_WRITE8_MEMBER(mbeeic_0a_w);
66   DECLARE_READ8_MEMBER(mbeepc_telcom_low_r);
67   DECLARE_READ8_MEMBER(mbeepc_telcom_high_r);
68   DECLARE_READ8_MEMBER(mbee256_speed_low_r);
69   DECLARE_READ8_MEMBER(mbee256_speed_high_r);
70   DECLARE_READ8_MEMBER(mbee256_18_r);
59   DECLARE_WRITE8_MEMBER(port04_w);
60   DECLARE_WRITE8_MEMBER(port06_w);
61   DECLARE_READ8_MEMBER(port07_r);
62   DECLARE_READ8_MEMBER(port08_r);
63   DECLARE_WRITE8_MEMBER(port08_w);
64   DECLARE_WRITE8_MEMBER(port0a_w);
65   DECLARE_WRITE8_MEMBER(port0b_w);
66   DECLARE_READ8_MEMBER(port18_r);
67   DECLARE_READ8_MEMBER(port1c_r);
68   DECLARE_WRITE8_MEMBER(port1c_w);
7169   DECLARE_WRITE8_MEMBER(mbee128_50_w);
7270   DECLARE_WRITE8_MEMBER(mbee256_50_w);
71   DECLARE_READ8_MEMBER(telcom_low_r);
72   DECLARE_READ8_MEMBER(telcom_high_r);
73   DECLARE_READ8_MEMBER(speed_low_r);
74   DECLARE_READ8_MEMBER(speed_high_r);
7375   DECLARE_READ8_MEMBER(m6545_status_r);
7476   DECLARE_WRITE8_MEMBER(m6545_index_w);
7577   DECLARE_READ8_MEMBER(m6545_data_r);
7678   DECLARE_WRITE8_MEMBER(m6545_data_w);
77   DECLARE_READ8_MEMBER(mbee_low_r);
78   DECLARE_READ8_MEMBER(mbee_high_r);
79   DECLARE_READ8_MEMBER(mbeeic_high_r);
80   DECLARE_WRITE8_MEMBER(mbeeic_high_w);
81   DECLARE_WRITE8_MEMBER(mbee_low_w);
82   DECLARE_WRITE8_MEMBER(mbee_high_w);
83   DECLARE_READ8_MEMBER(mbeeic_08_r);
84   DECLARE_WRITE8_MEMBER(mbeeic_08_w);
85   DECLARE_READ8_MEMBER(mbee_0b_r);
86   DECLARE_WRITE8_MEMBER(mbee_0b_w);
87   DECLARE_READ8_MEMBER(mbeeppc_1c_r);
88   DECLARE_WRITE8_MEMBER(mbeeppc_1c_w);
89   DECLARE_WRITE8_MEMBER(mbee256_1c_w);
90   DECLARE_READ8_MEMBER(mbeeppc_low_r);
91   DECLARE_READ8_MEMBER(mbeeppc_high_r);
92   DECLARE_WRITE8_MEMBER(mbeeppc_high_w);
93   DECLARE_WRITE8_MEMBER(mbeeppc_low_w);
79   DECLARE_READ8_MEMBER(video_low_r);
80   DECLARE_READ8_MEMBER(video_high_r);
81   DECLARE_WRITE8_MEMBER(video_low_w);
82   DECLARE_WRITE8_MEMBER(video_high_w);
9483   DECLARE_WRITE8_MEMBER(pio_port_b_w);
9584   DECLARE_READ8_MEMBER(pio_port_b_r);
9685   DECLARE_WRITE_LINE_MEMBER(pio_ardy);
r244646r244647
119108   DECLARE_MACHINE_RESET(mbeett);
120109   UINT32 screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
121110   TIMER_CALLBACK_MEMBER(timer_newkb);
122   TIMER_CALLBACK_MEMBER(timer_rtc_irq);
123111   TIMER_CALLBACK_MEMBER(timer_boot);
124112   DECLARE_QUICKLOAD_LOAD_MEMBER(mbee);
125113   DECLARE_QUICKLOAD_LOAD_MEMBER(mbee_z80bin);
114   WRITE_LINE_MEMBER(rtc_irq_w);
126115   WRITE_LINE_MEMBER(fdc_intrq_w);
127116   WRITE_LINE_MEMBER(fdc_drq_w);
128   UINT8 *m_p_videoram;
129   UINT8 *m_p_gfxram;
130   UINT8 *m_p_colorram;
131   UINT8 *m_p_attribram;
132   UINT8 m_framecnt;
133   UINT8 m_08;
134   UINT8 m_1c;
135   void mbee_video_kbd_scan(int param);
136   UINT8 m_sy6545_cursor[16];
137
138117   MC6845_UPDATE_ROW(mono_update_row);
139118   MC6845_UPDATE_ROW(colour_update_row);
140119   MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr);
141120
142121   required_device<palette_device> m_palette;
143122private:
123   UINT8 *m_p_videoram;
124   UINT8 *m_p_gfxram;
125   UINT8 *m_p_colorram;
126   UINT8 *m_p_attribram;
144127   bool m_is_premium;
145128   bool m_has_oldkb;
146129   size_t m_size;
r244646r244647
148131   bool m_b7_vs;
149132   bool m_b2;
150133   bool m_is_mbeett;
134   UINT8 m_framecnt;
135   UINT8 m_08;
136   UINT8 m_0a;
137   UINT8 m_0b;
138   UINT8 m_1c;
139   UINT8 m_sy6545_cursor[16];
151140   UINT8 m_mbee256_was_pressed[15];
152141   UINT8 m_mbee256_q[20];
153142   UINT8 m_mbee256_q_pos;
154   UINT8 m_0a;
155   UINT8 m_0b;
156143   UINT8 m_sy6545_status;
157144   UINT8 m_sy6545_reg[32];
158145   UINT8 m_sy6545_ind;
r244646r244647
160147   UINT8 m_bank_array[33];
161148   void setup_banks(UINT8 data, bool first_time, UINT8 b_mask);
162149   void sy6545_cursor_configure();
163   void keyboard_matrix_r(int offs);
164   void machine_reset_common_disk();
150   void oldkb_scan(UINT16 param);
151   void oldkb_matrix_r(UINT16 offs);
152   void machine_reset_common();
165153   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
166154   required_device<cpu_device> m_maincpu;
167155   required_device<z80pio_device> m_pio;
r244646r244647
175163   optional_device<floppy_connector> m_floppy0;
176164   optional_device<floppy_connector> m_floppy1;
177165   optional_device<mc146818_device> m_rtc;
178   optional_memory_bank m_boot;
179166   optional_memory_bank m_pak;
180167   optional_memory_bank m_telcom;
181168   optional_memory_bank m_basic;
trunk/src/mess/machine/mbee.c
r244646r244647
2020   case TIMER_MBEE_NEWKB:
2121      timer_newkb(ptr, param);
2222      break;
23   case TIMER_MBEE_RTC_IRQ:
24      timer_rtc_irq(ptr, param);
25      break;
26   case TIMER_MBEE_BOOT:
27      timer_boot(ptr, param);
28      break;
2923   default:
3024      assert_always(FALSE, "Unknown id in mbee_state::device_timer");
3125   }
r244646r244647
4640WRITE8_MEMBER( mbee_state::pio_port_b_w )
4741{
4842/*  PIO port B - d5..d2 not emulated
49    d7 network interrupt (microbee network for classrooms)
43    d7 interrupt from network or rtc or vsync or not used (see config switch)
5044    d6 speaker
5145    d5 rs232 output (1=mark)
5246    d4 rs232 input (0=mark)
5347    d3 rs232 CTS (0=clear to send)
5448    d2 rs232 clock or DTR
55    d1 cass out and (on 256tc) keyboard irq
49    d1 cass out and (on new keyboard) keyboard irq
5650    d0 cass in */
5751
58   m_cassette->output((data & 0x02) ? -1.0 : +1.0);
59
52   m_cassette->output(BIT(data, 1) ? -1.0 : +1.0);
6053   m_speaker->level_w(BIT(data, 6));
6154};
6255
r244646r244647
6457{
6558   UINT8 data = 0;
6659
67   if (m_cassette->input() > 0.03) data |= 1;
60   if (m_cassette->input() > 0.03)
61      data |= 1;
6862
6963   data |= 8; // CTS held high via resistor. If low, the disk-based models think a mouse is plugged in.
7064
71   if (m_is_mbeett)
65   switch (m_io_config->read() & 0xc0)
7266   {
73      if (m_b2)
74         data |= 0x82;
75      else
67      case 0x00:
68         data |= (UINT8)m_b7_vs << 7;
69         break;
70      case 0x40:
71         data |= (UINT8)m_b7_rtc << 7;
72         break;
73      case 0x80:
7674         data |= 0x80;
75         break;
7776   }
78   else
79   {
80      switch (m_io_config->read() & 0xc0)
81      {
82         case 0x00:
83            data |= (UINT8)m_b7_vs << 7;
84            break;
85         case 0x40:
86            data |= (UINT8)m_b7_rtc << 7;
87            break;
88         case 0x80:
89            data |= 0x80;
90            break;
91         case 0xc0:
92            data |= 0x80; // centronics busy line - FIXME
93            break;
94      }
95      data |= (UINT8)m_b2 << 1; // key pressed on new keyboard
96   }
77   data |= (UINT8)m_b2 << 1; // key pressed on new keyboard
9778
9879   return data;
9980}
r244646r244647
194175
195176   // if anything queued, cause an interrupt
196177   if (m_mbee256_q_pos)
197   {
198178      m_b2 = 1; // set irq
199      //breaks keyboard m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff));
200   }
201179
202   timer_set(attotime::from_hz(25), TIMER_MBEE_NEWKB);
180   if (m_b2)
181      m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff));
182
183   timer_set(attotime::from_hz(10), TIMER_MBEE_NEWKB);
203184}
204185
205READ8_MEMBER( mbee_state::mbee256_18_r )
186READ8_MEMBER( mbee_state::port18_r )
206187{
207188   UINT8 i, data = m_mbee256_q[0]; // get oldest key
208189
r244646r244647
223204
224205************************************************************/
225206
226READ8_MEMBER( mbee_state::mbee256_speed_low_r )
207READ8_MEMBER( mbee_state::speed_low_r )
227208{
228209   m_maincpu->set_unscaled_clock(3375000);
229210   return 0xff;
230211}
231212
232READ8_MEMBER( mbee_state::mbee256_speed_high_r )
213READ8_MEMBER( mbee_state::speed_high_r )
233214{
234215   m_maincpu->set_unscaled_clock(6750000);
235216   return 0xff;
r244646r244647
243224
244225************************************************************/
245226
246WRITE8_MEMBER( mbee_state::mbee_04_w )  // address
227WRITE8_MEMBER( mbee_state::port04_w )  // address
247228{
248229   m_rtc->write(space, 0, data);
249230}
250231
251WRITE8_MEMBER( mbee_state::mbee_06_w )  // write
232WRITE8_MEMBER( mbee_state::port06_w )  // write
252233{
253234   m_rtc->write(space, 1, data);
254235}
255236
256READ8_MEMBER( mbee_state::mbee_07_r )   // read
237READ8_MEMBER( mbee_state::port07_r )   // read
257238{
258239   return m_rtc->read(space, 1);
259240}
260241
261// This doesn't seem to do anything; the time works without it.
262TIMER_CALLBACK_MEMBER( mbee_state::timer_rtc_irq )
242// See it work: Run mbeett, choose RTC in the config switches, run the F3 test, press Esc.
243WRITE_LINE_MEMBER( mbee_state::rtc_irq_w )
263244{
264   if (!m_rtc)
265      return;
245   m_b7_rtc = (state) ? 0 : 1; // inverted by IC15 (pins 8,9,10)
266246
267   UINT8 data = m_rtc->read(m_maincpu->space(AS_IO), 12);
268   m_b7_rtc = (data) ? 1 : 0;
269
270247   if ((m_io_config->read() & 0xc0) == 0x40) // RTC selected in config menu
271248      m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff));
272
273   timer_set(attotime::from_hz(10), TIMER_MBEE_RTC_IRQ);
274249}
275250
276251
r244646r244647
327302            if (!BIT(b_byte, 4))
328303            {
329304               // select video
330               if (m_is_premium)
331               {
332                  mem.install_read_handler (b_vid, b_vid + 0x7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this));
333                  mem.install_read_handler (b_vid + 0x800, b_vid + 0xfff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this));
334               }
335               else
336               {
337                  mem.install_read_handler (b_vid, b_vid + 0x7ff, read8_delegate(FUNC(mbee_state::mbee_low_r), this));
338                  mem.install_read_handler (b_vid + 0x800, b_vid + 0xfff, read8_delegate(FUNC(mbee_state::mbeeic_high_r), this));
339               }
305               mem.install_read_handler (b_vid, b_vid + 0x7ff, read8_delegate(FUNC(mbee_state::video_low_r), this));
306               mem.install_read_handler (b_vid + 0x800, b_vid + 0xfff, read8_delegate(FUNC(mbee_state::video_high_r), this));
340307            }
341308            else
342309            {
r244646r244647
367334            if (!BIT(b_byte, 4))
368335            {
369336               // select video
370               if (m_is_premium)
371               {
372                  mem.install_write_handler (b_vid, b_vid + 0x7ff, write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
373                  mem.install_write_handler (b_vid + 0x800, b_vid + 0xfff, write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
374               }
375               else
376               {
377                  mem.install_write_handler (b_vid, b_vid + 0x7ff, write8_delegate(FUNC(mbee_state::mbee_low_w), this));
378                  mem.install_write_handler (b_vid + 0x800, b_vid + 0xfff, write8_delegate(FUNC(mbee_state::mbeeic_high_w), this));
379               }
337               mem.install_write_handler (b_vid, b_vid + 0x7ff, write8_delegate(FUNC(mbee_state::video_low_w), this));
338               mem.install_write_handler (b_vid + 0x800, b_vid + 0xfff, write8_delegate(FUNC(mbee_state::video_high_w), this));
380339            }
381340            else
382341            {
r244646r244647
433392
434393************************************************************/
435394
436READ8_MEMBER( mbee_state::mbeeic_0a_r )
395WRITE8_MEMBER( mbee_state::port0a_w )
437396{
438   return m_0a;
439}
440
441WRITE8_MEMBER( mbee_state::mbeeic_0a_w )
442{
443397   m_0a = data;
444   m_pak->set_entry(data & 15);
398
399   if (m_pak)
400      m_pak->set_entry(data & 15);
445401}
446402
447READ8_MEMBER( mbee_state::mbeepc_telcom_low_r )
403READ8_MEMBER( mbee_state::telcom_low_r )
448404{
449405/* Read of port 0A - set Telcom rom to first half */
450   m_telcom->set_entry(0);
406   if (m_telcom)
407      m_telcom->set_entry(0);
408
451409   return m_0a;
452410}
453411
454READ8_MEMBER( mbee_state::mbeepc_telcom_high_r )
412READ8_MEMBER( mbee_state::telcom_high_r )
455413{
456414/* Read of port 10A - set Telcom rom to 2nd half */
457   m_telcom->set_entry(1);
415   if (m_telcom)
416      m_telcom->set_entry(1);
417
458418   return m_0a;
459419}
460420
r244646r244647
471431*/
472432
473433
474/* after the first 4 bytes have been read from ROM, switch the ram back in */
475TIMER_CALLBACK_MEMBER( mbee_state::timer_boot )
434void mbee_state::machine_reset_common()
476435{
477   m_boot->set_entry(0);
478}
479
480void mbee_state::machine_reset_common_disk()
481{
482436   m_fdc_rq = 0;
437   m_08 = 0;
438   m_0a = 0;
439   m_0b = 0;
440   m_1c = 0;
441
442   if (m_basic)
443      m_basic->set_entry(0);
444
445   if (m_telcom)
446      m_telcom->set_entry(0);
483447}
484448
485449MACHINE_RESET_MEMBER( mbee_state, mbee )
486450{
487   m_boot->set_entry(1);
488   timer_set(attotime::from_usec(4), TIMER_MBEE_BOOT);
451   machine_reset_common();
452   m_maincpu->set_pc(0x8000);
489453}
490454
491455MACHINE_RESET_MEMBER( mbee_state, mbee56 )
492456{
493   machine_reset_common_disk();
494   m_boot->set_entry(1);
495   timer_set(attotime::from_usec(4), TIMER_MBEE_BOOT);
457   machine_reset_common();
458   m_maincpu->set_pc(0xE000);
496459}
497460
498461MACHINE_RESET_MEMBER( mbee_state, mbee128 )
499462{
500   machine_reset_common_disk();
463   machine_reset_common();
501464   setup_banks(0, 1, 3); // set banks to default
502465   m_maincpu->set_pc(0x8000);
503466}
504467
505468MACHINE_RESET_MEMBER( mbee_state, mbee256 )
506469{
507   UINT8 i;
508   for (i = 0; i < 15; i++) m_mbee256_was_pressed[i] = 0;
509470   m_mbee256_q_pos = 0;
510   machine_reset_common_disk();
471   machine_reset_common();
511472   setup_banks(0, 1, 7); // set banks to default
512473   m_maincpu->set_pc(0x8000);
513474}
514475
515476MACHINE_RESET_MEMBER( mbee_state, mbeett )
516477{
517   UINT8 i;
518   for (i = 0; i < 15; i++) m_mbee256_was_pressed[i] = 0;
519478   m_mbee256_q_pos = 0;
520   m_boot->set_entry(1);
521   timer_set(attotime::from_usec(4), TIMER_MBEE_BOOT);
479   machine_reset_common();
480   m_maincpu->set_pc(0x8000);
522481}
523482
524483DRIVER_INIT_MEMBER( mbee_state, mbee )
525484{
526   UINT8 *RAM = memregion("maincpu")->base();
527   m_boot->configure_entries(0, 2, &RAM[0x0000], 0x8000);
528485   m_size = 0x4000;
529486   m_has_oldkb = 1;
530487   m_is_mbeett = 0;
r244646r244647
532489
533490DRIVER_INIT_MEMBER( mbee_state, mbeeic )
534491{
535   UINT8 *RAM = memregion("maincpu")->base();
536   m_boot->configure_entries(0, 2, &RAM[0x0000], 0x8000);
537
538   RAM = memregion("pakrom")->base();
492   UINT8 *RAM = memregion("pakrom")->base();
539493   m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
540
541494   m_pak->set_entry(0);
495
542496   m_size = 0x8000;
543497   m_has_oldkb = 1;
544498   m_is_mbeett = 0;
r244646r244647
546500
547501DRIVER_INIT_MEMBER( mbee_state, mbeepc )
548502{
549   UINT8 *RAM = memregion("maincpu")->base();
550   m_boot->configure_entries(0, 2, &RAM[0x0000], 0x8000);
551
552   RAM = memregion("telcomrom")->base();
503   UINT8 *RAM = memregion("telcomrom")->base();
553504   m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000);
554505
555506   RAM = memregion("pakrom")->base();
556507   m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
557
558508   m_pak->set_entry(0);
559   m_telcom->set_entry(0);
509
560510   m_size = 0x8000;
561511   m_has_oldkb = 1;
562512   m_is_mbeett = 0;
r244646r244647
564514
565515DRIVER_INIT_MEMBER( mbee_state, mbeepc85 )
566516{
567   UINT8 *RAM = memregion("maincpu")->base();
568   m_boot->configure_entries(0, 2, &RAM[0x0000], 0x8000);
569
570   RAM = memregion("telcomrom")->base();
517   UINT8 *RAM = memregion("telcomrom")->base();
571518   m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000);
572519
573520   RAM = memregion("pakrom")->base();
574521   m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
575
576522   m_pak->set_entry(5);
577   m_telcom->set_entry(0);
523
578524   m_size = 0x8000;
579525   m_has_oldkb = 1;
580526   m_is_mbeett = 0;
r244646r244647
582528
583529DRIVER_INIT_MEMBER( mbee_state, mbeeppc )
584530{
585   UINT8 *RAM = memregion("maincpu")->base();
586   m_boot->configure_entry(0, &RAM[0x0000]);
587
588   RAM = memregion("basicrom")->base();
531   UINT8 *RAM = memregion("basicrom")->base();
589532   m_basic->configure_entries(0, 2, &RAM[0x0000], 0x2000);
590   m_boot->configure_entry(1, &RAM[0x0000]);
591533
592534   RAM = memregion("telcomrom")->base();
593535   m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000);
594536
595537   RAM = memregion("pakrom")->base();
596538   m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
597
598539   m_pak->set_entry(5);
599   m_telcom->set_entry(0);
600   m_basic->set_entry(0);
540
601541   m_size = 0x8000;
602542   m_has_oldkb = 1;
603543   m_is_mbeett = 0;
r244646r244647
605545
606546DRIVER_INIT_MEMBER( mbee_state, mbee56 )
607547{
608   UINT8 *RAM = memregion("maincpu")->base();
609   m_boot->configure_entries(0, 2, &RAM[0x0000], 0xe000);
610548   m_size = 0xe000;
611549   m_has_oldkb = 1;
612550   m_is_mbeett = 0;
r244646r244647
629567      membank(banktag)->configure_entries(64, 1, &ROM[0x4000], 0x1000); // dummy rom
630568   }
631569
632   timer_set(attotime::from_hz(1), TIMER_MBEE_RTC_IRQ);   /* timer for rtc */
633
634570   m_size = 0x8000;
635571   m_has_oldkb = 1;
636572   m_is_mbeett = 0;
r244646r244647
653589      membank(banktag)->configure_entries(64, 1, &ROM[0x4000], 0x1000); // dummy rom
654590   }
655591
656   timer_set(attotime::from_hz(1), TIMER_MBEE_RTC_IRQ);   /* timer for rtc */
657   timer_set(attotime::from_hz(25), TIMER_MBEE_NEWKB);   /* timer for kbd */
592   timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB);   /* kick-start timer for kbd */
658593
659594   m_size = 0x8000;
660595   m_has_oldkb = 0;
r244646r244647
663598
664599DRIVER_INIT_MEMBER( mbee_state, mbeett )
665600{
666   UINT8 *RAM = memregion("maincpu")->base();
667   m_boot->configure_entries(0, 2, &RAM[0x0000], 0x8000);
668
669   RAM = memregion("telcomrom")->base();
601   UINT8 *RAM = memregion("telcomrom")->base();
670602   m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000);
671603
672604   RAM = memregion("pakrom")->base();
673605   m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000);
674
675606   m_pak->set_entry(5);
676   m_telcom->set_entry(0);
677607
678   timer_set(attotime::from_hz(1), TIMER_MBEE_RTC_IRQ);   /* timer for rtc */
679   timer_set(attotime::from_hz(25), TIMER_MBEE_NEWKB);   /* timer for kbd */
608   timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB);   /* kick-start timer for kbd */
680609
681610   m_size = 0x8000;
682611   m_has_oldkb = 0;
trunk/src/mess/video/mbee.c
r244646r244647
6969************************************************************/
7070
7171
72READ8_MEMBER( mbee_state::mbee_low_r )
72READ8_MEMBER( mbee_state::video_low_r )
7373{
74   if (m_0b & 1)
74   if (m_is_premium && ((m_1c & 0x9f) == 0x90))
75      return m_p_attribram[offset];
76   else
77   if BIT(m_0b, 0)
7578      return m_p_gfxram[offset];
7679   else
7780      return m_p_videoram[offset];
7881}
7982
80WRITE8_MEMBER( mbee_state::mbee_low_w )
83WRITE8_MEMBER( mbee_state::video_low_w )
8184{
82   m_p_videoram[offset] = data;
85   if BIT(m_1c, 4)
86   {
87      // non-premium attribute writes are discarded
88      if (m_is_premium && BIT(m_1c, 7))
89         m_p_attribram[offset] = data;
90   }
91   else
92      m_p_videoram[offset] = data;
8393}
8494
85READ8_MEMBER( mbee_state::mbee_high_r )
95READ8_MEMBER( mbee_state::video_high_r )
8696{
87   return m_p_gfxram[0x800 | offset];
97   if BIT(m_08, 6)
98      return m_p_colorram[offset];
99   else
100      return m_p_gfxram[(((m_1c & 15) + 1) << 11) | offset];
88101}
89102
90WRITE8_MEMBER( mbee_state::mbee_high_w )
103WRITE8_MEMBER( mbee_state::video_high_w )
91104{
92   m_p_gfxram[0x800 | offset] = data;
105   if (BIT(m_08, 6) && (~m_0b & 1))
106      m_p_colorram[offset] = data;
107   else
108      m_p_gfxram[(((m_1c & 15) + 1) << 11) | offset] = data;
93109}
94110
95READ8_MEMBER( mbee_state::mbee_0b_r )
111WRITE8_MEMBER( mbee_state::port0b_w )
96112{
97   return m_0b;
113   m_0b = data & 1;
98114}
99115
100WRITE8_MEMBER( mbee_state::mbee_0b_w )
116READ8_MEMBER( mbee_state::port08_r )
101117{
102   m_0b = data;
103}
104
105READ8_MEMBER( mbee_state::mbeeic_08_r )
106{
107118   return m_08;
108119}
109120
110WRITE8_MEMBER( mbee_state::mbeeic_08_w )
121WRITE8_MEMBER( mbee_state::port08_w )
111122{
112123   m_08 = data;
113124}
114125
115READ8_MEMBER( mbee_state::mbeeic_high_r )
126READ8_MEMBER( mbee_state::port1c_r )
116127{
117   if (m_08 & 0x40)
118      return m_p_colorram[offset];
119   else
120      return m_p_gfxram[0x800 | offset];
121}
122
123WRITE8_MEMBER( mbee_state::mbeeic_high_w )
124{
125   if ((m_08 & 0x40) && (~m_0b & 1))
126      m_p_colorram[offset] = data;
127   else
128      m_p_gfxram[0x0800 | offset] = data;
129}
130
131READ8_MEMBER( mbee_state::mbeeppc_1c_r )
132{
133128   return m_1c;
134129}
135130
136WRITE8_MEMBER( mbee_state::mbeeppc_1c_w )
131WRITE8_MEMBER( mbee_state::port1c_w )
137132{
138133/*  d7 extended graphics (1=allow attributes and pcg banks)
139134    d5 bankswitch basic rom
140135    d4 select attribute ram
141136    d3..d0 select m_videoram bank */
142137
143   m_1c = data;
144   membank("basic")->set_entry(BIT(data, 5));
145}
146
147WRITE8_MEMBER( mbee_state::mbee256_1c_w )
148{
149/*  d7 extended graphics (1=allow attributes and pcg banks)
150    d5 bankswitch basic rom
151    d4 select attribute ram
152    d3..d0 select m_videoram bank */
153
154   m_1c = data;
155}
156
157READ8_MEMBER( mbee_state::mbeeppc_low_r )
158{
159   if ((m_1c & 0x1f) == 0x10)
160      return m_p_attribram[offset];
138   if (m_is_premium && BIT(data, 7))
139      m_1c = data;
161140   else
162   if (m_0b & 1)
163      return m_p_gfxram[offset];
164   else
165      return m_p_videoram[offset];
166}
141      m_1c = data & 0x30;
167142
168WRITE8_MEMBER( mbee_state::mbeeppc_low_w )
169{
170   if (m_1c & 16)
171      m_p_attribram[offset] = data;
172   else
173      m_p_videoram[offset] = data;
143   if (m_basic)
144      m_basic->set_entry(BIT(data, 5));
174145}
175146
176READ8_MEMBER( mbee_state::mbeeppc_high_r )
177{
178   if (m_08 & 0x40)
179      return m_p_colorram[offset];
180   else
181      return m_p_gfxram[(((m_1c & 15) + 1) << 11) | offset];
182}
183147
184WRITE8_MEMBER ( mbee_state::mbeeppc_high_w )
185{
186   if ((m_08 & 0x40) && (~m_0b & 1))
187      m_p_colorram[offset] = data;
188   else
189      m_p_gfxram[(((m_1c & 15) + 1) << 11) | offset] = data;
190}
191
192
193148/***********************************************************
194149
195150    CRTC-driven keyboard
r244646r244647
197152************************************************************/
198153
199154
200void mbee_state::keyboard_matrix_r(int offs)
155void mbee_state::oldkb_matrix_r(UINT16 offs)
201156{
202   UINT8 port = (offs >> 7) & 7;
203   UINT8 bit = (offs >> 4) & 7;
204   UINT8 data = m_io_oldkb[port]->read();
205   bool keydown  = ( data >> bit ) & 1;
206
207   // This adds premium-style cursor keys to the old keyboard
208   // They are used by the pc85 & ppc menu, and the 128k shell.
209   if (!keydown)
157   if (m_has_oldkb)
210158   {
211      UINT8 extra = m_io_extra->read();
159      UINT8 port = (offs >> 7) & 7;
160      UINT8 bit = (offs >> 4) & 7;
161      UINT8 data = m_io_oldkb[port]->read();
162      bool keydown  = ( data >> bit ) & 1;
212163
213      if (extra && port == 7 && bit == 1) keydown = 1;   /* Control */
164      // This adds premium-style cursor keys to the old keyboard
165      // They are used by the pc85 & ppc menu, and the 128k shell.
166      if (!keydown)
167      {
168         UINT8 extra = m_io_extra->read();
214169
215      if (BIT(extra, 0) && ( port == 0 && bit == 5 )) keydown = 1; // cursor up = ^E
216      else
217      if (BIT(extra, 1) && ( port == 3 && bit == 0 )) keydown = 1; // cursor down = ^X
218      else
219      if (BIT(extra, 2) && ( port == 2 && bit == 3 )) keydown = 1; // cursor left = ^S
220      else
221      if (BIT(extra, 3) && ( port == 0 && bit == 4 )) keydown = 1; // cursor right = ^D
222#if 0
223      // this key doesn't appear on any keyboard afaik. It is a Wordbee function.
224      else
225      if (BIT(extra, 4) && ( port == 2 && bit == 6 )) keydown = 1;  // insert = ^V
226#endif
227   }
170         if (extra && port == 7 && bit == 1) keydown = 1;   /* Control */
228171
229   if( keydown )
230   {
231      m_sy6545_reg[17] = offs;
232      m_sy6545_reg[16] = (offs >> 8) & 0x3f;
233      m_sy6545_status |= 0x40; //lpen_strobe
172         if (BIT(extra, 0) && ( port == 0 && bit == 5 )) keydown = 1; // cursor up = ^E
173         else
174         if (BIT(extra, 1) && ( port == 3 && bit == 0 )) keydown = 1; // cursor down = ^X
175         else
176         if (BIT(extra, 2) && ( port == 2 && bit == 3 )) keydown = 1; // cursor left = ^S
177         else
178         if (BIT(extra, 3) && ( port == 0 && bit == 4 )) keydown = 1; // cursor right = ^D
179         else
180         if (BIT(extra, 4) && ( port == 2 && bit == 6 )) keydown = 1; // insert = ^V
181      }
182
183      if( keydown )
184      {
185         m_sy6545_reg[17] = offs;
186         m_sy6545_reg[16] = (offs >> 8) & 0x3f;
187         m_sy6545_status |= 0x40; //lpen_strobe
188      }
234189   }
235190}
236191
237192
238void mbee_state::mbee_video_kbd_scan( int param )
193void mbee_state::oldkb_scan( UINT16 param )
239194{
240   if (m_0b) return; // can't remember why this is here
195   if (m_0b) return; // IC5 (pins 11,12,13)
241196   if (param & 15) return; // only scan once per row instead of 16 times
242   keyboard_matrix_r(param);
197   oldkb_matrix_r(param);
243198}
244199
245200
r244646r244647
277232      // This firstly pushes the contents of the transparent registers onto the MA lines,
278233      // then increments the address, then sets update strobe on.
279234      addr = (m_sy6545_reg[18] << 8) | m_sy6545_reg[19];
280      keyboard_matrix_r(addr);
235      oldkb_matrix_r(addr);
281236      m_sy6545_reg[19]++;
282237      if (!m_sy6545_reg[19]) m_sy6545_reg[18]++;
283238      m_sy6545_status |= 0x80; // update_strobe
r244646r244647
296251WRITE8_MEMBER ( mbee_state::m6545_data_w )
297252{
298253   static const UINT8 sy6545_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0,0x3f,0xff};
299   int addr = 0;
254   UINT16 addr = 0;
300255
301256   switch( m_sy6545_ind )
302257   {
r244646r244647
309264      // This firstly pushes the contents of the transparent registers onto the MA lines,
310265      // then increments the address, then sets update strobe on.
311266      addr = (m_sy6545_reg[18] << 8) | m_sy6545_reg[19];
312      keyboard_matrix_r(addr);
267      oldkb_matrix_r(addr);
313268      m_sy6545_reg[19]++;
314269      if (!m_sy6545_reg[19]) m_sy6545_reg[18]++;
315270      m_sy6545_status |= 0x80; // update_strobe
r244646r244647
382337      mem = (ma + x) & 0x7ff;
383338      chr = m_p_videoram[mem];
384339
385      mbee_video_kbd_scan(x+ma);
340      oldkb_scan(x+ma);
386341
387342      /* process cursor */
388343      if (x == cursor_x)
r244646r244647
419374      chr = m_p_videoram[mem];
420375      col = m_p_colorram[mem];                     // read a byte of colour
421376
422      if (m_is_premium)
377      if BIT(m_1c, 7) // premium graphics enabled?
423378      {
424         if (m_1c & 0x80)                     // are extended features enabled?
425         {
426            attr = m_p_attribram[mem];
379         attr = m_p_attribram[mem];
427380
428            if (chr & 0x80)
429               chr += ((attr & 15) << 7);          // bump chr to its particular pcg definition
381         if BIT(chr, 7)
382            chr += ((attr & 15) << 7);          // bump chr to its particular pcg definition
430383
431            if (attr & 0x40)
432               inv ^= 0xff;                    // inverse attribute
384         if BIT(attr, 6)
385            inv ^= 0xff;                    // inverse attribute
433386
434            if ((attr & 0x80) && (m_framecnt & 0x10))            // flashing attribute
435               chr = 0x20;
436         }
387         if (BIT(attr, 7) & BIT(m_framecnt, 4))            // flashing attribute
388            chr = 0x20;
437389      }
438390      else
439391         col |= colourm;
440392
441      if (m_has_oldkb)
442         mbee_video_kbd_scan(x+ma);
393      oldkb_scan(x+ma);
443394
444395      /* process cursor */
445396      if (x == cursor_x)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team