#ifndef _MLP_PRIV_H_ #define _MLP_PRIV_H_ #include "../../config.h" #include "mlp.h" #define MLP_MAX_DEBUG_MSG_LENGTH 1024 #define MLP_MAX_ERROR_MSG_LENGTH 1024 #define MLP_MALLOC(t) ((t *)malloc(sizeof(t))) #define MLP_MALLOC_N(t, n) ((t *)malloc((n) * sizeof(t))) #define MLP_CALLOC(t) ((t *)calloc(sizeof(t), 1)) #define MLP_CALLOC_N(t, n) ((t *)calloc(sizeof(t), (n))) #define RETURN_NULL_IF_NULL(c) if (c == NULL){return NULL ;} /* * The head directory where langauge plugins can look for there helper code * in there own language plugin language. */ #define MLP_LANGUAGE_DIR "/usr/lib/mlp" struct _mlp_interface ; typedef struct _mlp_interface mlp_interface ; const mlp_interface *mlp_language_get_iface(const mlp_language *lang) ; /* MLP context */ struct _mlp_context { mlp_error error ; char *error_msg ; } ; /* MLP value: A value can be passed as a function argument or returned by a function */ struct _mlp_value { mlp_type type ; union { char c ; long l ; double d ; char *s ; mlp_object *o ; mlp_exception *e ; } v ; /* int thrown ; */ char *stringy ; } ; /* MLP language */ struct _mlp_language { char *name ; char *dir ; void *handle ; mlp_interface *iface ; } ; /* A runtime */ struct _mlp_runtime { mlp_language *language ; void *handle ; } ; /* An object */ struct _mlp_object { mlp_runtime *runtime ; char *class ; void *handle ; char *stringy ; } ; /* An array */ struct _mlp_array { mlp_runtime *runtime ; mlp_type type ; int size ; void *handle ; char *stringy ; } ; /* An exception */ struct _mlp_exception { mlp_runtime *runtime ; char *message ; mlp_value *value ; char *stringy ; } ; #include "mlp_iface.h" mlp_object *mlp_object_alloc(mlp_runtime *rt, const char *class, void *object) ; mlp_exception *mlp_exception_alloc(mlp_runtime *rt, const char *msg, mlp_value *value) ; #endif