HTML-Template-Pro

 view release on metacpan or  search on metacpan

procore.c  view on Meta::CPAN

  int retval = 0;
  const char* saved_masterpath;
  /* 
   * param->masterpath is path to upper level template 
   * (or NULL in toplevel) which called <include filename>.
   * we use it to calculate filepath for filename.
   * Then filename becames upper level template for its <include>.
   */
  const char* filepath=(param->FindFileFuncPtr)(param->ext_findfile_state,filename, param->masterpath);
  if (NULL==filepath) return ERR_PRO_FILE_NOT_FOUND;
  /* filepath should be alive for every nested template */
  filepath = strdup(filepath);
  if (NULL==filepath) return ERR_PRO_NOT_ENOUGH_MEMORY;
  saved_masterpath=param->masterpath; /* saving current file name */
  param->masterpath=filepath;
  if (param->filters) memarea=(param->LoadFileFuncPtr)(param->ext_filter_state,filepath);
  else memarea=mmap_load_file(filepath);
  if (memarea.begin == NULL) {
    retval = ERR_PRO_CANT_OPEN_FILE;
    goto cleanup_filepath;
  }



( run in 0.934 second using v1.01-cache-2.11-cpan-71847e10f99 )