Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
types.h File Reference
#include <gtk/gtk.h>
#include <lautoc.h>
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
+ Include dependency graph for types.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define dt_lua_init_type(L, type_name)   dt_lua_init_type_type(L, luaA_type(L, type_name))
 
#define dt_lua_type_register_const(L, type_name, name)    dt_lua_type_register_const_type(L, luaA_type_find(L, #type_name), name)
 register a read-only member, the member function is popped from the stack
 
#define dt_lua_type_register(L, type_name, name)    dt_lua_type_register_type(L, luaA_type_find(L, #type_name), name)
 register a read-write member, the member function is popped from the stack
 
#define dt_lua_type_register_struct(L, type_name)    dt_lua_type_register_struct_type(L, luaA_type_find(L, #type_name))
 
#define dt_lua_type_register_number(L, type_name)    dt_lua_type_register_number_type(L, luaA_type_find(L, #type_name))
 
#define dt_lua_type_register_number_const(L, type_name)    dt_lua_type_register_number_const_type(L, luaA_type_find(L, #type_name))
 
#define dt_lua_type_register_parent(L, type_name, parent_type_name)    dt_lua_type_register_parent_type(L, luaA_type_find(L, #type_name), luaA_type_find(L, #parent_type_name))
 
#define dt_lua_init_int_type(L, type_name)   dt_lua_init_int_type_type(L, luaA_type(L, type_name))
 
#define dt_lua_init_gpointer_type(L, type_name)   dt_lua_init_gpointer_type_type(L, luaA_type(L, type_name))
 
#define dt_lua_type_gpointer_alias(L, type_name, pointer, alias)    dt_lua_type_gpointer_alias_type(L,luaA_type(L,type_name),pointer,alias)
 
#define dt_lua_isa(L, index, type)   dt_lua_isa_type(L, index, luaA_type(L, type))
 
#define dt_lua_type_setmetafield(L, type_name, name)   dt_lua_type_setmetafield_type(L,luaA_type(L,type_name),name)
 

Typedefs

typedef char * char_20
 
typedef char * char_32
 
typedef char * char_52
 
typedef char * char_64
 
typedef char * char_128
 
typedef char * char_256
 
typedef char * char_512
 
typedef char * char_1024
 
typedef char * char_filename_length
 
typedef char * char_path_length
 
typedef const char * const_string
 
typedef double protected_double
 
typedef double progress_double
 
typedef GtkOrientation dt_lua_orientation_t
 
typedef GtkAlign dt_lua_align_t
 
typedef PangoEllipsizeMode dt_lua_ellipsize_mode_t
 

Functions

luaA_Type dt_lua_init_type_type (lua_State *L, luaA_Type type_id)
 
void dt_lua_type_register_const_type (lua_State *L, luaA_Type type_id, const char *name)
 
void dt_lua_type_register_type (lua_State *L, luaA_Type type_id, const char *name)
 
void dt_lua_type_register_struct_type (lua_State *L, luaA_Type type_id)
 
void dt_lua_type_register_number_type (lua_State *L, luaA_Type type_id)
 
void dt_lua_type_register_number_const_type (lua_State *L, luaA_Type type_id)
 
void dt_lua_type_register_parent_type (lua_State *L, luaA_Type type_id, luaA_Type parent_type_id)
 
int dt_lua_type_member_common (lua_State *L)
 member function for common members. The common member must be the only upvalue of the function
 
int dt_lua_type_member_luaautoc (lua_State *L)
 member function for luaautoc struct, will use luaautoc to push/pull content
 
luaA_Type dt_lua_init_int_type_type (lua_State *L, luaA_Type type_id)
 
luaA_Type dt_lua_init_gpointer_type_type (lua_State *L, luaA_Type type_id)
 
void dt_lua_type_gpointer_alias_type (lua_State *L, luaA_Type type_id, void *pointer, void *alias)
 
void dt_lua_type_gpointer_drop (lua_State *L, void *pointer)
 
luaA_Type dt_lua_init_singleton (lua_State *L, const char *unique_name, void *data)
 
luaA_Type dt_lua_init_wrapped_singleton (lua_State *L, lua_CFunction pusher, lua_CFunction getter, const char *unique_name, void *data)
 
gboolean dt_lua_isa_type (lua_State *L, int index, luaA_Type type_id)
 
gboolean dt_lua_typeisa_type (lua_State *L, luaA_Type obj_type, luaA_Type type_id)
 
