1.1 --- a/sourcepawn/include/sp_vm_types.h Tue Aug 01 23:17:13 2006 +0000
1.2 +++ b/sourcepawn/include/sp_vm_types.h Tue Aug 01 23:40:32 2006 +0000
1.3 @@ -16,6 +16,7 @@
1.4 #define SP_ERR_PARAM 4 /* Invalid parameter */
1.5 #define SP_ERR_INVALID_ADDRESS 5 /* A memory address was not valid */
1.6 #define SP_ERR_NOT_FOUND 6 /* The object in question was not found */
1.7 +#define SP_ERR_INDEX 7 /* Invalid index parameter */
1.8
1.9 /**********************************************
1.10 *** The following structures are reference structures.
2.1 --- a/sourcepawn/vm/sp_reader.c Tue Aug 01 23:17:13 2006 +0000
2.2 +++ b/sourcepawn/vm/sp_reader.c Tue Aug 01 23:40:32 2006 +0000
2.3 @@ -39,10 +39,6 @@
2.4 plugin->data_size = dat->datasize;
2.5 plugin->memory = dat->memsize;
2.6 }
2.7 - else if (!(plugin->info->stringbase) && !strcmp(nameptr, ".names"))
2.8 - {
2.9 - plugin->info->stringbase = base + secptr->dataoffs;
2.10 - }
2.11 else if (!(plugin->info->publics) && !strcmp(nameptr, ".publics"))
2.12 {
2.13 plugin->info->publics_num = secptr->size / sizeof(sp_file_publics_t);
2.14 @@ -58,25 +54,34 @@
2.15 plugin->info->natives_num = secptr->size / sizeof(sp_file_natives_t);
2.16 plugin->info->natives = (sp_file_natives_t *)(base + secptr->dataoffs);
2.17 }
2.18 + else if (!(plugin->info->stringbase) && !strcmp(nameptr, ".names"))
2.19 + {
2.20 + plugin->info->stringbase = base + secptr->dataoffs;
2.21 + }
2.22 else if (!(plugin->debug->files) && !strcmp(nameptr, ".dbg.files"))
2.23 {
2.24 - plugin->debug->files_num = secptr->size / sizeof(sp_fdbg_file_t);
2.25 plugin->debug->files = (sp_fdbg_file_t *)(base + secptr->dataoffs);
2.26 }
2.27 + else if (!(plugin->debug->lines) && !strcmp(nameptr, ".dbg.lines"))
2.28 + {
2.29 + plugin->debug->lines = (sp_fdbg_line_t *)(base + secptr->dataoffs);
2.30 + }
2.31 + else if (!(plugin->debug->symbols) && !strcmp(nameptr, ".dbg.symbols"))
2.32 + {
2.33 + plugin->debug->symbols = (sp_fdbg_symbol_t *)(base + secptr->dataoffs);
2.34 + }
2.35 + else if (!(plugin->debug->lines_num) && !strcmp(nameptr, ".dbg.info"))
2.36 + {
2.37 + sp_fdbg_info_t *inf = (sp_fdbg_info_t *)(base + secptr->dataoffs);
2.38 + plugin->debug->files_num = inf->num_files;
2.39 + plugin->debug->lines_num = inf->num_lines;
2.40 + plugin->debug->syms_num = inf->num_syms;
2.41 + }
2.42 else if (!(plugin->debug->stringbase) && !strcmp(nameptr, ".dbg.strings"))
2.43 {
2.44 plugin->debug->stringbase = base + secptr->dataoffs;
2.45 }
2.46 - else if (!(plugin->debug->lines) && !strcmp(nameptr, ".dbg.lines"))
2.47 - {
2.48 - plugin->debug->lines_num = secptr->size / sizeof(sp_fdbg_line_t);
2.49 - plugin->debug->lines = (sp_fdbg_line_t *)(base + secptr->dataoffs);
2.50 - }
2.51 - else if (!(plugin->debug->symbols) && !strcmp(nameptr, ".dbg.symbols"))
2.52 - {
2.53 - plugin->debug->syms_num = secptr->size / sizeof(sp_fdbg_symbol_t);
2.54 - plugin->debug->symbols = (sp_fdbg_symbol_t *)(base + secptr->dataoffs);
2.55 - }
2.56 +
2.57 secptr++;
2.58 sectnum++;
2.59 }
3.1 --- a/sourcepawn/vm/sp_vm.h Tue Aug 01 23:17:13 2006 +0000
3.2 +++ b/sourcepawn/vm/sp_vm.h Tue Aug 01 23:40:32 2006 +0000
3.3 @@ -146,11 +146,18 @@
3.4 * @param local_addr Optionally filled with local address offset.
3.5 * @param phys_addr Optionally filled with relocated physical address.
3.6 */
3.7 -int SP_FindPubvarByName(sp_context_t *ctx,
3.8 - const char *name,
3.9 - uint32_t *index,
3.10 - cell_t *local_addr,
3.11 - cell_t **phys_addr);
3.12 +int SP_FindPubvarByName(sp_context_t *ctx, const char *name, uint32_t *index);
3.13 +
3.14 +//:TODO: fill in the info of this function, hi
3.15 +int SP_GetPubvarAddrs(sp_context_t *ctx, uint32_t index, cell_t *local_addr, cell_t **phys_addr);
3.16 +
3.17 +/**
3.18 +* Gets the number of public variables.
3.19 +*
3.20 +* @param ctx Context pointer.
3.21 +* @param num Filled with the number of public variables.
3.22 +*/
3.23 +int SP_GetPubVarsNum(sp_context_t *ctx, uint32_t *num);
3.24
3.25 /**
3.26 * Round-about method of converting a plugin reference to a physical address
3.27 @@ -162,7 +169,7 @@
3.28 int SP_LocalToPhysAddr(sp_context_t *ctx, cell_t local_addr, cell_t **phys_addr);
3.29
3.30 /**
3.31 - * Convers a local address to a physical string.
3.32 + * Converts a local address to a physical string.
3.33 * Note that SourcePawn does not support packed strings, as such this function is
3.34 * 'cell to char' only.
3.35 *