node-addon-layer
C API For writing Node modules
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Core types and helpers

Data Structures

struct  shim_module_struct
 Used by node to identify how to initialize this module. More...
 
struct  shim_fspec_s
 

Macros

#define SHIM_ABI_VERSION   1
 
#define SHIM_MODULE(name, func)
 
#define SHIM_FS_FULL(name, cfunc, nargs, data, flags)   { name, &cfunc, nargs, data, flags, 0 }
 
#define SHIM_FS_DEF(cfunc, nargs, data)   SHIM_FS_FULL(#cfunc, cfunc, nargs, data, 0)
 
#define SHIM_FS(cfunc)   SHIM_FS_DEF(cfunc, 0, NULL)
 
#define SHIM_FS_END   { NULL, NULL, 0, NULL, 0, 0 }
 

Typedefs

typedef enum shim_type shim_type_t
 
typedef struct shim_val_s shim_val_t
 
typedef struct shim_ctx_s shim_ctx_t
 
typedef struct shim_args_s shim_args_t
 
typedef int shim_bool_t
 
typedef void(* node_register_func )(void *, void *)
 
typedef int(* register_func )(shim_ctx_t *, shim_val_t *, shim_val_t *)
 
typedef int(* shim_func )(shim_ctx_t *, shim_args_t *)
 
typedef struct shim_fspec_s shim_fspec_t
 

Enumerations

enum  shim_type {
  SHIM_TYPE_UNKNOWN = 0, SHIM_TYPE_UNDEFINED, SHIM_TYPE_NULL, SHIM_TYPE_BOOL,
  SHIM_TYPE_DATE, SHIM_TYPE_ARRAY, SHIM_TYPE_OBJECT, SHIM_TYPE_INTEGER,
  SHIM_TYPE_INT32, SHIM_TYPE_UINT32, SHIM_TYPE_NUMBER, SHIM_TYPE_EXTERNAL,
  SHIM_TYPE_FUNCTION, SHIM_TYPE_STRING
}
 

Functions

void shim_module_initialize (void *, void *)
 

Variables

register_func shim_initialize
 

Detailed Description

Macro Definition Documentation

#define SHIM_ABI_VERSION   1

The ABI version of the addon layer

#define SHIM_FS (   cfunc)    SHIM_FS_DEF(cfunc, 0, NULL)

Define just the function

#define SHIM_FS_DEF (   cfunc,
  nargs,
  data 
)    SHIM_FS_FULL(#cfunc, cfunc, nargs, data, 0)

Define only the function, args, and data

#define SHIM_FS_END   { NULL, NULL, 0, NULL, 0, 0 }

Sentinel that indicates we're done defining functions

#define SHIM_FS_FULL (   name,
  cfunc,
  nargs,
  data,
  flags 
)    { name, &cfunc, nargs, data, flags, 0 }

Define the all the properties fo the function

#define SHIM_MODULE (   name,
  func 
)
Value:
struct shim_module_struct name ## _module = { \
NODE_MODULE_VERSION, \
NULL, \
__FILE__, \
#name, \
};

Use this to define the name and func entry point of your module

Typedef Documentation

typedef void(* node_register_func)(void *, void *)

Entry point from node to register the addon layer

typedef int(* register_func)(shim_ctx_t *, shim_val_t *, shim_val_t *)

Signature of for how a module will be initialized

typedef struct shim_args_s shim_args_t

The opaque handle that represents the arguments passed to this function

typedef int shim_bool_t

A wrapper for TRUE and FALSE that is merely an int

typedef struct shim_ctx_s shim_ctx_t

The opaque handle that represents the currently executing context

typedef struct shim_fspec_s shim_fspec_t

Describes a function signature

See Also
shim_obj_set_funcs()
typedef int(* shim_func)(shim_ctx_t *, shim_args_t *)

The signature of the entry point for exported functions

typedef enum shim_type shim_type_t

Defines the types natively supported by the addon layer

typedef struct shim_val_s shim_val_t

The opaque handle that represents a javascript value

You should use shim_value_release

Enumeration Type Documentation

enum shim_type

Defines the types natively supported by the addon layer

Enumerator
SHIM_TYPE_UNKNOWN 

Unknown type

SHIM_TYPE_UNDEFINED 

v8:Undefined

SHIM_TYPE_NULL 

v8::Null

SHIM_TYPE_BOOL 

true or false

SHIM_TYPE_DATE 

v8::Date object

SHIM_TYPE_ARRAY 

v8::Array object

SHIM_TYPE_OBJECT 

v8::Object

SHIM_TYPE_INTEGER 

v8::Integer

SHIM_TYPE_INT32 

v8::Integer::Int32

SHIM_TYPE_UINT32 

v8::Integer::Uint32

SHIM_TYPE_NUMBER 

v8::Number

SHIM_TYPE_EXTERNAL 

v8::External

SHIM_TYPE_FUNCTION 

v8::Function

SHIM_TYPE_STRING 

v8::String

Function Documentation

void shim_module_initialize ( void *  ,
void *   
)

The declaration of the addon layer entry point

Variable Documentation

register_func shim_initialize

Location of your entry point