]> git.sur5r.net Git - cc65/blobdiff - src/ca65/token.c
Finished implemenation of commands to delete macros. Added the new commands to
[cc65] / src / ca65 / token.c
index 20c0fd9b1ac9a195a102fcc0844d3833097f023c..5fb3d2fc805270640ac9d732dea386e9765c4613 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2007      Ullrich von Bassewitz                                       */
-/*               Roemerstrasse 52                                            */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2007-2011, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -44,7 +44,7 @@
 
 
 
-int TokHasSVal (Token Tok)
+int TokHasSVal (token_t Tok)
 /* Return true if the given token has an attached SVal */
 {
     return (Tok == TOK_IDENT || Tok == TOK_LOCAL_IDENT || Tok == TOK_STRCON);
@@ -52,7 +52,7 @@ int TokHasSVal (Token Tok)
 
 
 
-int TokHasIVal (Token Tok)
+int TokHasIVal (token_t Tok)
 /* Return true if the given token has an attached IVal */
 {
     return (Tok == TOK_INTCON || Tok == TOK_CHARCON || Tok == TOK_REG);
@@ -60,3 +60,18 @@ int TokHasIVal (Token Tok)
 
 
 
+void CopyToken (Token* Dst, const Token* Src)
+/* Copy a token from Src to Dst. The current value of Dst.SVal is free'd,
+ * so Dst must be initialized.
+ */
+{
+    /* Copy the fields */
+    Dst->Tok  = Src->Tok;
+    Dst->WS   = Src->WS;
+    Dst->IVal = Src->IVal;
+    SB_Copy (&Dst->SVal, &Src->SVal);
+    Dst->Pos  = Src->Pos;
+}
+
+
+