Permalink
Browse files

Import to git

  • Loading branch information...
drahosp committed Oct 1, 2010
0 parents commit 812a3639d76dee090776c8eb99e291f3fc3cc9bb
Showing with 4,966 additions and 0 deletions.
  1. +23 −0 CMakeLists.txt
  2. +19 −0 LICENSE
  3. +2 −0 Makefile
  4. +17 −0 NEWS
  5. +35 −0 README
  6. +130 −0 dist.cmake
  7. +16 −0 dist.info
  8. BIN doc/concurrentlua.png
  9. +105 −0 doc/index.html
  10. +625 −0 doc/introduction.html
  11. +89 −0 doc/license.html
  12. +314 −0 doc/reference.html
  13. +71 −0 doc/stylesheet.css
  14. +10 −0 samples/example1.lua
  15. +37 −0 samples/example2.lua
  16. +38 −0 samples/example3.lua
  17. +22 −0 samples/example4a.lua
  18. +25 −0 samples/example4b.lua
  19. +33 −0 samples/example5a.lua
  20. +37 −0 samples/example5b.lua
  21. +5 −0 src/Makefile
  22. +42 −0 src/cldaemon/Makefile
  23. +80 −0 src/cldaemon/cldaemon.c
  24. +2 −0 src/cldaemon/cldaemon.def
  25. +24 −0 src/clpmd/Makefile
  26. +61 −0 src/clpmd/clpmd
  27. +42 −0 src/cltime/Makefile
  28. +88 −0 src/cltime/cltime.c
  29. +2 −0 src/cltime/cltime.def
  30. +36 −0 src/concurrent/Makefile
  31. +34 −0 src/concurrent/distributed/Makefile
  32. +19 −0 src/concurrent/distributed/cookie.lua
  33. +15 −0 src/concurrent/distributed/init.lua
  34. +149 −0 src/concurrent/distributed/link.lua
  35. +73 −0 src/concurrent/distributed/message.lua
  36. +118 −0 src/concurrent/distributed/monitor.lua
  37. +299 −0 src/concurrent/distributed/network.lua
  38. +72 −0 src/concurrent/distributed/node.lua
  39. +79 −0 src/concurrent/distributed/process.lua
  40. +310 −0 src/concurrent/distributed/register.lua
  41. +53 −0 src/concurrent/distributed/scheduler.lua
  42. +17 −0 src/concurrent/init.lua
  43. +104 −0 src/concurrent/link.lua
  44. +36 −0 src/concurrent/message.lua
  45. +75 −0 src/concurrent/monitor.lua
  46. +19 −0 src/concurrent/option.lua
  47. +109 −0 src/concurrent/process.lua
  48. +61 −0 src/concurrent/register.lua
  49. +69 −0 src/concurrent/root.lua
  50. +123 −0 src/concurrent/scheduler.lua
  51. +9 −0 test/concurrent.sh
  52. +27 −0 test/concurrent/link1.lua
  53. +40 −0 test/concurrent/link2.lua
  54. +24 −0 test/concurrent/message1.lua
  55. +27 −0 test/concurrent/monitor1.lua
  56. +41 −0 test/concurrent/monitor2.lua
  57. +28 −0 test/concurrent/process1.lua
  58. +36 −0 test/concurrent/process2.lua
  59. +43 −0 test/concurrent/register1.lua
  60. +57 −0 test/concurrent/register2.lua
  61. +30 −0 test/concurrent/trapexit1.lua
  62. +45 −0 test/concurrent/trapexit2.lua
  63. +20 −0 test/distributed/cookie1a.lua
  64. +21 −0 test/distributed/cookie1b.lua
  65. +21 −0 test/distributed/cookie2a.lua
  66. +21 −0 test/distributed/cookie2b.lua
  67. +20 −0 test/distributed/link1a.lua
  68. +20 −0 test/distributed/link1b.lua
  69. +17 −0 test/distributed/link2a.lua
  70. +20 −0 test/distributed/link2b.lua
  71. +20 −0 test/distributed/link2c.lua
  72. +20 −0 test/distributed/message1a.lua
  73. +14 −0 test/distributed/message1b.lua
  74. +19 −0 test/distributed/monitor1a.lua
  75. +21 −0 test/distributed/monitor1b.lua
  76. +16 −0 test/distributed/monitor2a.lua
  77. +22 −0 test/distributed/monitor2b.lua
  78. +22 −0 test/distributed/monitor2c.lua
  79. +22 −0 test/distributed/node1a.lua
  80. +21 −0 test/distributed/node1b.lua
  81. +19 −0 test/distributed/process1a.lua
  82. +20 −0 test/distributed/process1b.lua
  83. +27 −0 test/distributed/process2a.lua
  84. +9 −0 test/distributed/process2b.lua
  85. +26 −0 test/distributed/register1a.lua
  86. +21 −0 test/distributed/register1b.lua
  87. +23 −0 test/distributed/register2a.lua
  88. +22 −0 test/distributed/register2b.lua
  89. +22 −0 test/distributed/register2c.lua
  90. +20 −0 test/distributed/trapexit1a.lua
  91. +23 −0 test/distributed/trapexit1b.lua
  92. +17 −0 test/distributed/trapexit2a.lua
  93. +25 −0 test/distributed/trapexit2b.lua
  94. +24 −0 test/distributed/trapexit2c.lua
  95. +8 −0 test/distributed2a.sh
  96. +9 −0 test/distributed2b.sh
  97. +7 −0 test/distributed3a.sh
  98. +8 −0 test/distributed3b.sh
  99. +8 −0 test/distributed3c.sh
