<%
'==================================
'this file is used default.asp
'located in this folder.
'==================================

globals_init
Server.ScriptTimeOut = 120

dim file_to_save, proceed
proceed=false   'true means "execute result"


'set_debug   
source = ""
if file_to_read = "" then _
   file_to_read  = request.QueryString("source")
if file_to_read = "" then 
   source = request.QueryString("source_text")
   if source = "" then 
      source = request.form("source_text")
         if source = "" then
                'giving up. psee readme.
                file_to_read = "readme.txt"
         	source = read_file ( file_to_read )  
         end if
   end if
else
  file_to_read = replace(file_to_read,"/","\")
  source = read_file ( file_to_read )  
end if
  
'WORK WITH "ESTABLISHED" FILE:
'"normal" means normal conversion:
file_to_save  = get_file_to_save(file_to_read, "normal") ' "sml")

if file_to_read <> "" then 
   if request.QueryString("do") = "now" then  proceed = true 
   source = read_file ( file_to_read )
   if trim(source) = "" then stope "no text is read into source text from file " _
      & file_to_read 
end if




compile_schema path_to_web_sml_engine ' & "\" & "schema.txt"
'"not" below triggers immidiate output:
compile_source(not (proceed_result_file and  proceed))
tt = tt & t




if not (proceed_result_file and  proceed) then _
   response.write t
if save_result_file and file_to_read <> ""  then 
   'HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
    write_file file_to_save, tt 
   'HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
   if proceed_result_file and proceed then 
      response.redirect file_to_save
     'HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
   else
      response.write ve & ve & vh & vh & _
        "~~~~~~~~~~~ short-ml-translator message ~~~~~~~~~~~" & _
        vh & "file `" & file_to_save & "` " & vh & _
        "has been saved on disk." & vh & _
        "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 
   end if
end if
%>