1/*****************************************************************************/
2/* */
3/* span.h */
4/* */
5/* A span of data within a segment */
6/* */
7/* */
8/* */
9/* (C) 2011, Ullrich von Bassewitz */
10/* Roemerstrasse 52 */
11/* D-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 SPAN_H
37#define SPAN_H
38
39
40
41#include <stdio.h>
42
43/* common */
44#include "coll.h"
45
46
47
48/*****************************************************************************/
49/* Forwards */
50/*****************************************************************************/
51
52
53
54struct ObjData;
55struct Segment;
56
57
58
59/*****************************************************************************/
60/* Data */
61/*****************************************************************************/
62
63
64
65/* Span is an opaque type */
66typedef struct Span Span;
67
68
69
70/*****************************************************************************/
71/* Code */
72/*****************************************************************************/
73
74
75
76Span* ReadSpan (FILE* F, struct ObjData* O, unsigned Id);
77/* Read a Span from a file and return it */
78
79unsigned* ReadSpanList (FILE* F);
80/* Read a list of span ids from a file. The list is returned as an array of
81** unsigneds, the first being the number of spans (never zero) followed by
82** the span ids. If the number of spans is zero, NULL is returned.
83*/
84
85unsigned* DupSpanList (const unsigned* S);
86/* Duplicate a span list */
87
88void FreeSpan (Span* S);
89/* Free a span structure */
90
91unsigned SpanCount (void);
92/* Return the total number of spans */
93
94void PrintDbgSpanList (FILE* F, const struct ObjData* O, const unsigned* List);
95/* Output a string ",span=x[+y...]" for the given list. If the list is empty
96** or NULL, output nothing. This is a helper function for other modules to
97** print a list of spans read by ReadSpanList to the debug info file.
98*/
99
100void PrintDbgSpans (FILE* F);
101/* Output the spans to a debug info file */
102
103
104
105/* End of span.h */
106
107#endif
108