Commits

Anonymous committed a71cccb

Removed lanes.

  • Participants
  • Parent commits b0f2483

Comments (0)

Files changed (13)

platform/msvc2008/love.vcproj

 					</File>
 				</Filter>
 			</Filter>
-			<Filter
-				Name="lanes"
-				>
-				<File
-					RelativePath="..\..\src\libraries\lanes\lanes.cpp"
-					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							ObjectFile="$(IntDir)\libraries\lanes\"
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							ObjectFile="$(IntDir)\libraries\lanes\"
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\libraries\lanes\lanes.h"
-					>
-				</File>
-				<Filter
-					Name="lanes"
-					>
-					<File
-						RelativePath="..\..\src\libraries\lanes\lanes\lanes.c"
-						>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								ObjectFile="$(IntDir)\libraries\lanes\lanes\"
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								ObjectFile="$(IntDir)\libraries\lanes\lanes\"
-							/>
-						</FileConfiguration>
-					</File>
-					<File
-						RelativePath="..\..\src\libraries\lanes\lanes\threading.c"
-						>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								ObjectFile="$(IntDir)\libraries\lanes\lanes\"
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								ObjectFile="$(IntDir)\libraries\lanes\lanes\"
-							/>
-						</FileConfiguration>
-					</File>
-					<File
-						RelativePath="..\..\src\libraries\lanes\lanes\tools.c"
-						>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								ObjectFile="$(IntDir)\libraries\lanes\lanes\"
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								ObjectFile="$(IntDir)\libraries\lanes\lanes\"
-							/>
-						</FileConfiguration>
-					</File>
-				</Filter>
-			</Filter>
 		</Filter>
 		<Filter
 			Name="scripts"

src/libraries/lanes/lanes.cpp

-/**
-* Copyright (c) 2006-2009 LOVE Development Team
-* 
-* This software is provided 'as-is', without any express or implied
-* warranty.  In no event will the authors be held liable for any damages
-* arising from the use of this software.
-* 
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions:
-* 
-* 1. The origin of this software must not be misrepresented; you must not
-*    claim that you wrote the original software. If you use this software
-*    in a product, an acknowledgment in the product documentation would be
-*    appreciated but is not required.
-* 2. Altered source versions must be plainly marked as such, and must not be
-*    misrepresented as being the original software.
-* 3. This notice may not be removed or altered from any source distribution.
-**/
-
-#include "lanes.h"
-
-// Lanes open function.
-extern "C"
-{
-	int luaopen_lanes( lua_State *L );
-}
-
-namespace love
-{
-namespace lanes
-{
-
-	// Opens the lanes.lua file.
-	static int open_lanes(lua_State * L)
-	{
-		#include "lanes/lanes.lua.h"
-		lua_getglobal(L, "lanes");
-		return 1;
-	}
-
-	int open(lua_State * L)
-	{
-		luax_preload(L, open_lanes, "lanes");
-		luax_preload(L, luaopen_lanes, "lua51-lanes");
-		return 0;
-	}
-
-} // lanes
-} // love

src/libraries/lanes/lanes.h

-/**
-* Copyright (c) 2006-2009 LOVE Development Team
-* 
-* This software is provided 'as-is', without any express or implied
-* warranty.  In no event will the authors be held liable for any damages
-* arising from the use of this software.
-* 
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions:
-* 
-* 1. The origin of this software must not be misrepresented; you must not
-*    claim that you wrote the original software. If you use this software
-*    in a product, an acknowledgment in the product documentation would be
-*    appreciated but is not required.
-* 2. Altered source versions must be plainly marked as such, and must not be
-*    misrepresented as being the original software.
-* 3. This notice may not be removed or altered from any source distribution.
-**/
-
-#ifndef LOVE_LANES_LANES_H
-#define LOVE_LANES_LANES_H
-
-// LOVE
-#include <common/runtime.h>
-
-namespace love
-{
-namespace lanes
-{
-	int open(lua_State * L);
-
-} // lanes
-} // love
-
-#endif // LOVE_LANES_LANES_H

src/libraries/lanes/lanes/keeper.lch

