+unsigned FileInfoCount (void)
+/* Return the total number of file infos */
+{
+ return CollCount (&FileInfos);
+}
+
+
+
+void AssignFileInfoIds (void)
+/* Remove unused file infos and assign the ids to the remaining ones */
+{
+ unsigned I, J;
+
+ /* Print all file infos */
+ for (I = 0, J = 0; I < CollCount (&FileInfos); ++I) {
+
+ /* Get the next file info */
+ FileInfo* FI = CollAtUnchecked (&FileInfos, I);
+
+ /* If it's unused, free it, otherwise assign the id and keep it */
+ if (CollCount (&FI->Modules) == 0) {
+ FreeFileInfo (FI);
+ } else {
+ FI->Id = J;
+ CollReplace (&FileInfos, FI, J++);
+ }
+ }
+
+ /* The new count is now in J */
+ FileInfos.Count = J;
+}
+
+
+
+void PrintDbgFileInfo (FILE* F)
+/* Output the file info to a debug info file */
+{
+ unsigned I, J;
+
+ /* Print all file infos */
+ for (I = 0; I < CollCount (&FileInfos); ++I) {
+
+ /* Get the file info */
+ const FileInfo* FI = CollAtUnchecked (&FileInfos, I);
+
+ /* Base info */
+ fprintf (F,
+ "file\tid=%u,name=\"%s\",size=%lu,mtime=0x%08lX,mod=",
+ FI->Id, GetString (FI->Name), FI->Size, FI->MTime);
+
+ /* Modules that use the file */
+ for (J = 0; J < CollCount (&FI->Modules); ++J) {
+
+ /* Get the module */
+ const ObjData* O = CollConstAt (&FI->Modules, J);
+
+ /* Output its id */
+ if (J > 0) {
+ fprintf (F, "+%u", O->Id);
+ } else {
+ fprintf (F, "%u", O->Id);
+ }
+ }
+
+ /* Terminate the output line */
+ fputc ('\n', F);
+ }
+}
+
+
+