Permalink
Browse files

Fix a bunch of compilation errors.

  • Loading branch information...
1 parent ae1252f commit ac976280d61275eaaaa8029d864a6d681d40f245 @meh committed May 13, 2012
Showing with 42 additions and 39 deletions.
  1. +25 −0 Rakefile
  2. +5 −7 nucular/available/select.d
  3. +1 −1 nucular/breaker.d
  4. +3 −1 nucular/connection.d
  5. +1 −1 nucular/descriptor.d
  6. +1 −1 nucular/periodictimer.d
  7. +4 −5 nucular/reactor.d
  8. +1 −1 nucular/server.d
  9. +0 −21 nucular/signature.d
  10. +1 −1 nucular/timer.d
View
@@ -0,0 +1,25 @@
+require 'rake'
+require 'rake/clean'
+
+NAME = 'nucular'
+VERSION = '0.0.1'
+
+def name
+ "#{NAME}.#{VERSION}"
+end
+
+DC = 'dmd'
+FLAGS = ''
+
+if ENV['DEBUG']
+ FLAGS << ' -debug'
+end
+
+SOURCES = FileList['nucular/**/*.d']
+OBJECTS = SOURCES.ext('o')
+
+task :default => ["lib#{name}.so"]
+
+file "lib#{name}.so" do
+ sh "#{DC} -shared #{FLAGS} #{SOURCES}"
+end
View
@@ -16,11 +16,9 @@
* along with nucular. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
-module nucular.available.select;
-
import core.time;
-import core.sys.posix.select;
-import core.sys.posix.sys.time.timeval;
+import core.sys.posix.sys.select;
+import core.sys.posix.sys.time;
import nucular.descriptor;
@@ -31,7 +29,7 @@ Descriptor[] readable (Descriptor[] descriptors, Duration sleep = null) {
if (sleep) {
timeval tv = { to!(time_t)(sleep.total!"seconds"()), to!(suseconds_t, sleep.fracSec.usecs) };
- select(nfds, &set, null, null, &tv)
+ select(nfds, &set, null, null, &tv);
}
else {
select(nfds, &set, null, null, null);
@@ -45,7 +43,7 @@ Descriptor[] writable (Descriptor[] descriptors, Duration sleep = null) {
if (sleep) {
timeval tv = { to!(time_t)(sleep.total!"seconds"()), to!(suseconds_t, sleep.fracSec.usecs) };
- select(nfds, null, &set, null, &tv)
+ select(nfds, null, &set, null, &tv);
}
else {
select(nfds, null, &set, null, null);
@@ -55,7 +53,7 @@ Descriptor[] writable (Descriptor[] descriptors, Duration sleep = null) {
private fd_set toSet (ref Descriptor[] descriptors) {
fd_set set;
- for (descriptor; descriptors) {
+ foreach (descriptor; descriptors) {
FD_SET(cast (int) descriptor, set);
}
View
@@ -16,7 +16,7 @@
* along with nucular. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
-module nucular;
+module nucular.breaker;
import core.memory;
View
@@ -16,7 +16,7 @@
* along with nucular. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
-module nucular;
+module nucular.connection;
class Connection {
this (Descriptor descriptor) {
@@ -28,7 +28,9 @@ class Connection {
}
void close_connection (bool after_writing = false) {
+ if (after_writing) {
+ }
}
void close_connection_after_writing () {
View
@@ -16,7 +16,7 @@
* along with nucular. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
-module nucular;
+module nucular.descriptor;
import std.conv;
import std.exception;
View
@@ -16,7 +16,7 @@
* along with nucular. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
-module nucular;
+module nucular.periodictimer;
import std.datetime;
import nucular.reactor;
View
@@ -27,7 +27,6 @@ import nucular.available;
import nucular.server;
public import nucular.connection;
-public import nucular.watcher;
public Threadpool threadpool;
@@ -41,7 +40,7 @@ private Duration _quantum = dur!"msecs"(100);
private Breaker _breaker;
private bool _running = false;
-private (void function ())[] _scheduled;
+private void function ()[] _scheduled;
private Mutex _mutex;
void run (void function () block) {
@@ -59,7 +58,7 @@ void run (void function () block) {
while (_running) {
synchronized (_mutex) {
- for (block; _scheduled) {
+ foreach (block; _scheduled) {
block();
}
@@ -132,13 +131,13 @@ PeriodicTimer addPeriodicTimer (Duration time, void function () block) {
void cancelTimer (Timer timer) {
schedule({
- _timers = filter!((a) { return a != timer })(_timers);
+ _timers = _timer.sfilter!((a) { return a != timer; });
});
}
void cancelTimer (PeriodicTimer timer) {
schedule({
- _periodical_timers = filter!((a) { return a != timer })(_periodic_timers);
+ _periodical_timers = _periodical_timers.filter!((a) { return a != timer; });
});
}
View
@@ -16,7 +16,7 @@
* along with nucular. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
-module nucular;
+module nucular.server;
class Server {
this (string host, int port = 0) {
View
@@ -1,21 +0,0 @@
-/* Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
- *
- * This file is part of nucular.
- *
- * nucular is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License,
- * or (at your option) any later version.
- *
- * nucular is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with nucular. If not, see <http://www.gnu.org/licenses/>.
- ****************************************************************************/
-
-module nucular.signature;
-
-alias int Signature;
View
@@ -16,7 +16,7 @@
* along with nucular. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
-module nucular;
+module nucular.timer;
import std.datetime;
import nucular.reactor;

0 comments on commit ac97628

Please sign in to comment.