-/* bin2c.lua generated code -- DO NOT EDIT
- *
- * To use from C source: 
- *    char my_chunk[]=
- *    #include "my.lch"
- */
-{ 
-   27, 76,117, 97, 81,  0,  1,  4,  4,  4,  8,  0, 12,  0,  0,  0, 64,107,101,101,
-  112,101,114, 46,108,117, 97,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  9,
-   45,  0,  0,  0,  5,  0,  0,  0, 69, 64,  0,  0, 28, 64,  0,  1,  5,  0,  0,  0,
-   69,128,  0,  0, 70,192,192,  0, 28,128,  0,  1, 69,  0,  0,  0,133,128,  0,  0,
-  134,  0, 65,  1, 92,128,  0,  1,164,  0,  0,  0,  0,  0,128,  0,202,  0,  0,  0,
-   10,  1,  0,  0, 74,  1,  0,  0,164, 65,  0,  0,  0,  0,128,  1,  0,  0,  0,  2,
-    0,  0,128,  2,228,129,  0,  0,  0,  0,  0,  3,  0,  0,  0,  1, 36,194,  0,  0,
-    0,  0,  0,  3,  7, 66,  1,  0, 36,  2,  1,  0,  0,  0,  0,  3,  0,  0,  0,  0,
-    7,130,  1,  0, 36, 66,  1,  0,  0,  0,  0,  3,  7,194,  1,  0, 36,130,  1,  0,
-    0,  0,  0,  3,  7,  2,  2,  0, 36,194,  1,  0,  0,  0,  0,  3,  7, 66,  2,  0,
-   36,  2,  2,  0,  0,  0,128,  1,  0,  0,  0,  2,  0,  0,128,  2,  7,130,  2,  0,
-   30,  0,128,  0, 11,  0,  0,  0,  4,  7,  0,  0,  0, 97,115,115,101,114,116,  0,
-    4, 13,  0,  0,  0,110,105,108, 95,115,101,110,116,105,110,101,108,  0,  4,  6,
-    0,  0,  0,116, 97, 98,108,101,  0,  4,  7,  0,  0,  0,114,101,109,111,118,101,
-    0,  4,  7,  0,  0,  0, 99,111,110, 99, 97,116,  0,  4,  5,  0,  0,  0,115,101,
-  110,100,  0,  4,  8,  0,  0,  0,114,101, 99,101,105,118,101,  0,  4,  6,  0,  0,
-    0,108,105,109,105,116,  0,  4,  4,  0,  0,  0,115,101,116,  0,  4,  4,  0,  0,
-    0,103,101,116,  0,  4,  6,  0,  0,  0, 99,108,101, 97,114,  0,  9,  0,  0,  0,
-    0,  0,  0,  0, 46,  0,  0,  0, 50,  0,  0,  0,  1,  0,  3,  6, 16,  0,  0,  0,
-   69,  0,  0,  0, 90,  0,  0,  0, 22,192,  2,128, 69,  0,  0,  0, 70, 64,192,  0,
-   75,128,192,  0,196,  0,  0,  0, 10,  1,  0,  0,101,  1,  0,  0, 34, 65,  0,  0,
-   65,193,  0,  0,220,128,128,  1,  1,  1,  1,  0,213,  0,129,  1, 92, 64,128,  1,
-   30,  0,128,  0,  5,  0,  0,  0,  4,  3,  0,  0,  0,105,111,  0,  4,  7,  0,  0,
-    0,115,116,100,101,114,114,  0,  4,  6,  0,  0,  0,119,114,105,116,101,  0,  4,
-    2,  0,  0,  0,  9,  0,  4,  2,  0,  0,  0, 10,  0,  0,  0,  0,  0, 16,  0,  0,
-    0, 47,  0,  0,  0, 47,  0,  0,  0, 47,  0,  0,  0, 48,  0,  0,  0, 48,  0,  0,
-    0, 48,  0,  0,  0, 48,  0,  0,  0, 48,  0,  0,  0, 48,  0,  0,  0, 48,  0,  0,
-    0, 48,  0,  0,  0, 48,  0,  0,  0, 48,  0,  0,  0, 48,  0,  0,  0, 48,  0,  0,
-    0, 50,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0, 97,114,103,  0,  0,  0,  0,
-    0, 15,  0,  0,  0,  1,  0,  0,  0, 13,  0,  0,  0,116, 97, 98,108,101, 95, 99,
-  111,110, 99, 97,116,  0,  0,  0,  0,  0, 84,  0,  0,  0, 93,  0,  0,  0,  3,  1,
-    0,  4, 21,  0,  0,  0, 68,  0,  0,  0, 70,  0,128,  0, 90, 64,  0,  0, 22,  0,
-    2,128, 68,  0,  0,  0,138,  0,  0,  0, 73,128,  0,  0, 68,  0,128,  0,138,  0,
-    0,  0, 73,128,  0,  0, 68,  0,  0,  1,138,  0,  0,  0, 73,128,  0,  0, 68,  0,
-    0,  0, 70,  0,128,  0,132,  0,128,  0,134,  0,  0,  1,196,  0,  0,  1,198,  0,
-  128,  1, 94,  0,  0,  2, 30,  0,128,  0,  0,  0,  0,  0,  0,  0,  0,  0, 21,  0,
-    0,  0, 87,  0,  0,  0, 87,  0,  0,  0, 87,  0,  0,  0, 87,  0,  0,  0, 88,  0,
-    0,  0, 88,  0,  0,  0, 88,  0,  0,  0, 89,  0,  0,  0, 89,  0,  0,  0, 89,  0,
-    0,  0, 90,  0,  0,  0, 90,  0,  0,  0, 90,  0,  0,  0, 92,  0,  0,  0, 92,  0,
-    0,  0, 92,  0,  0,  0, 92,  0,  0,  0, 92,  0,  0,  0, 92,  0,  0,  0, 92,  0,
-    0,  0, 93,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,117,100,  0,  0,  0,  0,
-    0, 20,  0,  0,  0,  3,  0,  0,  0,  6,  0,  0,  0, 95,100, 97,116, 97,  0, 10,
-    0,  0,  0, 95,105,110, 99,111,109,105,110,103,  0,  8,  0,  0,  0, 95,108,105,
-  109,105,116,115,  0,  0,  0,  0,  0, 96,  0,  0,  0,106,  0,  0,  0,  2,  3,  0,
-   16, 40,  0,  0,  0,197,  0,  0,  0, 27,  1,  0,  0, 22,128,  0,128, 27,  1,128,
-    0, 22,  0,  0,128,  0,  1,  0,  1,220, 64,  0,  1,196,  0,  0,  0,  0,  1,128,
-    0,220,  0,  1,  1,133, 65,  0,  0,198,129,128,  1,156,129,  0,  1,197,129,  0,
-    0,  6,130,  0,  2, 26, 66,  0,  0, 22,  0,  0,128, 10,  2,  0,  0,220,  1,  1,
-    1, 22, 64,  1,128,  0,  3,  0,  3, 65,195,  0,  0,133, 67,  0,  0,192,  3,128,
-    5,156,131,  0,  1,149,129,  3,  6,225,129,  0,  0, 22,192,253,127,196,  1,128,
-    0,  1,  2,  1,  0, 64,  2,  0,  0,129, 66,  1,  0,197, 66,  0,  0,  0,  3,  0,
-    1,220,130,  0,  1,  1,131,  1,  0, 21,  2,  3,  4, 64,  2,  0,  3,220, 65,128,
-    1, 30,  0,128,  0,  7,  0,  0,  0,  4,  7,  0,  0,  0, 97,115,115,101,114,116,
-    0,  4,  9,  0,  0,  0,116,111,115,116,114,105,110,103,  0,  4,  7,  0,  0,  0,
-  105,112, 97,105,114,115,  0,  4,  3,  0,  0,  0, 44, 32,  0,  4,  5,  0,  0,  0,
-   42, 42, 42, 32,  0,  4,  3,  0,  0,  0, 32, 40,  0,  4,  4,  0,  0,  0, 41, 58,
-   32,  0,  0,  0,  0,  0, 40,  0,  0,  0, 97,  0,  0,  0, 97,  0,  0,  0, 97,  0,
-    0,  0, 97,  0,  0,  0, 97,  0,  0,  0, 97,  0,  0,  0, 97,  0,  0,  0, 99,  0,
-    0,  0, 99,  0,  0,  0, 99,  0,  0,  0,101,  0,  0,  0,101,  0,  0,  0,101,  0,
-    0,  0,102,  0,  0,  0,102,  0,  0,  0,102,  0,  0,  0,102,  0,  0,  0,102,  0,
-    0,  0,102,  0,  0,  0,102,  0,  0,  0,103,  0,  0,  0,103,  0,  0,  0,103,  0,
-    0,  0,103,  0,  0,  0,103,  0,  0,  0,103,  0,  0,  0,102,  0,  0,  0,103,  0,
-    0,  0,105,  0,  0,  0,105,  0,  0,  0,105,  0,  0,  0,105,  0,  0,  0,105,  0,
-    0,  0,105,  0,  0,  0,105,  0,  0,  0,105,  0,  0,  0,105,  0,  0,  0,105,  0,
-    0,  0,105,  0,  0,  0,106,  0,  0,  0, 12,  0,  0,  0,  6,  0,  0,  0,116,105,
-  116,108,101,  0,  0,  0,  0,  0, 39,  0,  0,  0,  3,  0,  0,  0,117,100,  0,  0,
-    0,  0,  0, 39,  0,  0,  0,  4,  0,  0,  0,107,101,121,  0,  0,  0,  0,  0, 39,
-    0,  0,  0,  5,  0,  0,  0,100, 97,116, 97,  0, 10,  0,  0,  0, 39,  0,  0,  0,
-    9,  0,  0,  0,105,110, 99,111,109,105,110,103,  0, 10,  0,  0,  0, 39,  0,  0,
-    0,  2,  0,  0,  0, 95,  0, 10,  0,  0,  0, 39,  0,  0,  0,  2,  0,  0,  0,115,
-    0, 13,  0,  0,  0, 39,  0,  0,  0, 16,  0,  0,  0, 40,102,111,114, 32,103,101,
-  110,101,114, 97,116,111,114, 41,  0, 19,  0,  0,  0, 28,  0,  0,  0, 12,  0,  0,
-    0, 40,102,111,114, 32,115,116, 97,116,101, 41,  0, 19,  0,  0,  0, 28,  0,  0,
-    0, 14,  0,  0,  0, 40,102,111,114, 32, 99,111,110,116,114,111,108, 41,  0, 19,
-    0,  0,  0, 28,  0,  0,  0,  2,  0,  0,  0, 95,  0, 20,  0,  0,  0, 26,  0,  0,
-    0,  2,  0,  0,  0,118,  0, 20,  0,  0,  0, 26,  0,  0,  0,  2,  0,  0,  0,  7,
-    0,  0,  0,116, 97, 98,108,101,115,  0,  3,  0,  0,  0, 87, 82,  0,  0,  0,  0,
-    0,121,  0,  0,  0,158,  0,  0,  0,  1,  2,  3, 16, 56,  0,  0,  0,196,  0,  0,
-    0,  0,  1,  0,  0,220,  0,  1,  1,133,  1,  0,  0,193, 65,  0,  0, 37,  2,  0,
-    0,156,129,  0,  0, 23,128, 64,  3, 22, 64,  0,128,194,  1,128,  0,222,  1,  0,
-    1,198, 65,  0,  2, 23,192,192,  3, 22, 64,  0,128,202,  1,  0,  0,  9,193,129,
-    0,198, 65,128,  1,218,  1,  0,  0, 22,  0,  1,128,198, 65,  0,  2,212,  1,128,
-    3,204,193,  1,130,218, 65,  0,  0, 22,  0,  0,128,193,129,  0,  0,  6, 66,128,
-    2, 26,  2,  0,  0, 22,  0,  1,128, 76,130,129,  3, 24, 64,  2,  4, 22, 64,  0,
-  128, 66,  2,  0,  0, 94,  2,  0,  1, 65,  2,  1,  0,128,  2,  0,  3,193,  2,  1,
-    0, 96,130,  3,128, 69,  3,  0,  0,128,  3,  0,  6,229,  3,  0,  0, 92,131,  0,
-    0, 23,192,192,  6, 22,  0,  0,128, 69, 67,  1,  0, 23,128,192,  3, 22,128,  0,
-  128,201, 64,131,  0,193,  1,  1,  0, 22,128,  0,128,134, 67,  0,  2,137, 67,131,
-    3,204,  1,193,  3, 95,194,251,127, 66,  2,128,  0, 94,  2,  0,  1, 30,  0,128,
-    0,  6,  0,  0,  0,  4,  7,  0,  0,  0,115,101,108,101, 99,116,  0,  4,  2,  0,
-    0,  0, 35,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,
-    0,240, 63,  4, 13,  0,  0,  0,110,105,108, 95,115,101,110,116,105,110,101,108,
-    0,  0,  0,  0,  0, 56,  0,  0,  0,123,  0,  0,  0,123,  0,  0,  0,123,  0,  0,
-    0,125,  0,  0,  0,125,  0,  0,  0,125,  0,  0,  0,125,  0,  0,  0,126,  0,  0,
-    0,126,  0,  0,  0,126,  0,  0,  0,126,  0,  0,  0,130,  0,  0,  0,130,  0,  0,
-    0,130,  0,  0,  0,131,  0,  0,  0,131,  0,  0,  0,134,  0,  0,  0,134,  0,  0,
-    0,134,  0,  0,  0,134,  0,  0,  0,134,  0,  0,  0,134,  0,  0,  0,134,  0,  0,
-    0,134,  0,  0,  0,134,  0,  0,  0,135,  0,  0,  0,137,  0,  0,  0,137,  0,  0,
-    0,137,  0,  0,  0,137,  0,  0,  0,137,  0,  0,  0,138,  0,  0,  0,138,  0,  0,
-    0,141,  0,  0,  0,141,  0,  0,  0,141,  0,  0,  0,141,  0,  0,  0,142,  0,  0,
-    0,142,  0,  0,  0,142,  0,  0,  0,142,  0,  0,  0,145,  0,  0,  0,145,  0,  0,
-    0,146,  0,  0,  0,149,  0,  0,  0,149,  0,  0,  0,150,  0,  0,  0,151,  0,  0,
-    0,151,  0,  0,  0,153,  0,  0,  0,153,  0,  0,  0,154,  0,  0,  0,141,  0,  0,
-    0,157,  0,  0,  0,157,  0,  0,  0,158,  0,  0,  0, 14,  0,  0,  0,  3,  0,  0,
-    0,117,100,  0,  0,  0,  0,  0, 55,  0,  0,  0,  4,  0,  0,  0,107,101,121,  0,
-    0,  0,  0,  0, 55,  0,  0,  0,  4,  0,  0,  0, 97,114,103,  0,  0,  0,  0,  0,
-   55,  0,  0,  0,  5,  0,  0,  0,100, 97,116, 97,  0,  3,  0,  0,  0, 55,  0,  0,
-    0,  9,  0,  0,  0,105,110, 99,111,109,105,110,103,  0,  3,  0,  0,  0, 55,  0,
-    0,  0,  7,  0,  0,  0,108,105,109,105,116,115,  0,  3,  0,  0,  0, 55,  0,  0,
-    0,  2,  0,  0,  0,110,  0,  7,  0,  0,  0, 55,  0,  0,  0,  4,  0,  0,  0,108,
-  101,110,  0, 25,  0,  0,  0, 55,  0,  0,  0,  2,  0,  0,  0,109,  0, 26,  0,  0,
-    0, 55,  0,  0,  0, 12,  0,  0,  0, 40,102,111,114, 32,105,110,100,101,120, 41,
-    0, 36,  0,  0,  0, 53,  0,  0,  0, 12,  0,  0,  0, 40,102,111,114, 32,108,105,
-  109,105,116, 41,  0, 36,  0,  0,  0, 53,  0,  0,  0, 11,  0,  0,  0, 40,102,111,
-  114, 32,115,116,101,112, 41,  0, 36,  0,  0,  0, 53,  0,  0,  0,  2,  0,  0,  0,
-  105,  0, 37,  0,  0,  0, 52,  0,  0,  0,  4,  0,  0,  0,118, 97,108,  0, 41,  0,
-    0,  0, 52,  0,  0,  0,  1,  0,  0,  0,  7,  0,  0,  0,116, 97, 98,108,101,115,
-    0,  0,  0,  0,  0,167,  0,  0,  0,189,  0,  0,  0,  2,  1,  3, 14, 40,  0,  0,
-    0,132,  0,  0,  0,192,  0,  0,  0,156,  0,  1,  1, 65,  1,  0,  0,133, 65,  0,
-    0,193,129,  0,  0, 37,  2,  0,  0,156,129,  0,  0,193,  1,  0,  0, 96,193,  6,
-  128, 69, 66,  0,  0,128,  2,  0,  4,229,  2,  0,  0, 92,130,  0,  0,134, 66,  2,
-    1, 87,192, 64,  5, 22,  0,  5,128,198, 66,130,  1,218,  2,  0,  0, 22, 64,  2,
-  128,198, 66,130,  1,198,  2,192,  5, 87,192,192,  5, 22, 64,  1,128,196,  2,128,
-    0,  6, 67,130,  1, 65,  3,  0,  0,220,130,128,  1,137,192,130,  4, 22,  0,  0,
-  128,137,192,192,  4,197,  2,  1,  0, 23,192,  2,  5, 22,  0,  0,128,131,  2,  0,
-    5,192,  2,  0,  5,  0,  3,128,  4,222,  2,128,  1, 95,129,248,127, 30,  0,128,
-    0,  5,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,240, 63,  4,  7,  0,  0,  0,115,
-  101,108,101, 99,116,  0,  4,  2,  0,  0,  0, 35,  0,  0,  4, 13,  0,  0,  0,110,
-  105,108, 95,115,101,110,116,105,110,101,108,  0,  0,  0,  0,  0, 40,  0,  0,  0,
-  169,  0,  0,  0,169,  0,  0,  0,169,  0,  0,  0,171,  0,  0,  0,171,  0,  0,  0,
-  171,  0,  0,  0,171,  0,  0,  0,171,  0,  0,  0,171,  0,  0,  0,171,  0,  0,  0,
-  172,  0,  0,  0,172,  0,  0,  0,172,  0,  0,  0,172,  0,  0,  0,173,  0,  0,  0,
-  175,  0,  0,  0,175,  0,  0,  0,176,  0,  0,  0,176,  0,  0,  0,176,  0,  0,  0,
-  176,  0,  0,  0,176,  0,  0,  0,176,  0,  0,  0,176,  0,  0,  0,178,  0,  0,  0,
-  178,  0,  0,  0,178,  0,  0,  0,178,  0,  0,  0,178,  0,  0,  0,178,  0,  0,  0,
-  180,  0,  0,  0,182,  0,  0,  0,182,  0,  0,  0,182,  0,  0,  0,183,  0,  0,  0,
-  185,  0,  0,  0,185,  0,  0,  0,185,  0,  0,  0,171,  0,  0,  0,189,  0,  0,  0,
-   11,  0,  0,  0,  3,  0,  0,  0,117,100,  0,  0,  0,  0,  0, 39,  0,  0,  0,  4,
-    0,  0,  0, 97,114,103,  0,  0,  0,  0,  0, 39,  0,  0,  0,  5,  0,  0,  0,100,
-   97,116, 97,  0,  3,  0,  0,  0, 39,  0,  0,  0,  9,  0,  0,  0,105,110, 99,111,
-  109,105,110,103,  0,  3,  0,  0,  0, 39,  0,  0,  0,  2,  0,  0,  0, 95,  0,  3,
-    0,  0,  0, 39,  0,  0,  0, 12,  0,  0,  0, 40,102,111,114, 32,105,110,100,101,
-  120, 41,  0,  9,  0,  0,  0, 39,  0,  0,  0, 12,  0,  0,  0, 40,102,111,114, 32,
-  108,105,109,105,116, 41,  0,  9,  0,  0,  0, 39,  0,  0,  0, 11,  0,  0,  0, 40,
-  102,111,114, 32,115,116,101,112, 41,  0,  9,  0,  0,  0, 39,  0,  0,  0,  2,  0,
-    0,  0,105,  0, 10,  0,  0,  0, 38,  0,  0,  0,  4,  0,  0,  0,107,101,121,  0,
-   14,  0,  0,  0, 38,  0,  0,  0,  4,  0,  0,  0,118, 97,108,  0, 15,  0,  0,  0,
-   38,  0,  0,  0,  2,  0,  0,  0,  7,  0,  0,  0,116, 97, 98,108,101,115,  0, 13,
-    0,  0,  0,116, 97, 98,108,101, 95,114,101,109,111,118,101,  0,  0,  0,  0,  0,
-  195,  0,  0,  0,200,  0,  0,  0,  1,  3,  0,  6,  5,  0,  0,  0,196,  0,  0,  0,
-    0,  1,  0,  0,220,  0,  1,  1, 73,129,128,  0, 30,  0,128,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  5,  0,  0,  0,197,  0,  0,  0,197,  0,  0,  0,197,  0,  0,  0,
-  199,  0,  0,  0,200,  0,  0,  0,  6,  0,  0,  0,  3,  0,  0,  0,117,100,  0,  0,
-    0,  0,  0,  4,  0,  0,  0,  4,  0,  0,  0,107,101,121,  0,  0,  0,  0,  0,  4,
-    0,  0,  0,  2,  0,  0,  0,110,  0,  0,  0,  0,  0,  4,  0,  0,  0,  2,  0,  0,
-    0, 95,  0,  3,  0,  0,  0,  4,  0,  0,  0,  2,  0,  0,  0, 95,  0,  3,  0,  0,
-    0,  4,  0,  0,  0,  7,  0,  0,  0,108,105,109,105,116,115,  0,  3,  0,  0,  0,
-    4,  0,  0,  0,  1,  0,  0,  0,  7,  0,  0,  0,116, 97, 98,108,101,115,  0,  0,
-    0,  0,  0,206,  0,  0,  0,214,  0,  0,  0,  1,  3,  0,  6,  6,  0,  0,  0,196,
-    0,  0,  0,  0,  1,  0,  0,220,  0,  1,  1,201,128,128,  0,  9,  1,192,  0, 30,
-    0,128,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,208,  0,  0,  0,
-  208,  0,  0,  0,208,  0,  0,  0,212,  0,  0,  0,213,  0,  0,  0,214,  0,  0,  0,
-    6,  0,  0,  0,  3,  0,  0,  0,117,100,  0,  0,  0,  0,  0,  5,  0,  0,  0,  4,
-    0,  0,  0,107,101,121,  0,  0,  0,  0,  0,  5,  0,  0,  0,  4,  0,  0,  0,118,
-   97,108,  0,  0,  0,  0,  0,  5,  0,  0,  0,  5,  0,  0,  0,100, 97,116, 97,  0,
-    3,  0,  0,  0,  5,  0,  0,  0,  9,  0,  0,  0,105,110, 99,111,109,105,110,103,
-    0,  3,  0,  0,  0,  5,  0,  0,  0,  2,  0,  0,  0, 95,  0,  3,  0,  0,  0,  5,
-    0,  0,  0,  1,  0,  0,  0,  7,  0,  0,  0,116, 97, 98,108,101,115,  0,  0,  0,
-    0,  0,220,  0,  0,  0,229,  0,  0,  0,  1,  2,  0,  7, 10,  0,  0,  0,132,  0,
-    0,  0,192,  0,  0,  0,156,  0,  1,  1, 70, 65,  0,  1,133,  1,  0,  0, 23,128,
-  129,  2, 22,  0,  0,128, 67,  1,128,  2, 94,  1,  0,  1, 30,  0,128,  0,  1,  0,
-    0,  0,  4, 13,  0,  0,  0,110,105,108, 95,115,101,110,116,105,110,101,108,  0,
-    0,  0,  0,  0, 10,  0,  0,  0,222,  0,  0,  0,222,  0,  0,  0,222,  0,  0,  0,
-  224,  0,  0,  0,225,  0,  0,  0,225,  0,  0,  0,225,  0,  0,  0,226,  0,  0,  0,
-  228,  0,  0,  0,229,  0,  0,  0,  6,  0,  0,  0,  3,  0,  0,  0,117,100,  0,  0,
-    0,  0,  0,  9,  0,  0,  0,  4,  0,  0,  0,107,101,121,  0,  0,  0,  0,  0,  9,
-    0,  0,  0,  5,  0,  0,  0,100, 97,116, 97,  0,  3,  0,  0,  0,  9,  0,  0,  0,
-    2,  0,  0,  0, 95,  0,  3,  0,  0,  0,  9,  0,  0,  0,  2,  0,  0,  0, 95,  0,
-    3,  0,  0,  0,  9,  0,  0,  0,  4,  0,  0,  0,118, 97,108,  0,  4,  0,  0,  0,
-    9,  0,  0,  0,  1,  0,  0,  0,  7,  0,  0,  0,116, 97, 98,108,101,115,  0,  0,
-    0,  0,  0,237,  0,  0,  0,242,  0,  0,  0,  3,  1,  0,  2,  7,  0,  0,  0, 68,
-    0,  0,  0, 73,  0, 64,  0, 68,  0,128,  0, 73,  0, 64,  0, 68,  0,  0,  1, 73,
-    0, 64,  0, 30,  0,128,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,
-  239,  0,  0,  0,239,  0,  0,  0,240,  0,  0,  0,240,  0,  0,  0,241,  0,  0,  0,
-  241,  0,  0,  0,242,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,117,100,  0,  0,
-    0,  0,  0,  6,  0,  0,  0,  3,  0,  0,  0,  6,  0,  0,  0, 95,100, 97,116, 97,
-    0, 10,  0,  0,  0, 95,105,110, 99,111,109,105,110,103,  0,  8,  0,  0,  0, 95,
-  108,105,109,105,116,115,  0, 45,  0,  0,  0, 39,  0,  0,  0, 39,  0,  0,  0, 39,
-    0,  0,  0, 43,  0,  0,  0, 43,  0,  0,  0, 43,  0,  0,  0, 43,  0,  0,  0, 44,
-    0,  0,  0, 44,  0,  0,  0, 44,  0,  0,  0, 44,  0,  0,  0, 50,  0,  0,  0, 50,
-    0,  0,  0, 59,  0,  0,  0, 68,  0,  0,  0, 77,  0,  0,  0, 93,  0,  0,  0, 93,
-    0,  0,  0, 93,  0,  0,  0, 93,  0,  0,  0,106,  0,  0,  0,106,  0,  0,  0,106,
-    0,  0,  0,158,  0,  0,  0,158,  0,  0,  0,121,  0,  0,  0,189,  0,  0,  0,189,
-    0,  0,  0,189,  0,  0,  0,167,  0,  0,  0,200,  0,  0,  0,200,  0,  0,  0,195,
-    0,  0,  0,214,  0,  0,  0,214,  0,  0,  0,206,  0,  0,  0,229,  0,  0,  0,229,
-    0,  0,  0,220,  0,  0,  0,242,  0,  0,  0,242,  0,  0,  0,242,  0,  0,  0,242,
-    0,  0,  0,237,  0,  0,  0,242,  0,  0,  0,  8,  0,  0,  0, 13,  0,  0,  0,116,
-   97, 98,108,101, 95,114,101,109,111,118,101,  0,  7,  0,  0,  0, 44,  0,  0,  0,
-   13,  0,  0,  0,116, 97, 98,108,101, 95, 99,111,110, 99, 97,116,  0, 11,  0,  0,
-    0, 44,  0,  0,  0,  3,  0,  0,  0, 87, 82,  0, 13,  0,  0,  0, 44,  0,  0,  0,
-    6,  0,  0,  0, 95,100, 97,116, 97,  0, 14,  0,  0,  0, 44,  0,  0,  0, 10,  0,
-    0,  0, 95,105,110, 99,111,109,105,110,103,  0, 15,  0,  0,  0, 44,  0,  0,  0,
-    8,  0,  0,  0, 95,108,105,109,105,116,115,  0, 16,  0,  0,  0, 44,  0,  0,  0,
-    7,  0,  0,  0,116, 97, 98,108,101,115,  0, 20,  0,  0,  0, 44,  0,  0,  0,  6,
-    0,  0,  0, 68, 69, 66, 85, 71,  0, 23,  0,  0,  0, 44,  0,  0,  0,  0,  0,  0,
-    0,};
-

