From: uz Date: Wed, 17 Aug 2011 15:58:21 +0000 (+0000) Subject: Added cc65_line_byid. X-Git-Tag: V2.13.3~269 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1d025a3230ece56a772965213df25a84f604d870;p=cc65 Added cc65_line_byid. git-svn-id: svn://svn.cc65.org/cc65/trunk@5193 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/dbginfo/dbginfo.c b/src/dbginfo/dbginfo.c index 9092af60f..c769e1889 100644 --- a/src/dbginfo/dbginfo.c +++ b/src/dbginfo/dbginfo.c @@ -4714,6 +4714,39 @@ void cc65_free_libraryinfo (cc65_dbginfo Handle, const cc65_libraryinfo* Info) +const cc65_lineinfo* cc65_line_byid (cc65_dbginfo Handle, unsigned Id) +/* Return information about a line with a specific id. The function + * returns NULL if the id is invalid (no such line) and otherwise a + * cc65_lineinfo structure with one entry that contains the requested + * module information. + */ +{ + DbgInfo* Info; + cc65_lineinfo* D; + + /* Check the parameter */ + assert (Handle != 0); + + /* The handle is actually a pointer to a debug info struct */ + Info = (DbgInfo*) Handle; + + /* Check if the id is valid */ + if (Id >= CollCount (&Info->LineInfoById)) { + return 0; + } + + /* Allocate memory for the data structure returned to the caller */ + D = new_cc65_lineinfo (1); + + /* Fill in the data */ + CopyLineInfo (D->data, CollConstAt (&Info->LineInfoById, Id)); + + /* Return the result */ + return D; +} + + + const cc65_lineinfo* cc65_line_bynumber (cc65_dbginfo Handle, unsigned FileId, cc65_line Line) /* Return line information for a source file/line number combination. The @@ -5577,4 +5610,4 @@ void cc65_free_scopeinfo (cc65_dbginfo Handle, const cc65_scopeinfo* Info) - + diff --git a/src/dbginfo/dbginfo.h b/src/dbginfo/dbginfo.h index 62cc68e70..45c942736 100644 --- a/src/dbginfo/dbginfo.h +++ b/src/dbginfo/dbginfo.h @@ -175,6 +175,13 @@ struct cc65_lineinfo { +const cc65_lineinfo* cc65_line_byid (cc65_dbginfo handle, unsigned id); +/* Return information about a line with a specific id. The function + * returns NULL if the id is invalid (no such line) and otherwise a + * cc65_lineinfo structure with one entry that contains the requested + * module information. + */ + const cc65_lineinfo* cc65_line_bynumber (cc65_dbginfo handle, unsigned source_id, cc65_line line);