import.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* import.c: Routines for object file imports
  2. Copyright (C) 2003 Sebastian Reichelt
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #include "import.h"
  15. #ifdef COFF_SUPPORT
  16. #include "../../formats/coff.h"
  17. #include "imp_coff.h"
  18. #endif /* COFF_SUPPORT */
  19. #ifdef AMIGAOS_SUPPORT
  20. #include "../../formats/amigaos.h"
  21. #include "imp_amig.h"
  22. #endif /* AMIGAOS_SUPPORT */
  23. // Import an object file with an arbitrary format.
  24. BOOLEAN ArImportObjectFile (OBJECT_FILE *ObjectFile)
  25. {
  26. if (!(ObjectFile->Data))
  27. return FALSE;
  28. #ifdef COFF_SUPPORT
  29. if (IsCOFFFile (ObjectFile->Data, ObjectFile->Size))
  30. return (ArImportCOFFFile (ObjectFile));
  31. else
  32. #endif /* COFF_SUPPORT */
  33. #ifdef AMIGAOS_SUPPORT
  34. if (IsAmigaOSFile (ObjectFile->Data, ObjectFile->Size))
  35. return (ArImportAmigaOSFile (ObjectFile));
  36. else
  37. #endif /* AMIGAOS_SUPPORT */
  38. {
  39. Warning (ObjectFile->FileName, "Unknown object file format.");
  40. return FALSE;
  41. }
  42. }