'ALLPROGS - listing of ALL menu based program

external   dpath messboxwait() vloadif()

external   strtoary() fgi bgi fgp bgp progress() progtag() sch scw
external   messbox() remove() vunloadif()

public     ptary[1] ptval $file #rec_st #rec_fin ptstr

global     names i nextproj firstline x  $files nextdrive #line #f
global     currview f $filename
global     $module $c $out y $content ListProgs()


MAIN
single-step off
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
'   quiet off
  error off
  remove("output.txt")
  fopen "allprogs.txt" as 4
  while eof(4) = 0
    fread 4 into $file                  'message "$file) is:"&str($file)
    x = ListProgs()
'     if x = 0
'       fwrite 2 from "View has a date field width 8"
'     elseif x = 1
'       fwrite 2 from "NO date field"
'     elseif x = -1
'       fwrite 2 from "Cannot load View"
'     end if
  end while
  fclose 4
  fclose 2
  fclose 1
' message "Listing in `DATELIST.TXT'"
END MAIN


FUNCTION ListProgs()
  progress(15,9," ˙˙˙˙˙˙˙˙˙Listing Programs ˙˙˙˙˙˙˙˙˙˙˙˙",1)
  progtag(fgi,bgi,$file)
'   messboxwait(" Listing program:"&$file,0,0,1)
  fopen $file as 1
  fopen "output.txt" as 2
  fseek 2 EOF
  fwrite 2 from $file
  while not(eof(1))
    fread 1 into $content             'message "$content) is:"&str($content)
    if left($content,1)="'"
      continue while
    elseif left($content,8)="external"
      continue while
    elseif $content ! "message"
'       if $content ! ".dfq"
'         continue while
'       end if
'     elseif $content ! ".dfw"
'     elseif $content ! "vloadif("
'     elseif $content ! "execute"
'       if $content ! "in-memory"
        fwrite 2 from $content
'       end if
    end if
  end while
  fclose 1
  fclose 2
END FUNCTION ' ListInMemory()
