1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 22:29:35 +00:00

Added cc65_line_bysource

git-svn-id: svn://svn.cc65.org/cc65/trunk@5194 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-08-17 16:08:26 +00:00
parent 1d025a3230
commit 115db59743
2 changed files with 44 additions and 0 deletions

View File

@ -4792,6 +4792,45 @@ const cc65_lineinfo* cc65_line_bynumber (cc65_dbginfo Handle, unsigned FileId,
const cc65_lineinfo* cc65_line_bysource (cc65_dbginfo Handle, unsigned FileId)
/* Return line information for a source file. The function returns NULL if the
* file id is invalid.
*/
{
DbgInfo* Info;
FileInfo* F;
cc65_lineinfo* D;
unsigned I;
/* Check the parameter */
assert (Handle != 0);
/* The handle is actually a pointer to a debug info struct */
Info = (DbgInfo*) Handle;
/* Check if the source file id is valid */
if (FileId >= CollCount (&Info->FileInfoById)) {
return 0;
}
/* Get the file */
F = CollAt (&Info->FileInfoById, FileId);
/* Prepare the struct we will return to the caller */
D = new_cc65_lineinfo (CollCount (&F->LineInfoByLine));
/* Fill in the data */
for (I = 0; I < CollCount (&F->LineInfoByLine); ++I) {
/* Copy the data */
CopyLineInfo (D->data + I, CollConstAt (&F->LineInfoByLine, I));
}
/* Return the allocated struct */
return D;
}
void cc65_free_lineinfo (cc65_dbginfo Handle, const cc65_lineinfo* Info)
/* Free line info returned by one of the other functions */
{

View File

@ -189,6 +189,11 @@ const cc65_lineinfo* cc65_line_bynumber (cc65_dbginfo handle,
* function returns NULL if no line information was found.
*/
const cc65_lineinfo* cc65_line_bysource (cc65_dbginfo Handle, unsigned source_id);
/* Return line information for a source file. The function returns NULL if the
* file id is invalid.
*/
void cc65_free_lineinfo (cc65_dbginfo handle, const cc65_lineinfo* info);
/* Free line info returned by one of the other functions */