static int loop(struct walker *walker) { struct object_list *elem; while (process_queue) { struct object *obj = process_queue->item; elem = process_queue; process_queue = elem->next; free(elem); if (!process_queue) process_queue_end = &process_queue; /* If we are not scanning this object, we placed it in * the queue because we needed to fetch it first. */ if (! (obj->flags & TO_SCAN)) { if (walker->fetch(walker, obj->sha1)) { report_missing(obj); return -1; } } if (!obj->type) parse_object(obj->sha1); if (process_object(walker, obj)) return -1; } return 0; }
bool finder_base::validate_memregion(size_t bytes, bool required) const { // make sure we can resolve the full path to the region size_t bytes_found = 0; std::string const region_fulltag(m_base.get().subtag(m_tag)); // look for the region for (device_t const &dev : device_iterator(m_base.get().mconfig().root_device())) { for (romload::region const ®ion : romload::entries(dev.rom_region()).get_regions()) { if (dev.subtag(region.get_tag()) == region_fulltag) { bytes_found = region.get_length(); break; } } if (bytes_found != 0) break; } // check the length and warn if other than specified if ((bytes_found != 0) && (bytes != 0) && (bytes != bytes_found)) { osd_printf_warning("Region '%s' found but has %ld bytes, not %ld as requested\n", m_tag, long(bytes_found), long(bytes)); bytes_found = 0; } return report_missing(bytes_found != 0, "memory region", required); }
void edit_typeset_rep::typeset (SI& x1, SI& y1, SI& x2, SI& y2) { int missing_nr= INT_MAX; int redefined_nr= INT_MAX; while (true) { typeset_sub (x1, y1, x2, y2); if (!env->complete) break; env->complete= false; if (N(env->missing) == 0 && N(env->redefined) == 0) break; if ((N(env->missing) == missing_nr && N(env->redefined) == redefined_nr) || (N(env->missing) > missing_nr || N(env->redefined) > redefined_nr)) { report_missing (env->missing); report_redefined (env->redefined); break; } missing_nr= N(env->missing); redefined_nr= N(env->redefined); ::notify_assign (ttt, path(), ttt->br->st); } }
/* * Add new tests cases here. We increment the test number and pass the * type of ordering we want so that each test can be tested with multiple * ordering values in order to demostrate the difference. * * The return value is cumulative, and serves as a failure count that is * returned at the end of all the tests. */ static int run_test (int& test_number, int ordering) { int retval = 0; ACE_DEBUG ((LM_INFO, " ########## Running Tests with ordering = %C ##########\n", ordering == 1 ? "REQUIRE_ORDER" : ordering == 2 ? "PERMUTE_ARGS" : "RETURN_IN_ORDER")); // Basic test, but don't use the program name and don't skip any args. retval += parse_args (test_number++, ordering, ACE_TEXT ("-f -rreq-arg -oopt-arg -lopt-arg --long_only=lo_arg -s arg1 arg2"), 0); // Same, but combining short args that don't take args retval += parse_args (test_number++, ordering, ACE_TEXT ("-fsrreq-arg -oopt-arg -lopt-arg --long_only=lo_arg arg1 arg2")); // Now we use defaults for options with optional args. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fsrreq-arg -o -l --long_only=lo_arg arg1 arg2")); // Let's mix up the options and non-options an see what happens. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fs arg1 -rreq-arg -o arg2 -l --long_only=lo_arg")); // Now we turn off options parsing explicitely by passing "--" in the middle. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fs -rreq-arg -- arg1 -o arg2 -l --long_only=lo_arg")); // Let's try the same thing but mix up the options and non-options. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fs arg1 arg2 -rreq-arg -- arg3 -o")); // One more time but with "-W". retval += parse_args (test_number++, ordering, ACE_TEXT ("-fs arg1 arg2 -rreq-arg -W long_option=opt-arg -- arg3 -o")); // Let's pass some long options. retval += parse_args (test_number++, ordering, ACE_TEXT ("--flag -s --requires_arg=req-arg --optional_arg --long_only lo_arg arg1 arg2")); // And long options without the '='. retval += parse_args (test_number++, ordering, ACE_TEXT ("--flag -s --requires_arg req-arg --optional_arg --long_only=lo_arg arg1 arg2")); // Pass "-W" to cause the next argument to be read as a long option. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fso -W requires_arg=req-arg -Woptional_arg -l arg1 arg2")); // This is the special case of a non-alpha numeric short option. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fso --non_alpha-num_short=xxx arg1 arg2")); // Now, let's test some error conditions (we turn off report_errors since they are // intentional, we don't want to break the test script) int report_errors = 0; // Bad short option. retval += parse_args (test_number++, ordering, ACE_TEXT ("-X"), 1, report_errors); // Short option with missing required arg. ACE_TString report_missing (ACE_TEXT (":")); retval += parse_args (test_number++, ordering, ACE_TEXT ("-r"), 1, report_errors, report_missing); // Short option with missing required arg with trailing "--". // This reads "--" as the arg, but should it? retval += parse_args (test_number++, ordering, ACE_TEXT ("-r --"), 1, report_errors); // Long option with missing required arg. retval += parse_args (test_number++, ordering, ACE_TEXT ("--long_only"), 1, report_errors); // Long option that doesn't take an arg has one. retval += parse_args (test_number++, ordering, ACE_TEXT ("--long_no_arg=bad_arg"), 1, report_errors); // Unknown long option. retval += parse_args (test_number++, ordering, ACE_TEXT ("--unknown"), 1, report_errors); // Ambigous long option. retval += parse_args (test_number++, ordering, ACE_TEXT ("--long"), 1, report_errors); return retval; }