Previous 199869 Revisions Next

r31997 Monday 8th September, 2014 at 18:46:40 UTC by Oliver Stöneberg
moved tagged_list:: out of tagged_list to make it catch-able / handle add_exception / updated exception handling unidasm to match the main one and return a proper exitcode in case of an error (nw)
[src/emu]clifront.c machine.c
[src/lib/util]tagmap.h
[src/tools]unidasm.c

trunk/src/tools/unidasm.c
r31996r31997
644644   catch (emu_fatalerror &fatal)
645645   {
646646      fprintf(stderr, "%s\n", fatal.string());
647      result = 1;
647648      if (fatal.exitcode() != 0)
648649         result = fatal.exitcode();
649650   }
650651   catch (emu_exception &)
651652   {
652653      fprintf(stderr, "Caught unhandled emulator exception\n");
654      result = 1;
653655   }
654   catch (std::bad_alloc &)
656   catch (add_exception &aex)
655657   {
656      fprintf(stderr, "Out of memory!\n");
658      fprintf(stderr, "Tag '%s' already exists in tagged_list\n", aex.tag());
659      result = 1;
657660   }
661   catch (std::exception &ex)
662   {
663      fprintf(stderr, "Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what());
664      result = 1;
665   }
658666   catch (...)
659667   {
660668      fprintf(stderr, "Caught unhandled exception\n");
669      result = 1;
661670   }
662671
663672   osd_free(data);
trunk/src/emu/clifront.c
r31996r31997
274274      osd_printf_error("Caught unhandled emulator exception\n");
275275      m_result = MAMERR_FATALERROR;
276276   }
277   catch (add_exception &aex)
278   {
279      osd_printf_error("Tag '%s' already exists in tagged_list\n", aex.tag());
280      m_result = MAMERR_FATALERROR;
281   }
277282   catch (std::exception &ex)
278283   {
279284      osd_printf_error("Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what());
trunk/src/emu/machine.c
r31996r31997
414414      osd_printf_error("Error performing a late bind of type %s to %s\n", btex.m_actual_type.name(), btex.m_target_type.name());
415415      error = MAMERR_FATALERROR;
416416   }
417   catch (add_exception &aex)
418   {
419      osd_printf_error("Tag '%s' already exists in tagged_list\n", aex.tag());
420      error = MAMERR_FATALERROR;
421   }
417422   catch (std::exception &ex)
418423   {
419424      osd_printf_error("Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what());
trunk/src/lib/util/tagmap.h
r31996r31997
194194
195195// ======================> tagged_list
196196
197class add_exception
198{
199public:
200   add_exception(const char *tag) : m_tag(tag) { }
201   const char *tag() const { return m_tag; }
202private:
203   const char *m_tag;
204};
205
197206// a tagged_list is a class that maintains a list of objects that can be quickly looked up by tag
198207template<class _ElementType>
199208class tagged_list
r31996r31997
203212   tagged_list &operator=(const tagged_list &);
204213
205214public:
206   class add_exception
207   {
208   public:
209      add_exception(const char *tag) : m_tag(tag) { }
210      const char *tag() const { return m_tag; }
211   private:
212      const char *m_tag;
213   };
214
215215   // construction
216216   tagged_list() { }
217217

Previous 199869 Revisions Next


© 1997-2024 The MAME Team