deps/kb_meme/meme-5.0.1/src/html-monolith.c
/*
 * htmlwr_create
 * Creates a html monolith writer.
 * Takes the directory to search for sources, the name of the primary source.
 * Returns null if the primary source does not exist.
 */
htmlwr_create
Creates a html monolith writer.
Takes the directory to search for sources, the name of the primary source.
Returns null if the primary source does not exist.
htmlwr_create Creates a html monolith writer . Takes the directory to search for sources the name of the primary source . Returns null if the primary source does not exist .
HTMLWR_T* htmlwr_create(const char* search_dir, const char* primary_source, bool minimize) {
  HTMLWR_T *htmlwr;
  char *src_path;
  FILE *src_file;
  src_path = make_path_to_file(search_dir, primary_source);
  src_file = fopen(src_path, "r");
  free(src_path);
  if (!src_file) return NULL;
  htmlwr = mm_malloc(sizeof(HTMLWR_T));
  memset(htmlwr, 0, sizeof(HTMLWR_T));
  htmlwr->minimize = minimize;
  htmlwr->search_dir = strdup(search_dir);
  htmlwr->src = src_file;
  htmlwr->replace = rbtree_create(rbtree_strcmp, rbtree_strcpy, free, rbtree_strcpy, free);
  htmlwr->buffer = buf_create(100);
  buf_flip(htmlwr->buffer); 
  htmlwr->landmarks[0] = bmstr_create(SCRIPT_START);
  htmlwr->landmarks[1] = bmstr_create(LINK_START);
  htmlwr->landmarks[2] = bmstr_create(IMG_START);
  regcomp_or_die("source name", &(htmlwr->source_re), SOURCE_PAT, REG_EXTENDED | REG_NOSUB);
  return htmlwr;
}
HTMLWR_T * htmlwr_create ( const char * search_dir , const char * primary_source , bool minimize ) { HTMLWR_T * htmlwr ; char * src_path ; FILE * src_file ; src_path = make_path_to_file ( search_dir , primary_source ) ; src_file = fopen ( src_path , " " ) ; free ( src_path ) ; if ( ! src_file ) return NULL ; htmlwr = mm_malloc ( sizeof ( HTMLWR_T ) ) ; memset ( htmlwr , 0 , sizeof ( HTMLWR_T ) ) ; htmlwr -> minimize = minimize ; htmlwr -> search_dir = strdup ( search_dir ) ; htmlwr -> src = src_file ; htmlwr -> replace = rbtree_create ( rbtree_strcmp , rbtree_strcpy , free , rbtree_strcpy , free ) ; htmlwr -> buffer = buf_create ( 100 ) ; buf_flip ( htmlwr -> buffer ) ; htmlwr -> landmarks [ 0 ] = bmstr_create ( SCRIPT_START ) ; htmlwr -> landmarks [ 1 ] = bmstr_create ( LINK_START ) ; htmlwr -> landmarks [ 2 ] = bmstr_create ( IMG_START ) ; regcomp_or_die ( " " , & ( htmlwr -> source_re ) , SOURCE_PAT , REG_EXTENDED | REG_NOSUB ) ; return htmlwr ; }
htmlwr_create
 Creates a html monolith writer.
htmlwr_create Creates a html monolith writer .
// prepare for read