Example #1
0
/* Ensure that the directories we need exist and are empty.
 *
 * Our base directory has the name:
 *    output/progname-docs/
 * where output/progname is the executable we are producing (without any
 * extension).
 *
 * Within this base directory we have the following:
 *    mkdocs.yml
 *    docs/
 *      *.md
 */
static void doc_setup_dirs(docgen_t* docgen, ast_t* program, pass_opt_t* opt)
{
  assert(docgen != NULL);
  assert(program != NULL);
  assert(opt != NULL);

  // First build our directory strings
  const char* output = opt->output;
  const char* progname = package_filename(ast_child(program));

  docgen->base_dir = doc_cat(output, "/", progname, "-docs/", "",
    &docgen->base_dir_buf_len);

  docgen->sub_dir = doc_cat(docgen->base_dir, "docs/", "", "", "",
    &docgen->sub_dir_buf_len);

  printf("Writing docs to %s\n", docgen->base_dir);

  // Create and clear out base directory
  pony_mkdir(docgen->base_dir);
  doc_rm_star(docgen->base_dir);

  // Create and clear out sub directory
  pony_mkdir(docgen->sub_dir);
  doc_rm_star(docgen->sub_dir);
}
Example #2
0
bool codegen(ast_t* program, pass_opt_t* opt)
{
  if(opt->verbosity >= VERBOSITY_MINIMAL)
    fprintf(stderr, "Generating\n");

  pony_mkdir(opt->output);

  compile_t c;
  memset(&c, 0, sizeof(compile_t));

  genned_strings_init(&c.strings, 64);
  ffi_decls_init(&c.ffi_decls, 64);

  if(!init_module(&c, program, opt))
    return false;

  init_runtime(&c);
  genprim_reachable_init(&c, program);

  bool ok;

  if(c.opt->library)
    ok = genlib(&c, program);
  else
    ok = genexe(&c, program);

  codegen_cleanup(&c);
  return ok;
}
Example #3
0
File: codegen.c Project: dckc/ponyc
bool codegen(ast_t* program, pass_opt_t* opt)
{
  printf("Generating\n");
  pony_mkdir(opt->output);

  compile_t c;
  memset(&c, 0, sizeof(compile_t));

  init_module(&c, program, opt);
  init_runtime(&c);
  genprim_builtins(&c);

  // Emit debug info for this compile unit.
  dwarf_init(&c.dwarf, c.opt, c.builder, c.target_data, c.module);
  dwarf_compileunit(&c.dwarf, program);

  bool ok;

  if(c.opt->library)
    ok = genlib(&c, program);
  else
    ok = genexe(&c, program);

  codegen_cleanup(&c);
  return ok;
}
Example #4
0
bool codegen(ast_t* program, pass_opt_t* opt)
{
  PONY_LOG(opt, VERBOSITY_MINIMAL, ("Generating\n"));

  pony_mkdir(opt->output);

  compile_t c;
  memset(&c, 0, sizeof(compile_t));

  init_module(&c, program, opt);
  init_runtime(&c);
  genprim_reachable_init(&c, program);

  bool ok;

  if(c.opt->library)
    ok = genlib(&c, program);
  else
    ok = genexe(&c, program);

  codegen_cleanup(&c);
  return ok;
}