fixes, perl should work correctly now :)

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@982 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-12-09 20:54:47 +00:00 committed by cras
commit 5dcd683324
22 changed files with 407 additions and 415 deletions

View file

@ -1,32 +1,43 @@
#ifndef __PERL_COMMON_H
#define __PERL_COMMON_H
/* helper defines */
#define new_pv(a) \
(newSVpv((a) == NULL ? "" : (a), (a) == NULL ? 0 : strlen(a)))
#define new_bless(obj, stash) \
sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(obj))), stash)
#define push_bless(obj, stash) \
XPUSHs(sv_2mortal(new_bless(obj, stash)))
#define is_hvref(o) \
((o) && SvROK(o) && SvRV(o) && (SvTYPE(SvRV(o)) == SVt_PVHV))
#define hvref(o) \
(is_hvref(o) ? (HV *)SvRV(o) : NULL)
#define push_bless(obj, stash) \
XPUSHs(sv_2mortal(new_bless(obj, stash)))
typedef void (*PERL_OBJECT_FUNC) (HV *hv, void *object);
#define irssi_bless(object) \
((object) == NULL ? &PL_sv_undef : \
irssi_bless_object((object)->type, (object)->chat_type, object))
typedef struct {
char *name;
PERL_OBJECT_FUNC fill_func;
} PLAIN_OBJECT_INIT_REC;
/* returns the package who called us */
char *perl_get_package(void);
SV *irssi_bless_object(int type, int chat_type, void *object);
#define irssi_bless(object) \
((object) == NULL ? &PL_sv_undef : \
irssi_bless_iobject((object)->type, (object)->chat_type, object))
SV *irssi_bless_iobject(int type, int chat_type, void *object);
SV *irssi_bless_plain(const char *stash, void *object);
void *irssi_ref_object(SV *o);
void irssi_add_object(int type, int chat_type, const char *stash);
void irssi_add_object(int type, int chat_type, const char *stash,
PERL_OBJECT_FUNC func);
void irssi_add_plain(const char *stash, PERL_OBJECT_FUNC func);
void irssi_add_plains(PLAIN_OBJECT_INIT_REC *objects);
void perl_common_init(void);
void perl_common_deinit(void);