Skip to content

Commit

Permalink
Add EXPORTS macro, update modules to use it.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Robinson committed Jul 13, 2009
1 parent 8ad7c63 commit 28f29aa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/narwhal.h
Expand Up @@ -52,4 +52,6 @@ extern v8::Handle<v8::Object> require(const char * id);
#define END_NARWHAL_MODULE \
return JS_undefined;}\

#define EXPORTS(name, object) OBJECT_SET(Exports, name, object);

#endif
2 changes: 1 addition & 1 deletion src/foo.cc
Expand Up @@ -15,6 +15,6 @@ END

NARWHAL_MODULE(foo)

OBJECT_SET(Exports, "bar", JS_fn(Bar));
EXPORTS("bar", JS_fn(Bar));

END_NARWHAL_MODULE
6 changes: 4 additions & 2 deletions src/os-platform.cc
Expand Up @@ -2,6 +2,7 @@
#include <stdlib.h>

FUNCTION(Exit)

if (ARGC == 0)
{
exit(0);
Expand All @@ -11,11 +12,12 @@ FUNCTION(Exit)
ARG_int(code, 0);
exit(code);
}
return ThrowException(String::New("os.exit() takes 0 or 1 arguments."));

THROW("os.exit() takes 0 or 1 arguments.");
END

NARWHAL_MODULE(os_platform)

OBJECT_SET(Exports, "exit", JS_fn(Exit));
EXPORTS("exit", JS_fn(Exit));

END_NARWHAL_MODULE

0 comments on commit 28f29aa

Please sign in to comment.