void dt_lua_type_setmetafield_type (lua_State *L, luaA_Type type, const char *method_name)
 
int dt_lua_init_early_types (lua_State *L)
 

Macro Definition Documentation

◆ dt_lua_init_gpointer_type

#define dt_lua_init_gpointer_type (   L,
  type_name 
)    dt_lua_init_gpointer_type_type(L, luaA_type(L, type_name))

◆ dt_lua_init_int_type

#define dt_lua_init_int_type (   L,
  type_name 
)    dt_lua_init_int_type_type(L, luaA_type(L, type_name))

similar to dt_lua_init_type but creates a type for int or gpointer singletons the type must match and will guarantee a singleton per value i.e if you push the same int twice, you will push the same lua object not recreate a different one each time the singleton objects will still correctly be garbage collected

◆ dt_lua_init_type

#define dt_lua_init_type (   L,
  type_name 
)    dt_lua_init_type_type(L, luaA_type(L, type_name))

(0,0) register a C type to the dt-lua subsystem

the type can be converted to/from C using the usual luaA functions. the type becomes a full userdata (i.e malloc+memcpy then pushed on the lua stack, released when not referenced in lua) you can use luaL_checkudata to get and check the data from the stack

the following metamethods are defined for the type __luaA_TypeName : string with the associated C type __luaA_Type : int, the associated luaA_Type __pairs : will return (__next,obj,nil) __next : will iteratethrough the __get table of obj __index : will look into the __get table to find a callback, then raise an error __newindex : will look into the __set table to find a callback, then raise an error __get : empty table, contains getters, similar API to __index __set : empty table, contains setters, similar API to __newindex

◆ dt_lua_isa

#define dt_lua_isa (   L,
  index,
  type 
)    dt_lua_isa_type(L, index, luaA_type(L, type))

◆ dt_lua_type_gpointer_alias

#define dt_lua_type_gpointer_alias (   L,
  type_name,
  pointer,
  alias 
)     dt_lua_type_gpointer_alias_type(L,luaA_type(L,type_name),pointer,alias)

make a pointer an alias of another pointer. Both pointers will push the same lua object when pushed on the stack. The object contains the original pointer

◆ dt_lua_type_register

