예제 #1
0
static void dot_commit_graph(git_commit *c, rev_ref *branch)
{
    rev_file	*f;

    printf("\"");
    if (branch)
	dot_ref_name(stdout, branch);
//    if (c->tail)
//	printf("*** TAIL");
    printf("\\n");
    printf("%s\\n", ctime_nonl(&c->date));
    dump_log(stdout, c->log);
    printf("\\n");
    if (difffiles) {
	rev_diff    *diff = git_commit_diff(c->parent, c);
	rev_file_list   *fl;

	for (fl = diff->add; fl; fl = fl->next) {
	    if (!rev_file_list_has_filename(diff->del, fl->file->file_name)) {
		printf("+");
		dump_number(fl->file->file_name, &fl->file->number);
		printf("\\n");
	    }
	}
	for (fl = diff->add; fl; fl = fl->next) {
	    if (rev_file_list_has_filename(diff->del, fl->file->file_name)) {
		printf("|");
		dump_number(fl->file->file_name, &fl->file->number);
		printf("\\n");
	    }
	}
	for (fl = diff->del; fl; fl = fl->next) {
	    if (!rev_file_list_has_filename(diff->add, fl->file->file_name)) {
		printf("-");
		dump_number(fl->file->file_name, &fl->file->number);
		printf("\\n");
	    }
	}
	rev_diff_free(diff);
    } else {
	int		i, j;
	for (i = 0; i < c->ndirs; i++) {
	    rev_dir *dir = c->dirs[i];
	    for (j = 0; j < dir->nfiles; j++) {
		 f = dir->files[j];
		 dump_number(f->file_name, &f->number);
		 printf("\\n");
	    }
	}
    }
    printf("%p", c);
    printf("\"");
}
예제 #2
0
파일: main.cpp 프로젝트: Beej126/Karabiner
int main(int argc, const char* argv[]) {
  if (argc != 4) {
    std::cerr << "Usage: " << argv[0] << " system_xml_directory private_xml_directory command" << std::endl
              << std::endl
              << "Example: " << argv[0]
              << " /Applications/Karabiner.app/Contents/Resources"
              << " ~/Library/Application\\ Support/Karabiner"
              << " dump_data"
              << std::endl;
    exit(1);
  }

  pqrs::xml_compiler xml_compiler(argv[1], argv[2]);
  xml_compiler.reload();
  if (xml_compiler.get_error_information().get_count() > 0) {
    std::cerr << xml_compiler.get_error_information().get_message() << std::endl;
    exit(1);
  }

  std::string command(argv[3]);

  if (command == "dump_data") {
    auto v = xml_compiler.get_remapclasses_initialize_vector().get();
    for (auto& it : v) {
      std::cout << it << std::endl;
    }

  } else if (command == "dump_tree") {
    dump_tree(xml_compiler.get_preferences_checkbox_node_tree(), false);
    std::cout << std::endl;
    std::cout << std::endl;
    std::cout << "Total items: " << total_identifier_count_ << std::endl;

  } else if (command == "dump_tree_all") {
    dump_tree(xml_compiler.get_preferences_checkbox_node_tree(), true);
    std::cout << std::endl;
    std::cout << std::endl;
    std::cout << "Total items: " << total_identifier_count_ << std::endl;

  } else if (command == "dump_number") {
    dump_number(xml_compiler.get_preferences_number_node_tree());

  } else if (command == "dump_identifier_except_essential") {
    for (int i = 0;; ++i) {
      auto identifier = xml_compiler.get_identifier(i);
      if (!identifier) break;

      std::cout << *identifier << std::endl;
    }

  } else if (command == "dump_symbol_map") {
    xml_compiler.get_symbol_map().dump();

  } else if (command == "output_bridge_essential_configuration_enum_h") {
    std::cout << "enum {" << std::endl;

    for (size_t i = 0;; ++i) {
      auto essential_configuration = xml_compiler.get_essential_configuration(i);
      if (!essential_configuration) {
        std::cout << "BRIDGE_ESSENTIAL_CONFIG_INDEX__END__ = " << i << std::endl;
        break;
      }

      std::cout << "BRIDGE_ESSENTIAL_CONFIG_INDEX_" << essential_configuration->get_identifier()
                << " = " << i << ","
                << std::endl;
    }

    std::cout << "};" << std::endl;

  } else if (command == "output_bridge_essential_configuration_default_values_c") {
    for (size_t i = 0;; ++i) {
      auto essential_configuration = xml_compiler.get_essential_configuration(i);
      if (!essential_configuration) {
        break;
      }
      std::cout << essential_configuration->get_default_value()
                << ","
                << std::endl;
    }

  } else if (command == "output_bridge_essential_configuration_identifiers_m") {
    for (size_t i = 0;; ++i) {
      auto essential_configuration = xml_compiler.get_essential_configuration(i);
      if (!essential_configuration) {
        std::cout << "nil" << std::endl;
        break;
      }

      std::cout << "@\"" << essential_configuration->get_raw_identifier() << "\""
                << ","
                << std::endl;
    }
  }

  return 0;
}