From c2014a0a771e621cec552c6ee88daddcb46d13fe Mon Sep 17 00:00:00 2001 From: "N.N." Date: Mon, 21 Nov 2005 22:16:37 +0000 Subject: cyclone alpha55 (see notes.txt for cyclone and shared) svn path=/trunk/externals/miXed/; revision=4011 --- shared/common/messtree.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 shared/common/messtree.h (limited to 'shared/common/messtree.h') diff --git a/shared/common/messtree.h b/shared/common/messtree.h new file mode 100644 index 0000000..a3a3326 --- /dev/null +++ b/shared/common/messtree.h @@ -0,0 +1,47 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __MESSTREE_H__ +#define __MESSTREE_H__ + +typedef int (*t_messcall)(t_pd *, t_symbol *, int, t_atom *); +typedef char *t_messarg; + +typedef struct _messslot +{ + char *ms_name; + t_messcall ms_call; + char *ms_argument; + int ms_flags; + struct _messnode *ms_subnode; +} t_messslot; + +typedef struct _messnode /* a parser's symbol definition, sort of... */ +{ + t_messslot *mn_table; + int mn_nslots; + int mn_index; +} t_messnode; + +EXTERN_STRUCT _messtree; +#define t_messtree struct _messtree + +#define MESSTREE_NSLOTS(slots) (sizeof(slots)/sizeof(*(slots))) + +enum { MESSTREE_OK, /* done current message parsing, parse next */ + MESSTREE_CONTINUE, /* continue current message parsing */ + MESSTREE_UNKNOWN, /* current message unknown, parse next */ + MESSTREE_CORRUPT, /* current message corrupt, parse next */ + MESSTREE_FATAL /* exit parsing */ +}; + +#define MESSTREE_NONEXCLUSIVE 1 + +t_messtree *messtree_new(t_symbol *selector); +void messtree_add(t_messtree *mt, t_messnode *rootnode); +t_messtree *messtree_build(t_messslot *rootslot); +int messtree_doit(t_messtree *mt, t_messslot **msp, int *nargp, + t_pd *target, t_symbol *s, int ac, t_atom *av); + +#endif -- cgit v1.2.1