<%

'OUTPUT STREAM
sub outs(s)
    response.write s       
end sub

'sometimes useful:
sub rw(s)
    response.write s
end sub

sub set_debug()
       if not html_header_sent then
          outs "<html><head><title>short scripts tracing ... </title></head><body bgcolor=#0000BB text=#AAFFAA ><pre>"
          html_header_sent = true
       end if
	 deb    = true
end sub

sub debl(s)
       if deb then outs s & ve
end sub

' short is source text which may be cutting when taking lines, and tockens

' service subroutines
sub PrintS(s)
     outs s
end sub

sub PrintL(s)
     outs s & ve
end sub

sub StopP
    if html_header_sent then outs "</body></html>"
    Response.End
end sub

' other programs can mess with t ...
sub stope(s)
       if not html_header_sent then set_debug
       outs s & vh & "<b>Exception message completed." 
	 outs "</b></pre></body></html>"
       response.end
end sub


' pretty much garbage here ...
' make proper extentions to save file and so on ...
' this function  only changes an extention ...
' input: choice =  sml for normal convertion to asp, txt, ...
'			 sst for unusual convertion
function get_file_to_save(given_path,choice)
   dim s, wi, ws, wss
   get_file_to_save = ""
   if given_path = "" then exit function

   s = given_path
   ws  = ""						' current extention

   wi = instrrev(s,".")				' try to get an extention
   if wi = 0 then 
      wi = len(s) + 1				' no dots; string end is terminator
      ws = ""
   else
      ws = mid(s,wi+1)
      if instr(ws,"\") > 0 then 		' if "..\.\ " then
	   wi = len(s) + 1
         ws = ""
      end if
   end if
  
 'ws is an extention now; without ".";

 wss = "htm"					' result extention by default 
 if choice = "normal" then
    'this is "normal" conversion:
    if ws <> "txt" then wss = ws
 elseif choice = "sml" then
     select case mid(ws,2,1)			' ... with what extention to save on disk ...
          case "a" : wss="asp"
          case "h" : wss="htm"
          case "t" : wss="txt"
          case "p" : wss="php"
          case "i" : wss="inc"
     end select 
 elseif choice = "sst" then
     wss = "txt"					' result extention by default 
     select case mid(ws,1,1)			' ... with what extention to save on disk ...
          case "f" : wss="sa"		' for form.frm
          case "c" : wss="sa"		' cor class.cls
          case "t" : wss="txt"
          case "a" : wss="asp"
          case "h" : wss="htm"
          case "p" : wss="php"
          case "i" : wss="inc"
     end select 
 end if 

   get_file_to_save = mid(s,1,wi-1) & "." & wss		' to make html-extention
   if deb then printl "file_to_save=" & get_file_to_save
   
end function


%>