notaz.gp2x.de
/
ia32rtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
translate: some float arg handling
[ia32rtools.git]
/
tools
/
protoparse.h
diff --git
a/tools/protoparse.h
b/tools/protoparse.h
index
469c12f
..
549c903
100644
(file)
--- a/
tools/protoparse.h
+++ b/
tools/protoparse.h
@@
-15,6
+15,8
@@
struct parsed_type {
unsigned int is_struct:1; // split for args
unsigned int is_retreg:1; // register to return to caller
unsigned int is_va_list:1;
unsigned int is_struct:1; // split for args
unsigned int is_retreg:1; // register to return to caller
unsigned int is_va_list:1;
+ unsigned int is_64bit:1;
+ unsigned int is_float:1; // float, double
};
struct parsed_proto_arg {
};
struct parsed_proto_arg {
@@
-22,6
+24,7
@@
struct parsed_proto_arg {
struct parsed_type type;
struct parsed_proto *pp; // fptr or struct
void *datap;
struct parsed_type type;
struct parsed_proto *pp; // fptr or struct
void *datap;
+ unsigned int is_saved:1; // not set here, for tool use
};
struct parsed_proto {
};
struct parsed_proto {
@@
-191,12
+194,14
@@
static const char *known_ptr_types[] = {
"HACCEL",
"HANDLE",
"HBITMAP",
"HACCEL",
"HANDLE",
"HBITMAP",
+ "HBRUSH",
"HCALL",
"HCURSOR",
"HDC",
"HFONT",
"HGDIOBJ",
"HGLOBAL",
"HCALL",
"HCURSOR",
"HDC",
"HFONT",
"HGDIOBJ",
"HGLOBAL",
+ "HHOOK",
"HICON",
"HINSTANCE",
"HIMC", // DWORD in mingw, ptr in wine..
"HICON",
"HINSTANCE",
"HIMC", // DWORD in mingw, ptr in wine..
@@
-211,18
+216,26
@@
static const char *known_ptr_types[] = {
"HMENU",
"HWAVEOUT",
"HWND",
"HMENU",
"HWAVEOUT",
"HWND",
+ "PAPPBARDATA",
"PBYTE",
"PCRITICAL_SECTION",
"PBYTE",
"PCRITICAL_SECTION",
+ "PDEVMODEA",
"PDWORD",
"PFILETIME",
"PLARGE_INTEGER",
"PDWORD",
"PFILETIME",
"PLARGE_INTEGER",
+ "PHANDLE",
"PHKEY",
"PLONG",
"PMEMORY_BASIC_INFORMATION",
"PUINT",
"PHKEY",
"PLONG",
"PMEMORY_BASIC_INFORMATION",
"PUINT",
+ "PULARGE_INTEGER",
+ "PULONG_PTR",
"PVOID",
"PCVOID",
"PWORD",
"PVOID",
"PCVOID",
"PWORD",
+ "REFCLSID",
+ "REFIID",
+ "HOOKPROC",
"DLGPROC",
"TIMERPROC",
"WNDENUMPROC",
"DLGPROC",
"TIMERPROC",
"WNDENUMPROC",
@@
-511,7
+524,7
@@
static int parse_protostr(char *protostr, struct parsed_proto *pp)
pp->is_stdcall = 0; // custom
pp->is_userstack = 1;
}
pp->is_stdcall = 0; // custom
pp->is_userstack = 1;
}
- else if (IS(cconv, "WINAPI"))
+ else if (IS(cconv, "WINAPI")
|| IS(cconv, "PASCAL")
)
pp->is_stdcall = 1;
else {
printf("%s:%d:%zd: unhandled cconv: '%s'\n",
pp->is_stdcall = 1;
else {
printf("%s:%d:%zd: unhandled cconv: '%s'\n",
@@
-658,14
+671,22
@@
static int parse_protostr(char *protostr, struct parsed_proto *pp)
pp->has_retreg |= is_retreg;
}
pp->has_retreg |= is_retreg;
}
- if (
strstr(arg->type.name, "int64
")
- || IS(arg->type.name, "double"))
+ if (
IS(arg->type.name, "float
")
+
|| IS(arg->type.name, "double"))
{
{
+ arg->type.is_float = 1;
+ }
+
+ if (!arg->type.is_ptr && (strstr(arg->type.name, "int64")
+ || IS(arg->type.name, "double")))
+ {
+ arg->type.is_64bit = 1;
// hack..
// hack..
- free(arg->type.name);
- arg->type.name = strdup("int");
pp_copy_arg(&pp->arg[xarg], arg);
pp_copy_arg(&pp->arg[xarg], arg);
+ arg = &pp->arg[xarg];
xarg++;
xarg++;
+ free(arg->type.name);
+ arg->type.name = strdup("dummy");
}
ret = check_struct_arg(arg);
}
ret = check_struct_arg(arg);
@@
-860,7
+881,8
@@
static const struct parsed_proto *proto_parse(FILE *fhdr, const char *sym,
if (pp_cache == NULL)
build_caches(fhdr);
if (pp_cache == NULL)
build_caches(fhdr);
- if (sym[0] == '_') // && strncmp(fname, "stdc", 4) == 0)
+ // ugh...
+ if (sym[0] == '_' && !IS_START(sym, "__W"))
sym++;
strcpy(pp_search.name, sym);
sym++;
strcpy(pp_search.name, sym);