home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / editors / mutt / me2s_pl7.zoo / mu_edit2 / mc2 / mc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-26  |  2.8 KB  |  116 lines

  1. /* mc.h : stuff for Mutt compiler
  2.  */
  3.  
  4. /* Craig Durland    Public Domain
  5.  *   Distributed "as is", without warranties of any kind, but comments,
  6.  *     suggestions and bug reports are welcome.
  7.  */
  8.  
  9. #define MAXSTRLEN 255    /* max length of a string (MUST be < RSIZ!) */
  10. #define MAXDIM 2    /* max dimensions for an array */
  11.  
  12. typedef struct
  13. {
  14.   char *name;
  15.   short int token;
  16. } MuttCmd;
  17.  
  18. typedef struct
  19. {
  20.   char *name;        /* of member */
  21.   int offset;        /* from blob base */
  22.   unsigned int type;
  23.   int dims, dim[MAXDIM];    /* if its an array */
  24. } VBlob;
  25.  
  26. typedef struct
  27. {
  28.   char *name;
  29.   short int token;
  30.   unsigned short int class;
  31. } oMuttCmd;
  32.  
  33. #define NIL 0
  34.  
  35.     /*  var types */
  36. #define LOCAL    1
  37. #define GLOBAL    2
  38.  
  39.     /* pgm modifiers */
  40. #define HIDDEN    0x01
  41. #define MAIN    0x02
  42. #define LEAR    0x04
  43.  
  44.     /* additional token classes returned by get_token()
  45.      * these MUST NOT overlap val types (in mm.h)
  46.      */
  47.     /* OR'able values */
  48. #define POINTER       0x0100
  49.     /* Can't OR the following.  Use low byte for value. */
  50. #define MCTYPE       0x4000
  51. #define TOKEN       0x4001
  52. #define DELIMITER  0x4002
  53. #define SEOF       0x4003
  54. #define VAROK       0x4004
  55. #define PUSHEDARGS 0x4005
  56. #define UNKNOWN    0x4006
  57. #define ARRAY       0x4007
  58. #define EMPTY       0x4008
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. #if 0        /* Some interesting macros I don't use anymore */
  66.  
  67. /* ******************************************************************** */
  68. /* ********************* TABLES *************************************** */
  69. /* ******************************************************************** */
  70.  
  71. extern char *malloc(), *realloc();
  72.  
  73. #define DYNO(type,table,n,initial_size,step)            \
  74. {                                \
  75.   static int table_max = 0;                    \
  76.   if (n==table_max)    /* table not big enough */        \
  77.   {                                \
  78.     if (table_max==0)    /* table not allocated yet */        \
  79.     {                                \
  80.       table_max = initial_size;                    \
  81.       if ((table = (type *)malloc(table_max*sizeof(type)))==NULL)    \
  82.     bitch("Can't malloc table");                \
  83.     }                                \
  84.     else    /* table full, make bigger */            \
  85.     {                                \
  86.       table_max += step;                    \
  87.       if ((table = (type *)realloc(                \
  88.     (char *)table,table_max*sizeof(type)))==NULL)        \
  89.         bitch("Can't realloc table");            \
  90.     }                                \
  91.   }                                \
  92. }
  93.  
  94. #define DYNAMO(type,table,n,bump,initial_size,step)        \
  95. {                                \
  96.   static int table_max = 0;                    \
  97.   if (n+bump>=table_max)    /* table not big enough */    \
  98.   {                                \
  99.     if (table_max==0)    /* table not allocated yet */        \
  100.     {                                \
  101.       table_max = initial_size;                    \
  102.       if ((table = (type *)malloc(table_max*sizeof(type)))==NULL)    \
  103.     bitch("Can't malloc table");                \
  104.     }                                \
  105.     else    /* table full, make bigger */            \
  106.     {                                \
  107.       table_max += imax(n+bump-table_max,step);            \
  108.       if ((table = (type *)realloc(                \
  109.     (char *)table,table_max*sizeof(type)))==NULL)        \
  110.         bitch("Can't realloc table");            \
  111.     }                                \
  112.   }                                \
  113. }
  114.  
  115. #endif
  116.