src/libraries/lanes/lanes/keeper.lua

---
--- KEEPER.LUA
---
--- Keeper state logic
---
--- This code is read in for each "keeper state", which are the hidden, inter-
--- mediate data stores used by Lanes inter-state communication objects.
---
--- Author: Asko Kauppi <akauppi@gmail.com>
---
---[[
-===============================================================================
-
-Copyright (C) 2008 Asko Kauppi <akauppi@gmail.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-===============================================================================
-]]--
-
--- unique key instead of 'nil' in queues
---
-assert( nil_sentinel )
-
--- We only need to have base and table libraries (and io for debugging)
---
-local table_remove= assert( table.remove )
-local table_concat= assert( table.concat )
-
-local function WR(...)
-    if io then 
-        io.stderr:write( table_concat({...},'\t').."\n" ) 
-    end
-end
-
------
--- Actual data store
---
--- { [linda_deep_ud]= { key= val [, ...] }
---      ...
--- }
---
-local _data= {}
-
------
--- Entries queued for use when the existing 'data[ud][key]' entry is consumed.
---
--- { [linda_deep_ud]= { key= { val [, ... } [, ...] }
---      ...
--- }
---
-local _incoming= {}
-
------
--- Length limits (if any) for queues
---
--- 0:   don't queue values at all; ':send()' waits if the slot is not vacant
--- N:   allow N values to be queued (slot itself + N-1); wait if full
--- nil: no limits, '_incoming' may grow endlessly
---
-local _limits= {}
-
------
--- data_tbl, incoming_tbl, limits_tbl = tables( linda_deep_ud )
---
--- Gives appropriate tables for a certain Linda (creates them if needed)
---
-local function tables( ud )
-    -- tables are created either all or nothing
-    --
-    if not _data[ud] then
-        _data[ud]= {}
-        _incoming[ud]= {}
-        _limits[ud]= {}
-    end
-    return _data[ud], _incoming[ud], _limits[ud]
-end
-
-
-local function DEBUG(title,ud,key)
-    assert( title and ud and key )
-
-    local data,incoming,_= tables(ud)
-
-    local s= tostring(data[key])
-    for _,v in ipairs( incoming[key] or {} ) do
-        s= s..", "..tostring(v)
-    end
-    WR( "*** "..title.." ("..tostring(key).."): ", s )
-end
-
-
------
--- bool= send( linda_deep_ud, key, ... )
---
--- Send new data (1..N) to 'key' slot. This send is atomic; all the values
--- end up one after each other (this is why having possibility for sending
--- multiple values in one call is deemed important).
---
--- If the queue has a limit, values are sent only if all of them fit in.
---
--- Returns: 'true' if all the values were placed
---          'false' if sending would exceed the queue limit (wait & retry)
---
-function send( ud, key, ... )
-
-    local data,incoming,limits= tables(ud)
-
-    local n= select('#',...)
-    if n==0 then return true end    -- nothing to send
-
-    -- Initialize queue for all keys that have been used with ':send()'
-    --
-    if incoming[key]==nil then
-        incoming[key]= {}
-    end
-
-    local len= data[key] and 1+#incoming[key] or 0
-    local m= limits[key]
-
-    if m and len+n > m then
-        return false    -- would exceed the limit; try again later
-    end
-
-    for i=1,n do
-        local val= select(i,...)
-
-        -- 'nil' in the data replaced by sentinel
-        if val==nil then
-            val= nil_sentinel
-        end
-
-        if len==0 then
-            data[key]= val
-            len= 1
-        else
-            incoming[key][len]= val
-            len= len+1
-        end
-    end
-    return true
-end
-
-
------
--- [val, key]= receive( linda_deep_ud, key [, ...] )
---
--- Read any of the given keys, consuming the data found. Keys are read in
--- order.
---
-function receive( ud, ... )
-
-    local data,incoming,_= tables(ud)
-
-    for i=1,select('#',...) do
-        local key= select(i,...)
-        local val= data[key]
-
-        if val~=nil then
-            if incoming[key] and incoming[key][1]~=nil then
-                -- pop [1] from 'incoming[key]' into the actual slot
-                data[key]= table_remove( incoming[key], 1 )
-            else
-                data[key]= nil  -- empty the slot
-            end
-            if val==nil_sentinel then
-                val= nil
-            end
-            return val, key
-        end
-    end
-    --return nil
-end
-
-
------
--- = limit( linda_deep_ud, key, uint )
---
-function limit( ud, key, n )
-
-    local _,_,limits= tables(ud)
-
-    limits[key]= n
-end
-
-
------
--- void= set( linda_deep_ud, key, [val] )
---
-function set( ud, key, val )
-
-    local data,incoming,_= tables(ud)
-
-    -- Setting a key to 'nil' really clears it; only queing uses sentinels.
-    --
-    data[key]= val
-    incoming[key]= nil
-end
-
-
------
--- [val]= get( linda_deep_ud, key )
---
-function get( ud, key )
-
-    local data,_,_= tables(ud)
-
-    local val= data[key]
-    if val==nil_sentinel then
-        val= nil
-    end
-    return val
-end
-
-
------
--- void= clear( linda_deep_ud )
---
--- Clear the data structures used for a Linda (at its destructor)
---
-function clear( ud )
-
-    _data[ud]= nil
-    _incoming[ud]= nil
-    _limits[ud]= nil
-end
-
-

src/libraries/lanes/lanes/lanes.c

-/*
- * LANES.C   	                          Copyright (c) 2007-08, Asko Kauppi
- *
- * Multithreading in Lua.
- * 
- * History:
- *      20-Oct-08 (2.0.2): Added closing of free-running threads, but it does
- *                  not seem to eliminate the occasional segfaults at process
- *                  exit.
- *          ...
- *      24-Jun-08 .. 14-Aug-08 AKa: Major revise, Lanes 2008 version (2.0 rc1)
- *          ...
- *      18-Sep-06 AKa: Started the module.
- *
- * Platforms (tested internally):
- *      OS X (10.5.4 PowerPC/Intel)
- *      Linux x86 (Ubuntu 8.04)
- *      Win32 (Windows XP Home SP2, Visual C++ 2005/2008 Express)
- *      PocketPC (TBD)
- *
- * Platforms (tested externally):
- *      Win32 (MSYS) by Ross Berteig.
- *
- * Platforms (testers appreciated):
- *      Win64 - should work???
- *      Linux x64 - should work
- *      FreeBSD - should work
- *      QNX - porting shouldn't be hard
- *      Sun Solaris - porting shouldn't be hard
- *
- * References:
- *      "Porting multithreaded applications from Win32 to Mac OS X":
- *      <http://developer.apple.com/macosx/multithreadedprogramming.html>
- *
- *      Pthreads:
- *      <http://vergil.chemistry.gatech.edu/resources/programming/threads.html>
- *
- *      MSDN: <http://msdn2.microsoft.com/en-us/library/ms686679.aspx>
- *
- *      <http://ridiculousfish.com/blog/archives/2007/02/17/barrier>
- *
- * Defines:
- *      -DLINUX_SCHED_RR: all threads are lifted to SCHED_RR category, to
- *          allow negative priorities (-2,-1) be used. Even without this,
- *          using priorities will require 'sudo' privileges on Linux.
- *
- *		-DUSE_PTHREAD_TIMEDJOIN: use 'pthread_timedjoin_np()' for waiting
- *          for threads with a timeout. This changes the thread cleanup
- *          mechanism slightly (cleans up at the join, not once the thread
- *          has finished). May or may not be a good idea to use it.
- *          Available only in selected operating systems (Linux).
- *
- * Bugs:
- *
- * To-do:
- *
- *      ...
- */
-
-const char * VERSION = "2.0.3";
-
-/*
-===============================================================================
-
-Copyright (C) 2007-08 Asko Kauppi <akauppi@gmail.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-===============================================================================
-*/
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#include "lua.h"
-#include "lauxlib.h"
-
-#include "threading.h"
-#include "tools.h"
-
-#if !((defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC))
-# include <sys/time.h>
-#endif
-
-/* geteuid() */
-#ifdef PLATFORM_LINUX
-# include <unistd.h>
-# include <sys/types.h>
-#endif
-
-/* The selected number is not optimal; needs to be tested. Even using just
-* one keeper state may be good enough (depends on the number of Lindas used
-* in the applications).
-*/
-#define KEEPER_STATES_N 1   // 6
-
-/* Do you want full call stacks, or just the line where the error happened?
-*
-* TBD: The full stack feature does not seem to work (try 'make error').
-*/
-#define ERROR_FULL_STACK
-
-#ifdef ERROR_FULL_STACK
-# define STACK_TRACE_KEY ((void*)lane_error)     // used as registry key
-#endif
-
-/*
-* Lua code for the keeper states (baked in)
-*/
-static char keeper_chunk[]= 
-#include "keeper.lch"
-
-struct s_lane;
-static bool_t cancel_test( lua_State *L );
-static void cancel_error( lua_State *L );
-
-#define CANCEL_TEST_KEY ((void*)cancel_test)    // used as registry key
-#define CANCEL_ERROR ((void*)cancel_error)      // 'cancel_error' sentinel
-
-/*
-* registry[FINALIZER_REG_KEY] is either nil (no finalizers) or a table
-* of functions that Lanes will call after the executing 'pcall' has ended.
-*
-* We're NOT using the GC system for finalizer mainly because providing the
-* error (and maybe stack trace) parameters to the finalizer functions would
-* anyways complicate that approach.
-*/
-#define FINALIZER_REG_KEY ((void*)LG_set_finalizer)
-
-struct s_Linda;
-
-#if 1
-# define DEBUG_SIGNAL( msg, signal_ref ) /* */
-#else
-# define DEBUG_SIGNAL( msg, signal_ref ) \
-    { int i; unsigned char *ptr; char buf[999]; \
-      sprintf( buf, ">>> " msg ": %p\t", (signal_ref) ); \
-      ptr= (unsigned char *)signal_ref; \
-      for( i=0; i<sizeof(*signal_ref); i++ ) { \
-        sprintf( strchr(buf,'\0'), "%02x %c ", ptr[i], ptr[i] ); \
-      } \
-      fprintf( stderr, "%s\n", buf ); \
-    }
-#endif
-
-static bool_t thread_cancel( struct s_lane *s, double secs, bool_t force );
-
-
-/*
-* Push a table stored in registry onto Lua stack.
-*
-* If there is no existing table, create one if 'create' is TRUE.
-* 
-* Returns: TRUE if a table was pushed
-*          FALSE if no table found, not created, and nothing pushed
-*/
-static bool_t push_registry_table( lua_State *L, void *key, bool_t create ) {
-
-    STACK_GROW(L,3);
-    
-    lua_pushlightuserdata( L, key );
-    lua_gettable( L, LUA_REGISTRYINDEX );
-    
-    if (lua_isnil(L,-1)) {
-        lua_pop(L,1);
-
-        if (!create) return FALSE;  // nothing pushed
-
-        lua_newtable(L);
-        lua_pushlightuserdata( L, key );
-        lua_pushvalue(L,-2);    // duplicate of the table
-        lua_settable( L, LUA_REGISTRYINDEX );
-        
-        // [-1]: table that's also bound in registry
-    }
-    return TRUE;    // table pushed
-}
-
-
-/*---=== Serialize require ===---
-*/
-
-static MUTEX_T require_cs;
-
-//---
-// [val]= new_require( ... )
-//
-// Call 'old_require' but only one lane at a time.
-//
-// Upvalues: [1]: original 'require' function
-//
-static int new_require( lua_State *L ) {
-    int rc;
-    int args= lua_gettop(L);
-
-  STACK_GROW(L,1);
-  STACK_CHECK(L)
-    
-    // Using 'lua_pcall()' to catch errors; otherwise a failing 'require' would
-    // leave us locked, blocking any future 'require' calls from other lanes.
-    //
-    MUTEX_LOCK( &require_cs );
-    {
-        lua_pushvalue( L, lua_upvalueindex(1) );
-        lua_insert( L, 1 );
-
-        rc= lua_pcall( L, args, 1 /*retvals*/, 0 /*errfunc*/ );
-            //
-            // LUA_ERRRUN / LUA_ERRMEM
-    }
-    MUTEX_UNLOCK( &require_cs );
-
-    if (rc) lua_error(L);   // error message already at [-1]
-
-  STACK_END(L,0)
-    return 1;
-}
-
-/*
-* Serialize calls to 'require', if it exists
-*/
-static 
-void serialize_require( lua_State *L ) {
-
-  STACK_GROW(L,1);  
-  STACK_CHECK(L)
-    
-    // Check 'require' is there; if not, do nothing
-    //
-    lua_getglobal( L, "require" );
-    if (lua_isfunction( L, -1 )) {
-        // [-1]: original 'require' function
-
-        lua_pushcclosure( L, new_require, 1 /*upvalues*/ );
-        lua_setglobal( L, "require" );
-
-    } else {
-        // [-1]: nil
-        lua_pop(L,1);
-    }
-
-  STACK_END(L,0)
-}
-
-
-/*---=== Keeper states ===---
-*/
-
-/*
-* Pool of keeper states
-*
-* Access to keeper states is locked (only one OS thread at a time) so the 
-* bigger the pool, the less chances of unnecessary waits. Lindas map to the
-* keepers randomly, by a hash.
-*/
-struct s_Keeper {
-    MUTEX_T lock_;
-    lua_State *L;
-} keeper[ KEEPER_STATES_N ];
-
-/* We could use an empty table in 'keeper.lua' as the sentinel, but maybe
-* checking for a lightuserdata is faster.
-*/
-static bool_t nil_sentinel;
-
-/*
-* Initialize keeper states
-*
-* If there is a problem, return an error message (NULL for okay).
-*
-* Note: Any problems would be design flaws; the created Lua state is left
-*       unclosed, because it does not really matter. In production code, this
-*       function never fails.
-*/
-static const char *init_keepers(void) {
-    unsigned int i;
-    for( i=0; i<KEEPER_STATES_N; i++ ) {
-        
-        // Initialize Keeper states with bare minimum of libs (those required
-        // by 'keeper.lua')
-        //
-        lua_State *L= luaL_newstate();
-        if (!L) return "out of memory";
-
-        luaG_openlibs( L, "io,table" );     // 'io' for debugging messages
-
-        lua_pushlightuserdata( L, &nil_sentinel );
-        lua_setglobal( L, "nil_sentinel" );
-
-        // Read in the preloaded chunk (and run it)
-        //
-        if (luaL_loadbuffer( L, keeper_chunk, sizeof(keeper_chunk), "=lanes_keeper" ))
-            return "luaL_loadbuffer() failed";   // LUA_ERRMEM
-
-        if (lua_pcall( L, 0 /*args*/, 0 /*results*/, 0 /*errfunc*/ )) {
-            // LUA_ERRRUN / LUA_ERRMEM / LUA_ERRERR
-            //
-            const char *err= lua_tostring(L,-1);
-            assert(err);
-            return err;
-        }
-
-        MUTEX_INIT( &keeper[i].lock_ );
-        keeper[i].L= L;
-    }
-    return NULL;    // ok
-}
-
-static 
-struct s_Keeper *keeper_acquire( const void *ptr ) {
-    /*
-    * Any hashing will do that maps pointers to 0..KEEPER_STATES_N-1 
-    * consistently.
-    *
-    * Pointers are often aligned by 8 or so - ignore the low order bits
-    */
-    unsigned int i= ((unsigned long)(ptr) >> 3) % KEEPER_STATES_N;
-    struct s_Keeper *K= &keeper[i];
-
-    MUTEX_LOCK( &K->lock_ );
-    return K;
-}
-
-static 
-void keeper_release( struct s_Keeper *K ) {
-    MUTEX_UNLOCK( &K->lock_ );
-}
-
-/*
-* Call a function ('func_name') in the keeper state, and pass on the returned
-* values to 'L'.
-*
-* 'linda':          deep Linda pointer (used only as a unique table key, first parameter)
-* 'starting_index': first of the rest of parameters (none if 0)
-*
-* Returns:  number of return values (pushed to 'L')
-*/
-static
-int keeper_call( lua_State* K, const char *func_name, 
-                  lua_State *L, struct s_Linda *linda, uint_t starting_index ) {
-
-    int args= starting_index ? (lua_gettop(L) - starting_index +1) : 0;
-    int Ktos= lua_gettop(K);
-    int retvals;
-
-    lua_getglobal( K, func_name );
-    ASSERT_L( lua_isfunction(K,-1) );
-
-    STACK_GROW( K, 1 );
-    lua_pushlightuserdata( K, linda );
-
-    luaG_inter_copy( L,K, args );   // L->K
-    lua_call( K, 1+args, LUA_MULTRET );
-
-    retvals= lua_gettop(K) - Ktos;
-
-    luaG_inter_move( K,L, retvals );    // K->L
-    return retvals;
-}
-
-
-/*---=== Linda ===---
-*/
-
-/*
-* Actual data is kept within a keeper state, which is hashed by the 's_Linda'
-* pointer (which is same to all userdatas pointing to it).
-*/
-struct s_Linda {
-    SIGNAL_T read_happened;
-    SIGNAL_T write_happened;
-};
-
-static int LG_linda_id( lua_State* );
-
-#define lua_toLinda(L,n) ((struct s_Linda *)luaG_todeep( L, LG_linda_id, n ))
-
-
-/*
-* bool= linda_send( linda_ud, [timeout_secs=-1,] key_num|str|bool|lightuserdata, ... )
-*
-* Send one or more values to a Linda. If there is a limit, all values must fit.
-*
-* Returns:  'true' if the value was queued
-*           'false' for timeout (only happens when the queue size is limited)
-*/
-LUAG_FUNC( linda_send ) {
-    struct s_Linda *linda= lua_toLinda( L, 1 );
-    bool_t ret;
-    bool_t cancel= FALSE;
-    struct s_Keeper *K;
-    time_d timeout= -1.0;
-    uint_t key_i= 2;    // index of first key, if timeout not there
-
-    if (lua_isnumber(L,2)) {
-        timeout= SIGNAL_TIMEOUT_PREPARE( lua_tonumber(L,2) );
-        key_i++;
-    } else if (lua_isnil(L,2))
-        key_i++;
-
-    if (lua_isnil(L,key_i))
-        luaL_error( L, "nil key" );
-
-    STACK_GROW(L,1);
-
-    K= keeper_acquire( linda );
-    {
-        lua_State *KL= K->L;    // need to do this for 'STACK_CHECK'
-STACK_CHECK(KL)
-        while(TRUE) {
-            int pushed;
-        
-STACK_MID(KL,0)
-            pushed= keeper_call( K->L, "send", L, linda, key_i );
-            ASSERT_L( pushed==1 );
-        
-            ret= lua_toboolean(L,-1);
-            lua_pop(L,1);
-        
-            if (ret) {
-                // Wake up ALL waiting threads
-                //
-                SIGNAL_ALL( &linda->write_happened );
-                break;
-
-            } else if (timeout==0.0) {
-                break;  /* no wait; instant timeout */
-
-            } else {
-                /* limit faced; push until timeout */
-                    
-                cancel= cancel_test( L );   // testing here causes no delays
-                if (cancel) break;
-
-                // K lock will be released for the duration of wait and re-acquired
-                //
-                if (!SIGNAL_WAIT( &linda->read_happened, &K->lock_, timeout ))
-                    break;  // timeout
-            }
-        }
-STACK_END(KL,0)
-    }
-    keeper_release(K);
-
-    if (cancel)
-        cancel_error(L);
-    
-    lua_pushboolean( L, ret );
-    return 1;
-}
-
-
-/*
-* [val, key]= linda_receive( linda_ud, [timeout_secs_num=-1], key_num|str|bool|lightuserdata [, ...] )
-*
-* Receive a value from Linda, consuming it.
-*
-* Returns:  value received (which is consumed from the slot)
-*           key which had it
-*/
-LUAG_FUNC( linda_receive ) {
-    struct s_Linda *linda= lua_toLinda( L, 1 );
-    int pushed;
-    bool_t cancel= FALSE;
-    struct s_Keeper *K;
-    time_d timeout= -1.0;
-    uint_t key_i= 2;
-
-    if (lua_isnumber(L,2)) {
-        timeout= SIGNAL_TIMEOUT_PREPARE( lua_tonumber(L,2) );
-        key_i++;
-    } else if (lua_isnil(L,2))
-        key_i++;
-
-    K= keeper_acquire( linda );
-    {
-        while(TRUE) {
-            pushed= keeper_call( K->L, "receive", L, linda, key_i );
-            if (pushed) {
-                ASSERT_L( pushed==2 );
-
-                // To be done from within the 'K' locking area
-                //
-                SIGNAL_ALL( &linda->read_happened );
-                break;
-
-            } else if (timeout==0.0) {
-                break;  /* instant timeout */
-
-            } else {    /* nothing received; wait until timeout */
-    
-                cancel= cancel_test( L );   // testing here causes no delays
-                if (cancel) break;
-
-                // Release the K lock for the duration of wait, and re-acquire
-                //
-                if (!SIGNAL_WAIT( &linda->write_happened, &K->lock_, timeout ))
-                    break;
-            }
-        }
-    }
-    keeper_release(K);
-
-    if (cancel)
-        cancel_error(L);
-
-    return pushed;
-}
-
-
-/*
-* = linda_set( linda_ud, key_num|str|bool|lightuserdata [,value] )
-*
-* Set a value to Linda.
-*
-* Existing slot value is replaced, and possible queue entries removed.
-*/
-LUAG_FUNC( linda_set ) {
-    struct s_Linda *linda= lua_toLinda( L, 1 );
-    bool_t has_value= !lua_isnil(L,3);
-
-    struct s_Keeper *K= keeper_acquire( linda );
-    {
-        int pushed= keeper_call( K->L, "set", L, linda, 2 );
-        ASSERT_L( pushed==0 );
-
-        /* Set the signal from within 'K' locking.
-        */
-        if (has_value) {
-            SIGNAL_ALL( &linda->write_happened );
-        }
-    }
-    keeper_release(K);
-
-    return 0;
-}
-
-
-/*
-* [val]= linda_get( linda_ud, key_num|str|bool|lightuserdata )
-*
-* Get a value from Linda.
-*/
-LUAG_FUNC( linda_get ) {
-    struct s_Linda *linda= lua_toLinda( L, 1 );
-    int pushed;
-
-    struct s_Keeper *K= keeper_acquire( linda );
-    {
-        pushed= keeper_call( K->L, "get", L, linda, 2 );
-        ASSERT_L( pushed==0 || pushed==1 );
-    }
-    keeper_release(K);
-
-    return pushed;
-}
-
-
-/*
-* = linda_limit( linda_ud, key_num|str|bool|lightuserdata, uint [, ...] )
-*
-* Set limits to 1 or more Linda keys.
-*/
-LUAG_FUNC( linda_limit ) {
-    struct s_Linda *linda= lua_toLinda( L, 1 );
-
-    struct s_Keeper *K= keeper_acquire( linda );
-    {
-        int pushed= keeper_call( K->L, "limit", L, linda, 2 );
-        ASSERT_L( pushed==0 );
-    }
-    keeper_release(K);
-
-    return 0;
-}
-
-
-/*
-* lightuserdata= linda_deep( linda_ud )
-*
-* Return the 'deep' userdata pointer, identifying the Linda.
-*
-* This is needed for using Lindas as key indices (timer system needs it);
-* separately created proxies of the same underlying deep object will have
-* different userdata and won't be known to be essentially the same deep one
-* without this.
-*/
-LUAG_FUNC( linda_deep ) {
-    struct s_Linda *linda= lua_toLinda( L, 1 );
-    lua_pushlightuserdata( L, linda );      // just the address
-    return 1;
-}
-
-
-/*
-* Identity function of a shared userdata object.
-* 
-*   lightuserdata= linda_id( "new" [, ...] )
-*   = linda_id( "delete", lightuserdata )
-*
-* Creation and cleanup of actual 'deep' objects. 'luaG_...' will wrap them into
-* regular userdata proxies, per each state using the deep data.
-*
-*   tbl= linda_id( "metatable" )
-*
-* Returns a metatable for the proxy objects ('__gc' method not needed; will
-* be added by 'luaG_...')
-*
-*   = linda_id( str, ... )
-*
-* For any other strings, the ID function must not react at all. This allows
-* future extensions of the system. 
-*/
-LUAG_FUNC( linda_id ) {
-    const char *which= lua_tostring(L,1);
-
-    if (strcmp( which, "new" )==0) {
-        struct s_Linda *s;
-
-        /* We don't use any parameters, but one could (they're at [2..TOS])
-        */
-        ASSERT_L( lua_gettop(L)==1 );
-
-        /* The deep data is allocated separately of Lua stack; we might no
-        * longer be around when last reference to it is being released.
-        * One can use any memory allocation scheme.
-        */
-        s= (struct s_Linda *) malloc( sizeof(struct s_Linda) );
-        ASSERT_L(s);
-
-        SIGNAL_INIT( &s->read_happened );
-        SIGNAL_INIT( &s->write_happened );
-
-        lua_pushlightuserdata( L, s );
-        return 1;
-
-    } else if (strcmp( which, "delete" )==0) {
-        struct s_Keeper *K;
-        struct s_Linda *s= lua_touserdata(L,2);
-        ASSERT_L(s);
-
-        /* Clean associated structures in the keeper state.
-        */
-        K= keeper_acquire(s);
-        {
-            keeper_call( K->L, "clear", L, s, 0 );
-        }
-        keeper_release(K);
-
-        /* There aren't any lanes waiting on these lindas, since all proxies
-        * have been gc'ed. Right?
-        */
-        SIGNAL_FREE( &s->read_happened );
-        SIGNAL_FREE( &s->write_happened );
-        free(s);
-
-        return 0;
-
-    } else if (strcmp( which, "metatable" )==0) {
-
-      STACK_CHECK(L)
-        lua_newtable(L);
-        lua_newtable(L);
-            //
-            // [-2]: linda metatable
-            // [-1]: metatable's to-be .__index table
-    
-        lua_pushcfunction( L, LG_linda_send );
-        lua_setfield( L, -2, "send" );
-    
-        lua_pushcfunction( L, LG_linda_receive );
-        lua_setfield( L, -2, "receive" );
-    
-        lua_pushcfunction( L, LG_linda_limit );
-        lua_setfield( L, -2, "limit" );
-
-        lua_pushcfunction( L, LG_linda_set );
-        lua_setfield( L, -2, "set" );
-    
-        lua_pushcfunction( L, LG_linda_get );
-        lua_setfield( L, -2, "get" );
-
-        lua_pushcfunction( L, LG_linda_deep );
-        lua_setfield( L, -2, "deep" );
-
-        lua_setfield( L, -2, "__index" );
-      STACK_END(L,1)
-    
-        return 1;
-    }
-    
-    return 0;   // unknown request, be quiet
-}
-
-
-/*---=== Finalizer ===---
-*/
-
-//---
-// void= finalizer( finalizer_func )
-//
-// finalizer_func( [err, stack_tbl] )
-//
-// Add a function that will be called when exiting the lane, either via
-// normal return or an error.
-//
-LUAG_FUNC( set_finalizer )
-{
-    STACK_GROW(L,3);
-    
-    // Get the current finalizer table (if any)
-    //
-    push_registry_table( L, FINALIZER_REG_KEY, TRUE /*do create if none*/ );
-
-    lua_pushinteger( L, lua_objlen(L,-1)+1 );
-    lua_pushvalue( L, 1 );  // copy of the function
-    lua_settable( L, -3 );
-    
-    lua_pop(L,1);
-    return 0;
-}
-
-
-//---
-// Run finalizers - if any - with the given parameters
-//
-// If 'rc' is nonzero, error message and stack index are available as:
-//      [-1]: stack trace (table)
-//      [-2]: error message (any type)
-//
-// Returns:
-//      0 if finalizers were run without error (or there were none)
-//      LUA_ERRxxx return code if any of the finalizers failed
-//
-// TBD: should we add stack trace on failing finalizer, wouldn't be hard..
-//
-static int run_finalizers( lua_State *L, int lua_rc )
-{
-    unsigned error_index, tbl_index;
-    unsigned n;
-    int rc= 0;
-    
-    if (!push_registry_table(L, FINALIZER_REG_KEY, FALSE /*don't create one*/))
-        return 0;   // no finalizers
-
-    tbl_index= lua_gettop(L);
-    error_index= (lua_rc!=0) ? tbl_index-1 : 0;   // absolute indices
-
-    STACK_GROW(L,4);
-
-    // [-1]: { func [, ...] }
-    //
-    for( n= lua_objlen(L,-1); n>0; n-- ) {
-        unsigned args= 0;
-        lua_pushinteger( L,n );
-        lua_gettable( L, -2 );
-        
-        // [-1]: function
-        // [-2]: finalizers table
-
-        if (error_index) {
-            lua_pushvalue( L, error_index );
-            lua_pushvalue( L, error_index+1 );  // stack trace
-            args= 2;
-        }
-
-        rc= lua_pcall( L, args, 0 /*retvals*/, 0 /*no errfunc*/ );
-            //
-            // LUA_ERRRUN / LUA_ERRMEM
-    
-        if (rc!=0) {
-            // [-1]: error message
-            //
-            // If one finalizer fails, don't run the others. Return this
-            // as the 'real' error, preceding that we could have had (or not)
-            // from the actual code.
-            //
-            break;
-        }
-    }
-    
-    lua_remove(L,tbl_index);   // take finalizer table out of stack
-
-    return rc;
-}
-
-
-/*---=== Threads ===---
-*/
-
-// NOTE: values to be changed by either thread, during execution, without
-//       locking, are marked "volatile"
-//
-struct s_lane {
-    THREAD_T thread;
-        //
-        // M: sub-thread OS thread
-        // S: not used
-
-    lua_State *L;
-        //
-        // M: prepares the state, and reads results
-        // S: while S is running, M must keep out of modifying the state
-
-    volatile enum e_status status;
-        // 
-        // M: sets to PENDING (before launching)
-        // S: updates -> RUNNING/WAITING -> DONE/ERROR_ST/CANCELLED
-    
-    volatile bool_t cancel_request;
-        //
-        // M: sets to FALSE, flags TRUE for cancel request
-        // S: reads to see if cancel is requested
-
-#if !( (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) || (defined PTHREAD_TIMEDJOIN) )
-    SIGNAL_T done_signal_;
-        //
-        // M: Waited upon at lane ending  (if Posix with no PTHREAD_TIMEDJOIN)
-        // S: sets the signal once cancellation is noticed (avoids a kill)
-
-    MUTEX_T done_lock_;
-        // 
-        // Lock required by 'done_signal' condition variable, protecting
-        // lane status changes to DONE/ERROR_ST/CANCELLED.
-#endif
-
-    volatile enum { 
-        NORMAL,         // normal master side state
-        KILLED          // issued an OS kill
-    } mstatus;
-        //
-        // M: sets to NORMAL, if issued a kill changes to KILLED
-        // S: not used
-        
-    struct s_lane * volatile selfdestruct_next;
-        //
-        // M: sets to non-NULL if facing lane handle '__gc' cycle but the lane
-        //    is still running
-        // S: cleans up after itself if non-NULL at lane exit
-};
-
-static MUTEX_T selfdestruct_cs;
-    //
-    // Protects modifying the selfdestruct chain
-
-#define SELFDESTRUCT_END ((struct s_lane *)(-1))
-    //
-    // The chain is ended by '(struct s_lane*)(-1)', not NULL:
-    //      'selfdestruct_first -> ... -> ... -> (-1)'
-
-struct s_lane * volatile selfdestruct_first= SELFDESTRUCT_END;
-
-/*
-* Add the lane to selfdestruct chain; the ones still running at the end of the
-* whole process will be cancelled.
-*/
-static void selfdestruct_add( struct s_lane *s ) {
-
-    MUTEX_LOCK( &selfdestruct_cs );
-    {
-        assert( s->selfdestruct_next == NULL );
-
-        s->selfdestruct_next= selfdestruct_first;
-        selfdestruct_first= s;
-    }
-    MUTEX_UNLOCK( &selfdestruct_cs );
-}
-
-/*
-* A free-running lane has ended; remove it from selfdestruct chain
-*/
-static void selfdestruct_remove( struct s_lane *s ) {
-
-    MUTEX_LOCK( &selfdestruct_cs );
-    {
-        // Make sure (within the MUTEX) that we actually are in the chain
-        // still (at process exit they will remove us from chain and then
-        // cancel/kill).
-        //
-        if (s->selfdestruct_next != NULL) {
-            struct s_lane **ref= (struct s_lane **) &selfdestruct_first;
-            bool_t found= FALSE;
-    
-            while( *ref != SELFDESTRUCT_END ) {
-                if (*ref == s) {
-                    *ref= s->selfdestruct_next;
-                    s->selfdestruct_next= NULL;
-                    found= TRUE;
-                    break;
-                }
-                ref= (struct s_lane **) &((*ref)->selfdestruct_next);
-            }
-            assert( found );
-        }
-    }
-    MUTEX_UNLOCK( &selfdestruct_cs );
-}
-
-/*
-* Process end; cancel any still free-running threads
-*/
-static void selfdestruct_atexit( void ) {
-
-    if (selfdestruct_first == SELFDESTRUCT_END) return;    // no free-running threads
-
-    // Signal _all_ still running threads to exit
-    //
-    MUTEX_LOCK( &selfdestruct_cs );
-    {
-        struct s_lane *s= selfdestruct_first;
-        while( s != SELFDESTRUCT_END ) {
-            s->cancel_request= TRUE;
-            s= s->selfdestruct_next;
-        }
-    }
-    MUTEX_UNLOCK( &selfdestruct_cs );
-
-    // When noticing their cancel, the lanes will remove themselves from
-    // the selfdestruct chain.
-
-    // TBD: Not sure if Windows (multi core) will require the timed approach,
-    //      or single Yield. I don't have machine to test that (so leaving
-    //      for timed approach).    -- AKa 25-Oct-2008
- 
-#ifdef PLATFORM_LINUX
-    // It seems enough for Linux to have a single yield here, which allows
-    // other threads (timer lane) to proceed. Without the yield, there is
-    // segfault.
-    //
-    YIELD();
-#else
-    // OS X 10.5 (Intel) needs more to avoid segfaults.
-    //
-    // "make test" is okay. 100's of "make require" are okay.
-    //
-    // Tested on MacBook Core Duo 2GHz and 10.5.5:
-    //  -- AKa 25-Oct-2008
-    //
-    #ifndef ATEXIT_WAIT_SECS
-    # define ATEXIT_WAIT_SECS (0.1)
-    #endif
-    {
-        double t_until= now_secs() + ATEXIT_WAIT_SECS;
-    
-        while( selfdestruct_first != SELFDESTRUCT_END ) {
-            YIELD();    // give threads time to act on their cancel
-            
-            if (now_secs() >= t_until) break;
-        }
-    }
-#endif
-
-    //---
-    // Kill the still free running threads
-    //
-    if ( selfdestruct_first != SELFDESTRUCT_END ) {
-        unsigned n=0;
-        MUTEX_LOCK( &selfdestruct_cs );
-        {
-            struct s_lane *s= selfdestruct_first;
-            while( s != SELFDESTRUCT_END ) {
-                n++;
-                s= s->selfdestruct_next;
-            }
-        }
-        MUTEX_UNLOCK( &selfdestruct_cs );
-
-    // Linux (at least 64-bit): CAUSES A SEGFAULT IF THIS BLOCK IS ENABLED
-    //       and works without the block (so let's leave those lanes running)
-    //
-#if 1
-        // 2.0.2: at least timer lane is still here
-        //
-        //fprintf( stderr, "Left %d lane(s) with cancel request at process end.\n", n );
-#else
-        MUTEX_LOCK( &selfdestruct_cs );
-        {
-            struct s_lane *s= selfdestruct_first;
-            while( s != SELFDESTRUCT_END ) {
-                struct s_lane *next_s= s->selfdestruct_next;
-                s->selfdestruct_next= NULL;     // detach from selfdestruct chain
-
-                THREAD_KILL( &s->thread );
-                s= next_s;
-                n++;
-            }
-            selfdestruct_first= SELFDESTRUCT_END;
-        }
-        MUTEX_UNLOCK( &selfdestruct_cs );
-
-        fprintf( stderr, "Killed %d lane(s) at process end.\n", n );
-#endif
-    }
-}
-
-
-// To allow free-running threads (longer lifespan than the handle's)
-// 'struct s_lane' are malloc/free'd and the handle only carries a pointer.
-// This is not deep userdata since the handle's not portable among lanes.
-//
-#define lua_toLane(L,i)  (* ((struct s_lane**) lua_touserdata(L,i)))
-
-
-/*
-* Check if the thread in question ('L') has been signalled for cancel.
-*
-* Called by cancellation hooks and/or pending Linda operations (because then
-* the check won't affect performance).
-*
-* Returns TRUE if any locks are to be exited, and 'cancel_error()' called,
-* to make execution of the lane end.
-*/
-static bool_t cancel_test( lua_State *L ) {
-    struct s_lane *s;
-
-    STACK_GROW(L,1);
-
-  STACK_CHECK(L)
-    lua_pushlightuserdata( L, CANCEL_TEST_KEY );
-    lua_rawget( L, LUA_REGISTRYINDEX );
-    s= lua_touserdata( L, -1 );     // lightuserdata (true 's_lane' pointer) / nil
-    lua_pop(L,1);
-  STACK_END(L,0)
-
-    // 's' is NULL for the original main state (no-one can cancel that)
-    //
-    return s && s->cancel_request;
-}
-
-static void cancel_error( lua_State *L ) {
-    STACK_GROW(L,1);
-    lua_pushlightuserdata( L, CANCEL_ERROR );    // special error value
-    lua_error(L);   // no return
-}
-
-static void cancel_hook( lua_State *L, lua_Debug *ar ) {
-    (void)ar;
-    if (cancel_test(L)) cancel_error(L);
-}
-
-
-//---
-// = _single( [cores_uint=1] )
-//
-// Limits the process to use only 'cores' CPU cores. To be used for performance
-// testing on multicore devices. DEBUGGING ONLY!
-//
-LUAG_FUNC( _single ) {
-	uint_t cores= luaG_optunsigned(L,1,1);
-
-#ifdef PLATFORM_OSX
-  #ifdef _UTILBINDTHREADTOCPU
-	if (cores > 1) luaL_error( L, "Limiting to N>1 cores not possible." );
-    // requires 'chudInitialize()'
-    utilBindThreadToCPU(0);     // # of CPU to run on (we cannot limit to 2..N CPUs?)
-  #else
-    luaL_error( L, "Not available: compile with _UTILBINDTHREADTOCPU" );
-  #endif
-#else
-    luaL_error( L, "not implemented!" );
-#endif
-	(void)cores;
-	
-	return 0;
-}
-
-
-/*
-* str= lane_error( error_val|str )
-*
-* Called if there's an error in some lane; add call stack to error message 
-* just like 'lua.c' normally does.
-*
-* ".. will be called with the error message and its return value will be the 
-*     message returned on the stack by lua_pcall."
-*
-* Note: Rather than modifying the error message itself, it would be better
-*     to provide the call stack (as string) completely separated. This would
-*     work great with non-string error values as well (current system does not).
-*     (This is NOT possible with the Lua 5.1 'lua_pcall()'; we could of course
-*     implement a Lanes-specific 'pcall' of our own that does this). TBD!!! :)
-*       --AKa 22-Jan-2009
-*/
-#ifdef ERROR_FULL_STACK
-
-static int lane_error( lua_State *L ) {
-    lua_Debug ar;
-    unsigned lev,n;
-
-    // [1]: error message (any type)
-
-    assert( lua_gettop(L)==1 );
-
-    // Don't do stack survey for cancelled lanes.
-    //
-#if 1
-    if (lua_touserdata(L,1) == CANCEL_ERROR)
-        return 1;   // just pass on
-#endif
-
-    // Place stack trace at 'registry[lane_error]' for the 'luc_pcall()'
-    // caller to fetch. This bypasses the Lua 5.1 limitation of only one
-    // return value from error handler to 'lua_pcall()' caller.
-
-    // It's adequate to push stack trace as a table. This gives the receiver
-    // of the stack best means to format it to their liking. Also, it allows
-    // us to add more stack info later, if needed.
-    //
-    // table of { "sourcefile.lua:<line>", ... }
-    //
-    STACK_GROW(L,3);
-    lua_newtable(L);
-
-    // Best to start from level 1, but in some cases it might be a C function
-    // and we don't get '.currentline' for that. It's okay - just keep level
-    // and table index growing separate.    --AKa 22-Jan-2009
-    //
-    lev= 0;
-    n=1;
-    while( lua_getstack(L, ++lev, &ar ) ) {
-        lua_getinfo(L, "Sl", &ar);
-        if (ar.currentline > 0) {
-            lua_pushinteger( L, n++ );
-            lua_pushfstring( L, "%s:%d", ar.short_src, ar.currentline );
-            lua_settable( L, -3 );
-        }
-    }
-
-    lua_pushlightuserdata( L, STACK_TRACE_KEY );
-    lua_insert(L,-2);
-    lua_settable( L, LUA_REGISTRYINDEX );
-
-    assert( lua_gettop(L)== 1 );
-
-    return 1;   // the untouched error value
-}
-#endif
-
-
-//---
-#if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC)
-  static THREAD_RETURN_T __stdcall lane_main( void *vs )
-#else
-  static THREAD_RETURN_T lane_main( void *vs )
-#endif
-{
-    struct s_lane *s= (struct s_lane *)vs;
-    int rc, rc2;
-    lua_State *L= s->L;
-
-    s->status= RUNNING;  // PENDING -> RUNNING
-
-    // Tie "set_finalizer()" to the state
-    //
-    lua_pushcfunction( L, LG_set_finalizer );
-    lua_setglobal( L, "set_finalizer" );
-
-#ifdef ERROR_FULL_STACK
-    STACK_GROW( L, 1 );
-    lua_pushcfunction( L, lane_error );
-    lua_insert( L, 1 );
-
-    // [1]: error handler
-    // [2]: function to run
-    // [3..top]: parameters
-    //
-    rc= lua_pcall( L, lua_gettop(L)-2, LUA_MULTRET, 1 /*error handler*/ );
-        // 0: no error
-        // LUA_ERRRUN: a runtime error (error pushed on stack)
-        // LUA_ERRMEM: memory allocation error
-        // LUA_ERRERR: error while running the error handler (if any)
-
-    assert( rc!=LUA_ERRERR );   // since we've authored it
-
-    lua_remove(L,1);    // remove error handler
-
-    // Lua 5.1 error handler is limited to one return value; taking stack trace
-    // via registry
-    //
-    if (rc!=0) {    
-        STACK_GROW(L,1);
-        lua_pushlightuserdata( L, STACK_TRACE_KEY );
-        lua_gettable(L, LUA_REGISTRYINDEX);
-
-        // For cancellation, a stack trace isn't placed
-        //
-        assert( lua_istable(L,2) || (lua_touserdata(L,1)==CANCEL_ERROR) );
-        
-        // Just leaving the stack trace table on the stack is enough to get
-        // it through to the master.
-    }
-
-#else
-    // This code does not use 'lane_error'
-    //
-    // [1]: function to run
-    // [2..top]: parameters
-    //
-    rc= lua_pcall( L, lua_gettop(L)-1, LUA_MULTRET, 0 /*no error handler*/ );
-        // 0: no error
-        // LUA_ERRRUN: a runtime error (error pushed on stack)
-        // LUA_ERRMEM: memory allocation error
-#endif
-
-//STACK_DUMP(L);
-    // Call finalizers, if the script has set them up.
-    //
-    rc2= run_finalizers(L,rc);
-    if (rc2!=0) {
-        // Error within a finalizer!  
-        // 
-        // [-1]: error message
-
-        rc= rc2;    // we're overruling the earlier script error or normal return
-
-        lua_insert( L,1 );  // make error message [1]
-        lua_settop( L,1 );  // remove all rest
-
-        // Place an empty stack table just to keep the API simple (always when
-        // there's an error, there's also stack table - though it may be empty).
-        //
-        lua_newtable(L);
-    }
-
-    if (s->selfdestruct_next != NULL) {
-        // We're a free-running thread and no-one's there to clean us up.
-        //
-        lua_close( s->L );
-        L= 0;
-
-    #if !( (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) || (defined PTHREAD_TIMEDJOIN) )
-        SIGNAL_FREE( &s->done_signal_ );
-        MUTEX_FREE( &s->done_lock_ );
-    #endif
-        selfdestruct_remove(s);     // away from selfdestruct chain
-        free(s);
-
-    } else {
-        // leave results (1..top) or error message + stack trace (1..2) on the stack - master will copy them
-
-        enum e_status st= 
-            (rc==0) ? DONE 
-                    : (lua_touserdata(L,1)==CANCEL_ERROR) ? CANCELLED 
-                    : ERROR_ST;
-
-        // Posix no PTHREAD_TIMEDJOIN:
-        // 		'done_lock' protects the -> DONE|ERROR_ST|CANCELLED state change
-        //
-    #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) || (defined PTHREAD_TIMEDJOIN)
-        s->status= st;
-    #else
-        MUTEX_LOCK( &s->done_lock_ );
-        {
-            s->status= st;
-            SIGNAL_ONE( &s->done_signal_ );   // wake up master (while 's->done_lock' is on)
-        }
-        MUTEX_UNLOCK( &s->done_lock_ );
-    #endif
-    }
-
-    return 0;   // ignored
-}
-
-
-//---
-// lane_ud= thread_new( function, [libs_str], 
-//                          [cancelstep_uint=0], 
-//                          [prio_int=0],
-//                          [globals_tbl],
-//                          [... args ...] )
-//
-// Upvalues: metatable to use for 'lane_ud'
-//
-LUAG_FUNC( thread_new )
-{
-    lua_State *L2;
-    struct s_lane *s;
-    struct s_lane **ud;
-
-    const char *libs= lua_tostring( L, 2 );
-    uint_t cs= luaG_optunsigned( L, 3,0);
-    int prio= luaL_optinteger( L, 4,0);
-    uint_t glob= luaG_isany(L,5) ? 5:0;
-
-    #define FIXED_ARGS (5)
-    uint_t args= lua_gettop(L) - FIXED_ARGS;
-
-    if (prio < THREAD_PRIO_MIN || prio > THREAD_PRIO_MAX) {
-        luaL_error( L, "Priority out of range: %d..+%d (%d)", 
-                            THREAD_PRIO_MIN, THREAD_PRIO_MAX, prio );
-    }
-
-    /* --- Create and prepare the sub state --- */
-
-    L2 = luaL_newstate();   // uses standard 'realloc()'-based allocator,
-                            // sets the panic callback
-
-    if (!L2) luaL_error( L, "'luaL_newstate()' failed; out of memory" );
-
-    STACK_GROW( L,2 );
-
-    // Setting the globals table (needs to be done before loading stdlibs,
-    // and the lane function)
-    //
-    if (glob!=0) {
-STACK_CHECK(L)
-        if (!lua_istable(L,glob)) 
-            luaL_error( L, "Expected table, got %s", luaG_typename(L,glob) );
-
-        lua_pushvalue( L, glob );
-        luaG_inter_move( L,L2, 1 );     // moves the table to L2
-
-        // L2 [-1]: table of globals
-
-        // "You can change the global environment of a Lua thread using lua_replace"
-        // (refman-5.0.pdf p. 30) 
-        //
-        lua_replace( L2, LUA_GLOBALSINDEX );
-STACK_END(L,0)
-    }
-
-    // Selected libraries
-    //
-    if (libs) {
-        const char *err= luaG_openlibs( L2, libs );
-        ASSERT_L( !err );   // bad libs should have been noticed by 'lanes.lua'
-
-        serialize_require( L2 );
-    }
-
-    // Lane main function
-    //
-STACK_CHECK(L)
-    lua_pushvalue( L, 1 );
-    luaG_inter_move( L,L2, 1 );    // L->L2
-STACK_MID(L,0)
-
-    ASSERT_L( lua_gettop(L2) == 1 );
-    ASSERT_L( lua_isfunction(L2,1) );
-
-    // revive arguments
-    //
-    if (args) luaG_inter_copy( L,L2, args );    // L->L2
-STACK_MID(L,0)
-
-ASSERT_L( (uint_t)lua_gettop(L2) == 1+args );
-ASSERT_L( lua_isfunction(L2,1) );
-
-    // 's' is allocated from heap, not Lua, since its life span may surpass 
-    // the handle's (if free running thread)
-    //
-    ud= lua_newuserdata( L, sizeof(struct s_lane*) );
-    ASSERT_L(ud);
-
-    s= *ud= malloc( sizeof(struct s_lane) );
-    ASSERT_L(s);
-
-    //memset( s, 0, sizeof(struct s_lane) );
-    s->L= L2;
-    s->status= PENDING;
-    s->cancel_request= FALSE;
-
-#if !( (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) || (defined PTHREAD_TIMEDJOIN) )
-    MUTEX_INIT( &s->done_lock_ );