mirror of
https://github.com/cc65/cc65.git
synced 2025-01-30 12:33:15 +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:
parent
1d025a3230
commit
115db59743
@ -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 */
|
||||
{
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user