Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 69 lines (56 sloc) 2.215 kb
55048cd @ry Update copyright headers
ry authored
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
30dadfc @pquerna Register builtin extensions via a macro, rather than a manual strcmp
pquerna authored
22
23 #include "node.h"
24 #include "node_version.h"
25 #include <string.h>
13d6a1f @DrPizza Basic VC++ compatibility work.
DrPizza authored
26 #include <stdio.h>
30dadfc @pquerna Register builtin extensions via a macro, rather than a manual strcmp
pquerna authored
27
28 #undef NODE_EXT_LIST_START
29 #undef NODE_EXT_LIST_ITEM
30 #undef NODE_EXT_LIST_END
31
32 #define NODE_EXT_LIST_START
33 #define NODE_EXT_LIST_ITEM NODE_MODULE_DECL
34 #define NODE_EXT_LIST_END
35
36 #include "node_extensions.h"
37
38 #undef NODE_EXT_LIST_START
39 #undef NODE_EXT_LIST_ITEM
40 #undef NODE_EXT_LIST_END
41
42 #define NODE_EXT_STRING(x) &x ## _module,
43 #define NODE_EXT_LIST_START node::node_module_struct *node_module_list[] = {
44 #define NODE_EXT_LIST_ITEM NODE_EXT_STRING
45 #define NODE_EXT_LIST_END NULL};
46
47 #include "node_extensions.h"
48
49 namespace node {
50
51 node_module_struct* get_builtin_module(const char *name)
52 {
53 char buf[128];
54 node_module_struct *cur = NULL;
55 snprintf(buf, sizeof(buf), "node_%s", name);
189dd8f @piscisaureus Fix line endings and trailing whitespace
piscisaureus authored
56 /* TODO: you could look these up in a hash, but there are only
30dadfc @pquerna Register builtin extensions via a macro, rather than a manual strcmp
pquerna authored
57 * a few, and once loaded they are cached. */
58 for (int i = 0; node_module_list[i] != NULL; i++) {
59 cur = node_module_list[i];
60 if (strcmp(cur->modname, buf) == 0) {
61 return cur;
62 }
63 }
64
65 return NULL;
66 }
67
68 }; // namespace node
Something went wrong with that request. Please try again.