pike.git / bin / autodoc_images.pike

version» Context lines:

pike.git/bin/autodoc_images.pike:1:   string copy_to = "manual/images"; + #define DEBUG    - void parse_directory(string directory) { -  werror("autodoc_images: Entering %s...\n", directory); -  array(string) files = get_dir(directory); -  foreach(files, string file) { -  // werror("%O\n", directory+file); -  if(file_stat(directory+file)->isdir) { -  parse_directory(directory+file+"/"); -  continue; -  } -  if(!has_suffix(file, ".xml")) -  continue; + void parse_file(string file) { +     if(file=="sub_manual.xml") -  continue; +  return; +  +  string dir = getcwd()+"/"+dirname(file)+"/"; +     string x,y; -  y = Stdio.read_file(directory+file); +  y = Stdio.read_file(file);   #ifdef DEBUG    array err = catch {    x = Tools.AutoDoc.ProcessXML.moveImages -  (y, directory, copy_to); +  (y, dir, copy_to);    };    if(!err) {    if(x!=y) -  Stdio.write_file(directory+file, x); +  Stdio.write_file(file, x);    } -  else +  else { +  if(objectp(err) && _typeof(err) <= Tools.AutoDoc.AutoDocError) +  werror("%O\n", err); +  else if(arrayp(err))    werror(describe_backtrace(err)); -  +  else +  werror("%O\n", err); +  }   #else    x = Tools.AutoDoc.ProcessXML.moveImages -  (Stdio.read_file(directory+file), directory, copy_to); +  (Stdio.read_file(file), dir, copy_to);    if(x!=y)    Stdio.write_file(directory+file, x);   #endif   } - } +          int main(int num, array(string) args) {       if(num<3) throw( "Not enough arguments to autodoc_images.pike\n" ); -  copy_to = args[2]; -  parse_directory( args[1] ); +  copy_to = args[1]; +  foreach(args[2..], string file) +  parse_file( file );      }