]> git.sur5r.net Git - cc65/blobdiff - src/cc65/litpool.h
Fix 32/64-bit int/pointer casts
[cc65] / src / cc65 / litpool.h
index 99fd27bfbe15c0fda7d2ce18a8b8bb6b68a0c5d4..6efdfb089ac685a46a8561f1f26021909d96c484 100644 (file)
@@ -1,15 +1,15 @@
 /*****************************************************************************/
 /*                                                                           */
-/*                                litpool.h                                 */
+/*                                 litpool.h                                 */
 /*                                                                           */
-/*             Literal string handling for the cc65 C compiler              */
+/*              Literal string handling for the cc65 C compiler              */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2001 Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@cc65.org                                                */
+/* (C) 1998-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 
 
 /*****************************************************************************/
-/*                                  Data                                    */
+/*                                   Data                                    */
 /*****************************************************************************/
 
 
 
-extern unsigned LiteralPoolLabel;              /* Pool asm label */
+/* Forward for struct SymEntry */
+struct SymEntry;
+
+/* Forward for a literal */
+typedef struct Literal Literal;
+
+/* Forward for a literal pool */
+typedef struct LiteralPool LiteralPool;
 
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                              struct Literal                               */
 /*****************************************************************************/
 
 
 
-void InitLiteralPool (void);
-/* Initialize the literal pool */
+Literal* UseLiteral (Literal* L);
+/* Increase the reference counter for the literal and return it */
 
-void TranslateLiteralPool (unsigned Offs);
-/* Translate the literals starting from the given offset into the target
- * charset.
- */
+void ReleaseLiteral (Literal* L);
+/* Decrement the reference counter for the literal */
 
-void DumpLiteralPool (void);
-/* Dump the literal pool */
+void TranslateLiteral (Literal* L);
+/* Translate a literal into the target charset. */
 
-unsigned GetLiteralPoolOffs (void);
-/* Return the current offset into the literal pool */
+unsigned GetLiteralLabel (const Literal* L);
+/* Return the asm label for a literal */
 
-void ResetLiteralPoolOffs (unsigned Offs);
-/* Reset the offset into the literal pool to some earlier value, effectively
- * removing values from the pool.
- */
+const char* GetLiteralStr (const Literal* L);
+/* Return the data for a literal as pointer to char */
 
-void AddLiteralChar (char C);
-/* Add one character to the literal pool */
+const StrBuf* GetLiteralStrBuf (const Literal* L);
+/* Return the data for a literal as pointer to the string buffer */
 
-unsigned AddLiteral (const char* S);
-/* Add a literal string to the literal pool. Return the starting offset into
- * the pool for this string.
- */
+unsigned GetLiteralSize (const Literal* L);
+/* Get the size of a literal string */
 
-const char* GetLiteral (unsigned Offs);
-/* Get a pointer to the literal with the given offset in the pool */
 
-void GetLiteralStrBuf (StrBuf* Target, unsigned Offs);
-/* Copy the string starting at Offs and lasting to the end of the buffer
- * into Target.
- */
 
-void PrintLiteralPoolStats (FILE* F);
-/* Print statistics about the literal space used */
+/*****************************************************************************/
+/*                                   Code                                    */
+/*****************************************************************************/
 
 
 
-/* End of litpool.h */
-#endif
+void InitLiteralPool (void);
+/* Initialize the literal pool */
 
+void PushLiteralPool (struct SymEntry* Func);
+/* Push the current literal pool onto the stack and create a new one */
 
+LiteralPool* PopLiteralPool (void);
+/* Pop the last literal pool from TOS and activate it. Return the old
+** literal pool.
+*/
 
+void MoveLiteralPool (LiteralPool* LocalPool);
+/* Move all referenced literals in LocalPool to the global literal pool. This
+** function will free LocalPool after moving the used string literals.
+*/
 
+void OutputLiteralPool (void);
+/* Output the literal pool */
+
+Literal* AddLiteral (const char* S);
+/* Add a literal string to the literal pool. Return the literal. */
+
+Literal* AddLiteralBuf (const void* Buf, unsigned Len);
+/* Add a buffer containing a literal string to the literal pool. Return the
+** literal.
+*/
+
+Literal* AddLiteralStr (const StrBuf* S);
+/* Add a literal string to the literal pool. Return the literal. */
+
+
+
+/* End of litpool.h */
+
+#endif