* first annotation indicates that resulting typelib was created by the linker.
* annotations from files being linked in are now preserved.
This commit is contained in:
coop%netscape.com 1999-03-10 20:40:17 +00:00
Родитель 5c6bc56dbc
Коммит 8d12155d19
2 изменённых файлов: 60 добавлений и 6 удалений

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

@ -77,7 +77,7 @@ main(int argc, char **argv)
XPTInterfaceDirectoryEntry *newIDE, *IDE_array; XPTInterfaceDirectoryEntry *newIDE, *IDE_array;
XPTInterfaceDescriptor *id; XPTInterfaceDescriptor *id;
XPTTypeDescriptor *td; XPTTypeDescriptor *td;
XPTAnnotation *ann; XPTAnnotation *ann, *first_ann;
uint32 header_sz, len; uint32 header_sz, len;
struct stat file_stat; struct stat file_stat;
size_t flen = 0; size_t flen = 0;
@ -92,6 +92,15 @@ main(int argc, char **argv)
return 1; return 1;
} }
/* We're going to keep annotations now, so we'll start off with one
* that will let people know that the resultant type library file
* was generated by this tool (xpt_link).
*/
first_ann = XPT_NewAnnotation(XPT_ANN_LAST | XPT_ANN_PRIVATE,
XPT_NewStringZ("xpt_link"),
XPT_NewStringZ("This is a linked type library file created by xpt_link."));
for (i=2; i<argc; i++) { for (i=2; i<argc; i++) {
if (stat(argv[i], &file_stat) != 0) { if (stat(argv[i], &file_stat) != 0) {
perror("FAILED: fstat"); perror("FAILED: fstat");
@ -173,6 +182,16 @@ main(int argc, char **argv)
k++; k++;
} }
/* Copy the annotations.
*/
ann = first_ann;
while (ann->next != NULL) {
ann = ann->next;
}
if (header->annotations != NULL) {
ann->next = header->annotations;
}
PR_FREEIF(header) PR_FREEIF(header)
if (state) if (state)
XPT_DestroyXDRState(state); XPT_DestroyXDRState(state);
@ -186,6 +205,15 @@ main(int argc, char **argv)
} }
} }
/* Make sure the last annotation is the only one marked as XP_ANN_LAST.
*/
ann = first_ann;
while (ann->next != NULL) {
ann->flags &= ~XPT_ANN_LAST;
ann = ann->next;
}
ann->flags |= XPT_ANN_LAST;
/* Sort both IDE_array and fix_array by name so we can check for /* Sort both IDE_array and fix_array by name so we can check for
* name_space::name collisions. * name_space::name collisions.
*/ */
@ -356,8 +384,7 @@ main(int argc, char **argv)
} }
header = XPT_NewHeader(trueNumberOfInterfaces); header = XPT_NewHeader(trueNumberOfInterfaces);
ann = XPT_NewAnnotation(XPT_ANN_LAST, NULL, NULL); header->annotations = first_ann;
header->annotations = ann;
for (i=0; i<trueNumberOfInterfaces; i++) { for (i=0; i<trueNumberOfInterfaces; i++) {
if (!copy_IDE(&IDE_array[i], &header->interface_directory[i])) { if (!copy_IDE(&IDE_array[i], &header->interface_directory[i])) {
perror("FAILED: 2nd copying of IDE"); perror("FAILED: 2nd copying of IDE");

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

@ -77,7 +77,7 @@ main(int argc, char **argv)
XPTInterfaceDirectoryEntry *newIDE, *IDE_array; XPTInterfaceDirectoryEntry *newIDE, *IDE_array;
XPTInterfaceDescriptor *id; XPTInterfaceDescriptor *id;
XPTTypeDescriptor *td; XPTTypeDescriptor *td;
XPTAnnotation *ann; XPTAnnotation *ann, *first_ann;
uint32 header_sz, len; uint32 header_sz, len;
struct stat file_stat; struct stat file_stat;
size_t flen = 0; size_t flen = 0;
@ -92,6 +92,15 @@ main(int argc, char **argv)
return 1; return 1;
} }
/* We're going to keep annotations now, so we'll start off with one
* that will let people know that the resultant type library file
* was generated by this tool (xpt_link).
*/
first_ann = XPT_NewAnnotation(XPT_ANN_LAST | XPT_ANN_PRIVATE,
XPT_NewStringZ("xpt_link"),
XPT_NewStringZ("This is a linked type library file created by xpt_link."));
for (i=2; i<argc; i++) { for (i=2; i<argc; i++) {
if (stat(argv[i], &file_stat) != 0) { if (stat(argv[i], &file_stat) != 0) {
perror("FAILED: fstat"); perror("FAILED: fstat");
@ -173,6 +182,16 @@ main(int argc, char **argv)
k++; k++;
} }
/* Copy the annotations.
*/
ann = first_ann;
while (ann->next != NULL) {
ann = ann->next;
}
if (header->annotations != NULL) {
ann->next = header->annotations;
}
PR_FREEIF(header) PR_FREEIF(header)
if (state) if (state)
XPT_DestroyXDRState(state); XPT_DestroyXDRState(state);
@ -186,6 +205,15 @@ main(int argc, char **argv)
} }
} }
/* Make sure the last annotation is the only one marked as XP_ANN_LAST.
*/
ann = first_ann;
while (ann->next != NULL) {
ann->flags &= ~XPT_ANN_LAST;
ann = ann->next;
}
ann->flags |= XPT_ANN_LAST;
/* Sort both IDE_array and fix_array by name so we can check for /* Sort both IDE_array and fix_array by name so we can check for
* name_space::name collisions. * name_space::name collisions.
*/ */
@ -356,8 +384,7 @@ main(int argc, char **argv)
} }
header = XPT_NewHeader(trueNumberOfInterfaces); header = XPT_NewHeader(trueNumberOfInterfaces);
ann = XPT_NewAnnotation(XPT_ANN_LAST, NULL, NULL); header->annotations = first_ann;
header->annotations = ann;
for (i=0; i<trueNumberOfInterfaces; i++) { for (i=0; i<trueNumberOfInterfaces; i++) {
if (!copy_IDE(&IDE_array[i], &header->interface_directory[i])) { if (!copy_IDE(&IDE_array[i], &header->interface_directory[i])) {
perror("FAILED: 2nd copying of IDE"); perror("FAILED: 2nd copying of IDE");