* linker now sorts based on IIDs
* xpt_dump no longer complains about md->result if it is of the correct retval type
This commit is contained in:
coop%netscape.com 1999-03-08 21:13:58 +00:00
Родитель df77619c4a
Коммит 244b59ee4f
4 изменённых файлов: 82 добавлений и 40 удалений

Просмотреть файл

@ -74,7 +74,8 @@ XPT_DumpXPTString(XPTString *str);
PRBool PRBool
XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd, XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd,
const int indent, PRBool verbose_mode); const int indent, PRBool verbose_mode,
PRBool is_result);
PRBool PRBool
XPT_DumpTypeDescriptor(XPTTypeDescriptor *td, int indent, XPT_DumpTypeDescriptor(XPTTypeDescriptor *td, int indent,
@ -174,8 +175,8 @@ main(int argc, char **argv)
if (param_problems) { if (param_problems) {
fprintf(stdout, "\nWARNING: ParamDescriptors are present with " fprintf(stdout, "\nWARNING: ParamDescriptors are present with "
"no in/out flag information.\nThese have been marked " "bad in/out/retval flag information.\nThese have been marked "
"with 'XXX'.\n"); "with 'XXX'.\nRemember, retval params should always be marked as out!\n");
} }
XPT_DestroyXDRState(state); XPT_DestroyXDRState(state);
@ -471,13 +472,13 @@ XPT_DumpMethodDescriptor(XPTHeader *header, XPTMethodDescriptor *md,
fprintf(stdout, "%*sParameter #%d:\n", new_indent, " ", i); fprintf(stdout, "%*sParameter #%d:\n", new_indent, " ", i);
if (!XPT_DumpParamDescriptor(header, &md->params[i], more_indent, if (!XPT_DumpParamDescriptor(header, &md->params[i], more_indent,
verbose_mode)) verbose_mode, PR_FALSE))
return PR_FALSE; return PR_FALSE;
} }
fprintf(stdout, "%*sResult:\n", indent, " "); fprintf(stdout, "%*sResult:\n", indent, " ");
if (!XPT_DumpParamDescriptor(header, md->result, new_indent, if (!XPT_DumpParamDescriptor(header, md->result, new_indent,
verbose_mode)) { verbose_mode, PR_TRUE)) {
return PR_FALSE; return PR_FALSE;
} }
} else { } else {
@ -565,13 +566,29 @@ XPT_DumpXPTString(XPTString *str)
PRBool PRBool
XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd, 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; 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; param_problems = PR_TRUE;
fprintf(stdout, "XXX\n"); 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, " "); fprintf(stdout, "%*sIn Param? ", indent, " ");

Просмотреть файл

@ -32,10 +32,8 @@
#endif #endif
/* Forward declarations. */ /* Forward declarations. */
int compare_IDEs_by_IID(XPTInterfaceDirectoryEntry *ide1, static int compare_IDEs_by_IID(const void *ap, const void *bp);
XPTInterfaceDirectoryEntry *ide2); static int compare_IDEs_by_name(const void *ap, const void *bp);
int compare_IDEs_by_name(XPTInterfaceDirectoryEntry *ide1,
XPTInterfaceDirectoryEntry *ide2);
static int compare_IIDs(const void *ap, const void *bp); static int compare_IIDs(const void *ap, const void *bp);
PRBool copy_IDE(XPTInterfaceDirectoryEntry *from, PRBool copy_IDE(XPTInterfaceDirectoryEntry *from,
XPTInterfaceDirectoryEntry *to); 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); header = XPT_NewHeader(numberOfInterfaces);
ann = XPT_NewAnnotation(XPT_ANN_LAST, NULL, NULL); ann = XPT_NewAnnotation(XPT_ANN_LAST, NULL, NULL);
header->annotations = ann; header->annotations = ann;
@ -195,20 +198,21 @@ main(int argc, char **argv)
return 0; return 0;
} }
int static int
compare_IDEs_by_IID(XPTInterfaceDirectoryEntry *ide1, compare_IDEs_by_IID(const void *ap,
XPTInterfaceDirectoryEntry *ide2) const void *bp)
{ {
nsID *one = &ide1->iid; const XPTInterfaceDirectoryEntry *ide1 = ap, *ide2 = bp;
nsID *two = &ide2->iid;
return compare_IIDs(one, two); return compare_IIDs(&ide1->iid, &ide2->iid);
} }
int static int
compare_IDEs_by_name(XPTInterfaceDirectoryEntry *ide1, compare_IDEs_by_name(const void *ap,
XPTInterfaceDirectoryEntry *ide2) const void *bp)
{ {
const XPTInterfaceDirectoryEntry *ide1 = ap, *ide2 = bp;
return strcmp(ide1->name, ide2->name); return strcmp(ide1->name, ide2->name);
} }

