]> git.sur5r.net Git - cc65/blob - src/ca65/lineinfo.h
Merge remote-tracking branch 'upstream/master' into a5200
[cc65] / src / ca65 / lineinfo.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                lineinfo.h                                 */
4 /*                                                                           */
5 /*                     Source file line info management                      */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2001-2011, Ullrich von Bassewitz                                      */
10 /*                Roemerstrasse 52                                           */
11 /*                70794 Filderstadt                                          */
12 /* EMail:         uz@cc65.org                                                */
13 /*                                                                           */
14 /*                                                                           */
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.                                    */
18 /*                                                                           */
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:                            */
22 /*                                                                           */
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              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef LINEINFO_H
37 #define LINEINFO_H
38
39
40
41 /* common */
42 #include "coll.h"
43 #include "filepos.h"
44 #include "hashtab.h"
45 #include "lidefs.h"
46
47
48
49 /*****************************************************************************/
50 /*                                   Data                                    */
51 /*****************************************************************************/
52
53
54
55 /* Opaque structure used to handle line information */
56 typedef struct LineInfo LineInfo;
57
58
59
60 /*****************************************************************************/
61 /*                                   Code                                    */
62 /*****************************************************************************/
63
64
65
66 void InitLineInfo (void);
67 /* Initialize the line infos */
68
69 void DoneLineInfo (void);
70 /* Close down line infos */
71
72 void EndLine (LineInfo* LI);
73 /* End a line that is tracked by the given LineInfo structure */
74
75 LineInfo* StartLine (const FilePos* Pos, unsigned Type, unsigned Count);
76 /* Start line info for a new line */
77
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.
82  */
83
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.
87  */
88
89 void ReleaseLineInfo (LineInfo* LI);
90 /* Decrease the reference count for a line info */
91
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.
96  */
97
98 void ReleaseFullLineInfo (Collection* LineInfos);
99 /* Decrease the reference count for a collection full of LineInfos, then clear
100  * the collection.
101  */
102
103 const FilePos* GetSourcePos (const LineInfo* LI);
104 /* Return the source file position from the given line info */
105
106 unsigned GetLineInfoType (const LineInfo* LI);
107 /* Return the type of a line info */
108
109 void WriteLineInfo (const Collection* LineInfos);
110 /* Write a list of line infos to the object file. */
111
112 void WriteLineInfos (void);
113 /* Write a list of all line infos to the object file. */
114
115
116
117 /* End of lineinfo.h */
118
119 #endif