From 244b59ee4f2765e0e695da9d19aba922c7e84a00 Mon Sep 17 00:00:00 2001 From: "coop%netscape.com" Date: Mon, 8 Mar 1999 21:13:58 +0000 Subject: [PATCH] NOT YET PART OF SEAMONKEY: * linker now sorts based on IIDs * xpt_dump no longer complains about md->result if it is of the correct retval type --- xpcom/libxpt/tools/xpt_dump.c | 31 +++++++++++++++++++++++------- xpcom/libxpt/tools/xpt_link.c | 30 ++++++++++++++++------------- xpcom/typelib/xpt/tools/xpt_dump.c | 31 +++++++++++++++++++++++------- xpcom/typelib/xpt/tools/xpt_link.c | 30 ++++++++++++++++------------- 4 files changed, 82 insertions(+), 40 deletions(-) diff --git a/xpcom/libxpt/tools/xpt_dump.c b/xpcom/libxpt/tools/xpt_dump.c index a96c4fe77819..3be6a18d8c00 100644 --- a/xpcom/libxpt/tools/xpt_dump.c +++ b/xpcom/libxpt/tools/xpt_dump.c @@ -74,7 +74,8 @@ XPT_DumpXPTString(XPTString *str); PRBool XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd, - const int indent, PRBool verbose_mode); + const int indent, PRBool verbose_mode, + PRBool is_result); PRBool XPT_DumpTypeDescriptor(XPTTypeDescriptor *td, int indent, @@ -174,8 +175,8 @@ main(int argc, char **argv) if (param_problems) { fprintf(stdout, "\nWARNING: ParamDescriptors are present with " - "no in/out flag information.\nThese have been marked " - "with 'XXX'.\n"); + "bad in/out/retval flag information.\nThese have been marked " + "with 'XXX'.\nRemember, retval params should always be marked as out!\n"); } XPT_DestroyXDRState(state); @@ -471,13 +472,13 @@ XPT_DumpMethodDescriptor(XPTHeader *header, XPTMethodDescriptor *md, fprintf(stdout, "%*sParameter #%d:\n", new_indent, " ", i); if (!XPT_DumpParamDescriptor(header, &md->params[i], more_indent, - verbose_mode)) + verbose_mode, PR_FALSE)) return PR_FALSE; } fprintf(stdout, "%*sResult:\n", indent, " "); if (!XPT_DumpParamDescriptor(header, md->result, new_indent, - verbose_mode)) { + verbose_mode, PR_TRUE)) { return PR_FALSE; } } else { @@ -565,13 +566,29 @@ XPT_DumpXPTString(XPTString *str) PRBool XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd, - const int indent, PRBool verbose_mode) + const int indent, PRBool verbose_mode, + PRBool is_result) { int new_indent = indent + BASE_INDENT; - if (!XPT_PD_IS_IN(pd->flags) && !XPT_PD_IS_OUT(pd->flags)) { + if (!XPT_PD_IS_IN(pd->flags) && + !XPT_PD_IS_OUT(pd->flags) && + XPT_PD_IS_RETVAL(pd->flags)) { param_problems = PR_TRUE; fprintf(stdout, "XXX\n"); + } else { + if (!XPT_PD_IS_IN(pd->flags) && !XPT_PD_IS_OUT(pd->flags)) { + if (is_result) { + if (XPT_TDP_TAG(pd->type.prefix) != TD_UINT32 && + XPT_TDP_TAG(pd->type.prefix) != TD_VOID) { + param_problems = PR_TRUE; + fprintf(stdout, "XXX\n"); + } + } else { + param_problems = PR_TRUE; + fprintf(stdout, "XXX\n"); + } + } } fprintf(stdout, "%*sIn Param? ", indent, " "); diff --git a/xpcom/libxpt/tools/xpt_link.c b/xpcom/libxpt/tools/xpt_link.c index f5b6d7ae50d5..41c90c4189ce 100644 --- a/xpcom/libxpt/tools/xpt_link.c +++ b/xpcom/libxpt/tools/xpt_link.c @@ -32,10 +32,8 @@ #endif /* Forward declarations. */ -int compare_IDEs_by_IID(XPTInterfaceDirectoryEntry *ide1, - XPTInterfaceDirectoryEntry *ide2); -int compare_IDEs_by_name(XPTInterfaceDirectoryEntry *ide1, - XPTInterfaceDirectoryEntry *ide2); +static int compare_IDEs_by_IID(const void *ap, const void *bp); +static int compare_IDEs_by_name(const void *ap, const void *bp); static int compare_IIDs(const void *ap, const void *bp); PRBool copy_IDE(XPTInterfaceDirectoryEntry *from, XPTInterfaceDirectoryEntry *to); @@ -143,6 +141,11 @@ main(int argc, char **argv) } } + qsort(IDE_array, + numberOfInterfaces, + sizeof(XPTInterfaceDirectoryEntry), + compare_IDEs_by_IID); + header = XPT_NewHeader(numberOfInterfaces); ann = XPT_NewAnnotation(XPT_ANN_LAST, NULL, NULL); header->annotations = ann; @@ -195,20 +198,21 @@ main(int argc, char **argv) return 0; } -int -compare_IDEs_by_IID(XPTInterfaceDirectoryEntry *ide1, - XPTInterfaceDirectoryEntry *ide2) +static int +compare_IDEs_by_IID(const void *ap, + const void *bp) { - nsID *one = &ide1->iid; - nsID *two = &ide2->iid; + const XPTInterfaceDirectoryEntry *ide1 = ap, *ide2 = bp; - return compare_IIDs(one, two); + return compare_IIDs(&ide1->iid, &ide2->iid); } -int -compare_IDEs_by_name(XPTInterfaceDirectoryEntry *ide1, - XPTInterfaceDirectoryEntry *ide2) +static int +compare_IDEs_by_name(const void *ap, + const void *bp) { + const XPTInterfaceDirectoryEntry *ide1 = ap, *ide2 = bp; + return strcmp(ide1->name, ide2->name); } diff --git a/xpcom/typelib/xpt/tools/xpt_dump.c b/xpcom/typelib/xpt/tools/xpt_dump.c index a96c4fe77819..3be6a18d8c00 100644 --- a/xpcom/typelib/xpt/tools/xpt_dump.c +++ b/xpcom/typelib/xpt/tools/xpt_dump.c @@ -74,7 +74,8 @@ XPT_DumpXPTString(XPTString *str); PRBool XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd, - const int indent, PRBool verbose_mode); + const int indent, PRBool verbose_mode, + PRBool is_result); PRBool XPT_DumpTypeDescriptor(XPTTypeDescriptor *td, int indent, @@ -174,8 +175,8 @@ main(int argc, char **argv) if (param_problems) { fprintf(stdout, "\nWARNING: ParamDescriptors are present with " - "no in/out flag information.\nThese have been marked " - "with 'XXX'.\n"); + "bad in/out/retval flag information.\nThese have been marked " + "with 'XXX'.\nRemember, retval params should always be marked as out!\n"); } XPT_DestroyXDRState(state); @@ -471,13 +472,13 @@ XPT_DumpMethodDescriptor(XPTHeader *header, XPTMethodDescriptor *md, fprintf(stdout, "%*sParameter #%d:\n", new_indent, " ", i); if (!XPT_DumpParamDescriptor(header, &md->params[i], more_indent, - verbose_mode)) + verbose_mode, PR_FALSE)) return PR_FALSE; } fprintf(stdout, "%*sResult:\n", indent, " "); if (!XPT_DumpParamDescriptor(header, md->result, new_indent, - verbose_mode)) { + verbose_mode, PR_TRUE)) { return PR_FALSE; } } else { @@ -565,13 +566,29 @@ XPT_DumpXPTString(XPTString *str) PRBool XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd, - const int indent, PRBool verbose_mode) + const int indent, PRBool verbose_mode, + PRBool is_result) { int new_indent = indent + BASE_INDENT; - if (!XPT_PD_IS_IN(pd->flags) && !XPT_PD_IS_OUT(pd->flags)) { + if (!XPT_PD_IS_IN(pd->flags) && + !XPT_PD_IS_OUT(pd->flags) && + XPT_PD_IS_RETVAL(pd->flags)) { param_problems = PR_TRUE; fprintf(stdout, "XXX\n"); + } else { + if (!XPT_PD_IS_IN(pd->flags) && !XPT_PD_IS_OUT(pd->flags)) { + if (is_result) { + if (XPT_TDP_TAG(pd->type.prefix) != TD_UINT32 && + XPT_TDP_TAG(pd->type.prefix) != TD_VOID) { + param_problems = PR_TRUE; + fprintf(stdout, "XXX\n"); + } + } else { + param_problems = PR_TRUE; + fprintf(stdout, "XXX\n"); + } + } } fprintf(stdout, "%*sIn Param? ", indent, " "); diff --git a/xpcom/typelib/xpt/tools/xpt_link.c b/xpcom/typelib/xpt/tools/xpt_link.c index f5b6d7ae50d5..41c90c4189ce 100644 --- a/xpcom/typelib/xpt/tools/xpt_link.c +++ b/xpcom/typelib/xpt/tools/xpt_link.c @@ -32,10 +32,8 @@ #endif /* Forward declarations. */ -int compare_IDEs_by_IID(XPTInterfaceDirectoryEntry *ide1, - XPTInterfaceDirectoryEntry *ide2); -int compare_IDEs_by_name(XPTInterfaceDirectoryEntry *ide1, - XPTInterfaceDirectoryEntry *ide2); +static int compare_IDEs_by_IID(const void *ap, const void *bp); +static int compare_IDEs_by_name(const void *ap, const void *bp); static int compare_IIDs(const void *ap, const void *bp); PRBool copy_IDE(XPTInterfaceDirectoryEntry *from, XPTInterfaceDirectoryEntry *to); @@ -143,6 +141,11 @@ main(int argc, char **argv) } } + qsort(IDE_array, + numberOfInterfaces, + sizeof(XPTInterfaceDirectoryEntry), + compare_IDEs_by_IID); + header = XPT_NewHeader(numberOfInterfaces); ann = XPT_NewAnnotation(XPT_ANN_LAST, NULL, NULL); header->annotations = ann; @@ -195,20 +198,21 @@ main(int argc, char **argv) return 0; } -int -compare_IDEs_by_IID(XPTInterfaceDirectoryEntry *ide1, - XPTInterfaceDirectoryEntry *ide2) +static int +compare_IDEs_by_IID(const void *ap, + const void *bp) { - nsID *one = &ide1->iid; - nsID *two = &ide2->iid; + const XPTInterfaceDirectoryEntry *ide1 = ap, *ide2 = bp; - return compare_IIDs(one, two); + return compare_IIDs(&ide1->iid, &ide2->iid); } -int -compare_IDEs_by_name(XPTInterfaceDirectoryEntry *ide1, - XPTInterfaceDirectoryEntry *ide2) +static int +compare_IDEs_by_name(const void *ap, + const void *bp) { + const XPTInterfaceDirectoryEntry *ide1 = ap, *ide2 = bp; + return strcmp(ide1->name, ide2->name); }