1 /*****************************************************************************/
5 /* Source file line info management */
9 /* (C) 2001-2011, Ullrich von Bassewitz */
10 /* Roemerstrasse 52 */
11 /* 70794 Filderstadt */
12 /* EMail: uz@cc65.org */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
49 /*****************************************************************************/
51 /*****************************************************************************/
55 /* Opaque structure used to handle line information */
56 typedef struct LineInfo LineInfo;
60 /*****************************************************************************/
62 /*****************************************************************************/
66 void InitLineInfo (void);
67 /* Initialize the line infos */
69 void DoneLineInfo (void);
70 /* Close down line infos */
72 void EndLine (LineInfo* LI);
73 /* End a line that is tracked by the given LineInfo structure */
75 LineInfo* StartLine (const FilePos* Pos, unsigned Type, unsigned Count);
76 /* Start line info for a new line */
78 void NewAsmLine (void);
79 /* Start a new assembler input line. Use this function when generating new
80 ** line of LI_TYPE_ASM. It will check if line and/or file have actually
81 ** changed, end the old and start the new line as necessary.
84 LineInfo* GetAsmLineInfo (void);
85 /* Return the line info for the current assembler file. The function will
86 ** bump the reference counter before returning the line info.
89 void ReleaseLineInfo (LineInfo* LI);
90 /* Decrease the reference count for a line info */
92 void GetFullLineInfo (Collection* LineInfos);
93 /* Return full line infos, that is line infos for currently active Slots. The
94 ** infos will be added to the given collection, existing entries will be left
95 ** intact. The reference count of all added entries will be increased.
98 void ReleaseFullLineInfo (Collection* LineInfos);
99 /* Decrease the reference count for a collection full of LineInfos, then clear
103 const FilePos* GetSourcePos (const LineInfo* LI);
104 /* Return the source file position from the given line info */
106 unsigned GetLineInfoType (const LineInfo* LI);
107 /* Return the type of a line info */
109 void WriteLineInfo (const Collection* LineInfos);
110 /* Write a list of line infos to the object file. */
112 void WriteLineInfos (void);
113 /* Write a list of all line infos to the object file. */
117 /* End of lineinfo.h */