]> git.sur5r.net Git - cc65/blobdiff - src/cc65/macrotab.h
Fixed two compiler warnings.
[cc65] / src / cc65 / macrotab.h
index 0a699bbfcbb57642c7e57f0efbb12d2942a03c36..91142e8720daa60f9c261a83fd05e7cdd776beeb 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000     Ullrich von Bassewitz                                        */
-/*              Wacholderweg 14                                              */
-/*              D-70597 Stuttgart                                            */
-/* EMail:       uz@musoftware.de                                             */
+/* (C) 2000-2005, Ullrich von Bassewitz                                      */
+/*                Römerstraße 52                                             */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 
 
 
+/* common */
+#include "coll.h"
+#include "inline.h"
+#include "strbuf.h"
+
+
+
 /*****************************************************************************/
-/*                                  data                                    */
+/*                                  data                                    */
 /*****************************************************************************/
 
 
 
+/* Structure describing a macro */
 typedef struct Macro Macro;
 struct Macro {
-    Macro*      Next;          /* Next macro with same hash value */
-    int                 ArgCount;      /* Number of parameters, -1 = no parens */
-    unsigned    MaxArgs;       /* Size of formal argument list */
-    char**              FormalArgs;    /* Formal argument list */
-    char const** ActualArgs;   /* Actual argument list */
-    char*               Replacement;   /* Replacement text */
-    char        Name[1];       /* Name, dynamically allocated */
+    Macro*       Next;         /* Next macro with same hash value */
+    int           Expanding;    /* Are we currently expanding this macro? */
+    int                  ArgCount;     /* Number of parameters, -1 = no parens */
+    unsigned     MaxArgs;      /* Size of formal argument list */
+    Collection    FormalArgs;  /* Formal argument list (char*) */
+    StrBuf        Replacement;  /* Replacement text */
+    unsigned char Variadic;     /* C99 variadic macro */
+    char         Name[1];      /* Name, dynamically allocated */
 };
 
 
 
 /*****************************************************************************/
-/*                                  code                                    */
+/*                                  Code                                    */
 /*****************************************************************************/
 
 
@@ -80,9 +89,7 @@ void DefineTextMacro (const char* Name, const char* Val);
 /* Define a macro for a textual constant */
 
 void InsertMacro (Macro* M);
-/* Insert the given macro into the macro table. This call will also allocate
- * the ActualArgs parameter array.
- */
+/* Insert the given macro into the macro table. */
 
 int UndefineMacro (const char* Name);
 /* Search for the macro with the given name and remove it from the macro
@@ -93,17 +100,19 @@ int UndefineMacro (const char* Name);
 Macro* FindMacro (const char* Name);
 /* Find a macro with the given name. Return the macro definition or NULL */
 
-int IsMacro (const char* Name);
+#if defined(HAVE_INLINE)
+INLINE int IsMacro (const char* Name)
 /* Return true if the given name is the name of a macro, return false otherwise */
+{
+    return FindMacro (Name) != 0;
+}
+#else
+#  define IsMacro(Name)         (FindMacro (Name) != 0)
+#endif
 
-int MaybeMacro (unsigned char C);
-/* Return true if the given character may be the start of the name of an
- * existing macro, return false if not.
- */
-
-const char* FindMacroArg (Macro* M, const char* Arg);
-/* Search for a formal macro argument. If found, return the actual
- * (replacement) argument. If the argument was not found, return NULL.
+int FindMacroArg (Macro* M, const char* Arg);
+/* Search for a formal macro argument. If found, return the index of the
+ * argument. If the argument was not found, return -1.
  */
 
 void AddMacroArg (Macro* M, const char* Arg);