Просмотреть файл

@ -74,7 +74,8 @@ XPT_DumpXPTString(XPTString *str);
PRBool PRBool
XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd, XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd,
const int indent, PRBool verbose_mode); const int indent, PRBool verbose_mode,
PRBool is_result);
PRBool PRBool
XPT_DumpTypeDescriptor(XPTTypeDescriptor *td, int indent, XPT_DumpTypeDescriptor(XPTTypeDescriptor *td, int indent,
@ -174,8 +175,8 @@ main(int argc, char **argv)
if (param_problems) { if (param_problems) {
fprintf(stdout, "\nWARNING: ParamDescriptors are present with " fprintf(stdout, "\nWARNING: ParamDescriptors are present with "
"no in/out flag information.\nThese have been marked " "bad in/out/retval flag information.\nThese have been marked "
"with 'XXX'.\n"); "with 'XXX'.\nRemember, retval params should always be marked as out!\n");
} }
XPT_DestroyXDRState(state); XPT_DestroyXDRState(state);
@ -471,13 +472,13 @@ XPT_DumpMethodDescriptor(XPTHeader *header, XPTMethodDescriptor *md,
fprintf(stdout, "%*sParameter #%d:\n", new_indent, " ", i); fprintf(stdout, "%*sParameter #%d:\n", new_indent, " ", i);
if (!XPT_DumpParamDescriptor(header, &md->params[i], more_indent, if (!XPT_DumpParamDescriptor(header, &md->params[i], more_indent,
verbose_mode)) verbose_mode, PR_FALSE))
return PR_FALSE; return PR_FALSE;
} }
fprintf(stdout, "%*sResult:\n", indent, " "); fprintf(stdout, "%*sResult:\n", indent, " ");
if (!XPT_DumpParamDescriptor(header, md->result, new_indent, if (!XPT_DumpParamDescriptor(header, md->result, new_indent,
verbose_mode)) { verbose_mode, PR_TRUE)) {
return PR_FALSE; return PR_FALSE;
} }
} else { } else {
@ -565,13 +566,29 @@ XPT_DumpXPTString(XPTString *str)
PRBool PRBool
XPT_DumpParamDescriptor(XPTHeader *header, XPTParamDescriptor *pd, 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; 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; param_problems = PR_TRUE;
fprintf(stdout, "XXX\n"); 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, " "); fprintf(stdout, "%*sIn Param? ", indent, " ");

Просмотреть файл

@ -32,10 +32,8 @@
#endif #endif
/* Forward declarations. */ /* Forward declarations. */
int compare_IDEs_by_IID(XPTInterfaceDirectoryEntry *ide1, static int compare_IDEs_by_IID(const void *ap, const void *bp);
XPTInterfaceDirectoryEntry *ide2); static int compare_IDEs_by_name(const void *ap, const void *bp);
int compare_IDEs_by_name(XPTInterfaceDirectoryEntry *ide1,
XPTInterfaceDirectoryEntry *ide2);
static int compare_IIDs(const void *ap, const void *bp); static int compare_IIDs(const void *ap, const void *bp);
PRBool copy_IDE(XPTInterfaceDirectoryEntry *from, PRBool copy_IDE(XPTInterfaceDirectoryEntry *from,
XPTInterfaceDirectoryEntry *to); 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); header = XPT_NewHeader(numberOfInterfaces);
ann = XPT_NewAnnotation(XPT_ANN_LAST, NULL, NULL); ann = XPT_NewAnnotation(XPT_ANN_LAST, NULL, NULL);
header->annotations = ann; header->annotations = ann;
@ -195,20 +198,21 @@ main(int argc, char **argv)
return 0; return 0;
} }
int static int
compare_IDEs_by_IID(XPTInterfaceDirectoryEntry *ide1, compare_IDEs_by_IID(const void *ap,
XPTInterfaceDirectoryEntry *ide2) const void *bp)
{ {
nsID *one = &ide1->iid; const XPTInterfaceDirectoryEntry *ide1 = ap, *ide2 = bp;
nsID *two = &ide2->iid;
return compare_IIDs(one, two); return compare_IIDs(&ide1->iid, &ide2->iid);
} }
int static int
compare_IDEs_by_name(XPTInterfaceDirectoryEntry *ide1, compare_IDEs_by_name(const void *ap,
XPTInterfaceDirectoryEntry *ide2) const void *bp)
{ {
const XPTInterfaceDirectoryEntry *ide1 = ap, *ide2 = bp;
return strcmp(ide1->name, ide2->name); return strcmp(ide1->name, ide2->name);
} }