home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / MM1 / SOUNDUTILS / mm1_tracker.lzh / TRACKER4.6 / tags.h < prev    next >
Text File  |  1994-11-24  |  1KB  |  60 lines

  1. /* tags.h 
  2.     vi:ts=3 sw=3:
  3.  */
  4.  
  5. #define forever for(;;)
  6.  
  7. /* a tag is a very simple data structure */
  8.  
  9. struct tag
  10.    {
  11.    unsigned long type;
  12.    VALUE data;
  13.    };
  14.  
  15.  
  16. #define TAG_END 0
  17. #define TAG_IGNORE 1    /* ignore this tag */
  18. #define TAG_SKIP 3      /* skip <n> tags in the list */
  19. #define TAG_SUB 2       /* sub to <taglist> */
  20. #define TAG_JUMP 4      /* jump to <taglist> */
  21.  
  22. unsigned long tag_length P((struct tag *t));
  23. struct tag *tags_copy P((struct tag *t));
  24. struct tag *alloc_tags P((unsigned long l));
  25. struct tag *get_tag P((struct tag *t));
  26.  
  27. #ifdef KLUDGE_TAG
  28.  
  29. /* in case the stack is right, we can do this */
  30. #define TAG(function)   \
  31. struct tag *function##taglist(struct tag *list); \
  32. struct tag *function(unsigned long arg1, ...) \
  33.    { \
  34.    return function##taglist(&arg1); \
  35.    }\
  36. struct tag *function##taglist
  37. #else
  38.  
  39. /* in other cases, we have to copy the tags to a taglist... */
  40. #include <stdarg.h>
  41. #define TAG(function)   \
  42. struct tag *function##taglist(struct tag *list); \
  43. struct tag *function(unsigned long type, ...) \
  44.    {  \
  45.    va_list ap; \
  46.    struct tag big[50]; \
  47.    int i = 0; \
  48.    va_start(ap, type); \
  49.    while (type != TAG_END) \
  50.       { \
  51.       big[i].type = type; \
  52.       big[i].data = va_arg(ap, VALUE); \
  53.       i++; \
  54.       type = va_arg(ap, unsigned long); \
  55.       } \
  56.    return function##taglist(big); \
  57.    } \
  58. struct tag *function##taglist
  59. #endif
  60.