'COMP_ALL - compile all files in directory
external   strtoary() fgi bgi fgp bgp progress() progtag() sch scw vloadif()
external   messbox() remove()

public     ptary[1] ptval $file #rec_st #rec_fin ptstr

global     names i nextproj firstline x  $files nextdrive
global     $module $c CompileFiles()


MAIN
  single-step off
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
'   quiet off
  error off
  remove("*.rf3")
  remove("programs.txt")
  remember tools compile debug "comp_all.pf3"
  messbox(" Compile with DEBUG ON? (y/n) ",1,1,1)
  if ptstr == "y"
    $c = "Y"
  else
    $c = "N"
  end if
  tools os "dir C:\SW2K_NEW\programs\*.pf3 /O:N /B > C:\SW2K_NEW\programs\programs.txt"
  progress(fgp,bgp," Reading program files ",0)
  fopen "programs.txt" as 4
  while eof(4) = 0
    fread 4 into $file
message "$file is:"&str($file)
    CompileFiles()
  end while
  fclose 4
END MAIN


FUNCTION CompileFiles()
local $module  y y1 y2 $filename
  if $c = "Y"
    remember tools compile debug $file
    if cerror
      message $file|"not compiled"
    end if
    progress(fgp,bgp," Compiling program files - debug ON ",1)
    progtag(fgi,bgi,$file)
  else
    remember tools compile no-debug $file
    if cerror
      message $file|"not compiled"
    end if
    progress(fgp,bgp," Compiling program files - debug OFF ",1)
    progtag(fgi,bgi,$file)
  end if
END FUNCTION ' CompileFiles()

