+ return CollAtUnchecked (&O->Imports, Id);
+}
+
+
+
+struct Export* GetObjExport (const ObjData* O, unsigned Id)
+/* Get an export from an object file checking for a valid index */
+{
+ if (Id >= CollCount (&O->Exports)) {
+ Error ("Invalid export index (%u) in module `%s'",
+ Id, GetObjFileName (O));
+ }
+ return CollAtUnchecked (&O->Exports, Id);
+}
+
+
+
+struct DbgSym* GetObjDbgSym (const ObjData* O, unsigned Id)
+/* Get a debug symbol from an object file checking for a valid index */
+{
+ if (Id >= CollCount (&O->DbgSyms)) {
+ Error ("Invalid debug symbol index (%u) in module `%s'",
+ Id, GetObjFileName (O));
+ }
+ return CollAtUnchecked (&O->DbgSyms, Id);
+}
+
+
+
+struct Scope* GetObjScope (const ObjData* O, unsigned Id)
+/* Get a scope from an object file checking for a valid index */
+{
+ if (Id >= CollCount (&O->Scopes)) {
+ Error ("Invalid scope index (%u) in module `%s'",
+ Id, GetObjFileName (O));
+ }
+ return CollAtUnchecked (&O->Scopes, Id);
+}
+
+
+
+unsigned ObjDataCount (void)
+/* Return the total number of modules */
+{
+ return CollCount (&ObjDataList);
+}
+
+
+
+void PrintDbgModules (FILE* F)
+/* Output the modules to a debug info file */
+{
+ unsigned I;
+
+ /* Output modules */
+ for (I = 0; I < CollCount (&ObjDataList); ++I) {
+
+ /* Get this object file */
+ const ObjData* O = CollConstAt (&ObjDataList, I);
+
+ /* The main source file is the one at index zero */
+ const FileInfo* Source = CollConstAt (&O->Files, 0);
+
+ /* Output the module line */
+ fprintf (F,
+ "mod\tid=%u,name=\"%s\",file=%u",
+ I,
+ GetObjFileName (O),
+ Source->Id);
+
+ /* Add library if any */
+ if (O->Lib != 0) {
+ fprintf (F, ",lib=%u", GetLibId (O->Lib));
+ }
+
+ /* Terminate the output line */
+ fputc ('\n', F);
+ }
+