w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

data.h File Reference
#include "common.h"
Include dependency graph for data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mrb_data_type
 
struct  RData
 

Macros

#define Data_Wrap_Struct(mrb, klass, type, ptr)    mrb_data_object_alloc(mrb,klass,ptr,type)
 
#define Data_Make_Struct(mrb, klass, strct, type, sval, data_obj)
 
#define RDATA(obj)   ((struct RData *)(mrb_ptr(obj)))
 
#define DATA_PTR(d)   (RDATA(d)->data)
 
#define DATA_TYPE(d)   (RDATA(d)->type)
 
#define DATA_GET_PTR(mrb, obj, dtype, type)   (type*)mrb_data_get_ptr(mrb,obj,dtype)
 
#define DATA_CHECK_GET_PTR(mrb, obj, dtype, type)   (type*)mrb_data_check_get_ptr(mrb,obj,dtype)
 
#define mrb_data_check_and_get(mrb, obj, dtype)   mrb_data_get_ptr(mrb,obj,dtype)
 
#define mrb_get_datatype(mrb, val, type)   mrb_data_get_ptr(mrb, val, type)
 
#define mrb_check_datatype(mrb, val, type)   mrb_data_get_ptr(mrb, val, type)
 
#define Data_Get_Struct(mrb, obj, type, sval)
 

Typedefs

typedef struct mrb_data_type mrb_data_type
 

Functions

struct RDatamrb_data_object_alloc (mrb_state *mrb, struct RClass *klass, void *datap, const mrb_data_type *type)
 
void mrb_data_check_type (mrb_state *mrb, mrb_value, const mrb_data_type *)
 
voidmrb_data_get_ptr (mrb_state *mrb, mrb_value, const mrb_data_type *)
 
voidmrb_data_check_get_ptr (mrb_state *mrb, mrb_value, const mrb_data_type *)
 
static void mrb_data_init (mrb_value v, void *ptr, const mrb_data_type *type)
 

Detailed Description

  • Data class

See Copyright Notice in mruby.h

Definition in file data.h.

Macro Definition Documentation

◆ DATA_CHECK_GET_PTR

#define DATA_CHECK_GET_PTR (   mrb,
  obj,
  dtype,
  type 
)    (type*)mrb_data_check_get_ptr(mrb,obj,dtype)

Definition at line 56 of file data.h.

◆ DATA_GET_PTR

#define DATA_GET_PTR (   mrb,
  obj,
  dtype,
  type 
)    (type*)mrb_data_get_ptr(mrb,obj,dtype)

Definition at line 54 of file data.h.

◆ Data_Get_Struct

#define Data_Get_Struct (   mrb,
  obj,
  type,
  sval 
)
Value:
do {\
*(void**)&sval = mrb_data_get_ptr(mrb, obj, type); \
} while (0)
#define type(a)
Definition: aptex-macros.h:171
void * mrb_data_get_ptr(mrb_state *mrb, mrb_value, const mrb_data_type *)
Definition: etc.c:58

Definition at line 62 of file data.h.

◆ Data_Make_Struct

#define Data_Make_Struct (   mrb,
  klass,
  strct,
  type,
  sval,
  data_obj 
)
Value:
do { \
(data_obj) = Data_Wrap_Struct(mrb,klass,type,NULL);\
(sval) = (strct *)mrb_malloc(mrb, sizeof(strct)); \
{ static const strct zero = { 0 }; *(sval) = zero; };\
(data_obj)->data = (sval);\
} while (0)
#define Data_Wrap_Struct(mrb, klass, type, ptr)
Definition: data.h:39
struct rect data
Definition: dvipdfm.c:64
#define NULL
Definition: ftobjs.h:61
void * mrb_malloc(mrb_state *, size_t)
Definition: gc.c:256
#define zero
static void strct()

Definition at line 42 of file data.h.

◆ DATA_PTR

#define DATA_PTR (   d)    (RDATA(d)->data)

Definition at line 50 of file data.h.

◆ DATA_TYPE

#define DATA_TYPE (   d)    (RDATA(d)->type)

Definition at line 51 of file data.h.

◆ Data_Wrap_Struct

#define Data_Wrap_Struct (   mrb,
  klass,
  type,
  ptr 
)     mrb_data_object_alloc(mrb,klass,ptr,type)

Definition at line 39 of file data.h.

◆ mrb_check_datatype

#define mrb_check_datatype (   mrb,
  val,
  type 
)    mrb_data_get_ptr(mrb, val, type)

Definition at line 61 of file data.h.

◆ mrb_data_check_and_get

#define mrb_data_check_and_get (   mrb,
  obj,
  dtype 
)    mrb_data_get_ptr(mrb,obj,dtype)

Definition at line 59 of file data.h.

◆ mrb_get_datatype

#define mrb_get_datatype (   mrb,
  val,
  type 
)    mrb_data_get_ptr(mrb, val, type)

Definition at line 60 of file data.h.

◆ RDATA

#define RDATA (   obj)    ((struct RData *)(mrb_ptr(obj)))

Definition at line 49 of file data.h.

Typedef Documentation

◆ mrb_data_type

typedef struct mrb_data_type mrb_data_type

Custom C wrapped data.

Defining Ruby wrappers around native objects. Custom data type description.

Function Documentation

◆ mrb_data_check_get_ptr()

void* mrb_data_check_get_ptr ( mrb_state mrb,
mrb_value  obj,
const mrb_data_type type 
)

Definition at line 46 of file etc.c.

References DATA_PTR, DATA_TYPE, mrb_data_p, NULL, and type.

Referenced by mrb_unpack_backtrace().

◆ mrb_data_check_type()

void mrb_data_check_type ( mrb_state mrb,
mrb_value  obj,
const mrb_data_type type 
)

Definition at line 26 of file etc.c.

References DATA_TYPE, E_TYPE_ERROR, mrb_check_type(), mrb_data_p, mrb_raisef(), MRB_TT_DATA, t2, and type.

Referenced by mrb_data_get_ptr().

◆ mrb_data_get_ptr()

void* mrb_data_get_ptr ( mrb_state mrb,
mrb_value  obj,
const mrb_data_type type 
)

Definition at line 58 of file etc.c.

References DATA_PTR, mrb_data_check_type(), and type.

Referenced by io_get_open_fptr(), mrb_get_args(), mrb_io_closed(), and mrb_stat0().

◆ mrb_data_init()

static void mrb_data_init ( mrb_value  v,
void ptr,
const mrb_data_type type 
)
inlinestatic

Definition at line 67 of file data.h.

References DATA_PTR, DATA_TYPE, mrb_assert, mrb_data_p, ptr, type, and v.

Referenced by mrb_time_initialize(), and mrb_time_initialize_copy().

◆ mrb_data_object_alloc()

struct RData* mrb_data_object_alloc ( mrb_state mrb,
struct RClass klass,
void datap,
const mrb_data_type type 
)

Definition at line 14 of file etc.c.

References data, mrb_obj_alloc(), MRB_TT_DATA, ptr, and type.

Referenced by mrb_io_s_pipe(), mrb_io_s_popen_args(), and packed_backtrace().