Max 5 API Reference
00001 #ifndef __SYMOBJECT_H__ 00002 #define __SYMOBJECT_H__ 00003 00004 #if C74_PRAGMA_STRUCT_PACKPUSH 00005 #pragma pack(push, 2) 00006 #elif C74_PRAGMA_STRUCT_PACK 00007 #pragma pack(2) 00008 #endif 00009 00010 00011 /** The symobject data structure. 00012 @ingroup symobject 00013 */ 00014 typedef struct _symobject{ 00015 t_object obj; ///< Max object header. 00016 t_symbol *sym; ///< The symbol contained by the object. 00017 long flags; ///< Any user-flags you wish to set or get. 00018 void *thing; ///< A generic pointer for attaching additional data to the symobject. 00019 } t_symobject; 00020 00021 00022 #if C74_PRAGMA_STRUCT_PACKPUSH 00023 #pragma pack(pop) 00024 #elif C74_PRAGMA_STRUCT_PACK 00025 #pragma pack() 00026 #endif 00027 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif // __cplusplus 00032 00033 00034 // private 00035 void symobject_initclass(void); 00036 00037 00038 /** The symobject data structure. 00039 00040 @ingroup symobject 00041 @param sym A symbol with which to initialize the new symobject. 00042 @return Pointer to the new symobject instance. 00043 */ 00044 void *symobject_new(t_symbol *sym); 00045 00046 00047 /** Utility for searching a linklist containing symobjects. 00048 00049 @ingroup symobject 00050 @param a (opaque) 00051 @param b (opaque) 00052 @return Returns true if a match is found, otherwise returns false. 00053 00054 @remark The following example shows one common use of the this method. 00055 @code 00056 t_symobject *item = NULL; 00057 long index; 00058 t_symbol *textsym; 00059 00060 textsym = gensym("something to look for"); 00061 00062 // search for a symobject with the symbol 'something to look for' 00063 index = linklist_findfirst(s_ll_history, (void **)&item, symobject_linklist_match, textsym); 00064 if(index == -1){ 00065 // symobject not found. 00066 } 00067 else{ 00068 do something with the symobject, or with the index of the symbobject in the linklist 00069 } 00070 @endcode 00071 00072 */ 00073 long symobject_linklist_match(void *a, void *b); 00074 00075 00076 #ifdef __cplusplus 00077 } 00078 #endif // __cplusplus 00079 00080 #endif // __SYMOBJECT_H__
Copyright © 2008, Cycling '74