
'---------------------
'exo2 o2 compiler maker
'=====================

'Charles Pegge
'21 June 2010
'18:19 27/06/2011
'12:24 04/04/2013
'20:10 20/09/2014
'11:20 02/03/2017
'18:20 26/08/2018


 #include "xo2.inc"


  
  '
  'ATTEMPT TO GET FILE
  '===================
  '
  open s for binary access read as 2
  le=lof(2)
  t=string(le,chr(0))
  get #2,,t
  close 2
  '
  u=""
  '
  if swc then
    u+="#file "+qu+mnm+".exe"+qu+cr
  end if
  '
  
  '
  if t="" then
    print "error 3: file empty or not found: "+s
    goto finish
  end if
  '
  t=u+chr(12)+t : p=strptr(t)
  '
  '
  'NORMAL COMPILE
  '==============


  o2_mode(0) 'read/return null terminated ascii strings
  '
  select case swa
  case &h61   : print *o2_prep(p)
  case &h62   : print *o2_view(p)
  case &h69   : print *o2_abst(p)
  case else   : o2_basic(p) 'compile string
  end select
  '
  er=o2_error()
  '
  if len(*er) then
    print cr+ *er
    goto finish
  else
    if swc=0 then o2_exec(0) else print cr+"Okay"
    goto xfinish
  end if

  finish:
  '------


  xfinish:
  '-------
