+/*****************************************************************************/
+/* Scopes */
+/*****************************************************************************/
+
+
+
+/* Scope information */
+typedef enum {
+ CC65_SCOPE_GLOBAL, /* Global scope */
+ CC65_SCOPE_MODULE, /* Module scope */
+ CC65_SCOPE_SCOPE, /* .PROC/.SCOPE */
+ CC65_SCOPE_STRUCT, /* .STRUCT */
+ CC65_SCOPE_ENUM, /* .ENUM */
+} cc65_scope_type;
+
+typedef struct cc65_scopedata cc65_scopedata;
+struct cc65_scopedata {
+ unsigned scope_id; /* Id of scope */
+ const char* scope_name; /* Name of scope */
+ cc65_scope_type scope_type; /* Type of scope */
+ cc65_size scope_size; /* Size of scope, 0 if unknown */
+ unsigned parent_id; /* Id of parent scope */
+ unsigned symbol_id; /* Id of scope symbol if any */
+ unsigned module_id; /* Id of the module */
+};
+
+typedef struct cc65_scopeinfo cc65_scopeinfo;
+struct cc65_scopeinfo {
+ unsigned count; /* Number of data sets that follow */
+ cc65_scopedata data[1]; /* Data sets, number is dynamic */
+};
+
+
+
+const cc65_scopeinfo* cc65_get_scopelist (cc65_dbginfo handle);
+/* Return a list of all scopes in the debug information */
+
+const cc65_scopeinfo* cc65_scope_byid (cc65_dbginfo handle, unsigned id);
+/* Return the scope with a given id. The function returns NULL if no scope
+ * with this id was found.
+ */
+
+const cc65_scopeinfo* cc65_scope_bymodule (cc65_dbginfo handle, unsigned module_id);
+/* Return the list of scopes for one module. The function returns NULL if no
+ * scope with the given id was found.
+ */
+
+const cc65_scopeinfo* cc65_scope_byname (cc65_dbginfo handle, const char* name);
+/* Return the list of scopes with a given name. Returns NULL if no scope with
+ * the given name was found, otherwise a non empty scope list.
+ */
+
+const cc65_scopeinfo* cc65_scope_byspan (cc65_dbginfo handle, unsigned span_id);
+/* Return scope information for a a span. The function returns NULL if the
+ * span id is invalid, otherwise a list of line scopes.
+ */
+
+const cc65_scopeinfo* cc65_childscopes_byid (cc65_dbginfo handle, unsigned id);
+/* Return the direct child scopes of a scope with a given id. The function
+ * returns NULL if no scope with this id was found, otherwise a list of the
+ * direct childs.
+ */
+
+void cc65_free_scopeinfo (cc65_dbginfo Handle, const cc65_scopeinfo* Info);
+/* Free a scope info record */
+
+
+