#define dt_lua_type_register (   L,
  type_name,
  name 
)     dt_lua_type_register_type(L, luaA_type_find(L, #type_name), name)

register a read-write member, the member function is popped from the stack

◆ dt_lua_type_register_const

#define dt_lua_type_register_const (   L,
  type_name,
  name 
)     dt_lua_type_register_const_type(L, luaA_type_find(L, #type_name), name)

register a read-only member, the member function is popped from the stack

◆ dt_lua_type_register_number

#define dt_lua_type_register_number (   L,
  type_name 
)     dt_lua_type_register_number_type(L, luaA_type_find(L, #type_name))

◆ dt_lua_type_register_number_const

#define dt_lua_type_register_number_const (   L,
  type_name 
)     dt_lua_type_register_number_const_type(L, luaA_type_find(L, #type_name))

◆ dt_lua_type_register_parent

#define dt_lua_type_register_parent (   L,
  type_name,
  parent_type_name 
)     dt_lua_type_register_parent_type(L, luaA_type_find(L, #type_name), luaA_type_find(L, #parent_type_name))

register a type as a parent type the type will reuse all members and metafiels from the parent (unless it has its own) inheritance will be marked in __luaA_ParentMetatable THIS FUNCTION MUST BE CALLED AFTER PARENT WAS COMPLETELY DEFINED

◆ dt_lua_type_register_struct

#define dt_lua_type_register_struct (   L,
  type_name 
)     dt_lua_type_register_struct_type(L, luaA_type_find(L, #type_name))

register a function for all fields of luaautoc struct, the member function is popped from the stack detects red-only vs read-write automatically

◆ dt_lua_type_setmetafield

#define dt_lua_type_setmetafield (   L,
  type_name,
  name 
)    dt_lua_type_setmetafield_type(L,luaA_type(L,type_name),name)

Typedef Documentation

◆ char_1024

typedef char* char_1024

◆ char_128

typedef char* char_128

◆ char_20

typedef char* char_20

these defines can be used with luaA_struct_member to have checks on read added

◆ char_256

typedef char* char_256

◆ char_32

typedef char* char_32

◆ char_512

typedef char* char_512

◆ char_52

typedef char* char_52

◆ char_64

typedef char* char_64

◆ char_filename_length

typedef char* char_filename_length

◆ char_path_length

typedef char* char_path_length

◆ const_string

typedef const char* const_string

◆ dt_lua_align_t

typedef GtkAlign dt_lua_align_t

◆ dt_lua_ellipsize_mode_t

typedef PangoEllipsizeMode dt_lua_ellipsize_mode_t

◆ dt_lua_orientation_t

typedef GtkOrientation dt_lua_orientation_t

◆ progress_double

◆ protected_double

Function Documentation

◆ dt_lua_init_early_types()

◆ dt_lua_init_gpointer_type_type()

luaA_Type dt_lua_init_gpointer_type_type ( lua_State L,
luaA_Type  type_id 
)

◆ dt_lua_init_int_type_type()

luaA_Type dt_lua_init_int_type_type ( lua_State L,
luaA_Type  type_id 
)

◆ dt_lua_init_singleton()

luaA_Type dt_lua_init_singleton ( lua_State L,
const char *  unique_name,
void data 
)

similar to dt_lua_init_type but creates a singleton type that is : a type who has only one instance (which is a void* pointer) returns the associated luaA_Type so it can be decorated push the single instance of the object on the stack

References init_metatable().

Referenced by dt_lua_init_call(), dt_lua_init_database(), dt_lua_init_film(), dt_lua_init_gui(), dt_lua_init_styles(), dt_lua_init_tags(), dt_lua_init_wrapped_singleton(), dt_lua_module_entry_new_singleton(), and dt_lua_module_new().

◆ dt_lua_init_type_type()

luaA_Type dt_lua_init_type_type ( lua_State L,
luaA_Type  type_id 
)

◆ dt_lua_init_wrapped_singleton()

luaA_Type dt_lua_init_wrapped_singleton ( lua_State L,
lua_CFunction  pusher,
lua_CFunction  getter,
const char *  unique_name,
void data 
)

similar to dt_lua_init_singleton but the singleton has push and pop functions to save/restore the lua object called on

References dt_lua_init_singleton(), wrapped_index(), wrapped_newindex(), wrapped_pairs(), and wrapped_tostring().

Referenced by dt_lua_register_current_preset().

◆ dt_lua_isa_type()

gboolean dt_lua_isa_type ( lua_State L,
int  index,
luaA_Type  type_id 
)

◆ dt_lua_type_gpointer_alias_type()

void dt_lua_type_gpointer_alias_type ( lua_State L,
luaA_Type  type_id,
void pointer,
void alias 
)

Referenced by get_widget_params().

◆ dt_lua_type_gpointer_drop()

void dt_lua_type_gpointer_drop ( lua_State L,
void pointer 
)

drop a gpointer. Pushing the pointer again will create a new object. We can't guarantee when the original object will be GC, but it will point to NULL instead of its normal content. accessing it from the lua side will cause an error luaA_to will also raise an error NOTE : if the object had aliases, the aliases will return NULL too.

Referenced by _guides_draw_callback().

◆ dt_lua_type_member_common()

◆ dt_lua_type_member_luaautoc()

int dt_lua_type_member_luaautoc ( lua_State L)

member function for luaautoc struct, will use luaautoc to push/pull content

Referenced by dt_imageio_load_module_format(), dt_imageio_load_module_storage(), and dt_lua_init_styles().

◆ dt_lua_type_register_const_type()

◆ dt_lua_type_register_number_const_type()

void dt_lua_type_register_number_const_type ( lua_State L,
luaA_Type  type_id 
)

◆ dt_lua_type_register_number_type()

void dt_lua_type_register_number_type ( lua_State L,
luaA_Type  type_id 
)

◆ dt_lua_type_register_parent_type()

◆ dt_lua_type_register_struct_type()

void dt_lua_type_register_struct_type ( lua_State L,
luaA_Type  type_id 
)

◆ dt_lua_type_register_type()

void dt_lua_type_register_type ( lua_State L,
luaA_Type  type_id,
const char *  name 
)

◆ dt_lua_type_setmetafield_type()

void dt_lua_type_setmetafield_type ( lua_State L,
luaA_Type  type,
const char *  method_name 
)

◆ dt_lua_typeisa_type()

gboolean dt_lua_typeisa_type ( lua_State L,
luaA_Type  obj_type,
luaA_Type  type_id 
)