node-addon-layer
C API For writing Node modules
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Argument methods

Functions

shim_bool_t shim_unpack_one (shim_ctx_t *ctx, shim_args_t *args, uint32_t idx, shim_type_t type, void *rval)
 
shim_bool_t shim_unpack_type (shim_ctx_t *ctx, shim_val_t *arg, shim_type_t type, void *rval)
 
shim_bool_t shim_unpack (shim_ctx_t *ctx, shim_args_t *args, shim_type_t type,...)
 
int shim_unpack_fmt (shim_ctx_t *ctx, shim_args_t *args, const char *fmt,...)
 
size_t shim_args_length (shim_args_t *args)
 
shim_val_tshim_args_get (shim_args_t *, size_t idx)
 
shim_bool_t shim_args_set_rval (shim_ctx_t *ctx, shim_args_t *args, shim_val_t *val)
 
shim_val_tshim_args_get_this (shim_ctx_t *ctx, shim_args_t *args)
 
void * shim_args_get_data (shim_ctx_t *ctx, shim_args_t *args)
 

Detailed Description

Methods for arguments

Function Documentation

shim_val_t* shim_args_get ( shim_args_t args,
size_t  idx 
)

Get the argument at the given index

Parameters
argsThe arguments passed to the function
idxThe index of the desired argument
Returns
The wrapped argument
void* shim_args_get_data ( shim_ctx_t ctx,
shim_args_t args 
)

Get the arbitrary data associated with this function

Parameters
ctxCurrently executing context
argsThe arguments passed to the function
Returns
Pointer to the arbitrary data associated with the executing function
shim_val_t* shim_args_get_this ( shim_ctx_t ctx,
shim_args_t args 
)

Get the This for the given function

Parameters
ctxCurrently executing context
argsThe arguments passed to the function
Returns
The this associated with the executing function
size_t shim_args_length ( shim_args_t args)

How many arguments were passed to this function

Parameters
argsThe arguments passed to the function
Returns
The amount of arguments passed to the function
shim_bool_t shim_args_set_rval ( shim_ctx_t ctx,
shim_args_t args,
shim_val_t val 
)

Set the return value for this function

Parameters
ctxCurrently executing context
argsThe arguments passed to the function
valThe value to use for return
Returns
TRUE if it was able to set the return value, otherwise FALSE
shim_bool_t shim_unpack ( shim_ctx_t ctx,
shim_args_t args,
shim_type_t  type,
  ... 
)

Unpack the arguments into underlying types

Parameters
ctxCurrently executing context
argsArguments passed to the function
typeThe first type to unpack
Returns
TRUE if all desired arguments were able to be unpacked, otherwise FALSE

Arguments are passed in pairs of shim_type_t and a pointer to their destination, you end the set of pairs by a single SHIM_TYPE_UNKNOWN.

In the event an argument was unable to be unpacked, FALSE is returned and an exception is set.

int shim_unpack_fmt ( shim_ctx_t ctx,
shim_args_t args,
const char *  fmt,
  ... 
)

Unpack the arguments by format

shim_bool_t shim_unpack_one ( shim_ctx_t ctx,
shim_args_t args,
uint32_t  idx,
shim_type_t  type,
void *  rval 
)

Unpack the argument at the given index

Parameters
ctxCurrently executing context
argsArguments passed to the function
idxIndex of the argument to unpack
typeThe destination type
rvalThe pointer to the destination
Returns
TRUE if it was able to unpack, otherwise FALSE
shim_bool_t shim_unpack_type ( shim_ctx_t ctx,
shim_val_t arg,
shim_type_t  type,
void *  rval 
)

Unpack the value to the underlying type

Parameters
ctxCurrently executing context
argGiven wrapped value
typeThe destination type
rvalThe pointer to where the data will be stored
Returns
TRUE if it was able to convert, otherwise FALSE