@@ -0,0 +1,23 @@
+# Copyright (C) 2007-2009 LuaDist.
+# Created by Peter Drahoš
+# Redistribution and use of this file is allowed according to the terms of the MIT license.
+# For details see the COPYRIGHT file distributed with LuaDist.
+# Please note that the package source code is licensed under its own license.
+
+PROJECT(concrrentlua C)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+INCLUDE(dist.cmake)
+
+# Build
+ADD_LUA_MODULE(cldaemon src/cldaemon/cldaemon.c ${CMAKE_CURRENT_SOURCE_DIR}/src/cldaemon/cldaemon.def)
+ADD_LUA_MODULE(cltime src/cltime/cltime.c ${CMAKE_CURRENT_SOURCE_DIR}/src/cldaemon/cldaemon.def)
+
+# Install all files and documentation
+INSTALL (TARGETS cldaemon cltime DESTINATION ${INSTALL_CMOD})
+INSTALL (PROGRAMS src/clpmd/clpmd DESTINATION ${INSTALL_BIN})
+INSTALL (DIRECTORY src/concurrent DESTINATION ${INSTALL_LMOD} PATTERN "Makefile" EXCLUDE)
+INSTALL (DIRECTORY samples/ DESTINATION ${INSTALL_EXAMPLE})
+INSTALL (DIRECTORY test/ DESTINATION ${INSTALL_TEST})
+INSTALL (DIRECTORY doc/ DESTINATION ${INSTALL_DOC})
+INSTALL (FILES README LICENSE NEWS DESTINATION ${INSTALL_DATA})
+
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2007-2009 Eleftherios Chatzimparmpas
+
+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.
@@ -0,0 +1,2 @@
+all install uninstall clean:
+ cd src && $(MAKE) $@
17 NEWS
@@ -0,0 +1,17 @@
+Version 1.0.3 - 23 May 2009
+---------------------------
+- Bug fix; time calculation for the root process while sleeping was wrong.
+- Minor enhancements to the serializer in the handling of tables.
+
+Version 1.0.2 - 21 June 2008
+----------------------------
+- Minor enhancement to the serializer in the handling of strings.
+
+Version 1.0.1 - 24 March 2008
+-----------------------------
+- Bug fix; cltime.time() overflow in 32-bit architectures caused problems to
+ the scheduler.
+
+Version 1.0 - 31 December 2007
+------------------------------
+- Initial release.
35 README
@@ -0,0 +1,35 @@
+ConcurrentLua 1.0.3
+===================
+
+Requirements
+------------
+* The Lua Socket module (http://luasocket.luaforge.net)
+* The Lua Copas module (http://www.keplerproject.org/copas/)
+
+
+Installation
+------------
+The system can be compiled and installed using the make files:
+
+ make all
+ make install
+
+
+Usage
+-----
+See the doc/introduction.html and doc/reference.html files.
+
+
+Website
+-------
+http://concurrentlua.luaforge.net
+
+
+Author
+------
+Lefteris Chatzimparmpas <lefcha@hellug.gr>
+
+
+License
+-------
+See the LICENSE file.
@@ -0,0 +1,130 @@
+# LuaDist CMake utility library.
+# Provides variables and utility functions common to LuaDist CMake builds.
+#
+# Copyright (C) 2007-2010 LuaDist.
+# by David Manura, Peter Drahos
+# Redistribution and use of this file is allowed according to the terms of the MIT license.
+# For details see the COPYRIGHT file distributed with LuaDist.
+# Please note that the package source code is licensed under its own license.
+
+# Few convinence settings
+SET (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+SET (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH})
+
+# Where to install module parts:
+set(INSTALL_BIN bin CACHE PATH "Where to install binaries to.")
+set(INSTALL_LIB lib CACHE PATH "Where to install libraries to.")
+set(INSTALL_INC include CACHE PATH "Where to install headers to.")
+set(INSTALL_ETC etc CACHE PATH "Where to store configuration files")
+set(INSTALL_LMOD share/lua/lmod CACHE PATH "Directory to install Lua modules.")
+set(INSTALL_CMOD share/lua/cmod CACHE PATH "Directory to install Lua binary modules.")
+set(INSTALL_DATA share/${PROJECT_NAME} CACHE PATH "Directory the package can store documentation, tests or other data in.")
+set(INSTALL_DOC ${INSTALL_DATA}/doc CACHE PATH "Recommended directory to install documentation into.")
+set(INSTALL_EXAMPLE ${INSTALL_DATA}/example CACHE PATH "Recommended directory to install examples into.")
+set(INSTALL_TEST ${INSTALL_DATA}/test CACHE PATH "Recommended directory to install tests into.")
+set(INSTALL_FOO ${INSTALL_DATA}/etc CACHE PATH "Where to install additional files")
+
+
+# In MSVC, prevent warnings that can occur when using standard libraries.
+if(MSVC)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+endif(MSVC)
+
+# Adds Lua shared library module target `_target`.
+# Additional sources to build the module are listed after `_target`.
+macro(add_lua_module _target)
+ find_package(Lua51 REQUIRED)
+ include_directories(${LUA_INCLUDE_DIR}) #2DO: somehow apply only to _target?
+
+ add_library(${_target} MODULE ${ARGN})
+ set_target_properties(${_target} PROPERTIES PREFIX "")
+ target_link_libraries(${_target} ${LUA_LIBRARY})
+
+ IF(WIN32)
+ set_target_properties(${_target} PROPERTIES LINK_FLAGS "-Wl,--enable-auto-import")
+ ENDIF()
+
+endmacro(add_lua_module)
+
+# Runs Lua script `_testfile` under CTest tester.
+# Optional argument `_testcurrentdir` is current working directory to run test under
+# (defaults to ${CMAKE_CURRENT_BINARY_DIR}).
+# Both paths, if relative, are relative to ${CMAKE_CURRENT_SOURCE_DIR}.
+# Under LuaDist, set test=true in config.lua to enable testing.
+macro(add_lua_test _testfile)
+ include(CTest)
+ if(BUILD_TESTING)
+ find_program(LUA NAMES lua lua.bat)
+ get_filename_component(TESTFILEABS ${_testfile} ABSOLUTE)
+ get_filename_component(TESTFILENAME ${_testfile} NAME)
+ get_filename_component(TESTFILEBASE ${_testfile} NAME_WE)
+
+ # Write wrapper script.
+ set(TESTWRAPPER ${CMAKE_CURRENT_BINARY_DIR}/${TESTFILENAME})
+ set(TESTWRAPPERSOURCE
+"package.path = '${CMAKE_CURRENT_BINARY_DIR}/?.lua\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua\;' .. package.path
+package.cpath = '${CMAKE_CURRENT_BINARY_DIR}/?.so\;${CMAKE_CURRENT_BINARY_DIR}/?.dll\;' .. package.cpath
+return dofile '${TESTFILEABS}'
+" )
+ if(${ARGC} GREATER 1)
+ set(_testcurrentdir ${ARGV1})
+ get_filename_component(TESTCURRENTDIRABS ${_testcurrentdir} ABSOLUTE)
+ set(TESTWRAPPERSOURCE
+"require 'lfs'
+lfs.chdir('${TESTCURRENTDIRABS}')
+${TESTWRAPPERSOURCE}")
+ endif()
+ FILE(WRITE ${TESTWRAPPER} ${TESTWRAPPERSOURCE})
+
+ add_test(${TESTFILEBASE} ${LUA} ${TESTWRAPPER})
+ endif(BUILD_TESTING)
+
+ # see also http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/CMakeModules/UsePythonTest.cmake
+endmacro(add_lua_test)
+
+# Converts Lua source file `_source` to binary string embedded in C source
+# file `_target`. Optionally compiles Lua source to byte code (not available
+# under LuaJIT2, which doesn't have a bytecode loader). Additionally, Lua
+# versions of bin2c [1] and luac [2] may be passed respectively as additional
+# arguments.
+#
+# [1] http://lua-users.org/wiki/BinToCee
+# [2] http://lua-users.org/wiki/LuaCompilerInLua
+function(add_lua_bin2c _target _source)
+ find_program(LUA NAMES lua lua.bat)
+ execute_process(COMMAND ${LUA} -e "string.dump(function()end)" RESULT_VARIABLE _LUA_DUMP_RESULT ERROR_QUIET)
+ if (NOT ${_LUA_DUMP_RESULT})
+ SET(HAVE_LUA_DUMP true)
+ endif()
+ message("-- string.dump=${HAVE_LUA_DUMP}")
+
+ if (ARGV2)
+ get_filename_component(BIN2C ${ARGV2} ABSOLUTE)
+ set(BIN2C ${LUA} ${BIN2C})
+ else()
+ find_program(BIN2C NAMES bin2c bin2c.bat)
+ endif()
+ if (HAVE_LUA_DUMP)
+ if (ARGV3)
+ get_filename_component(LUAC ${ARGV3} ABSOLUTE)
+ set(LUAC ${LUA} ${LUAC})
+ else()
+ find_program(LUAC NAMES luac luac.bat)
+ endif()
+ endif (HAVE_LUA_DUMP)
+ message("-- bin2c=${BIN2C}")
+ message("-- luac=${LUAC}")
+
+ get_filename_component(SOURCEABS ${_source} ABSOLUTE)
+ if (HAVE_LUA_DUMP)
+ get_filename_component(SOURCEBASE ${_source} NAME_WE)
+ add_custom_command(
+ OUTPUT ${_target} DEPENDS ${_source}
+ COMMAND ${LUAC} -o ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ${SOURCEABS}
+ COMMAND ${BIN2C} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ">${_target}" )
+ else()
+ add_custom_command(
+ OUTPUT ${_target} DEPENDS ${SOURCEABS}
+ COMMAND ${BIN2C} ${_source} ">${_target}" )
+ endif()
+endfunction(add_lua_bin2c)
@@ -0,0 +1,16 @@
+--- This file is part of LuaDist project
+
+name = "concurrentlua"
+version = "1.0.3"
+
+desc = "Concurrency Oriented Programming in Lua"
+author = "Lefteris Chatzimparmpas"
+license = "MIT"
+url = "http://concurrentlua.luaforge.net/"
+maintainer = "Peter Drahoš"
+
+depends = {
+ "lua ~> 5.1",
+ "luasocket >= 2.0",
+ "copas >= 1.1"
+}
Binary file not shown.
@@ -0,0 +1,105 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></meta>
+<meta name="keywords" content="concurrent lua"></meta>
+<meta name="description" content="ConcurrentLua. Concurrency Oriented
+ Programming in Lua."></meta>
+<title>ConcurrentLua</title>
+<link href="stylesheet.css" rel="stylesheet" type="text/css"></link>
+</head>
+
+<body>
+
+<div class="center">
+ <a class="link" href="http://luaforge.net/projects/concurrentlua/">
+ <img src="concurrentlua.png" alt="ConcurrentLua logo"></img>
+ </a>
+ <h1>ConcurrentLua</h1>
+ <p>Concurrency Oriented Programming in Lua</p>
+ <div class="navigation">
+ <a class="link" href="index.html">home</a> &middot;
+ <a class="link" href="index.html#download">download</a> &middot;
+ <a class="link" href="index.html#installation">installation</a> &middot;
+ <a class="link" href="introduction.html">introduction</a> &middot;
+ <a class="link" href="reference.html">reference</a>
+ </div>
+</div>
+
+<div class="box">
+
+ <h3><a>Overview</a></h3>
+
+ <p>ConcurrentLua is a system that implements Erlang-style concurrency for the
+ <a class="link" href="http://www.lua.org/">Lua programming language</a>. It is
+ a system that brings an alternative to what scripting languages offer for
+ concurrent and distributed programming.</p>
+
+ <p>Erlang is regarded as the reference language for concurrent and distributed
+ programming using the message-passing model. Erlang was designed with
+ concurrency oriented programming in mind and has built-in facilities to
+ support this model.</p>
+
+ <p>ConcurrentLua is based on the Lua model for concurrency, namely coroutines,
+ and extends this model by providing message-passing primitives. Distributed
+ programming is supported transparently with the same message-passing
+ primitives.</p>
+
+ <p>ConcurrentLua is implemented as a collection of Lua modules that can be
+ loaded by any Lua program. Most of the code is written in Lua itself, with
+ minor parts written in C.</p>
+
+ <p>The system was originally designed and implemented as part of my MSc Thesis
+ at the Royal Institute of Technology (KTH). At this point it can be considered
+ a working prototype, nevertheless it is a complete solution and it was
+ implemented so as to be further extended in the future, if found useful by the
+ community.</p>
+
+ <h3><a id="download">Download</a></h3>
+
+ <p>The current version is 1.0.3, released on 23 May 2009.</p>
+
+ <p>ConcurrentLua can be downloaded from its <a class="link"
+ href="http://luaforge.net/projects/concurrentlua/">LuaForge project
+ page</a>.</p>
+
+ <h3><a id="installation">Installation</a></h3>
+
+ <p>ConcurrentLua depends only on the <a class="link"
+ href="http://luasocket.luaforge.net/">LuaSocket</a> and <a class="link"
+ href="http://www.keplerproject.org/copas/">Copas</a> modules.</p>
+
+ <p>ConcurrentLua uses the new package system for Lua 5.1. </p>
+
+ <p>ConcurrentLua is supplied with a Makefile that can be used to build and
+ install it.</p>
+
+ <h3><a>Contact</a></h3>
+
+ <p>Lefteris Chatzimparmpas <a class="link"
+ href="mailto:lefcha@hellug.gr">&lt;lefcha@hellug.gr&gt;</a></p>
+
+ <h3><a>License</a></h3>
+
+ <p>This program is released under the same <a class="link" href=
+ "license.html">terms and conditions</a> as the Lua language, the MIT/X11
+ license.</p>
+
+</div>
+
+<div class="center">
+ <div class="navigation">
+ <a class="link" href="index.html">home</a> &middot;
+ <a class="link" href="index.html#download">download</a> &middot;
+ <a class="link" href="index.html#installation">installation</a> &middot;
+ <a class="link" href="introduction.html">introduction</a> &middot;
+ <a class="link" href="reference.html">reference</a>
+ </div>
+</div>
+
+</body>
+
+</html>
+
Oops, something went wrong.

0 comments on commit 812a363

Please sign in to comment.