diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/extra/m_pd.h')
-rw-r--r-- | apps/plugins/pdbox/PDa/extra/m_pd.h | 649 |
1 files changed, 0 insertions, 649 deletions
diff --git a/apps/plugins/pdbox/PDa/extra/m_pd.h b/apps/plugins/pdbox/PDa/extra/m_pd.h index 403c5b382b..f08fdccf93 100644 --- a/apps/plugins/pdbox/PDa/extra/m_pd.h +++ b/apps/plugins/pdbox/PDa/extra/m_pd.h | |||
@@ -648,653 +648,4 @@ defined, there is a "te_xpix" field in objects, not a "te_xpos" as before: */ | |||
648 | 648 | ||
649 | #define __m_pd_h_ | 649 | #define __m_pd_h_ |
650 | #endif /* __m_pd_h_ */ | 650 | #endif /* __m_pd_h_ */ |
651 | /* Copyright (c) 1997-1999 Miller Puckette. | ||
652 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL | ||
653 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ | ||
654 | |||
655 | #ifndef __m_pd_h_ | ||
656 | |||
657 | #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) | ||
658 | extern "C" { | ||
659 | #endif | ||
660 | |||
661 | #define PD_VERSION 0.37 /* oops, don't use this... */ */ | ||
662 | #define PD_MAJOR_VERSION 0 /* ... use these two instead. */ | ||
663 | #define PD_MINOR_VERSION 37 | ||
664 | |||
665 | /* old name for "MSW" flag -- we have to take it for the sake of many old | ||
666 | "nmakefiles" for externs, which will define NT and not MSW */ | ||
667 | #if defined(NT) && !defined(MSW) | ||
668 | #define MSW | ||
669 | #endif | ||
670 | |||
671 | #ifdef MSW | ||
672 | // #pragma warning( disable : 4091 ) | ||
673 | #pragma warning( disable : 4305 ) /* uncast const double to float */ | ||
674 | #pragma warning( disable : 4244 ) /* uncast float/int conversion etc. */ | ||
675 | #pragma warning( disable : 4101 ) /* unused automatic variables */ | ||
676 | #endif /* MSW */ | ||
677 | |||
678 | /* the external storage class is "extern" in UNIX; in MSW it's ugly. */ | ||
679 | #ifdef MSW | ||
680 | #ifdef PD_INTERNAL | ||
681 | #define EXTERN __declspec(dllexport) extern | ||
682 | #else | ||
683 | #define EXTERN __declspec(dllimport) extern | ||
684 | #endif /* PD_INTERNAL */ | ||
685 | #else | ||
686 | #define EXTERN extern | ||
687 | #endif /* MSW */ | ||
688 | |||
689 | /* and depending on the compiler, hidden data structures are | ||
690 | declared differently: */ | ||
691 | #if defined( __GNUC__) || defined( __BORLANDC__ ) || defined( __MWERKS__ ) | ||
692 | #define EXTERN_STRUCT struct | ||
693 | #else | ||
694 | #define EXTERN_STRUCT extern struct | ||
695 | #endif | ||
696 | |||
697 | |||
698 | #if !defined(_SIZE_T) && !defined(_SIZE_T_) | ||
699 | #include <stddef.h> /* just for size_t -- how lame! */ | ||
700 | #endif | ||
701 | |||
702 | #define MAXPDSTRING 1000 /* use this for anything you want */ | ||
703 | #define MAXPDARG 5 /* max number of args we can typecheck today */ | ||
704 | |||
705 | /* signed and unsigned integer types the size of a pointer: */ | ||
706 | #ifdef __alpha__ | ||
707 | typedef long t_int; | ||
708 | #else | ||
709 | typedef int t_int; | ||
710 | #endif | ||
711 | |||
712 | typedef float t_float; /* a floating-point number at most the same size */ | ||
713 | typedef float t_floatarg; /* floating-point type for function calls */ | ||
714 | |||
715 | typedef struct _symbol | ||
716 | { | ||
717 | char *s_name; | ||
718 | struct _class **s_thing; | ||
719 | struct _symbol *s_next; | ||
720 | } t_symbol; | ||
721 | |||
722 | EXTERN_STRUCT _array; | ||
723 | #define t_array struct _array /* g_canvas.h */ | ||
724 | |||
725 | /* pointers to glist and array elements go through a "stub" which sticks | ||
726 | around after the glist or array is freed. The stub itself is deleted when | ||
727 | both the glist/array is gone and the refcount is zero, ensuring that no | ||
728 | gpointers are pointing here. */ | ||
729 | |||
730 | #define GP_NONE 0 /* the stub points nowhere (has been cut off) */ | ||
731 | #define GP_GLIST 1 /* the stub points to a glist element */ | ||
732 | #define GP_ARRAY 2 /* ... or array */ | ||
733 | 651 | ||
734 | typedef struct _gstub | ||
735 | { | ||
736 | union | ||
737 | { | ||
738 | struct _glist *gs_glist; /* glist we're in */ | ||
739 | struct _array *gs_array; /* array we're in */ | ||
740 | } gs_un; | ||
741 | int gs_which; /* GP_GLIST/GP_ARRAY */ | ||
742 | int gs_refcount; /* number of gpointers pointing here */ | ||
743 | } t_gstub; | ||
744 | |||
745 | typedef struct _gpointer /* pointer to a gobj in a glist */ | ||
746 | { | ||
747 | union | ||
748 | { | ||
749 | struct _scalar *gp_scalar; /* scalar we're in (if glist) */ | ||
750 | union word *gp_w; /* raw data (if array) */ | ||
751 | } gp_un; | ||
752 | int gp_valid; /* number which must match gpointee */ | ||
753 | t_gstub *gp_stub; /* stub which points to glist/array */ | ||
754 | } t_gpointer; | ||
755 | |||
756 | typedef union word | ||
757 | { | ||
758 | t_float w_float; | ||
759 | t_symbol *w_symbol; | ||
760 | t_gpointer *w_gpointer; | ||
761 | t_array *w_array; | ||
762 | struct _glist *w_list; | ||
763 | int w_index; | ||
764 | } t_word; | ||
765 | |||
766 | typedef enum | ||
767 | { | ||
768 | A_NULL, | ||
769 | A_FLOAT, | ||
770 | A_SYMBOL, | ||
771 | A_POINTER, | ||
772 | A_SEMI, | ||
773 | A_COMMA, | ||
774 | A_DEFFLOAT, | ||
775 | A_DEFSYM, | ||
776 | A_DOLLAR, | ||
777 | A_DOLLSYM, | ||
778 | A_GIMME, | ||
779 | A_CANT | ||
780 | } t_atomtype; | ||
781 | |||
782 | #define A_DEFSYMBOL A_DEFSYM /* better name for this */ | ||
783 | |||
784 | typedef struct _atom | ||
785 | { | ||
786 | t_atomtype a_type; | ||
787 | union word a_w; | ||
788 | } t_atom; | ||
789 | |||
790 | EXTERN_STRUCT _class; | ||
791 | #define t_class struct _class | ||
792 | |||
793 | EXTERN_STRUCT _outlet; | ||
794 | #define t_outlet struct _outlet | ||
795 | |||
796 | EXTERN_STRUCT _inlet; | ||
797 | #define t_inlet struct _inlet | ||
798 | |||
799 | EXTERN_STRUCT _binbuf; | ||
800 | #define t_binbuf struct _binbuf | ||
801 | |||
802 | EXTERN_STRUCT _clock; | ||
803 | #define t_clock struct _clock | ||
804 | |||
805 | EXTERN_STRUCT _outconnect; | ||
806 | #define t_outconnect struct _outconnect | ||
807 | |||
808 | EXTERN_STRUCT _glist; | ||
809 | #define t_glist struct _glist | ||
810 | #define t_canvas struct _glist /* LATER lose this */ | ||
811 | |||
812 | typedef t_class *t_pd; /* pure datum: nothing but a class pointer */ | ||
813 | |||
814 | typedef struct _gobj /* a graphical object */ | ||
815 | { | ||
816 | t_pd g_pd; /* pure datum header (class) */ | ||
817 | struct _gobj *g_next; /* next in list */ | ||
818 | } t_gobj; | ||
819 | |||
820 | typedef struct _scalar /* a graphical object holding data */ | ||
821 | { | ||
822 | t_gobj sc_gobj; /* header for graphical object */ | ||
823 | t_symbol *sc_template; /* template name (LATER replace with pointer) */ | ||
824 | t_word sc_vec[1]; /* indeterminate-length array of words */ | ||
825 | } t_scalar; | ||
826 | |||
827 | typedef struct _text /* patchable object - graphical, with text */ | ||
828 | { | ||
829 | t_gobj te_g; /* header for graphical object */ | ||
830 | t_binbuf *te_binbuf; /* holder for the text */ | ||
831 | t_outlet *te_outlet; /* linked list of outlets */ | ||
832 | t_inlet *te_inlet; /* linked list of inlets */ | ||
833 | short te_xpix; /* x&y location (within the toplevel) */ | ||
834 | short te_ypix; | ||
835 | short te_width; /* requested width in chars, 0 if auto */ | ||
836 | unsigned int te_type:2; /* from defs below */ | ||
837 | } t_text; | ||
838 | |||
839 | #define T_TEXT 0 /* just a textual comment */ | ||
840 | #define T_OBJECT 1 /* a MAX style patchable object */ | ||
841 | #define T_MESSAGE 2 /* a MAX stype message */ | ||
842 | #define T_ATOM 3 /* a cell to display a number or symbol */ | ||
843 | |||
844 | #define te_pd te_g.g_pd | ||
845 | |||
846 | /* t_object is synonym for t_text (LATER unify them) */ | ||
847 | |||
848 | typedef struct _text t_object; | ||
849 | |||
850 | #define ob_outlet te_outlet | ||
851 | #define ob_inlet te_inlet | ||
852 | #define ob_binbuf te_binbuf | ||
853 | #define ob_pd te_g.g_pd | ||
854 | #define ob_g te_g | ||
855 | |||
856 | typedef void (*t_method)(void); | ||
857 | typedef void *(*t_newmethod)( void); | ||
858 | typedef void (*t_gotfn)(void *x, ...); | ||
859 | |||
860 | /* ---------------- pre-defined objects and symbols --------------*/ | ||
861 | EXTERN t_pd pd_objectmaker; /* factory for creating "object" boxes */ | ||
862 | EXTERN t_pd pd_canvasmaker; /* factory for creating canvases */ | ||
863 | EXTERN t_symbol s_pointer; | ||
864 | EXTERN t_symbol s_float; | ||
865 | EXTERN t_symbol s_symbol; | ||
866 | EXTERN t_symbol s_bang; | ||
867 | EXTERN t_symbol s_list; | ||
868 | EXTERN t_symbol s_anything; | ||
869 | EXTERN t_symbol s_signal; | ||
870 | EXTERN t_symbol s__N; | ||
871 | EXTERN t_symbol s__X; | ||
872 | EXTERN t_symbol s_x; | ||
873 | EXTERN t_symbol s_y; | ||
874 | EXTERN t_symbol s_; | ||
875 | |||
876 | /* --------- prototypes from the central message system ----------- */ | ||
877 | EXTERN void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv); | ||
878 | EXTERN void pd_forwardmess(t_pd *x, int argc, t_atom *argv); | ||
879 | EXTERN t_symbol *gensym(char *s); | ||
880 | EXTERN t_gotfn getfn(t_pd *x, t_symbol *s); | ||
881 | EXTERN t_gotfn zgetfn(t_pd *x, t_symbol *s); | ||
882 | EXTERN void nullfn(void); | ||
883 | EXTERN void pd_vmess(t_pd *x, t_symbol *s, char *fmt, ...); | ||
884 | #define mess0(x, s) ((*getfn((x), (s)))((x))) | ||
885 | #define mess1(x, s, a) ((*getfn((x), (s)))((x), (a))) | ||
886 | #define mess2(x, s, a,b) ((*getfn((x), (s)))((x), (a),(b))) | ||
887 | #define mess3(x, s, a,b,c) ((*getfn((x), (s)))((x), (a),(b),(c))) | ||
888 | #define mess4(x, s, a,b,c,d) ((*getfn((x), (s)))((x), (a),(b),(c),(d))) | ||
889 | #define mess5(x, s, a,b,c,d,e) ((*getfn((x), (s)))((x), (a),(b),(c),(d),(e))) | ||
890 | EXTERN void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv); | ||
891 | EXTERN t_pd *pd_newest(void); | ||
892 | |||
893 | /* --------------- memory management -------------------- */ | ||
894 | EXTERN void *getbytes(size_t nbytes); | ||
895 | EXTERN void *getzbytes(size_t nbytes); | ||
896 | EXTERN void *copybytes(void *src, size_t nbytes); | ||
897 | EXTERN void freebytes(void *x, size_t nbytes); | ||
898 | EXTERN void *resizebytes(void *x, size_t oldsize, size_t newsize); | ||
899 | |||
900 | /* -------------------- atoms ----------------------------- */ | ||
901 | |||
902 | #define SETSEMI(atom) ((atom)->a_type = A_SEMI, (atom)->a_w.w_index = 0) | ||
903 | #define SETCOMMA(atom) ((atom)->a_type = A_COMMA, (atom)->a_w.w_index = 0) | ||
904 | #define SETPOINTER(atom, gp) ((atom)->a_type = A_POINTER, \ | ||
905 | (atom)->a_w.w_gpointer = (gp)) | ||
906 | #define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f)) | ||
907 | #define SETSYMBOL(atom, s) ((atom)->a_type = A_SYMBOL, \ | ||
908 | (atom)->a_w.w_symbol = (s)) | ||
909 | #define SETDOLLAR(atom, n) ((atom)->a_type = A_DOLLAR, \ | ||
910 | (atom)->a_w.w_index = (n)) | ||
911 | #define SETDOLLSYM(atom, s) ((atom)->a_type = A_DOLLSYM, \ | ||
912 | (atom)->a_w.w_symbol= (s)) | ||
913 | |||
914 | EXTERN t_float atom_getfloat(t_atom *a); | ||
915 | EXTERN t_int atom_getint(t_atom *a); | ||
916 | EXTERN t_symbol *atom_getsymbol(t_atom *a); | ||
917 | EXTERN t_symbol *atom_gensym(t_atom *a); | ||
918 | EXTERN t_float atom_getfloatarg(int which, int argc, t_atom *argv); | ||
919 | EXTERN t_int atom_getintarg(int which, int argc, t_atom *argv); | ||
920 | EXTERN t_symbol *atom_getsymbolarg(int which, int argc, t_atom *argv); | ||
921 | |||
922 | EXTERN void atom_string(t_atom *a, char *buf, unsigned int bufsize); | ||
923 | |||
924 | /* ------------------ binbufs --------------- */ | ||
925 | |||
926 | EXTERN t_binbuf *binbuf_new(void); | ||
927 | EXTERN void binbuf_free(t_binbuf *x); | ||
928 | EXTERN t_binbuf *binbuf_duplicate(t_binbuf *y); | ||
929 | |||
930 | EXTERN void binbuf_text(t_binbuf *x, char *text, size_t size); | ||
931 | EXTERN void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp); | ||
932 | EXTERN void binbuf_clear(t_binbuf *x); | ||
933 | EXTERN void binbuf_add(t_binbuf *x, int argc, t_atom *argv); | ||
934 | EXTERN void binbuf_addv(t_binbuf *x, char *fmt, ...); | ||
935 | EXTERN void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y); | ||
936 | EXTERN void binbuf_addsemi(t_binbuf *x); | ||
937 | EXTERN void binbuf_restore(t_binbuf *x, int argc, t_atom *argv); | ||
938 | EXTERN void binbuf_print(t_binbuf *x); | ||
939 | EXTERN int binbuf_getnatom(t_binbuf *x); | ||
940 | EXTERN t_atom *binbuf_getvec(t_binbuf *x); | ||
941 | EXTERN void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv); | ||
942 | EXTERN int binbuf_read(t_binbuf *b, char *filename, char *dirname, | ||
943 | int crflag); | ||
944 | EXTERN int binbuf_read_via_path(t_binbuf *b, char *filename, char *dirname, | ||
945 | int crflag); | ||
946 | EXTERN int binbuf_write(t_binbuf *x, char *filename, char *dir, | ||
947 | int crflag); | ||
948 | EXTERN void binbuf_evalfile(t_symbol *name, t_symbol *dir); | ||
949 | EXTERN t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, | ||
950 | int tonew); | ||
951 | |||
952 | /* ------------------ clocks --------------- */ | ||
953 | |||
954 | typedef long long t_time; | ||
955 | EXTERN t_clock *clock_new(void *owner, t_method fn); | ||
956 | EXTERN void clock_set(t_clock *x, t_time systime); | ||
957 | EXTERN void clock_delay(t_clock *x, t_time delaytime); | ||
958 | EXTERN void clock_unset(t_clock *x); | ||
959 | EXTERN t_time clock_getlogicaltime(void); | ||
960 | EXTERN t_time clock_getsystime(void); /* OBSOLETE; use clock_getlogicaltime() */ | ||
961 | EXTERN t_time clock_gettimesince(t_time prevsystime); | ||
962 | EXTERN t_time clock_getsystimeafter(t_time delaytime); | ||
963 | EXTERN void clock_free(t_clock *x); | ||
964 | |||
965 | /* ----------------- pure data ---------------- */ | ||
966 | EXTERN t_pd *pd_new(t_class *cls); | ||
967 | EXTERN void pd_free(t_pd *x); | ||
968 | EXTERN void pd_bind(t_pd *x, t_symbol *s); | ||
969 | EXTERN void pd_unbind(t_pd *x, t_symbol *s); | ||
970 | EXTERN t_pd *pd_findbyclass(t_symbol *s, t_class *c); | ||
971 | EXTERN void pd_pushsym(t_pd *x); | ||
972 | EXTERN void pd_popsym(t_pd *x); | ||
973 | EXTERN t_symbol *pd_getfilename(void); | ||
974 | EXTERN t_symbol *pd_getdirname(void); | ||
975 | EXTERN void pd_bang(t_pd *x); | ||
976 | EXTERN void pd_pointer(t_pd *x, t_gpointer *gp); | ||
977 | EXTERN void pd_float(t_pd *x, t_float f); | ||
978 | EXTERN void pd_symbol(t_pd *x, t_symbol *s); | ||
979 | EXTERN void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv); | ||
980 | EXTERN void pd_anything(t_pd *x, t_symbol *s, int argc, t_atom *argv); | ||
981 | #define pd_class(x) (*(x)) | ||
982 | |||
983 | /* ----------------- pointers ---------------- */ | ||
984 | EXTERN void gpointer_init(t_gpointer *gp); | ||
985 | EXTERN void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto); | ||
986 | EXTERN void gpointer_unset(t_gpointer *gp); | ||
987 | EXTERN int gpointer_check(const t_gpointer *gp, int headok); | ||
988 | |||
989 | /* ----------------- patchable "objects" -------------- */ | ||
990 | EXTERN_STRUCT _inlet; | ||
991 | #define t_inlet struct _inlet | ||
992 | EXTERN_STRUCT _outlet; | ||
993 | #define t_outlet struct _outlet | ||
994 | |||
995 | EXTERN t_inlet *inlet_new(t_object *owner, t_pd *dest, t_symbol *s1, | ||
996 | t_symbol *s2); | ||
997 | EXTERN t_inlet *pointerinlet_new(t_object *owner, t_gpointer *gp); | ||
998 | EXTERN t_inlet *floatinlet_new(t_object *owner, t_float *fp); | ||
999 | EXTERN t_inlet *symbolinlet_new(t_object *owner, t_symbol **sp); | ||
1000 | EXTERN void inlet_free(t_inlet *x); | ||
1001 | |||
1002 | EXTERN t_outlet *outlet_new(t_object *owner, t_symbol *s); | ||
1003 | EXTERN void outlet_bang(t_outlet *x); | ||
1004 | EXTERN void outlet_pointer(t_outlet *x, t_gpointer *gp); | ||
1005 | EXTERN void outlet_float(t_outlet *x, t_float f); | ||
1006 | EXTERN void outlet_symbol(t_outlet *x, t_symbol *s); | ||
1007 | EXTERN void outlet_list(t_outlet *x, t_symbol *s, int argc, t_atom *argv); | ||
1008 | EXTERN void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv); | ||
1009 | EXTERN t_symbol *outlet_getsymbol(t_outlet *x); | ||
1010 | EXTERN void outlet_free(t_outlet *x); | ||
1011 | EXTERN t_object *pd_checkobject(t_pd *x); | ||
1012 | |||
1013 | |||
1014 | /* -------------------- canvases -------------- */ | ||
1015 | |||
1016 | EXTERN void glob_setfilename(void *dummy, t_symbol *name, t_symbol *dir); | ||
1017 | |||
1018 | EXTERN void canvas_setargs(int argc, t_atom *argv); | ||
1019 | EXTERN void canvas_getargs(int *argcp, t_atom **argvp); | ||
1020 | EXTERN t_symbol *canvas_getcurrentdir(void); | ||
1021 | EXTERN t_glist *canvas_getcurrent(void); | ||
1022 | EXTERN void canvas_makefilename(t_glist *c, char *file, | ||
1023 | char *result,int resultsize); | ||
1024 | EXTERN t_symbol *canvas_getdir(t_glist *x); | ||
1025 | EXTERN int sys_fontwidth(int fontsize); | ||
1026 | EXTERN int sys_fontheight(int fontsize); | ||
1027 | EXTERN void canvas_dataproperties(t_glist *x, t_scalar *sc, t_binbuf *b); | ||
1028 | |||
1029 | /* ---------------- widget behaviors ---------------------- */ | ||
1030 | |||
1031 | EXTERN_STRUCT _widgetbehavior; | ||
1032 | #define t_widgetbehavior struct _widgetbehavior | ||
1033 | |||
1034 | EXTERN_STRUCT _parentwidgetbehavior; | ||
1035 | #define t_parentwidgetbehavior struct _parentwidgetbehavior | ||
1036 | EXTERN t_parentwidgetbehavior *pd_getparentwidget(t_pd *x); | ||
1037 | |||
1038 | /* -------------------- classes -------------- */ | ||
1039 | |||
1040 | #define CLASS_DEFAULT 0 /* flags for new classes below */ | ||
1041 | #define CLASS_PD 1 | ||
1042 | #define CLASS_GOBJ 2 | ||
1043 | #define CLASS_PATCHABLE 3 | ||
1044 | #define CLASS_NOINLET 8 | ||
1045 | |||
1046 | #define CLASS_TYPEMASK 3 | ||
1047 | |||
1048 | |||
1049 | EXTERN t_class *class_new(t_symbol *name, t_newmethod newmethod, | ||
1050 | t_method freemethod, size_t size, int flags, t_atomtype arg1, ...); | ||
1051 | EXTERN void class_addcreator(t_newmethod newmethod, t_symbol *s, | ||
1052 | t_atomtype type1, ...); | ||
1053 | EXTERN void class_addmethod(t_class *c, t_method fn, t_symbol *sel, | ||
1054 | t_atomtype arg1, ...); | ||
1055 | EXTERN void class_addbang(t_class *c, t_method fn); | ||
1056 | EXTERN void class_addpointer(t_class *c, t_method fn); | ||
1057 | EXTERN void class_doaddfloat(t_class *c, t_method fn); | ||
1058 | EXTERN void class_addsymbol(t_class *c, t_method fn); | ||
1059 | EXTERN void class_addlist(t_class *c, t_method fn); | ||
1060 | EXTERN void class_addanything(t_class *c, t_method fn); | ||
1061 | EXTERN void class_sethelpsymbol(t_class *c, t_symbol *s); | ||
1062 | EXTERN void class_setwidget(t_class *c, t_widgetbehavior *w); | ||
1063 | EXTERN void class_setparentwidget(t_class *c, t_parentwidgetbehavior *w); | ||
1064 | EXTERN t_parentwidgetbehavior *class_parentwidget(t_class *c); | ||
1065 | EXTERN char *class_getname(t_class *c); | ||
1066 | EXTERN char *class_gethelpname(t_class *c); | ||
1067 | EXTERN void class_setdrawcommand(t_class *c); | ||
1068 | EXTERN int class_isdrawcommand(t_class *c); | ||
1069 | EXTERN void class_domainsignalin(t_class *c, int onset); | ||
1070 | #define CLASS_MAINSIGNALIN(c, type, field) \ | ||
1071 | class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0) | ||
1072 | |||
1073 | /* prototype for functions to save Pd's to a binbuf */ | ||
1074 | typedef void (*t_savefn)(t_gobj *x, t_binbuf *b); | ||
1075 | EXTERN void class_setsavefn(t_class *c, t_savefn f); | ||
1076 | EXTERN t_savefn class_getsavefn(t_class *c); | ||
1077 | /* prototype for functions to open properties dialogs */ | ||
1078 | typedef void (*t_propertiesfn)(t_gobj *x, struct _glist *glist); | ||
1079 | EXTERN void class_setpropertiesfn(t_class *c, t_propertiesfn f); | ||
1080 | EXTERN t_propertiesfn class_getpropertiesfn(t_class *c); | ||
1081 | |||
1082 | #ifndef PD_CLASS_DEF | ||
1083 | #define class_addbang(x, y) class_addbang((x), (t_method)(y)) | ||
1084 | #define class_addpointer(x, y) class_addpointer((x), (t_method)(y)) | ||
1085 | #define class_addfloat(x, y) class_doaddfloat((x), (t_method)(y)) | ||
1086 | #define class_addsymbol(x, y) class_addsymbol((x), (t_method)(y)) | ||
1087 | #define class_addlist(x, y) class_addlist((x), (t_method)(y)) | ||
1088 | #define class_addanything(x, y) class_addanything((x), (t_method)(y)) | ||
1089 | #endif | ||
1090 | |||
1091 | /* ------------ printing --------------------------------- */ | ||
1092 | EXTERN void post(char *fmt, ...); | ||
1093 | EXTERN void startpost(char *fmt, ...); | ||
1094 | EXTERN void poststring(char *s); | ||
1095 | EXTERN void postfloat(float f); | ||
1096 | EXTERN void postatom(int argc, t_atom *argv); | ||
1097 | EXTERN void endpost(void); | ||
1098 | EXTERN void error(char *fmt, ...); | ||
1099 | EXTERN void bug(char *fmt, ...); | ||
1100 | EXTERN void pd_error(void *object, char *fmt, ...); | ||
1101 | EXTERN void sys_logerror(char *object, char *s); | ||
1102 | EXTERN void sys_unixerror(char *object); | ||
1103 | EXTERN void sys_ouch(void); | ||
1104 | |||
1105 | #ifdef __linux__ | ||
1106 | EXTERN char* sys_get_path( void); | ||
1107 | #endif | ||
1108 | EXTERN void sys_addpath(const char* p); | ||
1109 | |||
1110 | |||
1111 | /* ------------ system interface routines ------------------- */ | ||
1112 | EXTERN int sys_isreadablefile(const char *name); | ||
1113 | EXTERN void sys_bashfilename(const char *from, char *to); | ||
1114 | EXTERN void sys_unbashfilename(const char *from, char *to); | ||
1115 | EXTERN int open_via_path(const char *name, const char *ext, const char *dir, | ||
1116 | char *dirresult, char **nameresult, unsigned int size, int bin); | ||
1117 | EXTERN int sched_geteventno(void); | ||
1118 | EXTERN double sys_getrealtime(void); | ||
1119 | |||
1120 | |||
1121 | /* ------------ threading ------------------- */ | ||
1122 | /* T.Grill - see m_sched.c */ | ||
1123 | |||
1124 | EXTERN void sys_lock(void); | ||
1125 | EXTERN void sys_unlock(void); | ||
1126 | EXTERN int sys_trylock(void); | ||
1127 | |||
1128 | |||
1129 | /* --------------- signals ----------------------------------- */ | ||
1130 | |||
1131 | #define MAXLOGSIG 32 | ||
1132 | #define MAXSIGSIZE (1 << MAXLOGSIG) | ||
1133 | #ifndef FIXEDPOINT | ||
1134 | typedef float t_sample; | ||
1135 | #else | ||
1136 | #include "m_fixed.h" | ||
1137 | #endif | ||
1138 | |||
1139 | |||
1140 | typedef struct _signal | ||
1141 | { | ||
1142 | int s_n; /* number of points in the array */ | ||
1143 | t_sample *s_vec; /* the array */ | ||
1144 | float s_sr; /* sample rate */ | ||
1145 | int s_refcount; /* number of times used */ | ||
1146 | int s_isborrowed; /* whether we're going to borrow our array */ | ||
1147 | struct _signal *s_borrowedfrom; /* signal to borrow it from */ | ||
1148 | struct _signal *s_nextfree; /* next in freelist */ | ||
1149 | struct _signal *s_nextused; /* next in used list */ | ||
1150 | } t_signal; | ||
1151 | |||
1152 | |||
1153 | typedef t_int *(*t_perfroutine)(t_int *args); | ||
1154 | |||
1155 | EXTERN t_int *plus_perform(t_int *args); | ||
1156 | EXTERN t_int *zero_perform(t_int *args); | ||
1157 | EXTERN t_int *copy_perform(t_int *args); | ||
1158 | |||
1159 | EXTERN void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n); | ||
1160 | EXTERN void dsp_add_copy(t_sample *in, t_sample *out, int n); | ||
1161 | EXTERN void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n); | ||
1162 | EXTERN void dsp_add_zero(t_sample *out, int n); | ||
1163 | |||
1164 | EXTERN int sys_getblksize(void); | ||
1165 | EXTERN float sys_getsr(void); | ||
1166 | EXTERN int sys_get_inchannels(void); | ||
1167 | EXTERN int sys_get_outchannels(void); | ||
1168 | |||
1169 | EXTERN void dsp_add(t_perfroutine f, int n, ...); | ||
1170 | EXTERN void dsp_addv(t_perfroutine f, int n, t_int *vec); | ||
1171 | EXTERN void pd_fft(float *buf, int npoints, int inverse); | ||
1172 | EXTERN int ilog2(int n); | ||
1173 | |||
1174 | EXTERN void mayer_fht(t_sample *fz, int n); | ||
1175 | EXTERN void mayer_fft(int n, t_sample *real, t_sample *imag); | ||
1176 | EXTERN void mayer_ifft(int n, t_sample *real, t_sample *imag); | ||
1177 | EXTERN void mayer_realfft(int n, t_sample *real); | ||
1178 | EXTERN void mayer_realifft(int n, t_sample *real); | ||
1179 | |||
1180 | EXTERN t_sample *cos_table; | ||
1181 | |||
1182 | #define LOGCOSTABSIZE 9 | ||
1183 | #define COSTABSIZE (1<<LOGCOSTABSIZE) | ||
1184 | |||
1185 | EXTERN int canvas_suspend_dsp(void); | ||
1186 | EXTERN void canvas_resume_dsp(int oldstate); | ||
1187 | EXTERN void canvas_update_dsp(void); | ||
1188 | |||
1189 | /* IOhannes { (up/downsampling) */ | ||
1190 | typedef struct _resample | ||
1191 | { | ||
1192 | int method; /* up/downsampling method ID */ | ||
1193 | |||
1194 | t_int downsample; /* downsampling factor */ | ||
1195 | t_int upsample; /* upsampling factor */ | ||
1196 | |||
1197 | t_sample *s_vec; /* here we hold the resampled data */ | ||
1198 | int s_n; | ||
1199 | |||
1200 | t_sample *coeffs; /* coefficients for filtering... */ | ||
1201 | int coefsize; | ||
1202 | |||
1203 | t_sample *buffer; /* buffer for filtering */ | ||
1204 | int bufsize; | ||
1205 | } t_resample; | ||
1206 | |||
1207 | EXTERN void resample_init(t_resample *x); | ||
1208 | EXTERN void resample_free(t_resample *x); | ||
1209 | |||
1210 | EXTERN void resample_dsp(t_resample *x, t_sample *in, int insize, t_sample *out, int outsize, int method); | ||
1211 | EXTERN void resamplefrom_dsp(t_resample *x, t_sample *in, int insize, int outsize, int method); | ||
1212 | EXTERN void resampleto_dsp(t_resample *x, t_sample *out, int insize, int outsize, int method); | ||
1213 | /* } IOhannes */ | ||
1214 | |||
1215 | /* ----------------------- utility functions for signals -------------- */ | ||
1216 | EXTERN float mtof(float); | ||
1217 | EXTERN float ftom(float); | ||
1218 | EXTERN float rmstodb(float); | ||
1219 | EXTERN float powtodb(float); | ||
1220 | EXTERN float dbtorms(float); | ||
1221 | EXTERN float dbtopow(float); | ||
1222 | |||
1223 | EXTERN float q8_sqrt(float); | ||
1224 | EXTERN float q8_rsqrt(float); | ||
1225 | #ifndef N32 | ||
1226 | EXTERN float qsqrt(float); /* old names kept for extern compatibility */ | ||
1227 | EXTERN float qrsqrt(float); | ||
1228 | #endif | ||
1229 | /* --------------------- data --------------------------------- */ | ||
1230 | |||
1231 | /* graphical arrays */ | ||
1232 | EXTERN_STRUCT _garray; | ||
1233 | #define t_garray struct _garray | ||
1234 | |||
1235 | EXTERN t_class *garray_class; | ||
1236 | EXTERN int garray_getfloatarray(t_garray *x, int *size, t_sample **vec); | ||
1237 | EXTERN float garray_get(t_garray *x, t_symbol *s, t_int indx); | ||
1238 | EXTERN void garray_redraw(t_garray *x); | ||
1239 | EXTERN int garray_npoints(t_garray *x); | ||
1240 | EXTERN char *garray_vec(t_garray *x); | ||
1241 | EXTERN void garray_resize(t_garray *x, t_floatarg f); | ||
1242 | EXTERN void garray_usedindsp(t_garray *x); | ||
1243 | EXTERN void garray_setsaveit(t_garray *x, int saveit); | ||
1244 | EXTERN t_class *scalar_class; | ||
1245 | |||
1246 | EXTERN t_float *value_get(t_symbol *s); | ||
1247 | EXTERN void value_release(t_symbol *s); | ||
1248 | EXTERN int value_getfloat(t_symbol *s, t_float *f); | ||
1249 | EXTERN int value_setfloat(t_symbol *s, t_float f); | ||
1250 | |||
1251 | /* ------- GUI interface - functions to send strings to TK --------- */ | ||
1252 | EXTERN void sys_vgui(char *fmt, ...); | ||
1253 | EXTERN void sys_gui(char *s); | ||
1254 | |||
1255 | /* dialog window creation and destruction */ | ||
1256 | EXTERN void gfxstub_new(t_pd *owner, void *key, const char *cmd); | ||
1257 | EXTERN void gfxstub_deleteforkey(void *key); | ||
1258 | |||
1259 | extern t_class *glob_pdobject; /* object to send "pd" messages */ | ||
1260 | |||
1261 | /*------------- Max 0.26 compatibility --------------------*/ | ||
1262 | |||
1263 | /* the following reflects the new way classes are laid out, with the class | ||
1264 | pointing to the messlist and not vice versa. Externs shouldn't feel it. */ | ||
1265 | typedef t_class *t_externclass; | ||
1266 | |||
1267 | EXTERN void c_extern(t_externclass *cls, t_newmethod newroutine, | ||
1268 | t_method freeroutine, t_symbol *name, size_t size, int tiny, \ | ||
1269 | t_atomtype arg1, ...); | ||
1270 | EXTERN void c_addmess(t_method fn, t_symbol *sel, t_atomtype arg1, ...); | ||
1271 | |||
1272 | #define t_getbytes getbytes | ||
1273 | #define t_freebytes freebytes | ||
1274 | #define t_resizebytes resizebytes | ||
1275 | #define typedmess pd_typedmess | ||
1276 | #define vmess pd_vmess | ||
1277 | |||
1278 | /* A definition to help gui objects straddle 0.34-0.35 changes. If this is | ||
1279 | defined, there is a "te_xpix" field in objects, not a "te_xpos" as before: */ | ||
1280 | |||
1281 | #define PD_USE_TE_XPIX | ||
1282 | |||
1283 | #if 0 | ||
1284 | /* a test for NANs and denormals. Should only be necessary on i386. */ | ||
1285 | #define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \ | ||
1286 | (((*(unsigned int*)&(f))&0x7f800000)==0x7f800000)) | ||
1287 | /* more stringent test: anything not between 1e-19 and 1e19 in absolute val */ | ||
1288 | #define PD_BIGORSMALL(f) ((((*(unsigned int*)&(f))&0x60000000)==0) || \ | ||
1289 | (((*(unsigned int*)&(f))&0x60000000)==0x60000000)) | ||
1290 | #else | ||
1291 | #define PD_BADFLOAT(f) 0 | ||
1292 | #define PD_BIGORSMALL(f) 0 | ||
1293 | #endif | ||
1294 | |||
1295 | #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) | ||
1296 | } | ||
1297 | #endif | ||
1298 | |||
1299 | #define __m_pd_h_ | ||
1300 | #endif /* __m_pd_h_ */ | ||