]> git.sur5r.net Git - cc65/blobdiff - src/cc65/litpool.h
Fixed two compiler warnings.
[cc65] / src / cc65 / litpool.h
index 26f602ca32cbb8910c4938a15733fb8435edee1b..a71c5841447ffe4aa2ce0f1a842e264967ce434d 100644 (file)
 /* 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 PushLiteralPool (struct SymEntry* Func);
-/* Push the current literal pool onto the stack and create a new one */
+void ReleaseLiteral (Literal* L);
+/* Decrement the reference counter for the literal */
 
-void PopLiteralPool (void);
-/* Free the current literal pool and restore the one from TOS */
+void TranslateLiteral (Literal* L);
+/* Translate a literal into the target charset. */
 
-void TranslateLiteralPool (unsigned Offs);
-/* Translate the literals starting from the given offset into the target
- * charset.
- */
+unsigned GetLiteralLabel (const Literal* L);
+/* Return the asm label for a literal */
 
-void DumpLiteralPool (void);
-/* Dump the literal pool */
+const char* GetLiteralStr (const Literal* L);
+/* Return the data for a literal as pointer to char */
 
-unsigned GetLiteralPoolLabel (void);
-/* Return the asm label for the current literal pool */
+const StrBuf* GetLiteralStrBuf (const Literal* L);
+/* Return the data for a literal as pointer to the string buffer */
 
-unsigned GetLiteralPoolOffs (void);
-/* Return the current offset into the literal pool */
+unsigned GetLiteralSize (const Literal* L);
+/* Get the size of a literal string */
 
-void ResetLiteralPoolOffs (unsigned Offs);
-/* Reset the offset into the literal pool to some earlier value, effectively
- * removing values from the pool.
- */
 
-unsigned AddLiteral (const char* S);
-/* Add a literal string to the literal pool. Return the starting offset into
- * the pool for this string.
- */
 
-unsigned AddLiteralBuf (const void* Buf, unsigned Len);
-/* Add a buffer containing a literal string to the literal pool. Return the
- * starting offset into the pool for this string.
+/*****************************************************************************/
+/*                                  Code                                    */
+/*****************************************************************************/
+
+
+
+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.
  */
 
-unsigned AddLiteralStr (const StrBuf* S);
-/* Add a literal string to the literal pool. Return the starting offset into
- * the pool for this string.
+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.
  */
 
-const char* GetLiteral (unsigned Offs);
-/* Get a pointer to the literal with the given offset in the pool */
+void OutputLiteralPool (void);
+/* Output the literal pool */
 
-void GetLiteralStrBuf (StrBuf* Target, unsigned Offs);
-/* Copy the string starting at Offs and lasting to the end of the buffer
- * into Target.
+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.
  */
 
-void PrintLiteralPoolStats (FILE* F);
-/* Print statistics about the literal space used */
+Literal* AddLiteralStr (const StrBuf* S);
+/* Add a literal string to the literal pool. Return the literal. */