removed unused libraries section

added tag section for sawce

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40685
This commit is contained in:
David Anderson 2007-04-11 16:07:44 +00:00
parent e3b3180099
commit 3474ba74a5
3 changed files with 31 additions and 6 deletions

View File

@ -134,6 +134,15 @@ typedef struct sp_file_pubvars_s
uint32_t name; /**< Index into nametable */ uint32_t name; /**< Index into nametable */
} sp_file_pubvars_t; } sp_file_pubvars_t;
/**
* @brief File-encoded tag info.
*/
typedef struct sp_file_tag_s
{
uint32_t tag_id; /**< Tag ID from compiler */
uint32_t name; /**< Index into nametable */
} sp_file_tag_t;
#if defined __linux__ #if defined __linux__
#pragma pack() /* reset default packing */ #pragma pack() /* reset default packing */
#else #else

View File

@ -305,7 +305,7 @@
> >
</File> </File>
<File <File
RelativePath="..\..\include\sp_file_headers.h" RelativePath="..\..\..\public\sourcepawn\sp_file_headers.h"
> >
</File> </File>
<File <File

View File

@ -16,7 +16,6 @@ enum FileSections
FS_Publics, FS_Publics,
FS_Pubvars, FS_Pubvars,
FS_Natives, FS_Natives,
FS_Libraries,
FS_Nametable, /* required */ FS_Nametable, /* required */
FS_DbgFile, FS_DbgFile,
FS_DbgSymbol, FS_DbgSymbol,
@ -26,6 +25,7 @@ enum FileSections
FS_DbgState, FS_DbgState,
FS_DbgStrings, FS_DbgStrings,
FS_DbgInfo, FS_DbgInfo,
FS_Tags,
/* --- */ /* --- */
FS_Number, FS_Number,
}; };
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
sp_file_t *spf; sp_file_t *spf;
memfile_t *dbgtab = NULL; //dbgcrab memfile_t *dbgtab = NULL; //dbgcrab
unsigned char *dbgptr = NULL; unsigned char *dbgptr = NULL;
uint32_t sections[FS_Number] = {1,1,0,0,0,0,1,0,0,0,0,0,0}; uint32_t sections[FS_Number] = {1,1,0,0,0,1,0,0,0,0,0,0,0};
FILE *fp; FILE *fp;
if (bin_file == NULL) if (bin_file == NULL)
@ -91,10 +91,10 @@ int main(int argc, char *argv[])
{ {
spfw_add_section(spf, ".natives"); spfw_add_section(spf, ".natives");
} }
sections[FS_Libraries] = (hdr->pubvars - hdr->libraries) / hdr->defsize; sections[FS_Tags] = (hdr->nametable - hdr->tags) / hdr->defsize;
if (sections[FS_Libraries]) if (sections[FS_Tags])
{ {
spfw_add_section(spf, ".libraries"); spfw_add_section(spf, ".tags");
} }
spfw_add_section(spf, ".names"); spfw_add_section(spf, ".names");
@ -260,6 +260,22 @@ int main(int argc, char *argv[])
spfw_next_section(spf); spfw_next_section(spf);
} }
if (sections[FS_Tags])
{
uint32_t numTags = (uint32_t)sections[FS_Tags];
AMX_FUNCSTUBNT *stub;
sp_file_tag_t tag;
for (i=0; i<numTags; i++)
{
stub = (AMX_FUNCSTUBNT *)((unsigned char *)hdr + hdr->tags + (i * hdr->defsize));
tag.tag_id = stub->address;
tag.name = stub->nameofs - (hdr->nametable + sizeof(uint16_t));
sfwrite(&tag, sizeof(sp_file_tag_t), 1, spf);
}
spfw_next_section(spf);
}
if (sections[FS_Nametable]) if (sections[FS_Nametable])
{ {
unsigned char *base; unsigned char *base;